Version 15.72.4

This commit is contained in:
Antonio Cañas Vargas 2015-12-23 13:20:58 +01:00
parent 573ee8cbfc
commit 6fb8fb8688
7 changed files with 71 additions and 31 deletions

View File

@ -819,15 +819,18 @@ void ID_ConfirmUsrID (long UsrCod,const char *UsrID)
}
/*****************************************************************************/
/*************** Check if I can see the user's ID of a teacher ***************/
/***************** Check if I can see another user's ID **********************/
/*****************************************************************************/
bool ID_ICanSeeTeacherID (struct UsrData *UsrDat)
bool ID_ICanSeeUsrID (struct UsrData *UsrDat)
{
/* Check if I have permission to see the user's ID of a teacher
Only teachers who have accepted registration in courses are counted */
/* 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);
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 */

View File

@ -75,6 +75,6 @@ void ID_NewMyUsrID (void);
void ID_NewOtherUsrID (void);
void ID_ConfirmUsrID (long UsrCod,const char *UsrID);
bool ID_ICanSeeTeacherID (struct UsrData *UsrDat);
bool ID_ICanSeeUsrID (struct UsrData *UsrDat);
#endif

View File

@ -118,13 +118,13 @@
/****************************** Public constants *****************************/
/*****************************************************************************/
#define Log_PLATFORM_VERSION "SWAD 15.72.3 (2015-12-23)"
#define CSS_FILE "swad15.65.1.css"
#define Log_PLATFORM_VERSION "SWAD 15.72.4 (2015-12-23)"
#define CSS_FILE "swad15.72.4.css"
// 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.72.4: Dec 23, 2015 Show recipient when writing message to only one recipient. (? lines)
Version 15.72.4: Dec 23, 2015 Show recipient when writing message to only one recipient. (187775 lines)
Version 15.72.3: Dec 23, 2015 Message translated. (187733 lines)
Version 15.72.2: Dec 23, 2015 Write message only to one recipient. Not finished.
Some small icons changed. (187750 lines)

View File

@ -3201,7 +3201,7 @@ static void Brw_ShowDataOwnerAsgWrk (struct UsrData *UsrDat)
/***** Show user's ID *****/
ID_WriteUsrIDs (UsrDat,
UsrDat->RoleInCurrentCrsDB == Rol_TEACHER ? ID_ICanSeeTeacherID (UsrDat) :
UsrDat->RoleInCurrentCrsDB == Rol_TEACHER ? ID_ICanSeeUsrID (UsrDat) :
(Gbl.Usrs.Me.LoggedRole >= Rol_TEACHER));
/***** Show user's name *****/

View File

@ -38,6 +38,7 @@
#include "swad_forum.h"
#include "swad_global.h"
#include "swad_group.h"
#include "swad_ID.h"
#include "swad_message.h"
#include "swad_notification.h"
#include "swad_parameter.h"
@ -80,7 +81,9 @@ static void Msg_ShowASentOrReceivedMessage (Msg_TypeOfMessages_t TypeOfMessages,
static void Msg_GetStatusOfSentMsg (long MsgCod,bool *Expanded);
static void Msg_GetStatusOfReceivedMsg (long MsgCod,bool *Open,bool *Replied,bool *Expanded);
static long Msg_GetParamMsgCod (void);
static void Msg_PutLinkToShowMorePotentialRecipients (void);
static void Msg_PutParamsShowMorePotentialRecipients (void);
static void Msg_ShowOneUniqueRecipient (void);
static void Msg_WriteFormUsrsIDsOrNicksOtherRecipients (void);
static void Msg_WriteFormSubjectAndContentMsgToUsrs (const char *Content);
static void Msg_ShowNumMsgsDeleted (unsigned NumMsgs);
@ -263,7 +266,6 @@ static void Msg_PutFormMsgUsrs (const char *Content)
extern const char *The_ClassForm[The_NUM_THEMES];
extern const char *Txt_Reply_message;
extern const char *Txt_New_message;
extern const char *Txt_Show_more_recipients;
extern const char *Txt_MSG_To;
extern const char *Txt_Send_message;
char YN[1+1];
@ -278,8 +280,7 @@ static void Msg_PutFormMsgUsrs (const char *Content)
Gbl.Msg.Reply.OriginalMsgCod = Msg_GetParamMsgCod ();
/***** Get user's code of possible preselected recipient *****/
Usr_GetParamOtherUsrCodEncrypted ();
if (Gbl.Usrs.Other.UsrDat.UsrCod > 0) // There is a preselected recipient
if (Usr_GetParamOtherUsrCodEncryptedAndGetUsrData ()) // There is a preselected recipient
{
/* Get who to show as potential recipients:
- only the selected recipient
@ -328,13 +329,7 @@ static void Msg_PutFormMsgUsrs (const char *Content)
/***** Form to show several potential recipients *****/
if (Gbl.Msg.ShowOnlyOneRecipient)
{
fprintf (Gbl.F.Out,"<div class=\"CONTEXT_MENU\">");
Lay_PutContextualLink (ActReqMsgUsr,Msg_PutParamsShowMorePotentialRecipients,
"usrs64x64.gif",
Txt_Show_more_recipients,Txt_Show_more_recipients);
fprintf (Gbl.F.Out,"</div>");
}
Msg_PutLinkToShowMorePotentialRecipients ();
/***** Start form to select recipients and write the message *****/
Act_FormStart (ActRcvMsgUsr);
@ -349,7 +344,7 @@ static void Msg_PutFormMsgUsrs (const char *Content)
/***** Start table *****/
fprintf (Gbl.F.Out,"<table style=\"margin:0 auto;\">");
/***** To (recipients) *****/
/***** "To:" section (recipients) *****/
fprintf (Gbl.F.Out,"<tr>"
"<td class=\"%s RIGHT_TOP\">"
"%s:"
@ -359,13 +354,10 @@ static void Msg_PutFormMsgUsrs (const char *Content)
The_ClassForm[Gbl.Prefs.Theme],Txt_MSG_To);
if (Gbl.Msg.ShowOnlyOneRecipient)
{
fprintf (Gbl.F.Out,"<tr>"
"<td>");
/***** Show only one user as recipient *****/
sprintf (Gbl.Message,"Gbl.Usrs.Other.UsrDat.UsrCod = %ld",Gbl.Usrs.Other.UsrDat.UsrCod);
Lay_ShowAlert (Lay_INFO,Gbl.Message);
fprintf (Gbl.F.Out,"<tr>"
"<td class=\"LEFT_TOP\">");
Msg_ShowOneUniqueRecipient ();
fprintf (Gbl.F.Out,"</td>"
"</tr>");
}
@ -387,7 +379,7 @@ static void Msg_PutFormMsgUsrs (const char *Content)
"</td>"
"</tr>");
/***** Subject and content *****/
/***** Subject and content sections *****/
Msg_WriteFormSubjectAndContentMsgToUsrs (Content);
/***** Help for text editor and send button *****/
@ -424,6 +416,21 @@ static void Msg_PutFormMsgUsrs (const char *Content)
Grp_FreeListCodSelectedGrps ();
}
/*****************************************************************************/
/********** Put contextual link to show more potential recipients ************/
/*****************************************************************************/
static void Msg_PutLinkToShowMorePotentialRecipients (void)
{
extern const char *Txt_Show_more_recipients;
fprintf (Gbl.F.Out,"<div class=\"CONTEXT_MENU\">");
Lay_PutContextualLink (ActReqMsgUsr,Msg_PutParamsShowMorePotentialRecipients,
"usrs64x64.gif",
Txt_Show_more_recipients,Txt_Show_more_recipients);
fprintf (Gbl.F.Out,"</div>");
}
/*****************************************************************************/
/************ Put parameters to show more potential recipients ***************/
/*****************************************************************************/
@ -438,6 +445,36 @@ static void Msg_PutParamsShowMorePotentialRecipients (void)
}
}
/*****************************************************************************/
/************ Put parameters to show more potential recipients ***************/
/*****************************************************************************/
static void Msg_ShowOneUniqueRecipient (void)
{
char PhotoURL[PATH_MAX+1];
bool ShowPhoto;
/***** Show user's photo *****/
ShowPhoto = Pho_ShowUsrPhotoIsAllowed (&Gbl.Usrs.Other.UsrDat,PhotoURL);
Pho_ShowUsrPhoto (&Gbl.Usrs.Other.UsrDat,ShowPhoto ? PhotoURL :
NULL,
"PHOTO21x28",Pho_ZOOM);
/****** Write user's IDs ******/
fprintf (Gbl.F.Out,"<div class=\"MSG_TO_ONE_RCP %s\">",
Gbl.Usrs.Other.UsrDat.Accepted ? "DAT_SMALL_NOBR_N" :
"DAT_SMALL_NOBR");
ID_WriteUsrIDs (&Gbl.Usrs.Other.UsrDat,
ID_ICanSeeUsrID (&Gbl.Usrs.Other.UsrDat));
fprintf (Gbl.F.Out,"</div>");
/***** Write user's name *****/
fprintf (Gbl.F.Out,"<div class=\"MSG_TO_ONE_RCP %s\">%s</div>",
Gbl.Usrs.Other.UsrDat.Accepted ? "DAT_SMALL_NOBR_N" :
"DAT_SMALL_NOBR",
Gbl.Usrs.Other.UsrDat.FullName);
}
/*****************************************************************************/
/************** Nicknames of recipients of a message to users ****************/
/*****************************************************************************/

View File

@ -6473,7 +6473,7 @@ static void Tst_ShowDataUsr (struct UsrData *UsrDat,unsigned NumExams)
/***** Show user's ID *****/
ID_WriteUsrIDs (UsrDat,
(UsrDat->RoleInCurrentCrsDB == Rol_TEACHER ? ID_ICanSeeTeacherID (UsrDat) :
(UsrDat->RoleInCurrentCrsDB == Rol_TEACHER ? ID_ICanSeeUsrID (UsrDat) :
(Gbl.Usrs.Me.LoggedRole >= Rol_TEACHER)));
/***** Show user's name *****/

View File

@ -1847,7 +1847,7 @@ bool Usr_GetParamOtherUsrCodEncryptedAndGetUsrData (void)
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat)) // Existing user
return true;
Lay_ShowAlert (Lay_ERROR,"User does not exist.");
// Lay_ShowAlert (Lay_ERROR,"User does not exist.");
return false;
}
@ -3130,7 +3130,7 @@ static void Usr_WriteRowTchMainData (unsigned NumUsr,struct UsrData *UsrDat,bool
UsrDat->Accepted ? "DAT_SMALL_N" :
"DAT_SMALL",
BgColor);
ID_WriteUsrIDs (UsrDat,ID_ICanSeeTeacherID (UsrDat));
ID_WriteUsrIDs (UsrDat,ID_ICanSeeUsrID (UsrDat));
fprintf (Gbl.F.Out,"&nbsp;");
fprintf (Gbl.F.Out,"</td>");
@ -3183,7 +3183,7 @@ void Usr_WriteRowTchAllData (struct UsrData *UsrDat)
UsrDat->Accepted ? "DAT_SMALL_N" :
"DAT_SMALL",
Gbl.RowEvenOdd);
ID_WriteUsrIDs (UsrDat,ID_ICanSeeTeacherID (UsrDat));
ID_WriteUsrIDs (UsrDat,ID_ICanSeeUsrID (UsrDat));
fprintf (Gbl.F.Out,"&nbsp;</td>");
/***** Write rest of main teacher's data *****/