mirror of https://github.com/acanas/swad-core.git
Version 23.34: Oct 10, 2023 New module swad_name for short and full names.
This commit is contained in:
parent
7d8fa0bebb
commit
522962c8a7
2
Makefile
2
Makefile
|
@ -70,7 +70,7 @@ OBJS = swad_account.o swad_account_database.o swad_action.o swad_action_list.o \
|
|||
swad_match.o swad_match_database.o swad_match_print.o \
|
||||
swad_match_result.o swad_media.o swad_media_database.o swad_menu.o \
|
||||
swad_message.o swad_message_database.o swad_MFU.o swad_MFU_database.o \
|
||||
swad_network.o swad_network_database.o swad_nickname.o \
|
||||
swad_name.o swad_network.o swad_network_database.o swad_nickname.o \
|
||||
swad_nickname_database.o swad_notice.o swad_notice_database.o \
|
||||
swad_notification.o swad_notification_database.o \
|
||||
swad_pagination.o swad_parameter.o swad_parameter_code.o \
|
||||
|
|
|
@ -883,7 +883,8 @@ void Ban_ReceiveFormNewBanner (void)
|
|||
{
|
||||
/***** If name of banner was not in database... *****/
|
||||
if (!Nam_CheckIfNameExists (Ban_DB_CheckIfBannerNameExists,Names,-1L,
|
||||
-1L,0)) // Unused
|
||||
-1L, // Unused
|
||||
0)) // Unused
|
||||
{
|
||||
if (!Ban->Img[0])
|
||||
Ale_CreateAlert (Ale_WARNING,NULL,
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
|
||||
#include "swad_constant.h"
|
||||
#include "swad_hidden_visible.h"
|
||||
#include "swad_name.h"
|
||||
#include "swad_string.h"
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -743,7 +743,8 @@ void Bld_ReceiveFormNewBuilding (void)
|
|||
{
|
||||
/***** If name of building was not in database... *****/
|
||||
if (!Nam_CheckIfNameExists (Bld_DB_CheckIfBuildingNameExists,Names,-1L,
|
||||
-1L,0)) // Unused
|
||||
-1L, // Unused
|
||||
0)) // Unused
|
||||
{
|
||||
Bld_DB_CreateBuilding (Bld_EditingBuilding);
|
||||
Ale_CreateAlert (Ale_SUCCESS,NULL,Txt_Created_new_building_X,
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
/*****************************************************************************/
|
||||
|
||||
#include "swad_constant.h"
|
||||
#include "swad_name.h"
|
||||
#include "swad_string.h"
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
#include "swad_degree.h"
|
||||
#include "swad_figure_cache.h"
|
||||
#include "swad_map.h"
|
||||
#include "swad_name.h"
|
||||
#include "swad_role_type.h"
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -633,12 +633,12 @@ Me sale este error, no s
|
|||
"can npt create received message (duplicated entry '243218-2160773' for key 'UsrCod_MsgCod')
|
||||
*/
|
||||
|
||||
#define Log_PLATFORM_VERSION "SWAD 23.33.2 (2023-10-10)"
|
||||
#define Log_PLATFORM_VERSION "SWAD 23.34 (2023-10-10)"
|
||||
#define CSS_FILE "swad23.25.2.css"
|
||||
#define JS_FILE "swad22.49.js"
|
||||
/*
|
||||
// TODO: Donde aparezca Txt_X_already_exists cambiar por la función nueva Nam_...
|
||||
|
||||
Version 23.34: Oct 10, 2023 New module swad_name for short and full names. (335608 lines)
|
||||
Version 23.33.3: Oct 10, 2023 Code refactoring in short and full names. (335515 lines)
|
||||
Version 23.33.2: Oct 10, 2023 Code refactoring in short and full names. Not finished. (335661 lines)
|
||||
Version 23.33.1: Oct 10, 2023 Code refactoring in short and full names. Not finished. (335930 lines)
|
||||
Version 23.33: Oct 10, 2023 Code refactoring in short and full names. (335919 lines)
|
||||
|
|
|
@ -25,38 +25,10 @@
|
|||
/*********************************** Headers *********************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
#include "swad_constant.h"
|
||||
|
||||
/*****************************************************************************/
|
||||
/***************************** Public constants ******************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
const char *Nam_ParShrtOrFullName[Nam_NUM_SHRT_FULL_NAMES] =
|
||||
{
|
||||
[Nam_SHRT_NAME] = "ShortName",
|
||||
[Nam_FULL_NAME] = "FullName",
|
||||
};
|
||||
const char *Nam_FldShrtOrFullName[Nam_NUM_SHRT_FULL_NAMES] =
|
||||
{
|
||||
[Nam_SHRT_NAME] = "ShortName",
|
||||
[Nam_FULL_NAME] = "FullName",
|
||||
};
|
||||
unsigned Nam_MaxCharsShrtOrFullName[Nam_NUM_SHRT_FULL_NAMES] =
|
||||
{
|
||||
[Nam_SHRT_NAME] = Nam_MAX_CHARS_SHRT_NAME,
|
||||
[Nam_FULL_NAME] = Nam_MAX_CHARS_FULL_NAME,
|
||||
};
|
||||
unsigned Nam_MaxBytesShrtOrFullName[Nam_NUM_SHRT_FULL_NAMES] =
|
||||
{
|
||||
[Nam_SHRT_NAME] = Nam_MAX_BYTES_SHRT_NAME,
|
||||
[Nam_FULL_NAME] = Nam_MAX_BYTES_FULL_NAME,
|
||||
};
|
||||
const char *Nam_ClassShrtOrFullName[Nam_NUM_SHRT_FULL_NAMES] =
|
||||
{
|
||||
[Nam_SHRT_NAME] = "INPUT_SHORT_NAME",
|
||||
[Nam_FULL_NAME] = "INPUT_FULL_NAME",
|
||||
};
|
||||
|
||||
/*****************************************************************************/
|
||||
/**************************** Private constants ******************************/
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -33,12 +33,6 @@
|
|||
/***************************** Public constants ******************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
#define Nam_MAX_CHARS_SHRT_NAME (32 - 1) // 31
|
||||
#define Nam_MAX_BYTES_SHRT_NAME ((Nam_MAX_CHARS_SHRT_NAME + 1) * Str_MAX_BYTES_PER_CHAR - 1) // 511
|
||||
|
||||
#define Nam_MAX_CHARS_FULL_NAME (128 - 1) // 127
|
||||
#define Nam_MAX_BYTES_FULL_NAME ((Nam_MAX_CHARS_FULL_NAME + 1) * Str_MAX_BYTES_PER_CHAR - 1) // 2047
|
||||
|
||||
#define Cns_MAX_CHARS_WWW (256 - 1) // 255: max. number of chars of a URL
|
||||
#define Cns_MAX_BYTES_WWW Cns_MAX_CHARS_WWW // 255
|
||||
|
||||
|
@ -111,14 +105,6 @@ typedef enum
|
|||
Cns_VERBOSE,
|
||||
} Cns_QuietOrVerbose_t;
|
||||
|
||||
// Related with names of centers, degrees, courses,...
|
||||
#define Nam_NUM_SHRT_FULL_NAMES 2
|
||||
typedef enum
|
||||
{
|
||||
Nam_SHRT_NAME,
|
||||
Nam_FULL_NAME,
|
||||
} Nam_ShrtOrFullName_t;
|
||||
|
||||
#define Cns_NUM_DISABLED_ENABLED 2
|
||||
typedef enum
|
||||
{
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
#include "swad_degree.h"
|
||||
#include "swad_figure_cache.h"
|
||||
#include "swad_hierarchy_type.h"
|
||||
#include "swad_name.h"
|
||||
#include "swad_user.h"
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -537,7 +537,8 @@ void CrsCfg_ChangeCrsYear (void)
|
|||
{
|
||||
/***** If name of course was not in database in the new year... *****/
|
||||
if (!Nam_CheckIfNameExists (Crs_DB_CheckIfCrsNameExistsInYearOfDeg,Names,
|
||||
-1L,Gbl.Hierarchy.Node[Hie_CRS].PrtCod,NewYear))
|
||||
-1L,Gbl.Hierarchy.Node[Hie_CRS].PrtCod,
|
||||
NewYear))
|
||||
{
|
||||
/***** Update year in table of courses *****/
|
||||
Crs_UpdateCrsYear (&Gbl.Hierarchy.Node[Hie_CRS],NewYear);
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
#include "swad_constant.h"
|
||||
#include "swad_figure_cache.h"
|
||||
#include "swad_hierarchy_type.h"
|
||||
#include "swad_name.h"
|
||||
#include "swad_role_type.h"
|
||||
#include "swad_string.h"
|
||||
|
||||
|
|
90
swad_form.c
90
swad_form.c
|
@ -353,93 +353,3 @@ void Frm_LabelColumn (const char *TDClass,const char *Id,const char *Label)
|
|||
/***** Column/cell end *****/
|
||||
HTM_TD_End ();
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/************************ Write short and full names *************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Nam_NewShortAndFullNames (const char *Names[Nam_NUM_SHRT_FULL_NAMES])
|
||||
{
|
||||
extern const char *Nam_ParShrtOrFullName[Nam_NUM_SHRT_FULL_NAMES];
|
||||
extern unsigned Nam_MaxCharsShrtOrFullName[Nam_NUM_SHRT_FULL_NAMES];
|
||||
extern const char *Nam_ClassShrtOrFullName[Nam_NUM_SHRT_FULL_NAMES];
|
||||
Nam_ShrtOrFullName_t ShrtOrFullName;
|
||||
|
||||
for (ShrtOrFullName = Nam_SHRT_NAME;
|
||||
ShrtOrFullName <= Nam_FULL_NAME;
|
||||
ShrtOrFullName++)
|
||||
{
|
||||
HTM_TD_Begin ("class=\"CM\"");
|
||||
HTM_INPUT_TEXT (Nam_ParShrtOrFullName[ShrtOrFullName],
|
||||
Nam_MaxCharsShrtOrFullName[ShrtOrFullName],
|
||||
Names[ShrtOrFullName],
|
||||
HTM_DONT_SUBMIT_ON_CHANGE,
|
||||
"class=\"%s INPUT_%s\""
|
||||
" required=\"required\"",
|
||||
Nam_ClassShrtOrFullName[ShrtOrFullName],
|
||||
The_GetSuffix ());
|
||||
HTM_TD_End ();
|
||||
}
|
||||
}
|
||||
|
||||
void Nam_ExistingShortAndFullNames (Act_Action_t ActionRename[Nam_NUM_SHRT_FULL_NAMES],
|
||||
ParCod_Param_t ParCod,long Cod,
|
||||
const char *Names[Nam_NUM_SHRT_FULL_NAMES],
|
||||
bool PutForm)
|
||||
{
|
||||
extern const char *Nam_ParShrtOrFullName[Nam_NUM_SHRT_FULL_NAMES];
|
||||
extern unsigned Nam_MaxCharsShrtOrFullName[Nam_NUM_SHRT_FULL_NAMES];
|
||||
extern const char *Nam_ClassShrtOrFullName[Nam_NUM_SHRT_FULL_NAMES];
|
||||
Nam_ShrtOrFullName_t ShrtOrFullName;
|
||||
|
||||
for (ShrtOrFullName = Nam_SHRT_NAME;
|
||||
ShrtOrFullName <= Nam_FULL_NAME;
|
||||
ShrtOrFullName++)
|
||||
{
|
||||
HTM_TD_Begin ("class=\"LM DAT_%s\"",The_GetSuffix ());
|
||||
if (PutForm)
|
||||
{
|
||||
Frm_BeginForm (ActionRename[ShrtOrFullName]);
|
||||
ParCod_PutPar (ParCod,Cod);
|
||||
HTM_INPUT_TEXT (Nam_ParShrtOrFullName[ShrtOrFullName],
|
||||
Nam_MaxCharsShrtOrFullName[ShrtOrFullName],
|
||||
Names[ShrtOrFullName],
|
||||
HTM_SUBMIT_ON_CHANGE,
|
||||
"class=\"%s INPUT_%s\""
|
||||
" required=\"required\"",
|
||||
Nam_ClassShrtOrFullName[ShrtOrFullName],
|
||||
The_GetSuffix ());
|
||||
Frm_EndForm ();
|
||||
}
|
||||
else
|
||||
HTM_Txt (Names[ShrtOrFullName]);
|
||||
HTM_TD_End ();
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/****************** Check if a short or full name exists *********************/
|
||||
/*****************************************************************************/
|
||||
|
||||
bool Nam_CheckIfNameExists (bool (*FuncToCheck) (const char *FldName,const char *Name,
|
||||
long Cod,long PrtCod,unsigned Year),
|
||||
char *Names[Nam_NUM_SHRT_FULL_NAMES],
|
||||
long Cod,long PrtCod,unsigned Year)
|
||||
{
|
||||
extern const char *Nam_FldShrtOrFullName[Nam_NUM_SHRT_FULL_NAMES];
|
||||
extern const char *Txt_X_already_exists;
|
||||
Nam_ShrtOrFullName_t ShrtOrFullName;
|
||||
|
||||
for (ShrtOrFullName = Nam_SHRT_NAME;
|
||||
ShrtOrFullName <= Nam_FULL_NAME;
|
||||
ShrtOrFullName++)
|
||||
if (FuncToCheck (Nam_FldShrtOrFullName[ShrtOrFullName],
|
||||
Names[ShrtOrFullName],Cod,PrtCod,Year))
|
||||
{
|
||||
Ale_CreateAlert (Ale_WARNING,NULL,Txt_X_already_exists,
|
||||
Names[ShrtOrFullName]);
|
||||
return true; // Exists
|
||||
}
|
||||
|
||||
return false; // Does not exist
|
||||
}
|
||||
|
|
11
swad_form.h
11
swad_form.h
|
@ -79,15 +79,4 @@ void Frm_FreeAnchorStr (char **Anchor);
|
|||
|
||||
void Frm_LabelColumn (const char *TDClass,const char *Id,const char *Label);
|
||||
|
||||
void Nam_NewShortAndFullNames (const char *Names[Nam_NUM_SHRT_FULL_NAMES]);
|
||||
void Nam_ExistingShortAndFullNames (Act_Action_t ActionRename[Nam_NUM_SHRT_FULL_NAMES],
|
||||
ParCod_Param_t ParCod,long Cod,
|
||||
const char *Names[Nam_NUM_SHRT_FULL_NAMES],
|
||||
bool PutForm);
|
||||
|
||||
bool Nam_CheckIfNameExists (bool (*FuncToCheck) (const char *FldName,const char *Name,
|
||||
long Cod,long PrtCod,unsigned Year),
|
||||
char *Names[Nam_NUM_SHRT_FULL_NAMES],
|
||||
long Cod,long PrtCod,unsigned Year);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
/*****************************************************************************/
|
||||
|
||||
#include "swad_constant.h"
|
||||
#include "swad_name.h"
|
||||
#include "swad_role_type.h"
|
||||
#include "swad_string.h"
|
||||
|
||||
|
|
|
@ -1145,7 +1145,7 @@ void Ins_RenameInstitution (struct Hie_Node *Ins,Nam_ShrtOrFullName_t ShrtOrFull
|
|||
extern const char *Nam_ParShrtOrFullName[Nam_NUM_SHRT_FULL_NAMES];
|
||||
extern const char *Nam_FldShrtOrFullName[Nam_NUM_SHRT_FULL_NAMES];
|
||||
extern unsigned Nam_MaxBytesShrtOrFullName[Nam_NUM_SHRT_FULL_NAMES];
|
||||
extern const char *Txt_The_institution_X_already_exists;
|
||||
extern const char *Txt_X_already_exists;
|
||||
extern const char *Txt_The_institution_X_has_been_renamed_as_Y;
|
||||
extern const char *Txt_The_name_X_has_not_changed;
|
||||
char *CurrentName[Nam_NUM_SHRT_FULL_NAMES] =
|
||||
|
@ -1168,13 +1168,12 @@ void Ins_RenameInstitution (struct Hie_Node *Ins,Nam_ShrtOrFullName_t ShrtOrFull
|
|||
(this happens when return is pressed without changes) *****/
|
||||
if (strcmp (CurrentName[ShrtOrFullName],NewName)) // Different names
|
||||
{
|
||||
/***** If institution was in database... *****/
|
||||
/***** If institution was not in database... *****/
|
||||
if (Ins_DB_CheckIfInsNameExistsInCty (Nam_ParShrtOrFullName[ShrtOrFullName],
|
||||
NewName,Ins->HieCod,
|
||||
Gbl.Hierarchy.Node[Hie_CTY].HieCod))
|
||||
Ale_CreateAlert (Ale_WARNING,NULL,
|
||||
Txt_The_institution_X_already_exists,
|
||||
NewName);
|
||||
Gbl.Hierarchy.Node[Hie_CTY].HieCod,
|
||||
0)) // Unused
|
||||
Ale_CreateAlert (Ale_WARNING,NULL,Txt_X_already_exists,NewName);
|
||||
else
|
||||
{
|
||||
/* Update the table changing old name by new name */
|
||||
|
@ -1479,13 +1478,7 @@ void Ins_ReceiveFormNewIns (void)
|
|||
|
||||
static void Ins_ReceiveFormRequestOrCreateIns (Hie_Status_t Status)
|
||||
{
|
||||
extern const char *Nam_ParShrtOrFullName[Nam_NUM_SHRT_FULL_NAMES];
|
||||
extern const char *Nam_FldShrtOrFullName[Nam_NUM_SHRT_FULL_NAMES];
|
||||
extern unsigned Nam_MaxBytesShrtOrFullName[Nam_NUM_SHRT_FULL_NAMES];
|
||||
extern const char *Txt_The_institution_X_already_exists;
|
||||
extern const char *Txt_Created_new_institution_X;
|
||||
Nam_ShrtOrFullName_t ShrtOrFullName;
|
||||
bool Exists;
|
||||
char *Names[Nam_NUM_SHRT_FULL_NAMES] =
|
||||
{
|
||||
[Nam_SHRT_NAME] = Ins_EditingIns->ShrtName,
|
||||
|
@ -1507,20 +1500,10 @@ static void Ins_ReceiveFormRequestOrCreateIns (Hie_Status_t Status)
|
|||
{
|
||||
if (Ins_EditingIns->WWW[0])
|
||||
{
|
||||
/***** If name of institution was in database... *****/
|
||||
for (ShrtOrFullName = Nam_SHRT_NAME, Exists = false;
|
||||
ShrtOrFullName <= Nam_FULL_NAME && !Exists;
|
||||
ShrtOrFullName++)
|
||||
if (Ins_DB_CheckIfInsNameExistsInCty (Nam_FldShrtOrFullName[ShrtOrFullName],
|
||||
Names[ShrtOrFullName],
|
||||
-1L,Gbl.Hierarchy.Node[Hie_CTY].HieCod))
|
||||
{
|
||||
Ale_CreateAlert (Ale_WARNING,NULL,
|
||||
Txt_The_institution_X_already_exists,
|
||||
Names[ShrtOrFullName]);
|
||||
Exists = true;
|
||||
}
|
||||
if (!Exists) // Add new institution to database
|
||||
/***** If name of institution was not in database... *****/
|
||||
if (!Nam_CheckIfNameExists (Ins_DB_CheckIfInsNameExistsInCty,Names,
|
||||
-1L,Gbl.Hierarchy.Node[Hie_CTY].HieCod,
|
||||
0)) // Unused
|
||||
{
|
||||
Ins_EditingIns->HieCod = Ins_DB_CreateInstitution (Ins_EditingIns,Status);
|
||||
Ale_CreateAlert (Ale_SUCCESS,NULL,Txt_Created_new_institution_X,
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#include "swad_center.h"
|
||||
#include "swad_constant.h"
|
||||
#include "swad_figure_cache.h"
|
||||
#include "swad_name.h"
|
||||
#include "swad_role_type.h"
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -533,12 +533,8 @@ void InsCfg_RemoveLogo (void)
|
|||
|
||||
void InsCfg_ChangeInsCty (void)
|
||||
{
|
||||
extern const char *Nam_FldShrtOrFullName[Nam_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;
|
||||
Nam_ShrtOrFullName_t ShrtOrFullName;
|
||||
bool Exists;
|
||||
char *Names[Nam_NUM_SHRT_FULL_NAMES] =
|
||||
{
|
||||
[Nam_SHRT_NAME] = Gbl.Hierarchy.Node[Hie_INS].ShrtName,
|
||||
|
@ -555,19 +551,9 @@ void InsCfg_ChangeInsCty (void)
|
|||
Cty_GetBasicCountryDataByCod (&NewCty);
|
||||
|
||||
/***** Check if it already exists an institution with the same name in the new country *****/
|
||||
for (ShrtOrFullName = Nam_SHRT_NAME, Exists = false;
|
||||
ShrtOrFullName <= Nam_FULL_NAME && !Exists;
|
||||
ShrtOrFullName++)
|
||||
if (Ins_DB_CheckIfInsNameExistsInCty (Nam_FldShrtOrFullName[ShrtOrFullName],
|
||||
Names[ShrtOrFullName],
|
||||
-1L,NewCty.HieCod))
|
||||
{
|
||||
Ale_CreateAlert (Ale_WARNING,NULL,
|
||||
Txt_The_institution_X_already_exists,
|
||||
Names[ShrtOrFullName]);
|
||||
Exists = true;
|
||||
}
|
||||
if (!Exists)
|
||||
if (!Nam_CheckIfNameExists (Ins_DB_CheckIfInsNameExistsInCty,Names,
|
||||
-1L,NewCty.HieCod,
|
||||
0)) // Unused
|
||||
{
|
||||
/***** Update the table changing the country of the institution *****/
|
||||
Ins_DB_UpdateInsCty (Gbl.Hierarchy.Node[Hie_INS].HieCod,NewCty.HieCod);
|
||||
|
|
|
@ -193,8 +193,9 @@ unsigned Ins_DB_GetInsShrtNameAndCty (MYSQL_RES **mysql_res,long InsCod)
|
|||
|
||||
bool Ins_DB_CheckIfInsNameExistsInCty (const char *FldName,
|
||||
const char *Name,
|
||||
long InsCod,
|
||||
long CtyCod)
|
||||
long Cod,
|
||||
long PrtCod,
|
||||
__attribute__((unused)) unsigned Year)
|
||||
{
|
||||
return
|
||||
DB_QueryEXISTS ("can not check if the name of an institution already existed",
|
||||
|
@ -204,9 +205,9 @@ bool Ins_DB_CheckIfInsNameExistsInCty (const char *FldName,
|
|||
" WHERE CtyCod=%ld"
|
||||
" AND %s='%s'"
|
||||
" AND InsCod<>%ld)",
|
||||
CtyCod,
|
||||
PrtCod,
|
||||
FldName,Name,
|
||||
InsCod);
|
||||
Cod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -48,8 +48,9 @@ void Ins_DB_GetInsShrtName (long InsCod,char ShrtName[Nam_MAX_BYTES_SHRT_NAME +
|
|||
unsigned Ins_DB_GetInsShrtNameAndCty (MYSQL_RES **mysql_res,long InsCod);
|
||||
bool Ins_DB_CheckIfInsNameExistsInCty (const char *FldName,
|
||||
const char *Name,
|
||||
long InsCod,
|
||||
long CtyCod);
|
||||
long Cod,
|
||||
long PrtCod,
|
||||
__attribute__((unused)) unsigned Year);
|
||||
|
||||
unsigned Ins_DB_GetAllInsWithPendingCtr (MYSQL_RES **mysql_res);
|
||||
unsigned Ins_DB_GetInsWithPendingCtrsAdminByMe (MYSQL_RES **mysql_res);
|
||||
|
|
32
swad_link.c
32
swad_link.c
|
@ -529,7 +529,7 @@ static void Lnk_RenameLink (Nam_ShrtOrFullName_t ShrtOrFullName)
|
|||
extern const char *Nam_ParShrtOrFullName[Nam_NUM_SHRT_FULL_NAMES];
|
||||
extern const char *Nam_FldShrtOrFullName[Nam_NUM_SHRT_FULL_NAMES];
|
||||
extern unsigned Nam_MaxBytesShrtOrFullName[Nam_NUM_SHRT_FULL_NAMES];
|
||||
extern const char *Txt_The_link_X_already_exists;
|
||||
extern const char *Txt_X_already_exists;
|
||||
extern const char *Txt_The_link_X_has_been_renamed_as_Y;
|
||||
extern const char *Txt_The_name_X_has_not_changed;
|
||||
char *CurrentName[Nam_NUM_SHRT_FULL_NAMES] =
|
||||
|
@ -558,10 +558,10 @@ static void Lnk_RenameLink (Nam_ShrtOrFullName_t ShrtOrFullName)
|
|||
{
|
||||
/***** If link was in database... *****/
|
||||
if (Lnk_DB_CheckIfLinkNameExists (Nam_ParShrtOrFullName[ShrtOrFullName],
|
||||
NewName,Lnk_EditingLnk->LnkCod))
|
||||
Ale_CreateAlert (Ale_WARNING,NULL,
|
||||
Txt_The_link_X_already_exists,
|
||||
NewName);
|
||||
NewName,Lnk_EditingLnk->LnkCod,
|
||||
-1L, // Unused
|
||||
0)) // Unused
|
||||
Ale_CreateAlert (Ale_WARNING,NULL,Txt_X_already_exists,NewName);
|
||||
else
|
||||
{
|
||||
/* Update the table changing old name by new name */
|
||||
|
@ -714,14 +714,8 @@ static void Lnk_PutHeadLinks (void)
|
|||
|
||||
void Lnk_ReceiveFormNewLink (void)
|
||||
{
|
||||
extern const char *Nam_ParShrtOrFullName[Nam_NUM_SHRT_FULL_NAMES];
|
||||
extern const char *Nam_FldShrtOrFullName[Nam_NUM_SHRT_FULL_NAMES];
|
||||
extern unsigned Nam_MaxBytesShrtOrFullName[Nam_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;
|
||||
Nam_ShrtOrFullName_t ShrtOrFullName;
|
||||
bool Exists;
|
||||
char *Names[Nam_NUM_SHRT_FULL_NAMES] =
|
||||
{
|
||||
[Nam_SHRT_NAME] = Lnk_EditingLnk->ShrtName,
|
||||
|
@ -742,18 +736,10 @@ void Lnk_ReceiveFormNewLink (void)
|
|||
Lnk_EditingLnk->FullName[0]) // If there's a link name
|
||||
{
|
||||
/***** If name of link was in database... *****/
|
||||
for (ShrtOrFullName = Nam_SHRT_NAME, Exists = false;
|
||||
ShrtOrFullName <= Nam_FULL_NAME && !Exists;
|
||||
ShrtOrFullName++)
|
||||
if (Lnk_DB_CheckIfLinkNameExists (Nam_FldShrtOrFullName[ShrtOrFullName],
|
||||
Names[ShrtOrFullName],-1L))
|
||||
{
|
||||
Ale_CreateAlert (Ale_WARNING,NULL,
|
||||
Txt_The_link_X_already_exists,
|
||||
Names[ShrtOrFullName]);
|
||||
Exists = true;
|
||||
}
|
||||
if (!Exists)
|
||||
if (!Nam_CheckIfNameExists (Lnk_DB_CheckIfLinkNameExists,Names,
|
||||
-1L,
|
||||
-1L, // Unused
|
||||
0)) // Unused
|
||||
{
|
||||
if (!Lnk_EditingLnk->WWW[0])
|
||||
Ale_CreateAlert (Ale_WARNING,NULL,
|
||||
|
|
|
@ -110,7 +110,9 @@ unsigned Lnk_DB_GetLinkDataByCod (MYSQL_RES **mysql_res,long LnkCod)
|
|||
/********************** Check if the name of link exists *********************/
|
||||
/*****************************************************************************/
|
||||
|
||||
bool Lnk_DB_CheckIfLinkNameExists (const char *FldName,const char *Name,long LnkCod)
|
||||
bool Lnk_DB_CheckIfLinkNameExists (const char *FldName,const char *Name,long Cod,
|
||||
__attribute__((unused)) long PrtCod,
|
||||
__attribute__((unused)) unsigned Year)
|
||||
{
|
||||
return
|
||||
DB_QueryEXISTS ("can not check if the name of an institutional link already existed",
|
||||
|
@ -120,7 +122,7 @@ bool Lnk_DB_CheckIfLinkNameExists (const char *FldName,const char *Name,long Lnk
|
|||
" WHERE %s='%s'"
|
||||
" AND LnkCod<>%ld)",
|
||||
FldName,Name,
|
||||
LnkCod);
|
||||
Cod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -41,7 +41,9 @@ void Lnk_DB_UpdateLnkWWW (long LnkCod,const char NewWWW[Cns_MAX_BYTES_WWW + 1]);
|
|||
|
||||
unsigned Lnk_DB_GetLinks (MYSQL_RES **mysql_res);
|
||||
unsigned Lnk_DB_GetLinkDataByCod (MYSQL_RES **mysql_res,long LnkCod);
|
||||
bool Lnk_DB_CheckIfLinkNameExists (const char *FldName,const char *Name,long LnkCod);
|
||||
bool Lnk_DB_CheckIfLinkNameExists (const char *FldName,const char *Name,long Cod,
|
||||
__attribute__((unused)) long PrtCod,
|
||||
__attribute__((unused)) unsigned Year);
|
||||
|
||||
void Lnk_DB_RemoveLink (long LnkCod);
|
||||
|
||||
|
|
|
@ -0,0 +1,200 @@
|
|||
// swad_name.c: short and full names
|
||||
|
||||
/*
|
||||
SWAD (Shared Workspace At a Distance),
|
||||
is a web platform developed at the University of Granada (Spain),
|
||||
and used to support university teaching.
|
||||
|
||||
This file is part of SWAD core.
|
||||
Copyright (C) 1999-2023 Antonio Cañas Vargas
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
published by the Free Software Foundation, either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/*****************************************************************************/
|
||||
/*********************************** Headers *********************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
#include "swad_alert.h"
|
||||
#include "swad_form.h"
|
||||
#include "swad_HTML.h"
|
||||
#include "swad_name.h"
|
||||
#include "swad_parameter.h"
|
||||
#include "swad_theme.h"
|
||||
|
||||
/*****************************************************************************/
|
||||
/***************************** Public constants ******************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
const char *Nam_ParShrtOrFullName[Nam_NUM_SHRT_FULL_NAMES] =
|
||||
{
|
||||
[Nam_SHRT_NAME] = "ShortName",
|
||||
[Nam_FULL_NAME] = "FullName",
|
||||
};
|
||||
const char *Nam_FldShrtOrFullName[Nam_NUM_SHRT_FULL_NAMES] =
|
||||
{
|
||||
[Nam_SHRT_NAME] = "ShortName",
|
||||
[Nam_FULL_NAME] = "FullName",
|
||||
};
|
||||
unsigned Nam_MaxCharsShrtOrFullName[Nam_NUM_SHRT_FULL_NAMES] =
|
||||
{
|
||||
[Nam_SHRT_NAME] = Nam_MAX_CHARS_SHRT_NAME,
|
||||
[Nam_FULL_NAME] = Nam_MAX_CHARS_FULL_NAME,
|
||||
};
|
||||
unsigned Nam_MaxBytesShrtOrFullName[Nam_NUM_SHRT_FULL_NAMES] =
|
||||
{
|
||||
[Nam_SHRT_NAME] = Nam_MAX_BYTES_SHRT_NAME,
|
||||
[Nam_FULL_NAME] = Nam_MAX_BYTES_FULL_NAME,
|
||||
};
|
||||
const char *Nam_ClassShrtOrFullName[Nam_NUM_SHRT_FULL_NAMES] =
|
||||
{
|
||||
[Nam_SHRT_NAME] = "INPUT_SHORT_NAME",
|
||||
[Nam_FULL_NAME] = "INPUT_FULL_NAME",
|
||||
};
|
||||
|
||||
/*****************************************************************************/
|
||||
/**************************** Private constants ******************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
/*****************************************************************************/
|
||||
/******************************* Private types *******************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
/*****************************************************************************/
|
||||
/************** External global variables from others modules ****************/
|
||||
/*****************************************************************************/
|
||||
|
||||
/*****************************************************************************/
|
||||
/************************** Public global variables **************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
/*****************************************************************************/
|
||||
/************************* Private global variables **************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
/*****************************************************************************/
|
||||
/***************************** Private prototypes ****************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
/*****************************************************************************/
|
||||
/************************ Get short name and full name ***********************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Nam_GetParsShrtAndFullName (char *Names[Nam_NUM_SHRT_FULL_NAMES])
|
||||
{
|
||||
Nam_ShrtOrFullName_t ShrtOrFullName;
|
||||
|
||||
for (ShrtOrFullName = Nam_SHRT_NAME;
|
||||
ShrtOrFullName <= Nam_FULL_NAME;
|
||||
ShrtOrFullName++)
|
||||
Nam_GetParShrtOrFullName (ShrtOrFullName,Names[ShrtOrFullName]);
|
||||
}
|
||||
|
||||
void Nam_GetParShrtOrFullName (Nam_ShrtOrFullName_t ShrtOrFullName,char *Name)
|
||||
{
|
||||
extern const char *Nam_ParShrtOrFullName[Nam_NUM_SHRT_FULL_NAMES];
|
||||
extern unsigned Nam_MaxBytesShrtOrFullName[Nam_NUM_SHRT_FULL_NAMES];
|
||||
|
||||
Par_GetParText (Nam_ParShrtOrFullName[ShrtOrFullName],Name,
|
||||
Nam_MaxBytesShrtOrFullName[ShrtOrFullName]);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/************************ Write short and full names *************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Nam_NewShortAndFullNames (const char *Names[Nam_NUM_SHRT_FULL_NAMES])
|
||||
{
|
||||
extern const char *Nam_ParShrtOrFullName[Nam_NUM_SHRT_FULL_NAMES];
|
||||
extern unsigned Nam_MaxCharsShrtOrFullName[Nam_NUM_SHRT_FULL_NAMES];
|
||||
extern const char *Nam_ClassShrtOrFullName[Nam_NUM_SHRT_FULL_NAMES];
|
||||
Nam_ShrtOrFullName_t ShrtOrFullName;
|
||||
|
||||
for (ShrtOrFullName = Nam_SHRT_NAME;
|
||||
ShrtOrFullName <= Nam_FULL_NAME;
|
||||
ShrtOrFullName++)
|
||||
{
|
||||
HTM_TD_Begin ("class=\"CM\"");
|
||||
HTM_INPUT_TEXT (Nam_ParShrtOrFullName[ShrtOrFullName],
|
||||
Nam_MaxCharsShrtOrFullName[ShrtOrFullName],
|
||||
Names[ShrtOrFullName],
|
||||
HTM_DONT_SUBMIT_ON_CHANGE,
|
||||
"class=\"%s INPUT_%s\""
|
||||
" required=\"required\"",
|
||||
Nam_ClassShrtOrFullName[ShrtOrFullName],
|
||||
The_GetSuffix ());
|
||||
HTM_TD_End ();
|
||||
}
|
||||
}
|
||||
|
||||
void Nam_ExistingShortAndFullNames (Act_Action_t ActionRename[Nam_NUM_SHRT_FULL_NAMES],
|
||||
ParCod_Param_t ParCod,long Cod,
|
||||
const char *Names[Nam_NUM_SHRT_FULL_NAMES],
|
||||
bool PutForm)
|
||||
{
|
||||
extern const char *Nam_ParShrtOrFullName[Nam_NUM_SHRT_FULL_NAMES];
|
||||
extern unsigned Nam_MaxCharsShrtOrFullName[Nam_NUM_SHRT_FULL_NAMES];
|
||||
extern const char *Nam_ClassShrtOrFullName[Nam_NUM_SHRT_FULL_NAMES];
|
||||
Nam_ShrtOrFullName_t ShrtOrFullName;
|
||||
|
||||
for (ShrtOrFullName = Nam_SHRT_NAME;
|
||||
ShrtOrFullName <= Nam_FULL_NAME;
|
||||
ShrtOrFullName++)
|
||||
{
|
||||
HTM_TD_Begin ("class=\"LM DAT_%s\"",The_GetSuffix ());
|
||||
if (PutForm)
|
||||
{
|
||||
Frm_BeginForm (ActionRename[ShrtOrFullName]);
|
||||
ParCod_PutPar (ParCod,Cod);
|
||||
HTM_INPUT_TEXT (Nam_ParShrtOrFullName[ShrtOrFullName],
|
||||
Nam_MaxCharsShrtOrFullName[ShrtOrFullName],
|
||||
Names[ShrtOrFullName],
|
||||
HTM_SUBMIT_ON_CHANGE,
|
||||
"class=\"%s INPUT_%s\""
|
||||
" required=\"required\"",
|
||||
Nam_ClassShrtOrFullName[ShrtOrFullName],
|
||||
The_GetSuffix ());
|
||||
Frm_EndForm ();
|
||||
}
|
||||
else
|
||||
HTM_Txt (Names[ShrtOrFullName]);
|
||||
HTM_TD_End ();
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/****************** Check if a short or full name exists *********************/
|
||||
/*****************************************************************************/
|
||||
|
||||
bool Nam_CheckIfNameExists (bool (*FuncToCheck) (const char *FldName,const char *Name,
|
||||
long Cod,long PrtCod,unsigned Year),
|
||||
char *Names[Nam_NUM_SHRT_FULL_NAMES],
|
||||
long Cod,long PrtCod,unsigned Year)
|
||||
{
|
||||
extern const char *Nam_FldShrtOrFullName[Nam_NUM_SHRT_FULL_NAMES];
|
||||
extern const char *Txt_X_already_exists;
|
||||
Nam_ShrtOrFullName_t ShrtOrFullName;
|
||||
|
||||
for (ShrtOrFullName = Nam_SHRT_NAME;
|
||||
ShrtOrFullName <= Nam_FULL_NAME;
|
||||
ShrtOrFullName++)
|
||||
if (FuncToCheck (Nam_FldShrtOrFullName[ShrtOrFullName],
|
||||
Names[ShrtOrFullName],Cod,PrtCod,Year))
|
||||
{
|
||||
Ale_CreateAlert (Ale_WARNING,NULL,Txt_X_already_exists,
|
||||
Names[ShrtOrFullName]);
|
||||
return true; // Exists
|
||||
}
|
||||
|
||||
return false; // Does not exist
|
||||
}
|
|
@ -0,0 +1,74 @@
|
|||
// swad_name.h: short and full names
|
||||
|
||||
#ifndef _SWAD_NAM
|
||||
#define _SWAD_NAM
|
||||
/*
|
||||
SWAD (Shared Workspace At a Distance in Spanish),
|
||||
is a web platform developed at the University of Granada (Spain),
|
||||
and used to support university teaching.
|
||||
|
||||
This file is part of SWAD core.
|
||||
Copyright (C) 1999-2023 Antonio Cañas Vargas
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
published by the Free Software Foundation, either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/*****************************************************************************/
|
||||
/********************************* Headers ***********************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
#include "swad_action.h"
|
||||
#include "swad_parameter_code.h"
|
||||
#include "swad_string.h"
|
||||
|
||||
/*****************************************************************************/
|
||||
/***************************** Public constants ******************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
#define Nam_MAX_CHARS_SHRT_NAME (32 - 1) // 31
|
||||
#define Nam_MAX_BYTES_SHRT_NAME ((Nam_MAX_CHARS_SHRT_NAME + 1) * Str_MAX_BYTES_PER_CHAR - 1) // 511
|
||||
|
||||
#define Nam_MAX_CHARS_FULL_NAME (128 - 1) // 127
|
||||
#define Nam_MAX_BYTES_FULL_NAME ((Nam_MAX_CHARS_FULL_NAME + 1) * Str_MAX_BYTES_PER_CHAR - 1) // 2047
|
||||
|
||||
/*****************************************************************************/
|
||||
/******************************* Public types ********************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
// Related with names of centers, degrees, courses,...
|
||||
#define Nam_NUM_SHRT_FULL_NAMES 2
|
||||
typedef enum
|
||||
{
|
||||
Nam_SHRT_NAME,
|
||||
Nam_FULL_NAME,
|
||||
} Nam_ShrtOrFullName_t;
|
||||
|
||||
/*****************************************************************************/
|
||||
/***************************** Public prototypes *****************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Nam_GetParsShrtAndFullName (char *Names[Nam_NUM_SHRT_FULL_NAMES]);
|
||||
void Nam_GetParShrtOrFullName (Nam_ShrtOrFullName_t ShrtOrFullName,char *Name);
|
||||
|
||||
void Nam_NewShortAndFullNames (const char *Names[Nam_NUM_SHRT_FULL_NAMES]);
|
||||
void Nam_ExistingShortAndFullNames (Act_Action_t ActionRename[Nam_NUM_SHRT_FULL_NAMES],
|
||||
ParCod_Param_t ParCod,long Cod,
|
||||
const char *Names[Nam_NUM_SHRT_FULL_NAMES],
|
||||
bool PutForm);
|
||||
|
||||
bool Nam_CheckIfNameExists (bool (*FuncToCheck) (const char *FldName,const char *Name,
|
||||
long Cod,long PrtCod,unsigned Year),
|
||||
char *Names[Nam_NUM_SHRT_FULL_NAMES],
|
||||
long Cod,long PrtCod,unsigned Year);
|
||||
|
||||
#endif
|
|
@ -908,29 +908,6 @@ unsigned Par_GetParText (const char *ParName,char *ParValue,size_t MaxBytes)
|
|||
Str_REMOVE_SPACES);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/************************ Get short name and full name ***********************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Nam_GetParsShrtAndFullName (char *Names[Nam_NUM_SHRT_FULL_NAMES])
|
||||
{
|
||||
Nam_ShrtOrFullName_t ShrtOrFullName;
|
||||
|
||||
for (ShrtOrFullName = Nam_SHRT_NAME;
|
||||
ShrtOrFullName <= Nam_FULL_NAME;
|
||||
ShrtOrFullName++)
|
||||
Nam_GetParShrtOrFullName (ShrtOrFullName,Names[ShrtOrFullName]);
|
||||
}
|
||||
|
||||
void Nam_GetParShrtOrFullName (Nam_ShrtOrFullName_t ShrtOrFullName,char *Name)
|
||||
{
|
||||
extern const char *Nam_ParShrtOrFullName[Nam_NUM_SHRT_FULL_NAMES];
|
||||
extern unsigned Nam_MaxBytesShrtOrFullName[Nam_NUM_SHRT_FULL_NAMES];
|
||||
|
||||
Par_GetParText (Nam_ParShrtOrFullName[ShrtOrFullName],Name,
|
||||
Nam_MaxBytesShrtOrFullName[ShrtOrFullName]);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/****************** Get the unsigned value of a parameter ********************/
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -82,8 +82,6 @@ void Par_GetMainPars (void);
|
|||
|
||||
//------------------------------ Get parameters -------------------------------
|
||||
unsigned Par_GetParText (const char *ParName,char *ParValue,size_t MaxBytes);
|
||||
void Nam_GetParsShrtAndFullName (char *Names[Nam_NUM_SHRT_FULL_NAMES]);
|
||||
void Nam_GetParShrtOrFullName (Nam_ShrtOrFullName_t ShrtOrFullName,char *Name);
|
||||
unsigned long Par_GetParUnsignedLong (const char *ParName,
|
||||
unsigned long Min,
|
||||
unsigned long Max,
|
||||
|
|
31
swad_place.c
31
swad_place.c
|
@ -582,7 +582,7 @@ static void Plc_RenamePlace (Nam_ShrtOrFullName_t ShrtOrFullName)
|
|||
extern const char *Nam_ParShrtOrFullName[Nam_NUM_SHRT_FULL_NAMES];
|
||||
extern const char *Nam_FldShrtOrFullName[Nam_NUM_SHRT_FULL_NAMES];
|
||||
extern unsigned Nam_MaxBytesShrtOrFullName[Nam_NUM_SHRT_FULL_NAMES];
|
||||
extern const char *Txt_The_place_X_already_exists;
|
||||
extern const char *Txt_X_already_exists;
|
||||
extern const char *Txt_The_place_X_has_been_renamed_as_Y;
|
||||
extern const char *Txt_The_name_X_has_not_changed;
|
||||
char *CurrentName[Nam_NUM_SHRT_FULL_NAMES] =
|
||||
|
@ -611,10 +611,10 @@ static void Plc_RenamePlace (Nam_ShrtOrFullName_t ShrtOrFullName)
|
|||
{
|
||||
/***** If place was in database... *****/
|
||||
if (Plc_DB_CheckIfPlaceNameExists (Nam_ParShrtOrFullName[ShrtOrFullName],
|
||||
NewName,Plc_EditingPlc->PlcCod))
|
||||
Ale_CreateAlert (Ale_WARNING,NULL,
|
||||
Txt_The_place_X_already_exists,
|
||||
NewName);
|
||||
NewName,Plc_EditingPlc->PlcCod,
|
||||
Gbl.Hierarchy.Node[Hie_INS].HieCod,
|
||||
0)) // Unused
|
||||
Ale_CreateAlert (Ale_WARNING,NULL,Txt_X_already_exists,NewName);
|
||||
else
|
||||
{
|
||||
/* Update the table changing old name by new name */
|
||||
|
@ -724,11 +724,7 @@ static void Plc_PutHeadPlaces (void)
|
|||
|
||||
void Plc_ReceiveFormNewPlace (void)
|
||||
{
|
||||
extern const char *Nam_FldShrtOrFullName[Nam_NUM_SHRT_FULL_NAMES];
|
||||
extern const char *Txt_The_place_X_already_exists;
|
||||
extern const char *Txt_Created_new_place_X;
|
||||
Nam_ShrtOrFullName_t ShrtOrFullName;
|
||||
bool Exists;
|
||||
char *Names[Nam_NUM_SHRT_FULL_NAMES] =
|
||||
{
|
||||
[Nam_SHRT_NAME] = Plc_EditingPlc->ShrtName,
|
||||
|
@ -745,19 +741,10 @@ void Plc_ReceiveFormNewPlace (void)
|
|||
if (Plc_EditingPlc->ShrtName[0] &&
|
||||
Plc_EditingPlc->FullName[0]) // If there's a place name
|
||||
{
|
||||
/***** If name of place was in database... *****/
|
||||
for (ShrtOrFullName = Nam_SHRT_NAME, Exists = false;
|
||||
ShrtOrFullName <= Nam_FULL_NAME && !Exists;
|
||||
ShrtOrFullName++)
|
||||
if (Plc_DB_CheckIfPlaceNameExists (Nam_FldShrtOrFullName[ShrtOrFullName],
|
||||
Names[ShrtOrFullName],-1L))
|
||||
{
|
||||
Ale_CreateAlert (Ale_WARNING,NULL,
|
||||
Txt_The_place_X_already_exists,
|
||||
Names[ShrtOrFullName]);
|
||||
Exists = true;
|
||||
}
|
||||
if (!Exists) // Add new place to database
|
||||
/***** If name of place was not in database... *****/
|
||||
if (!Nam_CheckIfNameExists (Plc_DB_CheckIfPlaceNameExists,Names,
|
||||
-1L,Gbl.Hierarchy.Node[Hie_INS].HieCod,
|
||||
0)) // Unused
|
||||
{
|
||||
Plc_DB_CreatePlace (Plc_EditingPlc);
|
||||
Ale_CreateAlert (Ale_SUCCESS,NULL,Txt_Created_new_place_X,
|
||||
|
|
|
@ -149,7 +149,9 @@ unsigned Plc_DB_GetPlaceDataByCod (MYSQL_RES **mysql_res,long PlcCod)
|
|||
/********************** Check if the name of place exists ********************/
|
||||
/*****************************************************************************/
|
||||
|
||||
bool Plc_DB_CheckIfPlaceNameExists (const char *FldName,const char *Name,long PlcCod)
|
||||
bool Plc_DB_CheckIfPlaceNameExists (const char *FldName,const char *Name,long Cod,
|
||||
long PrtCod,
|
||||
__attribute__((unused)) unsigned Year)
|
||||
{
|
||||
return
|
||||
DB_QueryEXISTS ("can not check if the name of a place already existed",
|
||||
|
@ -159,9 +161,9 @@ bool Plc_DB_CheckIfPlaceNameExists (const char *FldName,const char *Name,long Pl
|
|||
" WHERE InsCod=%ld"
|
||||
" AND %s='%s'"
|
||||
" AND PlcCod<>%ld)",
|
||||
Gbl.Hierarchy.Node[Hie_INS].HieCod,
|
||||
PrtCod,
|
||||
FldName,Name,
|
||||
PlcCod);
|
||||
Cod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -38,7 +38,9 @@ void Plc_DB_UpdatePlcName (long PlcCod,const char *FldName,const char *NewPlcNam
|
|||
|
||||
unsigned Plc_DB_GetListPlaces (MYSQL_RES **mysql_res,Plc_Order_t SelectedOrder);
|
||||
unsigned Plc_DB_GetPlaceDataByCod (MYSQL_RES **mysql_res,long PlcCod);
|
||||
bool Plc_DB_CheckIfPlaceNameExists (const char *FldName,const char *Name,long PlcCod);
|
||||
bool Plc_DB_CheckIfPlaceNameExists (const char *FldName,const char *Name,long Cod,
|
||||
long PrtCod,
|
||||
__attribute__((unused)) unsigned Year);
|
||||
|
||||
void Plc_DB_RemovePlace (long PlcCod);
|
||||
|
||||
|
|
29
swad_room.c
29
swad_room.c
|
@ -1049,7 +1049,7 @@ static void Roo_RenameRoom (Nam_ShrtOrFullName_t ShrtOrFullName)
|
|||
extern const char *Nam_ParShrtOrFullName[Nam_NUM_SHRT_FULL_NAMES];
|
||||
extern const char *Nam_FldShrtOrFullName[Nam_NUM_SHRT_FULL_NAMES];
|
||||
extern unsigned Nam_MaxBytesShrtOrFullName[Nam_NUM_SHRT_FULL_NAMES];
|
||||
extern const char *Txt_The_room_X_already_exists;
|
||||
extern const char *Txt_X_already_exists;
|
||||
extern const char *Txt_The_room_X_has_been_renamed_as_Y;
|
||||
extern const char *Txt_The_name_X_has_not_changed;
|
||||
char *CurrentName[Nam_NUM_SHRT_FULL_NAMES] =
|
||||
|
@ -1079,9 +1079,9 @@ static void Roo_RenameRoom (Nam_ShrtOrFullName_t ShrtOrFullName)
|
|||
/***** If room was in database... *****/
|
||||
if (Roo_DB_CheckIfRoomNameExists (Nam_ParShrtOrFullName[ShrtOrFullName],
|
||||
NewName,Roo_EditingRoom->RooCod,
|
||||
Gbl.Hierarchy.Node[Hie_CTR].HieCod))
|
||||
Ale_CreateAlert (Ale_WARNING,NULL,
|
||||
Txt_The_room_X_already_exists,
|
||||
Gbl.Hierarchy.Node[Hie_CTR].HieCod,
|
||||
0)) // Unused
|
||||
Ale_CreateAlert (Ale_WARNING,NULL,Txt_X_already_exists,
|
||||
NewName);
|
||||
else
|
||||
{
|
||||
|
@ -1300,11 +1300,7 @@ static void Roo_PutHeadRooms (void)
|
|||
|
||||
void Roo_ReceiveFormNewRoom (void)
|
||||
{
|
||||
extern const char *Nam_FldShrtOrFullName[Nam_NUM_SHRT_FULL_NAMES];
|
||||
extern const char *Txt_The_room_X_already_exists;
|
||||
extern const char *Txt_Created_new_room_X;
|
||||
Nam_ShrtOrFullName_t ShrtOrFullName;
|
||||
bool Exists;
|
||||
char *Names[Nam_NUM_SHRT_FULL_NAMES] =
|
||||
{
|
||||
[Nam_SHRT_NAME] = Roo_EditingRoom->ShrtName,
|
||||
|
@ -1336,19 +1332,10 @@ void Roo_ReceiveFormNewRoom (void)
|
|||
if (Roo_EditingRoom->ShrtName[0] &&
|
||||
Roo_EditingRoom->FullName[0]) // If there's a room name
|
||||
{
|
||||
/***** If name of room was in database... *****/
|
||||
for (ShrtOrFullName = Nam_SHRT_NAME, Exists = false;
|
||||
ShrtOrFullName <= Nam_FULL_NAME && !Exists;
|
||||
ShrtOrFullName++)
|
||||
if (Roo_DB_CheckIfRoomNameExists (Nam_FldShrtOrFullName[ShrtOrFullName],
|
||||
Names[ShrtOrFullName],-1L,
|
||||
Gbl.Hierarchy.Node[Hie_CTR].HieCod))
|
||||
{
|
||||
Ale_CreateAlert (Ale_WARNING,NULL,
|
||||
Txt_The_room_X_already_exists,Names[ShrtOrFullName]);
|
||||
Exists = true;
|
||||
}
|
||||
if (!Exists) // Add new room to database
|
||||
/***** If name of room was not in database... *****/
|
||||
if (!Nam_CheckIfNameExists (Roo_DB_CheckIfRoomNameExists,Names,
|
||||
-1L,Gbl.Hierarchy.Node[Hie_CTR].HieCod,
|
||||
0)) // Unused
|
||||
{
|
||||
Roo_CreateRoom (Roo_EditingRoom);
|
||||
Ale_CreateAlert (Ale_SUCCESS,NULL,Txt_Created_new_room_X,
|
||||
|
|
|
@ -264,7 +264,8 @@ unsigned Roo_DB_GetListRooms (MYSQL_RES **mysql_res,
|
|||
/*****************************************************************************/
|
||||
|
||||
bool Roo_DB_CheckIfRoomNameExists (const char *FldName,const char *Name,
|
||||
long RooCod,long CtrCod)
|
||||
long Cod,long PrtCod,
|
||||
__attribute__((unused)) unsigned Year)
|
||||
{
|
||||
return
|
||||
DB_QueryEXISTS ("can not check if the name of a room already existed",
|
||||
|
@ -274,9 +275,9 @@ bool Roo_DB_CheckIfRoomNameExists (const char *FldName,const char *Name,
|
|||
" WHERE CtrCod=%ld"
|
||||
" AND %s='%s'"
|
||||
" AND RooCod<>%ld)",
|
||||
CtrCod,
|
||||
PrtCod,
|
||||
FldName,Name,
|
||||
RooCod);
|
||||
Cod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -42,7 +42,8 @@ unsigned Roo_DB_GetListRooms (MYSQL_RES **mysql_res,
|
|||
Roo_WhichData_t WhichData,
|
||||
Roo_Order_t SelectedOrder);
|
||||
bool Roo_DB_CheckIfRoomNameExists (const char *FldName,const char *Name,
|
||||
long RooCod,long CtrCod);
|
||||
long Cod,long PrtCod,
|
||||
__attribute__((unused)) unsigned Year);
|
||||
unsigned Roo_DB_GetRoomDataByCod (MYSQL_RES **mysql_res,long RooCod);
|
||||
unsigned Roo_DB_GetMACAddresses (MYSQL_RES **mysql_res,long RooCod);
|
||||
|
||||
|
|
92
swad_text.c
92
swad_text.c
|
@ -48647,29 +48647,6 @@ const char *Txt_The_ID_X_matches_one_of_the_existing = // Warning: it is very im
|
|||
" matches one of the existing."; // Çeviri lazim!
|
||||
#endif
|
||||
|
||||
const char *Txt_The_institution_X_already_exists = // Warning: it is very important to include %s in the following sentences
|
||||
#if L==1 // ca
|
||||
"La institució <strong>%s</strong> ja existeix.";
|
||||
#elif L==2 // de
|
||||
"Die Hochschule <strong>%s</strong> wurde bereits eingegeben.";
|
||||
#elif L==3 // en
|
||||
"The institution <strong>%s</strong> already exists.";
|
||||
#elif L==4 // es
|
||||
"La institución <strong>%s</strong> ya existe.";
|
||||
#elif L==5 // fr
|
||||
"The institution <strong>%s</strong> already exists."; // Besoin de traduction
|
||||
#elif L==6 // gn
|
||||
"La institución <strong>%s</strong> ya existe."; // Okoteve traducción
|
||||
#elif L==7 // it
|
||||
"L'istituzione <strong>%s</strong> già esiste.";
|
||||
#elif L==8 // pl
|
||||
"The institution <strong>%s</strong> already exists."; // Potrzebujesz tlumaczenie
|
||||
#elif L==9 // pt
|
||||
"A instituição <strong>%s</strong> já existe.";
|
||||
#elif L==10 // tr
|
||||
"The institution <strong>%s</strong> already exists."; // Çeviri lazim!
|
||||
#endif
|
||||
|
||||
const char *Txt_The_institution_X_has_been_renamed_as_Y = // Warning: it is very important to include two %s in the following sentences
|
||||
#if L==1 // ca
|
||||
"La institució <strong>%s</strong> ha passat a anomenar-se <strong>%s</strong>.";
|
||||
|
@ -48818,29 +48795,6 @@ const char *Txt_The_integrated_editor_is_not_yet_available =
|
|||
"The integrated editor is not yet available."; // Çeviri lazim!
|
||||
#endif
|
||||
|
||||
const char *Txt_The_link_X_already_exists = // Warning: it is very important to include %s in the following sentences
|
||||
#if L==1 // ca
|
||||
"L'enllaç <strong>%s</strong> ja existeix.";
|
||||
#elif L==2 // de
|
||||
"Der Link <strong>%s</strong> wurde bereits eingegeben.";
|
||||
#elif L==3 // en
|
||||
"The link <strong>%s</strong> already exists.";
|
||||
#elif L==4 // es
|
||||
"El enlace <strong>%s</strong> ya existe.";
|
||||
#elif L==5 // fr
|
||||
"Le lien <strong>%s</strong> existe déjà.";
|
||||
#elif L==6 // gn
|
||||
"El enlace <strong>%s</strong> ya existe."; // Okoteve traducción
|
||||
#elif L==7 // it
|
||||
"Il link <strong>%s</strong> già esiste.";
|
||||
#elif L==8 // pl
|
||||
"Link <strong>%s</strong> już istnieje.";
|
||||
#elif L==9 // pt
|
||||
"O link <strong>%s</strong> já existe.";
|
||||
#elif L==10 // tr
|
||||
"The link <strong>%s</strong> already exists."; // Çeviri lazim!
|
||||
#endif
|
||||
|
||||
const char *Txt_The_link_X_has_been_placed_inside_the_folder_Y = // Warning: it is very important to include %s in the following sentences
|
||||
#if L==1 // ca
|
||||
"El enlace <strong>%s</strong> se ha almacenado"
|
||||
|
@ -49908,29 +49862,6 @@ const char *Txt_The_password_has_been_changed_successfully =
|
|||
"The password has been changed successfully."; // Çeviri lazim!
|
||||
#endif
|
||||
|
||||
const char *Txt_The_place_X_already_exists = // Warning: it is very important to include %s in the following sentences
|
||||
#if L==1 // ca
|
||||
"El lloc <strong>%s</strong> ja existeix.";
|
||||
#elif L==2 // de
|
||||
"Der Standort <strong>%s</strong> wurde bereits eingegeben.";
|
||||
#elif L==3 // en
|
||||
"The place <strong>%s</strong> already exists.";
|
||||
#elif L==4 // es
|
||||
"El lugar <strong>%s</strong> ya existe.";
|
||||
#elif L==5 // fr
|
||||
"L'emplacement <strong>%s</strong> existe déjà.";
|
||||
#elif L==6 // gn
|
||||
"El lugar <strong>%s</strong> ya existe."; // Okoteve traducción
|
||||
#elif L==7 // it
|
||||
"Il luogo <strong>%s</strong> già esiste.";
|
||||
#elif L==8 // pl
|
||||
"Miejsce <strong>%s</strong> już istnieje.";
|
||||
#elif L==9 // pt
|
||||
"A localização <strong>%s</strong> já existe.";
|
||||
#elif L==10 // tr
|
||||
"The place <strong>%s</strong> already exists."; // Çeviri lazim!
|
||||
#endif
|
||||
|
||||
const char *Txt_The_place_X_has_been_renamed_as_Y = // Warning: it is very important to include two %s in the following sentences
|
||||
#if L==1 // ca
|
||||
"El lloc <strong>%s</strong> ha passat a anomenar-se <strong>%s</strong>.";
|
||||
|
@ -50204,29 +50135,6 @@ const char *Txt_The_role_of_THE_USER_X_in_the_course_Y_has_changed_from_A_to_B =
|
|||
" has changed from %s to %s."; // Çeviri lazim!
|
||||
#endif
|
||||
|
||||
const char *Txt_The_room_X_already_exists = // Warning: it is very important to include %s in the following sentences
|
||||
#if L==1 // ca
|
||||
"La sala <strong>%s</strong> ja existeix.";
|
||||
#elif L==2 // de
|
||||
"Das Raum <strong>%s</strong> wurde bereits eingegeben.";
|
||||
#elif L==3 // en
|
||||
"The room <strong>%s</strong> already exists.";
|
||||
#elif L==4 // es
|
||||
"La sala <strong>%s</strong> ya existe.";
|
||||
#elif L==5 // fr
|
||||
"La salle <strong>%s</strong> existe déjà.";
|
||||
#elif L==6 // gn
|
||||
"La sala <strong>%s</strong> ya existe."; // Okoteve traducción
|
||||
#elif L==7 // it
|
||||
"L'aula <strong>%s</strong> già esiste.";
|
||||
#elif L==8 // pl
|
||||
"Klasa <strong>%s</strong> już istnieje.";
|
||||
#elif L==9 // pt
|
||||
"A sala <strong>%s</strong> já existe.";
|
||||
#elif L==10 // tr
|
||||
"The room <strong>%s</strong> already exists."; // Çeviri lazim!
|
||||
#endif
|
||||
|
||||
const char *Txt_The_room_X_does_not_have_a_limited_capacity_now = // Warning: it is very important to include %s in the following sentences
|
||||
#if L==1 // ca
|
||||
"La sala <strong>%s</strong> ja no té un aforament limitat.";
|
||||
|
|
Loading…
Reference in New Issue