mirror of https://github.com/acanas/swad-core.git
Version 22.81: Mar 26, 2023 New module swad_resource.
parent
d7b20db859
commit
f7ca97a096
6
Makefile
6
Makefile
|
@ -83,9 +83,9 @@ OBJS = swad_account.o swad_account_database.o swad_action.o swad_action_list.o \
|
|||
swad_question.o swad_question_database.o swad_question_import.o \
|
||||
swad_QR.o \
|
||||
swad_record.o swad_record_database.o swad_report.o \
|
||||
swad_report_database.o swad_role.o swad_role_database.o swad_room.o \
|
||||
swad_room_database.o swad_RSS.o swad_rubric.o swad_rubric_criteria.o \
|
||||
swad_rubric_database.o \
|
||||
swad_report_database.o swad_resource.o swad_role.o swad_role_database.o \
|
||||
swad_room.o swad_room_database.o swad_RSS.o swad_rubric.o \
|
||||
swad_rubric_criteria.o swad_rubric_database.o \
|
||||
swad_scope.o swad_search.o swad_session.o swad_session_database.o \
|
||||
swad_setting.o swad_setting_database.o swad_statistic.o \
|
||||
swad_statistic_database.o swad_string.o swad_survey.o \
|
||||
|
|
|
@ -850,7 +850,7 @@ const struct Act_Actions ActLst_Actions[ActLst_NUM_ACTIONS] =
|
|||
[ActUp_RubCri ] = {1962,-1,TabUnk,ActSeeAllRub ,0x238,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,RubCri_MoveUpCriterion ,NULL},
|
||||
[ActDwnRubCri ] = {1963,-1,TabUnk,ActSeeAllRub ,0x238,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,RubCri_MoveDownCriterion ,NULL},
|
||||
[ActChgTitRubCri ] = {1964,-1,TabUnk,ActSeeAllRub ,0x238,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,RubCri_ChangeTitle ,NULL},
|
||||
[ActChgSrcRubCri ] = {1968,-1,TabUnk,ActSeeAllRub ,0x238,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,RubCri_ChangeSource ,NULL},
|
||||
[ActChgSrcRubCri ] = {1968,-1,TabUnk,ActSeeAllRub ,0x238,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,RubCri_ChangeType ,NULL},
|
||||
[ActChgMinRubCri ] = {1965,-1,TabUnk,ActSeeAllRub ,0x238,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,RubCri_ChangeMinValue ,NULL},
|
||||
[ActChgMaxRubCri ] = {1966,-1,TabUnk,ActSeeAllRub ,0x238,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,RubCri_ChangeMaxValue ,NULL},
|
||||
[ActChgWeiRubCri ] = {1967,-1,TabUnk,ActSeeAllRub ,0x238,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,RubCri_ChangeWeight ,NULL},
|
||||
|
|
|
@ -50,7 +50,7 @@
|
|||
#include "swad_pagination.h"
|
||||
#include "swad_parameter_code.h"
|
||||
#include "swad_photo.h"
|
||||
#include "swad_program_resource.h"
|
||||
#include "swad_resource.h"
|
||||
#include "swad_role.h"
|
||||
#include "swad_setting.h"
|
||||
#include "swad_string.h"
|
||||
|
@ -302,7 +302,7 @@ static void Asg_PutIconsListAssignments (void *Assignments)
|
|||
Asg_PutIconToCreateNewAsg (Assignments);
|
||||
|
||||
/***** Link to get resource link *****/
|
||||
if (PrgRsc_CheckIfICanGetLink ())
|
||||
if (Rsc_CheckIfICanGetLink ())
|
||||
{
|
||||
((struct Asg_Assignments *) Assignments)->Asg.AsgCod = -1L;
|
||||
Ico_PutContextualIconToGetLink (ActReqLnkAsg,NULL,
|
||||
|
@ -748,7 +748,7 @@ static void Asg_PutIconsToRemEditOneAsg (struct Asg_Assignments *Assignments,
|
|||
Asg_PutPars,Assignments);
|
||||
|
||||
/***** Link to get resource link *****/
|
||||
if (PrgRsc_CheckIfICanGetLink ())
|
||||
if (Rsc_CheckIfICanGetLink ())
|
||||
Ico_PutContextualIconToGetLink (ActReqLnkAsg,NULL,
|
||||
Asg_PutPars,Assignments);
|
||||
/* falls through */
|
||||
|
|
|
@ -61,7 +61,7 @@ void AsgRsc_GetLinkToAssignment (void)
|
|||
AsgRsc_GetTitleFromAsgCod (Assignments.Asg.AsgCod,Title,sizeof (Title) - 1);
|
||||
|
||||
/***** Copy link to assignment into resource clipboard *****/
|
||||
Prg_DB_CopyToClipboard (PrgRsc_ASSIGNMENT,Assignments.Asg.AsgCod);
|
||||
Prg_DB_CopyToClipboard (Rsc_ASSIGNMENT,Assignments.Asg.AsgCod);
|
||||
|
||||
/***** Write sucess message *****/
|
||||
Ale_ShowAlert (Ale_SUCCESS,Txt_Link_to_resource_X_copied_into_clipboard,
|
||||
|
@ -76,11 +76,11 @@ void AsgRsc_GetLinkToAssignment (void)
|
|||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/********************* Write assignment in course program ********************/
|
||||
/************************ Write assignment as resource ***********************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void AsgRsc_WriteAssignmentInCrsProgram (long AsgCod,bool PutFormToGo,
|
||||
const char *Icon,const char *IconTitle)
|
||||
void AsgRsc_WriteResourceAssignment (long AsgCod,bool PutFormToGo,
|
||||
const char *Icon,const char *IconTitle)
|
||||
{
|
||||
extern const char *Txt_Actions[ActLst_NUM_ACTIONS];
|
||||
Act_Action_t NextAction;
|
||||
|
@ -115,9 +115,7 @@ void AsgRsc_WriteAssignmentInCrsProgram (long AsgCod,bool PutFormToGo,
|
|||
/***** End form to download file *****/
|
||||
if (PutFormToGo)
|
||||
{
|
||||
/* End form */
|
||||
HTM_BUTTON_End ();
|
||||
|
||||
Frm_EndForm ();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,8 +35,8 @@
|
|||
/*****************************************************************************/
|
||||
|
||||
void AsgRsc_GetLinkToAssignment (void);
|
||||
void AsgRsc_WriteAssignmentInCrsProgram (long AsgCod,bool PutFormToGo,
|
||||
const char *Icon,const char *IconTitle);
|
||||
void AsgRsc_WriteResourceAssignment (long AsgCod,bool PutFormToGo,
|
||||
const char *Icon,const char *IconTitle);
|
||||
void AsgRsc_GetTitleFromAsgCod (long AsgCod,char *Title,size_t TitleSize);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -50,8 +50,8 @@
|
|||
#include "swad_pagination.h"
|
||||
#include "swad_parameter.h"
|
||||
#include "swad_photo.h"
|
||||
#include "swad_program_database.h"
|
||||
#include "swad_QR.h"
|
||||
#include "swad_resource.h"
|
||||
#include "swad_setting.h"
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -375,7 +375,7 @@ static void Att_PutIconsInListOfEvents (void *Events)
|
|||
Usr_PutParMyUsrCodEncrypted,Gbl.Usrs.Me.UsrDat.EnUsrCod);
|
||||
|
||||
/***** Put icon to get resource link *****/
|
||||
if (PrgRsc_CheckIfICanGetLink ())
|
||||
if (Rsc_CheckIfICanGetLink ())
|
||||
Ico_PutContextualIconToGetLink (ActReqLnkAtt,NULL,
|
||||
Att_PutPars,Events);
|
||||
}
|
||||
|
@ -621,7 +621,7 @@ static void Att_PutFormsToRemEditOneEvent (struct Att_Events *Events,
|
|||
}
|
||||
|
||||
/***** Icon to get resource link *****/
|
||||
if (PrgRsc_CheckIfICanGetLink ())
|
||||
if (Rsc_CheckIfICanGetLink ())
|
||||
Ico_PutContextualIconToGetLink (ActReqLnkAtt,NULL,
|
||||
Att_PutPars,Events);
|
||||
}
|
||||
|
|
|
@ -51,7 +51,7 @@ void AttRsc_GetLinkToEvent (void)
|
|||
AttRsc_GetTitleFromAttCod (AttCod,Title,sizeof (Title) - 1);
|
||||
|
||||
/***** Copy link to attendance event into resource clipboard *****/
|
||||
Prg_DB_CopyToClipboard (PrgRsc_ATTENDANCE_EVENT,AttCod);
|
||||
Prg_DB_CopyToClipboard (Rsc_ATTENDANCE_EVENT,AttCod);
|
||||
|
||||
/***** Write sucess message *****/
|
||||
Ale_ShowAlert (Ale_SUCCESS,Txt_Link_to_resource_X_copied_into_clipboard,
|
||||
|
@ -62,11 +62,11 @@ void AttRsc_GetLinkToEvent (void)
|
|||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/**************** Write attendance event in course program *******************/
|
||||
/****************** Write attendance event as resource ***********************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void AttRsc_WriteEventInCrsProgram (long AttCod,bool PutFormToGo,
|
||||
const char *Icon,const char *IconTitle)
|
||||
void AttRsc_WriteResourceEvent (long AttCod,bool PutFormToGo,
|
||||
const char *Icon,const char *IconTitle)
|
||||
{
|
||||
extern const char *Txt_Actions[ActLst_NUM_ACTIONS];
|
||||
Act_Action_t NextAction;
|
||||
|
@ -100,9 +100,7 @@ void AttRsc_WriteEventInCrsProgram (long AttCod,bool PutFormToGo,
|
|||
/***** End form to download file *****/
|
||||
if (PutFormToGo)
|
||||
{
|
||||
/* End form */
|
||||
HTM_BUTTON_End ();
|
||||
|
||||
Frm_EndForm ();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,8 +34,8 @@
|
|||
/*****************************************************************************/
|
||||
|
||||
void AttRsc_GetLinkToEvent (void);
|
||||
void AttRsc_WriteEventInCrsProgram (long AttCod,bool PutFormToGo,
|
||||
const char *Icon,const char *IconTitle);
|
||||
void AttRsc_WriteResourceEvent (long AttCod,bool PutFormToGo,
|
||||
const char *Icon,const char *IconTitle);
|
||||
void AttRsc_GetTitleFromAttCod (long AttCod,char *Title,size_t TitleSize);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -68,9 +68,9 @@
|
|||
#include "swad_photo.h"
|
||||
#include "swad_profile.h"
|
||||
#include "swad_profile_database.h"
|
||||
#include "swad_program_database.h"
|
||||
#include "swad_project.h"
|
||||
#include "swad_project_database.h"
|
||||
#include "swad_resource.h"
|
||||
#include "swad_role.h"
|
||||
#include "swad_setting.h"
|
||||
#include "swad_setting_database.h"
|
||||
|
@ -3297,7 +3297,7 @@ static void Brw_PutIconsFileBrowser (__attribute__((unused)) void *Args)
|
|||
|
||||
/***** Put icon to get resource link *****/
|
||||
if (Brw_ActReqLnk[Gbl.FileBrowser.Type] != ActUnk &&
|
||||
PrgRsc_CheckIfICanGetLink ())
|
||||
Rsc_CheckIfICanGetLink ())
|
||||
Ico_PutContextualIconToGetLink (Brw_ActReqLnk[Gbl.FileBrowser.Type],NULL,
|
||||
NULL,NULL);
|
||||
|
||||
|
@ -7558,7 +7558,7 @@ void Brw_ShowFileMetadata (void)
|
|||
if (Brw_ActReqLnk[Gbl.FileBrowser.Type] != ActUnk &&
|
||||
(FileMetadata.FilFolLnk.Type == Brw_IS_FILE || // Only files or links
|
||||
FileMetadata.FilFolLnk.Type == Brw_IS_LINK) &&
|
||||
PrgRsc_CheckIfICanGetLink ())
|
||||
Rsc_CheckIfICanGetLink ())
|
||||
Box_BoxShadowBegin (NULL,NULL,
|
||||
Brw_PutIconToGetLinkToFile,&FileMetadata,
|
||||
NULL);
|
||||
|
|
|
@ -52,7 +52,7 @@ void BrwRsc_GetLinkToFile (void)
|
|||
extern const char *Txt_Link_to_resource_X_copied_into_clipboard;
|
||||
long FilCod;
|
||||
char Title[NAME_MAX + 1]; // File or link name
|
||||
PrgRsc_Type_t Type;
|
||||
Rsc_Type_t Type;
|
||||
|
||||
/***** Get parameters related to file browser *****/
|
||||
Brw_GetParAndInitFileBrowser ();
|
||||
|
@ -65,16 +65,16 @@ void BrwRsc_GetLinkToFile (void)
|
|||
{
|
||||
case ActReqLnkSeeDocCrs:
|
||||
case ActReqLnkAdmDocCrs:
|
||||
Type = PrgRsc_DOCUMENT;
|
||||
BrwRsc_GetDocTitleFromFilCod (FilCod,Title,sizeof (Title) - 1);
|
||||
Type = Rsc_DOCUMENT;
|
||||
BrwRsc_GetTitleFromDocFilCod (FilCod,Title,sizeof (Title) - 1);
|
||||
break;
|
||||
case ActReqLnkSeeMrkCrs:
|
||||
case ActReqLnkAdmMrkCrs:
|
||||
Type = PrgRsc_MARKS;
|
||||
BrwRsc_GetMrkTitleFromFilCod (FilCod,Title,sizeof (Title) - 1);
|
||||
Type = Rsc_MARKS;
|
||||
BrwRsc_GetTitleFromMrkFilCod (FilCod,Title,sizeof (Title) - 1);
|
||||
break;
|
||||
default:
|
||||
Type = PrgRsc_NONE; // Initialized to avoid warning
|
||||
Type = Rsc_NONE; // Initialized to avoid warning
|
||||
Err_WrongTypeExit ();
|
||||
break;
|
||||
}
|
||||
|
@ -91,11 +91,11 @@ void BrwRsc_GetLinkToFile (void)
|
|||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/******************** Write file name in course program **********************/
|
||||
/************************ Write document as resource *************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void BrwRsc_WriteDocFileNameInCrsProgram (long FilCod,bool PutFormToGo,
|
||||
const char *Icon,const char *IconTitle)
|
||||
void BrwRsc_WriteResourceDocument (long FilCod,bool PutFormToGo,
|
||||
const char *Icon,const char *IconTitle)
|
||||
{
|
||||
extern const char *Txt_Documents;
|
||||
extern const char *Txt_Actions[ActLst_NUM_ACTIONS];
|
||||
|
@ -166,17 +166,16 @@ void BrwRsc_WriteDocFileNameInCrsProgram (long FilCod,bool PutFormToGo,
|
|||
if (PutFormToGo)
|
||||
{
|
||||
HTM_BUTTON_End ();
|
||||
|
||||
Frm_EndForm ();
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/******************** Write file name in course program **********************/
|
||||
/************************ Write marks file as resource ***********************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void BrwRsc_WriteMrkFileNameInCrsProgram (long FilCod,bool PutFormToGo,
|
||||
const char *Icon,const char *IconTitle)
|
||||
void BrwRsc_WriteResourceMarksFile (long FilCod,bool PutFormToGo,
|
||||
const char *Icon,const char *IconTitle)
|
||||
{
|
||||
extern const char *Txt_Marks_area;
|
||||
extern const char *Txt_Actions[ActLst_NUM_ACTIONS];
|
||||
|
@ -227,7 +226,6 @@ void BrwRsc_WriteMrkFileNameInCrsProgram (long FilCod,bool PutFormToGo,
|
|||
if (PutFormToGo)
|
||||
{
|
||||
HTM_BUTTON_End ();
|
||||
|
||||
Frm_EndForm ();
|
||||
}
|
||||
}
|
||||
|
@ -237,7 +235,7 @@ void BrwRsc_WriteMrkFileNameInCrsProgram (long FilCod,bool PutFormToGo,
|
|||
/*****************************************************************************/
|
||||
// The trailing null character is not counted in TitleSize
|
||||
|
||||
void BrwRsc_GetDocTitleFromFilCod (long FilCod,char *Title,size_t TitleSize)
|
||||
void BrwRsc_GetTitleFromDocFilCod (long FilCod,char *Title,size_t TitleSize)
|
||||
{
|
||||
extern const char *Txt_Documents;
|
||||
struct Brw_FileMetadata FileMetadata;
|
||||
|
@ -261,7 +259,7 @@ void BrwRsc_GetDocTitleFromFilCod (long FilCod,char *Title,size_t TitleSize)
|
|||
/*****************************************************************************/
|
||||
// The trailing null character is not counted in TitleSize
|
||||
|
||||
void BrwRsc_GetMrkTitleFromFilCod (long FilCod,char *Title,size_t TitleSize)
|
||||
void BrwRsc_GetTitleFromMrkFilCod (long FilCod,char *Title,size_t TitleSize)
|
||||
{
|
||||
extern const char *Txt_Marks_area;
|
||||
struct Brw_FileMetadata FileMetadata;
|
||||
|
|
|
@ -34,11 +34,11 @@
|
|||
/*****************************************************************************/
|
||||
|
||||
void BrwRsc_GetLinkToFile (void);
|
||||
void BrwRsc_WriteDocFileNameInCrsProgram (long FilCod,bool PutFormToGo,
|
||||
const char *Icon,const char *IconTitle);
|
||||
void BrwRsc_WriteMrkFileNameInCrsProgram (long FilCod,bool PutFormToGo,
|
||||
const char *Icon,const char *IconTitle);
|
||||
void BrwRsc_GetDocTitleFromFilCod (long FilCod,char *Title,size_t TitleSize);
|
||||
void BrwRsc_GetMrkTitleFromFilCod (long FilCod,char *Title,size_t TitleSize);
|
||||
void BrwRsc_WriteResourceDocument (long FilCod,bool PutFormToGo,
|
||||
const char *Icon,const char *IconTitle);
|
||||
void BrwRsc_WriteResourceMarksFile (long FilCod,bool PutFormToGo,
|
||||
const char *Icon,const char *IconTitle);
|
||||
void BrwRsc_GetTitleFromDocFilCod (long FilCod,char *Title,size_t TitleSize);
|
||||
void BrwRsc_GetTitleFromMrkFilCod (long FilCod,char *Title,size_t TitleSize);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -684,7 +684,7 @@ static void Cfe_PutIconsCallsForExams (__attribute__((unused)) void *Args)
|
|||
Ico_PutContextualIconToAdd (ActEdiCfe,NULL,NULL,NULL);
|
||||
|
||||
/***** Icon to get resource link *****/
|
||||
if (PrgRsc_CheckIfICanGetLink ())
|
||||
if (Rsc_CheckIfICanGetLink ())
|
||||
Ico_PutContextualIconToGetLink (ActReqLnkCfe,NULL,
|
||||
NULL,NULL);
|
||||
}
|
||||
|
@ -1518,7 +1518,7 @@ static void Cfe_PutIconsCallForExam (void *CallsForExams)
|
|||
&((struct Cfe_CallsForExams *) CallsForExams)->ExaCod);
|
||||
|
||||
/***** Link to get resource link *****/
|
||||
if (PrgRsc_CheckIfICanGetLink ())
|
||||
if (Rsc_CheckIfICanGetLink ())
|
||||
Ico_PutContextualIconToGetLink (ActReqLnkCfe,NULL,
|
||||
Cfe_PutParExaCod,
|
||||
&((struct Cfe_CallsForExams *) CallsForExams)->ExaCod);
|
||||
|
|
|
@ -52,7 +52,7 @@ void Cfe_GetLinkToCallForExam (void)
|
|||
CfeRsc_GetTitleFromExaCod (ExaCod,Title,sizeof (Title) - 1);
|
||||
|
||||
/***** Copy link to call for exam into resource clipboard *****/
|
||||
Prg_DB_CopyToClipboard (PrgRsc_CALL_FOR_EXAM,ExaCod);
|
||||
Prg_DB_CopyToClipboard (Rsc_CALL_FOR_EXAM,ExaCod);
|
||||
|
||||
/***** Write sucess message *****/
|
||||
Ale_ShowAlert (Ale_SUCCESS,Txt_Link_to_resource_X_copied_into_clipboard,
|
||||
|
@ -67,11 +67,11 @@ void Cfe_GetLinkToCallForExam (void)
|
|||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/******************* Write call for exam in course program *******************/
|
||||
/********************** Write call for exam as resource **********************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void CfeRsc_WriteCallForExamInCrsProgram (long ExaCod,bool PutFormToGo,
|
||||
const char *Icon,const char *IconTitle)
|
||||
void CfeRsc_WriteResourceCallForExam (long ExaCod,bool PutFormToGo,
|
||||
const char *Icon,const char *IconTitle)
|
||||
{
|
||||
extern const char *Txt_Actions[ActLst_NUM_ACTIONS];
|
||||
Act_Action_t NextAction;
|
||||
|
@ -112,9 +112,7 @@ void CfeRsc_WriteCallForExamInCrsProgram (long ExaCod,bool PutFormToGo,
|
|||
/***** End form to download file *****/
|
||||
if (PutFormToGo)
|
||||
{
|
||||
/* End form */
|
||||
HTM_BUTTON_End ();
|
||||
|
||||
Frm_EndForm ();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,8 +34,8 @@
|
|||
/*****************************************************************************/
|
||||
|
||||
void Cfe_GetLinkToCallForExam (void);
|
||||
void CfeRsc_WriteCallForExamInCrsProgram (long ExaCod,bool PutFormToGo,
|
||||
const char *Icon,const char *IconTitle);
|
||||
void CfeRsc_WriteResourceCallForExam (long ExaCod,bool PutFormToGo,
|
||||
const char *Icon,const char *IconTitle);
|
||||
void CfeRsc_GetTitleFromExaCod (long ExaCod,char *Title,size_t TitleSize);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -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.80 (2023-03-25)"
|
||||
#define Log_PLATFORM_VERSION "SWAD 22.81 (2023-03-26)"
|
||||
#define CSS_FILE "swad22.78.15.css"
|
||||
#define JS_FILE "swad22.49.js"
|
||||
/*
|
||||
Version 22.81: Mar 26, 2023 New module swad_resource. (337946 lines)
|
||||
Version 22.80: Mar 25, 2023 Resources in rubric criteria. Not finished. (338110 lines)
|
||||
Version 22.79.3: Mar 24, 2023 Translation of some actions. (337938 lines)
|
||||
Version 22.79.2: Mar 24, 2023 Code refactoring in rubrics. (337937 lines)
|
||||
|
|
|
@ -2593,7 +2593,7 @@ mysql> DESCRIBE prg_resources;
|
|||
"'mrk',"
|
||||
"'att',"
|
||||
"'for') NOT NULL DEFAULT 'non',"
|
||||
"Title VARCHAR(2047) NOT NULL," // PrgRsc_MAX_BYTES_PROGRAM_RESOURCE_TITLE
|
||||
"Title VARCHAR(2047) NOT NULL," // Rsc_MAX_BYTES_RESOURCE_TITLE
|
||||
"UNIQUE INDEX(RscCod),"
|
||||
"UNIQUE INDEX(ItmCod,RscInd))");
|
||||
|
||||
|
|
|
@ -353,7 +353,7 @@ static void Exa_PutIconsListExams (void *Exams)
|
|||
NULL,NULL);
|
||||
|
||||
/***** Link to get resource link *****/
|
||||
if (PrgRsc_CheckIfICanGetLink ())
|
||||
if (Rsc_CheckIfICanGetLink ())
|
||||
Ico_PutContextualIconToGetLink (ActReqLnkExa,NULL,
|
||||
Exa_PutPars,Exams);
|
||||
|
||||
|
@ -702,7 +702,7 @@ static void Exa_PutIconsToRemEditOneExam (struct Exa_Exams *Exams,
|
|||
Exa_PutPars,Exams);
|
||||
|
||||
/***** Link to get resource link *****/
|
||||
if (PrgRsc_CheckIfICanGetLink ())
|
||||
if (Rsc_CheckIfICanGetLink ())
|
||||
Ico_PutContextualIconToGetLink (ActReqLnkExa,NULL,
|
||||
Exa_PutPars,Exams);
|
||||
}
|
||||
|
|
|
@ -55,7 +55,7 @@ void ExaRsc_GetLinkToExam (void)
|
|||
ExaRsc_GetTitleFromExaCod (Exams.Exam.ExaCod,Title,sizeof (Title) - 1);
|
||||
|
||||
/***** Copy link to exam into resource clipboard *****/
|
||||
Prg_DB_CopyToClipboard (PrgRsc_EXAM,Exams.Exam.ExaCod);
|
||||
Prg_DB_CopyToClipboard (Rsc_EXAM,Exams.Exam.ExaCod);
|
||||
|
||||
/***** Write sucess message *****/
|
||||
Ale_ShowAlert (Ale_SUCCESS,Txt_Link_to_resource_X_copied_into_clipboard,
|
||||
|
@ -66,11 +66,11 @@ void ExaRsc_GetLinkToExam (void)
|
|||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/*********************** Write exam in course program ************************/
|
||||
/**************************** Write exam as resource *************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void ExaRsc_WriteExamInCrsProgram (long ExaCod,bool PutFormToGo,
|
||||
const char *Icon,const char *IconTitle)
|
||||
void ExaRsc_WriteResourceExam (long ExaCod,bool PutFormToGo,
|
||||
const char *Icon,const char *IconTitle)
|
||||
{
|
||||
extern const char *Txt_Actions[ActLst_NUM_ACTIONS];
|
||||
Act_Action_t NextAction;
|
||||
|
@ -103,9 +103,7 @@ void ExaRsc_WriteExamInCrsProgram (long ExaCod,bool PutFormToGo,
|
|||
/***** End form to download file *****/
|
||||
if (PutFormToGo)
|
||||
{
|
||||
/* End form */
|
||||
HTM_BUTTON_End ();
|
||||
|
||||
Frm_EndForm ();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,8 +34,8 @@
|
|||
/*****************************************************************************/
|
||||
|
||||
void ExaRsc_GetLinkToExam (void);
|
||||
void ExaRsc_WriteExamInCrsProgram (long ExaCod,bool PutFormToGo,
|
||||
const char *Icon,const char *IconTitle);
|
||||
void ExaRsc_WriteResourceExam (long ExaCod,bool PutFormToGo,
|
||||
const char *Icon,const char *IconTitle);
|
||||
void ExaRsc_GetTitleFromExaCod (long ExaCod,char *Title,size_t TitleSize);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -831,7 +831,7 @@ static void For_PutIconsOneThread (void *Forums)
|
|||
|
||||
/***** Put icon to get resource link *****/
|
||||
if (((struct For_Forums *) Forums)->Forum.Type == For_FORUM_COURSE_USRS &&
|
||||
PrgRsc_CheckIfICanGetLink ())
|
||||
Rsc_CheckIfICanGetLink ())
|
||||
Ico_PutContextualIconToGetLink (ActReqLnkForCrsUsr,NULL,
|
||||
For_PutParsNewPost,Forums);
|
||||
}
|
||||
|
@ -2112,7 +2112,7 @@ static void For_PutIconsThreads (void *Forums)
|
|||
|
||||
/***** Put icon to get resource link *****/
|
||||
if (((struct For_Forums *) Forums)->Forum.Type == For_FORUM_COURSE_USRS &&
|
||||
PrgRsc_CheckIfICanGetLink ())
|
||||
Rsc_CheckIfICanGetLink ())
|
||||
Ico_PutContextualIconToGetLink (ActReqLnkForCrsUsr,NULL,
|
||||
For_PutParsNewPost,Forums);
|
||||
}
|
||||
|
|
|
@ -59,7 +59,7 @@ void ForRsc_GetLinkToThread (void)
|
|||
ForRsc_GetTitleFromThrCod (Forums.Thread.Current,Subject,sizeof (Subject) - 1);
|
||||
|
||||
/***** Copy link to thread into resource clipboard *****/
|
||||
Prg_DB_CopyToClipboard (PrgRsc_FORUM_THREAD,Forums.Thread.Current);
|
||||
Prg_DB_CopyToClipboard (Rsc_FORUM_THREAD,Forums.Thread.Current);
|
||||
|
||||
/***** Write sucess message *****/
|
||||
Ale_ShowAlert (Ale_SUCCESS,Txt_Link_to_resource_X_copied_into_clipboard,
|
||||
|
@ -76,11 +76,11 @@ void ForRsc_GetLinkToThread (void)
|
|||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/***************** Write thread subject in course program ********************/
|
||||
/************************ Write thread as resource ***************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void ForRsc_WriteThreadInCrsProgram (long ThrCod,bool PutFormToGo,
|
||||
const char *Icon,const char *IconTitle)
|
||||
void ForRsc_WriteResourceThread (long ThrCod,bool PutFormToGo,
|
||||
const char *Icon,const char *IconTitle)
|
||||
{
|
||||
extern const char *Txt_Actions[ActLst_NUM_ACTIONS];
|
||||
Act_Action_t NextAction;
|
||||
|
@ -123,9 +123,7 @@ void ForRsc_WriteThreadInCrsProgram (long ThrCod,bool PutFormToGo,
|
|||
/***** End form to download file *****/
|
||||
if (PutFormToGo)
|
||||
{
|
||||
/* End form */
|
||||
HTM_BUTTON_End ();
|
||||
|
||||
Frm_EndForm ();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,8 +34,8 @@
|
|||
/*****************************************************************************/
|
||||
|
||||
void ForRsc_GetLinkToThread (void);
|
||||
void ForRsc_WriteThreadInCrsProgram (long ThrCod,bool PutFormToGo,
|
||||
const char *Icon,const char *IconTitle);
|
||||
void ForRsc_WriteResourceThread (long ThrCod,bool PutFormToGo,
|
||||
const char *Icon,const char *IconTitle);
|
||||
void ForRsc_GetTitleFromThrCod (long ThrCod,char *Title,size_t TitleSize);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -392,7 +392,7 @@ static void Gam_PutIconsListGames (void *Games)
|
|||
NULL,NULL);
|
||||
|
||||
/***** Link to get resource link *****/
|
||||
if (PrgRsc_CheckIfICanGetLink ())
|
||||
if (Rsc_CheckIfICanGetLink ())
|
||||
Ico_PutContextualIconToGetLink (ActReqLnkGam,NULL,
|
||||
Gam_PutPars,Games);
|
||||
|
||||
|
@ -757,7 +757,7 @@ static void Gam_PutIconsToRemEditOneGame (struct Gam_Games *Games,
|
|||
Gam_PutPars,Games);
|
||||
|
||||
/***** Link to get resource link *****/
|
||||
if (PrgRsc_CheckIfICanGetLink ())
|
||||
if (Rsc_CheckIfICanGetLink ())
|
||||
Ico_PutContextualIconToGetLink (ActReqLnkGam,NULL,
|
||||
Gam_PutPars,Games);
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@ void GamRsc_GetLinkToGame (void)
|
|||
GamRsc_GetTitleFromGamCod (GamCod,Title,sizeof (Title) - 1);
|
||||
|
||||
/***** Copy link to game into resource clipboard *****/
|
||||
Prg_DB_CopyToClipboard (PrgRsc_GAME,GamCod);
|
||||
Prg_DB_CopyToClipboard (Rsc_GAME,GamCod);
|
||||
|
||||
/***** Write sucess message *****/
|
||||
Ale_ShowAlert (Ale_SUCCESS,Txt_Link_to_resource_X_copied_into_clipboard,
|
||||
|
@ -67,11 +67,11 @@ void GamRsc_GetLinkToGame (void)
|
|||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/*********************** Write game in course program ************************/
|
||||
/************************** Write game as resource ***************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void GamRsc_WriteGameInCrsProgram (long GamCod,bool PutFormToGo,
|
||||
const char *Icon,const char *IconTitle)
|
||||
void GamRsc_WriteResourceGame (long GamCod,bool PutFormToGo,
|
||||
const char *Icon,const char *IconTitle)
|
||||
{
|
||||
extern const char *Txt_Actions[ActLst_NUM_ACTIONS];
|
||||
Act_Action_t NextAction;
|
||||
|
@ -104,9 +104,7 @@ void GamRsc_WriteGameInCrsProgram (long GamCod,bool PutFormToGo,
|
|||
/***** End form to go to game *****/
|
||||
if (PutFormToGo)
|
||||
{
|
||||
/* End form */
|
||||
HTM_BUTTON_End ();
|
||||
|
||||
Frm_EndForm ();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,8 +34,8 @@
|
|||
/*****************************************************************************/
|
||||
|
||||
void GamRsc_GetLinkToGame (void);
|
||||
void GamRsc_WriteGameInCrsProgram (long GamCod,bool PutFormToGo,
|
||||
const char *Icon,const char *IconTitle);
|
||||
void GamRsc_WriteResourceGame (long GamCod,bool PutFormToGo,
|
||||
const char *Icon,const char *IconTitle);
|
||||
void GamRsc_GetTitleFromGamCod (long GamCod,char *Title,size_t TitleSize);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1322,7 +1322,7 @@ void Prg_ResetResource (struct Prg_Item *Item)
|
|||
Item->Resource.Hierarchy.RscCod = -1L;
|
||||
Item->Resource.Hierarchy.RscInd = 0;
|
||||
Item->Resource.Hierarchy.Hidden = false;
|
||||
Item->Resource.Link.Type = PrgRsc_NONE;
|
||||
Item->Resource.Link.Type = Rsc_NONE;
|
||||
Item->Resource.Link.Cod = -1L;
|
||||
Item->Resource.Title[0] = '\0';
|
||||
Item->Resource.Title[0] = '\0';
|
||||
|
|
|
@ -32,14 +32,12 @@
|
|||
|
||||
#include "swad_database.h"
|
||||
#include "swad_date.h"
|
||||
#include "swad_resource.h"
|
||||
|
||||
/*****************************************************************************/
|
||||
/************************** Public types and constants ***********************/
|
||||
/*****************************************************************************/
|
||||
|
||||
#define PrgRsc_MAX_CHARS_PROGRAM_RESOURCE_TITLE (128 - 1) // 127
|
||||
#define PrgRsc_MAX_BYTES_PROGRAM_RESOURCE_TITLE ((PrgRsc_MAX_CHARS_PROGRAM_RESOURCE_TITLE + 1) * Str_MAX_BYTES_PER_CHAR - 1) // 2047
|
||||
|
||||
struct Prg_ResourceHierarchy
|
||||
{
|
||||
long RscCod;
|
||||
|
@ -47,35 +45,6 @@ struct Prg_ResourceHierarchy
|
|||
bool Hidden;
|
||||
};
|
||||
|
||||
#define PrgRsc_NUM_TYPES 11
|
||||
typedef enum
|
||||
{
|
||||
PrgRsc_NONE,
|
||||
// gui TEACHING_GUIDE // Link to teaching guide
|
||||
// bib BIBLIOGRAPHY // Link to bibliography
|
||||
// faq FAQ // Link to FAQ
|
||||
// lnk LINKS // Link to links
|
||||
// tmt TIMETABLE // Link to timetable
|
||||
PrgRsc_ASSIGNMENT,
|
||||
PrgRsc_PROJECT, // A project is only for some students
|
||||
PrgRsc_CALL_FOR_EXAM,
|
||||
// tst TEST // User selects tags, teacher should select
|
||||
PrgRsc_EXAM,
|
||||
PrgRsc_GAME,
|
||||
PrgRsc_SURVEY,
|
||||
PrgRsc_DOCUMENT,
|
||||
PrgRsc_MARKS,
|
||||
// grp GROUPS // ??? User select groups
|
||||
PrgRsc_ATTENDANCE_EVENT,
|
||||
PrgRsc_FORUM_THREAD,
|
||||
} PrgRsc_Type_t;
|
||||
|
||||
struct PrgRsc_Link
|
||||
{
|
||||
PrgRsc_Type_t Type;
|
||||
long Cod;
|
||||
};
|
||||
|
||||
#define Prg_MAX_CHARS_PROGRAM_ITEM_TITLE (128 - 1) // 127
|
||||
#define Prg_MAX_BYTES_PROGRAM_ITEM_TITLE ((Prg_MAX_CHARS_PROGRAM_ITEM_TITLE + 1) * Str_MAX_BYTES_PER_CHAR - 1) // 2047
|
||||
|
||||
|
@ -98,8 +67,8 @@ struct Prg_Item
|
|||
struct
|
||||
{
|
||||
struct Prg_ResourceHierarchy Hierarchy;
|
||||
struct PrgRsc_Link Link;
|
||||
char Title[PrgRsc_MAX_BYTES_PROGRAM_RESOURCE_TITLE + 1];
|
||||
struct Rsc_Link Link;
|
||||
char Title[Rsc_MAX_BYTES_RESOURCE_TITLE + 1];
|
||||
} Resource;
|
||||
};
|
||||
|
||||
|
|
|
@ -34,26 +34,26 @@
|
|||
/**************************** Private constants ******************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
const char *Prg_ResourceTypesDB[PrgRsc_NUM_TYPES] =
|
||||
const char *Rsc_ResourceTypesDB[Rsc_NUM_TYPES] =
|
||||
{
|
||||
[PrgRsc_NONE ] = "non",
|
||||
[Rsc_NONE ] = "non",
|
||||
// gui TEACHING_GUIDE // Link to teaching guide
|
||||
// bib BIBLIOGRAPHY // Link to bibliography
|
||||
// faq FAQ // Link to FAQ
|
||||
// lnk LINKS // Link to links
|
||||
// tmt TIMETABLE // Link to timetable
|
||||
[PrgRsc_ASSIGNMENT ] = "asg",
|
||||
[PrgRsc_PROJECT ] = "prj",
|
||||
[PrgRsc_CALL_FOR_EXAM ] = "cfe",
|
||||
[Rsc_ASSIGNMENT ] = "asg",
|
||||
[Rsc_PROJECT ] = "prj",
|
||||
[Rsc_CALL_FOR_EXAM ] = "cfe",
|
||||
// tst TEST // User selects tags, teacher should select
|
||||
[PrgRsc_EXAM ] = "exa",
|
||||
[PrgRsc_GAME ] = "gam",
|
||||
[PrgRsc_SURVEY ] = "svy",
|
||||
[PrgRsc_DOCUMENT ] = "doc",
|
||||
[PrgRsc_MARKS ] = "mrk",
|
||||
[Rsc_EXAM ] = "exa",
|
||||
[Rsc_GAME ] = "gam",
|
||||
[Rsc_SURVEY ] = "svy",
|
||||
[Rsc_DOCUMENT ] = "doc",
|
||||
[Rsc_MARKS ] = "mrk",
|
||||
// grp GROUPS // ??? User select groups
|
||||
[PrgRsc_ATTENDANCE_EVENT] = "att",
|
||||
[PrgRsc_FORUM_THREAD ] = "for",
|
||||
[Rsc_ATTENDANCE_EVENT] = "att",
|
||||
[Rsc_FORUM_THREAD ] = "for",
|
||||
};
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -474,7 +474,7 @@ long Prg_DB_CreateResource (const struct Prg_Item *Item)
|
|||
/*****************************************************************************/
|
||||
|
||||
void Prg_DB_UpdateResourceTitle (long ItmCod,long RscCod,
|
||||
const char NewTitle[PrgRsc_MAX_BYTES_PROGRAM_RESOURCE_TITLE + 1])
|
||||
const char NewTitle[Rsc_MAX_BYTES_RESOURCE_TITLE + 1])
|
||||
{
|
||||
DB_QueryUPDATE ("can not update the title of a resource",
|
||||
"UPDATE prg_resources,"
|
||||
|
@ -663,7 +663,7 @@ void Prg_DB_UpdateRscLink (const struct Prg_Item *Item)
|
|||
" SET Type='%s',"
|
||||
"Cod=%ld"
|
||||
" WHERE RscCod=%ld",
|
||||
Prg_ResourceTypesDB[Item->Resource.Link.Type],
|
||||
Rsc_ResourceTypesDB[Item->Resource.Link.Type],
|
||||
Item->Resource.Link.Cod,
|
||||
Item->Resource.Hierarchy.RscCod);
|
||||
}
|
||||
|
@ -672,7 +672,7 @@ void Prg_DB_UpdateRscLink (const struct Prg_Item *Item)
|
|||
/********************** Copy link to resource into clipboard *****************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Prg_DB_CopyToClipboard (PrgRsc_Type_t Type,long Cod)
|
||||
void Prg_DB_CopyToClipboard (Rsc_Type_t Type,long Cod)
|
||||
{
|
||||
DB_QueryREPLACE ("can not copy link to resource clipboard",
|
||||
"REPLACE INTO prg_clipboards"
|
||||
|
@ -681,7 +681,7 @@ void Prg_DB_CopyToClipboard (PrgRsc_Type_t Type,long Cod)
|
|||
" (%ld,%ld,'%s',%ld,NOW())",
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||
Gbl.Hierarchy.Crs.CrsCod,
|
||||
Prg_ResourceTypesDB[Type],
|
||||
Rsc_ResourceTypesDB[Type],
|
||||
Cod);
|
||||
}
|
||||
|
||||
|
@ -707,7 +707,7 @@ unsigned Prg_DB_GetClipboard (MYSQL_RES **mysql_res)
|
|||
/*************************** Remove link from clipboard **********************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Prg_DB_RemoveLinkFromClipboard (struct PrgRsc_Link *Link)
|
||||
void Prg_DB_RemoveLinkFromClipboard (struct Rsc_Link *Link)
|
||||
{
|
||||
DB_QueryDELETE ("can not remove link from clipboard",
|
||||
"DELETE FROM prg_clipboards"
|
||||
|
@ -717,7 +717,7 @@ void Prg_DB_RemoveLinkFromClipboard (struct PrgRsc_Link *Link)
|
|||
" AND Cod=%ld",
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||
Gbl.Hierarchy.Crs.CrsCod,
|
||||
Prg_ResourceTypesDB[Link->Type],
|
||||
Rsc_ResourceTypesDB[Link->Type],
|
||||
Link->Cod);
|
||||
}
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@ void Prg_DB_RemoveCrsItems (long CrsCod);
|
|||
long Prg_DB_CreateResource (const struct Prg_Item *Item);
|
||||
|
||||
void Prg_DB_UpdateResourceTitle (long ItmCod,long RscCod,
|
||||
const char NewTitle[PrgRsc_MAX_BYTES_PROGRAM_RESOURCE_TITLE + 1]);
|
||||
const char NewTitle[Rsc_MAX_BYTES_RESOURCE_TITLE + 1]);
|
||||
|
||||
unsigned Prg_DB_GetListResources (MYSQL_RES **mysql_res,long ItmCod,
|
||||
bool ShowHiddenResources);
|
||||
|
@ -77,9 +77,9 @@ void Prg_DB_LockTableResources (void);
|
|||
void Prg_DB_UpdateRscInd (long RscCod,int RscInd);
|
||||
void Prg_DB_UpdateRscLink (const struct Prg_Item *Item);
|
||||
|
||||
void Prg_DB_CopyToClipboard (PrgRsc_Type_t Type,long Cod);
|
||||
void Prg_DB_CopyToClipboard (Rsc_Type_t Type,long Cod);
|
||||
unsigned Prg_DB_GetClipboard (MYSQL_RES **mysql_res);
|
||||
void Prg_DB_RemoveLinkFromClipboard (struct PrgRsc_Link *Link);
|
||||
void Prg_DB_RemoveLinkFromClipboard (struct Rsc_Link *Link);
|
||||
|
||||
void Prg_DB_InsertItemInExpandedItems (long ItmCod);
|
||||
bool Prg_DB_GetIfExpandedItem (long ItmCod);
|
||||
|
|
|
@ -26,60 +26,24 @@
|
|||
/*****************************************************************************/
|
||||
|
||||
#define _GNU_SOURCE // For asprintf
|
||||
#include <mysql/mysql.h> // To access MySQL databases
|
||||
#include <stdio.h> // For asprintf
|
||||
#include <stdlib.h> // For free
|
||||
#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"
|
||||
#include "swad_box.h"
|
||||
#include "swad_browser_resource.h"
|
||||
#include "swad_call_for_exam_resource.h"
|
||||
#include "swad_button.h"
|
||||
#include "swad_error.h"
|
||||
#include "swad_exam_resource.h"
|
||||
#include "swad_form.h"
|
||||
#include "swad_forum_resource.h"
|
||||
#include "swad_game_resource.h"
|
||||
#include "swad_global.h"
|
||||
#include "swad_parameter.h"
|
||||
#include "swad_parameter_code.h"
|
||||
#include "swad_program.h"
|
||||
#include "swad_program_database.h"
|
||||
#include "swad_program_resource.h"
|
||||
#include "swad_project_resource.h"
|
||||
#include "swad_survey_resource.h"
|
||||
|
||||
/*****************************************************************************/
|
||||
/**************************** Private constants ******************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
const char *Prg_ResourceTypesIcons[PrgRsc_NUM_TYPES] =
|
||||
{
|
||||
[PrgRsc_NONE ] = "link-slash.svg",
|
||||
// gui TEACHING_GUIDE // Link to teaching guide
|
||||
// bib BIBLIOGRAPHY // Link to bibliography
|
||||
// faq FAQ // Link to FAQ
|
||||
// lnk LINKS // Link to links
|
||||
// tmt TIMETABLE // Link to timetable
|
||||
[PrgRsc_ASSIGNMENT ] = "edit.svg",
|
||||
[PrgRsc_PROJECT ] = "file-invoice.svg",
|
||||
[PrgRsc_CALL_FOR_EXAM ] = "bullhorn.svg",
|
||||
// tst TEST // User selects tags, teacher should select
|
||||
[PrgRsc_EXAM ] = "file-signature.svg",
|
||||
[PrgRsc_GAME ] = "gamepad.svg",
|
||||
[PrgRsc_SURVEY ] = "poll.svg",
|
||||
[PrgRsc_DOCUMENT ] = "folder-open.svg",
|
||||
[PrgRsc_MARKS ] = "list-alt.svg",
|
||||
// grp GROUPS // ??? User select groups
|
||||
[PrgRsc_ATTENDANCE_EVENT] = "calendar-check.svg",
|
||||
[PrgRsc_FORUM_THREAD ] = "comments.svg",
|
||||
};
|
||||
|
||||
/*****************************************************************************/
|
||||
/************** External global variables from others modules ****************/
|
||||
/*****************************************************************************/
|
||||
/****************************************************************************/
|
||||
|
||||
extern struct Globals Gbl;
|
||||
|
||||
|
@ -126,15 +90,6 @@ static bool PrgRsc_ExchangeResources (const struct Prg_ResourceHierarchy *Rsc1,
|
|||
const struct Prg_ResourceHierarchy *Rsc2);
|
||||
|
||||
static void PrgRsc_ShowClipboard (struct Prg_Item *Item);
|
||||
static void PrgRsc_WriteRowClipboard (bool SubmitOnClick,const struct PrgRsc_Link *Link);
|
||||
static void PrgRsc_WriteLinkName (const struct PrgRsc_Link *Link,bool PutFormToGo,
|
||||
const char *Icon,const char *IconTitle);
|
||||
static void PrgRsc_WriteEmptyLinkInCrsProgram (__attribute__((unused)) long Cod,
|
||||
__attribute__((unused)) bool PutFormToGo,
|
||||
const char *Icon,const char *IconTitle);
|
||||
static void PrgRsc_GetResourceTitleFromLink (struct Prg_Item *Item);
|
||||
static void PrgRsc_GetLinkDataFromRow (MYSQL_RES *mysql_res,
|
||||
struct PrgRsc_Link *Link);
|
||||
|
||||
/*****************************************************************************/
|
||||
/****************************** View resources *******************************/
|
||||
|
@ -396,7 +351,7 @@ static void PrgRsc_GetResourceDataFromRow (MYSQL_RES *mysql_res,
|
|||
Item->Resource.Hierarchy.Hidden = (row[3][0] == 'Y');
|
||||
|
||||
/***** Get link type and code (row[4], row[5]) *****/
|
||||
Item->Resource.Link.Type = PrgRsc_GetTypeFromString (row[4]);
|
||||
Item->Resource.Link.Type = Rsc_GetTypeFromString (row[4]);
|
||||
Item->Resource.Link.Cod = Str_ConvertStrCodToLongCod (row[5]);
|
||||
|
||||
/***** Get the title of the item resource (row[6]) *****/
|
||||
|
@ -410,7 +365,8 @@ static void PrgRsc_GetResourceDataFromRow (MYSQL_RES *mysql_res,
|
|||
static void PrgRsc_WriteRowViewResource (unsigned NumRsc,
|
||||
const struct Prg_Item *Item)
|
||||
{
|
||||
extern const char *Txt_RESOURCE_TYPES[PrgRsc_NUM_TYPES];
|
||||
extern const char *Rsc_ResourceTypesIcons[Rsc_NUM_TYPES];
|
||||
extern const char *Txt_RESOURCE_TYPES[Rsc_NUM_TYPES];
|
||||
|
||||
/***** Begin row *****/
|
||||
HTM_TR_Begin (NULL);
|
||||
|
@ -426,9 +382,9 @@ static void PrgRsc_WriteRowViewResource (unsigned NumRsc,
|
|||
The_GetSuffix (),The_GetColorRows1 (1));
|
||||
HTM_Txt (Item->Resource.Title);
|
||||
HTM_BR ();
|
||||
PrgRsc_WriteLinkName (&Item->Resource.Link,
|
||||
Rsc_WriteLinkName (&Item->Resource.Link,
|
||||
true, // Put form
|
||||
Prg_ResourceTypesIcons[Item->Resource.Link.Type],
|
||||
Rsc_ResourceTypesIcons[Item->Resource.Link.Type],
|
||||
Txt_RESOURCE_TYPES[Item->Resource.Link.Type]);
|
||||
HTM_TD_End ();
|
||||
|
||||
|
@ -443,7 +399,8 @@ static void PrgRsc_WriteRowViewResource (unsigned NumRsc,
|
|||
static void PrgRsc_WriteRowEditResource (unsigned NumRsc,unsigned NumResources,
|
||||
struct Prg_Item *Item,bool EditLink)
|
||||
{
|
||||
extern const char *Txt_RESOURCE_TYPES[PrgRsc_NUM_TYPES];
|
||||
extern const char *Rsc_ResourceTypesIcons[Rsc_NUM_TYPES];
|
||||
extern const char *Txt_RESOURCE_TYPES[Rsc_NUM_TYPES];
|
||||
|
||||
/***** Begin row *****/
|
||||
HTM_TR_Begin (NULL);
|
||||
|
@ -466,7 +423,7 @@ static void PrgRsc_WriteRowEditResource (unsigned NumRsc,unsigned NumResources,
|
|||
/* Title */
|
||||
Frm_BeginFormAnchor (ActRenPrgRsc,PrgRsc_RESOURCE_SECTION_ID);
|
||||
ParCod_PutPar (ParCod_Rsc,Item->Resource.Hierarchy.RscCod);
|
||||
HTM_INPUT_TEXT ("Title",PrgRsc_MAX_CHARS_PROGRAM_RESOURCE_TITLE,Item->Resource.Title,
|
||||
HTM_INPUT_TEXT ("Title",Rsc_MAX_CHARS_RESOURCE_TITLE,Item->Resource.Title,
|
||||
HTM_SUBMIT_ON_CHANGE,
|
||||
"class=\"PRG_RSC_INPUT INPUT_%s\"",
|
||||
The_GetSuffix ());
|
||||
|
@ -480,10 +437,10 @@ static void PrgRsc_WriteRowEditResource (unsigned NumRsc,unsigned NumResources,
|
|||
PrgRsc_ShowClipboard (Item);
|
||||
else
|
||||
/* Show current link */
|
||||
PrgRsc_WriteLinkName (&Item->Resource.Link,
|
||||
true, // Put form
|
||||
Prg_ResourceTypesIcons[Item->Resource.Link.Type],
|
||||
Txt_RESOURCE_TYPES[Item->Resource.Link.Type]);
|
||||
Rsc_WriteLinkName (&Item->Resource.Link,
|
||||
true, // Put form
|
||||
Rsc_ResourceTypesIcons[Item->Resource.Link.Type],
|
||||
Txt_RESOURCE_TYPES[Item->Resource.Link.Type]);
|
||||
|
||||
HTM_TD_End ();
|
||||
|
||||
|
@ -520,7 +477,7 @@ static void PrgRsc_WriteRowNewResource (unsigned NumResources,
|
|||
/* Title */
|
||||
Frm_BeginFormAnchor (ActNewPrgRsc,PrgRsc_RESOURCE_SECTION_ID);
|
||||
ParCod_PutPar (ParCod_Itm,Item->Hierarchy.ItmCod);
|
||||
HTM_INPUT_TEXT ("Title",PrgRsc_MAX_CHARS_PROGRAM_RESOURCE_TITLE,"",
|
||||
HTM_INPUT_TEXT ("Title",Rsc_MAX_CHARS_RESOURCE_TITLE,"",
|
||||
HTM_SUBMIT_ON_CHANGE,
|
||||
"placeholder=\"%s\""
|
||||
" class=\"PRG_RSC_INPUT INPUT_%s\"",
|
||||
|
@ -636,7 +593,7 @@ void PrgRsc_CreateResource (void)
|
|||
Prg_GetPars (&Item);
|
||||
|
||||
/* Get the new title for the new resource */
|
||||
Par_GetParText ("Title",Item.Resource.Title,PrgRsc_MAX_BYTES_PROGRAM_RESOURCE_TITLE);
|
||||
Par_GetParText ("Title",Item.Resource.Title,Rsc_MAX_BYTES_RESOURCE_TITLE);
|
||||
|
||||
/***** Create resource *****/
|
||||
Item.Resource.Hierarchy.RscCod = Prg_DB_CreateResource (&Item);
|
||||
|
@ -655,7 +612,7 @@ void PrgRsc_CreateResource (void)
|
|||
void PrgRsc_RenameResource (void)
|
||||
{
|
||||
struct Prg_Item Item;
|
||||
char NewTitle[PrgRsc_MAX_BYTES_PROGRAM_RESOURCE_TITLE + 1];
|
||||
char NewTitle[Rsc_MAX_BYTES_RESOURCE_TITLE + 1];
|
||||
|
||||
/***** Get list of program items *****/
|
||||
Prg_GetListItems ();
|
||||
|
@ -667,7 +624,7 @@ void PrgRsc_RenameResource (void)
|
|||
|
||||
/***** Rename resource *****/
|
||||
/* Get the new title for the resource */
|
||||
Par_GetParText ("Title",NewTitle,PrgRsc_MAX_BYTES_PROGRAM_RESOURCE_TITLE);
|
||||
Par_GetParText ("Title",NewTitle,Rsc_MAX_BYTES_RESOURCE_TITLE);
|
||||
|
||||
/* Update database changing old title by new title */
|
||||
Prg_DB_UpdateResourceTitle (Item.Hierarchy.ItmCod,Item.Resource.Hierarchy.RscCod,NewTitle);
|
||||
|
@ -907,10 +864,10 @@ static void PrgRsc_ShowClipboard (struct Prg_Item *Item)
|
|||
MYSQL_RES *mysql_res;
|
||||
unsigned NumLink;
|
||||
unsigned NumLinks;
|
||||
struct PrgRsc_Link Link;
|
||||
static const struct PrgRsc_Link EmptyLink =
|
||||
struct Rsc_Link Link;
|
||||
static const struct Rsc_Link EmptyLink =
|
||||
{
|
||||
.Type = PrgRsc_NONE,
|
||||
.Type = Rsc_NONE,
|
||||
.Cod = -1L,
|
||||
};
|
||||
|
||||
|
@ -926,11 +883,11 @@ static void PrgRsc_ShowClipboard (struct Prg_Item *Item)
|
|||
HTM_UL_Begin ("class=\"PRG_CLIPBOARD\"");
|
||||
|
||||
/***** Current link (empty or not) *****/
|
||||
PrgRsc_WriteRowClipboard (false,&Item->Resource.Link);
|
||||
Rsc_WriteRowClipboard (false,&Item->Resource.Link);
|
||||
|
||||
/***** Row with empty link to remove the current link *****/
|
||||
if (Item->Resource.Link.Type != PrgRsc_NONE)
|
||||
PrgRsc_WriteRowClipboard (true,&EmptyLink);
|
||||
if (Item->Resource.Link.Type != Rsc_NONE)
|
||||
Rsc_WriteRowClipboard (true,&EmptyLink);
|
||||
|
||||
/***** Get links in clipboard from database and write them *****/
|
||||
NumLinks = Prg_DB_GetClipboard (&mysql_res);
|
||||
|
@ -938,8 +895,8 @@ static void PrgRsc_ShowClipboard (struct Prg_Item *Item)
|
|||
NumLink <= NumLinks;
|
||||
NumLink++)
|
||||
{
|
||||
PrgRsc_GetLinkDataFromRow (mysql_res,&Link);
|
||||
PrgRsc_WriteRowClipboard (true,&Link);
|
||||
Rsc_GetLinkDataFromRow (mysql_res,&Link);
|
||||
Rsc_WriteRowClipboard (true,&Link);
|
||||
}
|
||||
DB_FreeMySQLResult (&mysql_res);
|
||||
|
||||
|
@ -950,116 +907,6 @@ static void PrgRsc_ShowClipboard (struct Prg_Item *Item)
|
|||
Frm_EndForm ();
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/************************ Show one link from clipboard ***********************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void PrgRsc_WriteRowClipboard (bool SubmitOnClick,const struct PrgRsc_Link *Link)
|
||||
{
|
||||
extern const char *Prg_ResourceTypesDB[PrgRsc_NUM_TYPES];
|
||||
extern const char *Txt_RESOURCE_TYPES[PrgRsc_NUM_TYPES];
|
||||
|
||||
HTM_LI_Begin ("class=\"PRG_RSC_%s\"",The_GetSuffix ());
|
||||
HTM_LABEL_Begin (NULL);
|
||||
|
||||
/***** Radio selector *****/
|
||||
HTM_INPUT_RADIO ("Link",SubmitOnClick,
|
||||
"value=\"%s_%ld\"%s",
|
||||
Prg_ResourceTypesDB[Link->Type],Link->Cod,
|
||||
SubmitOnClick ? "" :
|
||||
" checked=\"checked\"");
|
||||
|
||||
/***** Name *****/
|
||||
PrgRsc_WriteLinkName (Link,
|
||||
false, // Don't put form
|
||||
Prg_ResourceTypesIcons[Link->Type],
|
||||
Txt_RESOURCE_TYPES[Link->Type]);
|
||||
|
||||
HTM_LABEL_End ();
|
||||
HTM_LI_End ();
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/************* Write link name (filename, assignment title...) ***************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void PrgRsc_WriteLinkName (const struct PrgRsc_Link *Link,bool PutFormToGo,
|
||||
const char *Icon,const char *IconTitle)
|
||||
{
|
||||
static void (*WriteLinkName[PrgRsc_NUM_TYPES]) (long Cod,bool PutFormToGo,
|
||||
const char *Icon,
|
||||
const char *IconTitle) =
|
||||
{
|
||||
[PrgRsc_NONE ] = PrgRsc_WriteEmptyLinkInCrsProgram,
|
||||
[PrgRsc_ASSIGNMENT ] = AsgRsc_WriteAssignmentInCrsProgram,
|
||||
[PrgRsc_PROJECT ] = PrjRsc_WriteProjectInCrsProgram,
|
||||
[PrgRsc_CALL_FOR_EXAM ] = CfeRsc_WriteCallForExamInCrsProgram,
|
||||
[PrgRsc_EXAM ] = ExaRsc_WriteExamInCrsProgram,
|
||||
[PrgRsc_GAME ] = GamRsc_WriteGameInCrsProgram,
|
||||
[PrgRsc_SURVEY ] = SvyRsc_WriteSurveyInCrsProgram,
|
||||
[PrgRsc_DOCUMENT ] = BrwRsc_WriteDocFileNameInCrsProgram,
|
||||
[PrgRsc_MARKS ] = BrwRsc_WriteMrkFileNameInCrsProgram,
|
||||
[PrgRsc_ATTENDANCE_EVENT] = AttRsc_WriteEventInCrsProgram,
|
||||
[PrgRsc_FORUM_THREAD ] = ForRsc_WriteThreadInCrsProgram,
|
||||
};
|
||||
|
||||
/***** Write link name *****/
|
||||
if (WriteLinkName[Link->Type])
|
||||
WriteLinkName[Link->Type] (Link->Cod,PutFormToGo,Icon,IconTitle);
|
||||
else
|
||||
Ale_ShowAlert (Ale_ERROR,"Not implemented!");
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/******************** Write empty link in course program *********************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void PrgRsc_WriteEmptyLinkInCrsProgram (__attribute__((unused)) long Cod,
|
||||
__attribute__((unused)) bool PutFormToGo,
|
||||
const char *Icon,const char *IconTitle)
|
||||
{
|
||||
extern const char *Txt_RESOURCE_TYPES[PrgRsc_NUM_TYPES];
|
||||
|
||||
/***** Icon depending on type ******/
|
||||
Ico_PutIconOn (Icon,Ico_BLACK,IconTitle);
|
||||
|
||||
/***** Write text *****/
|
||||
HTM_Txt (Txt_RESOURCE_TYPES[PrgRsc_NONE]);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/************* Get the title for a new resource from link title **************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void PrgRsc_GetResourceTitleFromLink (struct Prg_Item *Item)
|
||||
{
|
||||
static void (*GetTitle[PrgRsc_NUM_TYPES]) (long Cod,char *Title,size_t TitleSize) =
|
||||
{
|
||||
[PrgRsc_NONE ] = NULL,
|
||||
[PrgRsc_ASSIGNMENT ] = AsgRsc_GetTitleFromAsgCod,
|
||||
[PrgRsc_PROJECT ] = PrjRsc_GetTitleFromPrjCod,
|
||||
[PrgRsc_CALL_FOR_EXAM ] = CfeRsc_GetTitleFromExaCod,
|
||||
[PrgRsc_EXAM ] = ExaRsc_GetTitleFromExaCod,
|
||||
[PrgRsc_GAME ] = GamRsc_GetTitleFromGamCod,
|
||||
[PrgRsc_SURVEY ] = SvyRsc_GetTitleFromSvyCod,
|
||||
[PrgRsc_DOCUMENT ] = BrwRsc_GetDocTitleFromFilCod,
|
||||
[PrgRsc_MARKS ] = BrwRsc_GetMrkTitleFromFilCod,
|
||||
[PrgRsc_ATTENDANCE_EVENT] = AttRsc_GetTitleFromAttCod,
|
||||
[PrgRsc_FORUM_THREAD ] = ForRsc_GetTitleFromThrCod,
|
||||
};
|
||||
|
||||
/***** Reset title *****/
|
||||
Item->Resource.Title[0] = '\0';
|
||||
|
||||
/***** Get title *****/
|
||||
if (GetTitle[Item->Resource.Link.Type])
|
||||
GetTitle[Item->Resource.Link.Type] (Item->Resource.Link.Cod,
|
||||
Item->Resource.Title,
|
||||
sizeof (Item->Resource.Title) - 1);
|
||||
else
|
||||
Ale_ShowAlert (Ale_ERROR,"Not implemented!");
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/***************** Show clipboard to change resource link ********************/
|
||||
/*****************************************************************************/
|
||||
|
@ -1084,7 +931,7 @@ void PrgRsc_ChangeLink (void)
|
|||
Par_GetParText ("Link",TypeCod,sizeof (TypeCod) - 1);
|
||||
if (sscanf (TypeCod,"%3s_%ld",TypeStr,&Cod) == 2)
|
||||
{
|
||||
Item.Resource.Link.Type = PrgRsc_GetTypeFromString (TypeStr);
|
||||
Item.Resource.Link.Type = Rsc_GetTypeFromString (TypeStr);
|
||||
Item.Resource.Link.Cod = Cod;
|
||||
|
||||
/***** Is it an existing resource? *****/
|
||||
|
@ -1092,7 +939,8 @@ void PrgRsc_ChangeLink (void)
|
|||
{
|
||||
/* No resource selected, so it's a new resource at the end of the item */
|
||||
/* Get the new title for the new resource from link title */
|
||||
PrgRsc_GetResourceTitleFromLink (&Item);
|
||||
Rsc_GetResourceTitleFromLink (&Item.Resource.Link,
|
||||
Item.Resource.Title);
|
||||
|
||||
/***** Create resource *****/
|
||||
Item.Resource.Hierarchy.RscCod = Prg_DB_CreateResource (&Item);
|
||||
|
@ -1111,59 +959,3 @@ void PrgRsc_ChangeLink (void)
|
|||
/***** Free list of program items *****/
|
||||
Prg_FreeListItems ();
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/********************** Get resource data from clipboard *********************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void PrgRsc_GetLinkDataFromRow (MYSQL_RES *mysql_res,
|
||||
struct PrgRsc_Link *Link)
|
||||
{
|
||||
MYSQL_ROW row;
|
||||
|
||||
/***** Get row *****/
|
||||
row = mysql_fetch_row (mysql_res);
|
||||
/*
|
||||
Type row[0]
|
||||
Cod row[1]
|
||||
*/
|
||||
/***** Get type (row[0]) *****/
|
||||
Link->Type = PrgRsc_GetTypeFromString (row[0]);
|
||||
|
||||
/***** Get code (row[1]) *****/
|
||||
Link->Cod = Str_ConvertStrCodToLongCod (row[1]);
|
||||
}
|
||||
|
||||
< |