Version19.104.2

This commit is contained in:
Antonio Cañas Vargas 2019-12-29 15:10:34 +01:00
parent 47d68b773e
commit b0351458d1
6 changed files with 141 additions and 134 deletions

View File

@ -1883,10 +1883,10 @@ const struct Act_Actions Act_Actions[Act_NUM_ACTIONS] =
// Actions not in menu:
[ActPrnDegInf ] = {1150,-1,TabUnk,ActSeeDegInf , 0, 0,0x3C7, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_NEW_TAB,NULL ,DegCfg_PrintConfiguration ,NULL},
[ActChgDegCtrCfg ] = {1588,-1,TabUnk,ActSeeDegInf , 0, 0,0x300, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,Deg_ChangeDegCtrInConfig ,Deg_ContEditAfterChgDegInConfig,NULL},
[ActRenDegShoCfg ] = {1598,-1,TabUnk,ActSeeDegInf , 0, 0,0x380, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,Deg_RenameDegreeShortInConfig ,Deg_ContEditAfterChgDegInConfig,NULL},
[ActRenDegFulCfg ] = {1597,-1,TabUnk,ActSeeDegInf , 0, 0,0x380, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,Deg_RenameDegreeFullInConfig ,Deg_ContEditAfterChgDegInConfig,NULL},
[ActChgDegWWWCfg ] = {1599,-1,TabUnk,ActSeeDegInf , 0, 0,0x3C0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Deg_ChangeDegWWWInConfig ,NULL},
[ActChgDegCtrCfg ] = {1588,-1,TabUnk,ActSeeDegInf , 0, 0,0x300, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,DegCfg_ChangeDegCtrInConfig ,DegCfg_ContEditAfterChgDegInConfig,NULL},
[ActRenDegShoCfg ] = {1598,-1,TabUnk,ActSeeDegInf , 0, 0,0x380, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,DegCfg_RenameDegreeShortInConfig ,DegCfg_ContEditAfterChgDegInConfig,NULL},
[ActRenDegFulCfg ] = {1597,-1,TabUnk,ActSeeDegInf , 0, 0,0x380, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,DegCfg_RenameDegreeFullInConfig ,DegCfg_ContEditAfterChgDegInConfig,NULL},
[ActChgDegWWWCfg ] = {1599,-1,TabUnk,ActSeeDegInf , 0, 0,0x3C0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,DegCfg_ChangeDegWWWInConfig ,NULL},
[ActReqDegLog ] = {1246,-1,TabUnk,ActSeeDegInf , 0, 0,0x3C0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Deg_RequestLogo ,NULL},
[ActRecDegLog ] = { 553,-1,TabUnk,ActSeeDegInf , 0, 0,0x3C0, 0, 0, 0, 0,Act_CONT_DATA,Act_BRW_1ST_TAB,Deg_ReceiveLogo ,DegCfg_ShowConfiguration ,NULL},
[ActRemDegLog ] = {1343,-1,TabUnk,ActSeeDegInf , 0, 0,0x3C0, 0, 0, 0, 0,Act_CONT_DATA,Act_BRW_1ST_TAB,Deg_RemoveLogo ,DegCfg_ShowConfiguration ,NULL},

View File

@ -492,7 +492,7 @@ enscript -2 --landscape --color --file-align=2 --highlight --line-numbers -o - *
En OpenSWAD:
ps2pdf source.ps destination.pdf
*/
#define Log_PLATFORM_VERSION "SWAD 19.104.1 (2019-12-29)"
#define Log_PLATFORM_VERSION "SWAD 19.104.2 (2019-12-29)"
#define CSS_FILE "swad19.101.5.css"
#define JS_FILE "swad19.91.1.js"
/*
@ -502,6 +502,7 @@ ps2pdf source.ps destination.pdf
Version 19.10x: Dec 29, 2019 Map in country information. (? lines)
Version 19.10x: Dec 29, 2019 Map in institution information. (? lines)
Version 19.104.2: Dec 29, 2019 Code refactoring in degree configuration. (249541 lines)
Version 19.104.1: Dec 29, 2019 Code refactoring in course configuration. (249536 lines)
Version 19.104: Dec 29, 2019 New module swad_centre_config for centre configuration. (249534 lines)
Version 19.103: Dec 29, 2019 New module swad_degree_config for degree configuration. (249457 lines)

View File

@ -90,14 +90,8 @@ static void Deg_PutParamOtherDegCod (long DegCod);
static void Deg_GetDataOfDegreeFromRow (struct Degree *Deg,MYSQL_ROW row);
static void Deg_RenameDegree (struct Degree *Deg,Cns_ShrtOrFullName_t ShrtOrFullName);
static bool Deg_CheckIfDegNameExistsInCtr (const char *FieldName,const char *Name,
long DegCod,long CtrCod);
static void Deg_UpdateDegNameDB (long DegCod,const char *FieldName,const char *NewDegName);
static void Deg_UpdateDegCtrDB (long DegCod,long CtrCod);
static void Deg_UpdateDegWWWDB (long DegCod,const char NewWWW[Cns_MAX_BYTES_WWW + 1]);
static void Deg_ShowAlertAndButtonToGoToDeg (void);
static void Deg_PutParamGoToDeg (void);
@ -1556,25 +1550,11 @@ void Deg_RenameDegreeFull (void)
Deg_RenameDegree (Deg_EditingDeg,Cns_FULL_NAME);
}
/*****************************************************************************/
/*************** Change the name of a degree in configuration ****************/
/*****************************************************************************/
void Deg_RenameDegreeShortInConfig (void)
{
Deg_RenameDegree (&Gbl.Hierarchy.Deg,Cns_SHRT_NAME);
}
void Deg_RenameDegreeFullInConfig (void)
{
Deg_RenameDegree (&Gbl.Hierarchy.Deg,Cns_FULL_NAME);
}
/*****************************************************************************/
/************************ Change the name of a degree ************************/
/*****************************************************************************/
static void Deg_RenameDegree (struct Degree *Deg,Cns_ShrtOrFullName_t ShrtOrFullName)
void Deg_RenameDegree (struct Degree *Deg,Cns_ShrtOrFullName_t ShrtOrFullName)
{
extern const char *Txt_The_degree_X_already_exists;
extern const char *Txt_The_name_of_the_degree_X_has_changed_to_Y;
@ -1648,8 +1628,8 @@ static void Deg_RenameDegree (struct Degree *Deg,Cns_ShrtOrFullName_t ShrtOrFull
/********************* Check if the name of degree exists ********************/
/*****************************************************************************/
static bool Deg_CheckIfDegNameExistsInCtr (const char *FieldName,const char *Name,
long DegCod,long CtrCod)
bool Deg_CheckIfDegNameExistsInCtr (const char *FieldName,const char *Name,
long DegCod,long CtrCod)
{
/***** Get number of degrees with a type and a name from database *****/
return (DB_QueryCOUNT ("can not check if the name of a degree"
@ -1671,78 +1651,6 @@ static void Deg_UpdateDegNameDB (long DegCod,const char *FieldName,const char *N
FieldName,NewDegName,DegCod);
}
/*****************************************************************************/
/************************ Change the centre of a degree **********************/
/*****************************************************************************/
void Deg_ChangeDegCtrInConfig (void)
{
extern const char *Txt_The_degree_X_already_exists;
extern const char *Txt_The_degree_X_has_been_moved_to_the_centre_Y;
struct Centre NewCtr;
/***** Get parameter with centre code *****/
NewCtr.CtrCod = Ctr_GetAndCheckParamOtherCtrCod (1);
/***** Check if centre has changed *****/
if (NewCtr.CtrCod != Gbl.Hierarchy.Deg.CtrCod)
{
/***** Get data of new centre *****/
Ctr_GetDataOfCentreByCod (&NewCtr,Ctr_GET_BASIC_DATA);
/***** Check if it already exists a degree with the same name in the new centre *****/
if (Deg_CheckIfDegNameExistsInCtr ("ShortName",Gbl.Hierarchy.Deg.ShrtName,Gbl.Hierarchy.Deg.DegCod,NewCtr.CtrCod))
Ale_CreateAlert (Ale_WARNING,
Txt_The_degree_X_already_exists,
Gbl.Hierarchy.Deg.ShrtName);
else if (Deg_CheckIfDegNameExistsInCtr ("FullName",Gbl.Hierarchy.Deg.FullName,Gbl.Hierarchy.Deg.DegCod,NewCtr.CtrCod))
Ale_CreateAlert (Ale_WARNING,
Txt_The_degree_X_already_exists,
Gbl.Hierarchy.Deg.FullName);
else
{
/***** Update centre in table of degrees *****/
Deg_UpdateDegCtrDB (Gbl.Hierarchy.Deg.DegCod,NewCtr.CtrCod);
Gbl.Hierarchy.Deg.CtrCod =
Gbl.Hierarchy.Ctr.CtrCod = NewCtr.CtrCod;
/***** Initialize again current course, degree, centre... *****/
Hie_InitHierarchy ();
/***** Create alert to show the change made *****/
Ale_CreateAlert (Ale_SUCCESS,NULL,
Txt_The_degree_X_has_been_moved_to_the_centre_Y,
Gbl.Hierarchy.Deg.FullName,
Gbl.Hierarchy.Ctr.FullName);
}
}
}
/*****************************************************************************/
/** Show message of success after changing a degree in degree configuration **/
/*****************************************************************************/
void Deg_ContEditAfterChgDegInConfig (void)
{
/***** Write success / warning message *****/
Ale_ShowAlerts (NULL);
/***** Show the form again *****/
DegCfg_ShowConfiguration ();
}
/*****************************************************************************/
/********************** Update centre in table of degrees ********************/
/*****************************************************************************/
static void Deg_UpdateDegCtrDB (long DegCod,long CtrCod)
{
/***** Update centre in table of degrees *****/
DB_QueryUPDATE ("can not update the centre of a degree",
"UPDATE degrees SET CtrCod=%ld WHERE DegCod=%ld",
CtrCod,DegCod);
}
/*****************************************************************************/
/************************ Change the type of a degree ************************/
/*****************************************************************************/
@ -1818,39 +1726,11 @@ void Deg_ChangeDegWWW (void)
Ale_CreateAlertYouCanNotLeaveFieldEmpty ();
}
void Deg_ChangeDegWWWInConfig (void)
{
extern const char *Txt_The_new_web_address_is_X;
char NewWWW[Cns_MAX_BYTES_WWW + 1];
/***** Get parameters from form *****/
/* Get the new WWW for the degree */
Par_GetParToText ("WWW",NewWWW,Cns_MAX_BYTES_WWW);
/***** Check if new WWW is empty *****/
if (NewWWW[0])
{
/***** Update the table changing old WWW by new WWW *****/
Deg_UpdateDegWWWDB (Gbl.Hierarchy.Deg.DegCod,NewWWW);
Str_Copy (Gbl.Hierarchy.Deg.WWW,NewWWW,
Cns_MAX_BYTES_WWW);
/***** Write message to show the change made *****/
Ale_ShowAlert (Ale_SUCCESS,Txt_The_new_web_address_is_X,
NewWWW);
}
else
Ale_ShowAlertYouCanNotLeaveFieldEmpty ();
/***** Show the form again *****/
DegCfg_ShowConfiguration ();
}
/*****************************************************************************/
/**************** Update database changing old WWW by new WWW ****************/
/*****************************************************************************/
static void Deg_UpdateDegWWWDB (long DegCod,const char NewWWW[Cns_MAX_BYTES_WWW + 1])
void Deg_UpdateDegWWWDB (long DegCod,const char NewWWW[Cns_MAX_BYTES_WWW + 1])
{
/***** Update database changing old WWW by new WWW *****/
DB_QueryUPDATE ("can not update the web of a degree",

View File

@ -133,13 +133,12 @@ long Deg_GetInsCodOfDegreeByCod (long DegCod);
void Deg_RemoveDegreeCompletely (long DegCod);
void Deg_RenameDegreeShort (void);
void Deg_RenameDegreeFull (void);
void Deg_RenameDegreeShortInConfig (void);
void Deg_RenameDegreeFullInConfig (void);
void Deg_ChangeDegCtrInConfig (void);
void Deg_ContEditAfterChgDegInConfig (void);
void Deg_RenameDegree (struct Degree *Deg,Cns_ShrtOrFullName_t ShrtOrFullName);
bool Deg_CheckIfDegNameExistsInCtr (const char *FieldName,const char *Name,
long DegCod,long CtrCod);
void Deg_ChangeDegreeType (void);
void Deg_ChangeDegWWW (void);
void Deg_ChangeDegWWWInConfig (void);
void Deg_UpdateDegWWWDB (long DegCod,const char NewWWW[Cns_MAX_BYTES_WWW + 1]);
void Deg_ChangeDegStatus (void);
void Deg_ContEditAfterChgDeg (void);

View File

@ -27,6 +27,7 @@
#include <stdbool.h> // For boolean type
#include "swad_database.h"
#include "swad_degree_config.h"
#include "swad_form.h"
#include "swad_global.h"
@ -68,6 +69,8 @@ static void DegCfg_QR (void);
static void DegCfg_NumCrss (void);
static void DegCfg_NumUsrsInCrssOfDeg (Rol_Role_t Role);
static void DegCfg_UpdateDegCtrDB (long DegCod,long CtrCod);
/*****************************************************************************/
/****************** Show information of the current degree *******************/
/*****************************************************************************/
@ -368,3 +371,121 @@ static void DegCfg_NumUsrsInCrssOfDeg (Rol_Role_t Role)
HTM_TR_End ();
}
/*****************************************************************************/
/************************ Change the centre of a degree **********************/
/*****************************************************************************/
void DegCfg_ChangeDegCtrInConfig (void)
{
extern const char *Txt_The_degree_X_already_exists;
extern const char *Txt_The_degree_X_has_been_moved_to_the_centre_Y;
struct Centre NewCtr;
/***** Get parameter with centre code *****/
NewCtr.CtrCod = Ctr_GetAndCheckParamOtherCtrCod (1);
/***** Check if centre has changed *****/
if (NewCtr.CtrCod != Gbl.Hierarchy.Deg.CtrCod)
{
/***** Get data of new centre *****/
Ctr_GetDataOfCentreByCod (&NewCtr,Ctr_GET_BASIC_DATA);
/***** Check if it already exists a degree with the same name in the new centre *****/
if (Deg_CheckIfDegNameExistsInCtr ("ShortName",Gbl.Hierarchy.Deg.ShrtName,Gbl.Hierarchy.Deg.DegCod,NewCtr.CtrCod))
Ale_CreateAlert (Ale_WARNING,
Txt_The_degree_X_already_exists,
Gbl.Hierarchy.Deg.ShrtName);
else if (Deg_CheckIfDegNameExistsInCtr ("FullName",Gbl.Hierarchy.Deg.FullName,Gbl.Hierarchy.Deg.DegCod,NewCtr.CtrCod))
Ale_CreateAlert (Ale_WARNING,
Txt_The_degree_X_already_exists,
Gbl.Hierarchy.Deg.FullName);
else
{
/***** Update centre in table of degrees *****/
DegCfg_UpdateDegCtrDB (Gbl.Hierarchy.Deg.DegCod,NewCtr.CtrCod);
Gbl.Hierarchy.Deg.CtrCod =
Gbl.Hierarchy.Ctr.CtrCod = NewCtr.CtrCod;
/***** Initialize again current course, degree, centre... *****/
Hie_InitHierarchy ();
/***** Create alert to show the change made *****/
Ale_CreateAlert (Ale_SUCCESS,NULL,
Txt_The_degree_X_has_been_moved_to_the_centre_Y,
Gbl.Hierarchy.Deg.FullName,
Gbl.Hierarchy.Ctr.FullName);
}
}
}
/*****************************************************************************/
/********************** Update centre in table of degrees ********************/
/*****************************************************************************/
static void DegCfg_UpdateDegCtrDB (long DegCod,long CtrCod)
{
/***** Update centre in table of degrees *****/
DB_QueryUPDATE ("can not update the centre of a degree",
"UPDATE degrees SET CtrCod=%ld WHERE DegCod=%ld",
CtrCod,DegCod);
}
/*****************************************************************************/
/*************** Change the name of a degree in configuration ****************/
/*****************************************************************************/
void DegCfg_RenameDegreeShortInConfig (void)
{
Deg_RenameDegree (&Gbl.Hierarchy.Deg,Cns_SHRT_NAME);
}
void DegCfg_RenameDegreeFullInConfig (void)
{
Deg_RenameDegree (&Gbl.Hierarchy.Deg,Cns_FULL_NAME);
}
/*****************************************************************************/
/************************* Change the WWW of a degree ************************/
/*****************************************************************************/
void DegCfg_ChangeDegWWWInConfig (void)
{
extern const char *Txt_The_new_web_address_is_X;
char NewWWW[Cns_MAX_BYTES_WWW + 1];
/***** Get parameters from form *****/
/* Get the new WWW for the degree */
Par_GetParToText ("WWW",NewWWW,Cns_MAX_BYTES_WWW);
/***** Check if new WWW is empty *****/
if (NewWWW[0])
{
/***** Update the table changing old WWW by new WWW *****/
Deg_UpdateDegWWWDB (Gbl.Hierarchy.Deg.DegCod,NewWWW);
Str_Copy (Gbl.Hierarchy.Deg.WWW,NewWWW,
Cns_MAX_BYTES_WWW);
/***** Write message to show the change made *****/
Ale_ShowAlert (Ale_SUCCESS,Txt_The_new_web_address_is_X,
NewWWW);
}
else
Ale_ShowAlertYouCanNotLeaveFieldEmpty ();
/***** Show the form again *****/
DegCfg_ShowConfiguration ();
}
/*****************************************************************************/
/** Show message of success after changing a degree in degree configuration **/
/*****************************************************************************/
void DegCfg_ContEditAfterChgDegInConfig (void)
{
/***** Write success / warning message *****/
Ale_ShowAlerts (NULL);
/***** Show the form again *****/
DegCfg_ShowConfiguration ();
}

View File

@ -42,4 +42,10 @@
void DegCfg_ShowConfiguration (void);
void DegCfg_PrintConfiguration (void);
void DegCfg_ChangeDegCtrInConfig (void);
void DegCfg_RenameDegreeShortInConfig (void);
void DegCfg_RenameDegreeFullInConfig (void);
void DegCfg_ChangeDegWWWInConfig (void);
void DegCfg_ContEditAfterChgDegInConfig (void);
#endif