Version 14.66

This commit is contained in:
Antonio Cañas Vargas 2015-01-24 19:30:44 +01:00
parent 5e2be20223
commit ce2ac64ac0
10 changed files with 725 additions and 832 deletions

View File

@ -10482,3 +10482,4 @@ CREATE TABLE IF NOT EXISTS file_browser_last (UsrCod INT NOT NULL,FileBrowser TI
INSERT INTO file_browser_last (UsrCod,FileBrowser,Cod,LastClick) SELECT UsrCod,'9','-1',LastAccBriefcase FROM usr_last WHERE LastAccBriefcase>0;
ALTER TABLE usr_last DROP COLUMN LastAccBriefcase;

View File

@ -172,21 +172,14 @@ CREATE TABLE IF NOT EXISTS clicks_without_photo (
CREATE TABLE IF NOT EXISTS clipboard (
UsrCod INT NOT NULL,
FileBrowser TINYINT NOT NULL,
InsCod INT NOT NULL DEFAULT -1,
CtrCod INT NOT NULL DEFAULT -1,
DegCod INT NOT NULL DEFAULT -1,
CrsCod INT NOT NULL DEFAULT -1,
GrpCod INT NOT NULL,
Cod INT NOT NULL DEFAULT -1,
WorksUsrCod INT NOT NULL,
FileType TINYINT NOT NULL DEFAULT 0,
Path TEXT COLLATE latin1_bin NOT NULL,
CopyTime TIMESTAMP,
UNIQUE INDEX(UsrCod),
INDEX(FileBrowser),
INDEX(InsCod),
INDEX(CtrCod),
INDEX(DegCod),
INDEX(CrsCod));
INDEX(FileBrowser,Cod),
INDEX(WorksUsrCod));
--
-- Table connected: users currently connected to the platform
--
@ -451,19 +444,13 @@ CREATE TABLE IF NOT EXISTS exam_announcements (
CREATE TABLE IF NOT EXISTS expanded_folders (
UsrCod INT NOT NULL,
FileBrowser TINYINT NOT NULL,
InsCod INT NOT NULL DEFAULT -1,
CtrCod INT NOT NULL DEFAULT -1,
DegCod INT NOT NULL DEFAULT -1,
CrsCod INT NOT NULL DEFAULT -1,
GrpCod INT NOT NULL,
Cod INT NOT NULL DEFAULT -1,
WorksUsrCod INT NOT NULL,
Path TEXT COLLATE latin1_bin NOT NULL,
ClickTime DATETIME NOT NULL,
INDEX(UsrCod,FileBrowser),
INDEX(InsCod),
INDEX(CtrCod),
INDEX(DegCod),
INDEX(CrsCod));
INDEX(UsrCod,FileBrowser,Cod),
INDEX(FileBrowser,Cod),
INDEX(WorksUsrCod));
--
-- Table file_browser_last: stores the last click of every user in each file browser zone
--

View File

@ -39,27 +39,59 @@
/****************************** Public constants *****************************/
/*****************************************************************************/
#define Log_PLATFORM_VERSION "SWAD 14.64 (2015/01/22)"
#define Log_PLATFORM_VERSION "SWAD 14.66 (2015/01/24)"
// 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.66: Jan 24, 2015 Changes in clipboard table. (175401 lines)
13 changes necessary in database:
DROP INDEX FileBrowser ON clipboard;
ALTER TABLE clipboard ADD COLUMN Cod INT NOT NULL DEFAULT -1 AFTER FileBrowser, ADD INDEX (FileBrowser,Cod);
CREATE INDEX WorksUsrCod ON clipboard (WorksUsrCod);
UPDATE clipboard SET Cod=InsCod WHERE InsCod>'0';
UPDATE clipboard SET Cod=CtrCod WHERE CtrCod>'0';
UPDATE clipboard SET Cod=DegCod WHERE DegCod>'0';
UPDATE clipboard SET Cod=CrsCod WHERE CrsCod>'0';
UPDATE clipboard SET Cod=GrpCod WHERE GrpCod>'0';
ALTER TABLE clipboard DROP COLUMN InsCod;
ALTER TABLE clipboard DROP COLUMN CtrCod;
ALTER TABLE clipboard DROP COLUMN DegCod;
ALTER TABLE clipboard DROP COLUMN CrsCod;
ALTER TABLE clipboard DROP COLUMN GrpCod;
Version 14.65: Jan 24, 2015 Changes in expanded_folders table. (175394 lines)
13 changes necessary in database:
DROP INDEX UsrCod ON expanded_folders;
ALTER TABLE expanded_folders ADD COLUMN Cod INT NOT NULL DEFAULT -1 AFTER FileBrowser, ADD INDEX (UsrCod,FileBrowser,Cod), ADD INDEX (FileBrowser,Cod);
CREATE INDEX WorksUsrCod ON expanded_folders (WorksUsrCod);
UPDATE expanded_folders SET Cod=InsCod WHERE InsCod>'0';
UPDATE expanded_folders SET Cod=CtrCod WHERE CtrCod>'0';
UPDATE expanded_folders SET Cod=DegCod WHERE DegCod>'0';
UPDATE expanded_folders SET Cod=CrsCod WHERE CrsCod>'0';
UPDATE expanded_folders SET Cod=GrpCod WHERE GrpCod>'0';
ALTER TABLE expanded_folders DROP COLUMN InsCod;
ALTER TABLE expanded_folders DROP COLUMN CtrCod;
ALTER TABLE expanded_folders DROP COLUMN DegCod;
ALTER TABLE expanded_folders DROP COLUMN CrsCod;
ALTER TABLE expanded_folders DROP COLUMN GrpCod;
Version 14.64: Jan 22, 2015 Changes in last accesses to group file browsers. (175510 lines)
6 changes necessary in database:
INSERT INTO file_browser_last (UsrCod,FileBrowser,Cod,LastClick) SELECT UsrCod,'11',GrpCod,LastAccDownloadGrp FROM crs_grp_usr WHERE LastAccDownloadGrp>0;
INSERT INTO file_browser_last (UsrCod,FileBrowser,Cod,LastClick) SELECT UsrCod,'5',GrpCod,LastAccCommonGrp FROM crs_grp_usr WHERE LastAccCommonGrp>0;
INSERT INTO file_browser_last (UsrCod,FileBrowser,Cod,LastClick) SELECT UsrCod,'13',GrpCod,LastAccCommonGrp FROM crs_grp_usr WHERE LastAccMarksGrp>0;
REPLACE INTO file_browser_last (UsrCod,FileBrowser,Cod,LastClick) SELECT UsrCod,'11',GrpCod,LastAccDownloadGrp FROM crs_grp_usr WHERE LastAccDownloadGrp>0;
REPLACE INTO file_browser_last (UsrCod,FileBrowser,Cod,LastClick) SELECT UsrCod,'5',GrpCod,LastAccCommonGrp FROM crs_grp_usr WHERE LastAccCommonGrp>0;
REPLACE INTO file_browser_last (UsrCod,FileBrowser,Cod,LastClick) SELECT UsrCod,'13',GrpCod,LastAccCommonGrp FROM crs_grp_usr WHERE LastAccMarksGrp>0;
ALTER TABLE crs_grp_usr DROP COLUMN LastAccDownloadGrp;
ALTER TABLE crs_grp_usr DROP COLUMN LastAccCommonGrp;
ALTER TABLE crs_grp_usr DROP COLUMN LastAccMarksGrp;
Version 14.63.6: Jan 22, 2015 Changes in last accesses to course file browsers. (175588 lines)
10 changes necessary in database:
INSERT INTO file_browser_last (UsrCod,FileBrowser,Cod,LastClick) SELECT UsrCod,'3',CrsCod,LastAccDownloadCrs FROM crs_usr WHERE LastAccDownloadCrs>0;
INSERT INTO file_browser_last (UsrCod,FileBrowser,Cod,LastClick) SELECT UsrCod,'4',CrsCod,LastAccCommonCrs FROM crs_usr WHERE LastAccCommonCrs>0;
INSERT INTO file_browser_last (UsrCod,FileBrowser,Cod,LastClick) SELECT UsrCod,'8',CrsCod,LastAccMarksCrs FROM crs_usr WHERE LastAccMarksCrs>0;
INSERT INTO file_browser_last (UsrCod,FileBrowser,Cod,LastClick) SELECT UsrCod,'14',CrsCod,LastAccMyWorks FROM crs_usr WHERE LastAccMyWorks>0;
INSERT INTO file_browser_last (UsrCod,FileBrowser,Cod,LastClick) SELECT UsrCod,'15',CrsCod,LastAccMyWorks FROM crs_usr WHERE LastAccCrsWorks>0;
REPLACE INTO file_browser_last (UsrCod,FileBrowser,Cod,LastClick) SELECT UsrCod,'3',CrsCod,LastAccDownloadCrs FROM crs_usr WHERE LastAccDownloadCrs>0;
REPLACE INTO file_browser_last (UsrCod,FileBrowser,Cod,LastClick) SELECT UsrCod,'4',CrsCod,LastAccCommonCrs FROM crs_usr WHERE LastAccCommonCrs>0;
REPLACE INTO file_browser_last (UsrCod,FileBrowser,Cod,LastClick) SELECT UsrCod,'8',CrsCod,LastAccMarksCrs FROM crs_usr WHERE LastAccMarksCrs>0;
REPLACE INTO file_browser_last (UsrCod,FileBrowser,Cod,LastClick) SELECT UsrCod,'14',CrsCod,LastAccMyWorks FROM crs_usr WHERE LastAccMyWorks>0;
REPLACE INTO file_browser_last (UsrCod,FileBrowser,Cod,LastClick) SELECT UsrCod,'15',CrsCod,LastAccMyWorks FROM crs_usr WHERE LastAccCrsWorks>0;
ALTER TABLE crs_usr DROP COLUMN LastAccDownloadCrs;
ALTER TABLE crs_usr DROP COLUMN LastAccCommonCrs;
ALTER TABLE crs_usr DROP COLUMN LastAccMarksCrs;
@ -68,7 +100,7 @@ ALTER TABLE crs_usr DROP COLUMN LastAccCrsWorks;
Version 14.63.5: Jan 22, 2015 Changes in last accesses to file browsers (briefcases). (? lines)
2 changes necessary in database:
INSERT INTO file_browser_last (UsrCod,FileBrowser,Cod,LastClick) SELECT UsrCod,'9','-1',LastAccBriefcase FROM usr_last WHERE LastAccBriefcase>0;
REPLACE INTO file_browser_last (UsrCod,FileBrowser,Cod,LastClick) SELECT UsrCod,'9','-1',LastAccBriefcase FROM usr_last WHERE LastAccBriefcase>0;
ALTER TABLE usr_last DROP COLUMN LastAccBriefcase;
Version 14.63.4: Jan 21, 2015 Fixed bug in listing of degree administrators, reported by Antonio Fernández Ares. (175548 lines)

View File

@ -2431,9 +2431,7 @@ static void Crs_EmptyCourseCompletely (long CrsCod)
DB_QueryDELETE (Query,"can not remove clipboards in a course");
/* Remove expanded folders in the course */
sprintf (Query,"DELETE FROM expanded_folders WHERE CrsCod='%ld'",
CrsCod);
DB_QueryDELETE (Query,"can not remove expanded folders in a course");
Brw_RemoveExpandedFoldersInCrs (CrsCod);
/* Remove format of files of marks of the course */
sprintf (Query,"DELETE FROM marks_properties"

View File

@ -435,31 +435,23 @@ mysql> DESCRIBE clipboard;
+-------------+------------+------+-----+-------------------+-----------------------------+
| UsrCod | int(11) | NO | PRI | NULL | |
| FileBrowser | tinyint(4) | NO | MUL | NULL | |
| InsCod | int(11) | NO | MUL | -1 | |
| CtrCod | int(11) | NO | MUL | -1 | |
| DegCod | int(11) | NO | MUL | -1 | |
| CrsCod | int(11) | NO | MUL | -1 | |
| GrpCod | int(11) | NO | | NULL | |
| WorksUsrCod | int(11) | NO | | NULL | |
| Cod | int(11) | NO | | -1 | |
| WorksUsrCod | int(11) | NO | MUL | NULL | |
| FileType | tinyint(4) | NO | | 0 | |
| Path | text | NO | | NULL | |
| CopyTime | timestamp | NO | | CURRENT_TIMESTAMP | on update CURRENT_TIMESTAMP |
+-------------+------------+------+-----+-------------------+-----------------------------+
11 rows in set (0.00 sec)
7 rows in set (0.00 sec)
*/
DB_CreateTable ("CREATE TABLE IF NOT EXISTS clipboard ("
"UsrCod INT NOT NULL,"
"FileBrowser TINYINT NOT NULL,"
"InsCod INT NOT NULL DEFAULT -1,"
"CtrCod INT NOT NULL DEFAULT -1,"
"DegCod INT NOT NULL DEFAULT -1,"
"CrsCod INT NOT NULL DEFAULT -1,"
"GrpCod INT NOT NULL,"
"Cod INT NOT NULL DEFAULT -1,"
"WorksUsrCod INT NOT NULL,"
"FileType TINYINT NOT NULL DEFAULT 0,"
"Path TEXT COLLATE latin1_bin NOT NULL,"
"CopyTime TIMESTAMP,"
"UNIQUE INDEX(UsrCod),INDEX(FileBrowser),INDEX(InsCod),INDEX(CtrCod),INDEX(DegCod),INDEX(CrsCod))");
"UNIQUE INDEX(UsrCod),INDEX(FileBrowser,Cod),INDEX(WorksUsrCod))");
/***** Table connected *****/
/*
@ -957,30 +949,22 @@ mysql> DESCRIBE expanded_folders;
| Field | Type | Null | Key | Default | Extra |
+-------------+------------+------+-----+---------+-------+
| UsrCod | int(11) | NO | MUL | NULL | |
| FileBrowser | tinyint(4) | NO | | NULL | |
| InsCod | int(11) | NO | MUL | -1 | |
| CtrCod | int(11) | NO | MUL | -1 | |
| DegCod | int(11) | NO | MUL | -1 | |
| CrsCod | int(11) | NO | MUL | -1 | |
| GrpCod | int(11) | NO | | NULL | |
| WorksUsrCod | int(11) | NO | | NULL | |
| FileBrowser | tinyint(4) | NO | MUL | NULL | |
| Cod | int(11) | NO | | -1 | |
| WorksUsrCod | int(11) | NO | MUL | NULL | |
| Path | text | NO | | NULL | |
| ClickTime | datetime | NO | | NULL | |
+-------------+------------+------+-----+---------+-------+
10 rows in set (0.00 sec)
6 rows in set (0.00 sec)
*/
DB_CreateTable ("CREATE TABLE IF NOT EXISTS expanded_folders ("
"UsrCod INT NOT NULL,"
"FileBrowser TINYINT NOT NULL,"
"InsCod INT NOT NULL DEFAULT -1,"
"CtrCod INT NOT NULL DEFAULT -1,"
"DegCod INT NOT NULL DEFAULT -1,"
"CrsCod INT NOT NULL DEFAULT -1,"
"GrpCod INT NOT NULL,"
"Cod INT NOT NULL DEFAULT -1,"
"WorksUsrCod INT NOT NULL,"
"Path TEXT COLLATE latin1_bin NOT NULL,"
"ClickTime DATETIME NOT NULL,"
"INDEX(UsrCod,FileBrowser),INDEX(InsCod),INDEX(CtrCod),INDEX(DegCod),INDEX(CrsCod))");
"INDEX(UsrCod,FileBrowser,Cod),INDEX(FileBrowser,Cod),INDEX(WorksUsrCod))");
/***** Table file_browser_last *****/
/*

File diff suppressed because it is too large Load Diff

View File

@ -157,7 +157,6 @@ void Brw_RemFolderFromTree (void);
void Brw_ExpandFileTree (void);
void Brw_ContractFileTree (void);
void Brw_CopyFromFileBrowser (void);
void Brw_RemoveExpiredExpandedFolders (void);
void Brw_PasteIntoFileBrowser (void);
void Brw_RemSubtreeInFileBrowser (void);
void Brw_ShowFormFileBrowser (void);
@ -183,6 +182,9 @@ void Brw_UpdateMyFileViews (long FilCod);
long Brw_AddPathToDB (long PublisherUsrCod,Brw_FileType_t FileType,
const char *Path,bool IsPublic,Brw_License_t License);
void Brw_RemoveExpandedFoldersInCrs (long CrsCod);
void Brw_RemoveExpiredExpandedFolders (void);
void Brw_RemoveUsrClipboard (long UsrCod);
void Brw_RemoveGrpClipboards (long GrpCod);
void Brw_RemoveUsrClipboardInCrs (long UsrCod,long CrsCod);

View File

@ -513,11 +513,7 @@ struct Globals
struct
{
Brw_FileBrowser_t FileBrowser; // Type of the file browser
long InsCod; // Code of the institution related to the file browser with the clipboard
long CtrCod; // Code of the centre related to the file browser with the clipboard
long DegCod; // Code of the degree related to the file browser with the clipboard
long CrsCod; // Code of the course related to the file browser with the clipboard
long GrpCod; // Code of the group related to the file browser with the clipboard
long Cod; // Code of the institution/centre/degree/course/group related to the file browser with the clipboard
long WorksUsrCod; // User code of the user related to the works file browser with the clipboard
char Path[PATH_MAX+1]; // Complete path in the file browser
char FileName[NAME_MAX+1]; // File name, last part of complete path in the file browser

View File

@ -2627,10 +2627,13 @@ void Grp_GetDataOfGroupByCod (struct GroupData *GrpDat)
unsigned long NumRows;
/***** Get data of a group from database *****/
sprintf (Query,"SELECT crs_grp_types.GrpTypCod,crs_grp_types.GrpTypName,crs_grp_types.Multiple,"
"crs_grp.GrpName,crs_grp.MaxStudents,crs_grp.Open,crs_grp.FileZones"
" FROM crs_grp_types,crs_grp"
" WHERE crs_grp_types.GrpTypCod=crs_grp.GrpTypCod AND crs_grp.GrpCod='%ld'",
sprintf (Query,"SELECT crs_grp_types.GrpTypCod,crs_grp_types.CrsCod,"
"crs_grp_types.GrpTypName,crs_grp_types.Multiple,"
"crs_grp.GrpName,crs_grp.MaxStudents,"
"crs_grp.Open,crs_grp.FileZones"
" FROM crs_grp,crs_grp_types"
" WHERE crs_grp.GrpCod='%ld'"
" AND crs_grp.GrpTypCod=crs_grp_types.GrpTypCod",
GrpDat->GrpCod);
NumRows = DB_QuerySELECT (Query,&mysql_res,"can not get data of a group");
@ -2639,21 +2642,32 @@ void Grp_GetDataOfGroupByCod (struct GroupData *GrpDat)
/***** Get data of group *****/
row = mysql_fetch_row (mysql_res);
/* Get the code of the group type (row[0]) */
if ((GrpDat->GrpTypCod = Str_ConvertStrCodToLongCod (row[0])) < 0)
if ((GrpDat->GrpTypCod = Str_ConvertStrCodToLongCod (row[0])) <= 0)
Lay_ShowErrorAndExit ("Wrong code of type of group.");
/* Get the name of the group type (row[1]) */
strcpy (GrpDat->GrpTypName,row[1]);
/* Get whether a student may be in one or multiple groups (row[2]) */
GrpDat->MultipleEnrollment = (Str_ConvertToUpperLetter (row[2][0]) == 'Y');
/* Get the name of the group (row[3]) */
strcpy (GrpDat->GrpName,row[3]);
/* Get maximum number of students (row[4]) */
GrpDat->MaxStudents = Grp_ConvertToNumMaxStdsGrp (row[4]);
/* Get whether group is open or closed (row[5]) */
GrpDat->Open = (Str_ConvertToUpperLetter (row[5][0]) == 'Y');
/* Get whether group has file zones (row[6]) */
GrpDat->FileZones = (Str_ConvertToUpperLetter (row[6][0]) == 'Y');
/* Get the code of the course (row[1]) */
if ((GrpDat->CrsCod = Str_ConvertStrCodToLongCod (row[1])) <= 0)
Lay_ShowErrorAndExit ("Wrong code of course.");
/* Get the name of the group type (row[2]) */
strcpy (GrpDat->GrpTypName,row[2]);
/* Get whether a student may be in one or multiple groups (row[3]) */
GrpDat->MultipleEnrollment = (Str_ConvertToUpperLetter (row[3][0]) == 'Y');
/* Get the name of the group (row[4]) */
strcpy (GrpDat->GrpName,row[4]);
/* Get maximum number of students (row[5]) */
GrpDat->MaxStudents = Grp_ConvertToNumMaxStdsGrp (row[5]);
/* Get whether group is open or closed (row[6]) */
GrpDat->Open = (Str_ConvertToUpperLetter (row[6][0]) == 'Y');
/* Get whether group has file zones (row[7]) */
GrpDat->FileZones = (Str_ConvertToUpperLetter (row[7][0]) == 'Y');
/***** Free structure that stores the query result *****/
DB_FreeMySQLResult (&mysql_res);

View File

@ -54,6 +54,7 @@ struct GroupData
{
long GrpCod;
long GrpTypCod;
long CrsCod;
char GrpTypName[MAX_LENGTH_GROUP_TYPE_NAME+1];
char GrpName[MAX_LENGTH_GROUP_NAME+1];
unsigned MaxStudents;