diff --git a/Makefile b/Makefile index c0d5f6ef..11444d39 100644 --- a/Makefile +++ b/Makefile @@ -30,10 +30,10 @@ OBJS = swad_account.o swad_action.o swad_agenda.o swad_alert.o \ swad_announcement.o swad_API.o swad_assignment.o swad_attendance.o \ swad_banner.o swad_box.o swad_button.o \ swad_calendar.o swad_centre.o swad_chat.o swad_classroom.o \ - swad_config.o swad_config_course.o swad_connected.o swad_cookie.o \ - swad_country.o swad_course.o swad_cryptography.o \ - swad_database.o swad_date.o swad_degree.o swad_degree_type.o \ - swad_department.o swad_duplicate.o \ + swad_config.o swad_connected.o swad_cookie.o swad_country.o \ + swad_course.o swad_course_config.o swad_cryptography.o \ + swad_database.o swad_date.o swad_degree.o swad_degree_config.o \ + swad_degree_type.o swad_department.o swad_duplicate.o \ swad_enrolment.o swad_exam.o \ swad_figure.o swad_file.o swad_file_browser.o swad_file_extension.o \ swad_file_MIME.o swad_firewall.o swad_follow.o swad_form.o \ diff --git a/swad_action.c b/swad_action.c index 44872c3b..47724d22 100644 --- a/swad_action.c +++ b/swad_action.c @@ -42,6 +42,7 @@ #include "swad_chat.h" #include "swad_database.h" #include "swad_date.h" +#include "swad_degree_config.h" #include "swad_degree_type.h" #include "swad_duplicate.h" #include "swad_exam.h" @@ -1875,18 +1876,18 @@ const struct Act_Actions Act_Actions[Act_NUM_ACTIONS] = // TabDeg ****************************************************************** // Actions in menu: - [ActSeeDegInf ] = {1149, 0,TabDeg,ActSeeDegInf , 0, 0,0x3C7, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Deg_ShowConfiguration ,"info" }, + [ActSeeDegInf ] = {1149, 0,TabDeg,ActSeeDegInf , 0, 0,0x3C7, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,DegCfg_ShowConfiguration ,"info" }, [ActSeeCrs ] = {1009, 1,TabDeg,ActSeeCrs , 0, 0,0x3C7, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Crs_ShowCrssOfCurrentDeg ,"list-ol" }, // Actions not in menu: - [ActPrnDegInf ] = {1150,-1,TabUnk,ActSeeDegInf , 0, 0,0x3C7, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_NEW_TAB,NULL ,Deg_PrintConfiguration ,NULL}, + [ActPrnDegInf ] = {1150,-1,TabUnk,ActSeeDegInf , 0, 0,0x3C7, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_NEW_TAB,NULL ,DegCfg_PrintConfiguration ,NULL}, [ActChgDegCtrCfg ] = {1588,-1,TabUnk,ActSeeDegInf , 0, 0,0x300, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,Deg_ChangeDegCtrInConfig ,Deg_ContEditAfterChgDegInConfig,NULL}, [ActRenDegShoCfg ] = {1598,-1,TabUnk,ActSeeDegInf , 0, 0,0x380, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,Deg_RenameDegreeShortInConfig ,Deg_ContEditAfterChgDegInConfig,NULL}, [ActRenDegFulCfg ] = {1597,-1,TabUnk,ActSeeDegInf , 0, 0,0x380, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,Deg_RenameDegreeFullInConfig ,Deg_ContEditAfterChgDegInConfig,NULL}, [ActChgDegWWWCfg ] = {1599,-1,TabUnk,ActSeeDegInf , 0, 0,0x3C0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Deg_ChangeDegWWWInConfig ,NULL}, [ActReqDegLog ] = {1246,-1,TabUnk,ActSeeDegInf , 0, 0,0x3C0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Deg_RequestLogo ,NULL}, - [ActRecDegLog ] = { 553,-1,TabUnk,ActSeeDegInf , 0, 0,0x3C0, 0, 0, 0, 0,Act_CONT_DATA,Act_BRW_1ST_TAB,Deg_ReceiveLogo ,Deg_ShowConfiguration ,NULL}, - [ActRemDegLog ] = {1343,-1,TabUnk,ActSeeDegInf , 0, 0,0x3C0, 0, 0, 0, 0,Act_CONT_DATA,Act_BRW_1ST_TAB,Deg_RemoveLogo ,Deg_ShowConfiguration ,NULL}, + [ActRecDegLog ] = { 553,-1,TabUnk,ActSeeDegInf , 0, 0,0x3C0, 0, 0, 0, 0,Act_CONT_DATA,Act_BRW_1ST_TAB,Deg_ReceiveLogo ,DegCfg_ShowConfiguration ,NULL}, + [ActRemDegLog ] = {1343,-1,TabUnk,ActSeeDegInf , 0, 0,0x3C0, 0, 0, 0, 0,Act_CONT_DATA,Act_BRW_1ST_TAB,Deg_RemoveLogo ,DegCfg_ShowConfiguration ,NULL}, [ActEdiCrs ] = { 555,-1,TabUnk,ActSeeCrs , 0, 0,0x3C6, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Crs_EditCourses ,NULL}, [ActReqCrs ] = {1053,-1,TabUnk,ActSeeCrs , 0, 0,0x3C6, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,Crs_RecFormReqCrs ,Crs_ContEditAfterChgCrs ,NULL}, @@ -1909,12 +1910,12 @@ const struct Act_Actions Act_Actions[Act_NUM_ACTIONS] = [ActSeeCrsTT ] = { 25, 6,TabCrs,ActSeeCrsTT ,0x3F8,0x3C7, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,TT_ShowClassTimeTable ,"clock" }, // Actions not in menu: - [ActPrnCrsInf ] = {1028,-1,TabUnk,ActSeeCrsInf ,0x3F8,0x3C7, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_NEW_TAB,NULL ,CfgCrs_PrintConfiguration ,NULL}, - [ActChgCrsDegCfg ] = {1587,-1,TabUnk,ActSeeCrsInf ,0x380,0x380, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,Crs_ChangeCrsDegInConfig ,CfgCrs_ContEditAfterChgCrsInConfig,NULL}, - [ActRenCrsShoCfg ] = {1601,-1,TabUnk,ActSeeCrsInf ,0x3C0,0x3C0, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,Crs_RenameCourseShortInConfig ,CfgCrs_ContEditAfterChgCrsInConfig,NULL}, - [ActRenCrsFulCfg ] = {1600,-1,TabUnk,ActSeeCrsInf ,0x3C0,0x3C0, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,Crs_RenameCourseFullInConfig ,CfgCrs_ContEditAfterChgCrsInConfig,NULL}, - [ActChgInsCrsCodCfg ] = {1024,-1,TabUnk,ActSeeCrsInf ,0x220,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,Crs_ChangeInsCrsCodInConfig ,CfgCrs_ContEditAfterChgCrsInConfig,NULL}, - [ActChgCrsYeaCfg ] = {1573,-1,TabUnk,ActSeeCrsInf ,0x220,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,Crs_ChangeCrsYearInConfig ,CfgCrs_ContEditAfterChgCrsInConfig,NULL}, + [ActPrnCrsInf ] = {1028,-1,TabUnk,ActSeeCrsInf ,0x3F8,0x3C7, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_NEW_TAB,NULL ,CrsCfg_PrintConfiguration ,NULL}, + [ActChgCrsDegCfg ] = {1587,-1,TabUnk,ActSeeCrsInf ,0x380,0x380, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,Crs_ChangeCrsDegInConfig ,CrsCfg_ContEditAfterChgCrsInConfig,NULL}, + [ActRenCrsShoCfg ] = {1601,-1,TabUnk,ActSeeCrsInf ,0x3C0,0x3C0, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,Crs_RenameCourseShortInConfig ,CrsCfg_ContEditAfterChgCrsInConfig,NULL}, + [ActRenCrsFulCfg ] = {1600,-1,TabUnk,ActSeeCrsInf ,0x3C0,0x3C0, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,Crs_RenameCourseFullInConfig ,CrsCfg_ContEditAfterChgCrsInConfig,NULL}, + [ActChgInsCrsCodCfg ] = {1024,-1,TabUnk,ActSeeCrsInf ,0x220,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,Crs_ChangeInsCrsCodInConfig ,CrsCfg_ContEditAfterChgCrsInConfig,NULL}, + [ActChgCrsYeaCfg ] = {1573,-1,TabUnk,ActSeeCrsInf ,0x220,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,Crs_ChangeCrsYearInConfig ,CrsCfg_ContEditAfterChgCrsInConfig,NULL}, [ActEdiCrsInf ] = { 848,-1,TabUnk,ActSeeCrsInf ,0x220,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Inf_FormsToSelSendInfo ,NULL}, [ActEdiTchGui ] = { 785,-1,TabUnk,ActSeeTchGui ,0x220,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Inf_FormsToSelSendInfo ,NULL}, diff --git a/swad_changelog.h b/swad_changelog.h index 6d4ad59c..40ee0306 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.102 (2019-12-28)" +#define Log_PLATFORM_VERSION "SWAD 19.103 (2019-12-28)" #define CSS_FILE "swad19.101.5.css" #define JS_FILE "swad19.91.1.js" /* @@ -502,7 +502,8 @@ ps2pdf source.ps destination.pdf Version 19.10x: Dec 28, 2019 Map in country information. (? lines) Version 19.10x: Dec 28, 2019 Map in institution information. (? lines) - Version 19.102: Dec 29, 2019 New module swad_config_course for course configuration. (249397 lines) + Version 19.103: Dec 29, 2019 New module swad_degree_config for degree configuration. (249457 lines) + Version 19.102: Dec 29, 2019 New module swad_course_config for course configuration. (249397 lines) Version 19.101.5: Dec 28, 2019 Country information is splitted into two columns. (249330 lines) Version 19.101.4: Dec 28, 2019 Institution information is splitted into two columns. (249324 lines) Version 19.101.3: Dec 28, 2019 Course information is splitted into two columns. (249308 lines) diff --git a/swad_course.c b/swad_course.c index 0affb813..75551e39 100644 --- a/swad_course.c +++ b/swad_course.c @@ -30,8 +30,8 @@ #include // For asprintf #include // For string functions -#include "swad_config_course.h" #include "swad_course.h" +#include "swad_course_config.h" #include "swad_database.h" #include "swad_form.h" #include "swad_global.h" @@ -127,7 +127,7 @@ void Crs_ShowIntroduction (void) { /***** Course configuration *****/ HTM_DIV_Begin ("class=\"CM\""); - CfgCrs_Configuration (false); + CrsCfg_Configuration (false); HTM_DIV_End (); /***** Course introduction *****/ @@ -2012,7 +2012,7 @@ void Crs_ChangeCrsDegInConfig (void) /** Show message of success after changing a course in course configuration **/ /*****************************************************************************/ -void CfgCrs_ContEditAfterChgCrsInConfig (void) +void CrsCfg_ContEditAfterChgCrsInConfig (void) { /***** Write error/success message *****/ Ale_ShowAlerts (NULL); diff --git a/swad_course.h b/swad_course.h index fdd32529..50ee6ca6 100644 --- a/swad_course.h +++ b/swad_course.h @@ -99,8 +99,8 @@ typedef enum /*****************************************************************************/ void Crs_ShowIntroduction (void); -void CfgCrs_PrintConfiguration (void); -void CfgCrs_ContEditAfterChgCrsInConfig (void); +void CrsCfg_PrintConfiguration (void); +void CrsCfg_ContEditAfterChgCrsInConfig (void); unsigned Crs_GetNumCrssTotal (void); unsigned Crs_GetNumCrssInCty (long CtyCod); diff --git a/swad_config_course.c b/swad_course_config.c similarity index 88% rename from swad_config_course.c rename to swad_course_config.c index 94b6dfc9..562e9263 100644 --- a/swad_config_course.c +++ b/swad_course_config.c @@ -1,4 +1,4 @@ -// swad_config_course.c: configuration of current course +// swad_course_config.c: configuration of current course /* SWAD (Shared Workspace At a Distance), @@ -56,24 +56,24 @@ extern struct Globals Gbl; /**************************** Private prototypes *****************************/ /*****************************************************************************/ -static void CfgCrs_PutIconToPrint (void); -static void CfgCrs_Title (bool PutLink); -static void CfgCrs_Degree (bool PrintView,bool PutForm); -static void CfgCrs_FullName (bool PutForm); -static void CfgCrs_ShrtName (bool PutForm); -static void CfgCrs_Year (bool PutForm); -static void CfgCrs_InstitutionalCode (bool PutForm); -static void CfgCrs_InternalCode (void); -static void CfgCrs_Shortcut (bool PrintView); -static void CfgCrs_QR (void); -static void CfgCrs_NumUsrsInCrs (Rol_Role_t Role); -static void CfgCrs_Indicators (void); +static void CrsCfg_PutIconToPrint (void); +static void CrsCfg_Title (bool PutLink); +static void CrsCfg_Degree (bool PrintView,bool PutForm); +static void CrsCfg_FullName (bool PutForm); +static void CrsCfg_ShrtName (bool PutForm); +static void CrsCfg_Year (bool PutForm); +static void CrsCfg_InstitutionalCode (bool PutForm); +static void CrsCfg_InternalCode (void); +static void CrsCfg_Shortcut (bool PrintView); +static void CrsCfg_QR (void); +static void CrsCfg_NumUsrsInCrs (Rol_Role_t Role); +static void CrsCfg_Indicators (void); /*****************************************************************************/ /***************** Configuration of the current course ***********************/ /*****************************************************************************/ -void CfgCrs_Configuration (bool PrintView) +void CrsCfg_Configuration (bool PrintView) { extern const char *Hlp_COURSE_Information; bool PutLink; @@ -108,11 +108,11 @@ void CfgCrs_Configuration (bool PrintView) Box_BoxBegin (NULL,NULL,NULL, NULL,Box_NOT_CLOSABLE); else - Box_BoxBegin (NULL,NULL,CfgCrs_PutIconToPrint, + Box_BoxBegin (NULL,NULL,CrsCfg_PutIconToPrint, Hlp_COURSE_Information,Box_NOT_CLOSABLE); /***** Title *****/ - CfgCrs_Title (PutLink); + CrsCfg_Title (PutLink); /**************************** Left part ***********************************/ HTM_DIV_Begin ("class=\"HIE_CFG_LEFT\""); @@ -121,39 +121,39 @@ void CfgCrs_Configuration (bool PrintView) HTM_TABLE_BeginWidePadding (2); /***** Degree *****/ - CfgCrs_Degree (PrintView,PutFormDeg); + CrsCfg_Degree (PrintView,PutFormDeg); /***** Course name *****/ - CfgCrs_FullName (PutFormName); - CfgCrs_ShrtName (PutFormName); + CrsCfg_FullName (PutFormName); + CrsCfg_ShrtName (PutFormName); /***** Course year *****/ - CfgCrs_Year (PutFormYear); + CrsCfg_Year (PutFormYear); if (!PrintView) { /***** Institutional code of the course *****/ - CfgCrs_InstitutionalCode (PutFormInsCod); + CrsCfg_InstitutionalCode (PutFormInsCod); /***** Internal code of the course *****/ - CfgCrs_InternalCode (); + CrsCfg_InternalCode (); } /***** Shortcut to the couse *****/ - CfgCrs_Shortcut (PrintView); + CrsCfg_Shortcut (PrintView); if (PrintView) /***** QR code with link to the course *****/ - CfgCrs_QR (); + CrsCfg_QR (); else { /***** Number of users *****/ - CfgCrs_NumUsrsInCrs (Rol_TCH); - CfgCrs_NumUsrsInCrs (Rol_NET); - CfgCrs_NumUsrsInCrs (Rol_STD); + CrsCfg_NumUsrsInCrs (Rol_TCH); + CrsCfg_NumUsrsInCrs (Rol_NET); + CrsCfg_NumUsrsInCrs (Rol_STD); /***** Indicators *****/ - CfgCrs_Indicators (); + CrsCfg_Indicators (); } /***** End table *****/ @@ -170,7 +170,7 @@ void CfgCrs_Configuration (bool PrintView) /************* Put icon to print the configuration of a course ***************/ /*****************************************************************************/ -static void CfgCrs_PutIconToPrint (void) +static void CrsCfg_PutIconToPrint (void) { Ico_PutContextualIconToPrint (ActPrnCrsInf,NULL); } @@ -179,16 +179,16 @@ static void CfgCrs_PutIconToPrint (void) /***************** Print configuration of the current course *****************/ /*****************************************************************************/ -void CfgCrs_PrintConfiguration (void) +void CrsCfg_PrintConfiguration (void) { - CfgCrs_Configuration (true); + CrsCfg_Configuration (true); } /*****************************************************************************/ /******************** Show title in course configuration *********************/ /*****************************************************************************/ -static void CfgCrs_Title (bool PutLink) +static void CrsCfg_Title (bool PutLink) { Hie_ConfigTitle (PutLink, Hie_DEG, // Logo scope @@ -203,7 +203,7 @@ static void CfgCrs_Title (bool PutLink) /******************** Show degree in course configuration ********************/ /*****************************************************************************/ -static void CfgCrs_Degree (bool PrintView,bool PutForm) +static void CrsCfg_Degree (bool PrintView,bool PutForm) { extern const char *Txt_Degree; extern const char *Txt_Go_to_X; @@ -271,7 +271,7 @@ static void CfgCrs_Degree (bool PrintView,bool PutForm) /************** Show course full name in course configuration ****************/ /*****************************************************************************/ -static void CfgCrs_FullName (bool PutForm) +static void CrsCfg_FullName (bool PutForm) { extern const char *Txt_Course; @@ -283,7 +283,7 @@ static void CfgCrs_FullName (bool PutForm) /************** Show course short name in course configuration ***************/ /*****************************************************************************/ -static void CfgCrs_ShrtName (bool PutForm) +static void CrsCfg_ShrtName (bool PutForm) { Hie_ConfigShrtName (PutForm,ActRenCrsShoCfg,Gbl.Hierarchy.Crs.ShrtName); } @@ -292,7 +292,7 @@ static void CfgCrs_ShrtName (bool PutForm) /***************** Show course year in course configuration ******************/ /*****************************************************************************/ -static void CfgCrs_Year (bool PutForm) +static void CrsCfg_Year (bool PutForm) { extern const char *Txt_Year_OF_A_DEGREE; extern const char *Txt_YEAR_OF_DEGREE[1 + Deg_MAX_YEARS_PER_DEGREE]; @@ -335,7 +335,7 @@ static void CfgCrs_Year (bool PutForm) /************* Show institutional code in course configuration ***************/ /*****************************************************************************/ -static void CfgCrs_InstitutionalCode (bool PutForm) +static void CrsCfg_InstitutionalCode (bool PutForm) { extern const char *Txt_Institutional_code; @@ -369,7 +369,7 @@ static void CfgCrs_InstitutionalCode (bool PutForm) /**************** Show internal code in course configuration *****************/ /*****************************************************************************/ -static void CfgCrs_InternalCode (void) +static void CrsCfg_InternalCode (void) { extern const char *Txt_Internal_code; @@ -391,7 +391,7 @@ static void CfgCrs_InternalCode (void) /*************** Show course shortcut in course configuration ****************/ /*****************************************************************************/ -static void CfgCrs_Shortcut (bool PrintView) +static void CrsCfg_Shortcut (bool PrintView) { Hie_ConfigShortcut (PrintView,"crs",Gbl.Hierarchy.Crs.CrsCod); } @@ -400,7 +400,7 @@ static void CfgCrs_Shortcut (bool PrintView) /****************** Show course QR in course configuration *******************/ /*****************************************************************************/ -static void CfgCrs_QR (void) +static void CrsCfg_QR (void) { Hie_ConfigQR ("crs",Gbl.Hierarchy.Crs.CrsCod); } @@ -409,7 +409,7 @@ static void CfgCrs_QR (void) /*********************** Number of users in this course **********************/ /*****************************************************************************/ -static void CfgCrs_NumUsrsInCrs (Rol_Role_t Role) +static void CrsCfg_NumUsrsInCrs (Rol_Role_t Role) { extern const char *Txt_ROLES_PLURAL_Abc[Rol_NUM_ROLES][Usr_NUM_SEXS]; @@ -431,7 +431,7 @@ static void CfgCrs_NumUsrsInCrs (Rol_Role_t Role) /****************** Show indicators in course configuration ******************/ /*****************************************************************************/ -static void CfgCrs_Indicators (void) +static void CrsCfg_Indicators (void) { extern const char *Txt_Indicators; extern const char *Txt_of_PART_OF_A_TOTAL; diff --git a/swad_config_course.h b/swad_course_config.h similarity index 89% rename from swad_config_course.h rename to swad_course_config.h index 3324c6e2..8fa4d07f 100644 --- a/swad_config_course.h +++ b/swad_course_config.h @@ -1,7 +1,7 @@ -// swad_config_course.h: configuration of current course +// swad_course_config.h: configuration of current course -#ifndef _SWAD_CFGCRS -#define _SWAD_CFGCRS +#ifndef _SWAD_CRS_CFG +#define _SWAD_CRS_CFG /* SWAD (Shared Workspace At a Distance in Spanish), is a web platform developed at the University of Granada (Spain), @@ -41,8 +41,8 @@ /***************************** Public prototypes *****************************/ /*****************************************************************************/ -void CfgCrs_Configuration (bool PrintView); -void CfgCrs_PrintConfiguration (void); -void CfgCrs_ContEditAfterChgCrsInConfig (void); +void CrsCfg_Configuration (bool PrintView); +void CrsCfg_PrintConfiguration (void); +void CrsCfg_ContEditAfterChgCrsInConfig (void); #endif diff --git a/swad_degree.c b/swad_degree.c index c32dfec1..5c0092e1 100644 --- a/swad_degree.c +++ b/swad_degree.c @@ -25,36 +25,17 @@ /********************************* Headers ***********************************/ /*****************************************************************************/ -#include // For isprint, isspace, etc. #include // For boolean type #include // For NULL -#include // For fprintf, etc. -#include // For exit, system, calloc, free, etc. #include // For string functions -#include // To access MySQL databases -#include "swad_box.h" -#include "swad_changelog.h" -#include "swad_config.h" #include "swad_database.h" #include "swad_degree.h" -#include "swad_degree_type.h" -#include "swad_exam.h" +#include "swad_degree_config.h" #include "swad_form.h" #include "swad_global.h" -#include "swad_help.h" -#include "swad_hierarchy.h" #include "swad_HTML.h" -#include "swad_indicator.h" -#include "swad_info.h" -#include "swad_language.h" #include "swad_logo.h" -#include "swad_notification.h" -#include "swad_parameter.h" -#include "swad_RSS.h" -#include "swad_string.h" -#include "swad_tab.h" -#include "swad_theme.h" /*****************************************************************************/ /************** External global variables from others modules ****************/ @@ -86,18 +67,6 @@ static struct Degree *Deg_EditingDeg = NULL; // Static variable to keep the degr /**************************** Private prototypes *****************************/ /*****************************************************************************/ -static void Deg_Configuration (bool PrintView); -static void Deg_PutIconsToPrintAndUpload (void); -static void Deg_ConfigTitle (bool PutLink); -static void Deg_ConfigCentre (bool PrintView,bool PutForm); -static void Deg_ConfigFullName (bool PutForm); -static void Deg_ConfigShrtName (bool PutForm); -static void Deg_ConfigWWW (bool PrintView,bool PutForm); -static void Deg_ConfigShortcut (bool PrintView); -static void Deg_ConfigQR (void); -static void Deg_ConfigNumCrss (void); -static void Deg_ShowNumUsrsInCrssOfDeg (Rol_Role_t Role); - static void Deg_ListDegreesForEdition (void); static bool Deg_CheckIfICanEditADegree (struct Degree *Deg); static Deg_StatusTxt_t Deg_GetStatusTxtFromStatusBits (Deg_Status_t Status); @@ -273,307 +242,6 @@ void Deg_DrawDegreeLogoAndNameWithLink (struct Degree *Deg,Act_Action_t Action, Frm_EndForm (); } -/*****************************************************************************/ -/****************** Show information of the current degree *******************/ -/*****************************************************************************/ - -void Deg_ShowConfiguration (void) - { - Deg_Configuration (false); - - /***** Show help to enrol me *****/ - Hlp_ShowHelpWhatWouldYouLikeToDo (); - } - -/*****************************************************************************/ -/****************** Print information of the current degree ******************/ -/*****************************************************************************/ - -void Deg_PrintConfiguration (void) - { - Deg_Configuration (true); - } - -/*****************************************************************************/ -/******************* Information of the current degree ***********************/ -/*****************************************************************************/ - -static void Deg_Configuration (bool PrintView) - { - extern const char *Hlp_DEGREE_Information; - bool PutLink; - bool PutFormCtr; - bool PutFormName; - bool PutFormWWW; - - /***** Trivial check *****/ - if (Gbl.Hierarchy.Deg.DegCod <= 0) // No degree selected - return; - - /***** Initializations *****/ - PutLink = !PrintView && Gbl.Hierarchy.Deg.WWW[0]; - PutFormCtr = !PrintView && Gbl.Usrs.Me.Role.Logged >= Rol_INS_ADM; - PutFormName = !PrintView && Gbl.Usrs.Me.Role.Logged >= Rol_CTR_ADM; - PutFormWWW = !PrintView && Gbl.Usrs.Me.Role.Logged >= Rol_DEG_ADM; - - /***** Begin box *****/ - if (PrintView) - Box_BoxBegin (NULL,NULL,NULL, - NULL,Box_NOT_CLOSABLE); - else - Box_BoxBegin (NULL,NULL,Deg_PutIconsToPrintAndUpload, - Hlp_DEGREE_Information,Box_NOT_CLOSABLE); - - /***** Title *****/ - Deg_ConfigTitle (PutLink); - - /**************************** Left part ***********************************/ - HTM_DIV_Begin ("class=\"HIE_CFG_LEFT\""); - - /***** Begin table *****/ - HTM_TABLE_BeginWidePadding (2); - - /***** Centre *****/ - Deg_ConfigCentre (PrintView,PutFormCtr); - - /***** Degree name *****/ - Deg_ConfigFullName (PutFormName); - Deg_ConfigShrtName (PutFormName); - - /***** Degree WWW *****/ - Deg_ConfigWWW (PrintView,PutFormWWW); - - /***** Shortcut to the degree *****/ - Deg_ConfigShortcut (PrintView); - - if (PrintView) - /***** QR code with link to the degree *****/ - Deg_ConfigQR (); - else - { - /***** Number of courses *****/ - Deg_ConfigNumCrss (); - - /***** Number of users *****/ - Deg_ShowNumUsrsInCrssOfDeg (Rol_TCH); - Deg_ShowNumUsrsInCrssOfDeg (Rol_NET); - Deg_ShowNumUsrsInCrssOfDeg (Rol_STD); - Deg_ShowNumUsrsInCrssOfDeg (Rol_UNK); - } - - /***** End table *****/ - HTM_TABLE_End (); - - /***** End of left part *****/ - HTM_DIV_End (); - - /***** End box *****/ - Box_BoxEnd (); - } - -/*****************************************************************************/ -/************ Put contextual icons in configuration of a degree **************/ -/*****************************************************************************/ - -static void Deg_PutIconsToPrintAndUpload (void) - { - /***** Link to print info about degree *****/ - Ico_PutContextualIconToPrint (ActPrnDegInf,NULL); - - if (Gbl.Usrs.Me.Role.Logged >= Rol_DEG_ADM) - // Only degree admins, centre admins, institution admins and system admins - // have permission to upload logo of the degree - /***** Link to upload logo of degree *****/ - Lgo_PutIconToChangeLogo (Hie_DEG); - } - -/*****************************************************************************/ -/******************** Show title in degree configuration *********************/ -/*****************************************************************************/ - -static void Deg_ConfigTitle (bool PutLink) - { - Hie_ConfigTitle (PutLink, - Hie_DEG, // Logo scope - Gbl.Hierarchy.Deg.DegCod, // Logo code - Gbl.Hierarchy.Deg.ShrtName, // Logo short name - Gbl.Hierarchy.Deg.FullName, // Logo full name - Gbl.Hierarchy.Deg.WWW, // Logo www - Gbl.Hierarchy.Deg.FullName); // Text full name - } - -/*****************************************************************************/ -/******************** Show centre in degree configuration ********************/ -/*****************************************************************************/ - -static void Deg_ConfigCentre (bool PrintView,bool PutForm) - { - extern const char *Txt_Centre; - extern const char *Txt_Go_to_X; - unsigned NumCtr; - - /***** Centre *****/ - HTM_TR_Begin (NULL); - - /* Label */ - Frm_LabelColumn ("RT",PutForm ? "OthCtrCod" : - NULL, - Txt_Centre); - - /* Data */ - HTM_TD_Begin ("class=\"DAT LB\""); - if (PutForm) - { - /* Get list of centres of the current institution */ - Ctr_GetListCentres (Gbl.Hierarchy.Ins.InsCod); - - /* Put form to select centre */ - Frm_StartForm (ActChgDegCtrCfg); - HTM_SELECT_Begin (true, - "id=\"OthCtrCod\" name=\"OthCtrCod\"" - " class=\"INPUT_SHORT_NAME\""); - for (NumCtr = 0; - NumCtr < Gbl.Hierarchy.Ins.Ctrs.Num; - NumCtr++) - HTM_OPTION (HTM_Type_LONG,&Gbl.Hierarchy.Ins.Ctrs.Lst[NumCtr].CtrCod, - Gbl.Hierarchy.Ins.Ctrs.Lst[NumCtr].CtrCod == Gbl.Hierarchy.Ctr.CtrCod,false, - "%s",Gbl.Hierarchy.Ins.Ctrs.Lst[NumCtr].ShrtName); - HTM_SELECT_End (); - Frm_EndForm (); - - /* Free list of centres */ - Ctr_FreeListCentres (); - } - else // I can not move degree to another centre - { - if (!PrintView) - { - Frm_StartFormGoTo (ActSeeCtrInf); - Ctr_PutParamCtrCod (Gbl.Hierarchy.Ctr.CtrCod); - snprintf (Gbl.Title,sizeof (Gbl.Title), - Txt_Go_to_X, - Gbl.Hierarchy.Ctr.ShrtName); - HTM_BUTTON_SUBMIT_Begin (Gbl.Title,"BT_LINK LT DAT",NULL); - } - Lgo_DrawLogo (Hie_CTR,Gbl.Hierarchy.Ctr.CtrCod,Gbl.Hierarchy.Ctr.ShrtName, - 20,"LM",true); - HTM_NBSP (); - HTM_Txt (Gbl.Hierarchy.Ctr.FullName); - if (!PrintView) - { - HTM_BUTTON_End (); - Frm_EndForm (); - } - } - HTM_TD_End (); - - HTM_TR_End (); - } - -/*****************************************************************************/ -/************** Show degree full name in degree configuration ****************/ -/*****************************************************************************/ - -static void Deg_ConfigFullName (bool PutForm) - { - extern const char *Txt_Degree; - - Hie_ConfigFullName (PutForm,Txt_Degree,ActRenDegFulCfg, - Gbl.Hierarchy.Deg.FullName); - } - -/*****************************************************************************/ -/************** Show degree short name in degree configuration ***************/ -/*****************************************************************************/ - -static void Deg_ConfigShrtName (bool PutForm) - { - Hie_ConfigShrtName (PutForm,ActRenDegShoCfg,Gbl.Hierarchy.Deg.ShrtName); - } - -/*****************************************************************************/ -/***************** Show degree WWW in degree configuration *******************/ -/*****************************************************************************/ - -static void Deg_ConfigWWW (bool PrintView,bool PutForm) - { - Hie_ConfigWWW (PrintView,PutForm,ActChgDegWWWCfg,Gbl.Hierarchy.Deg.WWW); - } - -/*****************************************************************************/ -/*************** Show degree shortcut in degree configuration ****************/ -/*****************************************************************************/ - -static void Deg_ConfigShortcut (bool PrintView) - { - Hie_ConfigShortcut (PrintView,"deg",Gbl.Hierarchy.Deg.DegCod); - } - -/*****************************************************************************/ -/****************** Show degree QR in degree configuration *******************/ -/*****************************************************************************/ - -static void Deg_ConfigQR (void) - { - Hie_ConfigQR ("deg",Gbl.Hierarchy.Deg.DegCod); - } - -/*****************************************************************************/ -/************** Show number of courses in degree configuration ***************/ -/*****************************************************************************/ - -static void Deg_ConfigNumCrss (void) - { - extern const char *Txt_Courses; - extern const char *Txt_Courses_of_DEGREE_X; - - /***** Number of courses *****/ - HTM_TR_Begin (NULL); - - /* Label */ - Frm_LabelColumn ("RT",NULL,Txt_Courses); - - /* Data */ - HTM_TD_Begin ("class=\"LB\""); - Frm_StartFormGoTo (ActSeeCrs); - Deg_PutParamDegCod (Gbl.Hierarchy.Deg.DegCod); - snprintf (Gbl.Title,sizeof (Gbl.Title), - Txt_Courses_of_DEGREE_X, - Gbl.Hierarchy.Deg.ShrtName); - HTM_BUTTON_SUBMIT_Begin (Gbl.Title,"BT_LINK DAT",NULL); - HTM_Unsigned (Crs_GetNumCrssInDeg (Gbl.Hierarchy.Deg.DegCod)); - HTM_BUTTON_End (); - Frm_EndForm (); - HTM_TD_End (); - - HTM_TR_End (); - } - -/*****************************************************************************/ -/***************** Number of users in courses of this degree *****************/ -/*****************************************************************************/ - -static void Deg_ShowNumUsrsInCrssOfDeg (Rol_Role_t Role) - { - extern const char *Txt_Users_in_courses; - extern const char *Txt_ROLES_PLURAL_Abc[Rol_NUM_ROLES][Usr_NUM_SEXS]; - - /***** Number of users in courses *****/ - HTM_TR_Begin (NULL); - - /* Label */ - 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 LB\""); - HTM_Unsigned (Usr_GetNumUsrsInCrssOfDeg (Role,Gbl.Hierarchy.Deg.DegCod)); - HTM_TD_End (); - - HTM_TR_End (); - } - /*****************************************************************************/ /*************************** Write selector of degree ************************/ /*****************************************************************************/ @@ -2060,7 +1728,7 @@ void Deg_ContEditAfterChgDegInConfig (void) Ale_ShowAlerts (NULL); /***** Show the form again *****/ - Deg_ShowConfiguration (); + DegCfg_ShowConfiguration (); } /*****************************************************************************/ @@ -2175,7 +1843,7 @@ void Deg_ChangeDegWWWInConfig (void) Ale_ShowAlertYouCanNotLeaveFieldEmpty (); /***** Show the form again *****/ - Deg_ShowConfiguration (); + DegCfg_ShowConfiguration (); } /*****************************************************************************/ diff --git a/swad_degree.h b/swad_degree.h index 80cdc565..718c3b23 100644 --- a/swad_degree.h +++ b/swad_degree.h @@ -104,9 +104,6 @@ void Deg_SeeDegWithPendingCrss (void); void Deg_DrawDegreeLogoAndNameWithLink (struct Degree *Deg,Act_Action_t Action, const char *ClassLink,const char *ClassLogo); -void Deg_ShowConfiguration (void); -void Deg_PrintConfiguration (void); - void Deg_WriteSelectorOfDegree (void); void Deg_ShowDegsOfCurrentCtr (void); diff --git a/swad_degree_config.c b/swad_degree_config.c new file mode 100644 index 00000000..5950531f --- /dev/null +++ b/swad_degree_config.c @@ -0,0 +1,370 @@ +// swad_degree_config.c: configuration of current degree + +/* + 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 ***********************************/ +/*****************************************************************************/ + +#include // For boolean type + +#include "swad_degree_config.h" +#include "swad_form.h" +#include "swad_global.h" +#include "swad_help.h" +#include "swad_HTML.h" +#include "swad_logo.h" + +/*****************************************************************************/ +/************** External global variables from others modules ****************/ +/*****************************************************************************/ + +extern struct Globals Gbl; + +/*****************************************************************************/ +/*************************** Public constants ********************************/ +/*****************************************************************************/ + +/*****************************************************************************/ +/***************************** Private types *********************************/ +/*****************************************************************************/ + +/*****************************************************************************/ +/**************************** Private variables ******************************/ +/*****************************************************************************/ + +/*****************************************************************************/ +/**************************** Private prototypes *****************************/ +/*****************************************************************************/ + +static void DegCfg_Configuration (bool PrintView); +static void DegCfg_PutIconsToPrintAndUpload (void); +static void DegCfg_Title (bool PutLink); +static void DegCfg_Centre (bool PrintView,bool PutForm); +static void DegCfg_FullName (bool PutForm); +static void DegCfg_ShrtName (bool PutForm); +static void DegCfg_WWW (bool PrintView,bool PutForm); +static void DegCfg_Shortcut (bool PrintView); +static void DegCfg_QR (void); +static void DegCfg_NumCrss (void); +static void DegCfg_NumUsrsInCrssOfDeg (Rol_Role_t Role); + +/*****************************************************************************/ +/****************** Show information of the current degree *******************/ +/*****************************************************************************/ + +void DegCfg_ShowConfiguration (void) + { + DegCfg_Configuration (false); + + /***** Show help to enrol me *****/ + Hlp_ShowHelpWhatWouldYouLikeToDo (); + } + +/*****************************************************************************/ +/****************** Print information of the current degree ******************/ +/*****************************************************************************/ + +void DegCfg_PrintConfiguration (void) + { + DegCfg_Configuration (true); + } + +/*****************************************************************************/ +/******************* Information of the current degree ***********************/ +/*****************************************************************************/ + +static void DegCfg_Configuration (bool PrintView) + { + extern const char *Hlp_DEGREE_Information; + bool PutLink; + bool PutFormCtr; + bool PutFormName; + bool PutFormWWW; + + /***** Trivial check *****/ + if (Gbl.Hierarchy.Deg.DegCod <= 0) // No degree selected + return; + + /***** Initializations *****/ + PutLink = !PrintView && Gbl.Hierarchy.Deg.WWW[0]; + PutFormCtr = !PrintView && Gbl.Usrs.Me.Role.Logged >= Rol_INS_ADM; + PutFormName = !PrintView && Gbl.Usrs.Me.Role.Logged >= Rol_CTR_ADM; + PutFormWWW = !PrintView && Gbl.Usrs.Me.Role.Logged >= Rol_DEG_ADM; + + /***** Begin box *****/ + if (PrintView) + Box_BoxBegin (NULL,NULL,NULL, + NULL,Box_NOT_CLOSABLE); + else + Box_BoxBegin (NULL,NULL,DegCfg_PutIconsToPrintAndUpload, + Hlp_DEGREE_Information,Box_NOT_CLOSABLE); + + /***** Title *****/ + DegCfg_Title (PutLink); + + /**************************** Left part ***********************************/ + HTM_DIV_Begin ("class=\"HIE_CFG_LEFT\""); + + /***** Begin table *****/ + HTM_TABLE_BeginWidePadding (2); + + /***** Centre *****/ + DegCfg_Centre (PrintView,PutFormCtr); + + /***** Degree name *****/ + DegCfg_FullName (PutFormName); + DegCfg_ShrtName (PutFormName); + + /***** Degree WWW *****/ + DegCfg_WWW (PrintView,PutFormWWW); + + /***** Shortcut to the degree *****/ + DegCfg_Shortcut (PrintView); + + if (PrintView) + /***** QR code with link to the degree *****/ + DegCfg_QR (); + else + { + /***** Number of courses *****/ + DegCfg_NumCrss (); + + /***** Number of users *****/ + DegCfg_NumUsrsInCrssOfDeg (Rol_TCH); + DegCfg_NumUsrsInCrssOfDeg (Rol_NET); + DegCfg_NumUsrsInCrssOfDeg (Rol_STD); + DegCfg_NumUsrsInCrssOfDeg (Rol_UNK); + } + + /***** End table *****/ + HTM_TABLE_End (); + + /***** End of left part *****/ + HTM_DIV_End (); + + /***** End box *****/ + Box_BoxEnd (); + } + +/*****************************************************************************/ +/************ Put contextual icons in configuration of a degree **************/ +/*****************************************************************************/ + +static void DegCfg_PutIconsToPrintAndUpload (void) + { + /***** Link to print info about degree *****/ + Ico_PutContextualIconToPrint (ActPrnDegInf,NULL); + + if (Gbl.Usrs.Me.Role.Logged >= Rol_DEG_ADM) + // Only degree admins, centre admins, institution admins and system admins + // have permission to upload logo of the degree + /***** Link to upload logo of degree *****/ + Lgo_PutIconToChangeLogo (Hie_DEG); + } + +/*****************************************************************************/ +/******************** Show title in degree configuration *********************/ +/*****************************************************************************/ + +static void DegCfg_Title (bool PutLink) + { + Hie_ConfigTitle (PutLink, + Hie_DEG, // Logo scope + Gbl.Hierarchy.Deg.DegCod, // Logo code + Gbl.Hierarchy.Deg.ShrtName, // Logo short name + Gbl.Hierarchy.Deg.FullName, // Logo full name + Gbl.Hierarchy.Deg.WWW, // Logo www + Gbl.Hierarchy.Deg.FullName); // Text full name + } + +/*****************************************************************************/ +/******************** Show centre in degree configuration ********************/ +/*****************************************************************************/ + +static void DegCfg_Centre (bool PrintView,bool PutForm) + { + extern const char *Txt_Centre; + extern const char *Txt_Go_to_X; + unsigned NumCtr; + + /***** Centre *****/ + HTM_TR_Begin (NULL); + + /* Label */ + Frm_LabelColumn ("RT",PutForm ? "OthCtrCod" : + NULL, + Txt_Centre); + + /* Data */ + HTM_TD_Begin ("class=\"DAT LB\""); + if (PutForm) + { + /* Get list of centres of the current institution */ + Ctr_GetListCentres (Gbl.Hierarchy.Ins.InsCod); + + /* Put form to select centre */ + Frm_StartForm (ActChgDegCtrCfg); + HTM_SELECT_Begin (true, + "id=\"OthCtrCod\" name=\"OthCtrCod\"" + " class=\"INPUT_SHORT_NAME\""); + for (NumCtr = 0; + NumCtr < Gbl.Hierarchy.Ins.Ctrs.Num; + NumCtr++) + HTM_OPTION (HTM_Type_LONG,&Gbl.Hierarchy.Ins.Ctrs.Lst[NumCtr].CtrCod, + Gbl.Hierarchy.Ins.Ctrs.Lst[NumCtr].CtrCod == Gbl.Hierarchy.Ctr.CtrCod,false, + "%s",Gbl.Hierarchy.Ins.Ctrs.Lst[NumCtr].ShrtName); + HTM_SELECT_End (); + Frm_EndForm (); + + /* Free list of centres */ + Ctr_FreeListCentres (); + } + else // I can not move degree to another centre + { + if (!PrintView) + { + Frm_StartFormGoTo (ActSeeCtrInf); + Ctr_PutParamCtrCod (Gbl.Hierarchy.Ctr.CtrCod); + snprintf (Gbl.Title,sizeof (Gbl.Title), + Txt_Go_to_X, + Gbl.Hierarchy.Ctr.ShrtName); + HTM_BUTTON_SUBMIT_Begin (Gbl.Title,"BT_LINK LT DAT",NULL); + } + Lgo_DrawLogo (Hie_CTR,Gbl.Hierarchy.Ctr.CtrCod,Gbl.Hierarchy.Ctr.ShrtName, + 20,"LM",true); + HTM_NBSP (); + HTM_Txt (Gbl.Hierarchy.Ctr.FullName); + if (!PrintView) + { + HTM_BUTTON_End (); + Frm_EndForm (); + } + } + HTM_TD_End (); + + HTM_TR_End (); + } + +/*****************************************************************************/ +/************** Show degree full name in degree configuration ****************/ +/*****************************************************************************/ + +static void DegCfg_FullName (bool PutForm) + { + extern const char *Txt_Degree; + + Hie_ConfigFullName (PutForm,Txt_Degree,ActRenDegFulCfg, + Gbl.Hierarchy.Deg.FullName); + } + +/*****************************************************************************/ +/************** Show degree short name in degree configuration ***************/ +/*****************************************************************************/ + +static void DegCfg_ShrtName (bool PutForm) + { + Hie_ConfigShrtName (PutForm,ActRenDegShoCfg,Gbl.Hierarchy.Deg.ShrtName); + } + +/*****************************************************************************/ +/***************** Show degree WWW in degree configuration *******************/ +/*****************************************************************************/ + +static void DegCfg_WWW (bool PrintView,bool PutForm) + { + Hie_ConfigWWW (PrintView,PutForm,ActChgDegWWWCfg,Gbl.Hierarchy.Deg.WWW); + } + +/*****************************************************************************/ +/*************** Show degree shortcut in degree configuration ****************/ +/*****************************************************************************/ + +static void DegCfg_Shortcut (bool PrintView) + { + Hie_ConfigShortcut (PrintView,"deg",Gbl.Hierarchy.Deg.DegCod); + } + +/*****************************************************************************/ +/****************** Show degree QR in degree configuration *******************/ +/*****************************************************************************/ + +static void DegCfg_QR (void) + { + Hie_ConfigQR ("deg",Gbl.Hierarchy.Deg.DegCod); + } + +/*****************************************************************************/ +/************** Show number of courses in degree configuration ***************/ +/*****************************************************************************/ + +static void DegCfg_NumCrss (void) + { + extern const char *Txt_Courses; + extern const char *Txt_Courses_of_DEGREE_X; + + /***** Number of courses *****/ + HTM_TR_Begin (NULL); + + /* Label */ + Frm_LabelColumn ("RT",NULL,Txt_Courses); + + /* Data */ + HTM_TD_Begin ("class=\"LB\""); + Frm_StartFormGoTo (ActSeeCrs); + Deg_PutParamDegCod (Gbl.Hierarchy.Deg.DegCod); + snprintf (Gbl.Title,sizeof (Gbl.Title), + Txt_Courses_of_DEGREE_X, + Gbl.Hierarchy.Deg.ShrtName); + HTM_BUTTON_SUBMIT_Begin (Gbl.Title,"BT_LINK DAT",NULL); + HTM_Unsigned (Crs_GetNumCrssInDeg (Gbl.Hierarchy.Deg.DegCod)); + HTM_BUTTON_End (); + Frm_EndForm (); + HTM_TD_End (); + + HTM_TR_End (); + } + +/*****************************************************************************/ +/***************** Number of users in courses of this degree *****************/ +/*****************************************************************************/ + +static void DegCfg_NumUsrsInCrssOfDeg (Rol_Role_t Role) + { + extern const char *Txt_Users_in_courses; + extern const char *Txt_ROLES_PLURAL_Abc[Rol_NUM_ROLES][Usr_NUM_SEXS]; + + /***** Number of users in courses *****/ + HTM_TR_Begin (NULL); + + /* Label */ + 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 LB\""); + HTM_Unsigned (Usr_GetNumUsrsInCrssOfDeg (Role,Gbl.Hierarchy.Deg.DegCod)); + HTM_TD_End (); + + HTM_TR_End (); + } diff --git a/swad_degree_config.h b/swad_degree_config.h new file mode 100644 index 00000000..22f2e45c --- /dev/null +++ b/swad_degree_config.h @@ -0,0 +1,45 @@ +// swad_degree_config.h: configuration of current degree + +#ifndef _SWAD_DEG_CFG +#define _SWAD_DEG_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 DegCfg_ShowConfiguration (void); +void DegCfg_PrintConfiguration (void); + +#endif