diff --git a/css/swad19.99.1.css b/css/swad19.101.1.css similarity index 99% rename from css/swad19.99.1.css rename to css/swad19.101.1.css index 4d998a1c3..777a6ebb8 100644 --- a/css/swad19.99.1.css +++ b/css/swad19.101.1.css @@ -1308,6 +1308,14 @@ a:hover /* Default ==> underlined */ width:600px; margin:12px auto; } + +.HIE_CFG_LEFT, .HIE_CFG_RIGHT + { + display:inline-block; + margin:0 6px; + vertical-align:top; + width:480px; + } /*********************************** Places **********************************/ .PLC_SEL @@ -1991,8 +1999,9 @@ table.CELLS_PAD_10 > tbody > tr > td {padding:10px;} .CENTRE_PHOTO_SHOW { box-sizing:border-box; - width:480px; - padding:6px; margin:9px; + width:460px; + padding:2px; + margin:9px auto; border:solid 1px #EEE; } a:hover img.CENTRE_PHOTO_SHOW @@ -2003,17 +2012,18 @@ a:hover img.CENTRE_PHOTO_SHOW .CENTRE_PHOTO_PRINT { box-sizing:border-box; - width:600px; - padding:10px; margin:15px; + width:460px; + padding:2px; + margin:9px auto; border:solid 1px #EEE; box-shadow:1px 1px 6px #999; } #centre_mapid { - width:480px; - height:360px; - margin:0 auto; + width:460px; + height:345px; + margin:9px auto; } /**************** Attribution (author and license) of images *****************/ @@ -2402,7 +2412,12 @@ a:hover img.CENTRE_PHOTO_SHOW width:358px; } -.REC_HEAD {font-family:Georgia,"DejaVu LGC Serif","Bitstream Vera Serif",serif; color:#808080; font-size:12pt;} +.REC_HEAD + { + font-family:Georgia,"DejaVu LGC Serif","Bitstream Vera Serif",serif; + color:#808080; + font-size:12pt; + } .REC_NAME { box-sizing:border-box; @@ -3918,40 +3933,49 @@ a.PAG:hover, .PAG_CUR /************* Forms to edit institution, centre, degree, course *************/ .CODE { + box-sizing:border-box; min-width:60px; text-align:right; vertical-align:middle; } .INPUT_INS_CODE { + box-sizing:border-box; width:90px; } .INPUT_SHORT_NAME { + box-sizing:border-box; width:180px; } .INPUT_FULL_NAME { + box-sizing:border-box; width:180px; } .INPUT_WWW_NARROW { + box-sizing:border-box; width:90px; } .INPUT_WWW_WIDE { + box-sizing:border-box; width:180px; } .INPUT_COORD { + box-sizing:border-box; width:180px; } .INPUT_STATUS { + box-sizing:border-box; width:80px; } .INPUT_REQUESTER { + box-sizing:border-box; width:90px; } diff --git a/swad_centre.c b/swad_centre.c index eefab223a..f37ee41b4 100644 --- a/swad_centre.c +++ b/swad_centre.c @@ -92,7 +92,8 @@ static void Ctr_ConfigMap (void); static void Ctr_ConfigLatitude (void); static void Ctr_ConfigLongitude (void); static void Ctr_ConfigAltitude (void); -static void Ctr_ConfigPhoto (bool PrintView,bool PutLink); +static void Ctr_ConfigPhoto (bool PrintView,bool PutForm,bool PutLink, + const char PathPhoto[PATH_MAX + 1]); static void Ctr_ConfigInstitution (bool PrintView,bool PutForm); static void Ctr_ConfigFullName (bool PutForm); static void Ctr_ConfigShrtName (bool PutForm); @@ -317,18 +318,23 @@ static void Ctr_Configuration (bool PrintView) bool PutFormPlc; bool PutFormCoor; bool PutFormWWW; + bool PutFormPhoto; + bool MapIsAvailable; + char PathPhoto[PATH_MAX + 1]; + bool PhotoExists; /***** Trivial check *****/ if (Gbl.Hierarchy.Ctr.CtrCod <= 0) // No centre selected return; /***** Initializations *****/ - PutLink = !PrintView && Gbl.Hierarchy.Ctr.WWW[0]; - PutFormIns = !PrintView && Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM; - PutFormName = !PrintView && Gbl.Usrs.Me.Role.Logged >= Rol_INS_ADM; - PutFormPlc = - PutFormCoor = - PutFormWWW = !PrintView && Gbl.Usrs.Me.Role.Logged >= Rol_CTR_ADM; + PutLink = !PrintView && Gbl.Hierarchy.Ctr.WWW[0]; + PutFormIns = !PrintView && Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM; + PutFormName = !PrintView && Gbl.Usrs.Me.Role.Logged >= Rol_INS_ADM; + PutFormPlc = + PutFormCoor = + PutFormWWW = + PutFormPhoto = !PrintView && Gbl.Usrs.Me.Role.Logged >= Rol_CTR_ADM; /***** Begin box *****/ if (PrintView) @@ -341,12 +347,8 @@ static void Ctr_Configuration (bool PrintView) /***** Title *****/ Ctr_ConfigTitle (PutLink); - /***** Centre map *****/ - if (Ctr_GetIfMapIsAvailable ()) - Ctr_ConfigMap (); - - /***** Centre photo *****/ - Ctr_ConfigPhoto (PrintView,PutLink); + /**************************** Left part ***********************************/ + HTM_DIV_Begin ("class=\"HIE_CFG_LEFT\""); /***** Begin table *****/ HTM_TABLE_BeginWidePadding (2); @@ -397,6 +399,36 @@ static void Ctr_Configuration (bool PrintView) /***** End table *****/ HTM_TABLE_End (); + HTM_DIV_End (); + + /**************************** Right part **********************************/ + /***** Check map *****/ + MapIsAvailable = Ctr_GetIfMapIsAvailable (); + + /***** Check photo *****/ + snprintf (PathPhoto,sizeof (PathPhoto), + "%s/%02u/%u/%u.jpg", + Cfg_PATH_CTR_PUBLIC, + (unsigned) (Gbl.Hierarchy.Ctr.CtrCod % 100), + (unsigned) Gbl.Hierarchy.Ctr.CtrCod, + (unsigned) Gbl.Hierarchy.Ctr.CtrCod); + PhotoExists = Fil_CheckIfPathExists (PathPhoto); + + if (MapIsAvailable || PhotoExists) + { + HTM_DIV_Begin ("class=\"HIE_CFG_RIGHT\""); + + /***** Centre map *****/ + if (MapIsAvailable) + Ctr_ConfigMap (); + + /***** Centre photo *****/ + if (PhotoExists) + Ctr_ConfigPhoto (PrintView,PutFormPhoto,PutLink,PathPhoto); + + HTM_DIV_End (); + } + /***** End box *****/ Box_BoxEnd (); } @@ -550,10 +582,10 @@ static void Ctr_ConfigLatitude (void) HTM_TR_Begin (NULL); /* Label */ - Frm_LabelColumn ("RM","Latitude",Txt_Latitude); + Frm_LabelColumn ("RT","Latitude",Txt_Latitude); /* Data */ - HTM_TD_Begin ("class=\"LM\""); + HTM_TD_Begin ("class=\"LB\""); Frm_StartForm (ActChgCtrLatCfg); HTM_INPUT_FLOAT ("Latitude", -90.0, // South Pole @@ -575,10 +607,10 @@ static void Ctr_ConfigLongitude (void) HTM_TR_Begin (NULL); /* Label */ - Frm_LabelColumn ("RM","Longitude",Txt_Longitude); + Frm_LabelColumn ("RT","Longitude",Txt_Longitude); /* Data */ - HTM_TD_Begin ("class=\"LM\""); + HTM_TD_Begin ("class=\"LB\""); Frm_StartForm (ActChgCtrLgtCfg); HTM_INPUT_FLOAT ("Longitude", -180.0, // West @@ -600,10 +632,10 @@ static void Ctr_ConfigAltitude (void) HTM_TR_Begin (NULL); /* Label */ - Frm_LabelColumn ("RM","Altitude",Txt_Altitude); + Frm_LabelColumn ("RT","Altitude",Txt_Altitude); /* Data */ - HTM_TD_Begin ("class=\"LM\""); + HTM_TD_Begin ("class=\"LB\""); Frm_StartForm (ActChgCtrAltCfg); HTM_INPUT_FLOAT ("Altitude", -413.0, // Dead Sea shore @@ -621,78 +653,67 @@ static void Ctr_ConfigAltitude (void) /***************************** Draw centre photo *****************************/ /*****************************************************************************/ -static void Ctr_ConfigPhoto (bool PrintView,bool PutLink) +static void Ctr_ConfigPhoto (bool PrintView,bool PutForm,bool PutLink, + const char PathPhoto[PATH_MAX + 1]) { - char PathPhoto[PATH_MAX + 1]; - bool PhotoExists; char *PhotoAttribution = NULL; char *URL; char *Icon; - /***** Path to photo *****/ - snprintf (PathPhoto,sizeof (PathPhoto), - "%s/%02u/%u/%u.jpg", - Cfg_PATH_CTR_PUBLIC, - (unsigned) (Gbl.Hierarchy.Ctr.CtrCod % 100), - (unsigned) Gbl.Hierarchy.Ctr.CtrCod, - (unsigned) Gbl.Hierarchy.Ctr.CtrCod); - PhotoExists = Fil_CheckIfPathExists (PathPhoto); + /***** Trivial checks *****/ + if (!PathPhoto) + return; + if (!PathPhoto[0]) + return; - /***** Centre photo *****/ - if (PhotoExists) + /***** Get photo attribution *****/ + Ctr_GetPhotoAttribution (Gbl.Hierarchy.Ctr.CtrCod,&PhotoAttribution); + + /***** Photo image *****/ + HTM_DIV_Begin ("class=\"DAT_SMALL CM\""); + if (PutLink) + HTM_A_Begin ("href=\"%s\" target=\"_blank\" class=\"DAT_N\"", + Gbl.Hierarchy.Ctr.WWW); + if (asprintf (&URL,"%s/%02u/%u", + Cfg_URL_CTR_PUBLIC, + (unsigned) (Gbl.Hierarchy.Ctr.CtrCod % 100), + (unsigned) Gbl.Hierarchy.Ctr.CtrCod) < 0) + Lay_NotEnoughMemoryExit (); + if (asprintf (&Icon,"%u.jpg", + (unsigned) Gbl.Hierarchy.Ctr.CtrCod) < 0) + Lay_NotEnoughMemoryExit (); + HTM_IMG (URL,Icon,Gbl.Hierarchy.Ctr.FullName, + "class=\"%s\"",PrintView ? "CENTRE_PHOTO_PRINT" : + "CENTRE_PHOTO_SHOW"); + free (Icon); + free (URL); + if (PutLink) + HTM_A_End (); + HTM_DIV_End (); + + /****** Photo attribution ******/ + if (PutForm) { - /* Get photo attribution */ - Ctr_GetPhotoAttribution (Gbl.Hierarchy.Ctr.CtrCod,&PhotoAttribution); - - /* Photo image */ - HTM_DIV_Begin ("class=\"DAT_SMALL CM\""); - if (PutLink) - HTM_A_Begin ("href=\"%s\" target=\"_blank\" class=\"DAT_N\"", - Gbl.Hierarchy.Ctr.WWW); - if (asprintf (&URL,"%s/%02u/%u", - Cfg_URL_CTR_PUBLIC, - (unsigned) (Gbl.Hierarchy.Ctr.CtrCod % 100), - (unsigned) Gbl.Hierarchy.Ctr.CtrCod) < 0) - Lay_NotEnoughMemoryExit (); - if (asprintf (&Icon,"%u.jpg", - (unsigned) Gbl.Hierarchy.Ctr.CtrCod) < 0) - Lay_NotEnoughMemoryExit (); - HTM_IMG (URL,Icon,Gbl.Hierarchy.Ctr.FullName, - "class=\"%s\"",PrintView ? "CENTRE_PHOTO_PRINT" : - "CENTRE_PHOTO_SHOW"); - free (Icon); - free (URL); - if (PutLink) - HTM_A_End (); - HTM_DIV_End (); - - /* Photo attribution */ - if (!PrintView && - Gbl.Usrs.Me.Role.Logged >= Rol_CTR_ADM) - // Only centre admins, institution admins and centre admins - // have permission to edit photo attribution - { - HTM_DIV_Begin ("class=\"CM\""); - Frm_StartForm (ActChgCtrPhoAtt); - HTM_TEXTAREA_Begin ("id=\"AttributionArea\" name=\"Attribution\" rows=\"2\"" - " onchange=\"document.getElementById('%s').submit();return false;\"", - Gbl.Form.Id); - if (PhotoAttribution) - HTM_Txt (PhotoAttribution); - HTM_TEXTAREA_End (); - Frm_EndForm (); - HTM_DIV_End (); - } - else if (PhotoAttribution) - { - HTM_DIV_Begin ("class=\"ATTRIBUTION\""); + HTM_DIV_Begin ("class=\"CM\""); + Frm_StartForm (ActChgCtrPhoAtt); + HTM_TEXTAREA_Begin ("id=\"AttributionArea\" name=\"Attribution\" rows=\"2\"" + " onchange=\"document.getElementById('%s').submit();return false;\"", + Gbl.Form.Id); + if (PhotoAttribution) HTM_Txt (PhotoAttribution); - HTM_DIV_End (); - } - - /* Free memory used for photo attribution */ - Ctr_FreePhotoAttribution (&PhotoAttribution); + HTM_TEXTAREA_End (); + Frm_EndForm (); + HTM_DIV_End (); } + else if (PhotoAttribution) + { + HTM_DIV_Begin ("class=\"ATTRIBUTION\""); + HTM_Txt (PhotoAttribution); + HTM_DIV_End (); + } + + /****** Free memory used for photo attribution ******/ + Ctr_FreePhotoAttribution (&PhotoAttribution); } /*****************************************************************************/ @@ -709,12 +730,12 @@ static void Ctr_ConfigInstitution (bool PrintView,bool PutForm) HTM_TR_Begin (NULL); /* Label */ - Frm_LabelColumn ("RM",PutForm ? "OthInsCod" : + Frm_LabelColumn ("RT",PutForm ? "OthInsCod" : NULL, Txt_Institution); /* Data */ - HTM_TD_Begin ("class=\"DAT LM\""); + HTM_TD_Begin ("class=\"DAT LB\""); if (PutForm) { /* Get list of institutions of the current country */ @@ -803,12 +824,12 @@ static void Ctr_ConfigPlace (bool PutForm) HTM_TR_Begin (NULL); /* Label */ - Frm_LabelColumn ("RM",PutForm ? "PlcCod" : + Frm_LabelColumn ("RT",PutForm ? "PlcCod" : NULL, Txt_Place); /* Data */ - HTM_TD_Begin ("class=\"DAT LM\""); + HTM_TD_Begin ("class=\"DAT LB\""); if (PutForm) { /* Get list of places of the current institution */ @@ -880,10 +901,10 @@ static void Ctr_ConfigNumUsrs (void) HTM_TR_Begin (NULL); /* Label */ - Frm_LabelColumn ("RM",NULL,Txt_Users_of_the_centre); + Frm_LabelColumn ("RT",NULL,Txt_Users_of_the_centre); /* Data */ - HTM_TD_Begin ("class=\"DAT LM\""); + HTM_TD_Begin ("class=\"DAT LB\""); HTM_Unsigned (Usr_GetNumUsrsWhoClaimToBelongToCtr (Gbl.Hierarchy.Ctr.CtrCod)); HTM_TD_End (); @@ -903,10 +924,10 @@ static void Ctr_ConfigNumDegs (void) HTM_TR_Begin (NULL); /* Label */ - Frm_LabelColumn ("RM",NULL,Txt_Degrees); + Frm_LabelColumn ("RT",NULL,Txt_Degrees); /* Data */ - HTM_TD_Begin ("class=\"LM\""); + HTM_TD_Begin ("class=\"LB\""); Frm_StartFormGoTo (ActSeeDeg); Ctr_PutParamCtrCod (Gbl.Hierarchy.Ctr.CtrCod); snprintf (Gbl.Title,sizeof (Gbl.Title), @@ -933,10 +954,10 @@ static void Ctr_ConfigNumCrss (void) HTM_TR_Begin (NULL); /* Label */ - Frm_LabelColumn ("RM",NULL,Txt_Courses); + Frm_LabelColumn ("RT",NULL,Txt_Courses); /* Data */ - HTM_TD_Begin ("class=\"DAT LM\""); + HTM_TD_Begin ("class=\"DAT LB\""); HTM_Unsigned (Crs_GetNumCrssInCtr (Gbl.Hierarchy.Ctr.CtrCod)); HTM_TD_End (); @@ -956,12 +977,12 @@ static void Ctr_ShowNumUsrsInCrssOfCtr (Rol_Role_t Role) HTM_TR_Begin (NULL); /* Label */ - Frm_LabelColumn ("RM",NULL, + Frm_LabelColumn ("RT",NULL, Role == Rol_UNK ? Txt_Users_in_courses : Txt_ROLES_PLURAL_Abc[Role][Usr_SEX_UNKNOWN]); /* Data */ - HTM_TD_Begin ("class=\"DAT LM\""); + HTM_TD_Begin ("class=\"DAT LB\""); HTM_Unsigned (Usr_GetNumUsrsInCrssOfCtr (Role,Gbl.Hierarchy.Ctr.CtrCod)); HTM_TD_End (); diff --git a/swad_changelog.h b/swad_changelog.h index a054cacb1..2e6951beb 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -492,16 +492,17 @@ enscript -2 --landscape --color --file-align=2 --highlight --line-numbers -o - * En OpenSWAD: ps2pdf source.ps destination.pdf */ -#define Log_PLATFORM_VERSION "SWAD 19.101 (2019-12-27)" -#define CSS_FILE "swad19.99.1.css" +#define Log_PLATFORM_VERSION "SWAD 19.101.1 (2019-12-28)" +#define CSS_FILE "swad19.101.1.css" #define JS_FILE "swad19.91.1.js" /* // TODO: Hacer un nuevo rol en los TFG: tutor externo (profesor de áreas no vinculadas con el centro, profesionales de empresas, etc.) // 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.103: Dec 27, 2019 Map in country information. (? lines) - Version 19.102: Dec 27, 2019 Map in institution information. (? lines) + Version 19.103: Dec 28, 2019 Map in country information. (? lines) + Version 19.102: Dec 28, 2019 Map in institution information. (? lines) + Version 19.101.1: Dec 28, 2019 Centre information is splitted into two columns. (249297 lines) Version 19.101: Dec 27, 2019 Code refactoring in course, degree, centre, institution and country information. (249255 lines) Version 19.100: Dec 27, 2019 Code refactoring in country information. (249170 lines) Version 19.99.2: Dec 27, 2019 Fixed bug in attendance. (248857 lines) diff --git a/swad_hierarchy.c b/swad_hierarchy.c index 9ab179e68..f5b5dfced 100644 --- a/swad_hierarchy.c +++ b/swad_hierarchy.c @@ -97,18 +97,19 @@ void Hie_ConfigFullName (bool PutForm,const char *Label,Act_Action_t NextAction, HTM_TR_Begin (NULL); /* Label */ - Frm_LabelColumn ("RM",PutForm ? "FullName" : + Frm_LabelColumn ("RT",PutForm ? "FullName" : NULL, Label); /* Data */ - HTM_TD_Begin ("class=\"DAT_N LM\""); + 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\""); + "id=\"FullName\" class=\"INPUT_FULL_NAME\"" + " required=\"required\""); Frm_EndForm (); } else // I can not edit full name @@ -131,18 +132,19 @@ void Hie_ConfigShrtName (bool PutForm,Act_Action_t NextAction, HTM_TR_Begin (NULL); /* Label */ - Frm_LabelColumn ("RM",PutForm ? "ShortName" : + Frm_LabelColumn ("RT",PutForm ? "ShortName" : NULL, Txt_Short_name); /* Data */ - HTM_TD_Begin ("class=\"DAT_N LM\""); + 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\""); + "id=\"ShortName\" class=\"INPUT_SHORT_NAME\"" + " required=\"required\""); Frm_EndForm (); } else // I can not edit short name @@ -165,12 +167,12 @@ void Hie_ConfigWWW (bool PrintView,bool PutForm,Act_Action_t NextAction, HTM_TR_Begin (NULL); /* Label */ - Frm_LabelColumn ("RM",PutForm ? "WWW" : + Frm_LabelColumn ("RT",PutForm ? "WWW" : NULL, Txt_Web); /* Data */ - HTM_TD_Begin ("class=\"DAT LM\""); + HTM_TD_Begin ("class=\"DAT LB\""); if (PutForm) { /* Form to change web */ @@ -207,10 +209,10 @@ void Hie_ConfigShortcut (bool PrintView,const char *ParamName,long HieCod) HTM_TR_Begin (NULL); /* Label */ - Frm_LabelColumn ("RM",NULL,Txt_Shortcut); + Frm_LabelColumn ("RT",NULL,Txt_Shortcut); /* Data */ - HTM_TD_Begin ("class=\"DAT LM\""); + HTM_TD_Begin ("class=\"DAT LB\""); if (!PrintView) HTM_A_Begin ("href=\"%s/%s?%s=%ld\" class=\"DAT\" target=\"_blank\"", Cfg_URL_SWAD_CGI, @@ -242,7 +244,7 @@ void Hie_ConfigQR (const char *ParamName,long HieCod) Frm_LabelColumn ("RT",NULL,Txt_QR_code); /* Data */ - HTM_TD_Begin ("class=\"DAT LT\""); + HTM_TD_Begin ("class=\"DAT LB\""); QR_LinkTo (250,ParamName,HieCod); HTM_TD_End ();