diff --git a/swad_centre.c b/swad_centre.c index a12cbcff4..fec5b857b 100644 --- a/swad_centre.c +++ b/swad_centre.c @@ -80,7 +80,7 @@ static void Ctr_PutIconsToPrintAndUpload (void); static void Ctr_PutIconToChangePhoto (void); static void Ctr_ListCentres (void); -static bool Ctr_CheckIfICanEditCentres (void); +static bool Ctr_CheckIfICanCreateCentres (void); static void Ctr_PutIconsListCentres (void); static void Ctr_PutIconToEditCentres (void); static void Ctr_ListOneCentreForSeeing (struct Centre *Ctr,unsigned NumCtr); @@ -760,7 +760,7 @@ static void Ctr_ListCentres (void) Lay_ShowAlert (Lay_INFO,Txt_No_centres); /***** Button to create centre *****/ - if (Ctr_CheckIfICanEditCentres ()) + if (Ctr_CheckIfICanCreateCentres ()) { Act_FormStart (ActEdiCtr); Lay_PutConfirmButton (Gbl.Ctrs.Num ? Txt_Create_another_centre : @@ -773,10 +773,10 @@ static void Ctr_ListCentres (void) } /*****************************************************************************/ -/*********************** Check if I can edit centres *************************/ +/********************** Check if I can create centres ************************/ /*****************************************************************************/ -static bool Ctr_CheckIfICanEditCentres (void) +static bool Ctr_CheckIfICanCreateCentres (void) { return (bool) (Gbl.Usrs.Me.LoggedRole >= Rol__GUEST_); } @@ -788,7 +788,7 @@ static bool Ctr_CheckIfICanEditCentres (void) static void Ctr_PutIconsListCentres (void) { /***** Put icon to edit centres *****/ - if (Ctr_CheckIfICanEditCentres ()) + if (Ctr_CheckIfICanCreateCentres ()) Ctr_PutIconToEditCentres (); /***** Put icon to show a figure *****/ diff --git a/swad_changelog.h b/swad_changelog.h index da5a16be8..873f8d5e2 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -156,13 +156,14 @@ /****************************** Public constants *****************************/ /*****************************************************************************/ -#define Log_PLATFORM_VERSION "SWAD 16.47.8 (2016-11-06)" +#define Log_PLATFORM_VERSION "SWAD 16.47.9 (2016-11-07)" #define CSS_FILE "swad16.32.1.css" #define JS_FILE "swad16.46.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.47.9: Nov 07, 2016 Icon in list of courses to show figure (statistics). (206231 lines) Version 16.47.8: Nov 06, 2016 Icon in list of degrees to show figure (statistics). (206211 lines) Version 16.47.7: Nov 06, 2016 Icon in list of centres to show figure (statistics). (206191 lines) Version 16.47.6: Nov 06, 2016 Code refactoring in countries. (206171 lines) diff --git a/swad_course.c b/swad_course.c index 936c31cfc..2568e25ef 100644 --- a/swad_course.c +++ b/swad_course.c @@ -79,6 +79,8 @@ static void Crs_WriteListMyCoursesToSelectOne (void); static void Crs_GetListCoursesInDegree (Crs_WhatCourses_t WhatCourses); static void Crs_ListCourses (void); +static bool Crs_CheckIfICanCreateCourses (void); +static void Crs_PutIconsListCourses (void); static void Crs_PutIconToEditCourses (void); static bool Crs_ListCoursesOfAYearForSeeing (unsigned Year); @@ -1174,12 +1176,10 @@ static void Crs_ListCourses (void) extern const char *Txt_Create_another_course; extern const char *Txt_Create_course; unsigned Year; - bool ICanEdit = (Gbl.Usrs.Me.LoggedRole >= Rol__GUEST_); /***** Start frame *****/ sprintf (Gbl.Title,Txt_Courses_of_DEGREE_X,Gbl.CurrentDeg.Deg.ShrtName); - Lay_StartRoundFrame (NULL,Gbl.Title,ICanEdit ? Crs_PutIconToEditCourses : - NULL); + Lay_StartRoundFrame (NULL,Gbl.Title,Crs_PutIconsListCourses); if (Gbl.CurrentDeg.NumCrss) // There are courses in the current degree { @@ -1202,7 +1202,7 @@ static void Crs_ListCourses (void) Lay_ShowAlert (Lay_INFO,Txt_No_courses); /***** Button to create course *****/ - if (ICanEdit) + if (Crs_CheckIfICanCreateCourses ()) { Act_FormStart (ActEdiCrs); Lay_PutConfirmButton (Gbl.CurrentDeg.NumCrss ? Txt_Create_another_course : @@ -1214,6 +1214,30 @@ static void Crs_ListCourses (void) Lay_EndRoundFrame (); } +/*****************************************************************************/ +/********************** Check if I can create courses ************************/ +/*****************************************************************************/ + +static bool Crs_CheckIfICanCreateCourses (void) + { + return (bool) (Gbl.Usrs.Me.LoggedRole >= Rol__GUEST_); + } + +/*****************************************************************************/ +/***************** Put contextual icons in list of courses *******************/ +/*****************************************************************************/ + +static void Crs_PutIconsListCourses (void) + { + /***** Put icon to edit courses *****/ + if (Crs_CheckIfICanCreateCourses ()) + Crs_PutIconToEditCourses (); + + /***** Put icon to show a figure *****/ + Gbl.Stat.FigureType = Sta_HIERARCHY; + Sta_PutIconToShowFigure (); + } + /*****************************************************************************/ /********************** Put link (form) to edit courses **********************/ /*****************************************************************************/ diff --git a/swad_degree.c b/swad_degree.c index e5da720b0..a0f4780af 100644 --- a/swad_degree.c +++ b/swad_degree.c @@ -99,7 +99,7 @@ static void Deg_PutHeadDegreesForEdition (void); static void Deg_CreateDegree (struct Degree *Deg,unsigned Status); static void Deg_ListDegrees (void); -static bool Deg_CheckIfICanEditDegrees (void); +static bool Deg_CheckIfICanCreateDegrees (void); static void Deg_PutIconsListDegrees (void); static void Deg_PutIconToEditDegrees (void); static void Deg_ListOneDegreeForSeeing (struct Degree *Deg,unsigned NumDeg); @@ -1641,7 +1641,7 @@ static void Deg_ListDegrees (void) Lay_ShowAlert (Lay_INFO,Txt_No_degrees); /***** Button to create degree *****/ - if (Deg_CheckIfICanEditDegrees ()) + if (Deg_CheckIfICanCreateDegrees ()) { Act_FormStart (ActEdiDeg); Lay_PutConfirmButton (Gbl.CurrentCtr.Ctr.Degs.Num ? Txt_Create_another_degree : @@ -1654,10 +1654,10 @@ static void Deg_ListDegrees (void) } /*****************************************************************************/ -/*********************** Check if I can edit degrees *************************/ +/********************** Check if I can create degrees ************************/ /*****************************************************************************/ -static bool Deg_CheckIfICanEditDegrees (void) +static bool Deg_CheckIfICanCreateDegrees (void) { return (bool) (Gbl.Usrs.Me.LoggedRole >= Rol__GUEST_); } @@ -1669,7 +1669,7 @@ static bool Deg_CheckIfICanEditDegrees (void) static void Deg_PutIconsListDegrees (void) { /***** Put icon to edit degrees *****/ - if (Deg_CheckIfICanEditDegrees ()) + if (Deg_CheckIfICanCreateDegrees ()) Deg_PutIconToEditDegrees (); /***** Put icon to show a figure *****/ diff --git a/swad_institution.c b/swad_institution.c index 88190190b..5dbc5747b 100644 --- a/swad_institution.c +++ b/swad_institution.c @@ -67,7 +67,7 @@ static void Ins_Configuration (bool PrintView); static void Ins_PutIconsToPrintAndUpload (void); static void Ins_ListInstitutions (void); -static bool Ins_CheckIfICanEditInstitutions (void); +static bool Ins_CheckIfICanCreateInstitutions (void); static void Ins_PutIconsListInstitutions (void); static void Ins_PutIconToEditInstitutions (void); static void Ins_ListOneInstitutionForSeeing (struct Instit *Ins,unsigned NumIns); @@ -683,7 +683,7 @@ static void Ins_ListInstitutions (void) Lay_ShowAlert (Lay_INFO,Txt_No_institutions); /***** Button to create institution *****/ - if (Ins_CheckIfICanEditInstitutions ()) + if (Ins_CheckIfICanCreateInstitutions ()) { Act_FormStart (ActEdiIns); Lay_PutConfirmButton (Gbl.Inss.Num ? Txt_Create_another_institution : @@ -695,10 +695,10 @@ static void Ins_ListInstitutions (void) } /*****************************************************************************/ -/******************** Check if I can edit institutions ***********************/ +/******************* Check if I can create institutions **********************/ /*****************************************************************************/ -static bool Ins_CheckIfICanEditInstitutions (void) +static bool Ins_CheckIfICanCreateInstitutions (void) { return (bool) (Gbl.Usrs.Me.LoggedRole >= Rol__GUEST_); } @@ -710,7 +710,7 @@ static bool Ins_CheckIfICanEditInstitutions (void) static void Ins_PutIconsListInstitutions (void) { /***** Put icon to edit institutions *****/ - if (Ins_CheckIfICanEditInstitutions ()) + if (Ins_CheckIfICanCreateInstitutions ()) Ins_PutIconToEditInstitutions (); /***** Put icon to show a figure *****/