Version 14.54

This commit is contained in:
Antonio Cañas Vargas 2015-01-04 15:48:24 +01:00
parent 7bcf099d42
commit e7c19104b0
13 changed files with 64 additions and 489 deletions

View File

@ -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 \

View File

@ -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;

View File

@ -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

View File

@ -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:

View File

@ -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;

View File

@ -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 *****/

View File

@ -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,"</tr>"
"<tr>");
break;
@ -763,414 +740,6 @@ static void Lay_WritePageTopHeading (void)
}
}
/*****************************************************************************/
/*************** Set current tab depending on current action *****************/
/*****************************************************************************/
void Lay_SetCurrentTab (void)
{
Gbl.CurrentTab = Act_Actions[Gbl.CurrentAct].Tab;
/***** Change action and tab if country, institution, centre or degree
are incompatible with the current tab *****/
switch (Gbl.CurrentTab)
{
case TabCty:
if (Gbl.CurrentCty.Cty.CtyCod <= 0) // No country selected
Gbl.CurrentAct = ActSeeCty;
break;
case TabIns:
if (Gbl.CurrentIns.Ins.InsCod <= 0) // No institution selected
{
if (Gbl.CurrentCty.Cty.CtyCod > 0) // Country selected, but no institution selected
Gbl.CurrentAct = ActSeeIns;
else // No country selected
Gbl.CurrentAct = ActSeeCty;
}
break;
case TabCtr:
if (Gbl.CurrentCtr.Ctr.CtrCod <= 0) // No centre selected
{
if (Gbl.CurrentIns.Ins.InsCod > 0) // Institution selected, but no centre selected
Gbl.CurrentAct = ActSeeCtr;
else if (Gbl.CurrentCty.Cty.CtyCod > 0) // Country selected, but no institution selected
Gbl.CurrentAct = ActSeeIns;
else // No country selected
Gbl.CurrentAct = ActSeeCty;
}
break;
case TabDeg:
if (Gbl.CurrentDeg.Deg.DegCod <= 0) // No degree selected
{
if (Gbl.CurrentCtr.Ctr.CtrCod > 0) // Centre selected, but no degree selected
Gbl.CurrentAct = ActSeeDeg;
else if (Gbl.CurrentIns.Ins.InsCod > 0) // Institution selected, but no centre selected
Gbl.CurrentAct = ActSeeCtr;
else if (Gbl.CurrentCty.Cty.CtyCod > 0) // Country selected, but no institution selected
Gbl.CurrentAct = ActSeeIns;
else // No country selected
Gbl.CurrentAct = ActSeeCty;
}
break;
default:
break;
}
Gbl.CurrentTab = Act_Actions[Gbl.CurrentAct].Tab;
Lay_DisableIncompatibleTabs ();
}
/*****************************************************************************/
/************************** Disable incompatible tabs ************************/
/*****************************************************************************/
void Lay_DisableIncompatibleTabs (void)
{
/***** Set country, institution, centre, degree and course depending on the current tab.
This will disable tabs incompatible with the current one. *****/
switch (Gbl.CurrentTab)
{
case TabSys:
Gbl.CurrentCty.Cty.CtyCod = -1L;
// no break
case TabCty:
Gbl.CurrentIns.Ins.InsCod = -1L;
// no break
case TabIns:
Gbl.CurrentCtr.Ctr.CtrCod = -1L;
// no break
case TabCtr:
Gbl.CurrentDeg.Deg.DegCod = -1L;
// no break
case TabDeg:
Gbl.CurrentCrs.Crs.CrsCod = -1L;
break;
default:
break;
}
}
/*****************************************************************************/
/**************** Draw tabs with the current tab highlighted *****************/
/*****************************************************************************/
static void Lay_DrawTabs (void)
{
unsigned ColspanCentralPart = 3;
if (Gbl.Prefs.Layout == Lay_LAYOUT_DESKTOP)
{
if (Gbl.Prefs.SideCols == Lay_SHOW_BOTH_COLUMNS) // 11: both side columns visible, left and right
ColspanCentralPart = 1;
else if (Gbl.Prefs.SideCols != Lay_HIDE_BOTH_COLUMNS) // 10 or 01: only one side column visible, left or right
ColspanCentralPart = 2;
}
fprintf (Gbl.F.Out,"<td colspan=\"%u\" style=\"height:56px;"
" text-align:center; vertical-align:top;"
" background-image: url('%s/head_base_background_1x56.gif');"
" background-repeat:repeat-x;\">"
"<div id=\"tabs_container\">",
ColspanCentralPart,Gbl.Prefs.PathTheme);
switch (Gbl.Prefs.Layout)
{
case Lay_LAYOUT_DESKTOP:
Lay_DrawTabsDeskTop ();
break;
case Lay_LAYOUT_MOBILE:
Lay_DrawBreadcrumb ();
break;
default:
break;
}
fprintf (Gbl.F.Out,"</div>"
"</td>");
}
/*****************************************************************************/
/**************** Draw tabs with the current tab highlighted *****************/
/*****************************************************************************/
static void Lay_DrawTabsDeskTop (void)
{
extern const char *The_ClassTabOn[The_NUM_THEMES];
extern const char *The_ClassTabOff[The_NUM_THEMES];
extern const char *The_TabOnBgColors[The_NUM_THEMES];
extern const char *The_TabOffBgColors[The_NUM_THEMES];
extern const char *Txt_TABS_FULL_TXT[Act_NUM_TABS];
extern const char *Txt_TABS_SHORT_TXT[Act_NUM_TABS];
Act_Tab_t NumTab;
bool ICanViewTab;
/***** Table start *****/
fprintf (Gbl.F.Out,"<ul style=\"list-style-type:none; padding:0; margin:0;\">");
/***** Draw the tabs *****/
for (NumTab = (Act_Tab_t) 1;
NumTab <= (Act_Tab_t) Act_NUM_TABS - 1;
NumTab++)
{
ICanViewTab = Lay_CheckIfICanViewTab (NumTab);
/* If current tab is unknown, then activate the first one with access allowed */
if (Gbl.CurrentTab == TabUnk)
{
Gbl.CurrentTab = NumTab;
Lay_DisableIncompatibleTabs ();
}
if (ICanViewTab || NumTab > TabCrs) // Don't show the first hidden tabs
{
/* Form, icon (at top) and text (at bottom) of the tab */
fprintf (Gbl.F.Out,"<li class=\"%s\" style=\"background-color:%s;\">",
NumTab == Gbl.CurrentTab ? "TAB_ON" :
"TAB_OFF",
NumTab == Gbl.CurrentTab ? The_TabOnBgColors[Gbl.Prefs.Theme] :
The_TabOffBgColors[Gbl.Prefs.Theme]);
if (ICanViewTab)
{
fprintf (Gbl.F.Out,"<div"); // This div must be present even in current tab in order to render properly the tab
if (NumTab != Gbl.CurrentTab)
fprintf (Gbl.F.Out," class=\"ICON_HIGHLIGHT\"");
fprintf (Gbl.F.Out,">");
Act_FormStart (ActMnu);
Par_PutHiddenParamUnsigned ("NxtTab",(unsigned) NumTab);
Act_LinkFormSubmit (Txt_TABS_FULL_TXT[NumTab],
NumTab == Gbl.CurrentTab ? The_ClassTabOn[Gbl.Prefs.Theme] :
The_ClassTabOff[Gbl.Prefs.Theme]);
fprintf (Gbl.F.Out,"<img src=\"%s/%s/%s32x32.gif\""
" alt=\"%s\" title=\"%s\""
" class=\"ICON32x32\" style=\"margin:4px;\" />"
"<div>%s</div>"
"</a>"
"</form>",
Gbl.Prefs.PathIconSet,Cfg_ICON_ACTION_32x32,
Lay_TabIcons[NumTab],
Txt_TABS_FULL_TXT[NumTab],
Txt_TABS_FULL_TXT[NumTab],
Txt_TABS_SHORT_TXT[NumTab]);
}
else
fprintf (Gbl.F.Out,"<div class=\"ICON_HIDDEN\">"
"<img src=\"%s/%s/%s32x32.gif\""
" alt=\"%s\" title=\"%s\""
" class=\"ICON32x32\" style=\"margin:4px;\" />"
"<div class=\"%s\">%s</div>",
Gbl.Prefs.PathIconSet,Cfg_ICON_ACTION_32x32,
Lay_TabIcons[NumTab],
Txt_TABS_FULL_TXT[NumTab],
Txt_TABS_FULL_TXT[NumTab],
The_ClassTabOff[Gbl.Prefs.Theme],
Txt_TABS_SHORT_TXT[NumTab]);
fprintf (Gbl.F.Out,"</div>"
"</li>");
}
}
/***** End of the table *****/
fprintf (Gbl.F.Out,"</ul>");
}
/*****************************************************************************/
/************************ Draw vertical menu with tabs ***********************/
/*****************************************************************************/
static void Lay_DrawTabsMobile (void)
{
extern const char *The_ClassMenuOff[The_NUM_THEMES];
extern const char *Txt_TABS_FULL_TXT[Act_NUM_TABS];
unsigned NumTabVisible;
Act_Tab_t NumTab;
bool ICanViewTab;
/***** Table start *****/
fprintf (Gbl.F.Out,"<table style=\"width:100%%;\">");
/***** Loop to write all tabs. Each row holds a tab *****/
for (NumTabVisible = 0, NumTab = (Act_Tab_t) 1;
NumTab <= (Act_Tab_t) Act_NUM_TABS - 1;
NumTab++)
{
ICanViewTab = Lay_CheckIfICanViewTab (NumTab);
if (ICanViewTab || NumTab > TabCrs) // Don't show the first hidden tabs
{
if (NumTabVisible % Cfg_LAYOUT_MOBILE_NUM_COLUMNS == 0)
fprintf (Gbl.F.Out,"<tr>");
/* Icon at top and text at bottom */
fprintf (Gbl.F.Out,"<td style=\"width:25%%; text-align:center;"
" vertical-align:top;\">");
if (ICanViewTab)
{
fprintf (Gbl.F.Out,"<div class=\"ICON_HIGHLIGHT\">");
Act_FormStart (ActMnu);
Par_PutHiddenParamUnsigned ("NxtTab",(unsigned) NumTab);
Act_LinkFormSubmit (Txt_TABS_FULL_TXT[NumTab],The_ClassMenuOff[Gbl.Prefs.Theme]);
fprintf (Gbl.F.Out,"<input type=\"image\" src=\"%s/%s/%s64x64.gif\""
" alt=\"%s\" title=\"%s\" class=\"ICON64x64\""
" style=\"margin:4px;\" />"
"<div>%s</div>"
"</a>"
"</form>"
"</div>",
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,"<div class=\"ICON_HIDDEN\">"
"<img src=\"%s/%s/%s64x64.gif\""
" alt=\"%s\" title=\"%s\""
" class=\"ICON64x64\" style=\"margin:4px;\" />"
"<div class=\"%s\">%s</div>"
"</div>",
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,"</td>");
if ((NumTabVisible % Cfg_LAYOUT_MOBILE_NUM_COLUMNS) == (Cfg_LAYOUT_MOBILE_NUM_COLUMNS-1))
fprintf (Gbl.F.Out,"</tr>");
NumTabVisible++;
}
}
/***** End of the table *****/
fprintf (Gbl.F.Out,"</table>");
}
/*****************************************************************************/
/************************* Check if I can view a tab *************************/
/*****************************************************************************/
static bool Lay_CheckIfICanViewTab (Act_Tab_t Tab)
{
switch (Tab)
{
case TabUnk:
return false;
case TabSys:
return (Gbl.CurrentCty.Cty.CtyCod <= 0);
case TabCty:
return (Gbl.CurrentCty.Cty.CtyCod > 0 &&
Gbl.CurrentIns.Ins.InsCod <= 0);
case TabIns:
return (Gbl.CurrentIns.Ins.InsCod > 0 &&
Gbl.CurrentCtr.Ctr.CtrCod <= 0);
case TabCtr:
return (Gbl.CurrentCtr.Ctr.CtrCod > 0 &&
Gbl.CurrentDeg.Deg.DegCod <= 0);
case TabDeg:
return (Gbl.CurrentDeg.Deg.DegCod > 0 &&
Gbl.CurrentCrs.Crs.CrsCod <= 0);
case TabCrs:
case TabAss:
return (Gbl.CurrentCrs.Crs.CrsCod > 0);
case TabMsg:
return (Gbl.Usrs.Me.Logged ||
Gbl.CurrentCrs.Crs.CrsCod > 0);
default:
return true;
}
}
/*****************************************************************************/
/********************* Draw breadcrumb with tab and action *******************/
/*****************************************************************************/
static void Lay_DrawBreadcrumb (void)
{
extern const char *The_TabOnBgColors[The_NUM_THEMES];
extern const char *The_ClassTabOn[The_NUM_THEMES];
fprintf (Gbl.F.Out,"<div class=\"TAB_ON\" style=\"background-color:%s;\">",
The_TabOnBgColors[Gbl.Prefs.Theme]);
/***** Home *****/
Lay_WriteBreadcrumbHome ();
if (Gbl.CurrentAct == ActMnu ||
Act_Actions[Act_Actions[Gbl.CurrentAct].SuperAction].IndexInMenu >= 0)
{
/***** Tab *****/
fprintf (Gbl.F.Out,"<span class=\"%s\"> &gt; </span>",
The_ClassTabOn[Gbl.Prefs.Theme]);
Lay_WriteBreadcrumbTab ();
if (Act_Actions[Act_Actions[Gbl.CurrentAct].SuperAction].IndexInMenu >= 0)
{
/***** Menu *****/
fprintf (Gbl.F.Out,"<span class=\"%s\"> &gt; </span>",
The_ClassTabOn[Gbl.Prefs.Theme]);
Lay_WriteBreadcrumbAction ();
}
}
fprintf (Gbl.F.Out,"</div>");
}
/*****************************************************************************/
/************************ Write home in breadcrumb ***************************/
/*****************************************************************************/
static void Lay_WriteBreadcrumbHome (void)
{
extern const char *The_ClassTabOn[The_NUM_THEMES];
extern const char *Txt_Home_PAGE;
Act_FormStart (ActHom);
Act_LinkFormSubmit (Txt_Home_PAGE,The_ClassTabOn[Gbl.Prefs.Theme]);
fprintf (Gbl.F.Out,"%s</a>"
"</form>",
Txt_Home_PAGE);
}
/*****************************************************************************/
/************ Write icon and title associated to the current tab *************/
/*****************************************************************************/
static void Lay_WriteBreadcrumbTab (void)
{
extern const char *The_ClassTabOn[The_NUM_THEMES];
extern const char *Txt_TABS_FULL_TXT[Act_NUM_TABS];
/***** Start form *****/
Act_FormStart (ActMnu);
Par_PutHiddenParamUnsigned ("NxtTab",(unsigned) Gbl.CurrentTab);
Act_LinkFormSubmit (Txt_TABS_FULL_TXT[Gbl.CurrentTab],The_ClassTabOn[Gbl.Prefs.Theme]);
/***** Title and end of form *****/
fprintf (Gbl.F.Out,"%s</a>"
"</form>",
Txt_TABS_FULL_TXT[Gbl.CurrentTab]);
}
/*****************************************************************************/
/***************** Write title associated to the current action **************/
/*****************************************************************************/
static void Lay_WriteBreadcrumbAction (void)
{
extern const char *The_ClassTabOn[The_NUM_THEMES];
const char *Title = Act_GetTitleAction (Gbl.CurrentAct);
/***** Start form *****/
Act_FormStart (Act_Actions[Gbl.CurrentAct].SuperAction);
Act_LinkFormSubmit (Title,The_ClassTabOn[Gbl.Prefs.Theme]);
/***** Title and end of form *****/
fprintf (Gbl.F.Out,"%s</a>"
"</form>",
Title);
}
/*****************************************************************************/
/*********** Write icon and title associated to the current action ***********/
/*****************************************************************************/
@ -1179,7 +748,7 @@ static void Lay_WriteTitleAction (void)
{
extern const char *The_ClassTitleAction[The_NUM_THEMES];
extern const char *The_ClassSubtitleAction[The_NUM_THEMES];
extern const char *Txt_TABS_FULL_TXT[Act_NUM_TABS];
extern const char *Txt_TABS_FULL_TXT[Tab_NUM_TABS];
/***** Container start *****/
fprintf (Gbl.F.Out,"<div id=\"action_title\""

View File

@ -86,9 +86,6 @@ typedef enum
void Lay_WriteStartOfPage (void);
void Lay_WriteTitle (const char *Title);
void Lay_SetCurrentTab (void);
void Lay_DisableIncompatibleTabs (void);
void Lay_PutFormToEdit (Act_Action_t Action);
void Lay_PutSendIcon (const char *Icon,const char *Alt,const char *Text);
void Lay_PutSendButton (const char *TextSendButton);

View File

@ -1,4 +1,4 @@
// swad_menu.h: menu (horizontal or vertical) selection
// swad_menu.c: menu (horizontal or vertical) selection
/*
SWAD (Shared Workspace At a Distance),
@ -33,6 +33,7 @@
#include "swad_menu.h"
#include "swad_parameter.h"
#include "swad_preference.h"
#include "swad_tab.h"
/*****************************************************************************/
/************** External global variables from others modules ****************/
@ -42,7 +43,7 @@ extern struct Globals Gbl;
extern struct Act_Actions Act_Actions[Act_NUM_ACTIONS];
/*****************************************************************************/
/******************************** Private constants **************************/
/****************************** Private constants ****************************/
/*****************************************************************************/
#define MAX_MENU_ID 16
@ -65,7 +66,6 @@ const char *Mnu_MenuIcons[Mnu_NUM_MENUS] =
"vertical",
};
/*****************************************************************************/
/************* Write the menu of current tab (desktop layout) ****************/
/*****************************************************************************/
@ -75,8 +75,8 @@ void Mnu_WriteVerticalMenuThisTabDesktop (void)
extern const char *The_ClassMenuOn[The_NUM_THEMES];
extern const char *The_ClassMenuOff[The_NUM_THEMES];
extern const char *The_ClassSeparator[The_NUM_THEMES];
extern const struct Act_Menu Act_Menu[Act_NUM_TABS][Act_MAX_OPTIONS_IN_MENU_PER_TAB];
extern const char *Txt_MENU_TITLE[Act_NUM_TABS][Act_MAX_OPTIONS_IN_MENU_PER_TAB];
extern const struct Act_Menu Act_Menu[Tab_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 NumOptInMenu;
Act_Action_t NumAct;
const char *Title;
@ -166,8 +166,8 @@ void Mnu_WriteHorizontalMenuThisTabDesktop (void)
{
extern const char *The_ClassMenuOn[The_NUM_THEMES];
extern const char *The_ClassMenuOff[The_NUM_THEMES];
extern const struct Act_Menu Act_Menu[Act_NUM_TABS][Act_MAX_OPTIONS_IN_MENU_PER_TAB];
extern const char *Txt_MENU_TITLE[Act_NUM_TABS][Act_MAX_OPTIONS_IN_MENU_PER_TAB];
extern const struct Act_Menu Act_Menu[Tab_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 NumOptInMenu;
Act_Action_t NumAct;
const char *Title;
@ -238,8 +238,8 @@ void Mnu_WriteMenuThisTabMobile (void)
{
extern const char *The_ClassMenuOn[The_NUM_THEMES];
extern const char *The_ClassMenuOff[The_NUM_THEMES];
extern const struct Act_Menu Act_Menu[Act_NUM_TABS][Act_MAX_OPTIONS_IN_MENU_PER_TAB];
extern const char *Txt_MENU_TITLE[Act_NUM_TABS][Act_MAX_OPTIONS_IN_MENU_PER_TAB];
extern const struct Act_Menu Act_Menu[Tab_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 NumOptInMenu;
unsigned NumOptVisible; // Only options I can see
Act_Action_t NumAct;

View File

@ -36,6 +36,7 @@
#include "swad_parameter.h"
#include "swad_password.h"
#include "swad_preference.h"
#include "swad_tab.h"
/*****************************************************************************/
/*************** External global variables from others modules ***************/
@ -149,7 +150,7 @@ void Par_GetMainParameters (void)
if (Gbl.WebService.IsWebService)
{
Gbl.CurrentAct = ActWebSvc;
Lay_SetCurrentTab ();
Tab_SetCurrentTab ();
return;
}
@ -159,7 +160,7 @@ void Par_GetMainParameters (void)
Gbl.Imported.ExternalSesId[0])
{
Gbl.CurrentAct = ActAutUsrExt;
Lay_SetCurrentTab ();
Tab_SetCurrentTab ();
return;
}
// SWAD is not called from external site
@ -300,14 +301,14 @@ void Par_GetMainParameters (void)
Par_GetParToText ("NxtTab",UnsignedStr,10);
if (UnsignedStr[0])
if (sscanf (UnsignedStr,"%u",&UnsignedNum) == 1)
if (UnsignedNum < Act_NUM_TABS)
if (UnsignedNum < Tab_NUM_TABS)
{
Gbl.CurrentTab = (Act_Tab_t) UnsignedNum;
Lay_DisableIncompatibleTabs ();
Tab_DisableIncompatibleTabs ();
}
}
else // Set tab depending on current action
Lay_SetCurrentTab ();
Tab_SetCurrentTab ();
}
/*****************************************************************************/

View File

@ -46,6 +46,7 @@
#include "swad_notification.h"
#include "swad_parameter.h"
#include "swad_statistic.h"
#include "swad_tab.h"
#include "swad_web_service.h"
/*****************************************************************************/
@ -688,7 +689,7 @@ static void Sta_WriteSelectorAction (void)
{
extern const char *The_ClassFormul[The_NUM_THEMES];
extern const char *Txt_Action;
extern const char *Txt_TABS_SHORT_TXT[Act_NUM_TABS];
extern const char *Txt_TABS_SHORT_TXT[Tab_NUM_TABS];
Act_Action_t NumAction;
char ActTxt[Act_MAX_LENGTH_ACTION_TXT+1];

View File

@ -83,6 +83,7 @@
#include "swad_statistic.h"
#include "swad_survey.h"
#include "swad_syllabus.h"
#include "swad_tab.h"
#include "swad_test.h"
#include "swad_text.h"
#include "swad_timetable.h"
@ -15580,7 +15581,7 @@ const char *Txt_MENU_NAMES[Mnu_NUM_MENUS] =
#endif
};
const char *Txt_MENU_TITLE[Act_NUM_TABS][Act_MAX_OPTIONS_IN_MENU_PER_TAB] =
const char *Txt_MENU_TITLE[Tab_NUM_TABS][Act_MAX_OPTIONS_IN_MENU_PER_TAB] =
{
{
// TabUnk ****************************************************
@ -17394,7 +17395,7 @@ const char *Txt_MENU_TITLE[Act_NUM_TABS][Act_MAX_OPTIONS_IN_MENU_PER_TAB] =
}
};
const char *Txt_MENU_SUBTITLE[Act_NUM_TABS][Act_MAX_OPTIONS_IN_MENU_PER_TAB] =
const char *Txt_MENU_SUBTITLE[Tab_NUM_TABS][Act_MAX_OPTIONS_IN_MENU_PER_TAB] =
{
{
// TabUnk ****************************************************
@ -36238,7 +36239,7 @@ const char *Txt_Table_not_found_in_the_file_of_marks =
"Table not found in the file of marks."; // Necessita de tradução
#endif
const char *Txt_TABS_FULL_TXT[Act_NUM_TABS] =
const char *Txt_TABS_FULL_TXT[Tab_NUM_TABS] =
{
// TabUnk
NULL,
@ -36474,7 +36475,7 @@ const char *Txt_TABS_FULL_TXT[Act_NUM_TABS] =
#endif
};
const char *Txt_TABS_SHORT_TXT[Act_NUM_TABS] = // Must be visible in 1024x768 without horizontal scroll bar
const char *Txt_TABS_SHORT_TXT[Tab_NUM_TABS] = // Must be visible in 1024x768 without horizontal scroll bar
{
// TabUnk
NULL,

View File

@ -50,6 +50,7 @@
#include "swad_password.h"
#include "swad_preference.h"
#include "swad_record.h"
#include "swad_tab.h"
#include "swad_user.h"
/*****************************************************************************/
@ -614,7 +615,7 @@ static void Usr_GetMyLastData (void)
/* Get last tab */
Gbl.Usrs.Me.UsrLast.LastTab = TabPrf; // By default, set last tab to the profile tab
if (sscanf (row[2],"%u",&UnsignedNum) == 1)
if (UnsignedNum >= 1 || UnsignedNum <= Act_NUM_TABS)
if (UnsignedNum >= 1 || UnsignedNum <= Tab_NUM_TABS)
Gbl.Usrs.Me.UsrLast.LastTab = (Act_Tab_t) UnsignedNum;
/* Get last access to notifications */
@ -1698,7 +1699,7 @@ void Usr_ChkUsrAndGetUsrData (void)
if (Gbl.CurrentAct != ActRefCon)
{
Gbl.CurrentAct = ActLogOut;
Lay_SetCurrentTab ();
Tab_SetCurrentTab ();
Lay_ShowAlert (Lay_WARNING,Txt_The_session_has_expired_due_to_inactivity);
PutFormLogin = true;
}
@ -1800,7 +1801,7 @@ void Usr_ChkUsrAndGetUsrData (void)
Gbl.CurrentTab = ((Gbl.Usrs.Me.UsrLast.LastTab == TabCrs) &&
(Gbl.CurrentCrs.Crs.CrsCod <= 0)) ? TabSys :
Gbl.Usrs.Me.UsrLast.LastTab;
Lay_DisableIncompatibleTabs ();
Tab_DisableIncompatibleTabs ();
}
Usr_UpdateMyLastData ();
Crs_UpdateCrsLast ();