diff --git a/Makefile b/Makefile index d5f09f17..e4e29b64 100644 --- a/Makefile +++ b/Makefile @@ -42,7 +42,7 @@ OBJS = swad_account.o swad_action.o swad_announcement.o swad_assignment.o swad_a swad_QR.o \ swad_record.o swad_role.o swad_RSS.o \ swad_scope.o swad_search.o swad_session.o swad_setup.o swad_statistic.o swad_string.o swad_survey.o swad_syllabus.o \ - swad_test.o swad_test_import.o swad_theme.o swad_timetable.o \ + swad_tab.o swad_test.o swad_test_import.o swad_theme.o swad_timetable.o \ swad_user.o \ swad_web_service.o \ swad_xml.o \ diff --git a/swad_action.c b/swad_action.c index 1fe31e52..b5c8ac08 100644 --- a/swad_action.c +++ b/swad_action.c @@ -59,6 +59,7 @@ #include "swad_QR.h" #include "swad_search.h" #include "swad_setup.h" +#include "swad_tab.h" #include "swad_test_import.h" #include "swad_zip.h" @@ -1050,7 +1051,7 @@ Profile: 904. ActDowBrf Download a file in the briefcase */ -const struct Act_Menu Act_Menu[Act_NUM_TABS][Act_MAX_OPTIONS_IN_MENU_PER_TAB] = +const struct Act_Menu Act_Menu[Tab_NUM_TABS][Act_MAX_OPTIONS_IN_MENU_PER_TAB] = { // TabUnk ********** { @@ -3550,7 +3551,7 @@ bool Act_CheckIfIHavePermissionToExecuteAction (Act_Action_t Action) const char *Act_GetTitleAction (Act_Action_t Action) { - extern const char *Txt_MENU_TITLE[Act_NUM_TABS][Act_MAX_OPTIONS_IN_MENU_PER_TAB]; + extern const char *Txt_MENU_TITLE[Tab_NUM_TABS][Act_MAX_OPTIONS_IN_MENU_PER_TAB]; if (Action < 0 || Action >= Act_NUM_ACTIONS) return NULL; @@ -3563,7 +3564,7 @@ const char *Act_GetTitleAction (Act_Action_t Action) const char *Act_GetSubtitleAction (Act_Action_t Action) { - extern const char *Txt_MENU_SUBTITLE[Act_NUM_TABS][Act_MAX_OPTIONS_IN_MENU_PER_TAB]; + extern const char *Txt_MENU_SUBTITLE[Tab_NUM_TABS][Act_MAX_OPTIONS_IN_MENU_PER_TAB]; if (Action < 0 || Action >= Act_NUM_ACTIONS) return NULL; @@ -3576,8 +3577,8 @@ const char *Act_GetSubtitleAction (Act_Action_t Action) void Act_GetBreadcrumbStrForAction (Act_Action_t Action,bool HTML,char *BreadcrumbStr) { - extern const char *Txt_TABS_FULL_TXT[Act_NUM_TABS]; - extern const char *Txt_MENU_TITLE[Act_NUM_TABS][Act_MAX_OPTIONS_IN_MENU_PER_TAB]; + extern const char *Txt_TABS_FULL_TXT[Tab_NUM_TABS]; + extern const char *Txt_MENU_TITLE[Tab_NUM_TABS][Act_MAX_OPTIONS_IN_MENU_PER_TAB]; Act_Action_t Superaction = Act_Actions[Action].SuperAction; char *Arrow; @@ -3732,7 +3733,7 @@ void Act_AdjustActionWhenNoUsrLogged (void) Gbl.CurrentAct = ActSeeCtyInf; else Gbl.CurrentAct = Cfg_DEFAULT_ACTION_WHEN_NO_USR_LOGGED; - Lay_SetCurrentTab (); + Tab_SetCurrentTab (); } /*****************************************************************************/ @@ -3763,7 +3764,7 @@ void Act_AdjustCurrentAction (void) break; default: Gbl.CurrentAct = ActFrmChgMyPwd; - Lay_SetCurrentTab (); + Tab_SetCurrentTab (); return; } } @@ -3773,7 +3774,7 @@ void Act_AdjustCurrentAction (void) if (!Pwd_FastCheckIfPasswordSeemsGood (Gbl.Usrs.Me.LoginPlainPassword)) { Gbl.CurrentAct = ActFrmChgMyPwd; - Lay_SetCurrentTab (); + Tab_SetCurrentTab (); return; } @@ -3790,7 +3791,7 @@ void Act_AdjustCurrentAction (void) break; default: Gbl.CurrentAct = ActFrmUsrAcc; - Lay_SetCurrentTab (); + Tab_SetCurrentTab (); return; } } @@ -3808,7 +3809,7 @@ void Act_AdjustCurrentAction (void) break; default: Gbl.CurrentAct = ActReqEdiRecCom; - Lay_SetCurrentTab (); + Tab_SetCurrentTab (); return; } @@ -3825,7 +3826,7 @@ void Act_AdjustCurrentAction (void) break; default: Gbl.CurrentAct = ActReqEdiMyIns; - Lay_SetCurrentTab (); + Tab_SetCurrentTab (); return; } @@ -3837,7 +3838,7 @@ void Act_AdjustCurrentAction (void) if (!Gbl.Usrs.Me.UsrDat.Accepted && Gbl.CurrentAct != ActLogOut) { Gbl.CurrentAct = ActReqAccEnrCrs; - Lay_SetCurrentTab (); + Tab_SetCurrentTab (); return; } @@ -3870,7 +3871,7 @@ void Act_AdjustCurrentAction (void) if (Grp_NumGrpTypesMandatIDontBelong ()) // To do: if this query is too slow ==> put it only when login. { Gbl.CurrentAct = ActReqSelGrp; - Lay_SetCurrentTab (); + Tab_SetCurrentTab (); return; } @@ -3884,7 +3885,7 @@ void Act_AdjustCurrentAction (void) /* If limit of clicks has been reached, the only action possible is show a form to send my photo */ Gbl.CurrentAct = ActReqMyPho; - Lay_SetCurrentTab (); + Tab_SetCurrentTab (); return; } break; @@ -3902,7 +3903,7 @@ void Act_AdjustCurrentAction (void) if (Tst_CheckIfCourseHaveTestsAndPluggableIsUnknown ()) { Gbl.CurrentAct = ActCfgTst; - Lay_SetCurrentTab (); + Tab_SetCurrentTab (); return; } break; @@ -4068,8 +4069,8 @@ void Act_WriteBigMFUActions (struct Act_ListMFUActions *ListMFUActions) { extern const char *The_ClassFormulNB[The_NUM_THEMES]; extern const char *Txt_Frequent_actions; - extern const char *Txt_TABS_FULL_TXT[Act_NUM_TABS]; - extern const char *Txt_MENU_TITLE[Act_NUM_TABS][Act_MAX_OPTIONS_IN_MENU_PER_TAB]; + extern const char *Txt_TABS_FULL_TXT[Tab_NUM_TABS]; + extern const char *Txt_MENU_TITLE[Tab_NUM_TABS][Act_MAX_OPTIONS_IN_MENU_PER_TAB]; unsigned NumAct; Act_Action_t Action; const char *Title; @@ -4120,7 +4121,7 @@ void Act_WriteBigMFUActions (struct Act_ListMFUActions *ListMFUActions) void Act_WriteSmallMFUActions (struct Act_ListMFUActions *ListMFUActions) { extern const char *Txt_Frequent_actions; - extern const char *Txt_MENU_TITLE[Act_NUM_TABS][Act_MAX_OPTIONS_IN_MENU_PER_TAB]; + extern const char *Txt_MENU_TITLE[Tab_NUM_TABS][Act_MAX_OPTIONS_IN_MENU_PER_TAB]; unsigned NumAct; Act_Action_t Action; const char *Title; diff --git a/swad_action.h b/swad_action.h index a3544672..87c804a4 100644 --- a/swad_action.h +++ b/swad_action.h @@ -69,8 +69,6 @@ typedef enum typedef int Act_Action_t; // Must be a signed type, because -1 is used to indicate obsolete action -/* Related with tabs, menus, etc. */ -#define Act_NUM_TABS (1+11) #define Act_NUM_ACTIONS (7+52+15+39+22+17+204+184+94+168+28+75) #define Act_MAX_ACTION_COD 1243 diff --git a/swad_changelog.h b/swad_changelog.h index 066af90b..a9570bc2 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -35,11 +35,15 @@ /****************************** Public constants *****************************/ /*****************************************************************************/ -#define Log_PLATFORM_VERSION "SWAD 14.53.1 (2015/01/04)" +#define Log_PLATFORM_VERSION "SWAD 14.54 (2015/01/04)" // Number of lines (includes comments but not blank lines) has been got with the following command: // nl swad*.c swad*.h css/swad*.css py/swad*.py js/swad*.js soap/swad*.h | tail -1 /* + Version 14.54 :Jan 04, 2014 New module swad_tab for drawing tabs. (173341 lines) + 1 change necessary in Makefile: +Add swad_tab.o to list of object files + Version 14.53.1 :Jan 04, 2014 Some functions moved from swad_layout to swad_menu. (173256 lines) Version 14.53 :Jan 04, 2014 New module swad_calendar for drawing months and calendar. (173254 lines) 1 change necessary in Makefile: diff --git a/swad_course.c b/swad_course.c index be43c812..94d91543 100644 --- a/swad_course.c +++ b/swad_course.c @@ -43,6 +43,7 @@ #include "swad_parameter.h" #include "swad_QR.h" #include "swad_RSS.h" +#include "swad_tab.h" #include "swad_theme.h" /*****************************************************************************/ @@ -133,8 +134,8 @@ static void Crs_Configuration (bool PrintView) { extern const char *The_ClassFormul[The_NUM_THEMES]; extern const char *Txt_This_course_fulfills_X_out_of_Y_indicators_; - extern const char *Txt_TABS_FULL_TXT[Act_NUM_TABS]; - extern const char *Txt_MENU_TITLE[Act_NUM_TABS][Act_MAX_OPTIONS_IN_MENU_PER_TAB]; + extern const char *Txt_TABS_FULL_TXT[Tab_NUM_TABS]; + extern const char *Txt_MENU_TITLE[Tab_NUM_TABS][Act_MAX_OPTIONS_IN_MENU_PER_TAB]; extern const char *Txt_Show_more_details; extern const char *Txt_NO; extern const char *Txt_Course; @@ -539,7 +540,7 @@ static void Crs_WriteListMyCoursesToSelectOne (void) { extern const char *The_ClassFormul[The_NUM_THEMES]; extern const char *Txt_My_courses; - extern const char *Txt_TABS_FULL_TXT[Act_NUM_TABS]; + extern const char *Txt_TABS_FULL_TXT[Tab_NUM_TABS]; extern const char *Txt_Go_to_X; struct Country Cty; struct Institution Ins; diff --git a/swad_degree.c b/swad_degree.c index 2ee6dfba..15c895ca 100644 --- a/swad_degree.c +++ b/swad_degree.c @@ -46,8 +46,9 @@ #include "swad_QR.h" #include "swad_RSS.h" #include "swad_string.h" -#include "swad_theme.h" +#include "swad_tab.h" #include "swad_text.h" +#include "swad_theme.h" /*****************************************************************************/ /************** External global variables from others modules ****************/ @@ -627,7 +628,7 @@ static void Deg_WriteSelectorOfDegree (Act_Action_t NextAction) void Deg_WriteCtyInsCtrDeg (void) { extern const char *The_ClassDegree[The_NUM_THEMES]; - extern const char *Txt_TABS_FULL_TXT[Act_NUM_TABS]; + extern const char *Txt_TABS_FULL_TXT[Tab_NUM_TABS]; char DegreeShortName[Deg_MAX_LENGTH_DEGREE_FULL_NAME+1]; // Full name of degree /***** Form to go to the system *****/ diff --git a/swad_layout.c b/swad_layout.c index 78b2004e..ccf2e292 100644 --- a/swad_layout.c +++ b/swad_layout.c @@ -40,6 +40,7 @@ #include "swad_notification.h" #include "swad_parameter.h" #include "swad_preference.h" +#include "swad_tab.h" #include "swad_theme.h" #include "swad_web_service.h" @@ -61,25 +62,9 @@ const char *Lay_LayoutIcons[Lay_NUM_LAYOUTS] = }; /*****************************************************************************/ -/****************************** Private constants ****************************/ +/***************************** Private constants *****************************/ /*****************************************************************************/ -const char *Lay_TabIcons[Act_NUM_TABS] = - { - /* TabUnk */ NULL, - /* TabSys */ "sys", - /* TabCty */ "cty", - /* TabIns */ "ins", - /* TabCtr */ "ctr", - /* TabDeg */ "deg", - /* TabCrs */ "crs", - /* TabAss */ "ass", - /* TabUsr */ "usr", - /* TabMsg */ "msg", - /* TabSta */ "sta", - /* TabPrf */ "prf", - }; - /*****************************************************************************/ /******************************* Private types *******************************/ /*****************************************************************************/ @@ -103,15 +88,7 @@ static void Lay_WriteScriptConnectedUsrs (void); static void Lay_WriteScriptCustomDropzone (void); static void Lay_WritePageTopHeading (void); -static void Lay_DrawTabs (void); -static void Lay_DrawTabsDeskTop (void); -static void Lay_DrawTabsMobile (void); -static bool Lay_CheckIfICanViewTab (Act_Tab_t Tab); -static void Lay_DrawBreadcrumb (void); -static void Lay_WriteBreadcrumbHome (void); -static void Lay_WriteBreadcrumbTab (void); -static void Lay_WriteBreadcrumbAction (void); static void Lay_WriteTitleAction (void); static void Lay_ShowLeftColumn (void); @@ -313,7 +290,7 @@ void Lay_WriteStartOfPage (void) if (Gbl.CurrentAct == ActMnu) Mnu_WriteMenuThisTabMobile (); else - Lay_DrawTabsMobile (); + Tab_DrawTabsMobile (); } break; default: @@ -730,7 +707,7 @@ static void Lay_WritePageTopHeading (void) Gbl.Prefs.PathTheme); /***** 3rd. row, 2nd. column *****/ - Lay_DrawTabs (); + Tab_DrawTabs (); /***** 3rd. row, 3rd. column *****/ if (Gbl.Prefs.SideCols & Lay_SHOW_RIGHT_COLUMN) // Right column visible @@ -754,7 +731,7 @@ static void Lay_WritePageTopHeading (void) } break; case Lay_LAYOUT_MOBILE: - Lay_DrawTabs (); + Tab_DrawTabs (); fprintf (Gbl.F.Out,"" "
");
- if (ICanViewTab)
- {
- fprintf (Gbl.F.Out," ");
- Act_FormStart (ActMnu);
- Par_PutHiddenParamUnsigned ("NxtTab",(unsigned) NumTab);
- Act_LinkFormSubmit (Txt_TABS_FULL_TXT[NumTab],The_ClassMenuOff[Gbl.Prefs.Theme]);
- fprintf (Gbl.F.Out,""
- " ",
- Gbl.Prefs.PathIconSet,Cfg_ICON_ACTION_64x64,
- Lay_TabIcons[NumTab],
- Txt_TABS_FULL_TXT[NumTab],
- Txt_TABS_FULL_TXT[NumTab],
- Txt_TABS_FULL_TXT[NumTab]);
- }
- else
- fprintf (Gbl.F.Out,"%s "
- ""
- ""
- ""
- ""
- " ",
- Gbl.Prefs.PathIconSet,
- Cfg_ICON_ACTION_64x64,
- Lay_TabIcons[NumTab],
- Txt_TABS_FULL_TXT[NumTab],
- Txt_TABS_FULL_TXT[NumTab],
- The_ClassMenuOff[Gbl.Prefs.Theme],
- Txt_TABS_FULL_TXT[NumTab]);
- fprintf (Gbl.F.Out,"%s "
- " | ");
- if ((NumTabVisible % Cfg_LAYOUT_MOBILE_NUM_COLUMNS) == (Cfg_LAYOUT_MOBILE_NUM_COLUMNS-1))
- fprintf (Gbl.F.Out,"