mirror of https://github.com/acanas/swad-core.git
Version 23.30: Oct 09, 2023 Code refactoring in short and full names.
This commit is contained in:
parent
cb3fb80753
commit
64e6b79510
|
@ -577,7 +577,7 @@ void Ale_CreateAlertYouMustSpecifyTheName (void)
|
|||
/************ Create alert when short name or full name are empty ************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Ale_CreateAlertYouMustSpecifyTheShortNameAndTheFullName (void)
|
||||
void Ale_CreateAlertYouMustSpecifyShrtNameAndFullName (void)
|
||||
{
|
||||
extern const char *Txt_You_must_specify_the_short_name_and_the_full_name;
|
||||
|
||||
|
|
|
@ -92,6 +92,6 @@ void Ale_CreateAlertYouCanNotLeaveFieldEmpty (void);
|
|||
void Ale_CreateAlertYouMustSpecifyTheTitle (void);
|
||||
void Ale_CreateAlertYouMustSpecifyTheWebAddress (void);
|
||||
void Ale_CreateAlertYouMustSpecifyTheName (void);
|
||||
void Ale_CreateAlertYouMustSpecifyTheShortNameAndTheFullName (void);
|
||||
void Ale_CreateAlertYouMustSpecifyShrtNameAndFullName (void);
|
||||
|
||||
#endif
|
||||
|
|
162
swad_banner.c
162
swad_banner.c
|
@ -383,15 +383,25 @@ void Ban_PutIconToViewBanners (void)
|
|||
|
||||
static void Ban_ListBannersForEdition (struct Ban_Banners *Banners)
|
||||
{
|
||||
extern const char *Cns_ParShrtOrFullName[Cns_NUM_SHRT_FULL_NAMES];
|
||||
extern unsigned Cns_MaxCharsShrtOrFullName[Cns_NUM_SHRT_FULL_NAMES];
|
||||
extern const char *Cns_ClassShrtOrFullName[Cns_NUM_SHRT_FULL_NAMES];
|
||||
extern const char *HidVis_DataClass[HidVis_NUM_HIDDEN_VISIBLE];
|
||||
static Act_Action_t ActionHideUnhide[HidVis_NUM_HIDDEN_VISIBLE] =
|
||||
{
|
||||
[HidVis_HIDDEN ] = ActUnhBan, // Hidden ==> action to unhide
|
||||
[HidVis_VISIBLE] = ActHidBan, // Visible ==> action to hide
|
||||
};
|
||||
extern const char *HidVis_DataClass[HidVis_NUM_HIDDEN_VISIBLE];
|
||||
static Act_Action_t ActionRename[Cns_NUM_SHRT_FULL_NAMES] =
|
||||
{
|
||||
[Cns_SHRT_NAME] = ActRenBanSho,
|
||||
[Cns_FULL_NAME] = ActRenBanFul,
|
||||
};
|
||||
unsigned NumBan;
|
||||
struct Ban_Banner *Ban;
|
||||
char *Anchor = NULL;
|
||||
char *Name[Cns_NUM_SHRT_FULL_NAMES];
|
||||
Cns_ShrtOrFullName_t ShrtOrFullName;
|
||||
|
||||
/***** Begin table *****/
|
||||
HTM_TABLE_BeginWidePadding (2);
|
||||
|
@ -437,27 +447,26 @@ static void Ban_ListBannersForEdition (struct Ban_Banners *Banners)
|
|||
HTM_ARTICLE_End ();
|
||||
HTM_TD_End ();
|
||||
|
||||
/* Banner short name */
|
||||
HTM_TD_Begin ("class=\"CM\"");
|
||||
Frm_BeginForm (ActRenBanSho);
|
||||
ParCod_PutPar (ParCod_Ban,Banners->BanCodToEdit);
|
||||
HTM_INPUT_TEXT ("ShortName",Cns_MAX_CHARS_SHRT_NAME,Ban->ShrtName,
|
||||
HTM_SUBMIT_ON_CHANGE,
|
||||
"class=\"INPUT_SHORT_NAME INPUT_%s\"",
|
||||
The_GetSuffix ());
|
||||
Frm_EndForm ();
|
||||
HTM_TD_End ();
|
||||
|
||||
/* Banner full name */
|
||||
HTM_TD_Begin ("class=\"CM\"");
|
||||
Frm_BeginForm (ActRenBanFul);
|
||||
ParCod_PutPar (ParCod_Ban,Banners->BanCodToEdit);
|
||||
HTM_INPUT_TEXT ("FullName",Cns_MAX_CHARS_FULL_NAME,Ban->FullName,
|
||||
HTM_SUBMIT_ON_CHANGE,
|
||||
"class=\"INPUT_FULL_NAME INPUT_%s\"",
|
||||
The_GetSuffix ());
|
||||
Frm_EndForm ();
|
||||
HTM_TD_End ();
|
||||
/* Banner short name and full name */
|
||||
Name[Cns_SHRT_NAME] = Ban->ShrtName;
|
||||
Name[Cns_FULL_NAME] = Ban->FullName;
|
||||
for (ShrtOrFullName = Cns_SHRT_NAME;
|
||||
ShrtOrFullName <= Cns_FULL_NAME;
|
||||
ShrtOrFullName++)
|
||||
{
|
||||
HTM_TD_Begin ("class=\"CM\"");
|
||||
Frm_BeginForm (ActionRename[ShrtOrFullName]);
|
||||
ParCod_PutPar (ParCod_Ban,Banners->BanCodToEdit);
|
||||
HTM_INPUT_TEXT (Cns_ParShrtOrFullName[ShrtOrFullName],
|
||||
Cns_MaxCharsShrtOrFullName[ShrtOrFullName],
|
||||
Name[ShrtOrFullName],
|
||||
HTM_SUBMIT_ON_CHANGE,
|
||||
"class=\"%s INPUT_%s\"",
|
||||
Cns_ClassShrtOrFullName[ShrtOrFullName],
|
||||
The_GetSuffix ());
|
||||
Frm_EndForm ();
|
||||
HTM_TD_End ();
|
||||
}
|
||||
|
||||
/* Banner image */
|
||||
HTM_TD_Begin ("class=\"CM\"");
|
||||
|
@ -783,6 +792,16 @@ void Ban_ContEditAfterChgBan (void)
|
|||
|
||||
static void Ban_PutFormToCreateBanner (const struct Ban_Banner *Ban)
|
||||
{
|
||||
extern const char *Cns_ParShrtOrFullName[Cns_NUM_SHRT_FULL_NAMES];
|
||||
extern unsigned Cns_MaxCharsShrtOrFullName[Cns_NUM_SHRT_FULL_NAMES];
|
||||
extern const char *Cns_ClassShrtOrFullName[Cns_NUM_SHRT_FULL_NAMES];
|
||||
const char *Name[Cns_NUM_SHRT_FULL_NAMES] =
|
||||
{
|
||||
[Cns_SHRT_NAME] = Ban->ShrtName,
|
||||
[Cns_FULL_NAME] = Ban->FullName,
|
||||
};
|
||||
Cns_ShrtOrFullName_t ShrtOrFullName;
|
||||
|
||||
/***** Begin form to create *****/
|
||||
Frm_BeginFormTable (ActNewBan,NULL,NULL,NULL);
|
||||
|
||||
|
@ -802,23 +821,22 @@ static void Ban_PutFormToCreateBanner (const struct Ban_Banner *Ban)
|
|||
|
||||
HTM_TD_Empty (1);
|
||||
|
||||
/* Banner short name */
|
||||
HTM_TD_Begin ("class=\"CM\"");
|
||||
HTM_INPUT_TEXT ("ShortName",Cns_MAX_CHARS_SHRT_NAME,Ban->ShrtName,
|
||||
HTM_DONT_SUBMIT_ON_CHANGE,
|
||||
"class=\"INPUT_SHORT_NAME INPUT_%s\""
|
||||
" required=\"required\"",
|
||||
The_GetSuffix ());
|
||||
HTM_TD_End ();
|
||||
|
||||
/* Banner full name */
|
||||
HTM_TD_Begin ("class=\"CM\"");
|
||||
HTM_INPUT_TEXT ("FullName",Cns_MAX_CHARS_FULL_NAME,Ban->FullName,
|
||||
HTM_DONT_SUBMIT_ON_CHANGE,
|
||||
"class=\"INPUT_FULL_NAME INPUT_%s\""
|
||||
" required=\"required\"",
|
||||
The_GetSuffix ());
|
||||
HTM_TD_End ();
|
||||
/* Banner short name and full name */
|
||||
for (ShrtOrFullName = Cns_SHRT_NAME;
|
||||
ShrtOrFullName <= Cns_FULL_NAME;
|
||||
ShrtOrFullName++)
|
||||
{
|
||||
HTM_TD_Begin ("class=\"CM\"");
|
||||
HTM_INPUT_TEXT (Cns_ParShrtOrFullName[ShrtOrFullName],
|
||||
Cns_MaxCharsShrtOrFullName[ShrtOrFullName],
|
||||
Name[ShrtOrFullName],
|
||||
HTM_DONT_SUBMIT_ON_CHANGE,
|
||||
"class=\"%s INPUT_%s\""
|
||||
" required=\"required\"",
|
||||
Cns_ClassShrtOrFullName[ShrtOrFullName],
|
||||
The_GetSuffix ());
|
||||
HTM_TD_End ();
|
||||
}
|
||||
|
||||
/* Banner image */
|
||||
HTM_TD_Begin ("class=\"CM\"");
|
||||
|
@ -878,48 +896,68 @@ static void Ban_PutHeadBanners (void)
|
|||
|
||||
void Ban_ReceiveFormNewBanner (void)
|
||||
{
|
||||
extern const char *Cns_ParShrtOrFullName[Cns_NUM_SHRT_FULL_NAMES];
|
||||
extern const char *Cns_FldShrtOrFullName[Cns_NUM_SHRT_FULL_NAMES];
|
||||
extern unsigned Cns_MaxBytesShrtOrFullName[Cns_NUM_SHRT_FULL_NAMES];
|
||||
extern const char *Txt_The_banner_X_already_exists;
|
||||
extern const char *Txt_You_must_specify_the_image_of_the_new_banner;
|
||||
extern const char *Txt_You_must_specify_the_web_address;
|
||||
extern const char *Txt_Created_new_banner_X;
|
||||
struct Ban_Banner *Ban = Ban_GetEditingBanner ();
|
||||
Cns_ShrtOrFullName_t ShrtOrFullName;
|
||||
bool Exists;
|
||||
char *Name[Cns_NUM_SHRT_FULL_NAMES] =
|
||||
{
|
||||
[Cns_SHRT_NAME] = Ban->ShrtName,
|
||||
[Cns_FULL_NAME] = Ban->FullName,
|
||||
};
|
||||
|
||||
/***** Reset banner *****/
|
||||
Ban_ResetBanner (Ban);
|
||||
|
||||
/***** Get parameters from form *****/
|
||||
Par_GetParText ("ShortName",Ban->ShrtName,Cns_MAX_BYTES_SHRT_NAME);
|
||||
Par_GetParText ("FullName" ,Ban->FullName,Cns_MAX_BYTES_FULL_NAME);
|
||||
Par_GetParText ("Img" ,Ban->Img ,Ban_MAX_BYTES_IMAGE);
|
||||
Par_GetParText ("WWW" ,Ban->WWW ,Cns_MAX_BYTES_WWW);
|
||||
for (ShrtOrFullName = Cns_SHRT_NAME;
|
||||
ShrtOrFullName <= Cns_FULL_NAME;
|
||||
ShrtOrFullName++)
|
||||
Par_GetParText (Cns_ParShrtOrFullName[ShrtOrFullName],
|
||||
Name[ShrtOrFullName],
|
||||
Cns_MaxBytesShrtOrFullName[ShrtOrFullName]);
|
||||
Par_GetParText ("Img",Ban->Img,Ban_MAX_BYTES_IMAGE);
|
||||
Par_GetParText ("WWW",Ban->WWW,Cns_MAX_BYTES_WWW);
|
||||
|
||||
if (Ban->ShrtName[0] &&
|
||||
Ban->FullName[0]) // If there's a banner name
|
||||
{
|
||||
/***** If name of banner was in database... *****/
|
||||
if (Ban_DB_CheckIfBannerNameExists ("ShortName",Ban->ShrtName,-1L))
|
||||
Ale_CreateAlert (Ale_WARNING,NULL,
|
||||
Txt_The_banner_X_already_exists,
|
||||
Ban->ShrtName);
|
||||
else if (Ban_DB_CheckIfBannerNameExists ("FullName",Ban->FullName,-1L))
|
||||
Ale_CreateAlert (Ale_WARNING,NULL,
|
||||
Txt_The_banner_X_already_exists,
|
||||
Ban->FullName);
|
||||
else if (!Ban->Img[0])
|
||||
Ale_CreateAlert (Ale_WARNING,NULL,
|
||||
Txt_You_must_specify_the_image_of_the_new_banner);
|
||||
else if (!Ban->WWW[0])
|
||||
Ale_CreateAlert (Ale_WARNING,NULL,
|
||||
Txt_You_must_specify_the_web_address);
|
||||
else // Add new banner to database
|
||||
for (ShrtOrFullName = Cns_SHRT_NAME, Exists = false;
|
||||
ShrtOrFullName <= Cns_FULL_NAME && !Exists;
|
||||
ShrtOrFullName++)
|
||||
if (Ban_DB_CheckIfBannerNameExists (Cns_FldShrtOrFullName[ShrtOrFullName],
|
||||
Name[ShrtOrFullName],-1L))
|
||||
{
|
||||
Ale_CreateAlert (Ale_WARNING,NULL,
|
||||
Txt_The_banner_X_already_exists,
|
||||
Name[ShrtOrFullName]);
|
||||
Exists = true;
|
||||
}
|
||||
if (!Exists)
|
||||
{
|
||||
Ban_DB_CreateBanner (Ban);
|
||||
Ale_CreateAlert (Ale_SUCCESS,Txt_Created_new_banner_X,
|
||||
Ban->ShrtName);
|
||||
if (!Ban->Img[0])
|
||||
Ale_CreateAlert (Ale_WARNING,NULL,
|
||||
Txt_You_must_specify_the_image_of_the_new_banner);
|
||||
else if (!Ban->WWW[0])
|
||||
Ale_CreateAlert (Ale_WARNING,NULL,
|
||||
Txt_You_must_specify_the_web_address);
|
||||
else // Add new banner to database
|
||||
{
|
||||
Ban_DB_CreateBanner (Ban);
|
||||
Ale_CreateAlert (Ale_SUCCESS,Txt_Created_new_banner_X,
|
||||
Ban->ShrtName);
|
||||
}
|
||||
}
|
||||
}
|
||||
else // If there is not a banner name
|
||||
Ale_CreateAlertYouMustSpecifyTheShortNameAndTheFullName ();
|
||||
Ale_CreateAlertYouMustSpecifyShrtNameAndFullName ();
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
139
swad_building.c
139
swad_building.c
|
@ -390,9 +390,19 @@ void Bld_FreeListBuildings (struct Bld_Buildings *Buildings)
|
|||
|
||||
static void Bld_ListBuildingsForEdition (const struct Bld_Buildings *Buildings)
|
||||
{
|
||||
extern const char *Cns_ParShrtOrFullName[Cns_NUM_SHRT_FULL_NAMES];
|
||||
extern unsigned Cns_MaxCharsShrtOrFullName[Cns_NUM_SHRT_FULL_NAMES];
|
||||
extern const char *Cns_ClassShrtOrFullName[Cns_NUM_SHRT_FULL_NAMES];
|
||||
static Act_Action_t ActionRename[Cns_NUM_SHRT_FULL_NAMES] =
|
||||
{
|
||||
[Cns_SHRT_NAME] = ActRenBldSho,
|
||||
[Cns_FULL_NAME] = ActRenBldFul,
|
||||
};
|
||||
unsigned NumBld;
|
||||
struct Bld_Building *Building;
|
||||
char *Anchor = NULL;
|
||||
Cns_ShrtOrFullName_t ShrtOrFullName;
|
||||
char *Name[Cns_NUM_SHRT_FULL_NAMES];
|
||||
|
||||
/***** Begin table *****/
|
||||
HTM_TABLE_BeginWidePadding (2);
|
||||
|
@ -425,27 +435,26 @@ static void Bld_ListBuildingsForEdition (const struct Bld_Buildings *Buildings)
|
|||
HTM_ARTICLE_End ();
|
||||
HTM_TD_End ();
|
||||
|
||||
/* Building short name */
|
||||
HTM_TD_Begin ("class=\"LM\"");
|
||||
Frm_BeginFormAnchor (ActRenBldSho,Anchor);
|
||||
ParCod_PutPar (ParCod_Bld,Building->BldCod);
|
||||
HTM_INPUT_TEXT ("ShortName",Cns_MAX_CHARS_SHRT_NAME,Building->ShrtName,
|
||||
HTM_SUBMIT_ON_CHANGE,
|
||||
"size=\"10\" class=\"INPUT_SHORT_NAME INPUT_%s\"",
|
||||
The_GetSuffix ());
|
||||
Frm_EndForm ();
|
||||
HTM_TD_End ();
|
||||
|
||||
/* Building full name */
|
||||
HTM_TD_Begin ("class=\"LM\"");
|
||||
Frm_BeginFormAnchor (ActRenBldFul,Anchor);
|
||||
ParCod_PutPar (ParCod_Bld,Building->BldCod);
|
||||
HTM_INPUT_TEXT ("FullName",Cns_MAX_CHARS_FULL_NAME,Building->FullName,
|
||||
HTM_SUBMIT_ON_CHANGE,
|
||||
"size=\"20\" class=\"INPUT_FULL_NAME INPUT_%s\"",
|
||||
The_GetSuffix ());
|
||||
Frm_EndForm ();
|
||||
HTM_TD_End ();
|
||||
/* Building short name and full name */
|
||||
Name[Cns_SHRT_NAME] = Building->ShrtName;
|
||||
Name[Cns_FULL_NAME] = Building->FullName;
|
||||
for (ShrtOrFullName = Cns_SHRT_NAME;
|
||||
ShrtOrFullName <= Cns_FULL_NAME;
|
||||
ShrtOrFullName++)
|
||||
{
|
||||
HTM_TD_Begin ("class=\"LM\"");
|
||||
Frm_BeginFormAnchor (ActionRename[ShrtOrFullName],Anchor);
|
||||
ParCod_PutPar (ParCod_Bld,Building->BldCod);
|
||||
HTM_INPUT_TEXT (Cns_ParShrtOrFullName[ShrtOrFullName],
|
||||
Cns_MaxCharsShrtOrFullName[ShrtOrFullName],
|
||||
Name[ShrtOrFullName],
|
||||
HTM_SUBMIT_ON_CHANGE,
|
||||
"size=\"10\" class=\"%s INPUT_%s\"",
|
||||
Cns_ClassShrtOrFullName[ShrtOrFullName],
|
||||
The_GetSuffix ());
|
||||
Frm_EndForm ();
|
||||
HTM_TD_End ();
|
||||
}
|
||||
|
||||
/* Building location */
|
||||
HTM_TD_Begin ("class=\"LM\"");
|
||||
|
@ -664,6 +673,16 @@ void Bld_ContEditAfterChgBuilding (void)
|
|||
|
||||
static void Bld_PutFormToCreateBuilding (void)
|
||||
{
|
||||
extern const char *Cns_ParShrtOrFullName[Cns_NUM_SHRT_FULL_NAMES];
|
||||
extern unsigned Cns_MaxCharsShrtOrFullName[Cns_NUM_SHRT_FULL_NAMES];
|
||||
extern const char *Cns_ClassShrtOrFullName[Cns_NUM_SHRT_FULL_NAMES];
|
||||
Cns_ShrtOrFullName_t ShrtOrFullName;
|
||||
char *Name[Cns_NUM_SHRT_FULL_NAMES] =
|
||||
{
|
||||
[Cns_SHRT_NAME] = Bld_EditingBuilding->ShrtName,
|
||||
[Cns_FULL_NAME] = Bld_EditingBuilding->FullName,
|
||||
};
|
||||
|
||||
/***** Begin form to create *****/
|
||||
Frm_BeginFormTable (ActNewBld,NULL,NULL,NULL);
|
||||
|
||||
|
@ -680,23 +699,22 @@ static void Bld_PutFormToCreateBuilding (void)
|
|||
HTM_TD_Begin ("class=\"CODE\"");
|
||||
HTM_TD_End ();
|
||||
|
||||
/***** Building short name *****/
|
||||
HTM_TD_Begin ("class=\"LM\"");
|
||||
HTM_INPUT_TEXT ("ShortName",Cns_MAX_CHARS_SHRT_NAME,Bld_EditingBuilding->ShrtName,
|
||||
HTM_DONT_SUBMIT_ON_CHANGE,
|
||||
"size=\"10\" class=\"INPUT_SHORT_NAME INPUT_%s\""
|
||||
" required=\"required\"",
|
||||
The_GetSuffix ());
|
||||
HTM_TD_End ();
|
||||
|
||||
/***** Building full name *****/
|
||||
HTM_TD_Begin ("class=\"LM\"");
|
||||
HTM_INPUT_TEXT ("FullName",Cns_MAX_CHARS_FULL_NAME,Bld_EditingBuilding->FullName,
|
||||
HTM_DONT_SUBMIT_ON_CHANGE,
|
||||
"size=\"20\" class=\"INPUT_FULL_NAME INPUT_%s\""
|
||||
" required=\"required\"",
|
||||
The_GetSuffix ());
|
||||
HTM_TD_End ();
|
||||
/***** Building short name and full name *****/
|
||||
for (ShrtOrFullName = Cns_SHRT_NAME;
|
||||
ShrtOrFullName <= Cns_FULL_NAME;
|
||||
ShrtOrFullName++)
|
||||
{
|
||||
HTM_TD_Begin ("class=\"LM\"");
|
||||
HTM_INPUT_TEXT (Cns_ParShrtOrFullName[ShrtOrFullName],
|
||||
Cns_MaxCharsShrtOrFullName[ShrtOrFullName],
|
||||
Name[ShrtOrFullName],
|
||||
HTM_DONT_SUBMIT_ON_CHANGE,
|
||||
"size=\"10\" class=\"%s INPUT_%s\""
|
||||
" required=\"required\"",
|
||||
Cns_ClassShrtOrFullName[ShrtOrFullName],
|
||||
The_GetSuffix ());
|
||||
HTM_TD_End ();
|
||||
}
|
||||
|
||||
/***** Building location *****/
|
||||
HTM_TD_Begin ("class=\"LM\"");
|
||||
|
@ -740,18 +758,30 @@ static void Bld_PutHeadBuildings (void)
|
|||
|
||||
void Bld_ReceiveFormNewBuilding (void)
|
||||
{
|
||||
extern const char *Cns_ParShrtOrFullName[Cns_NUM_SHRT_FULL_NAMES];
|
||||
extern const char *Cns_FldShrtOrFullName[Cns_NUM_SHRT_FULL_NAMES];
|
||||
extern unsigned Cns_MaxBytesShrtOrFullName[Cns_NUM_SHRT_FULL_NAMES];
|
||||
extern const char *Txt_The_building_X_already_exists;
|
||||
extern const char *Txt_Created_new_building_X;
|
||||
Cns_ShrtOrFullName_t ShrtOrFullName;
|
||||
bool Exists;
|
||||
char *Name[Cns_NUM_SHRT_FULL_NAMES] =
|
||||
{
|
||||
[Cns_SHRT_NAME] = Bld_EditingBuilding->ShrtName,
|
||||
[Cns_FULL_NAME] = Bld_EditingBuilding->FullName,
|
||||
};
|
||||
|
||||
/***** Building constructor *****/
|
||||
Bld_EditingBuildingConstructor ();
|
||||
|
||||
/***** Get parameters from form *****/
|
||||
/* Get building short name */
|
||||
Par_GetParText ("ShortName",Bld_EditingBuilding->ShrtName,Cns_MAX_BYTES_SHRT_NAME);
|
||||
|
||||
/* Get building full name */
|
||||
Par_GetParText ("FullName",Bld_EditingBuilding->FullName,Cns_MAX_BYTES_FULL_NAME);
|
||||
/* Get building short name and full name */
|
||||
for (ShrtOrFullName = Cns_SHRT_NAME;
|
||||
ShrtOrFullName <= Cns_FULL_NAME;
|
||||
ShrtOrFullName++)
|
||||
Par_GetParText (Cns_ParShrtOrFullName[ShrtOrFullName],
|
||||
Name[ShrtOrFullName],
|
||||
Cns_MaxBytesShrtOrFullName[ShrtOrFullName]);
|
||||
|
||||
/* Get building location */
|
||||
Par_GetParText ("Location",Bld_EditingBuilding->Location,Bld_MAX_BYTES_LOCATION);
|
||||
|
@ -760,15 +790,18 @@ void Bld_ReceiveFormNewBuilding (void)
|
|||
Bld_EditingBuilding->FullName[0]) // If there's a building name
|
||||
{
|
||||
/***** If name of building was in database... *****/
|
||||
if (Bld_DB_CheckIfBuildingNameExists ("ShortName",Bld_EditingBuilding->ShrtName,-1L))
|
||||
Ale_CreateAlert (Ale_WARNING,NULL,
|
||||
Txt_The_building_X_already_exists,
|
||||
Bld_EditingBuilding->ShrtName);
|
||||
else if (Bld_DB_CheckIfBuildingNameExists ("FullName",Bld_EditingBuilding->FullName,-1L))
|
||||
Ale_CreateAlert (Ale_WARNING,NULL,
|
||||
Txt_The_building_X_already_exists,
|
||||
Bld_EditingBuilding->FullName);
|
||||
else // Add new building to database
|
||||
for (ShrtOrFullName = Cns_SHRT_NAME, Exists = false;
|
||||
ShrtOrFullName <= Cns_FULL_NAME && !Exists;
|
||||
ShrtOrFullName++)
|
||||
if (Bld_DB_CheckIfBuildingNameExists (Cns_FldShrtOrFullName[ShrtOrFullName],
|
||||
Name[ShrtOrFullName],-1L))
|
||||
{
|
||||
Ale_CreateAlert (Ale_WARNING,NULL,
|
||||
Txt_The_building_X_already_exists,
|
||||
Name[ShrtOrFullName]);
|
||||
Exists = true;
|
||||
}
|
||||
if (!Exists) // Add new building to database
|
||||
{
|
||||
Bld_DB_CreateBuilding (Bld_EditingBuilding);
|
||||
Ale_CreateAlert (Ale_SUCCESS,NULL,
|
||||
|
@ -777,7 +810,7 @@ void Bld_ReceiveFormNewBuilding (void)
|
|||
}
|
||||
}
|
||||
else // If there is not a building name
|
||||
Ale_CreateAlertYouMustSpecifyTheShortNameAndTheFullName ();
|
||||
Ale_CreateAlertYouMustSpecifyShrtNameAndFullName ();
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -854,6 +854,7 @@ static void Cfe_ShowCallForExam (struct Cfe_CallsForExams *CallsForExams,
|
|||
Cfe_TypeViewCallForExam_t TypeViewCallForExam,
|
||||
bool HighLight)
|
||||
{
|
||||
extern unsigned Cns_MaxCharsShrtOrFullName[Cns_NUM_SHRT_FULL_NAMES];
|
||||
extern const char *Hlp_ASSESSMENT_Calls_for_exams_new_call;
|
||||
extern const char *Hlp_ASSESSMENT_Calls_for_exams_edit_call;
|
||||
extern const char *Txt_YEAR_OF_DEGREE[1 + Deg_MAX_YEARS_PER_DEGREE];
|
||||
|
@ -1001,7 +1002,8 @@ static void Cfe_ShowCallForExam (struct Cfe_CallsForExams *CallsForExams,
|
|||
HTM_TD_Begin ("class=\"LB DAT_STRONG_%s\"",
|
||||
The_GetSuffix ());
|
||||
if (TypeViewCallForExam == Cfe_FORM_VIEW)
|
||||
HTM_INPUT_TEXT ("CrsName",Cns_MAX_CHARS_FULL_NAME,CallsForExams->CallForExam.CrsFullName,
|
||||
HTM_INPUT_TEXT ("CrsName",Cns_MaxCharsShrtOrFullName[Cns_FULL_NAME],
|
||||
CallsForExams->CallForExam.CrsFullName,
|
||||
HTM_DONT_SUBMIT_ON_CHANGE,
|
||||
"id=\"CrsName\" size=\"30\" class=\"INPUT_%s\"",
|
||||
The_GetSuffix ());
|
||||
|
|
154
swad_center.c
154
swad_center.c
|
@ -730,8 +730,16 @@ void Ctr_WriteSelectorOfCenter (void)
|
|||
|
||||
static void Ctr_ListCentersForEdition (const struct Plc_Places *Places)
|
||||
{
|
||||
extern const char *Cns_ParShrtOrFullName[Cns_NUM_SHRT_FULL_NAMES];
|
||||
extern unsigned Cns_MaxCharsShrtOrFullName[Cns_NUM_SHRT_FULL_NAMES];
|
||||
extern const char *Cns_ClassShrtOrFullName[Cns_NUM_SHRT_FULL_NAMES];
|
||||
extern const char *Txt_Another_place;
|
||||
extern const char *Txt_CENTER_STATUS[Hie_NUM_STATUS_TXT];
|
||||
static Act_Action_t ActionRename[Cns_NUM_SHRT_FULL_NAMES] =
|
||||
{
|
||||
[Cns_SHRT_NAME] = ActRenCtrSho,
|
||||
[Cns_FULL_NAME] = ActRenCtrFul,
|
||||
};
|
||||
unsigned NumCtr;
|
||||
struct Hie_Node *Ctr;
|
||||
unsigned NumPlc;
|
||||
|
@ -742,6 +750,8 @@ static void Ctr_ListCentersForEdition (const struct Plc_Places *Places)
|
|||
unsigned NumDegs;
|
||||
unsigned NumUsrsCtr;
|
||||
unsigned NumUsrsInCrssOfCtr;
|
||||
Cns_ShrtOrFullName_t ShrtOrFullName;
|
||||
char *Name[Cns_NUM_SHRT_FULL_NAMES];
|
||||
|
||||
/***** Initialize structure with user's data *****/
|
||||
Usr_UsrDataConstructor (&UsrDat);
|
||||
|
@ -833,37 +843,31 @@ static void Ctr_ListCentersForEdition (const struct Plc_Places *Places)
|
|||
HTM_Txt (Places->Lst[NumPlc].ShrtName);
|
||||
HTM_TD_End ();
|
||||
|
||||
/* Center short name */
|
||||
HTM_TD_Begin ("class=\"LM DAT_%s\"",The_GetSuffix ());
|
||||
if (ICanEdit)
|
||||
{
|
||||
Frm_BeginForm (ActRenCtrSho);
|
||||
ParCod_PutPar (ParCod_OthHie,Ctr->HieCod);
|
||||
HTM_INPUT_TEXT ("ShortName",Cns_MAX_CHARS_SHRT_NAME,Ctr->ShrtName,
|
||||
HTM_SUBMIT_ON_CHANGE,
|
||||
"class=\"INPUT_SHORT_NAME INPUT_%s\"",
|
||||
The_GetSuffix ());
|
||||
Frm_EndForm ();
|
||||
}
|
||||
else
|
||||
HTM_Txt (Ctr->ShrtName);
|
||||
HTM_TD_End ();
|
||||
|
||||
/* Center full name */
|
||||
HTM_TD_Begin ("class=\"LM DAT_%s\"",The_GetSuffix ());
|
||||
if (ICanEdit)
|
||||
{
|
||||
Frm_BeginForm (ActRenCtrFul);
|
||||
ParCod_PutPar (ParCod_OthHie,Ctr->HieCod);
|
||||
HTM_INPUT_TEXT ("FullName",Cns_MAX_CHARS_FULL_NAME,Ctr->FullName,
|
||||
HTM_SUBMIT_ON_CHANGE,
|
||||
"class=\"INPUT_FULL_NAME INPUT_%s\"",
|
||||
The_GetSuffix ());
|
||||
Frm_EndForm ();
|
||||
}
|
||||
else
|
||||
HTM_Txt (Ctr->FullName);
|
||||
HTM_TD_End ();
|
||||
/* Center short name and full name */
|
||||
Name[Cns_SHRT_NAME] = Ctr->ShrtName;
|
||||
Name[Cns_FULL_NAME] = Ctr->FullName;
|
||||
for (ShrtOrFullName = Cns_SHRT_NAME;
|
||||
ShrtOrFullName <= Cns_FULL_NAME;
|
||||
ShrtOrFullName++)
|
||||
{
|
||||
HTM_TD_Begin ("class=\"LM DAT_%s\"",The_GetSuffix ());
|
||||
if (ICanEdit)
|
||||
{
|
||||
Frm_BeginForm (ActionRename[ShrtOrFullName]);
|
||||
ParCod_PutPar (ParCod_OthHie,Ctr->HieCod);
|
||||
HTM_INPUT_TEXT (Cns_ParShrtOrFullName[ShrtOrFullName],
|
||||
Cns_MaxCharsShrtOrFullName[ShrtOrFullName],
|
||||
Name[ShrtOrFullName],
|
||||
HTM_SUBMIT_ON_CHANGE,
|
||||
"class=\"%s INPUT_%s\"",
|
||||
Cns_ClassShrtOrFullName[ShrtOrFullName],
|
||||
The_GetSuffix ());
|
||||
Frm_EndForm ();
|
||||
}
|
||||
else
|
||||
HTM_Txt (Name[ShrtOrFullName]);
|
||||
HTM_TD_End ();
|
||||
}
|
||||
|
||||
/* Center WWW */
|
||||
HTM_TD_Begin ("class=\"LM DAT_%s\"",The_GetSuffix ());
|
||||
|
@ -1255,10 +1259,19 @@ static void Ctr_ShowAlertAndButtonToGoToCtr (void)
|
|||
|
||||
static void Ctr_PutFormToCreateCenter (const struct Plc_Places *Places)
|
||||
{
|
||||
extern const char *Cns_ParShrtOrFullName[Cns_NUM_SHRT_FULL_NAMES];
|
||||
extern unsigned Cns_MaxCharsShrtOrFullName[Cns_NUM_SHRT_FULL_NAMES];
|
||||
extern const char *Cns_ClassShrtOrFullName[Cns_NUM_SHRT_FULL_NAMES];
|
||||
extern const char *Txt_Another_place;
|
||||
Act_Action_t NextAction = ActUnk;
|
||||
unsigned NumPlc;
|
||||
const struct Plc_Place *PlcInLst;
|
||||
Cns_ShrtOrFullName_t ShrtOrFullName;
|
||||
char *Name[Cns_NUM_SHRT_FULL_NAMES] =
|
||||
{
|
||||
[Cns_SHRT_NAME] = Ctr_EditingCtr->ShrtName,
|
||||
[Cns_FULL_NAME] = Ctr_EditingCtr->FullName,
|
||||
};
|
||||
|
||||
/***** Set action depending on role *****/
|
||||
if (Gbl.Usrs.Me.Role.Logged >= Rol_INS_ADM)
|
||||
|
@ -1316,23 +1329,22 @@ static void Ctr_PutFormToCreateCenter (const struct Plc_Places *Places)
|
|||
HTM_SELECT_End ();
|
||||
HTM_TD_End ();
|
||||
|
||||
/***** Center short name *****/
|
||||
HTM_TD_Begin ("class=\"LM\"");
|
||||
HTM_INPUT_TEXT ("ShortName",Cns_MAX_CHARS_SHRT_NAME,Ctr_EditingCtr->ShrtName,
|
||||
HTM_DONT_SUBMIT_ON_CHANGE,
|
||||
"class=\"INPUT_SHORT_NAME INPUT_%s\""
|
||||
" required=\"required\"",
|
||||
The_GetSuffix ());
|
||||
HTM_TD_End ();
|
||||
|
||||
/***** Center full name *****/
|
||||
HTM_TD_Begin ("class=\"LM\"");
|
||||
HTM_INPUT_TEXT ("FullName",Cns_MAX_CHARS_FULL_NAME,Ctr_EditingCtr->FullName,
|
||||
HTM_DONT_SUBMIT_ON_CHANGE,
|
||||
"class=\"INPUT_FULL_NAME INPUT_%s\""
|
||||
" required=\"required\"",
|
||||
The_GetSuffix ());
|
||||
HTM_TD_End ();
|
||||
/***** Center short name and full name *****/
|
||||
for (ShrtOrFullName = Cns_SHRT_NAME;
|
||||
ShrtOrFullName <= Cns_FULL_NAME;
|
||||
ShrtOrFullName++)
|
||||
{
|
||||
HTM_TD_Begin ("class=\"LM\"");
|
||||
HTM_INPUT_TEXT (Cns_ParShrtOrFullName[ShrtOrFullName],
|
||||
Cns_MaxCharsShrtOrFullName[ShrtOrFullName],
|
||||
Name[ShrtOrFullName],
|
||||
HTM_DONT_SUBMIT_ON_CHANGE,
|
||||
"class=\"%s INPUT_%s\""
|
||||
" required=\"required\"",
|
||||
Cns_ClassShrtOrFullName[ShrtOrFullName],
|
||||
The_GetSuffix ());
|
||||
HTM_TD_End ();
|
||||
}
|
||||
|
||||
/***** Center WWW *****/
|
||||
HTM_TD_Begin ("class=\"LM\"");
|
||||
|
@ -1504,8 +1516,18 @@ void Ctr_ReceiveFormNewCtr (void)
|
|||
|
||||
static void Ctr_ReceiveFormRequestOrCreateCtr (Hie_Status_t Status)
|
||||
{
|
||||
extern const char *Cns_ParShrtOrFullName[Cns_NUM_SHRT_FULL_NAMES];
|
||||
extern const char *Cns_FldShrtOrFullName[Cns_NUM_SHRT_FULL_NAMES];
|
||||
extern unsigned Cns_MaxBytesShrtOrFullName[Cns_NUM_SHRT_FULL_NAMES];
|
||||
extern const char *Txt_The_center_X_already_exists;
|
||||
extern const char *Txt_Created_new_center_X;
|
||||
Cns_ShrtOrFullName_t ShrtOrFullName;
|
||||
char *Name[Cns_NUM_SHRT_FULL_NAMES] =
|
||||
{
|
||||
[Cns_SHRT_NAME] = Ctr_EditingCtr->ShrtName,
|
||||
[Cns_FULL_NAME] = Ctr_EditingCtr->FullName,
|
||||
};
|
||||
bool Exists;
|
||||
|
||||
/***** Get parameters from form *****/
|
||||
/* Set center institution */
|
||||
|
@ -1515,8 +1537,12 @@ static void Ctr_ReceiveFormRequestOrCreateCtr (Hie_Status_t Status)
|
|||
Ctr_EditingCtr->Specific.PlcCod = ParCod_GetAndCheckParMin (ParCod_Plc,0); // 0 (another place) is allowed here
|
||||
|
||||
/* Get center short name and full name */
|
||||
Par_GetParText ("ShortName",Ctr_EditingCtr->ShrtName,Cns_MAX_BYTES_SHRT_NAME);
|
||||
Par_GetParText ("FullName" ,Ctr_EditingCtr->FullName,Cns_MAX_BYTES_FULL_NAME);
|
||||
for (ShrtOrFullName = Cns_SHRT_NAME;
|
||||
ShrtOrFullName <= Cns_FULL_NAME;
|
||||
ShrtOrFullName++)
|
||||
Par_GetParText (Cns_ParShrtOrFullName[ShrtOrFullName],
|
||||
Name[ShrtOrFullName],
|
||||
Cns_MaxBytesShrtOrFullName[ShrtOrFullName]);
|
||||
|
||||
/* Get center WWW */
|
||||
Par_GetParText ("WWW",Ctr_EditingCtr->WWW,Cns_MAX_BYTES_WWW);
|
||||
|
@ -1527,19 +1553,19 @@ static void Ctr_ReceiveFormRequestOrCreateCtr (Hie_Status_t Status)
|
|||
if (Ctr_EditingCtr->WWW[0])
|
||||
{
|
||||
/***** If name of center was in database... *****/
|
||||
if (Ctr_DB_CheckIfCtrNameExistsInIns ("ShortName",
|
||||
Ctr_EditingCtr->ShrtName,-1L,
|
||||
Gbl.Hierarchy.Node[Hie_INS].HieCod))
|
||||
Ale_CreateAlert (Ale_WARNING,NULL,
|
||||
Txt_The_center_X_already_exists,
|
||||
Ctr_EditingCtr->ShrtName);
|
||||
else if (Ctr_DB_CheckIfCtrNameExistsInIns ("FullName",
|
||||
Ctr_EditingCtr->FullName,-1L,
|
||||
Gbl.Hierarchy.Node[Hie_INS].HieCod))
|
||||
Ale_CreateAlert (Ale_WARNING,NULL,
|
||||
Txt_The_center_X_already_exists,
|
||||
Ctr_EditingCtr->FullName);
|
||||
else // Add new center to database
|
||||
for (ShrtOrFullName = Cns_SHRT_NAME, Exists = false;
|
||||
ShrtOrFullName <= Cns_FULL_NAME && !Exists;
|
||||
ShrtOrFullName++)
|
||||
if (Ctr_DB_CheckIfCtrNameExistsInIns (Cns_FldShrtOrFullName[ShrtOrFullName],
|
||||
Name[ShrtOrFullName],-1L,
|
||||
Gbl.Hierarchy.Node[Hie_INS].HieCod))
|
||||
{
|
||||
Ale_CreateAlert (Ale_WARNING,NULL,
|
||||
Txt_The_center_X_already_exists,
|
||||
Name[ShrtOrFullName]);
|
||||
Exists = true;
|
||||
}
|
||||
if (!Exists) // Add new center to database
|
||||
{
|
||||
Ctr_EditingCtr->HieCod = Ctr_DB_CreateCenter (Ctr_EditingCtr,Status);
|
||||
Ale_CreateAlert (Ale_SUCCESS,NULL,
|
||||
|
@ -1551,7 +1577,7 @@ static void Ctr_ReceiveFormRequestOrCreateCtr (Hie_Status_t Status)
|
|||
Ale_CreateAlertYouMustSpecifyTheWebAddress ();
|
||||
}
|
||||
else // If there is not a center name
|
||||
Ale_CreateAlertYouMustSpecifyTheShortNameAndTheFullName ();
|
||||
Ale_CreateAlertYouMustSpecifyShrtNameAndFullName ();
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -611,9 +611,7 @@ static void CtrCfg_Institution (bool PrintView,bool PutForm)
|
|||
|
||||
static void CtrCfg_FullName (bool PutForm)
|
||||
{
|
||||
extern const char *Txt_Center;
|
||||
|
||||
HieCfg_FullName (PutForm,ActRenCtrFulCfg,Hie_CTR,Txt_Center);
|
||||
HieCfg_Name (PutForm,Hie_CTR,Cns_FULL_NAME);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -622,7 +620,7 @@ static void CtrCfg_FullName (bool PutForm)
|
|||
|
||||
static void CtrCfg_ShrtName (bool PutForm)
|
||||
{
|
||||
HieCfg_ShrtName (PutForm,ActRenCtrShoCfg,Hie_CTR);
|
||||
HieCfg_Name (PutForm,Hie_CTR,Cns_SHRT_NAME);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -1021,9 +1019,17 @@ void CtrCfg_ChangeCtrPhotoAttr (void)
|
|||
|
||||
void CtrCfg_ChangeCtrIns (void)
|
||||
{
|
||||
extern const char *Cns_FldShrtOrFullName[Cns_NUM_SHRT_FULL_NAMES];
|
||||
extern const char *Txt_The_center_X_already_exists;
|
||||
extern const char *Txt_The_center_X_has_been_moved_to_the_institution_Y;
|
||||
struct Hie_Node NewIns;
|
||||
Cns_ShrtOrFullName_t ShrtOrFullName;
|
||||
bool Exists;
|
||||
char *Name[Cns_NUM_SHRT_FULL_NAMES] =
|
||||
{
|
||||
[Cns_SHRT_NAME] = Gbl.Hierarchy.Node[Hie_CTR].ShrtName,
|
||||
[Cns_FULL_NAME] = Gbl.Hierarchy.Node[Hie_CTR].FullName,
|
||||
};
|
||||
|
||||
/***** Get parameter with institution code *****/
|
||||
NewIns.HieCod = ParCod_GetAndCheckPar (ParCod_OthIns);
|
||||
|
@ -1035,23 +1041,20 @@ void CtrCfg_ChangeCtrIns (void)
|
|||
Ins_GetInstitDataByCod (&NewIns);
|
||||
|
||||
/***** Check if it already exists a center with the same name in the new institution *****/
|
||||
if (Ctr_DB_CheckIfCtrNameExistsInIns ("ShortName",
|
||||
Gbl.Hierarchy.Node[Hie_CTR].ShrtName,
|
||||
Gbl.Hierarchy.Node[Hie_CTR].HieCod,
|
||||
NewIns.HieCod))
|
||||
/***** Create warning message *****/
|
||||
Ale_CreateAlert (Ale_WARNING,NULL,
|
||||
Txt_The_center_X_already_exists,
|
||||
Gbl.Hierarchy.Node[Hie_CTR].ShrtName);
|
||||
else if (Ctr_DB_CheckIfCtrNameExistsInIns ("FullName",
|
||||
Gbl.Hierarchy.Node[Hie_CTR].FullName,
|
||||
Gbl.Hierarchy.Node[Hie_CTR].HieCod,
|
||||
NewIns.HieCod))
|
||||
/***** Create warning message *****/
|
||||
Ale_CreateAlert (Ale_WARNING,NULL,
|
||||
Txt_The_center_X_already_exists,
|
||||
Gbl.Hierarchy.Node[Hie_CTR].FullName);
|
||||
else
|
||||
for (ShrtOrFullName = Cns_SHRT_NAME, Exists = false;
|
||||
ShrtOrFullName <= Cns_FULL_NAME && !Exists;
|
||||
ShrtOrFullName++)
|
||||
if (Ctr_DB_CheckIfCtrNameExistsInIns (Cns_FldShrtOrFullName[ShrtOrFullName],
|
||||
Name[ShrtOrFullName],
|
||||
Gbl.Hierarchy.Node[Hie_CTR].HieCod,
|
||||
NewIns.HieCod))
|
||||
{
|
||||
Ale_CreateAlert (Ale_WARNING,NULL,
|
||||
Txt_The_center_X_already_exists,
|
||||
Name[ShrtOrFullName]);
|
||||
Exists = true;
|
||||
}
|
||||
if (!Exists)
|
||||
{
|
||||
/***** Update institution in table of centers *****/
|
||||
Ctr_DB_UpdateCtrIns (Gbl.Hierarchy.Node[Hie_CTR].HieCod,NewIns.HieCod);
|
||||
|
|
|
@ -632,12 +632,14 @@ TODO: Francisco Javier Fern
|
|||
Me sale este error, no sé si por no recordar yo la sintaxis apropiada para mandar a varios destinatarios. ¿No era así?
|
||||
"can npt create received message (duplicated entry '243218-2160773' for key 'UsrCod_MsgCod')
|
||||
*/
|
||||
#define Log_PLATFORM_VERSION "SWAD 23.28 (2023-10-06)"
|
||||
#define Log_PLATFORM_VERSION "SWAD 23.30 (2023-10-09)"
|
||||
#define CSS_FILE "swad23.25.2.css"
|
||||
#define JS_FILE "swad22.49.js"
|
||||
/*
|
||||
Version 23.30: Oct 09, 2023 Code refactoring in short and full names. (336293 lines)
|
||||
Version 23.29: Oct 07, 2023 Code refactoring in short and full names. (336131 lines)
|
||||
Version 23.28: Oct 06, 2023 New file swad_constant.c.
|
||||
Changes in test and match results when a question is edited. Suggested by Francisco Javier Fernández Baldomero. (335920 lines)
|
||||
Changes in test and match results when a question is edited. Suggested by Francisco Javier Fernández Baldomero. (335921 lines)
|
||||
Version 23.27: Oct 06, 2023 Code refactoring. (335951 lines)
|
||||
Version 23.26.1: Oct 05, 2023 Code refactoring. (335938 lines)
|
||||
Version 23.26: Oct 04, 2023 Code refactoring in forum stats. (335965 lines)
|
||||
|
|
|
@ -41,11 +41,21 @@ const char *Cns_FldShrtOrFullName[Cns_NUM_SHRT_FULL_NAMES] =
|
|||
[Cns_SHRT_NAME] = "ShortName",
|
||||
[Cns_FULL_NAME] = "FullName",
|
||||
};
|
||||
unsigned Cns_MaxCharsShrtOrFullName[Cns_NUM_SHRT_FULL_NAMES] =
|
||||
{
|
||||
[Cns_SHRT_NAME] = Cns_MAX_CHARS_SHRT_NAME,
|
||||
[Cns_FULL_NAME] = Cns_MAX_CHARS_FULL_NAME,
|
||||
};
|
||||
unsigned Cns_MaxBytesShrtOrFullName[Cns_NUM_SHRT_FULL_NAMES] =
|
||||
{
|
||||
[Cns_SHRT_NAME] = Cns_MAX_BYTES_SHRT_NAME,
|
||||
[Cns_FULL_NAME] = Cns_MAX_BYTES_FULL_NAME,
|
||||
};
|
||||
const char *Cns_ClassShrtOrFullName[Cns_NUM_SHRT_FULL_NAMES] =
|
||||
{
|
||||
[Cns_SHRT_NAME] = "INPUT_SHORT_NAME",
|
||||
[Cns_FULL_NAME] = "INPUT_FULL_NAME",
|
||||
};
|
||||
|
||||
/*****************************************************************************/
|
||||
/**************************** Private constants ******************************/
|
||||
|
|
198
swad_course.c
198
swad_course.c
|
@ -916,14 +916,24 @@ static void Crs_ListCoursesForEdition (void)
|
|||
|
||||
static void Crs_ListCoursesOfAYearForEdition (unsigned Year)
|
||||
{
|
||||
extern const char *Cns_ParShrtOrFullName[Cns_NUM_SHRT_FULL_NAMES];
|
||||
extern unsigned Cns_MaxCharsShrtOrFullName[Cns_NUM_SHRT_FULL_NAMES];
|
||||
extern const char *Cns_ClassShrtOrFullName[Cns_NUM_SHRT_FULL_NAMES];
|
||||
extern const char *Txt_YEAR_OF_DEGREE[1 + Deg_MAX_YEARS_PER_DEGREE];
|
||||
extern const char *Txt_COURSE_STATUS[Hie_NUM_STATUS_TXT];
|
||||
static Act_Action_t ActionRename[Cns_NUM_SHRT_FULL_NAMES] =
|
||||
{
|
||||
[Cns_SHRT_NAME] = ActRenCrsSho,
|
||||
[Cns_FULL_NAME] = ActRenCrsFul,
|
||||
};
|
||||
struct Hie_Node *Crs;
|
||||
unsigned YearAux;
|
||||
unsigned NumCrs;
|
||||
struct Usr_Data UsrDat;
|
||||
bool ICanEdit;
|
||||
unsigned NumUsrs[Rol_NUM_ROLES];
|
||||
Cns_ShrtOrFullName_t ShrtOrFullName;
|
||||
char *Name[Cns_NUM_SHRT_FULL_NAMES];
|
||||
|
||||
/***** Initialize structure with user's data *****/
|
||||
Usr_UsrDataConstructor (&UsrDat);
|
||||
|
@ -934,6 +944,7 @@ static void Crs_ListCoursesOfAYearForEdition (unsigned Year)
|
|||
NumCrs++)
|
||||
{
|
||||
Crs = &(Gbl.Hierarchy.List[Hie_DEG].Lst[NumCrs]);
|
||||
|
||||
if (Crs->Specific.Year == Year)
|
||||
{
|
||||
ICanEdit = Crs_CheckIfICanEdit (Crs);
|
||||
|
@ -1006,37 +1017,31 @@ static void Crs_ListCoursesOfAYearForEdition (unsigned Year)
|
|||
HTM_Txt (Crs->InstitutionalCod);
|
||||
HTM_TD_End ();
|
||||
|
||||
/* Course short name */
|
||||
HTM_TD_Begin ("class=\"LM DAT_%s\"",The_GetSuffix ());
|
||||
if (ICanEdit)
|
||||
{
|
||||
Frm_BeginForm (ActRenCrsSho);
|
||||
ParCod_PutPar (ParCod_OthHie,Crs->HieCod);
|
||||
HTM_INPUT_TEXT ("ShortName",Cns_MAX_CHARS_SHRT_NAME,Crs->ShrtName,
|
||||
HTM_SUBMIT_ON_CHANGE,
|
||||
"class=\"INPUT_SHORT_NAME INPUT_%s\"",
|
||||
The_GetSuffix ());
|
||||
Frm_EndForm ();
|
||||
}
|
||||
else
|
||||
HTM_Txt (Crs->ShrtName);
|
||||
HTM_TD_End ();
|
||||
|
||||
/* Course full name */
|
||||
HTM_TD_Begin ("class=\"LM DAT_%s\"",The_GetSuffix ());
|
||||
if (ICanEdit)
|
||||
{
|
||||
Frm_BeginForm (ActRenCrsFul);
|
||||
ParCod_PutPar (ParCod_OthHie,Crs->HieCod);
|
||||
HTM_INPUT_TEXT ("FullName",Cns_MAX_CHARS_FULL_NAME,Crs->FullName,
|
||||
HTM_SUBMIT_ON_CHANGE,
|
||||
"class=\"INPUT_FULL_NAME INPUT_%s\"",
|
||||
The_GetSuffix ());
|
||||
Frm_EndForm ();
|
||||
}
|
||||
else
|
||||
HTM_Txt (Crs->FullName);
|
||||
HTM_TD_End ();
|
||||
/* Course short name and full name */
|
||||
Name[Cns_SHRT_NAME] = Crs->ShrtName;
|
||||
Name[Cns_FULL_NAME] = Crs->FullName;
|
||||
for (ShrtOrFullName = Cns_SHRT_NAME;
|
||||
ShrtOrFullName <= Cns_FULL_NAME;
|
||||
ShrtOrFullName++)
|
||||
{
|
||||
HTM_TD_Begin ("class=\"LM DAT_%s\"",The_GetSuffix ());
|
||||
if (ICanEdit)
|
||||
{
|
||||
Frm_BeginForm (ActionRename[ShrtOrFullName]);
|
||||
ParCod_PutPar (ParCod_OthHie,Crs->HieCod);
|
||||
HTM_INPUT_TEXT (Cns_ParShrtOrFullName[ShrtOrFullName],
|
||||
Cns_MaxCharsShrtOrFullName[ShrtOrFullName],
|
||||
Name[ShrtOrFullName],
|
||||
HTM_SUBMIT_ON_CHANGE,
|
||||
"class=\"%s INPUT_%s\"",
|
||||
Cns_ClassShrtOrFullName[ShrtOrFullName],
|
||||
The_GetSuffix ());
|
||||
Frm_EndForm ();
|
||||
}
|
||||
else
|
||||
HTM_Txt (Name[ShrtOrFullName]);
|
||||
HTM_TD_End ();
|
||||
}
|
||||
|
||||
/* Current number of teachers in this course */
|
||||
HTM_TD_Begin ("class=\"RM DAT_%s\"",The_GetSuffix ());
|
||||
|
@ -1089,9 +1094,18 @@ static bool Crs_CheckIfICanEdit (struct Hie_Node *Crs)
|
|||
|
||||
static void Crs_PutFormToCreateCourse (void)
|
||||
{
|
||||
extern const char *Cns_ParShrtOrFullName[Cns_NUM_SHRT_FULL_NAMES];
|
||||
extern unsigned Cns_MaxCharsShrtOrFullName[Cns_NUM_SHRT_FULL_NAMES];
|
||||
extern const char *Cns_ClassShrtOrFullName[Cns_NUM_SHRT_FULL_NAMES];
|
||||
extern const char *Txt_YEAR_OF_DEGREE[1 + Deg_MAX_YEARS_PER_DEGREE];
|
||||
Act_Action_t NextAction = ActUnk;
|
||||
unsigned Year;
|
||||
Cns_ShrtOrFullName_t ShrtOrFullName;
|
||||
char *Name[Cns_NUM_SHRT_FULL_NAMES] =
|
||||
{
|
||||
[Cns_SHRT_NAME] = Crs_EditingCrs->ShrtName,
|
||||
[Cns_FULL_NAME] = Crs_EditingCrs->FullName,
|
||||
};
|
||||
|
||||
/***** Set action depending on role *****/
|
||||
|
||||
|
@ -1145,23 +1159,22 @@ static void Crs_PutFormToCreateCourse (void)
|
|||
The_GetSuffix ());
|
||||
HTM_TD_End ();
|
||||
|
||||
/***** Course short name *****/
|
||||
HTM_TD_Begin ("class=\"LM\"");
|
||||
HTM_INPUT_TEXT ("ShortName",Cns_MAX_CHARS_SHRT_NAME,Crs_EditingCrs->ShrtName,
|
||||
HTM_DONT_SUBMIT_ON_CHANGE,
|
||||
"class=\"INPUT_SHORT_NAME INPUT_%s\""
|
||||
" required=\"required\"",
|
||||
The_GetSuffix ());
|
||||
HTM_TD_End ();
|
||||
|
||||
/***** Course full name *****/
|
||||
HTM_TD_Begin ("class=\"LM\"");
|
||||
HTM_INPUT_TEXT ("FullName",Cns_MAX_CHARS_FULL_NAME,Crs_EditingCrs->FullName,
|
||||
HTM_DONT_SUBMIT_ON_CHANGE,
|
||||
"class=\"INPUT_FULL_NAME INPUT_%s\""
|
||||
" required=\"required\"",
|
||||
The_GetSuffix ());
|
||||
HTM_TD_End ();
|
||||
/***** Course short name and full name *****/
|
||||
for (ShrtOrFullName = Cns_SHRT_NAME;
|
||||
ShrtOrFullName <= Cns_FULL_NAME;
|
||||
ShrtOrFullName++)
|
||||
{
|
||||
HTM_TD_Begin ("class=\"LM\"");
|
||||
HTM_INPUT_TEXT (Cns_ParShrtOrFullName[ShrtOrFullName],
|
||||
Cns_MaxCharsShrtOrFullName[ShrtOrFullName],
|
||||
Name[ShrtOrFullName],
|
||||
HTM_DONT_SUBMIT_ON_CHANGE,
|
||||
"class=\"%s INPUT_%s\""
|
||||
" required=\"required\"",
|
||||
Cns_ClassShrtOrFullName[ShrtOrFullName],
|
||||
The_GetSuffix ());
|
||||
HTM_TD_End ();
|
||||
}
|
||||
|
||||
/***** Current number of teachers in this course *****/
|
||||
HTM_TD_Begin ("class=\"RM DAT_%s\"",The_GetSuffix ());
|
||||
|
@ -1277,10 +1290,18 @@ void Crs_ReceiveFormNewCrs (void)
|
|||
|
||||
static void Crs_ReceiveFormRequestOrCreateCrs (Hie_Status_t Status)
|
||||
{
|
||||
extern const char *Cns_FldShrtOrFullName[Cns_NUM_SHRT_FULL_NAMES];
|
||||
extern const char *Txt_The_course_X_already_exists;
|
||||
extern const char *Txt_Created_new_course_X;
|
||||
extern const char *Txt_The_year_X_is_not_allowed;
|
||||
extern const char *Txt_YEAR_OF_DEGREE[1 + Deg_MAX_YEARS_PER_DEGREE];
|
||||
Cns_ShrtOrFullName_t ShrtOrFullName;
|
||||
bool Exists;
|
||||
char *Name[Cns_NUM_SHRT_FULL_NAMES] =
|
||||
{
|
||||
[Cns_SHRT_NAME] = Crs_EditingCrs->ShrtName,
|
||||
[Cns_FULL_NAME] = Crs_EditingCrs->FullName,
|
||||
};
|
||||
|
||||
/***** Get parameters from form *****/
|
||||
/* Set course degree */
|
||||
|
@ -1297,17 +1318,20 @@ static void Crs_ReceiveFormRequestOrCreateCrs (Hie_Status_t Status)
|
|||
Crs_EditingCrs->FullName[0]) // If there's a course name
|
||||
{
|
||||
/***** If name of course was in database... *****/
|
||||
if (Crs_DB_CheckIfCrsNameExistsInYearOfDeg ("ShortName",Crs_EditingCrs->ShrtName,
|
||||
-1L,Crs_EditingCrs->PrtCod,Crs_EditingCrs->Specific.Year))
|
||||
Ale_CreateAlert (Ale_WARNING,NULL,
|
||||
Txt_The_course_X_already_exists,
|
||||
Crs_EditingCrs->ShrtName);
|
||||
else if (Crs_DB_CheckIfCrsNameExistsInYearOfDeg ("FullName",Crs_EditingCrs->FullName,
|
||||
-1L,Crs_EditingCrs->PrtCod,Crs_EditingCrs->Specific.Year))
|
||||
Ale_CreateAlert (Ale_WARNING,NULL,
|
||||
Txt_The_course_X_already_exists,
|
||||
Crs_EditingCrs->FullName);
|
||||
else // Add new requested course to database
|
||||
for (ShrtOrFullName = Cns_SHRT_NAME, Exists = false;
|
||||
ShrtOrFullName <= Cns_FULL_NAME && !Exists;
|
||||
ShrtOrFullName++)
|
||||
if (Crs_DB_CheckIfCrsNameExistsInYearOfDeg (Cns_FldShrtOrFullName[ShrtOrFullName],
|
||||
Name[ShrtOrFullName],
|
||||
-1L,Crs_EditingCrs->PrtCod,
|
||||
Crs_EditingCrs->Specific.Year))
|
||||
{
|
||||
Ale_CreateAlert (Ale_WARNING,NULL,
|
||||
Txt_The_course_X_already_exists,
|
||||
Name[ShrtOrFullName]);
|
||||
Exists = true;
|
||||
}
|
||||
if (!Exists) // Add new requested course to database
|
||||
{
|
||||
Crs_DB_CreateCourse (Crs_EditingCrs,Status);
|
||||
Ale_CreateAlert (Ale_SUCCESS,NULL,
|
||||
|
@ -1316,7 +1340,7 @@ static void Crs_ReceiveFormRequestOrCreateCrs (Hie_Status_t Status)
|
|||
}
|
||||
}
|
||||
else // If there is not a course name
|
||||
Ale_CreateAlertYouMustSpecifyTheShortNameAndTheFullName ();
|
||||
Ale_CreateAlertYouMustSpecifyShrtNameAndFullName ();
|
||||
}
|
||||
else // Year not valid
|
||||
Ale_CreateAlert (Ale_WARNING,NULL,
|
||||
|
@ -1330,7 +1354,15 @@ static void Crs_ReceiveFormRequestOrCreateCrs (Hie_Status_t Status)
|
|||
|
||||
static void Crs_GetParsNewCourse (struct Hie_Node *Crs)
|
||||
{
|
||||
extern const char *Cns_ParShrtOrFullName[Cns_NUM_SHRT_FULL_NAMES];
|
||||
extern unsigned Cns_MaxBytesShrtOrFullName[Cns_NUM_SHRT_FULL_NAMES];
|
||||
char YearStr[2 + 1];
|
||||
Cns_ShrtOrFullName_t ShrtOrFullName;
|
||||
char *Name[Cns_NUM_SHRT_FULL_NAMES] =
|
||||
{
|
||||
[Cns_SHRT_NAME] = Crs->ShrtName,
|
||||
[Cns_FULL_NAME] = Crs->FullName,
|
||||
};
|
||||
|
||||
/***** Get parameters of the course from form *****/
|
||||
/* Get year */
|
||||
|
@ -1340,11 +1372,13 @@ static void Crs_GetParsNewCourse (struct Hie_Node *Crs)
|
|||
/* Get institutional code */
|
||||
Par_GetParText ("InsCrsCod",Crs->InstitutionalCod,Hie_MAX_BYTES_INSTITUTIONAL_COD);
|
||||
|
||||
/* Get course short name */
|
||||
Par_GetParText ("ShortName",Crs->ShrtName,Cns_MAX_BYTES_SHRT_NAME);
|
||||
|
||||
/* Get course full name */
|
||||
Par_GetParText ("FullName",Crs->FullName,Cns_MAX_BYTES_FULL_NAME);
|
||||
/* Get course short name and full name */
|
||||
for (ShrtOrFullName = Cns_SHRT_NAME;
|
||||
ShrtOrFullName <= Cns_FULL_NAME;
|
||||
ShrtOrFullName++)
|
||||
Par_GetParText (Cns_ParShrtOrFullName[ShrtOrFullName],
|
||||
Name[ShrtOrFullName],
|
||||
Cns_MaxBytesShrtOrFullName[ShrtOrFullName]);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -1629,12 +1663,20 @@ void Crs_ChangeInsCrsCod (void)
|
|||
|
||||
void Crs_ChangeCrsYear (void)
|
||||
{
|
||||
extern const char *Cns_FldShrtOrFullName[Cns_NUM_SHRT_FULL_NAMES];
|
||||
extern const char *Txt_The_course_X_already_exists_in_year_Y;
|
||||
extern const char *Txt_YEAR_OF_DEGREE[1 + Deg_MAX_YEARS_PER_DEGREE];
|
||||
extern const char *Txt_The_year_of_the_course_X_has_changed;
|
||||
extern const char *Txt_The_year_X_is_not_allowed;
|
||||
char YearStr[2 + 1];
|
||||
unsigned NewYear;
|
||||
Cns_ShrtOrFullName_t ShrtOrFullName;
|
||||
bool Exists;
|
||||
char *Name[Cns_NUM_SHRT_FULL_NAMES] =
|
||||
{
|
||||
[Cns_SHRT_NAME] = Crs_EditingCrs->ShrtName,
|
||||
[Cns_FULL_NAME] = Crs_EditingCrs->FullName,
|
||||
};
|
||||
|
||||
/***** Course constructor *****/
|
||||
Crs_EditingCourseConstructor ();
|
||||
|
@ -1655,19 +1697,19 @@ void Crs_ChangeCrsYear (void)
|
|||
if (NewYear <= Deg_MAX_YEARS_PER_DEGREE) // If year is valid
|
||||
{
|
||||
/***** If name of course was in database in the new year... *****/
|
||||
if (Crs_DB_CheckIfCrsNameExistsInYearOfDeg ("ShortName",Crs_EditingCrs->ShrtName,
|
||||
-1L,Crs_EditingCrs->PrtCod,NewYear))
|
||||
Ale_CreateAlert (Ale_WARNING,NULL,
|
||||
Txt_The_course_X_already_exists_in_year_Y,
|
||||
Crs_EditingCrs->ShrtName,
|
||||
Txt_YEAR_OF_DEGREE[NewYear]);
|
||||
else if (Crs_DB_CheckIfCrsNameExistsInYearOfDeg ("FullName",Crs_EditingCrs->FullName,
|
||||
-1L,Crs_EditingCrs->PrtCod,NewYear))
|
||||
Ale_CreateAlert (Ale_WARNING,NULL,
|
||||
Txt_The_course_X_already_exists_in_year_Y,
|
||||
Crs_EditingCrs->FullName,
|
||||
Txt_YEAR_OF_DEGREE[NewYear]);
|
||||
else // Update year in database
|
||||
for (ShrtOrFullName = Cns_SHRT_NAME, Exists = false;
|
||||
ShrtOrFullName <= Cns_FULL_NAME && !Exists;
|
||||
ShrtOrFullName++)
|
||||
{
|
||||
if (Crs_DB_CheckIfCrsNameExistsInYearOfDeg (Cns_FldShrtOrFullName[ShrtOrFullName],
|
||||
Name[ShrtOrFullName],
|
||||
-1L,Crs_EditingCrs->PrtCod,NewYear))
|
||||
Ale_CreateAlert (Ale_WARNING,NULL,
|
||||
Txt_The_course_X_already_exists_in_year_Y,
|
||||
Name[ShrtOrFullName],Txt_YEAR_OF_DEGREE[NewYear]);
|
||||
Exists = true;
|
||||
}
|
||||
if (!Exists) // Update year in database
|
||||
{
|
||||
/***** Update year in table of courses *****/
|
||||
Crs_UpdateCrsYear (Crs_EditingCrs,NewYear);
|
||||
|
|
|
@ -271,9 +271,7 @@ static void CrsCfg_Degree (bool PrintView,bool PutForm)
|
|||
|
||||
static void CrsCfg_FullName (bool PutForm)
|
||||
{
|
||||
extern const char *Txt_Course;
|
||||
|
||||
HieCfg_FullName (PutForm,ActRenCrsFulCfg,Hie_CRS,Txt_Course);
|
||||
HieCfg_Name (PutForm,Hie_CRS,Cns_FULL_NAME);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -282,7 +280,7 @@ static void CrsCfg_FullName (bool PutForm)
|
|||
|
||||
static void CrsCfg_ShrtName (bool PutForm)
|
||||
{
|
||||
HieCfg_ShrtName (PutForm,ActRenCrsShoCfg,Hie_CRS);
|
||||
HieCfg_Name (PutForm,Hie_CRS,Cns_SHRT_NAME);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -460,10 +458,18 @@ static void CrsCfg_Indicators (void)
|
|||
|
||||
void CrsCfg_ChangeCrsDeg (void)
|
||||
{
|
||||
extern const char *Cns_FldShrtOrFullName[Cns_NUM_SHRT_FULL_NAMES];
|
||||
extern const char *Txt_In_the_year_X_of_the_degree_Y_already_existed_a_course_with_the_name_Z;
|
||||
extern const char *Txt_YEAR_OF_DEGREE[1 + Deg_MAX_YEARS_PER_DEGREE];
|
||||
extern const char *Txt_The_course_X_has_been_moved_to_the_degree_Y;
|
||||
struct Hie_Node NewDeg;
|
||||
Cns_ShrtOrFullName_t ShrtOrFullName;
|
||||
bool Exists;
|
||||
char *Name[Cns_NUM_SHRT_FULL_NAMES] =
|
||||
{
|
||||
[Cns_SHRT_NAME] = Gbl.Hierarchy.Node[Hie_CRS].ShrtName,
|
||||
[Cns_FULL_NAME] = Gbl.Hierarchy.Node[Hie_CRS].FullName,
|
||||
};
|
||||
|
||||
/***** Get parameter with degree code *****/
|
||||
NewDeg.HieCod = ParCod_GetAndCheckPar (ParCod_OthDeg);
|
||||
|
@ -475,21 +481,20 @@ void CrsCfg_ChangeCrsDeg (void)
|
|||
Deg_GetDegreeDataByCod (&NewDeg);
|
||||
|
||||
/***** If name of course was in database in the new degree... *****/
|
||||
if (Crs_DB_CheckIfCrsNameExistsInYearOfDeg ("ShortName",Gbl.Hierarchy.Node[Hie_CRS].ShrtName,-1L,
|
||||
NewDeg.HieCod,Gbl.Hierarchy.Node[Hie_CRS].Specific.Year))
|
||||
Ale_CreateAlert (Ale_WARNING,NULL,
|
||||
Txt_In_the_year_X_of_the_degree_Y_already_existed_a_course_with_the_name_Z,
|
||||
Txt_YEAR_OF_DEGREE[Gbl.Hierarchy.Node[Hie_CRS].Specific.Year],
|
||||
NewDeg.FullName,
|
||||
Gbl.Hierarchy.Node[Hie_CRS].ShrtName);
|
||||
else if (Crs_DB_CheckIfCrsNameExistsInYearOfDeg ("FullName",Gbl.Hierarchy.Node[Hie_CRS].FullName,-1L,
|
||||
NewDeg.HieCod,Gbl.Hierarchy.Node[Hie_CRS].Specific.Year))
|
||||
Ale_CreateAlert (Ale_WARNING,NULL,
|
||||
Txt_In_the_year_X_of_the_degree_Y_already_existed_a_course_with_the_name_Z,
|
||||
Txt_YEAR_OF_DEGREE[Gbl.Hierarchy.Node[Hie_CRS].Specific.Year],
|
||||
NewDeg.FullName,
|
||||
Gbl.Hierarchy.Node[Hie_CRS].FullName);
|
||||
else // Update degree in database
|
||||
for (ShrtOrFullName = Cns_SHRT_NAME, Exists = false;
|
||||
ShrtOrFullName <= Cns_FULL_NAME && !Exists;
|
||||
ShrtOrFullName++)
|
||||
if (Crs_DB_CheckIfCrsNameExistsInYearOfDeg (Cns_FldShrtOrFullName[ShrtOrFullName],
|
||||
Name[ShrtOrFullName],-1L,
|
||||
NewDeg.HieCod,Gbl.Hierarchy.Node[Hie_CRS].Specific.Year))
|
||||
{
|
||||
Ale_CreateAlert (Ale_WARNING,NULL,
|
||||
Txt_In_the_year_X_of_the_degree_Y_already_existed_a_course_with_the_name_Z,
|
||||
Txt_YEAR_OF_DEGREE[Gbl.Hierarchy.Node[Hie_CRS].Specific.Year],
|
||||
NewDeg.FullName,Name[ShrtOrFullName]);
|
||||
Exists = true;
|
||||
}
|
||||
if (!Exists) // Update degree in database
|
||||
{
|
||||
/***** Update degree in table of courses *****/
|
||||
Crs_DB_UpdateCrsDeg (Gbl.Hierarchy.Node[Hie_CRS].HieCod,NewDeg.HieCod);
|
||||
|
@ -528,12 +533,20 @@ void CrsCfg_RenameCourseFull (void)
|
|||
|
||||
void CrsCfg_ChangeCrsYear (void)
|
||||
{
|
||||
extern const char *Cns_FldShrtOrFullName[Cns_NUM_SHRT_FULL_NAMES];
|
||||
extern const char *Txt_The_course_X_already_exists_in_year_Y;
|
||||
extern const char *Txt_YEAR_OF_DEGREE[1 + Deg_MAX_YEARS_PER_DEGREE];
|
||||
extern const char *Txt_The_year_of_the_course_X_has_changed;
|
||||
extern const char *Txt_The_year_X_is_not_allowed;
|
||||
char YearStr[2 + 1];
|
||||
unsigned NewYear;
|
||||
Cns_ShrtOrFullName_t ShrtOrFullName;
|
||||
bool Exists;
|
||||
char *Name[Cns_NUM_SHRT_FULL_NAMES] =
|
||||
{
|
||||
[Cns_SHRT_NAME] = Gbl.Hierarchy.Node[Hie_CRS].ShrtName,
|
||||
[Cns_FULL_NAME] = Gbl.Hierarchy.Node[Hie_CRS].FullName,
|
||||
};
|
||||
|
||||
/***** Get parameter with year/semester *****/
|
||||
Par_GetParText ("OthCrsYear",YearStr,2);
|
||||
|
@ -542,19 +555,19 @@ void CrsCfg_ChangeCrsYear (void)
|
|||
if (NewYear <= Deg_MAX_YEARS_PER_DEGREE) // If year is valid
|
||||
{
|
||||
/***** If name of course was in database in the new year... *****/
|
||||
if (Crs_DB_CheckIfCrsNameExistsInYearOfDeg ("ShortName",Gbl.Hierarchy.Node[Hie_CRS].ShrtName,-1L,
|
||||
Gbl.Hierarchy.Node[Hie_CRS].PrtCod,NewYear))
|
||||
Ale_CreateAlert (Ale_WARNING,NULL,
|
||||
Txt_The_course_X_already_exists_in_year_Y,
|
||||
Gbl.Hierarchy.Node[Hie_CRS].ShrtName,
|
||||
Txt_YEAR_OF_DEGREE[NewYear]);
|
||||
else if (Crs_DB_CheckIfCrsNameExistsInYearOfDeg ("FullName",Gbl.Hierarchy.Node[Hie_CRS].FullName,-1L,
|
||||
Gbl.Hierarchy.Node[Hie_CRS].PrtCod,NewYear))
|
||||
Ale_CreateAlert (Ale_WARNING,NULL,
|
||||
Txt_The_course_X_already_exists_in_year_Y,
|
||||
Gbl.Hierarchy.Node[Hie_CRS].FullName,
|
||||
Txt_YEAR_OF_DEGREE[NewYear]);
|
||||
else // Update year in database
|
||||
for (ShrtOrFullName = Cns_SHRT_NAME, Exists = false;
|
||||
ShrtOrFullName <= Cns_FULL_NAME && !Exists;
|
||||
ShrtOrFullName++)
|
||||
if (Crs_DB_CheckIfCrsNameExistsInYearOfDeg (Cns_FldShrtOrFullName[ShrtOrFullName],
|
||||
Name[ShrtOrFullName],-1L,
|
||||
Gbl.Hierarchy.Node[Hie_CRS].PrtCod,NewYear))
|
||||
{
|
||||
Ale_CreateAlert (Ale_WARNING,NULL,
|
||||
Txt_The_course_X_already_exists_in_year_Y,
|
||||
Name[ShrtOrFullName],Txt_YEAR_OF_DEGREE[NewYear]);
|
||||
Exists = true;
|
||||
}
|
||||
if (!Exists) // Update year in database
|
||||
{
|
||||
/***** Update year in table of courses *****/
|
||||
Crs_UpdateCrsYear (&Gbl.Hierarchy.Node[Hie_CRS],NewYear);
|
||||
|
|
209
swad_degree.c
209
swad_degree.c
|
@ -316,16 +316,26 @@ void Deg_ShowDegsOfCurrentCtr (void)
|
|||
|
||||
static void Deg_ListDegreesForEdition (const struct DegTyp_DegTypes *DegTypes)
|
||||
{
|
||||
extern const char *Cns_ParShrtOrFullName[Cns_NUM_SHRT_FULL_NAMES];
|
||||
extern unsigned Cns_MaxCharsShrtOrFullName[Cns_NUM_SHRT_FULL_NAMES];
|
||||
extern const char *Cns_ClassShrtOrFullName[Cns_NUM_SHRT_FULL_NAMES];
|
||||
extern const char *Txt_DEGREE_STATUS[Hie_NUM_STATUS_TXT];
|
||||
static Act_Action_t ActionRename[Cns_NUM_SHRT_FULL_NAMES] =
|
||||
{
|
||||
[Cns_SHRT_NAME] = ActRenDegSho,
|
||||
[Cns_FULL_NAME] = ActRenDegFul,
|
||||
};
|
||||
unsigned NumDeg;
|
||||
struct Hie_Node *DegInLst;
|
||||
struct Hie_Node *Deg;
|
||||
unsigned NumDegTyp;
|
||||
struct DegTyp_DegreeType *DegTypInLst;
|
||||
struct DegTyp_DegreeType *DegTyp;
|
||||
char WWW[Cns_MAX_BYTES_WWW + 1];
|
||||
struct Usr_Data UsrDat;
|
||||
bool ICanEdit;
|
||||
unsigned NumCrss;
|
||||
unsigned NumUsrsInCrssOfDeg;
|
||||
Cns_ShrtOrFullName_t ShrtOrFullName;
|
||||
char *Name[Cns_NUM_SHRT_FULL_NAMES];
|
||||
|
||||
/***** Initialize structure with user's data *****/
|
||||
Usr_UsrDataConstructor (&UsrDat);
|
||||
|
@ -341,13 +351,13 @@ static void Deg_ListDegreesForEdition (const struct DegTyp_DegTypes *DegTypes)
|
|||
NumDeg < Gbl.Hierarchy.List[Hie_CTR].Num;
|
||||
NumDeg++)
|
||||
{
|
||||
DegInLst = &(Gbl.Hierarchy.List[Hie_CTR].Lst[NumDeg]);
|
||||
Deg = &(Gbl.Hierarchy.List[Hie_CTR].Lst[NumDeg]);
|
||||
|
||||
ICanEdit = Deg_CheckIfICanEditADegree (DegInLst);
|
||||
ICanEdit = Deg_CheckIfICanEditADegree (Deg);
|
||||
NumCrss = Hie_GetNumNodesInHieLvl (Hie_CRS, // Number of courses...
|
||||
Hie_DEG, // ...in degree
|
||||
DegInLst->HieCod);
|
||||
NumUsrsInCrssOfDeg = Enr_GetNumUsrsInCrss (Hie_DEG,DegInLst->HieCod,
|
||||
Deg->HieCod);
|
||||
NumUsrsInCrssOfDeg = Enr_GetNumUsrsInCrss (Hie_DEG,Deg->HieCod,
|
||||
1 << Rol_STD |
|
||||
1 << Rol_NET |
|
||||
1 << Rol_TCH); // Any user
|
||||
|
@ -362,60 +372,54 @@ static void Deg_ListDegreesForEdition (const struct DegTyp_DegTypes *DegTypes)
|
|||
Ico_PutIconRemovalNotAllowed ();
|
||||
else
|
||||
Ico_PutContextualIconToRemove (ActRemDeg,NULL,
|
||||
Hie_PutParOtherHieCod,&DegInLst->HieCod);
|
||||
Hie_PutParOtherHieCod,&Deg->HieCod);
|
||||
HTM_TD_End ();
|
||||
|
||||
/* Degree code */
|
||||
HTM_TD_Begin ("class=\"DAT_%s CODE\"",The_GetSuffix ());
|
||||
HTM_Long (DegInLst->HieCod);
|
||||
HTM_Long (Deg->HieCod);
|
||||
HTM_TD_End ();
|
||||
|
||||
/* Degree logo */
|
||||
HTM_TD_Begin ("title=\"%s\" class=\"HIE_LOGO\"",DegInLst->FullName);
|
||||
HTM_TD_Begin ("title=\"%s\" class=\"HIE_LOGO\"",Deg->FullName);
|
||||
Lgo_DrawLogo (Hie_DEG,
|
||||
DegInLst->HieCod,
|
||||
DegInLst->ShrtName
|
||||
Deg->HieCod,
|
||||
Deg->ShrtName
|
||||
,20,NULL);
|
||||
HTM_TD_End ();
|
||||
|
||||
/* Degree short name */
|
||||
HTM_TD_Begin ("class=\"LM DAT_%s\"",The_GetSuffix ());
|
||||
if (ICanEdit)
|
||||
{
|
||||
Frm_BeginForm (ActRenDegSho);
|
||||
ParCod_PutPar (ParCod_OthHie,DegInLst->HieCod);
|
||||
HTM_INPUT_TEXT ("ShortName",Cns_MAX_CHARS_SHRT_NAME,DegInLst->ShrtName,
|
||||
HTM_SUBMIT_ON_CHANGE,
|
||||
"class=\"INPUT_SHORT_NAME INPUT_%s\"",
|
||||
The_GetSuffix ());
|
||||
Frm_EndForm ();
|
||||
}
|
||||
else
|
||||
HTM_Txt (DegInLst->ShrtName);
|
||||
HTM_TD_End ();
|
||||
|
||||
/* Degree full name */
|
||||
HTM_TD_Begin ("class=\"LM DAT_%s\"",The_GetSuffix ());
|
||||
if (ICanEdit)
|
||||
{
|
||||
Frm_BeginForm (ActRenDegFul);
|
||||
ParCod_PutPar (ParCod_OthHie,DegInLst->HieCod);
|
||||
HTM_INPUT_TEXT ("FullName",Cns_MAX_CHARS_FULL_NAME,DegInLst->FullName,
|
||||
HTM_SUBMIT_ON_CHANGE,
|
||||
"class=\"INPUT_FULL_NAME INPUT_%s\"",
|
||||
The_GetSuffix ());
|
||||
Frm_EndForm ();
|
||||
}
|
||||
else
|
||||
HTM_Txt (DegInLst->FullName);
|
||||
HTM_TD_End ();
|
||||
/* Degree short name and full name */
|
||||
Name[Cns_SHRT_NAME] = Deg->ShrtName;
|
||||
Name[Cns_FULL_NAME] = Deg->FullName;
|
||||
for (ShrtOrFullName = Cns_SHRT_NAME;
|
||||
ShrtOrFullName <= Cns_FULL_NAME;
|
||||
ShrtOrFullName++)
|
||||
{
|
||||
HTM_TD_Begin ("class=\"LM DAT_%s\"",The_GetSuffix ());
|
||||
if (ICanEdit)
|
||||
{
|
||||
Frm_BeginForm (ActionRename[ShrtOrFullName]);
|
||||
ParCod_PutPar (ParCod_OthHie,Deg->HieCod);
|
||||
HTM_INPUT_TEXT (Cns_ParShrtOrFullName[ShrtOrFullName],
|
||||
Cns_MaxCharsShrtOrFullName[ShrtOrFullName],
|
||||
Name[ShrtOrFullName],
|
||||
HTM_SUBMIT_ON_CHANGE,
|
||||
"class=\"%s INPUT_%s\"",
|
||||
Cns_ClassShrtOrFullName[ShrtOrFullName],
|
||||
The_GetSuffix ());
|
||||
Frm_EndForm ();
|
||||
}
|
||||
else
|
||||
HTM_Txt (Name[ShrtOrFullName]);
|
||||
HTM_TD_End ();
|
||||
}
|
||||
|
||||
/* Degree type */
|
||||
HTM_TD_Begin ("class=\"LM DAT_%s\"",The_GetSuffix ());
|
||||
if (ICanEdit)
|
||||
{
|
||||
Frm_BeginForm (ActChgDegTyp);
|
||||
ParCod_PutPar (ParCod_OthHie,DegInLst->HieCod);
|
||||
ParCod_PutPar (ParCod_OthHie,Deg->HieCod);
|
||||
HTM_SELECT_Begin (HTM_SUBMIT_ON_CHANGE,NULL,
|
||||
"name=\"OthDegTypCod\""
|
||||
" class=\"HIE_SEL_NARROW INPUT_%s\"",
|
||||
|
@ -424,12 +428,12 @@ static void Deg_ListDegreesForEdition (const struct DegTyp_DegTypes *DegTypes)
|
|||
NumDegTyp < DegTypes->Num;
|
||||
NumDegTyp++)
|
||||
{
|
||||
DegTypInLst = &DegTypes->Lst[NumDegTyp];
|
||||
HTM_OPTION (HTM_Type_LONG,&DegTypInLst->DegTypCod,
|
||||
DegTypInLst->DegTypCod == DegInLst->Specific.TypCod ? HTM_OPTION_SELECTED :
|
||||
HTM_OPTION_UNSELECTED,
|
||||
DegTyp = &DegTypes->Lst[NumDegTyp];
|
||||
HTM_OPTION (HTM_Type_LONG,&DegTyp->DegTypCod,
|
||||
DegTyp->DegTypCod == Deg->Specific.TypCod ? HTM_OPTION_SELECTED :
|
||||
HTM_OPTION_UNSELECTED,
|
||||
HTM_OPTION_ENABLED,
|
||||
"%s",DegTypInLst->DegTypName);
|
||||
"%s",DegTyp->DegTypName);
|
||||
}
|
||||
HTM_SELECT_End ();
|
||||
Frm_EndForm ();
|
||||
|
@ -439,9 +443,9 @@ static void Deg_ListDegreesForEdition (const struct DegTyp_DegTypes *DegTypes)
|
|||
NumDegTyp < DegTypes->Num;
|
||||
NumDegTyp++)
|
||||
{
|
||||
DegTypInLst = &DegTypes->Lst[NumDegTyp];
|
||||
if (DegTypInLst->DegTypCod == DegInLst->Specific.TypCod)
|
||||
HTM_Txt (DegTypInLst->DegTypName);
|
||||
DegTyp = &DegTypes->Lst[NumDegTyp];
|
||||
if (DegTyp->DegTypCod == Deg->Specific.TypCod)
|
||||
HTM_Txt (DegTyp->DegTypName);
|
||||
}
|
||||
HTM_TD_End ();
|
||||
|
||||
|
@ -450,8 +454,8 @@ static void Deg_ListDegreesForEdition (const struct DegTyp_DegTypes *DegTypes)
|
|||
if (ICanEdit)
|
||||
{
|
||||
Frm_BeginForm (ActChgDegWWW);
|
||||
ParCod_PutPar (ParCod_OthHie,DegInLst->HieCod);
|
||||
HTM_INPUT_URL ("WWW",DegInLst->WWW,HTM_SUBMIT_ON_CHANGE,
|
||||
ParCod_PutPar (ParCod_OthHie,Deg->HieCod);
|
||||
HTM_INPUT_URL ("WWW",Deg->WWW,HTM_SUBMIT_ON_CHANGE,
|
||||
"class=\"INPUT_WWW_NARROW INPUT_%s\""
|
||||
" required=\"required\"",
|
||||
The_GetSuffix ());
|
||||
|
@ -459,12 +463,12 @@ static void Deg_ListDegreesForEdition (const struct DegTyp_DegTypes *DegTypes)
|
|||
}
|
||||
else
|
||||
{
|
||||
Str_Copy (WWW,DegInLst->WWW,sizeof (WWW) - 1);
|
||||
Str_Copy (WWW,Deg->WWW,sizeof (WWW) - 1);
|
||||
HTM_DIV_Begin ("class=\"EXTERNAL_WWW_SHORT\"");
|
||||
HTM_A_Begin ("href=\"%s\" target=\"_blank\" title=\"%s\""
|
||||
" class=\"DAT_%s\"",
|
||||
DegInLst->WWW,
|
||||
DegInLst->WWW,
|
||||
Deg->WWW,
|
||||
Deg->WWW,
|
||||
The_GetSuffix ());
|
||||
HTM_Txt (WWW);
|
||||
HTM_A_End ();
|
||||
|
@ -483,7 +487,7 @@ static void Deg_ListDegreesForEdition (const struct DegTyp_DegTypes *DegTypes)
|
|||
HTM_TD_End ();
|
||||
|
||||
/* Degree requester */
|
||||
UsrDat.UsrCod = DegInLst->RequesterUsrCod;
|
||||
UsrDat.UsrCod = Deg->RequesterUsrCod;
|
||||
Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat,
|
||||
Usr_DONT_GET_PREFS,
|
||||
Usr_DONT_GET_ROLE_IN_CURRENT_CRS);
|
||||
|
@ -494,7 +498,7 @@ static void Deg_ListDegreesForEdition (const struct DegTyp_DegTypes *DegTypes)
|
|||
|
||||
/* Degree status */
|
||||
Hie_WriteStatusCellEditable (Gbl.Usrs.Me.Role.Logged >= Rol_CTR_ADM,
|
||||
DegInLst->Status,ActChgDegSta,DegInLst->HieCod,
|
||||
Deg->Status,ActChgDegSta,Deg->HieCod,
|
||||
Txt_DEGREE_STATUS);
|
||||
|
||||
HTM_TR_End ();
|
||||
|
@ -524,9 +528,18 @@ static bool Deg_CheckIfICanEditADegree (struct Hie_Node *Deg)
|
|||
|
||||
static void Deg_PutFormToCreateDegree (const struct DegTyp_DegTypes *DegTypes)
|
||||
{
|
||||
extern const char *Cns_ParShrtOrFullName[Cns_NUM_SHRT_FULL_NAMES];
|
||||
extern unsigned Cns_MaxCharsShrtOrFullName[Cns_NUM_SHRT_FULL_NAMES];
|
||||
extern const char *Cns_ClassShrtOrFullName[Cns_NUM_SHRT_FULL_NAMES];
|
||||
Act_Action_t NextAction = ActUnk;
|
||||
unsigned NumDegTyp;
|
||||
struct DegTyp_DegreeType *DegTypInLst;
|
||||
Cns_ShrtOrFullName_t ShrtOrFullName;
|
||||
char *Name[Cns_NUM_SHRT_FULL_NAMES] =
|
||||
{
|
||||
[Cns_SHRT_NAME] = Deg_EditingDeg->ShrtName,
|
||||
[Cns_FULL_NAME] = Deg_EditingDeg->FullName,
|
||||
};
|
||||
|
||||
/***** Set action depending on role *****/
|
||||
if (Gbl.Usrs.Me.Role.Logged >= Rol_CTR_ADM)
|
||||
|
@ -560,23 +573,22 @@ static void Deg_PutFormToCreateDegree (const struct DegTyp_DegTypes *DegTypes)
|
|||
20,NULL);
|
||||
HTM_TD_End ();
|
||||
|
||||
/***** Degree short name *****/
|
||||
HTM_TD_Begin ("class=\"LM\"");
|
||||
HTM_INPUT_TEXT ("ShortName",Cns_MAX_CHARS_SHRT_NAME,Deg_EditingDeg->ShrtName,
|
||||
HTM_DONT_SUBMIT_ON_CHANGE,
|
||||
"class=\"INPUT_SHORT_NAME INPUT_%s\""
|
||||
" required=\"required\"",
|
||||
The_GetSuffix ());
|
||||
HTM_TD_End ();
|
||||
|
||||
/***** Degree full name *****/
|
||||
HTM_TD_Begin ("class=\"LM\"");
|
||||
HTM_INPUT_TEXT ("FullName",Cns_MAX_CHARS_FULL_NAME,Deg_EditingDeg->FullName,
|
||||
HTM_DONT_SUBMIT_ON_CHANGE,
|
||||
"class=\"INPUT_FULL_NAME INPUT_%s\""
|
||||
" required=\"required\"",
|
||||
The_GetSuffix ());
|
||||
HTM_TD_End ();
|
||||
/***** Degree short name and full name *****/
|
||||
for (ShrtOrFullName = Cns_SHRT_NAME;
|
||||
ShrtOrFullName <= Cns_FULL_NAME;
|
||||
ShrtOrFullName++)
|
||||
{
|
||||
HTM_TD_Begin ("class=\"LM\"");
|
||||
HTM_INPUT_TEXT (Cns_ParShrtOrFullName[ShrtOrFullName],
|
||||
Cns_MaxCharsShrtOrFullName[ShrtOrFullName],
|
||||
Name[ShrtOrFullName],
|
||||
HTM_DONT_SUBMIT_ON_CHANGE,
|
||||
"class=\"%s INPUT_%s\""
|
||||
" required=\"required\"",
|
||||
Cns_ClassShrtOrFullName[ShrtOrFullName],
|
||||
The_GetSuffix ());
|
||||
HTM_TD_End ();
|
||||
}
|
||||
|
||||
/***** Degree type *****/
|
||||
HTM_TD_Begin ("class=\"LM\"");
|
||||
|
@ -1073,16 +1085,30 @@ void Deg_ReceiveFormNewDeg (void)
|
|||
|
||||
static void Deg_ReceiveFormRequestOrCreateDeg (Hie_Status_t Status)
|
||||
{
|
||||
extern const char *Cns_ParShrtOrFullName[Cns_NUM_SHRT_FULL_NAMES];
|
||||
extern const char *Cns_FldShrtOrFullName[Cns_NUM_SHRT_FULL_NAMES];
|
||||
extern unsigned Cns_MaxBytesShrtOrFullName[Cns_NUM_SHRT_FULL_NAMES];
|
||||
extern const char *Txt_The_degree_X_already_exists;
|
||||
extern const char *Txt_Created_new_degree_X;
|
||||
Cns_ShrtOrFullName_t ShrtOrFullName;
|
||||
bool Exists;
|
||||
char *Name[Cns_NUM_SHRT_FULL_NAMES] =
|
||||
{
|
||||
[Cns_SHRT_NAME] = Deg_EditingDeg->ShrtName,
|
||||
[Cns_FULL_NAME] = Deg_EditingDeg->FullName,
|
||||
};
|
||||
|
||||
/***** Get parameters from form *****/
|
||||
/* Set degree center */
|
||||
Deg_EditingDeg->PrtCod = Gbl.Hierarchy.Node[Hie_CTR].HieCod;
|
||||
|
||||
/* Get degree short name and full name */
|
||||
Par_GetParText ("ShortName",Deg_EditingDeg->ShrtName,Cns_MAX_BYTES_SHRT_NAME);
|
||||
Par_GetParText ("FullName" ,Deg_EditingDeg->FullName,Cns_MAX_BYTES_FULL_NAME);
|
||||
for (ShrtOrFullName = Cns_SHRT_NAME;
|
||||
ShrtOrFullName <= Cns_FULL_NAME;
|
||||
ShrtOrFullName++)
|
||||
Par_GetParText (Cns_ParShrtOrFullName[ShrtOrFullName],
|
||||
Name[ShrtOrFullName],
|
||||
Cns_MaxBytesShrtOrFullName[ShrtOrFullName]);
|
||||
|
||||
/* Get degree type */
|
||||
Deg_EditingDeg->Specific.TypCod = ParCod_GetAndCheckPar (ParCod_OthDegTyp);
|
||||
|
@ -1096,17 +1122,19 @@ static void Deg_ReceiveFormRequestOrCreateDeg (Hie_Status_t Status)
|
|||
if (Deg_EditingDeg->WWW[0])
|
||||
{
|
||||
/***** If name of degree was in database... *****/
|
||||
if (Deg_DB_CheckIfDegNameExistsInCtr ("ShortName",Deg_EditingDeg->ShrtName,
|
||||
-1L,Deg_EditingDeg->PrtCod))
|
||||
Ale_CreateAlert (Ale_WARNING,NULL,
|
||||
Txt_The_degree_X_already_exists,
|
||||
Deg_EditingDeg->ShrtName);
|
||||
else if (Deg_DB_CheckIfDegNameExistsInCtr ("FullName",Deg_EditingDeg->FullName,
|
||||
-1L,Deg_EditingDeg->PrtCod))
|
||||
Ale_CreateAlert (Ale_WARNING,NULL,
|
||||
Txt_The_degree_X_already_exists,
|
||||
Deg_EditingDeg->FullName);
|
||||
else // Add new degree to database
|
||||
for (ShrtOrFullName = Cns_SHRT_NAME, Exists = false;
|
||||
ShrtOrFullName <= Cns_FULL_NAME && !Exists;
|
||||
ShrtOrFullName++)
|
||||
if (Deg_DB_CheckIfDegNameExistsInCtr (Cns_FldShrtOrFullName[ShrtOrFullName],
|
||||
Name[ShrtOrFullName],
|
||||
-1L,Deg_EditingDeg->PrtCod))
|
||||
{
|
||||
Ale_CreateAlert (Ale_WARNING,NULL,
|
||||
Txt_The_degree_X_already_exists,
|
||||
Name[ShrtOrFullName]);
|
||||
Exists = true;
|
||||
}
|
||||
if (!Exists) // Add new degree to database
|
||||
{
|
||||
Deg_DB_CreateDegree (Deg_EditingDeg,Status);
|
||||
Ale_CreateAlert (Ale_SUCCESS,NULL,
|
||||
|
@ -1118,7 +1146,7 @@ static void Deg_ReceiveFormRequestOrCreateDeg (Hie_Status_t Status)
|
|||
Ale_CreateAlertYouMustSpecifyTheWebAddress ();
|
||||
}
|
||||
else // If there is not a degree name
|
||||
Ale_CreateAlertYouMustSpecifyTheShortNameAndTheFullName ();
|
||||
Ale_CreateAlertYouMustSpecifyShrtNameAndFullName ();
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -1351,8 +1379,7 @@ void Deg_RenameDegree (struct Hie_Node *Deg,Cns_ShrtOrFullName_t ShrtOrFullName)
|
|||
if (Deg_DB_CheckIfDegNameExistsInCtr (Cns_ParShrtOrFullName[ShrtOrFullName],
|
||||
NewName,Deg->HieCod,Deg->PrtCod))
|
||||
Ale_CreateAlert (Ale_WARNING,NULL,
|
||||
Txt_The_degree_X_already_exists,
|
||||
NewName);
|
||||
Txt_The_degree_X_already_exists,NewName);
|
||||
else
|
||||
{
|
||||
/* Update the table changing old name by new name */
|
||||
|
|
|
@ -266,9 +266,7 @@ static void DegCfg_Center (bool PrintView,bool PutForm)
|
|||
|
||||
static void DegCfg_FullName (bool PutForm)
|
||||
{
|
||||
extern const char *Txt_Degree;
|
||||
|
||||
HieCfg_FullName (PutForm,ActRenDegFulCfg,Hie_DEG,Txt_Degree);
|
||||
HieCfg_Name (PutForm,Hie_DEG,Cns_FULL_NAME);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -277,7 +275,7 @@ static void DegCfg_FullName (bool PutForm)
|
|||
|
||||
static void DegCfg_ShrtName (bool PutForm)
|
||||
{
|
||||
HieCfg_ShrtName (PutForm,ActRenDegShoCfg,Hie_DEG);
|
||||
HieCfg_Name (PutForm,Hie_DEG,Cns_SHRT_NAME);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -350,9 +348,17 @@ static void DegCfg_NumCrss (void)
|
|||
|
||||
void DegCfg_ChangeDegCtr (void)
|
||||
{
|
||||
extern const char *Cns_FldShrtOrFullName[Cns_NUM_SHRT_FULL_NAMES];
|
||||
extern const char *Txt_The_degree_X_already_exists;
|
||||
extern const char *Txt_The_degree_X_has_been_moved_to_the_center_Y;
|
||||
struct Hie_Node NewCtr;
|
||||
Cns_ShrtOrFullName_t ShrtOrFullName;
|
||||
bool Exists;
|
||||
char *Name[Cns_NUM_SHRT_FULL_NAMES] =
|
||||
{
|
||||
[Cns_SHRT_NAME] = Gbl.Hierarchy.Node[Hie_DEG].ShrtName,
|
||||
[Cns_FULL_NAME] = Gbl.Hierarchy.Node[Hie_DEG].FullName,
|
||||
};
|
||||
|
||||
/***** Get parameter with center code *****/
|
||||
NewCtr.HieCod = ParCod_GetAndCheckPar (ParCod_OthCtr);
|
||||
|
@ -364,21 +370,19 @@ void DegCfg_ChangeDegCtr (void)
|
|||
Ctr_GetCenterDataByCod (&NewCtr);
|
||||
|
||||
/***** Check if it already exists a degree with the same name in the new center *****/
|
||||
if (Deg_DB_CheckIfDegNameExistsInCtr ("ShortName",
|
||||
Gbl.Hierarchy.Node[Hie_DEG].ShrtName,
|
||||
Gbl.Hierarchy.Node[Hie_DEG].HieCod,
|
||||
NewCtr.HieCod))
|
||||
Ale_CreateAlert (Ale_WARNING,
|
||||
Txt_The_degree_X_already_exists,
|
||||
Gbl.Hierarchy.Node[Hie_DEG].ShrtName);
|
||||
else if (Deg_DB_CheckIfDegNameExistsInCtr ("FullName",
|
||||
Gbl.Hierarchy.Node[Hie_DEG].FullName,
|
||||
Gbl.Hierarchy.Node[Hie_DEG].HieCod,
|
||||
NewCtr.HieCod))
|
||||
Ale_CreateAlert (Ale_WARNING,
|
||||
Txt_The_degree_X_already_exists,
|
||||
Gbl.Hierarchy.Node[Hie_DEG].FullName);
|
||||
else
|
||||
for (ShrtOrFullName = Cns_SHRT_NAME, Exists = false;
|
||||
ShrtOrFullName <= Cns_FULL_NAME && !Exists;
|
||||
ShrtOrFullName++)
|
||||
if (Deg_DB_CheckIfDegNameExistsInCtr (Cns_FldShrtOrFullName[ShrtOrFullName],
|
||||
Name[ShrtOrFullName],
|
||||
Gbl.Hierarchy.Node[Hie_DEG].HieCod,
|
||||
NewCtr.HieCod))
|
||||
{
|
||||
Ale_CreateAlert (Ale_WARNING,Txt_The_degree_X_already_exists,
|
||||
Name[ShrtOrFullName]);
|
||||
Exists = true;
|
||||
}
|
||||
if (Exists)
|
||||
{
|
||||
/***** Update center in table of degrees *****/
|
||||
Deg_DB_UpdateDegCtr (Gbl.Hierarchy.Node[Hie_DEG].HieCod,NewCtr.HieCod);
|
||||
|
|
|
@ -464,12 +464,22 @@ static void Dpt_GetDepartmentDataFromRow (MYSQL_RES *mysql_res,
|
|||
|
||||
static void Dpt_ListDepartmentsForEdition (const struct Dpt_Departments *Departments)
|
||||
{
|
||||
extern const char *Cns_ParShrtOrFullName[Cns_NUM_SHRT_FULL_NAMES];
|
||||
extern unsigned Cns_MaxCharsShrtOrFullName[Cns_NUM_SHRT_FULL_NAMES];
|
||||
extern const char *Cns_ClassShrtOrFullName[Cns_NUM_SHRT_FULL_NAMES];
|
||||
extern const char *Txt_Another_institution;
|
||||
static Act_Action_t ActionRename[Cns_NUM_SHRT_FULL_NAMES] =
|
||||
{
|
||||
[Cns_SHRT_NAME] = ActRenDptSho,
|
||||
[Cns_FULL_NAME] = ActRenDptFul,
|
||||
};
|
||||
unsigned NumDpt;
|
||||
struct Dpt_Department *DptInLst;
|
||||
struct Hie_Node Ins;
|
||||
unsigned NumIns;
|
||||
struct Hie_Node *InsInLst;
|
||||
Cns_ShrtOrFullName_t ShrtOrFullName;
|
||||
char *Name[Cns_NUM_SHRT_FULL_NAMES];
|
||||
|
||||
/***** Begin table *****/
|
||||
HTM_TABLE_BeginPadding (2);
|
||||
|
@ -532,27 +542,26 @@ static void Dpt_ListDepartmentsForEdition (const struct Dpt_Departments *Departm
|
|||
Frm_EndForm ();
|
||||
HTM_TD_End ();
|
||||
|
||||
/* Department short name */
|
||||
HTM_TD_Begin ("class=\"LM\"");
|
||||
Frm_BeginForm (ActRenDptSho);
|
||||
ParCod_PutPar (ParCod_Dpt,DptInLst->DptCod);
|
||||
HTM_INPUT_TEXT ("ShortName",Cns_MAX_CHARS_SHRT_NAME,DptInLst->ShrtName,
|
||||
HTM_SUBMIT_ON_CHANGE,
|
||||
"class=\"INPUT_SHORT_NAME INPUT_%s\"",
|
||||
The_GetSuffix ());
|
||||
Frm_EndForm ();
|
||||
HTM_TD_End ();
|
||||
|
||||
/* Department full name */
|
||||
HTM_TD_Begin ("class=\"LM\"");
|
||||
Frm_BeginForm (ActRenDptFul);
|
||||
ParCod_PutPar (ParCod_Dpt,DptInLst->DptCod);
|
||||
HTM_INPUT_TEXT ("FullName",Cns_MAX_CHARS_FULL_NAME,DptInLst->FullName,
|
||||
HTM_SUBMIT_ON_CHANGE,
|
||||
"class=\"INPUT_FULL_NAME INPUT_%s\"",
|
||||
The_GetSuffix ());
|
||||
Frm_EndForm ();
|
||||
HTM_TD_End ();
|
||||
/* Department short name and full name */
|
||||
Name[Cns_SHRT_NAME] = DptInLst->ShrtName;
|
||||
Name[Cns_FULL_NAME] = DptInLst->FullName;
|
||||
for (ShrtOrFullName = Cns_SHRT_NAME;
|
||||
ShrtOrFullName <= Cns_FULL_NAME;
|
||||
ShrtOrFullName++)
|
||||
{
|
||||
HTM_TD_Begin ("class=\"LM\"");
|
||||
Frm_BeginForm (ActionRename[ShrtOrFullName]);
|
||||
ParCod_PutPar (ParCod_Dpt,DptInLst->DptCod);
|
||||
HTM_INPUT_TEXT (Cns_ParShrtOrFullName[ShrtOrFullName],
|
||||
Cns_MaxCharsShrtOrFullName[ShrtOrFullName],
|
||||
Name[ShrtOrFullName],
|
||||
HTM_SUBMIT_ON_CHANGE,
|
||||
"class=\"%s INPUT_%s\"",
|
||||
Cns_ClassShrtOrFullName[ShrtOrFullName],
|
||||
The_GetSuffix ());
|
||||
Frm_EndForm ();
|
||||
HTM_TD_End ();
|
||||
}
|
||||
|
||||
/* Department WWW */
|
||||
HTM_TD_Begin ("class=\"LM\"");
|
||||
|
@ -807,9 +816,18 @@ void Dpt_ContEditAfterChgDpt (void)
|
|||
|
||||
static void Dpt_PutFormToCreateDepartment (void)
|
||||
{
|
||||
extern const char *Cns_ParShrtOrFullName[Cns_NUM_SHRT_FULL_NAMES];
|
||||
extern unsigned Cns_MaxCharsShrtOrFullName[Cns_NUM_SHRT_FULL_NAMES];
|
||||
extern const char *Cns_ClassShrtOrFullName[Cns_NUM_SHRT_FULL_NAMES];
|
||||
extern const char *Txt_Another_institution;
|
||||
unsigned NumIns;
|
||||
const struct Hie_Node *InsInLst;
|
||||
Cns_ShrtOrFullName_t ShrtOrFullName;
|
||||
char *Name[Cns_NUM_SHRT_FULL_NAMES] =
|
||||
{
|
||||
[Cns_SHRT_NAME] = Dpt_EditingDpt->ShrtName,
|
||||
[Cns_FULL_NAME] = Dpt_EditingDpt->FullName,
|
||||
};
|
||||
|
||||
/***** Begin form to create *****/
|
||||
Frm_BeginFormTable (ActNewDpt,NULL,NULL,NULL);
|
||||
|
@ -852,23 +870,22 @@ static void Dpt_PutFormToCreateDepartment (void)
|
|||
HTM_SELECT_End ();
|
||||
HTM_TD_End ();
|
||||
|
||||
/***** Department short name *****/
|
||||
HTM_TD_Begin ("class=\"LM\"");
|
||||
HTM_INPUT_TEXT ("ShortName",Cns_MAX_CHARS_SHRT_NAME,Dpt_EditingDpt->ShrtName,
|
||||
HTM_DONT_SUBMIT_ON_CHANGE,
|
||||
"class=\"INPUT_SHORT_NAME INPUT_%s\""
|
||||
" required=\"required\"",
|
||||
The_GetSuffix ());
|
||||
HTM_TD_End ();
|
||||
|
||||
/***** Department full name *****/
|
||||
HTM_TD_Begin ("class=\"LM\"");
|
||||
HTM_INPUT_TEXT ("FullName",Cns_MAX_CHARS_FULL_NAME,Dpt_EditingDpt->FullName,
|
||||
HTM_DONT_SUBMIT_ON_CHANGE,
|
||||
"class=\"INPUT_FULL_NAME INPUT_%s\""
|
||||
" required=\"required\"",
|
||||
The_GetSuffix ());
|
||||
HTM_TD_End ();
|
||||
/***** Department short name and full name *****/
|
||||
for (ShrtOrFullName = Cns_SHRT_NAME;
|
||||
ShrtOrFullName <= Cns_FULL_NAME;
|
||||
ShrtOrFullName++)
|
||||
{
|
||||
HTM_TD_Begin ("class=\"LM\"");
|
||||
HTM_INPUT_TEXT (Cns_ParShrtOrFullName[ShrtOrFullName],
|
||||
Cns_MaxCharsShrtOrFullName[ShrtOrFullName],
|
||||
Name[ShrtOrFullName],
|
||||
HTM_DONT_SUBMIT_ON_CHANGE,
|
||||
"class=\"%s INPUT_%s\""
|
||||
" required=\"required\"",
|
||||
Cns_ClassShrtOrFullName[ShrtOrFullName],
|
||||
The_GetSuffix ());
|
||||
HTM_TD_End ();
|
||||
}
|
||||
|
||||
/***** Department WWW *****/
|
||||
HTM_TD_Begin ("class=\"LM\"");
|
||||
|
@ -919,8 +936,18 @@ static void Dpt_PutHeadDepartments (void)
|
|||
|
||||
void Dpt_ReceiveFormNewDpt (void)
|
||||
{
|
||||
extern const char *Cns_ParShrtOrFullName[Cns_NUM_SHRT_FULL_NAMES];
|
||||
extern const char *Cns_FldShrtOrFullName[Cns_NUM_SHRT_FULL_NAMES];
|
||||
extern unsigned Cns_MaxBytesShrtOrFullName[Cns_NUM_SHRT_FULL_NAMES];
|
||||
extern const char *Txt_The_department_X_already_exists;
|
||||
extern const char *Txt_Created_new_department_X;
|
||||
Cns_ShrtOrFullName_t ShrtOrFullName;
|
||||
bool Exists;
|
||||
char *Name[Cns_NUM_SHRT_FULL_NAMES] =
|
||||
{
|
||||
[Cns_SHRT_NAME] = Dpt_EditingDpt->ShrtName,
|
||||
[Cns_FULL_NAME] = Dpt_EditingDpt->FullName,
|
||||
};
|
||||
|
||||
/***** Department constructor *****/
|
||||
Dpt_EditingDepartmentConstructor ();
|
||||
|
@ -929,11 +956,13 @@ void Dpt_ReceiveFormNewDpt (void)
|
|||
/* Get institution */
|
||||
Dpt_EditingDpt->InsCod = ParCod_GetAndCheckPar (ParCod_OthIns);
|
||||
|
||||
/* Get department short name */
|
||||
Par_GetParText ("ShortName",Dpt_EditingDpt->ShrtName,Cns_MAX_BYTES_SHRT_NAME);
|
||||
|
||||
/* Get department full name */
|
||||
Par_GetParText ("FullName",Dpt_EditingDpt->FullName,Cns_MAX_BYTES_FULL_NAME);
|
||||
/* Get department short name and full name */
|
||||
for (ShrtOrFullName = Cns_SHRT_NAME;
|
||||
ShrtOrFullName <= Cns_FULL_NAME;
|
||||
ShrtOrFullName++)
|
||||
Par_GetParText (Cns_ParShrtOrFullName[ShrtOrFullName],
|
||||
Name[ShrtOrFullName],
|
||||
Cns_MaxBytesShrtOrFullName[ShrtOrFullName]);
|
||||
|
||||
/* Get department WWW */
|
||||
Par_GetParText ("WWW",Dpt_EditingDpt->WWW,Cns_MAX_BYTES_WWW);
|
||||
|
@ -944,15 +973,18 @@ void Dpt_ReceiveFormNewDpt (void)
|
|||
if (Dpt_EditingDpt->WWW[0])
|
||||
{
|
||||
/***** If name of department was in database... *****/
|
||||
if (Dpt_DB_CheckIfDepartmentNameExists ("ShortName",Dpt_EditingDpt->ShrtName,-1L))
|
||||
Ale_CreateAlert (Ale_WARNING,NULL,
|
||||
Txt_The_department_X_already_exists,
|
||||
Dpt_EditingDpt->ShrtName);
|
||||
else if (Dpt_DB_CheckIfDepartmentNameExists ("FullName",Dpt_EditingDpt->FullName,-1L))
|
||||
Ale_CreateAlert (Ale_WARNING,NULL,
|
||||
Txt_The_department_X_already_exists,
|
||||
Dpt_EditingDpt->FullName);
|
||||
else // Add new department to database
|
||||
for (ShrtOrFullName = Cns_SHRT_NAME, Exists = false;
|
||||
ShrtOrFullName <= Cns_FULL_NAME && !Exists;
|
||||
ShrtOrFullName++)
|
||||
if (Dpt_DB_CheckIfDepartmentNameExists (Cns_FldShrtOrFullName[ShrtOrFullName],
|
||||
Name[ShrtOrFullName],-1L))
|
||||
{
|
||||
Ale_CreateAlert (Ale_WARNING,NULL,
|
||||
Txt_The_department_X_already_exists,
|
||||
Name[ShrtOrFullName]);
|
||||
Exists = true;
|
||||
}
|
||||
if (!Exists) // Add new department to database
|
||||
{
|
||||
Dpt_DB_CreateDepartment (Dpt_EditingDpt);
|
||||
Ale_CreateAlert (Ale_SUCCESS,NULL,
|
||||
|
@ -964,7 +996,7 @@ void Dpt_ReceiveFormNewDpt (void)
|
|||
Ale_CreateAlertYouMustSpecifyTheWebAddress ();
|
||||
}
|
||||
else // If there is not a department name
|
||||
Ale_CreateAlertYouMustSpecifyTheShortNameAndTheFullName ();
|
||||
Ale_CreateAlertYouMustSpecifyShrtNameAndFullName ();
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -70,6 +70,27 @@ static FigCch_FigureCached_t Hie_FiguresCached[Hie_NUM_LEVELS] =
|
|||
[Hie_CRS] = FigCch_NUM_CRSS,
|
||||
};
|
||||
|
||||
/*****************************************************************************/
|
||||
/**************************** Public constants *******************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
extern const char *Txt_System;
|
||||
extern const char *Txt_Country;
|
||||
extern const char *Txt_Institution;
|
||||
extern const char *Txt_Center;
|
||||
extern const char *Txt_Degree;
|
||||
extern const char *Txt_Course;
|
||||
|
||||
const char **Hie_TxtLevel[Hie_NUM_LEVELS] =
|
||||
{
|
||||
[Hie_SYS] = &Txt_System,
|
||||
[Hie_CTY] = &Txt_Country,
|
||||
[Hie_INS] = &Txt_Institution,
|
||||
[Hie_CTR] = &Txt_Center,
|
||||
[Hie_DEG] = &Txt_Degree,
|
||||
[Hie_CRS] = &Txt_Course,
|
||||
};
|
||||
|
||||
/*****************************************************************************/
|
||||
/***************************** Private prototypes ****************************/
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -82,75 +82,62 @@ void HieCfg_Title (bool PutLink,Hie_Level_t Level)
|
|||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/********************** Show full name in configuration **********************/
|
||||
/******************* Show short/full name in configuration *******************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void HieCfg_FullName (bool PutForm,Act_Action_t NextAction,Hie_Level_t Level,
|
||||
const char *Label)
|
||||
void HieCfg_Name (bool PutForm,Hie_Level_t Level,Cns_ShrtOrFullName_t ShrtOrFullName)
|
||||
{
|
||||
extern const char *Cns_ParShrtOrFullName[Cns_NUM_SHRT_FULL_NAMES];
|
||||
extern unsigned Cns_MaxCharsShrtOrFullName[Cns_NUM_SHRT_FULL_NAMES];
|
||||
extern const char *Cns_ClassShrtOrFullName[Cns_NUM_SHRT_FULL_NAMES];
|
||||
extern const char **Hie_TxtLevel[Hie_NUM_LEVELS];
|
||||
extern const char *Txt_Short_name;
|
||||
static Act_Action_t Action[Hie_NUM_LEVELS][Cns_NUM_SHRT_FULL_NAMES] =
|
||||
{
|
||||
[Hie_INS][Cns_SHRT_NAME] = ActRenInsShoCfg,
|
||||
[Hie_INS][Cns_FULL_NAME] = ActRenInsFulCfg,
|
||||
[Hie_CTR][Cns_SHRT_NAME] = ActRenCtrShoCfg,
|
||||
[Hie_CTR][Cns_FULL_NAME] = ActRenCtrFulCfg,
|
||||
[Hie_DEG][Cns_SHRT_NAME] = ActRenDegShoCfg,
|
||||
[Hie_DEG][Cns_FULL_NAME] = ActRenDegFulCfg,
|
||||
[Hie_CRS][Cns_SHRT_NAME] = ActRenCrsShoCfg,
|
||||
[Hie_CRS][Cns_FULL_NAME] = ActRenCrsFulCfg,
|
||||
};
|
||||
char *Name[Cns_NUM_SHRT_FULL_NAMES] =
|
||||
{
|
||||
[Cns_SHRT_NAME] = Gbl.Hierarchy.Node[Level].ShrtName,
|
||||
[Cns_FULL_NAME] = Gbl.Hierarchy.Node[Level].FullName,
|
||||
};
|
||||
|
||||
/***** Full name *****/
|
||||
HTM_TR_Begin (NULL);
|
||||
|
||||
/* Label */
|
||||
Frm_LabelColumn ("RT",PutForm ? "FullName" :
|
||||
Frm_LabelColumn ("RT",PutForm ? Cns_ParShrtOrFullName[ShrtOrFullName] :
|
||||
NULL,
|
||||
Label);
|
||||
ShrtOrFullName == Cns_SHRT_NAME ? Txt_Short_name :
|
||||
*Hie_TxtLevel[Level]);
|
||||
|
||||
/* Data */
|
||||
HTM_TD_Begin ("class=\"LB DAT_STRONG_%s\"",The_GetSuffix ());
|
||||
if (PutForm)
|
||||
{
|
||||
/* Form to change full name */
|
||||
Frm_BeginForm (NextAction);
|
||||
HTM_INPUT_TEXT ("FullName",Cns_MAX_CHARS_FULL_NAME,
|
||||
Gbl.Hierarchy.Node[Level].FullName,
|
||||
Frm_BeginForm (Action[Level][ShrtOrFullName]);
|
||||
HTM_INPUT_TEXT (Cns_ParShrtOrFullName[ShrtOrFullName],
|
||||
Cns_MaxCharsShrtOrFullName[ShrtOrFullName],
|
||||
Name[ShrtOrFullName],
|
||||
HTM_SUBMIT_ON_CHANGE,
|
||||
"id=\"FullName\""
|
||||
" class=\"INPUT_FULL_NAME INPUT_%s\""
|
||||
"id=\"%s\""
|
||||
" class=\"%s INPUT_%s\""
|
||||
" required=\"required\"",
|
||||
Cns_ParShrtOrFullName[ShrtOrFullName],
|
||||
Cns_ClassShrtOrFullName[ShrtOrFullName],
|
||||
The_GetSuffix ());
|
||||
Frm_EndForm ();
|
||||
}
|
||||
else // I can not edit full name
|
||||
HTM_Txt (Gbl.Hierarchy.Node[Level].FullName);
|
||||
HTM_TD_End ();
|
||||
|
||||
HTM_TR_End ();
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/********* Show institution short name in institution configuration **********/
|
||||
/*****************************************************************************/
|
||||
|
||||
void HieCfg_ShrtName (bool PutForm,Act_Action_t NextAction,Hie_Level_t Level)
|
||||
{
|
||||
extern const char *Txt_Short_name;
|
||||
|
||||
/***** Short name *****/
|
||||
HTM_TR_Begin (NULL);
|
||||
|
||||
/* Label */
|
||||
Frm_LabelColumn ("RT",PutForm ? "ShortName" :
|
||||
NULL,
|
||||
Txt_Short_name);
|
||||
|
||||
/* Data */
|
||||
HTM_TD_Begin ("class=\"LB DAT_STRONG_%s\"",The_GetSuffix ());
|
||||
if (PutForm)
|
||||
{
|
||||
/* Form to change short name */
|
||||
Frm_BeginForm (NextAction);
|
||||
HTM_INPUT_TEXT ("ShortName",Cns_MAX_CHARS_SHRT_NAME,
|
||||
Gbl.Hierarchy.Node[Level].ShrtName,
|
||||
HTM_SUBMIT_ON_CHANGE,
|
||||
"id=\"ShortName\""
|
||||
" class=\"INPUT_SHORT_NAME INPUT_%s\""
|
||||
" required=\"required\"",
|
||||
The_GetSuffix ());
|
||||
Frm_EndForm ();
|
||||
}
|
||||
else // I can not edit short name
|
||||
HTM_Txt (Gbl.Hierarchy.Node[Level].ShrtName);
|
||||
HTM_Txt (Name[ShrtOrFullName]);
|
||||
HTM_TD_End ();
|
||||
|
||||
HTM_TR_End ();
|
||||
|
|
|
@ -34,9 +34,7 @@
|
|||
/*****************************************************************************/
|
||||
|
||||
void HieCfg_Title (bool PutLink,Hie_Level_t LogoScope);
|
||||
void HieCfg_FullName (bool PutForm,Act_Action_t NextAction,Hie_Level_t Level,
|
||||
const char *Label);
|
||||
void HieCfg_ShrtName (bool PutForm,Act_Action_t NextAction,Hie_Level_t Level);
|
||||
void HieCfg_Name (bool PutForm,Hie_Level_t Level,Cns_ShrtOrFullName_t ShrtOrFullName);
|
||||
void HieCfg_WWW (bool PrintView,bool PutForm,Act_Action_t NextAction,
|
||||
const char WWW[Cns_MAX_BYTES_WWW + 1]);
|
||||
void HieCfg_Shortcut (bool PrintView,ParCod_Param_t ParCode,long HieCod);
|
||||
|
|
|
@ -876,7 +876,15 @@ void Ins_WriteSelectorOfInstitution (void)
|
|||
|
||||
static void Ins_ListInstitutionsForEdition (void)
|
||||
{
|
||||
extern const char *Cns_ParShrtOrFullName[Cns_NUM_SHRT_FULL_NAMES];
|
||||
extern unsigned Cns_MaxCharsShrtOrFullName[Cns_NUM_SHRT_FULL_NAMES];
|
||||
extern const char *Cns_ClassShrtOrFullName[Cns_NUM_SHRT_FULL_NAMES];
|
||||
extern const char *Txt_INSTITUTION_STATUS[Hie_NUM_STATUS_TXT];
|
||||
static Act_Action_t ActionRename[Cns_NUM_SHRT_FULL_NAMES] =
|
||||
{
|
||||
[Cns_SHRT_NAME] = ActRenInsSho,
|
||||
[Cns_FULL_NAME] = ActRenInsFul,
|
||||
};
|
||||
unsigned NumIns;
|
||||
struct Hie_Node *Ins;
|
||||
char WWW[Cns_MAX_BYTES_WWW + 1];
|
||||
|
@ -885,6 +893,8 @@ static void Ins_ListInstitutionsForEdition (void)
|
|||
unsigned NumCtrs;
|
||||
unsigned NumUsrsIns;
|
||||
unsigned NumUsrsInCrssOfIns;
|
||||
Cns_ShrtOrFullName_t ShrtOrFullName;
|
||||
char *Name[Cns_NUM_SHRT_FULL_NAMES];
|
||||
|
||||
/***** Initialize structure with user's data *****/
|
||||
Usr_UsrDataConstructor (&UsrDat);
|
||||
|
@ -940,37 +950,31 @@ static void Ins_ListInstitutionsForEdition (void)
|
|||
20,NULL);
|
||||
HTM_TD_End ();
|
||||
|
||||
/* Institution short name */
|
||||
HTM_TD_Begin ("class=\"LM DAT_%s\"",The_GetSuffix ());
|
||||
if (ICanEdit)
|
||||
{
|
||||
Frm_BeginForm (ActRenInsSho);
|
||||
ParCod_PutPar (ParCod_OthHie,Ins->HieCod);
|
||||
HTM_INPUT_TEXT ("ShortName",Cns_MAX_CHARS_SHRT_NAME,Ins->ShrtName,
|
||||
HTM_SUBMIT_ON_CHANGE,
|
||||
"class=\"INPUT_SHORT_NAME INPUT_%s\"",
|
||||
The_GetSuffix ());
|
||||
Frm_EndForm ();
|
||||
}
|
||||
else
|
||||
HTM_Txt (Ins->ShrtName);
|
||||
HTM_TD_End ();
|
||||
|
||||
/* Institution full name */
|
||||
HTM_TD_Begin ("class=\"LM DAT_%s\"",The_GetSuffix ());
|
||||
if (ICanEdit)
|
||||
/* Institution short name and full name */
|
||||
Name[Cns_SHRT_NAME] = Ins->ShrtName;
|
||||
Name[Cns_FULL_NAME] = Ins->FullName;
|
||||
for (ShrtOrFullName = Cns_SHRT_NAME;
|
||||
ShrtOrFullName <= Cns_FULL_NAME;
|
||||
ShrtOrFullName++)
|
||||
{
|
||||
Frm_BeginForm (ActRenInsFul);
|
||||
ParCod_PutPar (ParCod_OthHie,Ins->HieCod);
|
||||
HTM_INPUT_TEXT ("FullName",Cns_MAX_CHARS_FULL_NAME,Ins->FullName,
|
||||
HTM_SUBMIT_ON_CHANGE,
|
||||
"class=\"INPUT_FULL_NAME INPUT_%s\"",
|
||||
The_GetSuffix ());
|
||||
Frm_EndForm ();
|
||||
HTM_TD_Begin ("class=\"LM DAT_%s\"",The_GetSuffix ());
|
||||
if (ICanEdit)
|
||||
{
|
||||
Frm_BeginForm (ActionRename[ShrtOrFullName]);
|
||||
ParCod_PutPar (ParCod_OthHie,Ins->HieCod);
|
||||
HTM_INPUT_TEXT (Cns_ParShrtOrFullName[ShrtOrFullName],
|
||||
Cns_MaxCharsShrtOrFullName[ShrtOrFullName],
|
||||
Name[ShrtOrFullName],
|
||||
HTM_SUBMIT_ON_CHANGE,
|
||||
"class=\"%s INPUT_%s\"",
|
||||
Cns_ClassShrtOrFullName[ShrtOrFullName],
|
||||
The_GetSuffix ());
|
||||
Frm_EndForm ();
|
||||
}
|
||||
else
|
||||
HTM_Txt (Name[ShrtOrFullName]);
|
||||
HTM_TD_End ();
|
||||
}
|
||||
else
|
||||
HTM_Txt (Ins->FullName);
|
||||
HTM_TD_End ();
|
||||
|
||||
/* Institution WWW */
|
||||
HTM_TD_Begin ("class=\"LM DAT_%s\"",The_GetSuffix ());
|
||||
|
@ -1349,7 +1353,16 @@ static void Ins_ShowAlertAndButtonToGoToIns (void)
|
|||
|
||||
static void Ins_PutFormToCreateInstitution (void)
|
||||
{
|
||||
extern const char *Cns_ParShrtOrFullName[Cns_NUM_SHRT_FULL_NAMES];
|
||||
extern unsigned Cns_MaxCharsShrtOrFullName[Cns_NUM_SHRT_FULL_NAMES];
|
||||
extern const char *Cns_ClassShrtOrFullName[Cns_NUM_SHRT_FULL_NAMES];
|
||||
Act_Action_t NextAction = ActUnk;
|
||||
Cns_ShrtOrFullName_t ShrtOrFullName;
|
||||
char *Name[Cns_NUM_SHRT_FULL_NAMES] =
|
||||
{
|
||||
[Cns_SHRT_NAME] = Ins_EditingIns->ShrtName,
|
||||
[Cns_FULL_NAME] = Ins_EditingIns->FullName,
|
||||
};
|
||||
|
||||
/***** Set action depending on role *****/
|
||||
if (Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM)
|
||||
|
@ -1383,23 +1396,22 @@ static void Ins_PutFormToCreateInstitution (void)
|
|||
20,NULL);
|
||||
HTM_TD_End ();
|
||||
|
||||
/***** Institution short name *****/
|
||||
HTM_TD_Begin ("class=\"LM\"");
|
||||
HTM_INPUT_TEXT ("ShortName",Cns_MAX_CHARS_SHRT_NAME,Ins_EditingIns->ShrtName,
|
||||
HTM_DONT_SUBMIT_ON_CHANGE,
|
||||
"class=\"INPUT_SHORT_NAME INPUT_%s\""
|
||||
" required=\"required\"",
|
||||
The_GetSuffix ());
|
||||
HTM_TD_End ();
|
||||
|
||||
/***** Institution full name *****/
|
||||
HTM_TD_Begin ("class=\"LM\"");
|
||||
HTM_INPUT_TEXT ("FullName",Cns_MAX_CHARS_FULL_NAME,Ins_EditingIns->FullName,
|
||||
HTM_DONT_SUBMIT_ON_CHANGE,
|
||||
"class=\"INPUT_FULL_NAME INPUT_%s\""
|
||||
" required=\"required\"",
|
||||
The_GetSuffix ());
|
||||
HTM_TD_End ();
|
||||
/***** Institution short name and full name *****/
|
||||
for (ShrtOrFullName = Cns_SHRT_NAME;
|
||||
ShrtOrFullName <= Cns_FULL_NAME;
|
||||
ShrtOrFullName++)
|
||||
{
|
||||
HTM_TD_Begin ("class=\"LM\"");
|
||||
HTM_INPUT_TEXT (Cns_ParShrtOrFullName[ShrtOrFullName],
|
||||
Cns_MaxCharsShrtOrFullName[ShrtOrFullName],
|
||||
Name[ShrtOrFullName],
|
||||
HTM_DONT_SUBMIT_ON_CHANGE,
|
||||
"class=\"%s INPUT_%s\""
|
||||
" required=\"required\"",
|
||||
Cns_ClassShrtOrFullName[ShrtOrFullName],
|
||||
The_GetSuffix ());
|
||||
HTM_TD_End ();
|
||||
}
|
||||
|
||||
/***** Institution WWW *****/
|
||||
HTM_TD_Begin ("class=\"LM\"");
|
||||
|
@ -1508,17 +1520,33 @@ void Ins_ReceiveFormNewIns (void)
|
|||
|
||||
static void Ins_ReceiveFormRequestOrCreateIns (Hie_Status_t Status)
|
||||
{
|
||||
extern const char *Cns_ParShrtOrFullName[Cns_NUM_SHRT_FULL_NAMES];
|
||||
extern const char *Cns_FldShrtOrFullName[Cns_NUM_SHRT_FULL_NAMES];
|
||||
extern unsigned Cns_MaxBytesShrtOrFullName[Cns_NUM_SHRT_FULL_NAMES];
|
||||
extern const char *Txt_The_institution_X_already_exists;
|
||||
extern const char *Txt_Created_new_institution_X;
|
||||
Cns_ShrtOrFullName_t ShrtOrFullName;
|
||||
bool Exists;
|
||||
char *Name[Cns_NUM_SHRT_FULL_NAMES] =
|
||||
{
|
||||
[Cns_SHRT_NAME] = Ins_EditingIns->ShrtName,
|
||||
[Cns_FULL_NAME] = Ins_EditingIns->FullName,
|
||||
};
|
||||
|
||||
/***** Get parameters from form *****/
|
||||
/* Set institution country */
|
||||
Ins_EditingIns->PrtCod = Gbl.Hierarchy.Node[Hie_CTY].HieCod;
|
||||
|
||||
/* Get institution short name, full name and WWW */
|
||||
Par_GetParText ("ShortName",Ins_EditingIns->ShrtName,Cns_MAX_BYTES_SHRT_NAME);
|
||||
Par_GetParText ("FullName" ,Ins_EditingIns->FullName,Cns_MAX_BYTES_FULL_NAME);
|
||||
Par_GetParText ("WWW" ,Ins_EditingIns->WWW ,Cns_MAX_BYTES_WWW);
|
||||
for (ShrtOrFullName = Cns_SHRT_NAME;
|
||||
ShrtOrFullName <= Cns_FULL_NAME;
|
||||
ShrtOrFullName++)
|
||||
Par_GetParText (Cns_ParShrtOrFullName[ShrtOrFullName],
|
||||
Name[ShrtOrFullName],
|
||||
Cns_MaxBytesShrtOrFullName[ShrtOrFullName]);
|
||||
|
||||
/* Get institution URL */
|
||||
Par_GetParText ("WWW",Ins_EditingIns->WWW,Cns_MAX_BYTES_WWW);
|
||||
|
||||
if (Ins_EditingIns->ShrtName[0] &&
|
||||
Ins_EditingIns->FullName[0]) // If there's a institution name
|
||||
|
@ -1526,17 +1554,19 @@ static void Ins_ReceiveFormRequestOrCreateIns (Hie_Status_t Status)
|
|||
if (Ins_EditingIns->WWW[0])
|
||||
{
|
||||
/***** If name of institution was in database... *****/
|
||||
if (Ins_DB_CheckIfInsNameExistsInCty ("ShortName",Ins_EditingIns->ShrtName,
|
||||
-1L,Gbl.Hierarchy.Node[Hie_CTY].HieCod))
|
||||
Ale_CreateAlert (Ale_WARNING,NULL,
|
||||
Txt_The_institution_X_already_exists,
|
||||
Ins_EditingIns->ShrtName);
|
||||
else if (Ins_DB_CheckIfInsNameExistsInCty ("FullName",Ins_EditingIns->FullName,
|
||||
-1L,Gbl.Hierarchy.Node[Hie_CTY].HieCod))
|
||||
Ale_CreateAlert (Ale_WARNING,NULL,
|
||||
Txt_The_institution_X_already_exists,
|
||||
Ins_EditingIns->FullName);
|
||||
else // Add new institution to database
|
||||
for (ShrtOrFullName = Cns_SHRT_NAME, Exists = false;
|
||||
ShrtOrFullName <= Cns_FULL_NAME && !Exists;
|
||||
ShrtOrFullName++)
|
||||
if (Ins_DB_CheckIfInsNameExistsInCty (Cns_FldShrtOrFullName[ShrtOrFullName],
|
||||
Name[ShrtOrFullName],
|
||||
-1L,Gbl.Hierarchy.Node[Hie_CTY].HieCod))
|
||||
{
|
||||
Ale_CreateAlert (Ale_WARNING,NULL,
|
||||
Txt_The_institution_X_already_exists,
|
||||
Name[ShrtOrFullName]);
|
||||
Exists = true;
|
||||
}
|
||||
if (!Exists) // Add new institution to database
|
||||
{
|
||||
Ins_EditingIns->HieCod = Ins_DB_CreateInstitution (Ins_EditingIns,Status);
|
||||
Ale_CreateAlert (Ale_SUCCESS,NULL,
|
||||
|
@ -1548,7 +1578,7 @@ static void Ins_ReceiveFormRequestOrCreateIns (Hie_Status_t Status)
|
|||
Ale_CreateAlertYouMustSpecifyTheWebAddress ();
|
||||
}
|
||||
else // If there is not a institution name
|
||||
Ale_CreateAlertYouMustSpecifyTheShortNameAndTheFullName ();
|
||||
Ale_CreateAlertYouMustSpecifyShrtNameAndFullName ();
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -368,9 +368,7 @@ static void InsCfg_Country (bool PrintView,bool PutForm)
|
|||
|
||||
static void InsCfg_FullName (bool PutForm)
|
||||
{
|
||||
extern const char *Txt_Institution;
|
||||
|
||||
HieCfg_FullName (PutForm,ActRenInsFulCfg,Hie_INS,Txt_Institution);
|
||||
HieCfg_Name (PutForm,Hie_INS,Cns_FULL_NAME);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -379,7 +377,7 @@ static void InsCfg_FullName (bool PutForm)
|
|||
|
||||
static void InsCfg_ShrtName (bool PutForm)
|
||||
{
|
||||
HieCfg_ShrtName (PutForm,ActRenInsShoCfg,Hie_INS);
|
||||
HieCfg_Name (PutForm,Hie_INS,Cns_SHRT_NAME);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -535,9 +533,17 @@ void InsCfg_RemoveLogo (void)
|
|||
|
||||
void InsCfg_ChangeInsCty (void)
|
||||
{
|
||||
extern const char *Cns_FldShrtOrFullName[Cns_NUM_SHRT_FULL_NAMES];
|
||||
extern const char *Txt_The_institution_X_already_exists;
|
||||
extern const char *Txt_The_country_of_the_institution_X_has_changed_to_Y;
|
||||
struct Hie_Node NewCty;
|
||||
Cns_ShrtOrFullName_t ShrtOrFullName;
|
||||
bool Exists;
|
||||
char *Name[Cns_NUM_SHRT_FULL_NAMES] =
|
||||
{
|
||||
[Cns_SHRT_NAME] = Gbl.Hierarchy.Node[Hie_INS].ShrtName,
|
||||
[Cns_FULL_NAME] = Gbl.Hierarchy.Node[Hie_INS].FullName,
|
||||
};
|
||||
|
||||
/***** Get the new country code for the institution *****/
|
||||
NewCty.HieCod = ParCod_GetAndCheckPar (ParCod_OthCty);
|
||||
|
@ -549,17 +555,19 @@ void InsCfg_ChangeInsCty (void)
|
|||
Cty_GetBasicCountryDataByCod (&NewCty);
|
||||
|
||||
/***** Check if it already exists an institution with the same name in the new country *****/
|
||||
if (Ins_DB_CheckIfInsNameExistsInCty ("ShortName",Gbl.Hierarchy.Node[Hie_INS].ShrtName,
|
||||
-1L,NewCty.HieCod))
|
||||
Ale_CreateAlert (Ale_WARNING,NULL,
|
||||
Txt_The_institution_X_already_exists,
|
||||
Gbl.Hierarchy.Node[Hie_INS].ShrtName);
|
||||
else if (Ins_DB_CheckIfInsNameExistsInCty ("FullName",Gbl.Hierarchy.Node[Hie_INS].FullName,
|
||||
-1L,NewCty.HieCod))
|
||||
Ale_CreateAlert (Ale_WARNING,NULL,
|
||||
Txt_The_institution_X_already_exists,
|
||||
Gbl.Hierarchy.Node[Hie_INS].FullName);
|
||||
else
|
||||
for (ShrtOrFullName = Cns_SHRT_NAME, Exists = false;
|
||||
ShrtOrFullName <= Cns_FULL_NAME && !Exists;
|
||||
ShrtOrFullName++)
|
||||
if (Ins_DB_CheckIfInsNameExistsInCty (Cns_FldShrtOrFullName[ShrtOrFullName],
|
||||
Name[ShrtOrFullName],
|
||||
-1L,NewCty.HieCod))
|
||||
{
|
||||
Ale_CreateAlert (Ale_WARNING,NULL,
|
||||
Txt_The_institution_X_already_exists,
|
||||
Name[ShrtOrFullName]);
|
||||
Exists = true;
|
||||
}
|
||||
if (!Exists)
|
||||
{
|
||||
/***** Update the table changing the country of the institution *****/
|
||||
Ins_DB_UpdateInsCty (Gbl.Hierarchy.Node[Hie_INS].HieCod,NewCty.HieCod);
|
||||
|
|
163
swad_link.c
163
swad_link.c
|
@ -397,8 +397,18 @@ static void Lnk_FreeListLinks (struct Lnk_Links *Links)
|
|||
|
||||
static void Lnk_ListLinksForEdition (const struct Lnk_Links *Links)
|
||||
{
|
||||
extern const char *Cns_ParShrtOrFullName[Cns_NUM_SHRT_FULL_NAMES];
|
||||
extern unsigned Cns_MaxCharsShrtOrFullName[Cns_NUM_SHRT_FULL_NAMES];
|
||||
extern const char *Cns_ClassShrtOrFullName[Cns_NUM_SHRT_FULL_NAMES];
|
||||
static Act_Action_t ActionRename[Cns_NUM_SHRT_FULL_NAMES] =
|
||||
{
|
||||
[Cns_SHRT_NAME] = ActRenLnkSho,
|
||||
[Cns_FULL_NAME] = ActRenLnkFul,
|
||||
};
|
||||
unsigned NumLnk;
|
||||
struct Lnk_Link *Lnk;
|
||||
Cns_ShrtOrFullName_t ShrtOrFullName;
|
||||
char *Name[Cns_NUM_SHRT_FULL_NAMES];
|
||||
|
||||
/***** Begin table *****/
|
||||
HTM_TABLE_BeginWidePadding (2);
|
||||
|
@ -426,29 +436,27 @@ static void Lnk_ListLinksForEdition (const struct Lnk_Links *Links)
|
|||
HTM_Long (Lnk->LnkCod);
|
||||
HTM_TD_End ();
|
||||
|
||||
/* Link short name */
|
||||
HTM_TD_Begin ("class=\"CM\"");
|
||||
Frm_BeginForm (ActRenLnkSho);
|
||||
ParCod_PutPar (ParCod_Lnk,Lnk->LnkCod);
|
||||
HTM_INPUT_TEXT ("ShortName",Cns_MAX_CHARS_SHRT_NAME,Lnk->ShrtName,
|
||||
HTM_SUBMIT_ON_CHANGE,
|
||||
"class=\"INPUT_SHORT_NAME INPUT_%s\""
|
||||
" required=\"required\"",
|
||||
The_GetSuffix ());
|
||||
Frm_EndForm ();
|
||||
HTM_TD_End ();
|
||||
|
||||
/* Link full name */
|
||||
HTM_TD_Begin ("class=\"CM\"");
|
||||
Frm_BeginForm (ActRenLnkFul);
|
||||
ParCod_PutPar (ParCod_Lnk,Lnk->LnkCod);
|
||||
HTM_INPUT_TEXT ("FullName",Cns_MAX_CHARS_FULL_NAME,Lnk->FullName,
|
||||
HTM_SUBMIT_ON_CHANGE,
|
||||
"class=\"INPUT_FULL_NAME INPUT_%s\""
|
||||
" required=\"required\"",
|
||||
The_GetSuffix ());
|
||||
Frm_EndForm ();
|
||||
HTM_TD_End ();
|
||||
/* Link short name and full name */
|
||||
Name[Cns_SHRT_NAME] = Lnk->ShrtName;
|
||||
Name[Cns_FULL_NAME] = Lnk->FullName;
|
||||
for (ShrtOrFullName = Cns_SHRT_NAME;
|
||||
ShrtOrFullName <= Cns_FULL_NAME;
|
||||
ShrtOrFullName++)
|
||||
{
|
||||
HTM_TD_Begin ("class=\"CM\"");
|
||||
Frm_BeginForm (ActionRename[ShrtOrFullName]);
|
||||
ParCod_PutPar (ParCod_Lnk,Lnk->LnkCod);
|
||||
HTM_INPUT_TEXT (Cns_ParShrtOrFullName[ShrtOrFullName],
|
||||
Cns_MaxCharsShrtOrFullName[ShrtOrFullName],
|
||||
Name[ShrtOrFullName],
|
||||
HTM_SUBMIT_ON_CHANGE,
|
||||
"class=\"%s INPUT_%s\""
|
||||
" required=\"required\"",
|
||||
Cns_ClassShrtOrFullName[ShrtOrFullName],
|
||||
The_GetSuffix ());
|
||||
Frm_EndForm ();
|
||||
HTM_TD_End ();
|
||||
}
|
||||
|
||||
/* Link WWW */
|
||||
HTM_TD_Begin ("class=\"CM\"");
|
||||
|
@ -660,6 +668,16 @@ void Lnk_ContEditAfterChgLnk (void)
|
|||
|
||||
static void Lnk_PutFormToCreateLink (void)
|
||||
{
|
||||
extern const char *Cns_ParShrtOrFullName[Cns_NUM_SHRT_FULL_NAMES];
|
||||
extern unsigned Cns_MaxCharsShrtOrFullName[Cns_NUM_SHRT_FULL_NAMES];
|
||||
extern const char *Cns_ClassShrtOrFullName[Cns_NUM_SHRT_FULL_NAMES];
|
||||
Cns_ShrtOrFullName_t ShrtOrFullName;
|
||||
char *Name[Cns_NUM_SHRT_FULL_NAMES] =
|
||||
{
|
||||
[Cns_SHRT_NAME] = Lnk_EditingLnk->ShrtName,
|
||||
[Cns_FULL_NAME] = Lnk_EditingLnk->FullName,
|
||||
};
|
||||
|
||||
/***** Begin form to create *****/
|
||||
Frm_BeginFormTable (ActNewLnk,NULL,NULL,NULL);
|
||||
|
||||
|
@ -676,23 +694,22 @@ static void Lnk_PutFormToCreateLink (void)
|
|||
HTM_TD_Begin ("class=\"CODE\"");
|
||||
HTM_TD_End ();
|
||||
|
||||
/***** Link short name *****/
|
||||
HTM_TD_Begin ("class=\"CM\"");
|
||||
HTM_INPUT_TEXT ("ShortName",Cns_MAX_CHARS_SHRT_NAME,Lnk_EditingLnk->ShrtName,
|
||||
HTM_DONT_SUBMIT_ON_CHANGE,
|
||||
"class=\"INPUT_SHORT_NAME INPUT_%s\""
|
||||
" required=\"required\"",
|
||||
The_GetSuffix ());
|
||||
HTM_TD_End ();
|
||||
|
||||
/***** Link full name *****/
|
||||
HTM_TD_Begin ("class=\"CM\"");
|
||||
HTM_INPUT_TEXT ("FullName",Cns_MAX_CHARS_FULL_NAME,Lnk_EditingLnk->FullName,
|
||||
HTM_DONT_SUBMIT_ON_CHANGE,
|
||||
"class=\"INPUT_FULL_NAME INPUT_%s\""
|
||||
" required=\"required\"",
|
||||
The_GetSuffix ());
|
||||
HTM_TD_End ();
|
||||
/***** Link short name and full name *****/
|
||||
for (ShrtOrFullName = Cns_SHRT_NAME;
|
||||
ShrtOrFullName <= Cns_FULL_NAME;
|
||||
ShrtOrFullName++)
|
||||
{
|
||||
HTM_TD_Begin ("class=\"CM\"");
|
||||
HTM_INPUT_TEXT (Cns_ParShrtOrFullName[ShrtOrFullName],
|
||||
Cns_MaxCharsShrtOrFullName[ShrtOrFullName],
|
||||
Name[ShrtOrFullName],
|
||||
HTM_DONT_SUBMIT_ON_CHANGE,
|
||||
"class=\"%s INPUT_%s\""
|
||||
" required=\"required\"",
|
||||
Cns_ClassShrtOrFullName[ShrtOrFullName],
|
||||
The_GetSuffix ());
|
||||
HTM_TD_End ();
|
||||
}
|
||||
|
||||
/***** Link WWW *****/
|
||||
HTM_TD_Begin ("class=\"CM\"");
|
||||
|
@ -734,19 +751,31 @@ static void Lnk_PutHeadLinks (void)
|
|||
|
||||
void Lnk_ReceiveFormNewLink (void)
|
||||
{
|
||||
extern const char *Cns_ParShrtOrFullName[Cns_NUM_SHRT_FULL_NAMES];
|
||||
extern const char *Cns_FldShrtOrFullName[Cns_NUM_SHRT_FULL_NAMES];
|
||||
extern unsigned Cns_MaxBytesShrtOrFullName[Cns_NUM_SHRT_FULL_NAMES];
|
||||
extern const char *Txt_The_link_X_already_exists;
|
||||
extern const char *Txt_You_must_specify_the_web_address;
|
||||
extern const char *Txt_Created_new_link_X;
|
||||
Cns_ShrtOrFullName_t ShrtOrFullName;
|
||||
bool Exists;
|
||||
char *Name[Cns_NUM_SHRT_FULL_NAMES] =
|
||||
{
|
||||
[Cns_SHRT_NAME] = Lnk_EditingLnk->ShrtName,
|
||||
[Cns_FULL_NAME] = Lnk_EditingLnk->FullName,
|
||||
};
|
||||
|
||||
/***** Link constructor *****/
|
||||
Lnk_EditingLinkConstructor ();
|
||||
|
||||
/***** Get parameters from form *****/
|
||||
/* Get link short name */
|
||||
Par_GetParText ("ShortName",Lnk_EditingLnk->ShrtName,Cns_MAX_BYTES_SHRT_NAME);
|
||||
|
||||
/* Get link full name */
|
||||
Par_GetParText ("FullName",Lnk_EditingLnk->FullName,Cns_MAX_BYTES_FULL_NAME);
|
||||
/* Get link short name and full name */
|
||||
for (ShrtOrFullName = Cns_SHRT_NAME;
|
||||
ShrtOrFullName <= Cns_FULL_NAME;
|
||||
ShrtOrFullName++)
|
||||
Par_GetParText (Cns_ParShrtOrFullName[ShrtOrFullName],
|
||||
Name[ShrtOrFullName],
|
||||
Cns_MaxBytesShrtOrFullName[ShrtOrFullName]);
|
||||
|
||||
/* Get link URL */
|
||||
Par_GetParText ("WWW",Lnk_EditingLnk->WWW,Cns_MAX_BYTES_WWW);
|
||||
|
@ -755,27 +784,33 @@ void Lnk_ReceiveFormNewLink (void)
|
|||
Lnk_EditingLnk->FullName[0]) // If there's a link name
|
||||
{
|
||||
/***** If name of link was in database... *****/
|
||||
if (Lnk_DB_CheckIfLinkNameExists ("ShortName",Lnk_EditingLnk->ShrtName,-1L))
|
||||
Ale_CreateAlert (Ale_WARNING,NULL,
|
||||
Txt_The_link_X_already_exists,
|
||||
Lnk_EditingLnk->ShrtName);
|
||||
else if (Lnk_DB_CheckIfLinkNameExists ("FullName",Lnk_EditingLnk->FullName,-1L))
|
||||
Ale_CreateAlert (Ale_WARNING,NULL,
|
||||
Txt_The_link_X_already_exists,
|
||||
Lnk_EditingLnk->FullName);
|
||||
else if (!Lnk_EditingLnk->WWW[0])
|
||||
Ale_CreateAlert (Ale_WARNING,NULL,
|
||||
Txt_You_must_specify_the_web_address);
|
||||
else // Add new link to database
|
||||
{
|
||||
Lnk_DB_CreateLink (Lnk_EditingLnk);
|
||||
Ale_CreateAlert (Ale_SUCCESS,NULL,
|
||||
Txt_Created_new_link_X,
|
||||
Lnk_EditingLnk->ShrtName);
|
||||
}
|
||||
for (ShrtOrFullName = Cns_SHRT_NAME, Exists = false;
|
||||
ShrtOrFullName <= Cns_FULL_NAME && !Exists;
|
||||
ShrtOrFullName++)
|
||||
if (Lnk_DB_CheckIfLinkNameExists (Cns_FldShrtOrFullName[ShrtOrFullName],
|
||||
Name[ShrtOrFullName],-1L))
|
||||
{
|
||||
Ale_CreateAlert (Ale_WARNING,NULL,
|
||||
Txt_The_link_X_already_exists,
|
||||
Name[ShrtOrFullName]);
|
||||
Exists = true;
|
||||
}
|
||||
if (!Exists)
|
||||
{
|
||||
if (!Lnk_EditingLnk->WWW[0])
|
||||
Ale_CreateAlert (Ale_WARNING,NULL,
|
||||
Txt_You_must_specify_the_web_address);
|
||||
else // Add new link to database
|
||||
{
|
||||
Lnk_DB_CreateLink (Lnk_EditingLnk);
|
||||
Ale_CreateAlert (Ale_SUCCESS,NULL,
|
||||
Txt_Created_new_link_X,
|
||||
Lnk_EditingLnk->ShrtName);
|
||||
}
|
||||
}
|
||||
}
|
||||
else // If there is not a link name
|
||||
Ale_CreateAlertYouMustSpecifyTheShortNameAndTheFullName ();
|
||||
Ale_CreateAlertYouMustSpecifyShrtNameAndFullName ();
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -782,7 +782,7 @@ void Mai_ReceiveFormNewMailDomain (void)
|
|||
}
|
||||
}
|
||||
else // If there is not a mail name
|
||||
Ale_CreateAlertYouMustSpecifyTheShortNameAndTheFullName ();
|
||||
Ale_CreateAlertYouMustSpecifyShrtNameAndFullName ();
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
139
swad_place.c
139
swad_place.c
|
@ -445,8 +445,18 @@ void Plc_FreeListPlaces (struct Plc_Places *Places)
|
|||
|
||||
static void Plc_ListPlacesForEdition (const struct Plc_Places *Places)
|
||||
{
|
||||
extern const char *Cns_ParShrtOrFullName[Cns_NUM_SHRT_FULL_NAMES];
|
||||
extern unsigned Cns_MaxCharsShrtOrFullName[Cns_NUM_SHRT_FULL_NAMES];
|
||||
extern const char *Cns_ClassShrtOrFullName[Cns_NUM_SHRT_FULL_NAMES];
|
||||
static Act_Action_t ActionRename[Cns_NUM_SHRT_FULL_NAMES] =
|
||||
{
|
||||
[Cns_SHRT_NAME] = ActRenPlcSho,
|
||||
[Cns_FULL_NAME] = ActRenPlcFul,
|
||||
};
|
||||
unsigned NumPlc;
|
||||
struct Plc_Place *Plc;
|
||||
Cns_ShrtOrFullName_t ShrtOrFullName;
|
||||
char *Name[Cns_NUM_SHRT_FULL_NAMES];
|
||||
|
||||
/***** Begin table *****/
|
||||
HTM_TABLE_BeginWidePadding (2);
|
||||
|
@ -477,27 +487,26 @@ static void Plc_ListPlacesForEdition (const struct Plc_Places *Places)
|
|||
HTM_Long (Plc->PlcCod);
|
||||
HTM_TD_End ();
|
||||
|
||||
/* Place short name */
|
||||
HTM_TD_Begin ("class=\"CM\"");
|
||||
Frm_BeginForm (ActRenPlcSho);
|
||||
ParCod_PutPar (ParCod_Plc,Plc->PlcCod);
|
||||
HTM_INPUT_TEXT ("ShortName",Cns_MAX_CHARS_SHRT_NAME,Plc->ShrtName,
|
||||
HTM_SUBMIT_ON_CHANGE,
|
||||
"class=\"INPUT_SHORT_NAME INPUT_%s\"",
|
||||
The_GetSuffix ());
|
||||
Frm_EndForm ();
|
||||
HTM_TD_End ();
|
||||
|
||||
/* Place full name */
|
||||
HTM_TD_Begin ("class=\"CM\"");
|
||||
Frm_BeginForm (ActRenPlcFul);
|
||||
ParCod_PutPar (ParCod_Plc,Plc->PlcCod);
|
||||
HTM_INPUT_TEXT ("FullName",Cns_MAX_CHARS_FULL_NAME,Plc->FullName,
|
||||
HTM_SUBMIT_ON_CHANGE,
|
||||
"class=\"INPUT_FULL_NAME INPUT_%s\"",
|
||||
The_GetSuffix ());
|
||||
Frm_EndForm ();
|
||||
HTM_TD_End ();
|
||||
/* Place short name and full name */
|
||||
Name[Cns_SHRT_NAME] = Plc->ShrtName;
|
||||
Name[Cns_FULL_NAME] = Plc->FullName;
|
||||
for (ShrtOrFullName = Cns_SHRT_NAME;
|
||||
ShrtOrFullName <= Cns_FULL_NAME;
|
||||
ShrtOrFullName++)
|
||||
{
|
||||
HTM_TD_Begin ("class=\"CM\"");
|
||||
Frm_BeginForm (ActionRename[ShrtOrFullName]);
|
||||
ParCod_PutPar (ParCod_Plc,Plc->PlcCod);
|
||||
HTM_INPUT_TEXT (Cns_ParShrtOrFullName[ShrtOrFullName],
|
||||
Cns_MaxCharsShrtOrFullName[ShrtOrFullName],
|
||||
Name[ShrtOrFullName],
|
||||
HTM_SUBMIT_ON_CHANGE,
|
||||
"class=\"%s INPUT_%s\"",
|
||||
Cns_ClassShrtOrFullName[ShrtOrFullName],
|
||||
The_GetSuffix ());
|
||||
Frm_EndForm ();
|
||||
HTM_TD_End ();
|
||||
}
|
||||
|
||||
/* Number of centers */
|
||||
HTM_TD_Begin ("class=\"RM DAT_%s\"",The_GetSuffix ());
|
||||
|
@ -672,6 +681,16 @@ void Plc_ContEditAfterChgPlc (void)
|
|||
|
||||
static void Plc_PutFormToCreatePlace (void)
|
||||
{
|
||||
extern const char *Cns_ParShrtOrFullName[Cns_NUM_SHRT_FULL_NAMES];
|
||||
extern unsigned Cns_MaxCharsShrtOrFullName[Cns_NUM_SHRT_FULL_NAMES];
|
||||
extern const char *Cns_ClassShrtOrFullName[Cns_NUM_SHRT_FULL_NAMES];
|
||||
Cns_ShrtOrFullName_t ShrtOrFullName;
|
||||
char *Name[Cns_NUM_SHRT_FULL_NAMES] =
|
||||
{
|
||||
[Cns_SHRT_NAME] = Plc_EditingPlc->ShrtName,
|
||||
[Cns_FULL_NAME] = Plc_EditingPlc->FullName,
|
||||
};
|
||||
|
||||
/***** Begin form to create *****/
|
||||
Frm_BeginFormTable (ActNewPlc,NULL,NULL,NULL);
|
||||
|
||||
|
@ -688,23 +707,22 @@ static void Plc_PutFormToCreatePlace (void)
|
|||
HTM_TD_Begin ("class=\"CODE\"");
|
||||
HTM_TD_End ();
|
||||
|
||||
/***** Place short name *****/
|
||||
HTM_TD_Begin ("class=\"CM\"");
|
||||
HTM_INPUT_TEXT ("ShortName",Cns_MAX_CHARS_SHRT_NAME,Plc_EditingPlc->ShrtName,
|
||||
HTM_DONT_SUBMIT_ON_CHANGE,
|
||||
"class=\"INPUT_SHORT_NAME INPUT_%s\""
|
||||
" required=\"required\"",
|
||||
The_GetSuffix ());
|
||||
HTM_TD_End ();
|
||||
|
||||
/***** Place full name *****/
|
||||
HTM_TD_Begin ("class=\"CM\"");
|
||||
HTM_INPUT_TEXT ("FullName",Cns_MAX_CHARS_FULL_NAME,Plc_EditingPlc->FullName,
|
||||
HTM_DONT_SUBMIT_ON_CHANGE,
|
||||
"class=\"INPUT_FULL_NAME INPUT_%s\""
|
||||
" required=\"required\"",
|
||||
The_GetSuffix ());
|
||||
HTM_TD_End ();
|
||||
/***** Place short name and full name *****/
|
||||
for (ShrtOrFullName = Cns_SHRT_NAME;
|
||||
ShrtOrFullName <= Cns_FULL_NAME;
|
||||
ShrtOrFullName++)
|
||||
{
|
||||
HTM_TD_Begin ("class=\"CM\"");
|
||||
HTM_INPUT_TEXT (Cns_ParShrtOrFullName[ShrtOrFullName],
|
||||
Cns_MaxCharsShrtOrFullName[ShrtOrFullName],
|
||||
Name[ShrtOrFullName],
|
||||
HTM_DONT_SUBMIT_ON_CHANGE,
|
||||
"class=\"%s INPUT_%s\""
|
||||
" required=\"required\"",
|
||||
Cns_ClassShrtOrFullName[ShrtOrFullName],
|
||||
The_GetSuffix ());
|
||||
HTM_TD_End ();
|
||||
}
|
||||
|
||||
/***** Number of centers *****/
|
||||
HTM_TD_Begin ("class=\"RM DAT_%s\"",The_GetSuffix ());
|
||||
|
@ -743,32 +761,47 @@ static void Plc_PutHeadPlaces (void)
|
|||
|
||||
void Plc_ReceiveFormNewPlace (void)
|
||||
{
|
||||
extern const char *Cns_ParShrtOrFullName[Cns_NUM_SHRT_FULL_NAMES];
|
||||
extern const char *Cns_FldShrtOrFullName[Cns_NUM_SHRT_FULL_NAMES];
|
||||
extern unsigned Cns_MaxBytesShrtOrFullName[Cns_NUM_SHRT_FULL_NAMES];
|
||||
extern const char *Txt_The_place_X_already_exists;
|
||||
extern const char *Txt_Created_new_place_X;
|
||||
Cns_ShrtOrFullName_t ShrtOrFullName;
|
||||
bool Exists;
|
||||
char *Name[Cns_NUM_SHRT_FULL_NAMES] =
|
||||
{
|
||||
[Cns_SHRT_NAME] = Plc_EditingPlc->ShrtName,
|
||||
[Cns_FULL_NAME] = Plc_EditingPlc->FullName,
|
||||
};
|
||||
|
||||
/***** Place constructor *****/
|
||||
Plc_EditingPlaceConstructor ();
|
||||
|
||||
/***** Get parameters from form *****/
|
||||
/* Get place short name */
|
||||
Par_GetParText ("ShortName",Plc_EditingPlc->ShrtName,Cns_MAX_BYTES_SHRT_NAME);
|
||||
|
||||
/* Get place full name */
|
||||
Par_GetParText ("FullName",Plc_EditingPlc->FullName,Cns_MAX_BYTES_FULL_NAME);
|
||||
/* Get place short name and full name */
|
||||
for (ShrtOrFullName = Cns_SHRT_NAME;
|
||||
ShrtOrFullName <= Cns_FULL_NAME;
|
||||
ShrtOrFullName++)
|
||||
Par_GetParText (Cns_ParShrtOrFullName[ShrtOrFullName],
|
||||
Name[ShrtOrFullName],
|
||||
Cns_MaxBytesShrtOrFullName[ShrtOrFullName]);
|
||||
|
||||
if (Plc_EditingPlc->ShrtName[0] &&
|
||||
Plc_EditingPlc->FullName[0]) // If there's a place name
|
||||
{
|
||||
/***** If name of place was in database... *****/
|
||||
if (Plc_DB_CheckIfPlaceNameExists (-1L,"ShortName",Plc_EditingPlc->ShrtName))
|
||||
Ale_CreateAlert (Ale_WARNING,NULL,
|
||||
Txt_The_place_X_already_exists,
|
||||
Plc_EditingPlc->ShrtName);
|
||||
else if (Plc_DB_CheckIfPlaceNameExists (-1L,"FullName",Plc_EditingPlc->FullName))
|
||||
Ale_CreateAlert (Ale_WARNING,NULL,
|
||||
Txt_The_place_X_already_exists,
|
||||
Plc_EditingPlc->FullName);
|
||||
else // Add new place to database
|
||||
for (ShrtOrFullName = Cns_SHRT_NAME, Exists = false;
|
||||
ShrtOrFullName <= Cns_FULL_NAME && !Exists;
|
||||
ShrtOrFullName++)
|
||||
if (Plc_DB_CheckIfPlaceNameExists (-1L,Cns_FldShrtOrFullName[ShrtOrFullName],
|
||||
Name[ShrtOrFullName]))
|
||||
{
|
||||
Ale_CreateAlert (Ale_WARNING,NULL,
|
||||
Txt_The_place_X_already_exists,
|
||||
Name[ShrtOrFullName]);
|
||||
Exists = true;
|
||||
}
|
||||
if (!Exists) // Add new place to database
|
||||
{
|
||||
Plc_DB_CreatePlace (Plc_EditingPlc);
|
||||
Ale_CreateAlert (Ale_SUCCESS,NULL,Txt_Created_new_place_X,
|
||||
|
@ -776,7 +809,7 @@ void Plc_ReceiveFormNewPlace (void)
|
|||
}
|
||||
}
|
||||
else // If there is not a place name
|
||||
Ale_CreateAlertYouMustSpecifyTheShortNameAndTheFullName ();
|
||||
Ale_CreateAlertYouMustSpecifyShrtNameAndFullName ();
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
139
swad_room.c
139
swad_room.c
|
@ -628,10 +628,20 @@ void Roo_FreeListRooms (struct Roo_Rooms *Rooms)
|
|||
static void Roo_ListRoomsForEdition (const struct Bld_Buildings *Buildings,
|
||||
const struct Roo_Rooms *Rooms)
|
||||
{
|
||||
extern const char *Cns_ParShrtOrFullName[Cns_NUM_SHRT_FULL_NAMES];
|
||||
extern unsigned Cns_MaxCharsShrtOrFullName[Cns_NUM_SHRT_FULL_NAMES];
|
||||
extern const char *Cns_ClassShrtOrFullName[Cns_NUM_SHRT_FULL_NAMES];
|
||||
static Act_Action_t ActionRename[Cns_NUM_SHRT_FULL_NAMES] =
|
||||
{
|
||||
[Cns_SHRT_NAME] = ActRenRooSho,
|
||||
[Cns_FULL_NAME] = ActRenRooFul,
|
||||
};
|
||||
unsigned NumRoom;
|
||||
struct Roo_Room *Room;
|
||||
char *Anchor = NULL;
|
||||
char StrCapacity[Cns_MAX_DECIMAL_DIGITS_UINT + 1];
|
||||
Cns_ShrtOrFullName_t ShrtOrFullName;
|
||||
char *Name[Cns_NUM_SHRT_FULL_NAMES];
|
||||
|
||||
HTM_TABLE_BeginWidePadding (2);
|
||||
|
||||
|
@ -692,29 +702,27 @@ static void Roo_ListRoomsForEdition (const struct Bld_Buildings *Buildings,
|
|||
Frm_EndForm ();
|
||||
HTM_TD_End ();
|
||||
|
||||
/* Room short name */
|
||||
HTM_TD_Begin ("class=\"LT\"");
|
||||
Frm_BeginFormAnchor (ActRenRooSho,Anchor);
|
||||
ParCod_PutPar (ParCod_Roo,Room->RooCod);
|
||||
HTM_INPUT_TEXT ("ShortName",Cns_MAX_CHARS_SHRT_NAME,Room->ShrtName,
|
||||
HTM_SUBMIT_ON_CHANGE,
|
||||
"size=\"10\""
|
||||
" class=\"INPUT_SHORT_NAME INPUT_%s\"",
|
||||
The_GetSuffix ());
|
||||
Frm_EndForm ();
|
||||
HTM_TD_End ();
|
||||
|
||||
/* Room full name */
|
||||
HTM_TD_Begin ("class=\"LT\"");
|
||||
Frm_BeginFormAnchor (ActRenRooFul,Anchor);
|
||||
ParCod_PutPar (ParCod_Roo,Room->RooCod);
|
||||
HTM_INPUT_TEXT ("FullName",Cns_MAX_CHARS_FULL_NAME,Room->FullName,
|
||||
HTM_SUBMIT_ON_CHANGE,
|
||||
"size=\"20\""
|
||||
" class=\"INPUT_FULL_NAME INPUT_%s\"",
|
||||
The_GetSuffix ());
|
||||
Frm_EndForm ();
|
||||
HTM_TD_End ();
|
||||
/* Room short name and full name */
|
||||
Name[Cns_SHRT_NAME] = Room->ShrtName;
|
||||
Name[Cns_FULL_NAME] = Room->FullName;
|
||||
for (ShrtOrFullName = Cns_SHRT_NAME;
|
||||
ShrtOrFullName <= Cns_FULL_NAME;
|
||||
ShrtOrFullName++)
|
||||
{
|
||||
HTM_TD_Begin ("class=\"LT\"");
|
||||
Frm_BeginFormAnchor (ActionRename[ShrtOrFullName],Anchor);
|
||||
ParCod_PutPar (ParCod_Roo,Room->RooCod);
|
||||
HTM_INPUT_TEXT (Cns_ParShrtOrFullName[ShrtOrFullName],
|
||||
Cns_MaxCharsShrtOrFullName[ShrtOrFullName],
|
||||
Name[ShrtOrFullName],
|
||||
HTM_SUBMIT_ON_CHANGE,
|
||||
"size=\"10\""
|
||||
" class=\"%s INPUT_%s\"",
|
||||
Cns_ClassShrtOrFullName[ShrtOrFullName],
|
||||
The_GetSuffix ());
|
||||
Frm_EndForm ();
|
||||
HTM_TD_End ();
|
||||
}
|
||||
|
||||
/* Seating capacity */
|
||||
HTM_TD_Begin ("class=\"LT\"");
|
||||
|
@ -1207,8 +1215,17 @@ void Roo_ContEditAfterChgRoom (void)
|
|||
|
||||
static void Roo_PutFormToCreateRoom (const struct Bld_Buildings *Buildings)
|
||||
{
|
||||
extern const char *Cns_ParShrtOrFullName[Cns_NUM_SHRT_FULL_NAMES];
|
||||
extern unsigned Cns_MaxCharsShrtOrFullName[Cns_NUM_SHRT_FULL_NAMES];
|
||||
extern const char *Cns_ClassShrtOrFullName[Cns_NUM_SHRT_FULL_NAMES];
|
||||
char StrCapacity[Cns_MAX_DECIMAL_DIGITS_UINT + 1];
|
||||
char MACstr[MAC_LENGTH_MAC_ADDRESS + 1]; // MAC address in xx:xx:xx:xx:xx:xx format
|
||||
Cns_ShrtOrFullName_t ShrtOrFullName;
|
||||
char *Name[Cns_NUM_SHRT_FULL_NAMES] =
|
||||
{
|
||||
[Cns_SHRT_NAME] = Roo_EditingRoom->ShrtName,
|
||||
[Cns_FULL_NAME] = Roo_EditingRoom->FullName,
|
||||
};
|
||||
|
||||
/***** Begin form to create *****/
|
||||
Frm_BeginFormTable (ActNewRoo,NULL,NULL,NULL);
|
||||
|
@ -1246,23 +1263,22 @@ static void Roo_PutFormToCreateRoom (const struct Bld_Buildings *Buildings)
|
|||
HTM_DONT_SUBMIT_ON_CHANGE);
|
||||
HTM_TD_End ();
|
||||
|
||||
/***** Room short name *****/
|
||||
HTM_TD_Begin ("class=\"LM\"");
|
||||
HTM_INPUT_TEXT ("ShortName",Cns_MAX_CHARS_SHRT_NAME,Roo_EditingRoom->ShrtName,
|
||||
HTM_DONT_SUBMIT_ON_CHANGE,
|
||||
"size=\"10\" class=\"INPUT_SHORT_NAME INPUT_%s\""
|
||||
" required=\"required\"",
|
||||
The_GetSuffix ());
|
||||
HTM_TD_End ();
|
||||
|
||||
/***** Room full name *****/
|
||||
HTM_TD_Begin ("class=\"LM\"");
|
||||
HTM_INPUT_TEXT ("FullName",Cns_MAX_CHARS_FULL_NAME,Roo_EditingRoom->FullName,
|
||||
HTM_DONT_SUBMIT_ON_CHANGE,
|
||||
"size=\"20\" class=\"INPUT_FULL_NAME INPUT_%s\""
|
||||
" required=\"required\"",
|
||||
The_GetSuffix ());
|
||||
HTM_TD_End ();
|
||||
/***** Room short name and full name *****/
|
||||
for (ShrtOrFullName = Cns_SHRT_NAME;
|
||||
ShrtOrFullName <= Cns_FULL_NAME;
|
||||
ShrtOrFullName++)
|
||||
{
|
||||
HTM_TD_Begin ("class=\"LM\"");
|
||||
HTM_INPUT_TEXT (Cns_ParShrtOrFullName[ShrtOrFullName],
|
||||
Cns_MaxCharsShrtOrFullName[ShrtOrFullName],
|
||||
Name[ShrtOrFullName],
|
||||
HTM_DONT_SUBMIT_ON_CHANGE,
|
||||
"size=\"10\" class=\"%s INPUT_%s\""
|
||||
" required=\"required\"",
|
||||
Cns_ClassShrtOrFullName[ShrtOrFullName],
|
||||
The_GetSuffix ());
|
||||
HTM_TD_End ();
|
||||
}
|
||||
|
||||
/***** Seating capacity *****/
|
||||
HTM_TD_Begin ("class=\"LM\"");
|
||||
|
@ -1322,8 +1338,18 @@ static void Roo_PutHeadRooms (void)
|
|||
|
||||
void Roo_ReceiveFormNewRoom (void)
|
||||
{
|
||||
extern const char *Cns_ParShrtOrFullName[Cns_NUM_SHRT_FULL_NAMES];
|
||||
extern const char *Cns_FldShrtOrFullName[Cns_NUM_SHRT_FULL_NAMES];
|
||||
extern unsigned Cns_MaxBytesShrtOrFullName[Cns_NUM_SHRT_FULL_NAMES];
|
||||
extern const char *Txt_The_room_X_already_exists;
|
||||
extern const char *Txt_Created_new_room_X;
|
||||
Cns_ShrtOrFullName_t ShrtOrFullName;
|
||||
bool Exists;
|
||||
char *Name[Cns_NUM_SHRT_FULL_NAMES] =
|
||||
{
|
||||
[Cns_SHRT_NAME] = Roo_EditingRoom->ShrtName,
|
||||
[Cns_FULL_NAME] = Roo_EditingRoom->FullName,
|
||||
};
|
||||
|
||||
/***** Room constructor *****/
|
||||
Roo_EditingRoomConstructor ();
|
||||
|
@ -1335,8 +1361,12 @@ void Roo_ReceiveFormNewRoom (void)
|
|||
Roo_EditingRoom->Type = Roo_GetParType ();
|
||||
|
||||
/* Get room short name and full name */
|
||||
Par_GetParText ("ShortName",Roo_EditingRoom->ShrtName,Cns_MAX_BYTES_SHRT_NAME);
|
||||
Par_GetParText ("FullName" ,Roo_EditingRoom->FullName,Cns_MAX_BYTES_FULL_NAME);
|
||||
for (ShrtOrFullName = Cns_SHRT_NAME;
|
||||
ShrtOrFullName <= Cns_FULL_NAME;
|
||||
ShrtOrFullName++)
|
||||
Par_GetParText (Cns_ParShrtOrFullName[ShrtOrFullName],
|
||||
Name[ShrtOrFullName],
|
||||
Cns_MaxBytesShrtOrFullName[ShrtOrFullName]);
|
||||
|
||||
/* Get seating capacity */
|
||||
Roo_EditingRoom->Capacity = (unsigned)
|
||||
|
@ -1352,17 +1382,18 @@ void Roo_ReceiveFormNewRoom (void)
|
|||
Roo_EditingRoom->FullName[0]) // If there's a room name
|
||||
{
|
||||
/***** If name of room was in database... *****/
|
||||
if (Roo_DB_CheckIfRoomNameExists (Gbl.Hierarchy.Node[Hie_CTR].HieCod,-1L,
|
||||
"ShortName",Roo_EditingRoom->ShrtName))
|
||||
Ale_CreateAlert (Ale_WARNING,NULL,
|
||||
Txt_The_room_X_already_exists,
|
||||
Roo_EditingRoom->ShrtName);
|
||||
else if (Roo_DB_CheckIfRoomNameExists (Gbl.Hierarchy.Node[Hie_CTR].HieCod,-1L,
|
||||
"FullName",Roo_EditingRoom->FullName))
|
||||
Ale_CreateAlert (Ale_WARNING,NULL,
|
||||
Txt_The_room_X_already_exists,
|
||||
Roo_EditingRoom->FullName);
|
||||
else // Add new room to database
|
||||
for (ShrtOrFullName = Cns_SHRT_NAME, Exists = false;
|
||||
ShrtOrFullName <= Cns_FULL_NAME && !Exists;
|
||||
ShrtOrFullName++)
|
||||
if (Roo_DB_CheckIfRoomNameExists (Gbl.Hierarchy.Node[Hie_CTR].HieCod,-1L,
|
||||
Cns_FldShrtOrFullName[ShrtOrFullName],
|
||||
Name[ShrtOrFullName]))
|
||||
{
|
||||
Ale_CreateAlert (Ale_WARNING,NULL,
|
||||
Txt_The_room_X_already_exists,Name[ShrtOrFullName]);
|
||||
Exists = true;
|
||||
}
|
||||
if (!Exists) // Add new room to database
|
||||
{
|
||||
Roo_CreateRoom (Roo_EditingRoom);
|
||||
Ale_CreateAlert (Ale_SUCCESS,NULL,
|
||||
|
@ -1371,7 +1402,7 @@ void Roo_ReceiveFormNewRoom (void)
|
|||
}
|
||||
}
|
||||
else // If there is not a room name
|
||||
Ale_CreateAlertYouMustSpecifyTheShortNameAndTheFullName ();
|
||||
Ale_CreateAlertYouMustSpecifyShrtNameAndFullName ();
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
18
swad_scope.c
18
swad_scope.c
|
@ -46,24 +46,10 @@ extern struct Globals Gbl;
|
|||
|
||||
void Sco_PutSelectorScope (const char *ParName,HTM_SubmitOnChange_t SubmitOnChange)
|
||||
{
|
||||
extern const char *Txt_System;
|
||||
extern const char *Txt_Country;
|
||||
extern const char *Txt_Institution;
|
||||
extern const char *Txt_Center;
|
||||
extern const char *Txt_Degree;
|
||||
extern const char *Txt_Course;
|
||||
extern const char **Hie_TxtLevel[Hie_NUM_LEVELS];
|
||||
Hie_Level_t Level;
|
||||
unsigned ScopeUnsigned;
|
||||
bool WriteScope;
|
||||
static const char **TxtScope[Hie_NUM_LEVELS] =
|
||||
{
|
||||
[Hie_SYS] = &Txt_System,
|
||||
[Hie_CTY] = &Txt_Country,
|
||||
[Hie_INS] = &Txt_Institution,
|
||||
[Hie_CTR] = &Txt_Center,
|
||||
[Hie_DEG] = &Txt_Degree,
|
||||
[Hie_CRS] = &Txt_Course,
|
||||
};
|
||||
|
||||
HTM_SELECT_Begin (SubmitOnChange,NULL,
|
||||
"id=\"%s\" name=\"%s\" class=\"INPUT_%s\"",
|
||||
|
@ -102,7 +88,7 @@ void Sco_PutSelectorScope (const char *ParName,HTM_SubmitOnChange_t SubmitOnChan
|
|||
HTM_OPTION_UNSELECTED,
|
||||
HTM_OPTION_ENABLED,
|
||||
"%s: %s",
|
||||
*TxtScope[Level],
|
||||
*Hie_TxtLevel[Level],
|
||||
Gbl.Hierarchy.Node[Level].ShrtName);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -391,18 +391,13 @@ void Svy_SeeOneSurvey (void)
|
|||
static void Svy_ShowOneSurvey (struct Svy_Surveys *Surveys,
|
||||
bool ShowOnlyThisSvyComplete)
|
||||
{
|
||||
extern const char **Hie_TxtLevel[Hie_NUM_LEVELS];
|
||||
extern const char *Hlp_ANALYTICS_Surveys;
|
||||
extern const char *Txt_Survey;
|
||||
extern const char *Txt_View_survey;
|
||||
extern const char *Txt_Number_of_questions;
|
||||
extern const char *Txt_Number_of_users;
|
||||
extern const char *Txt_Scope;
|
||||
extern const char *Txt_System;
|
||||
extern const char *Txt_Country;
|
||||
extern const char *Txt_Institution;
|
||||
extern const char *Txt_Center;
|
||||
extern const char *Txt_Degree;
|
||||
extern const char *Txt_Course;
|
||||
extern const char *Txt_Users;
|
||||
extern const char *Txt_Answer_survey;
|
||||
extern const char *Txt_View_results;
|
||||
|
@ -411,15 +406,6 @@ static void Svy_ShowOneSurvey (struct Svy_Surveys *Surveys,
|
|||
extern const char *HidVis_TitleClass[HidVis_NUM_HIDDEN_VISIBLE];
|
||||
extern const char *HidVis_GroupClass[HidVis_NUM_HIDDEN_VISIBLE];
|
||||
extern const char *HidVis_DataClass[HidVis_NUM_HIDDEN_VISIBLE];
|
||||
static const char **TxtScope[Hie_NUM_LEVELS] =
|
||||
{
|
||||
[Hie_SYS] = &Txt_System,
|
||||
[Hie_CTY] = &Txt_Country,
|
||||
[Hie_INS] = &Txt_Institution,
|
||||
[Hie_CTR] = &Txt_Center,
|
||||
[Hie_DEG] = &Txt_Degree,
|
||||
[Hie_CRS] = &Txt_Course,
|
||||
};
|
||||
char *Anchor = NULL;
|
||||
static unsigned UniqueId = 0;
|
||||
char *Id;
|
||||
|
@ -608,7 +594,7 @@ static void Svy_ShowOneSurvey (struct Svy_Surveys *Surveys,
|
|||
HidVis_GroupClass[Surveys->Svy.Status.HiddenOrVisible],
|
||||
The_GetSuffix ());
|
||||
HTM_TxtColonNBSP (Txt_Scope);
|
||||
HTM_TxtF ("%s %s",*TxtScope[Surveys->Svy.Level],
|
||||
HTM_TxtF ("%s %s",*Hie_TxtLevel[Surveys->Svy.Level],
|
||||
Gbl.Hierarchy.Node[Surveys->Svy.Level].ShrtName);
|
||||
HTM_DIV_End ();
|
||||
|
||||
|
|
Loading…
Reference in New Issue