diff --git a/swad_action.c b/swad_action.c index d40c0244..91e38107 100644 --- a/swad_action.c +++ b/swad_action.c @@ -917,6 +917,7 @@ Users: 763. ActRecAttMe Save my comments as student in an attendance event 764. ActSignUp Apply for my enrollment +New! 700. ActUpdSignUpReq Update pending requests for inscription in the current course 765. ActReqRejSignUp Ask if reject the enrollment of a user in a course 766. ActRejSignUp Reject the enrollment of a user in a course @@ -2238,6 +2239,7 @@ struct Act_Actions Act_Actions[Act_NUM_ACTIONS] = /* ActRecAttMe */{1076,-1,TabUsr,ActSeeAtt ,0x008,0x000,0x000,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Att_RegisterMeAsStdInAttEvent ,NULL}, /* ActSignUp */{1056,-1,TabUsr,ActReqSignUp ,0x000,0x006,0x000,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Enr_SignUpInCrs ,NULL}, + /* ActUpdSignUpReq */{1522,-1,TabUsr,ActSeeSignUpReq ,0x1F0,0x1F0,0x1F0,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Enr_UpdateEnrollmentRequests ,NULL}, /* ActReqRejSignUp */{1058,-1,TabUsr,ActSeeSignUpReq ,0x1F0,0x1F0,0x1F0,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Enr_AskIfRejectSignUp ,NULL}, /* ActRejSignUp */{1059,-1,TabUsr,ActSeeSignUpReq ,0x1F0,0x1F0,0x1F0,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Enr_RejectSignUp ,NULL}, @@ -4235,6 +4237,7 @@ Act_Action_t Act_FromActCodToAction[1+Act_MAX_ACTION_COD] = // Do not reuse uniq ActUnfSocComUsr, // #1519 ActSeeSocPrf, // #1520 ActFrmLogIn, // #1521 + ActUpdSignUpReq, // #1522 }; /*****************************************************************************/ diff --git a/swad_action.h b/swad_action.h index 8f7e36cd..60eb6d8c 100644 --- a/swad_action.h +++ b/swad_action.h @@ -71,9 +71,9 @@ typedef enum typedef int Act_Action_t; // Must be a signed type, because -1 is used to indicate obsolete action -#define Act_NUM_ACTIONS (1+9+51+15+90+70+67+205+183+143+172+36+27+83) +#define Act_NUM_ACTIONS (1+9+51+15+90+70+67+205+183+144+172+36+27+83) -#define Act_MAX_ACTION_COD 1521 +#define Act_MAX_ACTION_COD 1522 #define Act_MAX_OPTIONS_IN_MENU_PER_TAB 20 @@ -951,89 +951,90 @@ typedef int Act_Action_t; // Must be a signed type, because -1 is used to indica #define ActRecAttMe (ActChgNumRowFooGrp+ 70) #define ActSignUp (ActChgNumRowFooGrp+ 71) -#define ActReqRejSignUp (ActChgNumRowFooGrp+ 72) -#define ActRejSignUp (ActChgNumRowFooGrp+ 73) +#define ActUpdSignUpReq (ActChgNumRowFooGrp+ 72) +#define ActReqRejSignUp (ActChgNumRowFooGrp+ 73) +#define ActRejSignUp (ActChgNumRowFooGrp+ 74) -#define ActReqMdfOneOth (ActChgNumRowFooGrp+ 74) -#define ActReqMdfOneStd (ActChgNumRowFooGrp+ 75) -#define ActReqMdfOneTch (ActChgNumRowFooGrp+ 76) +#define ActReqMdfOneOth (ActChgNumRowFooGrp+ 75) +#define ActReqMdfOneStd (ActChgNumRowFooGrp+ 76) +#define ActReqMdfOneTch (ActChgNumRowFooGrp+ 77) -#define ActReqMdfOth (ActChgNumRowFooGrp+ 77) -#define ActReqMdfStd (ActChgNumRowFooGrp+ 78) -#define ActReqMdfTch (ActChgNumRowFooGrp+ 79) +#define ActReqMdfOth (ActChgNumRowFooGrp+ 78) +#define ActReqMdfStd (ActChgNumRowFooGrp+ 79) +#define ActReqMdfTch (ActChgNumRowFooGrp+ 80) -#define ActReqOthPho (ActChgNumRowFooGrp+ 80) -#define ActReqStdPho (ActChgNumRowFooGrp+ 81) -#define ActReqTchPho (ActChgNumRowFooGrp+ 82) -#define ActDetOthPho (ActChgNumRowFooGrp+ 83) -#define ActDetStdPho (ActChgNumRowFooGrp+ 84) -#define ActDetTchPho (ActChgNumRowFooGrp+ 85) -#define ActUpdOthPho (ActChgNumRowFooGrp+ 86) -#define ActUpdStdPho (ActChgNumRowFooGrp+ 87) -#define ActUpdTchPho (ActChgNumRowFooGrp+ 88) -#define ActRemOthPho (ActChgNumRowFooGrp+ 89) -#define ActRemStdPho (ActChgNumRowFooGrp+ 90) -#define ActRemTchPho (ActChgNumRowFooGrp+ 91) -#define ActCreOth (ActChgNumRowFooGrp+ 92) -#define ActCreStd (ActChgNumRowFooGrp+ 93) -#define ActCreTch (ActChgNumRowFooGrp+ 94) -#define ActUpdOth (ActChgNumRowFooGrp+ 95) -#define ActUpdStd (ActChgNumRowFooGrp+ 96) -#define ActUpdTch (ActChgNumRowFooGrp+ 97) +#define ActReqOthPho (ActChgNumRowFooGrp+ 81) +#define ActReqStdPho (ActChgNumRowFooGrp+ 82) +#define ActReqTchPho (ActChgNumRowFooGrp+ 83) +#define ActDetOthPho (ActChgNumRowFooGrp+ 84) +#define ActDetStdPho (ActChgNumRowFooGrp+ 85) +#define ActDetTchPho (ActChgNumRowFooGrp+ 86) +#define ActUpdOthPho (ActChgNumRowFooGrp+ 87) +#define ActUpdStdPho (ActChgNumRowFooGrp+ 88) +#define ActUpdTchPho (ActChgNumRowFooGrp+ 89) +#define ActRemOthPho (ActChgNumRowFooGrp+ 90) +#define ActRemStdPho (ActChgNumRowFooGrp+ 91) +#define ActRemTchPho (ActChgNumRowFooGrp+ 92) +#define ActCreOth (ActChgNumRowFooGrp+ 93) +#define ActCreStd (ActChgNumRowFooGrp+ 94) +#define ActCreTch (ActChgNumRowFooGrp+ 95) +#define ActUpdOth (ActChgNumRowFooGrp+ 96) +#define ActUpdStd (ActChgNumRowFooGrp+ 97) +#define ActUpdTch (ActChgNumRowFooGrp+ 98) -#define ActReqAccEnrStd (ActChgNumRowFooGrp+ 98) -#define ActReqAccEnrTch (ActChgNumRowFooGrp+ 99) -#define ActAccEnrStd (ActChgNumRowFooGrp+100) -#define ActAccEnrTch (ActChgNumRowFooGrp+101) -#define ActRemMe_Std (ActChgNumRowFooGrp+102) -#define ActRemMe_Tch (ActChgNumRowFooGrp+103) +#define ActReqAccEnrStd (ActChgNumRowFooGrp+ 99) +#define ActReqAccEnrTch (ActChgNumRowFooGrp+100) +#define ActAccEnrStd (ActChgNumRowFooGrp+101) +#define ActAccEnrTch (ActChgNumRowFooGrp+102) +#define ActRemMe_Std (ActChgNumRowFooGrp+103) +#define ActRemMe_Tch (ActChgNumRowFooGrp+104) -#define ActNewAdmIns (ActChgNumRowFooGrp+104) -#define ActRemAdmIns (ActChgNumRowFooGrp+105) -#define ActNewAdmCtr (ActChgNumRowFooGrp+106) -#define ActRemAdmCtr (ActChgNumRowFooGrp+107) -#define ActNewAdmDeg (ActChgNumRowFooGrp+108) -#define ActRemAdmDeg (ActChgNumRowFooGrp+109) +#define ActNewAdmIns (ActChgNumRowFooGrp+105) +#define ActRemAdmIns (ActChgNumRowFooGrp+106) +#define ActNewAdmCtr (ActChgNumRowFooGrp+107) +#define ActRemAdmCtr (ActChgNumRowFooGrp+108) +#define ActNewAdmDeg (ActChgNumRowFooGrp+109) +#define ActRemAdmDeg (ActChgNumRowFooGrp+110) -#define ActRcvFrmEnrSevStd (ActChgNumRowFooGrp+110) -#define ActRcvFrmEnrSevTch (ActChgNumRowFooGrp+111) +#define ActRcvFrmEnrSevStd (ActChgNumRowFooGrp+111) +#define ActRcvFrmEnrSevTch (ActChgNumRowFooGrp+112) -#define ActFrmIDsOth (ActChgNumRowFooGrp+112) -#define ActFrmIDsStd (ActChgNumRowFooGrp+113) -#define ActFrmIDsTch (ActChgNumRowFooGrp+114) -#define ActRemID_Oth (ActChgNumRowFooGrp+115) -#define ActRemID_Std (ActChgNumRowFooGrp+116) -#define ActRemID_Tch (ActChgNumRowFooGrp+117) -#define ActNewID_Oth (ActChgNumRowFooGrp+118) -#define ActNewID_Std (ActChgNumRowFooGrp+119) -#define ActNewID_Tch (ActChgNumRowFooGrp+120) -#define ActFrmPwdOth (ActChgNumRowFooGrp+121) -#define ActFrmPwdStd (ActChgNumRowFooGrp+122) -#define ActFrmPwdTch (ActChgNumRowFooGrp+123) -#define ActChgPwdOth (ActChgNumRowFooGrp+124) -#define ActChgPwdStd (ActChgNumRowFooGrp+125) -#define ActChgPwdTch (ActChgNumRowFooGrp+126) -#define ActFrmMaiOth (ActChgNumRowFooGrp+127) -#define ActFrmMaiStd (ActChgNumRowFooGrp+128) -#define ActFrmMaiTch (ActChgNumRowFooGrp+129) -#define ActRemMaiOth (ActChgNumRowFooGrp+130) -#define ActRemMaiStd (ActChgNumRowFooGrp+131) -#define ActRemMaiTch (ActChgNumRowFooGrp+132) -#define ActNewMaiOth (ActChgNumRowFooGrp+133) -#define ActNewMaiStd (ActChgNumRowFooGrp+134) -#define ActNewMaiTch (ActChgNumRowFooGrp+135) +#define ActFrmIDsOth (ActChgNumRowFooGrp+113) +#define ActFrmIDsStd (ActChgNumRowFooGrp+114) +#define ActFrmIDsTch (ActChgNumRowFooGrp+115) +#define ActRemID_Oth (ActChgNumRowFooGrp+116) +#define ActRemID_Std (ActChgNumRowFooGrp+117) +#define ActRemID_Tch (ActChgNumRowFooGrp+118) +#define ActNewID_Oth (ActChgNumRowFooGrp+119) +#define ActNewID_Std (ActChgNumRowFooGrp+120) +#define ActNewID_Tch (ActChgNumRowFooGrp+121) +#define ActFrmPwdOth (ActChgNumRowFooGrp+122) +#define ActFrmPwdStd (ActChgNumRowFooGrp+123) +#define ActFrmPwdTch (ActChgNumRowFooGrp+124) +#define ActChgPwdOth (ActChgNumRowFooGrp+125) +#define ActChgPwdStd (ActChgNumRowFooGrp+126) +#define ActChgPwdTch (ActChgNumRowFooGrp+127) +#define ActFrmMaiOth (ActChgNumRowFooGrp+128) +#define ActFrmMaiStd (ActChgNumRowFooGrp+129) +#define ActFrmMaiTch (ActChgNumRowFooGrp+130) +#define ActRemMaiOth (ActChgNumRowFooGrp+131) +#define ActRemMaiStd (ActChgNumRowFooGrp+132) +#define ActRemMaiTch (ActChgNumRowFooGrp+133) +#define ActNewMaiOth (ActChgNumRowFooGrp+134) +#define ActNewMaiStd (ActChgNumRowFooGrp+135) +#define ActNewMaiTch (ActChgNumRowFooGrp+136) -#define ActRemStdCrs (ActChgNumRowFooGrp+136) -#define ActRemTchCrs (ActChgNumRowFooGrp+137) -#define ActRemUsrGbl (ActChgNumRowFooGrp+138) +#define ActRemStdCrs (ActChgNumRowFooGrp+137) +#define ActRemTchCrs (ActChgNumRowFooGrp+138) +#define ActRemUsrGbl (ActChgNumRowFooGrp+139) -#define ActReqRemAllStdCrs (ActChgNumRowFooGrp+139) -#define ActRemAllStdCrs (ActChgNumRowFooGrp+140) +#define ActReqRemAllStdCrs (ActChgNumRowFooGrp+140) +#define ActRemAllStdCrs (ActChgNumRowFooGrp+141) -#define ActReqRemOldUsr (ActChgNumRowFooGrp+141) -#define ActRemOldUsr (ActChgNumRowFooGrp+142) +#define ActReqRemOldUsr (ActChgNumRowFooGrp+142) +#define ActRemOldUsr (ActChgNumRowFooGrp+143) -#define ActLstClk (ActChgNumRowFooGrp+143) +#define ActLstClk (ActChgNumRowFooGrp+144) /*****************************************************************************/ /******************************** Social tab *********************************/ diff --git a/swad_announcement.c b/swad_announcement.c index 5129a1de..f295cbe2 100644 --- a/swad_announcement.c +++ b/swad_announcement.c @@ -481,7 +481,8 @@ void Ann_ShowFormAnnouncement (void) 1 << Rol_UNKNOWN | 1 << Rol__GUEST_ | 1 << Rol_STUDENT | - 1 << Rol_TEACHER); + 1 << Rol_TEACHER, + false); fprintf (Gbl.F.Out,"" ""); diff --git a/swad_changelog.h b/swad_changelog.h index 70467f41..532bf78d 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -137,13 +137,17 @@ /****************************** Public constants *****************************/ /*****************************************************************************/ -#define Log_PLATFORM_VERSION "SWAD 15.160.4 (2016-03-24)" +#define Log_PLATFORM_VERSION "SWAD 15.161 (2016-03-24)" #define CSS_FILE "swad15.160.2.css" #define JS_FILE "swad15.131.3.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.161: Mar 24, 2016 Changes related to enrollments requests. (196581 lines) + 1 change necessary in database: +INSERT INTO actions (ActCod,Language,Obsolete,Txt) VALUES ('1522','es','N','Actualizar inscripciones pendientes'); + Version 15.160.4: Mar 24, 2016 Put contextual icon "update" integrated in frame in "Connected users". (196543 lines) Version 15.160.3: Mar 24, 2016 Put contextual icon "update" integrated in frame in "Who to follow". (196538 lines) Version 15.160.2: Mar 22, 2016 Changes in layout of tagline. (196512 lines) diff --git a/swad_enrollment.c b/swad_enrollment.c index efbd8452..389d6f06 100644 --- a/swad_enrollment.c +++ b/swad_enrollment.c @@ -102,6 +102,8 @@ static void Enr_MarkOfficialStdsAsRemovable (long ImpGrpCod,bool RemoveSpecified static void Enr_PutLinkToRemAllStdsThisCrs (void); +static void Enr_ShowEnrollmentRequestsGivenRoles (unsigned RolesSelected); + static void Enr_RemoveEnrollmentRequest (long CrsCod,long UsrCod); static void Enr_ReqRegRemUsr (Rol_Role_t Role); @@ -2152,6 +2154,46 @@ void Enr_RejectSignUp (void) /*****************************************************************************/ void Enr_ShowEnrollmentRequests (void) + { + /***** Show enrollment request (default roles depend on my logged role) *****/ + switch (Gbl.Usrs.Me.LoggedRole) + { + case Rol_TEACHER: + Enr_ShowEnrollmentRequestsGivenRoles ((1 << Rol_STUDENT) | + (1 << Rol_TEACHER)); + break; + case Rol_DEG_ADM: + case Rol_CTR_ADM: + case Rol_INS_ADM: + case Rol_SYS_ADM: + Enr_ShowEnrollmentRequestsGivenRoles (1 << Rol_TEACHER); + break; + default: + Lay_ShowErrorAndExit ("You don't have permission to list requesters."); + break; + } + } + +/*****************************************************************************/ +/******* Update pending requests for enrollment in the current course ********/ +/*****************************************************************************/ + +void Enr_UpdateEnrollmentRequests (void) + { + unsigned RolesSelected; + + /***** Get selected roles *****/ + Rol_GetSelectedRoles (&RolesSelected); + + /***** Update enrollment requests *****/ + Enr_ShowEnrollmentRequestsGivenRoles (RolesSelected); + } + +/*****************************************************************************/ +/************* Show pending requests for enrollment given roles **************/ +/*****************************************************************************/ + +static void Enr_ShowEnrollmentRequestsGivenRoles (unsigned RolesSelected) { extern const char *The_ClassForm[The_NUM_THEMES]; extern const char *The_ClassFormBold[The_NUM_THEMES]; @@ -2169,7 +2211,6 @@ void Enr_ShowEnrollmentRequests (void) extern const char *Txt_Register; extern const char *Txt_Reject; extern const char *Txt_No_enrollment_requests; - unsigned RolesSelected; char Query[1024]; MYSQL_RES *mysql_res; MYSQL_ROW row; @@ -2190,7 +2231,7 @@ void Enr_ShowEnrollmentRequests (void) /***** Selection of scope and roles *****/ /* Start form */ - Act_FormStart (ActSeeSignUpReq); + Act_FormStart (ActUpdSignUpReq); fprintf (Gbl.F.Out,""); /* Scope (whole platform, current centre, current degree or current course) */ @@ -2209,7 +2250,7 @@ void Enr_ShowEnrollmentRequests (void) 1 << Sco_SCOPE_CRS; Gbl.Scope.Default = Sco_SCOPE_CRS; Sco_GetScope (); - Sco_PutSelectorScope (false); + Sco_PutSelectorScope (true); fprintf (Gbl.F.Out,"" ""); @@ -2221,28 +2262,10 @@ void Enr_ShowEnrollmentRequests (void) "" "" "
", The_ClassForm[Gbl.Prefs.Theme], Txt_Users); - Rol_GetSelectedRoles (&RolesSelected); - if (!RolesSelected) - /* Set default roles */ - switch (Gbl.Usrs.Me.LoggedRole) - { - case Rol_TEACHER: - RolesSelected = (1 << Rol_STUDENT) | - (1 << Rol_TEACHER); - break; - case Rol_DEG_ADM: - case Rol_CTR_ADM: - case Rol_INS_ADM: - case Rol_SYS_ADM: - RolesSelected = (1 << Rol_TEACHER); - break; - default: - Lay_ShowErrorAndExit ("You don't have permission to list requesters."); - break; - } Rol_WriteSelectorRoles (1 << Rol_STUDENT | 1 << Rol_TEACHER, - RolesSelected); + RolesSelected, + true); fprintf (Gbl.F.Out,"
"); diff --git a/swad_enrollment.h b/swad_enrollment.h index bb962ac1..440d166d 100644 --- a/swad_enrollment.h +++ b/swad_enrollment.h @@ -111,6 +111,7 @@ void Enr_GetNotifEnrollmentRequest (char *SummaryStr,char **ContentStr, void Enr_AskIfRejectSignUp (void); void Enr_RejectSignUp (void); void Enr_ShowEnrollmentRequests (void); +void Enr_UpdateEnrollmentRequests (void); void Enr_PutLinkToAdminOneUsr (Act_Action_t NextAction); diff --git a/swad_role.c b/swad_role.c index acb380c9..d688a817 100644 --- a/swad_role.c +++ b/swad_role.c @@ -342,8 +342,8 @@ void Rol_ChangeMyRole (void) /********************* Write selector of users' roles ************************/ /*****************************************************************************/ -void Rol_WriteSelectorRoles (unsigned RolesAllowed, - unsigned RolesSelected) +void Rol_WriteSelectorRoles (unsigned RolesAllowed,unsigned RolesSelected, + bool SendOnChange) { extern const char *Txt_ROLES_PLURAL_abc[Rol_NUM_ROLES][Usr_NUM_SEXS]; Rol_Role_t Role; @@ -355,13 +355,29 @@ void Rol_WriteSelectorRoles (unsigned RolesAllowed, { fprintf (Gbl.F.Out,"%s
", Txt_ROLES_PLURAL_abc[Role][Usr_SEX_UNKNOWN]); } } +/*****************************************************************************/ +/******************** Put hidden param with users' roles *********************/ +/*****************************************************************************/ + +void Rol_PutHiddenParamRoles (unsigned Role) + { + fprintf (Gbl.F.Out,"", + Role); + } + /*****************************************************************************/ /************************* Get selected users' roles *************************/ /*****************************************************************************/ diff --git a/swad_role.h b/swad_role.h index 06178623..879f6b02 100644 --- a/swad_role.h +++ b/swad_role.h @@ -78,8 +78,9 @@ unsigned Rol_ConvertUnsignedStrToRoles (const char *UnsignedStr); void Rol_PutFormToChangeMyRole (bool FormInHead); void Rol_ChangeMyRole (void); -void Rol_WriteSelectorRoles (unsigned RolesAllowed, - unsigned RolesSelected); +void Rol_WriteSelectorRoles (unsigned RolesAllowed,unsigned RolesSelected, + bool SendOnChange); +void Rol_PutHiddenParamRoles (unsigned Role); void Rol_GetSelectedRoles (unsigned *Roles); Rol_Role_t Rol_GetRequestedRole (long UsrCod); diff --git a/swad_survey.c b/swad_survey.c index 891e00b1..d79d4d75 100644 --- a/swad_survey.c +++ b/swad_survey.c @@ -1604,7 +1604,8 @@ void Svy_RequestCreatOrEditSvy (void) Txt_Users); Rol_WriteSelectorRoles (1 << Rol_STUDENT | 1 << Rol_TEACHER, - Svy.Roles); + Svy.Roles, + false); fprintf (Gbl.F.Out,"" "");