2015-01-17 20:07:13 +01:00
|
|
|
|
// swad_tab.c: tabs drawing
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
SWAD (Shared Workspace At a Distance),
|
|
|
|
|
is a web platform developed at the University of Granada (Spain),
|
|
|
|
|
and used to support university teaching.
|
|
|
|
|
|
|
|
|
|
This file is part of SWAD core.
|
2017-01-13 01:51:23 +01:00
|
|
|
|
Copyright (C) 1999-2017 Antonio Ca<EFBFBD>as Vargas
|
2015-01-17 20:07:13 +01:00
|
|
|
|
|
|
|
|
|
This program is free software: you can redistribute it and/or modify
|
|
|
|
|
it under the terms of the GNU Affero General Public License as
|
|
|
|
|
published by the Free Software Foundation, either version 3 of the
|
|
|
|
|
License, or (at your option) any later version.
|
|
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
GNU Affero General Public License for more details.
|
|
|
|
|
|
|
|
|
|
You should have received a copy of the GNU Affero General Public License
|
|
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
*/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/********************************* Headers ***********************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
#include "swad_global.h"
|
|
|
|
|
#include "swad_parameter.h"
|
|
|
|
|
#include "swad_tab.h"
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/************** External global variables from others modules ****************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
extern struct Globals Gbl;
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/****************************** Private constants ****************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
const char *Tab_TabIcons[Tab_NUM_TABS] =
|
|
|
|
|
{
|
|
|
|
|
/* TabUnk */ NULL,
|
2015-12-28 12:55:08 +01:00
|
|
|
|
/* TabSys */ "sys64x64.gif",
|
|
|
|
|
/* TabCty */ "cty64x64.gif",
|
|
|
|
|
/* TabIns */ "ins64x64.gif",
|
|
|
|
|
/* TabCtr */ "ctr64x64.gif",
|
|
|
|
|
/* TabDeg */ "deg64x64.gif",
|
|
|
|
|
/* TabCrs */ "crs64x64.gif",
|
|
|
|
|
/* TabAss */ "ass64x64.gif",
|
2017-02-08 23:25:29 +01:00
|
|
|
|
/* TabFil */ "fil64x64.gif",
|
2015-12-28 12:55:08 +01:00
|
|
|
|
/* TabUsr */ "usr64x64.gif",
|
|
|
|
|
/* TabSoc */ "soc64x64.png",
|
|
|
|
|
/* TabMsg */ "msg64x64.gif",
|
2017-04-27 13:47:57 +02:00
|
|
|
|
/* TabAna */ "sta64x64.gif",
|
2015-12-28 12:55:08 +01:00
|
|
|
|
/* TabPrf */ "prf64x64.gif",
|
2015-01-17 20:07:13 +01:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/******************************* Private types *******************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/***************************** Private variables *****************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/***************************** Private prototypes ****************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2016-10-12 14:02:56 +02:00
|
|
|
|
static bool Tab_CheckIfICanViewTab (Tab_Tab_t Tab);
|
2015-01-17 20:07:13 +01:00
|
|
|
|
|
|
|
|
|
static void Tab_WriteBreadcrumbHome (void);
|
|
|
|
|
static void Tab_WriteBreadcrumbTab (void);
|
|
|
|
|
static void Tab_WriteBreadcrumbAction (void);
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/**************** Draw tabs with the current tab highlighted *****************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2015-11-27 13:45:39 +01:00
|
|
|
|
void Tab_DrawTabs (void)
|
2015-01-17 20:07:13 +01:00
|
|
|
|
{
|
2015-11-30 01:13:00 +01:00
|
|
|
|
extern const char *The_ClassTxtTabOn[The_NUM_THEMES];
|
|
|
|
|
extern const char *The_ClassTxtTabOff[The_NUM_THEMES];
|
2015-01-17 20:07:13 +01:00
|
|
|
|
extern const char *The_TabOnBgColors[The_NUM_THEMES];
|
|
|
|
|
extern const char *The_TabOffBgColors[The_NUM_THEMES];
|
2016-12-28 17:22:25 +01:00
|
|
|
|
extern const char *Txt_TABS_TXT[Tab_NUM_TABS];
|
|
|
|
|
extern const char *Txt_TABS_TXT[Tab_NUM_TABS];
|
2016-10-12 14:02:56 +02:00
|
|
|
|
Tab_Tab_t NumTab;
|
2015-01-17 20:07:13 +01:00
|
|
|
|
bool ICanViewTab;
|
2016-12-18 19:50:33 +01:00
|
|
|
|
const char *ClassHeadRow3[The_NUM_THEMES] =
|
|
|
|
|
{
|
|
|
|
|
"HEAD_ROW_3_WHITE", // The_THEME_WHITE
|
|
|
|
|
"HEAD_ROW_3_GREY", // The_THEME_GREY
|
|
|
|
|
"HEAD_ROW_3_BLUE", // The_THEME_BLUE
|
|
|
|
|
"HEAD_ROW_3_YELLOW", // The_THEME_YELLOW
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/***** Start tabs container *****/
|
|
|
|
|
fprintf (Gbl.F.Out,"<div class=\"%s\">"
|
|
|
|
|
"<nav id=\"tabs\">"
|
2016-12-19 00:55:24 +01:00
|
|
|
|
"<ul class=\"LIST_LEFT\">",
|
2016-12-18 19:50:33 +01:00
|
|
|
|
ClassHeadRow3[Gbl.Prefs.Theme]);
|
2015-01-17 20:07:13 +01:00
|
|
|
|
|
|
|
|
|
/***** Draw the tabs *****/
|
2016-10-12 14:02:56 +02:00
|
|
|
|
for (NumTab = (Tab_Tab_t) 1;
|
|
|
|
|
NumTab <= (Tab_Tab_t) Tab_NUM_TABS - 1;
|
2015-01-17 20:07:13 +01:00
|
|
|
|
NumTab++)
|
|
|
|
|
{
|
|
|
|
|
ICanViewTab = Tab_CheckIfICanViewTab (NumTab);
|
|
|
|
|
|
|
|
|
|
/* If current tab is unknown, then activate the first one with access allowed */
|
2016-01-17 15:10:54 +01:00
|
|
|
|
if (Gbl.Action.Tab == TabUnk)
|
2015-01-17 20:07:13 +01:00
|
|
|
|
{
|
2016-01-17 15:10:54 +01:00
|
|
|
|
Gbl.Action.Tab = NumTab;
|
2015-01-17 20:07:13 +01:00
|
|
|
|
Tab_DisableIncompatibleTabs ();
|
|
|
|
|
}
|
|
|
|
|
|
2016-12-10 16:12:19 +01:00
|
|
|
|
if (ICanViewTab) // Don't show the first hidden tabs
|
2015-01-17 20:07:13 +01:00
|
|
|
|
{
|
|
|
|
|
/* Form, icon (at top) and text (at bottom) of the tab */
|
2015-09-04 19:26:08 +02:00
|
|
|
|
fprintf (Gbl.F.Out,"<li class=\"%s %s\">",
|
2016-01-17 15:10:54 +01:00
|
|
|
|
NumTab == Gbl.Action.Tab ? "TAB_ON" :
|
2015-01-17 20:07:13 +01:00
|
|
|
|
"TAB_OFF",
|
2016-01-17 15:10:54 +01:00
|
|
|
|
NumTab == Gbl.Action.Tab ? The_TabOnBgColors[Gbl.Prefs.Theme] :
|
2015-01-17 20:07:13 +01:00
|
|
|
|
The_TabOffBgColors[Gbl.Prefs.Theme]);
|
2016-12-10 16:12:19 +01:00
|
|
|
|
|
|
|
|
|
fprintf (Gbl.F.Out,"<div"); // This div must be present even in current tab in order to render properly the tab
|
|
|
|
|
if (NumTab != Gbl.Action.Tab)
|
|
|
|
|
fprintf (Gbl.F.Out," class=\"ICO_HIGHLIGHT\"");
|
|
|
|
|
fprintf (Gbl.F.Out,">");
|
|
|
|
|
|
|
|
|
|
Act_FormStart (ActMnu);
|
|
|
|
|
Par_PutHiddenParamUnsigned ("NxtTab",(unsigned) NumTab);
|
2016-12-28 17:22:25 +01:00
|
|
|
|
Act_LinkFormSubmit (Txt_TABS_TXT[NumTab],
|
2016-12-10 16:12:19 +01:00
|
|
|
|
NumTab == Gbl.Action.Tab ? The_ClassTxtTabOn[Gbl.Prefs.Theme] :
|
|
|
|
|
The_ClassTxtTabOff[Gbl.Prefs.Theme],NULL);
|
|
|
|
|
fprintf (Gbl.F.Out,"<img src=\"%s/%s/%s\" alt=\"%s\" title=\"%s\""
|
|
|
|
|
" class=\"TAB_ICO\" />"
|
|
|
|
|
"<div class=\"TAB_TXT %s\">%s</div>"
|
|
|
|
|
"</a>",
|
|
|
|
|
Gbl.Prefs.PathIconSet,Cfg_ICON_ACTION,
|
|
|
|
|
Tab_TabIcons[NumTab],
|
2016-12-28 17:22:25 +01:00
|
|
|
|
Txt_TABS_TXT[NumTab],
|
|
|
|
|
Txt_TABS_TXT[NumTab],
|
2016-12-10 16:12:19 +01:00
|
|
|
|
NumTab == Gbl.Action.Tab ? The_ClassTxtTabOn[Gbl.Prefs.Theme] :
|
|
|
|
|
The_ClassTxtTabOff[Gbl.Prefs.Theme],
|
2016-12-28 17:22:25 +01:00
|
|
|
|
Txt_TABS_TXT[NumTab]);
|
2016-12-10 16:12:19 +01:00
|
|
|
|
Act_FormEnd ();
|
2015-01-17 20:07:13 +01:00
|
|
|
|
|
|
|
|
|
fprintf (Gbl.F.Out,"</div>"
|
|
|
|
|
"</li>");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2016-12-18 19:50:33 +01:00
|
|
|
|
/***** End tabs container *****/
|
2015-12-01 22:31:01 +01:00
|
|
|
|
fprintf (Gbl.F.Out,"</ul>"
|
2016-12-18 19:50:33 +01:00
|
|
|
|
"</nav>"
|
|
|
|
|
"</div>");
|
2015-01-17 20:07:13 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/************************* Check if I can view a tab *************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2016-10-12 14:02:56 +02:00
|
|
|
|
static bool Tab_CheckIfICanViewTab (Tab_Tab_t Tab)
|
2015-01-17 20:07:13 +01:00
|
|
|
|
{
|
|
|
|
|
switch (Tab)
|
|
|
|
|
{
|
|
|
|
|
case TabUnk:
|
|
|
|
|
return false;
|
|
|
|
|
case TabSys:
|
2017-04-29 21:32:04 +02:00
|
|
|
|
return (Gbl.CurrentCty.Cty.CtyCod <= 0); // No country selected
|
2015-01-17 20:07:13 +01:00
|
|
|
|
case TabCty:
|
2017-04-29 21:32:04 +02:00
|
|
|
|
return (Gbl.CurrentCty.Cty.CtyCod > 0 && // Country selected
|
|
|
|
|
Gbl.CurrentIns.Ins.InsCod <= 0); // No institution selected
|
2015-01-17 20:07:13 +01:00
|
|
|
|
case TabIns:
|
2017-04-29 21:32:04 +02:00
|
|
|
|
return (Gbl.CurrentIns.Ins.InsCod > 0 && // Institution selected
|
|
|
|
|
Gbl.CurrentCtr.Ctr.CtrCod <= 0); // No centre selected
|
2015-01-17 20:07:13 +01:00
|
|
|
|
case TabCtr:
|
2017-04-29 21:32:04 +02:00
|
|
|
|
return (Gbl.CurrentCtr.Ctr.CtrCod > 0 && // Centre selected
|
|
|
|
|
Gbl.CurrentDeg.Deg.DegCod <= 0); // No degree selected
|
2015-01-17 20:07:13 +01:00
|
|
|
|
case TabDeg:
|
2017-04-29 21:32:04 +02:00
|
|
|
|
return (Gbl.CurrentDeg.Deg.DegCod > 0 && // Degree selected
|
|
|
|
|
Gbl.CurrentCrs.Crs.CrsCod <= 0); // No course selected
|
2015-01-17 20:07:13 +01:00
|
|
|
|
case TabCrs:
|
2017-04-29 21:32:04 +02:00
|
|
|
|
return (Gbl.CurrentCrs.Crs.CrsCod > 0); // Course selected
|
|
|
|
|
case TabAss:
|
|
|
|
|
return (Gbl.CurrentCrs.Crs.CrsCod > 0 || // Course selected
|
|
|
|
|
Gbl.Usrs.Me.LoggedRole >= Rol_STUDENT);// Surveys not available for unknown users and guests
|
2017-02-09 10:31:21 +01:00
|
|
|
|
case TabFil:
|
2017-04-29 21:32:04 +02:00
|
|
|
|
return (Gbl.CurrentIns.Ins.InsCod > 0); // Institution selected
|
2015-01-17 20:07:13 +01:00
|
|
|
|
default:
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/********************* Draw breadcrumb with tab and action *******************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
void Tab_DrawBreadcrumb (void)
|
|
|
|
|
{
|
2016-04-23 23:39:07 +02:00
|
|
|
|
extern struct Act_Actions Act_Actions[Act_NUM_ACTIONS];
|
2015-01-17 20:07:13 +01:00
|
|
|
|
extern const char *The_TabOnBgColors[The_NUM_THEMES];
|
2015-11-30 01:13:00 +01:00
|
|
|
|
extern const char *The_ClassTxtTabOn[The_NUM_THEMES];
|
2015-01-17 20:07:13 +01:00
|
|
|
|
|
2015-11-25 14:44:17 +01:00
|
|
|
|
fprintf (Gbl.F.Out,"<div id=\"breadcrumb_container\" class=\"%s\">",
|
2015-01-17 20:07:13 +01:00
|
|
|
|
The_TabOnBgColors[Gbl.Prefs.Theme]);
|
|
|
|
|
|
|
|
|
|
/***** Home *****/
|
|
|
|
|
Tab_WriteBreadcrumbHome ();
|
|
|
|
|
|
2016-01-17 15:10:54 +01:00
|
|
|
|
if (Gbl.Action.Act == ActMnu ||
|
|
|
|
|
Act_Actions[Act_Actions[Gbl.Action.Act].SuperAction].IndexInMenu >= 0)
|
2015-01-17 20:07:13 +01:00
|
|
|
|
{
|
|
|
|
|
/***** Tab *****/
|
|
|
|
|
fprintf (Gbl.F.Out,"<span class=\"%s\"> > </span>",
|
2015-11-30 01:13:00 +01:00
|
|
|
|
The_ClassTxtTabOn[Gbl.Prefs.Theme]);
|
2015-01-17 20:07:13 +01:00
|
|
|
|
Tab_WriteBreadcrumbTab ();
|
|
|
|
|
|
2016-01-17 15:10:54 +01:00
|
|
|
|
if (Act_Actions[Act_Actions[Gbl.Action.Act].SuperAction].IndexInMenu >= 0)
|
2015-01-17 20:07:13 +01:00
|
|
|
|
{
|
|
|
|
|
/***** Menu *****/
|
|
|
|
|
fprintf (Gbl.F.Out,"<span class=\"%s\"> > </span>",
|
2015-11-30 01:13:00 +01:00
|
|
|
|
The_ClassTxtTabOn[Gbl.Prefs.Theme]);
|
2015-01-17 20:07:13 +01:00
|
|
|
|
Tab_WriteBreadcrumbAction ();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fprintf (Gbl.F.Out,"</div>");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/************************ Write home in breadcrumb ***************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
static void Tab_WriteBreadcrumbHome (void)
|
|
|
|
|
{
|
2015-11-30 01:13:00 +01:00
|
|
|
|
extern const char *The_ClassTxtTabOn[The_NUM_THEMES];
|
2015-01-17 20:07:13 +01:00
|
|
|
|
extern const char *Txt_Home_PAGE;
|
|
|
|
|
|
|
|
|
|
Act_FormStart (ActHom);
|
2016-07-01 17:13:41 +02:00
|
|
|
|
Act_LinkFormSubmit (Txt_Home_PAGE,The_ClassTxtTabOn[Gbl.Prefs.Theme],NULL);
|
2015-03-13 00:16:02 +01:00
|
|
|
|
fprintf (Gbl.F.Out,"%s</a>",
|
2015-01-17 20:07:13 +01:00
|
|
|
|
Txt_Home_PAGE);
|
2015-03-13 00:16:02 +01:00
|
|
|
|
Act_FormEnd ();
|
2015-01-17 20:07:13 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/************ Write icon and title associated to the current tab *************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
static void Tab_WriteBreadcrumbTab (void)
|
|
|
|
|
{
|
2015-11-30 01:13:00 +01:00
|
|
|
|
extern const char *The_ClassTxtTabOn[The_NUM_THEMES];
|
2016-12-28 17:22:25 +01:00
|
|
|
|
extern const char *Txt_TABS_TXT[Tab_NUM_TABS];
|
2015-01-17 20:07:13 +01:00
|
|
|
|
|
|
|
|
|
/***** Start form *****/
|
|
|
|
|
Act_FormStart (ActMnu);
|
2016-01-17 15:10:54 +01:00
|
|
|
|
Par_PutHiddenParamUnsigned ("NxtTab",(unsigned) Gbl.Action.Tab);
|
2016-12-28 17:22:25 +01:00
|
|
|
|
Act_LinkFormSubmit (Txt_TABS_TXT[Gbl.Action.Tab],The_ClassTxtTabOn[Gbl.Prefs.Theme],NULL);
|
2015-01-17 20:07:13 +01:00
|
|
|
|
|
|
|
|
|
/***** Title and end of form *****/
|
2016-12-28 17:22:25 +01:00
|
|
|
|
fprintf (Gbl.F.Out,"%s</a>",Txt_TABS_TXT[Gbl.Action.Tab]);
|
2015-03-13 00:16:02 +01:00
|
|
|
|
Act_FormEnd ();
|
2015-01-17 20:07:13 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/***************** Write title associated to the current action **************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
static void Tab_WriteBreadcrumbAction (void)
|
|
|
|
|
{
|
2016-04-23 23:39:07 +02:00
|
|
|
|
extern struct Act_Actions Act_Actions[Act_NUM_ACTIONS];
|
2015-11-30 01:13:00 +01:00
|
|
|
|
extern const char *The_ClassTxtTabOn[The_NUM_THEMES];
|
2016-01-17 15:10:54 +01:00
|
|
|
|
const char *Title = Act_GetTitleAction (Gbl.Action.Act);
|
2015-01-17 20:07:13 +01:00
|
|
|
|
|
|
|
|
|
/***** Start form *****/
|
2016-01-17 15:10:54 +01:00
|
|
|
|
Act_FormStart (Act_Actions[Gbl.Action.Act].SuperAction);
|
2016-07-01 17:13:41 +02:00
|
|
|
|
Act_LinkFormSubmit (Title,The_ClassTxtTabOn[Gbl.Prefs.Theme],NULL);
|
2015-01-17 20:07:13 +01:00
|
|
|
|
|
|
|
|
|
/***** Title and end of form *****/
|
2015-03-13 00:16:02 +01:00
|
|
|
|
fprintf (Gbl.F.Out,"%s</a>",
|
2015-01-17 20:07:13 +01:00
|
|
|
|
Title);
|
2015-03-13 00:16:02 +01:00
|
|
|
|
Act_FormEnd ();
|
2015-01-17 20:07:13 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/*************** Set current tab depending on current action *****************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
void Tab_SetCurrentTab (void)
|
|
|
|
|
{
|
2016-04-23 23:39:07 +02:00
|
|
|
|
extern struct Act_Actions Act_Actions[Act_NUM_ACTIONS];
|
2016-10-20 22:58:11 +02:00
|
|
|
|
Act_Action_t SuperAction;
|
2016-04-23 23:39:07 +02:00
|
|
|
|
|
2016-10-20 22:58:11 +02:00
|
|
|
|
SuperAction = Act_Actions[Gbl.Action.Act].SuperAction;
|
|
|
|
|
Gbl.Action.Tab = Act_Actions[SuperAction].Tab;
|
2015-01-17 20:07:13 +01:00
|
|
|
|
|
|
|
|
|
/***** Change action and tab if country, institution, centre or degree
|
|
|
|
|
are incompatible with the current tab *****/
|
2016-01-17 15:10:54 +01:00
|
|
|
|
switch (Gbl.Action.Tab)
|
2015-01-17 20:07:13 +01:00
|
|
|
|
{
|
|
|
|
|
case TabCty:
|
|
|
|
|
if (Gbl.CurrentCty.Cty.CtyCod <= 0) // No country selected
|
2016-01-17 15:10:54 +01:00
|
|
|
|
Gbl.Action.Act = ActSeeCty;
|
2015-01-17 20:07:13 +01:00
|
|
|
|
break;
|
|
|
|
|
case TabIns:
|
|
|
|
|
if (Gbl.CurrentIns.Ins.InsCod <= 0) // No institution selected
|
|
|
|
|
{
|
|
|
|
|
if (Gbl.CurrentCty.Cty.CtyCod > 0) // Country selected, but no institution selected
|
2016-01-17 15:10:54 +01:00
|
|
|
|
Gbl.Action.Act = ActSeeIns;
|
2015-01-17 20:07:13 +01:00
|
|
|
|
else // No country selected
|
2016-01-17 15:10:54 +01:00
|
|
|
|
Gbl.Action.Act = ActSeeCty;
|
2015-01-17 20:07:13 +01:00
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case TabCtr:
|
|
|
|
|
if (Gbl.CurrentCtr.Ctr.CtrCod <= 0) // No centre selected
|
|
|
|
|
{
|
|
|
|
|
if (Gbl.CurrentIns.Ins.InsCod > 0) // Institution selected, but no centre selected
|
2016-01-17 15:10:54 +01:00
|
|
|
|
Gbl.Action.Act = ActSeeCtr;
|
2015-01-17 20:07:13 +01:00
|
|
|
|
else if (Gbl.CurrentCty.Cty.CtyCod > 0) // Country selected, but no institution selected
|
2016-01-17 15:10:54 +01:00
|
|
|
|
Gbl.Action.Act = ActSeeIns;
|
2015-01-17 20:07:13 +01:00
|
|
|
|
else // No country selected
|
2016-01-17 15:10:54 +01:00
|
|
|
|
Gbl.Action.Act = ActSeeCty;
|
2015-01-17 20:07:13 +01:00
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case TabDeg:
|
|
|
|
|
if (Gbl.CurrentDeg.Deg.DegCod <= 0) // No degree selected
|
|
|
|
|
{
|
|
|
|
|
if (Gbl.CurrentCtr.Ctr.CtrCod > 0) // Centre selected, but no degree selected
|
2016-01-17 15:10:54 +01:00
|
|
|
|
Gbl.Action.Act = ActSeeDeg;
|
2015-01-17 20:07:13 +01:00
|
|
|
|
else if (Gbl.CurrentIns.Ins.InsCod > 0) // Institution selected, but no centre selected
|
2016-01-17 15:10:54 +01:00
|
|
|
|
Gbl.Action.Act = ActSeeCtr;
|
2015-01-17 20:07:13 +01:00
|
|
|
|
else if (Gbl.CurrentCty.Cty.CtyCod > 0) // Country selected, but no institution selected
|
2016-01-17 15:10:54 +01:00
|
|
|
|
Gbl.Action.Act = ActSeeIns;
|
2015-01-17 20:07:13 +01:00
|
|
|
|
else // No country selected
|
2016-01-17 15:10:54 +01:00
|
|
|
|
Gbl.Action.Act = ActSeeCty;
|
2015-01-17 20:07:13 +01:00
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
2016-10-20 22:58:11 +02:00
|
|
|
|
|
|
|
|
|
SuperAction = Act_Actions[Gbl.Action.Act].SuperAction;
|
|
|
|
|
Gbl.Action.Tab = Act_Actions[SuperAction].Tab;
|
2015-01-17 20:07:13 +01:00
|
|
|
|
|
|
|
|
|
Tab_DisableIncompatibleTabs ();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/************************** Disable incompatible tabs ************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
void Tab_DisableIncompatibleTabs (void)
|
|
|
|
|
{
|
|
|
|
|
/***** Set country, institution, centre, degree and course depending on the current tab.
|
|
|
|
|
This will disable tabs incompatible with the current one. *****/
|
2016-01-17 15:10:54 +01:00
|
|
|
|
switch (Gbl.Action.Tab)
|
2015-01-17 20:07:13 +01:00
|
|
|
|
{
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
}
|