mirror of https://github.com/acanas/swad-core.git
Version18.99
This commit is contained in:
parent
adadbaac87
commit
ab671d9447
|
@ -1833,7 +1833,7 @@ struct Act_Actions Act_Actions[Act_NUM_ACTIONS] =
|
|||
/* ActRemDeg */{ 542,-1,TabUnk,ActSeeDeg , 0, 0, 0,0x3C6, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Deg_RemoveDegree ,NULL},
|
||||
/* ActRenDegSho */{ 546,-1,TabUnk,ActSeeDeg , 0, 0, 0,0x3C6, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,Deg_RenameDegreeShort ,Deg_ContEditAfterChgDeg ,NULL},
|
||||
/* ActRenDegFul */{ 547,-1,TabUnk,ActSeeDeg , 0, 0, 0,0x3C6, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,Deg_RenameDegreeFull ,Deg_ContEditAfterChgDeg ,NULL},
|
||||
/* ActChgDegTyp */{ 544,-1,TabUnk,ActSeeDeg , 0, 0, 0,0x3C6, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,DT_ChangeDegreeType ,NULL},
|
||||
/* ActChgDegTyp */{ 544,-1,TabUnk,ActSeeDeg , 0, 0, 0,0x3C6, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Deg_ChangeDegreeType ,NULL},
|
||||
/* ActChgDegWWW */{ 554,-1,TabUnk,ActSeeDeg , 0, 0, 0,0x3C6, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Deg_ChangeDegWWW ,NULL},
|
||||
/* ActChgDegSta */{1207,-1,TabUnk,ActSeeDeg , 0, 0, 0,0x380, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Deg_ChangeDegStatus ,NULL},
|
||||
|
||||
|
|
|
@ -3065,4 +3065,3 @@ static void Ctr_EditingCentreDestructor (void)
|
|||
Ctr_EditingCtr = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -464,10 +464,11 @@ En OpenSWAD:
|
|||
ps2pdf source.ps destination.pdf
|
||||
*/
|
||||
|
||||
#define Log_PLATFORM_VERSION "SWAD 18.98 (2019-04-06)"
|
||||
#define Log_PLATFORM_VERSION "SWAD 18.99 (2019-04-07)"
|
||||
#define CSS_FILE "swad18.92.css"
|
||||
#define JS_FILE "swad18.92.js"
|
||||
/*
|
||||
Version 18.99: Apr 07, 2019 Code refactoring in edition of degrees. (241822 lines)
|
||||
Version 18.98: Apr 06, 2019 Code refactoring in edition of centres. (241762 lines)
|
||||
Version 18.97: Apr 06, 2019 Code refactoring in edition of institutions. (241699 lines)
|
||||
Version 18.96: Apr 03, 2019 Code refactoring in edition of institutions.
|
||||
|
|
|
@ -976,7 +976,7 @@ void Crs_ShowCrssOfCurrentDeg (void)
|
|||
Crs_ListCourses ();
|
||||
|
||||
/***** Free list of courses in this degree *****/
|
||||
Crs_FreeListCoursesInDegree (&Gbl.Hierarchy.Deg);
|
||||
Crs_FreeListCoursesInCurrentDegree ();
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -1044,13 +1044,13 @@ static void Crs_GetListCoursesInCurrentDegree (Crs_WhatCourses_t WhatCourses)
|
|||
/********************* Free list of courses in this degree *******************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Crs_FreeListCoursesInDegree (struct Degree *Deg)
|
||||
void Crs_FreeListCoursesInCurrentDegree (void)
|
||||
{
|
||||
if (Deg->Crss.Lst)
|
||||
if (Gbl.Hierarchy.Deg.Crss.Lst)
|
||||
{
|
||||
/***** Free memory used by the list of courses in degree *****/
|
||||
free ((void *) Deg->Crss.Lst);
|
||||
Deg->Crss.Lst = NULL;
|
||||
free ((void *) Gbl.Hierarchy.Deg.Crss.Lst);
|
||||
Gbl.Hierarchy.Deg.Crss.Lst = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1343,12 +1343,12 @@ void Crs_EditCourses (void)
|
|||
extern const char *Hlp_DEGREE_Courses;
|
||||
extern const char *Txt_Courses_of_DEGREE_X;
|
||||
|
||||
/***** Get list of courses in this degree *****/
|
||||
Crs_GetListCoursesInCurrentDegree (Crs_ALL_COURSES_EXCEPT_REMOVED);
|
||||
|
||||
/***** Get list of degrees in this centre *****/
|
||||
Deg_GetListDegsOfCurrentCtr ();
|
||||
|
||||
/***** Get list of courses in this degree *****/
|
||||
Crs_GetListCoursesInCurrentDegree (Crs_ALL_COURSES_EXCEPT_REMOVED);
|
||||
|
||||
/***** Write menu to select country, institution, centre and degree *****/
|
||||
Hie_WriteMenuHierarchy ();
|
||||
|
||||
|
@ -1370,7 +1370,7 @@ void Crs_EditCourses (void)
|
|||
Box_EndBox ();
|
||||
|
||||
/***** Free list of courses in this degree *****/
|
||||
Crs_FreeListCoursesInDegree (&Gbl.Hierarchy.Deg);
|
||||
Crs_FreeListCoursesInCurrentDegree ();
|
||||
|
||||
/***** Free list of degrees in this centre *****/
|
||||
Deg_FreeListDegs (&Gbl.Hierarchy.Ctr.Degs);
|
||||
|
|
|
@ -105,7 +105,7 @@ unsigned Crs_GetNumCrssWithUsrs (Rol_Role_t Role,const char *SubQuery);
|
|||
|
||||
void Crs_WriteSelectorOfCourse (void);
|
||||
void Crs_ShowCrssOfCurrentDeg (void);
|
||||
void Crs_FreeListCoursesInDegree (struct Degree *Deg);
|
||||
void Crs_FreeListCoursesInCurrentDegree (void);
|
||||
void Crs_WriteSelectorMyCoursesInBreadcrumb (void);
|
||||
|
||||
void Crs_EditCourses (void);
|
||||
|
|
290
swad_degree.c
290
swad_degree.c
|
@ -78,9 +78,11 @@ typedef enum
|
|||
} Deg_FirstOrLastYear_t;
|
||||
|
||||
/*****************************************************************************/
|
||||
/**************************** Private constants ******************************/
|
||||
/**************************** Private variables ******************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static struct Degree *Deg_EditingDeg = NULL; // Static variable to keep degree beeing edited
|
||||
|
||||
/*****************************************************************************/
|
||||
/**************************** Private prototypes *****************************/
|
||||
/*****************************************************************************/
|
||||
|
@ -104,6 +106,7 @@ static void Deg_PutIconsListingDegrees (void);
|
|||
static void Deg_PutIconToEditDegrees (void);
|
||||
static void Deg_ListOneDegreeForSeeing (struct Degree *Deg,unsigned NumDeg);
|
||||
|
||||
static void Deg_EditDegreesInternal (void);
|
||||
static void Deg_PutIconsEditingDegrees (void);
|
||||
|
||||
static void Deg_RecFormRequestOrCreateDeg (unsigned Status);
|
||||
|
@ -121,6 +124,9 @@ static void Deg_UpdateDegWWWDB (long DegCod,const char NewWWW[Cns_MAX_BYTES_WWW
|
|||
|
||||
static void Deg_PutParamGoToDeg (void);
|
||||
|
||||
static void Deg_EditingDegreeConstructor (void);
|
||||
static void Deg_EditingDegreeDestructor (void);
|
||||
|
||||
/*****************************************************************************/
|
||||
/******************* List degrees with pending courses ***********************/
|
||||
/*****************************************************************************/
|
||||
|
@ -939,13 +945,9 @@ static void Deg_PutFormToCreateDegree (void)
|
|||
{
|
||||
extern const char *Txt_New_degree;
|
||||
extern const char *Txt_Create_degree;
|
||||
struct Degree *Deg;
|
||||
struct DegreeType *DegTyp;
|
||||
unsigned NumDegTyp;
|
||||
|
||||
/***** Degree data *****/
|
||||
Deg = &Gbl.Degs.EditingDeg;
|
||||
|
||||
/***** Start form *****/
|
||||
if (Gbl.Usrs.Me.Role.Logged >= Rol_CTR_ADM)
|
||||
Frm_StartForm (ActNewDeg);
|
||||
|
@ -980,7 +982,7 @@ static void Deg_PutFormToCreateDegree (void)
|
|||
" class=\"INPUT_SHORT_NAME\""
|
||||
" required=\"required\" />"
|
||||
"</td>",
|
||||
Hie_MAX_CHARS_SHRT_NAME,Deg->ShrtName);
|
||||
Hie_MAX_CHARS_SHRT_NAME,Deg_EditingDeg->ShrtName);
|
||||
|
||||
/***** Degree full name *****/
|
||||
fprintf (Gbl.F.Out,"<td class=\"LEFT_MIDDLE\">"
|
||||
|
@ -989,7 +991,7 @@ static void Deg_PutFormToCreateDegree (void)
|
|||
" class=\"INPUT_FULL_NAME\""
|
||||
" required=\"required\" />"
|
||||
"</td>",
|
||||
Hie_MAX_CHARS_FULL_NAME,Deg->FullName);
|
||||
Hie_MAX_CHARS_FULL_NAME,Deg_EditingDeg->FullName);
|
||||
|
||||
/***** Degree type *****/
|
||||
fprintf (Gbl.F.Out,"<td class=\"LEFT_MIDDLE\">"
|
||||
|
@ -1001,8 +1003,8 @@ static void Deg_PutFormToCreateDegree (void)
|
|||
DegTyp = &Gbl.DegTypes.Lst[NumDegTyp];
|
||||
fprintf (Gbl.F.Out,"<option value=\"%ld\"%s>%s</option>",
|
||||
DegTyp->DegTypCod,
|
||||
DegTyp->DegTypCod == Deg->DegTypCod ? " selected=\"selected\"" :
|
||||
"",
|
||||
DegTyp->DegTypCod == Deg_EditingDeg->DegTypCod ? " selected=\"selected\"" :
|
||||
"",
|
||||
DegTyp->DegTypName);
|
||||
}
|
||||
fprintf (Gbl.F.Out,"</select>"
|
||||
|
@ -1015,7 +1017,7 @@ static void Deg_PutFormToCreateDegree (void)
|
|||
" class=\"INPUT_WWW\""
|
||||
" required=\"required\" />"
|
||||
"</td>",
|
||||
Cns_MAX_CHARS_WWW,Deg->WWW);
|
||||
Cns_MAX_CHARS_WWW,Deg_EditingDeg->WWW);
|
||||
|
||||
/***** Current number of courses in this degree *****/
|
||||
fprintf (Gbl.F.Out,"<td class=\"DAT RIGHT_MIDDLE\">"
|
||||
|
@ -1139,31 +1141,30 @@ unsigned Deg_ConvStrToYear (const char *StrYear)
|
|||
/*****************************************************************************/
|
||||
/***************************** Create a new degree ***************************/
|
||||
/*****************************************************************************/
|
||||
// Gbl.Degs.EditingDeg must hold the degree beeing edited
|
||||
|
||||
static void Deg_CreateDegree (unsigned Status)
|
||||
{
|
||||
extern const char *Txt_Created_new_degree_X;
|
||||
|
||||
/***** Create a new degree *****/
|
||||
Gbl.Degs.EditingDeg.DegCod =
|
||||
Deg_EditingDeg->DegCod =
|
||||
DB_QueryINSERTandReturnCode ("can not create a new degree",
|
||||
"INSERT INTO degrees (CtrCod,DegTypCod,Status,"
|
||||
"RequesterUsrCod,ShortName,FullName,WWW)"
|
||||
" VALUES (%ld,%ld,%u,%ld,'%s','%s','%s')",
|
||||
Gbl.Degs.EditingDeg.CtrCod,
|
||||
Gbl.Degs.EditingDeg.DegTypCod,
|
||||
Deg_EditingDeg->CtrCod,
|
||||
Deg_EditingDeg->DegTypCod,
|
||||
Status,
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||
Gbl.Degs.EditingDeg.ShrtName,
|
||||
Gbl.Degs.EditingDeg.FullName,
|
||||
Gbl.Degs.EditingDeg.WWW);
|
||||
Deg_EditingDeg->ShrtName,
|
||||
Deg_EditingDeg->FullName,
|
||||
Deg_EditingDeg->WWW);
|
||||
|
||||
/***** Write message to show the change made
|
||||
and put button to go to degree created *****/
|
||||
Ale_CreateAlert (Ale_SUCCESS,NULL,
|
||||
Txt_Created_new_degree_X,
|
||||
Gbl.Degs.EditingDeg.FullName);
|
||||
Deg_EditingDeg->FullName);
|
||||
Deg_ShowAlertAndButtonToGoToDeg ();
|
||||
}
|
||||
|
||||
|
@ -1344,6 +1345,18 @@ static void Deg_ListOneDegreeForSeeing (struct Degree *Deg,unsigned NumDeg)
|
|||
/*****************************************************************************/
|
||||
|
||||
void Deg_EditDegrees (void)
|
||||
{
|
||||
/***** Degree constructor *****/
|
||||
Deg_EditingDegreeConstructor ();
|
||||
|
||||
/***** Edit degrees *****/
|
||||
Deg_EditDegreesInternal ();
|
||||
|
||||
/***** Degree destructor *****/
|
||||
Deg_EditingDegreeDestructor ();
|
||||
}
|
||||
|
||||
static void Deg_EditDegreesInternal (void)
|
||||
{
|
||||
extern const char *Hlp_CENTRE_Degrees;
|
||||
extern const char *Txt_Degrees_of_CENTRE_X;
|
||||
|
@ -1535,7 +1548,14 @@ void Deg_FreeListDegs (struct ListDegrees *Degs)
|
|||
|
||||
void Deg_RecFormReqDeg (void)
|
||||
{
|
||||
/***** Degree constructor *****/
|
||||
Deg_EditingDegreeConstructor ();
|
||||
|
||||
/***** Receive form to request a new degree *****/
|
||||
Deg_RecFormRequestOrCreateDeg ((unsigned) Deg_STATUS_BIT_PENDING);
|
||||
|
||||
/***** Degree destructor *****/
|
||||
Deg_EditingDegreeDestructor ();
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -1544,7 +1564,14 @@ void Deg_RecFormReqDeg (void)
|
|||
|
||||
void Deg_RecFormNewDeg (void)
|
||||
{
|
||||
/***** Degree constructor *****/
|
||||
Deg_EditingDegreeConstructor ();
|
||||
|
||||
/***** Receive form to request a new degree *****/
|
||||
Deg_RecFormRequestOrCreateDeg (0);
|
||||
|
||||
/***** Degree destructor *****/
|
||||
Deg_EditingDegreeDestructor ();
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -1559,32 +1586,34 @@ static void Deg_RecFormRequestOrCreateDeg (unsigned Status)
|
|||
|
||||
/***** Get parameters from form *****/
|
||||
/* Set degree centre */
|
||||
Gbl.Degs.EditingDeg.CtrCod = Gbl.Hierarchy.Ctr.CtrCod;
|
||||
Deg_EditingDeg->CtrCod = Gbl.Hierarchy.Ctr.CtrCod;
|
||||
|
||||
/* Get degree short name */
|
||||
Par_GetParToText ("ShortName",Gbl.Degs.EditingDeg.ShrtName,Hie_MAX_BYTES_SHRT_NAME);
|
||||
Par_GetParToText ("ShortName",Deg_EditingDeg->ShrtName,Hie_MAX_BYTES_SHRT_NAME);
|
||||
|
||||
/* Get degree full name */
|
||||
Par_GetParToText ("FullName",Gbl.Degs.EditingDeg.FullName,Hie_MAX_BYTES_FULL_NAME);
|
||||
Par_GetParToText ("FullName",Deg_EditingDeg->FullName,Hie_MAX_BYTES_FULL_NAME);
|
||||
|
||||
/* Get degree type */
|
||||
Gbl.Degs.EditingDeg.DegTypCod = DT_GetAndCheckParamOtherDegTypCod (1);
|
||||
Deg_EditingDeg->DegTypCod = DT_GetAndCheckParamOtherDegTypCod (1);
|
||||
|
||||
/* Get degree WWW */
|
||||
Par_GetParToText ("WWW",Gbl.Degs.EditingDeg.WWW,Cns_MAX_BYTES_WWW);
|
||||
Par_GetParToText ("WWW",Deg_EditingDeg->WWW,Cns_MAX_BYTES_WWW);
|
||||
|
||||
if (Gbl.Degs.EditingDeg.ShrtName[0] &&
|
||||
Gbl.Degs.EditingDeg.FullName[0]) // If there's a degree name
|
||||
if (Deg_EditingDeg->ShrtName[0] &&
|
||||
Deg_EditingDeg->FullName[0]) // If there's a degree name
|
||||
{
|
||||
if (Gbl.Degs.EditingDeg.WWW[0])
|
||||
if (Deg_EditingDeg->WWW[0])
|
||||
{
|
||||
/***** If name of degree was in database... *****/
|
||||
if (Deg_CheckIfDegNameExistsInCtr ("ShortName",Gbl.Degs.EditingDeg.ShrtName,-1L,Gbl.Degs.EditingDeg.CtrCod))
|
||||
if (Deg_CheckIfDegNameExistsInCtr ("ShortName",Deg_EditingDeg->ShrtName,
|
||||
-1L,Deg_EditingDeg->CtrCod))
|
||||
Ale_ShowAlert (Ale_WARNING,Txt_The_degree_X_already_exists,
|
||||
Gbl.Degs.EditingDeg.ShrtName);
|
||||
else if (Deg_CheckIfDegNameExistsInCtr ("FullName",Gbl.Degs.EditingDeg.FullName,-1L,Gbl.Degs.EditingDeg.CtrCod))
|
||||
Deg_EditingDeg->ShrtName);
|
||||
else if (Deg_CheckIfDegNameExistsInCtr ("FullName",Deg_EditingDeg->FullName,
|
||||
-1L,Deg_EditingDeg->CtrCod))
|
||||
Ale_ShowAlert (Ale_WARNING,Txt_The_degree_X_already_exists,
|
||||
Gbl.Degs.EditingDeg.FullName);
|
||||
Deg_EditingDeg->FullName);
|
||||
else // Add new degree to database
|
||||
Deg_CreateDegree (Status);
|
||||
}
|
||||
|
@ -1595,7 +1624,7 @@ static void Deg_RecFormRequestOrCreateDeg (unsigned Status)
|
|||
Ale_ShowAlert (Ale_WARNING,Txt_You_must_specify_the_short_name_and_the_full_name_of_the_new_degree);
|
||||
|
||||
/***** Show the form again *****/
|
||||
Deg_EditDegrees ();
|
||||
Deg_EditDegreesInternal ();
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -1606,29 +1635,34 @@ void Deg_RemoveDegree (void)
|
|||
{
|
||||
extern const char *Txt_To_remove_a_degree_you_must_first_remove_all_courses_in_the_degree;
|
||||
extern const char *Txt_Degree_X_removed;
|
||||
struct Degree Deg;
|
||||
|
||||
/***** Degree constructor *****/
|
||||
Deg_EditingDegreeConstructor ();
|
||||
|
||||
/***** Get degree code *****/
|
||||
Deg.DegCod = Deg_GetAndCheckParamOtherDegCod (1);
|
||||
Deg_EditingDeg->DegCod = Deg_GetAndCheckParamOtherDegCod (1);
|
||||
|
||||
/***** Get data of degree *****/
|
||||
Deg_GetDataOfDegreeByCod (&Deg);
|
||||
Deg_GetDataOfDegreeByCod (Deg_EditingDeg);
|
||||
|
||||
/***** Check if this degree has courses *****/
|
||||
if (Crs_GetNumCrssInDeg (Deg.DegCod)) // Degree has courses ==> don't remove
|
||||
if (Crs_GetNumCrssInDeg (Deg_EditingDeg->DegCod)) // Degree has courses ==> don't remove
|
||||
Ale_ShowAlert (Ale_WARNING,Txt_To_remove_a_degree_you_must_first_remove_all_courses_in_the_degree);
|
||||
else // Degree has no courses ==> remove it
|
||||
{
|
||||
/***** Remove degree *****/
|
||||
Deg_RemoveDegreeCompletely (Deg.DegCod);
|
||||
Deg_RemoveDegreeCompletely (Deg_EditingDeg->DegCod);
|
||||
|
||||
/***** Write message to show the change made *****/
|
||||
Ale_ShowAlert (Ale_SUCCESS,Txt_Degree_X_removed,
|
||||
Deg.FullName);
|
||||
Deg_EditingDeg->FullName);
|
||||
}
|
||||
|
||||
/***** Show the form again *****/
|
||||
Deg_EditDegrees ();
|
||||
Deg_EditDegreesInternal ();
|
||||
|
||||
/***** Degree destructor *****/
|
||||
Deg_EditingDegreeDestructor ();
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -1904,30 +1938,49 @@ void Deg_RemoveDegreeCompletely (long DegCod)
|
|||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/********************* Change the short name of a degree *********************/
|
||||
/************************ Change the name of a degree ************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Deg_RenameDegreeShort (void)
|
||||
{
|
||||
Gbl.Degs.EditingDeg.DegCod = Deg_GetAndCheckParamOtherDegCod (1);
|
||||
Deg_RenameDegree (&Gbl.Degs.EditingDeg,Cns_SHRT_NAME);
|
||||
/***** Degree constructor *****/
|
||||
Deg_EditingDegreeConstructor ();
|
||||
|
||||
Deg_EditingDeg->DegCod = Deg_GetAndCheckParamOtherDegCod (1);
|
||||
Deg_RenameDegree (Deg_EditingDeg,Cns_SHRT_NAME);
|
||||
}
|
||||
|
||||
void Deg_RenameDegreeFull (void)
|
||||
{
|
||||
/***** Degree constructor *****/
|
||||
Deg_EditingDegreeConstructor ();
|
||||
|
||||
Deg_EditingDeg->DegCod = Deg_GetAndCheckParamOtherDegCod (1);
|
||||
Deg_RenameDegree (Deg_EditingDeg,Cns_FULL_NAME);
|
||||
}
|
||||
|
||||
void Deg_ContEditAfterChgDeg (void)
|
||||
{
|
||||
/***** Write message to show the change made
|
||||
and put button to go to degree changed *****/
|
||||
Deg_ShowAlertAndButtonToGoToDeg ();
|
||||
|
||||
/***** Show the form again *****/
|
||||
Deg_EditDegreesInternal ();
|
||||
|
||||
/***** Degree destructor *****/
|
||||
Deg_EditingDegreeDestructor ();
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/*************** Change the name of a degree in configuration ****************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Deg_RenameDegreeShortInConfig (void)
|
||||
{
|
||||
Deg_RenameDegree (&Gbl.Hierarchy.Deg,Cns_SHRT_NAME);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/********************* Change the full name of a degree **********************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Deg_RenameDegreeFull (void)
|
||||
{
|
||||
Gbl.Degs.EditingDeg.DegCod = Deg_GetAndCheckParamOtherDegCod (1);
|
||||
Deg_RenameDegree (&Gbl.Degs.EditingDeg,Cns_FULL_NAME);
|
||||
}
|
||||
|
||||
void Deg_RenameDegreeFullInConfig (void)
|
||||
{
|
||||
Deg_RenameDegree (&Gbl.Hierarchy.Deg,Cns_FULL_NAME);
|
||||
|
@ -2109,6 +2162,49 @@ static void Deg_UpdateDegCtrDB (long DegCod,long CtrCod)
|
|||
CtrCod,DegCod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/************************ Change the type of a degree ************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Deg_ChangeDegreeType (void)
|
||||
{
|
||||
extern const char *Txt_The_type_of_degree_of_the_degree_X_has_changed;
|
||||
long NewDegTypCod;
|
||||
|
||||
/***** Degree constructor *****/
|
||||
Deg_EditingDegreeConstructor ();
|
||||
|
||||
/***** Get parameters from form *****/
|
||||
/* Get degree code */
|
||||
Deg_EditingDeg->DegCod = Deg_GetAndCheckParamOtherDegCod (1);
|
||||
|
||||
/* Get the new degree type */
|
||||
NewDegTypCod = DT_GetAndCheckParamOtherDegTypCod (1);
|
||||
|
||||
/***** Get data of degree *****/
|
||||
Deg_GetDataOfDegreeByCod (Deg_EditingDeg);
|
||||
|
||||
/***** Update the table of degrees changing old type by new type *****/
|
||||
DB_QueryUPDATE ("can not update the type of a degree",
|
||||
"UPDATE degrees SET DegTypCod=%ld WHERE DegCod=%ld",
|
||||
NewDegTypCod,Deg_EditingDeg->DegCod);
|
||||
Gbl.DegTypes.EditingDegTyp.DegTypCod =
|
||||
Deg_EditingDeg->DegTypCod = NewDegTypCod;
|
||||
|
||||
/***** Write alert to show the change made
|
||||
and put button to go to degree changed *****/
|
||||
Ale_CreateAlert (Ale_SUCCESS,NULL,
|
||||
Txt_The_type_of_degree_of_the_degree_X_has_changed,
|
||||
Deg_EditingDeg->FullName);
|
||||
Deg_ShowAlertAndButtonToGoToDeg ();
|
||||
|
||||
/***** Show the form again *****/
|
||||
Deg_EditDegreesInternal ();
|
||||
|
||||
/***** Degree destructor *****/
|
||||
Deg_EditingDegreeDestructor ();
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/************************* Change the WWW of a degree ************************/
|
||||
/*****************************************************************************/
|
||||
|
@ -2119,22 +2215,25 @@ void Deg_ChangeDegWWW (void)
|
|||
extern const char *Txt_You_can_not_leave_the_web_address_empty;
|
||||
char NewWWW[Cns_MAX_BYTES_WWW + 1];
|
||||
|
||||
/***** Degree constructor *****/
|
||||
Deg_EditingDegreeConstructor ();
|
||||
|
||||
/***** Get parameters from form *****/
|
||||
/* Get the code of the degree */
|
||||
Gbl.Degs.EditingDeg.DegCod = Deg_GetAndCheckParamOtherDegCod (1);
|
||||
Deg_EditingDeg->DegCod = Deg_GetAndCheckParamOtherDegCod (1);
|
||||
|
||||
/* Get the new WWW for the degree */
|
||||
Par_GetParToText ("WWW",NewWWW,Cns_MAX_BYTES_WWW);
|
||||
|
||||
/***** Get data of degree *****/
|
||||
Deg_GetDataOfDegreeByCod (&Gbl.Degs.EditingDeg);
|
||||
Deg_GetDataOfDegreeByCod (Deg_EditingDeg);
|
||||
|
||||
/***** Check if new WWW is empty *****/
|
||||
if (NewWWW[0])
|
||||
{
|
||||
/***** Update the table changing old WWW by new WWW *****/
|
||||
Deg_UpdateDegWWWDB (Gbl.Degs.EditingDeg.DegCod,NewWWW);
|
||||
Str_Copy (Gbl.Degs.EditingDeg.WWW,NewWWW,
|
||||
Deg_UpdateDegWWWDB (Deg_EditingDeg->DegCod,NewWWW);
|
||||
Str_Copy (Deg_EditingDeg->WWW,NewWWW,
|
||||
Cns_MAX_BYTES_WWW);
|
||||
|
||||
/***** Write alert to show the change made
|
||||
|
@ -2148,7 +2247,10 @@ void Deg_ChangeDegWWW (void)
|
|||
Ale_ShowAlert (Ale_WARNING,Txt_You_can_not_leave_the_web_address_empty);
|
||||
|
||||
/***** Show the form again *****/
|
||||
Deg_EditDegrees ();
|
||||
Deg_EditDegreesInternal ();
|
||||
|
||||
/***** Degree destructor *****/
|
||||
Deg_EditingDegreeDestructor ();
|
||||
}
|
||||
|
||||
void Deg_ChangeDegWWWInConfig (void)
|
||||
|
@ -2202,9 +2304,12 @@ void Deg_ChangeDegStatus (void)
|
|||
Deg_Status_t Status;
|
||||
Deg_StatusTxt_t StatusTxt;
|
||||
|
||||
/***** Degree constructor *****/
|
||||
Deg_EditingDegreeConstructor ();
|
||||
|
||||
/***** Get parameters from form *****/
|
||||
/* Get degree code */
|
||||
Gbl.Degs.EditingDeg.DegCod = Deg_GetAndCheckParamOtherDegCod (1);
|
||||
Deg_EditingDeg->DegCod = Deg_GetAndCheckParamOtherDegCod (1);
|
||||
|
||||
/* Get parameter with status */
|
||||
Status = (Deg_Status_t)
|
||||
|
@ -2218,58 +2323,44 @@ void Deg_ChangeDegStatus (void)
|
|||
Status = Deg_GetStatusBitsFromStatusTxt (StatusTxt); // New status
|
||||
|
||||
/***** Get data of degree *****/
|
||||
Deg_GetDataOfDegreeByCod (&Gbl.Degs.EditingDeg);
|
||||
Deg_GetDataOfDegreeByCod (Deg_EditingDeg);
|
||||
|
||||
/***** Update status in table of degrees *****/
|
||||
DB_QueryUPDATE ("can not update the status of a degree",
|
||||
"UPDATE degrees SET Status=%u WHERE DegCod=%ld",
|
||||
(unsigned) Status,Gbl.Degs.EditingDeg.DegCod);
|
||||
|
||||
Gbl.Degs.EditingDeg.Status = Status;
|
||||
(unsigned) Status,Deg_EditingDeg->DegCod);
|
||||
Deg_EditingDeg->Status = Status;
|
||||
|
||||
/***** Write alert to show the change made
|
||||
and put button to go to degree changed *****/
|
||||
Ale_CreateAlert (Ale_SUCCESS,NULL,
|
||||
Txt_The_status_of_the_degree_X_has_changed,
|
||||
Gbl.Degs.EditingDeg.ShrtName);
|
||||
Deg_EditingDeg->ShrtName);
|
||||
Deg_ShowAlertAndButtonToGoToDeg ();
|
||||
|
||||
/***** Show the form again *****/
|
||||
Deg_EditDegrees ();
|
||||
}
|
||||
Deg_EditDegreesInternal ();
|
||||
|
||||
/*****************************************************************************/
|
||||
/************* Show message of success after changing a degree ***************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Deg_ContEditAfterChgDeg (void)
|
||||
{
|
||||
/***** Write message to show the change made
|
||||
and put button to go to degree changed *****/
|
||||
Deg_ShowAlertAndButtonToGoToDeg ();
|
||||
|
||||
/***** Show the form again *****/
|
||||
Deg_EditDegrees ();
|
||||
/***** Degree destructor *****/
|
||||
Deg_EditingDegreeDestructor ();
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/***************** Write message to show the change made ********************/
|
||||
/***************** and put button to go to degree changed ********************/
|
||||
/*****************************************************************************/
|
||||
// Gbl.Degs.EditingDeg is the degree that is beeing edited
|
||||
// Gbl.Hierarchy.Deg is the current degree
|
||||
|
||||
void Deg_ShowAlertAndButtonToGoToDeg (void)
|
||||
{
|
||||
extern const char *Txt_Go_to_X;
|
||||
|
||||
// If the degree being edited is different to the current one...
|
||||
if (Gbl.Degs.EditingDeg.DegCod != Gbl.Hierarchy.Deg.DegCod)
|
||||
if (Deg_EditingDeg->DegCod != Gbl.Hierarchy.Deg.DegCod)
|
||||
{
|
||||
/***** Alert with button to go to degree *****/
|
||||
snprintf (Gbl.Title,sizeof (Gbl.Title),
|
||||
Txt_Go_to_X,
|
||||
Gbl.Degs.EditingDeg.ShrtName);
|
||||
Deg_EditingDeg->ShrtName);
|
||||
Ale_ShowLastAlertAndButton (ActSeeCrs,NULL,NULL,Deg_PutParamGoToDeg,
|
||||
Btn_CONFIRM_BUTTON,Gbl.Title);
|
||||
}
|
||||
|
@ -2280,7 +2371,7 @@ void Deg_ShowAlertAndButtonToGoToDeg (void)
|
|||
|
||||
static void Deg_PutParamGoToDeg (void)
|
||||
{
|
||||
Deg_PutParamDegCod (Gbl.Degs.EditingDeg.DegCod);
|
||||
Deg_PutParamDegCod (Deg_EditingDeg->DegCod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -2586,3 +2677,40 @@ void Deg_ListDegsFound (MYSQL_RES **mysql_res,unsigned NumDegs)
|
|||
/***** Free structure that stores the query result *****/
|
||||
DB_FreeMySQLResult (mysql_res);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/************************ Degree constructor/destructor **********************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void Deg_EditingDegreeConstructor (void)
|
||||
{
|
||||
/***** Pointer must be NULL *****/
|
||||
if (Deg_EditingDeg != NULL)
|
||||
Lay_ShowErrorAndExit ("Error initializing degree.");
|
||||
|
||||
/***** Allocate memory for degree *****/
|
||||
if ((Deg_EditingDeg = (struct Degree *) malloc (sizeof (struct Degree))) == NULL)
|
||||
Lay_ShowErrorAndExit ("Error allocating memory for degree.");
|
||||
|
||||
/***** Reset degree *****/
|
||||
Deg_EditingDeg->DegCod = -1L;
|
||||
Deg_EditingDeg->DegTypCod = -1L;
|
||||
Deg_EditingDeg->CtrCod = -1L;
|
||||
Deg_EditingDeg->Status = 0;
|
||||
Deg_EditingDeg->RequesterUsrCod = -1L;
|
||||
Deg_EditingDeg->ShrtName[0] = '\0';
|
||||
Deg_EditingDeg->FullName[0] = '\0';
|
||||
Deg_EditingDeg->WWW[0] = '\0';
|
||||
Deg_EditingDeg->Crss.Num = 0;
|
||||
Deg_EditingDeg->Crss.Lst = NULL;
|
||||
}
|
||||
|
||||
static void Deg_EditingDegreeDestructor (void)
|
||||
{
|
||||
/***** Free memory used for institution *****/
|
||||
if (Deg_EditingDeg != NULL)
|
||||
{
|
||||
free ((void *) Deg_EditingDeg);
|
||||
Deg_EditingDeg = NULL;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -68,8 +68,8 @@ typedef enum
|
|||
|
||||
struct Degree
|
||||
{
|
||||
long DegTypCod; // Degree type code
|
||||
long DegCod; // Degree code
|
||||
long DegTypCod; // Degree type code
|
||||
long CtrCod; // Centre code
|
||||
Deg_Status_t Status; // Degree status
|
||||
long RequesterUsrCod; // User code of the person who requested the creation of this degree
|
||||
|
@ -128,15 +128,16 @@ long Deg_GetCtrCodOfDegreeByCod (long DegCod);
|
|||
long Deg_GetInsCodOfDegreeByCod (long DegCod);
|
||||
void Deg_RemoveDegreeCompletely (long DegCod);
|
||||
void Deg_RenameDegreeShort (void);
|
||||
void Deg_RenameDegreeShortInConfig (void);
|
||||
void Deg_RenameDegreeFull (void);
|
||||
void Deg_ContEditAfterChgDeg (void);
|
||||
void Deg_RenameDegreeShortInConfig (void);
|
||||
void Deg_RenameDegreeFullInConfig (void);
|
||||
void Deg_ChangeDegCtrInConfig (void);
|
||||
void Deg_ContEditAfterChgDegInConfig (void);
|
||||
void Deg_ChangeDegreeType (void);
|
||||
void Deg_ChangeDegWWW (void);
|
||||
void Deg_ChangeDegWWWInConfig (void);
|
||||
void Deg_ChangeDegStatus (void);
|
||||
void Deg_ContEditAfterChgDeg (void);
|
||||
|
||||
void Deg_ShowAlertAndButtonToGoToDeg (void);
|
||||
|
||||
|
|
|
@ -991,39 +991,3 @@ static bool DT_CheckIfDegreeTypeNameExists (const char *DegTypName,long DegTypCo
|
|||
" WHERE DegTypName='%s' AND DegTypCod<>%ld",
|
||||
DegTypName,DegTypCod) != 0);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/************************ Change the type of a degree ************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void DT_ChangeDegreeType (void)
|
||||
{
|
||||
extern const char *Txt_The_type_of_degree_of_the_degree_X_has_changed;
|
||||
long NewDegTypCod;
|
||||
|
||||
/***** Get parameters from form *****/
|
||||
/* Get degree code */
|
||||
Gbl.Degs.EditingDeg.DegCod = Deg_GetAndCheckParamOtherDegCod (1);
|
||||
|
||||
/* Get the new degree type */
|
||||
NewDegTypCod = DT_GetAndCheckParamOtherDegTypCod (1);
|
||||
|
||||
/***** Get data of degree *****/
|
||||
Deg_GetDataOfDegreeByCod (&Gbl.Degs.EditingDeg);
|
||||
|
||||
/***** Update the table of degrees changing old type by new type *****/
|
||||
DB_QueryUPDATE ("can not update the type of a degree",
|
||||
"UPDATE degrees SET DegTypCod=%ld WHERE DegCod=%ld",
|
||||
NewDegTypCod,Gbl.Degs.EditingDeg.DegCod);
|
||||
|
||||
/***** Write alert to show the change made
|
||||
and put button to go to degree changed *****/
|
||||
Ale_CreateAlert (Ale_SUCCESS,NULL,
|
||||
Txt_The_type_of_degree_of_the_degree_X_has_changed,
|
||||
Gbl.Degs.EditingDeg.FullName);
|
||||
Deg_ShowAlertAndButtonToGoToDeg ();
|
||||
|
||||
/***** Show the form again *****/
|
||||
Gbl.DegTypes.EditingDegTyp.DegTypCod = NewDegTypCod;
|
||||
Deg_EditDegrees ();
|
||||
}
|
||||
|
|
|
@ -80,6 +80,5 @@ long DT_GetAndCheckParamOtherDegTypCod (long MinCodAllowed);
|
|||
|
||||
bool DT_GetDataOfDegreeTypeByCod (struct DegreeType *DegTyp);
|
||||
void DT_RenameDegreeType (void);
|
||||
void DT_ChangeDegreeType (void);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -278,12 +278,6 @@ void Gbl_InitializeGlobals (void)
|
|||
Gbl.DegTypes.EditingDegTyp.DegTypCod = -1L;
|
||||
Gbl.DegTypes.EditingDegTyp.DegTypName[0] = '\0';
|
||||
|
||||
Gbl.Degs.EditingDeg.DegCod = -1L;
|
||||
Gbl.Degs.EditingDeg.ShrtName[0] = '\0';
|
||||
Gbl.Degs.EditingDeg.FullName[0] = '\0';
|
||||
Gbl.Degs.EditingDeg.WWW[0] = '\0';
|
||||
Gbl.Degs.EditingDeg.Crss.Lst = NULL;
|
||||
|
||||
Gbl.Crss.EditingCrs.CrsCod = -1L;
|
||||
Gbl.Crss.EditingCrs.DegCod = -1L;
|
||||
Gbl.Crss.EditingCrs.Year = 0;
|
||||
|
@ -483,7 +477,7 @@ void Gbl_Cleanup (void)
|
|||
Rec_FreeListFields ();
|
||||
Grp_FreeListGrpTypesAndGrps ();
|
||||
Grp_FreeListCodSelectedGrps ();
|
||||
Crs_FreeListCoursesInDegree (&Gbl.Degs.EditingDeg);
|
||||
Crs_FreeListCoursesInCurrentDegree ();
|
||||
Deg_FreeListDegs (&Gbl.Hierarchy.Ctr.Degs);
|
||||
DT_FreeListDegreeTypes ();
|
||||
Ins_FreeListInstitutions ();
|
||||
|
|
|
@ -214,10 +214,6 @@ struct Globals
|
|||
struct Degree Deg; // Current degree
|
||||
struct Course Crs; // Current course. Aditional info about course is stored in Gbl.Crs.
|
||||
} Hierarchy;
|
||||
struct
|
||||
{
|
||||
struct Degree EditingDeg;
|
||||
} Degs;
|
||||
struct
|
||||
{
|
||||
struct Course EditingCrs;
|
||||
|
|
|
@ -579,9 +579,7 @@ void Hie_InitHierarchy (void)
|
|||
}
|
||||
|
||||
/***** Initialize default fields for edition to current values *****/
|
||||
Gbl.Dpts.EditingDpt.InsCod = Gbl.Hierarchy.Ins.InsCod;
|
||||
Gbl.Degs.EditingDeg.CtrCod = Gbl.Hierarchy.Ctr.CtrCod;
|
||||
Gbl.Degs.EditingDeg.DegTypCod = Gbl.Hierarchy.Deg.DegTypCod;
|
||||
Gbl.Dpts.EditingDpt.InsCod = Gbl.Hierarchy.Ins.InsCod;
|
||||
|
||||
/***** Initialize paths *****/
|
||||
if (Gbl.Hierarchy.Level == Hie_CRS) // Course selected
|
||||
|
|
Loading…
Reference in New Issue