From 7d7a5ce980062f5a26c321e6ac89b48614ae0259 Mon Sep 17 00:00:00 2001 From: acanas Date: Tue, 3 Oct 2023 23:18:13 +0200 Subject: [PATCH] Version 23.25.4: Oct 03, 2023 Code refactoring. --- swad_API.c | 4 +- swad_attendance.c | 30 ++---- swad_browser.c | 169 +++++++++++++---------------- swad_browser_size.c | 2 +- swad_changelog.h | 3 +- swad_global.h | 17 +-- swad_hierarchy.c | 14 +-- swad_info.c | 2 +- swad_mark.c | 2 +- swad_text.c | 253 ++++++++------------------------------------ swad_zip.c | 4 +- 11 files changed, 153 insertions(+), 347 deletions(-) diff --git a/swad_API.c b/swad_API.c index 7ec973ff..cbf0d30f 100644 --- a/swad_API.c +++ b/swad_API.c @@ -4679,7 +4679,7 @@ int swad__getDirectoryTree (struct soap *soap, Gbl.Crs.Grps.GrpCod = (groupCode > 0) ? (long) groupCode : -1L; - snprintf (Gbl.Crs.PathPriv,sizeof (Gbl.Crs.PathPriv),"%s/%ld", + snprintf (Gbl.Crs.Path.AbsPriv,sizeof (Gbl.Crs.Path.AbsPriv),"%s/%ld", Cfg_PATH_CRS_PRIVATE,Gbl.Hierarchy.Node[Hie_CRS].HieCod); Brw_InitializeFileBrowser (); Str_Copy (Gbl.FileBrowser.FilFolLnk.Path,Brw_RootFolderInternalNames[Gbl.FileBrowser.Type], @@ -4706,7 +4706,7 @@ int swad__getDirectoryTree (struct soap *soap, if (Brw_CheckIfFileOrFolderIsSetAsHiddenInDB (Brw_IS_FOLDER, Gbl.FileBrowser.FilFolLnk.Full) == HidVis_VISIBLE) API_ListDir (XML,1, - Gbl.FileBrowser.Priv.PathRootFolder, + Gbl.FileBrowser.Path.RootFolder, Brw_RootFolderInternalNames[Gbl.FileBrowser.Type]); XML_WriteEndFile (XML,"tree"); diff --git a/swad_attendance.c b/swad_attendance.c index b5c3019f..9ba94733 100644 --- a/swad_attendance.c +++ b/swad_attendance.c @@ -72,6 +72,7 @@ extern struct Globals Gbl; /******************************** Private types ******************************/ /*****************************************************************************/ +#define Att_TYPES_OF_VIEW 4 typedef enum { Att_VIEW_ONLY_ME, // View only me @@ -2619,6 +2620,13 @@ static void Att_ListEventsToSelect (struct Att_Events *Events, extern const char *Txt_Event; extern const char *Txt_ROLES_PLURAL_Abc[Rol_NUM_ROLES][Usr_NUM_SEXS]; extern const char *Txt_Update_attendance; + static void (*FunctionToDrawContextualIcons[Att_TYPES_OF_VIEW]) (void *Args) = + { + [Att_VIEW_ONLY_ME] = Att_PutIconToViewAttEvents, + [Att_VIEW_SEL_USR] = Att_PutIconToEditAttEvents, + [Att_PRNT_ONLY_ME] = NULL, + [Att_PRNT_SEL_USR] = NULL, + }; unsigned UniqueId; char *Id; unsigned NumAttEvent; @@ -2626,25 +2634,9 @@ static void Att_ListEventsToSelect (struct Att_Events *Events, TypeOfView == Att_VIEW_SEL_USR); /***** Begin box *****/ - switch (TypeOfView) - { - case Att_VIEW_ONLY_ME: - Box_BoxBegin (NULL,Txt_Events, - Att_PutIconToViewAttEvents,NULL, - NULL,Box_NOT_CLOSABLE); - break; - case Att_VIEW_SEL_USR: - Box_BoxBegin (NULL,Txt_Events, - Att_PutIconToEditAttEvents,NULL, - NULL,Box_NOT_CLOSABLE); - break; - case Att_PRNT_ONLY_ME: - case Att_PRNT_SEL_USR: - Box_BoxBegin (NULL,Txt_Events, - NULL,NULL, - NULL,Box_NOT_CLOSABLE); - break; - } + Box_BoxBegin (NULL,Txt_Events, + FunctionToDrawContextualIcons[TypeOfView],NULL, + NULL,Box_NOT_CLOSABLE); /***** Begin form to update the attendance depending on the events selected *****/ diff --git a/swad_browser.c b/swad_browser.c index f9b26ea4..538f8eba 100644 --- a/swad_browser.c +++ b/swad_browser.c @@ -2250,8 +2250,8 @@ static void Brw_SetPathFileBrowser (void) /***** Reset paths. An empty path means that we don't have to create that directory *****/ - Gbl.FileBrowser.Priv.PathAboveRootFolder[0] = '\0'; - Gbl.FileBrowser.Priv.PathRootFolder[0] = '\0'; + Gbl.FileBrowser.Path.AboveRootFolder[0] = '\0'; + Gbl.FileBrowser.Path.RootFolder[0] = '\0'; /***** Set paths depending on file browser *****/ switch (Gbl.FileBrowser.Type) @@ -2270,8 +2270,8 @@ static void Brw_SetPathFileBrowser (void) Fil_CreateDirIfNotExists (Path); /* Create path to the current institution */ - snprintf (Gbl.FileBrowser.Priv.PathAboveRootFolder, - sizeof (Gbl.FileBrowser.Priv.PathAboveRootFolder), + snprintf (Gbl.FileBrowser.Path.AboveRootFolder, + sizeof (Gbl.FileBrowser.Path.AboveRootFolder), "%s/%02u/%u", Cfg_PATH_INS_PRIVATE, (unsigned) (Gbl.Hierarchy.Node[Hie_INS].HieCod % 100), @@ -2291,8 +2291,8 @@ static void Brw_SetPathFileBrowser (void) Fil_CreateDirIfNotExists (Path); /* Create path to the current center */ - snprintf (Gbl.FileBrowser.Priv.PathAboveRootFolder, - sizeof (Gbl.FileBrowser.Priv.PathAboveRootFolder), + snprintf (Gbl.FileBrowser.Path.AboveRootFolder, + sizeof (Gbl.FileBrowser.Path.AboveRootFolder), "%s/%02u/%u", Cfg_PATH_CTR_PRIVATE, (unsigned) (Gbl.Hierarchy.Node[Hie_CTR].HieCod % 100), @@ -2312,8 +2312,8 @@ static void Brw_SetPathFileBrowser (void) Fil_CreateDirIfNotExists (Path); /* Create path to the current degree */ - snprintf (Gbl.FileBrowser.Priv.PathAboveRootFolder, - sizeof (Gbl.FileBrowser.Priv.PathAboveRootFolder), + snprintf (Gbl.FileBrowser.Path.AboveRootFolder, + sizeof (Gbl.FileBrowser.Path.AboveRootFolder), "%s/%02u/%u", Cfg_PATH_DEG_PRIVATE, (unsigned) (Gbl.Hierarchy.Node[Hie_DEG].HieCod % 100), @@ -2326,8 +2326,8 @@ static void Brw_SetPathFileBrowser (void) case Brw_SHOW_MRK_CRS: case Brw_ADMI_MRK_CRS: /* Create path to the current course */ - Str_Copy (Gbl.FileBrowser.Priv.PathAboveRootFolder,Gbl.Crs.PathPriv, - sizeof (Gbl.FileBrowser.Priv.PathAboveRootFolder) - 1); + Str_Copy (Gbl.FileBrowser.Path.AboveRootFolder,Gbl.Crs.Path.AbsPriv, + sizeof (Gbl.FileBrowser.Path.AboveRootFolder) - 1); break; case Brw_SHOW_DOC_GRP: case Brw_ADMI_DOC_GRP: @@ -2337,37 +2337,37 @@ static void Brw_SetPathFileBrowser (void) case Brw_ADMI_MRK_GRP: /* Create a directory for groups inside the current course */ snprintf (Path,sizeof (Path),"%s/%s", - Gbl.Crs.PathPriv,Cfg_FOLDER_GRP); + Gbl.Crs.Path.AbsPriv,Cfg_FOLDER_GRP); Fil_CreateDirIfNotExists (Path); /* Create path to this group */ snprintf (Path,sizeof (Path),"%s/%s/%ld", - Gbl.Crs.PathPriv,Cfg_FOLDER_GRP, + Gbl.Crs.Path.AbsPriv,Cfg_FOLDER_GRP, Gbl.Crs.Grps.GrpCod); - Str_Copy (Gbl.FileBrowser.Priv.PathAboveRootFolder,Path, - sizeof (Gbl.FileBrowser.Priv.PathAboveRootFolder) - 1); + Str_Copy (Gbl.FileBrowser.Path.AboveRootFolder,Path, + sizeof (Gbl.FileBrowser.Path.AboveRootFolder) - 1); break; case Brw_ADMI_ASG_USR: case Brw_ADMI_WRK_USR: /* Create a directory for me inside the current course */ snprintf (Path,sizeof (Path),"%s/%s", - Gbl.Crs.PathPriv,Cfg_FOLDER_USR); + Gbl.Crs.Path.AbsPriv,Cfg_FOLDER_USR); Fil_CreateDirIfNotExists (Path); /* Create a directory for all users whose codes end in my-user-code mod 100 */ snprintf (Path,sizeof (Path),"%s/%s/%02u", - Gbl.Crs.PathPriv,Cfg_FOLDER_USR, + Gbl.Crs.Path.AbsPriv,Cfg_FOLDER_USR, (unsigned) (Gbl.Usrs.Me.UsrDat.UsrCod % 100)); Fil_CreateDirIfNotExists (Path); /* Create path to me */ snprintf (Path,sizeof (Path),"%s/%s/%02u/%ld", - Gbl.Crs.PathPriv,Cfg_FOLDER_USR, + Gbl.Crs.Path.AbsPriv,Cfg_FOLDER_USR, (unsigned) (Gbl.Usrs.Me.UsrDat.UsrCod % 100), Gbl.Usrs.Me.UsrDat.UsrCod); - Str_Copy (Gbl.FileBrowser.Priv.PathAboveRootFolder,Path, - sizeof (Gbl.FileBrowser.Priv.PathAboveRootFolder) - 1); + Str_Copy (Gbl.FileBrowser.Path.AboveRootFolder,Path, + sizeof (Gbl.FileBrowser.Path.AboveRootFolder) - 1); break; case Brw_ADMI_ASG_CRS: case Brw_ADMI_WRK_CRS: @@ -2375,23 +2375,23 @@ static void Brw_SetPathFileBrowser (void) { /* Create a directory for this user inside the current course */ snprintf (Path,sizeof (Path),"%s/%s", - Gbl.Crs.PathPriv,Cfg_FOLDER_USR); + Gbl.Crs.Path.AbsPriv,Cfg_FOLDER_USR); Fil_CreateDirIfNotExists (Path); /* Create a directory for all users whose codes end in user-code mod 100 */ snprintf (Path,sizeof (Path),"%s/%s/%02u", - Gbl.Crs.PathPriv,Cfg_FOLDER_USR, + Gbl.Crs.Path.AbsPriv,Cfg_FOLDER_USR, (unsigned) (Gbl.Usrs.Other.UsrDat.UsrCod % 100)); Fil_CreateDirIfNotExists (Path); /* Create path to user */ snprintf (Path,sizeof (Path),"%s/%s/%02u/%ld", - Gbl.Crs.PathPriv,Cfg_FOLDER_USR, + Gbl.Crs.Path.AbsPriv,Cfg_FOLDER_USR, (unsigned) (Gbl.Usrs.Other.UsrDat.UsrCod % 100), Gbl.Usrs.Other.UsrDat.UsrCod); - Str_Copy (Gbl.FileBrowser.Priv.PathAboveRootFolder,Path, - sizeof (Gbl.FileBrowser.Priv.PathAboveRootFolder) - 1); + Str_Copy (Gbl.FileBrowser.Path.AboveRootFolder,Path, + sizeof (Gbl.FileBrowser.Path.AboveRootFolder) - 1); } break; case Brw_ADMI_DOC_PRJ: @@ -2400,42 +2400,42 @@ static void Brw_SetPathFileBrowser (void) /* Create a directory for projects inside the current course */ snprintf (Path,sizeof (Path),"%s/%s", - Gbl.Crs.PathPriv,Cfg_FOLDER_PRJ); + Gbl.Crs.Path.AbsPriv,Cfg_FOLDER_PRJ); Fil_CreateDirIfNotExists (Path); /* Create a directory for all projects which codes end in project-code mod 100 */ snprintf (Path,sizeof (Path),"%s/%s/%02u", - Gbl.Crs.PathPriv,Cfg_FOLDER_PRJ, + Gbl.Crs.Path.AbsPriv,Cfg_FOLDER_PRJ, (unsigned) (PrjCod % 100)); Fil_CreateDirIfNotExists (Path); /* Create path to the current project */ snprintf (Path,sizeof (Path),"%s/%s/%02u/%ld", - Gbl.Crs.PathPriv,Cfg_FOLDER_PRJ, + Gbl.Crs.Path.AbsPriv,Cfg_FOLDER_PRJ, (unsigned) (PrjCod % 100), PrjCod); - Str_Copy (Gbl.FileBrowser.Priv.PathAboveRootFolder,Path, - sizeof (Gbl.FileBrowser.Priv.PathAboveRootFolder) - 1); + Str_Copy (Gbl.FileBrowser.Path.AboveRootFolder,Path, + sizeof (Gbl.FileBrowser.Path.AboveRootFolder) - 1); break; case Brw_ADMI_BRF_USR: - Str_Copy (Gbl.FileBrowser.Priv.PathAboveRootFolder,Gbl.Usrs.Me.PathDir, - sizeof (Gbl.FileBrowser.Priv.PathAboveRootFolder) - 1); + Str_Copy (Gbl.FileBrowser.Path.AboveRootFolder,Gbl.Usrs.Me.PathDir, + sizeof (Gbl.FileBrowser.Path.AboveRootFolder) - 1); break; default: return; } /***** Create directories that not exist *****/ - if (Gbl.FileBrowser.Priv.PathAboveRootFolder[0]) + if (Gbl.FileBrowser.Path.AboveRootFolder[0]) { - Fil_CreateDirIfNotExists (Gbl.FileBrowser.Priv.PathAboveRootFolder); + Fil_CreateDirIfNotExists (Gbl.FileBrowser.Path.AboveRootFolder); snprintf (Path,sizeof (Path),"%s/%s", - Gbl.FileBrowser.Priv.PathAboveRootFolder, + Gbl.FileBrowser.Path.AboveRootFolder, Brw_RootFolderInternalNames[Gbl.FileBrowser.Type]); - Str_Copy (Gbl.FileBrowser.Priv.PathRootFolder,Path, - sizeof (Gbl.FileBrowser.Priv.PathRootFolder) - 1); - Fil_CreateDirIfNotExists (Gbl.FileBrowser.Priv.PathRootFolder); + Str_Copy (Gbl.FileBrowser.Path.RootFolder,Path, + sizeof (Gbl.FileBrowser.Path.RootFolder) - 1); + Fil_CreateDirIfNotExists (Gbl.FileBrowser.Path.RootFolder); /***** If file browser is for assignments, create folders of assignments if not exist *****/ @@ -2473,7 +2473,7 @@ bool Brw_CheckIfExistsFolderAssigmentForAnyUsr (const char *FolderName) /* Check if folder exists */ snprintf (PathFolder,sizeof (PathFolder),"%s/usr/%02u/%ld/%s/%s", - Gbl.Crs.PathPriv, + Gbl.Crs.Path.AbsPriv, (unsigned) (UsrCod % 100), UsrCod, // User's code Brw_INTERNAL_NAME_ROOT_FOLDER_ASSIGNMENTS, @@ -2519,7 +2519,7 @@ static void Brw_CreateFoldersAssignmentsIfNotExist (long ZoneUsrCod) { /* Create folder if not exists */ snprintf (PathFolderAsg,sizeof (PathFolderAsg),"%s/%s", - Gbl.FileBrowser.Priv.PathRootFolder,row[0]); + Gbl.FileBrowser.Path.RootFolder,row[0]); Fil_CreateDirIfNotExists (PathFolderAsg); } } @@ -2565,13 +2565,13 @@ bool Brw_UpdateFoldersAssigmentsIfExistForAllUsrs (const char *OldFolderName, /* Rename folder if exists */ snprintf (PathOldFolder,sizeof (PathOldFolder),"%s/usr/%02u/%ld/%s/%s", - Gbl.Crs.PathPriv, + Gbl.Crs.Path.AbsPriv, (unsigned) (UsrCod % 100), UsrCod, // User's code Brw_INTERNAL_NAME_ROOT_FOLDER_ASSIGNMENTS, OldFolderName); snprintf (PathNewFolder,sizeof (PathNewFolder),"%s/usr/%02u/%ld/%s/%s", - Gbl.Crs.PathPriv, + Gbl.Crs.Path.AbsPriv, (unsigned) (UsrCod % 100), UsrCod, // User's code Brw_INTERNAL_NAME_ROOT_FOLDER_ASSIGNMENTS, @@ -2594,7 +2594,7 @@ bool Brw_UpdateFoldersAssigmentsIfExistForAllUsrs (const char *OldFolderName, /* Rename folder if exists */ snprintf (PathOldFolder,sizeof (PathOldFolder),"%s/usr/%02u/%ld/%s/%s", - Gbl.Crs.PathPriv, + Gbl.Crs.Path.AbsPriv, (unsigned) (UsrCod % 100), UsrCod, // User's code Brw_INTERNAL_NAME_ROOT_FOLDER_ASSIGNMENTS, @@ -2602,7 +2602,7 @@ bool Brw_UpdateFoldersAssigmentsIfExistForAllUsrs (const char *OldFolderName, if (Fil_CheckIfPathExists (PathOldFolder)) { snprintf (PathNewFolder,sizeof (PathNewFolder),"%s/usr/%02u/%ld/%s/%s", - Gbl.Crs.PathPriv, + Gbl.Crs.Path.AbsPriv, (unsigned) (UsrCod % 100), UsrCod, // User's code Brw_INTERNAL_NAME_ROOT_FOLDER_ASSIGNMENTS, @@ -2677,7 +2677,7 @@ void Brw_RemoveFoldersAssignmentsIfExistForAllUsrs (const char *FolderName) /* Remove tree if exists */ snprintf (PathFolder,sizeof (PathFolder),"%s/usr/%02u/%ld/%s/%s", - Gbl.Crs.PathPriv, + Gbl.Crs.Path.AbsPriv, (unsigned) (UsrCod % 100), UsrCod, // User's code Brw_INTERNAL_NAME_ROOT_FOLDER_ASSIGNMENTS, @@ -3240,7 +3240,7 @@ static void Brw_ShowFileBrowser (void) Brw_ICON_TREE_NOTHING)) Brw_ListDir (1,"1", false, // Tree not contracted - Gbl.FileBrowser.Priv.PathRootFolder, + Gbl.FileBrowser.Path.RootFolder, Brw_RootFolderInternalNames[Gbl.FileBrowser.Type]); HTM_TABLE_End (); @@ -5051,7 +5051,7 @@ void Brw_RemFileFromTree (void) if (Brw_CheckIfICanEditFileOrFolder (Gbl.FileBrowser.Level)) // Can I remove this file? { snprintf (Path,sizeof (Path),"%s/%s", - Gbl.FileBrowser.Priv.PathAboveRootFolder, + Gbl.FileBrowser.Path.AboveRootFolder, Gbl.FileBrowser.FilFolLnk.Full); /***** Check if is a file/link or a folder *****/ @@ -5104,7 +5104,7 @@ void Brw_RemFolderFromTree (void) if (Brw_CheckIfICanEditFileOrFolder (Gbl.FileBrowser.Level)) // Can I remove this folder? { snprintf (Path,sizeof (Path),"%s/%s", - Gbl.FileBrowser.Priv.PathAboveRootFolder, + Gbl.FileBrowser.Path.AboveRootFolder, Gbl.FileBrowser.FilFolLnk.Full); /***** Check if it's a file or a folder *****/ @@ -5170,7 +5170,7 @@ void Brw_RemSubtreeInFileBrowser (void) if (Brw_CheckIfICanEditFileOrFolder (Gbl.FileBrowser.Level)) // Can I remove this subtree? { snprintf (Path,sizeof (Path),"%s/%s", - Gbl.FileBrowser.Priv.PathAboveRootFolder, + Gbl.FileBrowser.Path.AboveRootFolder, Gbl.FileBrowser.FilFolLnk.Full); /***** Remove the whole tree *****/ @@ -5975,7 +5975,7 @@ static void Brw_PasteClipboard (struct BrwSiz_BrowserSize *Size) } /***** Paste tree (path in clipboard) into folder *****/ - BrwSiz_CalcSizeOfDir (Size,Gbl.FileBrowser.Priv.PathRootFolder); + BrwSiz_CalcSizeOfDir (Size,Gbl.FileBrowser.Path.RootFolder); BrwSiz_SetMaxQuota (Size); if (Brw_PasteTreeIntoFolder (Size, Gbl.FileBrowser.Clipboard.Level, @@ -6061,18 +6061,10 @@ static bool Brw_PasteTreeIntoFolder (struct BrwSiz_BrowserSize *Size, struct Brw_NumObjects *Pasted, long *FirstFilCod) { - extern const char *Txt_The_copy_has_stopped_when_trying_to_paste_the_file_X_because_it_would_exceed_the_disk_quota; - extern const char *Txt_The_copy_has_stopped_when_trying_to_paste_the_folder_X_because_it_would_exceed_the_disk_quota; - extern const char *Txt_The_copy_has_stopped_when_trying_to_paste_the_link_X_because_it_would_exceed_the_disk_quota; - - extern const char *Txt_The_copy_has_stopped_when_trying_to_paste_the_file_X_because_it_would_exceed_the_maximum_allowed_number_of_levels; - extern const char *Txt_The_copy_has_stopped_when_trying_to_paste_the_folder_X_because_it_would_exceed_the_maximum_allowed_number_of_levels; - extern const char *Txt_The_copy_has_stopped_when_trying_to_paste_the_link_X_because_it_would_exceed_the_maximum_allowed_number_of_levels; - - extern const char *Txt_The_copy_has_stopped_when_trying_to_paste_the_file_X_because_there_is_already_an_object_with_that_name; - extern const char *Txt_The_copy_has_stopped_when_trying_to_paste_the_link_X_because_there_is_already_an_object_with_that_name; - - extern const char *Txt_The_copy_has_stopped_when_trying_to_paste_the_file_X_because_you_can_not_paste_a_file_here_of_a_type_other_than_HTML; + extern const char *Txt_The_copy_has_stopped_when_trying_to_paste_X_because_it_would_exceed_the_disk_quota; + extern const char *Txt_The_copy_has_stopped_when_trying_to_paste_X_because_it_would_exceed_the_maximum_allowed_number_of_levels; + extern const char *Txt_The_copy_has_stopped_when_trying_to_paste_X_because_there_is_already_an_object_with_that_name; + extern const char *Txt_The_copy_has_stopped_when_trying_to_paste_X_because_you_can_not_paste_a_file_here_of_a_type_other_than_HTML; Brw_FileType_t FileType; char PathUntilFileNameOrg[PATH_MAX + 1]; char FileNameOrg[NAME_MAX + 1]; @@ -6120,7 +6112,7 @@ static bool Brw_PasteTreeIntoFolder (struct BrwSiz_BrowserSize *Size, /***** Construct the relative path of the destination file or folder *****/ snprintf (PathDstWithFile,sizeof (PathDstWithFile),"%s/%s", - Gbl.FileBrowser.Priv.PathAboveRootFolder, + Gbl.FileBrowser.Path.AboveRootFolder, PathDstInTreeWithFile); /***** Update and check number of levels *****/ @@ -6131,23 +6123,8 @@ static bool Brw_PasteTreeIntoFolder (struct BrwSiz_BrowserSize *Size, if (BrwSiz_CheckIfQuotaExceded (Size)) { - switch (FileType) - { - case Brw_IS_FILE: - Ale_ShowAlert (Ale_WARNING,Txt_The_copy_has_stopped_when_trying_to_paste_the_file_X_because_it_would_exceed_the_maximum_allowed_number_of_levels, - FileNameToShow); - break; - case Brw_IS_FOLDER: - Ale_ShowAlert (Ale_WARNING,Txt_The_copy_has_stopped_when_trying_to_paste_the_folder_X_because_it_would_exceed_the_maximum_allowed_number_of_levels, - FileNameToShow); - break; - case Brw_IS_LINK: - Ale_ShowAlert (Ale_WARNING,Txt_The_copy_has_stopped_when_trying_to_paste_the_link_X_because_it_would_exceed_the_maximum_allowed_number_of_levels, - FileNameToShow); - break; - default: - Err_ShowErrorAndExit ("Can not paste unknown file type."); - } + Ale_ShowAlert (Ale_WARNING,Txt_The_copy_has_stopped_when_trying_to_paste_X_because_it_would_exceed_the_maximum_allowed_number_of_levels, + FileNameToShow); CopyIsGoingSuccessful = false; } else // Quota not exceeded @@ -6159,8 +6136,7 @@ static bool Brw_PasteTreeIntoFolder (struct BrwSiz_BrowserSize *Size, /***** Check if exists the destination file */ if (Fil_CheckIfPathExists (PathDstWithFile)) { - Ale_ShowAlert (Ale_WARNING,FileType == Brw_IS_FILE ? Txt_The_copy_has_stopped_when_trying_to_paste_the_file_X_because_there_is_already_an_object_with_that_name : - Txt_The_copy_has_stopped_when_trying_to_paste_the_link_X_because_there_is_already_an_object_with_that_name, + Ale_ShowAlert (Ale_WARNING,Txt_The_copy_has_stopped_when_trying_to_paste_X_because_there_is_already_an_object_with_that_name, FileNameToShow); CopyIsGoingSuccessful = false; } @@ -6174,7 +6150,7 @@ static bool Brw_PasteTreeIntoFolder (struct BrwSiz_BrowserSize *Size, Mrk_CheckFileOfMarks (PathOrg,&Marks); else { - Ale_ShowAlert (Ale_WARNING,Txt_The_copy_has_stopped_when_trying_to_paste_the_file_X_because_you_can_not_paste_a_file_here_of_a_type_other_than_HTML, + Ale_ShowAlert (Ale_WARNING,Txt_The_copy_has_stopped_when_trying_to_paste_X_because_you_can_not_paste_a_file_here_of_a_type_other_than_HTML, FileNameToShow); CopyIsGoingSuccessful = false; } @@ -6187,8 +6163,7 @@ static bool Brw_PasteTreeIntoFolder (struct BrwSiz_BrowserSize *Size, Size->TotalSiz += (unsigned long long) FileStatus.st_size; if (BrwSiz_CheckIfQuotaExceded (Size)) { - Ale_ShowAlert (Ale_WARNING,FileType == Brw_IS_FILE ? Txt_The_copy_has_stopped_when_trying_to_paste_the_file_X_because_it_would_exceed_the_disk_quota : - Txt_The_copy_has_stopped_when_trying_to_paste_the_link_X_because_it_would_exceed_the_disk_quota, + Ale_ShowAlert (Ale_WARNING,Txt_The_copy_has_stopped_when_trying_to_paste_X_because_it_would_exceed_the_disk_quota, FileNameToShow); CopyIsGoingSuccessful = false; } @@ -6229,7 +6204,7 @@ static bool Brw_PasteTreeIntoFolder (struct BrwSiz_BrowserSize *Size, Size->TotalSiz += (unsigned long long) FileStatus.st_size; if (BrwSiz_CheckIfQuotaExceded (Size)) { - Ale_ShowAlert (Ale_WARNING,Txt_The_copy_has_stopped_when_trying_to_paste_the_folder_X_because_it_would_exceed_the_disk_quota, + Ale_ShowAlert (Ale_WARNING,Txt_The_copy_has_stopped_when_trying_to_paste_X_because_it_would_exceed_the_disk_quota, FileNameToShow); CopyIsGoingSuccessful = false; } @@ -6607,7 +6582,7 @@ void Brw_RecFolderFileBrowser (void) { /* In Gbl.FileBrowser.NewFilFolLnkName is the name of the new folder */ snprintf (Path,sizeof (Path),"%s/%s", - Gbl.FileBrowser.Priv.PathAboveRootFolder, + Gbl.FileBrowser.Path.AboveRootFolder, Gbl.FileBrowser.FilFolLnk.Full); if (strlen (Path) + 1 + strlen (Gbl.FileBrowser.NewFilFolLnkName) > PATH_MAX) @@ -6619,7 +6594,7 @@ void Brw_RecFolderFileBrowser (void) if (mkdir (Path,(mode_t) 0xFFF) == 0) { /* Check if quota has been exceeded */ - BrwSiz_CalcSizeOfDir (Size,Gbl.FileBrowser.Priv.PathRootFolder); + BrwSiz_CalcSizeOfDir (Size,Gbl.FileBrowser.Path.RootFolder); BrwSiz_SetMaxQuota (Size); if (BrwSiz_CheckIfQuotaExceded (Size)) { @@ -6712,10 +6687,10 @@ void Brw_RenFolderFileBrowser (void) Gbl.FileBrowser.FilFolLnk.Path, Gbl.FileBrowser.FilFolLnk.Name); snprintf (OldPath,sizeof (OldPath),"%s/%s", - Gbl.FileBrowser.Priv.PathAboveRootFolder,OldPathInTree); + Gbl.FileBrowser.Path.AboveRootFolder,OldPathInTree); /* Gbl.FileBrowser.NewFilFolLnkName holds the new name of the folder */ - if (strlen (Gbl.FileBrowser.Priv.PathAboveRootFolder) + 1 + + if (strlen (Gbl.FileBrowser.Path.AboveRootFolder) + 1 + strlen (Gbl.FileBrowser.FilFolLnk.Path) + 1 + strlen (Gbl.FileBrowser.NewFilFolLnkName) > PATH_MAX) Err_ShowErrorAndExit ("Path is too long."); @@ -6723,7 +6698,7 @@ void Brw_RenFolderFileBrowser (void) Gbl.FileBrowser.FilFolLnk.Path, Gbl.FileBrowser.NewFilFolLnkName); snprintf (NewPath,sizeof (NewPath),"%s/%s", - Gbl.FileBrowser.Priv.PathAboveRootFolder,NewPathInTree); + Gbl.FileBrowser.Path.AboveRootFolder,NewPathInTree); /* We should check here that a folder with the same name does not exist. but we leave this work to the system */ @@ -6892,7 +6867,7 @@ static bool Brw_RcvFileInFileBrw (struct BrwSiz_BrowserSize *Size, { /* Gbl.FileBrowser.NewFilFolLnkName holds the name of the new file */ snprintf (Path,sizeof (Path),"%s/%s", - Gbl.FileBrowser.Priv.PathAboveRootFolder, + Gbl.FileBrowser.Path.AboveRootFolder, Gbl.FileBrowser.FilFolLnk.Full); if (strlen (Path) + 1 + strlen (Gbl.FileBrowser.NewFilFolLnkName) + @@ -6931,7 +6906,7 @@ static bool Brw_RcvFileInFileBrw (struct BrwSiz_BrowserSize *Size, else // Success { /* Check if quota has been exceeded */ - BrwSiz_CalcSizeOfDir (Size,Gbl.FileBrowser.Priv.PathRootFolder); + BrwSiz_CalcSizeOfDir (Size,Gbl.FileBrowser.Path.RootFolder); BrwSiz_SetMaxQuota (Size); if (BrwSiz_CheckIfQuotaExceded (Size)) { @@ -7092,7 +7067,7 @@ void Brw_RecLinkFileBrowser (void) { /* The name of the file with the link will be the FileName.url */ snprintf (Path,sizeof (Path),"%s/%s", - Gbl.FileBrowser.Priv.PathAboveRootFolder, + Gbl.FileBrowser.Path.AboveRootFolder, Gbl.FileBrowser.FilFolLnk.Full); if (strlen (Path) + 1 + strlen (FileName) + strlen (".url") > PATH_MAX) Err_ShowErrorAndExit ("Path is too long."); @@ -7116,7 +7091,7 @@ void Brw_RecLinkFileBrowser (void) fclose (FileURL); /* Check if quota has been exceeded */ - BrwSiz_CalcSizeOfDir (Size,Gbl.FileBrowser.Priv.PathRootFolder); + BrwSiz_CalcSizeOfDir (Size,Gbl.FileBrowser.Path.RootFolder); BrwSiz_SetMaxQuota (Size); if (BrwSiz_CheckIfQuotaExceded (Size)) { @@ -7815,7 +7790,7 @@ void Brw_GetLinkToDownloadFile (const char *PathInTree,const char *FileName,char /***** Construct absolute path to file in the private directory *****/ snprintf (FullPathIncludingFile,sizeof (FullPathIncludingFile),"%s/%s/%s", - Gbl.FileBrowser.Priv.PathAboveRootFolder,PathInTree,FileName); + Gbl.FileBrowser.Path.AboveRootFolder,PathInTree,FileName); if (Str_FileIs (FileName,"url")) // It's a link (URL inside a .url file) { @@ -8489,7 +8464,7 @@ bool Brw_GetFileTypeSizeAndDate (struct Brw_FileMetadata *FileMetadata) struct stat FileStatus; snprintf (Path,sizeof (Path),"%s/%s", - Gbl.FileBrowser.Priv.PathAboveRootFolder, + Gbl.FileBrowser.Path.AboveRootFolder, FileMetadata->FilFolLnk.Full); if (lstat (Path,&FileStatus)) // On success ==> 0 is returned { @@ -9681,7 +9656,7 @@ static void Brw_RemoveOldFilesInBrowser (unsigned Months,struct Brw_NumObjects * Removed->NumFiles = Removed->NumLinks = Removed->NumFolds = 0; - Brw_ScanDirRemovingOldFiles (1,Gbl.FileBrowser.Priv.PathRootFolder, + Brw_ScanDirRemovingOldFiles (1,Gbl.FileBrowser.Path.RootFolder, Brw_RootFolderInternalNames[Gbl.FileBrowser.Type], TimeRemoveFilesOlder,Removed); diff --git a/swad_browser_size.c b/swad_browser_size.c index d7569e6d..ef76727a 100644 --- a/swad_browser_size.c +++ b/swad_browser_size.c @@ -164,7 +164,7 @@ void BrwSiz_SetAndCheckQuota (struct BrwSiz_BrowserSize *Size) /***** Check the quota *****/ BrwSiz_SetMaxQuota (Size); - BrwSiz_CalcSizeOfDir (Size,Gbl.FileBrowser.Priv.PathRootFolder); + BrwSiz_CalcSizeOfDir (Size,Gbl.FileBrowser.Path.RootFolder); if (BrwSiz_CheckIfQuotaExceded (Size)) Ale_ShowAlert (Ale_WARNING,Txt_Quota_exceeded); } diff --git a/swad_changelog.h b/swad_changelog.h index ac333b70..bda3cfdd 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -632,10 +632,11 @@ TODO: Francisco Javier Fern Me sale este error, no sé si por no recordar yo la sintaxis apropiada para mandar a varios destinatarios. ¿No era así? "can npt create received message (duplicated entry '243218-2160773' for key 'UsrCod_MsgCod') */ -#define Log_PLATFORM_VERSION "SWAD 23.25.3 (2023-10-03)" +#define Log_PLATFORM_VERSION "SWAD 23.25.4 (2023-10-03)" #define CSS_FILE "swad23.25.2.css" #define JS_FILE "swad22.49.js" /* + Version 23.25.4: Oct 03, 2023 Code refactoring. (336222 lines) Version 23.25.3: Oct 03, 2023 Code refactoring in user's hierarchy. (336222 lines) Version 23.25.2: Oct 03, 2023 Changes in my courses. (336230 lines) Version 23.25.1: Oct 03, 2023 Fixed recent bug in user's roles. (336225 lines) diff --git a/swad_global.h b/swad_global.h index 7dd29b10..a9bfae83 100644 --- a/swad_global.h +++ b/swad_global.h @@ -124,7 +124,6 @@ struct Globals char PendingPassword[Pwd_BYTES_ENCRYPTED_PASSWORD + 1]; char PathDir[PATH_MAX + 1]; bool Logged; - bool IBelongToCurrent[Hie_NUM_LEVELS]; bool MyPhotoExists; unsigned NumAccWithoutPhoto; char PhotoURL[Cns_MAX_BYTES_WWW + 1]; @@ -136,6 +135,7 @@ struct Globals unsigned Num; // Number of courses/degrees/centers/institutions/countries bool Filled; // List is already filled? } Hierarchy[Hie_NUM_LEVELS]; // My hierarchy + bool IBelongToCurrent[Hie_NUM_LEVELS]; Set_ShowUsrsType_t ListType; // My preference about user's list type unsigned NumFollowers; // Number of users who follow me unsigned NumFollowing; // Number of users I follow @@ -178,9 +178,12 @@ struct Globals } Usrs; struct { - char PathPriv[PATH_MAX + 1]; // Absolute path to the private directory of the course - char PathRelPubl[PATH_MAX + 1]; // Relative path to the public directory of the course - char PathURLPubl[PATH_MAX + 1]; // Abolute URL to the public part of the course + struct + { + char AbsPriv[PATH_MAX + 1]; // Absolute path to the private directory of the course + char RelPubl[PATH_MAX + 1]; // Relative path to the public directory of the course + char URLPubl[PATH_MAX + 1]; // Abolute URL to the public part of the course + } Path; struct Grp_Groups Grps; struct Inf_Info Info; struct @@ -202,9 +205,9 @@ struct Globals bool UploadingWithDropzone; struct { - char PathAboveRootFolder[PATH_MAX + 1]; - char PathRootFolder[PATH_MAX + 1]; - } Priv; + char AboveRootFolder[PATH_MAX + 1]; + char RootFolder[PATH_MAX + 1]; + } Path; char NewFilFolLnkName[NAME_MAX + 1]; struct Brw_FilFolLnk FilFolLnk; unsigned Level; diff --git a/swad_hierarchy.c b/swad_hierarchy.c index 03be4616..178a87d9 100644 --- a/swad_hierarchy.c +++ b/swad_hierarchy.c @@ -594,18 +594,18 @@ void Hie_InitHierarchy (void) if (Gbl.Hierarchy.Level == Hie_CRS) // Course selected { /***** Paths of course directories *****/ - snprintf (Gbl.Crs.PathPriv ,sizeof (Gbl.Crs.PathPriv ),"%s/%ld", + snprintf (Gbl.Crs.Path.AbsPriv,sizeof (Gbl.Crs.Path.AbsPriv),"%s/%ld", Cfg_PATH_CRS_PRIVATE,Gbl.Hierarchy.Node[Hie_CRS].HieCod); - snprintf (Gbl.Crs.PathRelPubl,sizeof (Gbl.Crs.PathRelPubl),"%s/%ld", + snprintf (Gbl.Crs.Path.RelPubl,sizeof (Gbl.Crs.Path.RelPubl),"%s/%ld", Cfg_PATH_CRS_PUBLIC ,Gbl.Hierarchy.Node[Hie_CRS].HieCod); - snprintf (Gbl.Crs.PathURLPubl,sizeof (Gbl.Crs.PathURLPubl),"%s/%ld", + snprintf (Gbl.Crs.Path.URLPubl,sizeof (Gbl.Crs.Path.URLPubl),"%s/%ld", Cfg_URL_CRS_PUBLIC ,Gbl.Hierarchy.Node[Hie_CRS].HieCod); /***** If any of the course directories does not exist, create it *****/ - if (!Fil_CheckIfPathExists (Gbl.Crs.PathPriv)) - Fil_CreateDirIfNotExists (Gbl.Crs.PathPriv); - if (!Fil_CheckIfPathExists (Gbl.Crs.PathRelPubl)) - Fil_CreateDirIfNotExists (Gbl.Crs.PathRelPubl); + if (!Fil_CheckIfPathExists (Gbl.Crs.Path.AbsPriv)) + Fil_CreateDirIfNotExists (Gbl.Crs.Path.AbsPriv); + if (!Fil_CheckIfPathExists (Gbl.Crs.Path.RelPubl)) + Fil_CreateDirIfNotExists (Gbl.Crs.Path.RelPubl); /***** Count number of groups in current course (used in some actions) *****/ diff --git a/swad_info.c b/swad_info.c index 3fa97fd6..8d691fc4 100644 --- a/swad_info.c +++ b/swad_info.c @@ -1965,7 +1965,7 @@ void Inf_ReceivePagInfo (void) Fil_RemoveTree (PathRelDirHTML); Fil_CreateDirIfNotExists (PathRelDirHTML); snprintf (PathRelFileZIP,sizeof (PathRelFileZIP),"%s/%s.zip", - Gbl.Crs.PathPriv, + Gbl.Crs.Path.AbsPriv, Inf_FileNamesForInfoType[Gbl.Crs.Info.Type]); if (Fil_EndReceptionOfFile (PathRelFileZIP,Par)) diff --git a/swad_mark.c b/swad_mark.c index 6f309c77..d0be7a95 100644 --- a/swad_mark.c +++ b/swad_mark.c @@ -542,7 +542,7 @@ void Mrk_ShowMyMarks (void) /***** Get the path of the file of marks *****/ Brw_SetFullPathInTree (); snprintf (PathPrivate,sizeof (PathPrivate),"%s/%s", - Gbl.FileBrowser.Priv.PathAboveRootFolder, + Gbl.FileBrowser.Path.AboveRootFolder, Gbl.FileBrowser.FilFolLnk.Full); /***** Get number of rows of header or footer *****/ diff --git a/swad_text.c b/swad_text.c index 17a78750..decc5569 100644 --- a/swad_text.c +++ b/swad_text.c @@ -47149,300 +47149,135 @@ const char *Txt_The_copy_has_been_successful = "The copy has been successful."; // Çeviri lazim! #endif -const char *Txt_The_copy_has_stopped_when_trying_to_paste_the_file_X_because_it_would_exceed_the_disk_quota = // Warning: it is very important to include %s in the following sentences +const char *Txt_The_copy_has_stopped_when_trying_to_paste_X_because_it_would_exceed_the_disk_quota = // Warning: it is very important to include %s in the following sentences #if L==1 // ca - "La copia se ha detenido al intentar pegar el archivo %s" + "La copia se ha detenido al intentar pegar %s" " porque se excedería la cuota de disco."; // Necessita traducció #elif L==2 // de "Der Kopiervorgang wurde aus Platzgründen abgebrochen, als versucht wurde," - " die Datei %s einzufügen."; + " %s einzufügen."; #elif L==3 // en - "The copy has stopped when trying to paste the file %s" + "The copy has stopped when trying to paste %s" " because it would exceed the disk quota."; #elif L==4 // es - "La copia se ha detenido al intentar pegar el archivo %s" + "La copia se ha detenido al intentar pegar %s" " porque se excedería la cuota de disco."; #elif L==5 // fr - "The copy has stopped when trying to paste the file %s" + "The copy has stopped when trying to paste %s" " because it would exceed the disk quota."; // Besoin de traduction #elif L==6 // gn - "La copia se ha detenido al intentar pegar el archivo %s" + "La copia se ha detenido al intentar pegar %s" " porque se excedería la cuota de disco."; // Okoteve traducción #elif L==7 // it - "La copia è terminata quando si è provato a incollare il file %s" + "La copia è terminata quando si è provato a incollare %s" " perchè esso superava la quota di gestione del disco."; #elif L==8 // pl - "The copy has stopped when trying to paste the file %s" + "The copy has stopped when trying to paste %s" " because it would exceed the disk quota."; // Potrzebujesz tlumaczenie #elif L==9 // pt - "A cópia parou ao tentar colar o arquivo %s" + "A cópia parou ao tentar colar %s" " porque ele excederia a cota de disco."; #elif L==10 // tr - "The copy has stopped when trying to paste the file %s" + "The copy has stopped when trying to paste %s" " because it would exceed the disk quota."; // Çeviri lazim! #endif -const char *Txt_The_copy_has_stopped_when_trying_to_paste_the_folder_X_because_it_would_exceed_the_disk_quota = // Warning: it is very important to include %s in the following sentences +const char *Txt_The_copy_has_stopped_when_trying_to_paste_X_because_it_would_exceed_the_maximum_allowed_number_of_levels = // Warning: it is very important to include %s in the following sentences #if L==1 // ca - "La copia se ha detenido al intentar pegar la carpeta %s" - " porque se excedería la cuota de disco."; // Necessita traducció -#elif L==2 // de - "Der Kopiervorgang wurde aus Platzgründen abgebrochen, als versucht wurde," - " das Verzeichnis %s einzufügen."; -#elif L==3 // en - "The copy has stopped when trying to paste the folder %s" - " because it would exceed the disk quota."; -#elif L==4 // es - "La copia se ha detenido al intentar pegar la carpeta %s" - " porque se excedería la cuota de disco."; -#elif L==5 // fr - "The copy has stopped when trying to paste the folder %s" - " because it would exceed the disk quota."; // Besoin de traduction -#elif L==6 // gn - "La copia se ha detenido al intentar pegar la carpeta %s" - " porque se excedería la cuota de disco."; // Okoteve traducción -#elif L==7 // it - "La copia è terminata quando si è provato a incollare la cartella%s" - " perchè essa superava la quota di gestione del disco."; -#elif L==8 // pl - "The copy has stopped when trying to paste the folder %s" - " because it would exceed the disk quota."; // Potrzebujesz tlumaczenie -#elif L==9 // pt - "A cópia parou ao tentar colar a pasta %s" - " porque ele excederia a cota de disco."; -#elif L==10 // tr - "The copy has stopped when trying to paste the folder %s" - " because it would exceed the disk quota."; // Çeviri lazim! -#endif - -const char *Txt_The_copy_has_stopped_when_trying_to_paste_the_link_X_because_it_would_exceed_the_disk_quota = // Warning: it is very important to include %s in the following sentences -#if L==1 // ca - "La copia se ha detenido al intentar pegar el enlace %s" - " porque se excedería la cuota de disco."; // Necessita traducció -#elif L==2 // de - "Der Kopiervorgang wurde aus Platzgründen abgebrochen, als versucht wurde," - " das Link %s einzufügen."; -#elif L==3 // en - "The copy has stopped when trying to paste the link %s" - " because it would exceed the disk quota."; -#elif L==4 // es - "La copia se ha detenido al intentar pegar el enlace %s" - " porque se excedería la cuota de disco."; -#elif L==5 // fr - "The copy has stopped when trying to paste the link %s" - " because it would exceed the disk quota."; // Besoin de traduction -#elif L==6 // gn - "La copia se ha detenido al intentar pegar el enlace %s" - " porque se excedería la cuota de disco."; // Okoteve traducción -#elif L==7 // it - "La copia è terminata quando si è provato a incollare il link%s" - " perchè essa superava la quota di gestione del disco."; -#elif L==8 // pl - "The copy has stopped when trying to paste the link %s" - " because it would exceed the disk quota."; // Potrzebujesz tlumaczenie -#elif L==9 // pt - "A cópia parou ao tentar colar o link %s" - " porque ele excederia a cota de disco."; -#elif L==10 // tr - "The copy has stopped when trying to paste the link %s" - " because it would exceed the disk quota."; // Çeviri lazim! -#endif - -const char *Txt_The_copy_has_stopped_when_trying_to_paste_the_file_X_because_it_would_exceed_the_maximum_allowed_number_of_levels = // Warning: it is very important to include %s in the following sentences -#if L==1 // ca - "La copia se ha detenido al intentar pegar el archivo %s" + "La copia se ha detenido al intentar pegar %s" " porque se excedería el número máximo de niveles permitido."; // Necessita traducció #elif L==2 // de "Zu viele Ebenen. Der Kopiervorgang wurde abgebrochen, als versucht wurde," - " die Datei %s einzufügen."; + " %s einzufügen."; #elif L==3 // en - "The copy has stopped when trying to paste the file %s" + "The copy has stopped when trying to paste %s" " because it would exceed the maximum allowed number of levels."; #elif L==4 // es - "La copia se ha detenido al intentar pegar el archivo %s" + "La copia se ha detenido al intentar pegar %s" " porque se excedería el número máximo de niveles permitido."; #elif L==5 // fr - "The copy has stopped when trying to paste the file %s" + "The copy has stopped when trying to paste %s" " because it would exceed the maximum allowed number of levels."; // Besoin de traduction #elif L==6 // gn - "La copia se ha detenido al intentar pegar el archivo %s" + "La copia se ha detenido al intentar pegar %s" " porque se excedería el número máximo de niveles permitido."; // Okoteve traducción #elif L==7 // it - "La copia è terminata quando si è provato a incollare il file %s" + "La copia è terminata quando si è provato a incollare %s" " perchè esso superava il massimo numero di livelli permesso."; #elif L==8 // pl - "The copy has stopped when trying to paste the file %s" + "The copy has stopped when trying to paste %s" " because it would exceed the maximum allowed number of levels."; // Potrzebujesz tlumaczenie #elif L==9 // pt - "A cópia parou ao tentar colar o arquivo %s" + "A cópia parou ao tentar colar %s" " porque ele excederia o número máximo permitido de níveis."; #elif L==10 // tr - "The copy has stopped when trying to paste the file %s" + "The copy has stopped when trying to paste %s" " because it would exceed the maximum allowed number of levels."; // Çeviri lazim! #endif -const char *Txt_The_copy_has_stopped_when_trying_to_paste_the_folder_X_because_it_would_exceed_the_maximum_allowed_number_of_levels = // Warning: it is very important to include %s in the following sentences +const char *Txt_The_copy_has_stopped_when_trying_to_paste_X_because_there_is_already_an_object_with_that_name = // Warning: it is very important to include %s in the following sentences #if L==1 // ca - "La copia se ha detenido al intentar pegar el archivo %s" - " porque se excedería el número máximo de niveles permitido."; // Necessita traducció -#elif L==2 // de - "Zu viele Ebenen. Der Kopiervorgang wurde abgebrochen, als versucht wurde," - " die Datei %s einzufügen."; -#elif L==3 // en - "The copy has stopped when trying to paste the file %s" - " because it would exceed the maximum allowed number of levels."; -#elif L==4 // es - "La copia se ha detenido al intentar pegar el archivo %s" - " porque se excedería el número máximo de niveles permitido."; -#elif L==5 // fr - "The copy has stopped when trying to paste the file %s" - " because it would exceed the maximum allowed number of levels."; // Besoin de traduction -#elif L==6 // gn - "La copia se ha detenido al intentar pegar el archivo %s" - " porque se excedería el número máximo de niveles permitido."; // Okoteve traducción -#elif L==7 // it - "La copia è terminata quando si è provato a incollare il file %s" - " perchè superava il massimo numero di livelli permessi."; -#elif L==8 // pl - "The copy has stopped when trying to paste the file %s" - " because it would exceed the maximum allowed number of levels."; // Potrzebujesz tlumaczenie -#elif L==9 // pt - "A cópia parou ao tentar colar o arquivo %s" - " porque ele excederia o número máximo permitido de níveis."; -#elif L==10 // tr - "The copy has stopped when trying to paste the file %s" - " because it would exceed the maximum allowed number of levels."; // Çeviri lazim! -#endif - -const char *Txt_The_copy_has_stopped_when_trying_to_paste_the_link_X_because_it_would_exceed_the_maximum_allowed_number_of_levels = // Warning: it is very important to include %s in the following sentences -#if L==1 // ca - "La copia se ha detenido al intentar pegar el enlace %s" - " porque se excedería el número máximo de niveles permitido."; // Necessita traducció -#elif L==2 // de - "Zu viele Ebenen. Der Kopiervorgang wurde abgebrochen, als versucht wurde," - " die Link %s einzufügen."; -#elif L==3 // en - "The copy has stopped when trying to paste the link %s" - " because it would exceed the maximum allowed number of levels."; -#elif L==4 // es - "La copia se ha detenido al intentar pegar el enlace %s" - " porque se excedería el número máximo de niveles permitido."; -#elif L==5 // fr - "The copy has stopped when trying to paste the link %s" - " because it would exceed the maximum allowed number of levels."; // Besoin de traduction -#elif L==6 // gn - "La copia se ha detenido al intentar pegar el enlace %s" - " porque se excedería el número máximo de niveles permitido."; // Okoteve traducción -#elif L==7 // it - "La copia è terminata quando si è provato a incollare il link %s" - " perchè superava il massimo numero di livelli permessi."; -#elif L==8 // pl - "The copy has stopped when trying to paste the link %s" - " because it would exceed the maximum allowed number of levels."; // Potrzebujesz tlumaczenie -#elif L==9 // pt - "A cópia parou ao tentar colar o link %s" - " porque ele excederia o número m&aaxute;ximo permitido de níveis."; -#elif L==10 // tr - "The copy has stopped when trying to paste the link %s" - " because it would exceed the maximum allowed number of levels."; // Çeviri lazim! -#endif - -const char *Txt_The_copy_has_stopped_when_trying_to_paste_the_file_X_because_there_is_already_an_object_with_that_name = // Warning: it is very important to include %s in the following sentences -#if L==1 // ca - "La copia se ha detenido al intentar pegar el archivo %s" + "La copia se ha detenido al intentar pegar %s" " porque ya existe otro objeto con ese nombre."; // Necessita traducció #elif L==2 // de - "Der Kopiervorgang wurde abgebrochen, als versucht wurde, die Datei %s" + "Der Kopiervorgang wurde abgebrochen, als versucht wurde, %s" " einzufügen. Der Objektname wird bereits verwendet."; #elif L==3 // en - "The copy has stopped when trying to paste the file %s" + "The copy has stopped when trying to paste %s" " because there is already an object with that name."; #elif L==4 // es - "La copia se ha detenido al intentar pegar el archivo %s" + "La copia se ha detenido al intentar pegar %s" " porque ya existe otro objeto con ese nombre."; #elif L==5 // fr - "The copy has stopped when trying to paste the file %s" + "The copy has stopped when trying to paste %s" " because there is already an object with that name."; // Besoin de traduction #elif L==6 // gn - "La copia se ha detenido al intentar pegar el archivo %s" + "La copia se ha detenido al intentar pegar %s" " porque ya existe otro objecto con ese nombre."; // Okoteve traducción #elif L==7 // it - "La copia è terminata quando si è provato a incollare il file %s" + "La copia è terminata quando si è provato a incollare %s" " perchè c'era già un oggetto con quel nome."; #elif L==8 // pl - "The copy has stopped when trying to paste the file %s" + "The copy has stopped when trying to paste %s" " because there is already an object with that name."; // Potrzebujesz tlumaczenie #elif L==9 // pt - "A cópia parou ao tentar colar o arquivo %s" + "A cópia parou ao tentar colar %s" " porque já existe um objeto com esse nome."; #elif L==10 // tr - "The copy has stopped when trying to paste the file %s" + "The copy has stopped when trying to paste %s" " because there is already an object with that name."; // Çeviri lazim! #endif -const char *Txt_The_copy_has_stopped_when_trying_to_paste_the_link_X_because_there_is_already_an_object_with_that_name = // Warning: it is very important to include %s in the following sentences +const char *Txt_The_copy_has_stopped_when_trying_to_paste_X_because_you_can_not_paste_a_file_here_of_a_type_other_than_HTML = // Warning: it is very important to include %s in the following sentences #if L==1 // ca - "La copia se ha detenido al intentar pegar el enlace %s" - " porque ya existe otro objeto con ese nombre."; // Necessita traducció -#elif L==2 // de - "Der Kopiervorgang wurde abgebrochen, als versucht wurde, die Link %s" - " einzufügen. Der Objektname wird bereits verwendet."; -#elif L==3 // en - "The copy has stopped when trying to paste the link %s" - " because there is already an object with that name."; -#elif L==4 // es - "La copia se ha detenido al intentar pegar el enlace %s" - " porque ya existe otro objeto con ese nombre."; -#elif L==5 // fr - "The copy has stopped when trying to paste the link %s" - " because there is already an object with that name."; // Besoin de traduction -#elif L==6 // gn - "La copia se ha detenido al intentar pegar el enlace %s" - " porque ya existe otro objecto con ese nombre."; // Okoteve traducción -#elif L==7 // it - "La copia è terminata quando si è provato a incollare il link %s" - " perchè c'era già un oggetto con quel nome."; -#elif L==8 // pl - "The copy has stopped when trying to paste the link %s" - " because there is already an object with that name."; // Potrzebujesz tlumaczenie -#elif L==9 // pt - "A cópia parou ao tentar colar o link %s" - " porque já existe um objeto com esse nome."; -#elif L==10 // tr - "The copy has stopped when trying to paste the link %s" - " because there is already an object with that name."; // Çeviri lazim! -#endif - -const char *Txt_The_copy_has_stopped_when_trying_to_paste_the_file_X_because_you_can_not_paste_a_file_here_of_a_type_other_than_HTML = // Warning: it is very important to include %s in the following sentences -#if L==1 // ca - "La copia se ha detenido al intentar pegar el archivo %s" + "La copia se ha detenido al intentar pegar %s" " porque no se puede pegar aquí un archivo de un tipo distinto a HTML."; // Necessita traducció #elif L==2 // de - "Der Kopiervorgang wurde abgebrochen, als versucht wurde, die Datei %s" + "Der Kopiervorgang wurde abgebrochen, als versucht wurde, %s" " einzufügen. Es dürfen nur HTML-Daten eingefügt werden."; #elif L==3 // en - "The copy has stopped when trying to paste the file %s" + "The copy has stopped when trying to paste %s" " because you can not paste a file here of a type other than HTML."; #elif L==4 // es - "La copia se ha detenido al intentar pegar el archivo %s" + "La copia se ha detenido al intentar pegar %s" " porque no se puede pegar aquí un archivo de un tipo distinto a HTML."; #elif L==5 // fr - "The copy has stopped when trying to paste the file %s" + "The copy has stopped when trying to paste %s" " because you can not paste a file here of a type other than HTML."; // Besoin de traduction #elif L==6 // gn - "La copia se ha detenido al intentar pegar el archivo %s" + "La copia se ha detenido al intentar pegar %s" " porque no se puede pegar aquí un archivo de un tipo distinto a HTML."; // Okoteve traducción #elif L==7 // it - "La copia è terminata quando si è provato a incollare il file %s" + "La copia è terminata quando si è provato a incollare %s" " perchè non puoi incollare qui un file di un tipo diverso da HTML."; #elif L==8 // pl - "The copy has stopped when trying to paste the file %s" + "The copy has stopped when trying to paste %s" " because you can not paste a file here of a type other than HTML."; // Potrzebujesz tlumaczenie #elif L==9 // pt - "A cópia parou ao tentar colar o arquivo %s" + "A cópia parou ao tentar colar %s" " porque você não pode colar um arquivo aqui de um tipo diferente de HTML."; #elif L==10 // tr - "The copy has stopped when trying to paste the file %s" + "The copy has stopped when trying to paste %s" " because you can not paste a file here of a type other than HTML."; // Çeviri lazim! #endif diff --git a/swad_zip.c b/swad_zip.c index 010ae0b1..96653542 100644 --- a/swad_zip.c +++ b/swad_zip.c @@ -275,7 +275,7 @@ static void ZIP_CreateDirCompressionUsr (struct Usr_Data *UsrDat) /* Create path to folder and link */ snprintf (PathFolderUsrInsideCrs,sizeof (PathFolderUsrInsideCrs), "%s/usr/%02u/%ld", - Gbl.Crs.PathPriv,(unsigned) (UsrDat->UsrCod % 100),UsrDat->UsrCod); + Gbl.Crs.Path.AbsPriv,(unsigned) (UsrDat->UsrCod % 100),UsrDat->UsrCod); snprintf (LinkTmpUsr,sizeof (LinkTmpUsr),"%s/%s/%s", Cfg_PATH_ZIP_PRIVATE,Gbl.FileBrowser.ZIP.TmpDir,FullNameAndUsrID); @@ -348,7 +348,7 @@ static void ZIP_CompressFolderIntoZIP (void) /***** Create a copy of the directory to compress *****/ snprintf (Path,sizeof (Path),"%s/%s", - Gbl.FileBrowser.Priv.PathAboveRootFolder, + Gbl.FileBrowser.Path.AboveRootFolder, Gbl.FileBrowser.FilFolLnk.Full); snprintf (PathCompression,sizeof (PathCompression),"%s/%s", Cfg_PATH_ZIP_PRIVATE,