diff --git a/swad_changelog.h b/swad_changelog.h
index b0571b481..7cc014dcc 100644
--- a/swad_changelog.h
+++ b/swad_changelog.h
@@ -193,14 +193,14 @@
/****************************** Public constants *****************************/
/*****************************************************************************/
-#define Log_PLATFORM_VERSION "SWAD 16.126 (2017-01-27)"
+#define Log_PLATFORM_VERSION "SWAD 16.126.1 (2017-01-27)"
#define CSS_FILE "swad16.123.css"
#define JS_FILE "swad16.123.js"
// Number of lines (includes comments but not blank lines) has been got with the following command:
// nl swad*.c swad*.h css/swad*.css py/swad*.py js/swad*.js soap/swad*?.h sql/swad*.sql | tail -1
/*
- Version 16.126.1: Jan 27, 2017 A teacher can create and register a new teacher directly in a course. (? lines)
+ Version 16.126.1: Jan 27, 2017 A teacher can create and register a new teacher directly in a course. (212080 lines)
Version 16.126: Jan 27, 2017 Code refactoring related to permissions to view/change another user's data. (212086 lines)
Version 16.125: Jan 27, 2017 Code refactoring related to permissions to view/change another user's data. (212152 lines)
Version 16.124: Jan 26, 2017 Code refactoring related to permissions to view/change another user's data. (212163 lines)
diff --git a/swad_enrollment.c b/swad_enrollment.c
index 9e3b5f9bb..a4342eb57 100644
--- a/swad_enrollment.c
+++ b/swad_enrollment.c
@@ -3132,7 +3132,7 @@ static void Enr_AskIfRegRemUsr (struct ListUsrCods *ListUsrCods,Rol_Role_t Role)
sprintf (Gbl.Message,Txt_The_user_is_new_not_yet_in_X,
Cfg_PLATFORM_SHORT_NAME);
Lay_ShowAlert (Lay_INFO,Gbl.Message);
- Rec_ShowFormOtherNewSharedRecord (&Gbl.Usrs.Other.UsrDat);
+ Rec_ShowFormOtherNewSharedRecord (&Gbl.Usrs.Other.UsrDat,Role);
}
else // User's ID is not valid
{
@@ -3644,7 +3644,7 @@ void Enr_ModifyUsr1 (void)
extern const char *Txt_The_role_of_THE_USER_X_in_the_course_Y_has_changed_from_A_to_B;
extern const char *Txt_ROLES_SINGUL_abc[Rol_NUM_ROLES][Usr_NUM_SEXS];
extern const char *Txt_THE_USER_X_has_been_enrolled_in_the_course_Y;
- char UnsignedStr[10+1];
+ char UnsignedStr[10 + 1];
unsigned UnsignedNum;
bool ItsMe;
Rol_Role_t OldRole;
diff --git a/swad_record.c b/swad_record.c
index 7e851608c..44df097c7 100644
--- a/swad_record.c
+++ b/swad_record.c
@@ -1993,9 +1993,14 @@ void Rec_ShowFormMySharedRecord (void)
/*************** Show form to edit the record of a new user ******************/
/*****************************************************************************/
-void Rec_ShowFormOtherNewSharedRecord (struct UsrData *UsrDat)
+void Rec_ShowFormOtherNewSharedRecord (struct UsrData *UsrDat,Rol_Role_t DefaultRole)
{
/***** Show the form *****/
+ /* In this case UsrDat->RoleInCurrentCrsDB
+ is not the current role in current course.
+ Instead it is initialized with the preferred role. */
+ UsrDat->RoleInCurrentCrsDB = (Gbl.CurrentCrs.Crs.CrsCod > 0) ? DefaultRole : // Course selected
+ Rol__GUEST_; // No course selected
Rec_ShowSharedUsrRecord (Rec_SHA_OTHER_NEW_USR_FORM,UsrDat);
}
@@ -2807,22 +2812,6 @@ static void Rec_ShowRole (struct UsrData *UsrDat,
(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,"",
- Txt_ROLES_SINGUL_Abc[Role][UsrDat->Sex]);
- }
- break;
- */
case Rol_TEACHER:
case Rol_DEG_ADM:
case Rol_CTR_ADM:
@@ -2861,20 +2850,25 @@ static void Rec_ShowRole (struct UsrData *UsrDat,
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,"",
- (unsigned) Rol_STUDENT,Txt_ROLES_SINGUL_Abc[Rol_STUDENT][Usr_SEX_UNKNOWN]);
- break;
- case Rol_DEG_ADM: // An administrator can create students and teachers in a course
+ case Rol_TEACHER:
+ case Rol_DEG_ADM:
case Rol_CTR_ADM:
case Rol_INS_ADM:
case Rol_SYS_ADM:
- fprintf (Gbl.F.Out,""
- "",
- (unsigned) Rol_STUDENT,Txt_ROLES_SINGUL_Abc[Rol_STUDENT][Usr_SEX_UNKNOWN],
- (unsigned) Rol_TEACHER,Txt_ROLES_SINGUL_Abc[Rol_TEACHER][Usr_SEX_UNKNOWN]);
+ /* In this case UsrDat->RoleInCurrentCrsDB
+ is not the current role in current course.
+ Instead it is initialized with the preferred role. */
+ DefaultRoleInCurrentCrs = UsrDat->RoleInCurrentCrsDB;
+ for (Role = Rol_STUDENT;
+ Role <= Rol_TEACHER;
+ Role++)
+ {
+ fprintf (Gbl.F.Out,"",
+ Txt_ROLES_SINGUL_Abc[Role][Usr_SEX_UNKNOWN]);
+ }
break;
default: // The rest of users can not register other users
break;
diff --git a/swad_record.h b/swad_record.h
index debb6d7b7..b651d04bd 100644
--- a/swad_record.h
+++ b/swad_record.h
@@ -144,7 +144,7 @@ void Rec_FreeMemFieldsRecordsCrs (void);
void Rec_ShowFormSignUpWithMySharedRecord (void);
void Rec_ShowFormMySharedRecord (void);
-void Rec_ShowFormOtherNewSharedRecord (struct UsrData *UsrDat);
+void Rec_ShowFormOtherNewSharedRecord (struct UsrData *UsrDat,Rol_Role_t DefaultRole);
void Rec_ShowMySharedRecordUpd (void);
void Rec_ShowSharedRecordUnmodifiable (struct UsrData *UsrDat);
void Rec_ShowSharedUsrRecord (Rec_SharedRecordViewType_t TypeOfView,