From 7bc74d7a36028d55b4951b30d042f74f010688be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Ca=C3=B1as=20Vargas?= Date: Mon, 5 Dec 2016 13:26:12 +0100 Subject: [PATCH] Version 16.87 --- swad_account.c | 2 +- swad_action.c | 27 +++--- swad_action.h | 221 ++++++++++++++++++++++++----------------------- swad_agenda.c | 41 ++++++--- swad_agenda.h | 2 + swad_changelog.h | 8 +- swad_connected.c | 4 +- swad_help.c | 6 +- swad_layout.c | 44 +++++++--- swad_mail.c | 2 +- swad_main.c | 1 - swad_parameter.c | 19 ++-- swad_user.c | 20 +++-- 13 files changed, 223 insertions(+), 174 deletions(-) diff --git a/swad_account.c b/swad_account.c index ee4c2a97..fc8ad7a4 100644 --- a/swad_account.c +++ b/swad_account.c @@ -299,7 +299,7 @@ static void Acc_WriteRowEmptyAccount (unsigned NumUsr,const char *ID,struct UsrD /***** Button to login with this account *****/ fprintf (Gbl.F.Out,"", Gbl.RowEvenOdd); - Act_FormStart (ActAutUsrNew); + Act_FormStart (ActLogInNew); Usr_PutParamUsrCodEncrypted (UsrDat->EncryptedUsrCod); Lay_PutCreateButtonInline (Txt_Its_me); Act_FormEnd (); diff --git a/swad_action.c b/swad_action.c index 67c1deee..64174c78 100644 --- a/swad_action.c +++ b/swad_action.c @@ -958,6 +958,7 @@ Users: NEW. ActFrmLogInUsrAgd Put form to log in to show another user's public agenda NEW. ActLogInUsrAgd Show another user's public agenda after log in + NEW. ActLogInUsrAgdLan Show another user's public agenda after change language NEW. ActSeeUsrAgd Show another user's public agenda 797. ActReqEnrSevStd Request the enrollment/removing of several users to / from current course @@ -1340,9 +1341,9 @@ Profile: 1149. ActSndNewPwd Send a new password via email 1150. ActLogOut Close session - 1151. ActAutUsrInt Authentify user internally (directly from the platform) - 1152. ActAutUsrNew Authentify user internally (directly from the platform, only if user has not password) - 1153. ActAutUsrChgLan Change language to my language just after authentication + 1151. ActLogIn Authentify user internally (directly from the platform) + 1152. ActLogInNew Authentify user internally (directly from the platform, only if user has not password) + 1153. ActLogInLan Change language to my language just after authentication 1154. ActAnnSee Mark announcement as seen 1155. ActChgMyRol Change type of logged user @@ -2370,6 +2371,7 @@ struct Act_Actions Act_Actions[Act_NUM_ACTIONS] = /* ActFrmLogInUsrAgd */{1614,-1,TabUnk,ActLstTch ,0x001,0x001,0x001,Act_CONT_NORM,Act_THIS_WINDOW,NULL ,Agd_PutFormLogInToShowUsrAgenda,NULL}, /* ActLogInUsrAgd */{1615,-1,TabUnk,ActLstTch ,0x1FC,0x1FC,0x1FC,Act_CONT_NORM,Act_THIS_WINDOW,NULL ,Agd_ShowUsrAgendaAfterLogIn ,NULL}, + /* ActLogInUsrAgdLan */{1616,-1,TabUnk,ActLstTch ,0x1FC,0x1FC,0x1FC,Act_CONT_NORM,Act_THIS_WINDOW,NULL ,Agd_ShowUsrAgendaAfterLogIn ,NULL}, /* ActSeeUsrAgd */{1611,-1,TabUnk,ActLstTch ,0x1FC,0x1FC,0x1FC,Act_CONT_NORM,Act_THIS_WINDOW,NULL ,Agd_ShowUsrAgenda ,NULL}, /* ActReqEnrSevStd */{1426,-1,TabUnk,ActLstStd ,0x1FE,0x1FE,0x1FE,Act_CONT_NORM,Act_THIS_WINDOW,NULL ,Enr_ReqAdminStds ,NULL}, @@ -2795,9 +2797,9 @@ struct Act_Actions Act_Actions[Act_NUM_ACTIONS] = /* ActSndNewPwd */{ 633,-1,TabUnk,ActFrmLogIn ,0x000,0x001,0x001,Act_CONT_NORM,Act_THIS_WINDOW,NULL ,Pwd_ChkIdLoginAndSendNewPwd ,NULL}, /* ActLogOut */{ 10,-1,TabUnk,ActFrmLogIn ,0x1FF,0x1FF,0x1FF,Act_CONT_NORM,Act_THIS_WINDOW,Ses_CloseSession ,Usr_Logout ,NULL}, - /* ActAutUsrInt */{ 6,-1,TabUnk,ActFrmRolSes ,0x1FF,0x1FF,0x1FF,Act_CONT_NORM,Act_THIS_WINDOW,NULL ,Usr_WelcomeUsr ,NULL}, - /* ActAutUsrNew */{1585,-1,TabUnk,ActFrmRolSes ,0x1FF,0x1FF,0x1FF,Act_CONT_NORM,Act_THIS_WINDOW,NULL ,Usr_WelcomeUsr ,NULL}, - /* ActAutUsrChgLan */{1077,-1,TabUnk,ActFrmRolSes ,0x1FE,0x1FE,0x1FE,Act_CONT_NORM,Act_THIS_WINDOW,NULL ,Usr_WelcomeUsr ,NULL}, + /* ActLogIn */{ 6,-1,TabUnk,ActFrmRolSes ,0x1FF,0x1FF,0x1FF,Act_CONT_NORM,Act_THIS_WINDOW,NULL ,Usr_WelcomeUsr ,NULL}, + /* ActLogInNew */{1585,-1,TabUnk,ActFrmRolSes ,0x1FF,0x1FF,0x1FF,Act_CONT_NORM,Act_THIS_WINDOW,NULL ,Usr_WelcomeUsr ,NULL}, + /* ActLogInLan */{1077,-1,TabUnk,ActFrmRolSes ,0x1FE,0x1FE,0x1FE,Act_CONT_NORM,Act_THIS_WINDOW,NULL ,Usr_WelcomeUsr ,NULL}, /* ActAnnSee */{1234,-1,TabUnk,ActFrmRolSes ,0x1FE,0x1FE,0x1FE,Act_CONT_NORM,Act_THIS_WINDOW,NULL ,Ann_MarkAnnouncementAsSeen ,NULL}, /* ActChgMyRol */{ 589,-1,TabUnk,ActFrmRolSes ,0x1FE,0x1FE,0x1FE,Act_CONT_NORM,Act_THIS_WINDOW,Rol_ChangeMyRole ,Usr_ShowFormsLogoutAndRole ,NULL}, @@ -2904,7 +2906,7 @@ Act_Action_t Act_FromActCodToAction[1+Act_MAX_ACTION_COD] = // Do not reuse uniq ActSeeRcvMsg, // #3 -1, // #4 (obsolete action) -1, // #5 (obsolete action) - ActAutUsrInt, // #6 + ActLogIn, // #6 -1, // #7 (obsolete action) -1, // #8 (obsolete action) ActSeeCrsLnk, // #9 @@ -3975,7 +3977,7 @@ Act_Action_t Act_FromActCodToAction[1+Act_MAX_ACTION_COD] = // Do not reuse uniq ActSeeLstStdAtt, // #1074 ActPrnLstStdAtt, // #1075 ActRecAttMe, // #1076 - ActAutUsrChgLan, // #1077 + ActLogInLan, // #1077 ActSeeDocCrs, // #1078 ActSeeMrkCrs, // #1079 ActReqSeeUsrTstRes, // #1080 @@ -4486,7 +4488,7 @@ Act_Action_t Act_FromActCodToAction[1+Act_MAX_ACTION_COD] = // Do not reuse uniq ActSeeMyUsgRep, // #1582 -1, // #1583 (obsolete action) ActChkUsrAcc, // #1584 - ActAutUsrNew, // #1585 + ActLogInNew, // #1585 ActReqMyUsgRep, // #1586 ActChgCrsDegCfg, // #1587 ActChgDegCtrCfg, // #1588 @@ -4517,6 +4519,7 @@ Act_Action_t Act_FromActCodToAction[1+Act_MAX_ACTION_COD] = // Do not reuse uniq ActShoEvtMyAgd, // #1613 ActFrmLogInUsrAgd, // #1614 ActLogInUsrAgd, // #1615 + ActLogInUsrAgdLan, // #1616 }; /*****************************************************************************/ @@ -4884,7 +4887,7 @@ void Act_AdjustCurrentAction (void) } /***** If my login password is not enough secure, the only action possible is show a form to change my password *****/ - if (Gbl.Action.Act == ActAutUsrInt) + if (Gbl.Action.Act == ActLogIn) if (!Pwd_FastCheckIfPasswordSeemsGood (Gbl.Usrs.Me.LoginPlainPassword)) { Gbl.Action.Act = ActFrmChgMyPwd; @@ -4978,8 +4981,8 @@ void Act_AdjustCurrentAction (void) case Rol_STUDENT: switch (Gbl.Action.Act) { - case ActAutUsrInt: - case ActAutUsrNew: + case ActLogIn: + case ActLogInNew: case ActHom: case ActMnu: case ActLogOut: diff --git a/swad_action.h b/swad_action.h index acf72261..4cb6d34d 100644 --- a/swad_action.h +++ b/swad_action.h @@ -55,9 +55,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+14+93+73+70+249+186+158+172+36+31+95) +#define Act_NUM_ACTIONS (1+9+51+14+93+73+70+249+186+159+172+36+31+95) -#define Act_MAX_ACTION_COD 1615 +#define Act_MAX_ACTION_COD 1616 #define Act_MAX_OPTIONS_IN_MENU_PER_TAB 11 @@ -974,127 +974,128 @@ typedef int Act_Action_t; // Must be a signed type, because -1 is used to indica #define ActFrmLogInUsrAgd (ActChgNumRowFooGrp+ 52) #define ActLogInUsrAgd (ActChgNumRowFooGrp+ 53) -#define ActSeeUsrAgd (ActChgNumRowFooGrp+ 54) +#define ActLogInUsrAgdLan (ActChgNumRowFooGrp+ 54) +#define ActSeeUsrAgd (ActChgNumRowFooGrp+ 55) -#define ActReqEnrSevStd (ActChgNumRowFooGrp+ 55) -#define ActReqEnrSevTch (ActChgNumRowFooGrp+ 56) +#define ActReqEnrSevStd (ActChgNumRowFooGrp+ 56) +#define ActReqEnrSevTch (ActChgNumRowFooGrp+ 57) -#define ActReqLstStdAtt (ActChgNumRowFooGrp+ 57) -#define ActSeeLstMyAtt (ActChgNumRowFooGrp+ 58) -#define ActPrnLstMyAtt (ActChgNumRowFooGrp+ 59) -#define ActSeeLstStdAtt (ActChgNumRowFooGrp+ 60) -#define ActPrnLstStdAtt (ActChgNumRowFooGrp+ 61) -#define ActFrmNewAtt (ActChgNumRowFooGrp+ 62) -#define ActEdiOneAtt (ActChgNumRowFooGrp+ 63) -#define ActNewAtt (ActChgNumRowFooGrp+ 64) -#define ActChgAtt (ActChgNumRowFooGrp+ 65) -#define ActReqRemAtt (ActChgNumRowFooGrp+ 66) -#define ActRemAtt (ActChgNumRowFooGrp+ 67) -#define ActHidAtt (ActChgNumRowFooGrp+ 68) -#define ActShoAtt (ActChgNumRowFooGrp+ 69) -#define ActSeeOneAtt (ActChgNumRowFooGrp+ 70) -#define ActRecAttStd (ActChgNumRowFooGrp+ 71) -#define ActRecAttMe (ActChgNumRowFooGrp+ 72) +#define ActReqLstStdAtt (ActChgNumRowFooGrp+ 58) +#define ActSeeLstMyAtt (ActChgNumRowFooGrp+ 59) +#define ActPrnLstMyAtt (ActChgNumRowFooGrp+ 60) +#define ActSeeLstStdAtt (ActChgNumRowFooGrp+ 61) +#define ActPrnLstStdAtt (ActChgNumRowFooGrp+ 62) +#define ActFrmNewAtt (ActChgNumRowFooGrp+ 63) +#define ActEdiOneAtt (ActChgNumRowFooGrp+ 64) +#define ActNewAtt (ActChgNumRowFooGrp+ 65) +#define ActChgAtt (ActChgNumRowFooGrp+ 66) +#define ActReqRemAtt (ActChgNumRowFooGrp+ 67) +#define ActRemAtt (ActChgNumRowFooGrp+ 68) +#define ActHidAtt (ActChgNumRowFooGrp+ 69) +#define ActShoAtt (ActChgNumRowFooGrp+ 70) +#define ActSeeOneAtt (ActChgNumRowFooGrp+ 71) +#define ActRecAttStd (ActChgNumRowFooGrp+ 72) +#define ActRecAttMe (ActChgNumRowFooGrp+ 73) -#define ActSignUp (ActChgNumRowFooGrp+ 73) -#define ActUpdSignUpReq (ActChgNumRowFooGrp+ 74) -#define ActReqRejSignUp (ActChgNumRowFooGrp+ 75) -#define ActRejSignUp (ActChgNumRowFooGrp+ 76) +#define ActSignUp (ActChgNumRowFooGrp+ 74) +#define ActUpdSignUpReq (ActChgNumRowFooGrp+ 75) +#define ActReqRejSignUp (ActChgNumRowFooGrp+ 76) +#define ActRejSignUp (ActChgNumRowFooGrp+ 77) -#define ActReqMdfOneOth (ActChgNumRowFooGrp+ 77) -#define ActReqMdfOneStd (ActChgNumRowFooGrp+ 78) -#define ActReqMdfOneTch (ActChgNumRowFooGrp+ 79) +#define ActReqMdfOneOth (ActChgNumRowFooGrp+ 78) +#define ActReqMdfOneStd (ActChgNumRowFooGrp+ 79) +#define ActReqMdfOneTch (ActChgNumRowFooGrp+ 80) -#define ActReqMdfOth (ActChgNumRowFooGrp+ 80) -#define ActReqMdfStd (ActChgNumRowFooGrp+ 81) -#define ActReqMdfTch (ActChgNumRowFooGrp+ 82) +#define ActReqMdfOth (ActChgNumRowFooGrp+ 81) +#define ActReqMdfStd (ActChgNumRowFooGrp+ 82) +#define ActReqMdfTch (ActChgNumRowFooGrp+ 83) -#define ActReqOthPho (ActChgNumRowFooGrp+ 83) -#define ActReqStdPho (ActChgNumRowFooGrp+ 84) -#define ActReqTchPho (ActChgNumRowFooGrp+ 85) -#define ActDetOthPho (ActChgNumRowFooGrp+ 86) -#define ActDetStdPho (ActChgNumRowFooGrp+ 87) -#define ActDetTchPho (ActChgNumRowFooGrp+ 88) -#define ActUpdOthPho (ActChgNumRowFooGrp+ 89) -#define ActUpdStdPho (ActChgNumRowFooGrp+ 90) -#define ActUpdTchPho (ActChgNumRowFooGrp+ 91) -#define ActReqRemOthPho (ActChgNumRowFooGrp+ 92) -#define ActReqRemStdPho (ActChgNumRowFooGrp+ 93) -#define ActReqRemTchPho (ActChgNumRowFooGrp+ 94) -#define ActRemOthPho (ActChgNumRowFooGrp+ 95) -#define ActRemStdPho (ActChgNumRowFooGrp+ 96) -#define ActRemTchPho (ActChgNumRowFooGrp+ 97) -#define ActCreOth (ActChgNumRowFooGrp+ 98) -#define ActCreStd (ActChgNumRowFooGrp+ 99) -#define ActCreTch (ActChgNumRowFooGrp+100) -#define ActUpdOth (ActChgNumRowFooGrp+101) -#define ActUpdStd (ActChgNumRowFooGrp+102) -#define ActUpdTch (ActChgNumRowFooGrp+103) +#define ActReqOthPho (ActChgNumRowFooGrp+ 84) +#define ActReqStdPho (ActChgNumRowFooGrp+ 85) +#define ActReqTchPho (ActChgNumRowFooGrp+ 86) +#define ActDetOthPho (ActChgNumRowFooGrp+ 87) +#define ActDetStdPho (ActChgNumRowFooGrp+ 88) +#define ActDetTchPho (ActChgNumRowFooGrp+ 89) +#define ActUpdOthPho (ActChgNumRowFooGrp+ 90) +#define ActUpdStdPho (ActChgNumRowFooGrp+ 91) +#define ActUpdTchPho (ActChgNumRowFooGrp+ 92) +#define ActReqRemOthPho (ActChgNumRowFooGrp+ 93) +#define ActReqRemStdPho (ActChgNumRowFooGrp+ 94) +#define ActReqRemTchPho (ActChgNumRowFooGrp+ 95) +#define ActRemOthPho (ActChgNumRowFooGrp+ 96) +#define ActRemStdPho (ActChgNumRowFooGrp+ 97) +#define ActRemTchPho (ActChgNumRowFooGrp+ 98) +#define ActCreOth (ActChgNumRowFooGrp+ 99) +#define ActCreStd (ActChgNumRowFooGrp+100) +#define ActCreTch (ActChgNumRowFooGrp+101) +#define ActUpdOth (ActChgNumRowFooGrp+102) +#define ActUpdStd (ActChgNumRowFooGrp+103) +#define ActUpdTch (ActChgNumRowFooGrp+104) -#define ActReqAccEnrStd (ActChgNumRowFooGrp+104) -#define ActReqAccEnrTch (ActChgNumRowFooGrp+105) -#define ActAccEnrStd (ActChgNumRowFooGrp+106) -#define ActAccEnrTch (ActChgNumRowFooGrp+107) -#define ActRemMe_Std (ActChgNumRowFooGrp+108) -#define ActRemMe_Tch (ActChgNumRowFooGrp+109) +#define ActReqAccEnrStd (ActChgNumRowFooGrp+105) +#define ActReqAccEnrTch (ActChgNumRowFooGrp+106) +#define ActAccEnrStd (ActChgNumRowFooGrp+107) +#define ActAccEnrTch (ActChgNumRowFooGrp+108) +#define ActRemMe_Std (ActChgNumRowFooGrp+109) +#define ActRemMe_Tch (ActChgNumRowFooGrp+110) -#define ActNewAdmIns (ActChgNumRowFooGrp+110) -#define ActRemAdmIns (ActChgNumRowFooGrp+111) -#define ActNewAdmCtr (ActChgNumRowFooGrp+112) -#define ActRemAdmCtr (ActChgNumRowFooGrp+113) -#define ActNewAdmDeg (ActChgNumRowFooGrp+114) -#define ActRemAdmDeg (ActChgNumRowFooGrp+115) +#define ActNewAdmIns (ActChgNumRowFooGrp+111) +#define ActRemAdmIns (ActChgNumRowFooGrp+112) +#define ActNewAdmCtr (ActChgNumRowFooGrp+113) +#define ActRemAdmCtr (ActChgNumRowFooGrp+114) +#define ActNewAdmDeg (ActChgNumRowFooGrp+115) +#define ActRemAdmDeg (ActChgNumRowFooGrp+116) -#define ActRcvFrmEnrSevStd (ActChgNumRowFooGrp+116) -#define ActRcvFrmEnrSevTch (ActChgNumRowFooGrp+117) +#define ActRcvFrmEnrSevStd (ActChgNumRowFooGrp+117) +#define ActRcvFrmEnrSevTch (ActChgNumRowFooGrp+118) -#define ActReqCnfID_Oth (ActChgNumRowFooGrp+118) -#define ActReqCnfID_Std (ActChgNumRowFooGrp+119) -#define ActReqCnfID_Tch (ActChgNumRowFooGrp+120) -#define ActCnfID_Oth (ActChgNumRowFooGrp+121) -#define ActCnfID_Std (ActChgNumRowFooGrp+122) -#define ActCnfID_Tch (ActChgNumRowFooGrp+123) +#define ActReqCnfID_Oth (ActChgNumRowFooGrp+119) +#define ActReqCnfID_Std (ActChgNumRowFooGrp+120) +#define ActReqCnfID_Tch (ActChgNumRowFooGrp+121) +#define ActCnfID_Oth (ActChgNumRowFooGrp+122) +#define ActCnfID_Std (ActChgNumRowFooGrp+123) +#define ActCnfID_Tch (ActChgNumRowFooGrp+124) -#define ActFrmIDsOth (ActChgNumRowFooGrp+124) -#define ActFrmIDsStd (ActChgNumRowFooGrp+125) -#define ActFrmIDsTch (ActChgNumRowFooGrp+126) -#define ActRemID_Oth (ActChgNumRowFooGrp+127) -#define ActRemID_Std (ActChgNumRowFooGrp+128) -#define ActRemID_Tch (ActChgNumRowFooGrp+129) -#define ActNewID_Oth (ActChgNumRowFooGrp+130) -#define ActNewID_Std (ActChgNumRowFooGrp+131) -#define ActNewID_Tch (ActChgNumRowFooGrp+132) -#define ActFrmPwdOth (ActChgNumRowFooGrp+133) -#define ActFrmPwdStd (ActChgNumRowFooGrp+134) -#define ActFrmPwdTch (ActChgNumRowFooGrp+135) -#define ActChgPwdOth (ActChgNumRowFooGrp+136) -#define ActChgPwdStd (ActChgNumRowFooGrp+137) -#define ActChgPwdTch (ActChgNumRowFooGrp+138) -#define ActFrmMaiOth (ActChgNumRowFooGrp+139) -#define ActFrmMaiStd (ActChgNumRowFooGrp+140) -#define ActFrmMaiTch (ActChgNumRowFooGrp+141) -#define ActRemMaiOth (ActChgNumRowFooGrp+142) -#define ActRemMaiStd (ActChgNumRowFooGrp+143) -#define ActRemMaiTch (ActChgNumRowFooGrp+144) -#define ActNewMaiOth (ActChgNumRowFooGrp+145) -#define ActNewMaiStd (ActChgNumRowFooGrp+146) -#define ActNewMaiTch (ActChgNumRowFooGrp+147) +#define ActFrmIDsOth (ActChgNumRowFooGrp+125) +#define ActFrmIDsStd (ActChgNumRowFooGrp+126) +#define ActFrmIDsTch (ActChgNumRowFooGrp+127) +#define ActRemID_Oth (ActChgNumRowFooGrp+128) +#define ActRemID_Std (ActChgNumRowFooGrp+129) +#define ActRemID_Tch (ActChgNumRowFooGrp+130) +#define ActNewID_Oth (ActChgNumRowFooGrp+131) +#define ActNewID_Std (ActChgNumRowFooGrp+132) +#define ActNewID_Tch (ActChgNumRowFooGrp+133) +#define ActFrmPwdOth (ActChgNumRowFooGrp+134) +#define ActFrmPwdStd (ActChgNumRowFooGrp+135) +#define ActFrmPwdTch (ActChgNumRowFooGrp+136) +#define ActChgPwdOth (ActChgNumRowFooGrp+137) +#define ActChgPwdStd (ActChgNumRowFooGrp+138) +#define ActChgPwdTch (ActChgNumRowFooGrp+139) +#define ActFrmMaiOth (ActChgNumRowFooGrp+140) +#define ActFrmMaiStd (ActChgNumRowFooGrp+141) +#define ActFrmMaiTch (ActChgNumRowFooGrp+142) +#define ActRemMaiOth (ActChgNumRowFooGrp+143) +#define ActRemMaiStd (ActChgNumRowFooGrp+144) +#define ActRemMaiTch (ActChgNumRowFooGrp+145) +#define ActNewMaiOth (ActChgNumRowFooGrp+146) +#define ActNewMaiStd (ActChgNumRowFooGrp+147) +#define ActNewMaiTch (ActChgNumRowFooGrp+148) -#define ActRemStdCrs (ActChgNumRowFooGrp+148) -#define ActRemTchCrs (ActChgNumRowFooGrp+149) -#define ActRemUsrGbl (ActChgNumRowFooGrp+150) +#define ActRemStdCrs (ActChgNumRowFooGrp+149) +#define ActRemTchCrs (ActChgNumRowFooGrp+150) +#define ActRemUsrGbl (ActChgNumRowFooGrp+151) -#define ActReqRemAllStdCrs (ActChgNumRowFooGrp+151) -#define ActRemAllStdCrs (ActChgNumRowFooGrp+152) +#define ActReqRemAllStdCrs (ActChgNumRowFooGrp+152) +#define ActRemAllStdCrs (ActChgNumRowFooGrp+153) -#define ActReqRemOldUsr (ActChgNumRowFooGrp+153) -#define ActRemOldUsr (ActChgNumRowFooGrp+154) +#define ActReqRemOldUsr (ActChgNumRowFooGrp+154) +#define ActRemOldUsr (ActChgNumRowFooGrp+155) -#define ActLstDupUsr (ActChgNumRowFooGrp+155) -#define ActLstSimUsr (ActChgNumRowFooGrp+156) -#define ActRemDupUsr (ActChgNumRowFooGrp+157) +#define ActLstDupUsr (ActChgNumRowFooGrp+156) +#define ActLstSimUsr (ActChgNumRowFooGrp+157) +#define ActRemDupUsr (ActChgNumRowFooGrp+158) -#define ActLstClk (ActChgNumRowFooGrp+158) +#define ActLstClk (ActChgNumRowFooGrp+159) /*****************************************************************************/ /******************************** Social tab *********************************/ @@ -1379,9 +1380,9 @@ typedef int Act_Action_t; // Must be a signed type, because -1 is used to indica #define ActReqSndNewPwd (ActSeeMyUsgRep+10) #define ActSndNewPwd (ActSeeMyUsgRep+11) #define ActLogOut (ActSeeMyUsgRep+12) -#define ActAutUsrInt (ActSeeMyUsgRep+13) -#define ActAutUsrNew (ActSeeMyUsgRep+14) -#define ActAutUsrChgLan (ActSeeMyUsgRep+15) +#define ActLogIn (ActSeeMyUsgRep+13) +#define ActLogInNew (ActSeeMyUsgRep+14) +#define ActLogInLan (ActSeeMyUsgRep+15) #define ActAnnSee (ActSeeMyUsgRep+16) #define ActChgMyRol (ActSeeMyUsgRep+17) #define ActFrmNewEvtMyAgd (ActSeeMyUsgRep+18) diff --git a/swad_agenda.c b/swad_agenda.c index 3be0f280..a2ffac33 100644 --- a/swad_agenda.c +++ b/swad_agenda.c @@ -100,13 +100,16 @@ static void Agd_UpdateEvent (struct AgendaEvent *AgdEvent,const char *Txt); void Agd_PutFormLogInToShowUsrAgenda (void) { - /***** Get encrypted user code from user code *****/ - Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat); - /***** Form to log in *****/ - /* Put the form to log in always, even if user does not exist, - to not give clues about whether a user exists or not */ - Usr_WriteFormLogin (ActLogInUsrAgd,Usr_PutParamOtherUsrCodEncrypted); + Usr_WriteFormLogin (ActLogInUsrAgd,Agd_PutParamAgd); + } + +void Agd_PutParamAgd (void) + { + char Nickname[Nck_MAX_BYTES_NICKNAME_WITH_ARROBA+1]; + + sprintf (Nickname,"@%s",Gbl.Usrs.Other.UsrDat.Nickname); + Par_PutHiddenParamString ("agd",Nickname); } /*****************************************************************************/ @@ -115,15 +118,27 @@ void Agd_PutFormLogInToShowUsrAgenda (void) void Agd_ShowUsrAgendaAfterLogIn (void) { + extern const unsigned Txt_Current_CGI_SWAD_Language; extern const char *Txt_User_not_found_or_you_do_not_have_permission_; + extern const char *Txt_Switching_to_LANGUAGE[1+Txt_NUM_LANGUAGES]; - /***** Get user *****/ - /* User code is already got */ - if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat)) // Existing user - /***** Show all the visible events in the user's agenda *****/ - Agd_ShowEvents (Agd_USR_AGENDA); - else - Lay_ShowAlert (Lay_WARNING,Txt_User_not_found_or_you_do_not_have_permission_); + if (Gbl.Usrs.Me.Logged) + { + if (Gbl.Usrs.Me.UsrDat.Prefs.Language == Txt_Current_CGI_SWAD_Language) + { + /***** Get user *****/ + /* If nickname is correct, user code is already got from nickname */ + if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat)) // Existing user + /***** Show all the visible events in the user's agenda *****/ + Agd_ShowEvents (Agd_USR_AGENDA); + else + Lay_ShowAlert (Lay_WARNING,Txt_User_not_found_or_you_do_not_have_permission_); + } + else + /* The current language is not my preferred language + ==> change automatically to my language */ + Lay_ShowAlert (Lay_INFO,Txt_Switching_to_LANGUAGE[Gbl.Usrs.Me.UsrDat.Prefs.Language]); + } } /*****************************************************************************/ diff --git a/swad_agenda.h b/swad_agenda.h index 09391470..d00e4ebe 100644 --- a/swad_agenda.h +++ b/swad_agenda.h @@ -75,6 +75,8 @@ typedef enum /*****************************************************************************/ void Agd_PutFormLogInToShowUsrAgenda (void); +void Agd_PutParamAgd (void); + void Agd_ShowUsrAgendaAfterLogIn (void); void Agd_ShowUsrAgenda (void); void Agd_ShowMyAgenda (void); diff --git a/swad_changelog.h b/swad_changelog.h index 2f27a609..d7425f37 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -179,19 +179,21 @@ // TODO: When teacher sees "No hay estudiantes", put a button to add students // TODO: When admin sees "No hay profesores", put a button to add teachers -// TODO: Al entrar sin identificar a ver una agenda, por ejemplo, https://localhost/swad/pt?agd=@rms, el idioma cambia ¿? - /*****************************************************************************/ /****************************** Public constants *****************************/ /*****************************************************************************/ -#define Log_PLATFORM_VERSION "SWAD 16.86.11 (2016-12-05)" +#define Log_PLATFORM_VERSION "SWAD 16.87 (2016-12-05)" #define CSS_FILE "swad16.86.5.css" #define JS_FILE "swad16.84.2.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.87: Dec 05, 2016 Change language after log in to view another user's public agenda. (209952 lines) + 1 change necessary in database: +INSERT INTO actions (ActCod,Language,Obsolete,Txt) VALUES ('1616','es','N','Cambiar idioma para ver agenda otro usuario'); + Version 16.86.11: Dec 05, 2016 Link to QR in user's agenda. (209908 lines) Version 16.86.10: Dec 05, 2016 Code refactoring related to user's QR (nickname). (209904 lines) Version 16.86.9: Dec 05, 2016 Link to QR in user's agenda. Not finished. (209889 lines) diff --git a/swad_connected.c b/swad_connected.c index 100136ae..be66045f 100644 --- a/swad_connected.c +++ b/swad_connected.c @@ -264,8 +264,8 @@ void Con_GetAndShowLastClicks (void) /* Use a special color for this row depending on the action */ ClassRow = (Act_Actions[Act_FromActCodToAction[ActCod]].BrowserWindow == Act_DOWNLD_FILE) ? "DAT_SMALL_YELLOW LEFT_MIDDLE" : - (ActCod == Act_Actions[ActAutUsrInt].ActCod || - ActCod == Act_Actions[ActAutUsrNew].ActCod) ? "DAT_SMALL_GREEN" : + (ActCod == Act_Actions[ActLogIn].ActCod || + ActCod == Act_Actions[ActLogInNew].ActCod) ? "DAT_SMALL_GREEN" : (ActCod == Act_Actions[ActLogOut].ActCod ) ? "DAT_SMALL_RED" : (ActCod == Act_Actions[ActWebSvc].ActCod ) ? "DAT_SMALL_BLUE" : "DAT_SMALL_GREY"; diff --git a/swad_help.c b/swad_help.c index 5d21b480..8ef675a0 100644 --- a/swad_help.c +++ b/swad_help.c @@ -334,9 +334,9 @@ void Hlp_ShowHelpWhatWouldYouLikeToDo (void) { if (Gbl.Usrs.Me.IBelongToCurrentCrs) // I belong to this course { - if (Gbl.Action.Act != ActAutUsrInt && - Gbl.Action.Act != ActAutUsrNew && - Gbl.Action.Act != ActAutUsrChgLan) // I am not just logged + if (Gbl.Action.Act != ActLogIn && + Gbl.Action.Act != ActLogInNew && + Gbl.Action.Act != ActLogInLan) // I am not just logged { /* Request my removing from this course */ sprintf (Gbl.Title,Txt_Remove_me_from_the_course_X, diff --git a/swad_layout.c b/swad_layout.c index f41bb645..a781c812 100644 --- a/swad_layout.c +++ b/swad_layout.c @@ -79,7 +79,9 @@ static void Lay_WriteEndOfPage (void); static void Lay_WritePageTitle (void); -static void Lay_WriteRedirectionToMyLanguage (void); +static void Lay_WriteRedirToMyLangOnLogIn (void); +static void Lay_WriteRedirToMyLangOnViewUsrAgd (void); + static void Lay_WriteScripts (void); static void Lay_WriteScriptInit (void); static void Lay_WriteScriptParamsAJAX (void); @@ -220,11 +222,15 @@ void Lay_WriteStartOfPage (void) Cfg_URL_SWAD_PUBLIC); /* Redirect to correct language */ - if ((Gbl.Action.Act == ActAutUsrInt || - Gbl.Action.Act == ActAutUsrNew) && // Action is log in - Gbl.Usrs.Me.Logged && // I am just logged + if (Gbl.Usrs.Me.Logged && // I am logged Gbl.Usrs.Me.UsrDat.Prefs.Language != Txt_Current_CGI_SWAD_Language) // My language != current language - Lay_WriteRedirectionToMyLanguage (); + { + if (Gbl.Action.Act == ActLogIn || // Regular log in + Gbl.Action.Act == ActLogInNew) // Log in when checking account + Lay_WriteRedirToMyLangOnLogIn (); + else if (Gbl.Action.Act == ActLogInUsrAgd) // Log in to view another user's public agenda + Lay_WriteRedirToMyLangOnViewUsrAgd (); + } /* Write initial scripts depending on the action */ Lay_WriteScripts (); @@ -321,9 +327,9 @@ void Lay_WriteStartOfPage (void) Gbl.Layout.HTMLStartWritten = true; /* Write new year greeting */ - if (Gbl.Action.Act == ActAutUsrInt || - Gbl.Action.Act == ActAutUsrNew || - Gbl.Action.Act == ActAutUsrChgLan) + if (Gbl.Action.Act == ActLogIn || + Gbl.Action.Act == ActLogInNew || + Gbl.Action.Act == ActLogInLan) if (Gbl.Now.Date.Month == 1 && Gbl.Now.Date.Day == 1) { @@ -395,7 +401,7 @@ static void Lay_WritePageTitle (void) /************* Write script and meta to redirect to my language **************/ /*****************************************************************************/ -static void Lay_WriteRedirectionToMyLanguage (void) +static void Lay_WriteRedirToMyLangOnLogIn (void) { extern struct Act_Actions Act_Actions[Act_NUM_ACTIONS]; extern const char *Txt_STR_LANG_ID[1+Txt_NUM_LANGUAGES]; @@ -404,10 +410,24 @@ static void Lay_WriteRedirectionToMyLanguage (void) " content=\"0; url='%s/%s?act=%ld&ses=%s'\">", Cfg_URL_SWAD_CGI, Txt_STR_LANG_ID[Gbl.Usrs.Me.UsrDat.Prefs.Language], - Act_Actions[ActAutUsrChgLan].ActCod, + Act_Actions[ActLogInLan].ActCod, Gbl.Session.Id); } +static void Lay_WriteRedirToMyLangOnViewUsrAgd (void) + { + extern struct Act_Actions Act_Actions[Act_NUM_ACTIONS]; + extern const char *Txt_STR_LANG_ID[1+Txt_NUM_LANGUAGES]; + + fprintf (Gbl.F.Out,"", + Cfg_URL_SWAD_CGI, + Txt_STR_LANG_ID[Gbl.Usrs.Me.UsrDat.Prefs.Language], + Act_Actions[ActLogInUsrAgdLan].ActCod, + Gbl.Session.Id, + Gbl.Usrs.Other.UsrDat.Nickname); + } + /*****************************************************************************/ /************ Write some scripts depending on the current action *************/ /*****************************************************************************/ @@ -984,8 +1004,8 @@ static void Lay_ShowRightColumn (void) /***** SWADroid advertisement *****/ if (!Gbl.Usrs.Me.Logged || - Gbl.Action.Act == ActAutUsrInt || - Gbl.Action.Act == ActAutUsrNew) + Gbl.Action.Act == ActLogIn || + Gbl.Action.Act == ActLogInNew) fprintf (Gbl.F.Out,"
" "" diff --git a/swad_mail.c b/swad_mail.c index 0aeb15f3..0ab17e46 100644 --- a/swad_mail.c +++ b/swad_mail.c @@ -1732,7 +1732,7 @@ void Mai_ConfirmEmail (void) Lay_ShowAlert (Lay_WARNING,Txt_Failed_email_confirmation_key); /***** Form to log in *****/ - Usr_WriteFormLogin (ActAutUsrInt,NULL); + Usr_WriteFormLogin (ActLogIn,NULL); } /*****************************************************************************/ diff --git a/swad_main.c b/swad_main.c index f5048cd9..762bf019 100644 --- a/swad_main.c +++ b/swad_main.c @@ -115,7 +115,6 @@ int main (int argc, char *argv[]) Par_CreateListOfParams (); Par_GetMainParameters (); Hie_InitHierarchy (); - if (!Gbl.WebService.IsWebService) { /***** Create file for HTML output *****/ diff --git a/swad_parameter.c b/swad_parameter.c index 374f76a0..2f7e9192 100644 --- a/swad_parameter.c +++ b/swad_parameter.c @@ -32,7 +32,7 @@ #include "swad_action.h" #include "swad_config.h" - +#include "swad_database.h" // TODO: REMOVE !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! #include "swad_global.h" #include "swad_parameter.h" #include "swad_password.h" @@ -677,10 +677,14 @@ void Par_GetMainParameters (void) { if (Nickname[0]) { + /* Set another user's nickname */ + Str_RemoveLeadingArrobas (Nickname); + strcpy (Gbl.Usrs.Other.UsrDat.Nickname,Nickname); // without arroba + // This user's code is used to go to public profile // and to refresh old publishings in user's timeline // If user does not exist ==> UsrCod = -1 - Gbl.Usrs.Other.UsrDat.UsrCod = Nck_GetUsrCodFromNickname (Nickname); + Gbl.Usrs.Other.UsrDat.UsrCod = Nck_GetUsrCodFromNickname (Gbl.Usrs.Other.UsrDat.Nickname); Gbl.Action.Act = ActSeePubPrf; // Set default action if no other is specified } } @@ -688,9 +692,13 @@ void Par_GetMainParameters (void) { if (Nickname[0]) { + /* Set another user's nickname */ + Str_RemoveLeadingArrobas (Nickname); + strcpy (Gbl.Usrs.Other.UsrDat.Nickname,Nickname); // without arroba + // This user's code is used to go to public agenda // If user does not exist ==> UsrCod = -1 - Gbl.Usrs.Other.UsrDat.UsrCod = Nck_GetUsrCodFromNickname (Nickname); + Gbl.Usrs.Other.UsrDat.UsrCod = Nck_GetUsrCodFromNickname (Gbl.Usrs.Other.UsrDat.Nickname); Gbl.Action.Act = ActFrmLogInUsrAgd; // Set default action if no other is specified } } @@ -720,9 +728,6 @@ void Par_GetMainParameters (void) Gbl.Action.Act == ActRefOldSocPubGbl || Gbl.Action.Act == ActRefOldSocPubUsr) Gbl.Action.UsesAJAX = true; - else if (Gbl.Action.Act == ActLogInUsrAgd) - // It's necessary to do this here when log in to view user's agenda fails - Usr_GetParamOtherUsrCodEncrypted (&Gbl.Usrs.Other.UsrDat); /***** Get session identifier, if exists *****/ Par_GetParToText ("ses",Gbl.Session.Id,Ses_LENGTH_SESSION_ID); @@ -757,7 +762,7 @@ void Par_GetMainParameters (void) /***** Get user password and login *****/ switch (Gbl.Action.Act) { - case ActAutUsrInt: + case ActLogIn: case ActFrmLogInUsrAgd: case ActLogInUsrAgd: // This action is necessary here when log in fails Pwd_GetParamUsrPwdLogin (); diff --git a/swad_user.c b/swad_user.c index db72efda..dcbdc8e5 100644 --- a/swad_user.c +++ b/swad_user.c @@ -1683,7 +1683,7 @@ bool Usr_ChkIfEncryptedUsrCodExists (const char *EncryptedUsrCod) void Usr_WriteLandingPage (void) { /***** Form to log in *****/ - Usr_WriteFormLogin (ActAutUsrInt,NULL); + Usr_WriteFormLogin (ActLogIn,NULL); /***** Form to go to request the creation of a new account *****/ Acc_ShowFormGoToRequestNewAccount (); @@ -1714,7 +1714,7 @@ void Usr_Logout (void) Lay_ShowAlert (Lay_INFO,Txt_The_session_has_been_closed); /***** Form to log in *****/ - Usr_WriteFormLogin (ActAutUsrInt,NULL); + Usr_WriteFormLogin (ActLogIn,NULL); /***** Advertisement about mobile app *****/ Lay_AdvertisementMobile (); @@ -1872,7 +1872,9 @@ void Usr_WelcomeUsr (void) /***** Show the global announcements I have not seen *****/ Ann_ShowMyAnnouncementsNotMarkedAsSeen (); } - else // The current language is not my preferred language ==> change automatically to my language + else + /* The current language is not my preferred language + ==> change automatically to my language */ Lay_ShowAlert (Lay_INFO,Txt_Switching_to_LANGUAGE[Gbl.Usrs.Me.UsrDat.Prefs.Language]); } } @@ -2210,7 +2212,7 @@ void Usr_ChkUsrAndGetUsrData (void) } FormLogin = { false, - ActAutUsrInt, + ActLogIn, NULL }; Act_Action_t Action; @@ -2268,7 +2270,7 @@ void Usr_ChkUsrAndGetUsrData (void) else FormLogin.PutForm = true; } - else if (Gbl.Action.Act == ActAutUsrInt || + else if (Gbl.Action.Act == ActLogIn || Gbl.Action.Act == ActLogInUsrAgd) // Login using @nickname, email or ID from form { if (Usr_ChkUsrAndGetUsrDataFromDirectLogin ()) // User logged in @@ -2287,11 +2289,11 @@ void Usr_ChkUsrAndGetUsrData (void) if (Gbl.Action.Act == ActLogInUsrAgd) { FormLogin.Action = ActLogInUsrAgd; - FormLogin.FuncParams = Usr_PutParamOtherUsrCodEncrypted; + FormLogin.FuncParams = Agd_PutParamAgd; } } } - else if (Gbl.Action.Act == ActAutUsrNew) // Empty account without password, login using encrypted user's code + else if (Gbl.Action.Act == ActLogInNew) // Empty account without password, login using encrypted user's code { /***** Get user's data *****/ Usr_GetParamOtherUsrCodEncrypted (&Gbl.Usrs.Me.UsrDat); @@ -2588,8 +2590,8 @@ static void Usr_SetUsrRoleAndPrefs (void) /***** Get my last data *****/ Usr_GetMyLastData (); - if (Gbl.Action.Act == ActAutUsrInt || - Gbl.Action.Act == ActAutUsrNew) // If I just logged in... + if (Gbl.Action.Act == ActLogIn || + Gbl.Action.Act == ActLogInNew) // If I just logged in... { /***** WhatToSearch is stored in session, but in login it is got from user's last data *****/