2019-12-29 13:13:09 +01:00
|
|
|
|
// 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.
|
2024-02-07 00:40:28 +01:00
|
|
|
|
Copyright (C) 1999-2024 Antonio Ca<EFBFBD>as Vargas
|
2019-12-29 13:13:09 +01:00
|
|
|
|
|
|
|
|
|
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 <http://www.gnu.org/licenses/>.
|
|
|
|
|
*/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/********************************* Headers ***********************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2021-12-29 23:41:26 +01:00
|
|
|
|
#define _GNU_SOURCE // For asprintf
|
2019-12-29 13:13:09 +01:00
|
|
|
|
#include <stdbool.h> // For boolean type
|
2021-12-29 23:41:26 +01:00
|
|
|
|
#include <stdio.h> // For asprintf
|
2022-04-25 18:27:24 +02:00
|
|
|
|
#include <stdlib.h> // For free
|
2019-12-29 13:13:09 +01:00
|
|
|
|
|
2022-11-06 18:11:10 +01:00
|
|
|
|
#include "swad_action_list.h"
|
2022-10-19 18:07:49 +02:00
|
|
|
|
#include "swad_alert.h"
|
|
|
|
|
#include "swad_box.h"
|
2019-12-29 15:10:34 +01:00
|
|
|
|
#include "swad_database.h"
|
2019-12-29 13:13:09 +01:00
|
|
|
|
#include "swad_degree_config.h"
|
2021-05-27 23:30:16 +02:00
|
|
|
|
#include "swad_degree_database.h"
|
2021-12-29 23:41:26 +01:00
|
|
|
|
#include "swad_error.h"
|
2019-12-29 13:13:09 +01:00
|
|
|
|
#include "swad_form.h"
|
|
|
|
|
#include "swad_global.h"
|
|
|
|
|
#include "swad_help.h"
|
2021-02-11 22:57:09 +01:00
|
|
|
|
#include "swad_hierarchy.h"
|
2019-12-29 20:11:57 +01:00
|
|
|
|
#include "swad_hierarchy_config.h"
|
2023-09-22 14:47:56 +02:00
|
|
|
|
#include "swad_hierarchy_type.h"
|
2019-12-29 13:13:09 +01:00
|
|
|
|
#include "swad_HTML.h"
|
|
|
|
|
#include "swad_logo.h"
|
2022-10-19 18:07:49 +02:00
|
|
|
|
#include "swad_parameter.h"
|
2019-12-29 13:13:09 +01:00
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/************** External global variables from others modules ****************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
extern struct Globals Gbl;
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/**************************** Private prototypes *****************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2023-10-29 12:32:08 +01:00
|
|
|
|
static void DegCfg_Configuration (Vie_ViewType_t ViewType);
|
2020-04-08 18:18:46 +02:00
|
|
|
|
static void DegCfg_PutIconsToPrintAndUpload (__attribute__((unused)) void *Args);
|
2023-11-06 00:32:41 +01:00
|
|
|
|
static void DegCfg_Center (Vie_ViewType_t ViewType,Frm_PutForm_t PutForm);
|
2019-12-29 13:13:09 +01:00
|
|
|
|
static void DegCfg_NumCrss (void);
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/****************** Show information of the current degree *******************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
void DegCfg_ShowConfiguration (void)
|
|
|
|
|
{
|
2023-10-29 12:32:08 +01:00
|
|
|
|
DegCfg_Configuration (Vie_VIEW);
|
2019-12-29 13:13:09 +01:00
|
|
|
|
|
|
|
|
|
/***** Show help to enrol me *****/
|
|
|
|
|
Hlp_ShowHelpWhatWouldYouLikeToDo ();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/****************** Print information of the current degree ******************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
void DegCfg_PrintConfiguration (void)
|
|
|
|
|
{
|
2023-10-29 12:32:08 +01:00
|
|
|
|
DegCfg_Configuration (Vie_PRINT);
|
2019-12-29 13:13:09 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/******************* Information of the current degree ***********************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2023-10-29 12:32:08 +01:00
|
|
|
|
static void DegCfg_Configuration (Vie_ViewType_t ViewType)
|
2019-12-29 13:13:09 +01:00
|
|
|
|
{
|
|
|
|
|
extern const char *Hlp_DEGREE_Information;
|
2023-11-07 11:01:14 +01:00
|
|
|
|
Hie_PutLink_t PutLink;
|
2023-11-06 00:32:41 +01:00
|
|
|
|
Frm_PutForm_t PutFormCtr;
|
|
|
|
|
Frm_PutForm_t PutFormName;
|
|
|
|
|
Frm_PutForm_t PutFormWWW;
|
2019-12-29 13:13:09 +01:00
|
|
|
|
|
|
|
|
|
/***** Trivial check *****/
|
2023-09-22 14:47:56 +02:00
|
|
|
|
if (Gbl.Hierarchy.Node[Hie_DEG].HieCod <= 0) // No degree selected
|
2019-12-29 13:13:09 +01:00
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
/***** Initializations *****/
|
2023-11-07 11:01:14 +01:00
|
|
|
|
PutLink = (ViewType == Vie_VIEW &&
|
|
|
|
|
Gbl.Hierarchy.Node[Hie_DEG].WWW[0]) ? Hie_PUT_LINK :
|
|
|
|
|
Hie_DONT_PUT_LINK;
|
2023-11-06 00:32:41 +01:00
|
|
|
|
PutFormCtr = (ViewType == Vie_VIEW &&
|
|
|
|
|
Gbl.Usrs.Me.Role.Logged >= Rol_INS_ADM) ? Frm_PUT_FORM :
|
|
|
|
|
Frm_DONT_PUT_FORM;
|
|
|
|
|
PutFormName = (ViewType == Vie_VIEW &&
|
|
|
|
|
Gbl.Usrs.Me.Role.Logged >= Rol_CTR_ADM) ? Frm_PUT_FORM :
|
|
|
|
|
Frm_DONT_PUT_FORM;
|
|
|
|
|
PutFormWWW = (ViewType == Vie_VIEW &&
|
|
|
|
|
Gbl.Usrs.Me.Role.Logged >= Rol_DEG_ADM) ? Frm_PUT_FORM :
|
|
|
|
|
Frm_DONT_PUT_FORM;
|
2019-12-29 13:13:09 +01:00
|
|
|
|
|
|
|
|
|
/***** Begin box *****/
|
2024-01-29 09:45:28 +01:00
|
|
|
|
Box_BoxBegin (NULL,
|
2023-10-29 12:32:08 +01:00
|
|
|
|
ViewType == Vie_VIEW ? DegCfg_PutIconsToPrintAndUpload :
|
|
|
|
|
NULL,NULL,
|
|
|
|
|
ViewType == Vie_VIEW ? Hlp_DEGREE_Information :
|
|
|
|
|
NULL,Box_NOT_CLOSABLE);
|
|
|
|
|
|
|
|
|
|
/***** Title *****/
|
|
|
|
|
HieCfg_Title (PutLink,Hie_DEG);
|
2019-12-29 13:13:09 +01:00
|
|
|
|
|
2021-05-27 23:30:16 +02:00
|
|
|
|
/**************************** Left part ***********************************/
|
2024-02-11 23:29:50 +01:00
|
|
|
|
HTM_DIV_Begin ("class=\"HIE_CFG_LEFT\"");
|
2019-12-29 13:13:09 +01:00
|
|
|
|
|
2021-05-27 23:30:16 +02:00
|
|
|
|
/***** Begin table *****/
|
2024-02-11 23:29:50 +01:00
|
|
|
|
HTM_TABLE_BeginPadding (2);
|
2019-12-29 13:13:09 +01:00
|
|
|
|
|
2021-05-27 23:30:16 +02:00
|
|
|
|
/***** Center *****/
|
2023-10-29 12:32:08 +01:00
|
|
|
|
DegCfg_Center (ViewType,PutFormCtr);
|
2019-12-29 13:13:09 +01:00
|
|
|
|
|
2021-05-27 23:30:16 +02:00
|
|
|
|
/***** Degree name *****/
|
2024-02-11 23:29:50 +01:00
|
|
|
|
HieCfg_Name (PutFormName,Hie_DEG,Nam_FULL_NAME);
|
|
|
|
|
HieCfg_Name (PutFormName,Hie_DEG,Nam_SHRT_NAME);
|
2019-12-29 13:13:09 +01:00
|
|
|
|
|
2021-05-27 23:30:16 +02:00
|
|
|
|
/***** Degree WWW *****/
|
2024-02-11 23:29:50 +01:00
|
|
|
|
HieCfg_WWW (ViewType,PutFormWWW,ActChgDegWWWCfg,Gbl.Hierarchy.Node[Hie_DEG].WWW);
|
2019-12-29 13:13:09 +01:00
|
|
|
|
|
2021-05-27 23:30:16 +02:00
|
|
|
|
/***** Shortcut to the degree *****/
|
2024-02-11 23:29:50 +01:00
|
|
|
|
HieCfg_Shortcut (ViewType,ParCod_Deg,Gbl.Hierarchy.Node[Hie_DEG].HieCod);
|
2019-12-29 13:13:09 +01:00
|
|
|
|
|
2023-10-29 12:32:08 +01:00
|
|
|
|
switch (ViewType)
|
2021-05-27 23:30:16 +02:00
|
|
|
|
{
|
2023-10-29 12:32:08 +01:00
|
|
|
|
case Vie_VIEW:
|
|
|
|
|
/***** Number of courses *****/
|
|
|
|
|
DegCfg_NumCrss ();
|
|
|
|
|
|
|
|
|
|
/***** Number of users *****/
|
|
|
|
|
HieCfg_NumUsrsInCrss (Hie_DEG,Gbl.Hierarchy.Node[Hie_DEG].HieCod,Rol_TCH);
|
|
|
|
|
HieCfg_NumUsrsInCrss (Hie_DEG,Gbl.Hierarchy.Node[Hie_DEG].HieCod,Rol_NET);
|
|
|
|
|
HieCfg_NumUsrsInCrss (Hie_DEG,Gbl.Hierarchy.Node[Hie_DEG].HieCod,Rol_STD);
|
|
|
|
|
HieCfg_NumUsrsInCrss (Hie_DEG,Gbl.Hierarchy.Node[Hie_DEG].HieCod,Rol_UNK);
|
|
|
|
|
break;
|
|
|
|
|
case Vie_PRINT:
|
|
|
|
|
/***** QR code with link to the degree *****/
|
2024-02-11 23:29:50 +01:00
|
|
|
|
HieCfg_QR (ParCod_Deg,Gbl.Hierarchy.Node[Hie_DEG].HieCod);
|
2023-10-29 12:32:08 +01:00
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
Err_WrongTypeExit ();
|
2021-05-27 23:30:16 +02:00
|
|
|
|
}
|
2019-12-29 13:13:09 +01:00
|
|
|
|
|
2021-05-27 23:30:16 +02:00
|
|
|
|
/***** End table *****/
|
|
|
|
|
HTM_TABLE_End ();
|
|
|
|
|
|
|
|
|
|
/***** End of left part *****/
|
|
|
|
|
HTM_DIV_End ();
|
2019-12-29 13:13:09 +01:00
|
|
|
|
|
|
|
|
|
/***** End box *****/
|
|
|
|
|
Box_BoxEnd ();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/************ Put contextual icons in configuration of a degree **************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2020-04-08 18:18:46 +02:00
|
|
|
|
static void DegCfg_PutIconsToPrintAndUpload (__attribute__((unused)) void *Args)
|
2019-12-29 13:13:09 +01:00
|
|
|
|
{
|
2020-04-08 18:18:46 +02:00
|
|
|
|
/***** Link to print info about degree *****/
|
2024-02-11 23:29:50 +01:00
|
|
|
|
Ico_PutContextualIconToPrint (ActPrnDegInf,NULL,NULL);
|
2020-04-08 18:18:46 +02:00
|
|
|
|
|
|
|
|
|
if (Gbl.Usrs.Me.Role.Logged >= Rol_DEG_ADM)
|
2021-03-07 21:21:04 +01:00
|
|
|
|
// Only degree admins, center admins, institution admins and system admins
|
2020-04-08 18:18:46 +02:00
|
|
|
|
// have permission to upload logo of the degree
|
|
|
|
|
/***** Link to upload logo of degree *****/
|
2023-09-22 14:47:56 +02:00
|
|
|
|
Lgo_PutIconToChangeLogo (Hie_DEG);
|
2019-12-29 13:13:09 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
2021-03-07 21:21:04 +01:00
|
|
|
|
/******************** Show center in degree configuration ********************/
|
2019-12-29 13:13:09 +01:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2023-11-06 00:32:41 +01:00
|
|
|
|
static void DegCfg_Center (Vie_ViewType_t ViewType,Frm_PutForm_t PutForm)
|
2019-12-29 13:13:09 +01:00
|
|
|
|
{
|
2024-03-22 09:59:20 +01:00
|
|
|
|
extern const char *Par_CodeStr[Par_NUM_PAR_COD];
|
2023-11-06 12:36:05 +01:00
|
|
|
|
extern const char *Txt_HIERARCHY_SINGUL_Abc[Hie_NUM_LEVELS];
|
2019-12-29 13:13:09 +01:00
|
|
|
|
unsigned NumCtr;
|
2023-10-10 00:27:25 +02:00
|
|
|
|
const struct Hie_Node *Ctr;
|
2023-11-06 00:32:41 +01:00
|
|
|
|
const char *Id[Frm_NUM_PUT_FORM] =
|
|
|
|
|
{
|
|
|
|
|
[Frm_DONT_PUT_FORM] = NULL,
|
|
|
|
|
[Frm_PUT_FORM ] = Par_CodeStr[ParCod_OthCtr],
|
|
|
|
|
};
|
2019-12-29 13:13:09 +01:00
|
|
|
|
|
2021-03-07 21:21:04 +01:00
|
|
|
|
/***** Center *****/
|
2019-12-29 13:13:09 +01:00
|
|
|
|
HTM_TR_Begin (NULL);
|
|
|
|
|
|
2021-05-27 23:30:16 +02:00
|
|
|
|
/* Label */
|
2024-02-11 23:29:50 +01:00
|
|
|
|
Frm_LabelColumn ("Frm_C1 RT",Id[PutForm],Txt_HIERARCHY_SINGUL_Abc[Hie_CTR]);
|
2021-05-27 23:30:16 +02:00
|
|
|
|
|
|
|
|
|
/* Data */
|
2024-02-11 23:29:50 +01:00
|
|
|
|
HTM_TD_Begin ("class=\"Frm_C2 LB DAT_%s\"",The_GetSuffix ());
|
2023-11-06 00:32:41 +01:00
|
|
|
|
switch (PutForm)
|
|
|
|
|
{
|
|
|
|
|
case Frm_DONT_PUT_FORM: // I can not move degree to another center
|
|
|
|
|
if (ViewType == Vie_VIEW)
|
|
|
|
|
{
|
|
|
|
|
Frm_BeginFormGoTo (ActSeeCtrInf);
|
|
|
|
|
ParCod_PutPar (ParCod_Ctr,Gbl.Hierarchy.Node[Hie_CTR].HieCod);
|
|
|
|
|
HTM_BUTTON_Submit_Begin (Str_BuildGoToTitle (Gbl.Hierarchy.Node[Hie_CTR].ShrtName),
|
|
|
|
|
"class=\"LB BT_LINK\"");
|
|
|
|
|
Str_FreeGoToTitle ();
|
|
|
|
|
}
|
2023-11-28 01:44:05 +01:00
|
|
|
|
Lgo_DrawLogo (Hie_CTR,&Gbl.Hierarchy.Node[Hie_CTR],"LM ICO20x20");
|
2023-11-06 00:32:41 +01:00
|
|
|
|
HTM_NBSP ();
|
|
|
|
|
HTM_Txt (Gbl.Hierarchy.Node[Hie_CTR].FullName);
|
|
|
|
|
if (ViewType == Vie_VIEW)
|
|
|
|
|
{
|
|
|
|
|
HTM_BUTTON_End ();
|
|
|
|
|
Frm_EndForm ();
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case Frm_PUT_FORM:
|
|
|
|
|
/* Get list of centers of the current institution */
|
|
|
|
|
Ctr_GetBasicListOfCenters (Gbl.Hierarchy.Node[Hie_INS].HieCod);
|
|
|
|
|
|
|
|
|
|
/* Put form to select center */
|
|
|
|
|
Frm_BeginForm (ActChgDegCtrCfg);
|
|
|
|
|
HTM_SELECT_Begin (HTM_SUBMIT_ON_CHANGE,NULL,
|
|
|
|
|
"id=\"OthCtrCod\" name=\"OthCtrCod\""
|
2024-02-11 23:29:50 +01:00
|
|
|
|
" class=\"Frm_C2_INPUT INPUT_%s\"",
|
2023-11-06 00:32:41 +01:00
|
|
|
|
The_GetSuffix ());
|
|
|
|
|
for (NumCtr = 0;
|
|
|
|
|
NumCtr < Gbl.Hierarchy.List[Hie_INS].Num;
|
|
|
|
|
NumCtr++)
|
|
|
|
|
{
|
|
|
|
|
Ctr = &Gbl.Hierarchy.List[Hie_INS].Lst[NumCtr];
|
|
|
|
|
HTM_OPTION (HTM_Type_LONG,&Ctr->HieCod,
|
|
|
|
|
Ctr->HieCod == Gbl.Hierarchy.Node[Hie_CTR].HieCod ? HTM_OPTION_SELECTED :
|
|
|
|
|
HTM_OPTION_UNSELECTED,
|
|
|
|
|
HTM_OPTION_ENABLED,
|
|
|
|
|
"%s",Ctr->ShrtName);
|
|
|
|
|
}
|
|
|
|
|
HTM_SELECT_End ();
|
2021-05-27 23:30:16 +02:00
|
|
|
|
Frm_EndForm ();
|
2023-11-06 00:32:41 +01:00
|
|
|
|
|
|
|
|
|
/* Free list of centers */
|
|
|
|
|
Hie_FreeList (Hie_INS);
|
|
|
|
|
break;
|
|
|
|
|
}
|
2021-05-27 23:30:16 +02:00
|
|
|
|
HTM_TD_End ();
|
2019-12-29 13:13:09 +01:00
|
|
|
|
|
|
|
|
|
HTM_TR_End ();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/************** Show number of courses in degree configuration ***************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
static void DegCfg_NumCrss (void)
|
|
|
|
|
{
|
2023-11-06 15:20:34 +01:00
|
|
|
|
extern const char *Txt_HIERARCHY_PLURAL_Abc[Hie_NUM_LEVELS];
|
2019-12-29 13:13:09 +01:00
|
|
|
|
extern const char *Txt_Courses_of_DEGREE_X;
|
2021-12-29 21:31:49 +01:00
|
|
|
|
char *Title;
|
2019-12-29 13:13:09 +01:00
|
|
|
|
|
|
|
|
|
/***** Number of courses *****/
|
2021-05-27 23:30:16 +02:00
|
|
|
|
/* Begin table row */
|
2019-12-29 13:13:09 +01:00
|
|
|
|
HTM_TR_Begin (NULL);
|
|
|
|
|
|
2021-05-27 23:30:16 +02:00
|
|
|
|
/* Label */
|
2024-02-11 23:29:50 +01:00
|
|
|
|
Frm_LabelColumn ("Frm_C1 RT",NULL,Txt_HIERARCHY_PLURAL_Abc[Hie_CRS]);
|
2021-05-27 23:30:16 +02:00
|
|
|
|
|
|
|
|
|
/* Data */
|
2024-02-11 23:29:50 +01:00
|
|
|
|
HTM_TD_Begin ("class=\"Frm_C2 LB DAT_%s\"",The_GetSuffix ());
|
2021-05-27 23:30:16 +02:00
|
|
|
|
Frm_BeginFormGoTo (ActSeeCrs);
|
2023-09-22 14:47:56 +02:00
|
|
|
|
ParCod_PutPar (ParCod_Deg,Gbl.Hierarchy.Node[Hie_DEG].HieCod);
|
2023-09-19 08:56:19 +02:00
|
|
|
|
if (asprintf (&Title,Txt_Courses_of_DEGREE_X,
|
2023-09-22 14:47:56 +02:00
|
|
|
|
Gbl.Hierarchy.Node[Hie_DEG].ShrtName) < 0)
|
2021-12-29 21:31:49 +01:00
|
|
|
|
Err_NotEnoughMemoryExit ();
|
2022-09-09 12:50:53 +02:00
|
|
|
|
HTM_BUTTON_Submit_Begin (Title,"class=\"LB BT_LINK\"");
|
2021-12-29 21:31:49 +01:00
|
|
|
|
free (Title);
|
2023-09-22 14:47:56 +02:00
|
|
|
|
HTM_Unsigned (Hie_GetCachedNumNodesInHieLvl (Hie_CRS, // Number of courses...
|
|
|
|
|
Hie_DEG, // ...in degree
|
|
|
|
|
Gbl.Hierarchy.Node[Hie_DEG].HieCod));
|
2021-05-27 23:30:16 +02:00
|
|
|
|
HTM_BUTTON_End ();
|
|
|
|
|
Frm_EndForm ();
|
|
|
|
|
HTM_TD_End ();
|
2019-12-29 13:13:09 +01:00
|
|
|
|
|
2021-05-27 23:30:16 +02:00
|
|
|
|
/* End table row */
|
2019-12-29 13:13:09 +01:00
|
|
|
|
HTM_TR_End ();
|
|
|
|
|
}
|
|
|
|
|
|
2019-12-29 15:10:34 +01:00
|
|
|
|
/*****************************************************************************/
|
2021-03-07 21:21:04 +01:00
|
|
|
|
/************************ Change the center of a degree **********************/
|
2019-12-29 15:10:34 +01:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2019-12-29 16:21:42 +01:00
|
|
|
|
void DegCfg_ChangeDegCtr (void)
|
2019-12-29 15:10:34 +01:00
|
|
|
|
{
|
2023-12-06 20:59:19 +01:00
|
|
|
|
extern bool (*Hie_GetDataByCod[Hie_NUM_LEVELS]) (struct Hie_Node *Node);
|
2021-03-07 21:21:04 +01:00
|
|
|
|
extern const char *Txt_The_degree_X_has_been_moved_to_the_center_Y;
|
2023-09-18 15:15:29 +02:00
|
|
|
|
struct Hie_Node NewCtr;
|
2023-10-11 00:02:14 +02:00
|
|
|
|
const char *Names[Nam_NUM_SHRT_FULL_NAMES];
|
2019-12-29 15:10:34 +01:00
|
|
|
|
|
2021-03-07 21:21:04 +01:00
|
|
|
|
/***** Get parameter with center code *****/
|
2023-09-20 10:36:07 +02:00
|
|
|
|
NewCtr.HieCod = ParCod_GetAndCheckPar (ParCod_OthCtr);
|
2019-12-29 15:10:34 +01:00
|
|
|
|
|
2021-03-07 21:21:04 +01:00
|
|
|
|
/***** Check if center has changed *****/
|
2023-09-22 14:47:56 +02:00
|
|
|
|
if (NewCtr.HieCod != Gbl.Hierarchy.Node[Hie_DEG].PrtCod)
|
2019-12-29 15:10:34 +01:00
|
|
|
|
{
|
2021-03-07 21:21:04 +01:00
|
|
|
|
/***** Get data of new center *****/
|
2023-12-06 20:59:19 +01:00
|
|
|
|
Hie_GetDataByCod[Hie_CTR] (&NewCtr);
|
2019-12-29 15:10:34 +01:00
|
|
|
|
|
2023-10-10 14:42:33 +02:00
|
|
|
|
/***** Check if it already existed a degree with the same name in the new center *****/
|
2023-10-11 00:02:14 +02:00
|
|
|
|
Names[Nam_SHRT_NAME] = Gbl.Hierarchy.Node[Hie_DEG].ShrtName;
|
|
|
|
|
Names[Nam_FULL_NAME] = Gbl.Hierarchy.Node[Hie_DEG].FullName;
|
|
|
|
|
if (!Nam_CheckIfNameExists (Deg_DB_CheckIfDegNameExistsInCtr,
|
|
|
|
|
Names,
|
|
|
|
|
Gbl.Hierarchy.Node[Hie_DEG].HieCod,
|
|
|
|
|
NewCtr.HieCod,
|
2023-10-10 14:42:33 +02:00
|
|
|
|
0)) // Unused
|
2019-12-29 15:10:34 +01:00
|
|
|
|
{
|
2021-03-07 21:21:04 +01:00
|
|
|
|
/***** Update center in table of degrees *****/
|
2023-09-22 14:47:56 +02:00
|
|
|
|
Deg_DB_UpdateDegCtr (Gbl.Hierarchy.Node[Hie_DEG].HieCod,NewCtr.HieCod);
|
|
|
|
|
Gbl.Hierarchy.Node[Hie_DEG].PrtCod =
|
|
|
|
|
Gbl.Hierarchy.Node[Hie_CTR].HieCod = NewCtr.HieCod;
|
2019-12-29 15:10:34 +01:00
|
|
|
|
|
2021-03-07 21:21:04 +01:00
|
|
|
|
/***** Initialize again current course, degree, center... *****/
|
2019-12-29 15:10:34 +01:00
|
|
|
|
Hie_InitHierarchy ();
|
|
|
|
|
|
|
|
|
|
/***** Create alert to show the change made *****/
|
|
|
|
|
Ale_CreateAlert (Ale_SUCCESS,NULL,
|
2021-03-07 21:21:04 +01:00
|
|
|
|
Txt_The_degree_X_has_been_moved_to_the_center_Y,
|
2023-10-10 10:51:21 +02:00
|
|
|
|
Names[Nam_FULL_NAME],
|
2023-09-22 14:47:56 +02:00
|
|
|
|
Gbl.Hierarchy.Node[Hie_CTR].FullName);
|
2019-12-29 15:10:34 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/*************** Change the name of a degree in configuration ****************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2019-12-29 16:21:42 +01:00
|
|
|
|
void DegCfg_RenameDegreeShort (void)
|
2019-12-29 15:10:34 +01:00
|
|
|
|
{
|
2023-10-10 10:51:21 +02:00
|
|
|
|
Deg_RenameDegree (&Gbl.Hierarchy.Node[Hie_DEG],Nam_SHRT_NAME);
|
2019-12-29 15:10:34 +01:00
|
|
|
|
}
|
|
|
|
|
|
2019-12-29 16:21:42 +01:00
|
|
|
|
void DegCfg_RenameDegreeFull (void)
|
2019-12-29 15:10:34 +01:00
|
|
|
|
{
|
2023-10-10 10:51:21 +02:00
|
|
|
|
Deg_RenameDegree (&Gbl.Hierarchy.Node[Hie_DEG],Nam_FULL_NAME);
|
2019-12-29 15:10:34 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/************************* Change the WWW of a degree ************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2019-12-29 16:21:42 +01:00
|
|
|
|
void DegCfg_ChangeDegWWW (void)
|
2019-12-29 15:10:34 +01:00
|
|
|
|
{
|
|
|
|
|
extern const char *Txt_The_new_web_address_is_X;
|
|
|
|
|
char NewWWW[Cns_MAX_BYTES_WWW + 1];
|
|
|
|
|
|
|
|
|
|
/***** Get parameters from form *****/
|
|
|
|
|
/* Get the new WWW for the degree */
|
2023-03-07 09:55:39 +01:00
|
|
|
|
Par_GetParText ("WWW",NewWWW,Cns_MAX_BYTES_WWW);
|
2019-12-29 15:10:34 +01:00
|
|
|
|
|
|
|
|
|
/***** Check if new WWW is empty *****/
|
|
|
|
|
if (NewWWW[0])
|
|
|
|
|
{
|
|
|
|
|
/***** Update the table changing old WWW by new WWW *****/
|
2023-09-22 14:47:56 +02:00
|
|
|
|
Deg_DB_UpdateDegWWW (Gbl.Hierarchy.Node[Hie_DEG].HieCod,NewWWW);
|
|
|
|
|
Str_Copy (Gbl.Hierarchy.Node[Hie_DEG].WWW,NewWWW,
|
|
|
|
|
sizeof (Gbl.Hierarchy.Node[Hie_DEG].WWW) - 1);
|
2019-12-29 15:10:34 +01:00
|
|
|
|
|
|
|
|
|
/***** Write message to show the change made *****/
|
|
|
|
|
Ale_ShowAlert (Ale_SUCCESS,Txt_The_new_web_address_is_X,
|
|
|
|
|
NewWWW);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
Ale_ShowAlertYouCanNotLeaveFieldEmpty ();
|
|
|
|
|
|
|
|
|
|
/***** Show the form again *****/
|
|
|
|
|
DegCfg_ShowConfiguration ();
|
|
|
|
|
}
|
|
|
|
|
|
2023-03-17 12:51:11 +01:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/*********** Show a form for sending a logo of the current degree ************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
void DegCfg_ReqLogo (void)
|
|
|
|
|
{
|
2023-09-22 14:47:56 +02:00
|
|
|
|
Lgo_RequestLogo (Hie_DEG);
|
2023-03-17 12:51:11 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/***************** Receive the logo of the current degree ********************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
void DegCfg_ReceiveLogo (void)
|
|
|
|
|
{
|
2023-09-22 14:47:56 +02:00
|
|
|
|
Lgo_ReceiveLogo (Hie_DEG);
|
2023-03-17 12:51:11 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/****************** Remove the logo of the current degree ********************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
void DegCfg_RemoveLogo (void)
|
|
|
|
|
{
|
2023-09-22 14:47:56 +02:00
|
|
|
|
Lgo_RemoveLogo (Hie_DEG);
|
2023-03-17 12:51:11 +01:00
|
|
|
|
}
|
|
|
|
|
|
2019-12-29 15:10:34 +01:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/** Show message of success after changing a degree in degree configuration **/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2019-12-29 16:21:42 +01:00
|
|
|
|
void DegCfg_ContEditAfterChgDeg (void)
|
2019-12-29 15:10:34 +01:00
|
|
|
|
{
|
|
|
|
|
/***** Write success / warning message *****/
|
|
|
|
|
Ale_ShowAlerts (NULL);
|
|
|
|
|
|
|
|
|
|
/***** Show the form again *****/
|
|
|
|
|
DegCfg_ShowConfiguration ();
|
|
|
|
|
}
|