From 284f2137798e6ece9872502a27e11ccb5408d684 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Ca=C3=B1as=20Vargas?= Date: Mon, 7 Nov 2016 01:44:50 +0100 Subject: [PATCH] Version 16.47.14 --- swad_assignment.c | 35 +++++++++++++++++++++++++++++------ swad_changelog.h | 3 ++- 2 files changed, 31 insertions(+), 7 deletions(-) diff --git a/swad_assignment.c b/swad_assignment.c index 26c12bc5..17306642 100644 --- a/swad_assignment.c +++ b/swad_assignment.c @@ -63,6 +63,8 @@ extern struct Globals Gbl; /*****************************************************************************/ static void Asg_ShowAllAssignments (void); +static bool Asg_CheckIfICanCreateAssignments (void); +static void Asg_PutIconsListAssignments (void); static void Asg_PutIconToCreateNewAsg (void); static void Asg_PutButtonToCreateNewAsg (void); static void Asg_PutParamsToCreateNewAsg (void); @@ -119,8 +121,6 @@ static void Asg_ShowAllAssignments (void) tAsgsOrderType Order; struct Pagination Pagination; unsigned NumAsg; - bool ICanEdit = (Gbl.Usrs.Me.LoggedRole == Rol_TEACHER || - Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM); /***** Get list of assignments *****/ Asg_GetListAssignments (); @@ -136,9 +136,7 @@ static void Asg_ShowAllAssignments (void) Pag_WriteLinksToPagesCentered (Pag_ASSIGNMENTS,0,&Pagination); /***** Start frame *****/ - Lay_StartRoundFrame ("100%",Txt_Assignments, - ICanEdit ? Asg_PutIconToCreateNewAsg : - NULL); + Lay_StartRoundFrame ("100%",Txt_Assignments,Asg_PutIconsListAssignments); /***** Select whether show only my groups or all groups *****/ if (Gbl.CurrentCrs.Grps.NumGrps) @@ -195,7 +193,7 @@ static void Asg_ShowAllAssignments (void) Lay_ShowAlert (Lay_INFO,Txt_No_assignments); /***** Button to create a new assignment *****/ - if (ICanEdit) + if (Asg_CheckIfICanCreateAssignments ()) Asg_PutButtonToCreateNewAsg (); /***** End frame *****/ @@ -209,6 +207,31 @@ static void Asg_ShowAllAssignments (void) Asg_FreeListAssignments (); } +/*****************************************************************************/ +/******************** Check if I can create assignments **********************/ +/*****************************************************************************/ + +static bool Asg_CheckIfICanCreateAssignments (void) + { + return (bool) (Gbl.Usrs.Me.LoggedRole == Rol_TEACHER || + Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM); + } + +/*****************************************************************************/ +/*************** Put contextual icons in list of assignments *****************/ +/*****************************************************************************/ + +static void Asg_PutIconsListAssignments (void) + { + /***** Put icon to create a new assignment *****/ + if (Asg_CheckIfICanCreateAssignments ()) + Asg_PutIconToCreateNewAsg (); + + /***** Put icon to show a figure *****/ + Gbl.Stat.FigureType = Sta_ASSIGNMENTS; + Sta_PutIconToShowFigure (); + } + /*****************************************************************************/ /******************* Put icon to create a new assignment *********************/ /*****************************************************************************/ diff --git a/swad_changelog.h b/swad_changelog.h index 237fe02c..e48bde21 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -156,13 +156,14 @@ /****************************** Public constants *****************************/ /*****************************************************************************/ -#define Log_PLATFORM_VERSION "SWAD 16.47.13 (2016-11-07)" +#define Log_PLATFORM_VERSION "SWAD 16.47.14 (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.14: Nov 07, 2016 Icon in list of assignments to show figure (statistics). (206314 lines) Version 16.47.13: Nov 07, 2016 Icon in list of guests to show figure (statistics). (206295 lines) Version 16.47.12: Nov 07, 2016 Icon in list of teachers to show figure (statistics). (206278 lines) Version 16.47.11: Nov 07, 2016 Icon in list of students to show figure (statistics). (206262 lines)