mirror of https://github.com/acanas/swad-core.git
Version 14.67
This commit is contained in:
parent
d07472ae74
commit
2296f89ac1
11
sql/swad.sql
11
sql/swad.sql
|
@ -489,13 +489,9 @@ CREATE TABLE IF NOT EXISTS file_view (
|
|||
--
|
||||
CREATE TABLE IF NOT EXISTS files (
|
||||
FilCod INT NOT NULL AUTO_INCREMENT,
|
||||
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 DEFAULT -1,
|
||||
ZoneUsrCod INT NOT NULL DEFAULT -1,
|
||||
FileBrowser TINYINT NOT NULL,
|
||||
Cod INT NOT NULL DEFAULT -1,
|
||||
ZoneUsrCod INT NOT NULL DEFAULT -1,
|
||||
PublisherUsrCod INT NOT NULL,
|
||||
FileType TINYINT NOT NULL DEFAULT 0,
|
||||
Path TEXT COLLATE latin1_bin NOT NULL,
|
||||
|
@ -503,7 +499,8 @@ CREATE TABLE IF NOT EXISTS files (
|
|||
Public ENUM('N','Y') NOT NULL DEFAULT 'N',
|
||||
License TINYINT NOT NULL DEFAULT 0,
|
||||
UNIQUE INDEX(FilCod),
|
||||
INDEX(InsCod,CtrCod,DegCod,CrsCod,GrpCod,ZoneUsrCod,FileBrowser),
|
||||
INDEX(FileBrowser,Cod,ZoneUsrCod),
|
||||
INDEX(ZoneUsrCod),
|
||||
INDEX(PublisherUsrCod));
|
||||
--
|
||||
-- Table forum_disabled_post: stores the forum post that have been disabled
|
||||
|
|
|
@ -39,11 +39,30 @@
|
|||
/****************************** Public constants *****************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
#define Log_PLATFORM_VERSION "SWAD 14.66.1 (2015/01/24)"
|
||||
#define Log_PLATFORM_VERSION "SWAD 14.67 (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.67: Jan 25, 2015 Changes in files table. (175369 lines)
|
||||
16 changes necessary in database:
|
||||
ALTER TABLE files ADD COLUMN ZoneUsrCod2 INT NOT NULL DEFAULT -1 AFTER FileBrowser;
|
||||
UPDATE files SET ZoneUsrCod2=ZoneUsrCod;
|
||||
ALTER TABLE files DROP COLUMN ZoneUsrCod;
|
||||
ALTER TABLE files CHANGE COLUMN ZoneUsrCod2 ZoneUsrCod INT NOT NULL DEFAULT -1;
|
||||
ALTER TABLE files ADD COLUMN Cod INT NOT NULL DEFAULT -1 AFTER FileBrowser, ADD INDEX (FileBrowser,Cod,ZoneUsrCod);
|
||||
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=GrpCod WHERE GrpCod>'0';
|
||||
ALTER TABLE files DROP COLUMN InsCod;
|
||||
ALTER TABLE files DROP COLUMN CtrCod;
|
||||
ALTER TABLE files DROP COLUMN DegCod;
|
||||
ALTER TABLE files DROP COLUMN CrsCod;
|
||||
ALTER TABLE files DROP COLUMN GrpCod;
|
||||
|
||||
Version 14.66.1: Jan 24, 2015 Fixed bug in clipboard. (175404 lines)
|
||||
Version 14.66: Jan 24, 2015 Changes in clipboard table. (175401 lines)
|
||||
13 changes necessary in database:
|
||||
|
|
|
@ -1039,13 +1039,9 @@ mysql> DESCRIBE files;
|
|||
| Field | Type | Null | Key | Default | Extra |
|
||||
+-----------------+---------------+------+-----+---------+----------------+
|
||||
| FilCod | int(11) | NO | PRI | NULL | auto_increment |
|
||||
| InsCod | int(11) | NO | MUL | -1 | |
|
||||
| CtrCod | int(11) | NO | | -1 | |
|
||||
| DegCod | int(11) | NO | | -1 | |
|
||||
| CrsCod | int(11) | NO | | -1 | |
|
||||
| GrpCod | int(11) | NO | | -1 | |
|
||||
| ZoneUsrCod | int(11) | NO | | -1 | |
|
||||
| FileBrowser | tinyint(4) | NO | | NULL | |
|
||||
| FileBrowser | tinyint(4) | NO | MUL | NULL | |
|
||||
| Cod | int(11) | NO | | -1 | |
|
||||
| ZoneUsrCod | int(11) | NO | MUL | -1 | |
|
||||
| PublisherUsrCod | int(11) | NO | MUL | NULL | |
|
||||
| FileType | tinyint(4) | NO | | 0 | |
|
||||
| Path | text | NO | | NULL | |
|
||||
|
@ -1053,24 +1049,23 @@ mysql> DESCRIBE files;
|
|||
| Public | enum('N','Y') | NO | | N | |
|
||||
| License | tinyint(4) | NO | | 0 | |
|
||||
+-----------------+---------------+------+-----+---------+----------------+
|
||||
14 rows in set (0.00 sec)
|
||||
10 rows in set (0.00 sec)
|
||||
*/
|
||||
DB_CreateTable ("CREATE TABLE IF NOT EXISTS files ("
|
||||
"FilCod INT NOT NULL AUTO_INCREMENT,"
|
||||
"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 DEFAULT -1,"
|
||||
"ZoneUsrCod INT NOT NULL DEFAULT -1,"
|
||||
"FileBrowser TINYINT NOT NULL,"
|
||||
"Cod INT NOT NULL DEFAULT -1,"
|
||||
"ZoneUsrCod INT NOT NULL DEFAULT -1,"
|
||||
"PublisherUsrCod INT NOT NULL,"
|
||||
"FileType TINYINT NOT NULL DEFAULT 0"
|
||||
"Path TEXT COLLATE latin1_bin NOT NULL,"
|
||||
"Hidden ENUM('N','Y') NOT NULL DEFAULT 'N',"
|
||||
"Public ENUM('N','Y') NOT NULL DEFAULT 'N',"
|
||||
"License TINYINT NOT NULL DEFAULT 0,"
|
||||
"UNIQUE INDEX(FilCod),INDEX(InsCod,CtrCod,DegCod,CrsCod,GrpCod,ZoneUsrCod,FileBrowser),INDEX(PublisherUsrCod))");
|
||||
"UNIQUE INDEX(FilCod),"
|
||||
"INDEX(FileBrowser,Cod,ZoneUsrCod),"
|
||||
"INDEX(ZoneUsrCod),"
|
||||
"INDEX(PublisherUsrCod))");
|
||||
|
||||
/***** Table forum_disabled_post *****/
|
||||
/*
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -97,13 +97,9 @@ typedef enum // Don't change these values! They are stored in database as number
|
|||
struct FileMetadata
|
||||
{
|
||||
long FilCod;
|
||||
long InsCod;
|
||||
long CtrCod;
|
||||
long DegCod;
|
||||
long CrsCod;
|
||||
long GrpCod;
|
||||
long ZoneUsrCod;
|
||||
Brw_FileBrowser_t FileBrowser;
|
||||
long Cod; // Code of institution, centre, degree, course or group
|
||||
long ZoneUsrCod;
|
||||
long PublisherUsrCod;
|
||||
char Path[PATH_MAX+1];
|
||||
bool IsHidden;
|
||||
|
@ -179,6 +175,9 @@ void Brw_GetFileMetadataByCod (struct FileMetadata *FileMetadata);
|
|||
bool Brw_GetFileSizeAndDate (struct FileMetadata *FileMetadata);
|
||||
void Brw_GetAndUpdateFileViews (struct FileMetadata *FileMetadata);
|
||||
void Brw_UpdateMyFileViews (long FilCod);
|
||||
|
||||
void Brw_GetCrsGrpFromFileMetadata (struct FileMetadata *FileMetadata,long *CrsCod,long *GrpCod);
|
||||
|
||||
long Brw_AddPathToDB (long PublisherUsrCod,Brw_FileType_t FileType,
|
||||
const char *Path,bool IsPublic,Brw_License_t License);
|
||||
|
||||
|
|
|
@ -621,8 +621,7 @@ static void Ntf_StartFormGoToAction (Ntf_NotifyEvent_t NotifyEvent,
|
|||
{
|
||||
FileMetadata.FilCod = Cod;
|
||||
Brw_GetFileMetadataByCod (&FileMetadata);
|
||||
CrsCod = FileMetadata.CrsCod;
|
||||
GrpCod = FileMetadata.GrpCod;
|
||||
Brw_GetCrsGrpFromFileMetadata (&FileMetadata,&CrsCod,&GrpCod);
|
||||
Str_SplitFullPathIntoPathAndFileName (FileMetadata.Path,
|
||||
PathUntilFileName,
|
||||
FileName);
|
||||
|
@ -844,9 +843,8 @@ void Ntf_SetNotifInCrsAsRemoved (long CrsCod,long ToUsrCod)
|
|||
/************ Set possible notifications of one file as removed **************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Ntf_SetNotifOneFileAsRemoved (long CrsCod,long GrpCod,
|
||||
Brw_FileBrowser_t FileBrowser,
|
||||
const char *Path)
|
||||
void Ntf_SetNotifOneFileAsRemoved (Brw_FileBrowser_t FileBrowser,
|
||||
long Cod,const char *Path)
|
||||
{
|
||||
char Query[512];
|
||||
char SubQuery[256];
|
||||
|
@ -881,8 +879,8 @@ void Ntf_SetNotifOneFileAsRemoved (long CrsCod,long GrpCod,
|
|||
case Brw_FILE_BRW_ADMIN_MARKS_CRS:
|
||||
case Brw_FILE_BRW_ADMIN_MARKS_GRP:
|
||||
sprintf (SubQuery,"SELECT FilCod FROM files"
|
||||
" WHERE CrsCod='%ld' AND GrpCod='%ld' AND Path='%s'",
|
||||
CrsCod,GrpCod,Path);
|
||||
" WHERE FileBrowser='%u' AND Cod='%ld' AND Path='%s'",
|
||||
(unsigned) FileBrowser,Cod,Path);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -898,9 +896,8 @@ void Ntf_SetNotifOneFileAsRemoved (long CrsCod,long GrpCod,
|
|||
/************** Set possible notifications of marks as removed ***************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Ntf_SetNotifChildrenOfFolderAsRemoved (long CrsCod,long GrpCod,
|
||||
Brw_FileBrowser_t FileBrowser,
|
||||
const char *Path)
|
||||
void Ntf_SetNotifChildrenOfFolderAsRemoved (Brw_FileBrowser_t FileBrowser,
|
||||
long Cod,const char *Path)
|
||||
{
|
||||
char Query[512];
|
||||
char SubQuery[256];
|
||||
|
@ -935,8 +932,8 @@ void Ntf_SetNotifChildrenOfFolderAsRemoved (long CrsCod,long GrpCod,
|
|||
case Brw_FILE_BRW_ADMIN_MARKS_CRS:
|
||||
case Brw_FILE_BRW_ADMIN_MARKS_GRP:
|
||||
sprintf (SubQuery,"SELECT FilCod FROM files"
|
||||
" WHERE CrsCod='%ld' AND GrpCod='%ld' AND Path LIKE '%s/%%'",
|
||||
CrsCod,GrpCod,Path);
|
||||
" WHERE FileBrowser='%u' AND Cod='%ld' AND Path LIKE '%s/%%'",
|
||||
(unsigned) FileBrowser,Cod,Path);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -952,7 +949,7 @@ void Ntf_SetNotifChildrenOfFolderAsRemoved (long CrsCod,long GrpCod,
|
|||
/******* Set all possible notifications of files in a group as removed *******/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Ntf_SetNotifFilesInGroupAsRemoved (long CrsCod,long GrpCod)
|
||||
void Ntf_SetNotifFilesInGroupAsRemoved (long GrpCod)
|
||||
{
|
||||
char Query[512];
|
||||
|
||||
|
@ -960,12 +957,15 @@ void Ntf_SetNotifFilesInGroupAsRemoved (long CrsCod,long GrpCod)
|
|||
sprintf (Query,"UPDATE notif SET Status=(Status | %u)"
|
||||
" WHERE NotifyEvent IN ('%u','%u','%u') AND Cod IN"
|
||||
" (SELECT FilCod FROM files"
|
||||
" WHERE CrsCod='%ld' AND GrpCod='%ld')",
|
||||
" WHERE FileBrowser IN ('%u','%u','%u') AND Cod='%ld')",
|
||||
(unsigned) Ntf_STATUS_BIT_REMOVED,
|
||||
(unsigned) Ntf_EVENT_DOCUMENT_FILE,
|
||||
(unsigned) Ntf_EVENT_SHARED_FILE,
|
||||
(unsigned) Ntf_EVENT_MARKS_FILE,
|
||||
CrsCod,GrpCod);
|
||||
(unsigned) Brw_FILE_BRW_ADMIN_DOCUMENTS_GRP,
|
||||
(unsigned) Brw_FILE_BRW_COMMON_GRP,
|
||||
(unsigned) Brw_FILE_BRW_ADMIN_MARKS_GRP,
|
||||
GrpCod);
|
||||
DB_QueryUPDATE (Query,"can not set notification(s) as removed");
|
||||
}
|
||||
|
||||
|
|
|
@ -98,13 +98,11 @@ void Ntf_SetNotifAsSeen (Ntf_NotifyEvent_t NotifyEvent,long Cod,long ToUsrCod);
|
|||
void Ntf_SetNotifAsRemoved (Ntf_NotifyEvent_t NotifyEvent,long Cod);
|
||||
void Ntf_SetNotifToOneUsrAsRemoved (Ntf_NotifyEvent_t NotifyEvent,long Cod,long ToUsrCod);
|
||||
void Ntf_SetNotifInCrsAsRemoved (long CrsCod,long ToUsrCod);
|
||||
void Ntf_SetNotifOneFileAsRemoved (long CrsCod,long GrpCod,
|
||||
Brw_FileBrowser_t FileBrowser,
|
||||
const char *Path);
|
||||
void Ntf_SetNotifChildrenOfFolderAsRemoved (long CrsCod,long GrpCod,
|
||||
Brw_FileBrowser_t FileBrowser,
|
||||
const char *Path);
|
||||
void Ntf_SetNotifFilesInGroupAsRemoved (long CrsCod,long GrpCod);
|
||||
void Ntf_SetNotifOneFileAsRemoved (Brw_FileBrowser_t FileBrowser,
|
||||
long Cod,const char *Path);
|
||||
void Ntf_SetNotifChildrenOfFolderAsRemoved (Brw_FileBrowser_t FileBrowser,
|
||||
long Cod,const char *Path);
|
||||
void Ntf_SetNotifFilesInGroupAsRemoved (long GrpCod);
|
||||
unsigned Ntf_StoreNotifyEventsToAllUsrs (Ntf_NotifyEvent_t NotifyEvent,long Cod);
|
||||
void Ntf_StoreNotifyEventToOneUser (Ntf_NotifyEvent_t NotifyEvent,
|
||||
struct UsrData *UsrDat,
|
||||
|
|
|
@ -3867,8 +3867,9 @@ int swad__getFile (struct soap *soap,
|
|||
"The file requested does not exists");
|
||||
|
||||
/***** Set course and group codes *****/
|
||||
Gbl.CurrentCrs.Crs.CrsCod = FileMetadata.CrsCod;
|
||||
Gbl.CurrentCrs.Grps.GrpCod = FileMetadata.GrpCod;
|
||||
Brw_GetCrsGrpFromFileMetadata (&FileMetadata,
|
||||
&Gbl.CurrentCrs.Crs.CrsCod,
|
||||
&Gbl.CurrentCrs.Grps.GrpCod);
|
||||
|
||||
/***** Get some of my data *****/
|
||||
if ((ReturnCode = Svc_GetSomeUsrDataFromUsrCod (&Gbl.Usrs.Me.UsrDat,Gbl.CurrentCrs.Crs.CrsCod)) != SOAP_OK)
|
||||
|
@ -4002,14 +4003,10 @@ int swad__getMarks (struct soap *soap,
|
|||
"Bad file code",
|
||||
"You can not get marks from this file");
|
||||
|
||||
if (FileMetadata.FileBrowser != Brw_FILE_BRW_ADMIN_MARKS_CRS &&
|
||||
FileMetadata.GrpCod > 0)
|
||||
return soap_receiver_fault (Gbl.soap,
|
||||
"Bad file code",
|
||||
"You can not get marks from this file");
|
||||
|
||||
Gbl.CurrentCrs.Crs.CrsCod = FileMetadata.CrsCod;
|
||||
Gbl.CurrentCrs.Grps.GrpCod = FileMetadata.GrpCod;
|
||||
/***** Set course and group codes *****/
|
||||
Brw_GetCrsGrpFromFileMetadata (&FileMetadata,
|
||||
&Gbl.CurrentCrs.Crs.CrsCod,
|
||||
&Gbl.CurrentCrs.Grps.GrpCod);
|
||||
|
||||
/***** Check course and group codes *****/
|
||||
if ((ReturnCode = Svc_CheckCourseAndGroupCodes (Gbl.CurrentCrs.Crs.CrsCod,Gbl.CurrentCrs.Grps.GrpCod)) != SOAP_OK)
|
||||
|
|
Loading…
Reference in New Issue