Version 16.214

This commit is contained in:
Antonio Cañas Vargas 2017-05-11 21:53:37 +02:00
parent 2e2af1057a
commit adf84d306a
15 changed files with 152 additions and 186 deletions

View File

@ -1298,15 +1298,12 @@ void Agd_AskRemEvent (void)
Agd_GetDataOfEventByCod (&AgdEvent); Agd_GetDataOfEventByCod (&AgdEvent);
/***** Show question and button to remove event *****/ /***** Show question and button to remove event *****/
/* Start alert */ Gbl.Agenda.AgdCodToEdit = AgdEvent.AgdCod;
sprintf (Gbl.Alert.Txt,Txt_Do_you_really_want_to_remove_the_event_X, sprintf (Gbl.Alert.Txt,Txt_Do_you_really_want_to_remove_the_event_X,
AgdEvent.Event); AgdEvent.Event);
Lay_ShowAlertAndButton1 (Lay_QUESTION,Gbl.Alert.Txt); Lay_ShowAlertAndButton (Lay_QUESTION,Gbl.Alert.Txt,
ActRemEvtMyAgd,NULL,Agd_PutCurrentParamsMyAgenda,
/* End alert */ Lay_REMOVE_BUTTON,Txt_Remove_event);
Gbl.Agenda.AgdCodToEdit = AgdEvent.AgdCod;
Lay_ShowAlertAndButton2 (ActRemEvtMyAgd,NULL,Agd_PutCurrentParamsMyAgenda,
Lay_REMOVE_BUTTON,Txt_Remove_event);
/***** Show events again *****/ /***** Show events again *****/
Agd_ShowMyAgenda (); Agd_ShowMyAgenda ();

View File

@ -969,15 +969,12 @@ void Asg_ReqRemAssignment (void)
Asg_GetDataOfAssignmentByCod (&Asg); Asg_GetDataOfAssignmentByCod (&Asg);
/***** Show question and button to remove the assignment *****/ /***** Show question and button to remove the assignment *****/
/* Start alert */ Gbl.Asgs.AsgCodToEdit = Asg.AsgCod;
sprintf (Gbl.Alert.Txt,Txt_Do_you_really_want_to_remove_the_assignment_X, sprintf (Gbl.Alert.Txt,Txt_Do_you_really_want_to_remove_the_assignment_X,
Asg.Title); Asg.Title);
Lay_ShowAlertAndButton1 (Lay_QUESTION,Gbl.Alert.Txt); Lay_ShowAlertAndButton (Lay_QUESTION,Gbl.Alert.Txt,
ActRemAsg,NULL,Asg_PutParams,
/* End alert */ Lay_REMOVE_BUTTON,Txt_Remove_assignment);
Gbl.Asgs.AsgCodToEdit = Asg.AsgCod;
Lay_ShowAlertAndButton2 (ActRemAsg,NULL,Asg_PutParams,
Lay_REMOVE_BUTTON,Txt_Remove_assignment);
/***** Show assignments again *****/ /***** Show assignments again *****/
Asg_SeeAssignments (); Asg_SeeAssignments ();

View File

@ -2166,20 +2166,18 @@ static void Ctr_ShowAlertAndButtonToGoToCtr (void)
{ {
extern const char *Txt_Go_to_X; extern const char *Txt_Go_to_X;
/***** Start alert *****/
Lay_ShowAlertAndButton1 (Gbl.Alert.Type,Gbl.Alert.Txt);
// If the centre being edited is different to the current one... // If the centre being edited is different to the current one...
if (Gbl.Ctrs.EditingCtr.CtrCod != Gbl.CurrentCtr.Ctr.CtrCod) if (Gbl.Ctrs.EditingCtr.CtrCod != Gbl.CurrentCtr.Ctr.CtrCod)
{ {
/***** Put button to go to centre and end alert *****/ /***** Alert with button to go to centre *****/
sprintf (Gbl.Title,Txt_Go_to_X,Gbl.Ctrs.EditingCtr.ShrtName); sprintf (Gbl.Title,Txt_Go_to_X,Gbl.Ctrs.EditingCtr.ShrtName);
Lay_ShowAlertAndButton2 (ActSeeDeg,NULL,Ctr_PutParamGoToCtr, Lay_ShowAlertAndButton (Gbl.Alert.Type,Gbl.Alert.Txt,
Lay_CONFIRM_BUTTON,Gbl.Title); ActSeeDeg,NULL,Ctr_PutParamGoToCtr,
Lay_CONFIRM_BUTTON,Gbl.Title);
} }
else else
/***** End alert *****/ /***** Alert *****/
Lay_ShowAlertAndButton2 (ActUnk,NULL,NULL,Lay_NO_BUTTON,NULL); Lay_ShowAlert (Gbl.Alert.Type,Gbl.Alert.Txt);
} }
static void Ctr_PutParamGoToCtr (void) static void Ctr_PutParamGoToCtr (void)

View File

@ -235,13 +235,15 @@
/****************************** Public constants *****************************/ /****************************** Public constants *****************************/
/*****************************************************************************/ /*****************************************************************************/
#define Log_PLATFORM_VERSION "SWAD 16.213 (2017-05-10)" #define Log_PLATFORM_VERSION "SWAD 16.214 (2017-05-10)"
#define CSS_FILE "swad16.209.3.css" #define CSS_FILE "swad16.209.3.css"
#define JS_FILE "swad16.206.3.js" #define JS_FILE "swad16.206.3.js"
// Number of lines (includes comments but not blank lines) has been got with the following command: // Number of lines (includes comments but not blank lines) has been got with the following command:
// nl swad*.c swad*.h css/swad*.css py/swad*.py js/swad*.js soap/swad*?.h sql/swad*.sql | tail -1 // nl swad*.c swad*.h css/swad*.css py/swad*.py js/swad*.js soap/swad*?.h sql/swad*.sql | tail -1
/* /*
Version 16.214: May 11, 2017 Changes in edition of institutions.
Code refactoring related to alerts. (218867 lines)
Version 16.213: May 11, 2017 Changes in edition of centres. (218881 lines) Version 16.213: May 11, 2017 Changes in edition of centres. (218881 lines)
Version 16.212: May 11, 2017 Changes in edition of courses and degrees. (218870 lines) Version 16.212: May 11, 2017 Changes in edition of courses and degrees. (218870 lines)
Version 16.211.2: May 11, 2017 Fixed bug in alerts. (218879 lines) Version 16.211.2: May 11, 2017 Fixed bug in alerts. (218879 lines)

View File

@ -2266,20 +2266,18 @@ void Deg_ShowAlertAndButtonToGoToDeg (void)
{ {
extern const char *Txt_Go_to_X; extern const char *Txt_Go_to_X;
/***** Start alert *****/
Lay_ShowAlertAndButton1 (Gbl.Alert.Type,Gbl.Alert.Txt);
// If the degree being edited is different to the current one... // If the degree being edited is different to the current one...
if (Gbl.Degs.EditingDeg.DegCod != Gbl.CurrentDeg.Deg.DegCod) if (Gbl.Degs.EditingDeg.DegCod != Gbl.CurrentDeg.Deg.DegCod)
{ {
/***** Put button to go to degree and end alert *****/ /***** Alert with button to go to degree *****/
sprintf (Gbl.Title,Txt_Go_to_X,Gbl.Degs.EditingDeg.ShrtName); sprintf (Gbl.Title,Txt_Go_to_X,Gbl.Degs.EditingDeg.ShrtName);
Lay_ShowAlertAndButton2 (ActSeeCrs,NULL,Deg_PutParamGoToDeg, Lay_ShowAlertAndButton (Gbl.Alert.Type,Gbl.Alert.Txt,
Lay_CONFIRM_BUTTON,Gbl.Title); ActSeeCrs,NULL,Deg_PutParamGoToDeg,
Lay_CONFIRM_BUTTON,Gbl.Title);
} }
else else
/***** End alert *****/ /***** Alert *****/
Lay_ShowAlertAndButton2 (ActUnk,NULL,NULL,Lay_NO_BUTTON,NULL); Lay_ShowAlert (Gbl.Alert.Type,Gbl.Alert.Txt);
} }
static void Deg_PutParamGoToDeg (void) static void Deg_PutParamGoToDeg (void)

View File

@ -6184,20 +6184,17 @@ void Brw_AskRemFileFromTree (void)
if (Brw_CheckIfICanEditFileOrFolder (Gbl.FileBrowser.Level)) // Can I remove this file? if (Brw_CheckIfICanEditFileOrFolder (Gbl.FileBrowser.Level)) // Can I remove this file?
{ {
/***** Show question and button to remove file/link *****/ /***** Show question and button to remove file/link *****/
/* Start alert */
Brw_GetFileNameToShowDependingOnLevel (Gbl.FileBrowser.FileType,Gbl.FileBrowser.Level, Brw_GetFileNameToShowDependingOnLevel (Gbl.FileBrowser.FileType,Gbl.FileBrowser.Level,
Gbl.FileBrowser.FileType, Gbl.FileBrowser.FileType,
Gbl.FileBrowser.FilFolLnkName,FileNameToShow); Gbl.FileBrowser.FilFolLnkName,FileNameToShow);
sprintf (Gbl.Alert.Txt,Txt_Do_you_really_want_to_remove_FILE_OR_LINK_X, sprintf (Gbl.Alert.Txt,Txt_Do_you_really_want_to_remove_FILE_OR_LINK_X,
FileNameToShow); FileNameToShow);
Lay_ShowAlertAndButton1 (Lay_QUESTION,Gbl.Alert.Txt); Lay_ShowAlertAndButton (Lay_QUESTION,Gbl.Alert.Txt,
Brw_ActRemoveFile[Gbl.FileBrowser.Type],NULL,
/* End alert */ Brw_PutParamsRemFile,
Lay_ShowAlertAndButton2 (Brw_ActRemoveFile[Gbl.FileBrowser.Type],NULL, Lay_REMOVE_BUTTON,
Brw_PutParamsRemFile, Gbl.FileBrowser.FileType == Brw_IS_FILE ? Txt_Remove_file :
Lay_REMOVE_BUTTON, Txt_Remove_link);
Gbl.FileBrowser.FileType == Brw_IS_FILE ? Txt_Remove_file :
Txt_Remove_link);
} }
else else
Lay_ShowErrorAndExit (Txt_You_can_not_remove_this_file_or_link); Lay_ShowErrorAndExit (Txt_You_can_not_remove_this_file_or_link);
@ -6335,15 +6332,12 @@ static void Brw_AskConfirmRemoveFolderNotEmpty (void)
extern const char *Txt_Remove_folder; extern const char *Txt_Remove_folder;
/***** Show question and button to remove not empty folder *****/ /***** Show question and button to remove not empty folder *****/
/* Start alert */
sprintf (Gbl.Alert.Txt,Txt_Do_you_really_want_to_remove_the_folder_X, sprintf (Gbl.Alert.Txt,Txt_Do_you_really_want_to_remove_the_folder_X,
Gbl.FileBrowser.FilFolLnkName); Gbl.FileBrowser.FilFolLnkName);
Lay_ShowAlertAndButton1 (Lay_QUESTION,Gbl.Alert.Txt); Lay_ShowAlertAndButton (Lay_QUESTION,Gbl.Alert.Txt,
Brw_ActRemoveFolderNotEmpty[Gbl.FileBrowser.Type],NULL,
/* End alert */ Brw_PutParamsRemFolder,
Lay_ShowAlertAndButton2 (Brw_ActRemoveFolderNotEmpty[Gbl.FileBrowser.Type],NULL, Lay_REMOVE_BUTTON,Txt_Remove_folder);
Brw_PutParamsRemFolder,
Lay_REMOVE_BUTTON,Txt_Remove_folder);
} }
/*****************************************************************************/ /*****************************************************************************/

View File

@ -4105,22 +4105,18 @@ void For_RequestRemoveThread (void)
For_ShowForumList (); For_ShowForumList ();
/***** Show question and button to remove the thread *****/ /***** Show question and button to remove the thread *****/
/* Start alert */
fprintf (Gbl.F.Out,"<section id=\"%s\">",For_ID_REMOVE_THREAD_SECTION); fprintf (Gbl.F.Out,"<section id=\"%s\">",For_ID_REMOVE_THREAD_SECTION);
if (Subject[0]) if (Subject[0])
{
sprintf (Gbl.Alert.Txt,Txt_Do_you_really_want_to_remove_the_entire_thread_X, sprintf (Gbl.Alert.Txt,Txt_Do_you_really_want_to_remove_the_entire_thread_X,
Subject); Subject);
Lay_ShowAlertAndButton1 (Lay_QUESTION,Gbl.Alert.Txt);
}
else else
Lay_ShowAlertAndButton1 (Lay_QUESTION,Txt_Do_you_really_want_to_remove_the_entire_thread); sprintf (Gbl.Alert.Txt,"%s",
Txt_Do_you_really_want_to_remove_the_entire_thread);
/* End alert */ Lay_ShowAlertAndButton (Lay_QUESTION,Gbl.Alert.Txt,
Lay_ShowAlertAndButton2 (For_ActionsDelThrFor[Gbl.Forum.ForumSelected.Type], For_ActionsDelThrFor[Gbl.Forum.ForumSelected.Type],
For_ID_FORUM_THREADS_SECTION, For_ID_FORUM_THREADS_SECTION,
For_PutAllHiddenParamsRemThread, For_PutAllHiddenParamsRemThread,
Lay_REMOVE_BUTTON,Txt_Remove_thread); Lay_REMOVE_BUTTON,Txt_Remove_thread);
fprintf (Gbl.F.Out,"</section>"); fprintf (Gbl.F.Out,"</section>");
/***** Show the threads again *****/ /***** Show the threads again *****/

View File

@ -3502,19 +3502,16 @@ static void Grp_AskConfirmRemGrpTypWithGrps (unsigned NumGrps)
Grp_ReqEditGroupsInternal0 (); Grp_ReqEditGroupsInternal0 ();
/***** Show question and button to remove type of group *****/ /***** Show question and button to remove type of group *****/
/* Start alert */
if (NumGrps == 1) if (NumGrps == 1)
sprintf (Gbl.Alert.Txt,Txt_Do_you_really_want_to_remove_the_type_of_group_X_1_group_, sprintf (Gbl.Alert.Txt,Txt_Do_you_really_want_to_remove_the_type_of_group_X_1_group_,
Gbl.CurrentCrs.Grps.GrpTyp.GrpTypName); Gbl.CurrentCrs.Grps.GrpTyp.GrpTypName);
else else
sprintf (Gbl.Alert.Txt,Txt_Do_you_really_want_to_remove_the_type_of_group_X_Y_groups_, sprintf (Gbl.Alert.Txt,Txt_Do_you_really_want_to_remove_the_type_of_group_X_Y_groups_,
Gbl.CurrentCrs.Grps.GrpTyp.GrpTypName,NumGrps); Gbl.CurrentCrs.Grps.GrpTyp.GrpTypName,NumGrps);
Lay_ShowAlertAndButton1 (Lay_QUESTION,Gbl.Alert.Txt); Lay_ShowAlertAndButton (Lay_QUESTION,Gbl.Alert.Txt,
ActRemGrpTyp,Grp_SECTION_GROUP_TYPES,
/* End alert */ Grp_PutParamRemGrpTyp,
Lay_ShowAlertAndButton2 (ActRemGrpTyp,Grp_SECTION_GROUP_TYPES, Lay_REMOVE_BUTTON,Txt_Remove_type_of_group);
Grp_PutParamRemGrpTyp,
Lay_REMOVE_BUTTON,Txt_Remove_type_of_group);
/***** Show the form to edit group types and groups again *****/ /***** Show the form to edit group types and groups again *****/
Grp_ReqEditGroupsInternal1 (Lay_INFO,NULL); Grp_ReqEditGroupsInternal1 (Lay_INFO,NULL);
@ -3555,7 +3552,6 @@ static void Grp_AskConfirmRemGrp (void)
Grp_ReqEditGroupsInternal1 (Lay_INFO,NULL); Grp_ReqEditGroupsInternal1 (Lay_INFO,NULL);
/***** Show question and button to remove group *****/ /***** Show question and button to remove group *****/
/* Start alert */
if (NumStds == 0) if (NumStds == 0)
sprintf (Gbl.Alert.Txt,Txt_Do_you_really_want_to_remove_the_group_X, sprintf (Gbl.Alert.Txt,Txt_Do_you_really_want_to_remove_the_group_X,
GrpDat.GrpName); GrpDat.GrpName);
@ -3565,11 +3561,9 @@ static void Grp_AskConfirmRemGrp (void)
else else
sprintf (Gbl.Alert.Txt,Txt_Do_you_really_want_to_remove_the_group_X_Y_students_, sprintf (Gbl.Alert.Txt,Txt_Do_you_really_want_to_remove_the_group_X_Y_students_,
GrpDat.GrpName,NumStds); GrpDat.GrpName,NumStds);
Lay_ShowAlertAndButton1 (Lay_QUESTION,Gbl.Alert.Txt); Lay_ShowAlertAndButton (Lay_QUESTION,Gbl.Alert.Txt,
ActRemGrp,Grp_SECTION_GROUPS,Grp_PutParamRemGrp,
/* End alert */ Lay_REMOVE_BUTTON,Txt_Remove_group);
Lay_ShowAlertAndButton2 (ActRemGrp,Grp_SECTION_GROUPS,Grp_PutParamRemGrp,
Lay_REMOVE_BUTTON,Txt_Remove_group);
/***** Show the form to edit groups again *****/ /***** Show the form to edit groups again *****/
Grp_ReqEditGroupsInternal2 (Lay_INFO,NULL); Grp_ReqEditGroupsInternal2 (Lay_INFO,NULL);

View File

@ -94,12 +94,13 @@ static void Ins_UpdateInsNameDB (long InsCod,const char *FieldName,const char *N
static void Ins_UpdateInsCtyDB (long InsCod,long CtyCod); static void Ins_UpdateInsCtyDB (long InsCod,long CtyCod);
static void Ins_UpdateInsWWWDB (long InsCod,const char NewWWW[Cns_MAX_BYTES_WWW + 1]); static void Ins_UpdateInsWWWDB (long InsCod,const char NewWWW[Cns_MAX_BYTES_WWW + 1]);
static void Ins_PutButtonToGoToIns (struct Instit *Ins); static void Ins_ShowAlertAndButtonToGoToIns (void);
static void Ins_PutParamGoToIns (void);
static void Ins_PutFormToCreateInstitution (void); static void Ins_PutFormToCreateInstitution (void);
static void Ins_PutHeadInstitutionsForEdition (void); static void Ins_PutHeadInstitutionsForEdition (void);
static void Ins_RecFormRequestOrCreateIns (unsigned Status); static void Ins_RecFormRequestOrCreateIns (unsigned Status);
static void Ins_CreateInstitution (struct Instit *Ins,unsigned Status); static void Ins_CreateInstitution (unsigned Status);
/*****************************************************************************/ /*****************************************************************************/
/***************** List institutions with pending centres ********************/ /***************** List institutions with pending centres ********************/
@ -1950,35 +1951,31 @@ void Ins_ChangeInsWWW (void)
{ {
extern const char *Txt_The_new_web_address_is_X; extern const char *Txt_The_new_web_address_is_X;
extern const char *Txt_You_can_not_leave_the_web_address_empty; extern const char *Txt_You_can_not_leave_the_web_address_empty;
struct Instit *Ins;
char NewWWW[Cns_MAX_BYTES_WWW + 1]; char NewWWW[Cns_MAX_BYTES_WWW + 1];
Ins = &Gbl.Inss.EditingIns;
/***** Get parameters from form *****/ /***** Get parameters from form *****/
/* Get the code of the institution */ /* Get the code of the institution */
Ins->InsCod = Ins_GetAndCheckParamOtherInsCod (); Gbl.Inss.EditingIns.InsCod = Ins_GetAndCheckParamOtherInsCod ();
/* Get the new WWW for the institution */ /* Get the new WWW for the institution */
Par_GetParToText ("WWW",NewWWW,Cns_MAX_BYTES_WWW); Par_GetParToText ("WWW",NewWWW,Cns_MAX_BYTES_WWW);
/***** Get data of institution *****/ /***** Get data of institution *****/
Ins_GetDataOfInstitutionByCod (Ins,Ins_GET_BASIC_DATA); Ins_GetDataOfInstitutionByCod (&Gbl.Inss.EditingIns,Ins_GET_BASIC_DATA);
/***** Check if new WWW is empty *****/ /***** Check if new WWW is empty *****/
if (NewWWW[0]) if (NewWWW[0])
{ {
/***** Update database changing old WWW by new WWW *****/ /***** Update database changing old WWW by new WWW *****/
Ins_UpdateInsWWWDB (Ins->InsCod,NewWWW); Ins_UpdateInsWWWDB (Gbl.Inss.EditingIns.InsCod,NewWWW);
Str_Copy (Ins->WWW,NewWWW, Str_Copy (Gbl.Inss.EditingIns.WWW,NewWWW,
Cns_MAX_BYTES_WWW); Cns_MAX_BYTES_WWW);
/***** Write message to show the change made *****/ /***** Write message to show the change made
and put button to go to institution changed *****/
Gbl.Alert.Type = Lay_SUCCESS;
sprintf (Gbl.Alert.Txt,Txt_The_new_web_address_is_X,NewWWW); sprintf (Gbl.Alert.Txt,Txt_The_new_web_address_is_X,NewWWW);
Lay_ShowAlert (Lay_SUCCESS,Gbl.Alert.Txt); Ins_ShowAlertAndButtonToGoToIns ();
/***** Put button to go to institution changed *****/
Ins_PutButtonToGoToIns (Ins);
} }
else else
Lay_ShowAlert (Lay_WARNING,Txt_You_can_not_leave_the_web_address_empty); Lay_ShowAlert (Lay_WARNING,Txt_You_can_not_leave_the_web_address_empty);
@ -2037,16 +2034,13 @@ static void Ins_UpdateInsWWWDB (long InsCod,const char NewWWW[Cns_MAX_BYTES_WWW
void Ins_ChangeInsStatus (void) void Ins_ChangeInsStatus (void)
{ {
extern const char *Txt_The_status_of_the_institution_X_has_changed; extern const char *Txt_The_status_of_the_institution_X_has_changed;
struct Instit *Ins;
char Query[128]; char Query[128];
Ins_Status_t Status; Ins_Status_t Status;
Ins_StatusTxt_t StatusTxt; Ins_StatusTxt_t StatusTxt;
Ins = &Gbl.Inss.EditingIns;
/***** Get parameters from form *****/ /***** Get parameters from form *****/
/* Get institution code */ /* Get institution code */
Ins->InsCod = Ins_GetAndCheckParamOtherInsCod (); Gbl.Inss.EditingIns.InsCod = Ins_GetAndCheckParamOtherInsCod ();
/* Get parameter with status */ /* Get parameter with status */
Status = (Ins_Status_t) Status = (Ins_Status_t)
@ -2060,22 +2054,20 @@ void Ins_ChangeInsStatus (void)
Status = Ins_GetStatusBitsFromStatusTxt (StatusTxt); // New status Status = Ins_GetStatusBitsFromStatusTxt (StatusTxt); // New status
/***** Get data of institution *****/ /***** Get data of institution *****/
Ins_GetDataOfInstitutionByCod (Ins,Ins_GET_BASIC_DATA); Ins_GetDataOfInstitutionByCod (&Gbl.Inss.EditingIns,Ins_GET_BASIC_DATA);
/***** Update status in table of institutions *****/ /***** Update status in table of institutions *****/
sprintf (Query,"UPDATE institutions SET Status=%u WHERE InsCod=%ld", sprintf (Query,"UPDATE institutions SET Status=%u WHERE InsCod=%ld",
(unsigned) Status,Ins->InsCod); (unsigned) Status,Gbl.Inss.EditingIns.InsCod);
DB_QueryUPDATE (Query,"can not update the status of an institution"); DB_QueryUPDATE (Query,"can not update the status of an institution");
Gbl.Inss.EditingIns.Status = Status;
Ins->Status = Status; /***** Write message to show the change made
and put button to go to institution changed *****/
/***** Write message to show the change made *****/ Gbl.Alert.Type = Lay_SUCCESS;
sprintf (Gbl.Alert.Txt,Txt_The_status_of_the_institution_X_has_changed, sprintf (Gbl.Alert.Txt,Txt_The_status_of_the_institution_X_has_changed,
Ins->ShrtName); Gbl.Inss.EditingIns.ShrtName);
Lay_ShowAlert (Lay_SUCCESS,Gbl.Alert.Txt); Ins_ShowAlertAndButtonToGoToIns ();
/***** Put button to go to institution changed *****/
Ins_PutButtonToGoToIns (Ins);
/***** Show the form again *****/ /***** Show the form again *****/
Ins_EditInstitutions (); Ins_EditInstitutions ();
@ -2087,36 +2079,42 @@ void Ins_ChangeInsStatus (void)
void Ins_ContEditAfterChgIns (void) void Ins_ContEditAfterChgIns (void)
{ {
/***** Write success / warning message *****/ /***** Write message to show the change made
Lay_ShowPendingAlert (); and put button to go to institution changed *****/
Ins_ShowAlertAndButtonToGoToIns ();
if (Gbl.Alert.Type == Lay_SUCCESS)
/***** Put button to go to institution changed *****/
Ins_PutButtonToGoToIns (&Gbl.Inss.EditingIns);
/***** Show the form again *****/ /***** Show the form again *****/
Ins_EditInstitutions (); Ins_EditInstitutions ();
} }
/*****************************************************************************/ /*****************************************************************************/
/********************* Put button to go to institution ***********************/ /*************** Write message to show the change made *****************/
/*************** and put button to go to institution changed *****************/
/*****************************************************************************/ /*****************************************************************************/
// Gbl.Degs.EditingDeg is the degree that is beeing edited
// Gbl.CurrentDeg.Deg is the current degree
static void Ins_PutButtonToGoToIns (struct Instit *Ins) static void Ins_ShowAlertAndButtonToGoToIns (void)
{ {
extern const char *Txt_Go_to_X; extern const char *Txt_Go_to_X;
// If the institution is different to the current one... // If the institution beeing edited is different to the current one...
if (Ins->InsCod != Gbl.CurrentIns.Ins.InsCod) if (Gbl.Inss.EditingIns.InsCod != Gbl.CurrentIns.Ins.InsCod)
{ {
fprintf (Gbl.F.Out,"<div class=\"BUTTONS_AFTER_ALERT\">"); /***** Alert with button to go to degree *****/
Act_FormStart (ActSeeCtr); sprintf (Gbl.Title,Txt_Go_to_X,Gbl.Inss.EditingIns.ShrtName);
Ins_PutParamInsCod (Ins->InsCod); Lay_ShowAlertAndButton (Gbl.Alert.Type,Gbl.Alert.Txt,
sprintf (Gbl.Title,Txt_Go_to_X,Ins->ShrtName); ActSeeCtr,NULL,Ins_PutParamGoToIns,
Lay_PutConfirmButtonInline (Gbl.Title); Lay_CONFIRM_BUTTON,Gbl.Title);
Act_FormEnd ();
fprintf (Gbl.F.Out,"</div>");
} }
else
/***** Alert *****/
Lay_ShowAlert (Gbl.Alert.Type,Gbl.Alert.Txt);
}
static void Ins_PutParamGoToIns (void)
{
Ins_PutParamInsCod (Gbl.Inss.EditingIns.InsCod);
} }
/*****************************************************************************/ /*****************************************************************************/
@ -2154,10 +2152,6 @@ static void Ins_PutFormToCreateInstitution (void)
{ {
extern const char *Txt_New_institution; extern const char *Txt_New_institution;
extern const char *Txt_Create_institution; extern const char *Txt_Create_institution;
struct Instit *Ins;
/***** Institution data *****/
Ins = &Gbl.Inss.EditingIns;
/***** Start form *****/ /***** Start form *****/
if (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM) if (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM)
@ -2192,7 +2186,7 @@ static void Ins_PutFormToCreateInstitution (void)
" class=\"INPUT_SHORT_NAME\"" " class=\"INPUT_SHORT_NAME\""
" required=\"required\" />" " required=\"required\" />"
"</td>", "</td>",
Hie_MAX_CHARS_SHRT_NAME,Ins->ShrtName); Hie_MAX_CHARS_SHRT_NAME,Gbl.Inss.EditingIns.ShrtName);
/***** Institution full name *****/ /***** Institution full name *****/
fprintf (Gbl.F.Out,"<td class=\"LEFT_MIDDLE\">" fprintf (Gbl.F.Out,"<td class=\"LEFT_MIDDLE\">"
@ -2201,7 +2195,7 @@ static void Ins_PutFormToCreateInstitution (void)
" class=\"INPUT_FULL_NAME\"" " class=\"INPUT_FULL_NAME\""
" required=\"required\" />" " required=\"required\" />"
"</td>", "</td>",
Hie_MAX_CHARS_FULL_NAME,Ins->FullName); Hie_MAX_CHARS_FULL_NAME,Gbl.Inss.EditingIns.FullName);
/***** Institution WWW *****/ /***** Institution WWW *****/
fprintf (Gbl.F.Out,"<td class=\"LEFT_MIDDLE\">" fprintf (Gbl.F.Out,"<td class=\"LEFT_MIDDLE\">"
@ -2210,7 +2204,7 @@ static void Ins_PutFormToCreateInstitution (void)
" class=\"INPUT_WWW\"" " class=\"INPUT_WWW\""
" required=\"required\" />" " required=\"required\" />"
"</td>", "</td>",
Cns_MAX_CHARS_WWW,Ins->WWW); Cns_MAX_CHARS_WWW,Gbl.Inss.EditingIns.WWW);
/***** Number of users who claim to belong to this institution ****/ /***** Number of users who claim to belong to this institution ****/
fprintf (Gbl.F.Out,"<td class=\"DAT RIGHT_MIDDLE\">" fprintf (Gbl.F.Out,"<td class=\"DAT RIGHT_MIDDLE\">"
@ -2327,42 +2321,40 @@ static void Ins_RecFormRequestOrCreateIns (unsigned Status)
extern const char *Txt_The_institution_X_already_exists; extern const char *Txt_The_institution_X_already_exists;
extern const char *Txt_You_must_specify_the_web_address_of_the_new_institution; extern const char *Txt_You_must_specify_the_web_address_of_the_new_institution;
extern const char *Txt_You_must_specify_the_short_name_and_the_full_name_of_the_new_institution; extern const char *Txt_You_must_specify_the_short_name_and_the_full_name_of_the_new_institution;
struct Instit *Ins;
Ins = &Gbl.Inss.EditingIns;
/***** Get parameters from form *****/ /***** Get parameters from form *****/
/* Set institution country */ /* Set institution country */
Ins->CtyCod = Gbl.CurrentCty.Cty.CtyCod; Gbl.Inss.EditingIns.CtyCod = Gbl.CurrentCty.Cty.CtyCod;
/* Get institution short name */ /* Get institution short name */
Par_GetParToText ("ShortName",Ins->ShrtName,Hie_MAX_BYTES_SHRT_NAME); Par_GetParToText ("ShortName",Gbl.Inss.EditingIns.ShrtName,Hie_MAX_BYTES_SHRT_NAME);
/* Get institution full name */ /* Get institution full name */
Par_GetParToText ("FullName",Ins->FullName,Hie_MAX_BYTES_FULL_NAME); Par_GetParToText ("FullName",Gbl.Inss.EditingIns.FullName,Hie_MAX_BYTES_FULL_NAME);
/* Get institution WWW */ /* Get institution WWW */
Par_GetParToText ("WWW",Ins->WWW,Cns_MAX_BYTES_WWW); Par_GetParToText ("WWW",Gbl.Inss.EditingIns.WWW,Cns_MAX_BYTES_WWW);
if (Ins->ShrtName[0] && Ins->FullName[0]) // If there's a institution name if (Gbl.Inss.EditingIns.ShrtName[0] &&
Gbl.Inss.EditingIns.FullName[0]) // If there's a institution name
{ {
if (Ins->WWW[0]) if (Gbl.Inss.EditingIns.WWW[0])
{ {
/***** If name of institution was in database... *****/ /***** If name of institution was in database... *****/
if (Ins_CheckIfInsNameExistsInCty ("ShortName",Ins->ShrtName,-1L,Gbl.CurrentCty.Cty.CtyCod)) if (Ins_CheckIfInsNameExistsInCty ("ShortName",Gbl.Inss.EditingIns.ShrtName,-1L,Gbl.CurrentCty.Cty.CtyCod))
{ {
sprintf (Gbl.Alert.Txt,Txt_The_institution_X_already_exists, sprintf (Gbl.Alert.Txt,Txt_The_institution_X_already_exists,
Ins->ShrtName); Gbl.Inss.EditingIns.ShrtName);
Lay_ShowAlert (Lay_WARNING,Gbl.Alert.Txt); Lay_ShowAlert (Lay_WARNING,Gbl.Alert.Txt);
} }
else if (Ins_CheckIfInsNameExistsInCty ("FullName",Ins->FullName,-1L,Gbl.CurrentCty.Cty.CtyCod)) else if (Ins_CheckIfInsNameExistsInCty ("FullName",Gbl.Inss.EditingIns.FullName,-1L,Gbl.CurrentCty.Cty.CtyCod))
{ {
sprintf (Gbl.Alert.Txt,Txt_The_institution_X_already_exists, sprintf (Gbl.Alert.Txt,Txt_The_institution_X_already_exists,
Ins->FullName); Gbl.Inss.EditingIns.FullName);
Lay_ShowAlert (Lay_WARNING,Gbl.Alert.Txt); Lay_ShowAlert (Lay_WARNING,Gbl.Alert.Txt);
} }
else // Add new institution to database else // Add new institution to database
Ins_CreateInstitution (Ins,Status); Ins_CreateInstitution (Status);
} }
else // If there is not a web else // If there is not a web
Lay_ShowAlert (Lay_WARNING,Txt_You_must_specify_the_web_address_of_the_new_institution); Lay_ShowAlert (Lay_WARNING,Txt_You_must_specify_the_web_address_of_the_new_institution);
@ -2377,8 +2369,9 @@ static void Ins_RecFormRequestOrCreateIns (unsigned Status)
/*****************************************************************************/ /*****************************************************************************/
/************************** Create a new institution *************************/ /************************** Create a new institution *************************/
/*****************************************************************************/ /*****************************************************************************/
// Gbl.Inss.EditingIns must hold the institution beeing edited
static void Ins_CreateInstitution (struct Instit *Ins,unsigned Status) static void Ins_CreateInstitution (unsigned Status)
{ {
extern const char *Txt_Created_new_institution_X; extern const char *Txt_Created_new_institution_X;
char Query[512 + char Query[512 +
@ -2391,19 +2384,20 @@ static void Ins_CreateInstitution (struct Instit *Ins,unsigned Status)
" (CtyCod,Status,RequesterUsrCod,ShortName,FullName,WWW)" " (CtyCod,Status,RequesterUsrCod,ShortName,FullName,WWW)"
" VALUES" " VALUES"
" (%ld,%u,%ld,'%s','%s','%s')", " (%ld,%u,%ld,'%s','%s','%s')",
Ins->CtyCod, Gbl.Inss.EditingIns.CtyCod,
Status, Status,
Gbl.Usrs.Me.UsrDat.UsrCod, Gbl.Usrs.Me.UsrDat.UsrCod,
Ins->ShrtName,Ins->FullName,Ins->WWW); Gbl.Inss.EditingIns.ShrtName,
Ins->InsCod = DB_QueryINSERTandReturnCode (Query,"can not create institution"); Gbl.Inss.EditingIns.FullName,
Gbl.Inss.EditingIns.WWW);
Gbl.Inss.EditingIns.InsCod = DB_QueryINSERTandReturnCode (Query,"can not create institution");
/***** Write success message *****/ /***** Write message to show the change made
and put button to go to institution created *****/
Gbl.Alert.Type = Lay_SUCCESS;
sprintf (Gbl.Alert.Txt,Txt_Created_new_institution_X, sprintf (Gbl.Alert.Txt,Txt_Created_new_institution_X,
Ins->FullName); Gbl.Inss.EditingIns.FullName);
Lay_ShowAlert (Lay_SUCCESS,Gbl.Alert.Txt); Ins_ShowAlertAndButtonToGoToIns ();
/***** Put button to go to institution created *****/
Ins_PutButtonToGoToIns (Ins);
} }
/*****************************************************************************/ /*****************************************************************************/

View File

@ -1684,10 +1684,17 @@ void Lay_ShowPendingAlert (void)
void Lay_ShowAlert (Lay_AlertType_t AlertType,const char *Txt) void Lay_ShowAlert (Lay_AlertType_t AlertType,const char *Txt)
{ {
if (AlertType != Lay_NONE) if (AlertType != Lay_NONE)
{ Lay_ShowAlertAndButton (AlertType,Txt,
Lay_ShowAlertAndButton1 (AlertType,Txt); ActUnk,NULL,NULL,Lay_NO_BUTTON,NULL);
Lay_ShowAlertAndButton2 (ActUnk,NULL,NULL,Lay_NO_BUTTON,NULL); }
}
void Lay_ShowAlertAndButton (Lay_AlertType_t AlertType,const char *Txt,
Act_Action_t NextAction,const char *Anchor,
void (*FuncParams) (),
Lay_Button_t Button,const char *TxtButton)
{
Lay_ShowAlertAndButton1 (AlertType,Txt);
Lay_ShowAlertAndButton2 (NextAction,Anchor,FuncParams,Button,TxtButton);
} }
void Lay_ShowAlertAndButton1 (Lay_AlertType_t AlertType,const char *Txt) void Lay_ShowAlertAndButton1 (Lay_AlertType_t AlertType,const char *Txt)

View File

@ -133,6 +133,10 @@ void Lay_EndTable (void);
void Lay_ShowErrorAndExit (const char *Txt); void Lay_ShowErrorAndExit (const char *Txt);
void Lay_ShowPendingAlert (void); void Lay_ShowPendingAlert (void);
void Lay_ShowAlert (Lay_AlertType_t AlertType,const char *Txt); void Lay_ShowAlert (Lay_AlertType_t AlertType,const char *Txt);
void Lay_ShowAlertAndButton (Lay_AlertType_t AlertType,const char *Txt,
Act_Action_t NextAction,const char *Anchor,
void (*FuncParams) (),
Lay_Button_t Button,const char *TxtButton);
void Lay_ShowAlertAndButton1 (Lay_AlertType_t AlertType,const char *Txt); void Lay_ShowAlertAndButton1 (Lay_AlertType_t AlertType,const char *Txt);
void Lay_ShowAlertAndButton2 (Act_Action_t NextAction,const char *Anchor, void Lay_ShowAlertAndButton2 (Act_Action_t NextAction,const char *Anchor,
void (*FuncParams) (), void (*FuncParams) (),

View File

@ -417,10 +417,8 @@ void Pho_ReqRemoveMyPhoto (void)
Lay_ShowAlertAndButton1 (Lay_QUESTION,Txt_Do_you_really_want_to_remove_your_photo); Lay_ShowAlertAndButton1 (Lay_QUESTION,Txt_Do_you_really_want_to_remove_your_photo);
/* Show current photo */ /* Show current photo */
fprintf (Gbl.F.Out,"<div class=\"CENTER_MIDDLE\">");
Pho_ShowUsrPhoto (&Gbl.Usrs.Me.UsrDat,Gbl.Usrs.Me.PhotoURL, Pho_ShowUsrPhoto (&Gbl.Usrs.Me.UsrDat,Gbl.Usrs.Me.PhotoURL,
"PHOTO186x248",Pho_NO_ZOOM,false); "PHOTO186x248",Pho_NO_ZOOM,false);
fprintf (Gbl.F.Out,"</div>");
/* End alert */ /* End alert */
Lay_ShowAlertAndButton2 (ActRemMyPho,NULL,NULL, Lay_ShowAlertAndButton2 (ActRemMyPho,NULL,NULL,
@ -480,10 +478,8 @@ void Pho_ReqRemoveUsrPhoto (void)
Lay_ShowAlertAndButton1 (Lay_QUESTION,Gbl.Alert.Txt); Lay_ShowAlertAndButton1 (Lay_QUESTION,Gbl.Alert.Txt);
/* Show current photo */ /* Show current photo */
fprintf (Gbl.F.Out,"<div class=\"CENTER_MIDDLE\">");
Pho_ShowUsrPhoto (&Gbl.Usrs.Other.UsrDat,PhotoURL, Pho_ShowUsrPhoto (&Gbl.Usrs.Other.UsrDat,PhotoURL,
"PHOTO186x248",Pho_NO_ZOOM,false); "PHOTO186x248",Pho_NO_ZOOM,false);
fprintf (Gbl.F.Out,"</div>");
/* End alert */ /* End alert */
Lay_ShowAlertAndButton2 ( Gbl.Usrs.Other.UsrDat.RoleInCurrentCrsDB == Rol_STUDENT ? ActRemStdPho : Lay_ShowAlertAndButton2 ( Gbl.Usrs.Other.UsrDat.RoleInCurrentCrsDB == Rol_STUDENT ? ActRemStdPho :

View File

@ -641,7 +641,6 @@ void Rec_AskConfirmRemFieldWithRecords (unsigned NumRecords)
&Gbl.CurrentCrs.Records.Field.Visibility); &Gbl.CurrentCrs.Records.Field.Visibility);
/***** Show question and button to remove my photo *****/ /***** Show question and button to remove my photo *****/
/* Start alert */
sprintf (Gbl.Alert.Txt,Txt_Do_you_really_want_to_remove_the_field_X_from_the_records_of_X, sprintf (Gbl.Alert.Txt,Txt_Do_you_really_want_to_remove_the_field_X_from_the_records_of_X,
Gbl.CurrentCrs.Records.Field.Name,Gbl.CurrentCrs.Crs.FullName); Gbl.CurrentCrs.Records.Field.Name,Gbl.CurrentCrs.Crs.FullName);
if (NumRecords == 1) if (NumRecords == 1)
@ -654,11 +653,9 @@ void Rec_AskConfirmRemFieldWithRecords (unsigned NumRecords)
Str_Concat (Gbl.Alert.Txt,Message_part2, Str_Concat (Gbl.Alert.Txt,Message_part2,
Lay_MAX_BYTES_ALERT); Lay_MAX_BYTES_ALERT);
} }
Lay_ShowAlertAndButton1 (Lay_QUESTION,Gbl.Alert.Txt); Lay_ShowAlertAndButton (Lay_QUESTION,Gbl.Alert.Txt,
ActRemFie,NULL,Rec_PutParamFielCod,
/* End alert */ Lay_REMOVE_BUTTON,Txt_Remove_record_field);
Lay_ShowAlertAndButton2 (ActRemFie,NULL,Rec_PutParamFielCod,
Lay_REMOVE_BUTTON,Txt_Remove_record_field);
/***** List record fields again *****/ /***** List record fields again *****/
Rec_ReqEditRecordFields (); Rec_ReqEditRecordFields ();

View File

@ -1478,15 +1478,12 @@ void Svy_AskRemSurvey (void)
Lay_ShowErrorAndExit ("You can not remove this survey."); Lay_ShowErrorAndExit ("You can not remove this survey.");
/***** Show question and button to remove survey *****/ /***** Show question and button to remove survey *****/
/* Start alert */ Gbl.Svys.SvyCodToEdit = Svy.SvyCod;
sprintf (Gbl.Alert.Txt,Txt_Do_you_really_want_to_remove_the_survey_X, sprintf (Gbl.Alert.Txt,Txt_Do_you_really_want_to_remove_the_survey_X,
Svy.Title); Svy.Title);
Lay_ShowAlertAndButton1 (Lay_QUESTION,Gbl.Alert.Txt); Lay_ShowAlertAndButton (Lay_QUESTION,Gbl.Alert.Txt,
ActRemSvy,NULL,Svy_PutParams,
/* End alert */ Lay_REMOVE_BUTTON,Txt_Remove_survey);
Gbl.Svys.SvyCodToEdit = Svy.SvyCod;
Lay_ShowAlertAndButton2 (ActRemSvy,NULL,Svy_PutParams,
Lay_REMOVE_BUTTON,Txt_Remove_survey);
/***** Show surveys again *****/ /***** Show surveys again *****/
Svy_ListAllSurveys (&SvyQst); Svy_ListAllSurveys (&SvyQst);
@ -3516,16 +3513,13 @@ void Svy_RequestRemoveQst (void)
SvyQst.QstInd = Svy_GetQstIndFromQstCod (SvyQst.QstCod); SvyQst.QstInd = Svy_GetQstIndFromQstCod (SvyQst.QstCod);
/***** Show question and button to remove question *****/ /***** Show question and button to remove question *****/
/* Start alert */
sprintf (Gbl.Alert.Txt,Txt_Do_you_really_want_to_remove_the_question_X,
(unsigned long) (SvyQst.QstInd + 1));
Lay_ShowAlertAndButton1 (Lay_QUESTION,Gbl.Alert.Txt);
/* End alert */
Gbl.Svys.SvyCodToEdit = SvyCod; Gbl.Svys.SvyCodToEdit = SvyCod;
Gbl.Svys.SvyQstCodToEdit = SvyQst.QstCod; Gbl.Svys.SvyQstCodToEdit = SvyQst.QstCod;
Lay_ShowAlertAndButton2 (ActRemSvyQst,NULL,Svy_PutParamsRemoveOneQst, sprintf (Gbl.Alert.Txt,Txt_Do_you_really_want_to_remove_the_question_X,
Lay_REMOVE_BUTTON,Txt_Remove_question); (unsigned long) (SvyQst.QstInd + 1));
Lay_ShowAlertAndButton (Lay_QUESTION,Gbl.Alert.Txt,
ActRemSvyQst,NULL,Svy_PutParamsRemoveOneQst,
Lay_REMOVE_BUTTON,Txt_Remove_question);
/***** Show current survey *****/ /***** Show current survey *****/
Svy_ShowOneSurvey (SvyCod,&SvyQst,true); Svy_ShowOneSurvey (SvyCod,&SvyQst,true);

View File

@ -5873,21 +5873,19 @@ void Tst_RequestRemoveQst (void)
Lay_ShowErrorAndExit ("Wrong test parameters."); Lay_ShowErrorAndExit ("Wrong test parameters.");
/***** Show question and button to remove question *****/ /***** Show question and button to remove question *****/
/* Start alert */
sprintf (Gbl.Alert.Txt,Txt_Do_you_really_want_to_remove_the_question_X, sprintf (Gbl.Alert.Txt,Txt_Do_you_really_want_to_remove_the_question_X,
(unsigned long) Gbl.Test.QstCod); (unsigned long) Gbl.Test.QstCod);
Lay_ShowAlertAndButton1 (Lay_QUESTION,Gbl.Alert.Txt);
/* End alert */
if (EditingOnlyThisQst) if (EditingOnlyThisQst)
Lay_ShowAlertAndButton2 (ActRemTstQst,NULL, Lay_ShowAlertAndButton (Lay_QUESTION,Gbl.Alert.Txt,
Tst_PutParamsRemoveOneQst, ActRemTstQst,NULL,
Lay_REMOVE_BUTTON,Txt_Remove_question); Tst_PutParamsRemoveOneQst,
Lay_REMOVE_BUTTON,Txt_Remove_question);
else else
{ {
Lay_ShowAlertAndButton2 (ActRemTstQst,NULL, Lay_ShowAlertAndButton (Lay_QUESTION,Gbl.Alert.Txt,
Tst_PutParamsRemoveQst, ActRemTstQst,NULL,
Lay_REMOVE_BUTTON,Txt_Remove_question); Tst_PutParamsRemoveQst,
Lay_REMOVE_BUTTON,Txt_Remove_question);
Tst_FreeTagsList (); Tst_FreeTagsList ();
} }