Version 16.234

This commit is contained in:
Antonio Cañas Vargas 2017-06-04 15:11:41 +02:00
parent 86f3976495
commit 6b45207167
13 changed files with 112 additions and 298 deletions

View File

@ -980,16 +980,16 @@ void Acc_CompletelyEliminateAccount (struct UsrData *UsrDat,
bool PhotoRemoved = false; bool PhotoRemoved = false;
/***** Remove the works zones of the user in all courses *****/ /***** Remove the works zones of the user in all courses *****/
Brw_RemoveUsrWorksInAllCrss (UsrDat,QuietOrVerbose); // Make this before of removing the user from the courses Brw_RemoveUsrWorksInAllCrss (UsrDat); // Make this before of removing the user from the courses
/***** Remove the fields of course record in all courses *****/ /***** Remove the fields of course record in all courses *****/
Rec_RemoveFieldsCrsRecordAll (UsrDat->UsrCod,QuietOrVerbose); Rec_RemoveFieldsCrsRecordAll (UsrDat->UsrCod);
/***** Remove user from all the attendance events *****/ /***** Remove user from all the attendance events *****/
Att_RemoveUsrFromAllAttEvents (UsrDat->UsrCod); Att_RemoveUsrFromAllAttEvents (UsrDat->UsrCod);
/***** Remove user from all the groups of all courses *****/ /***** Remove user from all the groups of all courses *****/
Grp_RemUsrFromAllGrps (UsrDat,QuietOrVerbose); Grp_RemUsrFromAllGrps (UsrDat);
/***** Remove user's requests for inscription *****/ /***** Remove user's requests for inscription *****/
sprintf (Query,"DELETE FROM crs_usr_requests WHERE UsrCod=%ld", sprintf (Query,"DELETE FROM crs_usr_requests WHERE UsrCod=%ld",

View File

@ -2599,9 +2599,9 @@ struct Act_Actions Act_Actions[Act_NUM_ACTIONS] =
/* ActNewMaiStd */{1482,-1,TabUnk,ActLstStd ,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,Act_CONT_NORM,Act_THIS_WINDOW,NULL ,Mai_NewOtherUsrEmail ,NULL}, /* ActNewMaiStd */{1482,-1,TabUnk,ActLstStd ,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,Act_CONT_NORM,Act_THIS_WINDOW,NULL ,Mai_NewOtherUsrEmail ,NULL},
/* ActNewMaiTch */{1483,-1,TabUnk,ActLstTch ,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,Act_CONT_NORM,Act_THIS_WINDOW,NULL ,Mai_NewOtherUsrEmail ,NULL}, /* ActNewMaiTch */{1483,-1,TabUnk,ActLstTch ,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,Act_CONT_NORM,Act_THIS_WINDOW,NULL ,Mai_NewOtherUsrEmail ,NULL},
/* ActRemStdCrs */{1462,-1,TabUnk,ActLstStd ,0x3F8,0x3C0, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_THIS_WINDOW,NULL ,Enr_RemUsrFromCrs ,NULL}, /* ActRemStdCrs */{1462,-1,TabUnk,ActLstStd ,0x3F8,0x3C0, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_THIS_WINDOW,Enr_RemUsrFromCrs1 ,Enr_RemUsrFromCrs2 ,NULL},
/* ActRemNETCrs */{1647,-1,TabUnk,ActLstTch ,0x3F0,0x3C0, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_THIS_WINDOW,NULL ,Enr_RemUsrFromCrs ,NULL}, /* ActRemNETCrs */{1647,-1,TabUnk,ActLstTch ,0x3F0,0x3C0, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_THIS_WINDOW,Enr_RemUsrFromCrs1 ,Enr_RemUsrFromCrs2 ,NULL},
/* ActRemTchCrs */{1463,-1,TabUnk,ActLstTch ,0x3E0,0x3C0, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_THIS_WINDOW,NULL ,Enr_RemUsrFromCrs ,NULL}, /* ActRemTchCrs */{1463,-1,TabUnk,ActLstTch ,0x3E0,0x3C0, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_THIS_WINDOW,Enr_RemUsrFromCrs1 ,Enr_RemUsrFromCrs2 ,NULL},
/* ActRemUsrGbl */{ 62,-1,TabUnk,ActLstOth ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_NORM,Act_THIS_WINDOW,NULL ,Acc_GetUsrCodAndRemUsrGbl ,NULL}, /* ActRemUsrGbl */{ 62,-1,TabUnk,ActLstOth ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_NORM,Act_THIS_WINDOW,NULL ,Acc_GetUsrCodAndRemUsrGbl ,NULL},

View File

@ -232,22 +232,20 @@
// TODO: Fix bug: soy profesor no editor y superusuario. Si me modifico en la asignatura, me borro sin querer de los grupos, ya que no me deja elegir grupos. // TODO: Fix bug: soy profesor no editor y superusuario. Si me modifico en la asignatura, me borro sin querer de los grupos, ya que no me deja elegir grupos.
// TODO: Fix bug: no llegan notificaciones de inscripción como profesor no editor. // TODO: Fix bug: no llegan notificaciones de inscripción como profesor no editor.
// TODO: Fix bug: un profesor no editor no debería poder cambiarse a profesor.
// TODO: When a user (student) is removed from a course, remove him in a priori function (check that he can not view Students option)
// TODO: When the role of a user is modified in a course, modify him in a priori function (check that he can not view Students option)
/*****************************************************************************/ /*****************************************************************************/
/****************************** Public constants *****************************/ /****************************** Public constants *****************************/
/*****************************************************************************/ /*****************************************************************************/
#define Log_PLATFORM_VERSION "SWAD 16.233 (2017-06-03)" #define Log_PLATFORM_VERSION "SWAD 16.234 (2017-06-03)"
#define CSS_FILE "swad16.226.css" #define CSS_FILE "swad16.226.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.234: Jun 04, 2017 Removed some verbose messages when removing a user.
Modification / removing of a user is performed in an a priori function. (220995 lines)
Version 16.233: Jun 04, 2017 Code refactoring related with roles. (221175 lines) Version 16.233: Jun 04, 2017 Code refactoring related with roles. (221175 lines)
Version 16.232.8: Jun 03, 2017 Fix bug (an URL like https://openswad.org/es?a gived Internal Server Error). (221147 lines) Version 16.232.8: Jun 03, 2017 Fix bug (an URL like https://openswad.org/es?a gived Internal Server Error). (221147 lines)
Version 16.232.7: Jun 03, 2017 Changed contextual links in institutional links and banners. (221148 lines) Version 16.232.7: Jun 03, 2017 Changed contextual links in institutional links and banners. (221148 lines)

View File

@ -137,13 +137,15 @@ static void Enr_ShowFormToEditOtherUsr (void);
static void Enr_AddAdm (Sco_Scope_t Scope,long Cod,const char *InsCtrDegName); static void Enr_AddAdm (Sco_Scope_t Scope,long Cod,const char *InsCtrDegName);
static void Enr_RegisterAdmin (struct UsrData *UsrDat,Sco_Scope_t Scope, static void Enr_RegisterAdmin (struct UsrData *UsrDat,Sco_Scope_t Scope,
long Cod,const char *InsCtrDegName); long Cod,const char *InsCtrDegName);
static void Enr_ReqRemOrRemUsrFromCrs (Enr_ReqDelOrDelUsr_t ReqDelOrDelUsr);
static bool Enr_CheckIfICanRemUsrFromCrs (void);
static void Enr_ReqRemAdmOfDeg (void); static void Enr_ReqRemAdmOfDeg (void);
static void Enr_ReqRemOrRemAdm (Enr_ReqDelOrDelUsr_t ReqDelOrDelUsr,Sco_Scope_t Scope, static void Enr_ReqRemOrRemAdm (Enr_ReqDelOrDelUsr_t ReqDelOrDelUsr,Sco_Scope_t Scope,
long Cod,const char *InsCtrDegName); long Cod,const char *InsCtrDegName);
static void Enr_ReqAddAdm (Sco_Scope_t Scope,long Cod,const char *InsCtrDegName); static void Enr_ReqAddAdm (Sco_Scope_t Scope,long Cod,const char *InsCtrDegName);
static void Enr_AskIfRemoveUsrFromCrs (struct UsrData *UsrDat,bool ItsMe); static void Enr_AskIfRemoveUsrFromCrs (struct UsrData *UsrDat);
static void Enr_EffectivelyRemUsrFromCrs (struct UsrData *UsrDat,struct Course *Crs, static void Enr_EffectivelyRemUsrFromCrs (struct UsrData *UsrDat,struct Course *Crs,
Enr_RemoveUsrWorks_t RemoveUsrWorks,Cns_QuietOrVerbose_t QuietOrVerbose); Enr_RemoveUsrWorks_t RemoveUsrWorks,Cns_QuietOrVerbose_t QuietOrVerbose);
@ -3438,7 +3440,7 @@ static void Enr_RegisterAdmin (struct UsrData *UsrDat,Sco_Scope_t Scope,long Cod
void Enr_ReqRemMeFromCrs (void) void Enr_ReqRemMeFromCrs (void)
{ {
Enr_AskIfRemoveUsrFromCrs (&Gbl.Usrs.Me.UsrDat,true); Enr_AskIfRemoveUsrFromCrs (&Gbl.Usrs.Me.UsrDat);
} }
/*****************************************************************************/ /*****************************************************************************/
@ -3447,69 +3449,81 @@ void Enr_ReqRemMeFromCrs (void)
void Enr_ReqRemUsrFromCrs (void) void Enr_ReqRemUsrFromCrs (void)
{ {
Enr_ReqRemOrRemUsrFromCrs (Enr_REQUEST_REMOVE_USR); extern const char *Txt_User_not_found_or_you_do_not_have_permission_;
/***** Get user to be removed *****/
if (Usr_GetParamOtherUsrCodEncryptedAndGetUsrData ())
{
if (Enr_CheckIfICanRemUsrFromCrs ())
Enr_AskIfRemoveUsrFromCrs (&Gbl.Usrs.Other.UsrDat);
else
Ale_ShowAlert (Ale_WARNING,Txt_User_not_found_or_you_do_not_have_permission_);
}
else
Ale_ShowAlert (Ale_WARNING,Txt_User_not_found_or_you_do_not_have_permission_);
} }
/*****************************************************************************/ /*****************************************************************************/
/********************* Remove a user from current course *********************/ /********************* Remove a user from current course *********************/
/*****************************************************************************/ /*****************************************************************************/
void Enr_RemUsrFromCrs (void) void Enr_RemUsrFromCrs1 (void)
{ {
extern const char *Txt_User_not_found_or_you_do_not_have_permission_;
if (Pwd_GetConfirmationOnDangerousAction ()) if (Pwd_GetConfirmationOnDangerousAction ())
Enr_ReqRemOrRemUsrFromCrs (Enr_REMOVE_USR); {
/***** Get user to be removed *****/
if (Usr_GetParamOtherUsrCodEncryptedAndGetUsrData ())
{
if (Enr_CheckIfICanRemUsrFromCrs ())
Enr_EffectivelyRemUsrFromCrs (&Gbl.Usrs.Other.UsrDat,&Gbl.CurrentCrs.Crs,
Enr_REMOVE_WORKS,Cns_VERBOSE);
else
{
Gbl.Alert.Type = Ale_WARNING;
sprintf (Gbl.Alert.Txt,"%s",Txt_User_not_found_or_you_do_not_have_permission_);
}
}
else
{
Gbl.Alert.Type = Ale_WARNING;
sprintf (Gbl.Alert.Txt,"%s",Txt_User_not_found_or_you_do_not_have_permission_);
}
}
}
void Enr_RemUsrFromCrs2 (void)
{
Ale_ShowAlert (Gbl.Alert.Type,Gbl.Alert.Txt);
} }
/*****************************************************************************/ /*****************************************************************************/
/******************** Remove of a user from current course *******************/ /*********** Check if I can remove another user in current course ************/
/*****************************************************************************/ /*****************************************************************************/
static void Enr_ReqRemOrRemUsrFromCrs (Enr_ReqDelOrDelUsr_t ReqDelOrDelUsr) static bool Enr_CheckIfICanRemUsrFromCrs (void)
{ {
extern const char *Txt_User_not_found_or_you_do_not_have_permission_; /* Check if it's forbidden remove that user */
bool ItsMe; // A teacher can remove a student or himself
bool ICanRemove; // An administrator can remove anyone
/***** Get user to be removed *****/ switch (Gbl.Usrs.Me.Roles.LoggedRole)
if (Usr_GetParamOtherUsrCodEncryptedAndGetUsrData ())
{ {
/* Check if it's forbidden remove that user */ case Rol_STD:
// A teacher can remove a student or himself case Rol_NET:
// An administrator can remove anyone return (Gbl.Usrs.Me.UsrDat.UsrCod == Gbl.Usrs.Other.UsrDat.UsrCod); // It's me?
ItsMe = (Gbl.Usrs.Me.UsrDat.UsrCod == Gbl.Usrs.Other.UsrDat.UsrCod); case Rol_TCH:
switch (Gbl.Usrs.Me.Roles.LoggedRole) case Rol_DEG_ADM:
{ case Rol_CTR_ADM:
case Rol_STD: case Rol_INS_ADM:
case Rol_NET: case Rol_SYS_ADM:
ICanRemove = ItsMe; return true;
break; break;
case Rol_TCH: default:
case Rol_DEG_ADM: return false;
case Rol_CTR_ADM: break;
case Rol_INS_ADM:
case Rol_SYS_ADM:
ICanRemove = true;
break;
default:
ICanRemove = false;
break;
}
if (ICanRemove)
switch (ReqDelOrDelUsr)
{
case Enr_REQUEST_REMOVE_USR: // Ask if remove user from current course
Enr_AskIfRemoveUsrFromCrs (&Gbl.Usrs.Other.UsrDat,ItsMe);
break;
case Enr_REMOVE_USR: // Remove user from current course
Enr_EffectivelyRemUsrFromCrs (&Gbl.Usrs.Other.UsrDat,&Gbl.CurrentCrs.Crs,
Enr_REMOVE_WORKS,Cns_VERBOSE);
break;
}
else
Ale_ShowAlert (Ale_WARNING,Txt_User_not_found_or_you_do_not_have_permission_);
} }
else
Ale_ShowAlert (Ale_WARNING,Txt_User_not_found_or_you_do_not_have_permission_);
} }
/*****************************************************************************/ /*****************************************************************************/
@ -4069,19 +4083,22 @@ void Enr_AcceptUsrInCrs (long UsrCod)
/******************* Ask if really wanted to remove a user *******************/ /******************* Ask if really wanted to remove a user *******************/
/*****************************************************************************/ /*****************************************************************************/
static void Enr_AskIfRemoveUsrFromCrs (struct UsrData *UsrDat,bool ItsMe) static void Enr_AskIfRemoveUsrFromCrs (struct UsrData *UsrDat)
{ {
extern const char *Txt_Do_you_really_want_to_be_removed_from_the_course_X; extern const char *Txt_Do_you_really_want_to_be_removed_from_the_course_X;
extern const char *Txt_Do_you_really_want_to_remove_the_following_user_from_the_course_X; extern const char *Txt_Do_you_really_want_to_remove_the_following_user_from_the_course_X;
extern const char *Txt_Remove_me_from_this_course; extern const char *Txt_Remove_me_from_this_course;
extern const char *Txt_Remove_user_from_this_course; extern const char *Txt_Remove_user_from_this_course;
extern const char *Txt_User_not_found_or_you_do_not_have_permission_; extern const char *Txt_User_not_found_or_you_do_not_have_permission_;
bool ItsMe;
Act_Action_t NextAction; Act_Action_t NextAction;
if (Usr_CheckIfUsrBelongsToCrs (UsrDat->UsrCod, if (Usr_CheckIfUsrBelongsToCrs (UsrDat->UsrCod,
Gbl.CurrentCrs.Crs.CrsCod, Gbl.CurrentCrs.Crs.CrsCod,
false)) false))
{ {
ItsMe = (Gbl.Usrs.Me.UsrDat.UsrCod == Gbl.Usrs.Other.UsrDat.UsrCod);
/***** Show question and button to remove user as administrator *****/ /***** Show question and button to remove user as administrator *****/
/* Start alert */ /* Start alert */
sprintf (Gbl.Alert.Txt, sprintf (Gbl.Alert.Txt,
@ -4134,6 +4151,7 @@ static void Enr_EffectivelyRemUsrFromCrs (struct UsrData *UsrDat,struct Course *
extern const char *Txt_THE_USER_X_has_been_removed_from_the_course_Y; extern const char *Txt_THE_USER_X_has_been_removed_from_the_course_Y;
extern const char *Txt_User_not_found_or_you_do_not_have_permission_; extern const char *Txt_User_not_found_or_you_do_not_have_permission_;
char Query[1024]; char Query[1024];
bool ItsMe;
if (Usr_CheckIfUsrBelongsToCrs (UsrDat->UsrCod, if (Usr_CheckIfUsrBelongsToCrs (UsrDat->UsrCod,
Crs->CrsCod, Crs->CrsCod,
@ -4143,17 +4161,17 @@ static void Enr_EffectivelyRemUsrFromCrs (struct UsrData *UsrDat,struct Course *
Att_RemoveUsrFromCrsAttEvents (UsrDat->UsrCod,Crs->CrsCod); Att_RemoveUsrFromCrsAttEvents (UsrDat->UsrCod,Crs->CrsCod);
/***** Remove user from all the groups in course *****/ /***** Remove user from all the groups in course *****/
Grp_RemUsrFromAllGrpsInCrs (UsrDat,Crs,QuietOrVerbose); Grp_RemUsrFromAllGrpsInCrs (UsrDat,Crs);
/***** Remove user's status about reading of course information *****/ /***** Remove user's status about reading of course information *****/
Inf_RemoveUsrFromCrsInfoRead (UsrDat->UsrCod,Crs->CrsCod); Inf_RemoveUsrFromCrsInfoRead (UsrDat->UsrCod,Crs->CrsCod);
/***** Remove works zone of this user in course *****/ /***** Remove works zone of this user in course *****/
if (RemoveUsrWorks == Enr_REMOVE_WORKS) if (RemoveUsrWorks == Enr_REMOVE_WORKS)
Brw_RemoveUsrWorksInCrs (UsrDat,Crs,QuietOrVerbose); Brw_RemoveUsrWorksInCrs (UsrDat,Crs);
/***** Remove fields of this user in its course record *****/ /***** Remove fields of this user in its course record *****/
Rec_RemoveFieldsCrsRecordInCrs (UsrDat->UsrCod,Crs,QuietOrVerbose); Rec_RemoveFieldsCrsRecordInCrs (UsrDat->UsrCod,Crs);
/***** Remove some information about files in course and groups *****/ /***** Remove some information about files in course and groups *****/
Brw_RemoveSomeInfoAboutCrsUsrFilesFromDB (UsrDat->UsrCod,Crs->CrsCod); Brw_RemoveSomeInfoAboutCrsUsrFilesFromDB (UsrDat->UsrCod,Crs->CrsCod);
@ -4171,16 +4189,28 @@ static void Enr_EffectivelyRemUsrFromCrs (struct UsrData *UsrDat,struct Course *
Crs->CrsCod,UsrDat->UsrCod); Crs->CrsCod,UsrDat->UsrCod);
DB_QueryDELETE (Query,"can not remove a user from a course"); DB_QueryDELETE (Query,"can not remove a user from a course");
/***** If it's me, change my roles *****/
ItsMe = (UsrDat->UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod);
if (ItsMe)
{
Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrsDB = UsrDat->Roles.InCurrentCrsDB = Rol_UNK;
Gbl.Usrs.Me.UsrDat.Roles.InCrss = UsrDat->Roles.InCrss = -1; // not yet filled/calculated
Rol_SetMyRoles ();
}
if (QuietOrVerbose == Cns_VERBOSE) if (QuietOrVerbose == Cns_VERBOSE)
{ {
Gbl.Alert.Type = Ale_SUCCESS;
sprintf (Gbl.Alert.Txt,Txt_THE_USER_X_has_been_removed_from_the_course_Y, sprintf (Gbl.Alert.Txt,Txt_THE_USER_X_has_been_removed_from_the_course_Y,
UsrDat->FullName,Crs->FullName); UsrDat->FullName,Crs->FullName);
Ale_ShowAlert (Ale_SUCCESS,Gbl.Alert.Txt);
} }
} }
else // User does not belong to course else // User does not belong to course
if (QuietOrVerbose == Cns_VERBOSE) if (QuietOrVerbose == Cns_VERBOSE)
Ale_ShowAlert (Ale_WARNING,Txt_User_not_found_or_you_do_not_have_permission_); {
Gbl.Alert.Type = Ale_WARNING;
sprintf (Gbl.Alert.Txt,"%s",Txt_User_not_found_or_you_do_not_have_permission_);
}
} }
/*****************************************************************************/ /*****************************************************************************/

View File

@ -130,7 +130,8 @@ void Enr_AddAdmToDeg (void);
void Enr_ReqRemMeFromCrs (void); void Enr_ReqRemMeFromCrs (void);
void Enr_ReqRemUsrFromCrs (void); void Enr_ReqRemUsrFromCrs (void);
void Enr_RemUsrFromCrs (void); void Enr_RemUsrFromCrs1 (void);
void Enr_RemUsrFromCrs2 (void);
void Enr_RemAdmIns (void); void Enr_RemAdmIns (void);
void Enr_RemAdmCtr (void); void Enr_RemAdmCtr (void);
void Enr_RemAdmDeg (void); void Enr_RemAdmDeg (void);

View File

@ -11181,9 +11181,8 @@ void Brw_RemoveGrpZones (long CrsCod,long GrpCod)
/***************** Remove the works of a user in a course ********************/ /***************** Remove the works of a user in a course ********************/
/*****************************************************************************/ /*****************************************************************************/
void Brw_RemoveUsrWorksInCrs (struct UsrData *UsrDat,struct Course *Crs,Cns_QuietOrVerbose_t QuietOrVerbose) void Brw_RemoveUsrWorksInCrs (struct UsrData *UsrDat,struct Course *Crs)
{ {
extern const char *Txt_Works_of_X_in_Y_removed;
char PathUsrInCrs[PATH_MAX + 1]; char PathUsrInCrs[PATH_MAX + 1];
/***** Remove user's works in the course from database *****/ /***** Remove user's works in the course from database *****/
@ -11195,23 +11194,14 @@ void Brw_RemoveUsrWorksInCrs (struct UsrData *UsrDat,struct Course *Crs,Cns_Quie
(unsigned) (UsrDat->UsrCod % 100),UsrDat->UsrCod); (unsigned) (UsrDat->UsrCod % 100),UsrDat->UsrCod);
Fil_RemoveTree (PathUsrInCrs); Fil_RemoveTree (PathUsrInCrs);
// If this was the last user in his/her subfolder ==> the subfolder will be empty // If this was the last user in his/her subfolder ==> the subfolder will be empty
/***** Write message *****/
if (QuietOrVerbose == Cns_VERBOSE)
{
sprintf (Gbl.Alert.Txt,Txt_Works_of_X_in_Y_removed,
UsrDat->FullName,Crs->FullName);
Ale_ShowAlert (Ale_SUCCESS,Gbl.Alert.Txt);
}
} }
/*****************************************************************************/ /*****************************************************************************/
/************* Remove the works of a user in all of his courses **************/ /************* Remove the works of a user in all of his courses **************/
/*****************************************************************************/ /*****************************************************************************/
void Brw_RemoveUsrWorksInAllCrss (struct UsrData *UsrDat,Cns_QuietOrVerbose_t QuietOrVerbose) void Brw_RemoveUsrWorksInAllCrss (struct UsrData *UsrDat)
{ {
extern const char *Txt_The_works_of_X_have_been_removed_in_a_total_of_Y_of_his_her_Z_courses;
MYSQL_RES *mysql_res; MYSQL_RES *mysql_res;
MYSQL_ROW row; MYSQL_ROW row;
unsigned long NumRow,NumRows; unsigned long NumRow,NumRows;
@ -11231,21 +11221,13 @@ void Brw_RemoveUsrWorksInAllCrss (struct UsrData *UsrDat,Cns_QuietOrVerbose_t Qu
Crs.CrsCod = Str_ConvertStrCodToLongCod (row[0]); Crs.CrsCod = Str_ConvertStrCodToLongCod (row[0]);
/* Get data of course */ /* Get data of course */
Crs_GetDataOfCourseByCod (&Crs); Crs_GetDataOfCourseByCod (&Crs);
Brw_RemoveUsrWorksInCrs (UsrDat,&Crs,QuietOrVerbose); Brw_RemoveUsrWorksInCrs (UsrDat,&Crs);
NumCrssWorksRemoved++; NumCrssWorksRemoved++;
} }
} }
/***** Free structure that stores the query result *****/ /***** Free structure that stores the query result *****/
DB_FreeMySQLResult (&mysql_res); DB_FreeMySQLResult (&mysql_res);
/***** Write message *****/
if (QuietOrVerbose == Cns_VERBOSE)
{
sprintf (Gbl.Alert.Txt,Txt_The_works_of_X_have_been_removed_in_a_total_of_Y_of_his_her_Z_courses,
UsrDat->FullName,NumCrssWorksRemoved,(unsigned) NumRows);
Ale_ShowAlert (Ale_SUCCESS,Gbl.Alert.Txt);
}
} }
/*****************************************************************************/ /*****************************************************************************/

View File

@ -248,8 +248,8 @@ void Brw_PutParamsFileBrowser (Act_Action_t NextAction,
void Brw_RemoveZonesOfGroupsOfType (long GrpTypCod); void Brw_RemoveZonesOfGroupsOfType (long GrpTypCod);
void Brw_RemoveGrpZones (long CrsCod,long GrpCod); void Brw_RemoveGrpZones (long CrsCod,long GrpCod);
void Brw_RemoveUsrWorksInCrs (struct UsrData *UsrDat,struct Course *Crs,Cns_QuietOrVerbose_t QuietOrVerbose); void Brw_RemoveUsrWorksInCrs (struct UsrData *UsrDat,struct Course *Crs);
void Brw_RemoveUsrWorksInAllCrss (struct UsrData *UsrDat,Cns_QuietOrVerbose_t QuietOrVerbose); void Brw_RemoveUsrWorksInAllCrss (struct UsrData *UsrDat);
void Brw_GetSummaryAndContentOfFile (char SummaryStr[Ntf_MAX_BYTES_SUMMARY + 1], void Brw_GetSummaryAndContentOfFile (char SummaryStr[Ntf_MAX_BYTES_SUMMARY + 1],
char **ContentStr, char **ContentStr,

View File

@ -1113,9 +1113,8 @@ unsigned Grp_RemoveUsrFromGroups (struct UsrData *UsrDat,struct ListCodGrps *Lst
/*************** Remove a user of all the groups of a course *****************/ /*************** Remove a user of all the groups of a course *****************/
/*****************************************************************************/ /*****************************************************************************/
void Grp_RemUsrFromAllGrpsInCrs (struct UsrData *UsrDat,struct Course *Crs,Cns_QuietOrVerbose_t QuietOrVerbose) void Grp_RemUsrFromAllGrpsInCrs (struct UsrData *UsrDat,struct Course *Crs)
{ {
extern const char *Txt_THE_USER_X_has_been_removed_from_all_groups_of_the_course_Y;
char Query[512]; char Query[512];
/***** Remove user from all the groups of the course *****/ /***** Remove user from all the groups of the course *****/
@ -1126,37 +1125,20 @@ void Grp_RemUsrFromAllGrpsInCrs (struct UsrData *UsrDat,struct Course *Crs,Cns_Q
" AND crs_grp_types.GrpTypCod=crs_grp.GrpTypCod)", " AND crs_grp_types.GrpTypCod=crs_grp.GrpTypCod)",
UsrDat->UsrCod,Crs->CrsCod); UsrDat->UsrCod,Crs->CrsCod);
DB_QueryDELETE (Query,"can not remove a user from all groups of a course"); DB_QueryDELETE (Query,"can not remove a user from all groups of a course");
/***** Write message to show the change made *****/
if (QuietOrVerbose == Cns_VERBOSE)
{
sprintf (Gbl.Alert.Txt,Txt_THE_USER_X_has_been_removed_from_all_groups_of_the_course_Y,
UsrDat->FullName,Crs->FullName);
Ale_ShowAlert (Ale_SUCCESS,Gbl.Alert.Txt);
}
} }
/*****************************************************************************/ /*****************************************************************************/
/******* Remove a user from all the groups of all the user's courses *********/ /******* Remove a user from all the groups of all the user's courses *********/
/*****************************************************************************/ /*****************************************************************************/
void Grp_RemUsrFromAllGrps (struct UsrData *UsrDat,Cns_QuietOrVerbose_t QuietOrVerbose) void Grp_RemUsrFromAllGrps (struct UsrData *UsrDat)
{ {
extern const char *Txt_THE_USER_X_has_been_removed_from_all_groups_in_all_courses;
char Query[128]; char Query[128];
/***** Remove user from all groups *****/ /***** Remove user from all groups *****/
sprintf (Query,"DELETE FROM crs_grp_usr WHERE UsrCod=%ld", sprintf (Query,"DELETE FROM crs_grp_usr WHERE UsrCod=%ld",
UsrDat->UsrCod); UsrDat->UsrCod);
DB_QueryDELETE (Query,"can not remove a user from the groups he/she belongs to"); DB_QueryDELETE (Query,"can not remove a user from the groups he/she belongs to");
/***** Write message to show the change made *****/
if (QuietOrVerbose == Cns_VERBOSE)
{
sprintf (Gbl.Alert.Txt,Txt_THE_USER_X_has_been_removed_from_all_groups_in_all_courses,
UsrDat->FullName);
Ale_ShowAlert (Ale_SUCCESS,Gbl.Alert.Txt);
}
} }
/*****************************************************************************/ /*****************************************************************************/

View File

@ -148,8 +148,8 @@ bool Grp_ChangeGrpsOtherUsrAtomically (struct ListCodGrps *LstGrpsUsrWants);
bool Grp_CheckIfSelectionGrpsIsValid (struct ListCodGrps *LstGrps); bool Grp_CheckIfSelectionGrpsIsValid (struct ListCodGrps *LstGrps);
void Grp_RegisterUsrIntoGroups (struct UsrData *UsrDat,struct ListCodGrps *LstGrps); void Grp_RegisterUsrIntoGroups (struct UsrData *UsrDat,struct ListCodGrps *LstGrps);
unsigned Grp_RemoveUsrFromGroups (struct UsrData *UsrDat,struct ListCodGrps *LstGrps); unsigned Grp_RemoveUsrFromGroups (struct UsrData *UsrDat,struct ListCodGrps *LstGrps);
void Grp_RemUsrFromAllGrpsInCrs (struct UsrData *UsrDat,struct Course *Crs,Cns_QuietOrVerbose_t QuietOrVerbose); void Grp_RemUsrFromAllGrpsInCrs (struct UsrData *UsrDat,struct Course *Crs);
void Grp_RemUsrFromAllGrps (struct UsrData *UsrDat,Cns_QuietOrVerbose_t QuietOrVerbose); void Grp_RemUsrFromAllGrps (struct UsrData *UsrDat);
void Grp_ListGrpsToEditAsgAttOrSvy (struct GroupType *GrpTyp,long Cod,Grp_AsgOrSvy_t Grp_AsgOrSvy); void Grp_ListGrpsToEditAsgAttOrSvy (struct GroupType *GrpTyp,long Cod,Grp_AsgOrSvy_t Grp_AsgOrSvy);
void Grp_ReqRegisterInGrps (void); void Grp_ReqRegisterInGrps (void);

View File

@ -1994,9 +1994,8 @@ void Rec_UpdateCrsRecord (long UsrCod)
/************ Remove fields of record of a user in current course ************/ /************ Remove fields of record of a user in current course ************/
/*****************************************************************************/ /*****************************************************************************/
void Rec_RemoveFieldsCrsRecordInCrs (long UsrCod,struct Course *Crs,Cns_QuietOrVerbose_t QuietOrVerbose) void Rec_RemoveFieldsCrsRecordInCrs (long UsrCod,struct Course *Crs)
{ {
extern const char *Txt_User_record_card_in_the_course_X_has_been_removed;
char Query[256]; char Query[256];
/***** Remove text of the field of record course *****/ /***** Remove text of the field of record course *****/
@ -2005,32 +2004,19 @@ void Rec_RemoveFieldsCrsRecordInCrs (long UsrCod,struct Course *Crs,Cns_QuietOrV
" (SELECT FieldCod FROM crs_record_fields WHERE CrsCod=%ld)", " (SELECT FieldCod FROM crs_record_fields WHERE CrsCod=%ld)",
UsrCod,Crs->CrsCod); UsrCod,Crs->CrsCod);
DB_QueryDELETE (Query,"can not remove user's record in a course"); DB_QueryDELETE (Query,"can not remove user's record in a course");
/***** Write mensaje *****/
if (QuietOrVerbose == Cns_VERBOSE)
{
sprintf (Gbl.Alert.Txt,Txt_User_record_card_in_the_course_X_has_been_removed,
Crs->FullName);
Ale_ShowAlert (Ale_SUCCESS,Gbl.Alert.Txt);
}
} }
/*****************************************************************************/ /*****************************************************************************/
/************* Remove fields of record of a user in all courses **************/ /************* Remove fields of record of a user in all courses **************/
/*****************************************************************************/ /*****************************************************************************/
void Rec_RemoveFieldsCrsRecordAll (long UsrCod,Cns_QuietOrVerbose_t QuietOrVerbose) void Rec_RemoveFieldsCrsRecordAll (long UsrCod)
{ {
extern const char *Txt_User_record_cards_in_all_courses_have_been_removed;
char Query[128]; char Query[128];
/***** Remove text of the field of record course *****/ /***** Remove text of the field of record course *****/
sprintf (Query,"DELETE FROM crs_records WHERE UsrCod=%ld",UsrCod); sprintf (Query,"DELETE FROM crs_records WHERE UsrCod=%ld",UsrCod);
DB_QueryDELETE (Query,"can not remove user's records in all courses"); DB_QueryDELETE (Query,"can not remove user's records in all courses");
/***** Write mensaje *****/
if (QuietOrVerbose == Cns_VERBOSE)
Ale_ShowAlert (Ale_SUCCESS,Txt_User_record_cards_in_all_courses_have_been_removed);
} }
/*****************************************************************************/ /*****************************************************************************/

View File

@ -155,8 +155,8 @@ void Rec_UpdateAndShowOtherCrsRecord (void);
unsigned long Rec_GetFieldFromCrsRecord (long UsrCod,long FieldCod,MYSQL_RES **mysql_res); unsigned long Rec_GetFieldFromCrsRecord (long UsrCod,long FieldCod,MYSQL_RES **mysql_res);
void Rec_GetFieldsCrsRecordFromForm (void); void Rec_GetFieldsCrsRecordFromForm (void);
void Rec_UpdateCrsRecord (long UsrCod); void Rec_UpdateCrsRecord (long UsrCod);
void Rec_RemoveFieldsCrsRecordInCrs (long UsrCod,struct Course *Crs,Cns_QuietOrVerbose_t QuietOrVerbose); void Rec_RemoveFieldsCrsRecordInCrs (long UsrCod,struct Course *Crs);
void Rec_RemoveFieldsCrsRecordAll (long UsrCod,Cns_QuietOrVerbose_t QuietOrVerbose); void Rec_RemoveFieldsCrsRecordAll (long UsrCod);
void Rec_AllocMemFieldsRecordsCrs (void); void Rec_AllocMemFieldsRecordsCrs (void);
void Rec_FreeMemFieldsRecordsCrs (void); void Rec_FreeMemFieldsRecordsCrs (void);

View File

@ -73,9 +73,9 @@ void Rol_SetMyRoles (void)
Rol_GetRolesInAllCrssIfNotYetGot (&Gbl.Usrs.Me.UsrDat); // Get my roles if not yet got Rol_GetRolesInAllCrssIfNotYetGot (&Gbl.Usrs.Me.UsrDat); // Get my roles if not yet got
Gbl.Usrs.Me.Roles.Max = Rol_GetMaxRoleInCrss ((unsigned) Gbl.Usrs.Me.UsrDat.Roles.InCrss); Gbl.Usrs.Me.Roles.Max = Rol_GetMaxRoleInCrss ((unsigned) Gbl.Usrs.Me.UsrDat.Roles.InCrss);
Gbl.Usrs.Me.Roles.LoggedRole = (Gbl.Usrs.Me.Roles.RoleFromSession == Rol_UNK) ? // If no logged role retrieved from session... Gbl.Usrs.Me.Roles.LoggedRole = (Gbl.Usrs.Me.Roles.RoleFromSession == Rol_UNK) ? // If no logged role retrieved from session...
((Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrsDB == Rol_UNK) ? Rol_USR : ((Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrsDB == Rol_UNK) ? Rol_USR :
Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrsDB) : Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrsDB) :
Gbl.Usrs.Me.Roles.RoleFromSession; // Get logged role from session Gbl.Usrs.Me.Roles.RoleFromSession; // Get logged role from session
/***** Check if I am administrator of current institution/centre/degree *****/ /***** Check if I am administrator of current institution/centre/degree *****/
if (Gbl.CurrentIns.Ins.InsCod > 0) if (Gbl.CurrentIns.Ins.InsCod > 0)

View File

@ -46269,66 +46269,6 @@ const char *Txt_THE_USER_X_has_been_removed_as_administrator = // Warning: it is
"<strong>%s</strong> has been removed as administrator."; // Necessita de tradução "<strong>%s</strong> has been removed as administrator."; // Necessita de tradução
#endif #endif
const char *Txt_THE_USER_X_has_been_removed_from_all_groups_in_all_courses = // Warning: it is very important to include %s in the following sentences
#if L==1
"<strong>%s</strong> ha sido eliminado/a"
" de todos los grupos de todas sus asignaturas."; // Necessita traduccio
#elif L==2
"<strong>%s</strong> has been removed"
" from all groups in all courses."; // Übersetzung notwendig
#elif L==3
"<strong>%s</strong> has been removed"
" from all groups in all courses.";
#elif L==4
"<strong>%s</strong> ha sido eliminado/a"
" de todos los grupos de todas sus asignaturas.";
#elif L==5
"<strong>%s</strong> has been removed"
" from all groups in all courses."; // Besoin de traduction
#elif L==6
"<strong>%s</strong> ha sido eliminado/a"
" de todos los grupos de todas sus asignaturas."; // Okoteve traducción
#elif L==7
"<strong>%s</strong> &egrave; stato rimosso"
" da tutti i gruppi di tutti i corsi.";
#elif L==8
"<strong>%s</strong> has been removed"
" from all groups in all courses."; // Potrzebujesz tlumaczenie
#elif L==9
"<strong>%s</strong> has been removed"
" from all groups in all courses."; // Necessita de tradução
#endif
const char *Txt_THE_USER_X_has_been_removed_from_all_groups_of_the_course_Y = // Warning: it is very important to include two %s in the following sentences
#if L==1
"<strong>%s</strong> ha sido eliminado/a"
" de todos los grupos de la asignatura <strong>%s</strong>."; // Necessita traduccio
#elif L==2
"<strong>%s</strong> has been removed"
" from all groups of the course <strong>%s</strong>."; // Übersetzung notwendig
#elif L==3
"<strong>%s</strong> has been removed"
" from all groups of the course <strong>%s</strong>.";
#elif L==4
"<strong>%s</strong> ha sido eliminado/a"
" de todos los grupos de la asignatura <strong>%s</strong>.";
#elif L==5
"<strong>%s</strong> has been removed"
" from all groups of the course <strong>%s</strong>."; // Besoin de traduction
#elif L==6
"<strong>%s</strong> ha sido eliminado/a"
" de todos los grupos de la asignatura <strong>%s</strong>."; // Okoteve traducción
#elif L==7
"<strong>%s</strong> &egrave; stato rimosso"
" da tutti i gruppi del corso <strong>%s</strong>.";
#elif L==8
"<strong>%s</strong> has been removed"
" from all groups of the course <strong>%s</strong>."; // Potrzebujesz tlumaczenie
#elif L==9
"<strong>%s</strong> has been removed"
" from all groups of the course <strong>%s</strong>."; // Necessita de tradução
#endif
const char *Txt_THE_USER_X_has_been_removed_from_all_his_her_courses = // Warning: it is very important to include %s in the following sentences const char *Txt_THE_USER_X_has_been_removed_from_all_his_her_courses = // Warning: it is very important to include %s in the following sentences
#if L==1 #if L==1
"<strong>%s</strong> ha sido eliminado/a de todas sus asignaturas."; // Necessita traduccio "<strong>%s</strong> ha sido eliminado/a de todas sus asignaturas."; // Necessita traduccio
@ -46749,39 +46689,6 @@ const char *Txt_The_whole_course =
"Toda a disciplina"; "Toda a disciplina";
#endif #endif
const char *Txt_The_works_of_X_have_been_removed_in_a_total_of_Y_of_his_her_Z_courses = // Warning: it is very important to include all %s and %u, in the correct order, in the following sentences
#if L==1
"Se han eliminado todos los trabajos"
" de <strong>%s</strong>"
" en un total de %u de sus %u asignaturas."; // Necessita traduccio
#elif L==2
"The works of <strong>%s</strong>"
" have been removed in a total of %u of her/his %u courses."; // Need Übersetzung
#elif L==3
"The works of <strong>%s</strong>"
" have been removed in a total of %u of her/his %u courses.";
#elif L==4
"Se han eliminado todos los trabajos"
" de <strong>%s</strong>"
" en un total de %u de sus %u asignaturas.";
#elif L==5
"The works of <strong>%s</strong>"
" have been removed in a total of %u of her/his %u courses."; // Besoin de traduction
#elif L==6
"Se han eliminado todos los trabajos"
" de <strong>%s</strong>"
" en un total de %u de sus %u asignaturas."; // Okoteve traducción
#elif L==7
"I lavori de <strong>%s</strong>"
" sono stati rimossi in un totale di %u dei suoi corsi.";
#elif L==8
"The works of <strong>%s</strong>"
" have been removed in a total of %u of her/his %u courses."; // Potrzebujesz tlumaczenie
#elif L==9
"The works of <strong>%s</strong>"
" have been removed in a total of %u of her/his %u courses."; // Necessita de tradução
#endif
const char *Txt_The_year_X_is_not_allowed = // Warning: it is very important to include %u in the following sentences const char *Txt_The_year_X_is_not_allowed = // Warning: it is very important to include %u in the following sentences
#if L==1 #if L==1
"El a&ntilde;o/semestre <strong>%u</strong> no est&aacute; permitido."; // Necessita traduccio "El a&ntilde;o/semestre <strong>%u</strong> no est&aacute; permitido."; // Necessita traduccio
@ -50306,48 +50213,6 @@ const char *Txt_User_not_found_or_you_do_not_have_permission_ =
" para realizar esta a&ccedil;&atilde;o."; " para realizar esta a&ccedil;&atilde;o.";
#endif #endif
const char *Txt_User_record_card_in_the_course_X_has_been_removed = // Warning: it is very important to include %s in the following sentences
#if L==1
"La ficha del usuario en la asignatura <strong>%s</strong> ha sido eliminada."; // Necessita traduccio
#elif L==2
"User record card in the course <strong>%s</strong> has been removed."; // Need Übersetzung
#elif L==3
"User record card in the course <strong>%s</strong> has been removed.";
#elif L==4
"La ficha del usuario en la asignatura <strong>%s</strong> ha sido eliminada.";
#elif L==5
"User record card in the course <strong>%s</strong> has been removed."; // Besoin de traduction
#elif L==6
"La ficha del usuario en la asignatura <strong>%s</strong> ha sido eliminada."; // Okoteve traducción
#elif L==7
"La scheda dell'utente nel corso <strong>%s</strong> &egrave; stata rimossa.";
#elif L==8
"User record card in the course <strong>%s</strong> has been removed."; // Potrzebujesz tlumaczenie
#elif L==9
"User record card in the course <strong>%s</strong> has been removed."; // Necessita de tradução
#endif
const char *Txt_User_record_cards_in_all_courses_have_been_removed =
#if L==1
"Se han eliminado las fichas del usuario en todas las asignaturas."; // Necessita traduccio
#elif L==2
"User record cards in all courses have been removed."; // Need Übersetzung
#elif L==3
"User record cards in all courses have been removed.";
#elif L==4
"Se han eliminado las fichas del usuario en todas las asignaturas.";
#elif L==5
"User record cards in all courses have been removed."; // Besoin de traduction
#elif L==6
"Se han eliminado las fichas del usuario en todas las asignaturas."; // Okoteve traducción
#elif L==7
"Le schede dell'utente in tutti i corsi sono state rimosse.";
#elif L==8
"User record cards in all courses have been removed."; // Potrzebujesz tlumaczenie
#elif L==9
"User record cards in all courses have been removed."; // Necessita de tradução
#endif
const char *Txt_Users = const char *Txt_Users =
#if L==1 #if L==1
"Usuaris"; "Usuaris";
@ -51733,36 +51598,6 @@ const char *Txt_works_ZIP_FILE_NAME = // Name (without extension) of the ZIP fil
"trabalhos"; "trabalhos";
#endif #endif
const char *Txt_Works_of_X_in_Y_removed = // Warning: it is very important to include two %s in the following sentences
#if L==1
"Trabajos de <strong>%s</strong>"
" en <strong>%s</strong> eliminados."; // Necessita traduccio
#elif L==2
"Die Hausarbeiten von <strong>%s</strong>"
" in <strong>%s</strong> wurden entfernt.";
#elif L==3
"The homework of <strong>%s</strong>"
" in <strong>%s</strong> has been removed.";
#elif L==4
"Trabajos de <strong>%s</strong>"
" en <strong>%s</strong> eliminados.";
#elif L==5
"Homework of <strong>%s</strong>"
" in <strong>%s</strong> removed."; // Besoin de traduction
#elif L==6
"Trabajos de <strong>%s</strong>"
" en <strong>%s</strong> eliminados."; // Okoteve traducción
#elif L==7
"Lavori de <strong>%s</strong>"
" in <strong>%s</strong> rimossi.";
#elif L==8
"The homework of <strong>%s</strong>"
" in <strong>%s</strong> has been removed."; // Potrzebujesz tlumaczenie
#elif L==9
"Homework of <strong>%s</strong>"
" in <strong>%s</strong> removed."; // Necessita de tradução
#endif
const char *Txt_Works_area = const char *Txt_Works_area =
#if L==1 #if L==1
"Zona d'altres treballs"; "Zona d'altres treballs";