From 2e4d3b50d8215da3751eba20e8662e0c0651d918 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Ca=C3=B1as=20Vargas?= Date: Sun, 30 Apr 2017 14:03:45 +0200 Subject: [PATCH] Version 16.197 --- swad_action.c | 2 +- swad_changelog.h | 4 +- swad_course.c | 7 +- swad_degree.c | 10 +-- swad_degree_type.c | 166 ++++++++++++++++++++++++++------------------- swad_degree_type.h | 3 +- swad_text.c | 63 +++++++++++------ 7 files changed, 152 insertions(+), 103 deletions(-) diff --git a/swad_action.c b/swad_action.c index 8276b090..54a01d6c 100644 --- a/swad_action.c +++ b/swad_action.c @@ -1674,7 +1674,7 @@ struct Act_Actions Act_Actions[Act_NUM_ACTIONS] = /* ActChgCtrPhoAtt */{1159,-1,TabUnk,ActSeeCtrInf , 0, 0, 0,0x1C0, 0, 0, 0,Act_CONT_NORM,Act_THIS_WINDOW,NULL ,Ctr_ChangeCtrPhotoAttribution ,NULL}, /* ActSeeDegTyp */{1013,-1,TabUnk,ActSeeDeg , 0, 0, 0,0x1FF, 0, 0, 0,Act_CONT_NORM,Act_THIS_WINDOW,NULL ,DT_SeeDegreeTypesInDegTab ,NULL}, - /* ActEdiDegTyp */{ 573,-1,TabUnk,ActSeeDeg , 0, 0, 0,0x100, 0, 0, 0,Act_CONT_NORM,Act_THIS_WINDOW,NULL ,DT_ReqEditDegreeTypes ,NULL}, + /* ActEdiDegTyp */{ 573,-1,TabUnk,ActSeeDeg , 0, 0, 0,0x100, 0, 0, 0,Act_CONT_NORM,Act_THIS_WINDOW,NULL ,DT_EditDegreeTypes ,NULL}, /* ActNewDegTyp */{ 537,-1,TabUnk,ActSeeDeg , 0, 0, 0,0x100, 0, 0, 0,Act_CONT_NORM,Act_THIS_WINDOW,NULL ,DT_RecFormNewDegreeType ,NULL}, /* ActRemDegTyp */{ 545,-1,TabUnk,ActSeeDeg , 0, 0, 0,0x100, 0, 0, 0,Act_CONT_NORM,Act_THIS_WINDOW,NULL ,DT_RemoveDegreeType ,NULL}, /* ActRenDegTyp */{ 538,-1,TabUnk,ActSeeDeg , 0, 0, 0,0x100, 0, 0, 0,Act_CONT_NORM,Act_THIS_WINDOW,NULL ,DT_RenameDegreeType ,NULL}, diff --git a/swad_changelog.h b/swad_changelog.h index 98200ccc..e946bb3b 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -209,7 +209,6 @@ // TODO: Comprobar que, para detectar el número de filas de cabecera y pie automáticamente en los archivos de calificaciones, SWAD mira no sólo que parezcan un ID, sino que coincida con alguno de los DNI de la asignatura (por ejemplo en el caso de los DNI alemanes formados por varias letras) // TODO: En información de un centro, poner icono que enlace a edición de lugares, y posibilidad de editar lugar del centro en un menú desplegable. Lugar debería ir encima de Acceso directo. -// TODO: Cuando se está editando instituciones, centros, titulaciones y asignaturas, poner un icono Ver (ojo) en la esquina superior izquierda. // TODO: Fix bug: An URL like https://openswad.org/es?a gives Internal Server Error @@ -223,13 +222,14 @@ /****************************** Public constants *****************************/ /*****************************************************************************/ -#define Log_PLATFORM_VERSION "SWAD 16.196.3 (2017-04-30)" +#define Log_PLATFORM_VERSION "SWAD 16.197 (2017-04-30)" #define CSS_FILE "swad16.195.8.css" #define JS_FILE "swad16.181.js" // Number of lines (includes comments but not blank lines) has been got with the following command: // nl swad*.c swad*.h css/swad*.css py/swad*.py js/swad*.js soap/swad*?.h sql/swad*.sql | tail -1 /* + Version 16.197: Apr 30, 2017 Changes in layout of edition of degree types. (218579 lines) Version 16.196.3: Apr 30, 2017 Changes in layout of edition of courses. (218540 lines) Version 16.196.2: Apr 30, 2017 Changes in layout of edition of degrees. (218537 lines) Version 16.196.1: Apr 30, 2017 Changes in layout of edition of centres. (218538 lines) diff --git a/swad_course.c b/swad_course.c index 20769ccf..a8acc1c1 100644 --- a/swad_course.c +++ b/swad_course.c @@ -1652,11 +1652,9 @@ static void Crs_PutFormToCreateCourse (void) Lay_StartRoundFrameTable (NULL,Txt_New_course,NULL,NULL,2); Crs_PutHeadCoursesForEdition (); - /***** Disabled icon to remove course *****/ + /***** Column to remove course, disabled here *****/ fprintf (Gbl.F.Out,"" - ""); - Lay_PutIconRemovalNotAllowed (); - fprintf (Gbl.F.Out,""); + ""); /***** Course code *****/ fprintf (Gbl.F.Out,""); @@ -1712,7 +1710,6 @@ static void Crs_PutFormToCreateCourse (void) "0" ""); - /***** Course requester *****/ fprintf (Gbl.F.Out,"" "" diff --git a/swad_degree.c b/swad_degree.c index db23f798..231af466 100644 --- a/swad_degree.c +++ b/swad_degree.c @@ -1177,7 +1177,7 @@ static void Deg_ListDegrees (void) if (Gbl.CurrentCtr.Ctr.Degs.Num) // There are degrees in the current centre { - /***** Start table *****/ + /***** Write heading *****/ fprintf (Gbl.F.Out,"
"); Deg_PutHeadDegreesForSeeing (); @@ -1345,7 +1345,7 @@ void Deg_EditDegrees (void) { extern const char *Hlp_CENTRE_Degrees; extern const char *Txt_Degrees_of_CENTRE_X; - extern const char *Txt_There_are_no_types_of_degree; + extern const char *Txt_No_types_of_degree; /***** Get list of degrees in the current centre *****/ Deg_GetListDegsOfCurrentCtr (); @@ -1371,11 +1371,11 @@ void Deg_EditDegrees (void) else // No degree types { /***** Warning message *****/ - Lay_ShowAlert (Lay_WARNING,Txt_There_are_no_types_of_degree); + Lay_ShowAlert (Lay_WARNING,Txt_No_types_of_degree); /***** Form to create the first degree type *****/ - if (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM) - DT_PutFormToCreateDegreeType (); + if (DT_CheckIfICanCreateDegreeTypes ()) + DT_EditDegreeTypes (); } /***** End frame *****/ diff --git a/swad_degree_type.c b/swad_degree_type.c index f1c8f704..7332990a 100644 --- a/swad_degree_type.c +++ b/swad_degree_type.c @@ -62,12 +62,13 @@ extern struct Globals Gbl; /**************************** Private prototypes *****************************/ /*****************************************************************************/ +static void DT_PutIconToViewDegreeTypesWhenEditing (void); + static void DT_SeeDegreeTypes (Act_Action_t NextAction,Sco_Scope_t Scope, DT_Order_t DefaultOrder); static DT_Order_t DT_GetParamDegTypOrder (DT_Order_t DefaultOrder); static void DT_ListDegreeTypes (Act_Action_t NextAction,DT_Order_t SelectedOrder); -static void DT_EditDegreeTypes (void); static void DT_ListDegreeTypesForSeeing (void); static void DT_PutIconsListDegTypes (void); static void DT_PutIconToEditDegTypes (void); @@ -136,6 +137,16 @@ void DT_PutIconToViewDegreeTypes (void) NULL); } +static void DT_PutIconToViewDegreeTypesWhenEditing (void) + { + extern const char *Txt_View; + + Lay_PutContextualLink (ActSeeDegTyp,NULL,NULL, + "eye-on64x64.png", + Txt_View,NULL, + NULL); + } + /*****************************************************************************/ /***************************** Show degree types *****************************/ /*****************************************************************************/ @@ -182,22 +193,6 @@ static DT_Order_t DT_GetParamDegTypOrder (DT_Order_t DefaultOrder) (unsigned long) DefaultOrder); } -/*****************************************************************************/ -/********************** Request edition of degree types **********************/ -/*****************************************************************************/ - -void DT_ReqEditDegreeTypes (void) - { - /***** Get list of degree types *****/ - DT_GetListDegreeTypes (Sco_SCOPE_SYS,DT_ORDER_BY_DEGREE_TYPE); - - /***** Put form to edit degree types *****/ - DT_EditDegreeTypes (); - - /***** Free list of degree types *****/ - DT_FreeListDegreeTypes (); - } - /*****************************************************************************/ /***************************** List degree types *****************************/ /*****************************************************************************/ @@ -210,51 +205,69 @@ static void DT_ListDegreeTypes (Act_Action_t NextAction,DT_Order_t SelectedOrder extern const char *Hlp_CENTRE_DegreeTypes; extern const char *Hlp_STATS_Figures_types_of_degree; extern const char *Txt_Types_of_degree; - extern const char *Txt_There_are_no_types_of_degree; + extern const char *Txt_No_types_of_degree; + extern const char *Txt_Create_another_type_of_degree; + extern const char *Txt_Create_type_of_degree; + + /***** Start frame *****/ + switch (NextAction) + { + case ActSeeDegTyp: + Lay_StartRoundFrame (NULL,Txt_Types_of_degree,DT_PutIconsListDegTypes, + Hlp_CENTRE_DegreeTypes); + break; + case ActSeeUseGbl: + Lay_StartRoundFrame (NULL,Txt_Types_of_degree,DT_PutIconToEditDegTypes, + Hlp_STATS_Figures_types_of_degree); + break; + default: // Bad call + return; + } if (Gbl.Degs.DegTypes.Num) { /***** Write heading *****/ - switch (NextAction) - { - case ActSeeDegTyp: - Lay_StartRoundFrameTable (NULL,Txt_Types_of_degree, - DT_PutIconsListDegTypes, - Hlp_CENTRE_DegreeTypes, - 2); - break; - case ActSeeUseGbl: - Lay_StartRoundFrameTable (NULL,Txt_Types_of_degree, - DT_PutIconToEditDegTypes, - Hlp_STATS_Figures_types_of_degree, - 2); - break; - default: // Bad call - return; - } + fprintf (Gbl.F.Out,"
"); DT_PutHeadDegreeTypesForSeeing (NextAction,SelectedOrder); /***** List current degree types for seeing *****/ DT_ListDegreeTypesForSeeing (); - /***** End table and frame *****/ - Lay_EndRoundFrameTable (); + /***** End table *****/ + fprintf (Gbl.F.Out,"
"); } - else - Lay_ShowAlert (Lay_INFO,Txt_There_are_no_types_of_degree); + else // No degree types created + Lay_ShowAlert (Lay_INFO,Txt_No_types_of_degree); + + /***** Button to create degree type *****/ + if (DT_CheckIfICanCreateDegreeTypes ()) + { + Act_FormStart (ActEdiDegTyp); + Lay_PutConfirmButton (Gbl.Degs.DegTypes.Num ? Txt_Create_another_type_of_degree : + Txt_Create_type_of_degree); + Act_FormEnd (); + } + + /***** End frame *****/ + Lay_EndRoundFrame (); } /*****************************************************************************/ /************************ Put forms to edit degree types *********************/ /*****************************************************************************/ -static void DT_EditDegreeTypes (void) +void DT_EditDegreeTypes (void) { - extern const char *Txt_There_are_no_types_of_degree; + extern const char *Hlp_CENTRE_DegreeTypes_edit; + extern const char *Txt_Types_of_degree; - if (!Gbl.Degs.DegTypes.Num) - /***** Help message *****/ - Lay_ShowAlert (Lay_INFO,Txt_There_are_no_types_of_degree); + /***** Get list of degree types *****/ + DT_GetListDegreeTypes (Sco_SCOPE_SYS,DT_ORDER_BY_DEGREE_TYPE); + + /***** Start frame *****/ + Lay_StartRoundFrame (NULL,Txt_Types_of_degree, + DT_PutIconToViewDegreeTypesWhenEditing, + Hlp_CENTRE_DegreeTypes_edit); /***** Put a form to create a new degree type *****/ DT_PutFormToCreateDegreeType (); @@ -262,6 +275,12 @@ static void DT_EditDegreeTypes (void) /***** Forms to edit current degree types *****/ if (Gbl.Degs.DegTypes.Num) DT_ListDegreeTypesForEdition (); + + /***** End frame *****/ + Lay_EndRoundFrame (); + + /***** Free list of degree types *****/ + DT_FreeListDegreeTypes (); } /*****************************************************************************/ @@ -327,11 +346,11 @@ static void DT_PutIconsListDegTypes (void) static void DT_PutIconToEditDegTypes (void) { extern const char *Txt_Edit; - bool IsCentreTab = Gbl.CurrentCtr.Ctr.CtrCod > 0 && - Gbl.CurrentDeg.Deg.DegCod <= 0; + bool CentreTabVisible = Gbl.CurrentCtr.Ctr.CtrCod > 0 && // Centre selected + Gbl.CurrentDeg.Deg.DegCod <= 0; // No degree selected - if (IsCentreTab && // Only editable in centre tab - Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM) // Only editable by system admins + if (CentreTabVisible && // Only editable if centre tab is visible + DT_CheckIfICanCreateDegreeTypes ()) Lay_PutContextualLink (ActEdiDegTyp,NULL,NULL, "edit64x64.png", Txt_Edit,NULL, @@ -344,13 +363,10 @@ static void DT_PutIconToEditDegTypes (void) static void DT_ListDegreeTypesForEdition (void) { - extern const char *Hlp_CENTRE_DegreeTypes_edit; - extern const char *Txt_Types_of_degree; unsigned NumDegTyp; /***** Write heading *****/ - Lay_StartRoundFrameTable (NULL,Txt_Types_of_degree, - NULL,Hlp_CENTRE_DegreeTypes_edit,2); + fprintf (Gbl.F.Out,""); DT_PutHeadDegreeTypesForEdition (); /***** List degree types with forms for edition *****/ @@ -373,7 +389,7 @@ static void DT_ListDegreeTypesForEdition (void) /* Degree type code */ fprintf (Gbl.F.Out,"" - "", Gbl.Degs.DegTypes.Lst[NumDegTyp].DegTypCod); @@ -399,7 +415,17 @@ static void DT_ListDegreeTypesForEdition (void) Gbl.Degs.DegTypes.Lst[NumDegTyp].NumDegs); } - Lay_EndRoundFrameTable (); + /***** End table *****/ + fprintf (Gbl.F.Out,"
" + "" "%ld" "
"); + } + +/*****************************************************************************/ +/******************** Check if I can create degree types *********************/ +/*****************************************************************************/ + +bool DT_CheckIfICanCreateDegreeTypes (void) + { + return (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM); } /*****************************************************************************/ @@ -408,35 +434,39 @@ static void DT_ListDegreeTypesForEdition (void) void DT_PutFormToCreateDegreeType (void) { - extern const char *Hlp_CENTRE_DegreeTypes_edit; extern const char *Txt_New_type_of_degree; - extern const char *Txt_Type_of_degree; extern const char *Txt_Create_type_of_degree; /***** Start form *****/ Act_FormStart (ActNewDegTyp); /***** Start of frame *****/ - Lay_StartRoundFrameTable (NULL,Txt_New_type_of_degree, - NULL,Hlp_CENTRE_DegreeTypes_edit,2); + Lay_StartRoundFrameTable (NULL,Txt_New_type_of_degree,NULL,NULL,2); /***** Write heading *****/ + DT_PutHeadDegreeTypesForEdition (); + + /***** Column to remove degree type, disabled here *****/ fprintf (Gbl.F.Out,"" - "" - "%s" - "" - "", - Txt_Type_of_degree); + ""); + + /***** Degree type code *****/ + fprintf (Gbl.F.Out,""); /***** Degree type name *****/ - fprintf (Gbl.F.Out,"" - "" + fprintf (Gbl.F.Out,"" "" "", Deg_MAX_CHARS_DEGREE_TYPE_NAME,Gbl.Degs.EditingDegTyp.DegTypName); + /***** Number of degrees of this degree type ****/ + fprintf (Gbl.F.Out,"" + "0" + "" + ""); + /***** Send button and end frame *****/ Lay_EndRoundFrameTableWithButton (Lay_CREATE_BUTTON,Txt_Create_type_of_degree); @@ -711,7 +741,7 @@ void DT_RecFormNewDegreeType (void) } /***** Show the form again *****/ - DT_ReqEditDegreeTypes (); + DT_EditDegreeTypes (); } /*****************************************************************************/ @@ -747,7 +777,7 @@ void DT_RemoveDegreeType (void) } /***** Show the form again *****/ - DT_ReqEditDegreeTypes (); + DT_EditDegreeTypes (); } /*****************************************************************************/ @@ -952,7 +982,7 @@ void DT_RenameDegreeType (void) /***** Show the form again *****/ Str_Copy (DegTyp->DegTypName,NewNameDegTyp, Deg_MAX_BYTES_DEGREE_TYPE_NAME); - DT_ReqEditDegreeTypes (); + DT_EditDegreeTypes (); } /*****************************************************************************/ diff --git a/swad_degree_type.h b/swad_degree_type.h index ee40b95c..8d8a4597 100644 --- a/swad_degree_type.h +++ b/swad_degree_type.h @@ -63,7 +63,8 @@ void DT_WriteSelectorDegreeTypes (void); void DT_PutIconToViewDegreeTypes (void); void DT_SeeDegreeTypesInDegTab (void); void DT_SeeDegreeTypesInStaTab (void); -void DT_ReqEditDegreeTypes (void); +void DT_EditDegreeTypes (void); +bool DT_CheckIfICanCreateDegreeTypes (void); void DT_PutFormToCreateDegreeType (void); void DT_GetListDegreeTypes (Sco_Scope_t Scope,DT_Order_t Order); diff --git a/swad_text.c b/swad_text.c index d97763d3..0a85e3e8 100644 --- a/swad_text.c +++ b/swad_text.c @@ -6176,6 +6176,27 @@ const char *Txt_Create_another_institution = "Criar uma outra institução"; #endif +const char *Txt_Create_another_type_of_degree = +#if L==1 + "Crear otro tipo de titulación"; // Necessita traduccio +#elif L==2 + "Erstellen Sie ein anderes Abschlussart"; +#elif L==3 + "Create another type of degree"; +#elif L==4 + "Crear otro tipo de titulación"; +#elif L==5 + "Créer un autre type d'étude"; +#elif L==6 + "Crear otro tipo de titulación"; // Okoteve traducción +#elif L==7 + "Crea un altro tipo di laurea"; +#elif L==8 + "Tworzenie inny typu stopnia"; +#elif L==9 + "Criar um outro tipo de titulação"; +#endif + const char *Txt_Create_assignment = #if L==1 "Crear actividad"; // Necessita traduccio @@ -24720,6 +24741,27 @@ const char *Txt_No_courses = "Não há disciplinas."; #endif +const char *Txt_No_types_of_degree = +#if L==1 + "No hay tipos de titulación."; // Necessita traduccio +#elif L==2 + "No types of degree."; // Need Übersetzung +#elif L==3 + "No types of degree."; +#elif L==4 + "No hay tipos de titulación."; +#elif L==5 + "There are no types of degree."; // Besoin de traduction +#elif L==6 + "No hay tipos de titulación."; // Okoteve traducción +#elif L==7 + "Non ci sono tipi di lauree."; +#elif L==8 + "No types of degree."; // Potrzebujesz tlumaczenie +#elif L==9 + "No types of degree."; // Necessita de tradução +#endif + const char *Txt_No_degrees = #if L==1 "No hi ha titulacions."; @@ -46706,27 +46748,6 @@ const char *Txt_There_are_no_record_fields_in_the_course_X = // Warning: it is v "There are no record fields in the course %s."; // Necessita de tradução #endif -const char *Txt_There_are_no_types_of_degree = -#if L==1 - "No existen tipos de titulación."; // Necessita traduccio -#elif L==2 - "There are no types of degree."; // Need Übersetzung -#elif L==3 - "There are no types of degree."; -#elif L==4 - "No existen tipos de titulación."; -#elif L==5 - "There are no types of degree."; // Besoin de traduction -#elif L==6 - "No existen tipos de titulación."; // Okoteve traducción -#elif L==7 - "Non ci sono tipi di lauree."; -#elif L==8 - "There are no types of degree."; // Potrzebujesz tlumaczenie -#elif L==9 - "There are no types of degree."; // Necessita de tradução -#endif - const char *Txt_There_are_no_types_of_group_in_the_course_X = // Warning: it is very important to include %s in the following sentences #if L==1 "No existen tipos de grupo en la asignatura %s."; // Necessita traduccio