Version 15.141

This commit is contained in:
Antonio Cañas Vargas 2016-03-01 13:36:48 +01:00
parent ba0de52e9d
commit dcb5c528a9
8 changed files with 165 additions and 64 deletions

View File

@ -1573,8 +1573,8 @@ struct Act_Actions Act_Actions[Act_NUM_ACTIONS] =
/* ActReqDeg */{1206,-1,TabCtr,ActSeeDeg ,0x1FE,0x1FE,0x1FE,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Deg_RecFormReqDeg ,NULL},
/* ActNewDeg */{ 540,-1,TabCtr,ActSeeDeg ,0x1C0,0x1C0,0x1C0,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Deg_RecFormNewDeg ,NULL},
/* ActRemDeg */{ 542,-1,TabCtr,ActSeeDeg ,0x1FE,0x1FE,0x1FE,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Deg_RemoveDegree ,NULL},
/* ActRenDegSho */{ 546,-1,TabCtr,ActSeeDeg ,0x1FE,0x1FE,0x1FE,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Deg_RenameDegreeShort ,NULL},
/* ActRenDegFul */{ 547,-1,TabCtr,ActSeeDeg ,0x1FE,0x1FE,0x1FE,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Deg_RenameDegreeFull ,NULL},
/* ActRenDegSho */{ 546,-1,TabCtr,ActSeeDeg ,0x1FE,0x1FE,0x1FE,Act_CONTENT_NORM,Act_MAIN_WINDOW,Deg_RenameDegreeShort ,Deg_ContEditAfterChgDeg ,NULL},
/* ActRenDegFul */{ 547,-1,TabCtr,ActSeeDeg ,0x1FE,0x1FE,0x1FE,Act_CONTENT_NORM,Act_MAIN_WINDOW,Deg_RenameDegreeFull ,Deg_ContEditAfterChgDeg ,NULL},
/* ActChgDegTyp */{ 544,-1,TabCtr,ActSeeDeg ,0x1FE,0x1FE,0x1FE,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Deg_ChangeDegreeType ,NULL},
/* ActChgDegCtr */{1049,-1,TabCtr,ActSeeDeg ,0x1C0,0x1C0,0x1C0,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Deg_ChangeDegreeCtr ,NULL},
/* ActChgDegWWW */{ 554,-1,TabCtr,ActSeeDeg ,0x1FE,0x1FE,0x1FE,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Deg_ChangeDegWWW ,NULL},

View File

@ -125,13 +125,14 @@
/****************************** Public constants *****************************/
/*****************************************************************************/
#define Log_PLATFORM_VERSION "SWAD 15.140.1 (2016-03-01)"
#define Log_PLATFORM_VERSION "SWAD 15.141 (2016-03-01)"
#define CSS_FILE "swad15.137.2.css"
#define JS_FILE "swad15.131.3.js"
// 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
/*
Version 15.141: Mar 01, 2016 Button to go to another degree after editing. (195898 lines)
Version 15.140.1: Mar 01, 2016 The link to go to another course after editing is replaced by a button. (195817 lines)
Version 15.140: Mar 01, 2016 New option "landing page". (195817 lines)
2 changes necessary in database:

View File

@ -2400,7 +2400,7 @@ void Crs_ChangeInsCrsCod (void)
/***** Change the institutional course code *****/
if (strcmp (NewInstitutionalCrsCod,Crs->InstitutionalCrsCod))
{
Crs_UpdateCurrentInstitutionalCrsCod (Crs,NewInstitutionalCrsCod);
Crs_UpdateInstitutionalCrsCod (Crs,NewInstitutionalCrsCod);
sprintf (Gbl.Message,Txt_The_institutional_code_of_the_course_X_has_changed_to_Y,
Crs->ShortName,NewInstitutionalCrsCod);
Lay_ShowAlert (Lay_SUCCESS,Gbl.Message);
@ -2489,6 +2489,7 @@ void Crs_ChangeCrsDegree (void)
sprintf (Query,"UPDATE courses SET DegCod='%ld' WHERE CrsCod='%ld'",
NewDeg.DegCod,Crs->CrsCod);
DB_QueryUPDATE (Query,"can not move course to another degree");
Crs->DegCod = NewDeg.DegCod;
/***** Write message to show the change made *****/
sprintf (Gbl.Message,Txt_The_course_X_has_been_moved_to_the_degree_Y,
@ -2600,16 +2601,13 @@ void Crs_ChangeCrsYear (void)
}
/*****************************************************************************/
/******** Change the institutional course code of the current course *********/
/************* Change the institutional course code of a course **************/
/*****************************************************************************/
void Crs_UpdateCurrentInstitutionalCrsCod (struct Course *Crs,const char *NewInstitutionalCrsCod)
void Crs_UpdateInstitutionalCrsCod (struct Course *Crs,const char *NewInstitutionalCrsCod)
{
char Query[512];
strncpy (Gbl.CurrentCrs.Crs.InstitutionalCrsCod,NewInstitutionalCrsCod,Crs_LENGTH_INSTITUTIONAL_CRS_COD);
Gbl.CurrentCrs.Crs.InstitutionalCrsCod[Crs_LENGTH_INSTITUTIONAL_CRS_COD] = '\0';
/***** Update institutional course code in table of courses *****/
sprintf (Query,"UPDATE courses SET InsCrsCod='%s' WHERE CrsCod='%ld'",
NewInstitutionalCrsCod,Crs->CrsCod);
@ -2743,7 +2741,10 @@ static bool Crs_RenameCourse (struct Course *Crs,Cns_ShortOrFullName_t ShortOrFu
}
}
else
Lay_ShowAlert (Lay_WARNING,Txt_You_dont_have_permission_to_edit_this_course);
{
strcpy (Gbl.Message,Txt_You_dont_have_permission_to_edit_this_course);
Gbl.Error = true;
}
return CourseHasBeenRenamed;
}
@ -2804,14 +2805,18 @@ void Crs_ChangeCrsStatus (void)
void Crs_ContEditAfterChgCrs (void)
{
/***** Write error/success message showing the change made *****/
Lay_ShowAlert (Gbl.Error ? Lay_WARNING :
Lay_INFO,
Gbl.Message);
if (Gbl.Error)
/***** Write error message *****/
Lay_ShowAlert (Lay_WARNING,Gbl.Message);
else
{
/***** Write success message showing the change made *****/
Lay_ShowAlert (Lay_INFO,Gbl.Message);
/***** Put button to go to course changed *****/
if (Gbl.Degs.EditingCrs.CrsCod != Gbl.CurrentCrs.Crs.CrsCod) // If changing other course different than the current one...
Crs_PutButtonToGoToCrs (&Gbl.Degs.EditingCrs);
/***** Put button to go to course changed *****/
if (Gbl.Degs.EditingCrs.CrsCod != Gbl.CurrentCrs.Crs.CrsCod) // If changing other course different than the current one...
Crs_PutButtonToGoToCrs (&Gbl.Degs.EditingCrs);
}
/***** Show the form again *****/
Crs_ReqEditCourses ();

View File

@ -120,7 +120,7 @@ void Crs_RemoveCourseCompletely (long CrsCod);
void Crs_ChangeInsCrsCod (void);
void Crs_ChangeCrsDegree (void);
void Crs_ChangeCrsYear (void);
void Crs_UpdateCurrentInstitutionalCrsCod (struct Course *Crs,const char *NewInstitutionalCrsCod);
void Crs_UpdateInstitutionalCrsCod (struct Course *Crs,const char *NewInstitutionalCrsCod);
void Crs_RenameCourseShort (void);
void Crs_RenameCourseFull (void);
void Crs_ChangeCrsStatus (void);

View File

@ -117,9 +117,10 @@ static unsigned Deg_CountNumDegsOfType (long DegTypCod);
static void Deg_GetDataOfDegreeFromRow (struct Degree *Deg,MYSQL_ROW row);
static void Deg_RemoveDegreeTypeCompletely (long DegTypCod);
static void Deg_RemoveDegreeCompletely (long DegCod);
static void Deg_RenameDegree (struct Degree *Deg,Cns_ShortOrFullName_t ShortOrFullName);
static bool Deg_RenameDegree (struct Degree *Deg,Cns_ShortOrFullName_t ShortOrFullName);
static bool Deg_CheckIfDegreeTypeNameExists (const char *DegTypName,long DegTypCod);
static bool Deg_CheckIfDegreeNameExists (long CtrCod,const char *FieldName,const char *Name,long DegCod);
static void Deg_PutButtonToGoToDeg (struct Degree *Deg);
/*****************************************************************************/
/********** List pending institutions, centres, degrees and courses **********/
@ -2079,6 +2080,9 @@ static void Deg_CreateDegree (struct Degree *Deg,unsigned Status)
sprintf (Gbl.Message,Txt_Created_new_degree_X,
Deg->FullName);
Lay_ShowAlert (Lay_SUCCESS,Gbl.Message);
/***** Put button to go to degree created *****/
Deg_PutButtonToGoToDeg (Deg);
}
/*****************************************************************************/
@ -2601,7 +2605,7 @@ void Deg_RemoveDegree (void)
if ((Deg.DegCod = Deg_GetParamOtherDegCod ()) == -1L)
Lay_ShowErrorAndExit ("Code of degree is missing.");
/***** Get data of the degree from database *****/
/***** Get data of degree *****/
Deg_GetDataOfDegreeByCod (&Deg);
/***** Check if this degree has courses *****/
@ -3134,7 +3138,7 @@ void Deg_RenameDegreeType (void)
NewNameDegTyp,DegTyp->DegTypCod);
DB_QueryUPDATE (Query,"can not update the type of a degree");
/***** Write message to show the change made *****/
/* Write message to show the change made */
sprintf (Gbl.Message,Txt_The_type_of_degree_X_has_been_renamed_as_Y,
DegTyp->DegTypName,NewNameDegTyp);
Lay_ShowAlert (Lay_SUCCESS,Gbl.Message);
@ -3159,7 +3163,13 @@ void Deg_RenameDegreeType (void)
void Deg_RenameDegreeShort (void)
{
Deg_RenameDegree (&Gbl.Degs.EditingDeg,Cns_SHORT_NAME);
struct Degree *Deg;
Deg = &Gbl.Degs.EditingDeg;
if (Deg_RenameDegree (Deg,Cns_SHORT_NAME))
if (Deg->DegCod == Gbl.CurrentDeg.Deg.DegCod) // If renaming current degree...
strcpy (Gbl.CurrentDeg.Deg.ShortName,Deg->ShortName); // Overwrite current degree name in order to show correctly in page title and heading
}
/*****************************************************************************/
@ -3168,14 +3178,22 @@ void Deg_RenameDegreeShort (void)
void Deg_RenameDegreeFull (void)
{
Deg_RenameDegree (&Gbl.Degs.EditingDeg,Cns_FULL_NAME);
struct Degree *Deg;
Deg = &Gbl.Degs.EditingDeg;
if (Deg_RenameDegree (Deg,Cns_FULL_NAME))
if (Deg->DegCod == Gbl.CurrentDeg.Deg.DegCod) // If renaming current degree...
strcpy (Gbl.CurrentDeg.Deg.FullName,Deg->FullName); // Overwrite current degree name in order to show correctly in page title and heading
}
/*****************************************************************************/
/************************ Change the name of a degree ************************/
/*****************************************************************************/
// Returns true if the degree is renamed
// Returns false if the degree is not renamed
static void Deg_RenameDegree (struct Degree *Deg,Cns_ShortOrFullName_t ShortOrFullName)
static bool Deg_RenameDegree (struct Degree *Deg,Cns_ShortOrFullName_t ShortOrFullName)
{
extern const char *Txt_You_can_not_leave_the_name_of_the_degree_X_empty;
extern const char *Txt_The_degree_X_already_exists;
@ -3187,6 +3205,7 @@ static void Deg_RenameDegree (struct Degree *Deg,Cns_ShortOrFullName_t ShortOrFu
unsigned MaxLength = 0; // Initialized to avoid warning
char *CurrentDegName = NULL; // Initialized to avoid warning
char NewDegName[Deg_MAX_LENGTH_DEGREE_FULL_NAME+1];
bool DegreeHasBeenRenamed = false;
switch (ShortOrFullName)
{
@ -3212,15 +3231,15 @@ static void Deg_RenameDegree (struct Degree *Deg,Cns_ShortOrFullName_t ShortOrFu
/* Get the new name for the degree */
Par_GetParToText (ParamName,NewDegName,MaxLength);
/***** Get from the database the type and the old names of the degree *****/
Deg_GetDataOfDegreeByCod (&Gbl.Degs.EditingDeg);
/***** Get data of degree *****/
Deg_GetDataOfDegreeByCod (Deg);
/***** Check if new name is empty *****/
if (!NewDegName[0])
{
sprintf (Gbl.Message,Txt_You_can_not_leave_the_name_of_the_degree_X_empty,
CurrentDegName);
Lay_ShowAlert (Lay_WARNING,Gbl.Message);
Gbl.Error = true;
}
else
{
@ -3232,7 +3251,7 @@ static void Deg_RenameDegree (struct Degree *Deg,Cns_ShortOrFullName_t ShortOrFu
{
sprintf (Gbl.Message,Txt_The_degree_X_already_exists,
NewDegName);
Lay_ShowAlert (Lay_WARNING,Gbl.Message);
Gbl.Error = true;
}
else
{
@ -3241,23 +3260,23 @@ static void Deg_RenameDegree (struct Degree *Deg,Cns_ShortOrFullName_t ShortOrFu
FieldName,NewDegName,Deg->DegCod);
DB_QueryUPDATE (Query,"can not update the name of a degree");
/***** Write message to show the change made *****/
/* Write message to show the change made */
sprintf (Gbl.Message,Txt_The_name_of_the_degree_X_has_changed_to_Y,
CurrentDegName,NewDegName);
Lay_ShowAlert (Lay_SUCCESS,Gbl.Message);
/* Change current degree name in order to display it properly */
strncpy (CurrentDegName,NewDegName,MaxLength);
CurrentDegName[MaxLength] = '\0';
DegreeHasBeenRenamed = true;
}
}
else // The same name
{
sprintf (Gbl.Message,Txt_The_name_of_the_degree_X_has_not_changed,
CurrentDegName);
Lay_ShowAlert (Lay_INFO,Gbl.Message);
}
}
/***** Show the form again *****/
strcpy (CurrentDegName,NewDegName);
Deg_EditDegrees ();
return DegreeHasBeenRenamed;
}
/*****************************************************************************/
@ -3357,7 +3376,7 @@ void Deg_ChangeDegreeType (void)
/* Get the new degree type */
NewDegTypCod = Deg_GetParamOtherDegTypCod ();
/* Get from the database the type and the name of the editing degree */
/***** Get data of degree *****/
Deg_GetDataOfDegreeByCod (Deg);
/***** Update the table of degrees changing old type by new type *****/
@ -3370,6 +3389,10 @@ void Deg_ChangeDegreeType (void)
Deg->FullName);
Lay_ShowAlert (Lay_SUCCESS,Gbl.Message);
/***** Put button to go to degree changed *****/
if (Deg->DegCod != Gbl.CurrentDeg.Deg.DegCod) // If changing other degree different than the current one...
Deg_PutButtonToGoToDeg (Deg);
/***** Show the form again *****/
Gbl.Degs.EditingDegTyp.DegTypCod = NewDegTypCod;
Deg_EditDegrees ();
@ -3381,8 +3404,9 @@ void Deg_ChangeDegreeType (void)
void Deg_ChangeDegreeCtr (void)
{
extern const char *Txt_The_centre_of_the_degree_has_changed;
extern const char *Txt_The_degree_X_has_been_moved_to_the_centre_Y;
struct Degree *Deg;
struct Centre NewCtr;
char Query[512];
Deg = &Gbl.Degs.EditingDeg;
@ -3393,15 +3417,26 @@ void Deg_ChangeDegreeCtr (void)
Lay_ShowErrorAndExit ("Code of degree is missing.");
/* Get parameter with centre code */
Deg->CtrCod = Ctr_GetParamOtherCtrCod ();
NewCtr.CtrCod = Ctr_GetParamOtherCtrCod ();
/***** Get data of degree and new centre *****/
Deg_GetDataOfDegreeByCod (Deg);
Ctr_GetDataOfCentreByCod (&NewCtr);
/***** Update centre in table of degrees *****/
sprintf (Query,"UPDATE degrees SET CtrCod='%ld' WHERE DegCod='%ld'",
Deg->CtrCod,Deg->DegCod);
NewCtr.CtrCod,Deg->DegCod);
DB_QueryUPDATE (Query,"can not update the centre of a degree");
Deg->CtrCod = NewCtr.CtrCod;
/***** Write message to show the change made *****/
Lay_ShowAlert (Lay_SUCCESS,Txt_The_centre_of_the_degree_has_changed);
sprintf (Gbl.Message,Txt_The_degree_X_has_been_moved_to_the_centre_Y,
Deg->FullName,NewCtr.FullName);
Lay_ShowAlert (Lay_SUCCESS,Gbl.Message);
/***** Put button to go to degree changed *****/
if (Deg->DegCod != Gbl.CurrentDeg.Deg.DegCod) // If changing other degree different than the current one...
Deg_PutButtonToGoToDeg (Deg);
/***** Show the form again *****/
Deg_EditDegrees ();
@ -3429,10 +3464,13 @@ void Deg_ChangeDegWWW (void)
/* Get the new WWW for the degree */
Par_GetParToText ("WWW",NewWWW,Cns_MAX_LENGTH_WWW);
/***** Get data of degree *****/
Deg_GetDataOfDegreeByCod (Deg);
/***** Check if new WWW is empty *****/
if (NewWWW[0])
{
/* Update the table changing old WWW by new WWW */
/***** Update the table changing old WWW by new WWW *****/
sprintf (Query,"UPDATE degrees SET WWW='%s' WHERE DegCod='%ld'",
NewWWW,Deg->DegCod);
DB_QueryUPDATE (Query,"can not update the web of a degree");
@ -3441,6 +3479,10 @@ void Deg_ChangeDegWWW (void)
sprintf (Gbl.Message,Txt_The_new_web_address_is_X,
NewWWW);
Lay_ShowAlert (Lay_SUCCESS,Gbl.Message);
/***** Put button to go to degree changed *****/
if (Deg->DegCod != Gbl.CurrentDeg.Deg.DegCod) // If changing other degree different than the current one...
Deg_PutButtonToGoToDeg (Deg);
}
else
{
@ -3495,10 +3537,52 @@ void Deg_ChangeDegStatus (void)
Deg->ShortName);
Lay_ShowAlert (Lay_SUCCESS,Gbl.Message);
/***** Put button to go to degree changed *****/
if (Deg->DegCod != Gbl.CurrentDeg.Deg.DegCod) // If changing other degree different than the current one...
Deg_PutButtonToGoToDeg (Deg);
/***** Show the form again *****/
Deg_EditDegrees ();
}
/*****************************************************************************/
/************* Show message of success after changing a degree ***************/
/*****************************************************************************/
void Deg_ContEditAfterChgDeg (void)
{
if (Gbl.Error)
/***** Write error message *****/
Lay_ShowAlert (Lay_WARNING,Gbl.Message);
else
{
/***** Write success message showing the change made *****/
Lay_ShowAlert (Lay_INFO,Gbl.Message);
/***** Put button to go to degree changed *****/
if (Gbl.Degs.EditingDeg.DegCod != Gbl.CurrentDeg.Deg.DegCod) // If changing other degree different than the current one...
Deg_PutButtonToGoToDeg (&Gbl.Degs.EditingDeg);
}
/***** Show the form again *****/
Deg_EditDegrees ();
}
/*****************************************************************************/
/************************ Put button to go to degree *************************/
/*****************************************************************************/
static void Deg_PutButtonToGoToDeg (struct Degree *Deg)
{
extern const char *Txt_Go_to_X;
Act_FormStart (ActSeeDegInf);
Deg_PutParamDegCod (Deg->DegCod);
sprintf (Gbl.Title,Txt_Go_to_X,Deg->ShortName);
Lay_PutConfirmButton (Gbl.Title);
Act_FormEnd ();
}
/*****************************************************************************/
/*********** Show a form for sending a logo of the current degree ************/
/*****************************************************************************/

View File

@ -144,6 +144,8 @@ void Deg_ChangeDegreeType (void);
void Deg_ChangeDegreeCtr (void);
void Deg_ChangeDegWWW (void);
void Deg_ChangeDegStatus (void);
void Deg_ContEditAfterChgDeg (void);
void Deg_RequestLogo (void);
void Deg_ReceiveLogo (void);
void Deg_RemoveLogo (void);

View File

@ -1522,7 +1522,7 @@ static void Enr_ReceiveFormUsrsCrs (Rol_Role_t Role)
Imp_ImportStdsFromAnImpGrp (GrpCod,&LstGrps,&NumUsrsRegistered);
/* Update the institutional course code to the external course code */
Crs_UpdateCurrentInstitutionalCrsCod (&Gbl.CurrentCrs.Crs,ExternalCrsCod);
Crs_UpdateInstitutionalCrsCod (&Gbl.CurrentCrs.Crs,ExternalCrsCod);
}
}
}

View File

@ -40080,27 +40080,6 @@ const char *Txt_The_banner_X_is_now_visible = // Warning: it is very important t
"O banner <strong>%s</strong> &eacute; agora visible.";
#endif
const char *Txt_The_centre_of_the_degree_has_changed =
#if L==1
"El centro de la titulaci&oacute;n ha cambiado."; // Necessita traduccio
#elif L==2
"The centre of the degree has changed."; // Need Übersetzung
#elif L==3
"The centre of the degree has changed.";
#elif L==4
"El centro de la titulaci&oacute;n ha cambiado.";
#elif L==5
"The centre of the degree has changed."; // Besoin de traduction
#elif L==6
"El centro de la titulaci&oacute;n ha cambiado."; // Okoteve traducción
#elif L==7
"Il centro della laurea &egrave; cambiato.";
#elif L==8
"The centre of the degree has changed."; // Potrzebujesz tlumaczenie
#elif L==9
"The centre of the degree has changed."; // Necessita de tradução
#endif
const char *Txt_The_centre_X_already_exists = // Warning: it is very important to include %s in the following sentences
#if L==1
"El centro <strong>%s</strong> ya existe."; // Necessita traduccio
@ -40704,6 +40683,36 @@ const char *Txt_The_degree_X_already_exists = // Warning: it is very important t
"The degree <strong>%s</strong> already exists."; // Necessita de tradução
#endif
const char *Txt_The_degree_X_has_been_moved_to_the_centre_Y = // Warning: it is very important to include two %s in the following sentences
#if L==1
"La titulaci&oacute;n <strong>%s</strong> se ha movido"
" al centro <strong>%s</strong>."; // Necessita traduccio
#elif L==2
"The degree <strong>%s</strong> has been moved"
" to the centre <strong>%s</strong>."; // Need Übersetzung
#elif L==3
"The degree <strong>%s</strong> has been moved"
" to the centre <strong>%s</strong>.";
#elif L==4
"La titulaci&oacute;n <strong>%s</strong> se ha movido"
" al centro <strong>%s</strong>.";
#elif L==5
"The degree <strong>%s</strong> has been moved"
" to the centre <strong>%s</strong>."; // Besoin de traduction
#elif L==6
"La titulaci&oacute;n <strong>%s</strong> se ha movido"
" al centro <strong>%s</strong>."; // Okoteve traducción
#elif L==7
"La laurea <strong>%s</strong> &egrave; stata spostata"
" al centro <strong>%s</strong>.";
#elif L==8
"The degree <strong>%s</strong> has been moved"
" to the centre <strong>%s</strong>."; // Potrzebujesz tlumaczenie
#elif L==9
"The degree <strong>%s</strong> has been moved"
" to the centre <strong>%s</strong>."; // Necessita de tradução
#endif
const char *Txt_The_department_X_already_exists = // Warning: it is very important to include %s in the following sentences
#if L==1
"El departamento <strong>%s</strong> ya existe."; // Necessita traduccio