diff --git a/swad_action.c b/swad_action.c index fbb822d84..4e5220cbf 100644 --- a/swad_action.c +++ b/swad_action.c @@ -370,6 +370,7 @@ Degree: 242. ActChgDegCtrCfg Request change of the centre of a degree in degree configuration NEW. ActRenDegShoCfg Request change of the short name of a degree in degree configuration NEW. ActRenDegFulCfg Request change of the full name of a degree in degree configuration + NEW. ActChgDegWWWCfg Request change of the web of a degree in degree configuration 243. ActReqDegLog Show form to send the logo of the current degree 244. ActRecDegLog Receive and store the logo of the current degree 245. ActRemDegLog Remove the logo of the current degree @@ -1728,6 +1729,7 @@ struct Act_Actions Act_Actions[Act_NUM_ACTIONS] = /* ActChgDegCtrCfg */{1588,-1,TabUnk,ActSeeDegInf ,0x180,0x180,0x180,Act_CONT_NORM,Act_THIS_WINDOW,Deg_ChangeDegCtrInConfig ,Deg_ContEditAfterChgDegInConfig,NULL}, /* ActRenDegShoCfg */{1598,-1,TabUnk,ActSeeDegInf ,0x1C0,0x1C0,0x1C0,Act_CONT_NORM,Act_THIS_WINDOW,Deg_RenameDegreeShortInConfig ,Deg_ContEditAfterChgDegInConfig,NULL}, /* ActRenDegFulCfg */{1597,-1,TabUnk,ActSeeDegInf ,0x1C0,0x1C0,0x1C0,Act_CONT_NORM,Act_THIS_WINDOW,Deg_RenameDegreeFullInConfig ,Deg_ContEditAfterChgDegInConfig,NULL}, + /* ActChgDegWWWCfg */{1599,-1,TabUnk,ActSeeDegInf ,0x1C0,0x1C0,0x1C0,Act_CONT_NORM,Act_THIS_WINDOW,NULL ,Deg_ChangeDegWWWInConfig ,NULL}, /* ActReqDegLog */{1246,-1,TabUnk,ActSeeDegInf ,0x100,0x100,0x100,Act_CONT_NORM,Act_THIS_WINDOW,NULL ,Deg_RequestLogo ,NULL}, /* ActRecDegLog */{ 553,-1,TabUnk,ActSeeDegInf ,0x100,0x100,0x100,Act_CONT_DATA,Act_THIS_WINDOW,Deg_ReceiveLogo ,Deg_ShowConfiguration ,NULL}, /* ActRemDegLog */{1343,-1,TabUnk,ActSeeDegInf ,0x100,0x100,0x100,Act_CONT_DATA,Act_THIS_WINDOW,Deg_RemoveLogo ,Deg_ShowConfiguration ,NULL}, @@ -4464,6 +4466,7 @@ Act_Action_t Act_FromActCodToAction[1+Act_MAX_ACTION_COD] = // Do not reuse uniq ActChgCtrWWWCfg, // #1596 ActRenDegFulCfg, // #1597 ActRenDegShoCfg, // #1598 + ActChgDegWWWCfg, // #1599 }; /*****************************************************************************/ diff --git a/swad_action.h b/swad_action.h index 681380363..a3bc95294 100644 --- a/swad_action.h +++ b/swad_action.h @@ -55,9 +55,9 @@ typedef enum typedef int Act_Action_t; // Must be a signed type, because -1 is used to indicate obsolete action -#define Act_NUM_ACTIONS (1+9+51+14+93+73+69+247+186+155+172+36+30+86) +#define Act_NUM_ACTIONS (1+9+51+14+93+73+70+247+186+155+172+36+30+86) -#define Act_MAX_ACTION_COD 1598 +#define Act_MAX_ACTION_COD 1599 #define Act_MAX_OPTIONS_IN_MENU_PER_TAB 11 @@ -370,68 +370,69 @@ typedef int Act_Action_t; // Must be a signed type, because -1 is used to indica #define ActChgDegCtrCfg (ActDowShaCtr+ 8) #define ActRenDegShoCfg (ActDowShaCtr+ 9) #define ActRenDegFulCfg (ActDowShaCtr+ 10) -#define ActReqDegLog (ActDowShaCtr+ 11) -#define ActRecDegLog (ActDowShaCtr+ 12) -#define ActRemDegLog (ActDowShaCtr+ 13) +#define ActChgDegWWWCfg (ActDowShaCtr+ 11) +#define ActReqDegLog (ActDowShaCtr+ 12) +#define ActRecDegLog (ActDowShaCtr+ 13) +#define ActRemDegLog (ActDowShaCtr+ 14) -#define ActEdiCrs (ActDowShaCtr+ 14) -#define ActReqCrs (ActDowShaCtr+ 15) -#define ActNewCrs (ActDowShaCtr+ 16) -#define ActRemCrs (ActDowShaCtr+ 17) -#define ActChgInsCrsCod (ActDowShaCtr+ 18) -#define ActChgCrsYea (ActDowShaCtr+ 19) -#define ActRenCrsSho (ActDowShaCtr+ 20) -#define ActRenCrsFul (ActDowShaCtr+ 21) -#define ActChgCrsSta (ActDowShaCtr+ 22) +#define ActEdiCrs (ActDowShaCtr+ 15) +#define ActReqCrs (ActDowShaCtr+ 16) +#define ActNewCrs (ActDowShaCtr+ 17) +#define ActRemCrs (ActDowShaCtr+ 18) +#define ActChgInsCrsCod (ActDowShaCtr+ 19) +#define ActChgCrsYea (ActDowShaCtr+ 20) +#define ActRenCrsSho (ActDowShaCtr+ 21) +#define ActRenCrsFul (ActDowShaCtr+ 22) +#define ActChgCrsSta (ActDowShaCtr+ 23) -#define ActChgToSeeDocDeg (ActDowShaCtr+ 23) -#define ActSeeDocDeg (ActDowShaCtr+ 24) -#define ActExpSeeDocDeg (ActDowShaCtr+ 25) -#define ActConSeeDocDeg (ActDowShaCtr+ 26) -#define ActZIPSeeDocDeg (ActDowShaCtr+ 27) -#define ActReqDatSeeDocDeg (ActDowShaCtr+ 28) -#define ActDowSeeDocDeg (ActDowShaCtr+ 29) -#define ActChgToAdmDocDeg (ActDowShaCtr+ 30) -#define ActAdmDocDeg (ActDowShaCtr+ 31) -#define ActReqRemFilDocDeg (ActDowShaCtr+ 32) -#define ActRemFilDocDeg (ActDowShaCtr+ 33) -#define ActRemFolDocDeg (ActDowShaCtr+ 34) -#define ActCopDocDeg (ActDowShaCtr+ 35) -#define ActPasDocDeg (ActDowShaCtr+ 36) -#define ActRemTreDocDeg (ActDowShaCtr+ 37) -#define ActFrmCreDocDeg (ActDowShaCtr+ 38) -#define ActCreFolDocDeg (ActDowShaCtr+ 39) -#define ActCreLnkDocDeg (ActDowShaCtr+ 40) -#define ActRenFolDocDeg (ActDowShaCtr+ 41) -#define ActRcvFilDocDegDZ (ActDowShaCtr+ 42) -#define ActRcvFilDocDegCla (ActDowShaCtr+ 43) -#define ActExpAdmDocDeg (ActDowShaCtr+ 44) -#define ActConAdmDocDeg (ActDowShaCtr+ 45) -#define ActZIPAdmDocDeg (ActDowShaCtr+ 46) -#define ActShoDocDeg (ActDowShaCtr+ 47) -#define ActHidDocDeg (ActDowShaCtr+ 48) -#define ActReqDatAdmDocDeg (ActDowShaCtr+ 49) -#define ActChgDatAdmDocDeg (ActDowShaCtr+ 50) -#define ActDowAdmDocDeg (ActDowShaCtr+ 51) +#define ActChgToSeeDocDeg (ActDowShaCtr+ 24) +#define ActSeeDocDeg (ActDowShaCtr+ 25) +#define ActExpSeeDocDeg (ActDowShaCtr+ 26) +#define ActConSeeDocDeg (ActDowShaCtr+ 27) +#define ActZIPSeeDocDeg (ActDowShaCtr+ 28) +#define ActReqDatSeeDocDeg (ActDowShaCtr+ 29) +#define ActDowSeeDocDeg (ActDowShaCtr+ 30) +#define ActChgToAdmDocDeg (ActDowShaCtr+ 31) +#define ActAdmDocDeg (ActDowShaCtr+ 32) +#define ActReqRemFilDocDeg (ActDowShaCtr+ 33) +#define ActRemFilDocDeg (ActDowShaCtr+ 34) +#define ActRemFolDocDeg (ActDowShaCtr+ 35) +#define ActCopDocDeg (ActDowShaCtr+ 36) +#define ActPasDocDeg (ActDowShaCtr+ 37) +#define ActRemTreDocDeg (ActDowShaCtr+ 38) +#define ActFrmCreDocDeg (ActDowShaCtr+ 39) +#define ActCreFolDocDeg (ActDowShaCtr+ 40) +#define ActCreLnkDocDeg (ActDowShaCtr+ 41) +#define ActRenFolDocDeg (ActDowShaCtr+ 42) +#define ActRcvFilDocDegDZ (ActDowShaCtr+ 43) +#define ActRcvFilDocDegCla (ActDowShaCtr+ 44) +#define ActExpAdmDocDeg (ActDowShaCtr+ 45) +#define ActConAdmDocDeg (ActDowShaCtr+ 46) +#define ActZIPAdmDocDeg (ActDowShaCtr+ 47) +#define ActShoDocDeg (ActDowShaCtr+ 48) +#define ActHidDocDeg (ActDowShaCtr+ 49) +#define ActReqDatAdmDocDeg (ActDowShaCtr+ 50) +#define ActChgDatAdmDocDeg (ActDowShaCtr+ 51) +#define ActDowAdmDocDeg (ActDowShaCtr+ 52) -#define ActReqRemFilShaDeg (ActDowShaCtr+ 52) -#define ActRemFilShaDeg (ActDowShaCtr+ 53) -#define ActRemFolShaDeg (ActDowShaCtr+ 54) -#define ActCopShaDeg (ActDowShaCtr+ 55) -#define ActPasShaDeg (ActDowShaCtr+ 56) -#define ActRemTreShaDeg (ActDowShaCtr+ 57) -#define ActFrmCreShaDeg (ActDowShaCtr+ 58) -#define ActCreFolShaDeg (ActDowShaCtr+ 59) -#define ActCreLnkShaDeg (ActDowShaCtr+ 60) -#define ActRenFolShaDeg (ActDowShaCtr+ 61) -#define ActRcvFilShaDegDZ (ActDowShaCtr+ 62) -#define ActRcvFilShaDegCla (ActDowShaCtr+ 63) -#define ActExpShaDeg (ActDowShaCtr+ 64) -#define ActConShaDeg (ActDowShaCtr+ 65) -#define ActZIPShaDeg (ActDowShaCtr+ 66) -#define ActReqDatShaDeg (ActDowShaCtr+ 67) -#define ActChgDatShaDeg (ActDowShaCtr+ 68) -#define ActDowShaDeg (ActDowShaCtr+ 69) +#define ActReqRemFilShaDeg (ActDowShaCtr+ 53) +#define ActRemFilShaDeg (ActDowShaCtr+ 54) +#define ActRemFolShaDeg (ActDowShaCtr+ 55) +#define ActCopShaDeg (ActDowShaCtr+ 56) +#define ActPasShaDeg (ActDowShaCtr+ 57) +#define ActRemTreShaDeg (ActDowShaCtr+ 58) +#define ActFrmCreShaDeg (ActDowShaCtr+ 59) +#define ActCreFolShaDeg (ActDowShaCtr+ 60) +#define ActCreLnkShaDeg (ActDowShaCtr+ 61) +#define ActRenFolShaDeg (ActDowShaCtr+ 62) +#define ActRcvFilShaDegDZ (ActDowShaCtr+ 63) +#define ActRcvFilShaDegCla (ActDowShaCtr+ 64) +#define ActExpShaDeg (ActDowShaCtr+ 65) +#define ActConShaDeg (ActDowShaCtr+ 66) +#define ActZIPShaDeg (ActDowShaCtr+ 67) +#define ActReqDatShaDeg (ActDowShaCtr+ 68) +#define ActChgDatShaDeg (ActDowShaCtr+ 69) +#define ActDowShaDeg (ActDowShaCtr+ 70) /*****************************************************************************/ /******************************** Course tab *********************************/ diff --git a/swad_changelog.h b/swad_changelog.h index 9e262319d..ca98a0b61 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -150,13 +150,18 @@ /****************************** Public constants *****************************/ /*****************************************************************************/ -#define Log_PLATFORM_VERSION "SWAD 16.38 (2016-10-23)" +#define Log_PLATFORM_VERSION "SWAD 16.39 (2016-10-23)" #define CSS_FILE "swad16.32.1.css" #define JS_FILE "swad15.238.1.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.39: Oct 23, 2016 New form in degree configuration to change WWW. (205404 lines) + 2 changes necessary in database: +UPDATE actions SET Txt='Cambiar web de titulación' WHERE ActCod='554' AND Language='es'; +INSERT INTO actions (ActCod,Language,Obsolete,Txt) VALUES ('1599','es','N','Cambiar web de titulación'); + Version 16.38: Oct 23, 2016 New form in degree configuration to change full name. (205354 lines) 1 change necessary in database: INSERT INTO actions (ActCod,Language,Obsolete,Txt) VALUES ('1598','es','N','Cambiar nombre breve titulac.'); diff --git a/swad_degree.c b/swad_degree.c index 1647f14af..0e8277b20 100644 --- a/swad_degree.c +++ b/swad_degree.c @@ -109,8 +109,8 @@ static void Deg_GetDataOfDegreeFromRow (struct Degree *Deg,MYSQL_ROW row); static void Deg_GetDegCodFromForm (void); static void Deg_RenameDegree (struct Degree *Deg,Cns_ShortOrFullName_t ShortOrFullName); static bool Deg_CheckIfDegNameExistsInCtr (const char *FieldName,const char *Name,long DegCod,long CtrCod); - static void Deg_UpdateDegCtrDB (long DegCod,long CtrCod); +static void Deg_UpdateDegWWWDB (long DegCod,const char NewWWW[Cns_MAX_LENGTH_WWW+1]); /*****************************************************************************/ /********** List pending institutions, centres, degrees and courses **********/ @@ -424,15 +424,29 @@ static void Deg_Configuration (bool PrintView) ""); /***** Degree WWW *****/ - if (Gbl.CurrentDeg.Deg.WWW[0]) + fprintf (Gbl.F.Out,"" + "" + "%s:" + "" + "", + The_ClassForm[Gbl.Prefs.Theme], + Txt_Web); + if (!PrintView && + Gbl.Usrs.Me.LoggedRole >= Rol_CTR_ADM) + // Only centre admins, institution admins and system admins can change degree WWW { - fprintf (Gbl.F.Out,"" - "" - "%s:" - "" - "", - The_ClassForm[Gbl.Prefs.Theme], - Txt_Web); + /* Form to change degree WWW */ + Act_FormStart (ActChgDegWWWCfg); + fprintf (Gbl.F.Out,"", + Cns_MAX_LENGTH_WWW, + Gbl.CurrentDeg.Deg.WWW, + Gbl.Form.Id); + Act_FormEnd (); + } + else // I can not change degree WWW fprintf (Gbl.F.Out,"
" "" "%s" @@ -440,9 +454,8 @@ static void Deg_Configuration (bool PrintView) "
", Gbl.CurrentDeg.Deg.WWW, Gbl.CurrentDeg.Deg.WWW); - fprintf (Gbl.F.Out,"" - ""); - } + fprintf (Gbl.F.Out,"" + ""); /***** Shortcut to the degree *****/ fprintf (Gbl.F.Out,"" @@ -2538,7 +2551,6 @@ void Deg_ChangeDegWWW (void) extern const char *Txt_The_new_web_address_is_X; extern const char *Txt_You_can_not_leave_the_web_address_empty; struct Degree *Deg; - char Query[256+Cns_MAX_LENGTH_WWW]; char NewWWW[Cns_MAX_LENGTH_WWW+1]; Deg = &Gbl.Degs.EditingDeg; @@ -2558,29 +2570,65 @@ void Deg_ChangeDegWWW (void) if (NewWWW[0]) { /***** Update the table changing old WWW by new WWW *****/ - sprintf (Query,"UPDATE degrees SET WWW='%s' WHERE DegCod='%ld'", - NewWWW,Deg->DegCod); - DB_QueryUPDATE (Query,"can not update the web of a degree"); + Deg_UpdateDegWWWDB (Deg->DegCod,NewWWW); + strcpy (Deg->WWW,NewWWW); /***** Write message to show the change made *****/ - sprintf (Gbl.Message,Txt_The_new_web_address_is_X, - NewWWW); + sprintf (Gbl.Message,Txt_The_new_web_address_is_X,NewWWW); Lay_ShowAlert (Lay_SUCCESS,Gbl.Message); /***** Put button to go to degree changed *****/ Deg_PutButtonToGoToDeg (Deg); } else - { - sprintf (Gbl.Message,"%s",Txt_You_can_not_leave_the_web_address_empty); - Lay_ShowAlert (Lay_WARNING,Gbl.Message); - } + Lay_ShowAlert (Lay_WARNING,Txt_You_can_not_leave_the_web_address_empty); /***** Show the form again *****/ - strcpy (Deg->WWW,NewWWW); Deg_EditDegrees (); } +void Deg_ChangeDegWWWInConfig (void) + { + extern const char *Txt_The_new_web_address_is_X; + extern const char *Txt_You_can_not_leave_the_web_address_empty; + char NewWWW[Cns_MAX_LENGTH_WWW+1]; + + /***** Get parameters from form *****/ + /* Get the new WWW for the degree */ + Par_GetParToText ("WWW",NewWWW,Cns_MAX_LENGTH_WWW); + + /***** Check if new WWW is empty *****/ + if (NewWWW[0]) + { + /***** Update the table changing old WWW by new WWW *****/ + Deg_UpdateDegWWWDB (Gbl.CurrentDeg.Deg.DegCod,NewWWW); + strcpy (Gbl.CurrentDeg.Deg.WWW,NewWWW); + + /***** Write message to show the change made *****/ + sprintf (Gbl.Message,Txt_The_new_web_address_is_X,NewWWW); + Lay_ShowAlert (Lay_SUCCESS,Gbl.Message); + } + else + Lay_ShowAlert (Lay_WARNING,Txt_You_can_not_leave_the_web_address_empty); + + /***** Show the form again *****/ + Deg_ShowConfiguration (); + } + +/*****************************************************************************/ +/**************** Update database changing old WWW by new WWW ****************/ +/*****************************************************************************/ + +static void Deg_UpdateDegWWWDB (long DegCod,const char NewWWW[Cns_MAX_LENGTH_WWW+1]) + { + char Query[256+Cns_MAX_LENGTH_WWW]; + + /***** Update database changing old WWW by new WWW *****/ + sprintf (Query,"UPDATE degrees SET WWW='%s' WHERE DegCod='%ld'", + NewWWW,DegCod); + DB_QueryUPDATE (Query,"can not update the web of a degree"); + } + /*****************************************************************************/ /*********************** Change the status of a degree ***********************/ /*****************************************************************************/ diff --git a/swad_degree.h b/swad_degree.h index 134f96f96..c0e36fe60 100644 --- a/swad_degree.h +++ b/swad_degree.h @@ -132,6 +132,7 @@ void Deg_RenameDegreeFullInConfig (void); void Deg_ChangeDegCtrInConfig (void); void Deg_ContEditAfterChgDegInConfig (void); void Deg_ChangeDegWWW (void); +void Deg_ChangeDegWWWInConfig (void); void Deg_ChangeDegStatus (void); void Deg_ContEditAfterChgDeg (void);