From dc9403695dca7c34383855c4f4d5507ed5e4b51a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Ca=C3=B1as=20Vargas?= Date: Thu, 26 Dec 2019 20:36:01 +0100 Subject: [PATCH] Version19.97.12 --- swad_centre.c | 40 ++++------------------------------ swad_changelog.h | 7 +++--- swad_course.c | 41 ++++------------------------------- swad_degree.c | 40 ++++------------------------------ swad_hierarchy.c | 54 ++++++++++++++++++++++++++++++++++++++++++++++ swad_hierarchy.h | 6 ++++++ swad_institution.c | 40 ++++------------------------------ 7 files changed, 80 insertions(+), 148 deletions(-) diff --git a/swad_centre.c b/swad_centre.c index 7b5a3e227..b48554bd5 100644 --- a/swad_centre.c +++ b/swad_centre.c @@ -737,24 +737,8 @@ static void Ctr_ConfigFullName (bool PutForm) { extern const char *Txt_Centre; - HTM_TR_Begin (NULL); - - Hie_ConfigLabel ("FullName",Txt_Centre); - - HTM_TD_Begin ("class=\"DAT_N LM\""); - if (PutForm) - { - /* Form to change centre full name */ - Frm_StartForm (ActRenCtrFulCfg); - HTM_INPUT_TEXT ("FullName",Hie_MAX_CHARS_FULL_NAME,Gbl.Hierarchy.Ctr.FullName,true, - "id=\"FullName\" class=\"INPUT_FULL_NAME\""); - Frm_EndForm (); - } - else // I can not edit centre full name - HTM_Txt (Gbl.Hierarchy.Ctr.FullName); - HTM_TD_End (); - - HTM_TR_End (); + Hie_ConfigFullName (PutForm,Txt_Centre,ActRenCtrFulCfg, + Gbl.Hierarchy.Ctr.FullName); } /*****************************************************************************/ @@ -765,24 +749,8 @@ static void Ctr_ConfigShrtName (bool PutForm) { extern const char *Txt_Short_name; - HTM_TR_Begin (NULL); - - Hie_ConfigLabel ("ShortName",Txt_Short_name); - - HTM_TD_Begin ("class=\"DAT_N LM\""); - if (PutForm) - { - /* Form to change centre short name */ - Frm_StartForm (ActRenCtrShoCfg); - HTM_INPUT_TEXT ("ShortName",Hie_MAX_CHARS_SHRT_NAME,Gbl.Hierarchy.Ctr.ShrtName,true, - "id=\"ShortName\" class=\"INPUT_SHORT_NAME\""); - Frm_EndForm (); - } - else // I can not edit centre short name - HTM_Txt (Gbl.Hierarchy.Ctr.ShrtName); - HTM_TD_End (); - - HTM_TR_End (); + Hie_ConfigShrtName (PutForm,Txt_Short_name,ActRenCtrShoCfg, + Gbl.Hierarchy.Ctr.ShrtName); } /*****************************************************************************/ diff --git a/swad_changelog.h b/swad_changelog.h index 70fbef4c0..8848e6c15 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.97.11 (2019-12-26)" +#define Log_PLATFORM_VERSION "SWAD 19.97.12 (2019-12-26)" #define CSS_FILE "swad19.97.css" #define JS_FILE "swad19.91.1.js" /* @@ -502,8 +502,9 @@ ps2pdf source.ps destination.pdf Version 19.99: Dec 26, 2019 Map in country information. (? lines) Version 19.98: Dec 26, 2019 Map in institution information. (? lines) - Version 19.97.12: Dec 26, 2019 Code refactoring in country information. (? lines) - Version 19.97.11: Dec 26, 2019 Code refactoring in degree, centre and institution information. (249353 lines) + Version 19.97.13: Dec 26, 2019 Code refactoring in country information. (? lines) + Version 19.97.12: Dec 26, 2019 Code refactoring in course, degree, centre and institution information. (249298 lines) + Version 19.97.11: Dec 26, 2019 Code refactoring in course, degree, centre and institution information. (249353 lines) Version 19.97.10: Dec 26, 2019 Code refactoring in course, degree, centre and institution information. (249394 lines) Version 19.97.9: Dec 26, 2019 Code refactoring in course information. (249557 lines) Version 19.97.8: Dec 26, 2019 Code refactoring in degree information. (249458 lines) diff --git a/swad_course.c b/swad_course.c index 7d9007ad2..f86205db8 100644 --- a/swad_course.c +++ b/swad_course.c @@ -342,24 +342,8 @@ static void Crs_ConfigFullName (bool PutForm) { extern const char *Txt_Course; - HTM_TR_Begin (NULL); - - Hie_ConfigLabel ("FullName",Txt_Course); - - HTM_TD_Begin ("class=\"DAT_N LM\""); - if (PutForm) - { - /* Form to change course full name */ - Frm_StartForm (ActRenCrsFulCfg); - HTM_INPUT_TEXT ("FullName",Hie_MAX_CHARS_FULL_NAME,Gbl.Hierarchy.Crs.FullName,true, - "id=\"FullName\" class=\"INPUT_FULL_NAME\""); - Frm_EndForm (); - } - else // I can not edit course full name - HTM_Txt (Gbl.Hierarchy.Crs.FullName); - HTM_TD_End (); - - HTM_TR_End (); + Hie_ConfigFullName (PutForm,Txt_Course,ActRenCrsFulCfg, + Gbl.Hierarchy.Crs.FullName); } /*****************************************************************************/ @@ -370,25 +354,8 @@ static void Crs_ConfigShrtName (bool PutForm) { extern const char *Txt_Short_name; - /***** Course short name *****/ - HTM_TR_Begin (NULL); - - Hie_ConfigLabel ("ShortName",Txt_Short_name); - - HTM_TD_Begin ("class=\"DAT_N LM\""); - if (PutForm) - { - /* Form to change course short name */ - Frm_StartForm (ActRenCrsShoCfg); - HTM_INPUT_TEXT ("ShortName",Hie_MAX_CHARS_SHRT_NAME,Gbl.Hierarchy.Crs.ShrtName,true, - "id=\"ShortName\" class=\"INPUT_SHORT_NAME\""); - Frm_EndForm (); - } - else // I can not edit course short name - HTM_Txt (Gbl.Hierarchy.Crs.ShrtName); - HTM_TD_End (); - - HTM_TR_End (); + Hie_ConfigShrtName (PutForm,Txt_Short_name,ActRenCrsShoCfg, + Gbl.Hierarchy.Crs.ShrtName); } /*****************************************************************************/ diff --git a/swad_degree.c b/swad_degree.c index 7fb847fce..18aeb88f8 100644 --- a/swad_degree.c +++ b/swad_degree.c @@ -449,24 +449,8 @@ static void Deg_ConfigFullName (bool PutForm) { extern const char *Txt_Degree; - HTM_TR_Begin (NULL); - - Hie_ConfigLabel ("FullName",Txt_Degree); - - HTM_TD_Begin ("class=\"DAT_N LM\""); - if (PutForm) - { - /* Form to change degree full name */ - Frm_StartForm (ActRenDegFulCfg); - HTM_INPUT_TEXT ("FullName",Hie_MAX_CHARS_FULL_NAME,Gbl.Hierarchy.Deg.FullName,true, - "id=\"FullName\" class=\"INPUT_FULL_NAME\""); - Frm_EndForm (); - } - else // I can not edit degree full name - HTM_Txt (Gbl.Hierarchy.Deg.FullName); - HTM_TD_End (); - - HTM_TR_End (); + Hie_ConfigFullName (PutForm,Txt_Degree,ActRenDegFulCfg, + Gbl.Hierarchy.Deg.FullName); } /*****************************************************************************/ @@ -477,24 +461,8 @@ static void Deg_ConfigShrtName (bool PutForm) { extern const char *Txt_Short_name; - HTM_TR_Begin (NULL); - - Hie_ConfigLabel ("ShortName",Txt_Short_name); - - HTM_TD_Begin ("class=\"DAT_N LM\""); - if (PutForm) - { - /* Form to change degree short name */ - Frm_StartForm (ActRenDegShoCfg); - HTM_INPUT_TEXT ("ShortName",Hie_MAX_CHARS_SHRT_NAME,Gbl.Hierarchy.Deg.ShrtName,true, - "id=\"ShortName\" class=\"INPUT_SHORT_NAME\""); - Frm_EndForm (); - } - else // I can not edit degree short name - HTM_Txt (Gbl.Hierarchy.Deg.ShrtName); - HTM_TD_End (); - - HTM_TR_End (); + Hie_ConfigShrtName (PutForm,Txt_Short_name,ActRenDegShoCfg, + Gbl.Hierarchy.Deg.ShrtName); } /*****************************************************************************/ diff --git a/swad_hierarchy.c b/swad_hierarchy.c index 87aa405d7..53e60508d 100644 --- a/swad_hierarchy.c +++ b/swad_hierarchy.c @@ -105,6 +105,60 @@ void Hie_ConfigLabel (const char *Id,const char *Label) HTM_TD_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]) + { + HTM_TR_Begin (NULL); + + Hie_ConfigLabel ("FullName",Label); + + HTM_TD_Begin ("class=\"DAT_N LM\""); + 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\""); + 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,const char *Label,Act_Action_t NextAction, + const char ShrtName[Hie_MAX_BYTES_SHRT_NAME + 1]) + { + HTM_TR_Begin (NULL); + + Hie_ConfigLabel ("ShortName",Label); + + HTM_TD_Begin ("class=\"DAT_N LM\""); + 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\""); + Frm_EndForm (); + } + else // I can not edit short name + HTM_Txt (ShrtName); + HTM_TD_End (); + + HTM_TR_End (); + } + /*****************************************************************************/ /************************* Show web in configuration *************************/ /*****************************************************************************/ diff --git a/swad_hierarchy.h b/swad_hierarchy.h index 712b99640..8642bc05f 100644 --- a/swad_hierarchy.h +++ b/swad_hierarchy.h @@ -27,6 +27,8 @@ /********************************* Headers ***********************************/ /*****************************************************************************/ +#include "swad_action.h" + /*****************************************************************************/ /***************************** Public constants ******************************/ /*****************************************************************************/ @@ -66,6 +68,10 @@ void Hie_ConfigTitle (bool PutLink, char LogoWWW[Cns_MAX_BYTES_WWW + 1], char TextFullName[Hie_MAX_BYTES_FULL_NAME + 1]); void Hie_ConfigLabel (const char *Id,const char *Label); +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,const char *Label,Act_Action_t NextAction, + const char ShrtName[Hie_MAX_BYTES_SHRT_NAME + 1]); void Hie_ConfigWWW (bool PutForm,Act_Action_t NextAction, const char WWW[Cns_MAX_BYTES_WWW + 1]); diff --git a/swad_institution.c b/swad_institution.c index 0b0da46a1..dd471883a 100644 --- a/swad_institution.c +++ b/swad_institution.c @@ -555,24 +555,8 @@ static void Ins_ConfigFullName (bool PutForm) { extern const char *Txt_Institution; - HTM_TR_Begin (NULL); - - Hie_ConfigLabel ("FullName",Txt_Institution); - - HTM_TD_Begin ("class=\"DAT_N LM\""); - if (PutForm) - { - /* Form to change institution full name */ - Frm_StartForm (ActRenInsFulCfg); - HTM_INPUT_TEXT ("FullName",Hie_MAX_CHARS_FULL_NAME,Gbl.Hierarchy.Ins.FullName,true, - "id=\"FullName\" class=\"INPUT_FULL_NAME\""); - Frm_EndForm (); - } - else // I can not edit institution full name - HTM_Txt (Gbl.Hierarchy.Ins.FullName); - HTM_TD_End (); - - HTM_TR_End (); + Hie_ConfigFullName (PutForm,Txt_Institution,ActRenInsFulCfg, + Gbl.Hierarchy.Ins.FullName); } /*****************************************************************************/ @@ -583,24 +567,8 @@ static void Ins_ConfigShrtName (bool PutForm) { extern const char *Txt_Short_name; - HTM_TR_Begin (NULL); - - Hie_ConfigLabel ("ShortName",Txt_Short_name); - - HTM_TD_Begin ("class=\"DAT_N LM\""); - if (PutForm) - { - /* Form to change institution short name */ - Frm_StartForm (ActRenInsShoCfg); - HTM_INPUT_TEXT ("ShortName",Hie_MAX_CHARS_SHRT_NAME,Gbl.Hierarchy.Ins.ShrtName,true, - "id=\"ShortName\" class=\"INPUT_SHORT_NAME\""); - Frm_EndForm (); - } - else // I can not edit institution short name - HTM_Txt (Gbl.Hierarchy.Ins.ShrtName); - HTM_TD_End (); - - HTM_TR_End (); + Hie_ConfigShrtName (PutForm,Txt_Short_name,ActRenInsShoCfg, + Gbl.Hierarchy.Ins.ShrtName); } /*****************************************************************************/