Version 15.93.4

This commit is contained in:
Antonio Cañas Vargas 2016-01-03 17:34:06 +01:00
parent 880f8ce7b4
commit 2bb3913249
4 changed files with 29 additions and 19 deletions

View File

@ -921,6 +921,7 @@ CREATE TABLE IF NOT EXISTS social_notes (
UsrCod INT NOT NULL, UsrCod INT NOT NULL,
HieCod INT NOT NULL DEFAULT -1, HieCod INT NOT NULL DEFAULT -1,
Cod INT NOT NULL DEFAULT -1, Cod INT NOT NULL DEFAULT -1,
Unavailable ENUM('N','Y') NOT NULL DEFAULT 'N',
TimeNote DATETIME NOT NULL, TimeNote DATETIME NOT NULL,
UNIQUE INDEX(NotCod), UNIQUE INDEX(NotCod),
INDEX(SocialNote), INDEX(SocialNote),

View File

@ -125,7 +125,10 @@
// Number of lines (includes comments but not blank lines) has been got with the following command: // Number of lines (includes comments but not blank lines) has been got with the following command:
// nl swad*.c swad*.h css/swad*.css py/swad*.py js/swad*.js soap/swad*.h sql/swad*.sql | tail -1 // nl swad*.c swad*.h css/swad*.css py/swad*.py js/swad*.js soap/swad*.h sql/swad*.sql | tail -1
/* /*
Version 15.93.4: Jan 03, 2016 Changes in links to actions in social timeline. (190345 lines) Version 15.93.4: Jan 03, 2016 Changes in links to actions in social timeline. (190353 lines)
1 change necessary in database:
ALTER TABLE social_notes ADD COLUMN Unavailable ENUM('N','Y') NOT NULL DEFAULT 'N' AFTER Cod;
Version 15.93.3: Jan 03, 2016 Code refactoring in file browser related with file metadata. (190345 lines) Version 15.93.3: Jan 03, 2016 Code refactoring in file browser related with file metadata. (190345 lines)
Version 15.93.2: Jan 03, 2016 To show a file in social timeline, file code is passed as parameter instead of path. (190360 lines) Version 15.93.2: Jan 03, 2016 To show a file in social timeline, file code is passed as parameter instead of path. (190360 lines)
Version 15.93.1: Jan 03, 2016 Show text indicating document not available in social note. (190358 lines) Version 15.93.1: Jan 03, 2016 Show text indicating document not available in social note. (190358 lines)

View File

@ -1938,17 +1938,17 @@ mysql> DESCRIBE sessions;
/***** Table social_notes *****/ /***** Table social_notes *****/
/* /*
mysql> DESCRIBE social_notes; mysql> DESCRIBE social_notes;
+----------+------------+------+-----+---------+----------------+ +-------------+---------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra | | Field | Type | Null | Key | Default | Extra |
+----------+------------+------+-----+---------+----------------+ +-------------+---------------+------+-----+---------+----------------+
| NotCod | bigint(20) | NO | PRI | NULL | auto_increment | | NotCod | bigint(20) | NO | PRI | NULL | auto_increment |
| NoteType | tinyint(4) | NO | MUL | NULL | | | NoteType | tinyint(4) | NO | MUL | NULL | |
| UsrCod | int(11) | NO | MUL | NULL | | | UsrCod | int(11) | NO | MUL | NULL | |
| HieCod | int(11) | NO | | -1 | | | HieCod | int(11) | NO | | -1 | |
| DegCod | int(11) | NO | | -1 | | | Cod | int(11) | NO | | -1 | |
| Cod | int(11) | NO | | -1 | | | Unavailable | enum('N','Y') | NO | | N | |
| TimeNote | datetime | NO | MUL | NULL | | | TimeNote | datetime | NO | MUL | NULL | |
+----------+------------+------+-----+---------+----------------+ +-------------+---------------+------+-----+---------+----------------+
7 rows in set (0.00 sec) 7 rows in set (0.00 sec)
*/ */
DB_CreateTable ("CREATE TABLE IF NOT EXISTS social_notes (" DB_CreateTable ("CREATE TABLE IF NOT EXISTS social_notes ("
@ -1957,6 +1957,7 @@ mysql> DESCRIBE social_notes;
"UsrCod INT NOT NULL," "UsrCod INT NOT NULL,"
"HieCod INT NOT NULL DEFAULT -1," "HieCod INT NOT NULL DEFAULT -1,"
"Cod INT NOT NULL DEFAULT -1," "Cod INT NOT NULL DEFAULT -1,"
"Unavailable ENUM('N','Y') NOT NULL DEFAULT 'N',"
"TimeNote DATETIME NOT NULL," "TimeNote DATETIME NOT NULL,"
"UNIQUE INDEX(NotCod)," "UNIQUE INDEX(NotCod),"
"INDEX(NoteType)," "INDEX(NoteType),"

View File

@ -109,8 +109,9 @@ struct SocialNote
long NotCod; long NotCod;
Soc_NoteType_t NoteType; Soc_NoteType_t NoteType;
long UsrCod; long UsrCod;
long HieCod; // Hierarchy code (institution/centre/degree/course) long HieCod; // Hierarchy code (institution/centre/degree/course)
long Cod; // Code of file, forum post, notice,... long Cod; // Code of file, forum post, notice,...
bool Unavailable; // File, forum post, notice,... unavailable (removed)
time_t DateTimeUTC; time_t DateTimeUTC;
}; };
@ -767,8 +768,8 @@ void Soc_StoreAndPublishSocialNote (Soc_NoteType_t NoteType,long Cod)
/***** Store social note *****/ /***** Store social note *****/
sprintf (Query,"INSERT INTO social_notes" sprintf (Query,"INSERT INTO social_notes"
" (NoteType,UsrCod,HieCod,Cod,TimeNote)" " (NoteType,UsrCod,HieCod,Cod,Unavailable,TimeNote)"
" VALUES ('%u','%ld','%ld','%ld',NOW())", " VALUES ('%u','%ld','%ld','%ld','N',NOW())",
(unsigned) NoteType,Gbl.Usrs.Me.UsrDat.UsrCod,HieCod,Cod); (unsigned) NoteType,Gbl.Usrs.Me.UsrDat.UsrCod,HieCod,Cod);
SocPub.NotCod = DB_QueryINSERTandReturnCode (Query,"can not create new social note"); SocPub.NotCod = DB_QueryINSERTandReturnCode (Query,"can not create new social note");
@ -1489,7 +1490,7 @@ static void Soc_GetDataOfSocialNoteByCod (struct SocialNote *SocNot)
MYSQL_ROW row; MYSQL_ROW row;
/***** Get data of social note from database *****/ /***** Get data of social note from database *****/
sprintf (Query,"SELECT NotCod,NoteType,UsrCod,HieCod,Cod,UNIX_TIMESTAMP(TimeNote)" sprintf (Query,"SELECT NotCod,NoteType,UsrCod,HieCod,Cod,Unavailable,UNIX_TIMESTAMP(TimeNote)"
" FROM social_notes" " FROM social_notes"
" WHERE NotCod='%ld'", " WHERE NotCod='%ld'",
SocNot->NotCod); SocNot->NotCod);
@ -1506,6 +1507,7 @@ static void Soc_GetDataOfSocialNoteByCod (struct SocialNote *SocNot)
SocNot->UsrCod = -1L; SocNot->UsrCod = -1L;
SocNot->HieCod = -1L; SocNot->HieCod = -1L;
SocNot->Cod = -1L; SocNot->Cod = -1L;
SocNot->Unavailable = false;
SocNot->DateTimeUTC = (time_t) 0; SocNot->DateTimeUTC = (time_t) 0;
} }
} }
@ -1531,8 +1533,11 @@ static void Soc_GetDataOfSocialNoteFromRow (MYSQL_ROW row,struct SocialNote *Soc
/* Get file/post... code (row[4]) */ /* Get file/post... code (row[4]) */
SocNot->Cod = Str_ConvertStrCodToLongCod (row[4]); SocNot->Cod = Str_ConvertStrCodToLongCod (row[4]);
/* Get time of the note (row[5]) */ /* File/post... unavailable (row[5]) */
SocNot->DateTimeUTC = Dat_GetUNIXTimeFromStr (row[5]); SocNot->Unavailable = (Str_ConvertToUpperLetter (row[5][0]) == 'Y');
/* Get time of the note (row[6]) */
SocNot->DateTimeUTC = Dat_GetUNIXTimeFromStr (row[6]);
} }
/*****************************************************************************/ /*****************************************************************************/