From 05e930cf295155a0bec99eb898407a0cadd37553 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Ca=C3=B1as=20Vargas?= Date: Sun, 6 Dec 2015 01:37:22 +0100 Subject: [PATCH] Version 15.59 --- swad_action.c | 7 +-- swad_action.h | 103 ++++++++++++++++++++--------------------- swad_changelog.h | 8 +++- swad_database.c | 14 ++++++ swad_degree.c | 117 +++++++++++++++++++++++++++++++++++------------ swad_degree.h | 4 +- swad_global.c | 2 +- swad_text.c | 12 ++--- 8 files changed, 174 insertions(+), 93 deletions(-) diff --git a/swad_action.c b/swad_action.c index 2b240973f..6182083a9 100644 --- a/swad_action.c +++ b/swad_action.c @@ -294,7 +294,7 @@ Centre: 184. ActChgDegCtr Request change of the centre of a degree 185. ActChgDegFstYea Request change of the first year of a degree 186. ActChgDegLstYea Request change of the last year of a degree - 187. ActChgDegOptYea Request change of the year of optativas of a degree +REMOVE ---> 187. ActChgDegOptYea Request change of the year of optativas of a degree 188. ActChgDegWWW Request change of the web of a degree 189. ActChgDegSta Request change of status of a degree @@ -1698,7 +1698,7 @@ struct Act_Actions Act_Actions[Act_NUM_ACTIONS] = /* ActChgDegCtr */{1049,-1,TabCtr,ActSeeDeg ,0x1C0,0x1C0,0x1C0,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Deg_ChangeDegreeCtr ,NULL}, /* ActChgDegFstYea */{ 550,-1,TabCtr,ActSeeDeg ,0x1FE,0x1FE,0x1FE,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Deg_ChangeDegFirstYear ,NULL}, /* ActChgDegLstYea */{ 551,-1,TabCtr,ActSeeDeg ,0x1FE,0x1FE,0x1FE,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Deg_ChangeDegLastYear ,NULL}, - /* ActChgDegOptYea */{ 552,-1,TabCtr,ActSeeDeg ,0x1FE,0x1FE,0x1FE,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Deg_ChangeDegOptYear ,NULL}, + /* ActChgDegOptYea *//*{ 552,-1,TabCtr,ActSeeDeg ,0x1FE,0x1FE,0x1FE,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Deg_ChangeDegOptYear ,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}, @@ -3351,7 +3351,8 @@ Act_Action_t Act_FromActCodToAction[1+Act_MAX_ACTION_COD] = // Do not reuse uniq -1, // #549 (obsolete action) ActChgDegFstYea, // #550 ActChgDegLstYea, // #551 - ActChgDegOptYea, // #552 + // ActChgDegOptYea, // #552 + -1, // #552 ActRecDegLog, // #553 ActChgDegWWW, // #554 ActEdiCrs, // #555 diff --git a/swad_action.h b/swad_action.h index a6a6771c1..add2a9eb8 100644 --- a/swad_action.h +++ b/swad_action.h @@ -71,7 +71,8 @@ typedef enum typedef int Act_Action_t; // Must be a signed type, because -1 is used to indicate obsolete action // #define Act_NUM_ACTIONS (7+52+15+90+73+68+205+183+154+171+27+80) -#define Act_NUM_ACTIONS (7+52+15+90+73+67+205+183+154+171+27+80) +// #define Act_NUM_ACTIONS (7+52+15+90+73+67+205+183+154+171+27+80) +#define Act_NUM_ACTIONS (7+52+15+90+72+67+205+183+154+171+27+80) #define Act_MAX_ACTION_COD 1487 @@ -307,58 +308,58 @@ typedef int Act_Action_t; // Must be a signed type, because -1 is used to indica #define ActChgDegCtr (ActDowComIns+ 21) #define ActChgDegFstYea (ActDowComIns+ 22) #define ActChgDegLstYea (ActDowComIns+ 23) -#define ActChgDegOptYea (ActDowComIns+ 24) -#define ActChgDegWWW (ActDowComIns+ 25) -#define ActChgDegSta (ActDowComIns+ 26) +// #define ActChgDegOptYea (ActDowComIns+ 24) +#define ActChgDegWWW (ActDowComIns+ 24) +#define ActChgDegSta (ActDowComIns+ 25) -#define ActChgToSeeDocCtr (ActDowComIns+ 27) -#define ActSeeDocCtr (ActDowComIns+ 28) -#define ActExpSeeDocCtr (ActDowComIns+ 29) -#define ActConSeeDocCtr (ActDowComIns+ 30) -#define ActZIPSeeDocCtr (ActDowComIns+ 31) -#define ActReqDatSeeDocCtr (ActDowComIns+ 32) -#define ActDowSeeDocCtr (ActDowComIns+ 33) -#define ActChgToAdmDocCtr (ActDowComIns+ 34) -#define ActAdmDocCtr (ActDowComIns+ 35) -#define ActReqRemFilDocCtr (ActDowComIns+ 36) -#define ActRemFilDocCtr (ActDowComIns+ 37) -#define ActRemFolDocCtr (ActDowComIns+ 38) -#define ActCopDocCtr (ActDowComIns+ 39) -#define ActPasDocCtr (ActDowComIns+ 40) -#define ActRemTreDocCtr (ActDowComIns+ 41) -#define ActFrmCreDocCtr (ActDowComIns+ 42) -#define ActCreFolDocCtr (ActDowComIns+ 43) -#define ActCreLnkDocCtr (ActDowComIns+ 44) -#define ActRenFolDocCtr (ActDowComIns+ 45) -#define ActRcvFilDocCtrDZ (ActDowComIns+ 46) -#define ActRcvFilDocCtrCla (ActDowComIns+ 47) -#define ActExpAdmDocCtr (ActDowComIns+ 48) -#define ActConAdmDocCtr (ActDowComIns+ 49) -#define ActZIPAdmDocCtr (ActDowComIns+ 50) -#define ActShoDocCtr (ActDowComIns+ 51) -#define ActHidDocCtr (ActDowComIns+ 52) -#define ActReqDatAdmDocCtr (ActDowComIns+ 53) -#define ActChgDatAdmDocCtr (ActDowComIns+ 54) -#define ActDowAdmDocCtr (ActDowComIns+ 55) +#define ActChgToSeeDocCtr (ActDowComIns+ 26) +#define ActSeeDocCtr (ActDowComIns+ 27) +#define ActExpSeeDocCtr (ActDowComIns+ 28) +#define ActConSeeDocCtr (ActDowComIns+ 29) +#define ActZIPSeeDocCtr (ActDowComIns+ 30) +#define ActReqDatSeeDocCtr (ActDowComIns+ 31) +#define ActDowSeeDocCtr (ActDowComIns+ 32) +#define ActChgToAdmDocCtr (ActDowComIns+ 33) +#define ActAdmDocCtr (ActDowComIns+ 34) +#define ActReqRemFilDocCtr (ActDowComIns+ 35) +#define ActRemFilDocCtr (ActDowComIns+ 36) +#define ActRemFolDocCtr (ActDowComIns+ 37) +#define ActCopDocCtr (ActDowComIns+ 38) +#define ActPasDocCtr (ActDowComIns+ 39) +#define ActRemTreDocCtr (ActDowComIns+ 40) +#define ActFrmCreDocCtr (ActDowComIns+ 41) +#define ActCreFolDocCtr (ActDowComIns+ 42) +#define ActCreLnkDocCtr (ActDowComIns+ 43) +#define ActRenFolDocCtr (ActDowComIns+ 44) +#define ActRcvFilDocCtrDZ (ActDowComIns+ 45) +#define ActRcvFilDocCtrCla (ActDowComIns+ 46) +#define ActExpAdmDocCtr (ActDowComIns+ 47) +#define ActConAdmDocCtr (ActDowComIns+ 48) +#define ActZIPAdmDocCtr (ActDowComIns+ 49) +#define ActShoDocCtr (ActDowComIns+ 50) +#define ActHidDocCtr (ActDowComIns+ 51) +#define ActReqDatAdmDocCtr (ActDowComIns+ 52) +#define ActChgDatAdmDocCtr (ActDowComIns+ 53) +#define ActDowAdmDocCtr (ActDowComIns+ 54) -#define ActReqRemFilComCtr (ActDowComIns+ 56) -#define ActRemFilComCtr (ActDowComIns+ 57) -#define ActRemFolComCtr (ActDowComIns+ 58) -#define ActCopComCtr (ActDowComIns+ 59) -#define ActPasComCtr (ActDowComIns+ 60) -#define ActRemTreComCtr (ActDowComIns+ 61) -#define ActFrmCreComCtr (ActDowComIns+ 62) -#define ActCreFolComCtr (ActDowComIns+ 63) -#define ActCreLnkComCtr (ActDowComIns+ 64) -#define ActRenFolComCtr (ActDowComIns+ 65) -#define ActRcvFilComCtrDZ (ActDowComIns+ 66) -#define ActRcvFilComCtrCla (ActDowComIns+ 67) -#define ActExpComCtr (ActDowComIns+ 68) -#define ActConComCtr (ActDowComIns+ 69) -#define ActZIPComCtr (ActDowComIns+ 70) -#define ActReqDatComCtr (ActDowComIns+ 71) -#define ActChgDatComCtr (ActDowComIns+ 72) -#define ActDowComCtr (ActDowComIns+ 73) +#define ActReqRemFilComCtr (ActDowComIns+ 55) +#define ActRemFilComCtr (ActDowComIns+ 56) +#define ActRemFolComCtr (ActDowComIns+ 57) +#define ActCopComCtr (ActDowComIns+ 58) +#define ActPasComCtr (ActDowComIns+ 59) +#define ActRemTreComCtr (ActDowComIns+ 60) +#define ActFrmCreComCtr (ActDowComIns+ 61) +#define ActCreFolComCtr (ActDowComIns+ 62) +#define ActCreLnkComCtr (ActDowComIns+ 63) +#define ActRenFolComCtr (ActDowComIns+ 64) +#define ActRcvFilComCtrDZ (ActDowComIns+ 65) +#define ActRcvFilComCtrCla (ActDowComIns+ 66) +#define ActExpComCtr (ActDowComIns+ 67) +#define ActConComCtr (ActDowComIns+ 68) +#define ActZIPComCtr (ActDowComIns+ 69) +#define ActReqDatComCtr (ActDowComIns+ 70) +#define ActChgDatComCtr (ActDowComIns+ 71) +#define ActDowComCtr (ActDowComIns+ 72) /*****************************************************************************/ /********************************* Degree tab ********************************/ diff --git a/swad_changelog.h b/swad_changelog.h index 9373830f9..8faf36d74 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -113,13 +113,17 @@ /****************************** Public constants *****************************/ /*****************************************************************************/ -#define Log_PLATFORM_VERSION "SWAD 15.58.1 (2015/12/06)" +#define Log_PLATFORM_VERSION "SWAD 15.59 (2015/12/06)" #define CSS_FILE "swad15.57.css" // 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 15.58.1: Dec 06, 2015 Removed unused code related to semester. (186960 lines) + Version 15.59: Dec 06, 2015 Year for optional courses is now always present. (186692 lines) + 1 change necessary in database: +UPDATE actions SET Obsolete='Y' WHERE ActCod='552'; + + Version 15.58.1: Dec 06, 2015 Removed unused code related to semester. (186604 lines) 1 change necessary in database: ALTER TABLE courses DROP COLUMN Semester; diff --git a/swad_database.c b/swad_database.c index 746629e26..a719e9b22 100644 --- a/swad_database.c +++ b/swad_database.c @@ -847,6 +847,7 @@ mysql> DESCRIBE degrees; +-----------------+---------------+------+-----+---------+----------------+ 11 rows in set (0.00 sec) */ +/* DB_CreateTable ("CREATE TABLE IF NOT EXISTS degrees (" "DegCod INT NOT NULL AUTO_INCREMENT," "CtrCod INT NOT NULL," @@ -860,6 +861,19 @@ mysql> DESCRIBE degrees; "OptYear ENUM('N','Y') NOT NULL DEFAULT 'N'," "WWW VARCHAR(255) NOT NULL," "UNIQUE INDEX(DegCod),INDEX(CtrCod),INDEX(DegTypCod),INDEX(Status))"); +*/ + DB_CreateTable ("CREATE TABLE IF NOT EXISTS degrees (" + "DegCod INT NOT NULL AUTO_INCREMENT," + "CtrCod INT NOT NULL," + "DegTypCod INT NOT NULL," + "Status TINYINT NOT NULL DEFAULT 0," + "RequesterUsrCod INT NOT NULL DEFAULT -1," + "ShortName VARCHAR(32) NOT NULL," + "FullName VARCHAR(127) NOT NULL," + "FirstYear TINYINT NOT NULL DEFAULT 0," + "LastYear TINYINT NOT NULL DEFAULT 0," + "WWW VARCHAR(255) NOT NULL," + "UNIQUE INDEX(DegCod),INDEX(CtrCod),INDEX(DegTypCod),INDEX(Status))"); /***** Table departments *****/ /* diff --git a/swad_degree.c b/swad_degree.c index fc70614bd..3f86531d8 100644 --- a/swad_degree.c +++ b/swad_degree.c @@ -1277,8 +1277,8 @@ static void Deg_ListOneDegreeForSeeing (struct Degree *Deg,unsigned NumDeg) { extern const char *Txt_DEGREE_With_courses; extern const char *Txt_DEGREE_Without_courses; - extern const char *Txt_DEGREE_With_year_for_optional_courses; - extern const char *Txt_DEGREE_Without_year_for_optional_courses; + // extern const char *Txt_DEGREE_With_year_for_optional_courses; + // extern const char *Txt_DEGREE_Without_year_for_optional_courses; extern const char *Txt_DEGREE_STATUS[Deg_NUM_STATUS_TXT]; struct DegreeType DegTyp; const char *TxtClassNormal; @@ -1352,6 +1352,7 @@ static void Deg_ListOneDegreeForSeeing (struct Degree *Deg,unsigned NumDeg) TxtClassNormal,BgColor,Deg->LastYear); /***** Degree optional year *****/ + /* fprintf (Gbl.F.Out,"" "\"%s\"OptYear ? Txt_DEGREE_With_year_for_optional_courses : Txt_DEGREE_Without_year_for_optional_courses); + */ /***** Current number of courses in this degree *****/ fprintf (Gbl.F.Out,"" @@ -1392,8 +1394,8 @@ static void Deg_ListOneDegreeForSeeing (struct Degree *Deg,unsigned NumDeg) static void Deg_ListDegreesForEdition (void) { extern const char *Txt_Degrees_of_CENTRE_X; - extern const char *Txt_DEGREE_With_year_for_optional_courses; - extern const char *Txt_DEGREE_Without_year_for_optional_courses; + // extern const char *Txt_DEGREE_With_year_for_optional_courses; + // extern const char *Txt_DEGREE_Without_year_for_optional_courses; extern const char *Txt_DEGREE_STATUS[Deg_NUM_STATUS_TXT]; unsigned NumDeg; struct DegreeType *DegTyp; @@ -1590,6 +1592,7 @@ static void Deg_ListDegreesForEdition (void) fprintf (Gbl.F.Out,""); /* Degree optional year */ + /* fprintf (Gbl.F.Out,""); if (ICanEdit) { @@ -1604,7 +1607,7 @@ static void Deg_ListDegreesForEdition (void) fprintf (Gbl.F.Out,""); } else - /* Degree optional year */ + * Degree optional year * fprintf (Gbl.F.Out,"\"%s\"", @@ -1616,6 +1619,7 @@ static void Deg_ListDegreesForEdition (void) Deg->OptYear ? Txt_DEGREE_With_year_for_optional_courses : Txt_DEGREE_Without_year_for_optional_courses); fprintf (Gbl.F.Out,""); + */ /* Degree WWW */ fprintf (Gbl.F.Out,""); @@ -1920,10 +1924,12 @@ static void Deg_PutFormToCreateDegree (void) ""); /***** Degree optional year *****/ + /* fprintf (Gbl.F.Out,"" "", Deg->OptYear ? " checked=\"checked\"" : ""); + */ /***** Degree WWW *****/ fprintf (Gbl.F.Out,"" @@ -2030,7 +2036,7 @@ static void Deg_PutHeadDegreesForSeeing (void) extern const char *Txt_Type; extern const char *Txt_First_BR_year; extern const char *Txt_Last_BR_year; - extern const char *Txt_Opt_BR_year; + // extern const char *Txt_Opt_BR_year; extern const char *Txt_Courses_ABBREVIATION; extern const char *Txt_Status; @@ -2049,9 +2055,9 @@ static void Deg_PutHeadDegreesForSeeing (void) "" "%s" "" - "" - "%s" - "" + // "" + // "%s" + // "" "" "%s" "" @@ -2063,7 +2069,7 @@ static void Deg_PutHeadDegreesForSeeing (void) Txt_Type, Txt_First_BR_year, Txt_Last_BR_year, - Txt_Opt_BR_year, + // Txt_Opt_BR_year, Txt_Courses_ABBREVIATION, Txt_Status); } @@ -2081,7 +2087,7 @@ static void Deg_PutHeadDegreesForEdition (void) extern const char *Txt_Type; extern const char *Txt_First_BR_year; extern const char *Txt_Last_BR_year; - extern const char *Txt_Opt_BR_year; + // extern const char *Txt_Opt_BR_year; extern const char *Txt_WWW; extern const char *Txt_Courses_ABBREVIATION; extern const char *Txt_Status; @@ -2111,9 +2117,9 @@ static void Deg_PutHeadDegreesForEdition (void) "" "%s" "" - "" - "%s" - "" + // "" + // "%s" + // "" "" "%s" "" @@ -2134,7 +2140,7 @@ static void Deg_PutHeadDegreesForEdition (void) Txt_Type, Txt_First_BR_year, Txt_Last_BR_year, - Txt_Opt_BR_year, + // Txt_Opt_BR_year, Txt_WWW, Txt_Courses_ABBREVIATION, Txt_Status, @@ -2191,6 +2197,7 @@ static void Deg_CreateDegree (struct Degree *Deg,unsigned Status) char Query[1024]; /***** Create a new degree *****/ + /* sprintf (Query,"INSERT INTO degrees (CtrCod,DegTypCod,Status,RequesterUsrCod," "ShortName,FullName,FirstYear,LastYear,OptYear,WWW)" " VALUES ('%ld','%ld','%u','%ld'," @@ -2203,6 +2210,17 @@ static void Deg_CreateDegree (struct Degree *Deg,unsigned Status) Deg->OptYear ? 'Y' : 'N', Deg->WWW); + */ + sprintf (Query,"INSERT INTO degrees (CtrCod,DegTypCod,Status,RequesterUsrCod," + "ShortName,FullName,FirstYear,LastYear,WWW)" + " VALUES ('%ld','%ld','%u','%ld'," + "'%s','%s','%u','%u','%s')", + Deg->CtrCod,Deg->DegTypCod, + Status, + Gbl.Usrs.Me.UsrDat.UsrCod, + Deg->ShortName,Deg->FullName, + Deg->FirstYear,Deg->LastYear, + Deg->WWW); DB_QueryINSERT (Query,"can not create a new degree"); /***** Write success message *****/ @@ -2370,9 +2388,14 @@ void Deg_GetListAllDegs (void) unsigned NumDeg; /***** Get degrees admin by me from database *****/ + /* sprintf (Query,"SELECT DegCod,CtrCod,DegTypCod,Status,RequesterUsrCod," "ShortName,FullName,FirstYear,LastYear,OptYear,WWW" " FROM degrees ORDER BY FullName"); + */ + sprintf (Query,"SELECT DegCod,CtrCod,DegTypCod,Status,RequesterUsrCod," + "ShortName,FullName,FirstYear,LastYear,WWW" + " FROM degrees ORDER BY FullName"); Gbl.Degs.AllDegs.Num = (unsigned) DB_QuerySELECT (Query,&mysql_res,"can not get degrees admin by you"); if (Gbl.Degs.AllDegs.Num) // Degrees found... @@ -2425,10 +2448,16 @@ static void Deg_GetListDegsOfCurrentCtr (void) unsigned NumDeg; /***** Get degrees of the current centre from database *****/ + /* sprintf (Query,"SELECT DegCod,CtrCod,DegTypCod,Status,RequesterUsrCod," "ShortName,FullName,FirstYear,LastYear,OptYear,WWW" " FROM degrees WHERE CtrCod='%ld' ORDER BY FullName", Gbl.CurrentCtr.Ctr.CtrCod); + */ + sprintf (Query,"SELECT DegCod,CtrCod,DegTypCod,Status,RequesterUsrCod," + "ShortName,FullName,FirstYear,LastYear,WWW" + " FROM degrees WHERE CtrCod='%ld' ORDER BY FullName", + Gbl.CurrentCtr.Ctr.CtrCod); NumRows = DB_QuerySELECT (Query,&mysql_res,"can not get degrees of a centre"); /***** Count number of rows in result *****/ @@ -2498,6 +2527,7 @@ void Deg_GetListDegsAdminByMe (void) unsigned NumDeg; /***** Get degrees admin by me from database *****/ + /* if (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM) sprintf (Query,"SELECT DegCod,CtrCod,DegTypCod,Status,RequesterUsrCod," "ShortName,FullName,FirstYear,LastYear,OptYear,WWW" @@ -2514,6 +2544,23 @@ void Deg_GetListDegsAdminByMe (void) " AND admin.Cod=degrees.DegCod" " ORDER BY degrees.ShortName", Gbl.Usrs.Me.UsrDat.UsrCod); + */ + if (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM) + sprintf (Query,"SELECT DegCod,CtrCod,DegTypCod,Status,RequesterUsrCod," + "ShortName,FullName,FirstYear,LastYear,WWW" + " FROM degrees" + " WHERE CtrCod='%ld'" + " ORDER BY ShortName", + Gbl.CurrentCtr.Ctr.CtrCod); + // TODO: put an if to select all degrees for admins of all degrees !!!!!!!!!!!!! + else // Gbl.Usrs.Me.LoggedRole == Rol_ROLE_DEG_ADM + sprintf (Query,"SELECT degrees.DegCod,degrees.CtrCod,degrees.DegTypCod,degrees.Status,degrees.RequesterUsrCod," + "degrees.ShortName,degrees.FullName,degrees.FirstYear,degrees.LastYear,degrees.WWW" + " FROM admin,degrees" + " WHERE admin.UsrCod='%ld' AND admin.Scope='Deg'" + " AND admin.Cod=degrees.DegCod" + " ORDER BY degrees.ShortName", + Gbl.Usrs.Me.UsrDat.UsrCod); Gbl.Usrs.Me.MyAdminDegs.Num = (unsigned) DB_QuerySELECT (Query,&mysql_res,"can not get degrees admin by you"); /***** Count number of rows in result *****/ @@ -2626,7 +2673,7 @@ static void Deg_RecFormRequestOrCreateDeg (unsigned Status) extern const char *Txt_You_must_specify_the_short_name_and_the_full_name_of_the_new_degree; struct Degree *Deg; char YearStr[2+1]; - char YN[1+1]; + // char YN[1+1]; Deg = &Gbl.Degs.EditingDeg; @@ -2653,8 +2700,10 @@ static void Deg_RecFormRequestOrCreateDeg (unsigned Status) Deg->LastYear = Deg_ConvStrToYear (YearStr); /* Get optional year */ + /* Par_GetParToText ("OptYear",YN,1); Deg->OptYear = (Str_ConvertToUpperLetter (YN[0]) == 'Y'); + */ /* Get degree WWW */ Par_GetParToText ("WWW",Deg->WWW,Cns_MAX_LENGTH_WWW); @@ -2932,7 +2981,7 @@ bool Deg_GetDataOfDegreeByCod (struct Degree *Deg) Deg->FullName[0] = '\0'; Deg->FirstYear = 0; Deg->LastYear = 0; - Deg->OptYear = false; + // Deg->OptYear = false; Deg->WWW[0] = '\0'; Deg->NumCourses = 0; Deg->LstCrss = NULL; @@ -2940,10 +2989,16 @@ bool Deg_GetDataOfDegreeByCod (struct Degree *Deg) } /***** Get data of a degree from database *****/ + /* sprintf (Query,"SELECT DegCod,CtrCod,DegTypCod,Status,RequesterUsrCod," "ShortName,FullName,FirstYear,LastYear,OptYear,WWW" " FROM degrees WHERE DegCod ='%ld'", Deg->DegCod); + */ + sprintf (Query,"SELECT DegCod,CtrCod,DegTypCod,Status,RequesterUsrCod," + "ShortName,FullName,FirstYear,LastYear,WWW" + " FROM degrees WHERE DegCod ='%ld'", + Deg->DegCod); NumRows = DB_QuerySELECT (Query,&mysql_res,"can not get data of a degree"); if (NumRows == 1) @@ -2965,7 +3020,7 @@ bool Deg_GetDataOfDegreeByCod (struct Degree *Deg) Deg->FullName[0] = '\0'; Deg->FirstYear = 0; Deg->LastYear = 0; - Deg->OptYear = false; + // Deg->OptYear = false; Deg->WWW[0] = '\0'; Deg->NumCourses = 0; Deg->LstCrss = NULL; @@ -3016,10 +3071,12 @@ static void Deg_GetDataOfDegreeFromRow (struct Degree *Deg,MYSQL_ROW row) Deg->LastYear = Deg_ConvStrToYear (row[8]); /***** Get optional year (row[9]) *****/ + /* Deg->OptYear = (Str_ConvertToUpperLetter (row[9][0]) == 'Y'); + */ - /***** Get WWW (row[10]) *****/ - strcpy (Deg->WWW,row[10]); + /***** Get WWW (row[9]) *****/ + strcpy (Deg->WWW,row[9]); /***** Get number of courses *****/ Deg->NumCourses = Crs_GetNumCrssInDeg (Deg->DegCod); @@ -3649,7 +3706,7 @@ static void Deg_ChangeDegYear (struct Degree *Deg,Deg_FirstOrLastYear_t FirstOrL /*****************************************************************************/ /******************** Change the optional year of a degree *******************/ /*****************************************************************************/ - +/* void Deg_ChangeDegOptYear (void) { extern const char *Txt_The_degree_now_has_a_year_for_optional_courses; @@ -3660,32 +3717,32 @@ void Deg_ChangeDegOptYear (void) Deg = &Gbl.Degs.EditingDeg; - /***** Get parameters from form *****/ - /* Get degree code */ + ***** Get parameters from form ***** + * Get degree code * if ((Deg->DegCod = Deg_GetParamOtherDegCod ()) == -1L) Lay_ShowErrorAndExit ("Code of degree is missing."); - /* Get parameter with optional year */ + * Get parameter with optional year * Par_GetParToText ("OptYear",YN,1); Deg->OptYear = (Str_ConvertToUpperLetter (YN[0]) == 'Y'); - /***** Update optional year in table of degrees *****/ + ***** Update optional year in table of degrees ***** sprintf (Query,"UPDATE degrees SET OptYear='%c' WHERE DegCod='%ld'", Deg->OptYear ? 'Y' : 'N', Deg->DegCod); DB_QueryUPDATE (Query,"can not update the optional year of a degree"); - /***** Write message to show the change made *****/ + ***** Write message to show the change made ***** sprintf (Gbl.Message,"%s", Deg->OptYear ? Txt_The_degree_now_has_a_year_for_optional_courses : Txt_The_degree_has_no_longer_a_year_for_optional_courses); Lay_ShowAlert (Lay_SUCCESS,Gbl.Message); - /***** Show the form again *****/ + ***** Show the form again ***** Deg_EditDegrees (); } - +*/ /*****************************************************************************/ /************************* Change the WWW of a degree ************************/ /*****************************************************************************/ @@ -3910,8 +3967,12 @@ unsigned Deg_GetNumDegsWithUsrs (Rol_Role_t Role,const char *SubQuery) bool Deg_CheckIfYearIsValidInDeg (unsigned Year,struct Degree *Deg) { + /* return (Year == 0 && Deg->OptYear) || (Year != 0 && Year >= Deg->FirstYear && Year <= Deg->LastYear); + */ + return (Year == 0) || + (Year != 0 && Year >= Deg->FirstYear && Year <= Deg->LastYear); } /*****************************************************************************/ diff --git a/swad_degree.h b/swad_degree.h index 2c939c6f7..c2d429eee 100644 --- a/swad_degree.h +++ b/swad_degree.h @@ -78,7 +78,7 @@ struct Degree char FullName[Deg_MAX_LENGTH_DEGREE_FULL_NAME+1]; // Full name of degree unsigned FirstYear; unsigned LastYear; - bool OptYear; + // bool OptYear; char WWW[Cns_MAX_LENGTH_WWW+1]; unsigned NumCourses; // Number of courses in the degree struct Course *LstCrss; // List of courses in this degree @@ -148,7 +148,7 @@ void Deg_ChangeDegreeType (void); void Deg_ChangeDegreeCtr (void); void Deg_ChangeDegFirstYear (void); void Deg_ChangeDegLastYear (void); -void Deg_ChangeDegOptYear (void); +// void Deg_ChangeDegOptYear (void); void Deg_ChangeDegWWW (void); void Deg_ChangeDegStatus (void); void Deg_RequestLogo (void); diff --git a/swad_global.c b/swad_global.c index ba1edea68..669286c18 100644 --- a/swad_global.c +++ b/swad_global.c @@ -307,7 +307,7 @@ void Gbl_InitializeGlobals (void) Gbl.Degs.EditingDeg.FullName[0] = '\0'; Gbl.Degs.EditingDeg.FirstYear = Gbl.Degs.EditingDeg.LastYear = 0; - Gbl.Degs.EditingDeg.OptYear = false; + // Gbl.Degs.EditingDeg.OptYear = false; Gbl.Degs.EditingDeg.WWW[0] = '\0'; Gbl.Degs.EditingDeg.NumCourses = 0; Gbl.Degs.EditingDeg.LstCrss = NULL; diff --git a/swad_text.c b/swad_text.c index d3348a976..0e53993c8 100644 --- a/swad_text.c +++ b/swad_text.c @@ -7302,7 +7302,7 @@ const char *Txt_DEGREE_With_courses = #elif L==8 "Com disciplinas"; #endif - +/* const char *Txt_DEGREE_With_year_for_optional_courses = #if L==0 "Con curso de optativas."; // Necessita traduccio @@ -7323,7 +7323,7 @@ const char *Txt_DEGREE_With_year_for_optional_courses = #elif L==8 "With year for optional courses."; // Necessita de tradução #endif - +*/ const char *Txt_DEGREE_Without_courses = #if L==0 "Sense assignatures"; @@ -7344,7 +7344,7 @@ const char *Txt_DEGREE_Without_courses = #elif L==8 "Sem disciplinas"; #endif - +/* const char *Txt_DEGREE_Without_year_for_optional_courses = #if L==0 "Sin curso de optativas."; // Necessita traduccio @@ -7365,7 +7365,7 @@ const char *Txt_DEGREE_Without_year_for_optional_courses = #elif L==8 "Without year for optional courses."; // Necessita de tradução #endif - +*/ const char *Txt_Degree_X_removed = // Warning: it is very important to include %s in the following sentences #if L==0 "Titulación %s eliminada."; // Necessita traduccio @@ -25808,7 +25808,7 @@ const char *Txt_Opening_of_groups = #elif L==8 "Opening of groups"; // Necessita de tradução #endif - +/* const char *Txt_Opt_BR_year = // Year for optional courses #if L==0 "¿Cur.
opt.?"; // Necessita traduccio @@ -25829,7 +25829,7 @@ const char *Txt_Opt_BR_year = // Year for optional courses #elif L==8 "Opt.
year?"; // Necessita de tradução #endif - +*/ const char *Txt_Option_a_Import_students_from_the_official_lists = #if L==0 "Opción a): Obtenga estudiantes de las listas oficiales"; // Necessita traduccio