From 24e0aa519d892cf1b9378cc1cdd6f0a7c3abe961 Mon Sep 17 00:00:00 2001 From: acanas Date: Thu, 14 Mar 2024 21:58:26 +0100 Subject: [PATCH] Version 23.68.1: Mar 14, 2024 Code refactoring in menu icons. --- swad_MFU.c | 4 +- swad_action.c | 4 +- swad_action.h | 3 +- swad_changelog.h | 3 +- swad_menu.c | 138 +++++------------------------------------------ swad_menu.h | 3 +- 6 files changed, 24 insertions(+), 131 deletions(-) diff --git a/swad_MFU.c b/swad_MFU.c index ef3292c3..29eec0e8 100644 --- a/swad_MFU.c +++ b/swad_MFU.c @@ -316,10 +316,10 @@ static void MFU_PutIconAndText (Act_Action_t Action, snprintf (URLIconSet,sizeof (URLIconSet),"%s/%s", Cfg_URL_ICON_SETS_PUBLIC,Ico_IconSetId[Gbl.Prefs.IconSet]); if (Color[Gbl.Prefs.IconSet] == Ico_UNCHANGED) - HTM_IMG (URLIconSet,Act_GetIcon (Action),MenuStr, + HTM_IMG (URLIconSet,Act_GetIconFromAction (Action),MenuStr, NULL); else - HTM_IMG (URLIconSet,Act_GetIcon (Action),MenuStr, + HTM_IMG (URLIconSet,Act_GetIconFromAction (Action),MenuStr, "class=\"ICO_%s_%s\"", Ico_GetPreffix (Color[Gbl.Prefs.IconSet]), The_GetSuffix ()); diff --git a/swad_action.c b/swad_action.c index 5f395143..3115a9e9 100644 --- a/swad_action.c +++ b/swad_action.c @@ -186,12 +186,12 @@ void (*Act_GetFunctionPosteriori (Act_Action_t Action)) (void) /********************** Get icon associated to an action *********************/ /*****************************************************************************/ -const char *Act_GetIcon (Act_Action_t Action) +const char *Act_GetIconFromAction (Act_Action_t Action) { if (Action < 0 || Action >= ActLst_NUM_ACTIONS) return NULL; - return Ico_GetIcon (Mnu_GetIcon (Action)); + return Ico_GetIcon (Mnu_GetIconFromAction (Action)); } /*****************************************************************************/ diff --git a/swad_action.h b/swad_action.h index 7aa5a83a..585e7afc 100644 --- a/swad_action.h +++ b/swad_action.h @@ -104,7 +104,8 @@ Act_Content_t Act_GetContentType (Act_Action_t Action); Act_BrowserTab_t Act_GetBrowserTab (Act_Action_t Action); void (*Act_GetFunctionPriori (Act_Action_t Action)) (void); void (*Act_GetFunctionPosteriori (Act_Action_t Action)) (void); -const char *Act_GetIcon (Act_Action_t Action); + +const char *Act_GetIconFromAction (Act_Action_t Action); const char *Act_GetTitleAction (Act_Action_t Action); const char *Act_GetActionText (Act_Action_t Action); diff --git a/swad_changelog.h b/swad_changelog.h index be146fff..d3670887 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -633,10 +633,11 @@ Me sale este error, no s "can npt create received message (duplicated entry '243218-2160773' for key 'UsrCod_MsgCod') */ -#define Log_PLATFORM_VERSION "SWAD 23.68 (2024-03-14)" +#define Log_PLATFORM_VERSION "SWAD 23.68.1 (2024-03-14)" #define CSS_FILE "swad23.67.2.css" #define JS_FILE "swad23.53.6.js" /* + Version 23.68.1: Mar 14, 2024 Code refactoring in menu icons. (335591 lines) Version 23.68: Mar 14, 2024 New order in list of actions. (335700 lines) Version 23.67.3: Mar 09, 2024 Changes in global hits. (335454 lines) Version 23.67.2: Mar 09, 2024 Changes in layout. Fixed missing texts in actions. (335424 lines) diff --git a/swad_menu.c b/swad_menu.c index a235b86b..ec6eaf25 100644 --- a/swad_menu.c +++ b/swad_menu.c @@ -187,138 +187,28 @@ static const struct Mnu_Menu }, }; -/* -static const Act_Action_t Mnu_MenuActions[Tab_NUM_TABS][Act_MAX_OPTIONS_IN_MENU_PER_TAB] = - { - [TabUnk] = { - }, - [TabStr] = { - [ 0] = ActFrmLogIn, - [ 1] = ActReqSch, - [ 2] = ActSeeGblTL, - [ 3] = ActSeeSocPrf, - [ 4] = ActSeeCal, - [ 5] = ActSeeNtf, - }, - [TabSys] = { - [ 0] = ActSeeSysInf, - [ 1] = ActSeeCty, - [ 2] = ActSeePen, - [ 3] = ActSeeLnk, - [ 4] = ActSeePlg, - [ 5] = ActMtn, - }, - [TabCty] = { - [ 0] = ActSeeCtyInf, - [ 1] = ActSeeIns, - }, - [TabIns] = { - [ 0] = ActSeeInsInf, - [ 1] = ActSeeCtr, - [ 2] = ActSeePlc, - [ 3] = ActSeeDpt, - [ 4] = ActSeeHld, - }, - [TabCtr] = { - [ 0] = ActSeeCtrInf, - [ 1] = ActSeeDeg, - [ 2] = ActSeeBld, - [ 3] = ActSeeRoo, - }, - [TabDeg] = { - [ 0] = ActSeeDegInf, - [ 1] = ActSeeCrs, - }, - [TabCrs] = { - [ 0] = ActSeeCrsInf, - [ 1] = ActSeePrg, - [ 2] = ActSeeTchGui, - [ 3] = ActSeeSyl, - [ 4] = ActSeeBib, - [ 5] = ActSeeFAQ, - [ 6] = ActSeeCrsLnk, - [ 7] = ActSeeAss, - [ 8] = ActSeeCrsTT, - }, - [TabAss] = { - [ 0] = ActSeeAllAsg, - [ 1] = ActSeeAllPrj, - [ 2] = ActSeeAllCfe, - [ 3] = ActEdiTstQst, - [ 4] = ActReqTst, - [ 5] = ActSeeAllExa, - [ 6] = ActSeeAllGam, - [ 7] = ActSeeAllRub, - }, - [TabFil] = { - [ 0] = ActSeeAdmDocIns, - [ 1] = ActAdmShaIns, - [ 2] = ActSeeAdmDocCtr, - [ 3] = ActAdmShaCtr, - [ 4] = ActSeeAdmDocDeg, - [ 5] = ActAdmShaDeg, - [ 6] = ActSeeAdmDocCrsGrp, - [ 7] = ActAdmTchCrsGrp, - [ 8] = ActAdmShaCrsGrp, - [ 9] = ActAdmAsgWrkUsr, - [10] = ActReqAsgWrkCrs, - [11] = ActSeeAdmMrk, - [12] = ActAdmBrf, - }, - [TabUsr] = { - [ 0] = ActReqSelGrp, - [ 1] = ActLstStd, - [ 2] = ActLstTch, - [ 3] = ActLstOth, - [ 4] = ActSeeAllAtt, - [ 5] = ActReqSignUp, - [ 6] = ActSeeSignUpReq, - [ 7] = ActLstCon, - }, - [TabMsg] = { - [ 0] = ActSeeAnn, - [ 1] = ActSeeAllNot, - [ 2] = ActSeeFor, - [ 3] = ActSeeChtRms, - [ 4] = ActSeeRcvMsg, - [ 5] = ActReqMaiUsr, - }, - [TabAna] = { - [ 0] = ActReqUseGbl, - [ 1] = ActSeePhoDeg, - [ 2] = ActReqStaCrs, - [ 3] = ActSeeAllSvy, - [ 4] = ActReqAccGbl, - [ 5] = ActReqMyUsgRep, - [ 6] = ActMFUAct, - }, - [TabPrf] = { - [ 0] = ActFrmRolSes, - [ 1] = ActMyCrs, - [ 2] = ActSeeMyTT, - [ 3] = ActSeeMyAgd, - [ 4] = ActFrmMyAcc, - [ 5] = ActReqEdiRecSha, - [ 6] = ActReqEdiSet, - }, - }; -*/ -/*****************************************************************************/ + /*****************************************************************************/ /****************************** Private prototypes ***************************/ /*****************************************************************************/ static void Mnu_PutIconsMenu (__attribute__((unused)) void *Args); +/*****************************************************************************/ +/***** Get icon associated to a number of option in menu of current tab ******/ +/*****************************************************************************/ + +const char *Mnu_GetIconFromNumOptInMenu (unsigned NumOptInMenu) + { + return Mnu_Menu[Gbl.Action.Tab][NumOptInMenu].Icon; + } + /*****************************************************************************/ /********************** Get icon associated to an action *********************/ /*****************************************************************************/ -const char *Mnu_GetIcon (Act_Action_t Action) +const char *Mnu_GetIconFromAction (Act_Action_t Action) { - if (Action < 0 || Action >= ActLst_NUM_ACTIONS) - return NULL; - - return Mnu_Menu[Gbl.Action.Tab][Act_GetIndexInMenu (Action)].Icon; + return Mnu_Menu[Act_GetTab (Action)][Act_GetIndexInMenu (Action)].Icon; } /*****************************************************************************/ @@ -399,12 +289,12 @@ void Mnu_WriteMenuThisTab (void) " style=\"background-image:url('%s/%s/%s');\"", ClassIcoMenu[Gbl.Prefs.IconSet],The_GetSuffix (), Cfg_URL_ICON_SETS_PUBLIC,Ico_IconSetId[Gbl.Prefs.IconSet], - Act_GetIcon (NumAct)); + Ico_GetIcon (Mnu_GetIconFromNumOptInMenu (NumOptInMenu))); else HTM_DIV_Begin ("class=\"MENU_ICO\"" " style=\"background-image:url('%s/%s/%s');\"", Cfg_URL_ICON_SETS_PUBLIC,Ico_IconSetId[Gbl.Prefs.IconSet], - Act_GetIcon (NumAct)); + Ico_GetIcon (Mnu_GetIconFromNumOptInMenu (NumOptInMenu))); HTM_DIV_End (); HTM_DIV_Begin ("class=\"MENU_TXT MENU_TXT_%s\"", The_GetSuffix ()); diff --git a/swad_menu.h b/swad_menu.h index ce310ad3..98c31dd4 100644 --- a/swad_menu.h +++ b/swad_menu.h @@ -45,7 +45,8 @@ typedef enum /***************************** Public prototypes *****************************/ /*****************************************************************************/ -const char *Mnu_GetIcon (Act_Action_t Action); +const char *Mnu_GetIconFromNumOptInMenu (unsigned NumOptInMenu); +const char *Mnu_GetIconFromAction (Act_Action_t Action); Act_Action_t Mnu_GetFirstActionAvailableInCurrentTab (void); void Mnu_WriteMenuThisTab (void);