From 19b832f7bb1d275e280d74d97bed5ab3b6702ae7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Ca=C3=B1as=20Vargas?= Date: Sun, 29 Dec 2019 20:11:57 +0100 Subject: [PATCH] Version19.107 --- Makefile | 3 +- swad_centre_config.c | 13 +- swad_changelog.h | 7 +- swad_country_config.c | 5 +- swad_course_config.c | 11 +- swad_degree_config.c | 13 +- swad_hierarchy.c | 198 +----------------------------- swad_hierarchy.h | 16 --- swad_hierarchy_config.c | 247 ++++++++++++++++++++++++++++++++++++++ swad_hierarchy_config.h | 58 +++++++++ swad_institution_config.c | 13 +- 11 files changed, 342 insertions(+), 242 deletions(-) create mode 100644 swad_hierarchy_config.c create mode 100644 swad_hierarchy_config.h diff --git a/Makefile b/Makefile index 45d633f3..e7468c8c 100644 --- a/Makefile +++ b/Makefile @@ -40,7 +40,8 @@ OBJS = swad_account.o swad_action.o swad_agenda.o swad_alert.o \ swad_file_MIME.o swad_firewall.o swad_follow.o swad_form.o \ swad_forum.o \ swad_game.o swad_global.o swad_group.o \ - swad_help.o swad_hierarchy.o swad_holiday.o swad_HTML.o \ + swad_help.o swad_hierarchy.o swad_hierarchy_config.o swad_holiday.o \ + swad_HTML.o \ swad_icon.o swad_ID.o swad_indicator.o swad_info.o swad_institution.o \ swad_institution_config.o \ swad_language.o swad_layout.o swad_link.o swad_log.o swad_logo.o \ diff --git a/swad_centre_config.c b/swad_centre_config.c index 29d56303..52fa3a47 100644 --- a/swad_centre_config.c +++ b/swad_centre_config.c @@ -37,6 +37,7 @@ #include "swad_form.h" #include "swad_global.h" #include "swad_help.h" +#include "swad_hierarchy_config.h" #include "swad_HTML.h" #include "swad_logo.h" @@ -305,7 +306,7 @@ static void CtrCfg_PutIconToChangePhoto (void) static void CtrCfg_Title (bool PutLink) { - Hie_ConfigTitle (PutLink, + HieCfg_Title (PutLink, Hie_CTR, // Logo scope Gbl.Hierarchy.Ctr.CtrCod, // Logo code Gbl.Hierarchy.Ctr.ShrtName, // Logo short name @@ -660,7 +661,7 @@ static void CtrCfg_FullName (bool PutForm) { extern const char *Txt_Centre; - Hie_ConfigFullName (PutForm,Txt_Centre,ActRenCtrFulCfg, + HieCfg_FullName (PutForm,Txt_Centre,ActRenCtrFulCfg, Gbl.Hierarchy.Ctr.FullName); } @@ -670,7 +671,7 @@ static void CtrCfg_FullName (bool PutForm) static void CtrCfg_ShrtName (bool PutForm) { - Hie_ConfigShrtName (PutForm,ActRenCtrShoCfg,Gbl.Hierarchy.Ctr.ShrtName); + HieCfg_ShrtName (PutForm,ActRenCtrShoCfg,Gbl.Hierarchy.Ctr.ShrtName); } /*****************************************************************************/ @@ -736,7 +737,7 @@ static void CtrCfg_Place (bool PutForm) static void CtrCfg_WWW (bool PrintView,bool PutForm) { - Hie_ConfigWWW (PrintView,PutForm,ActChgCtrWWWCfg,Gbl.Hierarchy.Ctr.WWW); + HieCfg_WWW (PrintView,PutForm,ActChgCtrWWWCfg,Gbl.Hierarchy.Ctr.WWW); } /*****************************************************************************/ @@ -745,7 +746,7 @@ static void CtrCfg_WWW (bool PrintView,bool PutForm) static void CtrCfg_Shortcut (bool PrintView) { - Hie_ConfigShortcut (PrintView,"ctr",Gbl.Hierarchy.Ctr.CtrCod); + HieCfg_Shortcut (PrintView,"ctr",Gbl.Hierarchy.Ctr.CtrCod); } /*****************************************************************************/ @@ -754,7 +755,7 @@ static void CtrCfg_Shortcut (bool PrintView) static void CtrCfg_QR (void) { - Hie_ConfigQR ("ctr",Gbl.Hierarchy.Ctr.CtrCod); + HieCfg_QR ("ctr",Gbl.Hierarchy.Ctr.CtrCod); } /*****************************************************************************/ diff --git a/swad_changelog.h b/swad_changelog.h index 4e1edba4..78646171 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -492,7 +492,7 @@ enscript -2 --landscape --color --file-align=2 --highlight --line-numbers -o - * En OpenSWAD: ps2pdf source.ps destination.pdf */ -#define Log_PLATFORM_VERSION "SWAD 19.106 (2019-12-29)" +#define Log_PLATFORM_VERSION "SWAD 19.107 (2019-12-29)" #define CSS_FILE "swad19.101.5.css" #define JS_FILE "swad19.91.1.js" /* @@ -500,8 +500,9 @@ ps2pdf source.ps destination.pdf // TODO: Impedir la creación y edición de proyectos si no son editables. // TODO: No se puede entrar con DNI '1' suponiendo que no tenga password ¿por qué? - Version 19.10x: Dec 29, 2019 Map in country information. (? lines) - Version 19.10x: Dec 29, 2019 Map in institution information. (? lines) + Version 19.10x: Dec 30, 2019 Map in country information. (? lines) + Version 19.10x: Dec 30, 2019 Map in institution information. (? lines) + Version 19.107: Dec 29, 2019 New module swad_hierarchy_config for common hierarchy configuration functions. (249760 lines) Version 19.106: Dec 29, 2019 New module swad_country_config for country configuration. (249683 lines) Version 19.105: Dec 29, 2019 New module swad_institution_config for institution configuration. (249614 lines) Version 19.104.2: Dec 29, 2019 Code refactoring in degree configuration. (249541 lines) diff --git a/swad_country_config.c b/swad_country_config.c index 424f0b3a..b5c8930e 100644 --- a/swad_country_config.c +++ b/swad_country_config.c @@ -33,6 +33,7 @@ #include "swad_form.h" #include "swad_global.h" #include "swad_help.h" +#include "swad_hierarchy_config.h" #include "swad_HTML.h" /*****************************************************************************/ @@ -289,7 +290,7 @@ static void CtyCfg_Name (bool PutLink) static void CtyCfg_Shortcut (bool PrintView) { - Hie_ConfigShortcut (PrintView,"cty",Gbl.Hierarchy.Cty.CtyCod); + HieCfg_Shortcut (PrintView,"cty",Gbl.Hierarchy.Cty.CtyCod); } /*****************************************************************************/ @@ -298,7 +299,7 @@ static void CtyCfg_Shortcut (bool PrintView) static void CtyCfg_QR (void) { - Hie_ConfigQR ("cty",Gbl.Hierarchy.Cty.CtyCod); + HieCfg_QR ("cty",Gbl.Hierarchy.Cty.CtyCod); } /*****************************************************************************/ diff --git a/swad_course_config.c b/swad_course_config.c index 1cd7dc83..c0034fab 100644 --- a/swad_course_config.c +++ b/swad_course_config.c @@ -32,6 +32,7 @@ #include "swad_database.h" #include "swad_form.h" #include "swad_global.h" +#include "swad_hierarchy_config.h" #include "swad_HTML.h" #include "swad_logo.h" #include "swad_role.h" @@ -194,7 +195,7 @@ void CrsCfg_PrintConfiguration (void) static void CrsCfg_Title (bool PutLink) { - Hie_ConfigTitle (PutLink, + HieCfg_Title (PutLink, Hie_DEG, // Logo scope Gbl.Hierarchy.Deg.DegCod, // Logo code Gbl.Hierarchy.Deg.ShrtName, // Logo short name @@ -279,7 +280,7 @@ static void CrsCfg_FullName (bool PutForm) { extern const char *Txt_Course; - Hie_ConfigFullName (PutForm,Txt_Course,ActRenCrsFulCfg, + HieCfg_FullName (PutForm,Txt_Course,ActRenCrsFulCfg, Gbl.Hierarchy.Crs.FullName); } @@ -289,7 +290,7 @@ static void CrsCfg_FullName (bool PutForm) static void CrsCfg_ShrtName (bool PutForm) { - Hie_ConfigShrtName (PutForm,ActRenCrsShoCfg,Gbl.Hierarchy.Crs.ShrtName); + HieCfg_ShrtName (PutForm,ActRenCrsShoCfg,Gbl.Hierarchy.Crs.ShrtName); } /*****************************************************************************/ @@ -397,7 +398,7 @@ static void CrsCfg_InternalCode (void) static void CrsCfg_Shortcut (bool PrintView) { - Hie_ConfigShortcut (PrintView,"crs",Gbl.Hierarchy.Crs.CrsCod); + HieCfg_Shortcut (PrintView,"crs",Gbl.Hierarchy.Crs.CrsCod); } /*****************************************************************************/ @@ -406,7 +407,7 @@ static void CrsCfg_Shortcut (bool PrintView) static void CrsCfg_QR (void) { - Hie_ConfigQR ("crs",Gbl.Hierarchy.Crs.CrsCod); + HieCfg_QR ("crs",Gbl.Hierarchy.Crs.CrsCod); } /*****************************************************************************/ diff --git a/swad_degree_config.c b/swad_degree_config.c index aeffb5a3..24f99207 100644 --- a/swad_degree_config.c +++ b/swad_degree_config.c @@ -32,6 +32,7 @@ #include "swad_form.h" #include "swad_global.h" #include "swad_help.h" +#include "swad_hierarchy_config.h" #include "swad_HTML.h" #include "swad_logo.h" @@ -191,7 +192,7 @@ static void DegCfg_PutIconsToPrintAndUpload (void) static void DegCfg_Title (bool PutLink) { - Hie_ConfigTitle (PutLink, + HieCfg_Title (PutLink, Hie_DEG, // Logo scope Gbl.Hierarchy.Deg.DegCod, // Logo code Gbl.Hierarchy.Deg.ShrtName, // Logo short name @@ -276,7 +277,7 @@ static void DegCfg_FullName (bool PutForm) { extern const char *Txt_Degree; - Hie_ConfigFullName (PutForm,Txt_Degree,ActRenDegFulCfg, + HieCfg_FullName (PutForm,Txt_Degree,ActRenDegFulCfg, Gbl.Hierarchy.Deg.FullName); } @@ -286,7 +287,7 @@ static void DegCfg_FullName (bool PutForm) static void DegCfg_ShrtName (bool PutForm) { - Hie_ConfigShrtName (PutForm,ActRenDegShoCfg,Gbl.Hierarchy.Deg.ShrtName); + HieCfg_ShrtName (PutForm,ActRenDegShoCfg,Gbl.Hierarchy.Deg.ShrtName); } /*****************************************************************************/ @@ -295,7 +296,7 @@ static void DegCfg_ShrtName (bool PutForm) static void DegCfg_WWW (bool PrintView,bool PutForm) { - Hie_ConfigWWW (PrintView,PutForm,ActChgDegWWWCfg,Gbl.Hierarchy.Deg.WWW); + HieCfg_WWW (PrintView,PutForm,ActChgDegWWWCfg,Gbl.Hierarchy.Deg.WWW); } /*****************************************************************************/ @@ -304,7 +305,7 @@ static void DegCfg_WWW (bool PrintView,bool PutForm) static void DegCfg_Shortcut (bool PrintView) { - Hie_ConfigShortcut (PrintView,"deg",Gbl.Hierarchy.Deg.DegCod); + HieCfg_Shortcut (PrintView,"deg",Gbl.Hierarchy.Deg.DegCod); } /*****************************************************************************/ @@ -313,7 +314,7 @@ static void DegCfg_Shortcut (bool PrintView) static void DegCfg_QR (void) { - Hie_ConfigQR ("deg",Gbl.Hierarchy.Deg.DegCod); + HieCfg_QR ("deg",Gbl.Hierarchy.Deg.DegCod); } /*****************************************************************************/ diff --git a/swad_hierarchy.c b/swad_hierarchy.c index f5b5dfce..c0c4edf5 100644 --- a/swad_hierarchy.c +++ b/swad_hierarchy.c @@ -26,18 +26,12 @@ /*****************************************************************************/ #define _GNU_SOURCE // For asprintf -#include // For fprintf, asprintf, etc. -#include // For free -#include // For string functions +#include // For asprintf -#include "swad_config.h" -#include "swad_degree.h" #include "swad_form.h" #include "swad_global.h" #include "swad_HTML.h" #include "swad_logo.h" -#include "swad_QR.h" -#include "swad_theme.h" /*****************************************************************************/ /************** External global variables from others modules ****************/ @@ -61,196 +55,6 @@ extern struct Globals Gbl; /**************************** Private prototypes *****************************/ /*****************************************************************************/ -/*****************************************************************************/ -/************************ Show title in configuration ************************/ -/*****************************************************************************/ - -void Hie_ConfigTitle (bool PutLink, - Hie_Level_t LogoScope, - long LogoCod, - char LogoShrtName[Hie_MAX_BYTES_SHRT_NAME + 1], - char LogoFullName[Hie_MAX_BYTES_FULL_NAME + 1], - char LogoWWW[Cns_MAX_BYTES_WWW + 1], - char TextFullName[Hie_MAX_BYTES_FULL_NAME + 1]) - { - HTM_DIV_Begin ("class=\"FRAME_TITLE FRAME_TITLE_BIG\""); - if (PutLink) - HTM_A_Begin ("href=\"%s\" target=\"_blank\"" - " class=\"FRAME_TITLE_BIG\" title=\"%s\"", - LogoWWW,LogoFullName); - Lgo_DrawLogo (LogoScope,LogoCod,LogoShrtName,64,NULL,true); - HTM_BR (); - HTM_Txt (TextFullName); - if (PutLink) - HTM_A_End (); - HTM_DIV_End (); - } - -/*****************************************************************************/ -/********************** Show full name in configuration **********************/ -/*****************************************************************************/ - -void Hie_ConfigFullName (bool PutForm,const char *Label,Act_Action_t NextAction, - const char FullName[Hie_MAX_BYTES_FULL_NAME + 1]) - { - /***** Full name *****/ - HTM_TR_Begin (NULL); - - /* Label */ - Frm_LabelColumn ("RT",PutForm ? "FullName" : - NULL, - Label); - - /* Data */ - HTM_TD_Begin ("class=\"DAT_N LB\""); - if (PutForm) - { - /* Form to change full name */ - Frm_StartForm (NextAction); - HTM_INPUT_TEXT ("FullName",Hie_MAX_CHARS_FULL_NAME,FullName,true, - "id=\"FullName\" class=\"INPUT_FULL_NAME\"" - " required=\"required\""); - Frm_EndForm (); - } - else // I can not edit full name - HTM_Txt (FullName); - HTM_TD_End (); - - HTM_TR_End (); - } - -/*****************************************************************************/ -/********* Show institution short name in institution configuration **********/ -/*****************************************************************************/ - -void Hie_ConfigShrtName (bool PutForm,Act_Action_t NextAction, - const char ShrtName[Hie_MAX_BYTES_SHRT_NAME + 1]) - { - extern const char *Txt_Short_name; - - /***** Short name *****/ - HTM_TR_Begin (NULL); - - /* Label */ - Frm_LabelColumn ("RT",PutForm ? "ShortName" : - NULL, - Txt_Short_name); - - /* Data */ - HTM_TD_Begin ("class=\"DAT_N LB\""); - if (PutForm) - { - /* Form to change short name */ - Frm_StartForm (NextAction); - HTM_INPUT_TEXT ("ShortName",Hie_MAX_CHARS_SHRT_NAME,ShrtName,true, - "id=\"ShortName\" class=\"INPUT_SHORT_NAME\"" - " required=\"required\""); - Frm_EndForm (); - } - else // I can not edit short name - HTM_Txt (ShrtName); - HTM_TD_End (); - - HTM_TR_End (); - } - -/*****************************************************************************/ -/************************* Show web in configuration *************************/ -/*****************************************************************************/ - -void Hie_ConfigWWW (bool PrintView,bool PutForm,Act_Action_t NextAction, - const char WWW[Cns_MAX_BYTES_WWW + 1]) - { - extern const char *Txt_Web; - - /***** Web *****/ - HTM_TR_Begin (NULL); - - /* Label */ - Frm_LabelColumn ("RT",PutForm ? "WWW" : - NULL, - Txt_Web); - - /* Data */ - HTM_TD_Begin ("class=\"DAT LB\""); - if (PutForm) - { - /* Form to change web */ - Frm_StartForm (NextAction); - HTM_INPUT_URL ("WWW",WWW,true, - "id=\"WWW\" class=\"INPUT_WWW_WIDE\" required=\"required\""); - Frm_EndForm (); - } - else // I can not change web - { - HTM_DIV_Begin ("class=\"EXTERNAL_WWW_LONG\""); - if (!PrintView) - HTM_A_Begin ("href=\"%s\" target=\"_blank\" class=\"DAT\"",WWW); - HTM_Txt (WWW); - if (!PrintView) - HTM_A_End (); - HTM_DIV_End (); - } - HTM_TD_End (); - - HTM_TR_End (); - } - -/*****************************************************************************/ -/********************** Show shortcut in configuration ***********************/ -/*****************************************************************************/ - -void Hie_ConfigShortcut (bool PrintView,const char *ParamName,long HieCod) - { - extern const char *Lan_STR_LANG_ID[1 + Lan_NUM_LANGUAGES]; - extern const char *Txt_Shortcut; - - /***** Short cut *****/ - HTM_TR_Begin (NULL); - - /* Label */ - Frm_LabelColumn ("RT",NULL,Txt_Shortcut); - - /* Data */ - HTM_TD_Begin ("class=\"DAT LB\""); - if (!PrintView) - HTM_A_Begin ("href=\"%s/%s?%s=%ld\" class=\"DAT\" target=\"_blank\"", - Cfg_URL_SWAD_CGI, - Lan_STR_LANG_ID[Gbl.Prefs.Language], - ParamName,HieCod); - HTM_TxtF ("%s/%s?%s=%ld", - Cfg_URL_SWAD_CGI, - Lan_STR_LANG_ID[Gbl.Prefs.Language], - ParamName,HieCod); - if (!PrintView) - HTM_A_End (); - HTM_TD_End (); - - HTM_TR_End (); - } - -/*****************************************************************************/ -/************************* Show QR in configuration **************************/ -/*****************************************************************************/ - -void Hie_ConfigQR (const char *ParamName,long HieCod) - { - extern const char *Txt_QR_code; - - /***** QR *****/ - HTM_TR_Begin (NULL); - - /* Label */ - Frm_LabelColumn ("RT",NULL,Txt_QR_code); - - /* Data */ - HTM_TD_Begin ("class=\"DAT LB\""); - QR_LinkTo (250,ParamName,HieCod); - HTM_TD_End (); - - HTM_TR_End (); - } - /*****************************************************************************/ /********** List pending institutions, centres, degrees and courses **********/ /*****************************************************************************/ diff --git a/swad_hierarchy.h b/swad_hierarchy.h index f7ef13b0..4fcd4829 100644 --- a/swad_hierarchy.h +++ b/swad_hierarchy.h @@ -60,22 +60,6 @@ typedef enum /***************************** Public prototypes *****************************/ /*****************************************************************************/ -void Hie_ConfigTitle (bool PutLink, - Hie_Level_t LogoScope, - long LogoCod, - char LogoShrtName[Hie_MAX_BYTES_SHRT_NAME + 1], - char LogoFullName[Hie_MAX_BYTES_FULL_NAME + 1], - char LogoWWW[Cns_MAX_BYTES_WWW + 1], - char TextFullName[Hie_MAX_BYTES_FULL_NAME + 1]); -void Hie_ConfigFullName (bool PutForm,const char *Label,Act_Action_t NextAction, - const char FullName[Hie_MAX_BYTES_FULL_NAME + 1]); -void Hie_ConfigShrtName (bool PutForm,Act_Action_t NextAction, - const char ShrtName[Hie_MAX_BYTES_SHRT_NAME + 1]); -void Hie_ConfigWWW (bool PrintView,bool PutForm,Act_Action_t NextAction, - const char WWW[Cns_MAX_BYTES_WWW + 1]); -void Hie_ConfigShortcut (bool PrintView,const char *ParamName,long HieCod); -void Hie_ConfigQR (const char *ParamName,long HieCod); - void Hie_SeePending (void); void Hie_WriteMenuHierarchy (void); diff --git a/swad_hierarchy_config.c b/swad_hierarchy_config.c new file mode 100644 index 00000000..46b804d8 --- /dev/null +++ b/swad_hierarchy_config.c @@ -0,0 +1,247 @@ +// swad_hierarchy_config.c: hierarchy (country, institution, centre, degree, course) configuration + +/* + SWAD (Shared Workspace At a Distance), + is a web platform developed at the University of Granada (Spain), + and used to support university teaching. + + This file is part of SWAD core. + Copyright (C) 1999-2019 Antonio Cañas Vargas + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as + published by the Free Software Foundation, either version 3 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see . +*/ +/*****************************************************************************/ +/********************************* Headers ***********************************/ +/*****************************************************************************/ + +#define _GNU_SOURCE // For asprintf +#include // For asprintf + +#include "swad_form.h" +#include "swad_global.h" +#include "swad_HTML.h" +#include "swad_logo.h" +#include "swad_QR.h" + +/*****************************************************************************/ +/************** External global variables from others modules ****************/ +/*****************************************************************************/ + +extern struct Globals Gbl; + +/*****************************************************************************/ +/*************************** Public constants ********************************/ +/*****************************************************************************/ + +/*****************************************************************************/ +/***************************** Private types *********************************/ +/*****************************************************************************/ + +/*****************************************************************************/ +/**************************** Private constants ******************************/ +/*****************************************************************************/ + +/*****************************************************************************/ +/**************************** Private prototypes *****************************/ +/*****************************************************************************/ + +/*****************************************************************************/ +/************************ Show title in configuration ************************/ +/*****************************************************************************/ + +void HieCfg_Title (bool PutLink, + Hie_Level_t LogoScope, + long LogoCod, + char LogoShrtName[Hie_MAX_BYTES_SHRT_NAME + 1], + char LogoFullName[Hie_MAX_BYTES_FULL_NAME + 1], + char LogoWWW[Cns_MAX_BYTES_WWW + 1], + char TextFullName[Hie_MAX_BYTES_FULL_NAME + 1]) + { + HTM_DIV_Begin ("class=\"FRAME_TITLE FRAME_TITLE_BIG\""); + if (PutLink) + HTM_A_Begin ("href=\"%s\" target=\"_blank\"" + " class=\"FRAME_TITLE_BIG\" title=\"%s\"", + LogoWWW,LogoFullName); + Lgo_DrawLogo (LogoScope,LogoCod,LogoShrtName,64,NULL,true); + HTM_BR (); + HTM_Txt (TextFullName); + if (PutLink) + HTM_A_End (); + HTM_DIV_End (); + } + +/*****************************************************************************/ +/********************** Show full name in configuration **********************/ +/*****************************************************************************/ + +void HieCfg_FullName (bool PutForm,const char *Label,Act_Action_t NextAction, + const char FullName[Hie_MAX_BYTES_FULL_NAME + 1]) + { + /***** Full name *****/ + HTM_TR_Begin (NULL); + + /* Label */ + Frm_LabelColumn ("RT",PutForm ? "FullName" : + NULL, + Label); + + /* Data */ + HTM_TD_Begin ("class=\"DAT_N LB\""); + if (PutForm) + { + /* Form to change full name */ + Frm_StartForm (NextAction); + HTM_INPUT_TEXT ("FullName",Hie_MAX_CHARS_FULL_NAME,FullName,true, + "id=\"FullName\" class=\"INPUT_FULL_NAME\"" + " required=\"required\""); + Frm_EndForm (); + } + else // I can not edit full name + HTM_Txt (FullName); + HTM_TD_End (); + + HTM_TR_End (); + } + +/*****************************************************************************/ +/********* Show institution short name in institution configuration **********/ +/*****************************************************************************/ + +void HieCfg_ShrtName (bool PutForm,Act_Action_t NextAction, + const char ShrtName[Hie_MAX_BYTES_SHRT_NAME + 1]) + { + extern const char *Txt_Short_name; + + /***** Short name *****/ + HTM_TR_Begin (NULL); + + /* Label */ + Frm_LabelColumn ("RT",PutForm ? "ShortName" : + NULL, + Txt_Short_name); + + /* Data */ + HTM_TD_Begin ("class=\"DAT_N LB\""); + if (PutForm) + { + /* Form to change short name */ + Frm_StartForm (NextAction); + HTM_INPUT_TEXT ("ShortName",Hie_MAX_CHARS_SHRT_NAME,ShrtName,true, + "id=\"ShortName\" class=\"INPUT_SHORT_NAME\"" + " required=\"required\""); + Frm_EndForm (); + } + else // I can not edit short name + HTM_Txt (ShrtName); + HTM_TD_End (); + + HTM_TR_End (); + } + +/*****************************************************************************/ +/************************* Show web in configuration *************************/ +/*****************************************************************************/ + +void HieCfg_WWW (bool PrintView,bool PutForm,Act_Action_t NextAction, + const char WWW[Cns_MAX_BYTES_WWW + 1]) + { + extern const char *Txt_Web; + + /***** Web *****/ + HTM_TR_Begin (NULL); + + /* Label */ + Frm_LabelColumn ("RT",PutForm ? "WWW" : + NULL, + Txt_Web); + + /* Data */ + HTM_TD_Begin ("class=\"DAT LB\""); + if (PutForm) + { + /* Form to change web */ + Frm_StartForm (NextAction); + HTM_INPUT_URL ("WWW",WWW,true, + "id=\"WWW\" class=\"INPUT_WWW_WIDE\" required=\"required\""); + Frm_EndForm (); + } + else // I can not change web + { + HTM_DIV_Begin ("class=\"EXTERNAL_WWW_LONG\""); + if (!PrintView) + HTM_A_Begin ("href=\"%s\" target=\"_blank\" class=\"DAT\"",WWW); + HTM_Txt (WWW); + if (!PrintView) + HTM_A_End (); + HTM_DIV_End (); + } + HTM_TD_End (); + + HTM_TR_End (); + } + +/*****************************************************************************/ +/********************** Show shortcut in configuration ***********************/ +/*****************************************************************************/ + +void HieCfg_Shortcut (bool PrintView,const char *ParamName,long HieCod) + { + extern const char *Lan_STR_LANG_ID[1 + Lan_NUM_LANGUAGES]; + extern const char *Txt_Shortcut; + + /***** Short cut *****/ + HTM_TR_Begin (NULL); + + /* Label */ + Frm_LabelColumn ("RT",NULL,Txt_Shortcut); + + /* Data */ + HTM_TD_Begin ("class=\"DAT LB\""); + if (!PrintView) + HTM_A_Begin ("href=\"%s/%s?%s=%ld\" class=\"DAT\" target=\"_blank\"", + Cfg_URL_SWAD_CGI, + Lan_STR_LANG_ID[Gbl.Prefs.Language], + ParamName,HieCod); + HTM_TxtF ("%s/%s?%s=%ld", + Cfg_URL_SWAD_CGI, + Lan_STR_LANG_ID[Gbl.Prefs.Language], + ParamName,HieCod); + if (!PrintView) + HTM_A_End (); + HTM_TD_End (); + + HTM_TR_End (); + } + +/*****************************************************************************/ +/************************* Show QR in configuration **************************/ +/*****************************************************************************/ + +void HieCfg_QR (const char *ParamName,long HieCod) + { + extern const char *Txt_QR_code; + + /***** QR *****/ + HTM_TR_Begin (NULL); + + /* Label */ + Frm_LabelColumn ("RT",NULL,Txt_QR_code); + + /* Data */ + HTM_TD_Begin ("class=\"DAT LB\""); + QR_LinkTo (250,ParamName,HieCod); + HTM_TD_End (); + + HTM_TR_End (); + } diff --git a/swad_hierarchy_config.h b/swad_hierarchy_config.h new file mode 100644 index 00000000..559ca583 --- /dev/null +++ b/swad_hierarchy_config.h @@ -0,0 +1,58 @@ +// swad_hierarchy_config.h: hierarchy (country, institution, centre, degree, course) configuration + +#ifndef _SWAD_HIE_CFG +#define _SWAD_HIE_CFG +/* + SWAD (Shared Workspace At a Distance in Spanish), + is a web platform developed at the University of Granada (Spain), + and used to support university teaching. + + This file is part of SWAD core. + Copyright (C) 1999-2019 Antonio Cañas Vargas + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as + published by the Free Software Foundation, either version 3 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see . +*/ +/*****************************************************************************/ +/********************************* Headers ***********************************/ +/*****************************************************************************/ + +/*****************************************************************************/ +/***************************** Public constants ******************************/ +/*****************************************************************************/ + +/*****************************************************************************/ +/******************************* Public types ********************************/ +/*****************************************************************************/ + +/*****************************************************************************/ +/***************************** Public prototypes *****************************/ +/*****************************************************************************/ + +void HieCfg_Title (bool PutLink, + Hie_Level_t LogoScope, + long LogoCod, + char LogoShrtName[Hie_MAX_BYTES_SHRT_NAME + 1], + char LogoFullName[Hie_MAX_BYTES_FULL_NAME + 1], + char LogoWWW[Cns_MAX_BYTES_WWW + 1], + char TextFullName[Hie_MAX_BYTES_FULL_NAME + 1]); +void HieCfg_FullName (bool PutForm,const char *Label,Act_Action_t NextAction, + const char FullName[Hie_MAX_BYTES_FULL_NAME + 1]); +void HieCfg_ShrtName (bool PutForm,Act_Action_t NextAction, + const char ShrtName[Hie_MAX_BYTES_SHRT_NAME + 1]); +void HieCfg_WWW (bool PrintView,bool PutForm,Act_Action_t NextAction, + const char WWW[Cns_MAX_BYTES_WWW + 1]); +void HieCfg_Shortcut (bool PrintView,const char *ParamName,long HieCod); +void HieCfg_QR (const char *ParamName,long HieCod); + +#endif diff --git a/swad_institution_config.c b/swad_institution_config.c index 654f20f3..8554380f 100644 --- a/swad_institution_config.c +++ b/swad_institution_config.c @@ -32,6 +32,7 @@ #include "swad_form.h" #include "swad_global.h" #include "swad_help.h" +#include "swad_hierarchy_config.h" #include "swad_HTML.h" #include "swad_institution.h" #include "swad_logo.h" @@ -222,7 +223,7 @@ static void InsCfg_PutIconsToPrintAndUpload (void) static void InsCfg_Title (bool PutLink) { - Hie_ConfigTitle (PutLink, + HieCfg_Title (PutLink, Hie_INS, // Logo scope Gbl.Hierarchy.Ins.InsCod, // Logo code Gbl.Hierarchy.Ins.ShrtName, // Logo short name @@ -387,7 +388,7 @@ static void InsCfg_FullName (bool PutForm) { extern const char *Txt_Institution; - Hie_ConfigFullName (PutForm,Txt_Institution,ActRenInsFulCfg, + HieCfg_FullName (PutForm,Txt_Institution,ActRenInsFulCfg, Gbl.Hierarchy.Ins.FullName); } @@ -397,7 +398,7 @@ static void InsCfg_FullName (bool PutForm) static void InsCfg_ShrtName (bool PutForm) { - Hie_ConfigShrtName (PutForm,ActRenInsShoCfg,Gbl.Hierarchy.Ins.ShrtName); + HieCfg_ShrtName (PutForm,ActRenInsShoCfg,Gbl.Hierarchy.Ins.ShrtName); } /*****************************************************************************/ @@ -406,7 +407,7 @@ static void InsCfg_ShrtName (bool PutForm) static void InsCfg_WWW (bool PrintView,bool PutForm) { - Hie_ConfigWWW (PrintView,PutForm,ActChgInsWWWCfg,Gbl.Hierarchy.Ins.WWW); + HieCfg_WWW (PrintView,PutForm,ActChgInsWWWCfg,Gbl.Hierarchy.Ins.WWW); } /*****************************************************************************/ @@ -415,7 +416,7 @@ static void InsCfg_WWW (bool PrintView,bool PutForm) static void InsCfg_Shortcut (bool PrintView) { - Hie_ConfigShortcut (PrintView,"ins",Gbl.Hierarchy.Ins.InsCod); + HieCfg_Shortcut (PrintView,"ins",Gbl.Hierarchy.Ins.InsCod); } /*****************************************************************************/ @@ -424,7 +425,7 @@ static void InsCfg_Shortcut (bool PrintView) static void InsCfg_QR (void) { - Hie_ConfigQR ("ins",Gbl.Hierarchy.Ins.InsCod); + HieCfg_QR ("ins",Gbl.Hierarchy.Ins.InsCod); } /*****************************************************************************/