diff --git a/swad_changelog.h b/swad_changelog.h index 873f8d5e2..8601abba2 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -156,13 +156,14 @@ /****************************** Public constants *****************************/ /*****************************************************************************/ -#define Log_PLATFORM_VERSION "SWAD 16.47.9 (2016-11-07)" +#define Log_PLATFORM_VERSION "SWAD 16.47.10 (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.10: Nov 07, 2016 Icon in list of surveys to show figure (statistics). (206246 lines) 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) diff --git a/swad_survey.c b/swad_survey.c index 3024edf31..580bdb3ab 100644 --- a/swad_survey.c +++ b/swad_survey.c @@ -92,6 +92,7 @@ struct SurveyQuestion static void Svy_ListAllSurveys (struct SurveyQuestion *SvyQst); static bool Svy_CheckIfICanCreateSvy (void); +static void Svy_PutIconsListSurveys (void); static void Svy_PutIconToCreateNewSvy (void); static void Svy_PutButtonToCreateNewSvy (void); static void Svy_PutParamsToCreateNewSvy (void); @@ -191,7 +192,6 @@ static void Svy_ListAllSurveys (struct SurveyQuestion *SvyQst) tSvysOrderType Order; struct Pagination Pagination; unsigned NumSvy; - bool ICanEdit = Svy_CheckIfICanCreateSvy (); /***** Get number of groups in current course *****/ if (!Gbl.CurrentCrs.Grps.NumGrps) @@ -211,9 +211,7 @@ static void Svy_ListAllSurveys (struct SurveyQuestion *SvyQst) Pag_WriteLinksToPagesCentered (Pag_SURVEYS,0,&Pagination); /***** Start frame *****/ - Lay_StartRoundFrame ("100%",Txt_Surveys, - ICanEdit ? Svy_PutIconToCreateNewSvy : - NULL); + Lay_StartRoundFrame ("100%",Txt_Surveys,Svy_PutIconsListSurveys); /***** Select whether show only my groups or all groups *****/ if (Gbl.CurrentCrs.Grps.NumGrps) @@ -269,7 +267,7 @@ static void Svy_ListAllSurveys (struct SurveyQuestion *SvyQst) Lay_ShowAlert (Lay_INFO,Txt_No_surveys); /***** Button to create a new survey *****/ - if (ICanEdit) + if (Svy_CheckIfICanCreateSvy ()) Svy_PutButtonToCreateNewSvy (); /***** End frame *****/ @@ -284,7 +282,7 @@ static void Svy_ListAllSurveys (struct SurveyQuestion *SvyQst) } /*****************************************************************************/ -/***************** Put form to select which groups to show *******************/ +/******************* Check if I can create a new survey **********************/ /*****************************************************************************/ static bool Svy_CheckIfICanCreateSvy (void) @@ -294,7 +292,11 @@ static bool Svy_CheckIfICanCreateSvy (void) case Rol_TEACHER: return (Gbl.CurrentCrs.Crs.CrsCod > 0); case Rol_DEG_ADM: - return (Gbl.CurrentDeg.Deg.DegCod > 0); + return (Gbl.CurrentDeg.Deg.DegCod > 0); // Always true + case Rol_CTR_ADM: + return (Gbl.CurrentCtr.Ctr.CtrCod > 0); // Always true + case Rol_INS_ADM: + return (Gbl.CurrentIns.Ins.InsCod > 0); // Always true case Rol_SYS_ADM: return true; default: @@ -303,6 +305,21 @@ static bool Svy_CheckIfICanCreateSvy (void) return false; } +/*****************************************************************************/ +/***************** Put contextual icons in list of surveys *******************/ +/*****************************************************************************/ + +static void Svy_PutIconsListSurveys (void) + { + /***** Put icon to create a new survey *****/ + if (Svy_CheckIfICanCreateSvy ()) + Svy_PutIconToCreateNewSvy (); + + /***** Put icon to show a figure *****/ + Gbl.Stat.FigureType = Sta_SURVEYS; + Sta_PutIconToShowFigure (); + } + /*****************************************************************************/ /********************** Put icon to create a new survey **********************/ /*****************************************************************************/