From 15fe3d4b04349bdd94ec2b1c04c3aab72cec26b4 Mon Sep 17 00:00:00 2001 From: acanas Date: Wed, 19 Apr 2023 12:11:38 +0200 Subject: [PATCH] Version 22.100.2: Apr 19, 2023 Institution admins can edit departments. --- swad_action_list.c | 20 ++++++++++---------- swad_admin.c | 6 ------ swad_changelog.h | 5 +++-- swad_department.c | 22 ++++++++++++++++------ swad_department.h | 2 +- swad_holiday.c | 2 +- swad_holiday.h | 2 +- swad_place.c | 2 +- swad_place.h | 2 +- swad_record.c | 20 +++----------------- 10 files changed, 37 insertions(+), 46 deletions(-) diff --git a/swad_action_list.c b/swad_action_list.c index 1c130a89d..a47bae5cc 100644 --- a/swad_action_list.c +++ b/swad_action_list.c @@ -284,9 +284,9 @@ const struct Act_Actions ActLst_Actions[ActLst_NUM_ACTIONS] = // Actions in menu: [ActSeeInsInf ] = {1153, 0,TabIns,ActSeeInsInf , 0, 0, 0, 0,0x3C7, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,InsCfg_ShowConfiguration ,"info" }, [ActSeeCtr ] = { 676, 1,TabIns,ActSeeCtr , 0, 0, 0, 0,0x3C7, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Ctr_ShowCtrsOfCurrentIns ,"building" }, - [ActSeePlc ] = { 703, 2,TabIns,ActSeePlc , 0, 0, 0, 0,0x3C7, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Plc_SeePlaces ,"map-marker-alt" }, - [ActSeeDpt ] = { 675, 3,TabIns,ActSeeDpt , 0, 0, 0, 0,0x3C7, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Dpt_SeeDepts ,"users" }, - [ActSeeHld ] = { 707, 4,TabIns,ActSeeHld , 0, 0, 0, 0,0x3C7, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Hld_SeeHolidays ,"calendar-day" }, + [ActSeePlc ] = { 703, 2,TabIns,ActSeePlc , 0, 0, 0, 0,0x3C7, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Plc_SeeAllPlaces ,"map-marker-alt" }, + [ActSeeDpt ] = { 675, 3,TabIns,ActSeeDpt , 0, 0, 0, 0,0x3C7, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Dpt_SeeAllDepts ,"users" }, + [ActSeeHld ] = { 707, 4,TabIns,ActSeeHld , 0, 0, 0, 0,0x3C7, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Hld_SeeAllHolidays ,"calendar-day" }, // Actions not in menu: [ActPrnInsInf ] = {1154,-1,TabUnk,ActSeeInsInf , 0, 0, 0, 0,0x3C7, 0, 0,Act_CONT_NORM,Act_BRW_NEW_TAB,NULL ,InsCfg_PrintConfiguration ,NULL}, @@ -314,13 +314,13 @@ const struct Act_Actions ActLst_Actions[ActLst_NUM_ACTIONS] = [ActRenPlcSho ] = { 894,-1,TabUnk,ActSeePlc , 0, 0, 0, 0,0x200, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,Plc_RenamePlaceShort ,Plc_ContEditAfterChgPlc ,NULL}, [ActRenPlcFul ] = { 895,-1,TabUnk,ActSeePlc , 0, 0, 0, 0,0x200, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,Plc_RenamePlaceFull ,Plc_ContEditAfterChgPlc ,NULL}, - [ActEdiDpt ] = { 677,-1,TabUnk,ActSeeDpt , 0, 0, 0, 0,0x200, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Dpt_EditDepartments ,NULL}, - [ActNewDpt ] = { 687,-1,TabUnk,ActSeeDpt , 0, 0, 0, 0,0x200, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,Dpt_ReceiveFormNewDpt ,Dpt_ContEditAfterChgDpt ,NULL}, - [ActRemDpt ] = { 690,-1,TabUnk,ActSeeDpt , 0, 0, 0, 0,0x200, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,Dpt_RemoveDepartment ,Dpt_ContEditAfterChgDpt ,NULL}, - [ActChgDptIns ] = { 721,-1,TabUnk,ActSeeDpt , 0, 0, 0, 0,0x200, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,Dpt_ChangeDepartIns ,Dpt_ContEditAfterChgDpt ,NULL}, - [ActRenDptSho ] = { 688,-1,TabUnk,ActSeeDpt , 0, 0, 0, 0,0x200, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,Dpt_RenameDepartShort ,Dpt_ContEditAfterChgDpt ,NULL}, - [ActRenDptFul ] = { 689,-1,TabUnk,ActSeeDpt , 0, 0, 0, 0,0x200, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,Dpt_RenameDepartFull ,Dpt_ContEditAfterChgDpt ,NULL}, - [ActChgDptWWW ] = { 691,-1,TabUnk,ActSeeDpt , 0, 0, 0, 0,0x200, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,Dpt_ChangeDptWWW ,Dpt_ContEditAfterChgDpt ,NULL}, + [ActEdiDpt ] = { 677,-1,TabUnk,ActSeeDpt , 0, 0, 0, 0,0x300, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Dpt_EditDepartments ,NULL}, + [ActNewDpt ] = { 687,-1,TabUnk,ActSeeDpt , 0, 0, 0, 0,0x300, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,Dpt_ReceiveFormNewDpt ,Dpt_ContEditAfterChgDpt ,NULL}, + [ActRemDpt ] = { 690,-1,TabUnk,ActSeeDpt , 0, 0, 0, 0,0x300, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,Dpt_RemoveDepartment ,Dpt_ContEditAfterChgDpt ,NULL}, + [ActChgDptIns ] = { 721,-1,TabUnk,ActSeeDpt , 0, 0, 0, 0,0x300, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,Dpt_ChangeDepartIns ,Dpt_ContEditAfterChgDpt ,NULL}, + [ActRenDptSho ] = { 688,-1,TabUnk,ActSeeDpt , 0, 0, 0, 0,0x300, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,Dpt_RenameDepartShort ,Dpt_ContEditAfterChgDpt ,NULL}, + [ActRenDptFul ] = { 689,-1,TabUnk,ActSeeDpt , 0, 0, 0, 0,0x300, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,Dpt_RenameDepartFull ,Dpt_ContEditAfterChgDpt ,NULL}, + [ActChgDptWWW ] = { 691,-1,TabUnk,ActSeeDpt , 0, 0, 0, 0,0x300, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,Dpt_ChangeDptWWW ,Dpt_ContEditAfterChgDpt ,NULL}, [ActEdiHld ] = { 713,-1,TabUnk,ActSeeHld , 0, 0, 0, 0,0x300, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Hld_EditHolidays ,NULL}, [ActNewHld ] = { 714,-1,TabUnk,ActSeeHld , 0, 0, 0, 0,0x300, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,Hld_ReceiveFormNewHoliday ,Hld_ContEditAfterChgHld ,NULL}, diff --git a/swad_admin.c b/swad_admin.c index bd4e29319..3b019ca9e 100644 --- a/swad_admin.c +++ b/swad_admin.c @@ -40,12 +40,6 @@ const bool Adm_ICanAdminOtherUsrs[Rol_NUM_ROLES] = { - /* Users who can not admin */ - [Rol_UNK ] = false, - [Rol_GST ] = false, - [Rol_USR ] = false, - [Rol_STD ] = false, - [Rol_NET ] = false, /* Users who can admin */ [Rol_TCH ] = true, [Rol_DEG_ADM] = true, diff --git a/swad_changelog.h b/swad_changelog.h index fd2637411..ea6636e87 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -629,11 +629,12 @@ TODO: Emilce Barrera Mesa: Podr TODO: Emilce Barrera Mesa: Mis estudiantes presentan muchas dificultades a la hora de poner la foto porque la plataforma es muy exigente respecto al fondo de la imagen. */ -#define Log_PLATFORM_VERSION "SWAD 22.100.1 (2023-04-19)" +#define Log_PLATFORM_VERSION "SWAD 22.100.2 (2023-04-19)" #define CSS_FILE "swad22.95.css" #define JS_FILE "swad22.49.js" /* - Version 22.100.1: Apr 19, 2023 Changes in projects. (? lines) + Version 22.100.2: Apr 19, 2023 Institution admins can edit departments. (338889 lines) + Version 22.100.1: Apr 19, 2023 Changes in projects. (338897 lines) Version 22.100: Apr 18, 2023 Changes in resources, assignments, exams, games, attendance events and surveys. (338875 lines) Version 22.99: Apr 18, 2023 Code refactoring in rubrics. (339025 lines) Version 22.98: Apr 17, 2023 Code refactoring in rubrics. (339062 lines) diff --git a/swad_department.c b/swad_department.c index f2d43fb6a..75c2c8a11 100644 --- a/swad_department.c +++ b/swad_department.c @@ -49,6 +49,17 @@ #include "swad_parameter_code.h" #include "swad_string.h" +/*****************************************************************************/ +/****************************** Private constants ****************************/ +/*****************************************************************************/ + +static const bool Dpt_ICanEditDpts[Rol_NUM_ROLES] = + { + /* Users who can edit */ + [Rol_INS_ADM] = true, + [Rol_SYS_ADM] = true, + }; + /*****************************************************************************/ /************** External global variables from others modules ****************/ /*****************************************************************************/ @@ -102,7 +113,7 @@ static void Dpt_ResetDepartments (struct Dpt_Departments *Departments) /*************************** List all departments ****************************/ /*****************************************************************************/ -void Dpt_SeeDepts (void) +void Dpt_SeeAllDepts (void) { extern const char *Hlp_INSTITUTION_Departments; extern const char *Txt_Departments_of_INSTITUTION_X; @@ -139,9 +150,7 @@ void Dpt_SeeDepts (void) if (asprintf (&Title,Txt_Departments_of_INSTITUTION_X,Gbl.Hierarchy.Ins.FullName) < 0) Err_NotEnoughMemoryExit (); Box_BoxTableBegin (NULL,Title, - Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM ? Dpt_PutIconToEditDpts : - NULL, - NULL, + Dpt_PutIconToEditDpts,NULL, Hlp_INSTITUTION_Departments,Box_NOT_CLOSABLE,2); free (Title); @@ -255,8 +264,9 @@ static Dpt_Order_t Dpt_GetParDptOrder (void) static void Dpt_PutIconToEditDpts (__attribute__((unused)) void *Args) { - Ico_PutContextualIconToEdit (ActEdiDpt,NULL, - NULL,NULL); + if (Dpt_ICanEditDpts[Gbl.Usrs.Me.Role.Logged]) + Ico_PutContextualIconToEdit (ActEdiDpt,NULL, + NULL,NULL); } /*****************************************************************************/ diff --git a/swad_department.h b/swad_department.h index 6415ceb5d..5adf59169 100644 --- a/swad_department.h +++ b/swad_department.h @@ -62,7 +62,7 @@ struct Dpt_Departments /***************************** Public prototypes *****************************/ /*****************************************************************************/ -void Dpt_SeeDepts (void); +void Dpt_SeeAllDepts (void); void Dpt_EditDepartments (void); void Dpt_FreeListDepartments (struct Dpt_Departments *Departments); void Dpt_GetDepartmentDataByCod (struct Dpt_Department *Dpt); diff --git a/swad_holiday.c b/swad_holiday.c index 03041c268..42677cbca 100644 --- a/swad_holiday.c +++ b/swad_holiday.c @@ -97,7 +97,7 @@ void Hld_ResetHolidays (struct Hld_Holidays *Holidays) /****************************** List all holidays ****************************/ /*****************************************************************************/ -void Hld_SeeHolidays (void) +void Hld_SeeAllHolidays (void) { extern const char *Hlp_INSTITUTION_Holidays; extern const char *Txt_Holidays; diff --git a/swad_holiday.h b/swad_holiday.h index fb5617a13..00088eac2 100644 --- a/swad_holiday.h +++ b/swad_holiday.h @@ -84,7 +84,7 @@ struct Hld_Holidays void Hld_ResetHolidays (struct Hld_Holidays *Holidays); -void Hld_SeeHolidays (void); +void Hld_SeeAllHolidays (void); void Hld_PutIconToSeeHlds (void); void Hld_EditHolidays (void); void Hld_GetListHolidays (struct Hld_Holidays *Holidays); diff --git a/swad_place.c b/swad_place.c index 57338e10c..f94589ec8 100644 --- a/swad_place.c +++ b/swad_place.c @@ -96,7 +96,7 @@ void Plc_ResetPlaces (struct Plc_Places *Places) /***************************** List all places *******************************/ /*****************************************************************************/ -void Plc_SeePlaces (void) +void Plc_SeeAllPlaces (void) { extern const char *Hlp_INSTITUTION_Places; extern const char *Txt_Places; diff --git a/swad_place.h b/swad_place.h index 6d097950d..5afaf9145 100644 --- a/swad_place.h +++ b/swad_place.h @@ -69,7 +69,7 @@ struct Plc_Places void Plc_ResetPlaces (struct Plc_Places *Places); -void Plc_SeePlaces (void); +void Plc_SeeAllPlaces (void); void Plc_EditPlaces (void); void Plc_PutIconToViewPlaces (void); void Plc_GetListPlaces (struct Plc_Places *Places); diff --git a/swad_record.c b/swad_record.c index e621b5197..ae71b3a73 100644 --- a/swad_record.c +++ b/swad_record.c @@ -2015,30 +2015,16 @@ void Rec_ShowSharedUsrRecord (Rec_SharedRecordViewType_t TypeOfView, extern const char *Txt_Confirm; const char *Rec_RecordHelp[Rec_SHARED_NUM_VIEW_TYPES] = { - [Rec_SHA_SIGN_UP_IN_CRS_FORM ] = Hlp_USERS_SignUp, - - [Rec_SHA_MY_RECORD_FORM ] = Hlp_PROFILE_Record, - - [Rec_SHA_OTHER_EXISTING_USR_FORM] = NULL, - [Rec_SHA_OTHER_NEW_USR_FORM ] = NULL, - [Rec_SHA_OTHER_USR_CHECK ] = NULL, - - [Rec_SHA_RECORD_LIST ] = NULL, - [Rec_SHA_RECORD_PRINT ] = NULL, - [Rec_SHA_RECORD_PUBLIC ] = Hlp_START_Profiles_view_public_profile, + [Rec_SHA_SIGN_UP_IN_CRS_FORM] = Hlp_USERS_SignUp, + [Rec_SHA_MY_RECORD_FORM ] = Hlp_PROFILE_Record, + [Rec_SHA_RECORD_PUBLIC ] = Hlp_START_Profiles_view_public_profile, }; const char *Rec_RecordListHelp[Rol_NUM_ROLES] = { - [Rol_UNK ] = NULL, [Rol_GST ] = Hlp_USERS_Guests, - [Rol_USR ] = NULL, [Rol_STD ] = Hlp_USERS_Students_shared_record_card, [Rol_NET ] = Hlp_USERS_Teachers_shared_record_card, [Rol_TCH ] = Hlp_USERS_Teachers_shared_record_card, - [Rol_DEG_ADM] = NULL, - [Rol_CTR_ADM] = NULL, - [Rol_INS_ADM] = NULL, - [Rol_SYS_ADM] = NULL, }; char StrRecordWidth[Cns_MAX_DECIMAL_DIGITS_UINT + 1]; Usr_MeOrOther_t MeOrOther;