Version 15.70.2

This commit is contained in:
Antonio Cañas Vargas 2015-12-21 11:07:54 +01:00
parent e9a7b6b79d
commit c5dddc2eb7
7 changed files with 138 additions and 71 deletions

View File

@ -2643,7 +2643,7 @@ struct Act_Actions Act_Actions[Act_NUM_ACTIONS] =
/* ActReqDatBrf */{1047,-1,TabPrf,ActAdmBrf ,0x1FE,0x1FE,0x1FE,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Brw_ShowFileMetadata ,NULL},
/* ActChgDatBrf */{1048,-1,TabPrf,ActAdmBrf ,0x1FC,0x1FC,0x1FC,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Brw_ChgFileMetadata ,NULL},
/* ActDowBrf */{1123,-1,TabPrf,ActAdmBrf ,0x1FE,0x1FE,0x1FE,Act_CONTENT_NORM,Act_DOWNLD_FILE,Brw_DownloadFile ,NULL ,NULL},
/* ActAskRemOldBrf */{1488,-1,TabPrf,ActAdmBrf ,0x1FE,0x1FE,0x1FE,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Brw_ConfirmRemoveOldFiles ,NULL},
/* ActAskRemOldBrf */{1488,-1,TabPrf,ActAdmBrf ,0x1FE,0x1FE,0x1FE,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Brw_AskRemoveOldFiles ,NULL},
/* ActRemOldBrf */{1489,-1,TabPrf,ActAdmBrf ,0x1FE,0x1FE,0x1FE,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Brw_RemoveOldFiles ,NULL},
};

View File

@ -118,12 +118,13 @@
/****************************** Public constants *****************************/
/*****************************************************************************/
#define Log_PLATFORM_VERSION "SWAD 15.70.1 (2015/12/21)"
#define Log_PLATFORM_VERSION "SWAD 15.70.2 (2015/12/21)"
#define CSS_FILE "swad15.65.1.css"
// 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 15.70.2: Dec 21, 2015 Users can selected number of months in form to remove old files in briefcase. Not finished. (187473 lines)
Version 15.70.1: Dec 21, 2015 Removing old files in briefcase. Not finished. (187408 lines)
Version 15.70: Dec 21, 2015 New action to remove old files in briefcase. Not finished. (187352 lines)
Version 15.69: Dec 20, 2015 New option in briefcase to ask for removing old files. (187270 lines)

View File

@ -507,8 +507,6 @@
#define Cfg_TIME_TO_DELETE_BROWSER_CLIPBOARD ((time_t)( 15UL*60UL)) // Paths older than these seconds are removed from clipboard
#define Cfg_TIME_TO_DELETE_BROWSER_ZIP_FILES ((time_t)( 2UL*60UL*60UL)) // Temporary zip files are deleted after these seconds
#define Cfg_MONTHS_TO_DELETE_OLD_BRIEFCASE_FILES 24 // Months to remove old files in briefcase
#define Cfg_TIME_TO_DELETE_MARKS_TMP_FILES ((time_t)( 2UL*60UL*60UL)) // Temporary files with students' marks are deleted after these seconds
#define Cfg_TIME_TO_DELETE_PARAMS_TO_COMMANDS ((time_t)( 15UL*60UL)) // Temporary files with params to commands are deleted after these seconds

View File

@ -700,7 +700,6 @@ void Enr_AskRemoveOldUsrs (void)
extern const char *Txt_Eliminate_all_users_who_are_not_enrolled_on_any_courses_PART_1_OF_2;
extern const char *Txt_Eliminate_all_users_who_are_not_enrolled_on_any_courses_PART_2_OF_2;
extern const char *Txt_Eliminate;
unsigned MonthsWithoutAccess = Usr_DEF_MONTHS_WITHOUT_ACCESS_TO_REMOVE_OLD_USRS;
unsigned Months;
/***** Start form *****/
@ -719,7 +718,7 @@ void Enr_AskRemoveOldUsrs (void)
Months++)
{
fprintf (Gbl.F.Out,"<option");
if (Months == MonthsWithoutAccess)
if (Months == Usr_DEF_MONTHS_WITHOUT_ACCESS_TO_REMOVE_OLD_USRS)
fprintf (Gbl.F.Out," selected=\"selected\"");
fprintf (Gbl.F.Out,">%u</option>",Months);
}
@ -747,7 +746,7 @@ void Enr_RemoveOldUsrs (void)
extern const char *Txt_X_users_have_been_eliminated;
char UnsignedStr[10+1];
unsigned MonthsWithoutAccess;
unsigned long SecondsWithoutAccess;
time_t SecondsWithoutAccess;
char Query[1024];
MYSQL_RES *mysql_res;
MYSQL_ROW row;
@ -759,11 +758,11 @@ void Enr_RemoveOldUsrs (void)
/***** Get parameter with number of months without access *****/
Par_GetParToText ("Months",UnsignedStr,10);
if (sscanf (UnsignedStr,"%u",&MonthsWithoutAccess) != 1)
Lay_ShowErrorAndExit ("Number of months without clicks is missing.");
Lay_ShowErrorAndExit ("Number of months is missing.");
if (MonthsWithoutAccess < Usr_MIN_MONTHS_WITHOUT_ACCESS_TO_REMOVE_OLD_USRS ||
MonthsWithoutAccess > Usr_MAX_MONTHS_WITHOUT_ACCESS_TO_REMOVE_OLD_USRS)
Lay_ShowErrorAndExit ("Wrong number of months without clicks.");
SecondsWithoutAccess = (unsigned long) MonthsWithoutAccess * Dat_SECONDS_IN_ONE_MONTH;
Lay_ShowErrorAndExit ("Wrong number of months.");
SecondsWithoutAccess = (time_t) MonthsWithoutAccess * Dat_SECONDS_IN_ONE_MONTH;
/***** Get old users from database *****/
sprintf (Query,"SELECT UsrCod FROM"
@ -775,7 +774,7 @@ void Enr_RemoveOldUsrs (void)
" UsrCod NOT IN (SELECT UsrCod FROM usr_last)"
") AS candidate_usrs"
" WHERE UsrCod NOT IN (SELECT DISTINCT UsrCod FROM crs_usr)",
SecondsWithoutAccess);
(unsigned long) SecondsWithoutAccess);
if ((NumUsrs = DB_QuerySELECT (Query,&mysql_res,"can not get old users")))
{
sprintf (Gbl.Message,Txt_Eliminating_X_users_who_were_not_enrolled_in_any_course_and_with_more_than_Y_months_without_access_to_Z,

View File

@ -1454,8 +1454,9 @@ static bool Brw_CheckIfIHavePermissionFileOrFolderCommon (void);
static void Brw_WriteRowDocData (unsigned *NumDocsNotHidden,MYSQL_ROW row);
static void Brw_PutFormToAskRemOldFiles (void);
static void Brw_RemoveOldFilesInBrowser (void);
static void Brw_ScanDirRemovingOlfFiles (unsigned Level,const char *Path);
static void Brw_RemoveOldFilesInBrowser (time_t TimeRemoveFilesOlder);
static void Brw_ScanDirRemovingOlfFiles (unsigned Level,const char *Path,
time_t TimeRemoveFilesOlder);
/*****************************************************************************/
/***************** Get parameters related to file browser ********************/
@ -11215,25 +11216,54 @@ static void Brw_PutFormToAskRemOldFiles (void)
/************** Write a form fo confirm removing of old files ****************/
/*****************************************************************************/
void Brw_ConfirmRemoveOldFiles (void)
#define Brw_MIN_MONTHS_TO_REMOVE_OLD_FILES 2 // 2 months
#define Brw_DEF_MONTHS_TO_REMOVE_OLD_FILES 12 // 1 year
#define Brw_MAX_MONTHS_TO_REMOVE_OLD_FILES (10*12) // 10 years
void Brw_AskRemoveOldFiles (void)
{
extern const char *Txt_Do_you_really_want_to_remove_files_older_than_X_months;
extern const char *The_ClassForm[The_NUM_THEMES];
extern const char *Txt_Remove_old_files;
extern const char *Txt_Remove_files_older_than_PART_1_OF_2;
extern const char *Txt_Remove_files_older_than_PART_2_OF_2;
extern const char *Txt_Remove;
unsigned Months;
/***** Get parameters related to file browser *****/
Brw_GetParAndInitFileBrowser ();
/***** Form to ask for confirmation to remove old files *****/
/***** Start form *****/
Act_FormStart (ActRemOldBrf);
Brw_PutParamsContextualLink ();
/* Show question */
sprintf (Gbl.Message,Txt_Do_you_really_want_to_remove_files_older_than_X_months,
Cfg_MONTHS_TO_DELETE_OLD_BRIEFCASE_FILES);
Lay_ShowAlert (Lay_WARNING,Gbl.Message);
/***** Start frame *****/
Lay_StartRoundFrame (NULL,Txt_Remove_old_files);
Lay_PutRemoveButton (Txt_Remove);
/***** Form to request number of months (to remove files older) *****/
fprintf (Gbl.F.Out,"<span class=\"%s\">%s </span>",
The_ClassForm[Gbl.Prefs.Theme],
Txt_Remove_files_older_than_PART_1_OF_2);
fprintf (Gbl.F.Out,"<select name=\"Months\">");
for (Months = Brw_MIN_MONTHS_TO_REMOVE_OLD_FILES;
Months <= Brw_MAX_MONTHS_TO_REMOVE_OLD_FILES;
Months++)
{
fprintf (Gbl.F.Out,"<option");
if (Months == Brw_DEF_MONTHS_TO_REMOVE_OLD_FILES)
fprintf (Gbl.F.Out," selected=\"selected\"");
fprintf (Gbl.F.Out,">%u</option>",Months);
}
fprintf (Gbl.F.Out,"</select>"
"<span class=\"%s\"> ",
The_ClassForm[Gbl.Prefs.Theme]);
fprintf (Gbl.F.Out,Txt_Remove_files_older_than_PART_2_OF_2,
Cfg_PLATFORM_SHORT_NAME);
fprintf (Gbl.F.Out,"</span>");
/***** End frame *****/
Lay_EndRoundFrameWithButton (Lay_REMOVE_BUTTON,Txt_Remove);
/***** End form *****/
Act_FormEnd ();
/***** Show again the file browser *****/
@ -11246,14 +11276,26 @@ void Brw_ConfirmRemoveOldFiles (void)
void Brw_RemoveOldFiles (void)
{
extern const char *Txt_Remove;
char UnsignedStr[10+1];
unsigned Months;
time_t TimeRemoveFilesOlder;
/***** Get parameters related to file browser *****/
Brw_GetParAndInitFileBrowser ();
/***** Get parameter with number of months without access *****/
Par_GetParToText ("Months",UnsignedStr,10);
if (sscanf (UnsignedStr,"%u",&Months) != 1)
Lay_ShowErrorAndExit ("Number of months is missing.");
if (Months < Brw_MIN_MONTHS_TO_REMOVE_OLD_FILES ||
Months > Brw_MAX_MONTHS_TO_REMOVE_OLD_FILES)
Lay_ShowErrorAndExit ("Wrong number of months.");
TimeRemoveFilesOlder = Gbl.StartExecutionTimeUTC -
(time_t) Months * Dat_SECONDS_IN_ONE_MONTH;
/***** Remove old files *****/
if (Gbl.FileBrowser.Type == Brw_ADMI_BRIEF_USR)
Brw_RemoveOldFilesInBrowser ();
Brw_RemoveOldFilesInBrowser (TimeRemoveFilesOlder);
/***** Show again the file browser *****/
Brw_ShowAgainFileBrowserOrWorks ();
@ -11263,7 +11305,7 @@ void Brw_RemoveOldFiles (void)
/******************************* Remove old files ****************************/
/*****************************************************************************/
static void Brw_RemoveOldFilesInBrowser (void)
static void Brw_RemoveOldFilesInBrowser (time_t TimeRemoveFilesOlder)
{
extern const char *Txt_Folders_removed;
extern const char *Txt_Files_removed;
@ -11271,7 +11313,7 @@ static void Brw_RemoveOldFilesInBrowser (void)
/***** Remove old files recursively *****/
Gbl.FileBrowser.Removed.NumFiles =
Gbl.FileBrowser.Removed.NumFolders = 0;
Brw_ScanDirRemovingOlfFiles (1,Gbl.FileBrowser.Priv.PathRootFolder);
Brw_ScanDirRemovingOlfFiles (1,Gbl.FileBrowser.Priv.PathRootFolder,TimeRemoveFilesOlder);
/***** Success message *****/
sprintf (Gbl.Message,"%s: %u. %s: %u.",
@ -11284,9 +11326,8 @@ static void Brw_RemoveOldFilesInBrowser (void)
/************* Scan a directory recursively removing old files ***************/
/*****************************************************************************/
#define Brw_TIME_TO_DELETE_BROWSER_OLD_FILES ((time_t)(Cfg_MONTHS_TO_DELETE_OLD_BRIEFCASE_FILES*30UL*24UL*60UL*60UL))
static void Brw_ScanDirRemovingOlfFiles (unsigned Level,const char *Path)
static void Brw_ScanDirRemovingOlfFiles (unsigned Level,const char *Path,
time_t TimeRemoveFilesOlder)
{
struct dirent **DirFileList;
struct dirent **SubdirFileList;
@ -11295,8 +11336,6 @@ static void Brw_ScanDirRemovingOlfFiles (unsigned Level,const char *Path)
int NumFilesInThisSubdir;
char PathFileRel[PATH_MAX+1];
struct stat FileStatus;
time_t TimeRemoveFilesOlder = Gbl.StartExecutionTimeUTC -
Brw_TIME_TO_DELETE_BROWSER_OLD_FILES;
/***** Scan directory *****/
NumFilesInThisDir = scandir (Path,&DirFileList,NULL,alphasort);
@ -11322,7 +11361,7 @@ static void Brw_ScanDirRemovingOlfFiles (unsigned Level,const char *Path)
if (NumFilesInThisSubdir > 2) // Not empty directory
{
/* Scan subtree starting at this this directory recursively */
Brw_ScanDirRemovingOlfFiles (Level+1,PathFileRel);
Brw_ScanDirRemovingOlfFiles (Level+1,PathFileRel,TimeRemoveFilesOlder);
/* Check again number of files after deletion */
NumFilesInThisSubdir = scandir (PathFileRel,&SubdirFileList,NULL,NULL);

View File

@ -218,7 +218,7 @@ void Brw_GetNotifDocOrSharedFile (char *SummaryStr,char **ContentStr,
unsigned Brw_ListDocsFound (const char *Query,const char *Title);
void Brw_ConfirmRemoveOldFiles (void);
void Brw_AskRemoveOldFiles (void);
void Brw_RemoveOldFiles (void);
#endif

View File

@ -8358,36 +8358,6 @@ const char *Txt_Do_you_really_want_to_reject_the_enrollment_request_ = // Warnin
" in the course <strong>%s</strong>?"; // Necessita de tradução
#endif
const char *Txt_Do_you_really_want_to_remove_files_older_than_X_months = // Warning: it is very important to include %u in the following sentences
#if L==1
"De veres voleu eliminar els arxius"
" amb m&eacute;s de %u mesos d'antiguitat?";
#elif L==2
"Wollen Sie wirklich, um Dateien,"
" die &auml;lter als %u Monate l&ouml;schen?";
#elif L==3
"Do you really want to remove files"
" older than %u months?";
#elif L==4
"&iquest;Realmente desea eliminar los archivos"
" con m&aacute;s de %u meses de antig&uuml;edad?";
#elif L==5
"Voulez-vous vraiment supprimer les fichiers"
" de plus de %u mois?";
#elif L==6
"&iquest;Realmente desea eliminar los archivos"
" con m&aacute;s de %u meses de antig&uuml;edad?"; // Okoteve traducción
#elif L==7
"Vuoi davvero rimuovere i file"
" pi&ugrave; vecchi di %u mesi?";
#elif L==8
"Czy na pewno chcesz usun&aogon;&cacute; pliki"
" starsze ni&zdot; %u miesi&eogon;cy?";
#elif L==9
"Voc&ecirc; realmente deseja remover arquivos"
" com mais de %u meses?";
#endif
const char *Txt_Do_you_really_want_to_remove_the_X_students_from_the_course_Y_ = // Warning: it is very important to include %u and %s in the following sentences
#if L==1
"&iquest;Realmente desea eliminar los %u estudiantes de la asignatura <strong>%s</strong>?<br />"
@ -9650,23 +9620,41 @@ const char *Txt_Eliminate_all_courses_whithout_users_PART_2_OF_2 =
const char *Txt_Eliminate_all_users_who_are_not_enrolled_on_any_courses_PART_1_OF_2 =
#if L==1
"Eliminar todos los usuarios que no est&eacute;n inscritos en ninguna asignatura y que lleven m&aacute;s de"; // Necessita traduccio
"Eliminar todos los usuarios"
" que no est&eacute;n inscritos en ninguna asignatura"
" y que lleven m&aacute;s de"; // Necessita traduccio
#elif L==2
"Eliminate all users who are not enrolled on any courses and with more than"; // Need Übersetzung
"Eliminate all users"
" who are not enrolled on any courses"
" and with more than"; // Need Übersetzung
#elif L==3
"Eliminate all users who are not enrolled on any courses and with more than";
"Eliminate all users"
" who are not enrolled on any courses"
" and with more than";
#elif L==4
"Eliminar todos los usuarios que no est&eacute;n inscritos en ninguna asignatura y que lleven m&aacute;s de";
"Eliminar todos los usuarios"
" que no est&eacute;n inscritos en ninguna asignatura"
" y que lleven m&aacute;s de";
#elif L==5
"Eliminate all users who are not enrolled on any courses and with more than"; // Besoin de traduction
"Eliminate all users"
" who are not enrolled on any courses"
" and with more than"; // Besoin de traduction
#elif L==6
"Eliminar todos los usuarios que no est&eacute;n inscritos en ninguna asignatura y que lleven m&aacute;s de"; // Okoteve traducción
"Eliminar todos los usuarios"
" que no est&eacute;n inscritos en ninguna asignatura"
" y que lleven m&aacute;s de"; // Okoteve traducción
#elif L==7
"Rimuovere tutti gli utenti che non sono registrati ad alcun corso e con pi&ugrave; di";
"Rimuovere tutti gli utenti"
" che non sono registrati ad alcun corso"
" e con pi&ugrave; di";
#elif L==8
"Wyeliminuj wszystkich uzytkownik&oacute;w, kt&oacute;rzy nie sa zarejestrowani na kazdym z kurs&oacute;w";
"Wyeliminuj wszystkich uzytkownik&oacute;w,"
" kt&oacute;rzy nie sa zarejestrowani"
" na kazdym z kurs&oacute;w";
#elif L==9
"Eliminate all users who are not enrolled on any courses and with more than"; // Necessita de tradução
"Eliminate all users"
" who are not enrolled on any courses"
" and with more than"; // Necessita de tradução
#endif
const char *Txt_Eliminate_all_users_who_are_not_enrolled_on_any_courses_PART_2_OF_2 = // Warning: it is very important to include %s in the following sentences
@ -28782,6 +28770,48 @@ const char *Txt_Remove_FILE_OR_LINK_X = // Warning: it is very important to incl
"Remover %s";
#endif
const char *Txt_Remove_files_older_than_PART_1_OF_2 =
#if L==1
"Eliminar els arxius amb m&eacute;s de";
#elif L==2
"Dateien zu entfernen, die &auml;lter als";
#elif L==3
"Remove files older than";
#elif L==4
"Eliminar los archivos con m&aacute;s de";
#elif L==5
"Supprimer les fichiers de plus de";
#elif L==6
"Eliminar los archivos con m&aacute;s de"; // Okoteve traducción
#elif L==7
"Rimuovere i file pi&ugrave; vecchi di";
#elif L==8
"Remove files older than"; // Potrzebujesz tlumaczenie
#elif L==9
"Remover arquivos com mais de";
#endif
const char *Txt_Remove_files_older_than_PART_2_OF_2 =
#if L==1
"mesos d'antiguitat.";
#elif L==2
"Monate.";
#elif L==3
"months.";
#elif L==4
"meses de antig&uuml;edad.";
#elif L==5
"mois.";
#elif L==6
"meses de antig&uuml;edad."; // Okoteve traducción
#elif L==7
"mesi.";
#elif L==8
"months."; // Potrzebujesz tlumaczenie
#elif L==9
"meses.";
#endif
const char *Txt_Remove_folder =
#if L==1
"Eliminar carpeta";