Version 23.43: Nov 06, 2023 Code refactoring in forms.

This commit is contained in:
acanas 2023-11-06 00:32:41 +01:00
parent ea3ec4837a
commit 91152dcf24
35 changed files with 805 additions and 702 deletions

View File

@ -4689,7 +4689,7 @@ static void Brw_PutIconFileWithLinkToViewMetadata (const struct Brw_FileMetadata
if (FileMetadata->FilFolLnk.Type == Brw_IS_FILE) if (FileMetadata->FilFolLnk.Type == Brw_IS_FILE)
Brw_PutIconFile (FileMetadata->FilFolLnk.Name, Brw_PutIconFile (FileMetadata->FilFolLnk.Name,
"CONTEXT_OPT ICO_HIGHLIGHT CONTEXT_ICO16x16", "CONTEXT_OPT ICO_HIGHLIGHT CONTEXT_ICO16x16",
Frm_PUT_FORM_TO_GO); // Put link to view metadata Frm_PUT_FORM); // Put link to view metadata
else else
Ico_PutIconLink ("up-right-from-square.svg",Ico_BLACK, Ico_PutIconLink ("up-right-from-square.svg",Ico_BLACK,
Brw_ActReqDatFile[Gbl.FileBrowser.Type]); Brw_ActReqDatFile[Gbl.FileBrowser.Type]);
@ -4707,7 +4707,7 @@ static void Brw_PutIconFileWithLinkToViewMetadata (const struct Brw_FileMetadata
/*****************************************************************************/ /*****************************************************************************/
void Brw_PutIconFile (const char *FileName, void Brw_PutIconFile (const char *FileName,
const char *Class,Frm_PutFormToGo_t PutFormToGo) const char *Class,Frm_PutForm_t PutFormToGo)
{ {
extern const unsigned Ext_NUM_FILE_EXT_ALLOWED; extern const unsigned Ext_NUM_FILE_EXT_ALLOWED;
extern const char *Ext_FileExtensionsAllowed[]; extern const char *Ext_FileExtensionsAllowed[];
@ -4744,10 +4744,10 @@ void Brw_PutIconFile (const char *FileName,
switch (PutFormToGo) switch (PutFormToGo)
{ {
case Frm_DONT_PUT_FORM_TO_GO: case Frm_DONT_PUT_FORM:
HTM_IMG (URL,Icon,Title,"class=\"%s\"",Class); HTM_IMG (URL,Icon,Title,"class=\"%s\"",Class);
break; break;
case Frm_PUT_FORM_TO_GO: case Frm_PUT_FORM:
HTM_INPUT_IMAGE (URL,Icon,Title,"class=\"%s\"",Class); HTM_INPUT_IMAGE (URL,Icon,Title,"class=\"%s\"",Class);
break; break;
} }
@ -8073,7 +8073,7 @@ static void Brw_WriteBigLinkToDownloadFile (const char *URL,
if (FileMetadata->FilFolLnk.Type == Brw_IS_FILE) if (FileMetadata->FilFolLnk.Type == Brw_IS_FILE)
Brw_PutIconFile (FileMetadata->FilFolLnk.Name, Brw_PutIconFile (FileMetadata->FilFolLnk.Name,
"ICO40x40", "ICO40x40",
Frm_DONT_PUT_FORM_TO_GO); // Don't put link to view metadata Frm_DONT_PUT_FORM); // Don't put link to view metadata
else else
Ico_PutIcon ("up-right-from-square.svg",Ico_BLACK,Txt_Link,"ICO40x40"); Ico_PutIcon ("up-right-from-square.svg",Ico_BLACK,Txt_Link,"ICO40x40");
@ -8098,7 +8098,7 @@ static void Brw_WriteBigLinkToDownloadFile (const char *URL,
if (FileMetadata->FilFolLnk.Type == Brw_IS_FILE) if (FileMetadata->FilFolLnk.Type == Brw_IS_FILE)
Brw_PutIconFile (FileMetadata->FilFolLnk.Name, Brw_PutIconFile (FileMetadata->FilFolLnk.Name,
"ICO40x40", "ICO40x40",
Frm_DONT_PUT_FORM_TO_GO); // Don't put link to view metadata Frm_DONT_PUT_FORM); // Don't put link to view metadata
else else
Ico_PutIcon ("up-right-from-square.svg",Ico_BLACK,Txt_Link,"ICO40x40"); Ico_PutIcon ("up-right-from-square.svg",Ico_BLACK,Txt_Link,"ICO40x40");
HTM_TxtF (" %s ",FileNameToShow); HTM_TxtF (" %s ",FileNameToShow);
@ -9506,7 +9506,7 @@ static void Brw_WriteRowDocData (unsigned *NumDocsNotHidden,MYSQL_ROW row)
case Brw_IS_FILE: case Brw_IS_FILE:
Brw_PutIconFile (FileMetadata.FilFolLnk.Name, Brw_PutIconFile (FileMetadata.FilFolLnk.Name,
"CONTEXT_ICO16x16", "CONTEXT_ICO16x16",
Frm_DONT_PUT_FORM_TO_GO); // Don't put link to view metadata Frm_DONT_PUT_FORM); // Don't put link to view metadata
break; break;
case Brw_IS_FOLDER: case Brw_IS_FOLDER:
Ico_PutIcon ("folder-yellow.png",Ico_UNCHANGED, Ico_PutIcon ("folder-yellow.png",Ico_UNCHANGED,

View File

@ -244,7 +244,7 @@ void Brw_DB_RemoveExpiredExpandedFolders (void);
void Brw_SetFullPathInTree (void); void Brw_SetFullPathInTree (void);
void Brw_PutIconFile (const char *FileName, void Brw_PutIconFile (const char *FileName,
const char *Class,Frm_PutFormToGo_t PutFormToGo); const char *Class,Frm_PutForm_t PutFormToGo);
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void Brw_CreateTmpPublicLinkToPrivateFile (const char *FullPathIncludingFile, void Brw_CreateTmpPublicLinkToPrivateFile (const char *FullPathIncludingFile,

View File

@ -82,15 +82,15 @@ static void CtrCfg_Map (const struct Map_Coordinates *Coord);
static void CtrCfg_Latitude (double Latitude); static void CtrCfg_Latitude (double Latitude);
static void CtrCfg_Longitude (double Longitude); static void CtrCfg_Longitude (double Longitude);
static void CtrCfg_Altitude (double Altitude); static void CtrCfg_Altitude (double Altitude);
static void CtrCfg_Photo (Vie_ViewType_t ViewType,bool PutForm,bool PutLink, static void CtrCfg_Photo (Vie_ViewType_t ViewType,Frm_PutForm_t PutForm,bool PutLink,
const char PathPhoto[PATH_MAX + 1]); const char PathPhoto[PATH_MAX + 1]);
static void CtrCfg_GetPhotoAttr (long CtrCod,char **PhotoAttribution); static void CtrCfg_GetPhotoAttr (long CtrCod,char **PhotoAttribution);
static void CtrCfg_FreePhotoAttr (char **PhotoAttribution); static void CtrCfg_FreePhotoAttr (char **PhotoAttribution);
static void CtrCfg_Institution (Vie_ViewType_t ViewType,bool PutForm); static void CtrCfg_Institution (Vie_ViewType_t ViewType,Frm_PutForm_t PutForm);
static void CtrCfg_FullName (bool PutForm); static void CtrCfg_FullName (Frm_PutForm_t PutForm);
static void CtrCfg_ShrtName (bool PutForm); static void CtrCfg_ShrtName (Frm_PutForm_t PutForm);
static void CtrCfg_Place (bool PutForm); static void CtrCfg_Place (Frm_PutForm_t PutForm);
static void CtrCfg_WWW (Vie_ViewType_t ViewType,bool PutForm); static void CtrCfg_WWW (Vie_ViewType_t ViewType,Frm_PutForm_t PutForm);
static void CtrCfg_Shortcut (Vie_ViewType_t ViewType); static void CtrCfg_Shortcut (Vie_ViewType_t ViewType);
static void CtrCfg_QR (void); static void CtrCfg_QR (void);
static void CtrCfg_NumUsrs (void); static void CtrCfg_NumUsrs (void);
@ -127,12 +127,12 @@ static void CtrCfg_Configuration (Vie_ViewType_t ViewType)
extern const char *Hlp_CENTER_Information; extern const char *Hlp_CENTER_Information;
struct Map_Coordinates Coord; struct Map_Coordinates Coord;
bool PutLink; bool PutLink;
bool PutFormIns; Frm_PutForm_t PutFormIns;
bool PutFormName; Frm_PutForm_t PutFormName;
bool PutFormPlc; Frm_PutForm_t PutFormPlc;
bool PutFormCoor; Frm_PutForm_t PutFormCoor;
bool PutFormWWW; Frm_PutForm_t PutFormWWW;
bool PutFormPhoto; Frm_PutForm_t PutFormPhoto;
bool MapIsAvailable; bool MapIsAvailable;
char PathPhoto[PATH_MAX + 1]; char PathPhoto[PATH_MAX + 1];
bool PhotoExists; bool PhotoExists;
@ -146,12 +146,18 @@ static void CtrCfg_Configuration (Vie_ViewType_t ViewType)
/***** Initializations *****/ /***** Initializations *****/
PutLink = ViewType == Vie_VIEW && Gbl.Hierarchy.Node[Hie_CTR].WWW[0]; PutLink = ViewType == Vie_VIEW && Gbl.Hierarchy.Node[Hie_CTR].WWW[0];
PutFormIns = ViewType == Vie_VIEW && Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM; PutFormIns = (ViewType == Vie_VIEW &&
PutFormName = ViewType == Vie_VIEW && Gbl.Usrs.Me.Role.Logged >= Rol_INS_ADM; Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM) ? Frm_PUT_FORM :
Frm_DONT_PUT_FORM;
PutFormName = (ViewType == Vie_VIEW &&
Gbl.Usrs.Me.Role.Logged >= Rol_INS_ADM) ? Frm_PUT_FORM :
Frm_DONT_PUT_FORM;
PutFormPlc = PutFormPlc =
PutFormCoor = PutFormCoor =
PutFormWWW = PutFormWWW =
PutFormPhoto = ViewType == Vie_VIEW && Gbl.Usrs.Me.Role.Logged >= Rol_CTR_ADM; PutFormPhoto = (ViewType == Vie_VIEW &&
Gbl.Usrs.Me.Role.Logged >= Rol_CTR_ADM) ? Frm_PUT_FORM :
Frm_DONT_PUT_FORM;
/***** Begin box *****/ /***** Begin box *****/
Box_BoxBegin (NULL,NULL, Box_BoxBegin (NULL,NULL,
@ -180,7 +186,7 @@ static void CtrCfg_Configuration (Vie_ViewType_t ViewType)
CtrCfg_Place (PutFormPlc); CtrCfg_Place (PutFormPlc);
/***** Coordinates *****/ /***** Coordinates *****/
if (PutFormCoor) if (PutFormCoor == Frm_PUT_FORM)
{ {
CtrCfg_Latitude (Coord.Latitude ); CtrCfg_Latitude (Coord.Latitude );
CtrCfg_Longitude (Coord.Longitude); CtrCfg_Longitude (Coord.Longitude);
@ -421,7 +427,7 @@ static void CtrCfg_Altitude (double Altitude)
/***************************** Draw center photo *****************************/ /***************************** Draw center photo *****************************/
/*****************************************************************************/ /*****************************************************************************/
static void CtrCfg_Photo (Vie_ViewType_t ViewType,bool PutForm,bool PutLink, static void CtrCfg_Photo (Vie_ViewType_t ViewType,Frm_PutForm_t PutForm,bool PutLink,
const char PathPhoto[PATH_MAX + 1]) const char PathPhoto[PATH_MAX + 1])
{ {
char *PhotoAttribution = NULL; char *PhotoAttribution = NULL;
@ -460,23 +466,27 @@ static void CtrCfg_Photo (Vie_ViewType_t ViewType,bool PutForm,bool PutLink,
HTM_DIV_End (); HTM_DIV_End ();
/****** Photo attribution ******/ /****** Photo attribution ******/
if (PutForm) switch (PutForm)
{ {
HTM_DIV_Begin ("class=\"CM\""); case Frm_DONT_PUT_FORM:
Frm_BeginForm (ActChgCtrPhoAtt); if (PhotoAttribution)
HTM_TEXTAREA_Begin ("id=\"AttributionArea\" name=\"Attribution\" rows=\"3\"" {
" onchange=\"this.form.submit();return false;\""); HTM_DIV_Begin ("class=\"ATTRIBUTION\"");
if (PhotoAttribution) HTM_Txt (PhotoAttribution);
HTM_Txt (PhotoAttribution); HTM_DIV_End ();
HTM_TEXTAREA_End (); }
Frm_EndForm (); break;
HTM_DIV_End (); case Frm_PUT_FORM:
} HTM_DIV_Begin ("class=\"CM\"");
else if (PhotoAttribution) Frm_BeginForm (ActChgCtrPhoAtt);
{ HTM_TEXTAREA_Begin ("id=\"AttributionArea\" name=\"Attribution\" rows=\"3\""
HTM_DIV_Begin ("class=\"ATTRIBUTION\""); " onchange=\"this.form.submit();return false;\"");
HTM_Txt (PhotoAttribution); if (PhotoAttribution)
HTM_DIV_End (); HTM_Txt (PhotoAttribution);
HTM_TEXTAREA_End ();
Frm_EndForm ();
HTM_DIV_End ();
break;
} }
/****** Free memory used for photo attribution ******/ /****** Free memory used for photo attribution ******/
@ -534,75 +544,79 @@ static void CtrCfg_FreePhotoAttr (char **PhotoAttribution)
/***************** Show institution in center configuration ******************/ /***************** Show institution in center configuration ******************/
/*****************************************************************************/ /*****************************************************************************/
static void CtrCfg_Institution (Vie_ViewType_t ViewType,bool PutForm) static void CtrCfg_Institution (Vie_ViewType_t ViewType,Frm_PutForm_t PutForm)
{ {
extern const char *Par_CodeStr[]; extern const char *Par_CodeStr[];
extern const char *Txt_Institution; extern const char *Txt_Institution;
unsigned NumIns; unsigned NumIns;
const struct Hie_Node *Ins; const struct Hie_Node *Ins;
const char *Id[Frm_NUM_PUT_FORM] =
{
[Frm_DONT_PUT_FORM] = NULL,
[Frm_PUT_FORM ] = Par_CodeStr[ParCod_OthIns],
};
/***** Institution *****/ /***** Institution *****/
HTM_TR_Begin (NULL); HTM_TR_Begin (NULL);
/* Label */ /* Label */
Frm_LabelColumn ("RT",PutForm ? Par_CodeStr[ParCod_OthIns] : Frm_LabelColumn ("RT",Id[PutForm],Txt_Institution);
NULL,
Txt_Institution);
/* Data */ /* Data */
HTM_TD_Begin ("class=\"LT DAT_%s\"",The_GetSuffix ()); HTM_TD_Begin ("class=\"LT DAT_%s\"",The_GetSuffix ());
if (PutForm) switch (PutForm)
{ {
/* Get list of institutions of the current country */ case Frm_DONT_PUT_FORM:
Ins_GetBasicListOfInstitutions (Gbl.Hierarchy.Node[Hie_CTY].HieCod); if (ViewType == Vie_VIEW)
{
Frm_BeginFormGoTo (ActSeeInsInf);
ParCod_PutPar (ParCod_Ins,Gbl.Hierarchy.Node[Hie_INS].HieCod);
HTM_BUTTON_Submit_Begin (Str_BuildGoToTitle (Gbl.Hierarchy.Node[Hie_INS].ShrtName),
"class=\"LT BT_LINK\"");
Str_FreeGoToTitle ();
}
/* Put form to select institution */ Lgo_DrawLogo (Hie_INS,
Frm_BeginForm (ActChgCtrInsCfg); Gbl.Hierarchy.Node[Hie_INS].HieCod,
HTM_SELECT_Begin (HTM_SUBMIT_ON_CHANGE,NULL, Gbl.Hierarchy.Node[Hie_INS].ShrtName,
"id=\"OthInsCod\" name=\"OthInsCod\"" 20,"LM");
" class=\"INPUT_SHORT_NAME INPUT_%s\"", HTM_NBSP ();
The_GetSuffix ()); HTM_Txt (Gbl.Hierarchy.Node[Hie_INS].FullName);
for (NumIns = 0;
NumIns < Gbl.Hierarchy.List[Hie_CTY].Num;
NumIns++)
{
Ins = &Gbl.Hierarchy.List[Hie_CTY].Lst[NumIns];
HTM_OPTION (HTM_Type_LONG,&Ins->HieCod,
Ins->HieCod == Gbl.Hierarchy.Node[Hie_INS].HieCod ? HTM_OPTION_SELECTED :
HTM_OPTION_UNSELECTED,
HTM_OPTION_ENABLED,
"%s",Ins->ShrtName);
}
HTM_SELECT_End ();
Frm_EndForm ();
/* Free list of institutions */ if (ViewType == Vie_VIEW)
Hie_FreeList (Hie_CTY); {
} HTM_BUTTON_End ();
else // I can not move center to another institution Frm_EndForm ();
{ }
if (ViewType == Vie_VIEW) break;
{ case Frm_PUT_FORM:
Frm_BeginFormGoTo (ActSeeInsInf); /* Get list of institutions of the current country */
ParCod_PutPar (ParCod_Ins,Gbl.Hierarchy.Node[Hie_INS].HieCod); Ins_GetBasicListOfInstitutions (Gbl.Hierarchy.Node[Hie_CTY].HieCod);
HTM_BUTTON_Submit_Begin (Str_BuildGoToTitle (Gbl.Hierarchy.Node[Hie_INS].ShrtName),
"class=\"LT BT_LINK\"");
Str_FreeGoToTitle ();
}
Lgo_DrawLogo (Hie_INS, /* Put form to select institution */
Gbl.Hierarchy.Node[Hie_INS].HieCod, Frm_BeginForm (ActChgCtrInsCfg);
Gbl.Hierarchy.Node[Hie_INS].ShrtName, HTM_SELECT_Begin (HTM_SUBMIT_ON_CHANGE,NULL,
20,"LM"); "id=\"OthInsCod\" name=\"OthInsCod\""
HTM_NBSP (); " class=\"INPUT_SHORT_NAME INPUT_%s\"",
HTM_Txt (Gbl.Hierarchy.Node[Hie_INS].FullName); The_GetSuffix ());
for (NumIns = 0;
if (ViewType == Vie_VIEW) NumIns < Gbl.Hierarchy.List[Hie_CTY].Num;
{ NumIns++)
HTM_BUTTON_End (); {
Ins = &Gbl.Hierarchy.List[Hie_CTY].Lst[NumIns];
HTM_OPTION (HTM_Type_LONG,&Ins->HieCod,
Ins->HieCod == Gbl.Hierarchy.Node[Hie_INS].HieCod ? HTM_OPTION_SELECTED :
HTM_OPTION_UNSELECTED,
HTM_OPTION_ENABLED,
"%s",Ins->ShrtName);
}
HTM_SELECT_End ();
Frm_EndForm (); Frm_EndForm ();
}
} /* Free list of institutions */
Hie_FreeList (Hie_CTY);
break;
}
HTM_TD_End (); HTM_TD_End ();
HTM_TR_End (); HTM_TR_End ();
@ -612,7 +626,7 @@ static void CtrCfg_Institution (Vie_ViewType_t ViewType,bool PutForm)
/************** Show center full name in center configuration ****************/ /************** Show center full name in center configuration ****************/
/*****************************************************************************/ /*****************************************************************************/
static void CtrCfg_FullName (bool PutForm) static void CtrCfg_FullName (Frm_PutForm_t PutForm)
{ {
HieCfg_Name (PutForm,Hie_CTR,Nam_FULL_NAME); HieCfg_Name (PutForm,Hie_CTR,Nam_FULL_NAME);
} }
@ -621,7 +635,7 @@ static void CtrCfg_FullName (bool PutForm)
/************** Show center short name in center configuration ***************/ /************** Show center short name in center configuration ***************/
/*****************************************************************************/ /*****************************************************************************/
static void CtrCfg_ShrtName (bool PutForm) static void CtrCfg_ShrtName (Frm_PutForm_t PutForm)
{ {
HieCfg_Name (PutForm,Hie_CTR,Nam_SHRT_NAME); HieCfg_Name (PutForm,Hie_CTR,Nam_SHRT_NAME);
} }
@ -630,7 +644,7 @@ static void CtrCfg_ShrtName (bool PutForm)
/**************** Show center place in center configuration ******************/ /**************** Show center place in center configuration ******************/
/*****************************************************************************/ /*****************************************************************************/
static void CtrCfg_Place (bool PutForm) static void CtrCfg_Place (Frm_PutForm_t PutForm)
{ {
extern const char *Par_CodeStr[]; extern const char *Par_CodeStr[];
extern const char *Txt_Place; extern const char *Txt_Place;
@ -638,6 +652,11 @@ static void CtrCfg_Place (bool PutForm)
struct Plc_Places Places; struct Plc_Places Places;
struct Plc_Place Plc; struct Plc_Place Plc;
unsigned NumPlc; unsigned NumPlc;
const char *Id[Frm_NUM_PUT_FORM] =
{
[Frm_DONT_PUT_FORM] = NULL,
[Frm_PUT_FORM ] = Par_CodeStr[ParCod_Plc],
};
/***** Reset places context *****/ /***** Reset places context *****/
Plc_ResetPlaces (&Places); Plc_ResetPlaces (&Places);
@ -646,51 +665,50 @@ static void CtrCfg_Place (bool PutForm)
HTM_TR_Begin (NULL); HTM_TR_Begin (NULL);
/* Label */ /* Label */
Frm_LabelColumn ("RT",PutForm ? Par_CodeStr[ParCod_Plc] : Frm_LabelColumn ("RT",Id[PutForm],Txt_Place);
NULL,
Txt_Place);
/* Data */ /* Data */
HTM_TD_Begin ("class=\"LB DAT_%s\"",The_GetSuffix ()); HTM_TD_Begin ("class=\"LB DAT_%s\"",The_GetSuffix ());
if (PutForm) switch (PutForm)
{ {
/* Get list of places of the current institution */ case Frm_DONT_PUT_FORM: // I can not change center place
Places.SelectedOrder = Plc_ORDER_BY_PLACE; /* Text with the place name */
Plc_GetListPlaces (&Places); Plc.PlcCod = Gbl.Hierarchy.Node[Hie_CTR].Specific.PlcCod;
Plc_GetPlaceDataByCod (&Plc);
HTM_Txt (Plc.FullName);
break;
case Frm_PUT_FORM:
/* Get list of places of the current institution */
Places.SelectedOrder = Plc_ORDER_BY_PLACE;
Plc_GetListPlaces (&Places);
/* Put form to select place */ /* Put form to select place */
Frm_BeginForm (ActChgCtrPlcCfg); Frm_BeginForm (ActChgCtrPlcCfg);
HTM_SELECT_Begin (HTM_SUBMIT_ON_CHANGE,NULL, HTM_SELECT_Begin (HTM_SUBMIT_ON_CHANGE,NULL,
"name=\"PlcCod\"" "name=\"PlcCod\""
" class=\"INPUT_SHORT_NAME INPUT_%s\"", " class=\"INPUT_SHORT_NAME INPUT_%s\"",
The_GetSuffix ()); The_GetSuffix ());
HTM_OPTION (HTM_Type_STRING,"0", HTM_OPTION (HTM_Type_STRING,"0",
Gbl.Hierarchy.Node[Hie_CTR].Specific.PlcCod == 0 ? HTM_OPTION_SELECTED : Gbl.Hierarchy.Node[Hie_CTR].Specific.PlcCod == 0 ? HTM_OPTION_SELECTED :
HTM_OPTION_UNSELECTED, HTM_OPTION_UNSELECTED,
HTM_OPTION_ENABLED,
"%s",Txt_Another_place);
for (NumPlc = 0;
NumPlc < Places.Num;
NumPlc++)
HTM_OPTION (HTM_Type_LONG,&Places.Lst[NumPlc].PlcCod,
Places.Lst[NumPlc].PlcCod == Gbl.Hierarchy.Node[Hie_CTR].Specific.PlcCod ? HTM_OPTION_SELECTED :
HTM_OPTION_UNSELECTED,
HTM_OPTION_ENABLED, HTM_OPTION_ENABLED,
"%s",Places.Lst[NumPlc].ShrtName); "%s",Txt_Another_place);
HTM_SELECT_End (); for (NumPlc = 0;
Frm_EndForm (); NumPlc < Places.Num;
NumPlc++)
HTM_OPTION (HTM_Type_LONG,&Places.Lst[NumPlc].PlcCod,
Places.Lst[NumPlc].PlcCod == Gbl.Hierarchy.Node[Hie_CTR].Specific.PlcCod ? HTM_OPTION_SELECTED :
HTM_OPTION_UNSELECTED,
HTM_OPTION_ENABLED,
"%s",Places.Lst[NumPlc].ShrtName);
HTM_SELECT_End ();
Frm_EndForm ();
/* Free list of places */ /* Free list of places */
Plc_FreeListPlaces (&Places); Plc_FreeListPlaces (&Places);
} break;
else // I can not change center place }
{
/* Text with the place name */
Plc.PlcCod = Gbl.Hierarchy.Node[Hie_CTR].Specific.PlcCod;
Plc_GetPlaceDataByCod (&Plc);
HTM_Txt (Plc.FullName);
}
HTM_TD_End (); HTM_TD_End ();
@ -701,7 +719,7 @@ static void CtrCfg_Place (bool PutForm)
/***************** Show center WWW in center configuration *******************/ /***************** Show center WWW in center configuration *******************/
/*****************************************************************************/ /*****************************************************************************/
static void CtrCfg_WWW (Vie_ViewType_t ViewType,bool PutForm) static void CtrCfg_WWW (Vie_ViewType_t ViewType,Frm_PutForm_t PutForm)
{ {
HieCfg_WWW (ViewType,PutForm,ActChgCtrWWWCfg,Gbl.Hierarchy.Node[Hie_CTR].WWW); HieCfg_WWW (ViewType,PutForm,ActChgCtrWWWCfg,Gbl.Hierarchy.Node[Hie_CTR].WWW);
} }

View File

@ -867,26 +867,30 @@ void Cty_WriteSelectorOfCountry (void)
void Cty_WriteCountryName (long CtyCod) void Cty_WriteCountryName (long CtyCod)
{ {
char CtyName[Cty_MAX_BYTES_NAME + 1]; char CtyName[Cty_MAX_BYTES_NAME + 1];
bool PutForm = !Frm_CheckIfInside () && // Only if not inside another form Frm_PutForm_t PutForm = (!Frm_CheckIfInside () && // Only if not inside another form
Act_GetBrowserTab (Gbl.Action.Act) == Act_BRW_1ST_TAB; // Only in main browser tab Act_GetBrowserTab (Gbl.Action.Act) == Act_BRW_1ST_TAB) ? Frm_PUT_FORM : // Only in main browser tab
Frm_DONT_PUT_FORM;
/***** Get country name *****/ /***** Get country name *****/
Cty_GetCountryNameInLanguage (CtyCod,Gbl.Prefs.Language,CtyName); Cty_GetCountryNameInLanguage (CtyCod,Gbl.Prefs.Language,CtyName);
if (PutForm) switch (PutForm)
{ {
/***** Write country name with link to country information *****/ case Frm_DONT_PUT_FORM:
Frm_BeginForm (ActSeeCtyInf); /***** Write country name without link *****/
ParCod_PutPar (ParCod_Cty,CtyCod); HTM_Txt (CtyName);
HTM_BUTTON_Submit_Begin (Act_GetActionText (ActSeeCtyInf), break;
"class=\"BT_LINK\""); case Frm_PUT_FORM:
HTM_Txt (CtyName); /***** Write country name with link to country information *****/
HTM_BUTTON_End (); Frm_BeginForm (ActSeeCtyInf);
Frm_EndForm (); ParCod_PutPar (ParCod_Cty,CtyCod);
HTM_BUTTON_Submit_Begin (Act_GetActionText (ActSeeCtyInf),
"class=\"BT_LINK\"");
HTM_Txt (CtyName);
HTM_BUTTON_End ();
Frm_EndForm ();
break;
} }
else
/***** Write country name without link *****/
HTM_Txt (CtyName);
} }
/*****************************************************************************/ /*****************************************************************************/

View File

@ -60,11 +60,11 @@ extern struct Globals Gbl;
/*****************************************************************************/ /*****************************************************************************/
static void CrsCfg_PutIconToPrint (__attribute__((unused)) void *Args); static void CrsCfg_PutIconToPrint (__attribute__((unused)) void *Args);
static void CrsCfg_Degree (Vie_ViewType_t ViewType,bool PutForm); static void CrsCfg_Degree (Vie_ViewType_t ViewType,Frm_PutForm_t PutForm);
static void CrsCfg_FullName (bool PutForm); static void CrsCfg_FullName (Frm_PutForm_t PutForm);
static void CrsCfg_ShrtName (bool PutForm); static void CrsCfg_ShrtName (Frm_PutForm_t PutForm);
static void CrsCfg_Year (bool PutForm); static void CrsCfg_Year (Frm_PutForm_t PutForm);
static void CrsCfg_InstitutionalCode (bool PutForm); static void CrsCfg_InstitutionalCode (Frm_PutForm_t PutForm);
static void CrsCfg_InternalCode (void); static void CrsCfg_InternalCode (void);
static void CrsCfg_Shortcut (Vie_ViewType_t ViewType); static void CrsCfg_Shortcut (Vie_ViewType_t ViewType);
static void CrsCfg_QR (void); static void CrsCfg_QR (void);
@ -78,10 +78,10 @@ void CrsCfg_Configuration (Vie_ViewType_t ViewType)
{ {
extern const char *Hlp_COURSE_Information; extern const char *Hlp_COURSE_Information;
bool PutLink; bool PutLink;
bool PutFormDeg; Frm_PutForm_t PutFormDeg;
bool PutFormName; Frm_PutForm_t PutFormName;
bool PutFormYear; Frm_PutForm_t PutFormYear;
bool PutFormInsCod; Frm_PutForm_t PutFormInsCod;
/***** Trivial check *****/ /***** Trivial check *****/
if (Gbl.Hierarchy.Node[Hie_CRS].HieCod <= 0) // No course selected if (Gbl.Hierarchy.Node[Hie_CRS].HieCod <= 0) // No course selected
@ -89,10 +89,16 @@ void CrsCfg_Configuration (Vie_ViewType_t ViewType)
/***** Initializations *****/ /***** Initializations *****/
PutLink = ViewType == Vie_VIEW && Gbl.Hierarchy.Node[Hie_DEG].WWW[0]; PutLink = ViewType == Vie_VIEW && Gbl.Hierarchy.Node[Hie_DEG].WWW[0];
PutFormDeg = ViewType == Vie_VIEW && Gbl.Usrs.Me.Role.Logged >= Rol_CTR_ADM; PutFormDeg = (ViewType == Vie_VIEW &&
PutFormName = ViewType == Vie_VIEW && Gbl.Usrs.Me.Role.Logged >= Rol_DEG_ADM; Gbl.Usrs.Me.Role.Logged >= Rol_CTR_ADM) ? Frm_PUT_FORM :
Frm_DONT_PUT_FORM;
PutFormName = (ViewType == Vie_VIEW &&
Gbl.Usrs.Me.Role.Logged >= Rol_DEG_ADM) ? Frm_PUT_FORM :
Frm_DONT_PUT_FORM;
PutFormYear = PutFormYear =
PutFormInsCod = ViewType == Vie_VIEW && Gbl.Usrs.Me.Role.Logged >= Rol_TCH; PutFormInsCod = (ViewType == Vie_VIEW &&
Gbl.Usrs.Me.Role.Logged >= Rol_TCH) ? Frm_PUT_FORM :
Frm_DONT_PUT_FORM;
/***** Contextual menu *****/ /***** Contextual menu *****/
if (ViewType == Vie_VIEW && if (ViewType == Vie_VIEW &&
@ -196,73 +202,77 @@ void CrsCfg_PrintConfiguration (void)
/******************** Show degree in course configuration ********************/ /******************** Show degree in course configuration ********************/
/*****************************************************************************/ /*****************************************************************************/
static void CrsCfg_Degree (Vie_ViewType_t ViewType,bool PutForm) static void CrsCfg_Degree (Vie_ViewType_t ViewType,Frm_PutForm_t PutForm)
{ {
extern const char *Par_CodeStr[]; extern const char *Par_CodeStr[];
extern const char *Txt_Degree; extern const char *Txt_Degree;
unsigned NumDeg; unsigned NumDeg;
const struct Hie_Node *Deg; const struct Hie_Node *Deg;
const char *Id[Frm_NUM_PUT_FORM] =
{
[Frm_DONT_PUT_FORM] = NULL,
[Frm_PUT_FORM ] = Par_CodeStr[ParCod_OthDeg],
};
/***** Degree *****/ /***** Degree *****/
HTM_TR_Begin (NULL); HTM_TR_Begin (NULL);
/* Label */ /* Label */
Frm_LabelColumn ("RT",PutForm ? Par_CodeStr[ParCod_OthDeg] : Frm_LabelColumn ("RT",Id[PutForm],Txt_Degree);
NULL,
Txt_Degree);
/* Data */ /* Data */
HTM_TD_Begin ("class=\"LT DAT_%s\"",The_GetSuffix ()); HTM_TD_Begin ("class=\"LT DAT_%s\"",The_GetSuffix ());
if (PutForm) switch (PutForm)
{ {
/* Get list of degrees of the current center */ case Frm_DONT_PUT_FORM: // I can not move course to another degree
Deg_GetListDegsInCurrentCtr (); if (ViewType == Vie_VIEW)
{
Frm_BeginFormGoTo (ActSeeDegInf);
ParCod_PutPar (ParCod_Deg,Gbl.Hierarchy.Node[Hie_DEG].HieCod);
HTM_BUTTON_Submit_Begin (Str_BuildGoToTitle (Gbl.Hierarchy.Node[Hie_DEG].ShrtName),
"class=\"LT BT_LINK\"");
Str_FreeGoToTitle ();
}
Lgo_DrawLogo (Hie_DEG,
Gbl.Hierarchy.Node[Hie_DEG].HieCod,
Gbl.Hierarchy.Node[Hie_DEG].ShrtName,
20,"LM");
HTM_NBSP ();
HTM_Txt (Gbl.Hierarchy.Node[Hie_DEG].FullName);
if (ViewType == Vie_VIEW)
{
HTM_BUTTON_End ();
Frm_EndForm ();
}
break;
case Frm_PUT_FORM:
/* Get list of degrees of the current center */
Deg_GetListDegsInCurrentCtr ();
/* Put form to select degree */ /* Put form to select degree */
Frm_BeginForm (ActChgCrsDegCfg); Frm_BeginForm (ActChgCrsDegCfg);
HTM_SELECT_Begin (HTM_SUBMIT_ON_CHANGE,NULL, HTM_SELECT_Begin (HTM_SUBMIT_ON_CHANGE,NULL,
"id=\"OthDegCod\" name=\"OthDegCod\"" "id=\"OthDegCod\" name=\"OthDegCod\""
" class=\"INPUT_SHORT_NAME INPUT_%s\"", " class=\"INPUT_SHORT_NAME INPUT_%s\"",
The_GetSuffix ()); The_GetSuffix ());
for (NumDeg = 0; for (NumDeg = 0;
NumDeg < Gbl.Hierarchy.List[Hie_CTR].Num; NumDeg < Gbl.Hierarchy.List[Hie_CTR].Num;
NumDeg++) NumDeg++)
{ {
Deg = &Gbl.Hierarchy.List[Hie_CTR].Lst[NumDeg]; Deg = &Gbl.Hierarchy.List[Hie_CTR].Lst[NumDeg];
HTM_OPTION (HTM_Type_LONG,&Deg->HieCod, HTM_OPTION (HTM_Type_LONG,&Deg->HieCod,
Deg->HieCod == Gbl.Hierarchy.Node[Hie_DEG].HieCod ? HTM_OPTION_SELECTED : Deg->HieCod == Gbl.Hierarchy.Node[Hie_DEG].HieCod ? HTM_OPTION_SELECTED :
HTM_OPTION_UNSELECTED, HTM_OPTION_UNSELECTED,
HTM_OPTION_ENABLED, HTM_OPTION_ENABLED,
"%s",Deg->ShrtName); "%s",Deg->ShrtName);
} }
HTM_SELECT_End (); HTM_SELECT_End ();
Frm_EndForm ();
/* Free list of degrees of the current center */
Hie_FreeList (Hie_CTR);
}
else // I can not move course to another degree
{
if (ViewType == Vie_VIEW)
{
Frm_BeginFormGoTo (ActSeeDegInf);
ParCod_PutPar (ParCod_Deg,Gbl.Hierarchy.Node[Hie_DEG].HieCod);
HTM_BUTTON_Submit_Begin (Str_BuildGoToTitle (Gbl.Hierarchy.Node[Hie_DEG].ShrtName),
"class=\"LT BT_LINK\"");
Str_FreeGoToTitle ();
}
Lgo_DrawLogo (Hie_DEG,
Gbl.Hierarchy.Node[Hie_DEG].HieCod,
Gbl.Hierarchy.Node[Hie_DEG].ShrtName,
20,"LM");
HTM_NBSP ();
HTM_Txt (Gbl.Hierarchy.Node[Hie_DEG].FullName);
if (ViewType == Vie_VIEW)
{
HTM_BUTTON_End ();
Frm_EndForm (); Frm_EndForm ();
}
} /* Free list of degrees of the current center */
Hie_FreeList (Hie_CTR);
break;
}
HTM_TD_End (); HTM_TD_End ();
HTM_TR_End (); HTM_TR_End ();
@ -272,7 +282,7 @@ static void CrsCfg_Degree (Vie_ViewType_t ViewType,bool PutForm)
/************** Show course full name in course configuration ****************/ /************** Show course full name in course configuration ****************/
/*****************************************************************************/ /*****************************************************************************/
static void CrsCfg_FullName (bool PutForm) static void CrsCfg_FullName (Frm_PutForm_t PutForm)
{ {
HieCfg_Name (PutForm,Hie_CRS,Nam_FULL_NAME); HieCfg_Name (PutForm,Hie_CRS,Nam_FULL_NAME);
} }
@ -281,7 +291,7 @@ static void CrsCfg_FullName (bool PutForm)
/************** Show course short name in course configuration ***************/ /************** Show course short name in course configuration ***************/
/*****************************************************************************/ /*****************************************************************************/
static void CrsCfg_ShrtName (bool PutForm) static void CrsCfg_ShrtName (Frm_PutForm_t PutForm)
{ {
HieCfg_Name (PutForm,Hie_CRS,Nam_SHRT_NAME); HieCfg_Name (PutForm,Hie_CRS,Nam_SHRT_NAME);
} }
@ -290,44 +300,50 @@ static void CrsCfg_ShrtName (bool PutForm)
/***************** Show course year in course configuration ******************/ /***************** Show course year in course configuration ******************/
/*****************************************************************************/ /*****************************************************************************/
static void CrsCfg_Year (bool PutForm) static void CrsCfg_Year (Frm_PutForm_t PutForm)
{ {
extern const char *Txt_Year_OF_A_DEGREE; extern const char *Txt_Year_OF_A_DEGREE;
extern const char *Txt_YEAR_OF_DEGREE[1 + Deg_MAX_YEARS_PER_DEGREE]; extern const char *Txt_YEAR_OF_DEGREE[1 + Deg_MAX_YEARS_PER_DEGREE];
extern const char *Txt_Not_applicable; extern const char *Txt_Not_applicable;
unsigned Year; unsigned Year;
static const char *Id[Frm_NUM_PUT_FORM] =
{
[Frm_DONT_PUT_FORM] = NULL,
[Frm_PUT_FORM ] = "OthCrsYear",
};
/***** Academic year *****/ /***** Academic year *****/
HTM_TR_Begin (NULL); HTM_TR_Begin (NULL);
/* Label */ /* Label */
Frm_LabelColumn ("RT",PutForm ? "OthCrsYear" : Frm_LabelColumn ("RT",Id[PutForm],Txt_Year_OF_A_DEGREE);
NULL,
Txt_Year_OF_A_DEGREE);
/* Data */ /* Data */
HTM_TD_Begin ("class=\"LB DAT_%s\"",The_GetSuffix ()); HTM_TD_Begin ("class=\"LB DAT_%s\"",The_GetSuffix ());
if (PutForm) switch (PutForm)
{ {
Frm_BeginForm (ActChgCrsYeaCfg); case Frm_DONT_PUT_FORM:
HTM_SELECT_Begin (HTM_SUBMIT_ON_CHANGE,NULL, HTM_Txt (Gbl.Hierarchy.Node[Hie_CRS].Specific.Year ? Txt_YEAR_OF_DEGREE[Gbl.Hierarchy.Node[Hie_CRS].Specific.Year] :
"id=\"OthCrsYear\" name=\"OthCrsYear\""
" class=\"INPUT_%s\"",
The_GetSuffix ());
for (Year = 0;
Year <= Deg_MAX_YEARS_PER_DEGREE;
Year++)
HTM_OPTION (HTM_Type_UNSIGNED,&Year,
Year == Gbl.Hierarchy.Node[Hie_CRS].Specific.Year ? HTM_OPTION_SELECTED :
HTM_OPTION_UNSELECTED,
HTM_OPTION_ENABLED,
"%s",Txt_YEAR_OF_DEGREE[Year]);
HTM_SELECT_End ();
Frm_EndForm ();
}
else
HTM_Txt (Gbl.Hierarchy.Node[Hie_CRS].Specific.Year ? Txt_YEAR_OF_DEGREE[Gbl.Hierarchy.Node[Hie_CRS].Specific.Year] :
Txt_Not_applicable); Txt_Not_applicable);
break;
case Frm_PUT_FORM:
Frm_BeginForm (ActChgCrsYeaCfg);
HTM_SELECT_Begin (HTM_SUBMIT_ON_CHANGE,NULL,
"id=\"OthCrsYear\" name=\"OthCrsYear\""
" class=\"INPUT_%s\"",
The_GetSuffix ());
for (Year = 0;
Year <= Deg_MAX_YEARS_PER_DEGREE;
Year++)
HTM_OPTION (HTM_Type_UNSIGNED,&Year,
Year == Gbl.Hierarchy.Node[Hie_CRS].Specific.Year ? HTM_OPTION_SELECTED :
HTM_OPTION_UNSELECTED,
HTM_OPTION_ENABLED,
"%s",Txt_YEAR_OF_DEGREE[Year]);
HTM_SELECT_End ();
Frm_EndForm ();
break;
}
HTM_TD_End (); HTM_TD_End ();
HTM_TR_End (); HTM_TR_End ();
@ -337,34 +353,40 @@ static void CrsCfg_Year (bool PutForm)
/************* Show institutional code in course configuration ***************/ /************* Show institutional code in course configuration ***************/
/*****************************************************************************/ /*****************************************************************************/
static void CrsCfg_InstitutionalCode (bool PutForm) static void CrsCfg_InstitutionalCode (Frm_PutForm_t PutForm)
{ {
extern const char *Txt_Institutional_code; extern const char *Txt_Institutional_code;
static const char *Id[Frm_NUM_PUT_FORM] =
{
[Frm_DONT_PUT_FORM] = NULL,
[Frm_PUT_FORM ] = "InsCrsCod",
};
/***** Institutional course code *****/ /***** Institutional course code *****/
HTM_TR_Begin (NULL); HTM_TR_Begin (NULL);
/* Label */ /* Label */
Frm_LabelColumn ("RT",PutForm ? "InsCrsCod" : Frm_LabelColumn ("RT",Id[PutForm],Txt_Institutional_code);
NULL,
Txt_Institutional_code);
/* Data */ /* Data */
HTM_TD_Begin ("class=\"LB DAT_%s\"",The_GetSuffix ()); HTM_TD_Begin ("class=\"LB DAT_%s\"",The_GetSuffix ());
if (PutForm) switch (PutForm)
{ {
Frm_BeginForm (ActChgInsCrsCodCfg); case Frm_DONT_PUT_FORM:
HTM_INPUT_TEXT ("InsCrsCod",Hie_MAX_CHARS_INSTITUTIONAL_COD, HTM_Txt (Gbl.Hierarchy.Node[Hie_CRS].InstitutionalCod);
Gbl.Hierarchy.Node[Hie_CRS].InstitutionalCod, break;
HTM_SUBMIT_ON_CHANGE, case Frm_PUT_FORM:
"id=\"InsCrsCod\" size=\"%u\"" Frm_BeginForm (ActChgInsCrsCodCfg);
" class=\"INPUT_INS_CODE INPUT_%s\"", HTM_INPUT_TEXT ("InsCrsCod",Hie_MAX_CHARS_INSTITUTIONAL_COD,
Hie_MAX_CHARS_INSTITUTIONAL_COD, Gbl.Hierarchy.Node[Hie_CRS].InstitutionalCod,
The_GetSuffix ()); HTM_SUBMIT_ON_CHANGE,
Frm_EndForm (); "id=\"InsCrsCod\" size=\"%u\""
} " class=\"INPUT_INS_CODE INPUT_%s\"",
else Hie_MAX_CHARS_INSTITUTIONAL_COD,
HTM_Txt (Gbl.Hierarchy.Node[Hie_CRS].InstitutionalCod); The_GetSuffix ());
Frm_EndForm ();
break;
}
HTM_TD_End (); HTM_TD_End ();
HTM_TR_End (); HTM_TR_End ();

View File

@ -59,10 +59,10 @@ extern struct Globals Gbl;
static void DegCfg_Configuration (Vie_ViewType_t ViewType); static void DegCfg_Configuration (Vie_ViewType_t ViewType);
static void DegCfg_PutIconsToPrintAndUpload (__attribute__((unused)) void *Args); static void DegCfg_PutIconsToPrintAndUpload (__attribute__((unused)) void *Args);
static void DegCfg_Center (Vie_ViewType_t ViewType,bool PutForm); static void DegCfg_Center (Vie_ViewType_t ViewType,Frm_PutForm_t PutForm);
static void DegCfg_FullName (bool PutForm); static void DegCfg_FullName (Frm_PutForm_t PutForm);
static void DegCfg_ShrtName (bool PutForm); static void DegCfg_ShrtName (Frm_PutForm_t PutForm);
static void DegCfg_WWW (Vie_ViewType_t ViewType,bool PutForm); static void DegCfg_WWW (Vie_ViewType_t ViewType,Frm_PutForm_t PutForm);
static void DegCfg_Shortcut (Vie_ViewType_t ViewType); static void DegCfg_Shortcut (Vie_ViewType_t ViewType);
static void DegCfg_QR (void); static void DegCfg_QR (void);
static void DegCfg_NumCrss (void); static void DegCfg_NumCrss (void);
@ -96,9 +96,9 @@ static void DegCfg_Configuration (Vie_ViewType_t ViewType)
{ {
extern const char *Hlp_DEGREE_Information; extern const char *Hlp_DEGREE_Information;
bool PutLink; bool PutLink;
bool PutFormCtr; Frm_PutForm_t PutFormCtr;
bool PutFormName; Frm_PutForm_t PutFormName;
bool PutFormWWW; Frm_PutForm_t PutFormWWW;
/***** Trivial check *****/ /***** Trivial check *****/
if (Gbl.Hierarchy.Node[Hie_DEG].HieCod <= 0) // No degree selected if (Gbl.Hierarchy.Node[Hie_DEG].HieCod <= 0) // No degree selected
@ -106,9 +106,15 @@ static void DegCfg_Configuration (Vie_ViewType_t ViewType)
/***** Initializations *****/ /***** Initializations *****/
PutLink = ViewType == Vie_VIEW && Gbl.Hierarchy.Node[Hie_DEG].WWW[0]; PutLink = ViewType == Vie_VIEW && Gbl.Hierarchy.Node[Hie_DEG].WWW[0];
PutFormCtr = ViewType == Vie_VIEW && Gbl.Usrs.Me.Role.Logged >= Rol_INS_ADM; PutFormCtr = (ViewType == Vie_VIEW &&
PutFormName = ViewType == Vie_VIEW && Gbl.Usrs.Me.Role.Logged >= Rol_CTR_ADM; Gbl.Usrs.Me.Role.Logged >= Rol_INS_ADM) ? Frm_PUT_FORM :
PutFormWWW = ViewType == Vie_VIEW && Gbl.Usrs.Me.Role.Logged >= Rol_DEG_ADM; Frm_DONT_PUT_FORM;
PutFormName = (ViewType == Vie_VIEW &&
Gbl.Usrs.Me.Role.Logged >= Rol_CTR_ADM) ? Frm_PUT_FORM :
Frm_DONT_PUT_FORM;
PutFormWWW = (ViewType == Vie_VIEW &&
Gbl.Usrs.Me.Role.Logged >= Rol_DEG_ADM) ? Frm_PUT_FORM :
Frm_DONT_PUT_FORM;
/***** Begin box *****/ /***** Begin box *****/
Box_BoxBegin (NULL,NULL, Box_BoxBegin (NULL,NULL,
@ -190,73 +196,77 @@ static void DegCfg_PutIconsToPrintAndUpload (__attribute__((unused)) void *Args)
/******************** Show center in degree configuration ********************/ /******************** Show center in degree configuration ********************/
/*****************************************************************************/ /*****************************************************************************/
static void DegCfg_Center (Vie_ViewType_t ViewType,bool PutForm) static void DegCfg_Center (Vie_ViewType_t ViewType,Frm_PutForm_t PutForm)
{ {
extern const char *Par_CodeStr[]; extern const char *Par_CodeStr[];
extern const char *Txt_Center; extern const char *Txt_Center;
unsigned NumCtr; unsigned NumCtr;
const struct Hie_Node *Ctr; const struct Hie_Node *Ctr;
const char *Id[Frm_NUM_PUT_FORM] =
{
[Frm_DONT_PUT_FORM] = NULL,
[Frm_PUT_FORM ] = Par_CodeStr[ParCod_OthCtr],
};
/***** Center *****/ /***** Center *****/
HTM_TR_Begin (NULL); HTM_TR_Begin (NULL);
/* Label */ /* Label */
Frm_LabelColumn ("RT",PutForm ? Par_CodeStr[ParCod_OthCtr] : Frm_LabelColumn ("RT",Id[PutForm],Txt_Center);
NULL,
Txt_Center);
/* Data */ /* Data */
HTM_TD_Begin ("class=\"LB DAT_%s\"",The_GetSuffix ()); HTM_TD_Begin ("class=\"LB DAT_%s\"",The_GetSuffix ());
if (PutForm) switch (PutForm)
{ {
/* Get list of centers of the current institution */ case Frm_DONT_PUT_FORM: // I can not move degree to another center
Ctr_GetBasicListOfCenters (Gbl.Hierarchy.Node[Hie_INS].HieCod); if (ViewType == Vie_VIEW)
{
Frm_BeginFormGoTo (ActSeeCtrInf);
ParCod_PutPar (ParCod_Ctr,Gbl.Hierarchy.Node[Hie_CTR].HieCod);
HTM_BUTTON_Submit_Begin (Str_BuildGoToTitle (Gbl.Hierarchy.Node[Hie_CTR].ShrtName),
"class=\"LB BT_LINK\"");
Str_FreeGoToTitle ();
}
Lgo_DrawLogo (Hie_CTR,
Gbl.Hierarchy.Node[Hie_CTR].HieCod,
Gbl.Hierarchy.Node[Hie_CTR].ShrtName,
20,"LM");
HTM_NBSP ();
HTM_Txt (Gbl.Hierarchy.Node[Hie_CTR].FullName);
if (ViewType == Vie_VIEW)
{
HTM_BUTTON_End ();
Frm_EndForm ();
}
break;
case Frm_PUT_FORM:
/* Get list of centers of the current institution */
Ctr_GetBasicListOfCenters (Gbl.Hierarchy.Node[Hie_INS].HieCod);
/* Put form to select center */ /* Put form to select center */
Frm_BeginForm (ActChgDegCtrCfg); Frm_BeginForm (ActChgDegCtrCfg);
HTM_SELECT_Begin (HTM_SUBMIT_ON_CHANGE,NULL, HTM_SELECT_Begin (HTM_SUBMIT_ON_CHANGE,NULL,
"id=\"OthCtrCod\" name=\"OthCtrCod\"" "id=\"OthCtrCod\" name=\"OthCtrCod\""
" class=\"INPUT_SHORT_NAME INPUT_%s\"", " class=\"INPUT_SHORT_NAME INPUT_%s\"",
The_GetSuffix ()); The_GetSuffix ());
for (NumCtr = 0; for (NumCtr = 0;
NumCtr < Gbl.Hierarchy.List[Hie_INS].Num; NumCtr < Gbl.Hierarchy.List[Hie_INS].Num;
NumCtr++) NumCtr++)
{ {
Ctr = &Gbl.Hierarchy.List[Hie_INS].Lst[NumCtr]; Ctr = &Gbl.Hierarchy.List[Hie_INS].Lst[NumCtr];
HTM_OPTION (HTM_Type_LONG,&Ctr->HieCod, HTM_OPTION (HTM_Type_LONG,&Ctr->HieCod,
Ctr->HieCod == Gbl.Hierarchy.Node[Hie_CTR].HieCod ? HTM_OPTION_SELECTED : Ctr->HieCod == Gbl.Hierarchy.Node[Hie_CTR].HieCod ? HTM_OPTION_SELECTED :
HTM_OPTION_UNSELECTED, HTM_OPTION_UNSELECTED,
HTM_OPTION_ENABLED, HTM_OPTION_ENABLED,
"%s",Ctr->ShrtName); "%s",Ctr->ShrtName);
} }
HTM_SELECT_End (); HTM_SELECT_End ();
Frm_EndForm ();
/* Free list of centers */
Hie_FreeList (Hie_INS);
}
else // I can not move degree to another center
{
if (ViewType == Vie_VIEW)
{
Frm_BeginFormGoTo (ActSeeCtrInf);
ParCod_PutPar (ParCod_Ctr,Gbl.Hierarchy.Node[Hie_CTR].HieCod);
HTM_BUTTON_Submit_Begin (Str_BuildGoToTitle (Gbl.Hierarchy.Node[Hie_CTR].ShrtName),
"class=\"LB BT_LINK\"");
Str_FreeGoToTitle ();
}
Lgo_DrawLogo (Hie_CTR,
Gbl.Hierarchy.Node[Hie_CTR].HieCod,
Gbl.Hierarchy.Node[Hie_CTR].ShrtName,
20,"LM");
HTM_NBSP ();
HTM_Txt (Gbl.Hierarchy.Node[Hie_CTR].FullName);
if (ViewType == Vie_VIEW)
{
HTM_BUTTON_End ();
Frm_EndForm (); Frm_EndForm ();
}
} /* Free list of centers */
Hie_FreeList (Hie_INS);
break;
}
HTM_TD_End (); HTM_TD_End ();
HTM_TR_End (); HTM_TR_End ();
@ -266,7 +276,7 @@ static void DegCfg_Center (Vie_ViewType_t ViewType,bool PutForm)
/************** Show degree full name in degree configuration ****************/ /************** Show degree full name in degree configuration ****************/
/*****************************************************************************/ /*****************************************************************************/
static void DegCfg_FullName (bool PutForm) static void DegCfg_FullName (Frm_PutForm_t PutForm)
{ {
HieCfg_Name (PutForm,Hie_DEG,Nam_FULL_NAME); HieCfg_Name (PutForm,Hie_DEG,Nam_FULL_NAME);
} }
@ -275,7 +285,7 @@ static void DegCfg_FullName (bool PutForm)
/************** Show degree short name in degree configuration ***************/ /************** Show degree short name in degree configuration ***************/
/*****************************************************************************/ /*****************************************************************************/
static void DegCfg_ShrtName (bool PutForm) static void DegCfg_ShrtName (Frm_PutForm_t PutForm)
{ {
HieCfg_Name (PutForm,Hie_DEG,Nam_SHRT_NAME); HieCfg_Name (PutForm,Hie_DEG,Nam_SHRT_NAME);
} }
@ -284,7 +294,7 @@ static void DegCfg_ShrtName (bool PutForm)
/***************** Show degree WWW in degree configuration *******************/ /***************** Show degree WWW in degree configuration *******************/
/*****************************************************************************/ /*****************************************************************************/
static void DegCfg_WWW (Vie_ViewType_t ViewType,bool PutForm) static void DegCfg_WWW (Vie_ViewType_t ViewType,Frm_PutForm_t PutForm)
{ {
HieCfg_WWW (ViewType,PutForm,ActChgDegWWWCfg,Gbl.Hierarchy.Node[Hie_DEG].WWW); HieCfg_WWW (ViewType,PutForm,ActChgDegWWWCfg,Gbl.Hierarchy.Node[Hie_DEG].WWW);
} }

View File

@ -406,8 +406,7 @@ void Exa_SeeOneExam (void)
Exa_GetExamDataByCod (&Exams.Exam); Exa_GetExamDataByCod (&Exams.Exam);
/***** Show exam *****/ /***** Show exam *****/
Exa_ShowOnlyOneExam (&Exams,&Session, Exa_ShowOnlyOneExam (&Exams,&Session,Frm_DONT_PUT_FORM);
false); // Do not put form for session
} }
/*****************************************************************************/ /*****************************************************************************/
@ -416,7 +415,7 @@ void Exa_SeeOneExam (void)
void Exa_ShowOnlyOneExam (struct Exa_Exams *Exams, void Exa_ShowOnlyOneExam (struct Exa_Exams *Exams,
struct ExaSes_Session *Session, struct ExaSes_Session *Session,
bool PutFormSession) Frm_PutForm_t PutFormSession)
{ {
Exa_ShowOnlyOneExamBegin (Exams,Session,PutFormSession); Exa_ShowOnlyOneExamBegin (Exams,Session,PutFormSession);
Exa_ShowOnlyOneExamEnd (); Exa_ShowOnlyOneExamEnd ();
@ -424,7 +423,7 @@ void Exa_ShowOnlyOneExam (struct Exa_Exams *Exams,
void Exa_ShowOnlyOneExamBegin (struct Exa_Exams *Exams, void Exa_ShowOnlyOneExamBegin (struct Exa_Exams *Exams,
struct ExaSes_Session *Session, struct ExaSes_Session *Session,
bool PutFormSession) Frm_PutForm_t PutFormSession)
{ {
extern const char *Hlp_ASSESSMENT_Exams; extern const char *Hlp_ASSESSMENT_Exams;
extern const char *Txt_Exam; extern const char *Txt_Exam;

View File

@ -44,10 +44,10 @@ bool Exa_CheckIfICanEditExams (void);
void Exa_SeeOneExam (void); void Exa_SeeOneExam (void);
void Exa_ShowOnlyOneExam (struct Exa_Exams *Exams, void Exa_ShowOnlyOneExam (struct Exa_Exams *Exams,
struct ExaSes_Session *Session, struct ExaSes_Session *Session,
bool PutFormSession); Frm_PutForm_t PutFormSession);
void Exa_ShowOnlyOneExamBegin (struct Exa_Exams *Exams, void Exa_ShowOnlyOneExamBegin (struct Exa_Exams *Exams,
struct ExaSes_Session *Session, struct ExaSes_Session *Session,
bool PutFormSession); Frm_PutForm_t PutFormSession);
void Exa_ShowOnlyOneExamEnd (void); void Exa_ShowOnlyOneExamEnd (void);
void Exa_SetCurrentExaCod (long ExaCod); void Exa_SetCurrentExaCod (long ExaCod);

View File

@ -201,16 +201,15 @@ void ExaRes_ShowMyResultsInExa (void)
Exa_GetExamDataByCod (&Exams.Exam); Exa_GetExamDataByCod (&Exams.Exam);
/***** Exam begin *****/ /***** Exam begin *****/
Exa_ShowOnlyOneExamBegin (&Exams,&Session, Exa_ShowOnlyOneExamBegin (&Exams,&Session,Frm_DONT_PUT_FORM);
false); // Do not put form to start new session
/***** List my sessions results in exam *****/ /***** List my sessions results in exam *****/
if (asprintf (&Title,Txt_Results_of_exam_X,Exams.Exam.Title) < 0) if (asprintf (&Title,Txt_Results_of_exam_X,Exams.Exam.Title) < 0)
Err_NotEnoughMemoryExit (); Err_NotEnoughMemoryExit ();
ExaRes_ShowResultsBegin (&Exams,Title,false); // Do not list exams to select ExaRes_ShowResultsBegin (&Exams,Title,false); // Do not list exams to select
free (Title); free (Title);
ExaRes_ListMyResultsInExa (&Exams); ExaRes_ListMyResultsInExa (&Exams);
ExaRes_ShowResultsEnd (); ExaRes_ShowResultsEnd ();
/***** Exam end *****/ /***** Exam end *****/
Exa_ShowOnlyOneExamEnd (); Exa_ShowOnlyOneExamEnd ();
@ -249,16 +248,15 @@ void ExaRes_ShowMyResultsInSes (void)
ExaSes_GetSessionDataByCod (&Session); ExaSes_GetSessionDataByCod (&Session);
/***** Exam begin *****/ /***** Exam begin *****/
Exa_ShowOnlyOneExamBegin (&Exams,&Session, Exa_ShowOnlyOneExamBegin (&Exams,&Session,Frm_DONT_PUT_FORM);
false); // Do not put form to start new session
/***** List my sessions results in session *****/ /***** List my sessions results in session *****/
if (asprintf (&Title,Txt_Results_of_session_X,Session.Title) < 0) if (asprintf (&Title,Txt_Results_of_session_X,Session.Title) < 0)
Err_NotEnoughMemoryExit (); Err_NotEnoughMemoryExit ();
ExaRes_ShowResultsBegin (&Exams,Title,false); // Do not list exams to select ExaRes_ShowResultsBegin (&Exams,Title,false); // Do not list exams to select
free (Title); free (Title);
ExaRes_ListMyResultsInSes (&Exams,Session.SesCod); ExaRes_ListMyResultsInSes (&Exams,Session.SesCod);
ExaRes_ShowResultsEnd (); ExaRes_ShowResultsEnd ();
/***** Exam end *****/ /***** Exam end *****/
Exa_ShowOnlyOneExamEnd (); Exa_ShowOnlyOneExamEnd ();
@ -393,16 +391,15 @@ void ExaRes_ShowAllResultsInExa (void)
Exa_GetExamDataByCod (&Exams.Exam); Exa_GetExamDataByCod (&Exams.Exam);
/***** Exam begin *****/ /***** Exam begin *****/
Exa_ShowOnlyOneExamBegin (&Exams,&Session, Exa_ShowOnlyOneExamBegin (&Exams,&Session,Frm_DONT_PUT_FORM);
false); // Do not put form to start new session
/***** List sessions results in exam *****/ /***** List sessions results in exam *****/
if (asprintf (&Title,Txt_Results_of_exam_X,Exams.Exam.Title) < 0) if (asprintf (&Title,Txt_Results_of_exam_X,Exams.Exam.Title) < 0)
Err_NotEnoughMemoryExit (); Err_NotEnoughMemoryExit ();
ExaRes_ShowResultsBegin (&Exams,Title,false); // Do not list exams to select ExaRes_ShowResultsBegin (&Exams,Title,false); // Do not list exams to select
free (Title); free (Title);
ExaRes_ListAllResultsInExa (&Exams); ExaRes_ListAllResultsInExa (&Exams);
ExaRes_ShowResultsEnd (); ExaRes_ShowResultsEnd ();
/***** Exam end *****/ /***** Exam end *****/
Exa_ShowOnlyOneExamEnd (); Exa_ShowOnlyOneExamEnd ();
@ -465,16 +462,15 @@ void ExaRes_ShowAllResultsInSes (void)
ExaSes_GetSessionDataByCod (&Session); ExaSes_GetSessionDataByCod (&Session);
/***** Exam begin *****/ /***** Exam begin *****/
Exa_ShowOnlyOneExamBegin (&Exams,&Session, Exa_ShowOnlyOneExamBegin (&Exams,&Session,Frm_DONT_PUT_FORM);
false); // Do not put form to start new session
/***** List sessions results in session *****/ /***** List sessions results in session *****/
if (asprintf (&Title,Txt_Results_of_session_X,Session.Title) < 0) if (asprintf (&Title,Txt_Results_of_session_X,Session.Title) < 0)
Err_NotEnoughMemoryExit (); Err_NotEnoughMemoryExit ();
ExaRes_ShowResultsBegin (&Exams,Title,false); // Do not list exams to select ExaRes_ShowResultsBegin (&Exams,Title,false); // Do not list exams to select
free (Title); free (Title);
ExaRes_ListAllResultsInSes (&Exams,Session.SesCod); ExaRes_ListAllResultsInSes (&Exams,Session.SesCod);
ExaRes_ShowResultsEnd (); ExaRes_ShowResultsEnd ();
/***** Exam end *****/ /***** Exam end *****/
Exa_ShowOnlyOneExamEnd (); Exa_ShowOnlyOneExamEnd ();

View File

@ -137,7 +137,7 @@ void ExaSes_ResetSession (struct ExaSes_Session *Session)
void ExaSes_ListSessions (struct Exa_Exams *Exams, void ExaSes_ListSessions (struct Exa_Exams *Exams,
struct ExaSes_Session *Session, struct ExaSes_Session *Session,
bool PutFormSession) Frm_PutForm_t PutFormSession)
{ {
extern const char *Hlp_ASSESSMENT_Exams_sessions; extern const char *Hlp_ASSESSMENT_Exams_sessions;
extern const char *Txt_Sessions; extern const char *Txt_Sessions;
@ -183,7 +183,7 @@ void ExaSes_ListSessions (struct Exa_Exams *Exams,
case Rol_NET: case Rol_NET:
case Rol_TCH: case Rol_TCH:
case Rol_SYS_ADM: case Rol_SYS_ADM:
if (PutFormSession && Session->SesCod <= 0) if (PutFormSession == Frm_PUT_FORM && Session->SesCod <= 0)
{ {
/* Reset session */ /* Reset session */
ExaSes_ResetSession (Session); ExaSes_ResetSession (Session);
@ -720,8 +720,7 @@ void ExaSes_ToggleVisResultsSesUsr (void)
Exa_DB_ToggleVisResultsSesUsr (&Session); Exa_DB_ToggleVisResultsSesUsr (&Session);
/***** Show current exam *****/ /***** Show current exam *****/
Exa_ShowOnlyOneExam (&Exams,&Session, Exa_ShowOnlyOneExam (&Exams,&Session,Frm_DONT_PUT_FORM);
false); // Do not put form for session
} }
/*****************************************************************************/ /*****************************************************************************/
@ -809,8 +808,7 @@ void ExaSes_ReqRemSession (void)
Session.Title); Session.Title);
/***** Show current exam *****/ /***** Show current exam *****/
Exa_ShowOnlyOneExam (&Exams,&Session, Exa_ShowOnlyOneExam (&Exams,&Session,Frm_DONT_PUT_FORM);
false); // Do not put form for session
} }
/*****************************************************************************/ /*****************************************************************************/
@ -855,8 +853,7 @@ void ExaSes_RemoveSession (void)
Exa_GetExamDataByCod (&Exams.Exam); Exa_GetExamDataByCod (&Exams.Exam);
/***** Show current exam *****/ /***** Show current exam *****/
Exa_ShowOnlyOneExam (&Exams,&Session, Exa_ShowOnlyOneExam (&Exams,&Session,Frm_DONT_PUT_FORM);
false); // Do not put form for session
} }
/*****************************************************************************/ /*****************************************************************************/
@ -894,8 +891,7 @@ static void ExaSes_HideUnhideSession (HidVis_HiddenOrVisible_t HiddenOrVisible)
Exa_DB_HideUnhideSession (&Session,HiddenOrVisible); Exa_DB_HideUnhideSession (&Session,HiddenOrVisible);
/***** Show current exam *****/ /***** Show current exam *****/
Exa_ShowOnlyOneExam (&Exams,&Session, Exa_ShowOnlyOneExam (&Exams,&Session,Frm_DONT_PUT_FORM);
false); // Do not put form for session
} }
/*****************************************************************************/ /*****************************************************************************/
@ -1098,8 +1094,7 @@ void ExaSes_ReqCreatOrEditSes (void)
} }
/***** Show exam *****/ /***** Show exam *****/
Exa_ShowOnlyOneExam (&Exams,&Session, Exa_ShowOnlyOneExam (&Exams,&Session,Frm_PUT_FORM); // Put form for session
true); // Put form for session
} }
/*****************************************************************************/ /*****************************************************************************/
@ -1181,8 +1176,7 @@ void ExaSes_ReceiveFormSession (void)
Exa_GetExamDataByCod (&Exams.Exam); Exa_GetExamDataByCod (&Exams.Exam);
/***** Show current exam *****/ /***** Show current exam *****/
Exa_ShowOnlyOneExam (&Exams,&Session, Exa_ShowOnlyOneExam (&Exams,&Session,Frm_DONT_PUT_FORM);
false); // Do not put form for session
} }
/*****************************************************************************/ /*****************************************************************************/

View File

@ -52,7 +52,7 @@ void ExaSes_ResetSession (struct ExaSes_Session *Session);
void ExaSes_ListSessions (struct Exa_Exams *Exams, void ExaSes_ListSessions (struct Exa_Exams *Exams,
struct ExaSes_Session *Session, struct ExaSes_Session *Session,
bool PutFormSession); Frm_PutForm_t PutFormSession);
void ExaSes_GetSessionDataByCod (struct ExaSes_Session *Session); void ExaSes_GetSessionDataByCod (struct ExaSes_Session *Session);
void ExaSes_ToggleVisResultsSesUsr (void); void ExaSes_ToggleVisResultsSesUsr (void);

View File

@ -44,11 +44,12 @@
#define Frm_MAX_BYTES_PARAM_LOCATION 256 #define Frm_MAX_BYTES_PARAM_LOCATION 256
#define Frm_MAX_BYTES_PARAMS_STR (Frm_MAX_BYTES_PARAM_ACTION + Frm_MAX_BYTES_PARAM_SESSION + Frm_MAX_BYTES_PARAM_LOCATION) #define Frm_MAX_BYTES_PARAMS_STR (Frm_MAX_BYTES_PARAM_ACTION + Frm_MAX_BYTES_PARAM_SESSION + Frm_MAX_BYTES_PARAM_LOCATION)
#define Frm_NUM_PUT_FORM 2
typedef enum typedef enum
{ {
Frm_DONT_PUT_FORM_TO_GO, Frm_DONT_PUT_FORM,
Frm_PUT_FORM_TO_GO, Frm_PUT_FORM,
} Frm_PutFormToGo_t; } Frm_PutForm_t;
/*****************************************************************************/ /*****************************************************************************/
/***************************** Public prototypes *****************************/ /***************************** Public prototypes *****************************/

View File

@ -453,7 +453,7 @@ void Gam_SeeOneGame (void)
void Gam_ShowOnlyOneGame (struct Gam_Games *Games, void Gam_ShowOnlyOneGame (struct Gam_Games *Games,
bool ListGameQuestions, bool ListGameQuestions,
bool PutFormNewMatch) Frm_PutForm_t PutFormNewMatch)
{ {
Gam_ShowOnlyOneGameBegin (Games,ListGameQuestions,PutFormNewMatch); Gam_ShowOnlyOneGameBegin (Games,ListGameQuestions,PutFormNewMatch);
Gam_ShowOnlyOneGameEnd (); Gam_ShowOnlyOneGameEnd ();
@ -461,7 +461,7 @@ void Gam_ShowOnlyOneGame (struct Gam_Games *Games,
void Gam_ShowOnlyOneGameBegin (struct Gam_Games *Games, void Gam_ShowOnlyOneGameBegin (struct Gam_Games *Games,
bool ListGameQuestions, bool ListGameQuestions,
bool PutFormNewMatch) Frm_PutForm_t PutFormNewMatch)
{ {
extern const char *Hlp_ASSESSMENT_Games; extern const char *Hlp_ASSESSMENT_Games;
extern const char *Txt_Game; extern const char *Txt_Game;
@ -2169,7 +2169,7 @@ void Gam_ReqNewMatch (void)
/***** Show game *****/ /***** Show game *****/
Gam_ShowOnlyOneGame (&Games, Gam_ShowOnlyOneGame (&Games,
false, // Do not list game questions false, // Do not list game questions
true); // Put form to start new match Frm_PUT_FORM);
} }
/*****************************************************************************/ /*****************************************************************************/

View File

@ -117,10 +117,10 @@ void Gam_ListAllGames (struct Gam_Games *Games);
void Gam_SeeOneGame (void); void Gam_SeeOneGame (void);
void Gam_ShowOnlyOneGame (struct Gam_Games *Games, void Gam_ShowOnlyOneGame (struct Gam_Games *Games,
bool ListGameQuestions, bool ListGameQuestions,
bool PutFormNewMatch); Frm_PutForm_t PutFormNewMatch);
void Gam_ShowOnlyOneGameBegin (struct Gam_Games *Games, void Gam_ShowOnlyOneGameBegin (struct Gam_Games *Games,
bool ListGameQuestions, bool ListGameQuestions,
bool PutFormNewMatch); Frm_PutForm_t PutFormNewMatch);
void Gam_ShowOnlyOneGameEnd (void); void Gam_ShowOnlyOneGameEnd (void);
void Gam_SetCurrentGamCod (long GamCod); void Gam_SetCurrentGamCod (long GamCod);

View File

@ -1704,7 +1704,8 @@ void Grp_ShowLstGrpsToChgMyGrps (void)
unsigned NumGrpTyp; unsigned NumGrpTyp;
unsigned NumGrpsThisTypeIBelong; unsigned NumGrpsThisTypeIBelong;
unsigned NumGrpsIBelong = 0; unsigned NumGrpsIBelong = 0;
bool PutFormToChangeGrps = !Frm_CheckIfInside (); // Not inside another form (record card) Frm_PutForm_t PutFormToChangeGrps = Frm_CheckIfInside () ? Frm_DONT_PUT_FORM : // Inside another form (record card)?
Frm_PUT_FORM;
bool ICanEdit = !Frm_CheckIfInside () && bool ICanEdit = !Frm_CheckIfInside () &&
(Gbl.Usrs.Me.Role.Logged == Rol_TCH || (Gbl.Usrs.Me.Role.Logged == Rol_TCH ||
Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM); Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM);

View File

@ -85,7 +85,8 @@ void HieCfg_Title (bool PutLink,Hie_Level_t Level)
/******************* Show short/full name in configuration *******************/ /******************* Show short/full name in configuration *******************/
/*****************************************************************************/ /*****************************************************************************/
void HieCfg_Name (bool PutForm,Hie_Level_t Level,Nam_ShrtOrFullName_t ShrtOrFull) void HieCfg_Name (Frm_PutForm_t PutForm,Hie_Level_t Level,
Nam_ShrtOrFullName_t ShrtOrFull)
{ {
extern const char *Nam_Params[Nam_NUM_SHRT_FULL_NAMES]; extern const char *Nam_Params[Nam_NUM_SHRT_FULL_NAMES];
extern unsigned Nam_MaxChars[Nam_NUM_SHRT_FULL_NAMES]; extern unsigned Nam_MaxChars[Nam_NUM_SHRT_FULL_NAMES];
@ -103,7 +104,12 @@ void HieCfg_Name (bool PutForm,Hie_Level_t Level,Nam_ShrtOrFullName_t ShrtOrFull
[Hie_CRS][Nam_SHRT_NAME] = ActRenCrsShoCfg, [Hie_CRS][Nam_SHRT_NAME] = ActRenCrsShoCfg,
[Hie_CRS][Nam_FULL_NAME] = ActRenCrsFulCfg, [Hie_CRS][Nam_FULL_NAME] = ActRenCrsFulCfg,
}; };
char *Name[Nam_NUM_SHRT_FULL_NAMES] = const char *Id[Frm_NUM_PUT_FORM] =
{
[Frm_DONT_PUT_FORM] = NULL,
[Frm_PUT_FORM ] = Nam_Params[ShrtOrFull],
};
const char *Name[Nam_NUM_SHRT_FULL_NAMES] =
{ {
[Nam_SHRT_NAME] = Gbl.Hierarchy.Node[Level].ShrtName, [Nam_SHRT_NAME] = Gbl.Hierarchy.Node[Level].ShrtName,
[Nam_FULL_NAME] = Gbl.Hierarchy.Node[Level].FullName, [Nam_FULL_NAME] = Gbl.Hierarchy.Node[Level].FullName,
@ -113,31 +119,33 @@ void HieCfg_Name (bool PutForm,Hie_Level_t Level,Nam_ShrtOrFullName_t ShrtOrFull
HTM_TR_Begin (NULL); HTM_TR_Begin (NULL);
/* Label */ /* Label */
Frm_LabelColumn ("RT",PutForm ? Nam_Params[ShrtOrFull] : Frm_LabelColumn ("RT",Id[PutForm],
NULL,
ShrtOrFull == Nam_SHRT_NAME ? Txt_Short_name : ShrtOrFull == Nam_SHRT_NAME ? Txt_Short_name :
*Hie_TxtLevel[Level]); *Hie_TxtLevel[Level]);
/* Data */ /* Data */
HTM_TD_Begin ("class=\"LB DAT_STRONG_%s\"",The_GetSuffix ()); HTM_TD_Begin ("class=\"LB DAT_STRONG_%s\"",The_GetSuffix ());
if (PutForm) switch (PutForm)
{ {
/* Form to change full name */ case Frm_DONT_PUT_FORM: // I can not edit full name
Frm_BeginForm (Action[Level][ShrtOrFull]); HTM_Txt (Name[ShrtOrFull]);
HTM_INPUT_TEXT (Nam_Params[ShrtOrFull], break;
Nam_MaxChars[ShrtOrFull], case Frm_PUT_FORM:
Name[ShrtOrFull], /* Form to change full name */
HTM_SUBMIT_ON_CHANGE, Frm_BeginForm (Action[Level][ShrtOrFull]);
"id=\"%s\"" HTM_INPUT_TEXT (Nam_Params[ShrtOrFull],
" class=\"%s INPUT_%s\"" Nam_MaxChars[ShrtOrFull],
" required=\"required\"", Name[ShrtOrFull],
Nam_Params[ShrtOrFull], HTM_SUBMIT_ON_CHANGE,
Nam_Classes[ShrtOrFull], "id=\"%s\""
The_GetSuffix ()); " class=\"%s INPUT_%s\""
Frm_EndForm (); " required=\"required\"",
} Nam_Params[ShrtOrFull],
else // I can not edit full name Nam_Classes[ShrtOrFull],
HTM_Txt (Name[ShrtOrFull]); The_GetSuffix ());
Frm_EndForm ();
break;
}
HTM_TD_End (); HTM_TD_End ();
HTM_TR_End (); HTM_TR_End ();
@ -147,43 +155,47 @@ void HieCfg_Name (bool PutForm,Hie_Level_t Level,Nam_ShrtOrFullName_t ShrtOrFull
/************************* Show web in configuration *************************/ /************************* Show web in configuration *************************/
/*****************************************************************************/ /*****************************************************************************/
void HieCfg_WWW (Vie_ViewType_t ViewType,bool PutForm,Act_Action_t NextAction, void HieCfg_WWW (Vie_ViewType_t ViewType,Frm_PutForm_t PutForm,
const char WWW[Cns_MAX_BYTES_WWW + 1]) Act_Action_t NextAction,const char WWW[Cns_MAX_BYTES_WWW + 1])
{ {
extern const char *Txt_Web; extern const char *Txt_Web;
static const char *Id[Frm_NUM_PUT_FORM] =
{
[Frm_DONT_PUT_FORM] = NULL,
[Frm_PUT_FORM ] = "WWW",
};
/***** Web *****/ /***** Web *****/
HTM_TR_Begin (NULL); HTM_TR_Begin (NULL);
/* Label */ /* Label */
Frm_LabelColumn ("RT",PutForm ? "WWW" : Frm_LabelColumn ("RT",Id[PutForm],Txt_Web);
NULL,
Txt_Web);
/* Data */ /* Data */
HTM_TD_Begin ("class=\"LB DAT_%s\"",The_GetSuffix ()); HTM_TD_Begin ("class=\"LB DAT_%s\"",The_GetSuffix ());
if (PutForm) switch (PutForm)
{ {
/* Form to change web */ case Frm_DONT_PUT_FORM: // I can not change web
Frm_BeginForm (NextAction); HTM_DIV_Begin ("class=\"EXTERNAL_WWW_FULL\"");
HTM_INPUT_URL ("WWW",WWW,HTM_SUBMIT_ON_CHANGE, if (ViewType == Vie_VIEW)
"id=\"WWW\" class=\"INPUT_WWW_WIDE INPUT_%s\"" HTM_A_Begin ("href=\"%s\" target=\"_blank\""
" required=\"required\"", " class=\"DAT_%s\"",
The_GetSuffix ()); WWW,The_GetSuffix ());
Frm_EndForm (); HTM_Txt (WWW);
} if (ViewType == Vie_VIEW)
else // I can not change web HTM_A_End ();
{ HTM_DIV_End ();
HTM_DIV_Begin ("class=\"EXTERNAL_WWW_FULL\""); break;
if (ViewType == Vie_VIEW) case Frm_PUT_FORM:
HTM_A_Begin ("href=\"%s\" target=\"_blank\"" /* Form to change web */
" class=\"DAT_%s\"", Frm_BeginForm (NextAction);
WWW,The_GetSuffix ()); HTM_INPUT_URL ("WWW",WWW,HTM_SUBMIT_ON_CHANGE,
HTM_Txt (WWW); "id=\"WWW\" class=\"INPUT_WWW_WIDE INPUT_%s\""
if (ViewType == Vie_VIEW) " required=\"required\"",
HTM_A_End (); The_GetSuffix ());
HTM_DIV_End (); Frm_EndForm ();
} break;
}
HTM_TD_End (); HTM_TD_End ();
HTM_TR_End (); HTM_TR_End ();
@ -237,7 +249,7 @@ void HieCfg_Shortcut (Vie_ViewType_t ViewType,ParCod_Param_t ParCode,long HieCod
/************************** Show number of centers ***************************/ /************************** Show number of centers ***************************/
/*****************************************************************************/ /*****************************************************************************/
void HieCfg_NumCtrs (unsigned NumCtrs,bool PutForm) void HieCfg_NumCtrs (unsigned NumCtrs,Frm_PutForm_t PutForm)
{ {
extern const char *Txt_Centers; extern const char *Txt_Centers;
extern const char *Txt_Centers_of_INSTITUTION_X; extern const char *Txt_Centers_of_INSTITUTION_X;
@ -251,7 +263,7 @@ void HieCfg_NumCtrs (unsigned NumCtrs,bool PutForm)
/* Data */ /* Data */
HTM_TD_Begin ("class=\"LB DAT_%s\"",The_GetSuffix ()); HTM_TD_Begin ("class=\"LB DAT_%s\"",The_GetSuffix ());
if (PutForm) if (PutForm == Frm_PUT_FORM)
{ {
Frm_BeginFormGoTo (ActSeeCtr); Frm_BeginFormGoTo (ActSeeCtr);
ParCod_PutPar (ParCod_Ins,Gbl.Hierarchy.Node[Hie_INS].HieCod); ParCod_PutPar (ParCod_Ins,Gbl.Hierarchy.Node[Hie_INS].HieCod);
@ -262,7 +274,7 @@ void HieCfg_NumCtrs (unsigned NumCtrs,bool PutForm)
free (Title); free (Title);
} }
HTM_Unsigned (NumCtrs); HTM_Unsigned (NumCtrs);
if (PutForm) if (PutForm == Frm_PUT_FORM)
{ {
HTM_BUTTON_End (); HTM_BUTTON_End ();
Frm_EndForm (); Frm_EndForm ();

View File

@ -34,11 +34,12 @@
/*****************************************************************************/ /*****************************************************************************/
void HieCfg_Title (bool PutLink,Hie_Level_t LogoScope); void HieCfg_Title (bool PutLink,Hie_Level_t LogoScope);
void HieCfg_Name (bool PutForm,Hie_Level_t Level,Nam_ShrtOrFullName_t ShrtOrFull); void HieCfg_Name (Frm_PutForm_t PutForm,Hie_Level_t Level,
void HieCfg_WWW (Vie_ViewType_t ViewType,bool PutForm,Act_Action_t NextAction, Nam_ShrtOrFullName_t ShrtOrFull);
const char WWW[Cns_MAX_BYTES_WWW + 1]); void HieCfg_WWW (Vie_ViewType_t ViewType,Frm_PutForm_t PutForm,
Act_Action_t NextAction,const char WWW[Cns_MAX_BYTES_WWW + 1]);
void HieCfg_Shortcut (Vie_ViewType_t ViewType,ParCod_Param_t ParCode,long HieCod); void HieCfg_Shortcut (Vie_ViewType_t ViewType,ParCod_Param_t ParCode,long HieCod);
void HieCfg_NumCtrs (unsigned NumCtrs,bool PutForm); void HieCfg_NumCtrs (unsigned NumCtrs,Frm_PutForm_t PutForm);
void HieCfg_NumCtrsWithMap (unsigned NumCtrs,unsigned NumCtrsWithMap); void HieCfg_NumCtrsWithMap (unsigned NumCtrs,unsigned NumCtrsWithMap);
void HieCfg_QR (ParCod_Param_t ParCode,long HieCod); void HieCfg_QR (ParCod_Param_t ParCode,long HieCod);
void HieCfg_NumUsrsInCrss (Hie_Level_t Level,long Cod,Rol_Role_t Role); void HieCfg_NumUsrsInCrss (Hie_Level_t Level,long Cod,Rol_Role_t Role);

View File

@ -85,7 +85,8 @@ static void Ind_GetNumCoursesWithIndicators (unsigned NumCrssWithIndicatorYes[1
unsigned NumCrss,MYSQL_RES *mysql_res); unsigned NumCrss,MYSQL_RES *mysql_res);
static void Ind_ShowNumCoursesWithIndicators (const struct Ind_Indicators *Indicators, static void Ind_ShowNumCoursesWithIndicators (const struct Ind_Indicators *Indicators,
unsigned NumCrssWithIndicatorYes[1 + Ind_NUM_INDICATORS], unsigned NumCrssWithIndicatorYes[1 + Ind_NUM_INDICATORS],
unsigned NumCrss,bool PutForm); unsigned NumCrss,
Frm_PutForm_t PutForm);
static void Ind_ShowTableOfCoursesWithIndicators (const struct Ind_Indicators *Indicators, static void Ind_ShowTableOfCoursesWithIndicators (const struct Ind_Indicators *Indicators,
Ind_IndicatorsLayout_t IndicatorsLayout, Ind_IndicatorsLayout_t IndicatorsLayout,
unsigned NumCrss,MYSQL_RES *mysql_res); unsigned NumCrss,MYSQL_RES *mysql_res);
@ -434,7 +435,8 @@ static void Ind_GetNumCoursesWithIndicators (unsigned NumCrssWithIndicatorYes[1
static void Ind_ShowNumCoursesWithIndicators (const struct Ind_Indicators *Indicators, static void Ind_ShowNumCoursesWithIndicators (const struct Ind_Indicators *Indicators,
unsigned NumCrssWithIndicatorYes[1 + Ind_NUM_INDICATORS], unsigned NumCrssWithIndicatorYes[1 + Ind_NUM_INDICATORS],
unsigned NumCrss,bool PutForm) unsigned NumCrss,
Frm_PutForm_t PutForm)
{ {
extern const char *Txt_Indicators; extern const char *Txt_Indicators;
extern const char *Txt_Courses; extern const char *Txt_Courses;
@ -455,7 +457,7 @@ static void Ind_ShowNumCoursesWithIndicators (const struct Ind_Indicators *Indic
/* Header */ /* Header */
HTM_TR_Begin (NULL); HTM_TR_Begin (NULL);
if (PutForm) if (PutForm == Frm_PUT_FORM)
HTM_TH_Empty (1); HTM_TH_Empty (1);
HTM_TH (Txt_Indicators,HTM_HEAD_RIGHT); HTM_TH (Txt_Indicators,HTM_HEAD_RIGHT);
HTM_TH_Span (Txt_Courses ,HTM_HEAD_RIGHT,1,2,NULL); HTM_TH_Span (Txt_Courses ,HTM_HEAD_RIGHT,1,2,NULL);
@ -469,7 +471,7 @@ static void Ind_ShowNumCoursesWithIndicators (const struct Ind_Indicators *Indic
ClassNormal; ClassNormal;
HTM_TR_Begin (NULL); HTM_TR_Begin (NULL);
if (PutForm) if (PutForm == Frm_PUT_FORM)
{ {
HTM_TD_Begin ("class=\"%s\"",Class); HTM_TD_Begin ("class=\"%s\"",Class);
HTM_INPUT_CHECKBOX ("Indicators",HTM_SUBMIT_ON_CHANGE, HTM_INPUT_CHECKBOX ("Indicators",HTM_SUBMIT_ON_CHANGE,
@ -503,7 +505,7 @@ static void Ind_ShowNumCoursesWithIndicators (const struct Ind_Indicators *Indic
/***** Write total of courses *****/ /***** Write total of courses *****/
HTM_TR_Begin (NULL); HTM_TR_Begin (NULL);
if (PutForm) if (PutForm == Frm_PUT_FORM)
HTM_TD_Empty (1); HTM_TD_Empty (1);
HTM_TD_LINE_TOP_Txt (Txt_Total); HTM_TD_LINE_TOP_Txt (Txt_Total);

View File

@ -65,10 +65,10 @@ extern struct Globals Gbl;
static void InsCfg_Configuration (Vie_ViewType_t ViewType); static void InsCfg_Configuration (Vie_ViewType_t ViewType);
static void InsCfg_PutIconsToPrintAndUpload (__attribute__((unused)) void *Args); static void InsCfg_PutIconsToPrintAndUpload (__attribute__((unused)) void *Args);
static void InsCfg_Map (void); static void InsCfg_Map (void);
static void InsCfg_Country (Vie_ViewType_t ViewType,bool PutForm); static void InsCfg_Country (Vie_ViewType_t ViewType,Frm_PutForm_t PutForm);
static void InsCfg_FullName (bool PutForm); static void InsCfg_FullName (Frm_PutForm_t PutForm);
static void InsCfg_ShrtName (bool PutForm); static void InsCfg_ShrtName (Frm_PutForm_t PutForm);
static void InsCfg_WWW (Vie_ViewType_t ViewType,bool PutForm); static void InsCfg_WWW (Vie_ViewType_t ViewType,Frm_PutForm_t PutForm);
static void InsCfg_Shortcut (Vie_ViewType_t ViewType); static void InsCfg_Shortcut (Vie_ViewType_t ViewType);
static void InsCfg_QR (void); static void InsCfg_QR (void);
static void InsCfg_NumUsrs (void); static void InsCfg_NumUsrs (void);
@ -105,9 +105,9 @@ static void InsCfg_Configuration (Vie_ViewType_t ViewType)
{ {
extern const char *Hlp_INSTITUTION_Information; extern const char *Hlp_INSTITUTION_Information;
bool PutLink; bool PutLink;
bool PutFormCty; Frm_PutForm_t PutFormCty;
bool PutFormName; Frm_PutForm_t PutFormName;
bool PutFormWWW; Frm_PutForm_t PutFormWWW;
unsigned NumCtrs; unsigned NumCtrs;
unsigned NumCtrsWithMap; unsigned NumCtrsWithMap;
@ -118,8 +118,12 @@ static void InsCfg_Configuration (Vie_ViewType_t ViewType)
/***** Initializations *****/ /***** Initializations *****/
PutLink = ViewType == Vie_VIEW && Gbl.Hierarchy.Node[Hie_INS].WWW[0]; PutLink = ViewType == Vie_VIEW && Gbl.Hierarchy.Node[Hie_INS].WWW[0];
PutFormCty = PutFormCty =
PutFormName = ViewType == Vie_VIEW && Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM; PutFormName = (ViewType == Vie_VIEW &&
PutFormWWW = ViewType == Vie_VIEW && Gbl.Usrs.Me.Role.Logged >= Rol_INS_ADM; Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM) ? Frm_PUT_FORM :
Frm_DONT_PUT_FORM;
PutFormWWW = (ViewType == Vie_VIEW &&
Gbl.Usrs.Me.Role.Logged >= Rol_INS_ADM) ? Frm_PUT_FORM :
Frm_DONT_PUT_FORM;
/***** Begin box *****/ /***** Begin box *****/
Box_BoxBegin (NULL,NULL, Box_BoxBegin (NULL,NULL,
@ -297,12 +301,17 @@ static void InsCfg_Map (void)
/***************** Show country in institution configuration *****************/ /***************** Show country in institution configuration *****************/
/*****************************************************************************/ /*****************************************************************************/
static void InsCfg_Country (Vie_ViewType_t ViewType,bool PutForm) static void InsCfg_Country (Vie_ViewType_t ViewType,Frm_PutForm_t PutForm)
{ {
extern const char *Par_CodeStr[]; extern const char *Par_CodeStr[];
extern const char *Txt_Country; extern const char *Txt_Country;
unsigned NumCty; unsigned NumCty;
const struct Hie_Node *Cty; const struct Hie_Node *Cty;
const char *Id[Frm_NUM_PUT_FORM] =
{
[Frm_DONT_PUT_FORM] = NULL,
[Frm_PUT_FORM ] = Par_CodeStr[ParCod_OthCty],
};
/***** Get list of countries *****/ /***** Get list of countries *****/
Cty_GetBasicListOfCountries (); Cty_GetBasicListOfCountries ();
@ -311,53 +320,52 @@ static void InsCfg_Country (Vie_ViewType_t ViewType,bool PutForm)
HTM_TR_Begin (NULL); HTM_TR_Begin (NULL);
/* Label */ /* Label */
Frm_LabelColumn ("RT",PutForm ? Par_CodeStr[ParCod_OthCty] : Frm_LabelColumn ("RT",Id[PutForm],Txt_Country);
NULL,
Txt_Country);
/* Data */ /* Data */
HTM_TD_Begin ("class=\"LT DAT_%s\"",The_GetSuffix ()); HTM_TD_Begin ("class=\"LT DAT_%s\"",The_GetSuffix ());
if (PutForm) switch (PutForm)
{ {
/* Put form to select country */ case Frm_DONT_PUT_FORM: // I can not move institution to another country
Frm_BeginForm (ActChgInsCtyCfg); if (ViewType == Vie_VIEW)
HTM_SELECT_Begin (HTM_SUBMIT_ON_CHANGE,NULL, {
"id=\"OthCtyCod\" name=\"OthCtyCod\"" Frm_BeginFormGoTo (ActSeeCtyInf);
" class=\"INPUT_SHORT_NAME INPUT_%s\"", ParCod_PutPar (ParCod_Cty,Gbl.Hierarchy.Node[Hie_CTY].HieCod);
The_GetSuffix ()); HTM_BUTTON_Submit_Begin (Str_BuildGoToTitle (Gbl.Hierarchy.Node[Hie_CTY].FullName),
for (NumCty = 0; "class=\"BT_LINK\"");
NumCty < Gbl.Hierarchy.List[Hie_SYS].Num; Str_FreeGoToTitle ();
NumCty++) }
{ Cty_DrawCountryMap (&Gbl.Hierarchy.Node[Hie_CTY],"COUNTRY_MAP_TINY");
Cty = &Gbl.Hierarchy.List[Hie_SYS].Lst[NumCty]; HTM_NBSP ();
HTM_OPTION (HTM_Type_LONG,&Cty->HieCod, HTM_Txt (Gbl.Hierarchy.Node[Hie_CTY].FullName);
Cty->HieCod == Gbl.Hierarchy.Node[Hie_CTY].HieCod ? HTM_OPTION_SELECTED : if (ViewType == Vie_VIEW)
HTM_OPTION_UNSELECTED, {
HTM_OPTION_ENABLED, HTM_BUTTON_End ();
"%s",Cty->FullName); Frm_EndForm ();
} }
HTM_SELECT_End (); break;
Frm_EndForm (); case Frm_PUT_FORM:
} /* Put form to select country */
else // I can not move institution to another country Frm_BeginForm (ActChgInsCtyCfg);
{ HTM_SELECT_Begin (HTM_SUBMIT_ON_CHANGE,NULL,
if (ViewType == Vie_VIEW) "id=\"OthCtyCod\" name=\"OthCtyCod\""
{ " class=\"INPUT_SHORT_NAME INPUT_%s\"",
Frm_BeginFormGoTo (ActSeeCtyInf); The_GetSuffix ());
ParCod_PutPar (ParCod_Cty,Gbl.Hierarchy.Node[Hie_CTY].HieCod); for (NumCty = 0;
HTM_BUTTON_Submit_Begin (Str_BuildGoToTitle (Gbl.Hierarchy.Node[Hie_CTY].FullName), NumCty < Gbl.Hierarchy.List[Hie_SYS].Num;
"class=\"BT_LINK\""); NumCty++)
Str_FreeGoToTitle (); {
} Cty = &Gbl.Hierarchy.List[Hie_SYS].Lst[NumCty];
Cty_DrawCountryMap (&Gbl.Hierarchy.Node[Hie_CTY],"COUNTRY_MAP_TINY"); HTM_OPTION (HTM_Type_LONG,&Cty->HieCod,
HTM_NBSP (); Cty->HieCod == Gbl.Hierarchy.Node[Hie_CTY].HieCod ? HTM_OPTION_SELECTED :
HTM_Txt (Gbl.Hierarchy.Node[Hie_CTY].FullName); HTM_OPTION_UNSELECTED,
if (ViewType == Vie_VIEW) HTM_OPTION_ENABLED,
{ "%s",Cty->FullName);
HTM_BUTTON_End (); }
HTM_SELECT_End ();
Frm_EndForm (); Frm_EndForm ();
} break;
} }
HTM_TD_End (); HTM_TD_End ();
HTM_TR_End (); HTM_TR_End ();
@ -369,7 +377,7 @@ static void InsCfg_Country (Vie_ViewType_t ViewType,bool PutForm)
/********* Show institution full name in institution configuration ***********/ /********* Show institution full name in institution configuration ***********/
/*****************************************************************************/ /*****************************************************************************/
static void InsCfg_FullName (bool PutForm) static void InsCfg_FullName (Frm_PutForm_t PutForm)
{ {
HieCfg_Name (PutForm,Hie_INS,Nam_FULL_NAME); HieCfg_Name (PutForm,Hie_INS,Nam_FULL_NAME);
} }
@ -378,7 +386,7 @@ static void InsCfg_FullName (bool PutForm)
/********* Show institution short name in institution configuration **********/ /********* Show institution short name in institution configuration **********/
/*****************************************************************************/ /*****************************************************************************/
static void InsCfg_ShrtName (bool PutForm) static void InsCfg_ShrtName (Frm_PutForm_t PutForm)
{ {
HieCfg_Name (PutForm,Hie_INS,Nam_SHRT_NAME); HieCfg_Name (PutForm,Hie_INS,Nam_SHRT_NAME);
} }
@ -387,7 +395,7 @@ static void InsCfg_ShrtName (bool PutForm)
/************ Show institution WWW in institution configuration **************/ /************ Show institution WWW in institution configuration **************/
/*****************************************************************************/ /*****************************************************************************/
static void InsCfg_WWW (Vie_ViewType_t ViewType,bool PutForm) static void InsCfg_WWW (Vie_ViewType_t ViewType,Frm_PutForm_t PutForm)
{ {
HieCfg_WWW (ViewType,PutForm,ActChgInsWWWCfg,Gbl.Hierarchy.Node[Hie_INS].WWW); HieCfg_WWW (ViewType,PutForm,ActChgInsWWWCfg,Gbl.Hierarchy.Node[Hie_INS].WWW);
} }

View File

@ -269,8 +269,7 @@ void Mch_ResetMatch (struct Mch_Match *Match)
/************************* List the matches of a game ************************/ /************************* List the matches of a game ************************/
/*****************************************************************************/ /*****************************************************************************/
void Mch_ListMatches (struct Gam_Games *Games, void Mch_ListMatches (struct Gam_Games *Games,Frm_PutForm_t PutFormNewMatch)
bool PutFormNewMatch)
{ {
extern const char *Hlp_ASSESSMENT_Games_matches; extern const char *Hlp_ASSESSMENT_Games_matches;
extern const char *Txt_Matches; extern const char *Txt_Matches;
@ -315,7 +314,7 @@ void Mch_ListMatches (struct Gam_Games *Games,
case Rol_NET: case Rol_NET:
case Rol_TCH: case Rol_TCH:
case Rol_SYS_ADM: case Rol_SYS_ADM:
if (PutFormNewMatch) if (PutFormNewMatch == Frm_PUT_FORM)
Mch_PutFormNewMatch (&Games->Game); // Form to fill in data and start playing a new match Mch_PutFormNewMatch (&Games->Game); // Form to fill in data and start playing a new match
break; break;
default: default:
@ -904,7 +903,7 @@ void Mch_ToggleVisResultsMchUsr (void)
/***** Show current game *****/ /***** Show current game *****/
Gam_ShowOnlyOneGame (&Games, Gam_ShowOnlyOneGame (&Games,
false, // Do not list game questions false, // Do not list game questions
false); // Do not put form to start new match Frm_DONT_PUT_FORM);
} }
/*****************************************************************************/ /*****************************************************************************/
@ -1020,7 +1019,7 @@ void Mch_ReqRemMatch (void)
/***** Show current game *****/ /***** Show current game *****/
Gam_ShowOnlyOneGame (&Games, Gam_ShowOnlyOneGame (&Games,
false, // Do not list game questions false, // Do not list game questions
false); // Do not put form to start new match Frm_DONT_PUT_FORM);
} }
/*****************************************************************************/ /*****************************************************************************/
@ -1055,7 +1054,7 @@ void Mch_RemoveMatch (void)
/***** Show current game *****/ /***** Show current game *****/
Gam_ShowOnlyOneGame (&Games, Gam_ShowOnlyOneGame (&Games,
false, // Do not list game questions false, // Do not list game questions
false); // Do not put form to start new match Frm_DONT_PUT_FORM);
} }
/*****************************************************************************/ /*****************************************************************************/
@ -1144,7 +1143,7 @@ void Mch_EditMatch (void)
/***** Show current game *****/ /***** Show current game *****/
Gam_ShowOnlyOneGame (&Games, Gam_ShowOnlyOneGame (&Games,
false, // Do not list game questions false, // Do not list game questions
false); // Do not put form to start new match Frm_DONT_PUT_FORM);
} }
/*****************************************************************************/ /*****************************************************************************/
@ -1431,7 +1430,7 @@ void Mch_ChangeMatch (void)
/***** Show current game *****/ /***** Show current game *****/
Gam_ShowOnlyOneGame (&Games, Gam_ShowOnlyOneGame (&Games,
false, // Do not list game questions false, // Do not list game questions
false); // Do not put form to start new match Frm_DONT_PUT_FORM);
} }
/*****************************************************************************/ /*****************************************************************************/
@ -2332,10 +2331,21 @@ static void Mch_PutFormsCountdown (struct Mch_Match *Match)
static void Mch_PutFormCountdown (struct Mch_Match *Match,long Seconds,const char *Color) static void Mch_PutFormCountdown (struct Mch_Match *Match,long Seconds,const char *Color)
{ {
extern const char *Txt_Countdown; extern const char *Txt_Countdown;
static const char *fmt[Frm_NUM_PUT_FORM] =
{
[Frm_DONT_PUT_FORM] = "class=\"BT_LINK_OFF MCH_BUTTON_HIDDEN\"",
[Frm_PUT_FORM ] = "class=\"BT_LINK MCH_BUTTON_ON\"",
};
char *OnSubmit; char *OnSubmit;
bool PutForm = Match->Status.Showing != Mch_END; Frm_PutForm_t PutForm = (Match->Status.Showing != Mch_END) ? Frm_PUT_FORM :
Frm_DONT_PUT_FORM;
const char *Title[Frm_NUM_PUT_FORM] =
{
[Frm_DONT_PUT_FORM] = NULL,
[Frm_PUT_FORM ] = Txt_Countdown,
};
if (PutForm) if (PutForm == Frm_PUT_FORM)
{ {
/***** Begin form *****/ /***** Begin form *****/
if (asprintf (&OnSubmit,"updateMatchTch('match_left'," if (asprintf (&OnSubmit,"updateMatchTch('match_left',"
@ -2350,10 +2360,7 @@ static void Mch_PutFormCountdown (struct Mch_Match *Match,long Seconds,const cha
/***** Put icon *****/ /***** Put icon *****/
HTM_DIV_Begin ("class=\"MCH_SMALLBUTTON_CONT %s\"",Color); HTM_DIV_Begin ("class=\"MCH_SMALLBUTTON_CONT %s\"",Color);
HTM_BUTTON_Submit_Begin (PutForm ? Txt_Countdown : HTM_BUTTON_Submit_Begin (Title[PutForm],fmt[PutForm]);
NULL,
PutForm ? "class=\"BT_LINK MCH_BUTTON_ON\"" :
"class=\"BT_LINK_OFF MCH_BUTTON_HIDDEN\"");
HTM_NBSP (); HTM_NBSP ();
if (Seconds >= 0) if (Seconds >= 0)
@ -2369,7 +2376,7 @@ static void Mch_PutFormCountdown (struct Mch_Match *Match,long Seconds,const cha
HTM_DIV_End (); HTM_DIV_End ();
/***** End form *****/ /***** End form *****/
if (PutForm) if (PutForm == Frm_PUT_FORM)
{ {
Frm_EndForm (); Frm_EndForm ();
free (OnSubmit); free (OnSubmit);

View File

@ -94,8 +94,7 @@ long Mch_GetMchCodBeingPlayed (void);
void Mch_ResetMatch (struct Mch_Match *Match); void Mch_ResetMatch (struct Mch_Match *Match);
void Mch_ListMatches (struct Gam_Games *Games, void Mch_ListMatches (struct Gam_Games *Games,Frm_PutForm_t PutFormNewMatch);
bool PutFormNewMatch);
void Mch_GetMatchDataByCod (struct Mch_Match *Match); void Mch_GetMatchDataByCod (struct Mch_Match *Match);
void Mch_ToggleVisResultsMchUsr (void); void Mch_ToggleVisResultsMchUsr (void);

View File

@ -167,7 +167,7 @@ void MchRes_ShowMyMchResultsInGam (void)
/***** Game begin *****/ /***** Game begin *****/
Gam_ShowOnlyOneGameBegin (&Games, Gam_ShowOnlyOneGameBegin (&Games,
false, // Do not list game questions false, // Do not list game questions
false); // Do not put form to start new match Frm_DONT_PUT_FORM);
/***** List my matches results in game *****/ /***** List my matches results in game *****/
if (asprintf (&Title,Txt_Results_of_game_X,Games.Game.Title) < 0) if (asprintf (&Title,Txt_Results_of_game_X,Games.Game.Title) < 0)
@ -217,7 +217,7 @@ void MchRes_ShowMyMchResultsInMch (void)
/***** Game begin *****/ /***** Game begin *****/
Gam_ShowOnlyOneGameBegin (&Games, Gam_ShowOnlyOneGameBegin (&Games,
false, // Do not list game questions false, // Do not list game questions
false); // Do not put form to start new match Frm_DONT_PUT_FORM);
/***** List my matches results in match *****/ /***** List my matches results in match *****/
if (asprintf (&Title,Txt_Results_of_match_X,Match.Title) < 0) if (asprintf (&Title,Txt_Results_of_match_X,Match.Title) < 0)
@ -360,7 +360,7 @@ void MchRes_ShowAllMchResultsInGam (void)
/***** Game begin *****/ /***** Game begin *****/
Gam_ShowOnlyOneGameBegin (&Games, Gam_ShowOnlyOneGameBegin (&Games,
false, // Do not list game questions false, // Do not list game questions
false); // Do not put form to start new match Frm_DONT_PUT_FORM);
/***** List matches results in game *****/ /***** List matches results in game *****/
if (asprintf (&Title,Txt_Results_of_game_X,Games.Game.Title) < 0) if (asprintf (&Title,Txt_Results_of_game_X,Games.Game.Title) < 0)
@ -432,7 +432,7 @@ void MchRes_ShowAllMchResultsInMch (void)
/***** Game begin *****/ /***** Game begin *****/
Gam_ShowOnlyOneGameBegin (&Games, Gam_ShowOnlyOneGameBegin (&Games,
false, // Do not list game questions false, // Do not list game questions
false); // Do not put form to start new match Frm_DONT_PUT_FORM);
/***** List matches results in match *****/ /***** List matches results in match *****/
if (asprintf (&Title,Txt_Results_of_match_X,Match.Title) < 0) if (asprintf (&Title,Txt_Results_of_match_X,Match.Title) < 0)

View File

@ -106,7 +106,7 @@ void Nam_NewShortAndFullNames (const char *Names[Nam_NUM_SHRT_FULL_NAMES])
void Nam_ExistingShortAndFullNames (const Act_Action_t ActionRename[Nam_NUM_SHRT_FULL_NAMES], void Nam_ExistingShortAndFullNames (const Act_Action_t ActionRename[Nam_NUM_SHRT_FULL_NAMES],
ParCod_Param_t ParCod,long Cod, ParCod_Param_t ParCod,long Cod,
const char *Names[Nam_NUM_SHRT_FULL_NAMES], const char *Names[Nam_NUM_SHRT_FULL_NAMES],
bool PutForm) Frm_PutForm_t PutForm)
{ {
Nam_ShrtOrFullName_t ShrtOrFull; Nam_ShrtOrFullName_t ShrtOrFull;
@ -115,19 +115,22 @@ void Nam_ExistingShortAndFullNames (const Act_Action_t ActionRename[Nam_NUM_SHRT
ShrtOrFull++) ShrtOrFull++)
{ {
HTM_TD_Begin ("class=\"LM DAT_%s\"",The_GetSuffix ()); HTM_TD_Begin ("class=\"LM DAT_%s\"",The_GetSuffix ());
if (PutForm) switch (PutForm)
{ {
Frm_BeginForm (ActionRename[ShrtOrFull]); case Frm_DONT_PUT_FORM:
ParCod_PutPar (ParCod,Cod); HTM_Txt (Names[ShrtOrFull]);
HTM_INPUT_TEXT (Nam_Params[ShrtOrFull],Nam_MaxChars[ShrtOrFull], break;
Names[ShrtOrFull], case Frm_PUT_FORM:
HTM_SUBMIT_ON_CHANGE, Frm_BeginForm (ActionRename[ShrtOrFull]);
"class=\"%s INPUT_%s\" required=\"required\"", ParCod_PutPar (ParCod,Cod);
Nam_Classes[ShrtOrFull],The_GetSuffix ()); HTM_INPUT_TEXT (Nam_Params[ShrtOrFull],Nam_MaxChars[ShrtOrFull],
Frm_EndForm (); Names[ShrtOrFull],
} HTM_SUBMIT_ON_CHANGE,
else "class=\"%s INPUT_%s\" required=\"required\"",
HTM_Txt (Names[ShrtOrFull]); Nam_Classes[ShrtOrFull],The_GetSuffix ());
Frm_EndForm ();
break;
}
HTM_TD_End (); HTM_TD_End ();
} }
} }

View File

@ -28,6 +28,7 @@
/*****************************************************************************/ /*****************************************************************************/
#include "swad_action.h" #include "swad_action.h"
#include "swad_form.h"
#include "swad_parameter_code.h" #include "swad_parameter_code.h"
#include "swad_string.h" #include "swad_string.h"
@ -64,7 +65,7 @@ void Nam_NewShortAndFullNames (const char *Names[Nam_NUM_SHRT_FULL_NAMES]);
void Nam_ExistingShortAndFullNames (const Act_Action_t ActionRename[Nam_NUM_SHRT_FULL_NAMES], void Nam_ExistingShortAndFullNames (const Act_Action_t ActionRename[Nam_NUM_SHRT_FULL_NAMES],
ParCod_Param_t ParCod,long Cod, ParCod_Param_t ParCod,long Cod,
const char *Names[Nam_NUM_SHRT_FULL_NAMES], const char *Names[Nam_NUM_SHRT_FULL_NAMES],
bool PutForm); Frm_PutForm_t PutForm);
bool Nam_CheckIfNameExists (bool (*FuncToCheck) (const char *FldName,const char *Name, bool Nam_CheckIfNameExists (bool (*FuncToCheck) (const char *FldName,const char *Name,
long Cod,long PrtCod,unsigned Year), long Cod,long PrtCod,unsigned Year),

View File

@ -109,8 +109,6 @@ typedef enum
Ntf_STATUS_EMAIL_SENT = 3, // --11 (Status & Ntf_STATUS_BIT_EMAIL) && (Status & Ntf_STATUS_BIT_SENT) Ntf_STATUS_EMAIL_SENT = 3, // --11 (Status & Ntf_STATUS_BIT_EMAIL) && (Status & Ntf_STATUS_BIT_SENT)
} Ntf_StatusTxt_t; } Ntf_StatusTxt_t;
#define Ntf_NUM_GET_CONTENT 2
typedef enum typedef enum
{ {
Ntf_DONT_GET_CONTENT = 0, Ntf_DONT_GET_CONTENT = 0,

View File

@ -407,7 +407,7 @@ static void PrgRsc_WriteRowViewResource (unsigned NumRsc,
The_GetSuffix (),The_GetColorRows1 (1)); The_GetSuffix (),The_GetColorRows1 (1));
HTM_Txt (Item->Resource.Title); HTM_Txt (Item->Resource.Title);
HTM_BR (); HTM_BR ();
Rsc_WriteLinkName (&Item->Resource.Link,Frm_PUT_FORM_TO_GO); Rsc_WriteLinkName (&Item->Resource.Link,Frm_PUT_FORM);
HTM_TD_End (); HTM_TD_End ();
/***** End row *****/ /***** End row *****/
@ -456,7 +456,7 @@ static void PrgRsc_WriteRowEditResource (unsigned NumRsc,unsigned NumResources,
{ {
case Vie_VIEW: case Vie_VIEW:
/* Show current link */ /* Show current link */
Rsc_WriteLinkName (&Item->Resource.Link,Frm_PUT_FORM_TO_GO); Rsc_WriteLinkName (&Item->Resource.Link,Frm_PUT_FORM);
break; break;
case Vie_EDIT: case Vie_EDIT:
/* Show clipboard to change resource link */ /* Show clipboard to change resource link */

View File

@ -1692,7 +1692,7 @@ static void Prj_ShowReviewStatus (struct Prj_Projects *Projects,
extern const char *Txt_PROJECT_REVIEW_SINGUL[Prj_NUM_REVIEW_STATUS]; extern const char *Txt_PROJECT_REVIEW_SINGUL[Prj_NUM_REVIEW_STATUS];
extern const char *Txt_Comments; extern const char *Txt_Comments;
extern const char *Txt_Save_changes; extern const char *Txt_Save_changes;
bool PutForm; Frm_PutForm_t PutForm;
static unsigned UniqueId = 0; static unsigned UniqueId = 0;
char *Id; char *Id;
@ -1700,10 +1700,11 @@ static void Prj_ShowReviewStatus (struct Prj_Projects *Projects,
switch (Projects->View) switch (Projects->View)
{ {
case Prj_PRINT_ONE_PROJECT: case Prj_PRINT_ONE_PROJECT:
PutForm = false; PutForm = Frm_DONT_PUT_FORM;
break; break;
default: default:
PutForm = Prj_CheckIfICanReviewProjects (); PutForm = Prj_CheckIfICanReviewProjects () ? Frm_PUT_FORM :
Frm_DONT_PUT_FORM;
break; break;
} }
@ -1735,17 +1736,20 @@ static void Prj_ShowReviewStatus (struct Prj_Projects *Projects,
break; break;
} }
if (PutForm) switch (PutForm)
{ {
/***** Begin form to change review status and text *****/ case Frm_DONT_PUT_FORM:
Frm_BeginFormAnchor (ActChgPrjRev,Anchor); HTM_Txt (Txt_PROJECT_REVIEW_SINGUL[Projects->Prj.Review.Status]);
Prj_PutCurrentPars (Projects); break;
case Frm_PUT_FORM:
/***** Begin form to change review status and text *****/
Frm_BeginFormAnchor (ActChgPrjRev,Anchor);
Prj_PutCurrentPars (Projects);
/***** Selector to change review status *****/ /***** Selector to change review status *****/
Prj_PutSelectorReviewStatus (Projects); Prj_PutSelectorReviewStatus (Projects);
break;
} }
else
HTM_Txt (Txt_PROJECT_REVIEW_SINGUL[Projects->Prj.Review.Status]);
HTM_NBSP (); HTM_NBSP ();
Ico_PutIconOff (ReviewIcon[Projects->Prj.Review.Status].Icon, Ico_PutIconOff (ReviewIcon[Projects->Prj.Review.Status].Icon,
@ -1776,47 +1780,51 @@ static void Prj_ShowReviewStatus (struct Prj_Projects *Projects,
Prj_PutWarningIcon (); Prj_PutWarningIcon ();
/***** Revision text *****/ /***** Revision text *****/
if (PutForm) switch (PutForm)
{ {
/* Show text form */ case Frm_DONT_PUT_FORM:
HTM_BR (); if (Projects->Prj.Review.Txt[0])
HTM_TEXTAREA_Begin ("name=\"ReviewTxt\" rows=\"1\"" {
" class=\"TITLE_DESCRIPTION_WIDTH INPUT_%s\"" /* Change text format */
" placeholder=\"%s&hellip;\"" Str_ChangeFormat (Str_FROM_HTML,Str_TO_RIGOROUS_HTML,
" onchange=\"unhideElement('prj_rev_%ld');return false;\"", Projects->Prj.Review.Txt,Cns_MAX_BYTES_TEXT,
The_GetSuffix (),Txt_Comments, Str_DONT_REMOVE_SPACES);
Projects->Prj.PrjCod); switch (Projects->View)
{
case Prj_PRINT_ONE_PROJECT:
break;
default:
ALn_InsertLinks (Projects->Prj.Review.Txt,Cns_MAX_BYTES_TEXT,60); // Insert links
break;
}
/* Show text */
HTM_BR ();
HTM_Txt (Projects->Prj.Review.Txt); HTM_Txt (Projects->Prj.Review.Txt);
HTM_TEXTAREA_End (); }
break;
case Frm_PUT_FORM:
/* Show text form */
HTM_BR ();
HTM_TEXTAREA_Begin ("name=\"ReviewTxt\" rows=\"1\""
" class=\"TITLE_DESCRIPTION_WIDTH INPUT_%s\""
" placeholder=\"%s&hellip;\""
" onchange=\"unhideElement('prj_rev_%ld');return false;\"",
The_GetSuffix (),Txt_Comments,
Projects->Prj.PrjCod);
HTM_Txt (Projects->Prj.Review.Txt);
HTM_TEXTAREA_End ();
/* Button to save changes. /* Button to save changes.
Initially hidden, is shown when clicking on selector or text */ Initially hidden, is shown when clicking on selector or text */
HTM_DIV_Begin ("id=\"prj_rev_%ld\" style=\"display:none;\"", HTM_DIV_Begin ("id=\"prj_rev_%ld\" style=\"display:none;\"",
Projects->Prj.PrjCod); Projects->Prj.PrjCod);
Btn_PutConfirmButtonInline (Txt_Save_changes); Btn_PutConfirmButtonInline (Txt_Save_changes);
HTM_DIV_End (); HTM_DIV_End ();
/* End form */ /* End form */
Frm_EndForm (); Frm_EndForm ();
} break;
else if (Projects->Prj.Review.Txt[0])
{
/* Change text format */
Str_ChangeFormat (Str_FROM_HTML,Str_TO_RIGOROUS_HTML,
Projects->Prj.Review.Txt,Cns_MAX_BYTES_TEXT,
Str_DONT_REMOVE_SPACES);
switch (Projects->View)
{
case Prj_PRINT_ONE_PROJECT:
break;
default:
ALn_InsertLinks (Projects->Prj.Review.Txt,Cns_MAX_BYTES_TEXT,60); // Insert links
break;
}
/* Show text */
HTM_BR ();
HTM_Txt (Projects->Prj.Review.Txt);
} }
HTM_TD_End (); HTM_TD_End ();

View File

@ -1773,7 +1773,7 @@ void Qst_ShowFormEditOneQst (void)
{ {
extern const char *Txt_Question_removed; extern const char *Txt_Question_removed;
struct Qst_Question Question; struct Qst_Question Question;
bool PutFormToEditQuestion; Frm_PutForm_t PutFormToEditQuestion;
/***** Create test question *****/ /***** Create test question *****/
Qst_QstConstructor (&Question); Qst_QstConstructor (&Question);
@ -1781,15 +1781,21 @@ void Qst_ShowFormEditOneQst (void)
/***** Get question data *****/ /***** Get question data *****/
Question.QstCod = ParCod_GetPar (ParCod_Qst); Question.QstCod = ParCod_GetPar (ParCod_Qst);
if (Question.QstCod <= 0) // New question if (Question.QstCod <= 0) // New question
PutFormToEditQuestion = true; PutFormToEditQuestion = Frm_PUT_FORM;
else else
PutFormToEditQuestion = Qst_GetQstDataByCod (&Question); PutFormToEditQuestion = Qst_GetQstDataByCod (&Question) ? Frm_PUT_FORM :
Frm_DONT_PUT_FORM;
/***** Put form to edit question *****/ /***** Put form to edit question *****/
if (PutFormToEditQuestion) switch (PutFormToEditQuestion)
Qst_PutFormEditOneQst (&Question); {
else case Frm_DONT_PUT_FORM:
Ale_ShowAlert (Ale_WARNING,Txt_Question_removed); Ale_ShowAlert (Ale_WARNING,Txt_Question_removed);
break;
case Frm_PUT_FORM:
Qst_PutFormEditOneQst (&Question);
break;
}
/***** Destroy test question *****/ /***** Destroy test question *****/
Qst_QstDestructor (&Question); Qst_QstDestructor (&Question);

View File

@ -136,10 +136,12 @@ static void Rec_PutParsStdResults (__attribute__((unused)) void *Args);
static void Rec_PutParsWorks (__attribute__((unused)) void *Args); static void Rec_PutParsWorks (__attribute__((unused)) void *Args);
static void Rec_PutParsStudent (__attribute__((unused)) void *Args); static void Rec_PutParsStudent (__attribute__((unused)) void *Args);
static void Rec_PutParsMsgUsr (__attribute__((unused)) void *Args); static void Rec_PutParsMsgUsr (__attribute__((unused)) void *Args);
static void Rec_ShowInstitutionInHead (struct Hie_Node *Ins,bool PutFormLinks); static void Rec_ShowInstitutionInHead (struct Hie_Node *Ins,
Frm_PutForm_t PutFormLinks);
static void Rec_ShowPhoto (struct Usr_Data *UsrDat); static void Rec_ShowPhoto (struct Usr_Data *UsrDat);
static void Rec_ShowFullName (struct Usr_Data *UsrDat); static void Rec_ShowFullName (struct Usr_Data *UsrDat);
static void Rec_ShowNickname (struct Usr_Data *UsrDat,bool PutFormLinks); static void Rec_ShowNickname (struct Usr_Data *UsrDat,
Frm_PutForm_t PutFormLinks);
static void Rec_ShowCountryInHead (struct Usr_Data *UsrDat,bool ShowData); static void Rec_ShowCountryInHead (struct Usr_Data *UsrDat,bool ShowData);
static void Rec_ShowWebsAndSocialNets (struct Usr_Data *UsrDat, static void Rec_ShowWebsAndSocialNets (struct Usr_Data *UsrDat,
Rec_SharedRecordViewType_t TypeOfView); Rec_SharedRecordViewType_t TypeOfView);
@ -2031,7 +2033,7 @@ void Rec_ShowSharedUsrRecord (Rec_SharedRecordViewType_t TypeOfView,
bool IAmLoggedAsTeacherOrSysAdm; bool IAmLoggedAsTeacherOrSysAdm;
bool CountryForm; bool CountryForm;
Vie_ViewType_t ViewType; Vie_ViewType_t ViewType;
bool PutFormLinks; // Put links (forms) inside record card Frm_PutForm_t PutFormLinks; // Put links (forms) inside record card
bool ShowData; bool ShowData;
bool ShowIDRows; bool ShowIDRows;
bool ShowAddressRows; bool ShowAddressRows;
@ -2084,8 +2086,9 @@ void Rec_ShowSharedUsrRecord (Rec_SharedRecordViewType_t TypeOfView,
Rec_RecordHelp[Rec_SHA_RECORD_LIST] = Rec_RecordListHelp[UsrDat->Roles.InCurrentCrs]; Rec_RecordHelp[Rec_SHA_RECORD_LIST] = Rec_RecordListHelp[UsrDat->Roles.InCurrentCrs];
PutFormLinks = !Frm_CheckIfInside () && // Only if not inside another form PutFormLinks = (!Frm_CheckIfInside () && // Only if not inside another form
Act_GetBrowserTab (Gbl.Action.Act) == Act_BRW_1ST_TAB; // Only in main browser tab Act_GetBrowserTab (Gbl.Action.Act) == Act_BRW_1ST_TAB) ? Frm_PUT_FORM : // Only in main browser tab
Frm_DONT_PUT_FORM;
Ins.HieCod = UsrDat->InsCod; Ins.HieCod = UsrDat->InsCod;
if (Ins.HieCod > 0) if (Ins.HieCod > 0)
@ -2523,14 +2526,15 @@ static void Rec_PutParsMsgUsr (__attribute__((unused)) void *Args)
/*********************** Show institution in record card *********************/ /*********************** Show institution in record card *********************/
/*****************************************************************************/ /*****************************************************************************/
static void Rec_ShowInstitutionInHead (struct Hie_Node *Ins,bool PutFormLinks) static void Rec_ShowInstitutionInHead (struct Hie_Node *Ins,
Frm_PutForm_t PutFormLinks)
{ {
/***** Institution logo *****/ /***** Institution logo *****/
HTM_TD_Begin ("rowspan=\"4\" class=\"REC_C1_TOP CM\""); HTM_TD_Begin ("rowspan=\"4\" class=\"REC_C1_TOP CM\"");
if (Ins->HieCod > 0) if (Ins->HieCod > 0)
{ {
/* Form to go to the institution */ /* Form to go to the institution */
if (PutFormLinks) if (PutFormLinks == Frm_PUT_FORM)
{ {
Frm_BeginFormGoTo (ActSeeInsInf); Frm_BeginFormGoTo (ActSeeInsInf);
ParCod_PutPar (ParCod_Ins,Ins->HieCod); ParCod_PutPar (ParCod_Ins,Ins->HieCod);
@ -2540,7 +2544,7 @@ static void Rec_ShowInstitutionInHead (struct Hie_Node *Ins,bool PutFormLinks)
Ins->HieCod, Ins->HieCod,
Ins->ShrtName, Ins->ShrtName,
Rec_INSTITUTION_LOGO_SIZE,NULL); Rec_INSTITUTION_LOGO_SIZE,NULL);
if (PutFormLinks) if (PutFormLinks == Frm_PUT_FORM)
{ {
HTM_BUTTON_End (); HTM_BUTTON_End ();
Frm_EndForm (); Frm_EndForm ();
@ -2553,14 +2557,14 @@ static void Rec_ShowInstitutionInHead (struct Hie_Node *Ins,bool PutFormLinks)
if (Ins->HieCod > 0) if (Ins->HieCod > 0)
{ {
/* Form to go to the institution */ /* Form to go to the institution */
if (PutFormLinks) if (PutFormLinks == Frm_PUT_FORM)
{ {
Frm_BeginFormGoTo (ActSeeInsInf); Frm_BeginFormGoTo (ActSeeInsInf);
ParCod_PutPar (ParCod_Ins,Ins->HieCod); ParCod_PutPar (ParCod_Ins,Ins->HieCod);
HTM_BUTTON_Submit_Begin (Ins->FullName,"class=\"BT_LINK\""); HTM_BUTTON_Submit_Begin (Ins->FullName,"class=\"BT_LINK\"");
} }
HTM_Txt (Ins->FullName); HTM_Txt (Ins->FullName);
if (PutFormLinks) if (PutFormLinks == Frm_PUT_FORM)
{ {
HTM_BUTTON_End (); HTM_BUTTON_End ();
Frm_EndForm (); Frm_EndForm ();
@ -2618,7 +2622,8 @@ static void Rec_ShowFullName (struct Usr_Data *UsrDat)
/*************************** Show user's nickname ****************************/ /*************************** Show user's nickname ****************************/
/*****************************************************************************/ /*****************************************************************************/
static void Rec_ShowNickname (struct Usr_Data *UsrDat,bool PutFormLinks) static void Rec_ShowNickname (struct Usr_Data *UsrDat,
Frm_PutForm_t PutFormLinks)
{ {
extern const char *Txt_My_public_profile; extern const char *Txt_My_public_profile;
extern const char *Txt_Another_user_s_profile; extern const char *Txt_Another_user_s_profile;
@ -2632,7 +2637,7 @@ static void Rec_ShowNickname (struct Usr_Data *UsrDat,bool PutFormLinks)
HTM_DIV_Begin ("class=\"REC_NICK\""); HTM_DIV_Begin ("class=\"REC_NICK\"");
if (UsrDat->Nickname[0]) if (UsrDat->Nickname[0])
{ {
if (PutFormLinks) if (PutFormLinks == Frm_PUT_FORM)
{ {
/* Put form to go to public profile */ /* Put form to go to public profile */
Frm_BeginForm (ActSeeOthPubPrf); Frm_BeginForm (ActSeeOthPubPrf);
@ -2641,7 +2646,7 @@ static void Rec_ShowNickname (struct Usr_Data *UsrDat,bool PutFormLinks)
"class=\"BT_LINK\""); "class=\"BT_LINK\"");
} }
HTM_TxtF ("@%s",UsrDat->Nickname); HTM_TxtF ("@%s",UsrDat->Nickname);
if (PutFormLinks) if (PutFormLinks == Frm_PUT_FORM)
{ {
HTM_BUTTON_End (); HTM_BUTTON_End ();
Frm_EndForm (); Frm_EndForm ();

View File

@ -129,7 +129,7 @@ void Rsc_ShowClipboard (void)
{ {
Rsc_GetLinkDataFromRow (mysql_res,&Link); Rsc_GetLinkDataFromRow (mysql_res,&Link);
HTM_LI_Begin ("class=\"PRG_RSC_%s\"",The_GetSuffix ()); HTM_LI_Begin ("class=\"PRG_RSC_%s\"",The_GetSuffix ());
Rsc_WriteLinkName (&Link,Frm_PUT_FORM_TO_GO); Rsc_WriteLinkName (&Link,Frm_PUT_FORM);
HTM_LI_End (); HTM_LI_End ();
} }
DB_FreeMySQLResult (&mysql_res); DB_FreeMySQLResult (&mysql_res);
@ -213,7 +213,7 @@ void Rsc_WriteRowClipboard (const struct Rsc_Link *Link,
""); "");
/***** Name *****/ /***** Name *****/
Rsc_WriteLinkName (Link,Frm_DONT_PUT_FORM_TO_GO); Rsc_WriteLinkName (Link,Frm_DONT_PUT_FORM);
HTM_LABEL_End (); HTM_LABEL_End ();
@ -225,7 +225,7 @@ void Rsc_WriteRowClipboard (const struct Rsc_Link *Link,
/************* Write link name (filename, assignment title...) ***************/ /************* Write link name (filename, assignment title...) ***************/
/*****************************************************************************/ /*****************************************************************************/
void Rsc_WriteLinkName (const struct Rsc_Link *Link,Frm_PutFormToGo_t PutFormToGo) void Rsc_WriteLinkName (const struct Rsc_Link *Link,Frm_PutForm_t PutFormToGo)
{ {
extern const char *Txt_Actions[ActLst_NUM_ACTIONS]; extern const char *Txt_Actions[ActLst_NUM_ACTIONS];
extern const char *Rsc_ResourceTypesIcons[Rsc_NUM_TYPES]; extern const char *Rsc_ResourceTypesIcons[Rsc_NUM_TYPES];
@ -293,13 +293,13 @@ void Rsc_WriteLinkName (const struct Rsc_Link *Link,Frm_PutFormToGo_t PutFormToG
/***** Put icon and title of resource *****/ /***** Put icon and title of resource *****/
switch (PutFormToGo) switch (PutFormToGo)
{ {
case Frm_DONT_PUT_FORM_TO_GO: case Frm_DONT_PUT_FORM:
/* Icon and title of resource */ /* Icon and title of resource */
Ico_PutIconOn (Rsc_ResourceTypesIcons[Link->Type],Ico_BLACK, Ico_PutIconOn (Rsc_ResourceTypesIcons[Link->Type],Ico_BLACK,
Txt_RESOURCE_TYPES[Link->Type]); Txt_RESOURCE_TYPES[Link->Type]);
HTM_Txt (Title); HTM_Txt (Title);
break; break;
case Frm_PUT_FORM_TO_GO: case Frm_PUT_FORM:
/* Begin form to go to resource */ /* Begin form to go to resource */
NextAction = (Link->Cod > 0) ? NextActions[Link->Type].IfCod : // Resource specified NextAction = (Link->Cod > 0) ? NextActions[Link->Type].IfCod : // Resource specified
NextActions[Link->Type].IfNotCod; // All resources of this type NextActions[Link->Type].IfNotCod; // All resources of this type

View File

@ -78,7 +78,7 @@ void Rsc_ShowClipboard (void);
void Rsc_ShowClipboardToChangeLink (const struct Rsc_Link *CurrentLink); void Rsc_ShowClipboardToChangeLink (const struct Rsc_Link *CurrentLink);
void Rsc_WriteRowClipboard (const struct Rsc_Link *Link, void Rsc_WriteRowClipboard (const struct Rsc_Link *Link,
HTM_SubmitOnClick_t SubmitOnClick,bool Checked); HTM_SubmitOnClick_t SubmitOnClick,bool Checked);
void Rsc_WriteLinkName (const struct Rsc_Link *Link,Frm_PutFormToGo_t PutFormToGo); void Rsc_WriteLinkName (const struct Rsc_Link *Link,Frm_PutForm_t PutFormToGo);
void Rsc_GetResourceTitleFromLink (const struct Rsc_Link *Link, void Rsc_GetResourceTitleFromLink (const struct Rsc_Link *Link,
char Title[Rsc_MAX_BYTES_RESOURCE_TITLE + 1]); char Title[Rsc_MAX_BYTES_RESOURCE_TITLE + 1]);

View File

@ -963,7 +963,7 @@ static void RubCri_WriteTitle (const struct RubCri_Criterion *Criterion)
static void RubCri_WriteLink (const struct RubCri_Criterion *Criterion) static void RubCri_WriteLink (const struct RubCri_Criterion *Criterion)
{ {
HTM_TD_Begin ("class=\"LT DAT_%s %s\"",The_GetSuffix (),The_GetColorRows ()); HTM_TD_Begin ("class=\"LT DAT_%s %s\"",The_GetSuffix (),The_GetColorRows ());
Rsc_WriteLinkName (&Criterion->Link,Frm_DONT_PUT_FORM_TO_GO); Rsc_WriteLinkName (&Criterion->Link,Frm_DONT_PUT_FORM);
HTM_TD_End (); HTM_TD_End ();
} }

View File

@ -123,10 +123,10 @@ static void Svy_PutIconToAddNewQuestion (void *Surveys);
static void Svy_WriteQstStem (const char *Stem); static void Svy_WriteQstStem (const char *Stem);
static void Svy_WriteAnswersOfAQst (struct Svy_Survey *Svy, static void Svy_WriteAnswersOfAQst (struct Svy_Survey *Svy,
struct Svy_Question *SvyQst, struct Svy_Question *SvyQst,
bool PutFormAnswerSurvey); Frm_PutForm_t PutFormAnswerSurvey);
static void Svy_WriteCommentsOfAQst (struct Svy_Survey *Svy, static void Svy_WriteCommentsOfAQst (struct Svy_Survey *Svy,
struct Svy_Question *SvyQst, struct Svy_Question *SvyQst,
bool PutFormAnswerSurvey); Frm_PutForm_t PutFormAnswerSurvey);
static void Svy_DrawBarNumUsrs (unsigned NumUsrs,unsigned MaxUsrs); static void Svy_DrawBarNumUsrs (unsigned NumUsrs,unsigned MaxUsrs);
static void Svy_PutIconToRemoveOneQst (void *Surveys); static void Svy_PutIconToRemoveOneQst (void *Surveys);
@ -2604,7 +2604,9 @@ static void Svy_ListSvyQuestions (struct Svy_Surveys *Surveys)
Gbl.Action.Act == ActEdiOneSvyQst || Gbl.Action.Act == ActEdiOneSvyQst ||
Gbl.Action.Act == ActNewSvyQst || Gbl.Action.Act == ActNewSvyQst ||
Gbl.Action.Act == ActChgSvyQst); Gbl.Action.Act == ActChgSvyQst);
bool PutFormAnswerSurvey = Surveys->Svy.Status.ICanAnswer && !Editing; Frm_PutForm_t PutFormAnswerSurvey = (Surveys->Svy.Status.ICanAnswer &&
!Editing) ? Frm_PUT_FORM :
Frm_DONT_PUT_FORM;
/***** Begin box *****/ /***** Begin box *****/
if (Surveys->Svy.Status.ICanEdit) if (Surveys->Svy.Status.ICanEdit)
@ -2619,7 +2621,7 @@ static void Svy_ListSvyQuestions (struct Svy_Surveys *Surveys)
/***** Get data of questions from database *****/ /***** Get data of questions from database *****/
if ((NumQsts = Svy_DB_GetSurveyQsts (&mysql_res,Surveys->Svy.SvyCod))) if ((NumQsts = Svy_DB_GetSurveyQsts (&mysql_res,Surveys->Svy.SvyCod)))
{ {
if (PutFormAnswerSurvey) if (PutFormAnswerSurvey == Frm_PUT_FORM)
{ {
/***** Begin form to send answers to survey *****/ /***** Begin form to send answers to survey *****/
Frm_BeginForm (ActAnsSvy); Frm_BeginForm (ActAnsSvy);
@ -2687,9 +2689,11 @@ static void Svy_ListSvyQuestions (struct Svy_Surveys *Surveys)
The_GetSuffix (), The_GetSuffix (),
The_GetColorRows ()); The_GetColorRows ());
Svy_WriteQstStem (Stem); Svy_WriteQstStem (Stem);
Svy_WriteAnswersOfAQst (&Surveys->Svy,&SvyQst,PutFormAnswerSurvey); Svy_WriteAnswersOfAQst (&Surveys->Svy,&SvyQst,
PutFormAnswerSurvey);
if (SvyQst.CommentsAllowed) if (SvyQst.CommentsAllowed)
Svy_WriteCommentsOfAQst (&Surveys->Svy,&SvyQst,PutFormAnswerSurvey); Svy_WriteCommentsOfAQst (&Surveys->Svy,&SvyQst,
PutFormAnswerSurvey);
HTM_TD_End (); HTM_TD_End ();
@ -2698,7 +2702,7 @@ static void Svy_ListSvyQuestions (struct Svy_Surveys *Surveys)
HTM_TABLE_End (); HTM_TABLE_End ();
if (PutFormAnswerSurvey) if (PutFormAnswerSurvey == Frm_PUT_FORM)
{ {
/***** Button to create/modify survey *****/ /***** Button to create/modify survey *****/
Btn_PutConfirmButton (Txt_Done); Btn_PutConfirmButton (Txt_Done);
@ -2799,7 +2803,7 @@ static void Svy_WriteQstStem (const char *Stem)
static void Svy_WriteAnswersOfAQst (struct Svy_Survey *Svy, static void Svy_WriteAnswersOfAQst (struct Svy_Survey *Svy,
struct Svy_Question *SvyQst, struct Svy_Question *SvyQst,
bool PutFormAnswerSurvey) Frm_PutForm_t PutFormAnswerSurvey)
{ {
unsigned NumAnswers; unsigned NumAnswers;
unsigned NumAns; unsigned NumAns;
@ -2844,7 +2848,7 @@ static void Svy_WriteAnswersOfAQst (struct Svy_Survey *Svy,
/* Selectors and label with the letter of the answer */ /* Selectors and label with the letter of the answer */
HTM_TR_Begin (NULL); HTM_TR_Begin (NULL);
if (PutFormAnswerSurvey) if (PutFormAnswerSurvey == Frm_PUT_FORM)
{ {
/* Write selector to choice this answer */ /* Write selector to choice this answer */
HTM_TD_Begin ("class=\"LT\""); HTM_TD_Begin ("class=\"LT\"");
@ -2913,7 +2917,7 @@ static void Svy_WriteAnswersOfAQst (struct Svy_Survey *Svy,
static void Svy_WriteCommentsOfAQst (struct Svy_Survey *Svy, static void Svy_WriteCommentsOfAQst (struct Svy_Survey *Svy,
struct Svy_Question *SvyQst, struct Svy_Question *SvyQst,
bool PutFormAnswerSurvey) Frm_PutForm_t PutFormAnswerSurvey)
{ {
extern const char *Txt_Comments; extern const char *Txt_Comments;
unsigned NumComments; unsigned NumComments;
@ -2921,56 +2925,60 @@ static void Svy_WriteCommentsOfAQst (struct Svy_Survey *Svy,
MYSQL_RES *mysql_res; MYSQL_RES *mysql_res;
MYSQL_ROW row; MYSQL_ROW row;
if (PutFormAnswerSurvey) switch (PutFormAnswerSurvey)
{ {
HTM_TEXTAREA_Begin ("name=\"Com%010u\"" case Frm_DONT_PUT_FORM:
" cols=\"60\" rows=\"4\"" if (Svy->Status.ICanViewComments)
" class=\"INPUT_%s\"" {
" placeholder=\"%s&hellip;\"", HTM_DL_Begin ();
(unsigned) SvyQst->QstCod,
The_GetSuffix (),
Txt_Comments);
HTM_TEXTAREA_End ();
}
else if (Svy->Status.ICanViewComments)
{
HTM_DL_Begin ();
HTM_DT_Begin (); HTM_DT_Begin ();
HTM_TxtColon (Txt_Comments); HTM_TxtColon (Txt_Comments);
HTM_DT_End (); HTM_DT_End ();
HTM_DD_Begin (); HTM_DD_Begin ();
/***** Get comments of this question *****/ /***** Get comments of this question *****/
NumComments = Svy_DB_GetCommentsQst (&mysql_res,SvyQst->QstCod); NumComments = Svy_DB_GetCommentsQst (&mysql_res,SvyQst->QstCod);
/***** Write the answers *****/ /***** Write the answers *****/
if (NumComments) if (NumComments)
{
HTM_OL_Begin ();
/* Write one row for each user who has commented */
for (NumCom = 0;
NumCom < NumComments;
NumCom++)
{ {
row = mysql_fetch_row (mysql_res); HTM_OL_Begin ();
HTM_LI_Begin (NULL); /* Write one row for each user who has commented */
HTM_Txt (row[0]); for (NumCom = 0;
HTM_LI_End (); NumCom < NumComments;
NumCom++)
{
row = mysql_fetch_row (mysql_res);
HTM_LI_Begin (NULL);
HTM_Txt (row[0]);
HTM_LI_End ();
}
HTM_OL_End ();
} }
HTM_OL_End (); /***** Free structure that stores the query result *****/
} DB_FreeMySQLResult (&mysql_res);
/***** Free structure that stores the query result *****/ HTM_DD_End ();
DB_FreeMySQLResult (&mysql_res);
HTM_DD_End (); HTM_DL_End ();
}
HTM_DL_End (); break;
case Frm_PUT_FORM:
HTM_TEXTAREA_Begin ("name=\"Com%010u\""
" cols=\"60\" rows=\"4\""
" class=\"INPUT_%s\""
" placeholder=\"%s&hellip;\"",
(unsigned) SvyQst->QstCod,
The_GetSuffix (),
Txt_Comments);
HTM_TEXTAREA_End ();
break;
} }
} }

View File

@ -228,8 +228,8 @@ static void Usr_ListRowsAllDataTchs (Rol_Role_t Role,
static void Usr_PutLinkToSeeAdmins (void); static void Usr_PutLinkToSeeAdmins (void);
static void Usr_PutLinkToSeeGuests (void); static void Usr_PutLinkToSeeGuests (void);
static bool Usr_SetOptionsListUsrsAllowed (Rol_Role_t UsrsRole, static Frm_PutForm_t Usr_SetOptionsListUsrsAllowed (Rol_Role_t UsrsRole,
bool ICanChooseOption[Usr_LIST_USRS_NUM_OPTIONS]); bool ICanChooseOption[Usr_LIST_USRS_NUM_OPTIONS]);
static void Usr_PutOptionsListUsrs (const bool ICanChooseOption[Usr_LIST_USRS_NUM_OPTIONS]); static void Usr_PutOptionsListUsrs (const bool ICanChooseOption[Usr_LIST_USRS_NUM_OPTIONS]);
static void Usr_ShowOneListUsrsOption (Usr_ListUsrsOption_t ListUsrsAction, static void Usr_ShowOneListUsrsOption (Usr_ListUsrsOption_t ListUsrsAction,
const char *Label); const char *Label);
@ -1613,12 +1613,12 @@ void Usr_ChkUsrAndGetUsrData (void)
extern const char *Txt_The_session_has_expired; extern const char *Txt_The_session_has_expired;
struct struct
{ {
bool PutForm; Frm_PutForm_t PutForm;
Act_Action_t Action; Act_Action_t Action;
void (*FuncPars) (void); void (*FuncPars) (void);
} FormLogin = } FormLogin =
{ {
false, Frm_DONT_PUT_FORM,
ActLogIn, ActLogIn,
NULL NULL
}; };
@ -1631,7 +1631,7 @@ void Usr_ChkUsrAndGetUsrData (void)
Gbl.Action.Act = ActLogOut; Gbl.Action.Act = ActLogOut;
Tab_SetCurrentTab (); Tab_SetCurrentTab ();
Ale_ShowAlert (Ale_WARNING,Txt_The_session_has_expired); Ale_ShowAlert (Ale_WARNING,Txt_The_session_has_expired);
FormLogin.PutForm = true; FormLogin.PutForm = Frm_PUT_FORM;
} }
} }
else // !Gbl.Session.HasBeenDisconnected else // !Gbl.Session.HasBeenDisconnected
@ -1677,7 +1677,7 @@ void Usr_ChkUsrAndGetUsrData (void)
} }
} }
else else
FormLogin.PutForm = true; FormLogin.PutForm = Frm_PUT_FORM;
} }
else if (Gbl.Action.Act == ActLogIn || else if (Gbl.Action.Act == ActLogIn ||
Gbl.Action.Act == ActLogInUsrAgd) // Login using @nickname, email or ID from form Gbl.Action.Act == ActLogInUsrAgd) // Login using @nickname, email or ID from form
@ -1694,7 +1694,7 @@ void Usr_ChkUsrAndGetUsrData (void)
} }
else else
{ {
FormLogin.PutForm = true; FormLogin.PutForm = Frm_PUT_FORM;
if (Gbl.Action.Act == ActLogInUsrAgd) if (Gbl.Action.Act == ActLogInUsrAgd)
{ {
FormLogin.Action = ActLogInUsrAgd; FormLogin.Action = ActLogInUsrAgd;
@ -1721,13 +1721,13 @@ void Usr_ChkUsrAndGetUsrData (void)
Set_SetSettingsFromIP (); // Set settings from current IP Set_SetSettingsFromIP (); // Set settings from current IP
} }
else else
FormLogin.PutForm = true; FormLogin.PutForm = Frm_PUT_FORM;
} }
} }
} }
/***** If session disconnected or error in login, show form to login *****/ /***** If session disconnected or error in login, show form to login *****/
if (FormLogin.PutForm) if (FormLogin.PutForm == Frm_PUT_FORM)
{ {
Usr_WriteFormLogin (FormLogin.Action,FormLogin.FuncPars); Usr_WriteFormLogin (FormLogin.Action,FormLogin.FuncPars);
Err_ShowErrorAndExit (NULL); Err_ShowErrorAndExit (NULL);
@ -3683,7 +3683,7 @@ void Usr_PutFormToSelectUsrsToGoToAct (struct Usr_SelectedUsrs *SelectedUsrs,
const char *Title, const char *Title,
const char *HelpLink, const char *HelpLink,
const char *TxtButton, const char *TxtButton,
bool PutFormDateRange) Frm_PutForm_t PutFormDateRange)
{ {
extern const char *Txt_Select_users; extern const char *Txt_Select_users;
extern const char *Txt_Users; extern const char *Txt_Users;
@ -3769,7 +3769,7 @@ void Usr_PutFormToSelectUsrsToGoToAct (struct Usr_SelectedUsrs *SelectedUsrs,
HTM_TR_End (); HTM_TR_End ();
/* Starting and ending dates in the search */ /* Starting and ending dates in the search */
if (PutFormDateRange) if (PutFormDateRange == Frm_PUT_FORM)
Dat_PutFormStartEndClientLocalDateTimesWithYesterdayToday (SetHMS); Dat_PutFormStartEndClientLocalDateTimesWithYesterdayToday (SetHMS);
HTM_TABLE_End (); HTM_TABLE_End ();
@ -5026,7 +5026,7 @@ void Usr_SeeGuests (void)
extern const char *Txt_ROLES_PLURAL_Abc[Rol_NUM_ROLES][Usr_NUM_SEXS]; extern const char *Txt_ROLES_PLURAL_Abc[Rol_NUM_ROLES][Usr_NUM_SEXS];
extern const char *Txt_Scope; extern const char *Txt_Scope;
bool ICanChooseOption[Usr_LIST_USRS_NUM_OPTIONS]; bool ICanChooseOption[Usr_LIST_USRS_NUM_OPTIONS];
bool PutForm; Frm_PutForm_t PutForm;
/***** Contextual menu *****/ /***** Contextual menu *****/
Mnu_ContextMenuBegin (); Mnu_ContextMenuBegin ();
@ -5085,10 +5085,11 @@ void Usr_SeeGuests (void)
Lay_WriteHeaderClassPhoto (Vie_VIEW); Lay_WriteHeaderClassPhoto (Vie_VIEW);
/* Set options allowed */ /* Set options allowed */
PutForm = Usr_SetOptionsListUsrsAllowed (Rol_GST,ICanChooseOption); PutForm = Usr_SetOptionsListUsrsAllowed (Rol_GST,ICanChooseOption) ? Frm_PUT_FORM :
Frm_DONT_PUT_FORM;
/* Begin form */ /* Begin form */
if (PutForm) if (PutForm == Frm_PUT_FORM)
Frm_BeginForm (ActDoActOnSevGst); Frm_BeginForm (ActDoActOnSevGst);
/* Begin table */ /* Begin table */
@ -5113,7 +5114,7 @@ void Usr_SeeGuests (void)
HTM_TABLE_End (); HTM_TABLE_End ();
/***** Which action, show records, follow...? *****/ /***** Which action, show records, follow...? *****/
if (PutForm) if (PutForm == Frm_PUT_FORM)
{ {
Usr_PutOptionsListUsrs (ICanChooseOption); Usr_PutOptionsListUsrs (ICanChooseOption);
Frm_EndForm (); Frm_EndForm ();
@ -5144,7 +5145,7 @@ void Usr_SeeStudents (void)
extern const char *Txt_ROLES_PLURAL_Abc[Rol_NUM_ROLES][Usr_NUM_SEXS]; extern const char *Txt_ROLES_PLURAL_Abc[Rol_NUM_ROLES][Usr_NUM_SEXS];
extern const char *Txt_Scope; extern const char *Txt_Scope;
bool ICanChooseOption[Usr_LIST_USRS_NUM_OPTIONS]; bool ICanChooseOption[Usr_LIST_USRS_NUM_OPTIONS];
bool PutForm; Frm_PutForm_t PutForm;
/***** Put contextual links *****/ /***** Put contextual links *****/
switch (Gbl.Usrs.Me.Role.Logged) switch (Gbl.Usrs.Me.Role.Logged)
@ -5235,10 +5236,11 @@ void Usr_SeeStudents (void)
Lay_WriteHeaderClassPhoto (Vie_VIEW); Lay_WriteHeaderClassPhoto (Vie_VIEW);
/* Set options allowed */ /* Set options allowed */
PutForm = Usr_SetOptionsListUsrsAllowed (Rol_STD,ICanChooseOption); PutForm = Usr_SetOptionsListUsrsAllowed (Rol_STD,ICanChooseOption) ? Frm_PUT_FORM :
Frm_DONT_PUT_FORM;
/* Begin form */ /* Begin form */
if (PutForm) if (PutForm == Frm_PUT_FORM)
{ {
Frm_BeginForm (ActDoActOnSevStd); Frm_BeginForm (ActDoActOnSevStd);
Grp_PutParsCodGrps (); Grp_PutParsCodGrps ();
@ -5266,7 +5268,7 @@ void Usr_SeeStudents (void)
HTM_TABLE_End (); HTM_TABLE_End ();
/***** Which action, show records, follow...? *****/ /***** Which action, show records, follow...? *****/
if (PutForm) if (PutForm == Frm_PUT_FORM)
{ {
Usr_PutOptionsListUsrs (ICanChooseOption); Usr_PutOptionsListUsrs (ICanChooseOption);
Frm_EndForm (); Frm_EndForm ();
@ -5301,7 +5303,7 @@ void Usr_SeeTeachers (void)
extern const char *Txt_Scope; extern const char *Txt_Scope;
unsigned NumUsrs; unsigned NumUsrs;
bool ICanChooseOption[Usr_LIST_USRS_NUM_OPTIONS]; bool ICanChooseOption[Usr_LIST_USRS_NUM_OPTIONS];
bool PutForm; Frm_PutForm_t PutForm;
/***** Put contextual links *****/ /***** Put contextual links *****/
switch (Gbl.Usrs.Me.Role.Logged) switch (Gbl.Usrs.Me.Role.Logged)
@ -5401,10 +5403,11 @@ void Usr_SeeTeachers (void)
Lay_WriteHeaderClassPhoto (Vie_VIEW); Lay_WriteHeaderClassPhoto (Vie_VIEW);
/* Set options allowed */ /* Set options allowed */
PutForm = Usr_SetOptionsListUsrsAllowed (Rol_TCH,ICanChooseOption); PutForm = Usr_SetOptionsListUsrsAllowed (Rol_TCH,ICanChooseOption) ? Frm_PUT_FORM :
Frm_DONT_PUT_FORM;
/* Begin form */ /* Begin form */
if (PutForm) if (PutForm == Frm_PUT_FORM)
{ {
Frm_BeginForm (ActDoActOnSevTch); Frm_BeginForm (ActDoActOnSevTch);
Grp_PutParsCodGrps (); Grp_PutParsCodGrps ();
@ -5443,7 +5446,7 @@ void Usr_SeeTeachers (void)
HTM_TABLE_End (); HTM_TABLE_End ();
/***** Which action, show records, follow...? *****/ /***** Which action, show records, follow...? *****/
if (PutForm) if (PutForm == Frm_PUT_FORM)
{ {
Usr_PutOptionsListUsrs (ICanChooseOption); Usr_PutOptionsListUsrs (ICanChooseOption);
Frm_EndForm (); Frm_EndForm ();
@ -5473,11 +5476,10 @@ void Usr_SeeTeachers (void)
/*****************************************************************************/ /*****************************************************************************/
// Returns true if any option is allowed // Returns true if any option is allowed
static bool Usr_SetOptionsListUsrsAllowed (Rol_Role_t UsrsRole, static Frm_PutForm_t Usr_SetOptionsListUsrsAllowed (Rol_Role_t UsrsRole,
bool ICanChooseOption[Usr_LIST_USRS_NUM_OPTIONS]) bool ICanChooseOption[Usr_LIST_USRS_NUM_OPTIONS])
{ {
Usr_ListUsrsOption_t Opt; Usr_ListUsrsOption_t Opt;
bool OptionsAllowed;
/***** Check which options I can choose *****/ /***** Check which options I can choose *****/
/* Set default (I can not choose options) */ /* Set default (I can not choose options) */
@ -5525,19 +5527,17 @@ static bool Usr_SetOptionsListUsrsAllowed (Rol_Role_t UsrsRole,
Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM)); Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM));
break; break;
default: default:
return false; return Frm_DONT_PUT_FORM;
} }
/***** Count allowed options *****/ /***** Count allowed options *****/
OptionsAllowed = false;
for (Opt = (Usr_ListUsrsOption_t) 1; // Skip unknown option for (Opt = (Usr_ListUsrsOption_t) 1; // Skip unknown option
!OptionsAllowed &&
Opt <= (Usr_ListUsrsOption_t) (Usr_LIST_USRS_NUM_OPTIONS - 1); Opt <= (Usr_ListUsrsOption_t) (Usr_LIST_USRS_NUM_OPTIONS - 1);
Opt++) Opt++)
if (ICanChooseOption[Opt]) if (ICanChooseOption[Opt])
OptionsAllowed = true; return Frm_PUT_FORM;
return OptionsAllowed; return Frm_DONT_PUT_FORM;
} }
/*****************************************************************************/ /*****************************************************************************/

View File

@ -403,7 +403,7 @@ void Usr_PutFormToSelectUsrsToGoToAct (struct Usr_SelectedUsrs *SelectedUsrs,
const char *Title, const char *Title,
const char *HelpLink, const char *HelpLink,
const char *TxtButton, const char *TxtButton,
bool PutFormDateRange); Frm_PutForm_t PutFormDateRange);
void Usr_GetSelectedUsrsAndGoToAct (struct Usr_SelectedUsrs *SelectedUsrs, void Usr_GetSelectedUsrsAndGoToAct (struct Usr_SelectedUsrs *SelectedUsrs,
void (*FuncWhenUsrsSelected) (void *ArgsSelected),void *ArgsSelected, void (*FuncWhenUsrsSelected) (void *ArgsSelected),void *ArgsSelected,
void (*FuncWhenNoUsrsSelected) (void *ArgsNoSelected),void *ArgsNoSelected); void (*FuncWhenNoUsrsSelected) (void *ArgsNoSelected),void *ArgsNoSelected);