Version 16.59.3

This commit is contained in:
Antonio Cañas Vargas 2016-11-14 11:57:42 +01:00
parent 916bdc67f2
commit 54eef99ee4
4 changed files with 21 additions and 23 deletions

View File

@ -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);

View File

@ -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.

View File

@ -5182,7 +5182,6 @@ static bool Brw_WriteRowFileBrowser (unsigned Level,
fprintf (Gbl.F.Out,"<tr>");
/****** 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,"<td class=\"BM%u\">",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,"<td class=\"BM%u\">",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,"<strong>%ld</strong>",
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) ||

View File

@ -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
{