mirror of https://github.com/acanas/swad-core.git
Version 22.92: Apr 06, 2023 Code refactoring in resources.
This commit is contained in:
parent
f08d17b785
commit
bfa90085a9
|
@ -1041,7 +1041,7 @@ const struct Act_Actions ActLst_Actions[ActLst_NUM_ACTIONS] =
|
|||
[ActConSeeDocCrs ] = { 476,-1,TabUnk,ActSeeAdmDocCrsGrp ,0x238,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_204_NO_CONT,Brw_ContractFileTree ,NULL ,NULL},
|
||||
[ActZIPSeeDocCrs ] = {1124,-1,TabUnk,ActSeeAdmDocCrsGrp ,0x238,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,ZIP_CompressFileTree ,NULL},
|
||||
[ActReqDatSeeDocCrs ] = {1033,-1,TabUnk,ActSeeAdmDocCrsGrp ,0x3F8,0x3C7, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Brw_ShowFileMetadata ,NULL},
|
||||
[ActReqLnkSeeDocCrs ] = {1930,-1,TabUnk,ActSeeAdmDocCrsGrp ,0x220,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,BrwRsc_GetLinkToFile ,NULL},
|
||||
[ActReqLnkSeeDocCrs ] = {1930,-1,TabUnk,ActSeeAdmDocCrsGrp ,0x220,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,BrwRsc_GetLinkToDocFil ,NULL},
|
||||
[ActDowSeeDocCrs ] = {1111,-1,TabUnk,ActSeeAdmDocCrsGrp ,0x3F8,0x3C7, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_DOWNLD_FILE,Brw_DownloadFile ,NULL ,NULL},
|
||||
|
||||
[ActSeeDocGrp ] = {1200,-1,TabUnk,ActSeeAdmDocCrsGrp ,0x238,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Brw_ShowFileBrowserOrWorks ,NULL},
|
||||
|
@ -1073,7 +1073,7 @@ const struct Act_Actions ActLst_Actions[ActLst_NUM_ACTIONS] =
|
|||
[ActHidDocCrs ] = { 465,-1,TabUnk,ActSeeAdmDocCrsGrp ,0x220,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Brw_SetDocumentAsHidden ,NULL},
|
||||
[ActReqDatAdmDocCrs ] = {1029,-1,TabUnk,ActSeeAdmDocCrsGrp ,0x220,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Brw_ShowFileMetadata ,NULL},
|
||||
[ActChgDatAdmDocCrs ] = { 996,-1,TabUnk,ActSeeAdmDocCrsGrp ,0x220,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Brw_ChgFileMetadata ,NULL},
|
||||
[ActReqLnkAdmDocCrs ] = {1931,-1,TabUnk,ActSeeAdmDocCrsGrp ,0x220,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,BrwRsc_GetLinkToFile ,NULL},
|
||||
[ActReqLnkAdmDocCrs ] = {1931,-1,TabUnk,ActSeeAdmDocCrsGrp ,0x220,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,BrwRsc_GetLinkToDocFil ,NULL},
|
||||
[ActDowAdmDocCrs ] = {1113,-1,TabUnk,ActSeeAdmDocCrsGrp ,0x220,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_DOWNLD_FILE,Brw_DownloadFile ,NULL ,NULL},
|
||||
|
||||
[ActAdmDocGrp ] = {1201,-1,TabUnk,ActSeeAdmDocCrsGrp ,0x220,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Brw_ShowFileBrowserOrWorks ,NULL},
|
||||
|
@ -1266,7 +1266,7 @@ const struct Act_Actions ActLst_Actions[ActLst_NUM_ACTIONS] =
|
|||
[ActExpSeeMrkCrs ] = { 528,-1,TabUnk,ActSeeAdmMrk ,0x238,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_204_NO_CONT,Brw_ExpandFileTree ,NULL ,NULL},
|
||||
[ActConSeeMrkCrs ] = { 527,-1,TabUnk,ActSeeAdmMrk ,0x238,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_204_NO_CONT,Brw_ContractFileTree ,NULL ,NULL},
|
||||
[ActReqDatSeeMrkCrs ] = {1086,-1,TabUnk,ActSeeAdmMrk ,0x238,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Brw_ShowFileMetadata ,NULL},
|
||||
[ActReqLnkSeeMrkCrs ] = {1939,-1,TabUnk,ActSeeAdmMrk ,0x220,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,BrwRsc_GetLinkToFile ,NULL},
|
||||
[ActReqLnkSeeMrkCrs ] = {1939,-1,TabUnk,ActSeeAdmMrk ,0x220,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,BrwRsc_GetLinkToMrkFil ,NULL},
|
||||
[ActSeeMyMrkCrs ] = { 523,-1,TabUnk,ActSeeAdmMrk ,0x238,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_NEW_TAB,Mrk_ShowMyMarks ,NULL ,NULL},
|
||||
|
||||
[ActSeeMrkGrp ] = {1204,-1,TabUnk,ActSeeAdmMrk ,0x238,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Brw_ShowFileBrowserOrWorks ,NULL},
|
||||
|
@ -1296,7 +1296,7 @@ const struct Act_Actions ActLst_Actions[ActLst_NUM_ACTIONS] =
|
|||
[ActHidMrkCrs ] = {1192,-1,TabUnk,ActSeeAdmMrk ,0x220,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Brw_SetDocumentAsHidden ,NULL},
|
||||
[ActReqDatAdmMrkCrs ] = {1035,-1,TabUnk,ActSeeAdmMrk ,0x220,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Brw_ShowFileMetadata ,NULL},
|
||||
[ActChgDatAdmMrkCrs ] = {1036,-1,TabUnk,ActSeeAdmMrk ,0x220,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Brw_ChgFileMetadata ,NULL},
|
||||
[ActReqLnkAdmMrkCrs ] = {1940,-1,TabUnk,ActSeeAdmMrk ,0x220,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,BrwRsc_GetLinkToFile ,NULL},
|
||||
[ActReqLnkAdmMrkCrs ] = {1940,-1,TabUnk,ActSeeAdmMrk ,0x220,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,BrwRsc_GetLinkToMrkFil ,NULL},
|
||||
[ActDowAdmMrkCrs ] = {1121,-1,TabUnk,ActSeeAdmMrk ,0x3F8,0x3C7, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_DOWNLD_FILE,Brw_DownloadFile ,NULL ,NULL},
|
||||
[ActChgNumRowHeaCrs ] = { 503,-1,TabUnk,ActSeeAdmMrk ,0x220,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Mrk_ChangeNumRowsHeader ,NULL},
|
||||
[ActChgNumRowFooCrs ] = { 504,-1,TabUnk,ActSeeAdmMrk ,0x220,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Mrk_ChangeNumRowsFooter ,NULL},
|
||||
|
|
|
@ -885,7 +885,7 @@ static void Agd_ShowOneEvent (struct Agd_Agenda *Agenda,
|
|||
HTM_TR_End ();
|
||||
|
||||
/***** Free anchor string *****/
|
||||
Frm_FreeAnchorStr (Anchor);
|
||||
Frm_FreeAnchorStr (&Anchor);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -474,7 +474,7 @@ static void Asg_PutIconsOneAsg (void *Assignments)
|
|||
Asg_PutIconsToRemEditOneAsg (Assignments,Anchor);
|
||||
|
||||
/***** Free anchor string *****/
|
||||
Frm_FreeAnchorStr (Anchor);
|
||||
Frm_FreeAnchorStr (&Anchor);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -615,7 +615,7 @@ static void Asg_ShowAssignmentRow (struct Asg_Assignments *Assignments,
|
|||
HTM_TR_End ();
|
||||
|
||||
/***** Free anchor string *****/
|
||||
Frm_FreeAnchorStr (Anchor);
|
||||
Frm_FreeAnchorStr (&Anchor);
|
||||
|
||||
/***** Mark possible notification as seen *****/
|
||||
Ntf_DB_MarkNotifAsSeenUsingCod (Ntf_EVENT_ASSIGNMENT,Assignments->Asg.AsgCod);
|
||||
|
|
|
@ -566,7 +566,7 @@ static void Att_ShowOneEventRow (struct Att_Events *Events,
|
|||
HTM_TR_End ();
|
||||
|
||||
/***** Free anchor string *****/
|
||||
Frm_FreeAnchorStr (Anchor);
|
||||
Frm_FreeAnchorStr (&Anchor);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -1508,7 +1508,7 @@ static void Att_PutIconsOneEvent (void *Events)
|
|||
Att_PutFormsToRemEditOneEvent ((struct Att_Events *) Events,Anchor);
|
||||
|
||||
/***** Free anchor string *****/
|
||||
Frm_FreeAnchorStr (Anchor);
|
||||
Frm_FreeAnchorStr (&Anchor);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -490,7 +490,7 @@ static void Ban_ListBannersForEdition (struct Ban_Banners *Banners)
|
|||
HTM_TR_End ();
|
||||
|
||||
/* Free anchor string */
|
||||
Frm_FreeAnchorStr (Anchor);
|
||||
Frm_FreeAnchorStr (&Anchor);
|
||||
}
|
||||
|
||||
/***** End table *****/
|
||||
|
|
|
@ -4718,10 +4718,6 @@ static void Brw_PutIconFileWithLinkToViewMetadata (const struct Brw_FileMetadata
|
|||
"CONTEXT_OPT ICO_HIGHLIGHT CONTEXT_ICO16x16",
|
||||
Frm_PUT_FORM_TO_GO); // Put link to view metadata
|
||||
else
|
||||
/*
|
||||
HTM_INPUT_IMAGE (Cfg_URL_ICON_PUBLIC,"up-right-from-square.svg",Txt_Link,
|
||||
"class=\"CONTEXT_OPT ICO_HIGHLIGHT CONTEXT_ICO16x16 ICO_%s_%s\"",
|
||||
Ico_GetPreffix (Ico_BLACK),The_GetSuffix ()); */
|
||||
Ico_PutIconLink ("up-right-from-square.svg",Ico_BLACK,
|
||||
Brw_ActReqDatFile[Gbl.FileBrowser.Type]);
|
||||
|
||||
|
@ -8574,19 +8570,19 @@ static void Brw_GetFileMetadataFromRow (MYSQL_RES *mysql_res,
|
|||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/*********************** Get file name using its code ************************/
|
||||
/****************** Get file type and path using its code ********************/
|
||||
/*****************************************************************************/
|
||||
// FileMetadata.FilCod must be filled
|
||||
// This function only gets file name stored in table files,
|
||||
// This function only gets type and path stored in table files,
|
||||
// The rest of the fields are not filled
|
||||
|
||||
void Brw_GetFileNameByCod (struct Brw_FileMetadata *FileMetadata)
|
||||
void Brw_GetPathByCod (struct Brw_FileMetadata *FileMetadata)
|
||||
{
|
||||
MYSQL_RES *mysql_res;
|
||||
MYSQL_ROW row;
|
||||
|
||||
/***** Get metadata of a file from database *****/
|
||||
if (Brw_DB_GetFileNameByCod (&mysql_res,FileMetadata->FilCod))
|
||||
if (Brw_DB_GetPathByCod (&mysql_res,FileMetadata->FilCod))
|
||||
{
|
||||
/* Get row */
|
||||
row = mysql_fetch_row (mysql_res);
|
||||
|
|
|
@ -224,7 +224,7 @@ void Brw_DownloadFile (void);
|
|||
void Brw_ChgFileMetadata (void);
|
||||
void Brw_GetFileMetadataByPath (struct Brw_FileMetadata *FileMetadata);
|
||||
void Brw_GetFileMetadataByCod (struct Brw_FileMetadata *FileMetadata);
|
||||
void Brw_GetFileNameByCod (struct Brw_FileMetadata *FileMetadata);
|
||||
void Brw_GetPathByCod (struct Brw_FileMetadata *FileMetadata);
|
||||
bool Brw_GetFileTypeSizeAndDate (struct Brw_FileMetadata *FileMetadata);
|
||||
void Brw_GetAndUpdateFileViews (struct Brw_FileMetadata *FileMetadata);
|
||||
void Brw_UpdateMyFileViews (long FilCod);
|
||||
|
|
|
@ -325,13 +325,13 @@ unsigned Brw_DB_GetFileMetadataByCod (MYSQL_RES **mysql_res,long FilCod)
|
|||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/*********************** Get file name using its code ************************/
|
||||
/************************ Get file path using its code ***********************/
|
||||
/*****************************************************************************/
|
||||
|
||||
unsigned Brw_DB_GetFileNameByCod (MYSQL_RES **mysql_res,long FilCod)
|
||||
unsigned Brw_DB_GetPathByCod (MYSQL_RES **mysql_res,long FilCod)
|
||||
{
|
||||
return (unsigned)
|
||||
DB_QuerySELECT (mysql_res,"can not get file name",
|
||||
DB_QuerySELECT (mysql_res,"can not get path",
|
||||
"SELECT Path" // row[0]
|
||||
" FROM brw_files"
|
||||
" WHERE FilCod=%ld",
|
||||
|
|
|
@ -47,7 +47,7 @@ void Brw_DB_RenameChildrenFilesOrFolders (const char OldPath[PATH_MAX + 1],
|
|||
long Brw_DB_GetFilCodByPath (const char *Path,bool OnlyIfPublic);
|
||||
unsigned Brw_DB_GetFileMetadataByPath (MYSQL_RES **mysql_res,const char *Path);
|
||||
unsigned Brw_DB_GetFileMetadataByCod (MYSQL_RES **mysql_res,long FilCod);
|
||||
unsigned Brw_DB_GetFileNameByCod (MYSQL_RES **mysql_res,long FilCod);
|
||||
unsigned Brw_DB_GetPathByCod (MYSQL_RES **mysql_res,long FilCod);
|
||||
long Brw_DB_GetPublisherOfSubtree (const char *Path);
|
||||
unsigned Brw_DB_GetNumFilesUsr (long UsrCod);
|
||||
unsigned Brw_DB_GetNumFilesInDocumZonesOfCrs (long CrsCod);
|
||||
|
|
|
@ -24,6 +24,8 @@
|
|||
/********************************* Headers ***********************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
#include <string.h> // For string functions
|
||||
|
||||
#include "swad_action.h"
|
||||
#include "swad_action_list.h"
|
||||
#include "swad_alert.h"
|
||||
|
@ -45,12 +47,11 @@ extern struct Globals Gbl;
|
|||
/****************************** Get link to file *****************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void BrwRsc_GetLinkToFile (void)
|
||||
void BrwRsc_GetLinkToDocFil (void)
|
||||
{
|
||||
extern const char *Txt_Link_to_resource_X_copied_into_clipboard;
|
||||
long FilCod;
|
||||
char Title[NAME_MAX + 1]; // File or link name
|
||||
Rsc_Type_t Type;
|
||||
|
||||
/***** Get parameters related to file browser *****/
|
||||
Brw_GetParAndInitFileBrowser ();
|
||||
|
@ -59,26 +60,36 @@ void BrwRsc_GetLinkToFile (void)
|
|||
FilCod = ParCod_GetPar (ParCod_Fil);
|
||||
|
||||
/***** Get file title *****/
|
||||
switch (Gbl.Action.Act)
|
||||
{
|
||||
case ActReqLnkSeeDocCrs:
|
||||
case ActReqLnkAdmDocCrs:
|
||||
Type = Rsc_DOCUMENT;
|
||||
BrwRsc_GetTitleFromDocFilCod (FilCod,Title,sizeof (Title) - 1);
|
||||
break;
|
||||
case ActReqLnkSeeMrkCrs:
|
||||
case ActReqLnkAdmMrkCrs:
|
||||
Type = Rsc_MARKS;
|
||||
BrwRsc_GetTitleFromMrkFilCod (FilCod,Title,sizeof (Title) - 1);
|
||||
break;
|
||||
default:
|
||||
Type = Rsc_NONE; // Initialized to avoid warning
|
||||
Err_WrongTypeExit ();
|
||||
break;
|
||||
}
|
||||
BrwRsc_GetTitleFromDocFilCod (FilCod,Title,sizeof (Title) - 1);
|
||||
|
||||
/***** Copy link to file into resource clipboard *****/
|
||||
Rsc_DB_CopyToClipboard (Type,FilCod);
|
||||
Rsc_DB_CopyToClipboard (Rsc_DOCUMENT,FilCod);
|
||||
|
||||
/***** Write sucess message *****/
|
||||
Ale_ShowAlert (Ale_SUCCESS,Txt_Link_to_resource_X_copied_into_clipboard,
|
||||
Title);
|
||||
|
||||
/***** Show again the file browser *****/
|
||||
Brw_ShowAgainFileBrowserOrWorks ();
|
||||
}
|
||||
|
||||
void BrwRsc_GetLinkToMrkFil (void)
|
||||
{
|
||||
extern const char *Txt_Link_to_resource_X_copied_into_clipboard;
|
||||
long FilCod;
|
||||
char Title[NAME_MAX + 1]; // File or link name
|
||||
|
||||
/***** Get parameters related to file browser *****/
|
||||
Brw_GetParAndInitFileBrowser ();
|
||||
|
||||
/***** Get file code *****/
|
||||
FilCod = ParCod_GetPar (ParCod_Fil);
|
||||
|
||||
/***** Get file title *****/
|
||||
BrwRsc_GetTitleFromMrkFilCod (FilCod,Title,sizeof (Title) - 1);
|
||||
|
||||
/***** Copy link to file into resource clipboard *****/
|
||||
Rsc_DB_CopyToClipboard (Rsc_MARKS,FilCod);
|
||||
|
||||
/***** Write sucess message *****/
|
||||
Ale_ShowAlert (Ale_SUCCESS,Txt_Link_to_resource_X_copied_into_clipboard,
|
||||
|
@ -243,7 +254,7 @@ void BrwRsc_WriteResourceMarksFile (long FilCod,Frm_PutFormToGo_t PutFormToGo,
|
|||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/******************** Get document name from file code ***********************/
|
||||
/********************** Get file name from file code *************************/
|
||||
/*****************************************************************************/
|
||||
// The trailing null character is not counted in TitleSize
|
||||
|
||||
|
@ -256,7 +267,11 @@ void BrwRsc_GetTitleFromDocFilCod (long FilCod,char *Title,size_t TitleSize)
|
|||
{
|
||||
/***** Get file name *****/
|
||||
FileMetadata.FilCod = FilCod;
|
||||
Brw_GetFileNameByCod (&FileMetadata);
|
||||
Brw_GetPathByCod (&FileMetadata);
|
||||
|
||||
/***** Remove .url if it's a link *****/
|
||||
if (Str_FileIs (FileMetadata.FilFolLnk.Name,"url"))
|
||||
FileMetadata.FilFolLnk.Name[strlen (FileMetadata.FilFolLnk.Name) - 4] = '\0';
|
||||
|
||||
/***** Copy file name into title *****/
|
||||
Str_Copy (Title,FileMetadata.FilFolLnk.Name,TitleSize);
|
||||
|
@ -266,11 +281,6 @@ void BrwRsc_GetTitleFromDocFilCod (long FilCod,char *Title,size_t TitleSize)
|
|||
Str_Copy (Title,Txt_Documents,TitleSize);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/******************* Get marks file name from file code **********************/
|
||||
/*****************************************************************************/
|
||||
// The trailing null character is not counted in TitleSize
|
||||
|
||||
void BrwRsc_GetTitleFromMrkFilCod (long FilCod,char *Title,size_t TitleSize)
|
||||
{
|
||||
extern const char *Txt_Marks_area;
|
||||
|
@ -280,7 +290,7 @@ void BrwRsc_GetTitleFromMrkFilCod (long FilCod,char *Title,size_t TitleSize)
|
|||
{
|
||||
/***** Get file name *****/
|
||||
FileMetadata.FilCod = FilCod;
|
||||
Brw_GetFileNameByCod (&FileMetadata);
|
||||
Brw_GetPathByCod (&FileMetadata);
|
||||
|
||||
/***** Copy file name into title *****/
|
||||
Str_Copy (Title,FileMetadata.FilFolLnk.Name,TitleSize);
|
||||
|
|
|
@ -33,7 +33,8 @@
|
|||
/************************ Public types and constants *************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void BrwRsc_GetLinkToFile (void);
|
||||
void BrwRsc_GetLinkToDocFil (void);
|
||||
void BrwRsc_GetLinkToMrkFil (void);
|
||||
void BrwRsc_WriteResourceDocument (long FilCod,Frm_PutFormToGo_t PutFormToGo,
|
||||
const char *Icon,const char *IconTitle);
|
||||
void BrwRsc_WriteResourceMarksFile (long FilCod,Frm_PutFormToGo_t PutFormToGo,
|
||||
|
|
|
@ -338,7 +338,7 @@ void Cfe_ReceiveCallForExam1 (void)
|
|||
Ale_CreateAlert (Ale_SUCCESS,Anchor,
|
||||
NewCallForExam ? Txt_Created_new_call_for_exam :
|
||||
Txt_The_call_for_exam_has_been_successfully_updated);
|
||||
Frm_FreeAnchorStr (Anchor);
|
||||
Frm_FreeAnchorStr (&Anchor);
|
||||
|
||||
/***** Set exam to be highlighted *****/
|
||||
CallsForExams->HighlightExaCod = ExaCod;
|
||||
|
@ -1469,7 +1469,7 @@ static void Cfe_ShowCallForExam (struct Cfe_CallsForExams *CallsForExams,
|
|||
HTM_ARTICLE_End ();
|
||||
|
||||
/***** Free anchor string *****/
|
||||
Frm_FreeAnchorStr (Anchor);
|
||||
Frm_FreeAnchorStr (&Anchor);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -97,7 +97,7 @@ void CfeRsc_WriteResourceCallForExam (long ExaCod,Frm_PutFormToGo_t PutFormToGo,
|
|||
The_GetSuffix ());
|
||||
|
||||
/* Free anchor string */
|
||||
Frm_FreeAnchorStr (Anchor);
|
||||
Frm_FreeAnchorStr (&Anchor);
|
||||
}
|
||||
|
||||
/***** Icon depending on type ******/
|
||||
|
|
|
@ -629,10 +629,11 @@ TODO: Emilce Barrera Mesa: Podr
|
|||
TODO: Emilce Barrera Mesa: Mis estudiantes presentan muchas dificultades a la hora de poner la foto porque la plataforma es muy exigente respecto al fondo de la imagen.
|
||||
|
||||
*/
|
||||
#define Log_PLATFORM_VERSION "SWAD 22.91 (2023-04-04)"
|
||||
#define Log_PLATFORM_VERSION "SWAD 22.92 (2023-04-06)"
|
||||
#define CSS_FILE "swad22.88.css"
|
||||
#define JS_FILE "swad22.49.js"
|
||||
/*
|
||||
Version 22.92: Apr 06, 2023 Code refactoring in resources. (339106 lines)
|
||||
Version 22.91.1: Apr 06, 2023 SQL script used to create database updated. (338984 lines)
|
||||
Version 22.91: Apr 06, 2023 Code refactoring in forums. (338928 lines)
|
||||
3 changes necessary in database:
|
||||
|
|
|
@ -618,7 +618,7 @@ static void Exa_ShowOneExam (struct Exa_Exams *Exams,bool ShowOnlyThisExam)
|
|||
The_ChangeRowColor ();
|
||||
|
||||
/***** Free anchor string *****/
|
||||
Frm_FreeAnchorStr (Anchor);
|
||||
Frm_FreeAnchorStr (&Anchor);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -638,7 +638,7 @@ static void Exa_PutIconsOneExam (void *Exams)
|
|||
Exa_PutIconsToRemEditOneExam ((struct Exa_Exams *) Exams,Anchor);
|
||||
|
||||
/***** Free anchor string *****/
|
||||
Frm_FreeAnchorStr (Anchor);
|
||||
Frm_FreeAnchorStr (&Anchor);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -763,7 +763,7 @@ static void ExaSet_ListOneOrMoreSetsForEdition (struct Exa_Exams *Exams,
|
|||
HTM_TR_End ();
|
||||
|
||||
/***** Free anchor string *****/
|
||||
Frm_FreeAnchorStr (Anchor);
|
||||
Frm_FreeAnchorStr (&Anchor);
|
||||
}
|
||||
|
||||
/***** End table *****/
|
||||
|
@ -923,7 +923,7 @@ static void ExaSet_ListOneOrMoreQuestionsForEdition (struct Exa_Exams *Exams,
|
|||
HTM_TR_End ();
|
||||
|
||||
/***** Free anchor string *****/
|
||||
Frm_FreeAnchorStr (Anchor);
|
||||
Frm_FreeAnchorStr (&Anchor);
|
||||
|
||||
/***** Destroy test question *****/
|
||||
Qst_QstDestructor (&Question);
|
||||
|
@ -1500,7 +1500,7 @@ void ExaSet_ReqRemQstFromSet (void)
|
|||
Exams.QstCod);
|
||||
|
||||
/***** Free anchor string *****/
|
||||
Frm_FreeAnchorStr (Anchor);
|
||||
Frm_FreeAnchorStr (&Anchor);
|
||||
|
||||
/***** Show current exam and its sets *****/
|
||||
Exa_PutFormsOneExam (&Exams,&Set,
|
||||
|
|
|
@ -279,12 +279,12 @@ void Frm_SetAnchorStr (long Cod,char **Anchor)
|
|||
*Anchor = NULL;
|
||||
}
|
||||
|
||||
void Frm_FreeAnchorStr (char *Anchor)
|
||||
void Frm_FreeAnchorStr (char **Anchor)
|
||||
{
|
||||
if (Anchor)
|
||||
if (*Anchor)
|
||||
{
|
||||
free (Anchor);
|
||||
Anchor = NULL;
|
||||
free (*Anchor);
|
||||
*Anchor = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -68,7 +68,7 @@ void Frm_EndForm (void);
|
|||
void Frm_SetUniqueId (char UniqueId[Frm_MAX_BYTES_ID + 1]);
|
||||
|
||||
void Frm_SetAnchorStr (long Cod,char **Anchor);
|
||||
void Frm_FreeAnchorStr (char *Anchor);
|
||||
void Frm_FreeAnchorStr (char **Anchor);
|
||||
|
||||
void Frm_LabelColumn (const char *TDClass,const char *Id,const char *Label);
|
||||
|
||||
|
|
18
swad_forum.c
18
swad_forum.c
|
@ -2450,18 +2450,32 @@ void For_GetParsForums (struct For_Forums *Forums)
|
|||
/***** Set forum type *****/
|
||||
For_SetForumType (Forums);
|
||||
|
||||
/***** Get parameter with code of course, degree, center or institution *****/
|
||||
/***** Get parameter with code of institution, center, degree or course *****/
|
||||
switch (Forums->Forum.Type)
|
||||
{
|
||||
case For_FORUM_INSTIT_USRS:
|
||||
case For_FORUM_INSTIT_TCHS:
|
||||
if ((Forums->Forum.HieCod = ParCod_GetPar (ParCod_OthHie)) <= 0)
|
||||
// If no institution specified ==> go to current institution forum
|
||||
Forums->Forum.HieCod = Gbl.Hierarchy.Ins.InsCod;
|
||||
break;
|
||||
case For_FORUM_CENTER_USRS:
|
||||
case For_FORUM_CENTER_TCHS:
|
||||
if ((Forums->Forum.HieCod = ParCod_GetPar (ParCod_OthHie)) <= 0)
|
||||
// If no center specified ==> go to current center forum
|
||||
Forums->Forum.HieCod = Gbl.Hierarchy.Ctr.CtrCod;
|
||||
break;
|
||||
case For_FORUM_DEGREE_USRS:
|
||||
case For_FORUM_DEGREE_TCHS:
|
||||
if ((Forums->Forum.HieCod = ParCod_GetPar (ParCod_OthHie)) <= 0)
|
||||
// If no degree specified ==> go to current degree forum
|
||||
Forums->Forum.HieCod = Gbl.Hierarchy.Deg.DegCod;
|
||||
break;
|
||||
case For_FORUM_COURSE_USRS:
|
||||
case For_FORUM_COURSE_TCHS:
|
||||
Forums->Forum.HieCod = ParCod_GetPar (ParCod_OthHie);
|
||||
if ((Forums->Forum.HieCod = ParCod_GetPar (ParCod_OthHie)) <= 0)
|
||||
// If no course specified ==> go to current course forum
|
||||
Forums->Forum.HieCod = Gbl.Hierarchy.Crs.CrsCod;
|
||||
break;
|
||||
default:
|
||||
Forums->Forum.HieCod = -1L;
|
||||
|
|
|
@ -131,6 +131,21 @@ void ForRsc_WriteResourceThread (long ThrCod,Frm_PutFormToGo_t PutFormToGo,
|
|||
}
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/************** Build/free anchor string given a thread code *****************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void ForRsc_SetAnchorStr (long ThrCod,char **Anchor)
|
||||
{
|
||||
*Anchor = (ThrCod > 0) ? For_FORUM_POSTS_SECTION_ID :
|
||||
For_FORUM_THREADS_SECTION_ID;
|
||||
}
|
||||
|
||||
void ForRsc_FreeAnchorStr (char **Anchor)
|
||||
{
|
||||
*Anchor = NULL;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/********************* Get survey title from survey code *********************/
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -36,6 +36,8 @@
|
|||
void ForRsc_GetLinkToThread (void);
|
||||
void ForRsc_WriteResourceThread (long ThrCod,Frm_PutFormToGo_t PutFormToGo,
|
||||
const char *Icon,const char *IconTitle);
|
||||
void ForRsc_SetAnchorStr (long ThrCod,char **Anchor);
|
||||
void ForRsc_FreeAnchorStr (char **Anchor);
|
||||
void ForRsc_GetTitleFromThrCod (long ThrCod,char *Title,size_t TitleSize);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -668,7 +668,7 @@ static void Gam_ShowGameMainData (struct Gam_Games *Games,
|
|||
The_ChangeRowColor ();
|
||||
|
||||
/***** Free anchor string *****/
|
||||
Frm_FreeAnchorStr (Anchor);
|
||||
Frm_FreeAnchorStr (&Anchor);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -688,7 +688,7 @@ static void Gam_PutIconsOneGame (void *Games)
|
|||
Gam_PutIconsToRemEditOneGame (Games,Anchor);
|
||||
|
||||
/***** Free anchor string *****/
|
||||
Frm_FreeAnchorStr (Anchor);
|
||||
Frm_FreeAnchorStr (&Anchor);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1763,7 +1763,7 @@ static void Gam_ListOneOrMoreQuestionsForEdition (struct Gam_Games *Games,
|
|||
HTM_TR_End ();
|
||||
|
||||
/***** Free anchor string *****/
|
||||
Frm_FreeAnchorStr (Anchor);
|
||||
Frm_FreeAnchorStr (&Anchor);
|
||||
|
||||
/***** Destroy test question *****/
|
||||
Qst_QstDestructor (&Question);
|
||||
|
|
|
@ -646,7 +646,7 @@ static void Not_DrawANotice (Not_Listing_t TypeNoticesListing,
|
|||
}
|
||||
|
||||
/***** Free anchor string *****/
|
||||
Frm_FreeAnchorStr (Anchor);
|
||||
Frm_FreeAnchorStr (&Anchor);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -717,7 +717,7 @@ static Act_Action_t Ntf_StartFormGoToAction (Ntf_NotifyEvent_t NotifyEvent,
|
|||
ParCod_PutPar (ParCod_Exa,Cod);
|
||||
|
||||
/* Free anchor string */
|
||||
Frm_FreeAnchorStr (Anchor);
|
||||
Frm_FreeAnchorStr (&Anchor);
|
||||
break;
|
||||
case Ntf_EVENT_DOCUMENT_FILE:
|
||||
case Ntf_EVENT_TEACHERS_FILE:
|
||||
|
|
|
@ -1117,9 +1117,10 @@ void ParCod_PutPar (ParCod_Param_t ParCod,long Cod)
|
|||
{
|
||||
extern const char *Par_CodeStr[];
|
||||
|
||||
// <0 => not specified => don't write parameter
|
||||
if (Cod >= 0) // 0 => another country, institution, centre...
|
||||
// >0 => a given country, institution, centre...
|
||||
if (ParCod != ParCod_None && Cod >= 0)
|
||||
// <0 => not specified => don't write parameter
|
||||
// 0 => another country, institution, centre...
|
||||
// >0 => a given country, institution, centre...
|
||||
Par_PutParLong (NULL,Par_CodeStr[ParCod],Cod);
|
||||
}
|
||||
|
||||
|
|
|
@ -367,9 +367,6 @@ static void PrgRsc_GetResourceDataFromRow (MYSQL_RES *mysql_res,
|
|||
static void PrgRsc_WriteRowViewResource (unsigned NumRsc,
|
||||
const struct Prg_Item *Item)
|
||||
{
|
||||
extern const char *Rsc_ResourceTypesIcons[Rsc_NUM_TYPES];
|
||||
extern const char *Txt_RESOURCE_TYPES[Rsc_NUM_TYPES];
|
||||
|
||||
/***** Begin row *****/
|
||||
HTM_TR_Begin (NULL);
|
||||
|
||||
|
@ -384,10 +381,7 @@ static void PrgRsc_WriteRowViewResource (unsigned NumRsc,
|
|||
The_GetSuffix (),The_GetColorRows1 (1));
|
||||
HTM_Txt (Item->Resource.Title);
|
||||
HTM_BR ();
|
||||
Rsc_WriteLinkName (&Item->Resource.Link,
|
||||
true, // Put form
|
||||
Rsc_ResourceTypesIcons[Item->Resource.Link.Type],
|
||||
Txt_RESOURCE_TYPES[Item->Resource.Link.Type]);
|
||||
Rsc_WriteLinkName (&Item->Resource.Link,Frm_PUT_FORM_TO_GO);
|
||||
HTM_TD_End ();
|
||||
|
||||
/***** End row *****/
|
||||
|
@ -401,9 +395,6 @@ static void PrgRsc_WriteRowViewResource (unsigned NumRsc,
|
|||
static void PrgRsc_WriteRowEditResource (unsigned NumRsc,unsigned NumResources,
|
||||
struct Prg_Item *Item,bool EditLink)
|
||||
{
|
||||
extern const char *Rsc_ResourceTypesIcons[Rsc_NUM_TYPES];
|
||||
extern const char *Txt_RESOURCE_TYPES[Rsc_NUM_TYPES];
|
||||
|
||||
/***** Begin row *****/
|
||||
HTM_TR_Begin (NULL);
|
||||
|
||||
|
@ -444,10 +435,7 @@ static void PrgRsc_WriteRowEditResource (unsigned NumRsc,unsigned NumResources,
|
|||
}
|
||||
else
|
||||
/* Show current link */
|
||||
Rsc_WriteLinkName (&Item->Resource.Link,
|
||||
true, // Put form
|
||||
Rsc_ResourceTypesIcons[Item->Resource.Link.Type],
|
||||
Txt_RESOURCE_TYPES[Item->Resource.Link.Type]);
|
||||
Rsc_WriteLinkName (&Item->Resource.Link,Frm_PUT_FORM_TO_GO);
|
||||
|
||||
HTM_TD_End ();
|
||||
|
||||
|
|
|
@ -1393,7 +1393,7 @@ static void Prj_PutIconsOnePrj (void *Projects)
|
|||
Prj_PutIconsToRemEditOnePrj (Projects,Anchor);
|
||||
|
||||
/***** Free anchor string *****/
|
||||
Frm_FreeAnchorStr (Anchor);
|
||||
Frm_FreeAnchorStr (&Anchor);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1505,7 +1505,7 @@ static void Prj_ShowProjectRow (struct Prj_Projects *Projects)
|
|||
Prj_ShowProjectURL (Projects,ClassLabel,ClassData,"prj_url_",UniqueId);
|
||||
|
||||
/***** Free anchor string *****/
|
||||
Frm_FreeAnchorStr (Anchor);
|
||||
Frm_FreeAnchorStr (&Anchor);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
162
swad_resource.c
162
swad_resource.c
|
@ -28,6 +28,7 @@
|
|||
#include <stdbool.h> // For boolean type
|
||||
#include <string.h> // For string functions
|
||||
|
||||
#include "swad_action_list.h"
|
||||
#include "swad_alert.h"
|
||||
#include "swad_assignment_resource.h"
|
||||
#include "swad_attendance_resource.h"
|
||||
|
@ -40,6 +41,7 @@
|
|||
#include "swad_global.h"
|
||||
#include "swad_HTML.h"
|
||||
#include "swad_parameter.h"
|
||||
#include "swad_parameter_code.h"
|
||||
#include "swad_project_resource.h"
|
||||
#include "swad_resource.h"
|
||||
#include "swad_resource_database.h"
|
||||
|
@ -90,7 +92,7 @@ const char *Rsc_ResourceTypesIcons[Rsc_NUM_TYPES] =
|
|||
[Rsc_EXAM ] = "file-signature.svg",
|
||||
[Rsc_GAME ] = "gamepad.svg",
|
||||
[Rsc_RUBRIC ] = "tasks.svg",
|
||||
[Rsc_DOCUMENT ] = "folder-open.svg",
|
||||
[Rsc_DOCUMENT ] = "file.svg",
|
||||
[Rsc_MARKS ] = "list-alt.svg",
|
||||
// grp GROUPS // ??? User select groups
|
||||
[Rsc_ATTENDANCE_EVENT] = "calendar-check.svg",
|
||||
|
@ -104,14 +106,19 @@ const char *Rsc_ResourceTypesIcons[Rsc_NUM_TYPES] =
|
|||
|
||||
extern struct Globals Gbl;
|
||||
|
||||
/*****************************************************************************/
|
||||
/**************************** Private prototypes *****************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void Rsc_GetResourceEmptyTitle (__attribute__((unused)) long Cod,
|
||||
char *Title,size_t TitleSize);
|
||||
|
||||
/*****************************************************************************/
|
||||
/************************* Show resources clipboard **************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Rsc_ShowClipboard (void)
|
||||
{
|
||||
extern const char *Rsc_ResourceTypesIcons[Rsc_NUM_TYPES];
|
||||
extern const char *Txt_RESOURCE_TYPES[Rsc_NUM_TYPES];
|
||||
MYSQL_RES *mysql_res;
|
||||
unsigned NumLink;
|
||||
unsigned NumLinks;
|
||||
|
@ -128,10 +135,7 @@ void Rsc_ShowClipboard (void)
|
|||
{
|
||||
Rsc_GetLinkDataFromRow (mysql_res,&Link);
|
||||
HTM_LI_Begin ("class=\"PRG_RSC_%s\"",The_GetSuffix ());
|
||||
Rsc_WriteLinkName (&Link,
|
||||
true, // Put form to go
|
||||
Rsc_ResourceTypesIcons[Link.Type],
|
||||
Txt_RESOURCE_TYPES[Link.Type]);
|
||||
Rsc_WriteLinkName (&Link,Frm_PUT_FORM_TO_GO);
|
||||
HTM_LI_End ();
|
||||
}
|
||||
DB_FreeMySQLResult (&mysql_res);
|
||||
|
@ -202,8 +206,6 @@ void Rsc_ShowClipboardToChangeLink (const struct Rsc_Link *CurrentLink)
|
|||
void Rsc_WriteRowClipboard (const struct Rsc_Link *Link,
|
||||
HTM_SubmitOnClick_t SubmitOnClick,bool Checked)
|
||||
{
|
||||
extern const char *Txt_RESOURCE_TYPES[Rsc_NUM_TYPES];
|
||||
|
||||
/***** Begin list row *****/
|
||||
HTM_LI_Begin ("class=\"PRG_RSC_%s\"",The_GetSuffix ());
|
||||
HTM_LABEL_Begin (NULL);
|
||||
|
@ -216,10 +218,7 @@ void Rsc_WriteRowClipboard (const struct Rsc_Link *Link,
|
|||
"");
|
||||
|
||||
/***** Name *****/
|
||||
Rsc_WriteLinkName (Link,
|
||||
false, // Don't put form to go
|
||||
Rsc_ResourceTypesIcons[Link->Type],
|
||||
Txt_RESOURCE_TYPES[Link->Type]);
|
||||
Rsc_WriteLinkName (Link,Frm_DONT_PUT_FORM_TO_GO);
|
||||
|
||||
HTM_LABEL_End ();
|
||||
|
||||
|
@ -231,9 +230,11 @@ void Rsc_WriteRowClipboard (const struct Rsc_Link *Link,
|
|||
/************* Write link name (filename, assignment title...) ***************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Rsc_WriteLinkName (const struct Rsc_Link *Link,Frm_PutFormToGo_t PutFormToGo,
|
||||
const char *Icon,const char *IconTitle)
|
||||
void Rsc_WriteLinkName (const struct Rsc_Link *Link,Frm_PutFormToGo_t PutFormToGo)
|
||||
{
|
||||
extern const char *Txt_Actions[ActLst_NUM_ACTIONS];
|
||||
extern const char *Rsc_ResourceTypesIcons[Rsc_NUM_TYPES];
|
||||
extern const char *Txt_RESOURCE_TYPES[Rsc_NUM_TYPES];
|
||||
static void (*WriteLinkName[Rsc_NUM_TYPES]) (long Cod,Frm_PutFormToGo_t PutFormToGo,
|
||||
const char *Icon,
|
||||
const char *IconTitle) =
|
||||
|
@ -251,10 +252,126 @@ void Rsc_WriteLinkName (const struct Rsc_Link *Link,Frm_PutFormToGo_t PutFormToG
|
|||
[Rsc_FORUM_THREAD ] = ForRsc_WriteResourceThread,
|
||||
[Rsc_SURVEY ] = SvyRsc_WriteResourceSurvey,
|
||||
};
|
||||
static void (*GetResourceTitle[Rsc_NUM_TYPES]) (long Cod,char *Title,size_t TitleSize) =
|
||||
{
|
||||
[Rsc_NONE ] = Rsc_GetResourceEmptyTitle,
|
||||
[Rsc_ASSIGNMENT ] = AsgRsc_GetTitleFromAsgCod,
|
||||
[Rsc_PROJECT ] = PrjRsc_GetTitleFromPrjCod,
|
||||
[Rsc_CALL_FOR_EXAM ] = CfeRsc_GetTitleFromExaCod,
|
||||
[Rsc_EXAM ] = ExaRsc_GetTitleFromExaCod,
|
||||
[Rsc_GAME ] = GamRsc_GetTitleFromGamCod,
|
||||
[Rsc_RUBRIC ] = RubRsc_GetTitleFromRubCod,
|
||||
[Rsc_DOCUMENT ] = BrwRsc_GetTitleFromDocFilCod,
|
||||
[Rsc_MARKS ] = BrwRsc_GetTitleFromMrkFilCod,
|
||||
[Rsc_ATTENDANCE_EVENT] = AttRsc_GetTitleFromAttCod,
|
||||
[Rsc_FORUM_THREAD ] = ForRsc_GetTitleFromThrCod,
|
||||
[Rsc_SURVEY ] = SvyRsc_GetTitleFromSvyCod,
|
||||
};
|
||||
static struct
|
||||
{
|
||||
void (*Set) (long Cod,char **Anchor);
|
||||
void (*Free) (char **Anchor);
|
||||
} FuncAnchor[Rsc_NUM_TYPES] =
|
||||
{
|
||||
[Rsc_NONE ] = {NULL,NULL},
|
||||
[Rsc_ASSIGNMENT ] = {NULL,NULL},
|
||||
[Rsc_PROJECT ] = {NULL,NULL},
|
||||
[Rsc_CALL_FOR_EXAM ] = {Frm_SetAnchorStr,Frm_FreeAnchorStr},
|
||||
[Rsc_EXAM ] = {NULL,NULL},
|
||||
[Rsc_GAME ] = {NULL,NULL},
|
||||
[Rsc_RUBRIC ] = {NULL,NULL},
|
||||
[Rsc_DOCUMENT ] = {NULL,NULL},
|
||||
[Rsc_MARKS ] = {NULL,NULL},
|
||||
[Rsc_ATTENDANCE_EVENT] = {NULL,NULL},
|
||||
[Rsc_FORUM_THREAD ] = {ForRsc_SetAnchorStr,ForRsc_FreeAnchorStr},
|
||||
[Rsc_SURVEY ] = {NULL,NULL},
|
||||
};
|
||||
static struct
|
||||
{
|
||||
Act_Action_t IfCod;
|
||||
Act_Action_t IfNotCod;
|
||||
} NextActions[Rsc_NUM_TYPES] =
|
||||
{
|
||||
[Rsc_NONE ] = {ActUnk ,ActUnk },
|
||||
[Rsc_ASSIGNMENT ] = {ActSeeOneAsg ,ActSeeAsg },
|
||||
[Rsc_PROJECT ] = {ActSeeOnePrj ,ActSeePrj },
|
||||
[Rsc_CALL_FOR_EXAM ] = {ActSeeOneCfe ,ActSeeAllCfe },
|
||||
[Rsc_EXAM ] = {ActSeeExa ,ActSeeAllExa },
|
||||
[Rsc_GAME ] = {ActSeeGam ,ActSeeAllGam },
|
||||
[Rsc_RUBRIC ] = {ActSeeRub ,ActSeeAllRub },
|
||||
[Rsc_DOCUMENT ] = {ActReqDatSeeDocCrs ,ActSeeAdmDocCrsGrp },
|
||||
[Rsc_MARKS ] = {ActReqDatSeeMrkCrs ,ActSeeAdmMrk },
|
||||
[Rsc_ATTENDANCE_EVENT] = {ActSeeOneAtt ,ActSeeAtt },
|
||||
[Rsc_FORUM_THREAD ] = {ActSeePstForCrsUsr ,ActSeeForCrsUsr },
|
||||
[Rsc_SURVEY ] = {ActSeeSvy ,ActSeeAllSvy },
|
||||
};
|
||||
static ParCod_Param_t ParCod[Rsc_NUM_TYPES] =
|
||||
{
|
||||
[Rsc_NONE ] = ParCod_None,
|
||||
[Rsc_ASSIGNMENT ] = ParCod_Asg,
|
||||
[Rsc_PROJECT ] = ParCod_Prj,
|
||||
[Rsc_CALL_FOR_EXAM ] = ParCod_Exa,
|
||||
[Rsc_EXAM ] = ParCod_Exa,
|
||||
[Rsc_GAME ] = ParCod_Gam,
|
||||
[Rsc_RUBRIC ] = ParCod_Rub,
|
||||
[Rsc_DOCUMENT ] = ParCod_Fil,
|
||||
[Rsc_MARKS ] = ParCod_Fil,
|
||||
[Rsc_ATTENDANCE_EVENT] = ParCod_Att,
|
||||
[Rsc_FORUM_THREAD ] = ParCod_Thr,
|
||||
[Rsc_SURVEY ] = ParCod_Svy,
|
||||
};
|
||||
Act_Action_t NextAction;
|
||||
char Title[Cns_MAX_BYTES_SUBJECT + 1];
|
||||
char *Anchor;
|
||||
|
||||
/***** Write link name *****/
|
||||
if (WriteLinkName[Link->Type])
|
||||
WriteLinkName[Link->Type] (Link->Cod,PutFormToGo,Icon,IconTitle);
|
||||
{
|
||||
GetResourceTitle[Link->Type] (Link->Cod,Title,sizeof (Title) - 1);
|
||||
|
||||
/***** Begin form to go to resource *****/
|
||||
if (PutFormToGo == Frm_PUT_FORM_TO_GO)
|
||||
{
|
||||
NextAction = (Link->Cod > 0) ? NextActions[Link->Type].IfCod : // Resource specified
|
||||
NextActions[Link->Type].IfNotCod; // All resources of this type
|
||||
if (FuncAnchor[Link->Type].Set)
|
||||
{
|
||||
FuncAnchor[Link->Type].Set (Link->Cod,&Anchor);
|
||||
Frm_BeginFormAnchor (NextAction,Anchor);
|
||||
FuncAnchor[Link->Type].Free (&Anchor);
|
||||
}
|
||||
else
|
||||
Frm_BeginForm (NextAction);
|
||||
|
||||
if (Link->Cod > 0)
|
||||
ParCod_PutPar (ParCod[Link->Type],Link->Cod);
|
||||
|
||||
HTM_BUTTON_Submit_Begin (Txt_Actions[NextAction],
|
||||
"class=\"LM BT_LINK PRG_LNK_%s\"",
|
||||
The_GetSuffix ());
|
||||
}
|
||||
|
||||
/***** Icon depending on type ******/
|
||||
switch (PutFormToGo)
|
||||
{
|
||||
case Frm_DONT_PUT_FORM_TO_GO:
|
||||
Ico_PutIconOn (Rsc_ResourceTypesIcons[Link->Type],Ico_BLACK,Txt_RESOURCE_TYPES[Link->Type]);
|
||||
break;
|
||||
case Frm_PUT_FORM_TO_GO:
|
||||
Ico_PutIconLink (Rsc_ResourceTypesIcons[Link->Type],Ico_BLACK,NextAction);
|
||||
break;
|
||||
}
|
||||
|
||||
/***** Write title of resource*****/
|
||||
HTM_Txt (Title);
|
||||
|
||||
/***** End form to download file *****/
|
||||
if (PutFormToGo == Frm_PUT_FORM_TO_GO)
|
||||
{
|
||||
HTM_BUTTON_End ();
|
||||
Frm_EndForm ();
|
||||
}
|
||||
}
|
||||
else
|
||||
Ale_ShowAlert (Ale_ERROR,"Not implemented!");
|
||||
}
|
||||
|
@ -276,6 +393,19 @@ void Rsc_WriteResourceEmpty (__attribute__((unused)) long Cod,
|
|||
HTM_Txt (Txt_RESOURCE_TYPES[Rsc_NONE]);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/******************** Write empty resource as resource ***********************/
|
||||
/*****************************************************************************/
|
||||
// The trailing null character is not counted in TitleSize
|
||||
|
||||
static void Rsc_GetResourceEmptyTitle (__attribute__((unused)) long Cod,
|
||||
char *Title,size_t TitleSize)
|
||||
{
|
||||
extern const char *Txt_RESOURCE_TYPES[Rsc_NUM_TYPES];
|
||||
|
||||
Str_Copy (Title,Txt_RESOURCE_TYPES[Rsc_NONE],TitleSize);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/************* Get the title for a new resource from link title **************/
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -78,8 +78,7 @@ void Rsc_ShowClipboard (void);
|
|||
void Rsc_ShowClipboardToChangeLink (const struct Rsc_Link *CurrentLink);
|
||||
void Rsc_WriteRowClipboard (const struct Rsc_Link *Link,
|
||||
HTM_SubmitOnClick_t SubmitOnClick,bool Checked);
|
||||
void Rsc_WriteLinkName (const struct Rsc_Link *Link,Frm_PutFormToGo_t PutFormToGo,
|
||||
const char *Icon,const char *IconTitle);
|
||||
void Rsc_WriteLinkName (const struct Rsc_Link *Link,Frm_PutFormToGo_t PutFormToGo);
|
||||
void Rsc_WriteResourceEmpty (__attribute__((unused)) long Cod,
|
||||
__attribute__((unused)) Frm_PutFormToGo_t PutFormToGo,
|
||||
const char *Icon,const char *IconTitle);
|
||||
|
|
|
@ -716,7 +716,7 @@ static void RubCri_ListOneOrMoreCriteriaForEdition (struct Rub_Rubrics *Rubrics,
|
|||
HTM_TR_End ();
|
||||
|
||||
/***** Free anchor string *****/
|
||||
Frm_FreeAnchorStr (Anchor);
|
||||
Frm_FreeAnchorStr (&Anchor);
|
||||
}
|
||||
|
||||
/***** End table *****/
|
||||
|
@ -1068,24 +1068,6 @@ static void RubCri_ExchangeCriteria (long RubCod,
|
|||
DB_UnlockTables ();
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/************************** Show criterion resource **************************/
|
||||
/*****************************************************************************/
|
||||
/*
|
||||
static void RubCri_ShowResource (struct Rub_Rubrics *Rubrics,
|
||||
const struct RubCri_Criterion *Criterion,
|
||||
bool Editing,const char *Anchor)
|
||||
{
|
||||
extern const char *Rsc_ResourceTypesIcons[Rsc_NUM_TYPES];
|
||||
extern const char *Txt_RESOURCE_TYPES[Rsc_NUM_TYPES];
|
||||
|
||||
Rsc_WriteLinkName (&Criterion->Link,
|
||||
true, // Put form to go
|
||||
Rsc_ResourceTypesIcons[Criterion->Link.Type],
|
||||
Txt_RESOURCE_TYPES[Criterion->Link.Type]);
|
||||
}
|
||||
*/
|
||||
|
||||
/*****************************************************************************/
|
||||
/***************** Show clipboard to change resource link ********************/
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -716,7 +716,7 @@ static void Svy_ShowOneSurvey (struct Svy_Surveys *Surveys,
|
|||
}
|
||||
|
||||
/***** Free anchor string *****/
|
||||
Frm_FreeAnchorStr (Anchor);
|
||||
Frm_FreeAnchorStr (&Anchor);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -736,7 +736,7 @@ static void Svy_PutIconsOneSvy (void *Surveys)
|
|||
Svy_PutFormsToRemEditOneSvy ((struct Svy_Surveys *) Surveys,Anchor);
|
||||
|
||||
/***** Free anchor string *****/
|
||||
Frm_FreeAnchorStr (Anchor);
|
||||
Frm_FreeAnchorStr (&Anchor);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -659,7 +659,7 @@ static void TmlNot_PutFormGoToAction (const struct TmlNot_Note *Not,
|
|||
Frm_SetAnchorStr (Not->Cod,&Anchor);
|
||||
Frm_BeginFormAnchor (Tml_DefaultActions[Not->Type],
|
||||
Anchor); // Locate on this specific exam
|
||||
Frm_FreeAnchorStr (Anchor);
|
||||
Frm_FreeAnchorStr (&Anchor);
|
||||
ParCod_PutPar (ParCod_Exa,Not->Cod);
|
||||
if (Not->HieCod != Gbl.Hierarchy.Crs.CrsCod) // Not the current course
|
||||
ParCod_PutPar (ParCod_Crs,Not->HieCod); // Go to another course
|
||||
|
@ -681,7 +681,7 @@ static void TmlNot_PutFormGoToAction (const struct TmlNot_Note *Not,
|
|||
case TmlNot_NOTICE:
|
||||
Frm_SetAnchorStr (Not->Cod,&Anchor);
|
||||
Frm_BeginFormAnchor (Tml_DefaultActions[Not->Type],Anchor);
|
||||
Frm_FreeAnchorStr (Anchor);
|
||||
Frm_FreeAnchorStr (&Anchor);
|
||||
ParCod_PutPar (ParCod_Not,Not->Cod);
|
||||
if (Not->HieCod != Gbl.Hierarchy.Crs.CrsCod) // Not the current course
|
||||
ParCod_PutPar (ParCod_Crs,Not->HieCod); // Go to another course
|
||||
|
|
Loading…
Reference in New Issue