From faa0c5c44f1b09f09e96b569444532d0dffff963 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Ca=C3=B1as=20Vargas?= Date: Tue, 22 Nov 2016 13:26:34 +0100 Subject: [PATCH] Version 16.68.5 --- swad_changelog.h | 3 ++- swad_file_browser.c | 43 +++++++++++++++++++------------------------ swad_zip.c | 12 +++++------- swad_zip.h | 2 +- 4 files changed, 27 insertions(+), 33 deletions(-) diff --git a/swad_changelog.h b/swad_changelog.h index f6c69c23..022ddf56 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -172,13 +172,14 @@ /****************************** Public constants *****************************/ /*****************************************************************************/ -#define Log_PLATFORM_VERSION "SWAD 16.68.4 (2016-11-22)" +#define Log_PLATFORM_VERSION "SWAD 16.68.5 (2016-11-22)" #define CSS_FILE "swad16.68.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.68.5: Nov 22, 2016 Code refactoring and change in layout of file browser and contextual links. (207443 lines) Version 16.68.4: Nov 22, 2016 Code refactoring in file browser. (207447 lines) Version 16.68.3: Nov 22, 2016 Change in layout of contextual links in file browsers. (207436 lines) Version 16.68.2: Nov 22, 2016 Code refactoring related to file browser and contextual checkbox. (207438 lines) diff --git a/swad_file_browser.c b/swad_file_browser.c index d2631170..310321ae 100644 --- a/swad_file_browser.c +++ b/swad_file_browser.c @@ -1450,7 +1450,6 @@ static bool Brw_CheckIfQuotaExceded (void); static void Brw_ShowFileBrowserNormal (void); static void Brw_ShowFileBrowsersAsgWrkCrs (void); -static void Brw_PutLinkZIPAsgWrk (void); static void Brw_ShowFileBrowsersAsgWrkUsr (void); static void Brw_FormToChangeCrsGrpZone (void); @@ -3131,8 +3130,9 @@ static void Brw_ShowFileBrowsersAsgWrkCrs (void) /***** Check the number of users whose works will be shown *****/ if (Usr_CountNumUsrsInListOfSelectedUsrs ()) // If some users are selected... { - /***** Put link to download / create zip file *****/ - Brw_PutLinkZIPAsgWrk (); + /***** Create the zip file and put a link to download it *****/ + if (Gbl.FileBrowser.ZIP.CreateZIP) + ZIP_CreateZIPAsgWrk (); /***** Write top before showing file browser *****/ Brw_WriteTopBeforeShowingFileBrowser (); @@ -3189,23 +3189,6 @@ static void Brw_ShowFileBrowsersAsgWrkCrs (void) Usr_FreeListsSelectedUsrsCods (); } -/*****************************************************************************/ -/******** Put link to download / create zip file in assigments / works *******/ -/*****************************************************************************/ - -static void Brw_PutLinkZIPAsgWrk (void) - { - if (Gbl.FileBrowser.ZIP.CreateZIP) - { - /* Create the zip file and put a link to download it */ - ZIP_CreateZIPAsgWrk (); - } - else - /***** Button to create a zip file - with all the works of the selected users *****/ - ZIP_PutButtonToCreateZIPAsgWrk (); - } - /*****************************************************************************/ /************ Show file browsers with works files of one user ****************/ /*****************************************************************************/ @@ -3726,10 +3709,22 @@ static void Brw_WriteTopBeforeShowingFileBrowser (void) /* Put checkbox to show the full tree */ Brw_PutCheckboxFullTree (); - /* Put link to remove old files */ - if (Gbl.FileBrowser.Type == Brw_ADMI_BRIEF_USR && - Gbl.Action.Act != ActReqRemOldBrf) - Brw_PutLinkToAskRemOldFiles (); + switch (Gbl.FileBrowser.Type) + { + case Brw_ADMI_ASSIG_CRS: + case Brw_ADMI_WORKS_CRS: + /* Put link to create a zip file with all the works of the selected users */ + if (!Gbl.FileBrowser.ZIP.CreateZIP) + ZIP_PutLinkToCreateZIPAsgWrk (); + break; + case Brw_ADMI_BRIEF_USR: + /* Put link to remove old files */ + if (Gbl.Action.Act != ActReqRemOldBrf) + Brw_PutLinkToAskRemOldFiles (); + break; + default: + break; + } fprintf (Gbl.F.Out,""); diff --git a/swad_zip.c b/swad_zip.c index 88f1a213..fffe71ac 100644 --- a/swad_zip.c +++ b/swad_zip.c @@ -102,7 +102,7 @@ extern struct Globals Gbl; /***************************** Internal prototypes ***************************/ /*****************************************************************************/ -static void ZIP_PutButtonToCreateZIPAsgWrkParams (void); +static void ZIP_PutLinkToCreateZIPAsgWrkParams (void); static void ZIP_CreateTmpDirForCompression (void); static void ZIP_CreateDirCompressionUsr (struct UsrData *UsrDat); @@ -113,22 +113,20 @@ static void ZIP_ShowLinkToDownloadZIP (const char *FileName,const char *URL, off_t FileSize,unsigned long long UncompressedSize); /*****************************************************************************/ -/********* Put button to create ZIP file of assignments and works ************/ +/*********** Put link to create ZIP file of assignments and works ************/ /*****************************************************************************/ -void ZIP_PutButtonToCreateZIPAsgWrk (void) +void ZIP_PutLinkToCreateZIPAsgWrk (void) { extern const char *Txt_Create_ZIP_file; - fprintf (Gbl.F.Out,"
"); - Lay_PutContextualLink (ActAdmAsgWrkCrs,ZIP_PutButtonToCreateZIPAsgWrkParams, + Lay_PutContextualLink (ActAdmAsgWrkCrs,ZIP_PutLinkToCreateZIPAsgWrkParams, "download64x64.png", Txt_Create_ZIP_file,Txt_Create_ZIP_file, NULL); - fprintf (Gbl.F.Out,"
"); } -static void ZIP_PutButtonToCreateZIPAsgWrkParams (void) +static void ZIP_PutLinkToCreateZIPAsgWrkParams (void) { Usr_PutHiddenParUsrCodAll (ActAdmAsgWrkCrs,Gbl.Usrs.Select.All); if (Gbl.FileBrowser.FullTree) diff --git a/swad_zip.h b/swad_zip.h index b3450478..e3f4c4c2 100644 --- a/swad_zip.h +++ b/swad_zip.h @@ -43,7 +43,7 @@ /***************************** Public prototypes *****************************/ /*****************************************************************************/ -void ZIP_PutButtonToCreateZIPAsgWrk (void); +void ZIP_PutLinkToCreateZIPAsgWrk (void); bool ZIP_GetCreateZIPFromForm (void); void ZIP_CreateZIPAsgWrk (void);