Version 14.134

This commit is contained in:
Antonio Cañas Vargas 2015-09-17 20:41:31 +02:00
parent 0a0e22e86a
commit df5cf12a1c
8 changed files with 350 additions and 134 deletions

View File

@ -10612,3 +10612,55 @@ ALTER TABLE usr_webs CHANGE Web Web ENUM('www','500px','delicious','deviantart',
ALTER TABLE usr_webs CHANGE Web Web ENUM('www','500px','delicious','deviantart','diaspora','edmodo','facebook','flickr','foursquare','github','gnusocial','googleplus','googlescholar','identica','instagram','linkedin','orcid','paperli','pinterest','quitter','researchgate','researcherid','scoopit','slideshare','storify','tumblr','twitter','wikipedia','youtube') NOT NULL; ALTER TABLE usr_webs CHANGE Web Web ENUM('www','500px','delicious','deviantart','diaspora','edmodo','facebook','flickr','foursquare','github','gnusocial','googleplus','googlescholar','identica','instagram','linkedin','orcid','paperli','pinterest','quitter','researchgate','researcherid','scoopit','slideshare','storify','tumblr','twitter','wikipedia','youtube') NOT NULL;
----- 2015-09-17, swad14.134
/*
UPDATE notif SET NotifyEvent=14 WHERE NotifyEvent=13;
UPDATE notif SET NotifyEvent=13 WHERE NotifyEvent=12;
UPDATE notif SET NotifyEvent=12 WHERE NotifyEvent=11;
UPDATE notif SET NotifyEvent=11 WHERE NotifyEvent=10;
UPDATE notif SET NotifyEvent=10 WHERE NotifyEvent=9;
UPDATE notif SET NotifyEvent=9 WHERE NotifyEvent=8;
UPDATE notif SET NotifyEvent=8 WHERE NotifyEvent=7;
UPDATE sta_notif SET NotifyEvent=14 WHERE NotifyEvent=13;
UPDATE sta_notif SET NotifyEvent=13 WHERE NotifyEvent=12;
UPDATE sta_notif SET NotifyEvent=12 WHERE NotifyEvent=11;
UPDATE sta_notif SET NotifyEvent=11 WHERE NotifyEvent=10;
UPDATE sta_notif SET NotifyEvent=10 WHERE NotifyEvent=9;
UPDATE sta_notif SET NotifyEvent=9 WHERE NotifyEvent=8;
UPDATE sta_notif SET NotifyEvent=8 WHERE NotifyEvent=7;
UPDATE usr_data SET NotifNtfEvents=(((NotifNtfEvents & ~0x7F) << 1) | (NotifNtfEvents & 0x7F) | 0x80);
UPDATE usr_data SET EmailNtfEvents=(((EmailNtfEvents & ~0x7F) << 1) | (EmailNtfEvents & 0x7F));
Ntf_EVENT_UNKNOWN = 0, // old 0
/* Course tab */
Ntf_EVENT_DOCUMENT_FILE = 1, // old 1
Ntf_EVENT_SHARED_FILE = 2, // old 2
/* Assessment tab */
Ntf_EVENT_ASSIGNMENT = 3, // old 3
Ntf_EVENT_EXAM_ANNOUNCEMENT = 4, // old 4
Ntf_EVENT_MARKS_FILE = 5, // old 5
/* Enrollment tab */
Ntf_EVENT_ENROLLMENT_STUDENT = 6, // old 6
Ntf_EVENT_ENROLLMENT_TEACHER = 7,
Ntf_EVENT_ENROLLMENT_REQUEST = 8, // old 7
/* Messages tab */
Ntf_EVENT_NOTICE = 9, // old 8
Ntf_EVENT_FORUM_POST_COURSE = 10, // old 9
Ntf_EVENT_FORUM_REPLY = 11, // old 10
Ntf_EVENT_MESSAGE = 12, // old 11
/* Statistics tab */
Ntf_EVENT_SURVEY = 13, // old 12
/* Profile tab */
Ntf_EVENT_FOLLOWER = 14, // old 13

View File

@ -942,12 +942,16 @@ Users:
768b. ActCreOth Create a new user 768b. ActCreOth Create a new user
768c. ActCreStd Create a new user 768c. ActCreStd Create a new user
768d. ActCreTch Create a new user 768d. ActCreTch Create a new user
769b. ActUpdOth Update another user's data and groups 769b. ActUpdOth Update another user's data and groups
769c. ActUpdStd Update another user's data and groups 769c. ActUpdStd Update another user's data and groups
769d. ActUpdTch Update another user's data and groups 769d. ActUpdTch Update another user's data and groups
770. ActReqAccEnrCrs Confirm acceptation / refusion of enrollment in current course 770b. ActReqAccEnrStd Confirm acceptation / refusion of enrollment as student in current course
771. ActAccEnrCrs Accept enrollment in current course 770c. ActReqAccEnrTch Confirm acceptation / refusion of enrollment as teacher in current course
772. ActRemMeCrs Refuse enrollment in current course 771b. ActAccEnrStd Accept enrollment as student in current course
771c. ActAccEnrTch Accept enrollment as teacher in current course
772b. ActRemMe_Std Reject enrollment as student in current course
772b. ActRemMe_Tch Reject enrollment as teacher in current course
773. ActNewAdmIns Register an administrador in this institution 773. ActNewAdmIns Register an administrador in this institution
774. ActRemAdmIns Remove an administrador of this institution 774. ActRemAdmIns Remove an administrador of this institution
775. ActNewAdmCtr Register an administrador in this centre 775. ActNewAdmCtr Register an administrador in this centre
@ -2364,9 +2368,12 @@ struct Act_Actions Act_Actions[Act_NUM_ACTIONS] =
/* ActUpdStd */{1423,-1,TabUsr,ActLstStd ,0x1FE,0x1FE,0x1FE,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Enr_ModifyUsr ,NULL}, /* ActUpdStd */{1423,-1,TabUsr,ActLstStd ,0x1FE,0x1FE,0x1FE,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Enr_ModifyUsr ,NULL},
/* ActUpdTch */{1424,-1,TabUsr,ActLstTch ,0x1FE,0x1FE,0x1FE,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Enr_ModifyUsr ,NULL}, /* ActUpdTch */{1424,-1,TabUsr,ActLstTch ,0x1FE,0x1FE,0x1FE,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Enr_ModifyUsr ,NULL},
/* ActReqAccEnrCrs */{ 592,-1,TabUsr,ActLstStd ,0x1F8,0x000,0x000,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Enr_ReqAcceptRegisterInCrs ,NULL}, /* ActReqAccEnrStd */{1456,-1,TabUsr,ActLstStd ,0x008,0x000,0x000,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Enr_ReqAcceptRegisterInCrs ,NULL},
/* ActAccEnrCrs */{ 558,-1,TabUsr,ActLstStd ,0x1F8,0x000,0x000,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Enr_AcceptRegisterMeInCrs ,NULL}, /* ActReqAccEnrTch */{1457,-1,TabUsr,ActLstTch ,0x010,0x000,0x000,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Enr_ReqAcceptRegisterInCrs ,NULL},
/* ActRemMeCrs */{ 559,-1,TabUsr,ActLstStd ,0x1F8,0x000,0x000,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Enr_ReqRemMeFromCrs ,NULL}, /* ActAccEnrStd */{1458,-1,TabUsr,ActLstStd ,0x008,0x000,0x000,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Enr_AcceptRegisterMeInCrs ,NULL},
/* ActAccEnrTch */{1459,-1,TabUsr,ActLstTch ,0x010,0x000,0x000,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Enr_AcceptRegisterMeInCrs ,NULL},
/* ActRemMe_Std */{1460,-1,TabUsr,ActLstStd ,0x008,0x000,0x000,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Enr_ReqRemMeFromCrs ,NULL},
/* ActRemMe_Tch */{1461,-1,TabUsr,ActLstTch ,0x010,0x000,0x000,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Enr_ReqRemMeFromCrs ,NULL},
/* ActNewAdmIns */{1337,-1,TabUsr,ActLstOth ,0x100,0x100,0x100,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Enr_AddAdmToIns ,NULL}, /* ActNewAdmIns */{1337,-1,TabUsr,ActLstOth ,0x100,0x100,0x100,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Enr_AddAdmToIns ,NULL},
/* ActRemAdmIns */{1338,-1,TabUsr,ActLstOth ,0x180,0x180,0x180,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Enr_RemAdmIns ,NULL}, /* ActRemAdmIns */{1338,-1,TabUsr,ActLstOth ,0x180,0x180,0x180,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Enr_RemAdmIns ,NULL},
@ -3302,8 +3309,8 @@ Act_Action_t Act_FromActCodToAction[1+Act_MAX_ACTION_COD] = // Do not reuse uniq
ActEdiCrs, // #555 ActEdiCrs, // #555
ActNewCrs, // #556 ActNewCrs, // #556
-1, // #557 (obsolete action) -1, // #557 (obsolete action)
ActAccEnrCrs, // #558 -1, // #558 (obsolete action)
ActRemMeCrs, // #559 -1, // #559 (obsolete action)
ActRemCrs, // #560 ActRemCrs, // #560
ActChgCrsYea, // #561 ActChgCrsYea, // #561
ActChgCrsSem, // #562 ActChgCrsSem, // #562
@ -3336,7 +3343,7 @@ Act_Action_t Act_FromActCodToAction[1+Act_MAX_ACTION_COD] = // Do not reuse uniq
ActChgMyRol, // #589 ActChgMyRol, // #589
ActReqRemOldUsr, // #590 ActReqRemOldUsr, // #590
ActReqAccGbl, // #591 ActReqAccGbl, // #591
ActReqAccEnrCrs, // #592 -1, // #592 (obsolete action)
ActReqDelAllRcvMsg, // #593 ActReqDelAllRcvMsg, // #593
ActReqAccCrs, // #594 ActReqAccCrs, // #594
ActReqRemFilMrkCrs, // #595 ActReqRemFilMrkCrs, // #595
@ -4194,15 +4201,21 @@ Act_Action_t Act_FromActCodToAction[1+Act_MAX_ACTION_COD] = // Do not reuse uniq
ActCreOth, // #1444 ActCreOth, // #1444
ActCreStd, // #1445 ActCreStd, // #1445
ActCreTch, // #1446 ActCreTch, // #1446
ActFrmIDsOth, // #1447 ActFrmIDsOth, // #1447
ActFrmIDsStd, // #1448 ActFrmIDsStd, // #1448
ActFrmIDsTch, // #1449 ActFrmIDsTch, // #1449
ActRemID_Oth, // #1450 ActRemID_Oth, // #1450
ActRemID_Std, // #1451 ActRemID_Std, // #1451
ActRemID_Tch, // #1452 ActRemID_Tch, // #1452
ActNewID_Oth, // #1453 ActNewID_Oth, // #1453
ActNewID_Std, // #1454 ActNewID_Std, // #1454
ActNewID_Tch, // #1455 ActNewID_Tch, // #1455
ActReqAccEnrStd, // #1456
ActReqAccEnrTch, // #1457
ActAccEnrStd, // #1458
ActAccEnrTch, // #1459
ActRemMe_Std, // #1460
ActRemMe_Tch, // #1461
}; };
/*****************************************************************************/ /*****************************************************************************/
@ -4578,7 +4591,8 @@ void Act_AdjustCurrentAction (void)
the only action possible is show a form to ask for enrollment *****/ the only action possible is show a form to ask for enrollment *****/
if (!Gbl.Usrs.Me.UsrDat.Accepted && Gbl.CurrentAct != ActLogOut) if (!Gbl.Usrs.Me.UsrDat.Accepted && Gbl.CurrentAct != ActLogOut)
{ {
Gbl.CurrentAct = ActReqAccEnrCrs; Gbl.CurrentAct = (Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB == Rol_STUDENT) ? ActReqAccEnrStd :
ActReqAccEnrTch;
Tab_SetCurrentTab (); Tab_SetCurrentTab ();
return; return;
} }

View File

@ -69,9 +69,9 @@ typedef enum
typedef int Act_Action_t; // Must be a signed type, because -1 is used to indicate obsolete action typedef int Act_Action_t; // Must be a signed type, because -1 is used to indicate obsolete action
#define Act_NUM_ACTIONS (7+52+15+90+73+68+204+182+134+168+28+79) #define Act_NUM_ACTIONS (7+52+15+90+73+68+204+182+137+168+28+79)
#define Act_MAX_ACTION_COD 1455 #define Act_MAX_ACTION_COD 1461
#define Act_MAX_OPTIONS_IN_MENU_PER_TAB 20 #define Act_MAX_OPTIONS_IN_MENU_PER_TAB 20
@ -974,51 +974,54 @@ typedef int Act_Action_t; // Must be a signed type, because -1 is used to indica
#define ActUpdStd (ActChgNumRowFooGrp+ 95) #define ActUpdStd (ActChgNumRowFooGrp+ 95)
#define ActUpdTch (ActChgNumRowFooGrp+ 96) #define ActUpdTch (ActChgNumRowFooGrp+ 96)
#define ActReqAccEnrCrs (ActChgNumRowFooGrp+ 97) #define ActReqAccEnrStd (ActChgNumRowFooGrp+ 97)
#define ActAccEnrCrs (ActChgNumRowFooGrp+ 98) #define ActReqAccEnrTch (ActChgNumRowFooGrp+ 98)
#define ActRemMeCrs (ActChgNumRowFooGrp+ 99) #define ActAccEnrStd (ActChgNumRowFooGrp+ 99)
#define ActAccEnrTch (ActChgNumRowFooGrp+100)
#define ActRemMe_Std (ActChgNumRowFooGrp+101)
#define ActRemMe_Tch (ActChgNumRowFooGrp+102)
#define ActNewAdmIns (ActChgNumRowFooGrp+100) #define ActNewAdmIns (ActChgNumRowFooGrp+103)
#define ActRemAdmIns (ActChgNumRowFooGrp+101) #define ActRemAdmIns (ActChgNumRowFooGrp+104)
#define ActNewAdmCtr (ActChgNumRowFooGrp+102) #define ActNewAdmCtr (ActChgNumRowFooGrp+105)
#define ActRemAdmCtr (ActChgNumRowFooGrp+103) #define ActRemAdmCtr (ActChgNumRowFooGrp+106)
#define ActNewAdmDeg (ActChgNumRowFooGrp+104) #define ActNewAdmDeg (ActChgNumRowFooGrp+107)
#define ActRemAdmDeg (ActChgNumRowFooGrp+105) #define ActRemAdmDeg (ActChgNumRowFooGrp+108)
#define ActRcvFrmEnrSevStd (ActChgNumRowFooGrp+106) #define ActRcvFrmEnrSevStd (ActChgNumRowFooGrp+109)
#define ActRcvFrmEnrSevTch (ActChgNumRowFooGrp+107) #define ActRcvFrmEnrSevTch (ActChgNumRowFooGrp+110)
#define ActFrmIDsOth (ActChgNumRowFooGrp+108) #define ActFrmIDsOth (ActChgNumRowFooGrp+111)
#define ActFrmIDsStd (ActChgNumRowFooGrp+109) #define ActFrmIDsStd (ActChgNumRowFooGrp+112)
#define ActFrmIDsTch (ActChgNumRowFooGrp+110) #define ActFrmIDsTch (ActChgNumRowFooGrp+113)
#define ActRemID_Oth (ActChgNumRowFooGrp+111) #define ActRemID_Oth (ActChgNumRowFooGrp+114)
#define ActRemID_Std (ActChgNumRowFooGrp+112) #define ActRemID_Std (ActChgNumRowFooGrp+115)
#define ActRemID_Tch (ActChgNumRowFooGrp+113) #define ActRemID_Tch (ActChgNumRowFooGrp+116)
#define ActNewID_Oth (ActChgNumRowFooGrp+114) #define ActNewID_Oth (ActChgNumRowFooGrp+117)
#define ActNewID_Std (ActChgNumRowFooGrp+115) #define ActNewID_Std (ActChgNumRowFooGrp+118)
#define ActNewID_Tch (ActChgNumRowFooGrp+116) #define ActNewID_Tch (ActChgNumRowFooGrp+119)
#define ActFrmPwdOthUsr (ActChgNumRowFooGrp+117) #define ActFrmPwdOthUsr (ActChgNumRowFooGrp+120)
#define ActChgPwdOthUsr (ActChgNumRowFooGrp+118) #define ActChgPwdOthUsr (ActChgNumRowFooGrp+121)
#define ActRemUsrCrs (ActChgNumRowFooGrp+119) #define ActRemUsrCrs (ActChgNumRowFooGrp+122)
#define ActRemUsrGbl (ActChgNumRowFooGrp+120) #define ActRemUsrGbl (ActChgNumRowFooGrp+123)
#define ActReqRemAllStdCrs (ActChgNumRowFooGrp+121) #define ActReqRemAllStdCrs (ActChgNumRowFooGrp+124)
#define ActRemAllStdCrs (ActChgNumRowFooGrp+122) #define ActRemAllStdCrs (ActChgNumRowFooGrp+125)
#define ActReqRemOldUsr (ActChgNumRowFooGrp+123) #define ActReqRemOldUsr (ActChgNumRowFooGrp+126)
#define ActRemOldUsr (ActChgNumRowFooGrp+124) #define ActRemOldUsr (ActChgNumRowFooGrp+127)
#define ActSeePubPrf (ActChgNumRowFooGrp+125) #define ActSeePubPrf (ActChgNumRowFooGrp+128)
#define ActCal1stClkTim (ActChgNumRowFooGrp+126) #define ActCal1stClkTim (ActChgNumRowFooGrp+129)
#define ActCalNumClk (ActChgNumRowFooGrp+127) #define ActCalNumClk (ActChgNumRowFooGrp+130)
#define ActCalNumFilVie (ActChgNumRowFooGrp+128) #define ActCalNumFilVie (ActChgNumRowFooGrp+131)
#define ActCalNumForPst (ActChgNumRowFooGrp+129) #define ActCalNumForPst (ActChgNumRowFooGrp+132)
#define ActCalNumMsgSnt (ActChgNumRowFooGrp+130) #define ActCalNumMsgSnt (ActChgNumRowFooGrp+133)
#define ActFolUsr (ActChgNumRowFooGrp+131) #define ActFolUsr (ActChgNumRowFooGrp+134)
#define ActUnfUsr (ActChgNumRowFooGrp+132) #define ActUnfUsr (ActChgNumRowFooGrp+135)
#define ActSeeFlg (ActChgNumRowFooGrp+133) #define ActSeeFlg (ActChgNumRowFooGrp+136)
#define ActSeeFlr (ActChgNumRowFooGrp+134) #define ActSeeFlr (ActChgNumRowFooGrp+137)
/*****************************************************************************/ /*****************************************************************************/
/******************************* Messages tab ********************************/ /******************************* Messages tab ********************************/

View File

@ -98,11 +98,40 @@
/****************************** Public constants *****************************/ /****************************** Public constants *****************************/
/*****************************************************************************/ /*****************************************************************************/
#define Log_PLATFORM_VERSION "SWAD 14.133.1 (2015/09/17)" #define Log_PLATFORM_VERSION "SWAD 14.134 (2015/09/17)"
// 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 14.134: Sep 17, 2015 Changes in user enrollment.
Changes in notifications about enrollment. (184823 lines)
25 changes necessary in database:
UPDATE actions SET Obsolete='Y' WHERE ActCod='592';
INSERT INTO actions (ActCod,Language,Obsolete,Txt) VALUES ('1456','es','N','Solicitar acept. inscrip. estudiante');
INSERT INTO actions (ActCod,Language,Obsolete,Txt) VALUES ('1457','es','N','Solicitar acept. inscrip. profesor');
UPDATE actions SET Obsolete='Y' WHERE ActCod='558';
INSERT INTO actions (ActCod,Language,Obsolete,Txt) VALUES ('1458','es','N','Aceptar inscrip. como estudiante');
INSERT INTO actions (ActCod,Language,Obsolete,Txt) VALUES ('1459','es','N','Aceptar inscrip. como profesor');
UPDATE actions SET Obsolete='Y' WHERE ActCod='559';
INSERT INTO actions (ActCod,Language,Obsolete,Txt) VALUES ('1460','es','N','Rechazar inscrip. como estudiante');
INSERT INTO actions (ActCod,Language,Obsolete,Txt) VALUES ('1461','es','N','Rechazar inscrip. como profesor');
UPDATE notif SET NotifyEvent=14 WHERE NotifyEvent=13;
UPDATE notif SET NotifyEvent=13 WHERE NotifyEvent=12;
UPDATE notif SET NotifyEvent=12 WHERE NotifyEvent=11;
UPDATE notif SET NotifyEvent=11 WHERE NotifyEvent=10;
UPDATE notif SET NotifyEvent=10 WHERE NotifyEvent=9;
UPDATE notif SET NotifyEvent=9 WHERE NotifyEvent=8;
UPDATE notif SET NotifyEvent=8 WHERE NotifyEvent=7;
UPDATE sta_notif SET NotifyEvent=14 WHERE NotifyEvent=13;
UPDATE sta_notif SET NotifyEvent=13 WHERE NotifyEvent=12;
UPDATE sta_notif SET NotifyEvent=12 WHERE NotifyEvent=11;
UPDATE sta_notif SET NotifyEvent=11 WHERE NotifyEvent=10;
UPDATE sta_notif SET NotifyEvent=10 WHERE NotifyEvent=9;
UPDATE sta_notif SET NotifyEvent=9 WHERE NotifyEvent=8;
UPDATE sta_notif SET NotifyEvent=8 WHERE NotifyEvent=7;
UPDATE usr_data SET NotifNtfEvents=(((NotifNtfEvents & ~0x7F) << 1) | (NotifNtfEvents & 0x7F) | 0x80);
UPDATE usr_data SET EmailNtfEvents=(((EmailNtfEvents & ~0x7F) << 1) | (EmailNtfEvents & 0x7F));
Version 14.133.1: Sep 17, 2015 Changes in user enrollment. (184669 lines) Version 14.133.1: Sep 17, 2015 Changes in user enrollment. (184669 lines)
Version 14.133: Sep 17, 2015 Changes in user enrollment. (184665 lines) Version 14.133: Sep 17, 2015 Changes in user enrollment. (184665 lines)
1 change necessary in database: 1 change necessary in database:

View File

@ -86,6 +86,8 @@ extern struct Globals Gbl;
/***************************** Private prototypes ****************************/ /***************************** Private prototypes ****************************/
/*****************************************************************************/ /*****************************************************************************/
static void Enr_NotifyAfterEnrollment (struct UsrData *UsrDat,Rol_Role_t NewRole);
static void Enr_ReqAdminUsrs (Rol_Role_t Role); static void Enr_ReqAdminUsrs (Rol_Role_t Role);
static void Enr_ShowFormRegRemSeveralUsrs (Rol_Role_t Role); static void Enr_ShowFormRegRemSeveralUsrs (Rol_Role_t Role);
@ -156,9 +158,14 @@ void Enr_ModifyRoleInCurrentCrs (struct UsrData *UsrDat,
if (NewRole != OldRole) // The role must be updated if (NewRole != OldRole) // The role must be updated
{ {
/***** Check if user's role is allowed *****/ /***** Check if user's role is allowed *****/
if (!(NewRole == Rol_STUDENT || switch (NewRole)
NewRole == Rol_TEACHER)) {
Lay_ShowErrorAndExit ("Wrong role."); case Rol_STUDENT:
case Rol_TEACHER:
break;
default:
Lay_ShowErrorAndExit ("Wrong role.");
}
/***** Update the role of a user in a course *****/ /***** Update the role of a user in a course *****/
sprintf (Query,"UPDATE crs_usr SET Role='%u'" sprintf (Query,"UPDATE crs_usr SET Role='%u'"
@ -166,6 +173,11 @@ void Enr_ModifyRoleInCurrentCrs (struct UsrData *UsrDat,
(unsigned) NewRole,Gbl.CurrentCrs.Crs.CrsCod,UsrDat->UsrCod); (unsigned) NewRole,Gbl.CurrentCrs.Crs.CrsCod,UsrDat->UsrCod);
DB_QueryUPDATE (Query,"can not modify user's role in course"); DB_QueryUPDATE (Query,"can not modify user's role in course");
/***** Create notification for this user.
If this user wants to receive notifications by e-mail,
activate the sending of a notification *****/
Enr_NotifyAfterEnrollment (UsrDat,NewRole);
/***** Show info message *****/ /***** Show info message *****/
if (QuietOrVerbose == Cns_VERBOSE) if (QuietOrVerbose == Cns_VERBOSE)
{ {
@ -194,13 +206,16 @@ void Enr_RegisterUsrInCurrentCrs (struct UsrData *UsrDat,Rol_Role_t NewRole,
extern const char *Usr_StringsUsrListTypeInDB[Usr_NUM_USR_LIST_TYPES]; extern const char *Usr_StringsUsrListTypeInDB[Usr_NUM_USR_LIST_TYPES];
extern const char *Txt_THE_USER_X_has_been_enrolled_in_the_course_Y; extern const char *Txt_THE_USER_X_has_been_enrolled_in_the_course_Y;
char Query[1024]; char Query[1024];
bool CreateNotif;
bool NotifyByEmail;
/***** Check if user's role is allowed *****/ /***** Check if user's role is allowed *****/
if (!(NewRole == Rol_STUDENT || switch (NewRole)
NewRole == Rol_TEACHER)) {
Lay_ShowErrorAndExit ("Wrong role."); case Rol_STUDENT:
case Rol_TEACHER:
break;
default:
Lay_ShowErrorAndExit ("Wrong role.");
}
/***** Register user in current course in database *****/ /***** Register user in current course in database *****/
sprintf (Query,"INSERT INTO crs_usr (CrsCod,UsrCod,Role,Accepted," sprintf (Query,"INSERT INTO crs_usr (CrsCod,UsrCod,Role,Accepted,"
@ -220,20 +235,10 @@ void Enr_RegisterUsrInCurrentCrs (struct UsrData *UsrDat,Rol_Role_t NewRole,
UsrDat->RoleInCurrentCrsDB = NewRole; UsrDat->RoleInCurrentCrsDB = NewRole;
UsrDat->Roles |= NewRole; UsrDat->Roles |= NewRole;
/***** Remove possible inscription request ******/
Enr_RemoveEnrollmentRequest (Gbl.CurrentCrs.Crs.CrsCod,UsrDat->UsrCod);
/***** Create notification for this user. /***** Create notification for this user.
If this user wants to receive notifications by e-mail, If this user wants to receive notifications by e-mail,
activate the sending of a notification *****/ activate the sending of a notification *****/
CreateNotif = (UsrDat->Prefs.NotifNtfEvents & (1 << Ntf_EVENT_ENROLLMENT)); Enr_NotifyAfterEnrollment (UsrDat,NewRole);
NotifyByEmail = CreateNotif &&
(UsrDat->UsrCod != Gbl.Usrs.Me.UsrDat.UsrCod) &&
(UsrDat->Prefs.EmailNtfEvents & (1 << Ntf_EVENT_ENROLLMENT));
if (CreateNotif)
Ntf_StoreNotifyEventToOneUser (Ntf_EVENT_ENROLLMENT,UsrDat,-1L,
(Ntf_Status_t) (NotifyByEmail ? Ntf_STATUS_BIT_EMAIL :
0));
/***** Show info message *****/ /***** Show info message *****/
if (QuietOrVerbose == Cns_VERBOSE) if (QuietOrVerbose == Cns_VERBOSE)
@ -244,6 +249,48 @@ void Enr_RegisterUsrInCurrentCrs (struct UsrData *UsrDat,Rol_Role_t NewRole,
} }
} }
/*****************************************************************************/
/********* Create notification after register user in current course *********/
/*****************************************************************************/
static void Enr_NotifyAfterEnrollment (struct UsrData *UsrDat,Rol_Role_t NewRole)
{
bool CreateNotif;
bool NotifyByEmail;
Ntf_NotifyEvent_t NotifyEvent;
/***** Check if user's role is allowed *****/
switch (NewRole)
{
case Rol_STUDENT:
NotifyEvent = Ntf_EVENT_ENROLLMENT_STUDENT;
break;
case Rol_TEACHER:
NotifyEvent = Ntf_EVENT_ENROLLMENT_TEACHER;
break;
default:
NotifyEvent = Ntf_EVENT_UNKNOWN;
Lay_ShowErrorAndExit ("Wrong role.");
}
/***** Remove possible enrollment request ******/
Enr_RemoveEnrollmentRequest (Gbl.CurrentCrs.Crs.CrsCod,UsrDat->UsrCod);
/***** Remove old enrollment notifications before inserting the new one ******/
Ntf_SetNotifToOneUsrAsRemoved (Ntf_EVENT_ENROLLMENT_STUDENT,-1,UsrDat->UsrCod);
Ntf_SetNotifToOneUsrAsRemoved (Ntf_EVENT_ENROLLMENT_TEACHER,-1,UsrDat->UsrCod);
/***** Create new notification ******/
CreateNotif = (UsrDat->Prefs.NotifNtfEvents & (1 << NotifyEvent));
NotifyByEmail = CreateNotif &&
(UsrDat->UsrCod != Gbl.Usrs.Me.UsrDat.UsrCod) &&
(UsrDat->Prefs.EmailNtfEvents & (1 << NotifyEvent));
if (CreateNotif)
Ntf_StoreNotifyEventToOneUser (NotifyEvent,UsrDat,-1L,
(Ntf_Status_t) (NotifyByEmail ? Ntf_STATUS_BIT_EMAIL :
0));
}
/*****************************************************************************/ /*****************************************************************************/
/****** Write a form to request another user's ID, @nickname or e-mail *******/ /****** Write a form to request another user's ID, @nickname or e-mail *******/
/*****************************************************************************/ /*****************************************************************************/
@ -288,17 +335,20 @@ void Enr_ReqAcceptRegisterInCrs (void)
fprintf (Gbl.F.Out,"<div class=\"CONTEXT_MENU\">"); fprintf (Gbl.F.Out,"<div class=\"CONTEXT_MENU\">");
/***** Send button to accept register in the current course *****/ /***** Send button to accept register in the current course *****/
Act_PutContextualLink (ActAccEnrCrs,NULL, Act_PutContextualLink (Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB == Rol_STUDENT ? ActAccEnrStd :
"ok_green",Txt_Confirm_my_enrollment); ActAccEnrTch,
NULL,"ok_green",Txt_Confirm_my_enrollment);
/***** Send button to refuse register in the current course *****/ /***** Send button to refuse register in the current course *****/
Act_PutContextualLink (ActRemMeCrs,NULL, Act_PutContextualLink (Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB == Rol_STUDENT ? ActRemMe_Std :
"delon",Txt_Remove_me_from_this_course); ActRemMe_Tch,
NULL,"delon",Txt_Remove_me_from_this_course);
fprintf (Gbl.F.Out,"</div>"); fprintf (Gbl.F.Out,"</div>");
/***** Mark possible notification as seen *****/ /***** Mark possible notification as seen *****/
Ntf_SetNotifAsSeen (Ntf_EVENT_ENROLLMENT, Ntf_SetNotifAsSeen (Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB == Rol_STUDENT ? Ntf_EVENT_ENROLLMENT_STUDENT :
Ntf_EVENT_ENROLLMENT_TEACHER,
-1L, -1L,
Gbl.Usrs.Me.UsrDat.UsrCod); Gbl.Usrs.Me.UsrDat.UsrCod);
} }
@ -3183,6 +3233,13 @@ void Enr_AcceptRegisterMeInCrs (void)
/***** Confirm my enrollment *****/ /***** Confirm my enrollment *****/
Enr_AcceptUsrInCrs (Gbl.Usrs.Me.UsrDat.UsrCod); Enr_AcceptUsrInCrs (Gbl.Usrs.Me.UsrDat.UsrCod);
/***** Mark all notifications about enrollment (as student or as teacher)
in current course as removed *****/
Ntf_SetNotifToOneUsrAsRemoved (Ntf_EVENT_ENROLLMENT_STUDENT,-1L,
Gbl.Usrs.Me.UsrDat.UsrCod);
Ntf_SetNotifToOneUsrAsRemoved (Ntf_EVENT_ENROLLMENT_TEACHER,-1L,
Gbl.Usrs.Me.UsrDat.UsrCod);
/***** Confirmation message *****/ /***** Confirmation message *****/
sprintf (Gbl.Message,Txt_You_have_confirmed_your_enrollment_in_the_course_X, sprintf (Gbl.Message,Txt_You_have_confirmed_your_enrollment_in_the_course_X,
Gbl.CurrentCrs.Crs.FullName); Gbl.CurrentCrs.Crs.FullName);

View File

@ -68,7 +68,8 @@ const char *Ntf_WSNotifyEvents[Ntf_NUM_NOTIFY_EVENTS] =
"marksFile", "marksFile",
/* Enrollment tab */ /* Enrollment tab */
"enrollment", "enrollmentStudent",
"enrollmentTeacher",
"enrollmentRequest", "enrollmentRequest",
/* Messages tab */ /* Messages tab */
@ -98,7 +99,8 @@ static const Act_Action_t Ntf_DefaultActions[Ntf_NUM_NOTIFY_EVENTS] =
ActSeeAdmMrk, // Ntf_EVENT_MARKS_FILE ActSeeAdmMrk, // Ntf_EVENT_MARKS_FILE
/* Users tab */ /* Users tab */
ActReqAccEnrCrs, // Ntf_EVENT_ENROLLMENT ActReqAccEnrStd, // Ntf_EVENT_ENROLLMENT_STUDENT
ActReqAccEnrTch, // Ntf_EVENT_ENROLLMENT_TEACHER
ActSeeSignUpReq, // Ntf_EVENT_ENROLLMENT_REQUEST ActSeeSignUpReq, // Ntf_EVENT_ENROLLMENT_REQUEST
/* Messages tab */ /* Messages tab */
@ -133,7 +135,8 @@ static const char *Ntf_ParamNotifMeAboutNotifyEvents[Ntf_NUM_NOTIFY_EVENTS] =
"NotifyNtfEventMarksFile", "NotifyNtfEventMarksFile",
/* Enrollment tab */ /* Enrollment tab */
"NotifyNtfEventEnrollment", "NotifyNtfEventEnrollmentStudent",
"NotifyNtfEventEnrollmentTeacher",
"NotifyNtfEventEnrollmentRequest", "NotifyNtfEventEnrollmentRequest",
/* Messages tab */ /* Messages tab */
@ -164,7 +167,8 @@ static const char *Ntf_ParamEmailMeAboutNotifyEvents[Ntf_NUM_NOTIFY_EVENTS] =
"EmailNtfEventMarksFile", "EmailNtfEventMarksFile",
/* Enrollment tab */ /* Enrollment tab */
"EmailNtfEventEnrollment", "EmailNtfEventEnrollmentStudent",
"EmailNtfEventEnrollmentTeacher",
"EmailNtfEventEnrollmentRequest", "EmailNtfEventEnrollmentRequest",
/* Messages tab */ /* Messages tab */
@ -195,7 +199,8 @@ static const char *Ntf_Icons[Ntf_NUM_NOTIFY_EVENTS] =
"grades", // Ntf_EVENT_MARKS_FILE "grades", // Ntf_EVENT_MARKS_FILE
/* Enrollment tab */ /* Enrollment tab */
"adduser", // Ntf_EVENT_ENROLLMENT "adduser", // Ntf_EVENT_ENROLLMENT_STUDENT
"adduser", // Ntf_EVENT_ENROLLMENT_TEACHER
"enrollmentrequest", // Ntf_EVENT_ENROLLMENT_REQUEST "enrollmentrequest", // Ntf_EVENT_ENROLLMENT_REQUEST
/* Messages tab */ /* Messages tab */
@ -739,7 +744,8 @@ void Ntf_GetNotifSummaryAndContent (char *SummaryStr,char **ContentStr,Ntf_Notif
case Ntf_EVENT_MARKS_FILE: case Ntf_EVENT_MARKS_FILE:
Mrk_GetNotifMyMarks (SummaryStr,ContentStr,Cod,UsrCod,MaxChars,GetContent); Mrk_GetNotifMyMarks (SummaryStr,ContentStr,Cod,UsrCod,MaxChars,GetContent);
break; break;
case Ntf_EVENT_ENROLLMENT: case Ntf_EVENT_ENROLLMENT_STUDENT:
case Ntf_EVENT_ENROLLMENT_TEACHER:
Enr_GetNotifEnrollment (SummaryStr,CrsCod,UsrCod,MaxChars); Enr_GetNotifEnrollment (SummaryStr,CrsCod,UsrCod,MaxChars);
break; break;
case Ntf_EVENT_ENROLLMENT_REQUEST: case Ntf_EVENT_ENROLLMENT_REQUEST:
@ -1067,7 +1073,8 @@ unsigned Ntf_StoreNotifyEventsToAllUsrs (Ntf_NotifyEvent_t NotifyEvent,long Cod)
Gbl.CurrentCrs.Crs.CrsCod, Gbl.CurrentCrs.Crs.CrsCod,
Gbl.Usrs.Me.UsrDat.UsrCod); Gbl.Usrs.Me.UsrDat.UsrCod);
break; break;
case Ntf_EVENT_ENROLLMENT: // This function should not be called in this case case Ntf_EVENT_ENROLLMENT_STUDENT: // This function should not be called in this case
case Ntf_EVENT_ENROLLMENT_TEACHER: // This function should not be called in this case
return 0; return 0;
case Ntf_EVENT_ENROLLMENT_REQUEST: case Ntf_EVENT_ENROLLMENT_REQUEST:
if (Gbl.CurrentCrs.Crs.NumTchs) if (Gbl.CurrentCrs.Crs.NumTchs)
@ -1444,7 +1451,8 @@ static void Ntf_SendPendingNotifByEMailToOneUsr (struct UsrData *ToUsrDat,unsign
case Ntf_EVENT_ASSIGNMENT: case Ntf_EVENT_ASSIGNMENT:
case Ntf_EVENT_EXAM_ANNOUNCEMENT: case Ntf_EVENT_EXAM_ANNOUNCEMENT:
case Ntf_EVENT_MARKS_FILE: case Ntf_EVENT_MARKS_FILE:
case Ntf_EVENT_ENROLLMENT: case Ntf_EVENT_ENROLLMENT_STUDENT:
case Ntf_EVENT_ENROLLMENT_TEACHER:
case Ntf_EVENT_ENROLLMENT_REQUEST: case Ntf_EVENT_ENROLLMENT_REQUEST:
case Ntf_EVENT_NOTICE: case Ntf_EVENT_NOTICE:
case Ntf_EVENT_MESSAGE: case Ntf_EVENT_MESSAGE:

View File

@ -37,37 +37,38 @@
/******************************** Public types *******************************/ /******************************** Public types *******************************/
/*****************************************************************************/ /*****************************************************************************/
#define Ntf_NUM_NOTIFY_EVENTS 14 #define Ntf_NUM_NOTIFY_EVENTS 15
// If the numbers assigned to each event type change, // If the numbers assigned to each event type change,
// it is necessary to change old numbers to new ones in database tables notif and sta_notif // it is necessary to change old numbers to new ones in database tables notif and sta_notif
typedef enum typedef enum
{ {
Ntf_EVENT_UNKNOWN = 0, Ntf_EVENT_UNKNOWN = 0, // old 0
/* Course tab */ /* Course tab */
Ntf_EVENT_DOCUMENT_FILE = 1, Ntf_EVENT_DOCUMENT_FILE = 1, // old 1
Ntf_EVENT_SHARED_FILE = 2, Ntf_EVENT_SHARED_FILE = 2, // old 2
/* Assessment tab */ /* Assessment tab */
Ntf_EVENT_ASSIGNMENT = 3, Ntf_EVENT_ASSIGNMENT = 3, // old 3
Ntf_EVENT_EXAM_ANNOUNCEMENT = 4, Ntf_EVENT_EXAM_ANNOUNCEMENT = 4, // old 4
Ntf_EVENT_MARKS_FILE = 5, Ntf_EVENT_MARKS_FILE = 5, // old 5
/* Enrollment tab */ /* Enrollment tab */
Ntf_EVENT_ENROLLMENT = 6, Ntf_EVENT_ENROLLMENT_STUDENT = 6, // old 6
Ntf_EVENT_ENROLLMENT_REQUEST = 7, Ntf_EVENT_ENROLLMENT_TEACHER = 7,
Ntf_EVENT_ENROLLMENT_REQUEST = 8, // old 7
/* Messages tab */ /* Messages tab */
Ntf_EVENT_NOTICE = 8, Ntf_EVENT_NOTICE = 9, // old 8
Ntf_EVENT_FORUM_POST_COURSE = 9, Ntf_EVENT_FORUM_POST_COURSE = 10, // old 9
Ntf_EVENT_FORUM_REPLY = 10, Ntf_EVENT_FORUM_REPLY = 11, // old 10
Ntf_EVENT_MESSAGE = 11, Ntf_EVENT_MESSAGE = 12, // old 11
/* Statistics tab */ /* Statistics tab */
Ntf_EVENT_SURVEY = 12, Ntf_EVENT_SURVEY = 13, // old 12
/* Profile tab */ /* Profile tab */
Ntf_EVENT_FOLLOWER = 13, Ntf_EVENT_FOLLOWER = 14, // old 13
} Ntf_NotifyEvent_t; } Ntf_NotifyEvent_t;

View File

@ -598,16 +598,28 @@ const char *Txt_NOTIFY_EVENTS_SINGULAR_NO_HTML[Ntf_NUM_NOTIFY_EVENTS][Txt_NUM_LA
"Novo arquivo de notas", "Novo arquivo de notas",
}, },
{ {
// Ntf_EVENT_ENROLLMENT // Ntf_EVENT_ENROLLMENT_STUDENT
"Nova inscripció", "Nova inscripció com a estudiant",
"New Einschreibung", "New Einschreibung als Student",
"New enrollment", "New enrollment as a student",
"Nueva inscripción", "Nueva inscripción como estudiante",
"Nouvelle inscription", "Nouvelle inscriptionen tant qu'étudiant",
"Nueva inscripción", // Okoteve traducción "Nueva inscripción como estudiante", // Okoteve traducción
"Nuova iscrizione", "Nuova iscrizione come studente",
"Nowe zapisy", "Nowe zapisy jako student",
"Nova inscrição", "Nova inscrição como estudante",
},
{
// Ntf_EVENT_ENROLLMENT_TEACHER
"Nova inscripció com a professor",
"New Einschreibung als Lehrkraft",
"New enrollment as a teacher",
"Nueva inscripción como profesor",
"Nouvelle inscription en tant qu'enseignant",
"Nueva inscripción como profesor", // Okoteve traducción
"Nuova iscrizione come professore",
"Nowe zapisy jako nauczyciel",
"Nova inscrição como professor",
}, },
{ {
// Ntf_EVENT_ENROLLMENT_REQUEST // Ntf_EVENT_ENROLLMENT_REQUEST
@ -24692,24 +24704,44 @@ const char *Txt_NOTIFY_EVENTS_PLURAL[Ntf_NUM_NOTIFY_EVENTS] =
"Novos arquivos de notas" "Novos arquivos de notas"
#endif #endif
, ,
#if L==0 // Ntf_EVENT_ENROLLMENT #if L==0 // Ntf_EVENT_ENROLLMENT_STUDENT
"Novas inscripci&oacute;s" "Novas inscripci&oacute;s com a estudiant"
#elif L==1 #elif L==1
"New Einschreibungen" "New Einschreibungen als Student"
#elif L==2 #elif L==2
"New enrollments" "New enrollments as a student"
#elif L==3 #elif L==3
"Nuevas inscripciones" "Nuevas inscripciones como estudiante"
#elif L==4 #elif L==4
"Nouvelles inscriptions" "Nouvelles inscriptions en tant qu'&eacute;tudiant"
#elif L==5 #elif L==5
"Nuevas inscripciones" // Okoteve traducción "Nuevas inscripciones como estudiante" // Okoteve traducción
#elif L==6 #elif L==6
"Nuova iscrizione" "Nuova iscrizione come studente"
#elif L==7 #elif L==7
"Nowe zapisy" "Nowe zapisy jako student"
#elif L==8 #elif L==8
"Novas inscri&ccedil;&otilde;es" "Novas inscri&ccedil;&otilde;es como estudante"
#endif
,
#if L==0 // Ntf_EVENT_ENROLLMENT_TEACHER
"Novas inscripci&oacute;s com a professor"
#elif L==1
"New Einschreibungen als Lehrkraft"
#elif L==2
"New enrollments as a teacher"
#elif L==3
"Nuevas inscripciones como profesor/a"
#elif L==4
"Nouvelles inscriptions en tant qu'enseignant"
#elif L==5
"Nuevas inscripciones como profesor/a" // Okoteve traducción
#elif L==6
"Nuova iscrizione come professore"
#elif L==7
"Nowe zapisy jako nauczyciel"
#elif L==8
"Novas inscri&ccedil;&otilde;es como professor"
#endif #endif
, ,
#if L==0 // Ntf_EVENT_ENROLLMENT_REQUEST #if L==0 // Ntf_EVENT_ENROLLMENT_REQUEST
@ -24975,24 +25007,44 @@ const char *Txt_NOTIFY_EVENTS_SINGULAR[Ntf_NUM_NOTIFY_EVENTS] =
"Arquivo de notas" "Arquivo de notas"
#endif #endif
, ,
#if L==0 // Ntf_EVENT_ENROLLMENT #if L==0 // Ntf_EVENT_ENROLLMENT_STUDENT
"Inscripci&oacute;" "Inscripci&oacute; com a estudiant"
#elif L==1 #elif L==1
"Einschreibung" "Einschreibung als Student"
#elif L==2 #elif L==2
"Enrollment" "Enrollment as a student"
#elif L==3 #elif L==3
"Inscripci&oacute;n" "Inscripci&oacute;n como estudiante"
#elif L==4 #elif L==4
"Inscription" "Inscription en tant qu'&eacute;tudiant"
#elif L==5 #elif L==5
"Inscripci&oacute;n" // Okoteve traducción "Inscripci&oacute;n como estudiante" // Okoteve traducción
#elif L==6 #elif L==6
"Iscrizione" "Iscrizione come studente"
#elif L==7 #elif L==7
"Zapisy" "Zapisy jako student"
#elif L==8 #elif L==8
"Inscri&ccedil;&atilde;o" "Inscri&ccedil;&atilde;o como estudante"
#endif
,
#if L==0 // Ntf_EVENT_ENROLLMENT_TEACHER
"Inscripci&oacute; com a professor"
#elif L==1
"Einschreibung als Lehrkraft"
#elif L==2
"Enrollment as a teacher"
#elif L==3
"Inscripci&oacute;n como profesor/a"
#elif L==4
"Inscription en tant qu'enseignant"
#elif L==5
"Inscripci&oacute;n como profesor/a" // Okoteve traducción
#elif L==6
"Iscrizione come professore"
#elif L==7
"Zapisy jako nauczyciel"
#elif L==8
"Inscri&ccedil;&atilde;o como professor"
#endif #endif
, ,
#if L==0 // Ntf_EVENT_ENROLLMENT_REQUEST #if L==0 // Ntf_EVENT_ENROLLMENT_REQUEST