Version 14.132.5

This commit is contained in:
Antonio Cañas Vargas 2015-09-16 22:13:00 +02:00
parent 8a816b0ef3
commit 9f7b4f5918
4 changed files with 214 additions and 156 deletions

View File

@ -938,7 +938,9 @@ Users:
767b. ActRemGstPho Remove other user's photo 767b. ActRemGstPho Remove other user's photo
767c. ActRemStdPho Remove other user's photo 767c. ActRemStdPho Remove other user's photo
767d. ActRemTchPho Remove other user's photo 767d. ActRemTchPho Remove other user's photo
768. ActCreOthUsrDat Insertar a new user in this course 768b. ActCreGst Create a new user
768c. ActCreStd Create a new user
768d. ActCreTch Create a new user
769b. ActUpdOthGst Update another user's data and groups 769b. ActUpdOthGst Update another user's data and groups
769c. ActUpdOthStd Update another user's data and groups 769c. ActUpdOthStd Update another user's data and groups
769d. ActUpdOthTch Update another user's data and groups 769d. ActUpdOthTch Update another user's data and groups
@ -2326,10 +2328,10 @@ struct Act_Actions Act_Actions[Act_NUM_ACTIONS] =
/* ActReqMdfOneTch */{1416,-1,TabUsr,ActLstTch ,0x1FE,0x1FE,0x1FE,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Enr_ReqRegRemTch ,NULL}, /* ActReqMdfOneTch */{1416,-1,TabUsr,ActLstTch ,0x1FE,0x1FE,0x1FE,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Enr_ReqRegRemTch ,NULL},
/* ActReqMdfOneAdm */{1417,-1,TabUsr,ActLstAdm ,0x1FE,0x1FE,0x1FE,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Enr_ReqRegRemAdm ,NULL}, /* ActReqMdfOneAdm */{1417,-1,TabUsr,ActLstAdm ,0x1FE,0x1FE,0x1FE,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Enr_ReqRegRemAdm ,NULL},
/* ActReqMdfUsr */{1418,-1,TabUsr,ActLstGst ,0x1FE,0x1FE,0x1FE,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Enr_AskIfRegRemAnotherGst ,NULL}, /* ActReqMdfGst */{1418,-1,TabUsr,ActLstGst ,0x1FE,0x1FE,0x1FE,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Enr_AskIfRegRemAnotherGst ,NULL},
/* ActReqMdfUsr */{1419,-1,TabUsr,ActLstStd ,0x1FE,0x1FE,0x1FE,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Enr_AskIfRegRemAnotherStd ,NULL}, /* ActReqMdfStd */{1419,-1,TabUsr,ActLstStd ,0x1FE,0x1FE,0x1FE,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Enr_AskIfRegRemAnotherStd ,NULL},
/* ActReqMdfUsr */{1420,-1,TabUsr,ActLstTch ,0x1FE,0x1FE,0x1FE,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Enr_AskIfRegRemAnotherTch ,NULL}, /* ActReqMdfTch */{1420,-1,TabUsr,ActLstTch ,0x1FE,0x1FE,0x1FE,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Enr_AskIfRegRemAnotherTch ,NULL},
/* ActReqMdfUsr */{1421,-1,TabUsr,ActLstAdm ,0x1FE,0x1FE,0x1FE,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Enr_AskIfRegRemAnotherAdm ,NULL}, /* ActReqMdfAdm */{1421,-1,TabUsr,ActLstAdm ,0x1FE,0x1FE,0x1FE,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Enr_AskIfRegRemAnotherAdm ,NULL},
/* ActReqGstPho */{1432,-1,TabUsr,ActLstGst ,0x1F0,0x1E0,0x1E0,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Pho_SendPhotoUsr ,NULL}, /* ActReqGstPho */{1432,-1,TabUsr,ActLstGst ,0x1F0,0x1E0,0x1E0,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Pho_SendPhotoUsr ,NULL},
/* ActReqStdPho */{1433,-1,TabUsr,ActLstStd ,0x1F0,0x1E0,0x1E0,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Pho_SendPhotoUsr ,NULL}, /* ActReqStdPho */{1433,-1,TabUsr,ActLstStd ,0x1F0,0x1E0,0x1E0,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Pho_SendPhotoUsr ,NULL},
@ -2347,7 +2349,10 @@ struct Act_Actions Act_Actions[Act_NUM_ACTIONS] =
/* ActRemStdPho */{1442,-1,TabUsr,ActLstStd ,0x1F0,0x1E0,0x1E0,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Pho_RemoveUsrPhoto ,NULL}, /* ActRemStdPho */{1442,-1,TabUsr,ActLstStd ,0x1F0,0x1E0,0x1E0,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Pho_RemoveUsrPhoto ,NULL},
/* ActRemTchPho */{1443,-1,TabUsr,ActLstTch ,0x1F0,0x1E0,0x1E0,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Pho_RemoveUsrPhoto ,NULL}, /* ActRemTchPho */{1443,-1,TabUsr,ActLstTch ,0x1F0,0x1E0,0x1E0,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Pho_RemoveUsrPhoto ,NULL},
/* ActCreOthUsrDat */{ 440,-1,TabUsr,ActLstStd ,0x1F0,0x1E0,0x1E0,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Enr_CreateNewUsr ,NULL}, /* ActCreGst */{1444,-1,TabUsr,ActLstGst ,0x1F0,0x1E0,0x1E0,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Enr_CreateNewUsr ,NULL},
/* ActCreStd */{1445,-1,TabUsr,ActLstStd ,0x1F0,0x1E0,0x1E0,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Enr_CreateNewUsr ,NULL},
/* ActCreTch */{1446,-1,TabUsr,ActLstTch ,0x1F0,0x1E0,0x1E0,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Enr_CreateNewUsr ,NULL},
/* ActUpdOthGst */{1422,-1,TabUsr,ActLstGst ,0x1FE,0x1FE,0x1FE,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Enr_ModifyUsr ,NULL}, /* ActUpdOthGst */{1422,-1,TabUsr,ActLstGst ,0x1FE,0x1FE,0x1FE,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Enr_ModifyUsr ,NULL},
/* ActUpdOthStd */{1423,-1,TabUsr,ActLstStd ,0x1FE,0x1FE,0x1FE,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Enr_ModifyUsr ,NULL}, /* ActUpdOthStd */{1423,-1,TabUsr,ActLstStd ,0x1FE,0x1FE,0x1FE,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Enr_ModifyUsr ,NULL},
/* ActUpdOthTch */{1424,-1,TabUsr,ActLstTch ,0x1FE,0x1FE,0x1FE,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Enr_ModifyUsr ,NULL}, /* ActUpdOthTch */{1424,-1,TabUsr,ActLstTch ,0x1FE,0x1FE,0x1FE,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Enr_ModifyUsr ,NULL},
@ -3164,7 +3169,7 @@ Act_Action_t Act_FromActCodToAction[1+Act_MAX_ACTION_COD] = // Do not reuse uniq
-1, // #437 (obsolete action) -1, // #437 (obsolete action)
-1, // #438 (obsolete action) -1, // #438 (obsolete action)
-1, // #439 (obsolete action) -1, // #439 (obsolete action)
ActCreOthUsrDat, // #440 -1, // #440 (obsolete action)
-1, // #441 (obsolete action) -1, // #441 (obsolete action)
-1, // #442 (obsolete action) -1, // #442 (obsolete action)
ActPrnTchPho, // #443 ActPrnTchPho, // #443
@ -4171,6 +4176,9 @@ Act_Action_t Act_FromActCodToAction[1+Act_MAX_ACTION_COD] = // Do not reuse uniq
ActRemGstPho, // #1441 ActRemGstPho, // #1441
ActRemStdPho, // #1442 ActRemStdPho, // #1442
ActRemTchPho, // #1443 ActRemTchPho, // #1443
ActCreGst, // #1444
ActCreStd, // #1445
ActCreTch, // #1446
}; };
/*****************************************************************************/ /*****************************************************************************/

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+129+168+28+79) #define Act_NUM_ACTIONS (7+52+15+90+73+68+204+182+131+168+28+79)
#define Act_MAX_ACTION_COD 1443 #define Act_MAX_ACTION_COD 1446
#define Act_MAX_OPTIONS_IN_MENU_PER_TAB 20 #define Act_MAX_OPTIONS_IN_MENU_PER_TAB 20
@ -966,51 +966,53 @@ typedef int Act_Action_t; // Must be a signed type, because -1 is used to indica
#define ActRemGstPho (ActChgNumRowFooGrp+ 90) #define ActRemGstPho (ActChgNumRowFooGrp+ 90)
#define ActRemStdPho (ActChgNumRowFooGrp+ 91) #define ActRemStdPho (ActChgNumRowFooGrp+ 91)
#define ActRemTchPho (ActChgNumRowFooGrp+ 92) #define ActRemTchPho (ActChgNumRowFooGrp+ 92)
#define ActCreOthUsrDat (ActChgNumRowFooGrp+ 93) #define ActCreGst (ActChgNumRowFooGrp+ 93)
#define ActUpdOthGst (ActChgNumRowFooGrp+ 94) #define ActCreStd (ActChgNumRowFooGrp+ 94)
#define ActUpdOthStd (ActChgNumRowFooGrp+ 95) #define ActCreTch (ActChgNumRowFooGrp+ 95)
#define ActUpdOthTch (ActChgNumRowFooGrp+ 96) #define ActUpdOthGst (ActChgNumRowFooGrp+ 96)
#define ActUpdOthAdm (ActChgNumRowFooGrp+ 97) #define ActUpdOthStd (ActChgNumRowFooGrp+ 97)
#define ActUpdOthTch (ActChgNumRowFooGrp+ 98)
#define ActUpdOthAdm (ActChgNumRowFooGrp+ 99)
#define ActReqAccEnrCrs (ActChgNumRowFooGrp+ 98) #define ActReqAccEnrCrs (ActChgNumRowFooGrp+100)
#define ActAccEnrCrs (ActChgNumRowFooGrp+ 99) #define ActAccEnrCrs (ActChgNumRowFooGrp+101)
#define ActRemMeCrs (ActChgNumRowFooGrp+100) #define ActRemMeCrs (ActChgNumRowFooGrp+102)
#define ActNewAdmIns (ActChgNumRowFooGrp+101) #define ActNewAdmIns (ActChgNumRowFooGrp+103)
#define ActRemAdmIns (ActChgNumRowFooGrp+102) #define ActRemAdmIns (ActChgNumRowFooGrp+104)
#define ActNewAdmCtr (ActChgNumRowFooGrp+103) #define ActNewAdmCtr (ActChgNumRowFooGrp+105)
#define ActRemAdmCtr (ActChgNumRowFooGrp+104) #define ActRemAdmCtr (ActChgNumRowFooGrp+106)
#define ActNewAdmDeg (ActChgNumRowFooGrp+105) #define ActNewAdmDeg (ActChgNumRowFooGrp+107)
#define ActRemAdmDeg (ActChgNumRowFooGrp+106) #define ActRemAdmDeg (ActChgNumRowFooGrp+108)
#define ActRcvFrmEnrSevStd (ActChgNumRowFooGrp+107) #define ActRcvFrmEnrSevStd (ActChgNumRowFooGrp+109)
#define ActRcvFrmEnrSevTch (ActChgNumRowFooGrp+108) #define ActRcvFrmEnrSevTch (ActChgNumRowFooGrp+110)
#define ActFrmIDsOthUsr (ActChgNumRowFooGrp+109) #define ActFrmIDsOthUsr (ActChgNumRowFooGrp+111)
#define ActRemIDOth (ActChgNumRowFooGrp+110) #define ActRemIDOth (ActChgNumRowFooGrp+112)
#define ActNewIDOth (ActChgNumRowFooGrp+111) #define ActNewIDOth (ActChgNumRowFooGrp+113)
#define ActFrmPwdOthUsr (ActChgNumRowFooGrp+112) #define ActFrmPwdOthUsr (ActChgNumRowFooGrp+114)
#define ActChgPwdOthUsr (ActChgNumRowFooGrp+113) #define ActChgPwdOthUsr (ActChgNumRowFooGrp+115)
#define ActRemUsrCrs (ActChgNumRowFooGrp+114) #define ActRemUsrCrs (ActChgNumRowFooGrp+116)
#define ActRemUsrGbl (ActChgNumRowFooGrp+115) #define ActRemUsrGbl (ActChgNumRowFooGrp+117)
#define ActReqRemAllStdCrs (ActChgNumRowFooGrp+116) #define ActReqRemAllStdCrs (ActChgNumRowFooGrp+118)
#define ActRemAllStdCrs (ActChgNumRowFooGrp+117) #define ActRemAllStdCrs (ActChgNumRowFooGrp+119)
#define ActReqRemOldUsr (ActChgNumRowFooGrp+118) #define ActReqRemOldUsr (ActChgNumRowFooGrp+120)
#define ActRemOldUsr (ActChgNumRowFooGrp+119) #define ActRemOldUsr (ActChgNumRowFooGrp+121)
#define ActSeePubPrf (ActChgNumRowFooGrp+120) #define ActSeePubPrf (ActChgNumRowFooGrp+122)
#define ActCal1stClkTim (ActChgNumRowFooGrp+121) #define ActCal1stClkTim (ActChgNumRowFooGrp+123)
#define ActCalNumClk (ActChgNumRowFooGrp+122) #define ActCalNumClk (ActChgNumRowFooGrp+124)
#define ActCalNumFilVie (ActChgNumRowFooGrp+123) #define ActCalNumFilVie (ActChgNumRowFooGrp+125)
#define ActCalNumForPst (ActChgNumRowFooGrp+124) #define ActCalNumForPst (ActChgNumRowFooGrp+126)
#define ActCalNumMsgSnt (ActChgNumRowFooGrp+125) #define ActCalNumMsgSnt (ActChgNumRowFooGrp+127)
#define ActFolUsr (ActChgNumRowFooGrp+126) #define ActFolUsr (ActChgNumRowFooGrp+128)
#define ActUnfUsr (ActChgNumRowFooGrp+127) #define ActUnfUsr (ActChgNumRowFooGrp+129)
#define ActSeeFlg (ActChgNumRowFooGrp+128) #define ActSeeFlg (ActChgNumRowFooGrp+130)
#define ActSeeFlr (ActChgNumRowFooGrp+129) #define ActSeeFlr (ActChgNumRowFooGrp+131)
/*****************************************************************************/ /*****************************************************************************/
/******************************* Messages tab ********************************/ /******************************* Messages tab ********************************/

View File

@ -98,11 +98,18 @@
/****************************** Public constants *****************************/ /****************************** Public constants *****************************/
/*****************************************************************************/ /*****************************************************************************/
#define Log_PLATFORM_VERSION "SWAD 14.132.4 (2015/09/16)" #define Log_PLATFORM_VERSION "SWAD 14.132.5 (2015/09/16)"
// 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.132.5: Sep 16, 2015 Changes in user enrollment. (184592 lines)
4 changes necessary in database:
UPDATE actions SET Obsolete='Y' WHERE ActCod='440';
INSERT INTO actions (ActCod,Language,Obsolete,Txt) VALUES ('1444','es','N','Crear invitado');
INSERT INTO actions (ActCod,Language,Obsolete,Txt) VALUES ('1445','es','N','Crear usuario como estudiante');
INSERT INTO actions (ActCod,Language,Obsolete,Txt) VALUES ('1446','es','N','Crear usuario como profesor');
Version 14.132.4: Sep 16, 2015 Changes in users' photos. (184536 lines) Version 14.132.4: Sep 16, 2015 Changes in users' photos. (184536 lines)
4 changes necessary in database: 4 changes necessary in database:
UPDATE actions SET Obsolete='Y' WHERE ActCod='429'; UPDATE actions SET Obsolete='Y' WHERE ActCod='429';

View File

@ -1991,53 +1991,52 @@ void Rec_ShowSharedUsrRecord (Rec_RecordViewType_t TypeOfView,
UsrDat->RoleInCurrentCrsDB == Rol_TEACHER); UsrDat->RoleInCurrentCrsDB == Rol_TEACHER);
bool CountryForm = (TypeOfView == Rec_FORM_MY_COMMON_RECORD || bool CountryForm = (TypeOfView == Rec_FORM_MY_COMMON_RECORD ||
TypeOfView == Rec_FORM_NEW_RECORD_OTHER_NEW_USR); TypeOfView == Rec_FORM_NEW_RECORD_OTHER_NEW_USR);
bool RoleForm = Gbl.CurrentCrs.Crs.CrsCod > 0 && bool RoleForm = (TypeOfView == Rec_FORM_SIGN_UP ||
(TypeOfView == Rec_FORM_SIGN_UP ||
TypeOfView == Rec_FORM_NEW_RECORD_OTHER_NEW_USR || TypeOfView == Rec_FORM_NEW_RECORD_OTHER_NEW_USR ||
TypeOfView == Rec_FORM_MODIFY_RECORD_OTHER_EXISTING_USR); TypeOfView == Rec_FORM_MODIFY_RECORD_OTHER_EXISTING_USR);
bool SexForm = TypeOfView == Rec_FORM_MY_COMMON_RECORD; bool SexForm = (TypeOfView == Rec_FORM_MY_COMMON_RECORD);
bool DataForm = TypeOfView == Rec_FORM_MY_COMMON_RECORD || bool DataForm = (TypeOfView == Rec_FORM_MY_COMMON_RECORD ||
TypeOfView == Rec_FORM_NEW_RECORD_OTHER_NEW_USR || TypeOfView == Rec_FORM_NEW_RECORD_OTHER_NEW_USR ||
(TypeOfView == Rec_FORM_MODIFY_RECORD_OTHER_EXISTING_USR && (TypeOfView == Rec_FORM_MODIFY_RECORD_OTHER_EXISTING_USR &&
Gbl.Usrs.Me.LoggedRole >= Rol_DEG_ADM); Gbl.Usrs.Me.LoggedRole >= Rol_DEG_ADM));
bool PutFormLinks; // Put links (forms) inside record card bool PutFormLinks; // Put links (forms) inside record card
bool ShowEmail = ItsMe || bool ShowEmail = (ItsMe ||
Gbl.Usrs.Me.LoggedRole >= Rol_DEG_ADM ||
DataForm ||
TypeOfView == Rec_FORM_MY_COMMON_RECORD ||
TypeOfView == Rec_MY_COMMON_RECORD_CHECK ||
TypeOfView == Rec_FORM_MY_COURSE_RECORD_AS_STUDENT ||
TypeOfView == Rec_CHECK_MY_COURSE_RECORD_AS_STUDENT ||
(UsrDat->Accepted &&
(TypeOfView == Rec_CHECK_OTHER_USR_COMMON_RECORD ||
((TypeOfView == Rec_RECORD_LIST ||
TypeOfView == Rec_RECORD_PRINT) &&
(IAmLoggedAsTeacher || Gbl.Usrs.Listing.RecsUsrs == Rec_RECORD_USERS_TEACHERS)))));
bool ShowID = (ItsMe ||
Gbl.Usrs.Me.LoggedRole >= Rol_DEG_ADM ||
DataForm ||
TypeOfView == Rec_FORM_MY_COMMON_RECORD ||
TypeOfView == Rec_MY_COMMON_RECORD_CHECK ||
TypeOfView == Rec_FORM_MY_COURSE_RECORD_AS_STUDENT ||
TypeOfView == Rec_CHECK_MY_COURSE_RECORD_AS_STUDENT ||
(UsrDat->Accepted &&
((TypeOfView == Rec_CHECK_OTHER_USR_COMMON_RECORD &&
!(IAmLoggedAsTeacher && HeIsTeacherInAnyCourse)) || // A teacher can not see another teacher's ID
((TypeOfView == Rec_RECORD_LIST ||
TypeOfView == Rec_RECORD_PRINT) &&
IAmLoggedAsTeacher && Gbl.Usrs.Listing.RecsUsrs == Rec_RECORD_USERS_STUDENTS))));
bool ShowData = (ItsMe ||
Gbl.Usrs.Me.LoggedRole >= Rol_DEG_ADM || Gbl.Usrs.Me.LoggedRole >= Rol_DEG_ADM ||
DataForm || UsrDat->Accepted);
TypeOfView == Rec_FORM_MY_COMMON_RECORD || bool ShowIDRows = (TypeOfView != Rec_RECORD_PUBLIC);
TypeOfView == Rec_MY_COMMON_RECORD_CHECK || bool ShowAddressRows = (TypeOfView == Rec_FORM_MY_COMMON_RECORD ||
TypeOfView == Rec_FORM_MY_COURSE_RECORD_AS_STUDENT || TypeOfView == Rec_MY_COMMON_RECORD_CHECK ||
TypeOfView == Rec_CHECK_MY_COURSE_RECORD_AS_STUDENT || TypeOfView == Rec_FORM_MY_COURSE_RECORD_AS_STUDENT ||
(UsrDat->Accepted && TypeOfView == Rec_CHECK_MY_COURSE_RECORD_AS_STUDENT ||
(TypeOfView == Rec_CHECK_OTHER_USR_COMMON_RECORD || ((TypeOfView == Rec_RECORD_LIST ||
((TypeOfView == Rec_RECORD_LIST || TypeOfView == Rec_RECORD_PRINT) &&
TypeOfView == Rec_RECORD_PRINT) && (IAmLoggedAsTeacher || IAmLoggedAsSysAdm) &&
(IAmLoggedAsTeacher || Gbl.Usrs.Listing.RecsUsrs == Rec_RECORD_USERS_TEACHERS)))); UsrDat->RoleInCurrentCrsDB == Rol_STUDENT));
bool ShowID = ItsMe ||
Gbl.Usrs.Me.LoggedRole >= Rol_DEG_ADM ||
DataForm ||
TypeOfView == Rec_FORM_MY_COMMON_RECORD ||
TypeOfView == Rec_MY_COMMON_RECORD_CHECK ||
TypeOfView == Rec_FORM_MY_COURSE_RECORD_AS_STUDENT ||
TypeOfView == Rec_CHECK_MY_COURSE_RECORD_AS_STUDENT ||
(UsrDat->Accepted &&
((TypeOfView == Rec_CHECK_OTHER_USR_COMMON_RECORD &&
!(IAmLoggedAsTeacher && HeIsTeacherInAnyCourse)) || // A teacher can not see another teacher's ID
((TypeOfView == Rec_RECORD_LIST ||
TypeOfView == Rec_RECORD_PRINT) &&
IAmLoggedAsTeacher && Gbl.Usrs.Listing.RecsUsrs == Rec_RECORD_USERS_STUDENTS)));
bool ShowData = ItsMe ||
Gbl.Usrs.Me.LoggedRole >= Rol_DEG_ADM ||
UsrDat->Accepted;
bool ShowIDRows = TypeOfView != Rec_RECORD_PUBLIC;
bool ShowAddressRows = TypeOfView == Rec_FORM_MY_COMMON_RECORD ||
TypeOfView == Rec_MY_COMMON_RECORD_CHECK ||
TypeOfView == Rec_FORM_MY_COURSE_RECORD_AS_STUDENT ||
TypeOfView == Rec_CHECK_MY_COURSE_RECORD_AS_STUDENT ||
((TypeOfView == Rec_RECORD_LIST ||
TypeOfView == Rec_RECORD_PRINT) &&
(IAmLoggedAsTeacher || IAmLoggedAsSysAdm) &&
UsrDat->RoleInCurrentCrsDB == Rol_STUDENT);
bool ShowTeacherRows = (((TypeOfView == Rec_FORM_MY_COMMON_RECORD || bool ShowTeacherRows = (((TypeOfView == Rec_FORM_MY_COMMON_RECORD ||
TypeOfView == Rec_MY_COMMON_RECORD_CHECK || TypeOfView == Rec_MY_COMMON_RECORD_CHECK ||
TypeOfView == Rec_FORM_MY_COURSE_RECORD_AS_STUDENT || TypeOfView == Rec_FORM_MY_COURSE_RECORD_AS_STUDENT ||
@ -2448,7 +2447,9 @@ void Rec_ShowSharedUsrRecord (Rec_RecordViewType_t TypeOfView,
Act_FormStart (ActChgMyData); Act_FormStart (ActChgMyData);
break; break;
case Rec_FORM_NEW_RECORD_OTHER_NEW_USR: case Rec_FORM_NEW_RECORD_OTHER_NEW_USR:
Act_FormStart (ActCreOthUsrDat); Act_FormStart ( Gbl.CurrentAct == ActReqMdfStd ? ActCreStd :
(Gbl.CurrentAct == ActReqMdfTch ? ActCreTch :
ActCreGst));
ID_PutParamOtherUsrIDPlain (); // New user ID_PutParamOtherUsrIDPlain (); // New user
break; break;
case Rec_FORM_MODIFY_RECORD_OTHER_EXISTING_USR: case Rec_FORM_MODIFY_RECORD_OTHER_EXISTING_USR:
@ -2522,7 +2523,7 @@ void Rec_ShowSharedUsrRecord (Rec_RecordViewType_t TypeOfView,
{ {
case Rec_FORM_SIGN_UP: // I want to apply for enrollment case Rec_FORM_SIGN_UP: // I want to apply for enrollment
DefaultRoleInCurrentCrs = (UsrDat->Roles & (1 << Rol_TEACHER)) ? Rol_TEACHER : DefaultRoleInCurrentCrs = (UsrDat->Roles & (1 << Rol_TEACHER)) ? Rol_TEACHER :
Rol_STUDENT; Rol_STUDENT;
fprintf (Gbl.F.Out,"<select name=\"Role\">"); fprintf (Gbl.F.Out,"<select name=\"Role\">");
for (Role = Rol_STUDENT; for (Role = Rol_STUDENT;
Role <= Rol_TEACHER; Role <= Rol_TEACHER;
@ -2537,32 +2538,49 @@ void Rec_ShowSharedUsrRecord (Rec_RecordViewType_t TypeOfView,
fprintf (Gbl.F.Out,"</select>"); fprintf (Gbl.F.Out,"</select>");
break; break;
case Rec_FORM_MODIFY_RECORD_OTHER_EXISTING_USR: // The other user already exists in the platform case Rec_FORM_MODIFY_RECORD_OTHER_EXISTING_USR: // The other user already exists in the platform
if (UsrDat->RoleInCurrentCrsDB < Rol_STUDENT) // The other user does not belong to current course
{
/* If there is a request of this user, default role is the requested role */
if ((DefaultRoleInCurrentCrs = Rol_GetRequestedRole (UsrDat->UsrCod)) == Rol_UNKNOWN)
DefaultRoleInCurrentCrs = (UsrDat->Roles & (1 << Rol_TEACHER)) ? Rol_TEACHER :
Rol_STUDENT;
}
else
DefaultRoleInCurrentCrs = UsrDat->RoleInCurrentCrsDB;
fprintf (Gbl.F.Out,"<select name=\"Role\">"); fprintf (Gbl.F.Out,"<select name=\"Role\">");
switch (Gbl.Usrs.Me.LoggedRole) if (Gbl.CurrentCrs.Crs.CrsCod > 0) // Course selected
{ {
case Rol__GUEST_: if (UsrDat->RoleInCurrentCrsDB < Rol_STUDENT) // The other user does not belong to current course
case Rol_VISITOR: {
case Rol_STUDENT: /* If there is a request of this user, default role is the requested role */
fprintf (Gbl.F.Out,"<option value=\"%u\" selected=\"selected\" disabled=\"disabled\">%s</option>", if ((DefaultRoleInCurrentCrs = Rol_GetRequestedRole (UsrDat->UsrCod)) == Rol_UNKNOWN)
(unsigned) Gbl.Usrs.Me.LoggedRole, DefaultRoleInCurrentCrs = (UsrDat->Roles & (1 << Rol_TEACHER)) ? Rol_TEACHER :
Txt_ROLES_SINGUL_Abc[Gbl.Usrs.Me.LoggedRole][UsrDat->Sex]); Rol_STUDENT;
break; }
case Rol_TEACHER: else
for (Role = Rol_STUDENT; DefaultRoleInCurrentCrs = UsrDat->RoleInCurrentCrsDB;
Role <= Rol_TEACHER;
Role++) switch (Gbl.Usrs.Me.LoggedRole)
if (Role == Rol_STUDENT || {
(UsrDat->Roles & (1 << Role))) // A teacher can not upgrade a student (in all other courses) to teacher case Rol__GUEST_:
case Rol_VISITOR:
case Rol_STUDENT:
fprintf (Gbl.F.Out,"<option value=\"%u\" selected=\"selected\" disabled=\"disabled\">%s</option>",
(unsigned) Gbl.Usrs.Me.LoggedRole,
Txt_ROLES_SINGUL_Abc[Gbl.Usrs.Me.LoggedRole][UsrDat->Sex]);
break;
case Rol_TEACHER:
for (Role = Rol_STUDENT;
Role <= Rol_TEACHER;
Role++)
if (Role == Rol_STUDENT ||
(UsrDat->Roles & (1 << Role))) // A teacher can not upgrade a student (in all other courses) to teacher
{
fprintf (Gbl.F.Out,"<option value=\"%u\"",(unsigned) Role);
if (Role == DefaultRoleInCurrentCrs)
fprintf (Gbl.F.Out," selected=\"selected\"");
fprintf (Gbl.F.Out,">%s</option>",
Txt_ROLES_SINGUL_Abc[Role][UsrDat->Sex]);
}
break;
case Rol_DEG_ADM:
case Rol_CTR_ADM:
case Rol_INS_ADM:
case Rol_SYS_ADM:
for (Role = Rol_STUDENT;
Role <= Rol_TEACHER;
Role++)
{ {
fprintf (Gbl.F.Out,"<option value=\"%u\"",(unsigned) Role); fprintf (Gbl.F.Out,"<option value=\"%u\"",(unsigned) Role);
if (Role == DefaultRoleInCurrentCrs) if (Role == DefaultRoleInCurrentCrs)
@ -2570,43 +2588,54 @@ void Rec_ShowSharedUsrRecord (Rec_RecordViewType_t TypeOfView,
fprintf (Gbl.F.Out,">%s</option>", fprintf (Gbl.F.Out,">%s</option>",
Txt_ROLES_SINGUL_Abc[Role][UsrDat->Sex]); Txt_ROLES_SINGUL_Abc[Role][UsrDat->Sex]);
} }
break; break;
case Rol_DEG_ADM: default: // The rest of users can not register other users
case Rol_SYS_ADM: break;
for (Role = Rol_STUDENT; }
Role <= Rol_TEACHER;
Role++) }
{ else // No course selected
fprintf (Gbl.F.Out,"<option value=\"%u\"",(unsigned) Role); {
if (Role == DefaultRoleInCurrentCrs) DefaultRoleInCurrentCrs = (UsrDat->Roles & ((1 << Rol_STUDENT) |
fprintf (Gbl.F.Out," selected=\"selected\""); (1 << Rol_TEACHER))) ? Rol_VISITOR :
fprintf (Gbl.F.Out,">%s</option>", Rol__GUEST_;
Txt_ROLES_SINGUL_Abc[Role][UsrDat->Sex]); fprintf (Gbl.F.Out,"<option value=\"%u\" selected=\"selected\" disabled=\"disabled\">%s</option>",
} (unsigned) DefaultRoleInCurrentCrs,
break; Txt_ROLES_SINGUL_Abc[DefaultRoleInCurrentCrs][UsrDat->Sex]);
default: // The rest of users can not register other users
break;
} }
fprintf (Gbl.F.Out,"</select>"); fprintf (Gbl.F.Out,"</select>");
break; break;
case Rec_FORM_NEW_RECORD_OTHER_NEW_USR: // The other user does not exist in platform case Rec_FORM_NEW_RECORD_OTHER_NEW_USR: // The other user does not exist in platform
fprintf (Gbl.F.Out,"<select name=\"Role\">"); fprintf (Gbl.F.Out,"<select name=\"Role\">");
switch (Gbl.Usrs.Me.LoggedRole) if (Gbl.CurrentCrs.Crs.CrsCod > 0) // Course selected
{ switch (Gbl.Usrs.Me.LoggedRole)
case Rol_TEACHER: // A teacher only can create students {
fprintf (Gbl.F.Out,"<option value=\"%u\" selected=\"selected\">%s</option>", case Rol_TEACHER: // A teacher only can create students
(unsigned) Rol_STUDENT,Txt_ROLES_SINGUL_Abc[Rol_STUDENT][Usr_SEX_UNKNOWN]); fprintf (Gbl.F.Out,"<option value=\"%u\" selected=\"selected\">%s</option>",
break; (unsigned) Rol_STUDENT,Txt_ROLES_SINGUL_Abc[Rol_STUDENT][Usr_SEX_UNKNOWN]);
case Rol_DEG_ADM: // An administrator or a superuser can create students and teachers break;
case Rol_SYS_ADM: case Rol_DEG_ADM: // An administrator can create students and teachers in a course
fprintf (Gbl.F.Out,"<option value=\"%u\" selected=\"selected\">%s</option>" case Rol_CTR_ADM:
"<option value=\"%u\">%s</option>", case Rol_INS_ADM:
(unsigned) Rol_STUDENT,Txt_ROLES_SINGUL_Abc[Rol_STUDENT][Usr_SEX_UNKNOWN], case Rol_SYS_ADM:
(unsigned) Rol_TEACHER,Txt_ROLES_SINGUL_Abc[Rol_TEACHER][Usr_SEX_UNKNOWN]); fprintf (Gbl.F.Out,"<option value=\"%u\" selected=\"selected\">%s</option>"
break; "<option value=\"%u\">%s</option>",
default: // The rest of users can not register other users (unsigned) Rol_STUDENT,Txt_ROLES_SINGUL_Abc[Rol_STUDENT][Usr_SEX_UNKNOWN],
break; (unsigned) Rol_TEACHER,Txt_ROLES_SINGUL_Abc[Rol_TEACHER][Usr_SEX_UNKNOWN]);
} break;
default: // The rest of users can not register other users
break;
}
else // No course selected
switch (Gbl.Usrs.Me.LoggedRole)
{
case Rol_SYS_ADM:
fprintf (Gbl.F.Out,"<option value=\"%u\" selected=\"selected\">%s</option>",
(unsigned) Rol__GUEST_,Txt_ROLES_SINGUL_Abc[Rol__GUEST_][Usr_SEX_UNKNOWN]);
break;
default: // The rest of users can not register other users
break;
}
fprintf (Gbl.F.Out,"</select>"); fprintf (Gbl.F.Out,"</select>");
break; break;
default: default:
@ -3164,6 +3193,7 @@ Rol_Role_t Rec_GetRoleFromRecordForm (void)
{ {
char UnsignedStr[10+1]; char UnsignedStr[10+1];
Rol_Role_t Role; Rol_Role_t Role;
bool RoleOK = false;
/***** Get role as a parameter from form *****/ /***** Get role as a parameter from form *****/
Par_GetParToText ("Role",UnsignedStr,10); Par_GetParToText ("Role",UnsignedStr,10);
@ -3171,31 +3201,42 @@ Rol_Role_t Rec_GetRoleFromRecordForm (void)
/***** Check if I can register a user /***** Check if I can register a user
with the received role in current course *****/ with the received role in current course *****/
/* Received role must be student or teacher */
if (!(Role == Rol_STUDENT ||
Role == Rol_TEACHER))
Lay_ShowErrorAndExit ("Wrong user's role.");
/* Check for other possible errors */ /* Check for other possible errors */
switch (Gbl.Usrs.Me.LoggedRole) switch (Gbl.Usrs.Me.LoggedRole)
{ {
case Rol_STUDENT: // I am logged as student case Rol_STUDENT: // I am logged as student
/* A student can only change his/her data, but not his/her role */ /* A student can only change his/her data, but not his/her role */
if (Role != Rol_STUDENT) if (Role == Rol_STUDENT)
Lay_ShowErrorAndExit ("Wrong user's role."); RoleOK = true;
break; break;
case Rol_TEACHER: // I am logged as teacher case Rol_TEACHER: // I am logged as teacher
/* A teacher can only register another user as teacher /* A teacher can only register another user as teacher
if the other is already teacher in any course. if the other is already teacher in any course.
That is, a teacher can not upgrade a student That is, a teacher can not upgrade a student
(in all other courses) to teacher */ (in all other courses) to teacher */
if (Role == Rol_TEACHER && // He/she will be a teacher in current course if ( Role == Rol_STUDENT ||
!(Gbl.Usrs.Other.UsrDat.Roles & (1 << Rol_TEACHER))) // He/she was not a teacher in any course (Role == Rol_TEACHER && // He/she will be a teacher in current course
Lay_ShowErrorAndExit ("Wrong user's role."); (Gbl.Usrs.Other.UsrDat.Roles & (1 << Rol_TEACHER)))) // He/she was a teacher in some courses
RoleOK = true;
break; break;
case Rol_DEG_ADM: // I am logged as admin
case Rol_CTR_ADM:
case Rol_INS_ADM:
if (Role == Rol_STUDENT ||
Role == Rol_TEACHER)
RoleOK = true;
break;
case Rol_SYS_ADM:
if ( Role == Rol_STUDENT ||
Role == Rol_TEACHER ||
(Role == Rol__GUEST_ && Gbl.CurrentCrs.Crs.CrsCod <= 0))
RoleOK = true;
break;
default: default:
break; break;
} }
if (!RoleOK)
Lay_ShowErrorAndExit ("Wrong user's role.");
return Role; return Role;
} }