diff --git a/swad_changelog.h b/swad_changelog.h index 226c20013..d3dd72f09 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -453,11 +453,12 @@ En OpenSWAD: ps2pdf source.ps destination.pdf */ -#define Log_PLATFORM_VERSION "SWAD 18.72.1 (2019-03-11)" +#define Log_PLATFORM_VERSION "SWAD 18.72.2 (2019-03-11)" #define CSS_FILE "swad18.68.3.css" #define JS_FILE "swad18.64.js" /* - Version 18.72.1: Mar 11, 2019 Show attendance list from list of students. (239075 lines) + Version 18.72.2: Mar 11, 2019 Create new message from list of users. (239114 lines) + Version 18.72.1: Mar 11, 2019 Show attendance list from list of users. (239075 lines) Version 18.72: Mar 11, 2019 Show homework from list of students and teachers. (239043 lines) Version 18.71: Mar 11, 2019 Listing of users now allow to do several actions. Not finished. (238920 lines) 3 changes necessary in database: diff --git a/swad_user.c b/swad_user.c index 3fb051082..5c5aead5f 100644 --- a/swad_user.c +++ b/swad_user.c @@ -240,6 +240,7 @@ static bool Usr_PutActionsSeveralUsrs (Rol_Role_t UsrsRole); static void Usr_PutActionShowRecords (void); static void Usr_PutActionShowHomework (void); static void Usr_PutActionShowAttendance (void); +static void Usr_PutActionNewMessage (void); static void Usr_PutActionFollowUsers (void); static void Usr_StartListUsrsAction (Usr_ListUsrsAction_t ListUsrsAction); static void Usr_EndListUsrsAction (void); @@ -7952,6 +7953,7 @@ void Usr_SeeTeachers (void) /* Start form */ Frm_StartForm (ActDoActOnSevTch); + Grp_PutParamsCodGrps (); /* Start table */ Tbl_StartTableWide (0); @@ -8023,6 +8025,7 @@ static bool Usr_PutActionsSeveralUsrs (Rol_Role_t UsrsRole) bool ICanViewRecords; bool ICanViewHomework; bool ICanViewAttendance; + bool ICanSendMessage; bool ICanFollow; bool OptionsShown = false; @@ -8036,10 +8039,12 @@ static bool Usr_PutActionsSeveralUsrs (Rol_Role_t UsrsRole) ICanViewHomework = ICanViewAttendance = + ICanSendMessage = ICanFollow = false; break; case Rol_STD: ICanViewRecords = + ICanSendMessage = ICanFollow = (Gbl.Scope.Current == Sco_SCOPE_CRS && (Gbl.Usrs.Me.IBelongToCurrentCrs || Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM)); @@ -8051,6 +8056,7 @@ static bool Usr_PutActionsSeveralUsrs (Rol_Role_t UsrsRole) break; case Rol_TCH: ICanViewRecords = + ICanSendMessage = ICanFollow = (Gbl.Scope.Current == Sco_SCOPE_CRS); ICanViewHomework = (Gbl.Usrs.Me.Role.Logged == Rol_NET || @@ -8063,6 +8069,7 @@ static bool Usr_PutActionsSeveralUsrs (Rol_Role_t UsrsRole) ICanViewRecords = ICanViewHomework = ICanViewAttendance = + ICanSendMessage = ICanFollow = false; break; } @@ -8092,6 +8099,13 @@ static bool Usr_PutActionsSeveralUsrs (Rol_Role_t UsrsRole) OptionsShown = true; } + /***** New message *****/ + if (ICanSendMessage) + { // I can write and send a new message to users + Usr_PutActionNewMessage (); + OptionsShown = true; + } + /***** Follow *****/ if (ICanFollow) { // I can follow users @@ -8144,6 +8158,19 @@ static void Usr_PutActionShowAttendance (void) Usr_EndListUsrsAction (); } +/*****************************************************************************/ +/*************** Put action to write a new message to users ******************/ +/*****************************************************************************/ + +static void Usr_PutActionNewMessage (void) + { + extern const char *Txt_Send_message; + + Usr_StartListUsrsAction (Usr_NEW_MESSAGE); + fprintf (Gbl.F.Out,"%s",Txt_Send_message); + Usr_EndListUsrsAction (); + } + /*****************************************************************************/ /*********************** Put action to follow users **************************/ /*****************************************************************************/ @@ -8255,6 +8282,20 @@ void Usr_DoActionOnSeveralUsrs1 (void) break; } break; + case Usr_NEW_MESSAGE: + switch (Gbl.Action.Act) + { + case ActDoActOnSevStd: + case ActDoActOnSevTch: + Gbl.Action.Act = ActReqMsgUsr; + Tab_SetCurrentTab (); + break; + default: + Ale_CreateAlert (Ale_ERROR,NULL, + "Wrong action."); + break; + } + break; case Usr_FOLLOW_USERS: Ale_CreateAlert (Ale_WARNING,NULL, "Not implemented."); diff --git a/swad_user.h b/swad_user.h index 6a597d9d8..23d00506a 100644 --- a/swad_user.h +++ b/swad_user.h @@ -115,14 +115,15 @@ typedef enum } Usr_ShowUsrsType_t; #define Usr_SHOW_USRS_TYPE_DEFAULT Usr_LIST_AS_CLASS_PHOTO -#define Usr_LIST_USRS_NUM_ACTIONS 5 +#define Usr_LIST_USRS_NUM_ACTIONS 6 typedef enum { Usr_LIST_USRS_UNKNOWN_ACTION = 0, Usr_SHOW_RECORDS = 1, Usr_VIEW_HOMEWORK = 2, Usr_SHOW_ATTENDANCE = 3, - Usr_FOLLOW_USERS = 4, + Usr_NEW_MESSAGE = 4, + Usr_FOLLOW_USERS = 5, } Usr_ListUsrsAction_t; #define Usr_LIST_USRS_DEFAULT_ACTION Usr_SHOW_RECORDS