mirror of https://github.com/acanas/swad-core.git
Version 14.68
This commit is contained in:
parent
0358f6ca96
commit
8fe68819d6
|
@ -689,12 +689,20 @@ void Acc_CompletelyEliminateAccount (struct UsrData *UsrDat,
|
|||
Lay_ShowAlert (Lay_SUCCESS,Gbl.Message);
|
||||
}
|
||||
|
||||
/***** Remove user's clipboards *****/
|
||||
Brw_RemoveUsrClipboard (UsrDat->UsrCod);
|
||||
/***** Remove user's clipboard in forums *****/
|
||||
For_RemoveUsrFromThrClipboard (UsrDat->UsrCod);
|
||||
|
||||
/***** Remove user's expanded folders *****/
|
||||
Brw_RemoveUsrExpandedFolders (UsrDat->UsrCod);
|
||||
/***** Remove some files of the user's from database *****/
|
||||
Brw_RemoveUsrFilesFromDB (UsrDat->UsrCod);
|
||||
|
||||
/***** Remove the file tree of a user *****/
|
||||
Acc_RemoveUsrBriefcase (UsrDat);
|
||||
if (QuietOrVerbose == Cns_VERBOSE)
|
||||
{
|
||||
sprintf (Gbl.Message,Txt_Virtual_pendrive_of_THE_USER_X_has_been_removed,
|
||||
UsrDat->FullName);
|
||||
Lay_ShowAlert (Lay_SUCCESS,Gbl.Message);
|
||||
}
|
||||
|
||||
/***** Remove exams made by user in all courses *****/
|
||||
Tst_RemoveExamsMadeByUsrInAllCrss (UsrDat->UsrCod);
|
||||
|
@ -734,15 +742,6 @@ void Acc_CompletelyEliminateAccount (struct UsrData *UsrDat,
|
|||
/***** Remove the user from the list of users without photo *****/
|
||||
Pho_RemoveUsrFromTableClicksWithoutPhoto (UsrDat->UsrCod);
|
||||
|
||||
/***** Remove the file tree of a user *****/
|
||||
Acc_RemoveUsrBriefcase (UsrDat);
|
||||
if (QuietOrVerbose == Cns_VERBOSE)
|
||||
{
|
||||
sprintf (Gbl.Message,Txt_Virtual_pendrive_of_THE_USER_X_has_been_removed,
|
||||
UsrDat->FullName);
|
||||
Lay_ShowAlert (Lay_SUCCESS,Gbl.Message);
|
||||
}
|
||||
|
||||
/***** Remove user's photo *****/
|
||||
PhotoRemoved = Pho_RemovePhoto (UsrDat);
|
||||
if (PhotoRemoved && QuietOrVerbose == Cns_VERBOSE)
|
||||
|
@ -770,15 +769,9 @@ static void Acc_RemoveUsrBriefcase (struct UsrData *UsrDat)
|
|||
{
|
||||
char PathRelUsr[PATH_MAX+1];
|
||||
|
||||
/***** Remove the briefcase of the user *****/
|
||||
/***** Remove files of the user's briefcase from disc *****/
|
||||
Usr_ConstructPathUsr (UsrDat->UsrCod,PathRelUsr);
|
||||
Brw_RemoveTree (PathRelUsr);
|
||||
|
||||
/***** Remove files in the course from database *****/
|
||||
Brw_RemoveFilesFromDB (-1L,-1L,-1L,-1L,-1L,UsrDat->UsrCod);
|
||||
|
||||
/***** Remove size of the briefcase of the user from database *****/
|
||||
Brw_RemoveSizeOfFileTreeFromDB (-1L,-1L,UsrDat->UsrCod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -1409,6 +1409,7 @@ void Ctr_RemoveCentre (void)
|
|||
extern const char *Txt_Centre_X_removed;
|
||||
char Query[512];
|
||||
struct Centre Ctr;
|
||||
char PathCtr[PATH_MAX+1];
|
||||
|
||||
/***** Get centre code *****/
|
||||
if ((Ctr.CtrCod = Ctr_GetParamOtherCtrCod ()) < 0)
|
||||
|
@ -1424,16 +1425,14 @@ void Ctr_RemoveCentre (void)
|
|||
else // Centre has no teachers ==> remove it
|
||||
{
|
||||
/***** Remove information related to files in centre *****/
|
||||
/* Remove clipboards related to the centre */
|
||||
sprintf (Query,"DELETE FROM clipboard WHERE CtrCod='%ld'",
|
||||
Ctr.CtrCod);
|
||||
DB_QueryDELETE (Query,"can not remove clipboards in a centre");
|
||||
Brw_RemoveCtrFilesFromDB (Ctr.CtrCod);
|
||||
|
||||
/* Remove last accesses to file browsers related with this centre */
|
||||
Brw_RemoveFileBrowserLast (Brw_FILE_BRW_ADMIN_DOCUMENTS_CTR,Ctr.CtrCod);
|
||||
|
||||
/* Remove files in the centre from database */
|
||||
Brw_RemoveFilesFromDB (-1L,Ctr.CtrCod,-1L,-1L,-1L,-1L);
|
||||
/***** Remove directories of the centre *****/
|
||||
sprintf (PathCtr,"%s/%s/%02u/%u",
|
||||
Cfg_PATH_SWAD_PUBLIC,Cfg_FOLDER_CTR,
|
||||
(unsigned) (Ctr.CtrCod % 100),
|
||||
(unsigned) Ctr.CtrCod);
|
||||
Brw_RemoveTree (PathCtr);
|
||||
|
||||
/***** Remove centre *****/
|
||||
sprintf (Query,"DELETE FROM centres WHERE CtrCod='%ld'",
|
||||
|
|
|
@ -39,11 +39,22 @@
|
|||
/****************************** Public constants *****************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
#define Log_PLATFORM_VERSION "SWAD 14.67.1 (2015/01/25)"
|
||||
#define Log_PLATFORM_VERSION "SWAD 14.68 (2015/01/25)"
|
||||
|
||||
// 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.68: Jan 25, 2015 Changes in file_browser_size table. (175606 lines)
|
||||
8 changes necessary in database:
|
||||
DROP INDEX FileBrowser ON file_browser_size;
|
||||
DROP INDEX UsrCod ON file_browser_size;
|
||||
ALTER TABLE file_browser_size CHANGE COLUMN UsrCod ZoneUsrCod INT NOT NULL DEFAULT -1,ADD INDEX (ZoneUsrCod);
|
||||
ALTER TABLE file_browser_size ADD COLUMN Cod INT NOT NULL DEFAULT -1 AFTER FileBrowser, ADD UNIQUE INDEX (FileBrowser,Cod,ZoneUsrCod);
|
||||
UPDATE file_browser_size SET Cod=CrsCod WHERE CrsCod>'0' AND GrpCod<='0';
|
||||
UPDATE file_browser_size SET Cod=GrpCod WHERE GrpCod>'0';
|
||||
ALTER TABLE file_browser_size DROP COLUMN CrsCod;
|
||||
ALTER TABLE file_browser_size DROP COLUMN GrpCod;
|
||||
|
||||
Version 14.67.1: Jan 25, 2015 Fixed bugs in file browsers. (175395 lines)
|
||||
Version 14.67: Jan 25, 2015 Changes in files table. (175369 lines)
|
||||
16 changes necessary in database:
|
||||
|
@ -56,7 +67,7 @@ CREATE INDEX ZoneUsrCod ON files (ZoneUsrCod);
|
|||
UPDATE files SET Cod=InsCod WHERE InsCod>'0';
|
||||
UPDATE files SET Cod=CtrCod WHERE CtrCod>'0';
|
||||
UPDATE files SET Cod=DegCod WHERE DegCod>'0';
|
||||
UPDATE files SET Cod=CrsCod WHERE CrsCod>'0';
|
||||
UPDATE files SET Cod=CrsCod WHERE CrsCod>'0' AND GrpCod<='0';
|
||||
UPDATE files SET Cod=GrpCod WHERE GrpCod>'0';
|
||||
ALTER TABLE files DROP COLUMN InsCod;
|
||||
ALTER TABLE files DROP COLUMN CtrCod;
|
||||
|
@ -73,7 +84,7 @@ 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=CrsCod WHERE CrsCod>'0' AND GrpCod<='0';
|
||||
UPDATE clipboard SET Cod=GrpCod WHERE GrpCod>'0';
|
||||
ALTER TABLE clipboard DROP COLUMN InsCod;
|
||||
ALTER TABLE clipboard DROP COLUMN CtrCod;
|
||||
|
@ -89,7 +100,7 @@ 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=CrsCod WHERE CrsCod>'0' AND GrpCod<='0';
|
||||
UPDATE expanded_folders SET Cod=GrpCod WHERE GrpCod>'0';
|
||||
ALTER TABLE expanded_folders DROP COLUMN InsCod;
|
||||
ALTER TABLE expanded_folders DROP COLUMN CtrCod;
|
||||
|
|
|
@ -2425,27 +2425,7 @@ static void Crs_EmptyCourseCompletely (long CrsCod)
|
|||
DB_QueryDELETE (Query,"can not remove users from a course");
|
||||
|
||||
/***** Remove information related to files in course *****/
|
||||
/* Remove clipboards related to the course */
|
||||
sprintf (Query,"DELETE FROM clipboard WHERE CrsCod='%ld'",
|
||||
CrsCod);
|
||||
DB_QueryDELETE (Query,"can not remove clipboards in a course");
|
||||
|
||||
/* Remove expanded folders in the course */
|
||||
Brw_RemoveExpandedFoldersInCrs (CrsCod);
|
||||
|
||||
/* Remove format of files of marks of the course */
|
||||
sprintf (Query,"DELETE FROM marks_properties"
|
||||
" USING files,marks_properties"
|
||||
" WHERE files.CrsCod='%ld'"
|
||||
" AND files.FilCod=marks_properties.FilCod",
|
||||
CrsCod);
|
||||
DB_QueryDELETE (Query,"can not remove the properties of marks associated to a course");
|
||||
|
||||
/* Remove files in the course from database */
|
||||
Brw_RemoveFilesFromDB (-1L,-1L,-1L,CrsCod,-1L,-1L);
|
||||
|
||||
/* Remove size of file zones in the course from database */
|
||||
Brw_RemoveSizeOfFileTreeFromDB (CrsCod,-1L,-1L);
|
||||
Brw_RemoveCrsFilesFromDB (CrsCod);
|
||||
|
||||
/***** Remove directories of the course *****/
|
||||
sprintf (PathRelCrs,"%s/%s/%ld",
|
||||
|
|
|
@ -1005,14 +1005,14 @@ mysql> DESCRIBE file_browser_size;
|
|||
*/
|
||||
DB_CreateTable ("CREATE TABLE IF NOT EXISTS file_browser_size ("
|
||||
"FileBrowser TINYINT NOT NULL,"
|
||||
"CrsCod INT NOT NULL DEFAULT -1,"
|
||||
"GrpCod INT NOT NULL DEFAULT -1,"
|
||||
"UsrCod INT NOT NULL DEFAULT -1,"
|
||||
"Cod INT NOT NULL DEFAULT -1,"
|
||||
"ZoneUsrCod INT NOT NULL DEFAULT -1,"
|
||||
"NumLevels INT NOT NULL,"
|
||||
"NumFolders INT NOT NULL,"
|
||||
"NumFiles INT NOT NULL,"
|
||||
"TotalSize BIGINT NOT NULL,"
|
||||
"UNIQUE INDEX(FileBrowser,CrsCod,GrpCod,UsrCod),INDEX(CrsCod),INDEX(GrpCod),INDEX(UsrCod))");
|
||||
"UNIQUE INDEX(FileBrowser,Cod,ZoneUsrCod),"
|
||||
"INDEX(ZoneUsrCod))");
|
||||
|
||||
/***** Table file_view *****/
|
||||
/*
|
||||
|
|
|
@ -3122,6 +3122,7 @@ static void Deg_RemoveDegreeCompletely (long DegCod)
|
|||
MYSQL_ROW row;
|
||||
unsigned long NumRow,NumRows;
|
||||
long CrsCod;
|
||||
char PathDeg[PATH_MAX+1];
|
||||
|
||||
/***** Get courses of a degree from database *****/
|
||||
sprintf (Query,"SELECT CrsCod FROM courses"
|
||||
|
@ -3183,16 +3184,14 @@ static void Deg_RemoveDegreeCompletely (long DegCod)
|
|||
DB_QueryDELETE (Query,"can not remove threads in forums of a degree");
|
||||
|
||||
/***** Remove information related to files in degree *****/
|
||||
/* Remove clipboards related to the degree */
|
||||
sprintf (Query,"DELETE FROM clipboard WHERE DegCod='%ld'",
|
||||
DegCod);
|
||||
DB_QueryDELETE (Query,"can not remove clipboards in a degree");
|
||||
Brw_RemoveDegFilesFromDB (DegCod);
|
||||
|
||||
/* Remove last accesses to file browsers related with this degree */
|
||||
Brw_RemoveFileBrowserLast (Brw_FILE_BRW_ADMIN_DOCUMENTS_DEG,DegCod);
|
||||
|
||||
/* Remove files in the degree from database */
|
||||
Brw_RemoveFilesFromDB (-1L,-1L,DegCod,-1L,-1L,-1L);
|
||||
/***** Remove directories of the degree *****/
|
||||
sprintf (PathDeg,"%s/%s/%02u/%u",
|
||||
Cfg_PATH_SWAD_PUBLIC,Cfg_FOLDER_DEG,
|
||||
(unsigned) (DegCod % 100),
|
||||
(unsigned) DegCod);
|
||||
Brw_RemoveTree (PathDeg);
|
||||
|
||||
/***** Remove administrators of this degree *****/
|
||||
sprintf (Query,"DELETE FROM deg_admin WHERE DegCod='%ld'",
|
||||
|
|
|
@ -3219,11 +3219,8 @@ static void Enr_EffectivelyRemUsrFromCrs (struct UsrData *UsrDat,struct Course *
|
|||
/***** Remove fields of this user in its course record *****/
|
||||
Rec_RemoveFieldsCrsRecordInCrs (UsrDat->UsrCod,Crs,QuietOrVerbose);
|
||||
|
||||
/***** Remove user's clipboard *****/
|
||||
Brw_RemoveUsrClipboardInCrs (UsrDat->UsrCod,Crs->CrsCod);
|
||||
|
||||
/***** Remove user's expanded folders in course *****/
|
||||
Brw_RemoveUsrExpandedFoldersInCrs (UsrDat->UsrCod,Crs->CrsCod);
|
||||
/***** Remove some information about files in course and groups *****/
|
||||
Brw_RemoveSomeInfoAboutCrsUsrFilesFromDB (UsrDat->UsrCod,Crs->CrsCod);
|
||||
|
||||
/***** Remove exams made by user in course *****/
|
||||
Tst_RemoveExamsMadeByUsrInCrs (UsrDat->UsrCod,Crs->CrsCod);
|
||||
|
|
|
@ -95,7 +95,7 @@ const char *Brw_Licenses_DB[Brw_NUM_LICENSES] =
|
|||
"cc_by_nc_nd", // CC Attribution-NonCommercial-NoDerivs License
|
||||
};
|
||||
*/
|
||||
// Brosers types for database "files" table
|
||||
// Browsers types for database "files" and "file_browser_size" tables
|
||||
const Brw_FileBrowser_t Brw_FileBrowserForDB_files[Brw_NUM_TYPES_FILE_BROWSER] =
|
||||
{
|
||||
Brw_FILE_BRW_UNKNOWN, // Brw_FILE_BRW_UNKNOWN = 0,
|
||||
|
@ -121,7 +121,7 @@ const Brw_FileBrowser_t Brw_FileBrowserForDB_files[Brw_NUM_TYPES_FILE_BROWSER] =
|
|||
Brw_FILE_BRW_ADMIN_DOCUMENTS_INS, // Brw_FILE_BRW_SEE_DOCUMENTS_INS = 20,
|
||||
Brw_FILE_BRW_ADMIN_DOCUMENTS_INS, // Brw_FILE_BRW_ADMIN_DOCUMENTS_INS = 21,
|
||||
};
|
||||
// Brosers types for database "clipboard" table
|
||||
// Browsers types for database "clipboard" table
|
||||
static const Brw_FileBrowser_t Brw_FileBrowserForDB_clipboard[Brw_NUM_TYPES_FILE_BROWSER] =
|
||||
{
|
||||
Brw_FILE_BRW_UNKNOWN, // Brw_FILE_BRW_UNKNOWN = 0,
|
||||
|
@ -147,7 +147,7 @@ static const Brw_FileBrowser_t Brw_FileBrowserForDB_clipboard[Brw_NUM_TYPES_FILE
|
|||
Brw_FILE_BRW_ADMIN_DOCUMENTS_INS, // Brw_FILE_BRW_SEE_DOCUMENTS_INS = 20,
|
||||
Brw_FILE_BRW_ADMIN_DOCUMENTS_INS, // Brw_FILE_BRW_ADMIN_DOCUMENTS_INS = 21,
|
||||
};
|
||||
// Brosers types for database "expanded_folders" table
|
||||
// Browsers types for database "expanded_folders" table
|
||||
static const Brw_FileBrowser_t Brw_FileBrowserForDB_expanded_folders[Brw_NUM_TYPES_FILE_BROWSER] =
|
||||
{
|
||||
Brw_FILE_BRW_UNKNOWN, // Brw_FILE_BRW_UNKNOWN
|
||||
|
@ -173,7 +173,9 @@ static const Brw_FileBrowser_t Brw_FileBrowserForDB_expanded_folders[Brw_NUM_TYP
|
|||
Brw_FILE_BRW_SEE_DOCUMENTS_INS, // Brw_FILE_BRW_SEE_DOCUMENTS_INS
|
||||
Brw_FILE_BRW_SEE_DOCUMENTS_INS, // Brw_FILE_BRW_ADMIN_DOCUMENTS_INS
|
||||
};
|
||||
// Brosers types for database "file_browser_last" table
|
||||
// Browsers types for database "file_browser_last" table
|
||||
// Assignments and works are stored as one in file_browser_last...
|
||||
// ...because a user views them at the same time
|
||||
static const Brw_FileBrowser_t Brw_FileBrowserForDB_file_browser_last[Brw_NUM_TYPES_FILE_BROWSER] =
|
||||
{
|
||||
Brw_FILE_BRW_UNKNOWN, // Brw_FILE_BRW_UNKNOWN = 0,
|
||||
|
@ -3475,147 +3477,199 @@ static void Brw_ShowSizeOfFileTree (void)
|
|||
|
||||
static void Brw_StoreSizeOfFileTreeInDB (void)
|
||||
{
|
||||
long Cod = Brw_GetCodForFiles ();
|
||||
long ZoneUsrCod = Brw_GetZoneUsrCodForFiles ();
|
||||
char Query[512];
|
||||
long CrsCod = -1L;
|
||||
long GrpCod = -1L;
|
||||
long UsrCod = -1L;
|
||||
Brw_FileBrowser_t FileBrowser = Gbl.FileBrowser.Type;
|
||||
|
||||
switch (Gbl.FileBrowser.Type)
|
||||
{
|
||||
case Brw_FILE_BRW_ADMIN_DOCUMENTS_CRS:
|
||||
case Brw_FILE_BRW_COMMON_CRS:
|
||||
case Brw_FILE_BRW_ADMIN_MARKS_CRS:
|
||||
CrsCod = Gbl.CurrentCrs.Crs.CrsCod;
|
||||
break;
|
||||
case Brw_FILE_BRW_COMMON_GRP:
|
||||
case Brw_FILE_BRW_ADMIN_DOCUMENTS_GRP:
|
||||
case Brw_FILE_BRW_ADMIN_MARKS_GRP:
|
||||
CrsCod = Gbl.CurrentCrs.Crs.CrsCod;
|
||||
GrpCod = Gbl.CurrentCrs.Grps.GrpCod;
|
||||
break;
|
||||
case Brw_FILE_BRW_ASSIGNMENTS_USR:
|
||||
case Brw_FILE_BRW_WORKS_USR:
|
||||
CrsCod = Gbl.CurrentCrs.Crs.CrsCod;
|
||||
UsrCod = Gbl.Usrs.Me.UsrDat.UsrCod;
|
||||
break;
|
||||
case Brw_FILE_BRW_ASSIGNMENTS_CRS:
|
||||
CrsCod = Gbl.CurrentCrs.Crs.CrsCod;
|
||||
UsrCod = Gbl.Usrs.Other.UsrDat.UsrCod;
|
||||
FileBrowser = Brw_FILE_BRW_ASSIGNMENTS_USR;
|
||||
break;
|
||||
case Brw_FILE_BRW_WORKS_CRS:
|
||||
CrsCod = Gbl.CurrentCrs.Crs.CrsCod;
|
||||
UsrCod = Gbl.Usrs.Other.UsrDat.UsrCod;
|
||||
FileBrowser = Brw_FILE_BRW_WORKS_USR;
|
||||
break;
|
||||
case Brw_FILE_BRW_BRIEFCASE_USR:
|
||||
UsrCod = Gbl.Usrs.Me.UsrDat.UsrCod;
|
||||
break;
|
||||
default: // Not aplicable here
|
||||
break;
|
||||
}
|
||||
|
||||
/***** Update size of the file browser in database *****/
|
||||
sprintf (Query,"REPLACE INTO file_browser_size"
|
||||
" (FileBrowser,CrsCod,GrpCod,UsrCod,NumLevels,NumFolders,NumFiles,TotalSize)"
|
||||
" VALUES ('%u','%ld','%ld','%ld','%u','%lu','%lu','%llu')",
|
||||
(unsigned) FileBrowser,CrsCod,GrpCod,UsrCod,
|
||||
Gbl.FileBrowser.Size.NumLevls,Gbl.FileBrowser.Size.NumFolds,Gbl.FileBrowser.Size.NumFiles,Gbl.FileBrowser.Size.TotalSiz);
|
||||
sprintf (Query,"REPLACE INTO file_browser_size (FileBrowser,Cod,ZoneUsrCod,"
|
||||
"NumLevels,NumFolders,NumFiles,TotalSize)"
|
||||
" VALUES ('%u','%ld','%ld',"
|
||||
"'%u','%lu','%lu','%llu')",
|
||||
(unsigned) Brw_FileBrowserForDB_files[Gbl.FileBrowser.Type],Cod,ZoneUsrCod,
|
||||
Gbl.FileBrowser.Size.NumLevls,
|
||||
Gbl.FileBrowser.Size.NumFolds,
|
||||
Gbl.FileBrowser.Size.NumFiles,
|
||||
Gbl.FileBrowser.Size.TotalSiz);
|
||||
DB_QueryREPLACE (Query,"can not store the size of a file browser");
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/**************** Remove size of a file browser from database ****************/
|
||||
/******** Remove files related to an institution from the database ***********/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Brw_RemoveSizeOfFileTreeFromDB (long CrsCod,long GrpCod,long UsrCod)
|
||||
void Brw_RemoveInsFilesFromDB (long InsCod)
|
||||
{
|
||||
char Query[512];
|
||||
|
||||
/***** Remove size of the file browser from database *****/
|
||||
if (CrsCod > 0 && GrpCod == -1L && UsrCod == -1L) // All the zones of the course
|
||||
sprintf (Query,"DELETE FROM file_browser_size WHERE CrsCod='%ld'",
|
||||
CrsCod);
|
||||
else if (CrsCod > 0 && UsrCod > 0) // Works of a student in the course
|
||||
sprintf (Query,"DELETE FROM file_browser_size WHERE CrsCod='%ld' AND UsrCod='%ld'",
|
||||
CrsCod,UsrCod);
|
||||
else if (GrpCod > 0) // All the zones of the group
|
||||
sprintf (Query,"DELETE FROM file_browser_size WHERE GrpCod='%ld'",
|
||||
GrpCod);
|
||||
else if (UsrCod > 0) // All the zones of the user
|
||||
sprintf (Query,"DELETE FROM file_browser_size WHERE UsrCod='%ld'",
|
||||
UsrCod);
|
||||
DB_QueryDELETE (Query,"can not remove the size of a file browser");
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/**************** Remove a file or folder from the database ******************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Brw_RemoveFilesFromDB (long InsCod,long CtrCod,long DegCod,long CrsCod,long GrpCod,long UsrCod)
|
||||
{
|
||||
char Query1[512];
|
||||
char Query2[512];
|
||||
|
||||
/***** Remove size of the file browser from database *****/
|
||||
if (InsCod > 0) // Documents of the institution
|
||||
{
|
||||
sprintf (Query1,"DELETE FROM file_view USING file_view,files"
|
||||
/***** Remove from database the entries that store the file views *****/
|
||||
sprintf (Query,"DELETE FROM file_view USING file_view,files"
|
||||
" WHERE files.FileBrowser='%u' AND files.Cod='%ld'"
|
||||
" AND files.FilCod=file_view.FilCod",
|
||||
(unsigned) Brw_FILE_BRW_ADMIN_DOCUMENTS_INS,
|
||||
InsCod);
|
||||
sprintf (Query2,"DELETE FROM files"
|
||||
DB_QueryDELETE (Query,"can not remove file views to files of an institution");
|
||||
|
||||
/***** Remove from database expanded folders *****/
|
||||
sprintf (Query,"DELETE LOW_PRIORITY FROM expanded_folders"
|
||||
" WHERE FileBrowser='%u' AND Cod='%ld'",
|
||||
(unsigned) Brw_FILE_BRW_SEE_DOCUMENTS_INS,
|
||||
InsCod);
|
||||
DB_QueryDELETE (Query,"can not remove expanded folders of an institution");
|
||||
|
||||
/***** Remove from database the entries that store clipboards *****/
|
||||
sprintf (Query,"DELETE FROM clipboard"
|
||||
" WHERE FileBrowser='%u' AND Cod='%ld'",
|
||||
(unsigned) Brw_FILE_BRW_ADMIN_DOCUMENTS_INS,
|
||||
InsCod);
|
||||
DB_QueryDELETE (Query,"can not remove clipboards related to files of an institution");
|
||||
|
||||
/***** Remove from database the entries that store the last time users visited file zones *****/
|
||||
sprintf (Query,"DELETE FROM file_browser_last"
|
||||
" WHERE FileBrowser='%u' AND Cod='%ld'",
|
||||
(unsigned) Brw_FILE_BRW_ADMIN_DOCUMENTS_INS,
|
||||
InsCod);
|
||||
DB_QueryDELETE (Query,"can not remove file last visits to files of an institution");
|
||||
|
||||
/***** Remove from database the entries that store the sizes of the file zones *****/
|
||||
sprintf (Query,"DELETE FROM file_browser_size"
|
||||
" WHERE FileBrowser='%u' AND Cod='%ld'",
|
||||
(unsigned) Brw_FILE_BRW_ADMIN_DOCUMENTS_INS,
|
||||
InsCod);
|
||||
DB_QueryDELETE (Query,"can not remove sizes of file zones of an institution");
|
||||
|
||||
/***** Remove from database the entries that store the data files *****/
|
||||
sprintf (Query,"DELETE FROM files"
|
||||
" WHERE FileBrowser='%u' AND Cod='%ld'",
|
||||
(unsigned) Brw_FILE_BRW_ADMIN_DOCUMENTS_INS,
|
||||
InsCod);
|
||||
DB_QueryDELETE (Query,"can not remove files of an institution");
|
||||
}
|
||||
else if (CtrCod > 0) // Documents of the centre
|
||||
|
||||
/*****************************************************************************/
|
||||
/************ Remove files related to a centre from the database *************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Brw_RemoveCtrFilesFromDB (long CtrCod)
|
||||
{
|
||||
sprintf (Query1,"DELETE FROM file_view USING file_view,files"
|
||||
char Query[512];
|
||||
|
||||
/***** Remove from database the entries that store the file views *****/
|
||||
sprintf (Query,"DELETE FROM file_view USING file_view,files"
|
||||
" WHERE files.FileBrowser='%u' AND files.Cod='%ld'"
|
||||
" AND files.FilCod=file_view.FilCod",
|
||||
(unsigned) Brw_FILE_BRW_ADMIN_DOCUMENTS_CTR,
|
||||
CtrCod);
|
||||
sprintf (Query2,"DELETE FROM files"
|
||||
DB_QueryDELETE (Query,"can not remove file views to files of a centre");
|
||||
|
||||
/***** Remove from database expanded folders *****/
|
||||
sprintf (Query,"DELETE LOW_PRIORITY FROM expanded_folders"
|
||||
" WHERE FileBrowser='%u' AND Cod='%ld'",
|
||||
(unsigned) Brw_FILE_BRW_SEE_DOCUMENTS_CTR,
|
||||
CtrCod);
|
||||
DB_QueryDELETE (Query,"can not remove expanded folders of a centre");
|
||||
|
||||
/***** Remove from database the entries that store clipboards *****/
|
||||
sprintf (Query,"DELETE FROM clipboard"
|
||||
" WHERE FileBrowser='%u' AND Cod='%ld'",
|
||||
(unsigned) Brw_FILE_BRW_ADMIN_DOCUMENTS_CTR,
|
||||
DegCod);
|
||||
CtrCod);
|
||||
DB_QueryDELETE (Query,"can not remove clipboards related to files of a centre");
|
||||
|
||||
/***** Remove from database the entries that store the last time users visited file zones *****/
|
||||
sprintf (Query,"DELETE FROM file_browser_last"
|
||||
" WHERE FileBrowser='%u' AND Cod='%ld'",
|
||||
(unsigned) Brw_FILE_BRW_ADMIN_DOCUMENTS_CTR,
|
||||
CtrCod);
|
||||
DB_QueryDELETE (Query,"can not remove file last visits to files of a centre");
|
||||
|
||||
/***** Remove from database the entries that store the sizes of the file zones *****/
|
||||
sprintf (Query,"DELETE FROM file_browser_size"
|
||||
" WHERE FileBrowser='%u' AND Cod='%ld'",
|
||||
(unsigned) Brw_FILE_BRW_ADMIN_DOCUMENTS_CTR,
|
||||
CtrCod);
|
||||
DB_QueryDELETE (Query,"can not remove sizes of file zones of a centre");
|
||||
|
||||
/***** Remove from database the entries that store the data files *****/
|
||||
sprintf (Query,"DELETE FROM files"
|
||||
" WHERE FileBrowser='%u' AND Cod='%ld'",
|
||||
(unsigned) Brw_FILE_BRW_ADMIN_DOCUMENTS_CTR,
|
||||
CtrCod);
|
||||
DB_QueryDELETE (Query,"can not remove files of a centre");
|
||||
}
|
||||
else if (DegCod > 0) // Documents of the degree
|
||||
|
||||
/*****************************************************************************/
|
||||
/************ Remove files related to a degree from the database *************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Brw_RemoveDegFilesFromDB (long DegCod)
|
||||
{
|
||||
sprintf (Query1,"DELETE FROM file_view USING file_view,files"
|
||||
char Query[512];
|
||||
|
||||
/***** Remove from database the entries that store the file views *****/
|
||||
sprintf (Query,"DELETE FROM file_view USING file_view,files"
|
||||
" WHERE files.FileBrowser='%u' AND files.Cod='%ld'"
|
||||
" AND files.FilCod=file_view.FilCod",
|
||||
(unsigned) Brw_FILE_BRW_ADMIN_DOCUMENTS_DEG,
|
||||
DegCod);
|
||||
sprintf (Query2,"DELETE FROM files"
|
||||
DB_QueryDELETE (Query,"can not remove file views to files of a degree");
|
||||
|
||||
/***** Remove from database expanded folders *****/
|
||||
sprintf (Query,"DELETE LOW_PRIORITY FROM expanded_folders"
|
||||
" WHERE FileBrowser='%u' AND Cod='%ld'",
|
||||
(unsigned) Brw_FILE_BRW_SEE_DOCUMENTS_DEG,
|
||||
DegCod);
|
||||
DB_QueryDELETE (Query,"can not remove expanded folders of a degree");
|
||||
|
||||
/***** Remove from database the entries that store clipboards *****/
|
||||
sprintf (Query,"DELETE FROM clipboard"
|
||||
" WHERE FileBrowser='%u' AND Cod='%ld'",
|
||||
(unsigned) Brw_FILE_BRW_ADMIN_DOCUMENTS_DEG,
|
||||
DegCod);
|
||||
DB_QueryDELETE (Query,"can not remove clipboards related to files of a degree");
|
||||
|
||||
/***** Remove from database the entries that store the last time users visited file zones *****/
|
||||
sprintf (Query,"DELETE FROM file_browser_last"
|
||||
" WHERE FileBrowser='%u' AND Cod='%ld'",
|
||||
(unsigned) Brw_FILE_BRW_ADMIN_DOCUMENTS_DEG,
|
||||
DegCod);
|
||||
DB_QueryDELETE (Query,"can not remove file last visits to files of a degree");
|
||||
|
||||
/***** Remove from database the entries that store the sizes of the file zones *****/
|
||||
sprintf (Query,"DELETE FROM file_browser_size"
|
||||
" WHERE FileBrowser='%u' AND Cod='%ld'",
|
||||
(unsigned) Brw_FILE_BRW_ADMIN_DOCUMENTS_DEG,
|
||||
DegCod);
|
||||
DB_QueryDELETE (Query,"can not remove sizes of file zones of a degree");
|
||||
|
||||
/***** Remove from database the entries that store the data files *****/
|
||||
sprintf (Query,"DELETE FROM files"
|
||||
" WHERE FileBrowser='%u' AND Cod='%ld'",
|
||||
(unsigned) Brw_FILE_BRW_ADMIN_DOCUMENTS_DEG,
|
||||
DegCod);
|
||||
DB_QueryDELETE (Query,"can not remove files of a degree");
|
||||
}
|
||||
else if (CrsCod > 0)
|
||||
|
||||
/*****************************************************************************/
|
||||
/************ Remove files related to a course from the database *************/
|
||||
/*****************************************************************************/
|
||||
// This function assumes that all the groups in the course have been removed before
|
||||
|
||||
void Brw_RemoveCrsFilesFromDB (long CrsCod)
|
||||
{
|
||||
if (UsrCod > 0) // Works of a user in the course
|
||||
{
|
||||
sprintf (Query1,"DELETE FROM file_view USING file_view,files"
|
||||
" WHERE files.FileBrowser IN ('%u','%u')"
|
||||
" AND files.Cod='%ld' AND files.ZoneUsrCod='%ld'"
|
||||
" AND files.FilCod=file_view.FilCod",
|
||||
(unsigned) Brw_FILE_BRW_ASSIGNMENTS_USR,
|
||||
(unsigned) Brw_FILE_BRW_WORKS_USR,
|
||||
CrsCod,UsrCod);
|
||||
sprintf (Query2,"DELETE FROM files"
|
||||
" WHERE FileBrowser IN ('%u','%u')"
|
||||
" AND Cod='%ld' AND ZoneUsrCod='%ld'",
|
||||
(unsigned) Brw_FILE_BRW_ASSIGNMENTS_USR,
|
||||
(unsigned) Brw_FILE_BRW_WORKS_USR,
|
||||
CrsCod,UsrCod);
|
||||
}
|
||||
else // UsrCod <= 0 // All the zones of the course
|
||||
{
|
||||
sprintf (Query1,"DELETE FROM file_view USING file_view,files"
|
||||
char Query[512];
|
||||
|
||||
/***** Remove format of files of marks *****/
|
||||
sprintf (Query,"DELETE FROM marks_properties USING files,marks_properties"
|
||||
" WHERE files.FileBrowser='%u'"
|
||||
" AND files.Cod='%ld'"
|
||||
" AND files.FilCod=marks_properties.FilCod",
|
||||
(unsigned) Brw_FILE_BRW_ADMIN_MARKS_CRS,
|
||||
CrsCod);
|
||||
DB_QueryDELETE (Query,"can not remove the properties of marks associated to a course");
|
||||
|
||||
/***** Remove from database the entries that store the file views *****/
|
||||
sprintf (Query,"DELETE FROM file_view USING file_view,files"
|
||||
" WHERE files.FileBrowser IN ('%u','%u','%u','%u','%u')"
|
||||
" AND files.Cod='%ld'"
|
||||
" AND files.FilCod=file_view.FilCod",
|
||||
|
@ -3625,8 +3679,52 @@ void Brw_RemoveFilesFromDB (long InsCod,long CtrCod,long DegCod,long CrsCod,long
|
|||
(unsigned) Brw_FILE_BRW_WORKS_USR,
|
||||
(unsigned) Brw_FILE_BRW_ADMIN_MARKS_CRS,
|
||||
CrsCod);
|
||||
sprintf (Query2,"DELETE FROM files"
|
||||
" WHERE files.FileBrowser IN ('%u','%u','%u','%u','%u')"
|
||||
DB_QueryDELETE (Query,"can not remove file views to files of a course");
|
||||
|
||||
/***** Remove from database expanded folders *****/
|
||||
sprintf (Query,"DELETE LOW_PRIORITY FROM expanded_folders"
|
||||
" WHERE FileBrowser IN ('%u','%u','%u','%u','%u','%u','%u')"
|
||||
" AND Cod='%ld'",
|
||||
(unsigned) Brw_FILE_BRW_SEE_DOCUMENTS_CRS,
|
||||
(unsigned) Brw_FILE_BRW_COMMON_CRS,
|
||||
(unsigned) Brw_FILE_BRW_ASSIGNMENTS_USR,
|
||||
(unsigned) Brw_FILE_BRW_ASSIGNMENTS_CRS,
|
||||
(unsigned) Brw_FILE_BRW_WORKS_USR,
|
||||
(unsigned) Brw_FILE_BRW_WORKS_CRS,
|
||||
(unsigned) Brw_FILE_BRW_SEE_MARKS_CRS,
|
||||
CrsCod);
|
||||
DB_QueryDELETE (Query,"can not remove expanded folders of a course");
|
||||
|
||||
/***** Remove from database the entries that store clipboards *****/
|
||||
sprintf (Query,"DELETE FROM clipboard"
|
||||
" WHERE FileBrowser IN ('%u','%u','%u','%u','%u','%u','%u')"
|
||||
" AND Cod='%ld'",
|
||||
(unsigned) Brw_FILE_BRW_ADMIN_DOCUMENTS_CRS,
|
||||
(unsigned) Brw_FILE_BRW_COMMON_CRS,
|
||||
(unsigned) Brw_FILE_BRW_ASSIGNMENTS_USR,
|
||||
(unsigned) Brw_FILE_BRW_ASSIGNMENTS_CRS,
|
||||
(unsigned) Brw_FILE_BRW_WORKS_USR,
|
||||
(unsigned) Brw_FILE_BRW_WORKS_CRS,
|
||||
(unsigned) Brw_FILE_BRW_ADMIN_MARKS_CRS,
|
||||
CrsCod);
|
||||
DB_QueryDELETE (Query,"can not remove clipboards related to files of a course");
|
||||
|
||||
/***** Remove from database the entries that store the last time users visited file zones *****/
|
||||
// Assignments and works are stored as one in file_browser_last...
|
||||
// ...because a user views them at the same time
|
||||
sprintf (Query,"DELETE FROM file_browser_last"
|
||||
" WHERE FileBrowser IN ('%u','%u','%u','%u')"
|
||||
" AND Cod='%ld'",
|
||||
(unsigned) Brw_FILE_BRW_ADMIN_DOCUMENTS_CRS,
|
||||
(unsigned) Brw_FILE_BRW_COMMON_CRS,
|
||||
(unsigned) Brw_FILE_BRW_ASSIGNMENTS_USR,
|
||||
(unsigned) Brw_FILE_BRW_ADMIN_MARKS_CRS,
|
||||
CrsCod);
|
||||
DB_QueryDELETE (Query,"can not remove file last visits to files of a course");
|
||||
|
||||
/***** Remove from database the entries that store the sizes of the file zones *****/
|
||||
sprintf (Query,"DELETE FROM file_browser_size"
|
||||
" WHERE FileBrowser IN ('%u','%u','%u','%u','%u')"
|
||||
" AND Cod='%ld'",
|
||||
(unsigned) Brw_FILE_BRW_ADMIN_DOCUMENTS_CRS,
|
||||
(unsigned) Brw_FILE_BRW_COMMON_CRS,
|
||||
|
@ -3634,11 +3732,40 @@ void Brw_RemoveFilesFromDB (long InsCod,long CtrCod,long DegCod,long CrsCod,long
|
|||
(unsigned) Brw_FILE_BRW_WORKS_USR,
|
||||
(unsigned) Brw_FILE_BRW_ADMIN_MARKS_CRS,
|
||||
CrsCod);
|
||||
DB_QueryDELETE (Query,"can not remove sizes of file zones of a course");
|
||||
|
||||
/***** Remove from database the entries that store the data files *****/
|
||||
sprintf (Query,"DELETE FROM files"
|
||||
" WHERE FileBrowser IN ('%u','%u','%u','%u','%u')"
|
||||
" AND Cod='%ld'",
|
||||
(unsigned) Brw_FILE_BRW_ADMIN_DOCUMENTS_CRS,
|
||||
(unsigned) Brw_FILE_BRW_COMMON_CRS,
|
||||
(unsigned) Brw_FILE_BRW_ASSIGNMENTS_USR,
|
||||
(unsigned) Brw_FILE_BRW_WORKS_USR,
|
||||
(unsigned) Brw_FILE_BRW_ADMIN_MARKS_CRS,
|
||||
CrsCod);
|
||||
DB_QueryDELETE (Query,"can not remove files of a course");
|
||||
}
|
||||
}
|
||||
else if (GrpCod > 0) // All the zones of the group
|
||||
|
||||
/*****************************************************************************/
|
||||
/************ Remove files related to a group from the database **************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Brw_RemoveGrpFilesFromDB (long GrpCod)
|
||||
{
|
||||
sprintf (Query1,"DELETE FROM file_view USING file_view,files"
|
||||
char Query[512];
|
||||
|
||||
/***** Remove format of files of marks *****/
|
||||
sprintf (Query,"DELETE FROM marks_properties USING files,marks_properties"
|
||||
" WHERE files.FileBrowser='%u'"
|
||||
" AND files.Cod='%ld'"
|
||||
" AND files.FilCod=marks_properties.FilCod",
|
||||
(unsigned) Brw_FILE_BRW_ADMIN_MARKS_GRP,
|
||||
GrpCod);
|
||||
DB_QueryDELETE (Query,"can not remove the properties of marks associated to a group");
|
||||
|
||||
/***** Remove from database the entries that store the file views *****/
|
||||
sprintf (Query,"DELETE FROM file_view USING file_view,files"
|
||||
" WHERE files.FileBrowser IN ('%u','%u','%u')"
|
||||
" AND files.Cod='%ld'"
|
||||
" AND files.FilCod=file_view.FilCod",
|
||||
|
@ -3646,30 +3773,250 @@ void Brw_RemoveFilesFromDB (long InsCod,long CtrCod,long DegCod,long CrsCod,long
|
|||
(unsigned) Brw_FILE_BRW_COMMON_GRP,
|
||||
(unsigned) Brw_FILE_BRW_ADMIN_MARKS_GRP,
|
||||
GrpCod);
|
||||
sprintf (Query2,"DELETE FROM files"
|
||||
DB_QueryDELETE (Query,"can not remove file views to files of a group");
|
||||
|
||||
/***** Remove from database expanded folders *****/
|
||||
sprintf (Query,"DELETE LOW_PRIORITY FROM expanded_folders"
|
||||
" WHERE FileBrowser IN ('%u','%u','%u')"
|
||||
" AND Cod='%ld'",
|
||||
(unsigned) Brw_FILE_BRW_SEE_DOCUMENTS_GRP,
|
||||
(unsigned) Brw_FILE_BRW_COMMON_GRP,
|
||||
(unsigned) Brw_FILE_BRW_SEE_MARKS_GRP,
|
||||
GrpCod);
|
||||
DB_QueryDELETE (Query,"can not remove expanded folders of a group");
|
||||
|
||||
/***** Remove from database the entries that store clipboards *****/
|
||||
sprintf (Query,"DELETE FROM clipboard"
|
||||
" WHERE FileBrowser IN ('%u','%u','%u')"
|
||||
" AND Cod='%ld'",
|
||||
(unsigned) Brw_FILE_BRW_ADMIN_DOCUMENTS_GRP,
|
||||
(unsigned) Brw_FILE_BRW_COMMON_GRP,
|
||||
(unsigned) Brw_FILE_BRW_ADMIN_MARKS_GRP,
|
||||
GrpCod);
|
||||
DB_QueryDELETE (Query,"can not remove clipboards related to files of a group");
|
||||
|
||||
/***** Remove from database the entries that store the last time users visited file zones *****/
|
||||
sprintf (Query,"DELETE FROM file_browser_last"
|
||||
" WHERE FileBrowser IN ('%u','%u','%u')"
|
||||
" AND Cod='%ld'",
|
||||
(unsigned) Brw_FILE_BRW_ADMIN_DOCUMENTS_GRP,
|
||||
(unsigned) Brw_FILE_BRW_COMMON_GRP,
|
||||
(unsigned) Brw_FILE_BRW_ADMIN_MARKS_GRP,
|
||||
GrpCod);
|
||||
DB_QueryDELETE (Query,"can not remove file last visits to files of a group");
|
||||
|
||||
/***** Remove from database the entries that store the sizes of the file zones *****/
|
||||
sprintf (Query,"DELETE FROM file_browser_size"
|
||||
" WHERE FileBrowser IN ('%u','%u','%u')"
|
||||
" AND Cod='%ld'",
|
||||
(unsigned) Brw_FILE_BRW_ADMIN_DOCUMENTS_GRP,
|
||||
(unsigned) Brw_FILE_BRW_COMMON_GRP,
|
||||
(unsigned) Brw_FILE_BRW_ADMIN_MARKS_GRP,
|
||||
GrpCod);
|
||||
DB_QueryDELETE (Query,"can not remove sizes of file zones of a group");
|
||||
|
||||
/***** Remove from database the entries that store the data files *****/
|
||||
sprintf (Query,"DELETE FROM files"
|
||||
" WHERE FileBrowser IN ('%u','%u','%u')"
|
||||
" AND Cod='%ld'",
|
||||
(unsigned) Brw_FILE_BRW_ADMIN_DOCUMENTS_GRP,
|
||||
(unsigned) Brw_FILE_BRW_COMMON_GRP,
|
||||
(unsigned) Brw_FILE_BRW_ADMIN_MARKS_GRP,
|
||||
GrpCod);
|
||||
DB_QueryDELETE (Query,"can not remove files of a group");
|
||||
}
|
||||
else if (UsrCod > 0) // All the zones of the user
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Remove some info about files related to a course and a user from database */
|
||||
/*****************************************************************************/
|
||||
|
||||
void Brw_RemoveSomeInfoAboutCrsUsrFilesFromDB (long CrsCod,long UsrCod)
|
||||
{
|
||||
sprintf (Query1,"DELETE FROM file_view USING file_view,files"
|
||||
char Query[512];
|
||||
|
||||
/***** Remove from database expanded folders *****/
|
||||
sprintf (Query,"DELETE LOW_PRIORITY FROM expanded_folders"
|
||||
" WHERE UsrCod='%ld' AND ("
|
||||
"(FileBrowser IN ('%u','%u','%u','%u','%u','%u','%u')"
|
||||
" AND Cod='%ld')"
|
||||
" OR "
|
||||
"(FileBrowser IN ('%u','%u','%u')"
|
||||
" AND Cod IN (SELECT GrpCod FROM crs_grp WHERE CrsCod='%ld'))"
|
||||
")",
|
||||
UsrCod,
|
||||
(unsigned) Brw_FILE_BRW_SEE_DOCUMENTS_CRS,
|
||||
(unsigned) Brw_FILE_BRW_COMMON_CRS,
|
||||
(unsigned) Brw_FILE_BRW_ASSIGNMENTS_USR,
|
||||
(unsigned) Brw_FILE_BRW_ASSIGNMENTS_CRS,
|
||||
(unsigned) Brw_FILE_BRW_WORKS_USR,
|
||||
(unsigned) Brw_FILE_BRW_WORKS_CRS,
|
||||
(unsigned) Brw_FILE_BRW_SEE_MARKS_CRS,
|
||||
CrsCod,
|
||||
(unsigned) Brw_FILE_BRW_SEE_DOCUMENTS_GRP,
|
||||
(unsigned) Brw_FILE_BRW_COMMON_GRP,
|
||||
(unsigned) Brw_FILE_BRW_SEE_MARKS_GRP,
|
||||
CrsCod);
|
||||
DB_QueryDELETE (Query,"can not remove expanded folders for a user in a course");
|
||||
|
||||
/***** Remove from database the entries that store clipboards *****/
|
||||
sprintf (Query,"DELETE FROM clipboard"
|
||||
" WHERE UsrCod='%ld' AND ("
|
||||
"(FileBrowser IN ('%u','%u','%u','%u','%u','%u','%u')"
|
||||
" AND Cod='%ld')"
|
||||
" OR "
|
||||
"(FileBrowser IN ('%u','%u','%u')"
|
||||
" AND Cod IN (SELECT GrpCod FROM crs_grp WHERE CrsCod='%ld'))"
|
||||
")",
|
||||
UsrCod,
|
||||
(unsigned) Brw_FILE_BRW_ADMIN_DOCUMENTS_CRS,
|
||||
(unsigned) Brw_FILE_BRW_COMMON_CRS,
|
||||
(unsigned) Brw_FILE_BRW_ASSIGNMENTS_USR,
|
||||
(unsigned) Brw_FILE_BRW_ASSIGNMENTS_CRS,
|
||||
(unsigned) Brw_FILE_BRW_WORKS_USR,
|
||||
(unsigned) Brw_FILE_BRW_WORKS_CRS,
|
||||
(unsigned) Brw_FILE_BRW_ADMIN_MARKS_CRS,
|
||||
CrsCod,
|
||||
(unsigned) Brw_FILE_BRW_ADMIN_DOCUMENTS_GRP,
|
||||
(unsigned) Brw_FILE_BRW_COMMON_GRP,
|
||||
(unsigned) Brw_FILE_BRW_ADMIN_MARKS_GRP,
|
||||
CrsCod);
|
||||
DB_QueryDELETE (Query,"can not remove source of copy for a user in a course");
|
||||
|
||||
/***** Remove from database the entries that store the last time user visited file zones *****/
|
||||
// Assignments and works are stored as one in file_browser_last...
|
||||
// ...because a user views them at the same time
|
||||
sprintf (Query,"DELETE FROM file_browser_last"
|
||||
" WHERE UsrCod='%ld' AND ("
|
||||
"(FileBrowser IN ('%u','%u','%u','%u')"
|
||||
" AND Cod='%ld')"
|
||||
" OR "
|
||||
"(FileBrowser IN ('%u','%u','%u')"
|
||||
" AND Cod IN (SELECT GrpCod FROM crs_grp WHERE CrsCod='%ld'))"
|
||||
")",
|
||||
UsrCod,
|
||||
(unsigned) Brw_FILE_BRW_ADMIN_DOCUMENTS_CRS,
|
||||
(unsigned) Brw_FILE_BRW_COMMON_CRS,
|
||||
(unsigned) Brw_FILE_BRW_ASSIGNMENTS_USR,
|
||||
(unsigned) Brw_FILE_BRW_ADMIN_MARKS_CRS,
|
||||
CrsCod,
|
||||
(unsigned) Brw_FILE_BRW_ADMIN_DOCUMENTS_GRP,
|
||||
(unsigned) Brw_FILE_BRW_COMMON_GRP,
|
||||
(unsigned) Brw_FILE_BRW_ADMIN_MARKS_GRP,
|
||||
CrsCod);
|
||||
DB_QueryDELETE (Query,"can not remove file last visits to files of a course from a user");
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/*************** Remove user's works in a course from database ***************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Brw_RemoveWrkFilesFromDB (long CrsCod,long UsrCod)
|
||||
{
|
||||
char Query[512];
|
||||
|
||||
/***** Remove from database the entries that store the file views *****/
|
||||
sprintf (Query,"DELETE FROM file_view USING file_view,files"
|
||||
" WHERE files.FileBrowser IN ('%u','%u')"
|
||||
" AND files.Cod='%ld' AND files.ZoneUsrCod='%ld'"
|
||||
" AND files.FilCod=file_view.FilCod",
|
||||
(unsigned) Brw_FILE_BRW_ASSIGNMENTS_USR,
|
||||
(unsigned) Brw_FILE_BRW_WORKS_USR,
|
||||
CrsCod,UsrCod);
|
||||
DB_QueryDELETE (Query,"can not remove file views");
|
||||
|
||||
/***** Remove from database expanded folders *****/
|
||||
sprintf (Query,"DELETE LOW_PRIORITY FROM expanded_folders"
|
||||
" WHERE FileBrowser IN ('%u','%u')"
|
||||
" AND Cod='%ld' AND WorksUsrCod='%ld'",
|
||||
(unsigned) Brw_FILE_BRW_ASSIGNMENTS_CRS,
|
||||
(unsigned) Brw_FILE_BRW_WORKS_CRS,
|
||||
CrsCod,UsrCod);
|
||||
DB_QueryDELETE (Query,"can not remove expanded folders of a group");
|
||||
|
||||
/***** Remove from database the entries that store clipboards *****/
|
||||
sprintf (Query,"DELETE FROM clipboard"
|
||||
" WHERE FileBrowser IN ('%u','%u')"
|
||||
" AND Cod='%ld' AND WorksUsrCod='%ld'",
|
||||
(unsigned) Brw_FILE_BRW_ASSIGNMENTS_CRS,
|
||||
(unsigned) Brw_FILE_BRW_WORKS_CRS,
|
||||
CrsCod,UsrCod);
|
||||
DB_QueryDELETE (Query,"can not remove clipboards");
|
||||
|
||||
/***** Remove from database the entries that store the last time users visited file zones *****/
|
||||
// Assignments and works are stored as one in file_browser_last...
|
||||
// ...because a user views them at the same time
|
||||
sprintf (Query,"DELETE FROM file_browser_last"
|
||||
" WHERE FileBrowser='%u'"
|
||||
" AND Cod='%ld' AND ZoneUsrCod='%ld'",
|
||||
(unsigned) Brw_FILE_BRW_ASSIGNMENTS_USR,
|
||||
CrsCod,UsrCod);
|
||||
DB_QueryDELETE (Query,"can not remove file last visits");
|
||||
|
||||
/***** Remove from database the entries that store the sizes of the file zones *****/
|
||||
sprintf (Query,"DELETE FROM file_browser_size"
|
||||
" WHERE FileBrowser IN ('%u','%u')"
|
||||
" AND Cod='%ld' AND ZoneUsrCod='%ld'",
|
||||
(unsigned) Brw_FILE_BRW_ASSIGNMENTS_USR,
|
||||
(unsigned) Brw_FILE_BRW_WORKS_USR,
|
||||
CrsCod,UsrCod);
|
||||
DB_QueryDELETE (Query,"can not remove file browser sizes");
|
||||
|
||||
/***** Remove from database the entries that store the data files *****/
|
||||
sprintf (Query,"DELETE FROM files"
|
||||
" WHERE FileBrowser IN ('%u','%u')"
|
||||
" AND Cod='%ld' AND ZoneUsrCod='%ld'",
|
||||
(unsigned) Brw_FILE_BRW_ASSIGNMENTS_USR,
|
||||
(unsigned) Brw_FILE_BRW_WORKS_USR,
|
||||
CrsCod,UsrCod);
|
||||
DB_QueryDELETE (Query,"can not remove files");
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/************* Remove files related to a user from the database **************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Brw_RemoveUsrFilesFromDB (long UsrCod)
|
||||
{
|
||||
char Query[512];
|
||||
|
||||
/***** Remove from database the entries that store the file views *****/
|
||||
// User is not removed from file_view table,
|
||||
// in order to take into account his/her views
|
||||
sprintf (Query,"DELETE FROM file_view USING file_view,files"
|
||||
" WHERE files.ZoneUsrCod='%ld'"
|
||||
" AND files.FilCod=file_view.FilCod",
|
||||
UsrCod);
|
||||
sprintf (Query2,"DELETE FROM files"
|
||||
DB_QueryDELETE (Query,"can not remove file views to files of a user");
|
||||
|
||||
/***** Remove from database expanded folders *****/
|
||||
sprintf (Query,"DELETE LOW_PRIORITY FROM expanded_folders"
|
||||
" WHERE UsrCod='%ld'",
|
||||
UsrCod);
|
||||
DB_QueryDELETE (Query,"can not remove expanded folders for a user");
|
||||
|
||||
/***** Remove from database the entries that store clipboards *****/
|
||||
sprintf (Query,"DELETE FROM clipboard"
|
||||
" WHERE UsrCod='%ld'", // User's clipboard
|
||||
UsrCod);
|
||||
DB_QueryDELETE (Query,"can not remove user's clipboards");
|
||||
|
||||
/***** Remove from database the entries that store the last time users visited file zones *****/
|
||||
sprintf (Query,"DELETE FROM file_browser_last"
|
||||
" WHERE UsrCod='%ld'", // User's last visits to all zones
|
||||
UsrCod);
|
||||
DB_QueryDELETE (Query,"can not remove user's last visits to file zones");
|
||||
|
||||
/***** Remove from database the entries that store the sizes of the file zones *****/
|
||||
sprintf (Query,"DELETE FROM file_browser_size"
|
||||
" WHERE ZoneUsrCod='%ld'",
|
||||
UsrCod);
|
||||
}
|
||||
DB_QueryDELETE (Query,"can not remove sizes of user's file zones");
|
||||
|
||||
/***** Remove from database the entries that store the file views *****/
|
||||
DB_QueryDELETE (Query1,"can not remove files");
|
||||
|
||||
/***** Remove from database the entry that stores the data of a file *****/
|
||||
DB_QueryDELETE (Query2,"can not remove files");
|
||||
/***** Remove from database the entries that store the data files *****/
|
||||
sprintf (Query,"DELETE FROM files"
|
||||
" WHERE ZoneUsrCod='%ld'",
|
||||
UsrCod);
|
||||
DB_QueryDELETE (Query,"can not remove files in user's file zones");
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -3897,20 +4244,6 @@ static void Brw_GetAndUpdateDateLastAccFileBrowser (void)
|
|||
DB_QueryUPDATE (Query,"can not update date of last access to a file browser");
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/******************** Remove last accesses to file browser *******************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Brw_RemoveFileBrowserLast (Brw_FileBrowser_t FileBrowser,long Cod)
|
||||
{
|
||||
char Query[128];
|
||||
|
||||
sprintf (Query,"DELETE FROM file_browser_last"
|
||||
" WHERE FileBrowser='%u' AND Cod='%ld'",
|
||||
(unsigned) Brw_FileBrowserForDB_file_browser_last[FileBrowser],Cod);
|
||||
DB_QueryDELETE (Query,"can not remove last accesses to file browsers");
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/************* Get the group of my last access to a common zone **************/
|
||||
/*****************************************************************************/
|
||||
|
@ -6389,78 +6722,6 @@ static long Brw_GetWorksUsrCodForExpandedFolders (void)
|
|||
}
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/******************* Remove expanded folders of a course *********************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Brw_RemoveExpandedFoldersInCrs (long CrsCod)
|
||||
{
|
||||
char Query[512];
|
||||
|
||||
/***** Remove all the expanded folders related to the course *****/
|
||||
sprintf (Query,"DELETE LOW_PRIORITY FROM expanded_folders"
|
||||
" WHERE FileBrowser IN ('%u','%u','%u','%u','%u','%u','%u')"
|
||||
" AND Cod='%ld'",
|
||||
(unsigned) Brw_FileBrowserForDB_expanded_folders[Brw_FILE_BRW_SEE_DOCUMENTS_CRS],
|
||||
(unsigned) Brw_FileBrowserForDB_expanded_folders[Brw_FILE_BRW_COMMON_CRS],
|
||||
(unsigned) Brw_FileBrowserForDB_expanded_folders[Brw_FILE_BRW_ASSIGNMENTS_USR],
|
||||
(unsigned) Brw_FileBrowserForDB_expanded_folders[Brw_FILE_BRW_ASSIGNMENTS_CRS],
|
||||
(unsigned) Brw_FileBrowserForDB_expanded_folders[Brw_FILE_BRW_WORKS_USR],
|
||||
(unsigned) Brw_FileBrowserForDB_expanded_folders[Brw_FILE_BRW_WORKS_CRS],
|
||||
(unsigned) Brw_FileBrowserForDB_expanded_folders[Brw_FILE_BRW_SEE_MARKS_CRS],
|
||||
CrsCod);
|
||||
DB_QueryDELETE (Query,"can not remove expanded folders in a course");
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/******************* Remove all expanded folders of a user *******************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Brw_RemoveUsrExpandedFolders (long UsrCod)
|
||||
{
|
||||
char Query[512];
|
||||
|
||||
/***** Remove expanded folders of specified user *****/
|
||||
sprintf (Query,"DELETE LOW_PRIORITY FROM expanded_folders"
|
||||
" WHERE UsrCod='%ld' OR WorksUsrCod='%ld'",
|
||||
UsrCod,UsrCod);
|
||||
DB_QueryDELETE (Query,"can not remove expanded folders for a user");
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/********** Remove all expanded folders of a user in this course *************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Brw_RemoveUsrExpandedFoldersInCrs (long UsrCod,long CrsCod)
|
||||
{
|
||||
char Query[512];
|
||||
|
||||
/***** Remove expanded folders of specified user in course *****/
|
||||
sprintf (Query,"DELETE LOW_PRIORITY FROM expanded_folders"
|
||||
" WHERE UsrCod='%ld'"
|
||||
" AND FileBrowser IN ('%u','%u','%u','%u','%u','%u','%u')"
|
||||
" AND Cod='%ld'",
|
||||
UsrCod,
|
||||
(unsigned) Brw_FileBrowserForDB_expanded_folders[Brw_FILE_BRW_SEE_DOCUMENTS_CRS],
|
||||
(unsigned) Brw_FileBrowserForDB_expanded_folders[Brw_FILE_BRW_COMMON_CRS],
|
||||
(unsigned) Brw_FileBrowserForDB_expanded_folders[Brw_FILE_BRW_ASSIGNMENTS_USR],
|
||||
(unsigned) Brw_FileBrowserForDB_expanded_folders[Brw_FILE_BRW_ASSIGNMENTS_CRS],
|
||||
(unsigned) Brw_FileBrowserForDB_expanded_folders[Brw_FILE_BRW_WORKS_USR],
|
||||
(unsigned) Brw_FileBrowserForDB_expanded_folders[Brw_FILE_BRW_WORKS_CRS],
|
||||
(unsigned) Brw_FileBrowserForDB_expanded_folders[Brw_FILE_BRW_SEE_MARKS_CRS],
|
||||
CrsCod);
|
||||
DB_QueryDELETE (Query,"can not remove expanded folders for a user in a course");
|
||||
|
||||
/***** Remove expanded folders related to user's assignments or works in course *****/
|
||||
sprintf (Query,"DELETE LOW_PRIORITY FROM expanded_folders"
|
||||
" WHERE FileBrowser IN ('%u','%u')"
|
||||
" AND Cod='%ld' AND WorksUsrCod='%ld'",
|
||||
(unsigned) Brw_FileBrowserForDB_expanded_folders[Brw_FILE_BRW_ASSIGNMENTS_CRS],
|
||||
(unsigned) Brw_FileBrowserForDB_expanded_folders[Brw_FILE_BRW_WORKS_CRS],
|
||||
CrsCod,UsrCod);
|
||||
DB_QueryDELETE (Query,"can not remove expanded folders for a user in a course");
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/************* Remove expired expanded folders (from all users) **************/
|
||||
/*****************************************************************************/
|
||||
|
@ -6476,63 +6737,6 @@ void Brw_RemoveExpiredExpandedFolders (void)
|
|||
DB_QueryDELETE (Query,"can not remove old expanded folders");
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/************************* Remove clipboard of a user ************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Brw_RemoveUsrClipboard (long UsrCod)
|
||||
{
|
||||
char Query[512];
|
||||
|
||||
/***** Remove clipboard of specified user *****/
|
||||
sprintf (Query,"DELETE FROM clipboard WHERE UsrCod='%ld'",UsrCod);
|
||||
DB_QueryDELETE (Query,"can not remove source of copy for a user");
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/************************ Remove clipboards of a group ***********************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Brw_RemoveGrpClipboards (long GrpCod)
|
||||
{
|
||||
char Query[512];
|
||||
|
||||
/***** Remove clipboard of specified user *****/
|
||||
sprintf (Query,"DELETE FROM clipboard"
|
||||
" WHERE FileBrowser IN ('%u','%u','%u')"
|
||||
" AND Cod='%ld'",
|
||||
(unsigned) Brw_FILE_BRW_ADMIN_DOCUMENTS_GRP,
|
||||
(unsigned) Brw_FILE_BRW_COMMON_GRP,
|
||||
(unsigned) Brw_FILE_BRW_ADMIN_MARKS_GRP,
|
||||
GrpCod);
|
||||
DB_QueryDELETE (Query,"can not remove source of copy for a group");
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/****************** Remove clipboards of a user and a coruse *****************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Brw_RemoveUsrClipboardInCrs (long UsrCod,long CrsCod)
|
||||
{
|
||||
char Query[512];
|
||||
|
||||
/***** Remove clipboard of specified user *****/
|
||||
sprintf (Query,"DELETE FROM clipboard"
|
||||
" WHERE UsrCod='%ld'"
|
||||
" AND FileBrowser IN ('%u','%u','%u','%u','%u','%u','%u')"
|
||||
" AND CrsCod='%ld'",
|
||||
UsrCod,
|
||||
(unsigned) Brw_FILE_BRW_ADMIN_DOCUMENTS_CRS,
|
||||
(unsigned) Brw_FILE_BRW_COMMON_CRS,
|
||||
(unsigned) Brw_FILE_BRW_ADMIN_MARKS_CRS,
|
||||
(unsigned) Brw_FILE_BRW_ASSIGNMENTS_USR,
|
||||
(unsigned) Brw_FILE_BRW_WORKS_USR,
|
||||
(unsigned) Brw_FILE_BRW_ASSIGNMENTS_CRS,
|
||||
(unsigned) Brw_FILE_BRW_WORKS_CRS,
|
||||
CrsCod);
|
||||
DB_QueryDELETE (Query,"can not remove source of copy for a user and a course");
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/****************** Remove expired clipboards (from all users) ***************/
|
||||
/*****************************************************************************/
|
||||
|
@ -9710,7 +9914,6 @@ static long Brw_GetZoneUsrCodForFiles (void)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/******** Get code of user in assignment / works for expanded folders ********/
|
||||
/*****************************************************************************/
|
||||
|
@ -9787,8 +9990,8 @@ static void Brw_RemoveOneFileOrFolderFromDB (const char *Path)
|
|||
Ntf_SetNotifOneFileAsRemoved (FileBrowser,Cod,Path);
|
||||
|
||||
/***** Remove from database the entries that store the marks properties *****/
|
||||
if (Gbl.FileBrowser.Type == Brw_FILE_BRW_ADMIN_MARKS_CRS ||
|
||||
Gbl.FileBrowser.Type == Brw_FILE_BRW_ADMIN_MARKS_GRP)
|
||||
if (FileBrowser == Brw_FILE_BRW_ADMIN_MARKS_CRS ||
|
||||
FileBrowser == Brw_FILE_BRW_ADMIN_MARKS_GRP)
|
||||
{
|
||||
sprintf (Query,"DELETE FROM marks_properties USING files,marks_properties"
|
||||
" WHERE files.FileBrowser='%u' AND files.Cod='%ld'"
|
||||
|
@ -9830,14 +10033,14 @@ static void Brw_RemoveChildrenOfFolderFromDB (const char *Path)
|
|||
Ntf_SetNotifChildrenOfFolderAsRemoved (FileBrowser,Cod,Path);
|
||||
|
||||
/***** Remove from database the entries that store the marks properties *****/
|
||||
if (Gbl.FileBrowser.Type == Brw_FILE_BRW_ADMIN_MARKS_CRS ||
|
||||
Gbl.FileBrowser.Type == Brw_FILE_BRW_ADMIN_MARKS_GRP)
|
||||
if (FileBrowser == Brw_FILE_BRW_ADMIN_MARKS_CRS ||
|
||||
FileBrowser == Brw_FILE_BRW_ADMIN_MARKS_GRP)
|
||||
{
|
||||
sprintf (Query,"DELETE FROM marks_properties USING files,marks_properties"
|
||||
" WHERE files.FileBrowser='%u' AND files.Cod='%ld'"
|
||||
" AND files.Path LIKE '%s/%%'"
|
||||
" AND files.FilCod=marks_properties.FilCod",
|
||||
FileBrowser,Cod,Path);
|
||||
(unsigned) FileBrowser,Cod,Path);
|
||||
DB_QueryDELETE (Query,"can not remove properties of marks from database");
|
||||
}
|
||||
|
||||
|
@ -9846,14 +10049,14 @@ static void Brw_RemoveChildrenOfFolderFromDB (const char *Path)
|
|||
" WHERE files.FileBrowser='%u' AND files.Cod='%ld' AND files.ZoneUsrCod='%ld'"
|
||||
" AND files.Path LIKE '%s/%%'"
|
||||
" AND files.FilCod=file_view.FilCod",
|
||||
FileBrowser,Cod,ZoneUsrCod,Path);
|
||||
(unsigned) FileBrowser,Cod,ZoneUsrCod,Path);
|
||||
DB_QueryDELETE (Query,"can not remove file views from database");
|
||||
|
||||
/***** Remove from database the entries that store the data of files *****/
|
||||
sprintf (Query,"DELETE FROM files"
|
||||
" WHERE FileBrowser='%u' AND Cod='%ld' AND ZoneUsrCod='%ld'"
|
||||
" AND Path LIKE '%s/%%'",
|
||||
FileBrowser,Cod,ZoneUsrCod,Path);
|
||||
(unsigned) FileBrowser,Cod,ZoneUsrCod,Path);
|
||||
DB_QueryDELETE (Query,"can not remove paths from database");
|
||||
}
|
||||
|
||||
|
@ -10012,7 +10215,7 @@ static bool Brw_CheckIfIHavePermissionFileOrFolderCommon (void)
|
|||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/************ Remove common zones of all the groups of a type ***************/
|
||||
/************* Remove common zones of all the groups of a type ***************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Brw_RemoveZonesOfGroupsOfType (long GrpTypCod)
|
||||
|
@ -10047,7 +10250,7 @@ void Brw_RemoveZonesOfGroupsOfType (long GrpTypCod)
|
|||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/************* Remove file zones of a group and show message ****************/
|
||||
/************** Remove file zones of a group and show message ****************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Brw_RemoveGrpZonesVerbose (struct GroupData *GrpDat)
|
||||
|
@ -10064,33 +10267,27 @@ void Brw_RemoveGrpZonesVerbose (struct GroupData *GrpDat)
|
|||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/********************** Remove file zones of a group ************************/
|
||||
/*********************** Remove file zones of a group ************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Brw_RemoveGrpZones (long CrsCod,long GrpCod)
|
||||
{
|
||||
char PathGrpFileZones[PATH_MAX+1];
|
||||
|
||||
/***** Remove group zones *****/
|
||||
sprintf (PathGrpFileZones,"%s/%s/%ld/grp/%ld",
|
||||
Cfg_PATH_SWAD_PRIVATE,Cfg_FOLDER_CRS,CrsCod,GrpCod);
|
||||
Brw_RemoveTree (PathGrpFileZones);
|
||||
|
||||
/***** Set notifications about files in this group zone as removed *****/
|
||||
Ntf_SetNotifFilesInGroupAsRemoved (GrpCod);
|
||||
|
||||
/***** Remove files in the group from database *****/
|
||||
Brw_RemoveFilesFromDB (-1L,-1L,-1L,-1L,GrpCod,-1L);
|
||||
Brw_RemoveGrpFilesFromDB (GrpCod);
|
||||
|
||||
/***** Remove size of file zones in the group from database *****/
|
||||
Brw_RemoveSizeOfFileTreeFromDB (CrsCod,GrpCod,-1L);
|
||||
|
||||
/***** Remove clipboard entries in this group *****/
|
||||
Brw_RemoveGrpClipboards (GrpCod);
|
||||
/***** Remove group zones *****/
|
||||
sprintf (PathGrpFileZones,"%s/%s/%ld/grp/%ld",
|
||||
Cfg_PATH_SWAD_PRIVATE,Cfg_FOLDER_CRS,CrsCod,GrpCod);
|
||||
Brw_RemoveTree (PathGrpFileZones);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/**************** Remove the works of a user in a course ********************/
|
||||
/***************** Remove the works of a user in a course ********************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Brw_RemoveUsrWorksInCrs (struct UsrData *UsrDat,struct Course *Crs,Cns_QuietOrVerbose_t QuietOrVerbose)
|
||||
|
@ -10098,6 +10295,9 @@ void Brw_RemoveUsrWorksInCrs (struct UsrData *UsrDat,struct Course *Crs,Cns_Quie
|
|||
extern const char *Txt_Works_of_X_in_Y_removed;
|
||||
char PathUsrInCrs[PATH_MAX+1];
|
||||
|
||||
/***** Remove user's works in the course from database *****/
|
||||
Brw_RemoveWrkFilesFromDB (Crs->CrsCod,UsrDat->UsrCod);
|
||||
|
||||
/***** Remove the folder for this user inside the course *****/
|
||||
sprintf (PathUsrInCrs,"%s/%s/%ld/usr/%02u/%ld",
|
||||
Cfg_PATH_SWAD_PRIVATE,Cfg_FOLDER_CRS,Crs->CrsCod,
|
||||
|
@ -10105,12 +10305,6 @@ void Brw_RemoveUsrWorksInCrs (struct UsrData *UsrDat,struct Course *Crs,Cns_Quie
|
|||
Brw_RemoveTree (PathUsrInCrs);
|
||||
// If this was the last user in his/her subfolder ==> the subfolder will be empty
|
||||
|
||||
/***** Remove files in the course from database *****/
|
||||
Brw_RemoveFilesFromDB (-1L,-1L,-1L,Crs->CrsCod,-1L,UsrDat->UsrCod);
|
||||
|
||||
/***** Remove size of file zone of the course from database *****/
|
||||
Brw_RemoveSizeOfFileTreeFromDB (Crs->CrsCod,-1L,UsrDat->UsrCod);
|
||||
|
||||
/***** Write message *****/
|
||||
if (QuietOrVerbose == Cns_VERBOSE)
|
||||
{
|
||||
|
@ -10121,7 +10315,7 @@ void Brw_RemoveUsrWorksInCrs (struct UsrData *UsrDat,struct Course *Crs,Cns_Quie
|
|||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/************* Remove the works of a user in all of his courses *************/
|
||||
/************* Remove the works of a user in all of his courses **************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Brw_RemoveUsrWorksInAllCrss (struct UsrData *UsrDat,Cns_QuietOrVerbose_t QuietOrVerbose)
|
||||
|
|
|
@ -142,10 +142,17 @@ bool Brw_UpdateFoldersAssigmentsIfExistForAllUsrs (const char *OldFolderName,con
|
|||
void Brw_RemoveFoldersAssignmentsIfExistForAllUsrs (const char *FolderName);
|
||||
void Brw_ShowFileBrowserOrWorks (void);
|
||||
void Brw_ShowAgainFileBrowserOrWorks (void);
|
||||
void Brw_RemoveSizeOfFileTreeFromDB (long CrsCod,long GrpCod,long UsrCod);
|
||||
void Brw_RemoveFilesFromDB (long InsCod,long CtrCod,long DegCod,long CrsCod,long GrpCod,long UsrCod);
|
||||
|
||||
void Brw_RemoveInsFilesFromDB (long InsCod);
|
||||
void Brw_RemoveCtrFilesFromDB (long CtrCod);
|
||||
void Brw_RemoveDegFilesFromDB (long DegCod);
|
||||
void Brw_RemoveCrsFilesFromDB (long CrsCod);
|
||||
void Brw_RemoveGrpFilesFromDB (long GrpCod);
|
||||
void Brw_RemoveSomeInfoAboutCrsUsrFilesFromDB (long CrsCod,long UsrCod);
|
||||
void Brw_RemoveWrkFilesFromDB (long CrsCod,long UsrCod);
|
||||
void Brw_RemoveUsrFilesFromDB (long UsrCod);
|
||||
|
||||
void Brw_CreateDirDownloadTmp (void);
|
||||
void Brw_RemoveFileBrowserLast (Brw_FileBrowser_t FileBrowser,long Cod);
|
||||
void Brw_AskEditWorksCrs (void);
|
||||
void Brw_AskRemFileFromTree (void);
|
||||
void Brw_RemFileFromTree (void);
|
||||
|
@ -183,15 +190,8 @@ void Brw_GetCrsGrpFromFileMetadata (Brw_FileBrowser_t FileBrowser,long Cod,
|
|||
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);
|
||||
void Brw_RemoveUsrExpandedFolders (long UsrCod);
|
||||
void Brw_RemoveUsrExpandedFoldersInCrs (long UsrCod,long CrsCod);
|
||||
|
||||
void Brw_RemoveTree (const char *Path);
|
||||
void Brw_CalcSizeOfDir (char *Path);
|
||||
|
||||
|
|
|
@ -1364,6 +1364,7 @@ void Ins_RemoveInstitution (void)
|
|||
extern const char *Txt_Institution_X_removed;
|
||||
char Query[512];
|
||||
struct Institution Ins;
|
||||
char PathIns[PATH_MAX+1];
|
||||
|
||||
/***** Get institution code *****/
|
||||
if ((Ins.InsCod = Ins_GetParamOtherInsCod ()) < 0)
|
||||
|
@ -1379,16 +1380,14 @@ void Ins_RemoveInstitution (void)
|
|||
else // Institution has no users ==> remove it
|
||||
{
|
||||
/***** Remove information related to files in institution *****/
|
||||
/* Remove clipboards related to the institution */
|
||||
sprintf (Query,"DELETE FROM clipboard WHERE InsCod='%ld'",
|
||||
Ins.InsCod);
|
||||
DB_QueryDELETE (Query,"can not remove clipboards in an institution");
|
||||
Brw_RemoveInsFilesFromDB (Ins.InsCod);
|
||||
|
||||
/* Remove last accesses to file browsers related with this institution */
|
||||
Brw_RemoveFileBrowserLast (Brw_FILE_BRW_ADMIN_DOCUMENTS_INS,Ins.InsCod);
|
||||
|
||||
/* Remove files in the institution from database */
|
||||
Brw_RemoveFilesFromDB (Ins.InsCod,-1L,-1L,-1L,-1L,-1L);
|
||||
/***** Remove directories of the institution *****/
|
||||
sprintf (PathIns,"%s/%s/%02u/%u",
|
||||
Cfg_PATH_SWAD_PUBLIC,Cfg_FOLDER_INS,
|
||||
(unsigned) (Ins.InsCod % 100),
|
||||
(unsigned) Ins.InsCod);
|
||||
Brw_RemoveTree (PathIns);
|
||||
|
||||
/***** Remove institution *****/
|
||||
sprintf (Query,"DELETE FROM institutions WHERE InsCod='%ld'",
|
||||
|
|
|
@ -273,8 +273,6 @@ static void Mrk_ChangeNumRowsHeaderOrFooter (Brw_HeadOrFoot_t HeaderOrFooter)
|
|||
Gbl.FileBrowser.Priv.FullPathInTree);
|
||||
DB_QueryUPDATE (Query,"can not update properties of marks");
|
||||
|
||||
Lay_ShowAlert (Lay_INFO,Query);
|
||||
|
||||
/***** Write message of success *****/
|
||||
sprintf (Gbl.Message,Txt_The_number_of_rows_is_now_X,
|
||||
NumRows);
|
||||
|
|
|
@ -764,7 +764,8 @@ static unsigned Sch_SearchOpenDocumentsInDB (const char *RangeQuery)
|
|||
"centres.ShortName,courses.ShortName"
|
||||
" FROM files,courses,degrees,centres,institutions,countries"
|
||||
" WHERE files.Public='Y' AND %s"
|
||||
" AND files.CrsCod=courses.CrsCod"
|
||||
" AND files.FileBrowser IN ('%u','%u')"
|
||||
" AND files.Cod=courses.CrsCod"
|
||||
" AND courses.DegCod=degrees.DegCod"
|
||||
" AND degrees.CtrCod=centres.CtrCod"
|
||||
" AND centres.InsCod=institutions.InsCod"
|
||||
|
@ -773,6 +774,8 @@ static unsigned Sch_SearchOpenDocumentsInDB (const char *RangeQuery)
|
|||
" HAVING PathFromRoot<>''"
|
||||
" ORDER BY degrees.ShortName,courses.ShortName,PathFromRoot",
|
||||
SearchQuery,
|
||||
(unsigned) Brw_FILE_BRW_ADMIN_DOCUMENTS_CRS,
|
||||
(unsigned) Brw_FILE_BRW_COMMON_CRS,
|
||||
RangeQuery);
|
||||
|
||||
/***** Query database and list documents found *****/
|
||||
|
@ -805,11 +808,13 @@ static unsigned Sch_SearchDocumentsInMyCoursesInDB (const char *RangeQuery)
|
|||
It is necessary to speed up the second query *****/
|
||||
sprintf (Query,"CREATE TEMPORARY TABLE my_files (FilCod INT NOT NULL,UNIQUE INDEX(FilCod)) ENGINE=MEMORY"
|
||||
" SELECT files.FilCod FROM crs_usr,files"
|
||||
" WHERE crs_usr.UsrCod='%ld' AND crs_usr.CrsCod=files.CrsCod"
|
||||
" WHERE crs_usr.UsrCod='%ld'"
|
||||
" AND crs_usr.CrsCod=files.Cod"
|
||||
" AND files.FileBrowser IN ('%u','%u','%u')"
|
||||
" UNION"
|
||||
" SELECT files.FilCod FROM crs_grp_usr,files"
|
||||
" WHERE crs_grp_usr.UsrCod='%ld' AND crs_grp_usr.GrpCod=files.GrpCod"
|
||||
" WHERE crs_grp_usr.UsrCod='%ld'"
|
||||
" AND crs_grp_usr.GrpCod=files.Cod"
|
||||
" AND files.FileBrowser IN ('%u','%u','%u')",
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||
(unsigned) Brw_FILE_BRW_ADMIN_DOCUMENTS_CRS,
|
||||
|
@ -829,9 +834,18 @@ static unsigned Sch_SearchDocumentsInMyCoursesInDB (const char *RangeQuery)
|
|||
"SUBSTRING(files.Path,LOCATE('/',files.Path)) AS PathFromRoot,"
|
||||
"degrees.DegCod,degrees.ShortName,"
|
||||
"centres.ShortName,courses.ShortName"
|
||||
" FROM files,courses,degrees,centres,institutions,countries"
|
||||
" FROM files,crs_grp,crs_grp_types,courses,degrees,centres,institutions,countries"
|
||||
" WHERE files.FilCod IN (SELECT FilCod FROM my_files) AND %s"
|
||||
" AND files.CrsCod=courses.CrsCod"
|
||||
" AND "
|
||||
"("
|
||||
"(files.FileBrowser IN ('%u','%u','%u')"
|
||||
" AND files.Cod=courses.CrsCod)"
|
||||
" OR "
|
||||
"(files.FileBrowser IN ('%u','%u','%u')"
|
||||
" AND files.Cod=crs_grp.GrpCod"
|
||||
" AND crs_grp.GrpTypCod=crs_grp_types.GrpTypCod"
|
||||
" AND crs_grp.types.CrsCod=courses.CrsCod)"
|
||||
")"
|
||||
" AND courses.DegCod=degrees.DegCod"
|
||||
" AND degrees.CtrCod=centres.CtrCod"
|
||||
" AND centres.InsCod=institutions.InsCod"
|
||||
|
@ -840,6 +854,12 @@ static unsigned Sch_SearchDocumentsInMyCoursesInDB (const char *RangeQuery)
|
|||
" HAVING PathFromRoot<>''"
|
||||
" ORDER BY degrees.ShortName,courses.ShortName,PathFromRoot",
|
||||
SearchQuery,
|
||||
(unsigned) Brw_FILE_BRW_ADMIN_DOCUMENTS_CRS,
|
||||
(unsigned) Brw_FILE_BRW_COMMON_CRS,
|
||||
(unsigned) Brw_FILE_BRW_ADMIN_MARKS_CRS,
|
||||
(unsigned) Brw_FILE_BRW_ADMIN_DOCUMENTS_GRP,
|
||||
(unsigned) Brw_FILE_BRW_COMMON_GRP,
|
||||
(unsigned) Brw_FILE_BRW_ADMIN_MARKS_GRP,
|
||||
RangeQuery);
|
||||
|
||||
/***** Query database and list documents found *****/
|
||||
|
@ -883,9 +903,18 @@ static unsigned Sch_SearchMyDocumentsInDB (const char *RangeQuery)
|
|||
"SUBSTRING(files.Path,LOCATE('/',files.Path)) AS PathFromRoot,"
|
||||
"degrees.DegCod,degrees.ShortName AS DegShortName,"
|
||||
"centres.ShortName,courses.ShortName AS CrsShortName"
|
||||
" FROM files,courses,degrees,centres,institutions,countries"
|
||||
" FROM files,crs_grp,crs_grp_types,courses,degrees,centres,institutions,countries"
|
||||
" WHERE files.PublisherUsrCod='%ld' AND %s"
|
||||
" AND files.CrsCod=courses.CrsCod"
|
||||
" AND "
|
||||
"("
|
||||
"(files.FileBrowser IN ('%u','%u','%u')"
|
||||
" AND files.Cod=courses.CrsCod)"
|
||||
" OR "
|
||||
"(files.FileBrowser IN ('%u','%u','%u')"
|
||||
" AND files.Cod=crs_grp.GrpCod"
|
||||
" AND crs_grp.GrpTypCod=crs_grp_types.GrpTypCod"
|
||||
" AND crs_grp.types.CrsCod=courses.CrsCod)"
|
||||
")"
|
||||
" AND courses.DegCod=degrees.DegCod"
|
||||
" AND degrees.CtrCod=centres.CtrCod"
|
||||
" AND centres.InsCod=institutions.InsCod"
|
||||
|
@ -900,16 +929,32 @@ static unsigned Sch_SearchMyDocumentsInDB (const char *RangeQuery)
|
|||
") AS my_files"
|
||||
" WHERE PathFromRoot<>''"
|
||||
" ORDER BY DegShortName,CrsShortName,PathFromRoot",
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod,SearchQuery,RangeQuery,
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod,SearchQuery,
|
||||
(unsigned) Brw_FILE_BRW_ADMIN_DOCUMENTS_CRS,
|
||||
(unsigned) Brw_FILE_BRW_COMMON_CRS,
|
||||
(unsigned) Brw_FILE_BRW_ADMIN_MARKS_CRS,
|
||||
(unsigned) Brw_FILE_BRW_ADMIN_DOCUMENTS_GRP,
|
||||
(unsigned) Brw_FILE_BRW_COMMON_GRP,
|
||||
(unsigned) Brw_FILE_BRW_ADMIN_MARKS_GRP,
|
||||
RangeQuery,
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod,(unsigned) Brw_FILE_BRW_BRIEFCASE_USR,SearchQuery);
|
||||
else
|
||||
sprintf (Query,"SELECT files.FilCod,"
|
||||
"SUBSTRING(files.Path,LOCATE('/',files.Path)) AS PathFromRoot,"
|
||||
"degrees.DegCod,degrees.ShortName,"
|
||||
"centres.ShortName,courses.ShortName"
|
||||
" FROM files,courses,degrees,centres,institutions,countries"
|
||||
" FROM files,crs_grp,crs_grp_types,courses,degrees,centres,institutions,countries"
|
||||
" WHERE files.PublisherUsrCod='%ld' AND %s"
|
||||
" AND files.CrsCod=courses.CrsCod"
|
||||
" AND "
|
||||
"("
|
||||
"(files.FileBrowser IN ('%u','%u','%u')"
|
||||
" AND files.Cod=courses.CrsCod)"
|
||||
" OR "
|
||||
"(files.FileBrowser IN ('%u','%u','%u')"
|
||||
" AND files.Cod=crs_grp.GrpCod"
|
||||
" AND crs_grp.GrpTypCod=crs_grp_types.GrpTypCod"
|
||||
" AND crs_grp.types.CrsCod=courses.CrsCod)"
|
||||
")"
|
||||
" AND courses.DegCod=degrees.DegCod"
|
||||
" AND degrees.CtrCod=centres.CtrCod"
|
||||
" AND centres.InsCod=institutions.InsCod"
|
||||
|
@ -918,6 +963,12 @@ static unsigned Sch_SearchMyDocumentsInDB (const char *RangeQuery)
|
|||
" HAVING PathFromRoot<>''"
|
||||
" ORDER BY degrees.ShortName,courses.ShortName,PathFromRoot",
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod,SearchQuery,
|
||||
(unsigned) Brw_FILE_BRW_ADMIN_DOCUMENTS_CRS,
|
||||
(unsigned) Brw_FILE_BRW_COMMON_CRS,
|
||||
(unsigned) Brw_FILE_BRW_ADMIN_MARKS_CRS,
|
||||
(unsigned) Brw_FILE_BRW_ADMIN_DOCUMENTS_GRP,
|
||||
(unsigned) Brw_FILE_BRW_COMMON_GRP,
|
||||
(unsigned) Brw_FILE_BRW_ADMIN_MARKS_GRP,
|
||||
RangeQuery);
|
||||
|
||||
/***** Query database and list documents found *****/
|
||||
|
|
|
@ -4994,10 +4994,13 @@ static void Sta_GetNumberOfOERsFromDB (Sco_Scope_t Scope,Brw_License_t License,u
|
|||
" WHERE centres.InsCod='%ld'"
|
||||
" AND centres.CtrCod=degrees.CtrCod"
|
||||
" AND degrees.DegCod=courses.DegCod"
|
||||
" AND courses.CrsCod=files.CrsCod"
|
||||
" AND courses.CrsCod=files.Cod"
|
||||
" AND files.FileBrowser IN ('%u','%u')"
|
||||
" AND files.License='%u'"
|
||||
" GROUP BY files.Public",
|
||||
Gbl.CurrentIns.Ins.InsCod,
|
||||
(unsigned) Brw_FILE_BRW_ADMIN_DOCUMENTS_CRS,
|
||||
(unsigned) Brw_FILE_BRW_COMMON_CRS,
|
||||
(unsigned) License);
|
||||
break;
|
||||
case Sco_SCOPE_CENTRE:
|
||||
|
@ -5005,20 +5008,26 @@ static void Sta_GetNumberOfOERsFromDB (Sco_Scope_t Scope,Brw_License_t License,u
|
|||
" FROM degrees,courses,files"
|
||||
" WHERE degrees.CtrCod='%ld'"
|
||||
" AND degrees.DegCod=courses.DegCod"
|
||||
" AND courses.CrsCod=files.CrsCod"
|
||||
" AND courses.CrsCod=files.Cod"
|
||||
" AND files.FileBrowser IN ('%u','%u')"
|
||||
" AND files.License='%u'"
|
||||
" GROUP BY files.Public",
|
||||
Gbl.CurrentCtr.Ctr.CtrCod,
|
||||
(unsigned) Brw_FILE_BRW_ADMIN_DOCUMENTS_CRS,
|
||||
(unsigned) Brw_FILE_BRW_COMMON_CRS,
|
||||
(unsigned) License);
|
||||
break;
|
||||
case Sco_SCOPE_DEGREE:
|
||||
sprintf (Query,"SELECT files.Public,COUNT(*)"
|
||||
" FROM courses,files"
|
||||
" WHERE courses.DegCod='%ld'"
|
||||
" AND courses.CrsCod=files.CrsCod"
|
||||
" AND courses.CrsCod=files.Cod"
|
||||
" AND files.FileBrowser IN ('%u','%u')"
|
||||
" AND files.License='%u'"
|
||||
" GROUP BY files.Public",
|
||||
Gbl.CurrentDeg.Deg.DegCod,
|
||||
(unsigned) Brw_FILE_BRW_ADMIN_DOCUMENTS_CRS,
|
||||
(unsigned) Brw_FILE_BRW_COMMON_CRS,
|
||||
(unsigned) License);
|
||||
break;
|
||||
case Sco_SCOPE_COURSE:
|
||||
|
|
Loading…
Reference in New Issue