Version 16.164.2

This commit is contained in:
Antonio Cañas Vargas 2017-03-24 13:22:54 +01:00
parent 803b15d886
commit 8438dbabcd
5 changed files with 34 additions and 31 deletions

View File

@ -209,13 +209,15 @@
/****************************** Public constants *****************************/ /****************************** Public constants *****************************/
/*****************************************************************************/ /*****************************************************************************/
#define Log_PLATFORM_VERSION "SWAD 16.164.1 (2017-03-24)" #define Log_PLATFORM_VERSION "SWAD 16.164.2 (2017-03-24)"
#define CSS_FILE "swad16.161.css" #define CSS_FILE "swad16.161.css"
#define JS_FILE "swad16.144.js" #define JS_FILE "swad16.144.js"
// Number of lines (includes comments but not blank lines) has been got with the following command: // 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 sql/swad*.sql | tail -1 // nl swad*.c swad*.h css/swad*.css py/swad*.py js/swad*.js soap/swad*?.h sql/swad*.sql | tail -1
/* /*
Version 16.164.3: Mar 24, 2017 Types of degree in system tab restricted to system admins only. (? lines)
Version 16.164.2: Mar 24, 2017 Code refactoring in types of degree. (217576 lines)
Version 16.164.1: Mar 24, 2017 Statistics about types of degree depends on the selected scope. (217575 lines) Version 16.164.1: Mar 24, 2017 Statistics about types of degree depends on the selected scope. (217575 lines)
Version 16.164: Mar 24, 2017 New figure in statistics: types of degree. (217510 lines) Version 16.164: Mar 24, 2017 New figure in statistics: types of degree. (217510 lines)
Version 16.163: Mar 24, 2017 Types of degree can be ordered by name and by number of degrees. Version 16.163: Mar 24, 2017 Types of degree can be ordered by name and by number of degrees.

View File

@ -1369,7 +1369,7 @@ void Deg_EditDegrees (void)
Deg_GetListDegsOfCurrentCtr (); Deg_GetListDegsOfCurrentCtr ();
/***** Get list of degree types *****/ /***** Get list of degree types *****/
DT_GetListDegreeTypes (); DT_GetListDegreeTypes (Sco_SCOPE_SYS,DT_ORDER_BY_DEGREE_TYPE);
if (Gbl.Degs.DegTypes.Num) if (Gbl.Degs.DegTypes.Num)
{ {

View File

@ -63,16 +63,16 @@ extern struct Globals Gbl;
/*****************************************************************************/ /*****************************************************************************/
static void DT_SeeDegreeTypes (Act_Action_t NextAction,DT_Order_t DefaultOrder); static void DT_SeeDegreeTypes (Act_Action_t NextAction,DT_Order_t DefaultOrder);
static void DT_GetParamDegTypOrder (DT_Order_t DefaultOrder); static DT_Order_t DT_GetParamDegTypOrder (DT_Order_t DefaultOrder);
static void DT_ListDegreeTypes (Act_Action_t NextAction); static void DT_ListDegreeTypes (Act_Action_t NextAction,DT_Order_t SelectedOrder);
static void DT_EditDegreeTypes (void); static void DT_EditDegreeTypes (void);
static void DT_ListDegreeTypesForSeeing (void); static void DT_ListDegreeTypesForSeeing (void);
static void DT_PutIconToEditDegTypes (void); static void DT_PutIconToEditDegTypes (void);
static void DT_ListDegreeTypesForEdition (void); static void DT_ListDegreeTypesForEdition (void);
static void DT_PutFormToCreateDegreeType (void); static void DT_PutFormToCreateDegreeType (void);
static void DT_PutHeadDegreeTypesForSeeing (Act_Action_t NextAction); static void DT_PutHeadDegreeTypesForSeeing (Act_Action_t NextAction,DT_Order_t SelectedOrder);
static void DT_PutHeadDegreeTypesForEdition (void); static void DT_PutHeadDegreeTypesForEdition (void);
static void DT_CreateDegreeType (struct DegreeType *DegTyp); static void DT_CreateDegreeType (struct DegreeType *DegTyp);
@ -93,7 +93,7 @@ void DT_WriteSelectorDegreeTypes (void)
/***** Form to select degree types *****/ /***** Form to select degree types *****/
/* Get list of degree types */ /* Get list of degree types */
DT_GetListDegreeTypes (); DT_GetListDegreeTypes (Sco_SCOPE_SYS,DT_ORDER_BY_DEGREE_TYPE);
/* List degree types */ /* List degree types */
fprintf (Gbl.F.Out,"<select id=\"OthDegTypCod\" name=\"OthDegTypCod\"" fprintf (Gbl.F.Out,"<select id=\"OthDegTypCod\" name=\"OthDegTypCod\""
@ -139,14 +139,16 @@ void DT_SeeDegreeTypesInStaTab (void)
static void DT_SeeDegreeTypes (Act_Action_t NextAction,DT_Order_t DefaultOrder) static void DT_SeeDegreeTypes (Act_Action_t NextAction,DT_Order_t DefaultOrder)
{ {
DT_Order_t SelectedOrder;
/***** Get parameter with the type of order in the list of degree types *****/ /***** Get parameter with the type of order in the list of degree types *****/
DT_GetParamDegTypOrder (DefaultOrder); SelectedOrder = DT_GetParamDegTypOrder (DefaultOrder);
/***** Get list of degree types *****/ /***** Get list of degree types *****/
DT_GetListDegreeTypes (); DT_GetListDegreeTypes (Gbl.Scope.Current,SelectedOrder);
/***** List degree types *****/ /***** List degree types *****/
DT_ListDegreeTypes (NextAction); DT_ListDegreeTypes (NextAction,SelectedOrder);
/***** Free list of degree types *****/ /***** Free list of degree types *****/
DT_FreeListDegreeTypes (); DT_FreeListDegreeTypes ();
@ -156,13 +158,12 @@ static void DT_SeeDegreeTypes (Act_Action_t NextAction,DT_Order_t DefaultOrder)
/******* Get parameter with the type or order in list of degree types ********/ /******* Get parameter with the type or order in list of degree types ********/
/*****************************************************************************/ /*****************************************************************************/
static void DT_GetParamDegTypOrder (DT_Order_t DefaultOrder) static DT_Order_t DT_GetParamDegTypOrder (DT_Order_t DefaultOrder)
{ {
Gbl.Degs.DegTypes.SelectedOrder = (DT_Order_t) return (DT_Order_t) Par_GetParToUnsignedLong ("Order",
Par_GetParToUnsignedLong ("Order", 0,
0, DT_NUM_ORDERS - 1,
DT_NUM_ORDERS - 1, (unsigned long) DefaultOrder);
(unsigned long) DefaultOrder);
} }
/*****************************************************************************/ /*****************************************************************************/
@ -172,8 +173,7 @@ static void DT_GetParamDegTypOrder (DT_Order_t DefaultOrder)
void DT_ReqEditDegreeTypes (void) void DT_ReqEditDegreeTypes (void)
{ {
/***** Get list of degree types *****/ /***** Get list of degree types *****/
Gbl.Degs.DegTypes.SelectedOrder = DT_ORDER_BY_DEGREE_TYPE; DT_GetListDegreeTypes (Sco_SCOPE_SYS,DT_ORDER_BY_DEGREE_TYPE);
DT_GetListDegreeTypes ();
/***** Put form to edit degree types *****/ /***** Put form to edit degree types *****/
DT_EditDegreeTypes (); DT_EditDegreeTypes ();
@ -189,7 +189,7 @@ void DT_ReqEditDegreeTypes (void)
// - system tab ==> NextAction = ActSeeDegTyp // - system tab ==> NextAction = ActSeeDegTyp
// - statistic tab ==> NextAction = ActSeeUseGbl // - statistic tab ==> NextAction = ActSeeUseGbl
static void DT_ListDegreeTypes (Act_Action_t NextAction) static void DT_ListDegreeTypes (Act_Action_t NextAction,DT_Order_t SelectedOrder)
{ {
extern const char *Hlp_SYSTEM_Studies; extern const char *Hlp_SYSTEM_Studies;
extern const char *Hlp_STATS_Figures_types_of_degree; extern const char *Hlp_STATS_Figures_types_of_degree;
@ -205,7 +205,7 @@ static void DT_ListDegreeTypes (Act_Action_t NextAction)
(NextAction == ActSeeDegTyp) ? Hlp_SYSTEM_Studies : (NextAction == ActSeeDegTyp) ? Hlp_SYSTEM_Studies :
Hlp_STATS_Figures_types_of_degree, Hlp_STATS_Figures_types_of_degree,
2); 2);
DT_PutHeadDegreeTypesForSeeing (NextAction); DT_PutHeadDegreeTypesForSeeing (NextAction,SelectedOrder);
/***** List current degree types for seeing *****/ /***** List current degree types for seeing *****/
DT_ListDegreeTypesForSeeing (); DT_ListDegreeTypesForSeeing ();
@ -403,7 +403,7 @@ static void DT_PutFormToCreateDegreeType (void)
/***************** Write header with fields of a degree type *****************/ /***************** Write header with fields of a degree type *****************/
/*****************************************************************************/ /*****************************************************************************/
static void DT_PutHeadDegreeTypesForSeeing (Act_Action_t NextAction) static void DT_PutHeadDegreeTypesForSeeing (Act_Action_t NextAction,DT_Order_t SelectedOrder)
{ {
extern const char *Txt_DEGREE_TYPES_HELP_ORDER[DT_NUM_ORDERS]; extern const char *Txt_DEGREE_TYPES_HELP_ORDER[DT_NUM_ORDERS];
extern const char *Txt_DEGREE_TYPES_ORDER[DT_NUM_ORDERS]; extern const char *Txt_DEGREE_TYPES_ORDER[DT_NUM_ORDERS];
@ -427,10 +427,10 @@ static void DT_PutHeadDegreeTypesForSeeing (Act_Action_t NextAction)
/* Link with the head of this column */ /* Link with the head of this column */
Act_LinkFormSubmit (Txt_DEGREE_TYPES_HELP_ORDER[Order],"TIT_TBL",NULL); Act_LinkFormSubmit (Txt_DEGREE_TYPES_HELP_ORDER[Order],"TIT_TBL",NULL);
if (Order == Gbl.Degs.DegTypes.SelectedOrder) if (Order == SelectedOrder)
fprintf (Gbl.F.Out,"<u>"); fprintf (Gbl.F.Out,"<u>");
fprintf (Gbl.F.Out,"%s",Txt_DEGREE_TYPES_ORDER[Order]); fprintf (Gbl.F.Out,"%s",Txt_DEGREE_TYPES_ORDER[Order]);
if (Order == Gbl.Degs.DegTypes.SelectedOrder) if (Order == SelectedOrder)
fprintf (Gbl.F.Out,"</u>"); fprintf (Gbl.F.Out,"</u>");
fprintf (Gbl.F.Out,"</a>"); fprintf (Gbl.F.Out,"</a>");
@ -492,7 +492,7 @@ static void DT_CreateDegreeType (struct DegreeType *DegTyp)
/**************** Create a list with all the degree types ********************/ /**************** Create a list with all the degree types ********************/
/*****************************************************************************/ /*****************************************************************************/
void DT_GetListDegreeTypes (void) void DT_GetListDegreeTypes (Sco_Scope_t Scope,DT_Order_t Order)
{ {
static const char *OrderBySubQuery[DT_NUM_ORDERS] = static const char *OrderBySubQuery[DT_NUM_ORDERS] =
{ {
@ -505,7 +505,7 @@ void DT_GetListDegreeTypes (void)
unsigned long NumRow; unsigned long NumRow;
/***** Get types of degree from database *****/ /***** Get types of degree from database *****/
switch (Gbl.Scope.Current) switch (Scope)
{ {
case Sco_SCOPE_SYS: case Sco_SCOPE_SYS:
/* Get /* Get
@ -523,7 +523,7 @@ void DT_GetListDegreeTypes (void)
" WHERE DegTypCod NOT IN" " WHERE DegTypCod NOT IN"
" (SELECT DegTypCod FROM degrees))" " (SELECT DegTypCod FROM degrees))"
" ORDER BY %s", " ORDER BY %s",
OrderBySubQuery[Gbl.Degs.DegTypes.SelectedOrder]); OrderBySubQuery[Order]);
break; break;
case Sco_SCOPE_CTY: case Sco_SCOPE_CTY:
/* Get only degree types with degrees in the current country */ /* Get only degree types with degrees in the current country */
@ -537,7 +537,7 @@ void DT_GetListDegreeTypes (void)
" GROUP BY degrees.DegTypCod" " GROUP BY degrees.DegTypCod"
" ORDER BY %s", " ORDER BY %s",
Gbl.CurrentCty.Cty.CtyCod, Gbl.CurrentCty.Cty.CtyCod,
OrderBySubQuery[Gbl.Degs.DegTypes.SelectedOrder]); OrderBySubQuery[Order]);
break; break;
case Sco_SCOPE_INS: case Sco_SCOPE_INS:
/* Get only degree types with degrees in the current institution */ /* Get only degree types with degrees in the current institution */
@ -550,7 +550,7 @@ void DT_GetListDegreeTypes (void)
" GROUP BY degrees.DegTypCod" " GROUP BY degrees.DegTypCod"
" ORDER BY %s", " ORDER BY %s",
Gbl.CurrentIns.Ins.InsCod, Gbl.CurrentIns.Ins.InsCod,
OrderBySubQuery[Gbl.Degs.DegTypes.SelectedOrder]); OrderBySubQuery[Order]);
break; break;
case Sco_SCOPE_CTR: case Sco_SCOPE_CTR:
/* Get only degree types with degrees in the current centre */ /* Get only degree types with degrees in the current centre */
@ -562,7 +562,7 @@ void DT_GetListDegreeTypes (void)
" GROUP BY degrees.DegTypCod" " GROUP BY degrees.DegTypCod"
" ORDER BY %s", " ORDER BY %s",
Gbl.CurrentCtr.Ctr.CtrCod, Gbl.CurrentCtr.Ctr.CtrCod,
OrderBySubQuery[Gbl.Degs.DegTypes.SelectedOrder]); OrderBySubQuery[Order]);
break; break;
case Sco_SCOPE_DEG: case Sco_SCOPE_DEG:
case Sco_SCOPE_CRS: case Sco_SCOPE_CRS:
@ -575,7 +575,7 @@ void DT_GetListDegreeTypes (void)
" GROUP BY degrees.DegTypCod" " GROUP BY degrees.DegTypCod"
" ORDER BY %s", " ORDER BY %s",
Gbl.CurrentDeg.Deg.DegCod, Gbl.CurrentDeg.Deg.DegCod,
OrderBySubQuery[Gbl.Degs.DegTypes.SelectedOrder]); OrderBySubQuery[Order]);
break; break;
default: default:
Lay_ShowErrorAndExit ("Wrong scope."); Lay_ShowErrorAndExit ("Wrong scope.");

View File

@ -27,6 +27,8 @@
/********************************* Headers ***********************************/ /********************************* Headers ***********************************/
/*****************************************************************************/ /*****************************************************************************/
#include "swad_scope.h"
/*****************************************************************************/ /*****************************************************************************/
/***************************** Public constants ******************************/ /***************************** Public constants ******************************/
/*****************************************************************************/ /*****************************************************************************/
@ -62,7 +64,7 @@ void DT_SeeDegreeTypesInSysTab (void);
void DT_SeeDegreeTypesInStaTab (void); void DT_SeeDegreeTypesInStaTab (void);
void DT_ReqEditDegreeTypes (void); void DT_ReqEditDegreeTypes (void);
void DT_GetListDegreeTypes (void); void DT_GetListDegreeTypes (Sco_Scope_t Scope,DT_Order_t Order);
void DT_FreeListDegreeTypes (void); void DT_FreeListDegreeTypes (void);
void DT_RecFormNewDegreeType (void); void DT_RecFormNewDegreeType (void);

View File

@ -258,7 +258,6 @@ struct Globals
{ {
unsigned Num; // Number of degree types unsigned Num; // Number of degree types
struct DegreeType *Lst; // List of degree types struct DegreeType *Lst; // List of degree types
DT_Order_t SelectedOrder;
} DegTypes; } DegTypes;
struct DegreeType EditingDegTyp; struct DegreeType EditingDegTyp;
struct Degree EditingDeg; struct Degree EditingDeg;