diff --git a/swad_assignment.c b/swad_assignment.c
index c3c3a122..17c61515 100644
--- a/swad_assignment.c
+++ b/swad_assignment.c
@@ -514,9 +514,12 @@ static void Asg_WriteAssignmentFolder (struct Assignment *Asg,bool PrintView)
Lay_ShowErrorAndExit ("Wrong role.");
break;
}
- Brw_PutParamsFileBrowser (Brw_INTERNAL_NAME_ROOT_FOLDER_ASSIGNMENTS,
- Asg->Folder,
- Brw_IS_FOLDER,-1L);
+ Str_Copy (Gbl.FileBrowser.FilFolLnk.Path,Brw_INTERNAL_NAME_ROOT_FOLDER_ASSIGNMENTS,
+ PATH_MAX);
+ Str_Copy (Gbl.FileBrowser.FilFolLnk.Name,Asg->Folder,
+ NAME_MAX);
+ Gbl.FileBrowser.FilFolLnk.Type = Brw_IS_FOLDER;
+ Brw_PutImplicitParamsFileBrowser ();
Ico_PutIconLink ("folder-open-yellow-plus.png",
Txt_Upload_file_or_create_folder);
Frm_EndForm ();
diff --git a/swad_changelog.h b/swad_changelog.h
index 478b6c80..ba5b0956 100644
--- a/swad_changelog.h
+++ b/swad_changelog.h
@@ -448,10 +448,11 @@ En OpenSWAD:
ps2pdf source.ps destination.pdf
*/
-#define Log_PLATFORM_VERSION "SWAD 18.119 (2019-04-25)"
+#define Log_PLATFORM_VERSION "SWAD 18.120 (2019-04-25)"
#define CSS_FILE "swad18.112.1.css"
#define JS_FILE "swad18.116.5.js"
/*
+ Version 18.120: Apr 25, 2019 Code refactoring related to file browser. (242466 lines)
Version 18.119: Apr 25, 2019 Code refactoring related to selected users. (242536 lines)
Version 18.118.5: Apr 23, 2019 Code refactoring in file browser. (242497 lines)
Version 18.118.4: Apr 23, 2019 Changes in file browser. (242518 lines)
diff --git a/swad_file_browser.c b/swad_file_browser.c
index 5a57d822..8133711b 100644
--- a/swad_file_browser.c
+++ b/swad_file_browser.c
@@ -1228,10 +1228,6 @@ const unsigned long long Brw_MAX_QUOTA_BRIEF[Rol_NUM_ROLES] = // MaxRole is used
/**************************** Internal variables *****************************/
/*****************************************************************************/
-/* Used to pass parameter to function */
-static const char *Brw_PathInTree;
-static const char *Brw_FileName;
-
/*****************************************************************************/
/*************************** Internal prototypes *****************************/
/*****************************************************************************/
@@ -1239,8 +1235,8 @@ static const char *Brw_FileName;
static long Brw_GetGrpSettings (void);
static void Brw_GetDataCurrentGrp (void);
-static void Brw_PutImplicitParamsFileBrowser (void);
-
+static void Brw_PutParamsFileBrowser (const char *PathInTree,const char *FileFolderName,
+ Brw_FileType_t FileType,long FilCod);
static void Brw_GetParamsPathInTreeAndFileName (void);
static void Brw_SetPathFileBrowser (void);
static void Brw_CreateFoldersAssignmentsIfNotExist (long ZoneUsrCod);
@@ -1287,58 +1283,40 @@ static void Brw_ListDir (unsigned Level,const char *RowId,
const char PathInTree[PATH_MAX + 1]);
static bool Brw_WriteRowFileBrowser (unsigned Level,const char *RowId,
bool TreeContracted,
- Brw_IconTree_t IconThisRow,
- const char PathInTree[PATH_MAX + 1],
- const char *FileName);
+ Brw_IconTree_t IconThisRow);
static bool Brw_CheckIfCanPasteIn (unsigned Level);
-static void Brw_PutIconRemove (const char PathInTree[PATH_MAX + 1],
- const char *FileName);
-static void Brw_PutIconCopy (const char PathInTree[PATH_MAX + 1],
- const char *FileName);
-static void Brw_PutIconPaste (unsigned Level,const char PathInTree[PATH_MAX + 1],
- const char *FileName);
+static void Brw_PutIconRemove (void);
+static void Brw_PutIconCopy (void);
+static void Brw_PutIconPaste (unsigned Level);
static void Brw_IndentAndWriteIconExpandContract (unsigned Level,
const char *FileBrowserId,const char *RowId,
- Brw_IconTree_t IconThisRow,
- const char PathInTree[PATH_MAX + 1],
- const char *FileName);
+ Brw_IconTree_t IconThisRow);
static void Brw_IndentDependingOnLevel (unsigned Level);
static void Brw_PutIconToExpandFolder (const char *FileBrowserId,const char *RowId,
- bool Hidden,
- const char PathInTree[PATH_MAX + 1],
- const char *FileName);
+ bool Hidden);
static void Brw_PutIconToContractFolder (const char *FileBrowserId,const char *RowId,
- bool Hidden,
- const char PathInTree[PATH_MAX + 1],
- const char *FileName);
+ bool Hidden);
-static void Brw_PutIconShow (const char *PathInTree,const char *FileName,
- const char *Anchor);
-static void Brw_PutIconHide (const char *PathInTree,const char *FileName,
- const char *Anchor);
+static void Brw_PutIconShow (const char *Anchor);
+static void Brw_PutIconHide (const char *Anchor);
static bool Brw_CheckIfAnyUpperLevelIsHidden (unsigned CurrentLevel);
static void Brw_PutIconFolder (unsigned Level,
const char *FileBrowserId,const char *RowId,
- Brw_IconTree_t IconSubtree,
- const char *PathInTree,
- const char *FileName);
+ Brw_IconTree_t IconSubtree);
static void Brw_PutIconFolderWithoutPlus (const char *FileBrowserId,const char *RowId,
bool Open,bool Hidden);
static void Brw_PutIconFolderWithPlus (const char *FileBrowserId,const char *RowId,
- bool Open,bool Hidden,
- const char PathInTree[PATH_MAX + 1],
- const char *FileName);
+ bool Open,bool Hidden);
static void Brw_PutIconNewFileOrFolder (void);
static void Brw_PutIconFileWithLinkToViewMetadata (unsigned Size,
struct FileMetadata *FileMetadata);
static void Brw_PutIconFile (unsigned Size,Brw_FileType_t FileType,const char *FileName);
-static void Brw_PutButtonToDownloadZIPOfAFolder (const char *PathInTree,const char *FileName);
+static void Brw_PutButtonToDownloadZIPOfAFolder (void);
-static void Brw_WriteFileName (unsigned Level,bool IsPublic,
- const char *PathInTree,const char *FileName);
+static void Brw_WriteFileName (unsigned Level,bool IsPublic);
static void Brw_GetFileNameToShowDependingOnLevel (Brw_FileBrowser_t FileBrowser,
unsigned Level,
Brw_FileType_t FileType,
@@ -1397,7 +1375,8 @@ static bool Brw_CheckIfIAmOwnerOfFile (long PublisherUsrCod);
static void Brw_WriteBigLinkToDownloadFile (const char *URL,
struct FileMetadata *FileMetadata,
const char *FileNameToShow);
-static void Brw_WriteSmallLinkToDownloadFile (const char *URL,Brw_FileType_t FileType,
+static void Brw_WriteSmallLinkToDownloadFile (const char *URL,
+ struct FileMetadata *FileMetadata,
const char *FileNameToShow);
static bool Brw_GetParamPublicFile (void);
static Brw_License_t Brw_GetParLicense (void);
@@ -2070,8 +2049,7 @@ void Brw_GetParAndInitFileBrowser (void)
/***** Get the path in the file browser and the name of the file or folder *****/
Brw_GetParamsPathInTreeAndFileName ();
- Brw_SetFullPathInTree (Gbl.FileBrowser.Priv.PathInTreeUntilFilFolLnk,
- Gbl.FileBrowser.FilFolLnkName);
+ Brw_SetFullPathInTree ();
/***** Get other parameters *****/
if (Brw_GetIfProjectFileBrowser ())
@@ -2306,14 +2284,16 @@ long Brw_GetParamFilCod (void)
/**************** Write parameters related with file browser *****************/
/*****************************************************************************/
-static void Brw_PutImplicitParamsFileBrowser (void)
+void Brw_PutImplicitParamsFileBrowser (void)
{
- Brw_PutParamsFileBrowser (Brw_PathInTree,Brw_FileName,
- Gbl.FileBrowser.FileType,-1L);
+ Brw_PutParamsFileBrowser (Gbl.FileBrowser.FilFolLnk.Path,
+ Gbl.FileBrowser.FilFolLnk.Name,
+ Gbl.FileBrowser.FilFolLnk.Type,
+ -1L); // Not used
}
-void Brw_PutParamsFileBrowser (const char *PathInTree,const char *FileFolderName,
- Brw_FileType_t FileType,long FilCod)
+static void Brw_PutParamsFileBrowser (const char *PathInTree,const char *FilFolLnkName,
+ Brw_FileType_t FileType,long FilCod)
{
if (Brw_GetIfGroupFileBrowser ()) // This file browser needs specify a group
/***** Group code *****/
@@ -2334,8 +2314,8 @@ void Brw_PutParamsFileBrowser (const char *PathInTree,const char *FileFolderName
/***** Path and file *****/
if (PathInTree)
Par_PutHiddenParamString ("Path",PathInTree);
- if (FileFolderName)
- Par_PutHiddenParamString (Brw_FileTypeParamName[FileType],FileFolderName);
+ if (FilFolLnkName)
+ Par_PutHiddenParamString (Brw_FileTypeParamName[FileType],FilFolLnkName);
if (FilCod > 0)
Brw_PutHiddenParamFilCod (FilCod);
}
@@ -2354,27 +2334,27 @@ static void Brw_GetParamsPathInTreeAndFileName (void)
/***** Get the path inside the tree
(this path does not include
the name of the file or folder at the end) *****/
- Par_GetParToText ("Path",Gbl.FileBrowser.Priv.PathInTreeUntilFilFolLnk,PATH_MAX);
+ Par_GetParToText ("Path",Gbl.FileBrowser.FilFolLnk.Path,PATH_MAX);
/* Check if path contains ".." */
- if (strstr (Gbl.FileBrowser.Priv.PathInTreeUntilFilFolLnk,"..")) // ".." is not allowed in path
+ if (strstr (Gbl.FileBrowser.FilFolLnk.Path,"..")) // ".." is not allowed in path
Lay_ShowErrorAndExit ("Wrong path.");
/***** Get the name of the file, folder or link *****/
- Gbl.FileBrowser.FileType = Brw_IS_UNKNOWN;
+ Gbl.FileBrowser.FilFolLnk.Type = Brw_IS_UNKNOWN;
for (FileType = (Brw_FileType_t) 0;
FileType < Brw_NUM_FILE_TYPES;
FileType++)
// File names with heading and trailing spaces are allowed
if (Par_GetParAndChangeFormat (Brw_FileTypeParamName[FileType],
- Gbl.FileBrowser.FilFolLnkName,
+ Gbl.FileBrowser.FilFolLnk.Name,
NAME_MAX,Str_TO_TEXT,false))
{
- Gbl.FileBrowser.FileType = FileType;
+ Gbl.FileBrowser.FilFolLnk.Type = FileType;
/* Check if filename contains ".." */
- Brw_GetFileNameToShow (Gbl.FileBrowser.FileType,
- Gbl.FileBrowser.FilFolLnkName,
+ Brw_GetFileNameToShow (Gbl.FileBrowser.FilFolLnk.Type,
+ Gbl.FileBrowser.FilFolLnk.Name,
FileNameToShow);
if (strstr (FileNameToShow,"..")) // ".." is not allowed in filename
Lay_ShowErrorAndExit ("Wrong file name.");
@@ -2382,13 +2362,13 @@ static void Brw_GetParamsPathInTreeAndFileName (void)
}
/***** Set level of this file or folder inside file browser *****/
- if (!strcmp (Gbl.FileBrowser.FilFolLnkName,"."))
+ if (!strcmp (Gbl.FileBrowser.FilFolLnk.Name,"."))
Gbl.FileBrowser.Level = 0;
else
{
// Level == number-of-slashes-in-path-except-file-or-folder + 1
Gbl.FileBrowser.Level = 1;
- for (Ptr = Gbl.FileBrowser.Priv.PathInTreeUntilFilFolLnk;
+ for (Ptr = Gbl.FileBrowser.FilFolLnk.Path;
*Ptr;
Ptr++)
if (*Ptr == '/')
@@ -2402,12 +2382,12 @@ static void Brw_GetParamsPathInTreeAndFileName (void)
{
if (Gbl.FileBrowser.Level == 1)
// We are in this case: assignments/assignment-folder
- Str_Copy (Gbl.FileBrowser.Asg.Folder,Gbl.FileBrowser.FilFolLnkName,
+ Str_Copy (Gbl.FileBrowser.Asg.Folder,Gbl.FileBrowser.FilFolLnk.Name,
Brw_MAX_BYTES_FOLDER);
else
{
// We are in this case: assignments/assignment-folder/rest-of-path
- for (Ptr = Gbl.FileBrowser.Priv.PathInTreeUntilFilFolLnk;
+ for (Ptr = Gbl.FileBrowser.FilFolLnk.Path;
*Ptr && *Ptr != '/';
Ptr++); // Go to first '/'
if (*Ptr == '/')
@@ -3676,13 +3656,15 @@ static void Brw_ShowFileBrowser (void)
/***** List recursively the directory *****/
fprintf (Gbl.F.Out,"
");
- Brw_SetFullPathInTree (Brw_RootFolderInternalNames[Gbl.FileBrowser.Type],".");
- Gbl.FileBrowser.FileType = Brw_IS_FOLDER;
+ Str_Copy (Gbl.FileBrowser.FilFolLnk.Path,Brw_RootFolderInternalNames[Gbl.FileBrowser.Type],
+ PATH_MAX);
+ Str_Copy (Gbl.FileBrowser.FilFolLnk.Name,".",
+ NAME_MAX);
+ Brw_SetFullPathInTree ();
+ Gbl.FileBrowser.FilFolLnk.Type = Brw_IS_FOLDER;
if (Brw_WriteRowFileBrowser (0,"1",
false, // Tree not contracted
- Brw_ICON_TREE_NOTHING,
- Brw_RootFolderInternalNames[Gbl.FileBrowser.Type],
- "."))
+ Brw_ICON_TREE_NOTHING))
Brw_ListDir (1,"1",
false, // Tree not contracted
Gbl.FileBrowser.Priv.PathRootFolder,
@@ -5369,7 +5351,12 @@ static void Brw_ListDir (unsigned Level,const char *ParentRowId,
snprintf (PathFileInExplTree,sizeof (PathFileInExplTree),
"%s/%s",
PathInTree,FileList[NumFile]->d_name);
- Brw_SetFullPathInTree (PathInTree,FileList[NumFile]->d_name);
+
+ Str_Copy (Gbl.FileBrowser.FilFolLnk.Path,PathInTree,
+ PATH_MAX);
+ Str_Copy (Gbl.FileBrowser.FilFolLnk.Name,FileList[NumFile]->d_name,
+ NAME_MAX);
+ Brw_SetFullPathInTree ();
/***** Add number of row to parent row id *****/
NumRow++;
@@ -5382,6 +5369,8 @@ static void Brw_ListDir (unsigned Level,const char *ParentRowId,
Lay_ShowErrorAndExit ("Can not get information about a file or folder.");
else if (S_ISDIR (FileStatus.st_mode)) // It's a directory
{
+ Gbl.FileBrowser.FilFolLnk.Type = Brw_IS_FOLDER;
+
if (Gbl.FileBrowser.FullTree)
IconSubtree = Brw_ICON_TREE_NOTHING;
else
@@ -5393,7 +5382,7 @@ static void Brw_ListDir (unsigned Level,const char *ParentRowId,
IconSubtree = Brw_ICON_TREE_NOTHING;
else
/***** Check if the tree starting at this subdirectory must be expanded *****/
- IconSubtree = Brw_GetIfExpandedTree (Gbl.FileBrowser.Priv.FullPathInTree) ? Brw_ICON_TREE_CONTRACT :
+ IconSubtree = Brw_GetIfExpandedTree (Gbl.FileBrowser.FilFolLnk.Full) ? Brw_ICON_TREE_CONTRACT :
Brw_ICON_TREE_EXPAND;
for (NumFileInSubdir = 0;
NumFileInSubdir < NumFilesInSubdir;
@@ -5406,12 +5395,9 @@ static void Brw_ListDir (unsigned Level,const char *ParentRowId,
}
/***** Write a row for the subdirectory *****/
- Gbl.FileBrowser.FileType = Brw_IS_FOLDER;
if (Brw_WriteRowFileBrowser (Level,RowId,
TreeContracted,
- IconSubtree,
- PathInTree,
- FileList[NumFile]->d_name))
+ IconSubtree))
if (Level < Brw_MAX_DIR_LEVELS)
/* List subtree starting at this this directory */
Brw_ListDir (Level + 1,RowId,
@@ -5420,13 +5406,11 @@ static void Brw_ListDir (unsigned Level,const char *ParentRowId,
}
else if (S_ISREG (FileStatus.st_mode)) // It's a regular file
{
- Gbl.FileBrowser.FileType = Str_FileIs (FileList[NumFile]->d_name,"url") ? Brw_IS_LINK :
- Brw_IS_FILE;
+ Gbl.FileBrowser.FilFolLnk.Type = Str_FileIs (Gbl.FileBrowser.FilFolLnk.Name,"url") ? Brw_IS_LINK :
+ Brw_IS_FILE;
Brw_WriteRowFileBrowser (Level,RowId,
TreeContracted,
- Brw_ICON_TREE_NOTHING,
- PathInTree,
- FileList[NumFile]->d_name);
+ Brw_ICON_TREE_NOTHING);
}
}
free ((void *) FileList[NumFile]);
@@ -5446,9 +5430,7 @@ static void Brw_ListDir (unsigned Level,const char *ParentRowId,
static bool Brw_WriteRowFileBrowser (unsigned Level,const char *RowId,
bool TreeContracted,
- Brw_IconTree_t IconThisRow,
- const char PathInTree[PATH_MAX + 1],
- const char *FileName)
+ Brw_IconTree_t IconThisRow)
{
char *Anchor;
bool RowSetAsHidden = false;
@@ -5489,21 +5471,21 @@ static bool Brw_WriteRowFileBrowser (unsigned Level,const char *RowId,
if (SeeDocsZone || AdminDocsZone ||
SeeMarks || AdminMarks)
{
- RowSetAsHidden = Brw_CheckIfFileOrFolderIsSetAsHiddenInDB (Gbl.FileBrowser.FileType,
- Gbl.FileBrowser.Priv.FullPathInTree);
+ RowSetAsHidden = Brw_CheckIfFileOrFolderIsSetAsHiddenInDB (Gbl.FileBrowser.FilFolLnk.Type,
+ Gbl.FileBrowser.FilFolLnk.Full);
if (RowSetAsHidden && Level && (SeeDocsZone || SeeMarks))
return false;
if (AdminDocsZone || AdminMarks)
{
if (RowSetAsHidden) // this row is marked as hidden
{
- if (Gbl.FileBrowser.FileType == Brw_IS_FOLDER)
+ if (Gbl.FileBrowser.FilFolLnk.Type == Brw_IS_FOLDER)
Gbl.FileBrowser.HiddenLevels[Level] = true;
LightStyle = true;
}
else // this row is not marked as hidden
{
- if (Gbl.FileBrowser.FileType == Brw_IS_FOLDER)
+ if (Gbl.FileBrowser.FilFolLnk.Type == Brw_IS_FOLDER)
Gbl.FileBrowser.HiddenLevels[Level] = false;
LightStyle = Brw_CheckIfAnyUpperLevelIsHidden (Level);
}
@@ -5516,12 +5498,12 @@ static bool Brw_WriteRowFileBrowser (unsigned Level,const char *RowId,
if (FileMetadata.FilCod <= 0) // No entry for this file in database table of files
/* Add entry to the table of files/folders */
FileMetadata.FilCod = Brw_AddPathToDB (-1L,FileMetadata.FileType,
- Gbl.FileBrowser.Priv.FullPathInTree,false,Brw_LICENSE_DEFAULT);
+ Gbl.FileBrowser.FilFolLnk.Full,false,Brw_LICENSE_DEFAULT);
/***** Is this row public or private? *****/
if (SeeDocsZone || AdminDocsZone || SharedZone)
{
- RowSetAsPublic = (Gbl.FileBrowser.FileType == Brw_IS_FOLDER) ? Brw_GetIfFolderHasPublicFiles (Gbl.FileBrowser.Priv.FullPathInTree) :
+ RowSetAsPublic = (Gbl.FileBrowser.FilFolLnk.Type == Brw_IS_FOLDER) ? Brw_GetIfFolderHasPublicFiles (Gbl.FileBrowser.FilFolLnk.Full) :
FileMetadata.IsPublic;
if (Gbl.FileBrowser.ShowOnlyPublicFiles && !RowSetAsPublic)
return false;
@@ -5533,13 +5515,13 @@ static bool Brw_WriteRowFileBrowser (unsigned Level,const char *RowId,
IsRecent = true;
/* Style of the text in this row */
- Gbl.FileBrowser.TxtStyle = (LightStyle ? (Gbl.FileBrowser.FileType == Brw_IS_FOLDER || !IsRecent ? "LST_HID" :
+ Gbl.FileBrowser.TxtStyle = (LightStyle ? (Gbl.FileBrowser.FilFolLnk.Type == Brw_IS_FOLDER || !IsRecent ? "LST_HID" :
"LST_REC_HID") :
- (Gbl.FileBrowser.FileType == Brw_IS_FOLDER || !IsRecent ? "LST" :
+ (Gbl.FileBrowser.FilFolLnk.Type == Brw_IS_FOLDER || !IsRecent ? "LST" :
"LST_REC"));
- Gbl.FileBrowser.InputStyle = (LightStyle ? (Gbl.FileBrowser.FileType == Brw_IS_FOLDER || !IsRecent ? "LST_EDIT_HID" :
+ Gbl.FileBrowser.InputStyle = (LightStyle ? (Gbl.FileBrowser.FilFolLnk.Type == Brw_IS_FOLDER || !IsRecent ? "LST_EDIT_HID" :
"LST_EDIT_REC_HID") :
- (Gbl.FileBrowser.FileType == Brw_IS_FOLDER || !IsRecent ? "LST_EDIT" :
+ (Gbl.FileBrowser.FilFolLnk.Type == Brw_IS_FOLDER || !IsRecent ? "LST_EDIT" :
"LST_EDIT_REC"));
/***** Get data of assignment using the name of the folder *****/
@@ -5547,7 +5529,7 @@ static bool Brw_WriteRowFileBrowser (unsigned Level,const char *RowId,
{
if (Level == 1) // Main folder of the assignment
{
- Str_Copy (Gbl.FileBrowser.Asg.Folder,FileName,
+ Str_Copy (Gbl.FileBrowser.Asg.Folder,Gbl.FileBrowser.FilFolLnk.Name,
Brw_MAX_BYTES_FOLDER);
Asg_GetDataOfAssignmentByFolder (&Gbl.FileBrowser.Asg);
// The data of this assignment remains in Gbl.FileBrowser.Asg
@@ -5587,20 +5569,20 @@ static bool Brw_WriteRowFileBrowser (unsigned Level,const char *RowId,
Level != 0) // Never copy root folder
// If path in the clipboard is equal to complete path in tree...
// ...or is the start of complete path in tree...
- if (Str_Path1BeginsByPath2 (Gbl.FileBrowser.Priv.FullPathInTree,Gbl.FileBrowser.Clipboard.Path))
+ if (Str_Path1BeginsByPath2 (Gbl.FileBrowser.FilFolLnk.Full,Gbl.FileBrowser.Clipboard.Path))
Gbl.FileBrowser.Clipboard.IsThisFile = true;
/* Check if I can modify (remove, rename, etc.) this file or folder */
Gbl.FileBrowser.ICanEditFileOrFolder = Brw_CheckIfICanEditFileOrFolder (Level);
/* Icon to remove folder, file or link */
- Brw_PutIconRemove (PathInTree,FileName);
+ Brw_PutIconRemove ();
/* Icon to copy */
- Brw_PutIconCopy (PathInTree,FileName);
+ Brw_PutIconCopy ();
/* Icon to paste */
- Brw_PutIconPaste (Level,PathInTree,FileName);
+ Brw_PutIconPaste (Level);
}
/***** Indentation depending on level, icon, and file/folder name *****/
@@ -5613,23 +5595,21 @@ static bool Brw_WriteRowFileBrowser (unsigned Level,const char *RowId,
/* Indent depending on level */
if (Level)
- Brw_IndentAndWriteIconExpandContract (Level,FileBrowserId,RowId,IconThisRow,
- PathInTree,FileName);
+ Brw_IndentAndWriteIconExpandContract (Level,FileBrowserId,RowId,IconThisRow);
/* Put icon to show/hide file or folder */
if (AdminDocsZone || AdminMarks)
{
if (RowSetAsHidden) // this row is marked as hidden
- Brw_PutIconShow (PathInTree,FileName,Anchor);
+ Brw_PutIconShow (Anchor);
else // this row is not marked as hidden
- Brw_PutIconHide (PathInTree,FileName,Anchor);
+ Brw_PutIconHide (Anchor);
}
/***** File or folder icon *****/
- if (Gbl.FileBrowser.FileType == Brw_IS_FOLDER)
+ if (Gbl.FileBrowser.FilFolLnk.Type == Brw_IS_FOLDER)
/* Icon with folder */
- Brw_PutIconFolder (Level,FileBrowserId,RowId,IconThisRow,
- PathInTree,FileName);
+ Brw_PutIconFolder (Level,FileBrowserId,RowId,IconThisRow);
else // File or link
{
/* Icon with file type or link */
@@ -5644,8 +5624,7 @@ static bool Brw_WriteRowFileBrowser (unsigned Level,const char *RowId,
Brw_PutIconNewFileOrFolder ();
/* File or folder name */
- Brw_WriteFileName (Level,FileMetadata.IsPublic,
- PathInTree,FileName);
+ Brw_WriteFileName (Level,FileMetadata.IsPublic);
/* End column */
fprintf (Gbl.F.Out,""
@@ -5654,7 +5633,7 @@ static bool Brw_WriteRowFileBrowser (unsigned Level,const char *RowId,
if (AdminMarks)
/***** Header and footer rows *****/
- Mrk_GetAndWriteNumRowsHeaderAndFooter (Gbl.FileBrowser.FileType,PathInTree,FileName);
+ Mrk_GetAndWriteNumRowsHeaderAndFooter ();
if (AssignmentsZone && Level == 1)
/***** Start and end dates of assignment *****/
@@ -5663,14 +5642,14 @@ static bool Brw_WriteRowFileBrowser (unsigned Level,const char *RowId,
/***** File date and size *****/
Brw_WriteFileSizeAndDate (&FileMetadata);
- if (Gbl.FileBrowser.FileType == Brw_IS_FOLDER)
+ if (Gbl.FileBrowser.FilFolLnk.Type == Brw_IS_FOLDER)
{
/***** Put icon to download ZIP of folder *****/
fprintf (Gbl.F.Out,"
",Gbl.RowEvenOdd);
if (Gbl.Usrs.Me.Role.Logged >= Rol_STD && // Only ZIP folders if I am student, teacher...
!SeeMarks && // Do not ZIP folders when seeing marks
!(SeeDocsZone && RowSetAsHidden)) // When seeing docs, if folder is not hidden (this could happen for Level == 0)
- Brw_PutButtonToDownloadZIPOfAFolder (PathInTree,FileName);
+ Brw_PutButtonToDownloadZIPOfAFolder ();
fprintf (Gbl.F.Out,"
");
}
else // File or link
@@ -5691,41 +5670,40 @@ static bool Brw_WriteRowFileBrowser (unsigned Level,const char *RowId,
/*****************************************************************************/
/*************** Construct full path in tree of file browser *****************/
/*****************************************************************************/
-// If, for example, PathInTreeUntilFileOrFolder is "descarga/teoria" and FilFolLnkName is "tema1.pdf"
-// then Gbl.FileBrowser.Priv.FullPathInTree will be "descarga/teoria/tema1.pdf"
-// If FilFolLnkName is ".", then Gbl.FileBrowser.Priv.FullPathInTree will be equal to PathInTreeUntilFileOrFolder
+// If, for example, Path is "descarga/teoria" and Name is "tema1.pdf"
+// then FullPathInTree will be "descarga/teoria/tema1.pdf"
+// If Name is ".", then FullPathInTree will be equal to Path
-void Brw_SetFullPathInTree (const char PathInTreeUntilFileOrFolder[PATH_MAX + 1],
- const char FilFolLnkName[NAME_MAX + 1])
+void Brw_SetFullPathInTree (void)
{
char FullPath[PATH_MAX + 1 + NAME_MAX + 1];
- if (!PathInTreeUntilFileOrFolder[0])
- Gbl.FileBrowser.Priv.FullPathInTree[0] = '\0';
- else if (strcmp (FilFolLnkName,"."))
+ if (!Gbl.FileBrowser.FilFolLnk.Path[0])
+ Gbl.FileBrowser.FilFolLnk.Full[0] = '\0';
+ else if (strcmp (Gbl.FileBrowser.FilFolLnk.Name,"."))
{
snprintf (FullPath,sizeof (FullPath),
"%s/%s",
- PathInTreeUntilFileOrFolder,FilFolLnkName);
- Str_Copy (Gbl.FileBrowser.Priv.FullPathInTree,FullPath,
+ Gbl.FileBrowser.FilFolLnk.Path,Gbl.FileBrowser.FilFolLnk.Name);
+ Str_Copy (Gbl.FileBrowser.FilFolLnk.Full,FullPath,
PATH_MAX);
}
else // It's the root folder
- Str_Copy (Gbl.FileBrowser.Priv.FullPathInTree,PathInTreeUntilFileOrFolder,
+ Str_Copy (Gbl.FileBrowser.FilFolLnk.Full,Gbl.FileBrowser.FilFolLnk.Path,
PATH_MAX);
}
/*****************************************************************************/
/******* Check if the clipboard can be pasted into the current folder ********/
/*****************************************************************************/
-// Return true if Gbl.FileBrowser.Clipboard.Path can be pasted into Gbl.FileBrowser.Priv.FullPathInTree
+// Return true if Gbl.FileBrowser.Clipboard.Path can be pasted into Gbl.FileBrowser.FilFolLnk.Full
static bool Brw_CheckIfCanPasteIn (unsigned Level)
{
char PathDstWithFile[PATH_MAX + 1 + NAME_MAX + 1];
/***** If not in a folder... *****/
- if (Gbl.FileBrowser.FileType != Brw_IS_FOLDER)
+ if (Gbl.FileBrowser.FilFolLnk.Type != Brw_IS_FOLDER)
return false;
/***** If there is nothing in clipboard... *****/
@@ -5748,7 +5726,7 @@ static bool Brw_CheckIfCanPasteIn (unsigned Level)
/***** Construct the name of the file or folder destination *****/
snprintf (PathDstWithFile,sizeof (PathDstWithFile),
"%s/%s",
- Gbl.FileBrowser.Priv.FullPathInTree,
+ Gbl.FileBrowser.FilFolLnk.Full,
Gbl.FileBrowser.Clipboard.FileName);
return !Str_Path1BeginsByPath2 (PathDstWithFile,
@@ -5762,26 +5740,21 @@ static bool Brw_CheckIfCanPasteIn (unsigned Level)
/********** Write link and icon to remove a file, link or folder *************/
/*****************************************************************************/
-static void Brw_PutIconRemove (const char PathInTree[PATH_MAX + 1],
- const char *FileName)
+static void Brw_PutIconRemove (void)
{
fprintf (Gbl.F.Out,"
",Gbl.RowEvenOdd);
if (Gbl.FileBrowser.ICanEditFileOrFolder) // Can I remove this?
- switch (Gbl.FileBrowser.FileType)
+ switch (Gbl.FileBrowser.FilFolLnk.Type)
{
case Brw_IS_FILE:
case Brw_IS_LINK:
/***** Form to remove a file or link *****/
- Brw_PathInTree = PathInTree;
- Brw_FileName = FileName;
Ico_PutContextualIconToRemove (Brw_ActAskRemoveFile[Gbl.FileBrowser.Type],
Brw_PutImplicitParamsFileBrowser);
break;
case Brw_IS_FOLDER:
/***** Form to remove a folder *****/
- Brw_PathInTree = PathInTree;
- Brw_FileName = FileName;
Ico_PutContextualIconToRemove (Brw_ActRemoveFolder[Gbl.FileBrowser.Type],
Brw_PutImplicitParamsFileBrowser);
break;
@@ -5795,17 +5768,14 @@ static void Brw_PutIconRemove (const char PathInTree[PATH_MAX + 1],
}
/*****************************************************************************/
-/************** Write link e icon to copy a file o a folder ******************/
+/************* Write link and icon to copy a file o a folder *****************/
/*****************************************************************************/
-static void Brw_PutIconCopy (const char PathInTree[PATH_MAX + 1],
- const char *FileName)
+static void Brw_PutIconCopy (void)
{
fprintf (Gbl.F.Out,"
",Gbl.RowEvenOdd);
/***** Form to copy into the clipboard *****/
- Brw_PathInTree = PathInTree;
- Brw_FileName = FileName;
Ico_PutContextualIconToCopy (Brw_ActCopy[Gbl.FileBrowser.Type],
Brw_PutImplicitParamsFileBrowser);
@@ -5813,24 +5783,21 @@ static void Brw_PutIconCopy (const char PathInTree[PATH_MAX + 1],
}
/*****************************************************************************/
-/************** Write link e icon to paste a file or a folder ****************/
+/************* Write link and icon to paste a file or a folder ***************/
/*****************************************************************************/
-static void Brw_PutIconPaste (unsigned Level,const char PathInTree[PATH_MAX + 1],
- const char *FileName)
+static void Brw_PutIconPaste (unsigned Level)
{
extern const char *Txt_Copy_not_allowed;
fprintf (Gbl.F.Out,"
",Gbl.RowEvenOdd);
- if (Gbl.FileBrowser.FileType == Brw_IS_FOLDER) // Can't paste in a file or link
+ if (Gbl.FileBrowser.FilFolLnk.Type == Brw_IS_FOLDER) // Can't paste in a file or link
{
/* Icon to paste */
if (Brw_CheckIfCanPasteIn (Level))
{
/***** Form to paste the content of the clipboard *****/
- Brw_PathInTree = PathInTree;
- Brw_FileName = FileName;
Ico_PutContextualIconToPaste (Brw_ActPaste[Gbl.FileBrowser.Type],
Brw_PutImplicitParamsFileBrowser);
}
@@ -5848,9 +5815,7 @@ static void Brw_PutIconPaste (unsigned Level,const char PathInTree[PATH_MAX + 1]
static void Brw_IndentAndWriteIconExpandContract (unsigned Level,
const char *FileBrowserId,const char *RowId,
- Brw_IconTree_t IconThisRow,
- const char PathInTree[PATH_MAX + 1],
- const char *FileName)
+ Brw_IconTree_t IconThisRow)
{
fprintf (Gbl.F.Out,"
");
/***** Form and icon *****/
- Brw_PathInTree = PathInTree;
- Brw_FileName = FileName;
Ico_PutContextualIconToCreateInFolder (Brw_ActFormCreate[Gbl.FileBrowser.Type],
Brw_PutImplicitParamsFileBrowser,
Open);
@@ -6206,8 +6145,9 @@ static void Brw_PutIconFileWithLinkToViewMetadata (unsigned Size,
/***** Start form *****/
Frm_StartForm (Brw_ActReqDatFile[Gbl.FileBrowser.Type]);
- Brw_PutParamsFileBrowser (NULL,NULL,
- Gbl.FileBrowser.FileType, // Not used
+ Brw_PutParamsFileBrowser (NULL, // Not used
+ NULL, // Not used
+ Brw_IS_UNKNOWN, // Not used
FileMetadata->FilCod);
/***** Name and link of the file or folder *****/
@@ -6268,11 +6208,9 @@ static void Brw_PutIconFile (unsigned Size,Brw_FileType_t FileType,const char *F
/***************** Put button to create ZIP file of a folder *****************/
/*****************************************************************************/
-static void Brw_PutButtonToDownloadZIPOfAFolder (const char *PathInTree,const char *FileName)
+static void Brw_PutButtonToDownloadZIPOfAFolder (void)
{
/***** Form to zip and download folder *****/
- Brw_PathInTree = PathInTree;
- Brw_FileName = FileName;
Ico_PutContextualIconToZIP (Brw_ActZIPFolder[Gbl.FileBrowser.Type],
Brw_PutImplicitParamsFileBrowser);
}
@@ -6281,8 +6219,7 @@ static void Brw_PutButtonToDownloadZIPOfAFolder (const char *PathInTree,const ch
/********** Write central part with the name of a file or folder *************/
/*****************************************************************************/
-static void Brw_WriteFileName (unsigned Level,bool IsPublic,
- const char *PathInTree,const char *FileName)
+static void Brw_WriteFileName (unsigned Level,bool IsPublic)
{
extern const char *Txt_Check_marks_in_the_file;
extern const char *Txt_Download;
@@ -6292,12 +6229,12 @@ static void Brw_WriteFileName (unsigned Level,bool IsPublic,
/***** Get the name of the file to show *****/
Brw_GetFileNameToShowDependingOnLevel (Gbl.FileBrowser.Type,
Level,
- Gbl.FileBrowser.FileType,
- FileName,
+ Gbl.FileBrowser.FilFolLnk.Type,
+ Gbl.FileBrowser.FilFolLnk.Name,
FileNameToShow);
/***** Name and link of the folder, file or link *****/
- if (Gbl.FileBrowser.FileType == Brw_IS_FOLDER)
+ if (Gbl.FileBrowser.FilFolLnk.Type == Brw_IS_FOLDER)
{
/***** Start cell *****/
fprintf (Gbl.F.Out,"
"
"");
@@ -9801,7 +9721,7 @@ void Brw_ShowFileMetadata (void)
}
/***** Add paths until file to table of expanded folders *****/
- Brw_InsFoldersInPathAndUpdOtherFoldersInExpandedFolders (Gbl.FileBrowser.Priv.PathInTreeUntilFilFolLnk);
+ Brw_InsFoldersInPathAndUpdOtherFoldersInExpandedFolders (Gbl.FileBrowser.FilFolLnk.Path);
}
else // !ICanView
{
@@ -9867,7 +9787,7 @@ void Brw_DownloadFile (void)
if (FileMetadata.FilCod <= 0) // No entry for this file in database table of files
/* Add entry to the table of files/folders */
FileMetadata.FilCod = Brw_AddPathToDB (-1L,FileMetadata.FileType,
- Gbl.FileBrowser.Priv.FullPathInTree,
+ Gbl.FileBrowser.FilFolLnk.Full,
false,Brw_LICENSE_DEFAULT);
/***** Check if I can view this file.
@@ -9910,8 +9830,8 @@ void Brw_DownloadFile (void)
Gbl.FileBrowser.Type == Brw_SHOW_MRK_GRP)
URL[0] = '\0';
else
- Brw_GetLinkToDownloadFile (Gbl.FileBrowser.Priv.PathInTreeUntilFilFolLnk,
- Gbl.FileBrowser.FilFolLnkName,
+ Brw_GetLinkToDownloadFile (Gbl.FileBrowser.FilFolLnk.Path,
+ Gbl.FileBrowser.FilFolLnk.Name,
URL);
/***** Mark possible notifications as seen *****/
@@ -9951,7 +9871,7 @@ void Brw_DownloadFile (void)
}
/***** Add paths until file to table of expanded folders *****/
- Brw_InsFoldersInPathAndUpdOtherFoldersInExpandedFolders (Gbl.FileBrowser.Priv.PathInTreeUntilFilFolLnk);
+ Brw_InsFoldersInPathAndUpdOtherFoldersInExpandedFolders (Gbl.FileBrowser.FilFolLnk.Path);
/***** Download the file *****/
fprintf (stdout,"Location: %s\n\n",URL);
@@ -10083,9 +10003,12 @@ static void Brw_WriteBigLinkToDownloadFile (const char *URL,
/* Form to see marks */
Frm_StartForm (Gbl.FileBrowser.Type == Brw_SHOW_MRK_CRS ? ActSeeMyMrkCrs :
ActSeeMyMrkGrp);
- Brw_PutParamsFileBrowser (FileMetadata->PathInTreeUntilFilFolLnk,
- FileMetadata->FilFolLnkName,
- FileMetadata->FileType,-1L);
+ Str_Copy (Gbl.FileBrowser.FilFolLnk.Path,FileMetadata->PathInTreeUntilFilFolLnk,
+ PATH_MAX);
+ Str_Copy (Gbl.FileBrowser.FilFolLnk.Name,FileMetadata->FilFolLnkName,
+ NAME_MAX);
+ Gbl.FileBrowser.FilFolLnk.Type = FileMetadata->FileType;
+ Brw_PutImplicitParamsFileBrowser ();
/* Link begin */
Frm_LinkFormSubmit (Txt_Check_marks_in_the_file,"FILENAME_TXT",NULL);
@@ -10126,7 +10049,8 @@ static void Brw_WriteBigLinkToDownloadFile (const char *URL,
/*********************** Write link to download a file ***********************/
/*****************************************************************************/
-static void Brw_WriteSmallLinkToDownloadFile (const char *URL,Brw_FileType_t FileType,
+static void Brw_WriteSmallLinkToDownloadFile (const char *URL,
+ struct FileMetadata *FileMetadata,
const char *FileNameToShow)
{
extern const char *Txt_Check_marks_in_the_file;
@@ -10138,9 +10062,12 @@ static void Brw_WriteSmallLinkToDownloadFile (const char *URL,Brw_FileType_t Fil
/* Form to see marks */
Frm_StartForm (Gbl.FileBrowser.Type == Brw_SHOW_MRK_CRS ? ActSeeMyMrkCrs :
ActSeeMyMrkGrp);
- Brw_PutParamsFileBrowser (Gbl.FileBrowser.Priv.PathInTreeUntilFilFolLnk,
- Gbl.FileBrowser.FilFolLnkName,
- FileType,-1L);
+ Str_Copy (Gbl.FileBrowser.FilFolLnk.Path,FileMetadata->PathInTreeUntilFilFolLnk,
+ PATH_MAX);
+ Str_Copy (Gbl.FileBrowser.FilFolLnk.Name,FileMetadata->FilFolLnkName,
+ NAME_MAX);
+ Gbl.FileBrowser.FilFolLnk.Type = FileMetadata->FileType;
+ Brw_PutImplicitParamsFileBrowser ();
/* Link begin */
Frm_LinkFormSubmit (Txt_Check_marks_in_the_file,"DAT",NULL);
@@ -10267,11 +10194,11 @@ void Brw_ChgFileMetadata (void)
/***** Change file metadata *****/
if (FileMetadata.FilCod > 0) // Entry exists in database
Brw_ChangeFilePublicInDB (Gbl.Usrs.Me.UsrDat.UsrCod,
- Gbl.FileBrowser.Priv.FullPathInTree,
+ Gbl.FileBrowser.FilFolLnk.Full,
PublicFileAfterEdition,License);
else // No entry in database
FileMetadata.FilCod = Brw_AddPathToDB (Gbl.Usrs.Me.UsrDat.UsrCod,FileMetadata.FileType,
- Gbl.FileBrowser.Priv.FullPathInTree,
+ Gbl.FileBrowser.FilFolLnk.Full,
PublicFileAfterEdition,License);
/***** Remove the affected clipboards *****/
@@ -10314,7 +10241,7 @@ void Brw_ChgFileMetadata (void)
/***** Write sucess message *****/
Ale_ShowAlert (Ale_SUCCESS,Txt_The_properties_of_file_X_have_been_saved,
- Gbl.FileBrowser.FilFolLnkName);
+ Gbl.FileBrowser.FilFolLnk.Name);
}
else
/***** Write error message and exit *****/
@@ -10409,7 +10336,7 @@ void Brw_GetFileMetadataByPath (struct FileMetadata *FileMetadata)
" AND Path='%s'",
(unsigned) Brw_FileBrowserForDB_files[Gbl.FileBrowser.Type],
Cod,ZoneUsrCod,
- Gbl.FileBrowser.Priv.FullPathInTree))
+ Gbl.FileBrowser.FilFolLnk.Full))
{
/* Get row */
row = mysql_fetch_row (mysql_res);
@@ -11360,7 +11287,7 @@ static bool Brw_CheckIfICanEditFileOrFolder (unsigned Level)
if (Gbl.FileBrowser.Asg.Hidden) // If assignment is hidden
return false; // Do not edit anything in hidden assigments
- if (Gbl.FileBrowser.FileType == Brw_IS_FOLDER && // The main folder of an assignment
+ if (Gbl.FileBrowser.FilFolLnk.Type == Brw_IS_FOLDER && // The main folder of an assignment
Level == 1)
return false; // Do not remove / rename main folder of assigment
@@ -11395,7 +11322,7 @@ static bool Brw_CheckIfICanEditFileOrFolder (unsigned Level)
static bool Brw_CheckIfICanCreateIntoFolder (unsigned Level)
{
/***** If not in a folder... *****/
- if (Gbl.FileBrowser.FileType != Brw_IS_FOLDER)
+ if (Gbl.FileBrowser.FilFolLnk.Type != Brw_IS_FOLDER)
return false;
/***** I must be student, teacher, admin or superuser to edit *****/
@@ -11471,7 +11398,7 @@ static bool Brw_CheckIfICanCreateIntoFolder (unsigned Level)
/********** Check if I have permission to modify a file or folder ************/
/********** in the current shared or private zone ************/
/*****************************************************************************/
-// Returns true if I can remove or rename Gbl.FileBrowser.Priv.FullPathInTree, and false if I have not permission
+// Returns true if I can remove or rename Gbl.FileBrowser.FilFolLnk.Full, and false if I have not permission
// I can remove or rename a file if I am the publisher
// I can remove or rename a folder if I am the unique publisher of all the files and folders in the subtree starting there
@@ -11558,7 +11485,7 @@ static bool Brw_CheckIfICanViewProjectAssessment (unsigned MyRolesInProject)
/********** Check if I have permission to modify a file or folder ************/
/********** in the current project documents zone ************/
/*****************************************************************************/
-// Returns true if I can remove or rename Gbl.FileBrowser.Priv.FullPathInTree, and false if I have not permission
+// Returns true if I can remove or rename Gbl.FileBrowser.FilFolLnk.Full, and false if I have not permission
// I can remove or rename a file if I am the publisher
// I can remove or rename a folder if I am the unique publisher of all the files and folders in the subtree starting there
@@ -11587,7 +11514,7 @@ static bool Brw_CheckIfICanModifyPrjDocFileOrFolder (void)
/********** Check if I have permission to modify a file or folder ************/
/********** in the current project assessment zone ************/
/*****************************************************************************/
-// Returns true if I can remove or rename Gbl.FileBrowser.Priv.FullPathInTree, and false if I have not permission
+// Returns true if I can remove or rename Gbl.FileBrowser.FilFolLnk.Full, and false if I have not permission
// I can remove or rename a file if I am the publisher
// I can remove or rename a folder if I am the unique publisher of all the files and folders in the subtree starting there
@@ -11625,19 +11552,19 @@ static long Brw_GetPublisherOfSubtree (void)
long PublisherUsrCod;
long Cod = Brw_GetCodForFiles ();
- /***** Get all the distinct publishers of files starting by
- Gbl.FileBrowser.Priv.FullPathInTree from database *****/
+ /***** Get all common files that are equal to full path (including filename)
+ or that are under that full path from database *****/
NumRows = DB_QuerySELECT (&mysql_res,"can not get publishers of files",
"SELECT DISTINCT(PublisherUsrCod) FROM files"
" WHERE FileBrowser=%u AND Cod=%ld"
" AND (Path='%s' OR Path LIKE '%s/%%')",
(unsigned) Brw_FileBrowserForDB_files[Gbl.FileBrowser.Type],
Cod,
- Gbl.FileBrowser.Priv.FullPathInTree,
- Gbl.FileBrowser.Priv.FullPathInTree);
+ Gbl.FileBrowser.FilFolLnk.Full,
+ Gbl.FileBrowser.FilFolLnk.Full);
- /***** Check all common files that are equal to Gbl.FileBrowser.Priv.FullPathInTree
- or that are under the folder Gbl.FileBrowser.Priv.FullPathInTree *****/
+ /***** Check all common files that are equal to full path (including filename)
+ or that are under that full path *****/
if (NumRows == 1) // Get the publisher of the file(s)
{
row = mysql_fetch_row (mysql_res);
@@ -12151,13 +12078,13 @@ static void Brw_WriteRowDocData (unsigned long *NumDocsNotHidden,MYSQL_ROW row)
Frm_StartForm (Action);
/* Parameters to go to file / folder */
- Brw_PutParamsFileBrowser (FileMetadata.FileType == Brw_IS_FOLDER ? FileMetadata.PathInTreeUntilFilFolLnk :
- NULL,
- FileMetadata.FileType == Brw_IS_FOLDER ? FileMetadata.FilFolLnkName :
- NULL,
- FileMetadata.FileType,
- FileMetadata.FileType == Brw_IS_FOLDER ? -1L :
- FileMetadata.FilCod);
+ if (FileMetadata.FileType == Brw_IS_FOLDER)
+ Brw_PutImplicitParamsFileBrowser ();
+ else
+ Brw_PutParamsFileBrowser (NULL, // Not used
+ NULL, // Not used
+ Brw_IS_UNKNOWN, // Not used
+ FileMetadata.FilCod);
/* File or folder icon */
Frm_LinkFormSubmit (FileNameToShow,"DAT_N",NULL);
diff --git a/swad_file_browser.h b/swad_file_browser.h
index 8c904ddb..b3e0b363 100644
--- a/swad_file_browser.h
+++ b/swad_file_browser.h
@@ -242,13 +242,12 @@ void Brw_RemoveExpiredExpandedFolders (void);
void Brw_CalcSizeOfDir (char *Path);
-void Brw_SetFullPathInTree (const char *PathInTreeUntilFileOrFolder,const char *FilFolLnkName);
+void Brw_SetFullPathInTree (void);
void Brw_CreateTmpPublicLinkToPrivateFile (const char *FullPathIncludingFile,
const char *FileName);
-void Brw_PutParamsFileBrowser (const char *PathInTree,const char *FileFolderName,
- Brw_FileType_t FileType,long FilCod);
+void Brw_PutImplicitParamsFileBrowser (void);
void Brw_RemoveZonesOfGroupsOfType (long GrpTypCod);
void Brw_RemoveGrpZones (long CrsCod,long GrpCod);
diff --git a/swad_global.c b/swad_global.c
index 3cad3a3b..20213b5d 100644
--- a/swad_global.c
+++ b/swad_global.c
@@ -382,7 +382,7 @@ void Gbl_InitializeGlobals (void)
/* File browser */
Gbl.FileBrowser.Id = 0;
Gbl.FileBrowser.Type = Brw_UNKNOWN;
- Gbl.FileBrowser.FileType = Brw_IS_UNKNOWN;
+ Gbl.FileBrowser.FilFolLnk.Type = Brw_IS_UNKNOWN;
Gbl.FileBrowser.UploadingWithDropzone = false;
/* Agenda */
diff --git a/swad_global.h b/swad_global.h
index 95b060fe..bf525fb4 100644
--- a/swad_global.h
+++ b/swad_global.h
@@ -507,12 +507,15 @@ struct Globals
{
char PathAboveRootFolder[PATH_MAX + 1];
char PathRootFolder[PATH_MAX + 1];
- char PathInTreeUntilFilFolLnk[PATH_MAX + 1];
- char FullPathInTree[PATH_MAX + 1];
} Priv;
char NewFilFolLnkName[NAME_MAX + 1];
- char FilFolLnkName[NAME_MAX + 1];
- Brw_FileType_t FileType;
+ struct
+ {
+ char Full[PATH_MAX + 1]; // Full path in tree, including filename
+ char Path[PATH_MAX + 1]; // Path in tree above filename
+ char Name[NAME_MAX + 1]; // Filename
+ Brw_FileType_t Type;
+ } FilFolLnk;
unsigned Level;
bool ICanEditFileOrFolder; // Can I modify (remove, rename, create inside, etc.) a file or folder?
Brw_IconViewEdit_t IconViewEdit;
diff --git a/swad_mark.c b/swad_mark.c
index 5f71863e..e5765f44 100644
--- a/swad_mark.c
+++ b/swad_mark.c
@@ -105,16 +105,14 @@ void Mrk_AddMarksToDB (long FilCod,struct MarksProperties *Marks)
/********* Write number of header and footer rows of a file of marks *********/
/*****************************************************************************/
-void Mrk_GetAndWriteNumRowsHeaderAndFooter (Brw_FileType_t FileType,
- const char *PathInTree,
- const char *FileName)
+void Mrk_GetAndWriteNumRowsHeaderAndFooter (void)
{
extern const char *The_ClassFormInBoxNoWrap[The_NUM_THEMES];
extern const char *Txt_TABLE_Header;
extern const char *Txt_TABLE_Footer;
struct MarksProperties Marks;
- if (FileType == Brw_IS_FOLDER)
+ if (Gbl.FileBrowser.FilFolLnk.Type == Brw_IS_FOLDER)
fprintf (Gbl.F.Out,"