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;
|
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 *****/
|
/***** Put icon to show a figure *****/
|
||||||
switch (Gbl.FileBrowser.Type)
|
switch (Gbl.FileBrowser.Type)
|
||||||
{
|
{
|
||||||
|
@ -7855,7 +7862,6 @@ void Brw_ShowFileMetadata (void)
|
||||||
bool ICanEdit;
|
bool ICanEdit;
|
||||||
bool ICanChangePublic = false;
|
bool ICanChangePublic = false;
|
||||||
bool FileHasPublisher;
|
bool FileHasPublisher;
|
||||||
bool PutIconToGetLink;
|
|
||||||
Brw_License_t License;
|
Brw_License_t License;
|
||||||
unsigned LicenseUnsigned;
|
unsigned LicenseUnsigned;
|
||||||
|
|
||||||
|
@ -7943,15 +7949,12 @@ void Brw_ShowFileMetadata (void)
|
||||||
FileNameToShow);
|
FileNameToShow);
|
||||||
|
|
||||||
/***** Begin box *****/
|
/***** Begin box *****/
|
||||||
PutIconToGetLink = (Gbl.FileBrowser.Type == Brw_SHOW_DOC_CRS || // Only document zone
|
// Put icon to get link?
|
||||||
Gbl.FileBrowser.Type == Brw_ADMI_DOC_CRS ||
|
if (Brw_ActReqLnk[Gbl.FileBrowser.Type] != ActUnk &&
|
||||||
Gbl.FileBrowser.Type == Brw_SHOW_MRK_CRS ||
|
(FileMetadata.FilFolLnk.Type == Brw_IS_FILE || // Only files or links
|
||||||
Gbl.FileBrowser.Type == Brw_ADMI_MRK_CRS) &&
|
FileMetadata.FilFolLnk.Type == Brw_IS_LINK) &&
|
||||||
(FileMetadata.FilFolLnk.Type == Brw_IS_FILE || // Only files or links
|
(Gbl.Usrs.Me.Role.Logged == Rol_TCH || // Only if I am a teacher
|
||||||
FileMetadata.FilFolLnk.Type == Brw_IS_LINK) &&
|
Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM)) // or a superuser
|
||||||
(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)
|
|
||||||
Box_BoxShadowBegin (NULL,NULL,
|
Box_BoxShadowBegin (NULL,NULL,
|
||||||
Brw_PutIconToGetLinkToFile,&FileMetadata,
|
Brw_PutIconToGetLinkToFile,&FileMetadata,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
|
|
||||||
#include "swad_action.h"
|
#include "swad_action.h"
|
||||||
#include "swad_browser.h"
|
#include "swad_browser.h"
|
||||||
|
#include "swad_browser_resource.h"
|
||||||
#include "swad_error.h"
|
#include "swad_error.h"
|
||||||
#include "swad_form.h"
|
#include "swad_form.h"
|
||||||
#include "swad_global.h"
|
#include "swad_global.h"
|
||||||
|
@ -46,43 +47,42 @@ extern struct Globals Gbl;
|
||||||
void BrwRsc_GetLinkToFile (void)
|
void BrwRsc_GetLinkToFile (void)
|
||||||
{
|
{
|
||||||
extern const char *Txt_Link_to_resource_X_copied_into_clipboard;
|
extern const char *Txt_Link_to_resource_X_copied_into_clipboard;
|
||||||
struct Brw_FileMetadata FileMetadata;
|
long FilCod;
|
||||||
bool Found;
|
char Title[NAME_MAX + 1]; // File or link name
|
||||||
PrgRsc_Type_t Type;
|
PrgRsc_Type_t Type;
|
||||||
|
|
||||||
/***** Get parameters related to file browser *****/
|
/***** Get parameters related to file browser *****/
|
||||||
Brw_GetParAndInitFileBrowser ();
|
Brw_GetParAndInitFileBrowser ();
|
||||||
|
|
||||||
/***** Get file name *****/
|
/***** Get file code *****/
|
||||||
FileMetadata.FilCod = Brw_GetParamFilCod ();
|
FilCod = Brw_GetParamFilCod ();
|
||||||
Brw_GetFileNameByCod (&FileMetadata);
|
|
||||||
Found = Brw_GetFileTypeSizeAndDate (&FileMetadata);
|
|
||||||
|
|
||||||
if (Found)
|
/***** Get file title *****/
|
||||||
|
switch (Gbl.Action.Act)
|
||||||
{
|
{
|
||||||
/***** Copy link to file into resource clipboard *****/
|
case ActReqLnkSeeDocCrs:
|
||||||
switch (Gbl.Action.Act)
|
case ActReqLnkAdmDocCrs:
|
||||||
{
|
Type = PrgRsc_DOCUMENT;
|
||||||
case ActReqLnkSeeDocCrs:
|
BrwRsc_GetDocTitleFromFilCod (FilCod,Title,sizeof (Title) - 1);
|
||||||
case ActReqLnkAdmDocCrs:
|
break;
|
||||||
Type = PrgRsc_DOCUMENT;
|
case ActReqLnkSeeMrkCrs:
|
||||||
break;
|
case ActReqLnkAdmMrkCrs:
|
||||||
case ActReqLnkSeeMrkCrs:
|
Type = PrgRsc_MARKS;
|
||||||
case ActReqLnkAdmMrkCrs:
|
BrwRsc_GetMrkTitleFromFilCod (FilCod,Title,sizeof (Title) - 1);
|
||||||
Type = PrgRsc_MARKS;
|
break;
|
||||||
break;
|
default:
|
||||||
default:
|
Type = PrgRsc_NONE; // Initialized to avoid warning
|
||||||
Type = PrgRsc_NONE; // Initialized to avoid warning
|
Err_WrongTypeExit ();
|
||||||
Err_WrongTypeExit ();
|
break;
|
||||||
break;
|
|
||||||
}
|
|
||||||
Prg_DB_CopyToClipboard (Type,FileMetadata.FilCod);
|
|
||||||
|
|
||||||
/***** Write sucess message *****/
|
|
||||||
Ale_ShowAlert (Ale_SUCCESS,Txt_Link_to_resource_X_copied_into_clipboard,
|
|
||||||
FileMetadata.FilFolLnk.Name);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/***** 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,
|
||||||
|
Title);
|
||||||
|
|
||||||
/***** Show again the file browser *****/
|
/***** Show again the file browser *****/
|
||||||
Brw_ShowAgainFileBrowserOrWorks ();
|
Brw_ShowAgainFileBrowserOrWorks ();
|
||||||
}
|
}
|
||||||
|
@ -94,13 +94,25 @@ void BrwRsc_GetLinkToFile (void)
|
||||||
void BrwRsc_WriteDocFileNameInCrsProgram (long FilCod,bool PutFormToGo,
|
void BrwRsc_WriteDocFileNameInCrsProgram (long FilCod,bool PutFormToGo,
|
||||||
const char *Icon,const char *IconTitle)
|
const char *Icon,const char *IconTitle)
|
||||||
{
|
{
|
||||||
|
extern const char *Txt_Documents;
|
||||||
extern const char *Txt_Actions[Act_NUM_ACTIONS];
|
extern const char *Txt_Actions[Act_NUM_ACTIONS];
|
||||||
Act_Action_t NextAction;
|
Act_Action_t NextAction;
|
||||||
struct Brw_FileMetadata FileMetadata;
|
struct Brw_FileMetadata FileMetadata;
|
||||||
|
char Title[NAME_MAX + 1]; // File or link name
|
||||||
|
|
||||||
/***** Get file metadata *****/
|
/***** Get file metadata *****/
|
||||||
FileMetadata.FilCod = FilCod;
|
FileMetadata.FilCod = FilCod;
|
||||||
Brw_GetFileMetadataByCod (&FileMetadata);
|
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 *****/
|
/***** Begin form to go to file data *****/
|
||||||
if (PutFormToGo)
|
if (PutFormToGo)
|
||||||
|
@ -108,35 +120,44 @@ void BrwRsc_WriteDocFileNameInCrsProgram (long FilCod,bool PutFormToGo,
|
||||||
NextAction = (FileMetadata.FilCod > 0) ? ActReqDatSeeDocCrs : // Document specified
|
NextAction = (FileMetadata.FilCod > 0) ? ActReqDatSeeDocCrs : // Document specified
|
||||||
ActSeeAdmDocCrsGrp; // All documents
|
ActSeeAdmDocCrsGrp; // All documents
|
||||||
Frm_BeginForm (NextAction);
|
Frm_BeginForm (NextAction);
|
||||||
Brw_PutParamsFileBrowser (NULL, // Not used
|
if (FileMetadata.FilCod > 0)
|
||||||
NULL, // Not used
|
Brw_PutParamsFileBrowser (NULL, // Not used
|
||||||
Brw_IS_UNKNOWN, // Not used
|
NULL, // Not used
|
||||||
FileMetadata.FilCod);
|
Brw_IS_UNKNOWN, // Not used
|
||||||
|
FileMetadata.FilCod);
|
||||||
HTM_BUTTON_Submit_Begin (Txt_Actions[NextAction],
|
HTM_BUTTON_Submit_Begin (Txt_Actions[NextAction],
|
||||||
"class=\"LM BT_LINK PRG_LNK_%s\"",
|
"class=\"LM BT_LINK PRG_LNK_%s\"",
|
||||||
The_GetSuffix ());
|
The_GetSuffix ());
|
||||||
}
|
}
|
||||||
|
|
||||||
/***** Icon depending on type ******/
|
/***** Icon depending on type ******/
|
||||||
switch (FileMetadata.FilFolLnk.Type)
|
if (FileMetadata.FilCod > 0)
|
||||||
|
switch (FileMetadata.FilFolLnk.Type)
|
||||||
|
{
|
||||||
|
case Brw_IS_FILE:
|
||||||
|
Brw_PutIconFile (FileMetadata.FilFolLnk.Name,
|
||||||
|
"CONTEXT_OPT ICO_HIGHLIGHT CONTEXT_ICO16x16",
|
||||||
|
PutFormToGo); // Put link to view metadata
|
||||||
|
break;
|
||||||
|
case Brw_IS_LINK:
|
||||||
|
if (PutFormToGo)
|
||||||
|
Ico_PutIconLink ("up-right-from-square.svg",Ico_BLACK,NextAction);
|
||||||
|
else
|
||||||
|
Ico_PutIconOn ("up-right-from-square.svg",Ico_BLACK,IconTitle);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
else // Documents zone
|
||||||
{
|
{
|
||||||
case Brw_IS_FILE:
|
if (PutFormToGo)
|
||||||
Brw_PutIconFile (FileMetadata.FilFolLnk.Name,
|
Ico_PutIconLink (Icon,Ico_BLACK,NextAction);
|
||||||
"CONTEXT_OPT ICO_HIGHLIGHT CONTEXT_ICO16x16",
|
else
|
||||||
PutFormToGo); // Put link to view metadata
|
Ico_PutIconOn (Icon,Ico_BLACK,IconTitle);
|
||||||
break;
|
|
||||||
case Brw_IS_LINK:
|
|
||||||
if (PutFormToGo)
|
|
||||||
Ico_PutIconLink (Icon,Ico_BLACK,NextAction);
|
|
||||||
else
|
|
||||||
Ico_PutIconOn (Icon,Ico_BLACK,IconTitle);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/***** Write filename *****/
|
/***** Write title *****/
|
||||||
HTM_Txt (FileMetadata.FilFolLnk.Name);
|
HTM_Txt (Title);
|
||||||
|
|
||||||
/***** End form to download file *****/
|
/***** End form to download file *****/
|
||||||
if (PutFormToGo)
|
if (PutFormToGo)
|
||||||
|
@ -154,13 +175,25 @@ void BrwRsc_WriteDocFileNameInCrsProgram (long FilCod,bool PutFormToGo,
|
||||||
void BrwRsc_WriteMrkFileNameInCrsProgram (long FilCod,bool PutFormToGo,
|
void BrwRsc_WriteMrkFileNameInCrsProgram (long FilCod,bool PutFormToGo,
|
||||||
const char *Icon,const char *IconTitle)
|
const char *Icon,const char *IconTitle)
|
||||||
{
|
{
|
||||||
|
extern const char *Txt_Marks_area;
|
||||||
extern const char *Txt_Actions[Act_NUM_ACTIONS];
|
extern const char *Txt_Actions[Act_NUM_ACTIONS];
|
||||||
Act_Action_t NextAction;
|
Act_Action_t NextAction;
|
||||||
struct Brw_FileMetadata FileMetadata;
|
struct Brw_FileMetadata FileMetadata;
|
||||||
|
char Title[NAME_MAX + 1]; // File or link name
|
||||||
|
|
||||||
/***** Get file metadata *****/
|
/***** Get file metadata *****/
|
||||||
FileMetadata.FilCod = FilCod;
|
FileMetadata.FilCod = FilCod;
|
||||||
Brw_GetFileMetadataByCod (&FileMetadata);
|
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 *****/
|
/***** Begin form to go to file data *****/
|
||||||
if (PutFormToGo)
|
if (PutFormToGo)
|
||||||
|
@ -168,10 +201,11 @@ void BrwRsc_WriteMrkFileNameInCrsProgram (long FilCod,bool PutFormToGo,
|
||||||
NextAction = (FileMetadata.FilCod > 0) ? ActReqDatSeeMrkCrs : // Marks file specified
|
NextAction = (FileMetadata.FilCod > 0) ? ActReqDatSeeMrkCrs : // Marks file specified
|
||||||
ActSeeAdmMrk; // All marks files
|
ActSeeAdmMrk; // All marks files
|
||||||
Frm_BeginForm (NextAction);
|
Frm_BeginForm (NextAction);
|
||||||
Brw_PutParamsFileBrowser (NULL, // Not used
|
if (FileMetadata.FilCod > 0)
|
||||||
NULL, // Not used
|
Brw_PutParamsFileBrowser (NULL, // Not used
|
||||||
Brw_IS_UNKNOWN, // Not used
|
NULL, // Not used
|
||||||
FileMetadata.FilCod);
|
Brw_IS_UNKNOWN, // Not used
|
||||||
|
FileMetadata.FilCod);
|
||||||
HTM_BUTTON_Submit_Begin (Txt_Actions[NextAction],
|
HTM_BUTTON_Submit_Begin (Txt_Actions[NextAction],
|
||||||
"class=\"LM BT_LINK PRG_LNK_%s\"",
|
"class=\"LM BT_LINK PRG_LNK_%s\"",
|
||||||
The_GetSuffix ());
|
The_GetSuffix ());
|
||||||
|
@ -184,7 +218,7 @@ void BrwRsc_WriteMrkFileNameInCrsProgram (long FilCod,bool PutFormToGo,
|
||||||
Ico_PutIconOn (Icon,Ico_BLACK,IconTitle);
|
Ico_PutIconOn (Icon,Ico_BLACK,IconTitle);
|
||||||
|
|
||||||
/***** Write filename *****/
|
/***** Write filename *****/
|
||||||
HTM_Txt (FileMetadata.FilFolLnk.Name);
|
HTM_Txt (Title);
|
||||||
|
|
||||||
/***** End form to download file *****/
|
/***** End form to download file *****/
|
||||||
if (PutFormToGo)
|
if (PutFormToGo)
|
||||||
|
@ -218,7 +252,6 @@ void BrwRsc_GetDocTitleFromFilCod (long FilCod,char *Title,size_t TitleSize)
|
||||||
Str_Copy (Title,Txt_Documents,TitleSize);
|
Str_Copy (Title,Txt_Documents,TitleSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/******************* Get marks file name from file code **********************/
|
/******************* 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.
|
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 CSS_FILE "swad22.22.1.css"
|
||||||
#define JS_FILE "swad21.100.js"
|
#define JS_FILE "swad21.100.js"
|
||||||
/*
|
/*
|
||||||
Version 22.32.8: Sep 29, 2022 TODO: Changes in program resources and course forums. (? lines)
|
Version 22.33.3: Sep 29, 2022 TODO: Fix layout of marks file metadata. (? lines)
|
||||||
Version 22.32.7: Sep 29, 2022 TODO: Changes in program resources and attendance events. (? lines)
|
Version 22.33.2: Sep 29, 2022 TODO: Changes in program resources and course forums. (? lines)
|
||||||
Version 22.32.6: Sep 29, 2022 TODO: Changes in program resources and mark files. (? lines)
|
Version 22.33.1: Sep 29, 2022 TODO: Changes in program resources and attendance events. (? lines)
|
||||||
Version 22.32.5: Sep 29, 2022 TODO: Changes in program resources and documents. (? 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. (? 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.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.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)
|
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_EXAM ] = "file-signature.svg",
|
||||||
[PrgRsc_GAME ] = "gamepad.svg",
|
[PrgRsc_GAME ] = "gamepad.svg",
|
||||||
[PrgRsc_SURVEY ] = "poll.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",
|
[PrgRsc_MARKS ] = "list-alt.svg",
|
||||||
// grp GROUPS // ??? User select groups
|
// grp GROUPS // ??? User select groups
|
||||||
[PrgRsc_ATTENDANCE_EVENT] = "calendar-check.svg",
|
[PrgRsc_ATTENDANCE_EVENT] = "calendar-check.svg",
|
||||||
|
|
Loading…
Reference in New Issue