mirror of https://github.com/acanas/swad-core.git
Version 22.33: Sep 29, 2022 Changes in program resources, documents and mark files.
This commit is contained in:
parent
2cd8323491
commit
036375ffe7
|
@ -3575,6 +3575,13 @@ static void Brw_PutIconsFileBrowser (__attribute__((unused)) void *Args)
|
|||
break;
|
||||
}
|
||||
|
||||
/***** Put icon to get resource link *****/
|
||||
if (Brw_ActReqLnk[Gbl.FileBrowser.Type] != ActUnk &&
|
||||
(Gbl.Usrs.Me.Role.Logged == Rol_TCH || // Only if I am a teacher
|
||||
Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM)) // or a superuser
|
||||
Ico_PutContextualIconToGetLink (Brw_ActReqLnk[Gbl.FileBrowser.Type],NULL,
|
||||
NULL,NULL);
|
||||
|
||||
/***** Put icon to show a figure *****/
|
||||
switch (Gbl.FileBrowser.Type)
|
||||
{
|
||||
|
@ -7855,7 +7862,6 @@ void Brw_ShowFileMetadata (void)
|
|||
bool ICanEdit;
|
||||
bool ICanChangePublic = false;
|
||||
bool FileHasPublisher;
|
||||
bool PutIconToGetLink;
|
||||
Brw_License_t License;
|
||||
unsigned LicenseUnsigned;
|
||||
|
||||
|
@ -7943,15 +7949,12 @@ void Brw_ShowFileMetadata (void)
|
|||
FileNameToShow);
|
||||
|
||||
/***** Begin box *****/
|
||||
PutIconToGetLink = (Gbl.FileBrowser.Type == Brw_SHOW_DOC_CRS || // Only document zone
|
||||
Gbl.FileBrowser.Type == Brw_ADMI_DOC_CRS ||
|
||||
Gbl.FileBrowser.Type == Brw_SHOW_MRK_CRS ||
|
||||
Gbl.FileBrowser.Type == Brw_ADMI_MRK_CRS) &&
|
||||
// Put icon to get link?
|
||||
if (Brw_ActReqLnk[Gbl.FileBrowser.Type] != ActUnk &&
|
||||
(FileMetadata.FilFolLnk.Type == Brw_IS_FILE || // Only files or links
|
||||
FileMetadata.FilFolLnk.Type == Brw_IS_LINK) &&
|
||||
(Gbl.Usrs.Me.Role.Logged == Rol_TCH || // Only if I am a teacher
|
||||
Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM); // or a superuser
|
||||
if (PutIconToGetLink)
|
||||
Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM)) // or a superuser
|
||||
Box_BoxShadowBegin (NULL,NULL,
|
||||
Brw_PutIconToGetLinkToFile,&FileMetadata,
|
||||
NULL);
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
|
||||
#include "swad_action.h"
|
||||
#include "swad_browser.h"
|
||||
#include "swad_browser_resource.h"
|
||||
#include "swad_error.h"
|
||||
#include "swad_form.h"
|
||||
#include "swad_global.h"
|
||||
|
@ -46,42 +47,41 @@ extern struct Globals Gbl;
|
|||
void BrwRsc_GetLinkToFile (void)
|
||||
{
|
||||
extern const char *Txt_Link_to_resource_X_copied_into_clipboard;
|
||||
struct Brw_FileMetadata FileMetadata;
|
||||
bool Found;
|
||||
long FilCod;
|
||||
char Title[NAME_MAX + 1]; // File or link name
|
||||
PrgRsc_Type_t Type;
|
||||
|
||||
/***** Get parameters related to file browser *****/
|
||||
Brw_GetParAndInitFileBrowser ();
|
||||
|
||||
/***** Get file name *****/
|
||||
FileMetadata.FilCod = Brw_GetParamFilCod ();
|
||||
Brw_GetFileNameByCod (&FileMetadata);
|
||||
Found = Brw_GetFileTypeSizeAndDate (&FileMetadata);
|
||||
/***** Get file code *****/
|
||||
FilCod = Brw_GetParamFilCod ();
|
||||
|
||||
if (Found)
|
||||
{
|
||||
/***** Copy link to file into resource clipboard *****/
|
||||
/***** Get file title *****/
|
||||
switch (Gbl.Action.Act)
|
||||
{
|
||||
case ActReqLnkSeeDocCrs:
|
||||
case ActReqLnkAdmDocCrs:
|
||||
Type = PrgRsc_DOCUMENT;
|
||||
BrwRsc_GetDocTitleFromFilCod (FilCod,Title,sizeof (Title) - 1);
|
||||
break;
|
||||
case ActReqLnkSeeMrkCrs:
|
||||
case ActReqLnkAdmMrkCrs:
|
||||
Type = PrgRsc_MARKS;
|
||||
BrwRsc_GetMrkTitleFromFilCod (FilCod,Title,sizeof (Title) - 1);
|
||||
break;
|
||||
default:
|
||||
Type = PrgRsc_NONE; // Initialized to avoid warning
|
||||
Err_WrongTypeExit ();
|
||||
break;
|
||||
}
|
||||
Prg_DB_CopyToClipboard (Type,FileMetadata.FilCod);
|
||||
|
||||
/***** Copy link to file into resource clipboard *****/
|
||||
Prg_DB_CopyToClipboard (Type,FilCod);
|
||||
|
||||
/***** Write sucess message *****/
|
||||
Ale_ShowAlert (Ale_SUCCESS,Txt_Link_to_resource_X_copied_into_clipboard,
|
||||
FileMetadata.FilFolLnk.Name);
|
||||
}
|
||||
Title);
|
||||
|
||||
/***** Show again the file browser *****/
|
||||
Brw_ShowAgainFileBrowserOrWorks ();
|
||||
|
@ -94,13 +94,25 @@ void BrwRsc_GetLinkToFile (void)
|
|||
void BrwRsc_WriteDocFileNameInCrsProgram (long FilCod,bool PutFormToGo,
|
||||
const char *Icon,const char *IconTitle)
|
||||
{
|
||||
extern const char *Txt_Documents;
|
||||
extern const char *Txt_Actions[Act_NUM_ACTIONS];
|
||||
Act_Action_t NextAction;
|
||||
struct Brw_FileMetadata FileMetadata;
|
||||
char Title[NAME_MAX + 1]; // File or link name
|
||||
|
||||
/***** Get file metadata *****/
|
||||
FileMetadata.FilCod = FilCod;
|
||||
if (FileMetadata.FilCod > 0)
|
||||
Brw_GetFileMetadataByCod (&FileMetadata);
|
||||
// If file doesn't exist ==> file code is changed to -1
|
||||
|
||||
/***** Set title *****/
|
||||
if (FileMetadata.FilCod > 0)
|
||||
/***** Copy file name into title *****/
|
||||
Str_Copy (Title,FileMetadata.FilFolLnk.Name,sizeof (Title) - 1);
|
||||
else
|
||||
/***** Generic title for all documents *****/
|
||||
Str_Copy (Title,Txt_Documents,sizeof (Title) - 1);
|
||||
|
||||
/***** Begin form to go to file data *****/
|
||||
if (PutFormToGo)
|
||||
|
@ -108,6 +120,7 @@ void BrwRsc_WriteDocFileNameInCrsProgram (long FilCod,bool PutFormToGo,
|
|||
NextAction = (FileMetadata.FilCod > 0) ? ActReqDatSeeDocCrs : // Document specified
|
||||
ActSeeAdmDocCrsGrp; // All documents
|
||||
Frm_BeginForm (NextAction);
|
||||
if (FileMetadata.FilCod > 0)
|
||||
Brw_PutParamsFileBrowser (NULL, // Not used
|
||||
NULL, // Not used
|
||||
Brw_IS_UNKNOWN, // Not used
|
||||
|
@ -118,6 +131,7 @@ void BrwRsc_WriteDocFileNameInCrsProgram (long FilCod,bool PutFormToGo,
|
|||
}
|
||||
|
||||
/***** Icon depending on type ******/
|
||||
if (FileMetadata.FilCod > 0)
|
||||
switch (FileMetadata.FilFolLnk.Type)
|
||||
{
|
||||
case Brw_IS_FILE:
|
||||
|
@ -127,16 +141,23 @@ void BrwRsc_WriteDocFileNameInCrsProgram (long FilCod,bool PutFormToGo,
|
|||
break;
|
||||
case Brw_IS_LINK:
|
||||
if (PutFormToGo)
|
||||
Ico_PutIconLink (Icon,Ico_BLACK,NextAction);
|
||||
Ico_PutIconLink ("up-right-from-square.svg",Ico_BLACK,NextAction);
|
||||
else
|
||||
Ico_PutIconOn (Icon,Ico_BLACK,IconTitle);
|
||||
Ico_PutIconOn ("up-right-from-square.svg",Ico_BLACK,IconTitle);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
else // Documents zone
|
||||
{
|
||||
if (PutFormToGo)
|
||||
Ico_PutIconLink (Icon,Ico_BLACK,NextAction);
|
||||
else
|
||||
Ico_PutIconOn (Icon,Ico_BLACK,IconTitle);
|
||||
}
|
||||
|
||||
/***** Write filename *****/
|
||||
HTM_Txt (FileMetadata.FilFolLnk.Name);
|
||||
/***** Write title *****/
|
||||
HTM_Txt (Title);
|
||||
|
||||
/***** End form to download file *****/
|
||||
if (PutFormToGo)
|
||||
|
@ -154,13 +175,25 @@ void BrwRsc_WriteDocFileNameInCrsProgram (long FilCod,bool PutFormToGo,
|
|||
void BrwRsc_WriteMrkFileNameInCrsProgram (long FilCod,bool PutFormToGo,
|
||||
const char *Icon,const char *IconTitle)
|
||||
{
|
||||
extern const char *Txt_Marks_area;
|
||||
extern const char *Txt_Actions[Act_NUM_ACTIONS];
|
||||
Act_Action_t NextAction;
|
||||
struct Brw_FileMetadata FileMetadata;
|
||||
char Title[NAME_MAX + 1]; // File or link name
|
||||
|
||||
/***** Get file metadata *****/
|
||||
FileMetadata.FilCod = FilCod;
|
||||
if (FileMetadata.FilCod > 0)
|
||||
Brw_GetFileMetadataByCod (&FileMetadata);
|
||||
// If file doesn't exist ==> file code is changed to -1
|
||||
|
||||
/***** Set title *****/
|
||||
if (FileMetadata.FilCod > 0)
|
||||
/***** Copy file name into title *****/
|
||||
Str_Copy (Title,FileMetadata.FilFolLnk.Name,sizeof (Title) - 1);
|
||||
else
|
||||
/***** Generic title for all documents *****/
|
||||
Str_Copy (Title,Txt_Marks_area,sizeof (Title) - 1);
|
||||
|
||||
/***** Begin form to go to file data *****/
|
||||
if (PutFormToGo)
|
||||
|
@ -168,6 +201,7 @@ void BrwRsc_WriteMrkFileNameInCrsProgram (long FilCod,bool PutFormToGo,
|
|||
NextAction = (FileMetadata.FilCod > 0) ? ActReqDatSeeMrkCrs : // Marks file specified
|
||||
ActSeeAdmMrk; // All marks files
|
||||
Frm_BeginForm (NextAction);
|
||||
if (FileMetadata.FilCod > 0)
|
||||
Brw_PutParamsFileBrowser (NULL, // Not used
|
||||
NULL, // Not used
|
||||
Brw_IS_UNKNOWN, // Not used
|
||||
|
@ -184,7 +218,7 @@ void BrwRsc_WriteMrkFileNameInCrsProgram (long FilCod,bool PutFormToGo,
|
|||
Ico_PutIconOn (Icon,Ico_BLACK,IconTitle);
|
||||
|
||||
/***** Write filename *****/
|
||||
HTM_Txt (FileMetadata.FilFolLnk.Name);
|
||||
HTM_Txt (Title);
|
||||
|
||||
/***** End form to download file *****/
|
||||
if (PutFormToGo)
|
||||
|
@ -218,7 +252,6 @@ void BrwRsc_GetDocTitleFromFilCod (long FilCod,char *Title,size_t TitleSize)
|
|||
Str_Copy (Title,Txt_Documents,TitleSize);
|
||||
}
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/******************* Get marks file name from file code **********************/
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -606,15 +606,15 @@ TODO: Fix bug: error al enviar un mensaje a dos recipientes, error on duplicate
|
|||
|
||||
TODO: Attach pdf files in multimedia.
|
||||
*/
|
||||
#define Log_PLATFORM_VERSION "SWAD 22.32.4 (2022-09-29)"
|
||||
#define Log_PLATFORM_VERSION "SWAD 22.33 (2022-09-29)"
|
||||
#define CSS_FILE "swad22.22.1.css"
|
||||
#define JS_FILE "swad21.100.js"
|
||||
/*
|
||||
Version 22.32.8: Sep 29, 2022 TODO: Changes in program resources and course forums. (? lines)
|
||||
Version 22.32.7: Sep 29, 2022 TODO: Changes in program resources and attendance events. (? lines)
|
||||
Version 22.32.6: Sep 29, 2022 TODO: Changes in program resources and mark files. (? lines)
|
||||
Version 22.32.5: Sep 29, 2022 TODO: Changes in program resources and documents. (? lines)
|
||||
Version 22.32.4: Sep 29, 2022 Changes in program resources and surveys. (? lines)
|
||||
Version 22.33.3: Sep 29, 2022 TODO: Fix layout of marks file metadata. (? lines)
|
||||
Version 22.33.2: Sep 29, 2022 TODO: Changes in program resources and course forums. (? lines)
|
||||
Version 22.33.1: Sep 29, 2022 TODO: Changes in program resources and attendance events. (? lines)
|
||||
Version 22.33: Sep 29, 2022 Changes in program resources, documents and mark files. (332683 lines)
|
||||
Version 22.32.4: Sep 29, 2022 Changes in program resources and surveys. (332650 lines)
|
||||
Version 22.32.3: Sep 29, 2022 Changes in program resources and games. (332642 lines)
|
||||
Version 22.32.2: Sep 29, 2022 Changes in program resources and exams. (332637 lines)
|
||||
Version 22.32.1: Sep 29, 2022 Changes in program resources and calls for exams. (332635 lines)
|
||||
|
|
|
@ -65,7 +65,7 @@ const char *Prg_ResourceTypesIcons[PrgRsc_NUM_TYPES] =
|
|||
[PrgRsc_EXAM ] = "file-signature.svg",
|
||||
[PrgRsc_GAME ] = "gamepad.svg",
|
||||
[PrgRsc_SURVEY ] = "poll.svg",
|
||||
[PrgRsc_DOCUMENT ] = "up-right-from-square.svg", // for links because each file type has its own icon
|
||||
[PrgRsc_DOCUMENT ] = "folder-open.svg",
|
||||
[PrgRsc_MARKS ] = "list-alt.svg",
|
||||
// grp GROUPS // ??? User select groups
|
||||
[PrgRsc_ATTENDANCE_EVENT] = "calendar-check.svg",
|
||||
|
|
Loading…
Reference in New Issue