mirror of
https://github.com/acanas/swad-core.git
synced 2024-06-15 21:24:07 +02:00
Version 15.93.3
This commit is contained in:
parent
9f474e85e9
commit
6925503ad3
|
@ -118,13 +118,14 @@
|
||||||
/****************************** Public constants *****************************/
|
/****************************** Public constants *****************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
#define Log_PLATFORM_VERSION "SWAD 15.93.2 (2016-01-03)"
|
#define Log_PLATFORM_VERSION "SWAD 15.93.3 (2016-01-03)"
|
||||||
#define CSS_FILE "swad15.88.1.css"
|
#define CSS_FILE "swad15.88.1.css"
|
||||||
#define JS_FILE "swad15.77.7.js"
|
#define JS_FILE "swad15.77.7.js"
|
||||||
|
|
||||||
// Number of lines (includes comments but not blank lines) has been got with the following command:
|
// 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
|
// nl swad*.c swad*.h css/swad*.css py/swad*.py js/swad*.js soap/swad*.h sql/swad*.sql | tail -1
|
||||||
/*
|
/*
|
||||||
|
Version 15.93.3: Jan 03, 2016 Code refactoring in file browser related with file metadata. (190345 lines)
|
||||||
Version 15.93.2: Jan 03, 2016 To show a file in social timeline, file code is passed as parameter instead of path. (190360 lines)
|
Version 15.93.2: Jan 03, 2016 To show a file in social timeline, file code is passed as parameter instead of path. (190360 lines)
|
||||||
Version 15.93.1: Jan 03, 2016 Show text indicating document not available in social note. (190358 lines)
|
Version 15.93.1: Jan 03, 2016 Show text indicating document not available in social note. (190358 lines)
|
||||||
Version 15.93: Jan 03, 2016 Fixing bugs in file metadata of files in institution, centre and degree zones. (190335 lines)
|
Version 15.93: Jan 03, 2016 Fixing bugs in file metadata of files in institution, centre and degree zones. (190335 lines)
|
||||||
|
|
|
@ -1378,8 +1378,9 @@ static bool Brw_CheckIfAnyUpperLevelIsHidden (unsigned CurrentLevel);
|
||||||
static void Brw_PutIconFolder (unsigned Level,Brw_ExpandTree_t ExpandTree,
|
static void Brw_PutIconFolder (unsigned Level,Brw_ExpandTree_t ExpandTree,
|
||||||
const char *PathInTree,const char *FileName,const char *FileNameToShow);
|
const char *PathInTree,const char *FileName,const char *FileNameToShow);
|
||||||
static void Brw_PutIconNewFileOrFolder (void);
|
static void Brw_PutIconNewFileOrFolder (void);
|
||||||
static void Brw_PutIconFileWithLinkToViewMetadata (unsigned Size,Brw_FileType_t FileType,
|
static void Brw_PutIconFileWithLinkToViewMetadata (unsigned Size,
|
||||||
const char *PathInTree,const char *FileName,const char *FileNameToShow);
|
struct FileMetadata *FileMetadata,
|
||||||
|
const char *FileNameToShow);
|
||||||
static void Brw_PutIconFile (unsigned Size,Brw_FileType_t FileType,const char *FileName);
|
static void Brw_PutIconFile (unsigned Size,Brw_FileType_t FileType,const char *FileName);
|
||||||
static void Brw_WriteFileName (unsigned Level,bool IsPublic,Brw_FileType_t FileType,
|
static void Brw_WriteFileName (unsigned Level,bool IsPublic,Brw_FileType_t FileType,
|
||||||
const char *PathInTree,const char *FileName,const char *FileNameToShow);
|
const char *PathInTree,const char *FileName,const char *FileNameToShow);
|
||||||
|
@ -1430,7 +1431,8 @@ static bool Brw_RcvFileInFileBrw (Brw_UploadType_t UploadType);
|
||||||
static bool Brw_CheckIfUploadIsAllowed (const char *FileType);
|
static bool Brw_CheckIfUploadIsAllowed (const char *FileType);
|
||||||
|
|
||||||
static bool Brw_CheckIfICanEditFileMetadata (long PublisherUsrCod);
|
static bool Brw_CheckIfICanEditFileMetadata (long PublisherUsrCod);
|
||||||
static void Brw_WriteBigLinkToDownloadFile (const char *URL,Brw_FileType_t FileType,
|
static void Brw_WriteBigLinkToDownloadFile (const char *URL,
|
||||||
|
struct FileMetadata *FileMetadata,
|
||||||
const char *FileNameToShow);
|
const char *FileNameToShow);
|
||||||
static void Brw_WriteSmallLinkToDownloadFile (const char *URL,Brw_FileType_t FileType,
|
static void Brw_WriteSmallLinkToDownloadFile (const char *URL,Brw_FileType_t FileType,
|
||||||
const char *FileNameToShow);
|
const char *FileNameToShow);
|
||||||
|
@ -2027,7 +2029,7 @@ void Brw_GetParAndInitFileBrowser (void)
|
||||||
|
|
||||||
/***** Get the path in the file browser and the name of the file or folder *****/
|
/***** Get the path in the file browser and the name of the file or folder *****/
|
||||||
Brw_GetParamsPathInTreeAndFileName ();
|
Brw_GetParamsPathInTreeAndFileName ();
|
||||||
Brw_SetFullPathInTree (Gbl.FileBrowser.Priv.PathInTreeExceptFileOrFolder,
|
Brw_SetFullPathInTree (Gbl.FileBrowser.Priv.PathInTreeUntilFilFolLnk,
|
||||||
Gbl.FileBrowser.FilFolLnkName);
|
Gbl.FileBrowser.FilFolLnkName);
|
||||||
|
|
||||||
switch (Gbl.FileBrowser.Type)
|
switch (Gbl.FileBrowser.Type)
|
||||||
|
@ -2272,8 +2274,8 @@ static void Brw_GetParamsPathInTreeAndFileName (void)
|
||||||
Brw_FileType_t FileType;
|
Brw_FileType_t FileType;
|
||||||
|
|
||||||
/***** Get the path inside the tree (this path does not include the name of the file or folder at the end) *****/
|
/***** 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.PathInTreeExceptFileOrFolder,PATH_MAX);
|
Par_GetParToText ("Path",Gbl.FileBrowser.Priv.PathInTreeUntilFilFolLnk,PATH_MAX);
|
||||||
if (strstr (Gbl.FileBrowser.Priv.PathInTreeExceptFileOrFolder,"..")) // ".." is not allowed in the path
|
if (strstr (Gbl.FileBrowser.Priv.PathInTreeUntilFilFolLnk,"..")) // ".." is not allowed in the path
|
||||||
Lay_ShowErrorAndExit ("Wrong path.");
|
Lay_ShowErrorAndExit ("Wrong path.");
|
||||||
|
|
||||||
/***** Get the name of the file, folder or link *****/
|
/***** Get the name of the file, folder or link *****/
|
||||||
|
@ -2300,7 +2302,7 @@ static void Brw_GetParamsPathInTreeAndFileName (void)
|
||||||
{
|
{
|
||||||
// Level == number-of-slashes-in-path-except-file-or-folder + 1
|
// Level == number-of-slashes-in-path-except-file-or-folder + 1
|
||||||
Gbl.FileBrowser.Level = 1;
|
Gbl.FileBrowser.Level = 1;
|
||||||
for (Ptr = Gbl.FileBrowser.Priv.PathInTreeExceptFileOrFolder;
|
for (Ptr = Gbl.FileBrowser.Priv.PathInTreeUntilFilFolLnk;
|
||||||
*Ptr;
|
*Ptr;
|
||||||
Ptr++)
|
Ptr++)
|
||||||
if (*Ptr == '/')
|
if (*Ptr == '/')
|
||||||
|
@ -2321,7 +2323,7 @@ static void Brw_GetParamsPathInTreeAndFileName (void)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// We are in this case: assignments/assignment-folder/rest-of-path
|
// We are in this case: assignments/assignment-folder/rest-of-path
|
||||||
for (Ptr = Gbl.FileBrowser.Priv.PathInTreeExceptFileOrFolder;
|
for (Ptr = Gbl.FileBrowser.Priv.PathInTreeUntilFilFolLnk;
|
||||||
*Ptr && *Ptr != '/';
|
*Ptr && *Ptr != '/';
|
||||||
Ptr++); // Go to first '/'
|
Ptr++); // Go to first '/'
|
||||||
if (*Ptr == '/')
|
if (*Ptr == '/')
|
||||||
|
@ -4942,7 +4944,7 @@ static bool Brw_WriteRowFileBrowser (unsigned Level,
|
||||||
{
|
{
|
||||||
/* Icon with file type or link */
|
/* Icon with file type or link */
|
||||||
fprintf (Gbl.F.Out,"<td class=\"BM%u\">",Gbl.RowEvenOdd);
|
fprintf (Gbl.F.Out,"<td class=\"BM%u\">",Gbl.RowEvenOdd);
|
||||||
Brw_PutIconFileWithLinkToViewMetadata (16,FileType,PathInTree,FileName,FileNameToShow);
|
Brw_PutIconFileWithLinkToViewMetadata (16,&FileMetadata,FileNameToShow);
|
||||||
fprintf (Gbl.F.Out,"</td>");
|
fprintf (Gbl.F.Out,"</td>");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5564,8 +5566,9 @@ static void Brw_PutIconNewFileOrFolder (void)
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
// FileType can be Brw_IS_FILE or Brw_IS_LINK
|
// FileType can be Brw_IS_FILE or Brw_IS_LINK
|
||||||
|
|
||||||
static void Brw_PutIconFileWithLinkToViewMetadata (unsigned Size,Brw_FileType_t FileType,
|
static void Brw_PutIconFileWithLinkToViewMetadata (unsigned Size,
|
||||||
const char *PathInTree,const char *FileName,const char *FileNameToShow)
|
struct FileMetadata *FileMetadata,
|
||||||
|
const char *FileNameToShow)
|
||||||
{
|
{
|
||||||
extern const char *Txt_View_data_of_FILE_OR_LINK_X;
|
extern const char *Txt_View_data_of_FILE_OR_LINK_X;
|
||||||
|
|
||||||
|
@ -5587,7 +5590,7 @@ static void Brw_PutIconFileWithLinkToViewMetadata (unsigned Size,Brw_FileType_t
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
Brw_ParamListFiles (FileType,PathInTree,FileName);
|
Brw_PutHiddenParamFilCod (FileMetadata->FilCod);
|
||||||
|
|
||||||
/***** Name and link of the file or folder *****/
|
/***** Name and link of the file or folder *****/
|
||||||
sprintf (Gbl.Title,Txt_View_data_of_FILE_OR_LINK_X,
|
sprintf (Gbl.Title,Txt_View_data_of_FILE_OR_LINK_X,
|
||||||
|
@ -5597,7 +5600,7 @@ static void Brw_PutIconFileWithLinkToViewMetadata (unsigned Size,Brw_FileType_t
|
||||||
Act_LinkFormSubmit (Gbl.Title,Gbl.FileBrowser.TxtStyle);
|
Act_LinkFormSubmit (Gbl.Title,Gbl.FileBrowser.TxtStyle);
|
||||||
|
|
||||||
/***** Icon depending on the file extension *****/
|
/***** Icon depending on the file extension *****/
|
||||||
Brw_PutIconFile (Size,FileType,FileName);
|
Brw_PutIconFile (Size,FileMetadata->FileType,FileMetadata->FilFolLnkName);
|
||||||
|
|
||||||
/* End of the link and of the form */
|
/* End of the link and of the form */
|
||||||
fprintf (Gbl.F.Out,"</a>");
|
fprintf (Gbl.F.Out,"</a>");
|
||||||
|
@ -6009,7 +6012,7 @@ void Brw_AskRemFileFromTree (void)
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
Brw_ParamListFiles (Gbl.FileBrowser.FileType,Gbl.FileBrowser.Priv.PathInTreeExceptFileOrFolder,Gbl.FileBrowser.FilFolLnkName);
|
Brw_ParamListFiles (Gbl.FileBrowser.FileType,Gbl.FileBrowser.Priv.PathInTreeUntilFilFolLnk,Gbl.FileBrowser.FilFolLnkName);
|
||||||
|
|
||||||
/* Show question */
|
/* Show question */
|
||||||
Brw_GetFileNameToShow (Gbl.FileBrowser.FileType,Gbl.FileBrowser.Level,Gbl.FileBrowser.FileType,
|
Brw_GetFileNameToShow (Gbl.FileBrowser.FileType,Gbl.FileBrowser.Level,Gbl.FileBrowser.FileType,
|
||||||
|
@ -6161,7 +6164,7 @@ static void Brw_AskConfirmRemoveFolderNotEmpty (void)
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
Brw_ParamListFiles (Brw_IS_FOLDER,Gbl.FileBrowser.Priv.PathInTreeExceptFileOrFolder,Gbl.FileBrowser.FilFolLnkName);
|
Brw_ParamListFiles (Brw_IS_FOLDER,Gbl.FileBrowser.Priv.PathInTreeUntilFilFolLnk,Gbl.FileBrowser.FilFolLnkName);
|
||||||
sprintf (Gbl.Message,Txt_Do_you_really_want_to_remove_the_folder_X,
|
sprintf (Gbl.Message,Txt_Do_you_really_want_to_remove_the_folder_X,
|
||||||
Gbl.FileBrowser.FilFolLnkName);
|
Gbl.FileBrowser.FilFolLnkName);
|
||||||
Lay_ShowAlert (Lay_WARNING,Gbl.Message);
|
Lay_ShowAlert (Lay_WARNING,Gbl.Message);
|
||||||
|
@ -7787,7 +7790,7 @@ static void Brw_PutFormToCreateAFolder (const char *FileNameToShow)
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
Brw_ParamListFiles (Brw_IS_FOLDER,Gbl.FileBrowser.Priv.PathInTreeExceptFileOrFolder,Gbl.FileBrowser.FilFolLnkName);
|
Brw_ParamListFiles (Brw_IS_FOLDER,Gbl.FileBrowser.Priv.PathInTreeUntilFilFolLnk,Gbl.FileBrowser.FilFolLnkName);
|
||||||
|
|
||||||
/***** Start frame *****/
|
/***** Start frame *****/
|
||||||
Lay_StartRoundFrame (NULL,Txt_Create_folder);
|
Lay_StartRoundFrame (NULL,Txt_Create_folder);
|
||||||
|
@ -7861,7 +7864,7 @@ static void Brw_PutFormToUploadFilesUsingDropzone (const char *FileNameToShow)
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
Brw_ParamListFiles (Brw_IS_FOLDER,Gbl.FileBrowser.Priv.PathInTreeExceptFileOrFolder,Gbl.FileBrowser.FilFolLnkName);
|
Brw_ParamListFiles (Brw_IS_FOLDER,Gbl.FileBrowser.Priv.PathInTreeUntilFilFolLnk,Gbl.FileBrowser.FilFolLnkName);
|
||||||
|
|
||||||
fprintf (Gbl.F.Out,"<div class=\"dz-message\">"
|
fprintf (Gbl.F.Out,"<div class=\"dz-message\">"
|
||||||
"<span class=\"DAT_LIGHT\">%s</span>"
|
"<span class=\"DAT_LIGHT\">%s</span>"
|
||||||
|
@ -7935,7 +7938,7 @@ static void Brw_PutFormToUploadOneFileClassic (const char *FileNameToShow)
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
Brw_ParamListFiles (Brw_IS_FOLDER,Gbl.FileBrowser.Priv.PathInTreeExceptFileOrFolder,Gbl.FileBrowser.FilFolLnkName);
|
Brw_ParamListFiles (Brw_IS_FOLDER,Gbl.FileBrowser.Priv.PathInTreeUntilFilFolLnk,Gbl.FileBrowser.FilFolLnkName);
|
||||||
fprintf (Gbl.F.Out,"<input type=\"file\" name=\"%s\""
|
fprintf (Gbl.F.Out,"<input type=\"file\" name=\"%s\""
|
||||||
" size=\"50\" maxlength=\"100\" value=\"\" />",
|
" size=\"50\" maxlength=\"100\" value=\"\" />",
|
||||||
Fil_NAME_OF_PARAM_FILENAME_ORG);
|
Fil_NAME_OF_PARAM_FILENAME_ORG);
|
||||||
|
@ -7975,7 +7978,7 @@ static void Brw_PutFormToPasteAFileOrFolder (const char *FileNameToShow)
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
Brw_ParamListFiles (Brw_IS_FOLDER,Gbl.FileBrowser.Priv.PathInTreeExceptFileOrFolder,Gbl.FileBrowser.FilFolLnkName);
|
Brw_ParamListFiles (Brw_IS_FOLDER,Gbl.FileBrowser.Priv.PathInTreeUntilFilFolLnk,Gbl.FileBrowser.FilFolLnkName);
|
||||||
|
|
||||||
/***** Start frame *****/
|
/***** Start frame *****/
|
||||||
Lay_StartRoundFrame (NULL,Txt_Paste);
|
Lay_StartRoundFrame (NULL,Txt_Paste);
|
||||||
|
@ -8022,7 +8025,7 @@ static void Brw_PutFormToCreateALink (const char *FileNameToShow)
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
Brw_ParamListFiles (Brw_IS_FOLDER,Gbl.FileBrowser.Priv.PathInTreeExceptFileOrFolder,Gbl.FileBrowser.FilFolLnkName);
|
Brw_ParamListFiles (Brw_IS_FOLDER,Gbl.FileBrowser.Priv.PathInTreeUntilFilFolLnk,Gbl.FileBrowser.FilFolLnkName);
|
||||||
|
|
||||||
/***** Start frame *****/
|
/***** Start frame *****/
|
||||||
Lay_StartRoundFrame (NULL,Txt_Create_link);
|
Lay_StartRoundFrame (NULL,Txt_Create_link);
|
||||||
|
@ -8183,15 +8186,15 @@ void Brw_RenFolderFileBrowser (void)
|
||||||
if (strcmp (Gbl.FileBrowser.FilFolLnkName,Gbl.FileBrowser.NewFilFolLnkName)) // The name has changed
|
if (strcmp (Gbl.FileBrowser.FilFolLnkName,Gbl.FileBrowser.NewFilFolLnkName)) // The name has changed
|
||||||
{
|
{
|
||||||
/* Gbl.FileBrowser.FilFolLnkName holds the new name of the folder */
|
/* Gbl.FileBrowser.FilFolLnkName holds the new name of the folder */
|
||||||
sprintf (OldPathInTree,"%s/%s",Gbl.FileBrowser.Priv.PathInTreeExceptFileOrFolder,Gbl.FileBrowser.FilFolLnkName);
|
sprintf (OldPathInTree,"%s/%s",Gbl.FileBrowser.Priv.PathInTreeUntilFilFolLnk,Gbl.FileBrowser.FilFolLnkName);
|
||||||
sprintf (OldPath,"%s/%s",Gbl.FileBrowser.Priv.PathAboveRootFolder,OldPathInTree);
|
sprintf (OldPath,"%s/%s",Gbl.FileBrowser.Priv.PathAboveRootFolder,OldPathInTree);
|
||||||
|
|
||||||
/* Gbl.FileBrowser.NewFilFolLnkName holds the new name of the folder */
|
/* Gbl.FileBrowser.NewFilFolLnkName holds the new name of the folder */
|
||||||
if (strlen (Gbl.FileBrowser.Priv.PathAboveRootFolder)+1+
|
if (strlen (Gbl.FileBrowser.Priv.PathAboveRootFolder)+1+
|
||||||
strlen (Gbl.FileBrowser.Priv.PathInTreeExceptFileOrFolder)+1+
|
strlen (Gbl.FileBrowser.Priv.PathInTreeUntilFilFolLnk)+1+
|
||||||
strlen (Gbl.FileBrowser.NewFilFolLnkName) > PATH_MAX)
|
strlen (Gbl.FileBrowser.NewFilFolLnkName) > PATH_MAX)
|
||||||
Lay_ShowErrorAndExit ("Path is too long.");
|
Lay_ShowErrorAndExit ("Path is too long.");
|
||||||
sprintf (NewPathInTree,"%s/%s",Gbl.FileBrowser.Priv.PathInTreeExceptFileOrFolder,Gbl.FileBrowser.NewFilFolLnkName);
|
sprintf (NewPathInTree,"%s/%s",Gbl.FileBrowser.Priv.PathInTreeUntilFilFolLnk,Gbl.FileBrowser.NewFilFolLnkName);
|
||||||
sprintf (NewPath,"%s/%s",Gbl.FileBrowser.Priv.PathAboveRootFolder,NewPathInTree);
|
sprintf (NewPath,"%s/%s",Gbl.FileBrowser.Priv.PathAboveRootFolder,NewPathInTree);
|
||||||
|
|
||||||
/* We should check here that a folder with the same name does not exist.
|
/* We should check here that a folder with the same name does not exist.
|
||||||
|
@ -8840,8 +8843,8 @@ bool Brw_CheckIfFileOrFolderIsHidden (struct FileMetadata *FileMetadata)
|
||||||
FileMetadata->FileBrowser,
|
FileMetadata->FileBrowser,
|
||||||
FileMetadata->Cod,
|
FileMetadata->Cod,
|
||||||
FileMetadata->ZoneUsrCod,
|
FileMetadata->ZoneUsrCod,
|
||||||
FileMetadata->Path,
|
FileMetadata->FullPathInTree,
|
||||||
FileMetadata->Path);
|
FileMetadata->FullPathInTree);
|
||||||
|
|
||||||
return (DB_QueryCOUNT (Query,"can not check if a file or folder is hidden") != 0);
|
return (DB_QueryCOUNT (Query,"can not check if a file or folder is hidden") != 0);
|
||||||
}
|
}
|
||||||
|
@ -8889,13 +8892,8 @@ void Brw_ShowFileMetadata (void)
|
||||||
Brw_GetParAndInitFileBrowser ();
|
Brw_GetParAndInitFileBrowser ();
|
||||||
|
|
||||||
/***** Get file metadata *****/
|
/***** Get file metadata *****/
|
||||||
// Brw_GetFileMetadataByPath (&FileMetadata);
|
|
||||||
FileMetadata.FilCod = Brw_GetParamFilCod ();
|
FileMetadata.FilCod = Brw_GetParamFilCod ();
|
||||||
Brw_GetFileMetadataByCod (&FileMetadata);
|
Brw_GetFileMetadataByCod (&FileMetadata);
|
||||||
strcpy (Gbl.FileBrowser.Priv.FullPathInTree,FileMetadata.Path);
|
|
||||||
Str_SplitFullPathIntoPathAndFileName (Gbl.FileBrowser.Priv.FullPathInTree,
|
|
||||||
Gbl.FileBrowser.Priv.PathInTreeExceptFileOrFolder,
|
|
||||||
Gbl.FileBrowser.FilFolLnkName);
|
|
||||||
Found = Brw_GetFileTypeSizeAndDate (&FileMetadata);
|
Found = Brw_GetFileTypeSizeAndDate (&FileMetadata);
|
||||||
|
|
||||||
if (Found)
|
if (Found)
|
||||||
|
@ -8903,7 +8901,8 @@ void Brw_ShowFileMetadata (void)
|
||||||
if (FileMetadata.FilCod <= 0) // No entry for this file in database table of files
|
if (FileMetadata.FilCod <= 0) // No entry for this file in database table of files
|
||||||
/* Add entry to the table of files/folders */
|
/* Add entry to the table of files/folders */
|
||||||
FileMetadata.FilCod = Brw_AddPathToDB (-1L,FileMetadata.FileType,
|
FileMetadata.FilCod = Brw_AddPathToDB (-1L,FileMetadata.FileType,
|
||||||
Gbl.FileBrowser.Priv.FullPathInTree,false,Brw_LICENSE_DEFAULT);
|
FileMetadata.FullPathInTree,
|
||||||
|
false,Brw_LICENSE_DEFAULT);
|
||||||
|
|
||||||
/***** Check if I can view this file.
|
/***** Check if I can view this file.
|
||||||
It could be marked as hidden or in a hidden folder *****/
|
It could be marked as hidden or in a hidden folder *****/
|
||||||
|
@ -8957,8 +8956,8 @@ void Brw_ShowFileMetadata (void)
|
||||||
Gbl.FileBrowser.Type == Brw_SHOW_MARKS_GRP)
|
Gbl.FileBrowser.Type == Brw_SHOW_MARKS_GRP)
|
||||||
URL[0] = '\0';
|
URL[0] = '\0';
|
||||||
else
|
else
|
||||||
Brw_GetLinkToDownloadFile (Gbl.FileBrowser.Priv.PathInTreeExceptFileOrFolder,
|
Brw_GetLinkToDownloadFile (FileMetadata.PathInTreeUntilFilFolLnk,
|
||||||
Gbl.FileBrowser.FilFolLnkName,
|
FileMetadata.FilFolLnkName,
|
||||||
URL);
|
URL);
|
||||||
|
|
||||||
/***** Can I edit the properties of the file? *****/
|
/***** Can I edit the properties of the file? *****/
|
||||||
|
@ -8966,7 +8965,8 @@ void Brw_ShowFileMetadata (void)
|
||||||
|
|
||||||
/***** Name of the file/link to be shown *****/
|
/***** Name of the file/link to be shown *****/
|
||||||
Brw_LimitLengthFileNameToShow (FileMetadata.FileType,
|
Brw_LimitLengthFileNameToShow (FileMetadata.FileType,
|
||||||
Gbl.FileBrowser.FilFolLnkName,FileNameToShow);
|
FileMetadata.FilFolLnkName,
|
||||||
|
FileNameToShow);
|
||||||
|
|
||||||
/***** Start form to update the metadata of a file *****/
|
/***** Start form to update the metadata of a file *****/
|
||||||
if (ICanEdit) // I can edit file properties
|
if (ICanEdit) // I can edit file properties
|
||||||
|
@ -9014,8 +9014,8 @@ void Brw_ShowFileMetadata (void)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
Brw_ParamListFiles (FileMetadata.FileType,
|
Brw_ParamListFiles (FileMetadata.FileType,
|
||||||
Gbl.FileBrowser.Priv.PathInTreeExceptFileOrFolder,
|
FileMetadata.PathInTreeUntilFilFolLnk,
|
||||||
Gbl.FileBrowser.FilFolLnkName);
|
FileMetadata.FilFolLnkName);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***** Start frame *****/
|
/***** Start frame *****/
|
||||||
|
@ -9025,8 +9025,7 @@ void Brw_ShowFileMetadata (void)
|
||||||
fprintf (Gbl.F.Out,"<tr>"
|
fprintf (Gbl.F.Out,"<tr>"
|
||||||
"<td colspan=\"2\""
|
"<td colspan=\"2\""
|
||||||
" class=\"FILENAME CENTER_MIDDLE\">");
|
" class=\"FILENAME CENTER_MIDDLE\">");
|
||||||
Brw_WriteBigLinkToDownloadFile (URL,FileMetadata.FileType,
|
Brw_WriteBigLinkToDownloadFile (URL,&FileMetadata,FileNameToShow);
|
||||||
FileNameToShow);
|
|
||||||
fprintf (Gbl.F.Out,"</td>"
|
fprintf (Gbl.F.Out,"</td>"
|
||||||
"</tr>");
|
"</tr>");
|
||||||
|
|
||||||
|
@ -9234,7 +9233,7 @@ void Brw_ShowFileMetadata (void)
|
||||||
}
|
}
|
||||||
|
|
||||||
/***** Add paths until file to table of expanded folders *****/
|
/***** Add paths until file to table of expanded folders *****/
|
||||||
Brw_InsFoldersInPathAndUpdOtherFoldersInExpandedFolders (Gbl.FileBrowser.Priv.PathInTreeExceptFileOrFolder);
|
Brw_InsFoldersInPathAndUpdOtherFoldersInExpandedFolders (Gbl.FileBrowser.Priv.PathInTreeUntilFilFolLnk);
|
||||||
}
|
}
|
||||||
else // !ICanView
|
else // !ICanView
|
||||||
{
|
{
|
||||||
|
@ -9295,7 +9294,8 @@ void Brw_DownloadFile (void)
|
||||||
if (FileMetadata.FilCod <= 0) // No entry for this file in database table of files
|
if (FileMetadata.FilCod <= 0) // No entry for this file in database table of files
|
||||||
/* Add entry to the table of files/folders */
|
/* Add entry to the table of files/folders */
|
||||||
FileMetadata.FilCod = Brw_AddPathToDB (-1L,FileMetadata.FileType,
|
FileMetadata.FilCod = Brw_AddPathToDB (-1L,FileMetadata.FileType,
|
||||||
Gbl.FileBrowser.Priv.FullPathInTree,false,Brw_LICENSE_DEFAULT);
|
Gbl.FileBrowser.Priv.FullPathInTree,
|
||||||
|
false,Brw_LICENSE_DEFAULT);
|
||||||
|
|
||||||
/***** Check if I can view this file.
|
/***** Check if I can view this file.
|
||||||
It could be marked as hidden or in a hidden folder *****/
|
It could be marked as hidden or in a hidden folder *****/
|
||||||
|
@ -9337,7 +9337,7 @@ void Brw_DownloadFile (void)
|
||||||
Gbl.FileBrowser.Type == Brw_SHOW_MARKS_GRP)
|
Gbl.FileBrowser.Type == Brw_SHOW_MARKS_GRP)
|
||||||
URL[0] = '\0';
|
URL[0] = '\0';
|
||||||
else
|
else
|
||||||
Brw_GetLinkToDownloadFile (Gbl.FileBrowser.Priv.PathInTreeExceptFileOrFolder,
|
Brw_GetLinkToDownloadFile (Gbl.FileBrowser.Priv.PathInTreeUntilFilFolLnk,
|
||||||
Gbl.FileBrowser.FilFolLnkName,
|
Gbl.FileBrowser.FilFolLnkName,
|
||||||
URL);
|
URL);
|
||||||
|
|
||||||
|
@ -9372,7 +9372,7 @@ void Brw_DownloadFile (void)
|
||||||
}
|
}
|
||||||
|
|
||||||
/***** Add paths until file to table of expanded folders *****/
|
/***** Add paths until file to table of expanded folders *****/
|
||||||
Brw_InsFoldersInPathAndUpdOtherFoldersInExpandedFolders (Gbl.FileBrowser.Priv.PathInTreeExceptFileOrFolder);
|
Brw_InsFoldersInPathAndUpdOtherFoldersInExpandedFolders (Gbl.FileBrowser.Priv.PathInTreeUntilFilFolLnk);
|
||||||
|
|
||||||
/***** Download the file *****/
|
/***** Download the file *****/
|
||||||
fprintf (stdout,"Location: %s\n\n",URL);
|
fprintf (stdout,"Location: %s\n\n",URL);
|
||||||
|
@ -9479,7 +9479,8 @@ static bool Brw_CheckIfICanEditFileMetadata (long PublisherUsrCod)
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
// FileType can be Brw_IS_FILE or Brw_IS_LINK
|
// FileType can be Brw_IS_FILE or Brw_IS_LINK
|
||||||
|
|
||||||
static void Brw_WriteBigLinkToDownloadFile (const char *URL,Brw_FileType_t FileType,
|
static void Brw_WriteBigLinkToDownloadFile (const char *URL,
|
||||||
|
struct FileMetadata *FileMetadata,
|
||||||
const char *FileNameToShow)
|
const char *FileNameToShow)
|
||||||
{
|
{
|
||||||
extern const char *Txt_Check_marks_in_file_X;
|
extern const char *Txt_Check_marks_in_file_X;
|
||||||
|
@ -9502,14 +9503,14 @@ static void Brw_WriteBigLinkToDownloadFile (const char *URL,Brw_FileType_t FileT
|
||||||
default: // Not aplicable here
|
default: // Not aplicable here
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
Brw_ParamListFiles (FileType,
|
Brw_ParamListFiles (FileMetadata->FileType,
|
||||||
Gbl.FileBrowser.Priv.PathInTreeExceptFileOrFolder,
|
FileMetadata->PathInTreeUntilFilFolLnk,
|
||||||
Gbl.FileBrowser.FilFolLnkName);
|
FileMetadata->FilFolLnkName);
|
||||||
|
|
||||||
/* Link begin */
|
/* Link begin */
|
||||||
sprintf (Gbl.Title,Txt_Check_marks_in_file_X,FileNameToShow);
|
sprintf (Gbl.Title,Txt_Check_marks_in_file_X,FileNameToShow);
|
||||||
Act_LinkFormSubmit (Gbl.Title,"FILENAME");
|
Act_LinkFormSubmit (Gbl.Title,"FILENAME");
|
||||||
Brw_PutIconFile (32,FileType,Gbl.FileBrowser.FilFolLnkName);
|
Brw_PutIconFile (32,FileMetadata->FileType,FileMetadata->FilFolLnkName);
|
||||||
|
|
||||||
/* Name of the file of marks, link end and form end */
|
/* Name of the file of marks, link end and form end */
|
||||||
fprintf (Gbl.F.Out," %s "
|
fprintf (Gbl.F.Out," %s "
|
||||||
|
@ -9527,9 +9528,9 @@ static void Brw_WriteBigLinkToDownloadFile (const char *URL,Brw_FileType_t FileT
|
||||||
fprintf (Gbl.F.Out,"<a href=\"%s\" class=\"FILENAME\""
|
fprintf (Gbl.F.Out,"<a href=\"%s\" class=\"FILENAME\""
|
||||||
" title=\"%s\" target=\"_blank\">",
|
" title=\"%s\" target=\"_blank\">",
|
||||||
URL,
|
URL,
|
||||||
(FileType == Brw_IS_LINK) ? URL : // If it's a link, show full URL in title
|
(FileMetadata->FileType == Brw_IS_LINK) ? URL : // If it's a link, show full URL in title
|
||||||
FileNameToShow);
|
FileNameToShow);
|
||||||
Brw_PutIconFile (32,FileType,Gbl.FileBrowser.FilFolLnkName);
|
Brw_PutIconFile (32,FileMetadata->FileType,FileMetadata->FilFolLnkName);
|
||||||
fprintf (Gbl.F.Out," %s "
|
fprintf (Gbl.F.Out," %s "
|
||||||
"<img src=\"%s/%s/download64x64.gif\""
|
"<img src=\"%s/%s/download64x64.gif\""
|
||||||
" alt=\"%s\" title=\"%s\""
|
" alt=\"%s\" title=\"%s\""
|
||||||
|
@ -9568,7 +9569,7 @@ static void Brw_WriteSmallLinkToDownloadFile (const char *URL,Brw_FileType_t Fil
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
Brw_ParamListFiles (FileType,
|
Brw_ParamListFiles (FileType,
|
||||||
Gbl.FileBrowser.Priv.PathInTreeExceptFileOrFolder,
|
Gbl.FileBrowser.Priv.PathInTreeUntilFilFolLnk,
|
||||||
Gbl.FileBrowser.FilFolLnkName);
|
Gbl.FileBrowser.FilFolLnkName);
|
||||||
|
|
||||||
/* Link begin */
|
/* Link begin */
|
||||||
|
@ -9876,8 +9877,11 @@ void Brw_GetFileMetadataByPath (struct FileMetadata *FileMetadata)
|
||||||
FileMetadata->FileType = (Brw_FileType_t) UnsignedNum;
|
FileMetadata->FileType = (Brw_FileType_t) UnsignedNum;
|
||||||
|
|
||||||
/* Get path (row[6]) */
|
/* Get path (row[6]) */
|
||||||
strncpy (FileMetadata->Path,row[6],PATH_MAX);
|
strncpy (FileMetadata->FullPathInTree,row[6],PATH_MAX);
|
||||||
FileMetadata->Path[PATH_MAX] = '\0';
|
FileMetadata->FullPathInTree[PATH_MAX] = '\0';
|
||||||
|
Str_SplitFullPathIntoPathAndFileName (FileMetadata->FullPathInTree,
|
||||||
|
FileMetadata->PathInTreeUntilFilFolLnk,
|
||||||
|
FileMetadata->FilFolLnkName);
|
||||||
|
|
||||||
/* File is hidden? (row[7]) */
|
/* File is hidden? (row[7]) */
|
||||||
switch (Gbl.FileBrowser.Type)
|
switch (Gbl.FileBrowser.Type)
|
||||||
|
@ -9927,16 +9931,18 @@ void Brw_GetFileMetadataByPath (struct FileMetadata *FileMetadata)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
FileMetadata->FilCod = -1L;
|
FileMetadata->FilCod = -1L;
|
||||||
FileMetadata->FileBrowser = Brw_UNKNOWN;
|
FileMetadata->FileBrowser = Brw_UNKNOWN;
|
||||||
FileMetadata->Cod = -1L;
|
FileMetadata->Cod = -1L;
|
||||||
FileMetadata->ZoneUsrCod = -1L;
|
FileMetadata->ZoneUsrCod = -1L;
|
||||||
FileMetadata->PublisherUsrCod = -1L;
|
FileMetadata->PublisherUsrCod = -1L;
|
||||||
FileMetadata->FileType = Brw_IS_UNKNOWN;
|
FileMetadata->FileType = Brw_IS_UNKNOWN;
|
||||||
FileMetadata->Path[0] = '\0';
|
FileMetadata->FullPathInTree[0] = '\0';
|
||||||
FileMetadata->IsHidden = false;
|
FileMetadata->PathInTreeUntilFilFolLnk[0] = '\0';
|
||||||
FileMetadata->IsPublic = false;
|
FileMetadata->FilFolLnkName[0] = '\0';
|
||||||
FileMetadata->License = Brw_LICENSE_DEFAULT;
|
FileMetadata->IsHidden = false;
|
||||||
|
FileMetadata->IsPublic = false;
|
||||||
|
FileMetadata->License = Brw_LICENSE_DEFAULT;
|
||||||
}
|
}
|
||||||
|
|
||||||
/***** Free structure that stores the query result *****/
|
/***** Free structure that stores the query result *****/
|
||||||
|
@ -10001,8 +10007,11 @@ void Brw_GetFileMetadataByCod (struct FileMetadata *FileMetadata)
|
||||||
FileMetadata->FileType = (Brw_FileType_t) UnsignedNum;
|
FileMetadata->FileType = (Brw_FileType_t) UnsignedNum;
|
||||||
|
|
||||||
/* Get path (row[6]) */
|
/* Get path (row[6]) */
|
||||||
strncpy (FileMetadata->Path,row[6],PATH_MAX);
|
strncpy (FileMetadata->FullPathInTree,row[6],PATH_MAX);
|
||||||
FileMetadata->Path[PATH_MAX] = '\0';
|
FileMetadata->FullPathInTree[PATH_MAX] = '\0';
|
||||||
|
Str_SplitFullPathIntoPathAndFileName (FileMetadata->FullPathInTree,
|
||||||
|
FileMetadata->PathInTreeUntilFilFolLnk,
|
||||||
|
FileMetadata->FilFolLnkName);
|
||||||
|
|
||||||
/* Is a hidden file? (row[7]) */
|
/* Is a hidden file? (row[7]) */
|
||||||
switch (Gbl.FileBrowser.Type)
|
switch (Gbl.FileBrowser.Type)
|
||||||
|
@ -10052,16 +10061,18 @@ void Brw_GetFileMetadataByCod (struct FileMetadata *FileMetadata)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
FileMetadata->FilCod = -1L;
|
FileMetadata->FilCod = -1L;
|
||||||
FileMetadata->FileBrowser = Brw_UNKNOWN;
|
FileMetadata->FileBrowser = Brw_UNKNOWN;
|
||||||
FileMetadata->Cod = -1L;
|
FileMetadata->Cod = -1L;
|
||||||
FileMetadata->ZoneUsrCod = -1L;
|
FileMetadata->ZoneUsrCod = -1L;
|
||||||
FileMetadata->PublisherUsrCod = -1L;
|
FileMetadata->PublisherUsrCod = -1L;
|
||||||
FileMetadata->FileType = Brw_IS_UNKNOWN;
|
FileMetadata->FileType = Brw_IS_UNKNOWN;
|
||||||
FileMetadata->Path[0] = '\0';
|
FileMetadata->FullPathInTree[0] = '\0';
|
||||||
FileMetadata->IsHidden = false;
|
FileMetadata->PathInTreeUntilFilFolLnk[0] = '\0';
|
||||||
FileMetadata->IsPublic = false;
|
FileMetadata->FilFolLnkName[0] = '\0';
|
||||||
FileMetadata->License = Brw_LICENSE_DEFAULT;
|
FileMetadata->IsHidden = false;
|
||||||
|
FileMetadata->IsPublic = false;
|
||||||
|
FileMetadata->License = Brw_LICENSE_DEFAULT;
|
||||||
}
|
}
|
||||||
|
|
||||||
/***** Free structure that stores the query result *****/
|
/***** Free structure that stores the query result *****/
|
||||||
|
@ -10087,7 +10098,7 @@ bool Brw_GetFileTypeSizeAndDate (struct FileMetadata *FileMetadata)
|
||||||
struct stat FileStatus;
|
struct stat FileStatus;
|
||||||
|
|
||||||
sprintf (Path,"%s/%s",Gbl.FileBrowser.Priv.PathAboveRootFolder,
|
sprintf (Path,"%s/%s",Gbl.FileBrowser.Priv.PathAboveRootFolder,
|
||||||
Gbl.FileBrowser.Priv.FullPathInTree);
|
FileMetadata->FullPathInTree);
|
||||||
if (lstat (Path,&FileStatus))
|
if (lstat (Path,&FileStatus))
|
||||||
{
|
{
|
||||||
// Error on lstat
|
// Error on lstat
|
||||||
|
@ -10101,8 +10112,8 @@ bool Brw_GetFileTypeSizeAndDate (struct FileMetadata *FileMetadata)
|
||||||
if (S_ISDIR (FileStatus.st_mode))
|
if (S_ISDIR (FileStatus.st_mode))
|
||||||
FileMetadata->FileType = Brw_IS_FOLDER;
|
FileMetadata->FileType = Brw_IS_FOLDER;
|
||||||
else if (S_ISREG (FileStatus.st_mode))
|
else if (S_ISREG (FileStatus.st_mode))
|
||||||
FileMetadata->FileType = Str_FileIs (Gbl.FileBrowser.Priv.FullPathInTree,"url") ? Brw_IS_LINK :
|
FileMetadata->FileType = Str_FileIs (FileMetadata->FullPathInTree,"url") ? Brw_IS_LINK :
|
||||||
Brw_IS_FILE;
|
Brw_IS_FILE;
|
||||||
else
|
else
|
||||||
FileMetadata->FileType = Brw_IS_UNKNOWN;
|
FileMetadata->FileType = Brw_IS_UNKNOWN;
|
||||||
FileMetadata->Size = FileStatus.st_size;
|
FileMetadata->Size = FileStatus.st_size;
|
||||||
|
@ -10580,7 +10591,7 @@ void Brw_GetCrsGrpFromFileMetadata (Brw_FileBrowser_t FileBrowser,long Cod,
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
long Brw_AddPathToDB (long PublisherUsrCod,Brw_FileType_t FileType,
|
long Brw_AddPathToDB (long PublisherUsrCod,Brw_FileType_t FileType,
|
||||||
const char *Path,bool IsPublic,Brw_License_t License)
|
const char *FullPathInTree,bool IsPublic,Brw_License_t License)
|
||||||
{
|
{
|
||||||
long Cod = Brw_GetCodForFiles ();
|
long Cod = Brw_GetCodForFiles ();
|
||||||
long ZoneUsrCod = Brw_GetZoneUsrCodForFiles ();
|
long ZoneUsrCod = Brw_GetZoneUsrCodForFiles ();
|
||||||
|
@ -10595,7 +10606,7 @@ long Brw_AddPathToDB (long PublisherUsrCod,Brw_FileType_t FileType,
|
||||||
Cod,ZoneUsrCod,
|
Cod,ZoneUsrCod,
|
||||||
PublisherUsrCod,
|
PublisherUsrCod,
|
||||||
(unsigned) FileType,
|
(unsigned) FileType,
|
||||||
Path,
|
FullPathInTree,
|
||||||
IsPublic ? 'Y' :
|
IsPublic ? 'Y' :
|
||||||
'N',
|
'N',
|
||||||
(unsigned) License);
|
(unsigned) License);
|
||||||
|
@ -11173,8 +11184,6 @@ static void Brw_WriteRowDocData (unsigned *NumDocsNotHidden,MYSQL_ROW row)
|
||||||
const char *CrsShortName;
|
const char *CrsShortName;
|
||||||
const char *BgColor;
|
const char *BgColor;
|
||||||
const char *Title;
|
const char *Title;
|
||||||
char PathUntilFileName[PATH_MAX+1];
|
|
||||||
char FileName[NAME_MAX+1];
|
|
||||||
char FileNameToShow[NAME_MAX+1];
|
char FileNameToShow[NAME_MAX+1];
|
||||||
/*
|
/*
|
||||||
row[ 0] = FilCod
|
row[ 0] = FilCod
|
||||||
|
@ -11325,10 +11334,9 @@ static void Brw_WriteRowDocData (unsigned *NumDocsNotHidden,MYSQL_ROW row)
|
||||||
BgColor,Title);
|
BgColor,Title);
|
||||||
|
|
||||||
/***** Get the name of the file to show *****/
|
/***** Get the name of the file to show *****/
|
||||||
Str_SplitFullPathIntoPathAndFileName (FileMetadata.Path,
|
Brw_LimitLengthFileNameToShow (FileMetadata.FileType,
|
||||||
PathUntilFileName,
|
FileMetadata.FilFolLnkName,
|
||||||
FileName);
|
FileNameToShow);
|
||||||
Brw_LimitLengthFileNameToShow (FileMetadata.FileType,FileName,FileNameToShow);
|
|
||||||
|
|
||||||
/***** Write file name using path (row[1]) *****/
|
/***** Write file name using path (row[1]) *****/
|
||||||
fprintf (Gbl.F.Out,"<td class=\"DAT_N LEFT_TOP %s\">",
|
fprintf (Gbl.F.Out,"<td class=\"DAT_N LEFT_TOP %s\">",
|
||||||
|
@ -11344,7 +11352,9 @@ static void Brw_WriteRowDocData (unsigned *NumDocsNotHidden,MYSQL_ROW row)
|
||||||
Act_FormStart (Brw_ActReqDatFile[FileMetadata.FileBrowser]);
|
Act_FormStart (Brw_ActReqDatFile[FileMetadata.FileBrowser]);
|
||||||
if (GrpCod > 0)
|
if (GrpCod > 0)
|
||||||
Grp_PutParamGrpCod (GrpCod);
|
Grp_PutParamGrpCod (GrpCod);
|
||||||
Brw_PutParamsPathAndFile (FileMetadata.FileType,PathUntilFileName,FileName);
|
Brw_PutParamsPathAndFile (FileMetadata.FileType,
|
||||||
|
FileMetadata.PathInTreeUntilFilFolLnk,
|
||||||
|
FileMetadata.FilFolLnkName);
|
||||||
|
|
||||||
Act_LinkFormSubmit (FileNameToShow,"DAT_N");
|
Act_LinkFormSubmit (FileNameToShow,"DAT_N");
|
||||||
|
|
||||||
|
@ -11358,7 +11368,7 @@ static void Brw_WriteRowDocData (unsigned *NumDocsNotHidden,MYSQL_ROW row)
|
||||||
Txt_Folder,Txt_Folder);
|
Txt_Folder,Txt_Folder);
|
||||||
else
|
else
|
||||||
/* Icon with file type or link */
|
/* Icon with file type or link */
|
||||||
Brw_PutIconFile (16,FileMetadata.FileType,FileName);
|
Brw_PutIconFile (16,FileMetadata.FileType,FileMetadata.FilFolLnkName);
|
||||||
|
|
||||||
/* File name and end of form */
|
/* File name and end of form */
|
||||||
fprintf (Gbl.F.Out,"%s"
|
fprintf (Gbl.F.Out,"%s"
|
||||||
|
|
|
@ -104,7 +104,10 @@ struct FileMetadata
|
||||||
long Cod; // Code of institution, centre, degree, course or group
|
long Cod; // Code of institution, centre, degree, course or group
|
||||||
long ZoneUsrCod;
|
long ZoneUsrCod;
|
||||||
long PublisherUsrCod;
|
long PublisherUsrCod;
|
||||||
char Path[PATH_MAX+1];
|
char FullPathInTree[PATH_MAX+1];
|
||||||
|
// FullPathInTree is splitted as PathInTreeUntilFilFolLnk/FilFolLnkName
|
||||||
|
char PathInTreeUntilFilFolLnk[PATH_MAX+1]; // Path in tree, without ending '/', until file, folder or link name
|
||||||
|
char FilFolLnkName[NAME_MAX+1]; // File, folder or link name
|
||||||
bool IsHidden;
|
bool IsHidden;
|
||||||
bool IsPublic;
|
bool IsPublic;
|
||||||
Brw_License_t License;
|
Brw_License_t License;
|
||||||
|
@ -201,7 +204,8 @@ void Brw_GetCrsGrpFromFileMetadata (Brw_FileBrowser_t FileBrowser,long Cod,
|
||||||
long *GrpCod);
|
long *GrpCod);
|
||||||
|
|
||||||
long Brw_AddPathToDB (long PublisherUsrCod,Brw_FileType_t FileType,
|
long Brw_AddPathToDB (long PublisherUsrCod,Brw_FileType_t FileType,
|
||||||
const char *Path,bool IsPublic,Brw_License_t License);
|
const char *FullPathInTree,
|
||||||
|
bool IsPublic,Brw_License_t License);
|
||||||
|
|
||||||
void Brw_RemoveExpiredExpandedFolders (void);
|
void Brw_RemoveExpiredExpandedFolders (void);
|
||||||
|
|
||||||
|
|
|
@ -504,7 +504,7 @@ struct Globals
|
||||||
{
|
{
|
||||||
char PathAboveRootFolder[PATH_MAX+1];
|
char PathAboveRootFolder[PATH_MAX+1];
|
||||||
char PathRootFolder[PATH_MAX+1];
|
char PathRootFolder[PATH_MAX+1];
|
||||||
char PathInTreeExceptFileOrFolder[PATH_MAX+1];
|
char PathInTreeUntilFilFolLnk[PATH_MAX+1];
|
||||||
char FullPathInTree[PATH_MAX+1];
|
char FullPathInTree[PATH_MAX+1];
|
||||||
} Priv;
|
} Priv;
|
||||||
char NewFilFolLnkName[NAME_MAX+1];
|
char NewFilFolLnkName[NAME_MAX+1];
|
||||||
|
|
|
@ -611,7 +611,7 @@ void Mrk_ShowMyMarks (void)
|
||||||
Brw_GetParAndInitFileBrowser ();
|
Brw_GetParAndInitFileBrowser ();
|
||||||
|
|
||||||
/***** Get the path of the file of marks *****/
|
/***** Get the path of the file of marks *****/
|
||||||
Brw_SetFullPathInTree (Gbl.FileBrowser.Priv.PathInTreeExceptFileOrFolder,
|
Brw_SetFullPathInTree (Gbl.FileBrowser.Priv.PathInTreeUntilFilFolLnk,
|
||||||
Gbl.FileBrowser.FilFolLnkName);
|
Gbl.FileBrowser.FilFolLnkName);
|
||||||
sprintf (PathPrivate,"%s/%s",Gbl.FileBrowser.Priv.PathAboveRootFolder,Gbl.FileBrowser.Priv.FullPathInTree);
|
sprintf (PathPrivate,"%s/%s",Gbl.FileBrowser.Priv.PathAboveRootFolder,Gbl.FileBrowser.Priv.FullPathInTree);
|
||||||
|
|
||||||
|
|
|
@ -647,8 +647,6 @@ static bool Ntf_StartFormGoToAction (Ntf_NotifyEvent_t NotifyEvent,
|
||||||
long CtrCod = -1L;
|
long CtrCod = -1L;
|
||||||
long DegCod = -1L;
|
long DegCod = -1L;
|
||||||
long GrpCod = -1L;
|
long GrpCod = -1L;
|
||||||
char PathUntilFileName[PATH_MAX+1];
|
|
||||||
char FileName[NAME_MAX+1];
|
|
||||||
Act_Action_t Action = ActUnk; // Initialized to avoid warning
|
Act_Action_t Action = ActUnk; // Initialized to avoid warning
|
||||||
|
|
||||||
/***** Parameters depending on the type of event *****/
|
/***** Parameters depending on the type of event *****/
|
||||||
|
@ -657,57 +655,41 @@ static bool Ntf_StartFormGoToAction (Ntf_NotifyEvent_t NotifyEvent,
|
||||||
case Ntf_EVENT_DOCUMENT_FILE:
|
case Ntf_EVENT_DOCUMENT_FILE:
|
||||||
case Ntf_EVENT_SHARED_FILE:
|
case Ntf_EVENT_SHARED_FILE:
|
||||||
case Ntf_EVENT_MARKS_FILE:
|
case Ntf_EVENT_MARKS_FILE:
|
||||||
|
Action = ActUnk;
|
||||||
FileMetadata.FilCod = Cod;
|
FileMetadata.FilCod = Cod;
|
||||||
PathUntilFileName[0] = '\0';
|
|
||||||
FileName[0] = '\0';
|
|
||||||
if (FileMetadata.FilCod > 0)
|
if (FileMetadata.FilCod > 0)
|
||||||
{
|
|
||||||
Brw_GetFileMetadataByCod (&FileMetadata);
|
Brw_GetFileMetadataByCod (&FileMetadata);
|
||||||
if (FileMetadata.FilCod > 0)
|
if (FileMetadata.FilCod > 0)
|
||||||
{
|
|
||||||
Brw_GetCrsGrpFromFileMetadata (FileMetadata.FileBrowser,FileMetadata.Cod,
|
|
||||||
&InsCod,&CtrCod,&DegCod,&CrsCod,&GrpCod);
|
|
||||||
Str_SplitFullPathIntoPathAndFileName (FileMetadata.Path,
|
|
||||||
PathUntilFileName,
|
|
||||||
FileName);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
switch (NotifyEvent)
|
|
||||||
{
|
|
||||||
case Ntf_EVENT_DOCUMENT_FILE:
|
|
||||||
Action = (FileMetadata.FilCod > 0) ? ((GrpCod > 0) ? ActReqDatSeeDocGrp :
|
|
||||||
((CrsCod > 0) ? ActReqDatSeeDocCrs :
|
|
||||||
((DegCod > 0) ? ActReqDatSeeDocDeg :
|
|
||||||
(CtrCod > 0) ? ActReqDatSeeDocCtr :
|
|
||||||
ActReqDatSeeDocIns))) :
|
|
||||||
ActUnk;
|
|
||||||
break;
|
|
||||||
case Ntf_EVENT_SHARED_FILE:
|
|
||||||
Action = (FileMetadata.FilCod > 0) ? ((GrpCod > 0) ? ActReqDatShaGrp :
|
|
||||||
((CrsCod > 0) ? ActReqDatShaCrs :
|
|
||||||
((DegCod > 0) ? ActReqDatShaDeg :
|
|
||||||
(CtrCod > 0) ? ActReqDatShaCtr :
|
|
||||||
ActReqDatShaIns))) :
|
|
||||||
ActUnk;
|
|
||||||
break;
|
|
||||||
case Ntf_EVENT_MARKS_FILE:
|
|
||||||
Action = (FileMetadata.FilCod > 0) ? ((GrpCod > 0) ? ActReqDatSeeMrkGrp :
|
|
||||||
ActReqDatSeeMrkCrs) :
|
|
||||||
ActUnk;
|
|
||||||
break;
|
|
||||||
default: // Not aplicable here
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (Action != ActUnk)
|
|
||||||
{
|
{
|
||||||
|
Brw_GetCrsGrpFromFileMetadata (FileMetadata.FileBrowser,FileMetadata.Cod,
|
||||||
|
&InsCod,&CtrCod,&DegCod,&CrsCod,&GrpCod);
|
||||||
|
switch (NotifyEvent)
|
||||||
|
{
|
||||||
|
case Ntf_EVENT_DOCUMENT_FILE:
|
||||||
|
Action = (GrpCod > 0 ? ActReqDatSeeDocGrp :
|
||||||
|
(CrsCod > 0 ? ActReqDatSeeDocCrs :
|
||||||
|
(DegCod > 0 ? ActReqDatSeeDocDeg :
|
||||||
|
(CtrCod > 0 ? ActReqDatSeeDocCtr :
|
||||||
|
ActReqDatSeeDocIns))));
|
||||||
|
break;
|
||||||
|
case Ntf_EVENT_SHARED_FILE:
|
||||||
|
Action = (GrpCod > 0 ? ActReqDatShaGrp :
|
||||||
|
(CrsCod > 0 ? ActReqDatShaCrs :
|
||||||
|
(DegCod > 0 ? ActReqDatShaDeg :
|
||||||
|
(CtrCod > 0 ? ActReqDatShaCtr :
|
||||||
|
ActReqDatShaIns))));
|
||||||
|
break;
|
||||||
|
case Ntf_EVENT_MARKS_FILE:
|
||||||
|
Action = (GrpCod > 0 ? ActReqDatSeeMrkGrp :
|
||||||
|
ActReqDatSeeMrkCrs);
|
||||||
|
break;
|
||||||
|
default: // Not aplicable here
|
||||||
|
break;
|
||||||
|
}
|
||||||
Act_FormStart (Action);
|
Act_FormStart (Action);
|
||||||
if (GrpCod > 0)
|
if (GrpCod > 0)
|
||||||
Grp_PutParamGrpCod (GrpCod);
|
Grp_PutParamGrpCod (GrpCod);
|
||||||
if (FileMetadata.FilCod > 0)
|
Brw_PutHiddenParamFilCod (FileMetadata.FilCod);
|
||||||
{
|
|
||||||
// Brw_PutHiddenParamFilCod (FileMetadata.FilCod);
|
|
||||||
Brw_PutParamsPathAndFile (FileMetadata.FileType,PathUntilFileName,FileName);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case Ntf_EVENT_NOTICE:
|
case Ntf_EVENT_NOTICE:
|
||||||
|
|
|
@ -619,8 +619,6 @@ static void Soc_PutFormGoToAction (Soc_NoteType_t NoteType,long CrsCod,long Cod)
|
||||||
long CtrCod = -1L;
|
long CtrCod = -1L;
|
||||||
long DegCod = -1L;
|
long DegCod = -1L;
|
||||||
long GrpCod = -1L;
|
long GrpCod = -1L;
|
||||||
char PathUntilFileName[PATH_MAX+1];
|
|
||||||
char FileName[NAME_MAX+1];
|
|
||||||
|
|
||||||
/***** Parameters depending on the type of note *****/
|
/***** Parameters depending on the type of note *****/
|
||||||
switch (NoteType)
|
switch (NoteType)
|
||||||
|
@ -634,25 +632,17 @@ static void Soc_PutFormGoToAction (Soc_NoteType_t NoteType,long CrsCod,long Cod)
|
||||||
case Soc_NOTE_CRS_DOC_PUB_FILE:
|
case Soc_NOTE_CRS_DOC_PUB_FILE:
|
||||||
case Soc_NOTE_CRS_SHA_PUB_FILE:
|
case Soc_NOTE_CRS_SHA_PUB_FILE:
|
||||||
FileMetadata.FilCod = Cod;
|
FileMetadata.FilCod = Cod;
|
||||||
PathUntilFileName[0] = '\0';
|
|
||||||
FileName[0] = '\0';
|
|
||||||
if (FileMetadata.FilCod > 0)
|
if (FileMetadata.FilCod > 0)
|
||||||
{
|
{
|
||||||
Brw_GetFileMetadataByCod (&FileMetadata);
|
Brw_GetFileMetadataByCod (&FileMetadata);
|
||||||
if (FileMetadata.FilCod > 0) // Found
|
if (FileMetadata.FilCod > 0) // Found
|
||||||
{
|
|
||||||
Brw_GetCrsGrpFromFileMetadata (FileMetadata.FileBrowser,FileMetadata.Cod,
|
Brw_GetCrsGrpFromFileMetadata (FileMetadata.FileBrowser,FileMetadata.Cod,
|
||||||
&InsCod,&CtrCod,&DegCod,&CrsCod,&GrpCod);
|
&InsCod,&CtrCod,&DegCod,&CrsCod,&GrpCod);
|
||||||
Str_SplitFullPathIntoPathAndFileName (FileMetadata.Path,
|
|
||||||
PathUntilFileName,
|
|
||||||
FileName);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (FileMetadata.FilCod > 0)
|
if (FileMetadata.FilCod > 0)
|
||||||
{
|
{
|
||||||
Act_FormStart (Soc_DefaultActions[NoteType]);
|
Act_FormStart (Soc_DefaultActions[NoteType]);
|
||||||
Brw_PutHiddenParamFilCod (FileMetadata.FilCod);
|
Brw_PutHiddenParamFilCod (FileMetadata.FilCod);
|
||||||
// Brw_PutParamsPathAndFile (FileMetadata.FileType,PathUntilFileName,FileName);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case Soc_NOTE_NOTICE:
|
case Soc_NOTE_NOTICE:
|
||||||
|
|
|
@ -4174,8 +4174,6 @@ int swad__getFile (struct soap *soap,
|
||||||
extern const char *Txt_LICENSES[Brw_NUM_LICENSES];
|
extern const char *Txt_LICENSES[Brw_NUM_LICENSES];
|
||||||
int ReturnCode;
|
int ReturnCode;
|
||||||
struct FileMetadata FileMetadata;
|
struct FileMetadata FileMetadata;
|
||||||
char PathUntilFileName[PATH_MAX+1];
|
|
||||||
char FileName[NAME_MAX+1];
|
|
||||||
char URL[PATH_MAX+1];
|
char URL[PATH_MAX+1];
|
||||||
char PhotoURL[PATH_MAX+1];
|
char PhotoURL[PATH_MAX+1];
|
||||||
|
|
||||||
|
@ -4277,8 +4275,8 @@ int swad__getFile (struct soap *soap,
|
||||||
|
|
||||||
/***** Set paths *****/
|
/***** Set paths *****/
|
||||||
Deg_InitCurrentCourse ();
|
Deg_InitCurrentCourse ();
|
||||||
Str_SplitFullPathIntoPathAndFileName (FileMetadata.Path,PathUntilFileName,FileName);
|
Brw_SetFullPathInTree (FileMetadata.PathInTreeUntilFilFolLnk,
|
||||||
Brw_SetFullPathInTree (PathUntilFileName,FileName);
|
FileMetadata.FilFolLnkName);
|
||||||
Brw_InitializeFileBrowser ();
|
Brw_InitializeFileBrowser ();
|
||||||
|
|
||||||
/***** Get file size and date *****/
|
/***** Get file size and date *****/
|
||||||
|
@ -4288,12 +4286,12 @@ int swad__getFile (struct soap *soap,
|
||||||
Brw_GetAndUpdateFileViews (&FileMetadata);
|
Brw_GetAndUpdateFileViews (&FileMetadata);
|
||||||
|
|
||||||
/***** Create and get link to download the file *****/
|
/***** Create and get link to download the file *****/
|
||||||
Brw_GetLinkToDownloadFile (PathUntilFileName,
|
Brw_GetLinkToDownloadFile (FileMetadata.PathInTreeUntilFilFolLnk,
|
||||||
FileName,
|
FileMetadata.FilFolLnkName,
|
||||||
URL);
|
URL);
|
||||||
|
|
||||||
/***** Copy data into output structure *****/
|
/***** Copy data into output structure *****/
|
||||||
strncpy (getFileOut->fileName,FileName,NAME_MAX);
|
strncpy (getFileOut->fileName,FileMetadata.FilFolLnkName,NAME_MAX);
|
||||||
getFileOut->fileName[NAME_MAX] = '\0';
|
getFileOut->fileName[NAME_MAX] = '\0';
|
||||||
|
|
||||||
strncpy (getFileOut->URL,URL,PATH_MAX);
|
strncpy (getFileOut->URL,URL,PATH_MAX);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user