From 54eef99ee4c04fec30cc203b0ab3f5d457e232bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Ca=C3=B1as=20Vargas?= Date: Mon, 14 Nov 2016 11:57:42 +0100 Subject: [PATCH] Version 16.59.3 --- swad_assignment.c | 20 ++++++++------------ swad_changelog.h | 5 ++++- swad_file_browser.c | 16 ++++++++-------- swad_global.h | 3 +-- 4 files changed, 21 insertions(+), 23 deletions(-) diff --git a/swad_assignment.c b/swad_assignment.c index 7719a613..81f07256 100644 --- a/swad_assignment.c +++ b/swad_assignment.c @@ -719,10 +719,17 @@ static void Asg_GetDataOfAssignment (struct Assignment *Asg,const char *Query) MYSQL_ROW row; unsigned long NumRows; - /***** Clear data *****/ + /***** Clear all assignment data *****/ + Asg->AsgCod = -1L; + Asg->Hidden = false; + Asg->UsrCod = -1L; Asg->TimeUTC[Asg_START_TIME] = Asg->TimeUTC[Asg_END_TIME ] = (time_t) 0; + Asg->Open = false; Asg->Title[0] = '\0'; + Asg->SendWork = false; + Asg->Folder[0] = '\0'; + Asg->IBelongToCrsOrGrps = false; /***** Get data of assignment from database *****/ NumRows = DB_QuerySELECT (Query,&mysql_res,"can not get assignment data"); @@ -760,17 +767,6 @@ static void Asg_GetDataOfAssignment (struct Assignment *Asg,const char *Query) /* Can I do this assignment? */ Asg->IBelongToCrsOrGrps = Asg_CheckIfIBelongToCrsOrGrpsThisAssignment (Asg->AsgCod); } - else - { - /* Initialize to empty assignment */ - Asg->AsgCod = -1L; - Asg->Hidden = false; - Asg->Open = false; - Asg->Title[0] = '\0'; - Asg->SendWork = false; - Asg->Folder[0] = '\0'; - Asg->IBelongToCrsOrGrps = false; - } /***** Free structure that stores the query result *****/ DB_FreeMySQLResult (&mysql_res); diff --git a/swad_changelog.h b/swad_changelog.h index ad3bdbd3..dc3a973e 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -151,17 +151,20 @@ // TODO: STATS > Figures > Folders and files --> statistics about documents and shared in institutions, centres and degrees +// TODO: When an assignment has the same name or the same folder as another existing assignment, after error the fields are empty! + /*****************************************************************************/ /****************************** Public constants *****************************/ /*****************************************************************************/ -#define Log_PLATFORM_VERSION "SWAD 16.59.2 (2016-11-14)" +#define Log_PLATFORM_VERSION "SWAD 16.59.3 (2016-11-14)" #define CSS_FILE "swad16.59.css" #define JS_FILE "swad16.46.1.js" // Number of lines (includes comments but not blank lines) has been got with the following command: // nl swad*.c swad*.h css/swad*.css py/swad*.py js/swad*.js soap/swad*?.h sql/swad*.sql | tail -1 /* + Version 16.59.3: Nov 14, 2016 Code refactoring in file browser. (207072 lines) Version 16.59.2: Nov 14, 2016 Fix bug in user's usage report. (207077 lines) Version 16.59.1: Nov 14, 2016 Fix bug in deletion of a notice, reported by Javier Fernández Baldomero and others. (207076 lines) Version 16.59: Nov 14, 2016 Changes in layout of contextual help icon. diff --git a/swad_file_browser.c b/swad_file_browser.c index d781af58..6a840f6e 100644 --- a/swad_file_browser.c +++ b/swad_file_browser.c @@ -5182,7 +5182,6 @@ static bool Brw_WriteRowFileBrowser (unsigned Level, fprintf (Gbl.F.Out,""); /****** If current action allows file administration... ******/ - Gbl.FileBrowser.ICanRemoveFileOrFolder = Gbl.FileBrowser.ICanEditFileOrFolder = false; if (Brw_FileBrowserIsEditable[Gbl.FileBrowser.Type] && !Gbl.FileBrowser.ShowOnlyPublicFiles) @@ -5195,9 +5194,6 @@ static bool Brw_WriteRowFileBrowser (unsigned Level, /* Check if I can modify (remove, rename, etc.) this file or folder */ Gbl.FileBrowser.ICanEditFileOrFolder = Brw_CheckIfICanEditFileOrFolder (Level); - Gbl.FileBrowser.ICanRemoveFileOrFolder = (Gbl.FileBrowser.Type == Brw_ADMI_BRIEF_USR && - Level != 0) ? true : - Gbl.FileBrowser.ICanEditFileOrFolder; /* Put icons to remove, copy and paste */ Brw_PutIconsRemoveCopyPaste (Level,FileType,PathInTree,FileName,FileNameToShow); @@ -5385,7 +5381,7 @@ static void Brw_PutIconRemoveFile (Brw_FileType_t FileType, fprintf (Gbl.F.Out,"",Gbl.RowEvenOdd); - if (Gbl.FileBrowser.ICanRemoveFileOrFolder) // Can I remove this file? + if (Gbl.FileBrowser.ICanEditFileOrFolder) // Can I remove this file? { /***** Form to remove a file *****/ Act_FormStart (Brw_ActAskRemoveFile[Gbl.FileBrowser.Type]); @@ -5430,7 +5426,7 @@ static void Brw_PutIconRemoveDir (const char *PathInTree,const char *FileName,co fprintf (Gbl.F.Out,"",Gbl.RowEvenOdd); - if (Gbl.FileBrowser.ICanRemoveFileOrFolder) // Can I remove this folder? + if (Gbl.FileBrowser.ICanEditFileOrFolder) // Can I remove this folder? { /***** Form to remove a folder *****/ Act_FormStart (Brw_ActRemoveFolder[Gbl.FileBrowser.Type]); @@ -5985,6 +5981,10 @@ static void Brw_WriteFileName (unsigned Level,bool IsPublic,Brw_FileType_t FileT case Brw_ADMI_WORKS_CRS: Usr_PutHiddenParUsrCodAll (Brw_ActRenameFolder[Gbl.FileBrowser.Type],Gbl.Usrs.Select.All); Usr_PutParamOtherUsrCodEncrypted (); + + fprintf (Gbl.F.Out,"%ld", + Gbl.FileBrowser.Asg.AsgCod); // TODO: Remove this!!!!!!!!!!!!!!! + break; default: break; @@ -11116,7 +11116,7 @@ static bool Brw_CheckIfICanEditFileOrFolder (unsigned Level) return Brw_CheckIfICanModifySharedFileOrFolder (); case Brw_ADMI_ASSIG_USR: case Brw_ADMI_ASSIG_CRS: - return (Gbl.FileBrowser.Asg.AsgCod < 0 || // If folder does not correspond to any assignment + return (Gbl.FileBrowser.Asg.AsgCod <= 0 || // If folder does not correspond to any assignment (!Gbl.FileBrowser.Asg.Hidden && // If assignment is visible (not hidden) Gbl.FileBrowser.Asg.IBelongToCrsOrGrps && // If I can do this assignment ((Gbl.Usrs.Me.LoggedRole == Rol_STUDENT && Gbl.FileBrowser.Asg.Open) || @@ -11146,7 +11146,7 @@ static bool Brw_CheckIfICanCreateIntoFolder (unsigned Level) case Brw_ADMI_ASSIG_USR: case Brw_ADMI_ASSIG_CRS: return (Level != 0 && - (Gbl.FileBrowser.Asg.AsgCod < 0 || // If folder does not correspond to any assignment + (Gbl.FileBrowser.Asg.AsgCod <= 0 || // If folder does not correspond to any assignment (!Gbl.FileBrowser.Asg.Hidden && // If assignment is visible (not hidden) Gbl.FileBrowser.Asg.IBelongToCrsOrGrps && // If I can do this assignment ((Gbl.Usrs.Me.LoggedRole == Rol_STUDENT && Gbl.FileBrowser.Asg.Open) || diff --git a/swad_global.h b/swad_global.h index f59f83f9..bc5bbf4f 100644 --- a/swad_global.h +++ b/swad_global.h @@ -527,8 +527,7 @@ struct Globals char FilFolLnkName[NAME_MAX+1]; Brw_FileType_t FileType; unsigned Level; - bool ICanRemoveFileOrFolder; // Can I remove a file or folder? - bool ICanEditFileOrFolder; // Can I modify (rename, create inside, etc.) a file or folder? + bool ICanEditFileOrFolder; // Can I modify (remove, rename, create inside, etc.) a file or folder? Brw_IconViewEdit_t IconViewEdit; struct {