mirror of https://github.com/acanas/swad-core.git
Version 14.63
This commit is contained in:
parent
167fb7eb78
commit
39ffbde5c3
|
@ -10472,3 +10472,7 @@ ALTER TABLE files ADD COLUMN DegCod INT NOT NULL DEFAULT -1 AFTER CtrCod;
|
|||
DROP INDEX CrsCod ON files;
|
||||
DROP INDEX CrsCod_GrpCod_FileBrowser ON files;
|
||||
CREATE INDEX Location ON files (InsCod,CtrCod,DegCod,CrsCod,GrpCod,FileBrowser);
|
||||
|
||||
----- 2015-01-21, swad14.63
|
||||
|
||||
CREATE TABLE IF NOT EXISTS file_browser_last (UsrCod INT NOT NULL,FileBrowser TINYINT NOT NULL,Cod INT NOT NULL DEFAULT -1,LastClick DATETIME NOT NULL,UNIQUE INDEX(UsrCod,FileBrowser,Cod));
|
||||
|
|
|
@ -473,6 +473,15 @@ CREATE TABLE IF NOT EXISTS expanded_folders (
|
|||
INDEX(DegCod),
|
||||
INDEX(CrsCod));
|
||||
--
|
||||
-- Table file_browser_last: stores the last click of every user in each file browser zone
|
||||
--
|
||||
CREATE TABLE IF NOT EXISTS file_browser_last (
|
||||
"UsrCod INT NOT NULL,
|
||||
"FileBrowser TINYINT NOT NULL,
|
||||
"Cod INT NOT NULL DEFAULT -1,
|
||||
"LastClick DATETIME NOT NULL,
|
||||
"UNIQUE INDEX(UsrCod,FileBrowser,Cod));
|
||||
--
|
||||
-- Table file_browser_size: stores the sizes of the file zones
|
||||
--
|
||||
CREATE TABLE IF NOT EXISTS file_browser_size (
|
||||
|
|
|
@ -39,11 +39,16 @@
|
|||
/****************************** Public constants *****************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
#define Log_PLATFORM_VERSION "SWAD 14.62.3 (2015/01/20)"
|
||||
#define Log_PLATFORM_VERSION "SWAD 14.63 (2015/01/21)"
|
||||
|
||||
// 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 | tail -1
|
||||
/*
|
||||
Version 14.63: Jan 21, 2015 See/admin documents of degree, centre and institution. (175512 lines)
|
||||
1 change necessary in database:
|
||||
CREATE TABLE IF NOT EXISTS file_browser_last (UsrCod INT NOT NULL,FileBrowser TINYINT NOT NULL,Cod INT NOT NULL DEFAULT -1,LastClick DATETIME NOT NULL,UNIQUE INDEX(UsrCod,FileBrowser,Cod));
|
||||
|
||||
Version 14.62.4: Jan 20, 2015 Fixed bug in search of courses. (175443 lines)
|
||||
Version 14.62.3: Jan 20, 2015 See/admin documents of degree, centre and institution (not finished). (? lines)
|
||||
Version 14.62.2: Jan 20, 2015 See/admin documents of degree, centre and institution (not finished). (175407 lines)
|
||||
Version 14.62.1: Jan 20, 2015 See/admin documents of degree, centre and institution (not finished). (175371 lines)
|
||||
|
|
|
@ -998,6 +998,26 @@ mysql> DESCRIBE expanded_folders;
|
|||
"ClickTime DATETIME NOT NULL,"
|
||||
"INDEX(UsrCod,FileBrowser),INDEX(InsCod),INDEX(CtrCod),INDEX(DegCod),INDEX(CrsCod))");
|
||||
|
||||
/***** Table file_browser_last *****/
|
||||
/*
|
||||
mysql> DESCRIBE file_browser_last;
|
||||
+-------------+------------+------+-----+---------+-------+
|
||||
| Field | Type | Null | Key | Default | Extra |
|
||||
+-------------+------------+------+-----+---------+-------+
|
||||
| UsrCod | int(11) | NO | PRI | NULL | |
|
||||
| FileBrowser | tinyint(4) | NO | PRI | NULL | |
|
||||
| Cod | int(11) | NO | PRI | -1 | |
|
||||
| LastClick | datetime | NO | | NULL | |
|
||||
+-------------+------------+------+-----+---------+-------+
|
||||
4 rows in set (0.01 sec)
|
||||
*/
|
||||
DB_CreateTable ("CREATE TABLE IF NOT EXISTS file_browser_last ("
|
||||
"UsrCod INT NOT NULL,"
|
||||
"FileBrowser TINYINT NOT NULL,"
|
||||
"Cod INT NOT NULL DEFAULT -1,"
|
||||
"LastClick DATETIME NOT NULL,"
|
||||
"UNIQUE INDEX(UsrCod,FileBrowser,Cod))");
|
||||
|
||||
/***** Table file_browser_size *****/
|
||||
/*
|
||||
mysql> DESCRIBE file_browser_size;
|
||||
|
|
|
@ -3185,6 +3185,14 @@ static void Brw_UpdateLastAccess (void)
|
|||
/***** Get and update date and hour of last access to file browser *****/
|
||||
switch (Gbl.FileBrowser.Type)
|
||||
{
|
||||
case Brw_FILE_BRW_SEE_DOCUMENTS_INS:
|
||||
case Brw_FILE_BRW_ADMIN_DOCUMENTS_INS:
|
||||
case Brw_FILE_BRW_SEE_DOCUMENTS_CTR:
|
||||
case Brw_FILE_BRW_ADMIN_DOCUMENTS_CTR:
|
||||
case Brw_FILE_BRW_SEE_DOCUMENTS_DEG:
|
||||
case Brw_FILE_BRW_ADMIN_DOCUMENTS_DEG:
|
||||
Brw_GetAndUpdateDateLastAccFileBrowser ("");
|
||||
break;
|
||||
case Brw_FILE_BRW_SEE_DOCUMENTS_CRS:
|
||||
case Brw_FILE_BRW_ADMIN_DOCUMENTS_CRS:
|
||||
Brw_GetAndUpdateDateLastAccFileBrowser ("LastAccDownloadCrs");
|
||||
|
@ -3749,8 +3757,6 @@ void Brw_CreateDirDownloadTmp (void)
|
|||
/* Get and update the date of my last access to file browser in this course **/
|
||||
/*****************************************************************************/
|
||||
|
||||
// TODO: Store last access for institution, centre and degree file browsers
|
||||
|
||||
static void Brw_GetAndUpdateDateLastAccFileBrowser (const char *FieldNameDB)
|
||||
{
|
||||
char Query1[256];
|
||||
|
@ -3762,6 +3768,45 @@ static void Brw_GetAndUpdateDateLastAccFileBrowser (const char *FieldNameDB)
|
|||
/***** Get date of last accesss to a file browser from database *****/
|
||||
switch (Gbl.FileBrowser.Type)
|
||||
{
|
||||
case Brw_FILE_BRW_SEE_DOCUMENTS_INS:
|
||||
case Brw_FILE_BRW_ADMIN_DOCUMENTS_INS:
|
||||
sprintf (Query1,"SELECT UNIX_TIMESTAMP(LastClick) FROM file_browser_last"
|
||||
" WHERE UsrCod='%ld' AND FileBrowser='%u' AND Cod='%ld'",
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||
(unsigned) Brw_FileBrowserForDB[Gbl.FileBrowser.Type],
|
||||
Gbl.CurrentIns.Ins.InsCod);
|
||||
sprintf (Query2,"REPLACE INTO file_browser_last (UsrCod,FileBrowser,Cod,LastClick)"
|
||||
" VALUES ('%ld','%u','%ld',NOW())",
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||
(unsigned) Brw_FileBrowserForDB[Gbl.FileBrowser.Type],
|
||||
Gbl.CurrentIns.Ins.InsCod);
|
||||
break;
|
||||
case Brw_FILE_BRW_SEE_DOCUMENTS_CTR:
|
||||
case Brw_FILE_BRW_ADMIN_DOCUMENTS_CTR:
|
||||
sprintf (Query1,"SELECT UNIX_TIMESTAMP(LastClick) FROM file_browser_last"
|
||||
" WHERE UsrCod='%ld' AND FileBrowser='%u' AND Cod='%ld'",
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||
(unsigned) Brw_FileBrowserForDB[Gbl.FileBrowser.Type],
|
||||
Gbl.CurrentCtr.Ctr.CtrCod);
|
||||
sprintf (Query2,"REPLACE INTO file_browser_last (UsrCod,FileBrowser,Cod,LastClick)"
|
||||
" VALUES ('%ld','%u','%ld',NOW())",
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||
(unsigned) Brw_FileBrowserForDB[Gbl.FileBrowser.Type],
|
||||
Gbl.CurrentCtr.Ctr.CtrCod);
|
||||
break;
|
||||
case Brw_FILE_BRW_SEE_DOCUMENTS_DEG:
|
||||
case Brw_FILE_BRW_ADMIN_DOCUMENTS_DEG:
|
||||
sprintf (Query1,"SELECT UNIX_TIMESTAMP(LastClick) FROM file_browser_last"
|
||||
" WHERE UsrCod='%ld' AND FileBrowser='%u' AND Cod='%ld'",
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||
(unsigned) Brw_FileBrowserForDB[Gbl.FileBrowser.Type],
|
||||
Gbl.CurrentDeg.Deg.DegCod);
|
||||
sprintf (Query2,"REPLACE INTO file_browser_last (UsrCod,FileBrowser,Cod,LastClick)"
|
||||
" VALUES ('%ld','%u','%ld',NOW())",
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||
(unsigned) Brw_FileBrowserForDB[Gbl.FileBrowser.Type],
|
||||
Gbl.CurrentDeg.Deg.DegCod);
|
||||
break;
|
||||
case Brw_FILE_BRW_SEE_DOCUMENTS_CRS:
|
||||
case Brw_FILE_BRW_ADMIN_DOCUMENTS_CRS:
|
||||
case Brw_FILE_BRW_COMMON_CRS:
|
||||
|
@ -10494,7 +10539,7 @@ static void Brw_WriteRowDocData (unsigned *NumDocsNotHidden,MYSQL_ROW row)
|
|||
"</td>",
|
||||
BgColor,++(*NumDocsNotHidden));
|
||||
|
||||
/***** Write degree logo (row[3]), degree short name (row[4]) and centre short name (row[5]) *****/
|
||||
/***** Write degree logo, degree short name (row[3]) and centre short name (row[4]) *****/
|
||||
fprintf (Gbl.F.Out,"<td class=\"DAT\" style=\"text-align:left;"
|
||||
" vertical-align:top; background-color:%s;\">",
|
||||
BgColor);
|
||||
|
@ -10508,11 +10553,11 @@ static void Brw_WriteRowDocData (unsigned *NumDocsNotHidden,MYSQL_ROW row)
|
|||
16,"vertical-align:top;",true);
|
||||
fprintf (Gbl.F.Out," %s (%s)</a>"
|
||||
"</form>",
|
||||
row[4],row[5]);
|
||||
row[3],row[4]);
|
||||
}
|
||||
fprintf (Gbl.F.Out,"</td>");
|
||||
|
||||
/***** Write course short name (row[6]) *****/
|
||||
/***** Write course short name (row[5]) *****/
|
||||
fprintf (Gbl.F.Out,"<td class=\"DAT\" style=\"text-align:left;"
|
||||
" vertical-align:top; background-color:%s;\">",
|
||||
BgColor);
|
||||
|
@ -10520,11 +10565,11 @@ static void Brw_WriteRowDocData (unsigned *NumDocsNotHidden,MYSQL_ROW row)
|
|||
{
|
||||
Act_FormGoToStart (ActSeeCrsInf);
|
||||
Crs_PutParamCrsCod (FileMetadata.CrsCod);
|
||||
sprintf (Gbl.Title,Txt_Go_to_X,row[6]);
|
||||
sprintf (Gbl.Title,Txt_Go_to_X,row[5]);
|
||||
Act_LinkFormSubmit (Gbl.Title,"DAT");
|
||||
fprintf (Gbl.F.Out,"%s</a>"
|
||||
"</form>",
|
||||
row[6]);
|
||||
row[5]);
|
||||
}
|
||||
fprintf (Gbl.F.Out,"</td>");
|
||||
|
||||
|
|
|
@ -760,7 +760,7 @@ static unsigned Sch_SearchOpenDocumentsInDB (const char *RangeQuery)
|
|||
/***** Build the query *****/
|
||||
sprintf (Query,"SELECT files.FilCod,"
|
||||
"SUBSTRING(files.Path,LOCATE('/',files.Path)) AS PathFromRoot,"
|
||||
"degrees.DegCod,degrees.Logo,degrees.ShortName,"
|
||||
"degrees.DegCod,degrees.ShortName,"
|
||||
"centres.ShortName,courses.ShortName"
|
||||
" FROM files,courses,degrees,centres,institutions,countries"
|
||||
" WHERE files.Public='Y' AND %s"
|
||||
|
@ -827,7 +827,7 @@ static unsigned Sch_SearchDocumentsInMyCoursesInDB (const char *RangeQuery)
|
|||
/***** Build the query *****/
|
||||
sprintf (Query,"SELECT files.FilCod,"
|
||||
"SUBSTRING(files.Path,LOCATE('/',files.Path)) AS PathFromRoot,"
|
||||
"degrees.DegCod,degrees.Logo,degrees.ShortName,"
|
||||
"degrees.DegCod,degrees.ShortName,"
|
||||
"centres.ShortName,courses.ShortName"
|
||||
" FROM files,courses,degrees,centres,institutions,countries"
|
||||
" WHERE files.FilCod IN (SELECT FilCod FROM my_files) AND %s"
|
||||
|
@ -881,7 +881,7 @@ static unsigned Sch_SearchMyDocumentsInDB (const char *RangeQuery)
|
|||
"("
|
||||
"SELECT files.FilCod,"
|
||||
"SUBSTRING(files.Path,LOCATE('/',files.Path)) AS PathFromRoot,"
|
||||
"degrees.DegCod,degrees.Logo,degrees.ShortName AS DegShortName,"
|
||||
"degrees.DegCod,degrees.ShortName AS DegShortName,"
|
||||
"centres.ShortName,courses.ShortName AS CrsShortName"
|
||||
" FROM files,courses,degrees,centres,institutions,countries"
|
||||
" WHERE files.PublisherUsrCod='%ld' AND %s"
|
||||
|
@ -894,7 +894,7 @@ static unsigned Sch_SearchMyDocumentsInDB (const char *RangeQuery)
|
|||
" UNION "
|
||||
"SELECT files.FilCod,"
|
||||
"SUBSTRING(files.Path,LOCATE('/',files.Path)) AS PathFromRoot,"
|
||||
"'-1','','' AS DegShortName,'','' AS CrsShortName"
|
||||
"'-1','' AS DegShortName,'','' AS CrsShortName"
|
||||
" FROM files"
|
||||
" WHERE files.PublisherUsrCod='%ld' AND files.FileBrowser='%u' AND %s"
|
||||
") AS my_files"
|
||||
|
@ -905,7 +905,7 @@ static unsigned Sch_SearchMyDocumentsInDB (const char *RangeQuery)
|
|||
else
|
||||
sprintf (Query,"SELECT files.FilCod,"
|
||||
"SUBSTRING(files.Path,LOCATE('/',files.Path)) AS PathFromRoot,"
|
||||
"degrees.DegCod,degrees.Logo,degrees.ShortName,"
|
||||
"degrees.DegCod,degrees.ShortName,"
|
||||
"centres.ShortName,courses.ShortName"
|
||||
" FROM files,courses,degrees,centres,institutions,countries"
|
||||
" WHERE files.PublisherUsrCod='%ld' AND %s"
|
||||
|
|
Loading…
Reference in New Issue