From 4a2849d4359b733479d87ee00f05328214b34deb Mon Sep 17 00:00:00 2001 From: acanas Date: Thu, 6 Apr 2023 20:18:42 +0200 Subject: [PATCH] Version 22.92.1: Apr 06, 2023 Removed unused code in resources. --- swad_action_list.c | 2 +- swad_assignment_resource.c | 48 ----------- swad_assignment_resource.h | 5 -- swad_attendance_resource.c | 49 ----------- swad_attendance_resource.h | 4 - swad_browser_resource.c | 155 ---------------------------------- swad_browser_resource.h | 4 - swad_call_for_exam_resource.c | 59 +------------ swad_call_for_exam_resource.h | 4 +- swad_changelog.h | 3 +- swad_exam_resource.c | 49 ----------- swad_exam_resource.h | 4 - swad_forum_resource.c | 56 ------------ swad_forum_resource.h | 2 - swad_game_resource.c | 49 ----------- swad_game_resource.h | 2 - swad_project_resource.c | 49 ----------- swad_project_resource.h | 2 - swad_resource.c | 98 ++++++--------------- swad_resource.h | 3 - swad_rubric_resource.c | 49 ----------- swad_rubric_resource.h | 2 - swad_survey_resource.c | 48 ----------- swad_survey_resource.h | 2 - 24 files changed, 33 insertions(+), 715 deletions(-) diff --git a/swad_action_list.c b/swad_action_list.c index 964d447f6..5d2429938 100644 --- a/swad_action_list.c +++ b/swad_action_list.c @@ -697,7 +697,7 @@ const struct Act_Actions ActLst_Actions[ActLst_NUM_ACTIONS] = [ActRemCfe ] = { 187,-1,TabUnk,ActSeeAllCfe ,0x220,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,Cfe_RemoveCallForExam1 ,Cfe_RemoveCallForExam2 ,NULL}, [ActHidCfe ] = {1620,-1,TabUnk,ActSeeAllCfe ,0x220,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,Cfe_HideCallForExam ,Cfe_ListCallsForExamsEdit ,NULL}, [ActUnhCfe ] = {1621,-1,TabUnk,ActSeeAllCfe ,0x220,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,Cfe_UnhideCallForExam ,Cfe_ListCallsForExamsEdit ,NULL}, - [ActReqLnkCfe ] = {1934,-1,TabUnk,ActSeeAllCfe ,0x220,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Cfe_GetLinkToCallForExam ,NULL}, + [ActReqLnkCfe ] = {1934,-1,TabUnk,ActSeeAllCfe ,0x220,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,CfeRsc_GetLinkToCallForExam ,NULL}, [ActEdiOneTstQst ] = { 105,-1,TabUnk,ActEdiTstQst ,0x220,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Qst_ShowFormEditOneQst ,NULL}, [ActReqImpTstQst ] = {1007,-1,TabUnk,ActEdiTstQst ,0x220,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,QstImp_ShowFormImpQstsFromXML ,NULL}, diff --git a/swad_assignment_resource.c b/swad_assignment_resource.c index d4da23405..9d14071b1 100644 --- a/swad_assignment_resource.c +++ b/swad_assignment_resource.c @@ -75,54 +75,6 @@ void AsgRsc_GetLinkToAssignment (void) Asg_ShowAllAssignments (&Assignments); } -/*****************************************************************************/ -/************************ Write assignment as resource ***********************/ -/*****************************************************************************/ - -void AsgRsc_WriteResourceAssignment (long AsgCod,Frm_PutFormToGo_t PutFormToGo, - const char *Icon,const char *IconTitle) - { - extern const char *Txt_Actions[ActLst_NUM_ACTIONS]; - Act_Action_t NextAction; - char Title[Asg_MAX_BYTES_ASSIGNMENT_TITLE + 1]; - - /***** Get assignment title *****/ - AsgRsc_GetTitleFromAsgCod (AsgCod,Title,sizeof (Title) - 1); - - /***** Begin form to go to assignment *****/ - if (PutFormToGo == Frm_PUT_FORM_TO_GO) - { - NextAction = (AsgCod > 0) ? ActSeeOneAsg : // Assignment specified - ActSeeAsg; // All assignments - Frm_BeginForm (NextAction); - ParCod_PutPar (ParCod_Asg,AsgCod); - 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 (Icon,Ico_BLACK,IconTitle); - break; - case Frm_PUT_FORM_TO_GO: - Ico_PutIconLink (Icon,Ico_BLACK,NextAction); - break; - } - - /***** Write assignment title of exam *****/ - HTM_Txt (Title); - - /***** End form to download file *****/ - if (PutFormToGo == Frm_PUT_FORM_TO_GO) - { - HTM_BUTTON_End (); - Frm_EndForm (); - } - } - /*****************************************************************************/ /**************** Get assignment title from assignment code ******************/ /*****************************************************************************/ diff --git a/swad_assignment_resource.h b/swad_assignment_resource.h index 3fb8e4e23..4f5375d08 100644 --- a/swad_assignment_resource.h +++ b/swad_assignment_resource.h @@ -27,18 +27,13 @@ /********************************* Headers ***********************************/ /*****************************************************************************/ -#include // For boolean type #include // For size_t -#include "swad_form.h" - /*****************************************************************************/ /***************************** Public prototypes *****************************/ /*****************************************************************************/ void AsgRsc_GetLinkToAssignment (void); -void AsgRsc_WriteResourceAssignment (long AsgCod,Frm_PutFormToGo_t PutFormToGo, - const char *Icon,const char *IconTitle); void AsgRsc_GetTitleFromAsgCod (long AsgCod,char *Title,size_t TitleSize); #endif diff --git a/swad_attendance_resource.c b/swad_attendance_resource.c index 916a64087..2b9e84ebb 100644 --- a/swad_attendance_resource.c +++ b/swad_attendance_resource.c @@ -30,7 +30,6 @@ #include "swad_attendance_database.h" #include "swad_attendance_resource.h" #include "swad_error.h" -#include "swad_form.h" #include "swad_parameter_code.h" #include "swad_resource_database.h" @@ -61,54 +60,6 @@ void AttRsc_GetLinkToEvent (void) Att_SeeEvents (); } -/*****************************************************************************/ -/****************** Write attendance event as resource ***********************/ -/*****************************************************************************/ - -void AttRsc_WriteResourceEvent (long AttCod,Frm_PutFormToGo_t PutFormToGo, - const char *Icon,const char *IconTitle) - { - extern const char *Txt_Actions[ActLst_NUM_ACTIONS]; - Act_Action_t NextAction; - char Title[Att_MAX_BYTES_ATTENDANCE_EVENT_TITLE + 1]; - - /***** Get game title *****/ - AttRsc_GetTitleFromAttCod (AttCod,Title,sizeof (Title) - 1); - - /***** Begin form to go to game *****/ - if (PutFormToGo == Frm_PUT_FORM_TO_GO) - { - NextAction = (AttCod > 0) ? ActSeeOneAtt : // Attendance events specified - ActSeeAtt; // All attendance events - Frm_BeginForm (NextAction); - ParCod_PutPar (ParCod_Att,AttCod); - 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 (Icon,Ico_BLACK,IconTitle); - break; - case Frm_PUT_FORM_TO_GO: - Ico_PutIconLink (Icon,Ico_BLACK,NextAction); - break; - } - - /***** Write attendance event title *****/ - HTM_Txt (Title); - - /***** End form to download file *****/ - if (PutFormToGo == Frm_PUT_FORM_TO_GO) - { - HTM_BUTTON_End (); - Frm_EndForm (); - } - } - /*****************************************************************************/ /*************** Get attendance event title from game code *******************/ /*****************************************************************************/ diff --git a/swad_attendance_resource.h b/swad_attendance_resource.h index eea90a83c..7e5b91120 100644 --- a/swad_attendance_resource.h +++ b/swad_attendance_resource.h @@ -29,15 +29,11 @@ #include // For size_t -#include "swad_form.h" - /*****************************************************************************/ /***************************** Public prototypes *****************************/ /*****************************************************************************/ void AttRsc_GetLinkToEvent (void); -void AttRsc_WriteResourceEvent (long AttCod,Frm_PutFormToGo_t PutFormToGo, - const char *Icon,const char *IconTitle); void AttRsc_GetTitleFromAttCod (long AttCod,char *Title,size_t TitleSize); #endif diff --git a/swad_browser_resource.c b/swad_browser_resource.c index 6685c2f15..01e8f15ef 100644 --- a/swad_browser_resource.c +++ b/swad_browser_resource.c @@ -32,7 +32,6 @@ #include "swad_browser.h" #include "swad_browser_resource.h" #include "swad_error.h" -#include "swad_form.h" #include "swad_global.h" #include "swad_parameter_code.h" #include "swad_resource_database.h" @@ -99,160 +98,6 @@ void BrwRsc_GetLinkToMrkFil (void) Brw_ShowAgainFileBrowserOrWorks (); } -/*****************************************************************************/ -/************************ Write document as resource *************************/ -/*****************************************************************************/ - -void BrwRsc_WriteResourceDocument (long FilCod,Frm_PutFormToGo_t PutFormToGo, - const char *Icon,const char *IconTitle) - { - extern const char *Txt_Documents; - extern const char *Txt_Actions[ActLst_NUM_ACTIONS]; - Act_Action_t NextAction = ActUnk; // Initialized to avoid warning - struct Brw_FileMetadata FileMetadata; - char Title[NAME_MAX + 1]; // File or link name - - /***** Get file metadata *****/ - FileMetadata.FilCod = FilCod; - if (FileMetadata.FilCod > 0) - Brw_GetFileMetadataByCod (&FileMetadata); - // If file doesn't exist ==> file code is changed to -1 - - /***** Set title *****/ - if (FileMetadata.FilCod > 0) - /***** Copy file name into title *****/ - Str_Copy (Title,FileMetadata.FilFolLnk.Name,sizeof (Title) - 1); - else - /***** Generic title for all documents *****/ - Str_Copy (Title,Txt_Documents,sizeof (Title) - 1); - - /***** Begin form to go to file data *****/ - if (PutFormToGo == Frm_PUT_FORM_TO_GO) - { - NextAction = (FileMetadata.FilCod > 0) ? ActReqDatSeeDocCrs : // Document specified - ActSeeAdmDocCrsGrp; // All documents - Frm_BeginForm (NextAction); - if (FileMetadata.FilCod > 0) - Brw_PutParsFileBrowser (NULL, // Not used - NULL, // Not used - Brw_IS_UNKNOWN, // Not used - FileMetadata.FilCod); - HTM_BUTTON_Submit_Begin (Txt_Actions[NextAction], - "class=\"LM BT_LINK PRG_LNK_%s\"", - The_GetSuffix ()); - } - - /***** Icon depending on type ******/ - if (FileMetadata.FilCod > 0) - switch (FileMetadata.FilFolLnk.Type) - { - case Brw_IS_FILE: - Brw_PutIconFile (FileMetadata.FilFolLnk.Name, - "CONTEXT_OPT ICO_HIGHLIGHT CONTEXT_ICO16x16", - PutFormToGo); // Put link to view metadata? - break; - case Brw_IS_LINK: - switch (PutFormToGo) - { - case Frm_DONT_PUT_FORM_TO_GO: - Ico_PutIconOn ("up-right-from-square.svg",Ico_BLACK,IconTitle); - break; - case Frm_PUT_FORM_TO_GO: - Ico_PutIconLink ("up-right-from-square.svg",Ico_BLACK,NextAction); - break; - } - - break; - default: - break; - } - else // Documents zone - switch (PutFormToGo) - { - case Frm_DONT_PUT_FORM_TO_GO: - Ico_PutIconOn (Icon,Ico_BLACK,IconTitle); - break; - case Frm_PUT_FORM_TO_GO: - Ico_PutIconLink (Icon,Ico_BLACK,NextAction); - break; - } - - /***** Write title *****/ - HTM_Txt (Title); - - /***** End form to download file *****/ - if (PutFormToGo == Frm_PUT_FORM_TO_GO) - { - HTM_BUTTON_End (); - Frm_EndForm (); - } - } - -/*****************************************************************************/ -/************************ Write marks file as resource ***********************/ -/*****************************************************************************/ - -void BrwRsc_WriteResourceMarksFile (long FilCod,Frm_PutFormToGo_t PutFormToGo, - const char *Icon,const char *IconTitle) - { - extern const char *Txt_Marks_area; - extern const char *Txt_Actions[ActLst_NUM_ACTIONS]; - Act_Action_t NextAction; - struct Brw_FileMetadata FileMetadata; - char Title[NAME_MAX + 1]; // File or link name - - /***** Get file metadata *****/ - FileMetadata.FilCod = FilCod; - if (FileMetadata.FilCod > 0) - Brw_GetFileMetadataByCod (&FileMetadata); - // If file doesn't exist ==> file code is changed to -1 - - /***** Set title *****/ - if (FileMetadata.FilCod > 0) - /***** Copy file name into title *****/ - Str_Copy (Title,FileMetadata.FilFolLnk.Name,sizeof (Title) - 1); - else - /***** Generic title for all documents *****/ - Str_Copy (Title,Txt_Marks_area,sizeof (Title) - 1); - - /***** Begin form to go to file data *****/ - if (PutFormToGo == Frm_PUT_FORM_TO_GO) - { - NextAction = (FileMetadata.FilCod > 0) ? ActReqDatSeeMrkCrs : // Marks file specified - ActSeeAdmMrk; // All marks files - Frm_BeginForm (NextAction); - if (FileMetadata.FilCod > 0) - Brw_PutParsFileBrowser (NULL, // Not used - NULL, // Not used - Brw_IS_UNKNOWN, // Not used - FileMetadata.FilCod); - 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 (Icon,Ico_BLACK,IconTitle); - break; - case Frm_PUT_FORM_TO_GO: - Ico_PutIconLink (Icon,Ico_BLACK,NextAction); - break; - } - - /***** Write filename *****/ - HTM_Txt (Title); - - /***** End form to download file *****/ - if (PutFormToGo == Frm_PUT_FORM_TO_GO) - { - HTM_BUTTON_End (); - Frm_EndForm (); - } - } - /*****************************************************************************/ /********************** Get file name from file code *************************/ /*****************************************************************************/ diff --git a/swad_browser_resource.h b/swad_browser_resource.h index a2961c1ab..963f67b9f 100644 --- a/swad_browser_resource.h +++ b/swad_browser_resource.h @@ -35,10 +35,6 @@ 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, - 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); diff --git a/swad_call_for_exam_resource.c b/swad_call_for_exam_resource.c index 7eeedc6dd..ac4ccb40c 100644 --- a/swad_call_for_exam_resource.c +++ b/swad_call_for_exam_resource.c @@ -30,7 +30,6 @@ #include "swad_call_for_exam.h" #include "swad_call_for_exam_resource.h" #include "swad_error.h" -#include "swad_form.h" #include "swad_parameter_code.h" #include "swad_resource_database.h" @@ -38,7 +37,7 @@ /************************ Get link to call for exam **************************/ /*****************************************************************************/ -void Cfe_GetLinkToCallForExam (void) +void CfeRsc_GetLinkToCallForExam (void) { extern const char *Txt_Link_to_resource_X_copied_into_clipboard; struct Cfe_CallsForExams *CallsForExams = Cfe_GetGlobalCallsForExams (); @@ -66,62 +65,6 @@ void Cfe_GetLinkToCallForExam (void) Cfe_ListCallsForExamsEdit (); } -/*****************************************************************************/ -/********************** Write call for exam as resource **********************/ -/*****************************************************************************/ - -void CfeRsc_WriteResourceCallForExam (long ExaCod,Frm_PutFormToGo_t PutFormToGo, - const char *Icon,const char *IconTitle) - { - extern const char *Txt_Actions[ActLst_NUM_ACTIONS]; - Act_Action_t NextAction; - char Title[Cfe_MAX_BYTES_SESSION_AND_DATE]; - char *Anchor = NULL; - - /***** Get session and date of the exam *****/ - CfeRsc_GetTitleFromExaCod (ExaCod,Title,sizeof (Title) - 1); - - /***** Begin form to download file *****/ - if (PutFormToGo == Frm_PUT_FORM_TO_GO) - { - /* Build anchor string */ - Frm_SetAnchorStr (ExaCod,&Anchor); - - /* Begin form */ - NextAction = (ExaCod > 0) ? ActSeeOneCfe : // Call for exam specified - ActSeeAllCfe; // All calls for exams - Frm_BeginFormAnchor (NextAction,Anchor); - ParCod_PutPar (ParCod_Exa,ExaCod); - HTM_BUTTON_Submit_Begin (Txt_Actions[NextAction], - "class=\"LM BT_LINK PRG_LNK_%s\"", - The_GetSuffix ()); - - /* Free anchor string */ - Frm_FreeAnchorStr (&Anchor); - } - - /***** Icon depending on type ******/ - switch (PutFormToGo) - { - case Frm_DONT_PUT_FORM_TO_GO: - Ico_PutIconOn (Icon,Ico_BLACK,IconTitle); - break; - case Frm_PUT_FORM_TO_GO: - Ico_PutIconLink (Icon,Ico_BLACK,NextAction); - break; - } - - /***** Write title of call for exam *****/ - HTM_Txt (Title); - - /***** End form to download file *****/ - if (PutFormToGo == Frm_PUT_FORM_TO_GO) - { - HTM_BUTTON_End (); - Frm_EndForm (); - } - } - /*****************************************************************************/ /************** Get call for exam text from call for exam code ***************/ /*****************************************************************************/ diff --git a/swad_call_for_exam_resource.h b/swad_call_for_exam_resource.h index 5266692b4..b741084b4 100644 --- a/swad_call_for_exam_resource.h +++ b/swad_call_for_exam_resource.h @@ -35,9 +35,7 @@ /***************************** Public prototypes *****************************/ /*****************************************************************************/ -void Cfe_GetLinkToCallForExam (void); -void CfeRsc_WriteResourceCallForExam (long ExaCod,Frm_PutFormToGo_t PutFormToGo, - const char *Icon,const char *IconTitle); +void CfeRsc_GetLinkToCallForExam (void); void CfeRsc_GetTitleFromExaCod (long ExaCod,char *Title,size_t TitleSize); #endif diff --git a/swad_changelog.h b/swad_changelog.h index 57279aa8b..c528b9c00 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -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.92 (2023-04-06)" +#define Log_PLATFORM_VERSION "SWAD 22.92.1 (2023-04-06)" #define CSS_FILE "swad22.88.css" #define JS_FILE "swad22.49.js" /* + Version 22.92.1: Apr 06, 2023 Removed unused code in resources. (338514 lines) 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) diff --git a/swad_exam_resource.c b/swad_exam_resource.c index fabce8fbc..dd9603aa4 100644 --- a/swad_exam_resource.c +++ b/swad_exam_resource.c @@ -31,7 +31,6 @@ #include "swad_exam.h" #include "swad_exam_database.h" #include "swad_exam_resource.h" -#include "swad_form.h" #include "swad_parameter_code.h" #include "swad_resource_database.h" @@ -65,54 +64,6 @@ void ExaRsc_GetLinkToExam (void) Exa_ListAllExams (&Exams); } -/*****************************************************************************/ -/**************************** Write exam as resource *************************/ -/*****************************************************************************/ - -void ExaRsc_WriteResourceExam (long ExaCod,Frm_PutFormToGo_t PutFormToGo, - const char *Icon,const char *IconTitle) - { - extern const char *Txt_Actions[ActLst_NUM_ACTIONS]; - Act_Action_t NextAction; - char Title[Exa_MAX_BYTES_TITLE + 1]; - - /***** Get exam title *****/ - ExaRsc_GetTitleFromExaCod (ExaCod,Title,sizeof (Title) - 1); - - /***** Begin form to go to exam *****/ - if (PutFormToGo == Frm_PUT_FORM_TO_GO) - { - NextAction = (ExaCod > 0) ? ActSeeExa : // Exam specified - ActSeeAllExa; // All exams - Frm_BeginForm (NextAction); - ParCod_PutPar (ParCod_Exa,ExaCod); - 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 (Icon,Ico_BLACK,IconTitle); - break; - case Frm_PUT_FORM_TO_GO: - Ico_PutIconLink (Icon,Ico_BLACK,NextAction); - break; - } - - /***** Write title of exam *****/ - HTM_Txt (Title); - - /***** End form to download file *****/ - if (PutFormToGo == Frm_PUT_FORM_TO_GO) - { - HTM_BUTTON_End (); - Frm_EndForm (); - } - } - /*****************************************************************************/ /*********************** Get exam title from exam code ***********************/ /*****************************************************************************/ diff --git a/swad_exam_resource.h b/swad_exam_resource.h index d056987d4..3ea21f51e 100644 --- a/swad_exam_resource.h +++ b/swad_exam_resource.h @@ -29,15 +29,11 @@ #include // For size_t -#include "swad_form.h" - /*****************************************************************************/ /***************************** Public prototypes *****************************/ /*****************************************************************************/ void ExaRsc_GetLinkToExam (void); -void ExaRsc_WriteResourceExam (long ExaCod,Frm_PutFormToGo_t PutFormToGo, - const char *Icon,const char *IconTitle); void ExaRsc_GetTitleFromExaCod (long ExaCod,char *Title,size_t TitleSize); #endif diff --git a/swad_forum_resource.c b/swad_forum_resource.c index 4317c976f..7bd06b018 100644 --- a/swad_forum_resource.c +++ b/swad_forum_resource.c @@ -26,7 +26,6 @@ #include "swad_action_list.h" #include "swad_alert.h" -#include "swad_form.h" #include "swad_forum.h" #include "swad_forum_database.h" #include "swad_forum_resource.h" @@ -76,61 +75,6 @@ void ForRsc_GetLinkToThread (void) For_ShowPostsOfAThread (&Forums,Ale_SUCCESS,NULL); } -/*****************************************************************************/ -/************************ Write thread as resource ***************************/ -/*****************************************************************************/ - -void ForRsc_WriteResourceThread (long ThrCod,Frm_PutFormToGo_t PutFormToGo, - const char *Icon,const char *IconTitle) - { - extern const char *Txt_Actions[ActLst_NUM_ACTIONS]; - Act_Action_t NextAction; - char Subject[Cns_MAX_BYTES_SUBJECT + 1]; - - /***** Get thread subject *****/ - ForRsc_GetTitleFromThrCod (ThrCod,Subject,sizeof (Subject) - 1); - - /***** Begin form to go to survey *****/ - if (PutFormToGo == Frm_PUT_FORM_TO_GO) - { - /***** Set forum and thread *****/ - // TODO: In the listing of threads, the page is always the first. - // The page should be that corresponding to the selected thread. - NextAction = (ThrCod > 0) ? ActSeePstForCrsUsr : // Thread specified - ActSeeForCrsUsr; // All threads - Frm_BeginFormAnchor (NextAction,ThrCod > 0 ? For_FORUM_POSTS_SECTION_ID : - For_FORUM_THREADS_SECTION_ID); - if (ThrCod > 0) - ParCod_PutPar (ParCod_Thr,ThrCod); - else - ParCod_PutPar (ParCod_OthHie,Gbl.Hierarchy.Crs.CrsCod); - 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 (Icon,Ico_BLACK,IconTitle); - break; - case Frm_PUT_FORM_TO_GO: - Ico_PutIconLink (Icon,Ico_BLACK,NextAction); - break; - } - - /***** Write title of forum *****/ - HTM_Txt (Subject); - - /***** End form to download file *****/ - if (PutFormToGo == Frm_PUT_FORM_TO_GO) - { - HTM_BUTTON_End (); - Frm_EndForm (); - } - } - /*****************************************************************************/ /************** Build/free anchor string given a thread code *****************/ /*****************************************************************************/ diff --git a/swad_forum_resource.h b/swad_forum_resource.h index 9ef228ee3..d68ba4bec 100644 --- a/swad_forum_resource.h +++ b/swad_forum_resource.h @@ -34,8 +34,6 @@ /*****************************************************************************/ 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); diff --git a/swad_game_resource.c b/swad_game_resource.c index 209acb75f..7aa0e9fdd 100644 --- a/swad_game_resource.c +++ b/swad_game_resource.c @@ -28,7 +28,6 @@ #include "swad_action_list.h" #include "swad_alert.h" #include "swad_error.h" -#include "swad_form.h" #include "swad_game.h" #include "swad_game_database.h" #include "swad_game_resource.h" @@ -67,54 +66,6 @@ void GamRsc_GetLinkToGame (void) Gam_ListAllGames (&Games); } -/*****************************************************************************/ -/************************** Write game as resource ***************************/ -/*****************************************************************************/ - -void GamRsc_WriteResourceGame (long GamCod,Frm_PutFormToGo_t PutFormToGo, - const char *Icon,const char *IconTitle) - { - extern const char *Txt_Actions[ActLst_NUM_ACTIONS]; - Act_Action_t NextAction; - char Title[Gam_MAX_BYTES_TITLE + 1]; - - /***** Get game title *****/ - GamRsc_GetTitleFromGamCod (GamCod,Title,sizeof (Title) - 1); - - /***** Begin form to go to game *****/ - if (PutFormToGo == Frm_PUT_FORM_TO_GO) - { - NextAction = (GamCod > 0) ? ActSeeGam : // Game specified - ActSeeAllGam; // All games - Frm_BeginForm (NextAction); - ParCod_PutPar (ParCod_Gam,GamCod); - 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 (Icon,Ico_BLACK,IconTitle); - break; - case Frm_PUT_FORM_TO_GO: - Ico_PutIconLink (Icon,Ico_BLACK,NextAction); - break; - } - - /***** Write game title of exam *****/ - HTM_Txt (Title); - - /***** End form to go to game *****/ - if (PutFormToGo == Frm_PUT_FORM_TO_GO) - { - HTM_BUTTON_End (); - Frm_EndForm (); - } - } - /*****************************************************************************/ /*********************** Get game title from game code ***********************/ /*****************************************************************************/ diff --git a/swad_game_resource.h b/swad_game_resource.h index ac1d266bb..f4d57e604 100644 --- a/swad_game_resource.h +++ b/swad_game_resource.h @@ -34,8 +34,6 @@ /*****************************************************************************/ void GamRsc_GetLinkToGame (void); -void GamRsc_WriteResourceGame (long GamCod,Frm_PutFormToGo_t PutFormToGo, - const char *Icon,const char *IconTitle); void GamRsc_GetTitleFromGamCod (long GamCod,char *Title,size_t TitleSize); #endif diff --git a/swad_project_resource.c b/swad_project_resource.c index 360b9a6ef..8bf495ec1 100644 --- a/swad_project_resource.c +++ b/swad_project_resource.c @@ -28,7 +28,6 @@ #include "swad_action_list.h" #include "swad_alert.h" #include "swad_error.h" -#include "swad_form.h" #include "swad_parameter_code.h" #include "swad_program_database.h" #include "swad_project.h" @@ -70,54 +69,6 @@ void PrjRsc_GetLinkToProject (void) Prj_ShowProjects (&Projects); } -/*****************************************************************************/ -/*********************** Write project as resource ************************/ -/*****************************************************************************/ - -void PrjRsc_WriteResourceProject (long PrjCod,Frm_PutFormToGo_t PutFormToGo, - const char *Icon,const char *IconTitle) - { - extern const char *Txt_Actions[ActLst_NUM_ACTIONS]; - Act_Action_t NextAction; - char Title[Prj_MAX_BYTES_TITLE + 1]; - - /***** Get project title *****/ - PrjRsc_GetTitleFromPrjCod (PrjCod,Title,sizeof (Title) - 1); - - /***** Begin form to go to project *****/ - if (PutFormToGo == Frm_PUT_FORM_TO_GO) - { - NextAction = (PrjCod > 0) ? ActSeeOnePrj : // Project specified - ActSeePrj; // All projects - Frm_BeginForm (NextAction); - ParCod_PutPar (ParCod_Prj,PrjCod); - 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 (Icon,Ico_BLACK,IconTitle); - break; - case Frm_PUT_FORM_TO_GO: - Ico_PutIconLink (Icon,Ico_BLACK,NextAction); - break; - } - - /***** Write project title *****/ - HTM_Txt (Title); - - /***** End form to go to project *****/ - if (PutFormToGo == Frm_PUT_FORM_TO_GO) - { - HTM_BUTTON_End (); - Frm_EndForm (); - } - } - /*****************************************************************************/ /******************* Get project title from project code *********************/ /*****************************************************************************/ diff --git a/swad_project_resource.h b/swad_project_resource.h index e894170f8..742aec35c 100644 --- a/swad_project_resource.h +++ b/swad_project_resource.h @@ -34,8 +34,6 @@ /*****************************************************************************/ void PrjRsc_GetLinkToProject (void); -void PrjRsc_WriteResourceProject (long PrjCod,Frm_PutFormToGo_t PutFormToGo, - const char *Icon,const char *IconTitle); void PrjRsc_GetTitleFromPrjCod (long PrjCod,char *Title,size_t TitleSize); #endif diff --git a/swad_resource.c b/swad_resource.c index e4adcad98..9d9020221 100644 --- a/swad_resource.c +++ b/swad_resource.c @@ -235,23 +235,6 @@ void Rsc_WriteLinkName (const struct Rsc_Link *Link,Frm_PutFormToGo_t PutFormToG 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) = - { - [Rsc_NONE ] = Rsc_WriteResourceEmpty, - [Rsc_ASSIGNMENT ] = AsgRsc_WriteResourceAssignment, - [Rsc_PROJECT ] = PrjRsc_WriteResourceProject, - [Rsc_CALL_FOR_EXAM ] = CfeRsc_WriteResourceCallForExam, - [Rsc_EXAM ] = ExaRsc_WriteResourceExam, - [Rsc_GAME ] = GamRsc_WriteResourceGame, - [Rsc_RUBRIC ] = RubRsc_WriteResourceRubric, - [Rsc_DOCUMENT ] = BrwRsc_WriteResourceDocument, - [Rsc_MARKS ] = BrwRsc_WriteResourceMarksFile, - [Rsc_ATTENDANCE_EVENT] = AttRsc_WriteResourceEvent, - [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, @@ -324,73 +307,48 @@ void Rsc_WriteLinkName (const struct Rsc_Link *Link,Frm_PutFormToGo_t PutFormToG char Title[Cns_MAX_BYTES_SUBJECT + 1]; char *Anchor; - /***** Write link name *****/ - if (WriteLinkName[Link->Type]) + /***** Get resource title *****/ + GetResourceTitle[Link->Type] (Link->Cod,Title,sizeof (Title) - 1); + + switch (PutFormToGo) { - GetResourceTitle[Link->Type] (Link->Cod,Title,sizeof (Title) - 1); - - /***** Begin form to go to resource *****/ - if (PutFormToGo == Frm_PUT_FORM_TO_GO) - { + case Frm_DONT_PUT_FORM_TO_GO: + /* Icon and title of resource *****/ + Ico_PutIconOn (Rsc_ResourceTypesIcons[Link->Type],Ico_BLACK, + Txt_RESOURCE_TYPES[Link->Type]); + HTM_Txt (Title); + break; + case Frm_PUT_FORM_TO_GO: + /* Begin form to go to resource */ 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); + 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); - + FuncAnchor[Link->Type].Free (&Anchor); + } + else + Frm_BeginForm (NextAction); if (Link->Cod > 0) ParCod_PutPar (ParCod[Link->Type],Link->Cod); + /* Begin link */ 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; - } + /* Icon and title of resource *****/ + Ico_PutIconLink (Rsc_ResourceTypesIcons[Link->Type],Ico_BLACK, + NextAction); + HTM_Txt (Title); - /***** Write title of resource*****/ - HTM_Txt (Title); + /* End link */ + HTM_BUTTON_End (); - /***** End form to download file *****/ - if (PutFormToGo == Frm_PUT_FORM_TO_GO) - { - HTM_BUTTON_End (); Frm_EndForm (); - } + break; } - else - Ale_ShowAlert (Ale_ERROR,"Not implemented!"); - } - -/*****************************************************************************/ -/******************** Write empty resource as resource ***********************/ -/*****************************************************************************/ - -void Rsc_WriteResourceEmpty (__attribute__((unused)) long Cod, - __attribute__((unused)) Frm_PutFormToGo_t PutFormToGo, - const char *Icon,const char *IconTitle) - { - extern const char *Txt_RESOURCE_TYPES[Rsc_NUM_TYPES]; - - /***** Icon depending on type ******/ - Ico_PutIconOn (Icon,Ico_BLACK,IconTitle); - - /***** Write text *****/ - HTM_Txt (Txt_RESOURCE_TYPES[Rsc_NONE]); } /*****************************************************************************/ diff --git a/swad_resource.h b/swad_resource.h index 2f30becc0..0f7b475c0 100644 --- a/swad_resource.h +++ b/swad_resource.h @@ -79,9 +79,6 @@ 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); -void Rsc_WriteResourceEmpty (__attribute__((unused)) long Cod, - __attribute__((unused)) Frm_PutFormToGo_t PutFormToGo, - const char *Icon,const char *IconTitle); void Rsc_GetResourceTitleFromLink (struct Rsc_Link *Link, char Title[Rsc_MAX_BYTES_RESOURCE_TITLE + 1]); diff --git a/swad_rubric_resource.c b/swad_rubric_resource.c index abefbe9c5..a3041ffc6 100644 --- a/swad_rubric_resource.c +++ b/swad_rubric_resource.c @@ -29,7 +29,6 @@ #include "swad_alert.h" #include "swad_box.h" #include "swad_error.h" -#include "swad_form.h" #include "swad_parameter_code.h" #include "swad_resource_database.h" #include "swad_rubric.h" @@ -74,54 +73,6 @@ void RubRsc_GetLinkToRubric (void) Rub_ListAllRubrics (&Rubrics); } -/*****************************************************************************/ -/*************************** Write rubric as resource ************************/ -/*****************************************************************************/ - -void RubRsc_WriteResourceRubric (long RubCod,Frm_PutFormToGo_t PutFormToGo, - const char *Icon,const char *IconTitle) - { - extern const char *Txt_Actions[ActLst_NUM_ACTIONS]; - Act_Action_t NextAction; - char Title[Rub_MAX_BYTES_TITLE + 1]; - - /***** Get rubric title *****/ - RubRsc_GetTitleFromRubCod (RubCod,Title,sizeof (Title) - 1); - - /***** Begin form to go to rubric *****/ - if (PutFormToGo == Frm_PUT_FORM_TO_GO) - { - NextAction = (RubCod > 0) ? ActSeeRub : // Rubric specified - ActSeeAllRub; // All rubrics - Frm_BeginForm (NextAction); - ParCod_PutPar (ParCod_Rub,RubCod); - 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 (Icon,Ico_BLACK,IconTitle); - break; - case Frm_PUT_FORM_TO_GO: - Ico_PutIconLink (Icon,Ico_BLACK,NextAction); - break; - } - - /***** Write title of rubric *****/ - HTM_Txt (Title); - - /***** End form to download file *****/ - if (PutFormToGo == Frm_PUT_FORM_TO_GO) - { - HTM_BUTTON_End (); - Frm_EndForm (); - } - } - /*****************************************************************************/ /********************* Get rubric title from rubric code *********************/ /*****************************************************************************/ diff --git a/swad_rubric_resource.h b/swad_rubric_resource.h index 7190d02d8..e22983400 100644 --- a/swad_rubric_resource.h +++ b/swad_rubric_resource.h @@ -34,8 +34,6 @@ /*****************************************************************************/ void RubRsc_GetLinkToRubric (void); -void RubRsc_WriteResourceRubric (long RubCod,Frm_PutFormToGo_t PutFormToGo, - const char *Icon,const char *IconTitle); void RubRsc_GetTitleFromRubCod (long RubCod,char *Title,size_t TitleSize); void RubRsc_ViewResourceClipboard (void); diff --git a/swad_survey_resource.c b/swad_survey_resource.c index 0744e675e..8f1a1be1d 100644 --- a/swad_survey_resource.c +++ b/swad_survey_resource.c @@ -65,54 +65,6 @@ void SvyRsc_GetLinkToSurvey (void) Svy_ListAllSurveys (&Surveys); } -/*****************************************************************************/ -/************************* Write survey as resource **************************/ -/*****************************************************************************/ - -void SvyRsc_WriteResourceSurvey (long SvyCod,Frm_PutFormToGo_t PutFormToGo, - const char *Icon,const char *IconTitle) - { - extern const char *Txt_Actions[ActLst_NUM_ACTIONS]; - Act_Action_t NextAction; - char Title[Svy_MAX_BYTES_SURVEY_TITLE + 1]; - - /***** Get survey title *****/ - SvyRsc_GetTitleFromSvyCod (SvyCod,Title,sizeof (Title) - 1); - - /***** Begin form to go to survey *****/ - if (PutFormToGo == Frm_PUT_FORM_TO_GO) - { - NextAction = (SvyCod > 0) ? ActSeeSvy : // Survey specified - ActSeeAllSvy; // All surveys - Frm_BeginForm (NextAction); - ParCod_PutPar (ParCod_Svy,SvyCod); - 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 (Icon,Ico_BLACK,IconTitle); - break; - case Frm_PUT_FORM_TO_GO: - Ico_PutIconLink (Icon,Ico_BLACK,NextAction); - break; - } - - /***** Write title of survey *****/ - HTM_Txt (Title); - - /***** End form to download file *****/ - if (PutFormToGo == Frm_PUT_FORM_TO_GO) - { - HTM_BUTTON_End (); - Frm_EndForm (); - } - } - /*****************************************************************************/ /********************* Get survey title from survey code *********************/ /*****************************************************************************/ diff --git a/swad_survey_resource.h b/swad_survey_resource.h index 0265ff3f5..8cffa1666 100644 --- a/swad_survey_resource.h +++ b/swad_survey_resource.h @@ -34,8 +34,6 @@ /*****************************************************************************/ void SvyRsc_GetLinkToSurvey (void); -void SvyRsc_WriteResourceSurvey (long SvyCod,Frm_PutFormToGo_t PutFormToGo, - const char *Icon,const char *IconTitle); void SvyRsc_GetTitleFromSvyCod (long SvyCod,char *Title,size_t TitleSize); #endif