From 80639a59346047908dcb87a5a272e3b2a212011a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Ca=C3=B1as=20Vargas?= Date: Wed, 10 Apr 2019 19:19:34 +0200 Subject: [PATCH] Version18.109.2 --- swad_changelog.h | 3 +- swad_file_browser.c | 82 +++--------------------------------------- swad_user.c | 88 +++++++++++++++++++++++++++++++++++++++++++++ swad_user.h | 3 ++ 4 files changed, 97 insertions(+), 79 deletions(-) diff --git a/swad_changelog.h b/swad_changelog.h index 6d12a359..3a634ba1 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -459,10 +459,11 @@ En OpenSWAD: ps2pdf source.ps destination.pdf */ -#define Log_PLATFORM_VERSION "SWAD 18.109.1 (2019-04-10)" +#define Log_PLATFORM_VERSION "SWAD 18.109.2 (2019-04-10)" #define CSS_FILE "swad18.92.css" #define JS_FILE "swad18.92.js" /* + Version 18.109.2: Apr 10, 2019 Code refactoring in selection of users to view homework. (242421 lines) Version 18.109.1: Apr 10, 2019 A non-editing teacher can choose students with no groups of a type. (242406 lines) Version 18.109: Apr 09, 2019 Code refactoring in edition of plugins. (242421 lines) Version 18.108: Apr 09, 2019 Code refactoring in edition of links. (242336 lines) diff --git a/swad_file_browser.c b/swad_file_browser.c index b4111537..e4ec5fc1 100644 --- a/swad_file_browser.c +++ b/swad_file_browser.c @@ -3051,89 +3051,15 @@ static bool Brw_CheckIfQuotaExceded (void) void Brw_AskEditWorksCrs (void) { extern const char *Hlp_FILES_Homework_for_teachers; - extern const char *Txt_Users; extern const char *Txt_View_homework; - unsigned NumTotalUsrs; /***** Get parameters related to file browser *****/ Brw_GetParAndInitFileBrowser (); - /***** Get and update type of list, - number of columns in class photo - and preference about view photos *****/ - Usr_GetAndUpdatePrefsAboutUsrList (); - - /***** Get groups to show ******/ - Grp_GetParCodsSeveralGrpsToShowUsrs (); - - /***** Get and order lists of users from this course *****/ - Usr_GetListUsrs (Hie_CRS,Rol_STD); - Usr_GetListUsrs (Hie_CRS,Rol_NET); - Usr_GetListUsrs (Hie_CRS,Rol_TCH); - NumTotalUsrs = Gbl.Usrs.LstUsrs[Rol_STD].NumUsrs + - Gbl.Usrs.LstUsrs[Rol_NET].NumUsrs + - Gbl.Usrs.LstUsrs[Rol_TCH].NumUsrs; - - /***** Draw class photos to select users *****/ - Box_StartBox (NULL,Txt_Users,NULL, - Hlp_FILES_Homework_for_teachers,Box_NOT_CLOSABLE); - - /***** Show form to select the groups *****/ - Grp_ShowFormToSelectSeveralGroups (ActReqAsgWrkCrs,Grp_ONLY_MY_GROUPS); - - /***** Start section with user list *****/ - Lay_StartSection (Usr_USER_LIST_SECTION_ID); - - if (NumTotalUsrs) - { - if (Usr_GetIfShowBigList (NumTotalUsrs,NULL)) - { - /* Form to select type of list used for select several users */ - Usr_ShowFormsToSelectUsrListType (ActReqAsgWrkCrs); - - /***** Put link to register students *****/ - Enr_CheckStdsAndPutButtonToRegisterStdsInCurrentCrs (); - - /* Start form */ - Frm_StartForm (ActAdmAsgWrkCrs); - Grp_PutParamsCodGrps (); - Gbl.FileBrowser.FullTree = true; // By default, show all files - Brw_PutHiddenParamFullTreeIfSelected (); - - /* Put list of users to select some of them */ - Tbl_StartTableCenter (0); - Usr_ListUsersToSelect (Rol_TCH); - Usr_ListUsersToSelect (Rol_NET); - Usr_ListUsersToSelect (Rol_STD); - Tbl_EndTable (); - - /* Send button */ - Btn_PutConfirmButton (Txt_View_homework); - - /* End form */ - Frm_EndForm (); - } - } - else // NumTotalUsrs == 0 - /***** Show warning indicating no users found *****/ - Usr_ShowWarningNoUsersFound (Rol_UNK); - - /***** End section with user list *****/ - Lay_EndSection (); - - /***** End box *****/ - Box_EndBox (); - - /***** Free memory for users' list *****/ - Usr_FreeUsrsList (Rol_TCH); - Usr_FreeUsrsList (Rol_NET); - Usr_FreeUsrsList (Rol_STD); - - /***** Free memory used by list of selected users' codes *****/ - Usr_FreeListsSelectedUsrsCods (); - - /***** Free memory for list of selected groups *****/ - Grp_FreeListCodSelectedGrps (); + /***** List users to select some of them *****/ + Usr_PutFormToSelectUsrsToGoToAct (ActReqAsgWrkCrs, + Hlp_FILES_Homework_for_teachers, + Txt_View_homework); } /*****************************************************************************/ diff --git a/swad_user.c b/swad_user.c index 03b2d940..4f91b942 100644 --- a/swad_user.c +++ b/swad_user.c @@ -6130,6 +6130,94 @@ void Usr_PutExtraParamsUsrList (Act_Action_t NextAction) /******************** List users to select some of them **********************/ /*****************************************************************************/ +void Usr_PutFormToSelectUsrsToGoToAct (Act_Action_t NextAction, + const char *HelpLink, + const char *TxtButton) + { + extern const char *Txt_Users; + unsigned NumTotalUsrs; + + /***** Get and update type of list, + number of columns in class photo + and preference about view photos *****/ + Usr_GetAndUpdatePrefsAboutUsrList (); + + /***** Get groups to show ******/ + Grp_GetParCodsSeveralGrpsToShowUsrs (); + + /***** Get and order lists of users from this course *****/ + Usr_GetListUsrs (Hie_CRS,Rol_STD); + Usr_GetListUsrs (Hie_CRS,Rol_NET); + Usr_GetListUsrs (Hie_CRS,Rol_TCH); + NumTotalUsrs = Gbl.Usrs.LstUsrs[Rol_STD].NumUsrs + + Gbl.Usrs.LstUsrs[Rol_NET].NumUsrs + + Gbl.Usrs.LstUsrs[Rol_TCH].NumUsrs; + + /***** Draw class photos to select users *****/ + Box_StartBox (NULL,Txt_Users,NULL,HelpLink,Box_NOT_CLOSABLE); + + /***** Show form to select the groups *****/ + Grp_ShowFormToSelectSeveralGroups (NextAction,Grp_ONLY_MY_GROUPS); + + /***** Start section with user list *****/ + Lay_StartSection (Usr_USER_LIST_SECTION_ID); + + if (NumTotalUsrs) + { + if (Usr_GetIfShowBigList (NumTotalUsrs,NULL)) + { + /* Form to select type of list used for select several users */ + Usr_ShowFormsToSelectUsrListType (ActReqAsgWrkCrs); + + /***** Put link to register students *****/ + Enr_CheckStdsAndPutButtonToRegisterStdsInCurrentCrs (); + + /* Start form */ + Frm_StartForm (ActAdmAsgWrkCrs); + Grp_PutParamsCodGrps (); + Gbl.FileBrowser.FullTree = true; // By default, show all files + Brw_PutHiddenParamFullTreeIfSelected (); + + /* Put list of users to select some of them */ + Tbl_StartTableCenter (0); + Usr_ListUsersToSelect (Rol_TCH); + Usr_ListUsersToSelect (Rol_NET); + Usr_ListUsersToSelect (Rol_STD); + Tbl_EndTable (); + + /* Send button */ + Btn_PutConfirmButton (TxtButton); + + /* End form */ + Frm_EndForm (); + } + } + else // NumTotalUsrs == 0 + /***** Show warning indicating no users found *****/ + Usr_ShowWarningNoUsersFound (Rol_UNK); + + /***** End section with user list *****/ + Lay_EndSection (); + + /***** End box *****/ + Box_EndBox (); + + /***** Free memory for users' list *****/ + Usr_FreeUsrsList (Rol_TCH); + Usr_FreeUsrsList (Rol_NET); + Usr_FreeUsrsList (Rol_STD); + + /***** Free memory used by list of selected users' codes *****/ + Usr_FreeListsSelectedUsrsCods (); + + /***** Free memory for list of selected groups *****/ + Grp_FreeListCodSelectedGrps (); + } + +/*****************************************************************************/ +/*********** List users with a given role to select some of them *************/ +/*****************************************************************************/ + void Usr_ListUsersToSelect (Rol_Role_t Role) { /***** If there are no users, don't list anything *****/ diff --git a/swad_user.h b/swad_user.h index 454fb3c7..7c4c8122 100644 --- a/swad_user.h +++ b/swad_user.h @@ -424,6 +424,9 @@ void Usr_SetUsrDatMainFieldNames (void); void Usr_WriteHeaderFieldsUsrDat (bool PutCheckBoxToSelectUsr); void Usr_PutExtraParamsUsrList (Act_Action_t NextAction); +void Usr_PutFormToSelectUsrsToGoToAct (Act_Action_t NextAction, + const char *HelpLink, + const char *TxtButton); void Usr_ListUsersToSelect (Rol_Role_t Role); void Usr_ListAllDataGsts (void);