From 72258bc338a1055d4b0b1e4037b4e24beceb8657 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Ca=C3=B1as=20Vargas?= Date: Wed, 19 Oct 2016 20:43:26 +0200 Subject: [PATCH] Version 16.23 --- swad_action.c | 5 +- swad_action.h | 125 ++++++++++++++++++++++++----------------------- swad_changelog.h | 5 +- swad_course.c | 56 +++++++++++---------- swad_degree.c | 97 ++++++++++++++++++++++++++++++++++-- swad_degree.h | 2 + 6 files changed, 195 insertions(+), 95 deletions(-) diff --git a/swad_action.c b/swad_action.c index e5d2abafb..162bad23c 100644 --- a/swad_action.c +++ b/swad_action.c @@ -362,6 +362,7 @@ Degree: 241. ActDegSch Search for courses, teachers, documents... 242. ActPrnDegInf Print information on the current degree + NEW. ActChgDegCtrCfg Request change of the centre 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 @@ -1646,7 +1647,7 @@ struct Act_Actions Act_Actions[Act_NUM_ACTIONS] = /* ActRenDegSho */{ 546,-1,TabCtr,ActSeeDeg ,0x1FE,0x1FE,0x1FE,Act_CONTENT_NORM,Act_MAIN_WINDOW,Deg_RenameDegreeShort ,Deg_ContEditAfterChgDeg ,NULL}, /* ActRenDegFul */{ 547,-1,TabCtr,ActSeeDeg ,0x1FE,0x1FE,0x1FE,Act_CONTENT_NORM,Act_MAIN_WINDOW,Deg_RenameDegreeFull ,Deg_ContEditAfterChgDeg ,NULL}, /* ActChgDegTyp */{ 544,-1,TabCtr,ActSeeDeg ,0x1FE,0x1FE,0x1FE,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,DT_ChangeDegreeType ,NULL}, - /* ActChgDegCtr */{1049,-1,TabCtr,ActSeeDeg ,0x1C0,0x1C0,0x1C0,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Deg_ChangeDegreeCtr ,NULL}, + /* ActChgDegCtr */{1049,-1,TabCtr,ActSeeDeg ,0x1E0,0x1E0,0x1E0,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Deg_ChangeDegreeCtr ,NULL}, /* ActChgDegWWW */{ 554,-1,TabCtr,ActSeeDeg ,0x1FE,0x1FE,0x1FE,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Deg_ChangeDegWWW ,NULL}, /* ActChgDegSta */{1207,-1,TabCtr,ActSeeDeg ,0x1C0,0x1C0,0x1C0,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Deg_ChangeDegStatus ,NULL}, @@ -1715,6 +1716,7 @@ struct Act_Actions Act_Actions[Act_NUM_ACTIONS] = /* ActDegSch */{1184,-1,TabDeg,ActDegReqSch ,0x1FF,0x1FF,0x1FF,Act_CONTENT_NORM,Act_MAIN_WINDOW,Sch_GetParamsSearch ,Sch_DegSearch ,NULL}, /* ActPrnDegInf */{1150,-1,TabDeg,ActSeeDegInf ,0x1FF,0x1FF,0x1FF,Act_CONTENT_NORM,Act_NEW_WINDOW ,NULL ,Deg_PrintConfiguration ,NULL}, + /* ActChgDegCtrCfg */{1588,-1,TabDeg,ActSeeDegInf ,0x1E0,0x1E0,0x1E0,Act_CONTENT_NORM,Act_MAIN_WINDOW,Deg_ChangeDegreeCtrInConfig ,Deg_ContEditAfterChgDegInConfig,NULL}, /* ActReqDegLog */{1246,-1,TabDeg,ActSeeDegInf ,0x100,0x100,0x100,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Deg_RequestLogo ,NULL}, /* ActRecDegLog */{ 553,-1,TabDeg,ActSeeDegInf ,0x100,0x100,0x100,Act_CONTENT_DATA,Act_MAIN_WINDOW,Deg_ReceiveLogo ,Deg_ShowConfiguration ,NULL}, /* ActRemDegLog */{1343,-1,TabDeg,ActSeeDegInf ,0x100,0x100,0x100,Act_CONTENT_DATA,Act_MAIN_WINDOW,Deg_RemoveLogo ,Deg_ShowConfiguration ,NULL}, @@ -4441,6 +4443,7 @@ Act_Action_t Act_FromActCodToAction[1+Act_MAX_ACTION_COD] = // Do not reuse uniq ActAutUsrNew, // #1585 ActReqMyUsgRep, // #1586 ActChgCrsDegCfg, // #1587 + ActChgDegCtrCfg, // #1588 }; /*****************************************************************************/ diff --git a/swad_action.h b/swad_action.h index 1c0d8e9e5..2137510c2 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+15+90+70+67+247+186+155+172+36+30+86) +#define Act_NUM_ACTIONS (1+9+51+15+90+70+68+247+186+155+172+36+30+86) -#define Act_MAX_ACTION_COD 1587 +#define Act_MAX_ACTION_COD 1588 #define Act_MAX_OPTIONS_IN_MENU_PER_TAB 20 @@ -362,69 +362,70 @@ typedef int Act_Action_t; // Must be a signed type, because -1 is used to indica // Secondary actions #define ActDegSch (ActDowShaCtr+ 6) #define ActPrnDegInf (ActDowShaCtr+ 7) -#define ActReqDegLog (ActDowShaCtr+ 8) -#define ActRecDegLog (ActDowShaCtr+ 9) -#define ActRemDegLog (ActDowShaCtr+ 10) +#define ActChgDegCtrCfg (ActDowShaCtr+ 8) +#define ActReqDegLog (ActDowShaCtr+ 9) +#define ActRecDegLog (ActDowShaCtr+ 10) +#define ActRemDegLog (ActDowShaCtr+ 11) -#define ActEdiCrs (ActDowShaCtr+ 11) -#define ActReqCrs (ActDowShaCtr+ 12) -#define ActNewCrs (ActDowShaCtr+ 13) -#define ActRemCrs (ActDowShaCtr+ 14) -#define ActChgInsCrsCod (ActDowShaCtr+ 15) -#define ActChgCrsDeg (ActDowShaCtr+ 16) -#define ActChgCrsYea (ActDowShaCtr+ 17) -#define ActRenCrsSho (ActDowShaCtr+ 18) -#define ActRenCrsFul (ActDowShaCtr+ 19) -#define ActChgCrsSta (ActDowShaCtr+ 20) +#define ActEdiCrs (ActDowShaCtr+ 12) +#define ActReqCrs (ActDowShaCtr+ 13) +#define ActNewCrs (ActDowShaCtr+ 14) +#define ActRemCrs (ActDowShaCtr+ 15) +#define ActChgInsCrsCod (ActDowShaCtr+ 16) +#define ActChgCrsDeg (ActDowShaCtr+ 17) +#define ActChgCrsYea (ActDowShaCtr+ 18) +#define ActRenCrsSho (ActDowShaCtr+ 19) +#define ActRenCrsFul (ActDowShaCtr+ 20) +#define ActChgCrsSta (ActDowShaCtr+ 21) -#define ActChgToSeeDocDeg (ActDowShaCtr+ 21) -#define ActSeeDocDeg (ActDowShaCtr+ 22) -#define ActExpSeeDocDeg (ActDowShaCtr+ 23) -#define ActConSeeDocDeg (ActDowShaCtr+ 24) -#define ActZIPSeeDocDeg (ActDowShaCtr+ 25) -#define ActReqDatSeeDocDeg (ActDowShaCtr+ 26) -#define ActDowSeeDocDeg (ActDowShaCtr+ 27) -#define ActChgToAdmDocDeg (ActDowShaCtr+ 28) -#define ActAdmDocDeg (ActDowShaCtr+ 29) -#define ActReqRemFilDocDeg (ActDowShaCtr+ 30) -#define ActRemFilDocDeg (ActDowShaCtr+ 31) -#define ActRemFolDocDeg (ActDowShaCtr+ 32) -#define ActCopDocDeg (ActDowShaCtr+ 33) -#define ActPasDocDeg (ActDowShaCtr+ 34) -#define ActRemTreDocDeg (ActDowShaCtr+ 35) -#define ActFrmCreDocDeg (ActDowShaCtr+ 36) -#define ActCreFolDocDeg (ActDowShaCtr+ 37) -#define ActCreLnkDocDeg (ActDowShaCtr+ 38) -#define ActRenFolDocDeg (ActDowShaCtr+ 39) -#define ActRcvFilDocDegDZ (ActDowShaCtr+ 40) -#define ActRcvFilDocDegCla (ActDowShaCtr+ 41) -#define ActExpAdmDocDeg (ActDowShaCtr+ 42) -#define ActConAdmDocDeg (ActDowShaCtr+ 43) -#define ActZIPAdmDocDeg (ActDowShaCtr+ 44) -#define ActShoDocDeg (ActDowShaCtr+ 45) -#define ActHidDocDeg (ActDowShaCtr+ 46) -#define ActReqDatAdmDocDeg (ActDowShaCtr+ 47) -#define ActChgDatAdmDocDeg (ActDowShaCtr+ 48) -#define ActDowAdmDocDeg (ActDowShaCtr+ 49) +#define ActChgToSeeDocDeg (ActDowShaCtr+ 22) +#define ActSeeDocDeg (ActDowShaCtr+ 23) +#define ActExpSeeDocDeg (ActDowShaCtr+ 24) +#define ActConSeeDocDeg (ActDowShaCtr+ 25) +#define ActZIPSeeDocDeg (ActDowShaCtr+ 26) +#define ActReqDatSeeDocDeg (ActDowShaCtr+ 27) +#define ActDowSeeDocDeg (ActDowShaCtr+ 28) +#define ActChgToAdmDocDeg (ActDowShaCtr+ 29) +#define ActAdmDocDeg (ActDowShaCtr+ 30) +#define ActReqRemFilDocDeg (ActDowShaCtr+ 31) +#define ActRemFilDocDeg (ActDowShaCtr+ 32) +#define ActRemFolDocDeg (ActDowShaCtr+ 33) +#define ActCopDocDeg (ActDowShaCtr+ 34) +#define ActPasDocDeg (ActDowShaCtr+ 35) +#define ActRemTreDocDeg (ActDowShaCtr+ 36) +#define ActFrmCreDocDeg (ActDowShaCtr+ 37) +#define ActCreFolDocDeg (ActDowShaCtr+ 38) +#define ActCreLnkDocDeg (ActDowShaCtr+ 39) +#define ActRenFolDocDeg (ActDowShaCtr+ 40) +#define ActRcvFilDocDegDZ (ActDowShaCtr+ 41) +#define ActRcvFilDocDegCla (ActDowShaCtr+ 42) +#define ActExpAdmDocDeg (ActDowShaCtr+ 43) +#define ActConAdmDocDeg (ActDowShaCtr+ 44) +#define ActZIPAdmDocDeg (ActDowShaCtr+ 45) +#define ActShoDocDeg (ActDowShaCtr+ 46) +#define ActHidDocDeg (ActDowShaCtr+ 47) +#define ActReqDatAdmDocDeg (ActDowShaCtr+ 48) +#define ActChgDatAdmDocDeg (ActDowShaCtr+ 49) +#define ActDowAdmDocDeg (ActDowShaCtr+ 50) -#define ActReqRemFilShaDeg (ActDowShaCtr+ 50) -#define ActRemFilShaDeg (ActDowShaCtr+ 51) -#define ActRemFolShaDeg (ActDowShaCtr+ 52) -#define ActCopShaDeg (ActDowShaCtr+ 53) -#define ActPasShaDeg (ActDowShaCtr+ 54) -#define ActRemTreShaDeg (ActDowShaCtr+ 55) -#define ActFrmCreShaDeg (ActDowShaCtr+ 56) -#define ActCreFolShaDeg (ActDowShaCtr+ 57) -#define ActCreLnkShaDeg (ActDowShaCtr+ 58) -#define ActRenFolShaDeg (ActDowShaCtr+ 59) -#define ActRcvFilShaDegDZ (ActDowShaCtr+ 60) -#define ActRcvFilShaDegCla (ActDowShaCtr+ 61) -#define ActExpShaDeg (ActDowShaCtr+ 62) -#define ActConShaDeg (ActDowShaCtr+ 63) -#define ActZIPShaDeg (ActDowShaCtr+ 64) -#define ActReqDatShaDeg (ActDowShaCtr+ 65) -#define ActChgDatShaDeg (ActDowShaCtr+ 66) -#define ActDowShaDeg (ActDowShaCtr+ 67) +#define ActReqRemFilShaDeg (ActDowShaCtr+ 51) +#define ActRemFilShaDeg (ActDowShaCtr+ 52) +#define ActRemFolShaDeg (ActDowShaCtr+ 53) +#define ActCopShaDeg (ActDowShaCtr+ 54) +#define ActPasShaDeg (ActDowShaCtr+ 55) +#define ActRemTreShaDeg (ActDowShaCtr+ 56) +#define ActFrmCreShaDeg (ActDowShaCtr+ 57) +#define ActCreFolShaDeg (ActDowShaCtr+ 58) +#define ActCreLnkShaDeg (ActDowShaCtr+ 59) +#define ActRenFolShaDeg (ActDowShaCtr+ 60) +#define ActRcvFilShaDegDZ (ActDowShaCtr+ 61) +#define ActRcvFilShaDegCla (ActDowShaCtr+ 62) +#define ActExpShaDeg (ActDowShaCtr+ 63) +#define ActConShaDeg (ActDowShaCtr+ 64) +#define ActZIPShaDeg (ActDowShaCtr+ 65) +#define ActReqDatShaDeg (ActDowShaCtr+ 66) +#define ActChgDatShaDeg (ActDowShaCtr+ 67) +#define ActDowShaDeg (ActDowShaCtr+ 68) /*****************************************************************************/ /******************************** Course tab *********************************/ diff --git a/swad_changelog.h b/swad_changelog.h index ec7d9a058..b9ec83c6a 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -148,17 +148,18 @@ /****************************** Public constants *****************************/ /*****************************************************************************/ -#define Log_PLATFORM_VERSION "SWAD 16.22.2 (2016-10-19)" +#define Log_PLATFORM_VERSION "SWAD 16.23 (2016-10-19)" #define CSS_FILE "swad15.229.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.23: Oct 19, 2016 New form in degree configuration to move degree to another centre. (205434 lines) Version 16.22.2: Oct 19, 2016 Code refactoring in course configuration. Fixed bug in selector of courses in breadcrumb. (205350 lines) Version 16.22.1: Oct 19, 2016 Fixed bug in course configuration. (205373 lines) - Version 16.22: Oct 19, 2016 New form in course configuration to change course degree. + Version 16.22: Oct 19, 2016 New form in course configuration to move course to another degree. Code refactorization related with courses and degrees. (205369 lines) 1 change necessary in database: INSERT INTO actions (ActCod,Language,Obsolete,Txt) VALUES ('1587','es','N','Mover asignatura a otra titulac.'); diff --git a/swad_course.c b/swad_course.c index b207702f8..2bd0dbb2f 100644 --- a/swad_course.c +++ b/swad_course.c @@ -205,7 +205,7 @@ static void Crs_Configuration (bool PrintView) /***** Start table *****/ fprintf (Gbl.F.Out,""); - /***** Course degree *****/ + /***** Degree *****/ fprintf (Gbl.F.Out,"" "
" "%s:" @@ -214,14 +214,13 @@ static void Crs_Configuration (bool PrintView) The_ClassForm[Gbl.Prefs.Theme], Txt_Degree); - if (PrintView) - Gbl.Usrs.Me.MyAdminDegs.Num = 0; - else - /* Get list of degrees administrated by me */ + /* Get list of degrees administrated by me */ + if (!PrintView) Deg_GetListDegsAdminByMe (); /* Put form to select degree */ - if (Gbl.Usrs.Me.MyAdminDegs.Num) + if (!PrintView && + Gbl.Usrs.Me.MyAdminDegs.Num) { Act_FormStart (ActChgCrsDegCfg); fprintf (Gbl.F.Out,""); + /***** Centre *****/ + fprintf (Gbl.F.Out,"" + "" + "" + ""); + /***** Degree full name *****/ fprintf (Gbl.F.Out,"" "
" + "%s:" + "", + The_ClassForm[Gbl.Prefs.Theme], + Txt_Centre); + + if (!PrintView && + Gbl.Usrs.Me.LoggedRole >= Rol_INS_ADM) // Only institution admins and system admin can move a degree to another centre + { + /* Get list of centres of the current institution */ + Ctr_GetListCentres (Gbl.CurrentIns.Ins.InsCod); + + /* Put form to select centre */ + Act_FormStart (ActChgDegCtrCfg); + fprintf (Gbl.F.Out,""); + Act_FormEnd (); + + /* Free list of centres */ + Ctr_FreeListCentres (); + } + else // I can not edit centre + fprintf (Gbl.F.Out,"%s",Gbl.CurrentCtr.Ctr.FullName); + + fprintf (Gbl.F.Out,"
" @@ -2538,12 +2581,60 @@ static bool Deg_CheckIfDegreeNameExists (long CtrCod,const char *FieldName,const /************************ Change the centre of a degree **********************/ /*****************************************************************************/ +void Deg_ChangeDegreeCtrInConfig (void) + { + extern const char *Txt_The_degree_X_has_been_moved_to_the_centre_Y; + struct Centre NewCtr; + char Query[128]; + + /***** Get parameters from form *****/ + /* Get parameter with centre code */ + NewCtr.CtrCod = Ctr_GetParamOtherCtrCod (); + + /***** Get data of new centre *****/ + Ctr_GetDataOfCentreByCod (&NewCtr); + + /***** Update centre in table of degrees *****/ + sprintf (Query,"UPDATE degrees SET CtrCod='%ld' WHERE DegCod='%ld'", + NewCtr.CtrCod,Gbl.CurrentDeg.Deg.DegCod); + DB_QueryUPDATE (Query,"can not update the centre of a degree"); + Gbl.CurrentDeg.Deg.CtrCod = + Gbl.CurrentCtr.Ctr.CtrCod = NewCtr.CtrCod; + + /***** Initialize again current course, degree, centre... *****/ + Deg_InitCurrentCourse (); + + /***** Create message to show the change made *****/ + sprintf (Gbl.Message,Txt_The_degree_X_has_been_moved_to_the_centre_Y, + Gbl.CurrentDeg.Deg.FullName, + Gbl.CurrentCtr.Ctr.FullName); + } + +/*****************************************************************************/ +/** Show message of success after changing a course in course configuration **/ +/*****************************************************************************/ + +void Deg_ContEditAfterChgDegInConfig (void) + { + /***** Write error/success message *****/ + Lay_ShowAlert (Gbl.Error ? Lay_WARNING : + Lay_SUCCESS, + Gbl.Message); + + /***** Show the form again *****/ + Deg_ShowConfiguration (); + } + +/*****************************************************************************/ +/************************ Change the centre of a degree **********************/ +/*****************************************************************************/ + void Deg_ChangeDegreeCtr (void) { extern const char *Txt_The_degree_X_has_been_moved_to_the_centre_Y; struct Degree *Deg; struct Centre NewCtr; - char Query[512]; + char Query[128]; Deg = &Gbl.Degs.EditingDeg; diff --git a/swad_degree.h b/swad_degree.h index 4d5e4db5c..b059f7468 100644 --- a/swad_degree.h +++ b/swad_degree.h @@ -128,6 +128,8 @@ long Deg_GetInsCodOfDegreeByCod (long DegCod); void Deg_RemoveDegreeCompletely (long DegCod); void Deg_RenameDegreeShort (void); void Deg_RenameDegreeFull (void); +void Deg_ChangeDegreeCtrInConfig (void); +void Deg_ContEditAfterChgDegInConfig (void); void Deg_ChangeDegreeCtr (void); void Deg_ChangeDegWWW (void); void Deg_ChangeDegStatus (void);