From 39dffca30b620492d37517b923ed6a242864a6b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Ca=C3=B1as=20Vargas?= Date: Thu, 19 Nov 2015 20:04:41 +0100 Subject: [PATCH] Version 15.40.5 --- swad_centre.c | 4 +-- swad_changelog.h | 3 +- swad_degree.c | 80 ++++++++++++++++++++++++++---------------------- swad_degree.h | 3 ++ swad_statistic.c | 22 +++++-------- 5 files changed, 58 insertions(+), 54 deletions(-) diff --git a/swad_centre.c b/swad_centre.c index 1918358e1..f90608e7a 100644 --- a/swad_centre.c +++ b/swad_centre.c @@ -194,7 +194,7 @@ void Ctr_SeeCtrWithPendingDegs (void) } /*****************************************************************************/ -/****************** Draw institution logo and name with link *****************/ +/******************** Draw centre logo and name with link ********************/ /*****************************************************************************/ void Ctr_DrawCentreLogoAndNameWithLink (struct Centre *Ctr,Act_Action_t Action, @@ -210,7 +210,7 @@ void Ctr_DrawCentreLogoAndNameWithLink (struct Centre *Ctr,Act_Action_t Action, sprintf (Gbl.Title,Txt_Go_to_X,Ctr->FullName); Act_LinkFormSubmit (Gbl.Title,ClassLink); - /***** Draw institution logo *****/ + /***** Draw centre logo *****/ Log_DrawLogo (Sco_SCOPE_CTR,Ctr->CtrCod,Ctr->ShortName, 16,ClassLogo,true); diff --git a/swad_changelog.h b/swad_changelog.h index cba92bbef..96e424b66 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -111,11 +111,12 @@ /****************************** Public constants *****************************/ /*****************************************************************************/ -#define Log_PLATFORM_VERSION "SWAD 15.40.4 (2015/11/19)" +#define Log_PLATFORM_VERSION "SWAD 15.40.5 (2015/11/19)" // 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.40.5: Nov 19, 2015 Code refactoring in degrees. (187274 lines) Version 15.40.4: Nov 19, 2015 Code refactoring in centres. (187279 lines) Version 15.40.3: Nov 19, 2015 Code refactoring in institutions. (187281 lines) Version 15.40.2: Nov 19, 2015 Some links to countries, institutions, centres and degrees removed. (187281 lines) diff --git a/swad_degree.c b/swad_degree.c index 1735971f7..e37ec13fa 100644 --- a/swad_degree.c +++ b/swad_degree.c @@ -150,7 +150,6 @@ void Deg_SeeDegWithPendingCrss (void) extern const char *Txt_Degrees_with_pending_courses; extern const char *Txt_Degree; extern const char *Txt_Courses_ABBREVIATION; - extern const char *Txt_Go_to_X; extern const char *Txt_There_are_no_degrees_with_requests_for_courses_to_be_confirmed; char Query[1024]; MYSQL_RES *mysql_res; @@ -221,15 +220,8 @@ void Deg_SeeDegWithPendingCrss (void) fprintf (Gbl.F.Out,"" "", BgColor); - Act_FormGoToStart (ActSeeCrs); - Deg_PutParamDegCod (Deg.DegCod); - sprintf (Gbl.Title,Txt_Go_to_X,Deg.FullName); - Act_LinkFormSubmit (Gbl.Title,"DAT_NOBR"); - Log_DrawLogo (Sco_SCOPE_DEG,Deg.DegCod,Deg.ShortName, - 16,"CENTER_MIDDLE",true); - fprintf (Gbl.F.Out," %s", - Deg.FullName); - Act_FormEnd (); + Deg_DrawDegreeLogoAndNameWithLink (&Deg,ActSeeCrs, + "DAT_NOBR","CENTER_MIDDLE"); fprintf (Gbl.F.Out,""); /* Number of pending courses (row[1]) */ @@ -251,6 +243,34 @@ void Deg_SeeDegWithPendingCrss (void) DB_FreeMySQLResult (&mysql_res); } +/*****************************************************************************/ +/******************** Draw degree logo and name with link ********************/ +/*****************************************************************************/ + +void Deg_DrawDegreeLogoAndNameWithLink (struct Degree *Deg,Act_Action_t Action, + const char *ClassLink,const char *ClassLogo) + { + extern const char *Txt_Go_to_X; + + /***** Start form *****/ + Act_FormGoToStart (Action); + Deg_PutParamDegCod (Deg->DegCod); + + /***** Link to action *****/ + sprintf (Gbl.Title,Txt_Go_to_X,Deg->FullName); + Act_LinkFormSubmit (Gbl.Title,ClassLink); + + /***** Draw degree logo *****/ + Log_DrawLogo (Sco_SCOPE_DEG,Deg->DegCod,Deg->ShortName, + 16,ClassLogo,true); + + /***** End link *****/ + fprintf (Gbl.F.Out," %s",Deg->FullName); + + /***** End form *****/ + Act_FormEnd (); + } + /*****************************************************************************/ /****************** Show information of the current degree *******************/ /*****************************************************************************/ @@ -1222,7 +1242,6 @@ 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_Go_to_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_STATUS[Deg_NUM_STATUS_TXT]; @@ -1274,17 +1293,9 @@ static void Deg_ListOneDegreeForSeeing (struct Degree *Deg,unsigned NumDeg) NumDeg); /***** Degree logo and name *****/ - fprintf (Gbl.F.Out,"", - TxtClassStrong,BgColor); - Act_FormGoToStart (ActSeeCrs); - Deg_PutParamDegCod (Deg->DegCod); - sprintf (Gbl.Title,Txt_Go_to_X,Deg->FullName); - Act_LinkFormSubmit (Gbl.Title,TxtClassStrong); - Log_DrawLogo (Sco_SCOPE_DEG,Deg->DegCod,Deg->ShortName, - 16,"CENTER_MIDDLE",true); - fprintf (Gbl.F.Out," %s", - Deg->FullName); - Act_FormEnd (); + fprintf (Gbl.F.Out,"",BgColor); + Deg_DrawDegreeLogoAndNameWithLink (Deg,ActSeeCrs, + TxtClassStrong,"CENTER_MIDDLE"); fprintf (Gbl.F.Out,""); /***** Type of degree *****/ @@ -3893,18 +3904,18 @@ void Deg_GetAndWriteDegreesAdminBy (long UsrCod,unsigned ColSpan) MYSQL_RES *mysql_res; MYSQL_ROW row; unsigned long NumRow,NumRows; - long DegCod; + struct Degree Deg; /***** Get degrees admin by a user from database *****/ - sprintf (Query,"(SELECT -1 AS DegCod,'' AS ShortName,''" + sprintf (Query,"(SELECT -1 AS DegCod,'' AS FullName" " FROM admin" " WHERE UsrCod='%ld' AND Scope='Sys')" " UNION " - "(SELECT degrees.DegCod,degrees.ShortName AS ShortName,degrees.FullName" + "(SELECT DegCod,degrees.FullName" " FROM admin,degrees" " WHERE admin.UsrCod='%ld' AND admin.Scope='Deg'" " AND admin.Cod=degrees.DegCod)" - " ORDER BY ShortName", + " ORDER BY FullName", UsrCod,UsrCod); if ((NumRows = DB_QuerySELECT (Query,&mysql_res,"can not get degrees admin by a user"))) // If degrees found for this administrator /***** Get the list of degrees *****/ @@ -3930,19 +3941,16 @@ void Deg_GetAndWriteDegreesAdminBy (long UsrCod,unsigned ColSpan) /* Get next degree */ row = mysql_fetch_row (mysql_res); - DegCod = Str_ConvertStrCodToLongCod (row[0]); + Deg.DegCod = Str_ConvertStrCodToLongCod (row[0]); - if (DegCod > 0) + if (Deg.DegCod > 0) { + /* Get data of degree */ + Deg_GetDataOfDegreeByCod (&Deg); + /* Write degree logo and degree short name */ - Act_FormGoToStart (ActSeeDegInf); - Deg_PutParamDegCod (DegCod); - sprintf (Gbl.Title,Txt_Go_to_X,row[2]); - Act_LinkFormSubmit (Gbl.Title,"DAT_SMALL_NOBR"); - Log_DrawLogo (Sco_SCOPE_DEG,DegCod,row[1], - 16,"LEFT_TOP",true); - fprintf (Gbl.F.Out," %s",row[2]); - Act_FormEnd (); + Deg_DrawDegreeLogoAndNameWithLink (&Deg,ActSeeDegInf, + "DAT_SMALL_NOBR","LEFT_TOP"); } else fprintf (Gbl.F.Out,"" "%s" "" - "" + "" "%s" "" "" @@ -3323,7 +3323,7 @@ static void Sta_ShowNumHitsPerInstitution (unsigned long NumRows, "" "%s" "" - "" + "" "%s" "" "" @@ -3513,7 +3513,7 @@ static void Sta_ShowNumHitsPerDegree (unsigned long NumRows, "" "%s" "" - "" + "" "%s" "" "" @@ -3560,7 +3560,6 @@ static void Sta_ShowNumHitsPerDegree (unsigned long NumRows, static void Sta_WriteDegree (long DegCod) { - extern const char *Txt_Go_to_X; struct Degree Deg; /***** Start cell *****/ @@ -3577,15 +3576,8 @@ static void Sta_WriteDegree (long DegCod) Deg.FullName); /***** Form to go to degree *****/ - Act_FormGoToStart (ActSeeDegInf); - Deg_PutParamDegCod (DegCod); - sprintf (Gbl.Title,Txt_Go_to_X,Deg.ShortName); - Act_LinkFormSubmit (Gbl.Title,"LOG"); - Log_DrawLogo (Sco_SCOPE_DEG,Deg.DegCod,Deg.ShortName, - 16,"CENTER_TOP",true); - fprintf (Gbl.F.Out," %s ", - Deg.ShortName); - Act_FormEnd (); + Deg_DrawDegreeLogoAndNameWithLink (&Deg,ActSeeDegInf, + "LOG","CENTER_TOP"); } else // Hit with no degree selected /***** No degree selected *****/ @@ -3621,13 +3613,13 @@ static void Sta_ShowNumHitsPerCourse (unsigned long NumRows, "" "%s" "" - "" + "" "%s" "" "" "%s" "" - "" + "" "%s" "" ""