diff --git a/css/swad15.198.css b/css/swad15.202.css
similarity index 99%
rename from css/swad15.198.css
rename to css/swad15.202.css
index f2e39f2ed..eeb4a2101 100644
--- a/css/swad15.198.css
+++ b/css/swad15.202.css
@@ -1679,6 +1679,10 @@ a:hover img.CENTRE_PHOTO_SHOW
.DAT_SMALL_BLUE {font-family:"Arial Narrow","Nimbus Sans L","DejaVu LGC Sans Condensed",sans-serif; color:#0080FF; font-size:12pt;}
.DAT_SMALL_YELLOW {font-family:"Arial Narrow","Nimbus Sans L","DejaVu LGC Sans Condensed",sans-serif; color:#C0C000; font-size:12pt;}
+/******************************** User's IDs *********************************/
+.USR_ID_C {color:#408020}
+.USR_ID_NC {color:#A02020}
+
/******************************* Record card *********************************/
.REC_SHORTCUTS
{
diff --git a/swad_ID.c b/swad_ID.c
index 99ee46c67..031a42ecc 100644
--- a/swad_ID.c
+++ b/swad_ID.c
@@ -345,26 +345,27 @@ static bool ID_CheckIfUsrIDIsValidUsingMinDigits (const char *UsrID,unsigned Min
/*************************** Write list of user's ID *************************/
/*****************************************************************************/
-void ID_WriteUsrIDs (struct UsrData *UsrDat,bool ICanSeeUsrID)
+void ID_WriteUsrIDs (struct UsrData *UsrDat)
{
unsigned NumID;
+ bool ICanSeeUsrID = ID_ICanSeeUsrID (UsrDat);
- if (ICanSeeUsrID)
- for (NumID = 0;
- NumID < UsrDat->IDs.Num;
- NumID++)
- {
- if (NumID)
- fprintf (Gbl.F.Out," ");
+ for (NumID = 0;
+ NumID < UsrDat->IDs.Num;
+ NumID++)
+ {
+ if (NumID)
+ fprintf (Gbl.F.Out," ");
- if (!UsrDat->IDs.List[NumID].Confirmed)
- fprintf (Gbl.F.Out,"");
+ fprintf (Gbl.F.Out,"",
+ UsrDat->IDs.List[NumID].Confirmed ? "USR_ID_C" :
+ "USR_ID_NC");
+ if (ICanSeeUsrID)
fprintf (Gbl.F.Out,"%s",UsrDat->IDs.List[NumID].ID);
- if (!UsrDat->IDs.List[NumID].Confirmed)
- fprintf (Gbl.F.Out,"");
- }
- else
- fprintf (Gbl.F.Out,"********");
+ else
+ fprintf (Gbl.F.Out,"********");
+ fprintf (Gbl.F.Out,"");
+ }
}
/*****************************************************************************/
@@ -824,13 +825,19 @@ void ID_ConfirmUsrID (long UsrCod,const char *UsrID)
bool ID_ICanSeeUsrID (struct UsrData *UsrDat)
{
+ bool ItsMe = (UsrDat->UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod);
+
+ if (ItsMe)
+ return true;
+
/* Check if I have permission to see another user's ID */
switch (Gbl.Usrs.Me.LoggedRole)
{
case Rol_TEACHER:
/* If I am a teacher of current course,
I only can see the user's ID of students from current course */
- return (UsrDat->RoleInCurrentCrsDB == Rol_STUDENT);
+ return (UsrDat->Accepted &&
+ UsrDat->RoleInCurrentCrsDB == Rol_STUDENT);
case Rol_DEG_ADM:
/* If I am an administrator of current degree,
I only can see the user's ID of users from current degree */
diff --git a/swad_ID.h b/swad_ID.h
index d43139ab3..f971e49d9 100644
--- a/swad_ID.h
+++ b/swad_ID.h
@@ -64,7 +64,7 @@ void ID_GetParamOtherUsrIDPlain (void);
bool ID_CheckIfUsrIDIsValid (const char *UsrID);
bool ID_CheckIfUsrIDSeemsAValidID (const char *UsrID);
-void ID_WriteUsrIDs (struct UsrData *UsrDat,bool ICanSeeUsrID);
+void ID_WriteUsrIDs (struct UsrData *UsrDat);
void ID_PutLinkToChangeUsrIDs (void);
void ID_ShowFormOthIDs (void);
diff --git a/swad_attendance.c b/swad_attendance.c
index be401f818..1a4567991 100644
--- a/swad_attendance.c
+++ b/swad_attendance.c
@@ -2008,7 +2008,7 @@ static void Att_WriteRowStdToCallTheRoll (unsigned NumStd,struct UsrData *UsrDat
UsrDat->Accepted ? "DAT_SMALL_N" :
"DAT_SMALL",
Gbl.RowEvenOdd);
- ID_WriteUsrIDs (UsrDat,true);
+ ID_WriteUsrIDs (UsrDat);
fprintf (Gbl.F.Out,"");
/***** Write student's name *****/
@@ -3217,7 +3217,7 @@ static void Att_WriteRowStdSeveralAttEvents (unsigned NumStd,struct UsrData *Usr
UsrDat->Accepted ? "DAT_SMALL_N" :
"DAT_SMALL",
Gbl.RowEvenOdd);
- ID_WriteUsrIDs (UsrDat,true);
+ ID_WriteUsrIDs (UsrDat);
fprintf (Gbl.F.Out,"");
/***** Write student's name *****/
@@ -3357,7 +3357,7 @@ static void Att_ListAttEventsForAStd (unsigned NumStd,struct UsrData *UsrDat)
Gbl.RowEvenOdd,
UsrDat->Accepted ? "DAT_SMALL_N" :
"DAT_SMALL");
- ID_WriteUsrIDs (UsrDat,true);
+ ID_WriteUsrIDs (UsrDat);
fprintf (Gbl.F.Out,"");
/***** Write student's name *****/
diff --git a/swad_changelog.h b/swad_changelog.h
index 0a6a3df85..95a7c0d3b 100644
--- a/swad_changelog.h
+++ b/swad_changelog.h
@@ -137,13 +137,17 @@
/****************************** Public constants *****************************/
/*****************************************************************************/
-#define Log_PLATFORM_VERSION "SWAD 15.201.8 (2016-04-22)"
-#define CSS_FILE "swad15.198.css"
+#define Log_PLATFORM_VERSION "SWAD 15.202 (2016-04-23)"
+#define CSS_FILE "swad15.202.css"
#define JS_FILE "swad15.197.js"
// Number of lines (includes comments but not blank lines) has been got with the following command:
// nl swad*.c swad*.h css/swad*.css py/swad*.py js/swad*.js soap/swad*.h sql/swad*.sql | tail -1
/*
+ Version 15.202: Apr 23, 2016 User's IDs are show in green or red.
+ Code refactoring and bug fixing related to showing user's ID and e-mail. (200908 lines)
+ Version 15.201.9: Apr 22, 2016 Code refactoring in record card.
+ Changes in layout of record cards. (200895 lines)
Version 15.201.8: Apr 22, 2016 Code refactoring in record card.
Fixed bugs in record cards. (200881 lines)
Version 15.201.7: Apr 22, 2016 Code refactoring in record card.
diff --git a/swad_file_browser.c b/swad_file_browser.c
index c0261cc83..2248b8a3d 100644
--- a/swad_file_browser.c
+++ b/swad_file_browser.c
@@ -3457,9 +3457,7 @@ static void Brw_ShowDataOwnerAsgWrk (struct UsrData *UsrDat)
Usr_PutParamUsrCodEncrypted (UsrDat->EncryptedUsrCod);
/***** Show user's ID *****/
- ID_WriteUsrIDs (UsrDat,
- UsrDat->RoleInCurrentCrsDB == Rol_TEACHER ? ID_ICanSeeUsrID (UsrDat) :
- (Gbl.Usrs.Me.LoggedRole >= Rol_TEACHER));
+ ID_WriteUsrIDs (UsrDat);
/***** Show user's name *****/
fprintf (Gbl.F.Out," ");
diff --git a/swad_mail.c b/swad_mail.c
index 739f8371b..c9a0ae14b 100644
--- a/swad_mail.c
+++ b/swad_mail.c
@@ -1558,3 +1558,47 @@ void Mai_WriteFootNoteEMail (Txt_Language_t Language)
Cfg_PLATFORM_SHORT_NAME,
Cfg_HTTPS_URL_SWAD_CGI);
}
+
+/*****************************************************************************/
+/**************** Check if I can see another user's e-mail *******************/
+/*****************************************************************************/
+
+bool Mai_ICanSeeEmail (struct UsrData *UsrDat)
+ {
+ bool ItsMe = (UsrDat->UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod);
+
+ if (ItsMe)
+ return true;
+
+ /* Check if I have permission to see another user's e-mail */
+ switch (Gbl.Usrs.Me.LoggedRole)
+ {
+ case Rol_STUDENT:
+ /* If I am a student of current course,
+ I only can see the user's e-mail of teachers from current course */
+ return (UsrDat->Accepted &&
+ UsrDat->RoleInCurrentCrsDB == Rol_TEACHER);
+ case Rol_TEACHER:
+ /* If I am a teacher of current course,
+ I only can see the user's e-mail of students or teachers from current course */
+ return (UsrDat->Accepted &&
+ (UsrDat->RoleInCurrentCrsDB == Rol_STUDENT ||
+ UsrDat->RoleInCurrentCrsDB == Rol_TEACHER));
+ case Rol_DEG_ADM:
+ /* If I am an administrator of current degree,
+ I only can see the user's e-mail of users from current degree */
+ return Usr_CheckIfUsrBelongsToDeg (UsrDat->UsrCod,Gbl.CurrentDeg.Deg.DegCod,true);
+ case Rol_CTR_ADM:
+ /* If I am an administrator of current centre,
+ I only can see the user's e-mail of users from current centre */
+ return Usr_CheckIfUsrBelongsToCtr (UsrDat->UsrCod,Gbl.CurrentCtr.Ctr.CtrCod,true);
+ case Rol_INS_ADM:
+ /* If I am an administrator of current institution,
+ I only can see the user's e-mail of users from current institution */
+ return Usr_CheckIfUsrBelongsToIns (UsrDat->UsrCod,Gbl.CurrentIns.Ins.InsCod,true);
+ case Rol_SYS_ADM:
+ return true;
+ default:
+ return false;
+ }
+ }
diff --git a/swad_mail.h b/swad_mail.h
index e67e17a40..3c856e560 100644
--- a/swad_mail.h
+++ b/swad_mail.h
@@ -85,4 +85,6 @@ void Mai_CreateFileNameMail (void);
void Mai_WriteWelcomeNoteEMail (struct UsrData *UsrDat);
void Mai_WriteFootNoteEMail (Txt_Language_t Language);
+bool Mai_ICanSeeEmail (struct UsrData *UsrDat);
+
#endif
diff --git a/swad_message.c b/swad_message.c
index fae36dc12..355bda508 100644
--- a/swad_message.c
+++ b/swad_message.c
@@ -493,8 +493,7 @@ static void Msg_ShowOneUniqueRecipient (void)
fprintf (Gbl.F.Out,"
",
- ClassForm,Rec_C1_BOTTOM,
- Txt_Role,
- Rec_C2_BOTTOM);
- switch (TypeOfView)
- {
- case Rec_FORM_SIGN_UP: // I want to apply for enrollment
- DefaultRoleInCurrentCrs = ((UsrDat->Roles & (1 << Rol_TEACHER)) || // I am teacher in other courses
- UsrDat->UsrCod == Gbl.CurrentCrs.Crs.RequesterUsrCod) ? // I am the creator of the course
- Rol_TEACHER :
- Rol_STUDENT;
- fprintf (Gbl.F.Out,"");
- break;
- case Rec_FORM_MODIFY_RECORD_OTHER_EXISTING_USR: // The other user already exists in the platform
- fprintf (Gbl.F.Out,"");
- break;
- case Rec_FORM_NEW_RECORD_OTHER_NEW_USR: // The other user does not exist in platform
- fprintf (Gbl.F.Out,"");
- break;
- default:
- break;
- }
- fprintf (Gbl.F.Out,"
",
+ ClassForm,Rec_C1_BOTTOM,
+ Txt_Role,
+ Rec_C2_BOTTOM);
+ switch (TypeOfView)
+ {
+ case Rec_FORM_SIGN_UP: // I want to apply for enrollment
+ DefaultRoleInCurrentCrs = ((UsrDat->Roles & (1 << Rol_TEACHER)) || // I am teacher in other courses
+ UsrDat->UsrCod == Gbl.CurrentCrs.Crs.RequesterUsrCod) ? // I am the creator of the course
+ Rol_TEACHER :
+ Rol_STUDENT;
+ fprintf (Gbl.F.Out,"");
+ break;
+ case Rec_FORM_MODIFY_RECORD_OTHER_EXISTING_USR: // The other user already exists in the platform
+ fprintf (Gbl.F.Out,"");
+ break;
+ case Rec_FORM_NEW_RECORD_OTHER_NEW_USR: // The other user does not exist in platform
+ fprintf (Gbl.F.Out,"");
+ break;
+ default:
+ break;
+ }
+ fprintf (Gbl.F.Out,"
");
/* Write the first name and the surnames */
@@ -1821,7 +1821,7 @@ static void Sta_ShowNumHitsPerUsr (unsigned long NumRows,
/* Write the user's ID if user is a student in current course */
fprintf (Gbl.F.Out,"
");
- /***** Student has accepted enrollment in current course? *****/
+ /***** Guest has accepted enrollment in current course? *****/
fprintf (Gbl.F.Out,"