Version 16.245

This commit is contained in:
Antonio Cañas Vargas 2017-06-12 19:14:05 +02:00
parent 1e84e91429
commit 4767fa9f35
5 changed files with 119 additions and 51 deletions

View File

@ -245,6 +245,7 @@ Centre:
128. ActChgCtrInsCfg Request change of the institution of a centre in centre configuration
129. ActRenCtrShoCfg Change short name centre in centre configuration
130. ActRenCtrFulCfg Change full name centre in centre configuration
NEW. ActChgCtrPlcCfg Change place of centre in centre configuration
131. ActChgCtrWWWCfg Change web of centre in centre configuration
132. ActReqCtrLog Show form to send the logo of the current centre
133. ActRecCtrLog Receive and store the logo of the current centre
@ -1627,7 +1628,7 @@ struct Act_Actions Act_Actions[Act_NUM_ACTIONS] =
/* ActReqCtr */{1208,-1,TabUnk,ActSeeCtr , 0, 0, 0, 0,0x3C6, 0, 0,Act_CONT_NORM,Act_THIS_WINDOW,NULL ,Ctr_RecFormReqCtr ,NULL},
/* ActNewCtr */{ 685,-1,TabUnk,ActSeeCtr , 0, 0, 0, 0,0x300, 0, 0,Act_CONT_NORM,Act_THIS_WINDOW,NULL ,Ctr_RecFormNewCtr ,NULL},
/* ActRemCtr */{ 686,-1,TabUnk,ActSeeCtr , 0, 0, 0, 0,0x3C6, 0, 0,Act_CONT_NORM,Act_THIS_WINDOW,NULL ,Ctr_RemoveCentre ,NULL},
/* ActChgDegPlc */{ 706,-1,TabUnk,ActSeeCtr , 0, 0, 0, 0,0x300, 0, 0,Act_CONT_NORM,Act_THIS_WINDOW,NULL ,Ctr_ChangeCentrePlace ,NULL},
/* ActChgDegPlc */{ 706,-1,TabUnk,ActSeeCtr , 0, 0, 0, 0,0x300, 0, 0,Act_CONT_NORM,Act_THIS_WINDOW,NULL ,Ctr_ChangeCtrPlc ,NULL},
/* ActRenCtrSho */{ 682,-1,TabUnk,ActSeeCtr , 0, 0, 0, 0,0x3C6, 0, 0,Act_CONT_NORM,Act_THIS_WINDOW,Ctr_RenameCentreShort ,Ctr_ContEditAfterChgCtr ,NULL},
/* ActRenCtrFul */{ 684,-1,TabUnk,ActSeeCtr , 0, 0, 0, 0,0x3C6, 0, 0,Act_CONT_NORM,Act_THIS_WINDOW,Ctr_RenameCentreFull ,Ctr_ContEditAfterChgCtr ,NULL},
/* ActChgCtrWWW */{ 683,-1,TabUnk,ActSeeCtr , 0, 0, 0, 0,0x3C6, 0, 0,Act_CONT_NORM,Act_THIS_WINDOW,NULL ,Ctr_ChangeCtrWWW ,NULL},
@ -1675,6 +1676,7 @@ struct Act_Actions Act_Actions[Act_NUM_ACTIONS] =
/* ActChgCtrInsCfg */{1589,-1,TabUnk,ActSeeCtrInf , 0, 0, 0,0x200, 0, 0, 0,Act_CONT_NORM,Act_THIS_WINDOW,Ctr_ChangeCtrInsInConfig ,Ctr_ContEditAfterChgCtrInConfig,NULL},
/* ActRenCtrShoCfg */{1595,-1,TabUnk,ActSeeCtrInf , 0, 0, 0,0x300, 0, 0, 0,Act_CONT_NORM,Act_THIS_WINDOW,Ctr_RenameCentreShortInConfig ,Ctr_ContEditAfterChgCtrInConfig,NULL},
/* ActRenCtrFulCfg */{1594,-1,TabUnk,ActSeeCtrInf , 0, 0, 0,0x300, 0, 0, 0,Act_CONT_NORM,Act_THIS_WINDOW,Ctr_RenameCentreFullInConfig ,Ctr_ContEditAfterChgCtrInConfig,NULL},
/* ActChgCtrPlcCfg */{1648,-1,TabUnk,ActSeeCtrInf , 0, 0, 0,0x380, 0, 0, 0,Act_CONT_NORM,Act_THIS_WINDOW,NULL ,Ctr_ChangeCtrPlcInConfig ,NULL},
/* ActChgCtrWWWCfg */{1596,-1,TabUnk,ActSeeCtrInf , 0, 0, 0,0x380, 0, 0, 0,Act_CONT_NORM,Act_THIS_WINDOW,NULL ,Ctr_ChangeCtrWWWInConfig ,NULL},
/* ActReqCtrLog */{1244,-1,TabUnk,ActSeeCtrInf , 0, 0, 0,0x380, 0, 0, 0,Act_CONT_NORM,Act_THIS_WINDOW,NULL ,Ctr_RequestLogo ,NULL},
/* ActRecCtrLog */{1051,-1,TabUnk,ActSeeCtrInf , 0, 0, 0,0x380, 0, 0, 0,Act_CONT_DATA,Act_THIS_WINDOW,Ctr_ReceiveLogo ,Ctr_ShowConfiguration ,NULL},
@ -4650,6 +4652,7 @@ Act_Action_t Act_FromActCodToAction[1 + Act_MAX_ACTION_COD] = // Do not reuse un
ActCreNET, // #1645
ActUpdNET, // #1646
ActRemNETCrs, // #1647
ActChgCtrPlcCfg, // #1648
};
/*****************************************************************************/

View File

@ -57,9 +57,9 @@ typedef enum
typedef signed int Act_Action_t; // Must be a signed type, because -1 is used to indicate obsolete action
#define Act_NUM_ACTIONS (1 + 9 + 43 + 17 + 47 + 32 + 24 + 115 + 72 + 416 + 165 + 172 + 42 + 14 + 97)
#define Act_NUM_ACTIONS (1 + 9 + 43 + 17 + 47 + 33 + 24 + 115 + 72 + 416 + 165 + 172 + 42 + 14 + 97)
#define Act_MAX_ACTION_COD 1647
#define Act_MAX_ACTION_COD 1648
#define Act_MAX_OPTIONS_IN_MENU_PER_TAB 12
@ -238,32 +238,33 @@ typedef signed int Act_Action_t; // Must be a signed type, because -1 is used to
#define ActChgCtrInsCfg (ActChgCalIns1stDay + 7)
#define ActRenCtrShoCfg (ActChgCalIns1stDay + 8)
#define ActRenCtrFulCfg (ActChgCalIns1stDay + 9)
#define ActChgCtrWWWCfg (ActChgCalIns1stDay + 10)
#define ActReqCtrLog (ActChgCalIns1stDay + 11)
#define ActRecCtrLog (ActChgCalIns1stDay + 12)
#define ActRemCtrLog (ActChgCalIns1stDay + 13)
#define ActReqCtrPho (ActChgCalIns1stDay + 14)
#define ActRecCtrPho (ActChgCalIns1stDay + 15)
#define ActChgCtrPhoAtt (ActChgCalIns1stDay + 16)
#define ActChgCtrPlcCfg (ActChgCalIns1stDay + 10)
#define ActChgCtrWWWCfg (ActChgCalIns1stDay + 11)
#define ActReqCtrLog (ActChgCalIns1stDay + 12)
#define ActRecCtrLog (ActChgCalIns1stDay + 13)
#define ActRemCtrLog (ActChgCalIns1stDay + 14)
#define ActReqCtrPho (ActChgCalIns1stDay + 15)
#define ActRecCtrPho (ActChgCalIns1stDay + 16)
#define ActChgCtrPhoAtt (ActChgCalIns1stDay + 17)
#define ActSeeDegTyp (ActChgCalIns1stDay + 17)
#define ActEdiDegTyp (ActChgCalIns1stDay + 18)
#define ActNewDegTyp (ActChgCalIns1stDay + 19)
#define ActRemDegTyp (ActChgCalIns1stDay + 20)
#define ActRenDegTyp (ActChgCalIns1stDay + 21)
#define ActSeeDegTyp (ActChgCalIns1stDay + 18)
#define ActEdiDegTyp (ActChgCalIns1stDay + 19)
#define ActNewDegTyp (ActChgCalIns1stDay + 20)
#define ActRemDegTyp (ActChgCalIns1stDay + 21)
#define ActRenDegTyp (ActChgCalIns1stDay + 22)
#define ActEdiDeg (ActChgCalIns1stDay + 22)
#define ActReqDeg (ActChgCalIns1stDay + 23)
#define ActNewDeg (ActChgCalIns1stDay + 24)
#define ActRemDeg (ActChgCalIns1stDay + 25)
#define ActRenDegSho (ActChgCalIns1stDay + 26)
#define ActRenDegFul (ActChgCalIns1stDay + 27)
#define ActChgDegTyp (ActChgCalIns1stDay + 28)
#define ActChgDegWWW (ActChgCalIns1stDay + 29)
#define ActChgDegSta (ActChgCalIns1stDay + 30)
#define ActEdiDeg (ActChgCalIns1stDay + 23)
#define ActReqDeg (ActChgCalIns1stDay + 24)
#define ActNewDeg (ActChgCalIns1stDay + 25)
#define ActRemDeg (ActChgCalIns1stDay + 26)
#define ActRenDegSho (ActChgCalIns1stDay + 27)
#define ActRenDegFul (ActChgCalIns1stDay + 28)
#define ActChgDegTyp (ActChgCalIns1stDay + 29)
#define ActChgDegWWW (ActChgCalIns1stDay + 30)
#define ActChgDegSta (ActChgCalIns1stDay + 31)
#define ActPrnCalCtr (ActChgCalIns1stDay + 31)
#define ActChgCalCtr1stDay (ActChgCalIns1stDay + 32)
#define ActPrnCalCtr (ActChgCalIns1stDay + 32)
#define ActChgCalCtr1stDay (ActChgCalIns1stDay + 33)
/*****************************************************************************/
/********************************* Degree tab ********************************/

View File

@ -103,6 +103,7 @@ static Ctr_Status_t Ctr_GetStatusBitsFromStatusTxt (Ctr_StatusTxt_t StatusTxt);
static void Ctr_PutParamOtherCtrCod (long CtrCod);
static void Ctr_UpdateCtrInsDB (long CtrCod,long InsCod);
static void Ctr_UpdateCtrPlcDB (long CtrCod,long NewPlcCod);
static void Ctr_RenameCentre (struct Centre *Ctr,Cns_ShrtOrFullName_t ShrtOrFullName);
static bool Ctr_CheckIfCtrNameExistsInIns (const char *FieldName,const char *Name,long CtrCod,long InsCod);
@ -285,6 +286,7 @@ static void Ctr_Configuration (bool PrintView)
extern const char *Txt_Institution;
extern const char *Txt_Centre;
extern const char *Txt_Short_name;
extern const char *Txt_Another_place;
extern const char *Txt_Web;
extern const char *Txt_Shortcut;
extern const char *Txt_STR_LANG_ID[1 + Txt_NUM_LANGUAGES];
@ -295,6 +297,7 @@ static void Ctr_Configuration (bool PrintView)
extern const char *Txt_Degrees_of_CENTRE_X;
extern const char *Txt_Courses;
unsigned NumIns;
unsigned NumPlc;
struct Place Plc;
char PathPhoto[PATH_MAX + 1];
bool PhotoExists;
@ -490,12 +493,59 @@ static void Ctr_Configuration (bool PrintView)
fprintf (Gbl.F.Out,"</td>"
"</tr>");
/***** Place *****/
Plc.PlcCod = Gbl.CurrentCtr.Ctr.PlcCod;
Plc_GetDataOfPlaceByCod (&Plc);
fprintf (Gbl.F.Out,"<tr>"
"<td class=\"%s RIGHT_MIDDLE\">"
"%s:"
"</td>"
"<td class=\"DAT LEFT_MIDDLE\">",
The_ClassForm[Gbl.Prefs.Theme],
Txt_Place);
if (!PrintView &&
Gbl.Usrs.Me.Role.Logged >= Rol_CTR_ADM)
// Only centre admins, institution admins and system admins
// can change centre place
{
/* Get list of places of the current institution */
Gbl.Plcs.SelectedOrder = Plc_ORDER_BY_PLACE;
Plc_GetListPlaces ();
/* Put form to select place */
Act_FormStart (ActChgCtrPlcCfg);
fprintf (Gbl.F.Out,"<select name=\"PlcCod\" class=\"INPUT_SHORT_NAME\""
" onchange=\"document.getElementById('%s').submit();\">",
Gbl.Form.Id);
fprintf (Gbl.F.Out,"<option value=\"0\"");
if (Gbl.CurrentCtr.Ctr.PlcCod == 0)
fprintf (Gbl.F.Out," selected=\"selected\"");
fprintf (Gbl.F.Out,">%s</option>",Txt_Another_place);
for (NumPlc = 0;
NumPlc < Gbl.Plcs.Num;
NumPlc++)
fprintf (Gbl.F.Out,"<option value=\"%ld\"%s>%s</option>",
Gbl.Plcs.Lst[NumPlc].PlcCod,
(Gbl.Plcs.Lst[NumPlc].PlcCod == Gbl.CurrentCtr.Ctr.PlcCod) ? " selected=\"selected\"" :
"",
Gbl.Plcs.Lst[NumPlc].ShrtName);
fprintf (Gbl.F.Out,"</select>");
Act_FormEnd ();
/* Free list of places */
Plc_FreeListPlaces ();
}
else // I can not change centre place
fprintf (Gbl.F.Out,"%s",Plc.FullName);
fprintf (Gbl.F.Out,"</td>"
"</tr>");
/***** Centre WWW *****/
fprintf (Gbl.F.Out,"<tr>"
"<td class=\"RIGHT_MIDDLE\">"
"<label for=\"WWW\" class=\"%s\">%s:</label>"
"</td>"
"<td class=\"DAT LEFT_MIDDLE\">",
"<td class=\"LEFT_MIDDLE\">",
The_ClassForm[Gbl.Prefs.Theme],
Txt_Web);
if (!PrintView &&
@ -561,21 +611,6 @@ static void Ctr_Configuration (bool PrintView)
}
else
{
/***** Place *****/
Plc.PlcCod = Gbl.CurrentCtr.Ctr.PlcCod;
Plc_GetDataOfPlaceByCod (&Plc);
fprintf (Gbl.F.Out,"<tr>"
"<td class=\"%s RIGHT_MIDDLE\">"
"%s:"
"</td>"
"<td class=\"DAT LEFT_MIDDLE\">"
"%s"
"</td>"
"</tr>",
The_ClassForm[Gbl.Prefs.Theme],
Txt_Place,
Plc.FullName);
/***** Number of users who claim to belong to this centre *****/
fprintf (Gbl.F.Out,"<tr>"
"<td class=\"%s RIGHT_MIDDLE\">"
@ -1836,11 +1871,10 @@ static void Ctr_UpdateCtrInsDB (long CtrCod,long InsCod)
/************************ Change the place of a centre ***********************/
/*****************************************************************************/
void Ctr_ChangeCentrePlace (void)
void Ctr_ChangeCtrPlc (void)
{
extern const char *Txt_The_place_of_the_centre_has_changed;
long NewPlcCod;
char Query[512];
/***** Get centre code *****/
Gbl.Ctrs.EditingCtr.CtrCod = Ctr_GetAndCheckParamOtherCtrCod (1);
@ -1852,9 +1886,7 @@ void Ctr_ChangeCentrePlace (void)
Ctr_GetDataOfCentreByCod (&Gbl.Ctrs.EditingCtr);
/***** Update place in table of centres *****/
sprintf (Query,"UPDATE centres SET PlcCod=%ld WHERE CtrCod=%ld",
NewPlcCod,Gbl.Ctrs.EditingCtr.CtrCod);
DB_QueryUPDATE (Query,"can not update the place of a centre");
Ctr_UpdateCtrPlcDB (Gbl.Ctrs.EditingCtr.CtrCod,NewPlcCod);
Gbl.Ctrs.EditingCtr.PlcCod = NewPlcCod;
/***** Write message to show the change made
@ -1867,6 +1899,38 @@ void Ctr_ChangeCentrePlace (void)
Ctr_EditCentres ();
}
void Ctr_ChangeCtrPlcInConfig (void)
{
extern const char *Txt_The_place_of_the_centre_has_changed;
long NewPlcCod;
/***** Get parameter with place code *****/
NewPlcCod = Plc_GetParamPlcCod ();
/***** Update place in table of centres *****/
Ctr_UpdateCtrPlcDB (Gbl.CurrentCtr.Ctr.CtrCod,NewPlcCod);
Gbl.CurrentCtr.Ctr.PlcCod = NewPlcCod;
/***** Write message to show the change made *****/
Ale_ShowAlert (Ale_SUCCESS,Txt_The_place_of_the_centre_has_changed);
/***** Show the form again *****/
Ctr_ShowConfiguration ();
}
/*****************************************************************************/
/************** Update database changing old place by new place **************/
/*****************************************************************************/
static void Ctr_UpdateCtrPlcDB (long CtrCod,long NewPlcCod)
{
char Query[256];
sprintf (Query,"UPDATE centres SET PlcCod=%ld WHERE CtrCod=%ld",
NewPlcCod,CtrCod);
DB_QueryUPDATE (Query,"can not update the place of a centre");
}
/*****************************************************************************/
/********************* Change the short name of a centre *********************/
/*****************************************************************************/

View File

@ -106,7 +106,8 @@ long Ctr_GetAndCheckParamOtherCtrCod (long MinCodAllowed);
void Ctr_RemoveCentre (void);
void Ctr_ChangeCtrInsInConfig (void);
void Ctr_ContEditAfterChgCtrInConfig (void);
void Ctr_ChangeCentrePlace (void);
void Ctr_ChangeCtrPlc (void);
void Ctr_ChangeCtrPlcInConfig (void);
void Ctr_RenameCentreShort (void);
void Ctr_RenameCentreShortInConfig (void);
void Ctr_RenameCentreFull (void);

View File

@ -230,21 +230,20 @@
// TODO: Link names are too short ==> add more length, for example: "A guide to building and understanding the physics of Water Rockets"
// TODO: Fix bug: Error when a link end in a dot. Example: "A guide to building..." --> "A guide to building._..url" (two dots)
// TODO: In centre configuration, place should be editable
// TODO: Cuando sólo se cambian los grupos y no el rol de un profesor ya existente, no sale ningún mensaje. se haga lo que se haga en la edición debería salir un mensaje del tipo "Cambios realizados"
/*****************************************************************************/
/****************************** Public constants *****************************/
/*****************************************************************************/
#define Log_PLATFORM_VERSION "SWAD 16.244 (2017-06-11)"
#define Log_PLATFORM_VERSION "SWAD 16.245 (2017-06-11)"
#define CSS_FILE "swad16.235.1.css"
#define JS_FILE "swad16.206.3.js"
// 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
/*
Version 16.245: Jun 12, 2017 Place editable in centre configuration. (221876 lines)
Version 16.244.1: Jun 12, 2017 Fix bug in edition of centres. (221817 lines)
Version 16.244: Jun 12, 2017 Code refactoring related with boxes. (221815 lines)
Version 16.243: Jun 12, 2017 Code refactoring related with boxes. (222174 lines)