diff --git a/swad_ID.c b/swad_ID.c index 476ba2a3..b51ac0a7 100644 --- a/swad_ID.c +++ b/swad_ID.c @@ -75,7 +75,7 @@ static void ID_PutLinkToConfirmID (struct UsrData *UsrDat,unsigned NumID, const char *Anchor); static void ID_ShowFormChangeUsrID (const struct UsrData *UsrDat, - bool ItsMe,bool IShouldFillID); + bool ItsMe,bool IShouldFillInID); static void ID_RemoveUsrID (const struct UsrData *UsrDat,bool ItsMe); static bool ID_CheckIfConfirmed (long UsrCod,const char *UsrID); @@ -511,7 +511,7 @@ static void ID_PutLinkToConfirmID (struct UsrData *UsrDat,unsigned NumID, /*********************** Show form to change my user's ID ********************/ /*****************************************************************************/ -void ID_ShowFormChangeMyID (bool IShouldFillID) +void ID_ShowFormChangeMyID (bool IShouldFillInID) { extern const char *Hlp_PROFILE_Account; extern const char *Txt_ID; @@ -530,7 +530,7 @@ void ID_ShowFormChangeMyID (bool IShouldFillID) /***** Show form to change ID *****/ ID_ShowFormChangeUsrID (&Gbl.Usrs.Me.UsrDat, true, // ItsMe - IShouldFillID); + IShouldFillInID); /***** End box *****/ Box_EndBox (); @@ -562,7 +562,7 @@ void ID_ShowFormChangeOtherUsrID (void) /***** Show form to change ID *****/ ID_ShowFormChangeUsrID (&Gbl.Usrs.Other.UsrDat, false, // ItsMe - false); // IShouldFillID + false); // IShouldFillInID /***** End box *****/ Box_EndBox (); @@ -576,7 +576,7 @@ void ID_ShowFormChangeOtherUsrID (void) /*****************************************************************************/ static void ID_ShowFormChangeUsrID (const struct UsrData *UsrDat, - bool ItsMe,bool IShouldFillID) + bool ItsMe,bool IShouldFillInID) { extern const char *Hlp_PROFILE_Account; extern const char *The_ClassForm[The_NUM_THEMES]; @@ -595,7 +595,7 @@ static void ID_ShowFormChangeUsrID (const struct UsrData *UsrDat, Ale_ShowAlert (Gbl.Alert.Type,Gbl.Alert.Txt); /***** Help message *****/ - if (IShouldFillID) + if (IShouldFillInID) Ale_ShowAlert (Ale_WARNING,Txt_Please_fill_in_your_ID); /***** Start table *****/ @@ -627,7 +627,7 @@ static void ID_ShowFormChangeUsrID (const struct UsrData *UsrDat, { /* Form to remove user's ID */ if (ItsMe) - Frm_StartFormAnchor (ActRemID_Me,ID_ID_SECTION_ID); + Frm_StartFormAnchor (ActRemMyID,ID_ID_SECTION_ID); else { switch (UsrDat->Roles.InCurrentCrs.Role) @@ -690,7 +690,7 @@ static void ID_ShowFormChangeUsrID (const struct UsrData *UsrDat, UsrDat->IDs.Num ? Txt_Another_ID : // A new user's ID Txt_ID); // The first user's ID if (ItsMe) - Frm_StartFormAnchor (ActNewIDMe,ID_ID_SECTION_ID); + Frm_StartFormAnchor (ActChgMyID,ID_ID_SECTION_ID); else { switch (UsrDat->Roles.InCurrentCrs.Role) diff --git a/swad_ID.h b/swad_ID.h index 7f2cc1d8..7735a91d 100644 --- a/swad_ID.h +++ b/swad_ID.h @@ -72,7 +72,7 @@ bool ID_CheckIfUsrIDSeemsAValidID (const char *UsrID); void ID_WriteUsrIDs (struct UsrData *UsrDat,const char *Anchor); bool ID_ICanSeeOtherUsrIDs (const struct UsrData *UsrDat); -void ID_ShowFormChangeMyID (bool IShouldFillID); +void ID_ShowFormChangeMyID (bool IShouldFillInID); void ID_ShowFormChangeOtherUsrID (void); void ID_RemoveMyUsrID (void); diff --git a/swad_account.c b/swad_account.c index de389594..082ae604 100644 --- a/swad_account.c +++ b/swad_account.c @@ -25,6 +25,8 @@ /*********************************** Headers *********************************/ /*****************************************************************************/ +#define _GNU_SOURCE // For asprintf +#include // For asprintf #include // For string functions #include "swad_account.h" @@ -182,6 +184,7 @@ void Acc_CheckIfEmptyAccountExists (void) struct UsrData UsrDat; MYSQL_RES *mysql_res; MYSQL_ROW row; + char *Txt; /***** Links to other actions *****/ fprintf (Gbl.F.Out,"
"); @@ -244,10 +247,11 @@ void Acc_CheckIfEmptyAccountExists (void) } else { - snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), - Txt_There_is_no_empty_account_associated_with_your_ID_X, - ID); - Ale_ShowAlert (Ale_INFO,Gbl.Alert.Txt); + if (asprintf (&Txt,Txt_There_is_no_empty_account_associated_with_your_ID_X, + ID) < 0) + Lay_NotEnoughMemoryExit (); + Ale_ShowAlert (Ale_INFO,Txt); + free ((void *) Txt); } /***** Free structure that stores the query result *****/ @@ -431,13 +435,12 @@ void Acc_ShowFormChgMyAccount (void) { extern const char *Txt_Before_going_to_any_other_option_you_must_create_your_password; extern const char *Txt_Before_going_to_any_other_option_you_must_fill_your_nickname; - extern const char *Txt_Please_fill_in_your_email_address; - bool IMustFillPassword = (Gbl.Usrs.Me.UsrDat.Password[0] == '\0'); - bool IMustFillNickname = (Gbl.Usrs.Me.UsrDat.Nickname[0] == '\0'); - bool IMustFillEmail = (Gbl.Usrs.Me.UsrDat.Email[0] == '\0'); - bool IShouldConfirmEmail = (!Gbl.Usrs.Me.UsrDat.EmailConfirmed && // Email not yet confirmed - !Gbl.Usrs.Me.ConfirmEmailJustSent); // Do not ask for email confirmation when confirmation email is just sent - bool IShouldFillID = (Gbl.Usrs.Me.UsrDat.IDs.Num == 0); + extern const char *Txt_Before_going_to_any_other_option_you_must_fill_in_your_email_address; + bool IMustCreateMyPasswordNow = false; + bool IMustCreateMyNicknameNow = false; + bool IMustFillInMyEmailNow = false; + bool IShouldConfirmMyEmailNow = false; + bool IShouldFillInMyIDNow = false; /***** Get current user's nickname and email address It's necessary because current nickname or email could be just updated *****/ @@ -445,29 +448,44 @@ void Acc_ShowFormChgMyAccount (void) Mai_GetEmailFromUsrCod (&Gbl.Usrs.Me.UsrDat); /***** Check nickname, email and ID *****/ - if (IMustFillPassword) + IMustCreateMyPasswordNow = (Gbl.Usrs.Me.UsrDat.Password[0] == '\0'); + if (IMustCreateMyPasswordNow) Ale_ShowAlert (Ale_WARNING, Txt_Before_going_to_any_other_option_you_must_create_your_password); - if (IMustFillNickname) - Ale_ShowAlert (Ale_WARNING, - Txt_Before_going_to_any_other_option_you_must_fill_your_nickname); - if (IMustFillEmail) - Ale_ShowAlert (Ale_WARNING, - Txt_Please_fill_in_your_email_address); + else + { + IMustCreateMyNicknameNow = (Gbl.Usrs.Me.UsrDat.Nickname[0] == '\0'); + if (IMustCreateMyNicknameNow) + Ale_ShowAlert (Ale_WARNING, + Txt_Before_going_to_any_other_option_you_must_fill_your_nickname); + else + { + IMustFillInMyEmailNow = (Gbl.Usrs.Me.UsrDat.Email[0] == '\0'); + if (IMustFillInMyEmailNow) + Ale_ShowAlert (Ale_WARNING, + Txt_Before_going_to_any_other_option_you_must_fill_in_your_email_address); + else + { + IShouldConfirmMyEmailNow = (!Gbl.Usrs.Me.UsrDat.EmailConfirmed && // Email not yet confirmed + !Gbl.Usrs.Me.ConfirmEmailJustSent); // Do not ask for email confirmation when confirmation email is just sent + IShouldFillInMyIDNow = (Gbl.Usrs.Me.UsrDat.IDs.Num == 0); + } + } + } /***** Start container for this user *****/ fprintf (Gbl.F.Out,"
"); - /***** Show form to change my nickname and my email *****/ + /***** Show form to change my password *****/ fprintf (Gbl.F.Out,"
"); - Nck_ShowFormChangeMyNickname (IMustFillNickname); - Mai_ShowFormChangeMyEmail (IMustFillEmail,IShouldConfirmEmail); + Pwd_ShowFormChgMyPwd (); fprintf (Gbl.F.Out,"
"); - /***** Show form to change my ID and my password *****/ + /***** Show form to change my nickname, my email and my ID *****/ fprintf (Gbl.F.Out,"
"); - ID_ShowFormChangeMyID (IShouldFillID); - Pwd_ShowFormChgMyPwd (); + Nck_ShowFormChangeMyNickname (IMustCreateMyNicknameNow); + Mai_ShowFormChangeMyEmail (IMustFillInMyEmailNow,IShouldConfirmMyEmailNow); + ID_ShowFormChangeMyID (IShouldFillInMyIDNow); fprintf (Gbl.F.Out,"
"); /***** Start container for this user *****/ @@ -609,6 +627,7 @@ static bool Acc_GetParamsNewAccount (char NewNicknameWithoutArroba[Nck_MAX_BYTES extern const char *Txt_The_email_address_entered_X_is_not_valid; char NewNicknameWithArroba[Nck_MAX_BYTES_NICKNAME_FROM_FORM + 1]; char NewPlainPassword[Pwd_MAX_BYTES_PLAIN_PASSWORD + 1]; + char *Txt; bool Error = false; /***** Step 1/3: Get new nickname from form *****/ @@ -636,21 +655,23 @@ static bool Acc_GetParamsNewAccount (char NewNicknameWithoutArroba[Nck_MAX_BYTES Gbl.Usrs.Me.UsrDat.UsrCod)) // A nickname of another user is the same that this nickname { Error = true; - snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), - Txt_The_nickname_X_had_been_registered_by_another_user, - NewNicknameWithoutArroba); - Ale_ShowAlert (Ale_WARNING,Gbl.Alert.Txt); + if (asprintf (&Txt,Txt_The_nickname_X_had_been_registered_by_another_user, + NewNicknameWithoutArroba) < 0) + Lay_NotEnoughMemoryExit (); + Ale_ShowAlert (Ale_WARNING,Txt); + free ((void *) Txt); } } else // New nickname is not valid { Error = true; - snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), - Txt_The_nickname_entered_X_is_not_valid_, - NewNicknameWithArroba, - Nck_MIN_CHARS_NICKNAME_WITHOUT_ARROBA, - Nck_MAX_CHARS_NICKNAME_WITHOUT_ARROBA); - Ale_ShowAlert (Ale_WARNING,Gbl.Alert.Txt); + if (asprintf (&Txt,Txt_The_nickname_entered_X_is_not_valid_, + NewNicknameWithArroba, + Nck_MIN_CHARS_NICKNAME_WITHOUT_ARROBA, + Nck_MAX_CHARS_NICKNAME_WITHOUT_ARROBA) < 0) + Lay_NotEnoughMemoryExit (); + Ale_ShowAlert (Ale_WARNING,Txt); + free ((void *) Txt); } /***** Step 2/3: Get new email from form *****/ @@ -666,19 +687,21 @@ static bool Acc_GetParamsNewAccount (char NewNicknameWithoutArroba[Nck_MAX_BYTES NewEmail)) // An email of another user is the same that my email { Error = true; - snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), - Txt_The_email_address_X_had_been_registered_by_another_user, - NewEmail); - Ale_ShowAlert (Ale_WARNING,Gbl.Alert.Txt); + if (asprintf (&Txt,Txt_The_email_address_X_had_been_registered_by_another_user, + NewEmail) < 0) + Lay_NotEnoughMemoryExit (); + Ale_ShowAlert (Ale_WARNING,Txt); + free ((void *) Txt); } } else // New email is not valid { Error = true; - snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), - Txt_The_email_address_entered_X_is_not_valid, - NewEmail); - Ale_ShowAlert (Ale_WARNING,Gbl.Alert.Txt); + if (asprintf (&Txt,Txt_The_email_address_entered_X_is_not_valid, + NewEmail) < 0) + Lay_NotEnoughMemoryExit (); + Ale_ShowAlert (Ale_WARNING,Txt); + free ((void *) Txt); } /***** Step 3/3: Get new password from form *****/ @@ -687,7 +710,7 @@ static bool Acc_GetParamsNewAccount (char NewNicknameWithoutArroba[Nck_MAX_BYTES if (!Pwd_SlowCheckIfPasswordIsGood (NewPlainPassword,NewEncryptedPassword,-1L)) // New password is good? { Error = true; - Ale_ShowAlert (Ale_WARNING,Gbl.Alert.Txt); // Error message is set in Usr_SlowCheckIfPasswordIsGood + Ale_ShowAlert (Ale_WARNING,Gbl.AlertToShowLater.Txt); // Error message is set in Pwd_SlowCheckIfPasswordIsGood } return !Error; @@ -828,15 +851,17 @@ static void Acc_CreateNewEncryptedUsrCod (struct UsrData *UsrDat) void Acc_AfterCreationNewAccount (void) { extern const char *Txt_Congratulations_You_have_created_your_account_X_Now_Y_will_request_you_; + char *Txt; if (Gbl.Usrs.Me.Logged) // If account has been created without problem, I am logged { /***** Show message of success *****/ - snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), - Txt_Congratulations_You_have_created_your_account_X_Now_Y_will_request_you_, - Gbl.Usrs.Me.UsrDat.Nickname, - Cfg_PLATFORM_SHORT_NAME); - Ale_ShowAlert (Ale_SUCCESS,Gbl.Alert.Txt); + if (asprintf (&Txt,Txt_Congratulations_You_have_created_your_account_X_Now_Y_will_request_you_, + Gbl.Usrs.Me.UsrDat.Nickname, + Cfg_PLATFORM_SHORT_NAME) < 0) + Lay_NotEnoughMemoryExit (); + Ale_ShowAlert (Ale_SUCCESS,Txt); + free ((void *) Txt); /***** Show form with account data *****/ Acc_ShowFormChgMyAccount (); @@ -1002,6 +1027,7 @@ void Acc_CompletelyEliminateAccount (struct UsrData *UsrDat, extern const char *Txt_Briefcase_of_THE_USER_X_has_been_removed; extern const char *Txt_Photo_of_THE_USER_X_has_been_removed; extern const char *Txt_Record_card_of_THE_USER_X_has_been_removed; + char *Txt; bool PhotoRemoved = false; /***** Remove the works zones of the user in all courses *****/ @@ -1034,10 +1060,11 @@ void Acc_CompletelyEliminateAccount (struct UsrData *UsrDat, if (QuietOrVerbose == Cns_VERBOSE) { - snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), - Txt_THE_USER_X_has_been_removed_from_all_his_her_courses, - UsrDat->FullName); - Ale_ShowAlert (Ale_SUCCESS,Gbl.Alert.Txt); + if (asprintf (&Txt,Txt_THE_USER_X_has_been_removed_from_all_his_her_courses, + UsrDat->FullName) < 0) + Lay_NotEnoughMemoryExit (); + Ale_ShowAlert (Ale_SUCCESS,Txt); + free ((void *) Txt); } /***** Remove user as administrator of any degree *****/ @@ -1047,10 +1074,11 @@ void Acc_CompletelyEliminateAccount (struct UsrData *UsrDat, if (QuietOrVerbose == Cns_VERBOSE) { - snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), - Txt_THE_USER_X_has_been_removed_as_administrator, - UsrDat->FullName); - Ale_ShowAlert (Ale_SUCCESS,Gbl.Alert.Txt); + if (asprintf (&Txt,Txt_THE_USER_X_has_been_removed_as_administrator, + UsrDat->FullName) < 0) + Lay_NotEnoughMemoryExit (); + Ale_ShowAlert (Ale_SUCCESS,Txt); + free ((void *) Txt); } /***** Remove user's clipboard in forums *****/ @@ -1063,10 +1091,11 @@ void Acc_CompletelyEliminateAccount (struct UsrData *UsrDat, Acc_RemoveUsrBriefcase (UsrDat); if (QuietOrVerbose == Cns_VERBOSE) { - snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), - Txt_Briefcase_of_THE_USER_X_has_been_removed, - UsrDat->FullName); - Ale_ShowAlert (Ale_SUCCESS,Gbl.Alert.Txt); + if (asprintf (&Txt,Txt_Briefcase_of_THE_USER_X_has_been_removed, + UsrDat->FullName) < 0) + Lay_NotEnoughMemoryExit (); + Ale_ShowAlert (Ale_SUCCESS,Txt); + free ((void *) Txt); } /***** Remove test results made by user in all courses *****/ @@ -1080,10 +1109,11 @@ void Acc_CompletelyEliminateAccount (struct UsrData *UsrDat, Msg_DelAllRecAndSntMsgsUsr (UsrDat->UsrCod); if (QuietOrVerbose == Cns_VERBOSE) { - snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), - Txt_Messages_of_THE_USER_X_have_been_deleted, - UsrDat->FullName); - Ale_ShowAlert (Ale_SUCCESS,Gbl.Alert.Txt); + if (asprintf (&Txt,Txt_Messages_of_THE_USER_X_have_been_deleted, + UsrDat->FullName) < 0) + Lay_NotEnoughMemoryExit (); + Ale_ShowAlert (Ale_SUCCESS,Txt); + free ((void *) Txt); } /***** Remove user from tables of banned users *****/ @@ -1128,20 +1158,22 @@ void Acc_CompletelyEliminateAccount (struct UsrData *UsrDat, PhotoRemoved = Pho_RemovePhoto (UsrDat); if (PhotoRemoved && QuietOrVerbose == Cns_VERBOSE) { - snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), - Txt_Photo_of_THE_USER_X_has_been_removed, - UsrDat->FullName); - Ale_ShowAlert (Ale_SUCCESS,Gbl.Alert.Txt); + if (asprintf (&Txt,Txt_Photo_of_THE_USER_X_has_been_removed, + UsrDat->FullName) < 0) + Lay_NotEnoughMemoryExit (); + Ale_ShowAlert (Ale_SUCCESS,Txt); + free ((void *) Txt); } /***** Remove user *****/ Acc_RemoveUsr (UsrDat); if (QuietOrVerbose == Cns_VERBOSE) { - snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), - Txt_Record_card_of_THE_USER_X_has_been_removed, - UsrDat->FullName); - Ale_ShowAlert (Ale_SUCCESS,Gbl.Alert.Txt); + if (asprintf (&Txt,Txt_Record_card_of_THE_USER_X_has_been_removed, + UsrDat->FullName) < 0) + Lay_NotEnoughMemoryExit (); + Ale_ShowAlert (Ale_SUCCESS,Txt); + free ((void *) Txt); } } diff --git a/swad_action.c b/swad_action.c index f7b10dc6..57e1a853 100644 --- a/swad_action.c +++ b/swad_action.c @@ -90,7 +90,6 @@ extern struct Globals Gbl; 1360 actions in one CGI: 0. ActAll Any action (used for statistics) 1. ActUnk Unknown action - 2. ActHom Show home menu 3. ActMnu Show menu of a tab 4. ActRefCon Refresh number of notifications and connected users via AJAX 5. ActRefLstClk Refresh last clicks in log via AJAX @@ -107,6 +106,10 @@ Start: 16. ActSeeCal Show the academic calendar 1228. ActSeeNtf Show my recent notifications + 1296. ActLogIn Authentify user internally (directly from the platform) + 1297. ActLogInNew Authentify user internally (directly from the platform, only if user has not password) + 1298. ActLogInLan Change language to my language just after authentication + 1299. ActAnnSee Mark announcement as seen 1293. ActReqSndNewPwd Show form to send a new password via email 1294. ActSndNewPwd Send a new password via email 1295. ActLogOut Close session @@ -1487,10 +1490,6 @@ Profile: 1291. ActReqEdiRecSha Request the edition of the record with the personal data of the user 1292. ActEdiPrf Show forms to edit preferences - 1296. ActLogIn Authentify user internally (directly from the platform) - 1297. ActLogInNew Authentify user internally (directly from the platform, only if user has not password) - 1298. ActLogInLan Change language to my language just after authentication - 1299. ActAnnSee Mark announcement as seen 1300. ActChgMyRol Change type of logged user 1301. ActFrmNewEvtMyAgd Form to create a new event in my agenda @@ -1507,15 +1506,14 @@ Profile: 1312. ActChkUsrAcc Check if already exists a new account without password associated to a ID 1313. ActCreUsrAcc Create new user account - 1314. ActRemID_Me Remove one of my user's IDs - 1315. ActNewIDMe Create a new user's ID for me - 1316. ActRemOldNicMe Remove one of my old nicknames - 1317. ActChgNicMe Change my nickname - 1318. ActRemMaiMe Remove one of my old emails - 1319. ActNewMaiMe Change my email address + 1314. ActRemMyID Remove one of my user's IDs + 1315. ActChgMyID Create a new user's ID for me + 1316. ActRemMyNck Remove one of my old nicknames + 1317. ActChgMyNck Change my nickname + 1318. ActRemMyMai Remove one of my old emails + 1319. ActChgMyMai Change my email address 1320. ActCnfMai Confirm email address - 1321. ActFrmChgMyPwd Show form to the change of the password - 1322. ActChgPwd Change the password + 1322. ActChgMyPwd Change my password 1323. ActReqRemMyAcc Request the removal of my account 1324. ActRemMyAcc Remove my account @@ -1590,7 +1588,6 @@ struct Act_Actions Act_Actions[Act_NUM_ACTIONS] = // Actions not in menu: /* ActAll */{ 645,-1,TabUnk,ActAll ,0x3F8,0x3C7,0x3C7,0x3C7,0x3C7,0x3C7,0x3C7,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,NULL ,NULL}, // Used for statistics /* ActUnk */{ 194,-1,TabUnk,ActUnk ,0x3F8,0x3C7,0x3C7,0x3C7,0x3C7,0x3C7,0x3C7,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,NULL ,NULL}, - /* ActHom */{ 844,-1,TabUnk,ActHom ,0x3F8,0x3C7,0x3C7,0x3C7,0x3C7,0x3C7,0x3C7,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,NULL ,NULL}, /* ActMnu */{ 2,-1,TabUnk,ActMnu ,0x3F8,0x3C7,0x3C7,0x3C7,0x3C7,0x3C7,0x3C7,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,NULL ,NULL}, /* ActRefCon */{ 845,-1,TabUnk,ActRefCon ,0x3F8,0x3C7,0x3C7,0x3C7,0x3C7,0x3C7,0x3C7,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Lay_RefreshNotifsAndConnected ,NULL}, /* ActRefLstClk */{ 994,-1,TabUnk,ActRefLstClk ,0x3F8,0x3C7,0x3C7,0x3C7,0x3C7,0x3C7,0x3C7,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Lay_RefreshLastClicks ,NULL}, @@ -1607,6 +1604,10 @@ struct Act_Actions Act_Actions[Act_NUM_ACTIONS] = /* ActSeeCal */{1622, 4,TabSta,ActSeeCal ,0x3F8,0x3C7,0x3C7,0x3C7,0x3C7,0x3C7,0x3C7,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Cal_ShowCalendar ,"calendar" }, /* ActSeeNtf */{ 990, 5,TabSta,ActSeeNtf ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Ntf_ShowMyNotifications ,"bell" }, + /* ActLogIn */{ 6,-1,TabUnk,ActFrmLogIn ,0x3F8,0x3C7,0x3C7,0x3C7,0x3C7,0x3C7,0x3C7,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Usr_WelcomeUsr ,NULL}, + /* ActLogInNew */{1585,-1,TabUnk,ActFrmLogIn ,0x3F8,0x3C7,0x3C7,0x3C7,0x3C7,0x3C7,0x3C7,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Usr_WelcomeUsr ,NULL}, + /* ActLogInLan */{1077,-1,TabUnk,ActFrmLogIn ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Usr_WelcomeUsr ,NULL}, + /* ActAnnSee */{1234,-1,TabUnk,ActFrmLogIn ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Ann_MarkAnnouncementAsSeen ,NULL}, /* ActReqSndNewPwd */{ 665,-1,TabUnk,ActFrmLogIn , 0,0x001,0x001,0x001,0x001,0x001,0x001,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Pwd_ShowFormSendNewPwd ,NULL}, /* ActSndNewPwd */{ 633,-1,TabUnk,ActFrmLogIn , 0,0x001,0x001,0x001,0x001,0x001,0x001,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Pwd_ChkIdLoginAndSendNewPwd ,NULL}, /* ActLogOut */{ 10,-1,TabUnk,ActFrmLogIn ,0x3F8,0x3C7,0x3C7,0x3C7,0x3C7,0x3C7,0x3C7,Act_CONT_NORM,Act_BRW_1ST_TAB,Ses_CloseSession ,Usr_Logout ,NULL}, @@ -3063,10 +3064,6 @@ struct Act_Actions Act_Actions[Act_NUM_ACTIONS] = /* ActEdiPrf */{ 673, 6,TabPrf,ActEdiPrf ,0x3F8,0x3C7,0x3C7,0x3C7,0x3C7,0x3C7,0x3C7,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Pre_EditPrefs ,"cog" }, // Actions not in menu: - /* ActLogIn */{ 6,-1,TabUnk,ActFrmRolSes ,0x3F8,0x3C7,0x3C7,0x3C7,0x3C7,0x3C7,0x3C7,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Usr_WelcomeUsr ,NULL}, - /* ActLogInNew */{1585,-1,TabUnk,ActFrmRolSes ,0x3F8,0x3C7,0x3C7,0x3C7,0x3C7,0x3C7,0x3C7,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Usr_WelcomeUsr ,NULL}, - /* ActLogInLan */{1077,-1,TabUnk,ActFrmRolSes ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Usr_WelcomeUsr ,NULL}, - /* ActAnnSee */{1234,-1,TabUnk,ActFrmRolSes ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Ann_MarkAnnouncementAsSeen ,NULL}, /* ActChgMyRol */{ 589,-1,TabUnk,ActFrmRolSes ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_NORM,Act_BRW_1ST_TAB,Rol_ChangeMyRole ,Usr_ShowFormsLogoutAndRole ,NULL}, /* ActFrmNewEvtMyAgd */{1603,-1,TabUnk,ActSeeMyAgd ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Agd_RequestCreatOrEditEvent ,NULL}, @@ -3084,18 +3081,17 @@ struct Act_Actions Act_Actions[Act_NUM_ACTIONS] = /* ActChkUsrAcc */{1584,-1,TabUnk,ActFrmMyAcc ,0x3F8,0x3C7,0x3C7,0x3C7,0x3C7,0x3C7,0x3C7,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Acc_CheckIfEmptyAccountExists ,NULL}, /* ActCreUsrAcc */{1163,-1,TabUnk,ActFrmMyAcc ,0x3F8,0x3C7,0x3C7,0x3C7,0x3C7,0x3C7,0x3C7,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Acc_AfterCreationNewAccount ,NULL}, - /* ActRemID_Me */{1147,-1,TabUnk,ActFrmMyAcc ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,ID_RemoveMyUsrID ,NULL}, - /* ActNewIDMe */{1148,-1,TabUnk,ActFrmMyAcc ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,ID_NewMyUsrID ,NULL}, + /* ActRemMyID */{1147,-1,TabUnk,ActFrmMyAcc ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,ID_RemoveMyUsrID ,NULL}, + /* ActChgMyID */{1148,-1,TabUnk,ActFrmMyAcc ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,ID_NewMyUsrID ,NULL}, - /* ActRemOldNicMe */{1089,-1,TabUnk,ActFrmMyAcc ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Nck_RemoveMyNick ,NULL}, - /* ActChgNicMe */{ 37,-1,TabUnk,ActFrmMyAcc ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Nck_UpdateMyNick ,NULL}, + /* ActRemMyNck */{1089,-1,TabUnk,ActFrmMyAcc ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Nck_RemoveMyNick ,NULL}, + /* ActChgMyNck */{ 37,-1,TabUnk,ActFrmMyAcc ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Nck_UpdateMyNick ,NULL}, - /* ActRemMaiMe */{1090,-1,TabUnk,ActFrmMyAcc ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Mai_RemoveMyUsrEmail ,NULL}, - /* ActNewMaiMe */{1088,-1,TabUnk,ActFrmMyAcc ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,May_NewMyUsrEmail ,NULL}, + /* ActRemMyMai */{1090,-1,TabUnk,ActFrmMyAcc ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Mai_RemoveMyUsrEmail ,NULL}, + /* ActChgMyMai */{1088,-1,TabUnk,ActFrmMyAcc ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,May_NewMyUsrEmail ,NULL}, /* ActCnfMai */{1091,-1,TabUnk,ActFrmMyAcc ,0x3F8,0x3C7,0x3C7,0x3C7,0x3C7,0x3C7,0x3C7,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Mai_ConfirmEmail ,NULL}, - /* ActFrmChgMyPwd */{ 34,-1,TabUnk,ActFrmMyAcc ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Acc_ShowFormChgMyAccount ,NULL}, - /* ActChgPwd */{ 35,-1,TabUnk,ActFrmMyAcc ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_NORM,Act_BRW_1ST_TAB,Pwd_UpdateMyPwd ,Acc_ShowFormChgMyAccount ,NULL}, + /* ActChgMyPwd */{ 35,-1,TabUnk,ActFrmMyAcc ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_NORM,Act_BRW_1ST_TAB,Pwd_UpdateMyPwd ,Acc_ShowFormChgMyAccount ,NULL}, /* ActReqRemMyAcc */{1430,-1,TabUnk,ActFrmMyAcc ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Acc_AskIfRemoveMyAccount ,NULL}, /* ActRemMyAcc */{1431,-1,TabUnk,ActFrmMyAcc ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Acc_RemoveMyAccount ,NULL}, @@ -3181,10 +3177,10 @@ Act_Action_t Act_FromActCodToAction[1 + Act_MAX_ACTION_COD] = // Do not reuse un -1, // #31 (obsolete action) ActSeeBib, // #32 -1, // #33 (obsolete action) - ActFrmChgMyPwd, // #34 - ActChgPwd, // #35 + -1, // #34 (obsolete action) + ActChgMyPwd, // #35 ActFrmMyAcc, // #36 - ActChgNicMe, // #37 + ActChgMyNck, // #37 -1, // #38 (obsolete action) -1, // #39 (obsolete action) -1, // #40 (obsolete action) @@ -3991,7 +3987,7 @@ Act_Action_t Act_FromActCodToAction[1 + Act_MAX_ACTION_COD] = // Do not reuse un ActChgThe, // #841 -1, // #842 (obsolete action) ActFrmRolSes, // #843 - ActHom, // #844 + -1, // #844 (obsolete action) ActRefCon, // #845 ActRcvFilAsgCrsCla, // #846 ActSeeCrsInf, // #847 @@ -4235,9 +4231,9 @@ Act_Action_t Act_FromActCodToAction[1 + Act_MAX_ACTION_COD] = // Do not reuse un ActSeeOneTstResMe, // #1085 ActReqDatSeeMrkCrs, // #1086 ActReqDatSeeMrkGrp, // #1087 - ActNewMaiMe, // #1088 - ActRemOldNicMe, // #1089 - ActRemMaiMe, // #1090 + ActChgMyMai, // #1088 + ActRemMyNck, // #1089 + ActRemMyMai, // #1090 ActCnfMai, // #1091 ActChgIco, // #1092 ActRchTxtEdiCrsInf, // #1093 @@ -4294,8 +4290,8 @@ Act_Action_t Act_FromActCodToAction[1 + Act_MAX_ACTION_COD] = // Do not reuse un ActChgBanImg, // #1144 ActClkBan, // #1145 ActMrkNtfSee, // #1146 - ActRemID_Me, // #1147 - ActNewIDMe, // #1148 + ActRemMyID, // #1147 + ActChgMyID, // #1148 ActSeeDegInf, // #1149 ActPrnDegInf, // #1150 ActSeeCtrInf, // #1151 @@ -5146,15 +5142,17 @@ void Act_AdjustCurrentAction (void) return; /***** If I have no password in database, - the only action possible is show a form to change my password *****/ + the only action possible is show a form to change my account *****/ if (!Gbl.Usrs.Me.UsrDat.Password[0]) { switch (Gbl.Action.Act) { - case ActHom: case ActLogOut: + case ActLogOut: + case ActFrmMyAcc: + case ActChgMyPwd: break; default: - Gbl.Action.Act = ActFrmChgMyPwd; + Gbl.Action.Act = ActFrmMyAcc; Tab_SetCurrentTab (); return; } @@ -5164,9 +5162,9 @@ void Act_AdjustCurrentAction (void) if (Gbl.Action.Act == ActLogIn) if (!Pwd_FastCheckIfPasswordSeemsGood (Gbl.Usrs.Me.LoginPlainPassword)) /* If my login password is not enough secure, - the only action possible is show a form to change my password */ + the only action possible is show a form to change my account */ { - Gbl.Action.Act = ActFrmChgMyPwd; + Gbl.Action.Act = ActFrmMyAcc; Tab_SetCurrentTab (); return; } @@ -5178,8 +5176,10 @@ void Act_AdjustCurrentAction (void) { switch (Gbl.Action.Act) { - case ActHom: case ActLogOut: - case ActFrmChgMyPwd: + case ActLogOut: + case ActFrmMyAcc: + case ActChgMyPwd: + case ActChgMyNck: break; default: Gbl.Action.Act = ActFrmMyAcc; @@ -5196,8 +5196,10 @@ void Act_AdjustCurrentAction (void) Gbl.Usrs.Me.UsrDat.CtyCod <= 0) switch (Gbl.Action.Act) { - case ActHom: case ActLogOut: - case ActFrmMyAcc: case ActFrmChgMyPwd: + case ActLogOut: + case ActFrmMyAcc: + case ActChgMyPwd: + case ActChgMyNck: break; default: Gbl.Action.Act = ActReqEdiRecSha; @@ -5218,8 +5220,10 @@ void Act_AdjustCurrentAction (void) Gbl.Usrs.Me.UsrDat.Tch.DptCod < 0))) switch (Gbl.Action.Act) { - case ActHom: case ActLogOut: - case ActFrmMyAcc: case ActFrmChgMyPwd: + case ActLogOut: + case ActFrmMyAcc: + case ActChgMyPwd: + case ActChgMyNck: case ActReqEdiRecSha: break; default: @@ -5233,9 +5237,12 @@ void Act_AdjustCurrentAction (void) Gbl.Usrs.Me.UsrDat.ProfileVisibility == Pri_VISIBILITY_UNKNOWN) switch (Gbl.Action.Act) { - case ActHom: case ActLogOut: - case ActFrmMyAcc: case ActFrmChgMyPwd: - case ActReqEdiRecSha: case ActReqEdiMyIns: + case ActLogOut: + case ActFrmMyAcc: + case ActChgMyPwd: + case ActChgMyNck: + case ActReqEdiRecSha: + case ActReqEdiMyIns: break; default: Gbl.Action.Act = ActEdiPri; @@ -5276,11 +5283,11 @@ void Act_AdjustCurrentAction (void) { case ActLogIn: case ActLogInNew: - case ActHom: case ActMnu: case ActLogOut: case ActFrmMyAcc: - case ActFrmChgMyPwd: + case ActChgMyPwd: + case ActChgMyNck: case ActReqEdiRecSha: case ActReqEdiMyIns: case ActEdiPri: diff --git a/swad_action.h b/swad_action.h index 498fc417..d3f94a5c 100644 --- a/swad_action.h +++ b/swad_action.h @@ -61,7 +61,7 @@ typedef enum typedef signed int Act_Action_t; // Must be a signed type, because -1 is used to indicate obsolete action -#define Act_NUM_ACTIONS (1 + 9 + 55 + 38 + 12 + 42 + 36 + 19 + 110 + 157 + 437 + 165 + 168 + 15 + 72) +#define Act_NUM_ACTIONS (1 + 8 + 59 + 38 + 12 + 42 + 36 + 19 + 110 + 157 + 437 + 165 + 168 + 15 + 67) #define Act_MAX_ACTION_COD 1752 @@ -73,17 +73,16 @@ typedef signed int Act_Action_t; // Must be a signed type, because -1 is used to #define ActAll 0 #define ActUnk 1 -#define ActHom 2 -#define ActMnu 3 +#define ActMnu 2 // The following 5 actions use AJAX to refresh only a part of the page -#define ActRefCon 4 -#define ActRefLstClk 5 -#define ActRefNewSocPubGbl 6 -#define ActRefOldSocPubGbl 7 -#define ActRefOldSocPubUsr 8 +#define ActRefCon 3 +#define ActRefLstClk 4 +#define ActRefNewSocPubGbl 5 +#define ActRefOldSocPubGbl 6 +#define ActRefOldSocPubUsr 7 -#define ActWebSvc 9 +#define ActWebSvc 8 /*****************************************************************************/ /********************************* Start tab *********************************/ @@ -97,63 +96,67 @@ typedef signed int Act_Action_t; // Must be a signed type, because -1 is used to #define ActSeeNtf (ActWebSvc + 6) // Secondary actions -#define ActReqSndNewPwd (ActWebSvc + 7) -#define ActSndNewPwd (ActWebSvc + 8) -#define ActLogOut (ActWebSvc + 9) +#define ActLogIn (ActWebSvc + 7) +#define ActLogInNew (ActWebSvc + 8) +#define ActLogInLan (ActWebSvc + 9) +#define ActAnnSee (ActWebSvc + 10) +#define ActReqSndNewPwd (ActWebSvc + 11) +#define ActSndNewPwd (ActWebSvc + 12) +#define ActLogOut (ActWebSvc + 13) -#define ActSch (ActWebSvc + 10) +#define ActSch (ActWebSvc + 14) -#define ActRcvSocPstGbl (ActWebSvc + 11) -#define ActRcvSocComGbl (ActWebSvc + 12) -#define ActShaSocNotGbl (ActWebSvc + 13) -#define ActUnsSocNotGbl (ActWebSvc + 14) -#define ActFavSocNotGbl (ActWebSvc + 15) -#define ActUnfSocNotGbl (ActWebSvc + 16) -#define ActFavSocComGbl (ActWebSvc + 17) -#define ActUnfSocComGbl (ActWebSvc + 18) -#define ActReqRemSocPubGbl (ActWebSvc + 19) -#define ActRemSocPubGbl (ActWebSvc + 20) -#define ActReqRemSocComGbl (ActWebSvc + 21) -#define ActRemSocComGbl (ActWebSvc + 22) +#define ActRcvSocPstGbl (ActWebSvc + 15) +#define ActRcvSocComGbl (ActWebSvc + 16) +#define ActShaSocNotGbl (ActWebSvc + 17) +#define ActUnsSocNotGbl (ActWebSvc + 18) +#define ActFavSocNotGbl (ActWebSvc + 19) +#define ActUnfSocNotGbl (ActWebSvc + 20) +#define ActFavSocComGbl (ActWebSvc + 21) +#define ActUnfSocComGbl (ActWebSvc + 22) +#define ActReqRemSocPubGbl (ActWebSvc + 23) +#define ActRemSocPubGbl (ActWebSvc + 24) +#define ActReqRemSocComGbl (ActWebSvc + 25) +#define ActRemSocComGbl (ActWebSvc + 26) -#define ActReqOthPubPrf (ActWebSvc + 23) +#define ActReqOthPubPrf (ActWebSvc + 27) -#define ActRcvSocPstUsr (ActWebSvc + 24) -#define ActRcvSocComUsr (ActWebSvc + 25) -#define ActShaSocNotUsr (ActWebSvc + 26) -#define ActUnsSocNotUsr (ActWebSvc + 27) -#define ActFavSocNotUsr (ActWebSvc + 28) -#define ActUnfSocNotUsr (ActWebSvc + 29) -#define ActFavSocComUsr (ActWebSvc + 30) -#define ActUnfSocComUsr (ActWebSvc + 31) -#define ActReqRemSocPubUsr (ActWebSvc + 32) -#define ActRemSocPubUsr (ActWebSvc + 33) -#define ActReqRemSocComUsr (ActWebSvc + 34) -#define ActRemSocComUsr (ActWebSvc + 35) +#define ActRcvSocPstUsr (ActWebSvc + 28) +#define ActRcvSocComUsr (ActWebSvc + 29) +#define ActShaSocNotUsr (ActWebSvc + 30) +#define ActUnsSocNotUsr (ActWebSvc + 31) +#define ActFavSocNotUsr (ActWebSvc + 32) +#define ActUnfSocNotUsr (ActWebSvc + 33) +#define ActFavSocComUsr (ActWebSvc + 34) +#define ActUnfSocComUsr (ActWebSvc + 35) +#define ActReqRemSocPubUsr (ActWebSvc + 36) +#define ActRemSocPubUsr (ActWebSvc + 37) +#define ActReqRemSocComUsr (ActWebSvc + 38) +#define ActRemSocComUsr (ActWebSvc + 39) -#define ActSeeOthPubPrf (ActWebSvc + 36) -#define ActCal1stClkTim (ActWebSvc + 37) -#define ActCalNumClk (ActWebSvc + 38) -#define ActCalNumFilVie (ActWebSvc + 39) -#define ActCalNumForPst (ActWebSvc + 40) -#define ActCalNumMsgSnt (ActWebSvc + 41) +#define ActSeeOthPubPrf (ActWebSvc + 40) +#define ActCal1stClkTim (ActWebSvc + 41) +#define ActCalNumClk (ActWebSvc + 42) +#define ActCalNumFilVie (ActWebSvc + 43) +#define ActCalNumForPst (ActWebSvc + 44) +#define ActCalNumMsgSnt (ActWebSvc + 45) -#define ActFolUsr (ActWebSvc + 42) -#define ActUnfUsr (ActWebSvc + 43) -#define ActSeeFlg (ActWebSvc + 44) -#define ActSeeFlr (ActWebSvc + 45) +#define ActFolUsr (ActWebSvc + 46) +#define ActUnfUsr (ActWebSvc + 47) +#define ActSeeFlg (ActWebSvc + 48) +#define ActSeeFlr (ActWebSvc + 49) -#define ActPrnCal (ActWebSvc + 46) -#define ActChgCal1stDay (ActWebSvc + 47) +#define ActPrnCal (ActWebSvc + 50) +#define ActChgCal1stDay (ActWebSvc + 51) -#define ActSeeNewNtf (ActWebSvc + 48) -#define ActMrkNtfSee (ActWebSvc + 49) -#define ActSeeMai (ActWebSvc + 50) -#define ActEdiMai (ActWebSvc + 51) -#define ActNewMai (ActWebSvc + 52) -#define ActRemMai (ActWebSvc + 53) -#define ActRenMaiSho (ActWebSvc + 54) -#define ActRenMaiFul (ActWebSvc + 55) +#define ActSeeNewNtf (ActWebSvc + 52) +#define ActMrkNtfSee (ActWebSvc + 53) +#define ActSeeMai (ActWebSvc + 54) +#define ActEdiMai (ActWebSvc + 55) +#define ActNewMai (ActWebSvc + 56) +#define ActRemMai (ActWebSvc + 57) +#define ActRenMaiSho (ActWebSvc + 58) +#define ActRenMaiFul (ActWebSvc + 59) /*****************************************************************************/ /******************************** System tab *********************************/ @@ -1521,80 +1524,75 @@ typedef signed int Act_Action_t; // Must be a signed type, because -1 is used to #define ActReqEdiRecSha (ActSeeMyUsgRep + 6) #define ActEdiPrf (ActSeeMyUsgRep + 7) // Secondary actions -#define ActLogIn (ActSeeMyUsgRep + 8) -#define ActLogInNew (ActSeeMyUsgRep + 9) -#define ActLogInLan (ActSeeMyUsgRep + 10) -#define ActAnnSee (ActSeeMyUsgRep + 11) -#define ActChgMyRol (ActSeeMyUsgRep + 12) -#define ActFrmNewEvtMyAgd (ActSeeMyUsgRep + 13) -#define ActEdiOneEvtMyAgd (ActSeeMyUsgRep + 14) -#define ActNewEvtMyAgd (ActSeeMyUsgRep + 15) -#define ActChgEvtMyAgd (ActSeeMyUsgRep + 16) -#define ActReqRemEvtMyAgd (ActSeeMyUsgRep + 17) -#define ActRemEvtMyAgd (ActSeeMyUsgRep + 18) -#define ActHidEvtMyAgd (ActSeeMyUsgRep + 19) -#define ActShoEvtMyAgd (ActSeeMyUsgRep + 20) -#define ActPrvEvtMyAgd (ActSeeMyUsgRep + 21) -#define ActPubEvtMyAgd (ActSeeMyUsgRep + 22) -#define ActPrnAgdQR (ActSeeMyUsgRep + 23) +#define ActChgMyRol (ActSeeMyUsgRep + 8) +#define ActFrmNewEvtMyAgd (ActSeeMyUsgRep + 9) +#define ActEdiOneEvtMyAgd (ActSeeMyUsgRep + 10) +#define ActNewEvtMyAgd (ActSeeMyUsgRep + 11) +#define ActChgEvtMyAgd (ActSeeMyUsgRep + 12) +#define ActReqRemEvtMyAgd (ActSeeMyUsgRep + 13) +#define ActRemEvtMyAgd (ActSeeMyUsgRep + 14) +#define ActHidEvtMyAgd (ActSeeMyUsgRep + 15) +#define ActShoEvtMyAgd (ActSeeMyUsgRep + 16) +#define ActPrvEvtMyAgd (ActSeeMyUsgRep + 17) +#define ActPubEvtMyAgd (ActSeeMyUsgRep + 18) +#define ActPrnAgdQR (ActSeeMyUsgRep + 19) -#define ActChkUsrAcc (ActSeeMyUsgRep + 24) -#define ActCreUsrAcc (ActSeeMyUsgRep + 25) -#define ActRemID_Me (ActSeeMyUsgRep + 26) -#define ActNewIDMe (ActSeeMyUsgRep + 27) -#define ActRemOldNicMe (ActSeeMyUsgRep + 28) -#define ActChgNicMe (ActSeeMyUsgRep + 29) -#define ActRemMaiMe (ActSeeMyUsgRep + 30) -#define ActNewMaiMe (ActSeeMyUsgRep + 31) -#define ActCnfMai (ActSeeMyUsgRep + 32) -#define ActFrmChgMyPwd (ActSeeMyUsgRep + 33) -#define ActChgPwd (ActSeeMyUsgRep + 34) -#define ActReqRemMyAcc (ActSeeMyUsgRep + 35) -#define ActRemMyAcc (ActSeeMyUsgRep + 36) +#define ActChkUsrAcc (ActSeeMyUsgRep + 20) +#define ActCreUsrAcc (ActSeeMyUsgRep + 21) +#define ActRemMyID (ActSeeMyUsgRep + 22) +#define ActChgMyID (ActSeeMyUsgRep + 23) +#define ActRemMyNck (ActSeeMyUsgRep + 24) +#define ActChgMyNck (ActSeeMyUsgRep + 25) +#define ActRemMyMai (ActSeeMyUsgRep + 26) +#define ActChgMyMai (ActSeeMyUsgRep + 27) +#define ActCnfMai (ActSeeMyUsgRep + 28) +#define ActChgMyPwd (ActSeeMyUsgRep + 29) +#define ActReqRemMyAcc (ActSeeMyUsgRep + 30) +#define ActRemMyAcc (ActSeeMyUsgRep + 31) -#define ActChgMyData (ActSeeMyUsgRep + 37) +#define ActChgMyData (ActSeeMyUsgRep + 32) -#define ActReqMyPho (ActSeeMyUsgRep + 38) -#define ActDetMyPho (ActSeeMyUsgRep + 39) -#define ActUpdMyPho (ActSeeMyUsgRep + 40) -#define ActReqRemMyPho (ActSeeMyUsgRep + 41) -#define ActRemMyPho (ActSeeMyUsgRep + 42) +#define ActReqMyPho (ActSeeMyUsgRep + 33) +#define ActDetMyPho (ActSeeMyUsgRep + 34) +#define ActUpdMyPho (ActSeeMyUsgRep + 35) +#define ActReqRemMyPho (ActSeeMyUsgRep + 36) +#define ActRemMyPho (ActSeeMyUsgRep + 37) -#define ActEdiPri (ActSeeMyUsgRep + 43) -#define ActChgPriPho (ActSeeMyUsgRep + 44) -#define ActChgPriPrf (ActSeeMyUsgRep + 45) +#define ActEdiPri (ActSeeMyUsgRep + 38) +#define ActChgPriPho (ActSeeMyUsgRep + 39) +#define ActChgPriPrf (ActSeeMyUsgRep + 40) -#define ActReqEdiMyIns (ActSeeMyUsgRep + 46) -#define ActChgCtyMyIns (ActSeeMyUsgRep + 47) -#define ActChgMyIns (ActSeeMyUsgRep + 48) -#define ActChgMyCtr (ActSeeMyUsgRep + 49) -#define ActChgMyDpt (ActSeeMyUsgRep + 50) -#define ActChgMyOff (ActSeeMyUsgRep + 51) -#define ActChgMyOffPho (ActSeeMyUsgRep + 52) +#define ActReqEdiMyIns (ActSeeMyUsgRep + 41) +#define ActChgCtyMyIns (ActSeeMyUsgRep + 42) +#define ActChgMyIns (ActSeeMyUsgRep + 43) +#define ActChgMyCtr (ActSeeMyUsgRep + 44) +#define ActChgMyDpt (ActSeeMyUsgRep + 45) +#define ActChgMyOff (ActSeeMyUsgRep + 46) +#define ActChgMyOffPho (ActSeeMyUsgRep + 47) -#define ActReqEdiMyNet (ActSeeMyUsgRep + 53) -#define ActChgMyNet (ActSeeMyUsgRep + 54) +#define ActReqEdiMyNet (ActSeeMyUsgRep + 48) +#define ActChgMyNet (ActSeeMyUsgRep + 49) -#define ActChgThe (ActSeeMyUsgRep + 55) -#define ActReqChgLan (ActSeeMyUsgRep + 56) -#define ActChgLan (ActSeeMyUsgRep + 57) -#define ActChg1stDay (ActSeeMyUsgRep + 58) -#define ActChgDatFmt (ActSeeMyUsgRep + 59) -#define ActChgCol (ActSeeMyUsgRep + 60) -#define ActHidLftCol (ActSeeMyUsgRep + 61) -#define ActHidRgtCol (ActSeeMyUsgRep + 62) -#define ActShoLftCol (ActSeeMyUsgRep + 63) -#define ActShoRgtCol (ActSeeMyUsgRep + 64) -#define ActChgIco (ActSeeMyUsgRep + 65) -#define ActChgMnu (ActSeeMyUsgRep + 66) -#define ActChgNtfPrf (ActSeeMyUsgRep + 67) +#define ActChgThe (ActSeeMyUsgRep + 50) +#define ActReqChgLan (ActSeeMyUsgRep + 51) +#define ActChgLan (ActSeeMyUsgRep + 52) +#define ActChg1stDay (ActSeeMyUsgRep + 53) +#define ActChgDatFmt (ActSeeMyUsgRep + 54) +#define ActChgCol (ActSeeMyUsgRep + 55) +#define ActHidLftCol (ActSeeMyUsgRep + 56) +#define ActHidRgtCol (ActSeeMyUsgRep + 57) +#define ActShoLftCol (ActSeeMyUsgRep + 58) +#define ActShoRgtCol (ActSeeMyUsgRep + 59) +#define ActChgIco (ActSeeMyUsgRep + 60) +#define ActChgMnu (ActSeeMyUsgRep + 61) +#define ActChgNtfPrf (ActSeeMyUsgRep + 62) -#define ActPrnUsrQR (ActSeeMyUsgRep + 68) +#define ActPrnUsrQR (ActSeeMyUsgRep + 63) -#define ActPrnMyTT (ActSeeMyUsgRep + 69) -#define ActEdiTut (ActSeeMyUsgRep + 70) -#define ActChgTut (ActSeeMyUsgRep + 71) -#define ActChgMyTT1stDay (ActSeeMyUsgRep + 72) +#define ActPrnMyTT (ActSeeMyUsgRep + 64) +#define ActEdiTut (ActSeeMyUsgRep + 65) +#define ActChgTut (ActSeeMyUsgRep + 66) +#define ActChgMyTT1stDay (ActSeeMyUsgRep + 67) /*****************************************************************************/ /******************************** Public types *******************************/ diff --git a/swad_agenda.c b/swad_agenda.c index 0135a398..6bea64d8 100644 --- a/swad_agenda.c +++ b/swad_agenda.c @@ -1260,6 +1260,7 @@ void Agd_AskRemEvent (void) extern const char *Txt_Do_you_really_want_to_remove_the_event_X; extern const char *Txt_Remove_event; struct AgendaEvent AgdEvent; + char *Txt; /***** Get parameters *****/ Agd_GetParams (Agd_MY_AGENDA); @@ -1274,13 +1275,14 @@ void Agd_AskRemEvent (void) /***** Show question and button to remove event *****/ Gbl.Agenda.AgdCodToEdit = AgdEvent.AgdCod; - snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), - Txt_Do_you_really_want_to_remove_the_event_X, - AgdEvent.Event); - Ale_ShowAlertAndButton (Ale_QUESTION,Gbl.Alert.Txt, + if (asprintf (&Txt,Txt_Do_you_really_want_to_remove_the_event_X, + AgdEvent.Event) < 0) + Lay_NotEnoughMemoryExit (); + Ale_ShowAlertAndButton (Ale_QUESTION,Txt, ActRemEvtMyAgd,NULL,NULL, Agd_PutCurrentParamsMyAgenda, Btn_REMOVE_BUTTON,Txt_Remove_event); + free ((void *) Txt); /***** Show events again *****/ Agd_ShowMyAgenda (); @@ -1294,6 +1296,7 @@ void Agd_RemoveEvent (void) { extern const char *Txt_Event_X_removed; struct AgendaEvent AgdEvent; + char *Txt; /***** Get event code *****/ if ((AgdEvent.AgdCod = Agd_GetParamAgdCod ()) == -1L) @@ -1309,10 +1312,11 @@ void Agd_RemoveEvent (void) AgdEvent.AgdCod,AgdEvent.UsrCod); /***** Write message to show the change made *****/ - snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), - Txt_Event_X_removed, - AgdEvent.Event); - Ale_ShowAlert (Ale_SUCCESS,Gbl.Alert.Txt); + if (asprintf (&Txt,Txt_Event_X_removed, + AgdEvent.Event) < 0) + Lay_NotEnoughMemoryExit (); + Ale_ShowAlert (Ale_SUCCESS,Txt); + free ((void *) Txt); /***** Show events again *****/ Agd_ShowMyAgenda (); @@ -1326,6 +1330,7 @@ void Agd_HideEvent (void) { extern const char *Txt_Event_X_is_now_hidden; struct AgendaEvent AgdEvent; + char *Txt; /***** Get event code *****/ if ((AgdEvent.AgdCod = Agd_GetParamAgdCod ()) == -1L) @@ -1342,10 +1347,11 @@ void Agd_HideEvent (void) AgdEvent.AgdCod,AgdEvent.UsrCod); /***** Write message to show the change made *****/ - snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), - Txt_Event_X_is_now_hidden, - AgdEvent.Event); - Ale_ShowAlert (Ale_SUCCESS,Gbl.Alert.Txt); + if (asprintf (&Txt,Txt_Event_X_is_now_hidden, + AgdEvent.Event) < 0) + Lay_NotEnoughMemoryExit (); + Ale_ShowAlert (Ale_SUCCESS,Txt); + free ((void *) Txt); /***** Show events again *****/ Agd_ShowMyAgenda (); @@ -1359,6 +1365,7 @@ void Agd_UnhideEvent (void) { extern const char *Txt_Event_X_is_now_visible; struct AgendaEvent AgdEvent; + char *Txt; /***** Get event code *****/ if ((AgdEvent.AgdCod = Agd_GetParamAgdCod ()) == -1L) @@ -1375,10 +1382,11 @@ void Agd_UnhideEvent (void) AgdEvent.AgdCod,AgdEvent.UsrCod); /***** Write message to show the change made *****/ - snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), - Txt_Event_X_is_now_visible, - AgdEvent.Event); - Ale_ShowAlert (Ale_SUCCESS,Gbl.Alert.Txt); + if (asprintf (&Txt,Txt_Event_X_is_now_visible, + AgdEvent.Event) < 0) + Lay_NotEnoughMemoryExit (); + Ale_ShowAlert (Ale_SUCCESS,Txt); + free ((void *) Txt); /***** Show events again *****/ Agd_ShowMyAgenda (); @@ -1392,6 +1400,7 @@ void Agd_MakeEventPrivate (void) { extern const char *Txt_Event_X_is_now_private; struct AgendaEvent AgdEvent; + char *Txt; /***** Get event code *****/ if ((AgdEvent.AgdCod = Agd_GetParamAgdCod ()) == -1L) @@ -1408,10 +1417,11 @@ void Agd_MakeEventPrivate (void) AgdEvent.AgdCod,AgdEvent.UsrCod); /***** Write message to show the change made *****/ - snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), - Txt_Event_X_is_now_private, - AgdEvent.Event); - Ale_ShowAlert (Ale_SUCCESS,Gbl.Alert.Txt); + if (asprintf (&Txt,Txt_Event_X_is_now_private, + AgdEvent.Event) < 0) + Lay_NotEnoughMemoryExit (); + Ale_ShowAlert (Ale_SUCCESS,Txt); + free ((void *) Txt); /***** Show events again *****/ Agd_ShowMyAgenda (); @@ -1425,6 +1435,7 @@ void Agd_MakeEventPublic (void) { extern const char *Txt_Event_X_is_now_visible_to_users_of_your_courses; struct AgendaEvent AgdEvent; + char *Txt; /***** Get event code *****/ if ((AgdEvent.AgdCod = Agd_GetParamAgdCod ()) == -1L) @@ -1441,10 +1452,11 @@ void Agd_MakeEventPublic (void) AgdEvent.AgdCod,AgdEvent.UsrCod); /***** Write message to show the change made *****/ - snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), - Txt_Event_X_is_now_visible_to_users_of_your_courses, - AgdEvent.Event); - Ale_ShowAlert (Ale_SUCCESS,Gbl.Alert.Txt); + if (asprintf (&Txt,Txt_Event_X_is_now_visible_to_users_of_your_courses, + AgdEvent.Event) < 0) + Lay_NotEnoughMemoryExit (); + Ale_ShowAlert (Ale_SUCCESS,Txt); + free ((void *) Txt); /***** Show events again *****/ Agd_ShowMyAgenda (); @@ -1593,7 +1605,8 @@ void Agd_RecFormEvent (void) struct AgendaEvent AgdEvent; bool ItsANewEvent; bool NewEventIsCorrect = true; - char Txt[Cns_MAX_BYTES_TEXT + 1]; + char EventTxt[Cns_MAX_BYTES_TEXT + 1]; + char *Txt; /***** Set author of the event *****/ AgdEvent.UsrCod = Gbl.Usrs.Me.UsrDat.UsrCod; @@ -1612,7 +1625,7 @@ void Agd_RecFormEvent (void) Par_GetParToText ("Event",AgdEvent.Event,Agd_MAX_BYTES_EVENT); /***** Get text *****/ - Par_GetParToHTML ("Txt",Txt,Cns_MAX_BYTES_TEXT); // Store in HTML format (not rigorous) + Par_GetParToHTML ("Txt",EventTxt,Cns_MAX_BYTES_TEXT); // Store in HTML format (not rigorous) /***** Adjust dates *****/ if (AgdEvent.TimeUTC[Agd_START_TIME] == 0) @@ -1639,17 +1652,18 @@ void Agd_RecFormEvent (void) { if (ItsANewEvent) { - Agd_CreateEvent (&AgdEvent,Txt); // Add new event to database + Agd_CreateEvent (&AgdEvent,EventTxt); // Add new event to database /***** Write success message *****/ - snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), - Txt_Created_new_event_X, - AgdEvent.Event); - Ale_ShowAlert (Ale_SUCCESS,Gbl.Alert.Txt); + if (asprintf (&Txt,Txt_Created_new_event_X, + AgdEvent.Event) < 0) + Lay_NotEnoughMemoryExit (); + Ale_ShowAlert (Ale_SUCCESS,Txt); + free ((void *) Txt); } else { - Agd_UpdateEvent (&AgdEvent,Txt); + Agd_UpdateEvent (&AgdEvent,EventTxt); /***** Write success message *****/ Ale_ShowAlert (Ale_SUCCESS,Txt_The_event_has_been_modified); diff --git a/swad_alert.c b/swad_alert.c index afe7d56e..75c60d65 100644 --- a/swad_alert.c +++ b/swad_alert.c @@ -100,7 +100,6 @@ void Ale_ShowAlert (Ale_AlertType_t AlertType,const char *Txt) if (AlertType != Ale_NONE) Ale_ShowAlertAndButton (AlertType,Txt, ActUnk,NULL,NULL,NULL,Btn_NO_BUTTON,NULL); - // Ale_ResetAlert (); } void Ale_ShowAlertAndButton (Ale_AlertType_t AlertType,const char *Txt, diff --git a/swad_assignment.c b/swad_assignment.c index ab393fb9..e6a08a8c 100644 --- a/swad_assignment.c +++ b/swad_assignment.c @@ -25,8 +25,10 @@ /********************************* Headers ***********************************/ /*****************************************************************************/ +#define _GNU_SOURCE // For asprintf #include // For PATH_MAX #include // For NULL +#include // For asprintf #include // For calloc #include // For string functions @@ -927,6 +929,7 @@ void Asg_ReqRemAssignment (void) extern const char *Txt_Do_you_really_want_to_remove_the_assignment_X; extern const char *Txt_Remove_assignment; struct Assignment Asg; + char *Txt; /***** Get parameters *****/ Asg_GetParamAsgOrder (); @@ -942,12 +945,13 @@ void Asg_ReqRemAssignment (void) /***** Show question and button to remove the assignment *****/ Gbl.Asgs.AsgCodToEdit = Asg.AsgCod; - snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), - Txt_Do_you_really_want_to_remove_the_assignment_X, - Asg.Title); - Ale_ShowAlertAndButton (Ale_QUESTION,Gbl.Alert.Txt, + if (asprintf (&Txt,Txt_Do_you_really_want_to_remove_the_assignment_X, + Asg.Title) < 0) + Lay_NotEnoughMemoryExit (); + Ale_ShowAlertAndButton (Ale_QUESTION,Txt, ActRemAsg,NULL,NULL,Asg_PutParams, Btn_REMOVE_BUTTON,Txt_Remove_assignment); + free ((void *) Txt); /***** Show assignments again *****/ Asg_SeeAssignments (); @@ -961,6 +965,7 @@ void Asg_RemoveAssignment (void) { extern const char *Txt_Assignment_X_removed; struct Assignment Asg; + char *Txt; /***** Get assignment code *****/ if ((Asg.AsgCod = Asg_GetParamAsgCod ()) == -1L) @@ -985,10 +990,11 @@ void Asg_RemoveAssignment (void) Ntf_MarkNotifAsRemoved (Ntf_EVENT_ASSIGNMENT,Asg.AsgCod); /***** Write message to show the change made *****/ - snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), - Txt_Assignment_X_removed, - Asg.Title); - Ale_ShowAlert (Ale_SUCCESS,Gbl.Alert.Txt); + if (asprintf (&Txt,Txt_Assignment_X_removed, + Asg.Title) < 0) + Lay_NotEnoughMemoryExit (); + Ale_ShowAlert (Ale_SUCCESS,Txt); + free ((void *) Txt); /***** Show assignments again *****/ Asg_SeeAssignments (); @@ -1002,6 +1008,7 @@ void Asg_HideAssignment (void) { extern const char *Txt_Assignment_X_is_now_hidden; struct Assignment Asg; + char *Txt; /***** Get assignment code *****/ if ((Asg.AsgCod = Asg_GetParamAsgCod ()) == -1L) @@ -1017,10 +1024,11 @@ void Asg_HideAssignment (void) Asg.AsgCod,Gbl.CurrentCrs.Crs.CrsCod); /***** Write message to show the change made *****/ - snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), - Txt_Assignment_X_is_now_hidden, - Asg.Title); - Ale_ShowAlert (Ale_SUCCESS,Gbl.Alert.Txt); + if (asprintf (&Txt,Txt_Assignment_X_is_now_hidden, + Asg.Title) < 0) + Lay_NotEnoughMemoryExit (); + Ale_ShowAlert (Ale_SUCCESS,Txt); + free ((void *) Txt); /***** Show assignments again *****/ Asg_SeeAssignments (); @@ -1034,6 +1042,7 @@ void Asg_ShowAssignment (void) { extern const char *Txt_Assignment_X_is_now_visible; struct Assignment Asg; + char *Txt; /***** Get assignment code *****/ if ((Asg.AsgCod = Asg_GetParamAsgCod ()) == -1L) @@ -1049,10 +1058,11 @@ void Asg_ShowAssignment (void) Asg.AsgCod,Gbl.CurrentCrs.Crs.CrsCod); /***** Write message to show the change made *****/ - snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), - Txt_Assignment_X_is_now_visible, - Asg.Title); - Ale_ShowAlert (Ale_SUCCESS,Gbl.Alert.Txt); + if (asprintf (&Txt,Txt_Assignment_X_is_now_visible, + Asg.Title) < 0) + Lay_NotEnoughMemoryExit (); + Ale_ShowAlert (Ale_SUCCESS,Txt); + free ((void *) Txt); /***** Show assignments again *****/ Asg_SeeAssignments (); @@ -1291,7 +1301,8 @@ void Asg_RecFormAssignment (void) bool ItsANewAssignment; bool NewAssignmentIsCorrect = true; unsigned NumUsrsToBeNotifiedByEMail; - char Txt[Cns_MAX_BYTES_TEXT + 1]; + char Description[Cns_MAX_BYTES_TEXT + 1]; + char *Txt; /***** Get the code of the assignment *****/ NewAsg.AsgCod = Asg_GetParamAsgCod (); @@ -1323,7 +1334,7 @@ void Asg_RecFormAssignment (void) Asg_DO_NOT_SEND_WORK; /***** Get assignment text *****/ - Par_GetParToHTML ("Txt",Txt,Cns_MAX_BYTES_TEXT); // Store in HTML format (not rigorous) + Par_GetParToHTML ("Txt",Description,Cns_MAX_BYTES_TEXT); // Store in HTML format (not rigorous) /***** Adjust dates *****/ if (NewAsg.TimeUTC[Dat_START_TIME] == 0) @@ -1338,10 +1349,12 @@ void Asg_RecFormAssignment (void) if (Asg_CheckIfSimilarAssignmentExists ("Title",NewAsg.Title,NewAsg.AsgCod)) { NewAssignmentIsCorrect = false; - snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), - Txt_Already_existed_an_assignment_with_the_title_X, - NewAsg.Title); - Ale_ShowAlert (Ale_WARNING,Gbl.Alert.Txt); + + if (asprintf (&Txt,Txt_Already_existed_an_assignment_with_the_title_X, + NewAsg.Title) < 0) + Lay_NotEnoughMemoryExit (); + Ale_ShowAlert (Ale_WARNING,Txt); + free ((void *) Txt); } else // Title is correct { @@ -1391,7 +1404,7 @@ void Asg_RecFormAssignment (void) if (ItsANewAssignment) { - Asg_CreateAssignment (&NewAsg,Txt); // Add new assignment to database + Asg_CreateAssignment (&NewAsg,Description); // Add new assignment to database /***** Write success message *****/ snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), @@ -1406,7 +1419,7 @@ void Asg_RecFormAssignment (void) NewAssignmentIsCorrect = Brw_UpdateFoldersAssigmentsIfExistForAllUsrs (OldAsg.Folder,NewAsg.Folder); if (NewAssignmentIsCorrect) { - Asg_UpdateAssignment (&NewAsg,Txt); + Asg_UpdateAssignment (&NewAsg,Description); /***** Write success message *****/ Ale_ShowAlert (Ale_SUCCESS,Txt_The_assignment_has_been_modified); diff --git a/swad_attendance.c b/swad_attendance.c index 131f61aa..2867b28c 100644 --- a/swad_attendance.c +++ b/swad_attendance.c @@ -98,7 +98,7 @@ static void Att_PutParams (void); static void Att_GetListAttEvents (Att_OrderNewestOldest_t OrderNewestOldest); static void Att_GetDataOfAttEventByCodAndCheckCrs (struct AttendanceEvent *Att); static void Att_ResetAttendanceEvent (struct AttendanceEvent *Att); -static void Att_GetAttEventTxtFromDB (long AttCod,char Txt[Cns_MAX_BYTES_TEXT + 1]); +static void Att_GetAttEventDescriptionFromDB (long AttCod,char Description[Cns_MAX_BYTES_TEXT + 1]); static bool Att_CheckIfSimilarAttEventExists (const char *Field,const char *Value,long AttCod); static void Att_ShowLstGrpsToEditAttEvent (long AttCod); static void Att_RemoveAllTheGrpsAssociatedToAnAttEvent (long AttCod); @@ -378,7 +378,7 @@ static void Att_ShowOneAttEvent (struct AttendanceEvent *Att,bool ShowOnlyThisAt extern const char *Txt_Today; extern const char *Txt_View_event; static unsigned UniqueId = 0; - char Txt[Cns_MAX_BYTES_TEXT + 1]; + char Description[Cns_MAX_BYTES_TEXT + 1]; /***** Get data of this attendance event *****/ Att_GetDataOfAttEventByCodAndCheckCrs (Att); @@ -474,10 +474,10 @@ static void Att_ShowOneAttEvent (struct AttendanceEvent *Att,bool ShowOnlyThisAt fprintf (Gbl.F.Out,""); /* Text of the attendance event */ - Att_GetAttEventTxtFromDB (Att->AttCod,Txt); + Att_GetAttEventDescriptionFromDB (Att->AttCod,Description); Str_ChangeFormat (Str_FROM_HTML,Str_TO_RIGOROUS_HTML, - Txt,Cns_MAX_BYTES_TEXT,false); // Convert from HTML to recpectful HTML - Str_InsertLinks (Txt,Cns_MAX_BYTES_TEXT,60); // Insert links + Description,Cns_MAX_BYTES_TEXT,false); // Convert from HTML to recpectful HTML + Str_InsertLinks (Description,Cns_MAX_BYTES_TEXT,60); // Insert links fprintf (Gbl.F.Out,"%s
", Att->Hidden ? "DAT_LIGHT" : "DAT", - Txt); + Description); fprintf (Gbl.F.Out,"" ""); @@ -816,7 +816,7 @@ void Att_FreeListAttEvents (void) /***************** Get attendance event text from database *******************/ /*****************************************************************************/ -static void Att_GetAttEventTxtFromDB (long AttCod,char Txt[Cns_MAX_BYTES_TEXT + 1]) +static void Att_GetAttEventDescriptionFromDB (long AttCod,char Description[Cns_MAX_BYTES_TEXT + 1]) { MYSQL_RES *mysql_res; MYSQL_ROW row; @@ -835,11 +835,11 @@ static void Att_GetAttEventTxtFromDB (long AttCod,char Txt[Cns_MAX_BYTES_TEXT + row = mysql_fetch_row (mysql_res); /* Get info text */ - Str_Copy (Txt,row[0], + Str_Copy (Description,row[0], Cns_MAX_BYTES_TEXT); } else - Txt[0] = '\0'; + Description[0] = '\0'; /***** Free structure that stores the query result *****/ DB_FreeMySQLResult (&mysql_res); @@ -1054,7 +1054,7 @@ void Att_RequestCreatOrEditAttEvent (void) extern const char *Txt_Save; struct AttendanceEvent Att; bool ItsANewAttEvent; - char Txt[Cns_MAX_BYTES_TEXT + 1]; + char Description[Cns_MAX_BYTES_TEXT + 1]; /***** Get parameters *****/ Att_GetParamAttOrder (); @@ -1085,7 +1085,7 @@ void Att_RequestCreatOrEditAttEvent (void) Att_GetDataOfAttEventByCodAndCheckCrs (&Att); /* Get text of the attendance event from database */ - Att_GetAttEventTxtFromDB (Att.AttCod,Txt); + Att_GetAttEventDescriptionFromDB (Att.AttCod,Description); } /***** Start form *****/ @@ -1163,7 +1163,7 @@ void Att_RequestCreatOrEditAttEvent (void) " cols=\"60\" rows=\"5\">", The_ClassForm[Gbl.Prefs.Theme],Txt_Description); if (!ItsANewAttEvent) - fprintf (Gbl.F.Out,"%s",Txt); + fprintf (Gbl.F.Out,"%s",Description); fprintf (Gbl.F.Out,"" "" ""); @@ -1257,7 +1257,7 @@ void Att_RecFormAttEvent (void) struct AttendanceEvent ReceivedAtt; bool ItsANewAttEvent; bool ReceivedAttEventIsCorrect = true; - char Txt[Cns_MAX_BYTES_TEXT + 1]; + char Description[Cns_MAX_BYTES_TEXT + 1]; /***** Get the code of the attendance event *****/ ItsANewAttEvent = ((ReceivedAtt.AttCod = Att_GetParamAttCod ()) == -1L); @@ -1280,8 +1280,8 @@ void Att_RecFormAttEvent (void) /***** Get attendance event title *****/ Par_GetParToText ("Title",ReceivedAtt.Title,Att_MAX_BYTES_ATTENDANCE_EVENT_TITLE); - /***** Get attendance event text *****/ - Par_GetParToHTML ("Txt",Txt,Cns_MAX_BYTES_TEXT); // Store in HTML format (not rigorous) + /***** Get attendance event description *****/ + Par_GetParToHTML ("Txt",Description,Cns_MAX_BYTES_TEXT); // Store in HTML format (not rigorous) /***** Adjust dates *****/ if (ReceivedAtt.TimeUTC[Att_START_TIME] == 0) @@ -1317,7 +1317,7 @@ void Att_RecFormAttEvent (void) if (ItsANewAttEvent) { ReceivedAtt.Hidden = false; // New attendance events are visible by default - Att_CreateAttEvent (&ReceivedAtt,Txt); // Add new attendance event to database + Att_CreateAttEvent (&ReceivedAtt,Description); // Add new attendance event to database /***** Write success message *****/ snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), @@ -1327,7 +1327,7 @@ void Att_RecFormAttEvent (void) } else { - Att_UpdateAttEvent (&ReceivedAtt,Txt); + Att_UpdateAttEvent (&ReceivedAtt,Description); /***** Write success message *****/ Ale_ShowAlert (Ale_SUCCESS,Txt_The_event_has_been_modified); @@ -1347,7 +1347,7 @@ void Att_RecFormAttEvent (void) /********************* Create a new attendance event *************************/ /*****************************************************************************/ -void Att_CreateAttEvent (struct AttendanceEvent *Att,const char *Txt) +void Att_CreateAttEvent (struct AttendanceEvent *Att,const char *Description) { /***** Create a new attendance event *****/ Att->AttCod = @@ -1367,7 +1367,7 @@ void Att_CreateAttEvent (struct AttendanceEvent *Att,const char *Txt) Att->CommentTchVisible ? 'Y' : 'N', Att->Title, - Txt); + Description); /***** Create groups *****/ if (Gbl.CurrentCrs.Grps.LstGrpsSel.NumGrps) @@ -1378,7 +1378,7 @@ void Att_CreateAttEvent (struct AttendanceEvent *Att,const char *Txt) /****************** Update an existing attendance event **********************/ /*****************************************************************************/ -void Att_UpdateAttEvent (struct AttendanceEvent *Att,const char *Txt) +void Att_UpdateAttEvent (struct AttendanceEvent *Att,const char *Description) { /***** Update the data of the attendance event *****/ DB_QueryUPDATE ("can not update attendance event", @@ -1395,7 +1395,7 @@ void Att_UpdateAttEvent (struct AttendanceEvent *Att,const char *Txt) Att->CommentTchVisible ? 'Y' : 'N', Att->Title, - Txt, + Description, Att->AttCod,Gbl.CurrentCrs.Crs.CrsCod); /***** Update groups *****/ diff --git a/swad_attendance.h b/swad_attendance.h index b74ec3f3..cc29719f 100644 --- a/swad_attendance.h +++ b/swad_attendance.h @@ -91,8 +91,8 @@ void Att_RemoveAttEventFromDB (long AttCod); void Att_HideAttEvent (void); void Att_ShowAttEvent (void); void Att_RecFormAttEvent (void); -void Att_CreateAttEvent (struct AttendanceEvent *Att,const char *Txt); -void Att_UpdateAttEvent (struct AttendanceEvent *Att,const char *Txt); +void Att_CreateAttEvent (struct AttendanceEvent *Att,const char *Description); +void Att_UpdateAttEvent (struct AttendanceEvent *Att,const char *Description); bool Att_CheckIfAttEventIsAssociatedToGrps (long AttCod); bool Att_CheckIfAttEventIsAssociatedToGrp (long AsgCod,long GrpCod); void Att_RemoveGroupsOfType (long GrpTypCod); diff --git a/swad_changelog.h b/swad_changelog.h index 449d81be..5f28279f 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -34,6 +34,17 @@ Sabia que você pode usar SWAD em portugués? https://swad.ugr.es/pt */ +/*****************************************************************************/ +/****************************** Debug example ********************************/ +/*****************************************************************************/ +/* + DB_QueryINSERT ("can not debug", + "INSERT INTO debug" + " (DebugTime,Txt)" + " VALUES" + " (NOW(),'ActCod = %ld')", + Act_GetActCod (Gbl.Action.Act)); +*/ /*****************************************************************************/ /*********************************** TODO ************************************/ /*****************************************************************************/ @@ -364,7 +375,11 @@ Buenos d // Que haya una opción general que los bloquee todos y que los desbloquee todos // Para bloquear/desbloquear se usará un icono candado // Para preasignado/no preasignado usar otro icono (usuario/usuario tachado, por ej.) - +/* +SHOW TABLE STATUS WHERE Name = 'debug'; +ALTER TABLE debug ENGINE=MyISAM; +OPTIMIZE TABLE debug; +*/ /*****************************************************************************/ /****************************** Public constants *****************************/ /*****************************************************************************/ @@ -384,10 +399,17 @@ En OpenSWAD: ps2pdf source.ps destination.pdf */ -#define Log_PLATFORM_VERSION "SWAD 18.45.4 (2019-02-15)" +#define Log_PLATFORM_VERSION "SWAD 18.46 (2019-02-15)" #define CSS_FILE "swad18.41.1.css" #define JS_FILE "swad18.32.1.js" /* + Version 18.46: Feb 15, 2019 Removed unused code related to tabs. + Fixed bug in actions related to login. + Refactoring code related to alerts. (238468 lines) + 2 changes necessary in database: +UPDATE actions SET Obsolete='Y' WHERE ActCod='34'; +UPDATE actions SET Obsolete='Y' WHERE ActCod='844'; + Version 18.45.4: Feb 15, 2019 Changes in new year greeting. (238431 lines) Version 18.45.3: Feb 15, 2019 Contextual icon to see calendar from holidays. (238434 lines) Version 18.45.2: Feb 15, 2019 Changed holidays icon. (238411 lines) diff --git a/swad_global.h b/swad_global.h index 21b95383..cfda5b2b 100644 --- a/swad_global.h +++ b/swad_global.h @@ -110,7 +110,13 @@ struct Globals Ale_AlertType_t Type; char Txt[Ale_MAX_BYTES_ALERT + 1]; const char *Section; // Where to display the alert - } Alert; // Used in a posteriori function to write success / warning message + } Alert; // TODO: Obsolete -> change progressively + struct + { + Ale_AlertType_t Type; + char Txt[Ale_MAX_BYTES_ALERT + 1]; + const char *Section; // Where to display the alert + } AlertToShowLater; // Used in a posteriori function to write success / warning message struct { size_t ContentLength; diff --git a/swad_mail.c b/swad_mail.c index 984a0e4f..f37248bc 100644 --- a/swad_mail.c +++ b/swad_mail.c @@ -89,7 +89,7 @@ static void Mai_PutHeadMailDomains (void); static void Mai_CreateMailDomain (struct Mail *Mai); static void Mai_ShowFormChangeUsrEmail (const struct UsrData *UsrDat,bool ItsMe, - bool IMustFillEmail,bool IShouldConfirmEmail); + bool IMustFillInEmail,bool IShouldConfirmEmail); static void Mai_RemoveEmail (struct UsrData *UsrDat); static void Mai_RemoveEmailFromDB (long UsrCod,const char Email[Cns_MAX_BYTES_EMAIL_ADDRESS + 1]); @@ -1144,7 +1144,7 @@ long Mai_GetUsrCodFromEmail (const char Email[Cns_MAX_BYTES_EMAIL_ADDRESS + 1]) /*********************** Show form to change my email ************************/ /*****************************************************************************/ -void Mai_ShowFormChangeMyEmail (bool IMustFillEmail,bool IShouldConfirmEmail) +void Mai_ShowFormChangeMyEmail (bool IMustFillInEmail,bool IShouldConfirmEmail) { extern const char *Hlp_PROFILE_Account; extern const char *Txt_Email; @@ -1163,7 +1163,7 @@ void Mai_ShowFormChangeMyEmail (bool IMustFillEmail,bool IShouldConfirmEmail) /***** Show form to change email *****/ Mai_ShowFormChangeUsrEmail (&Gbl.Usrs.Me.UsrDat, true, // ItsMe - IMustFillEmail,IShouldConfirmEmail); + IMustFillInEmail,IShouldConfirmEmail); /***** End box *****/ Box_EndBox (); @@ -1195,7 +1195,7 @@ void Mai_ShowFormChangeOtherUsrEmail (void) /***** Show form to change email *****/ Mai_ShowFormChangeUsrEmail (&Gbl.Usrs.Other.UsrDat, false, // ItsMe - false, // IMustFillEmail + false, // IMustFillInEmail false); // IShouldConfirmEmail /***** End box *****/ @@ -1210,10 +1210,10 @@ void Mai_ShowFormChangeOtherUsrEmail (void) /*****************************************************************************/ static void Mai_ShowFormChangeUsrEmail (const struct UsrData *UsrDat,bool ItsMe, - bool IMustFillEmail,bool IShouldConfirmEmail) + bool IMustFillInEmail,bool IShouldConfirmEmail) { extern const char *The_ClassForm[The_NUM_THEMES]; - extern const char *Txt_Please_fill_in_your_email_address; + extern const char *Txt_Before_going_to_any_other_option_you_must_fill_in_your_email_address; extern const char *Txt_Please_confirm_your_email_address; extern const char *Txt_Current_email; extern const char *Txt_Other_emails; @@ -1236,8 +1236,8 @@ static void Mai_ShowFormChangeUsrEmail (const struct UsrData *UsrDat,bool ItsMe, Ale_ShowAlert (Gbl.Alert.Type,Gbl.Alert.Txt); /***** Help message *****/ - if (IMustFillEmail) - Ale_ShowAlert (Ale_WARNING,Txt_Please_fill_in_your_email_address); + if (IMustFillInEmail) + Ale_ShowAlert (Ale_WARNING,Txt_Before_going_to_any_other_option_you_must_fill_in_your_email_address); else if (IShouldConfirmEmail) Ale_ShowAlert (Ale_WARNING,Txt_Please_confirm_your_email_address); @@ -1291,7 +1291,7 @@ static void Mai_ShowFormChangeUsrEmail (const struct UsrData *UsrDat,bool ItsMe, /* Form to remove email */ if (ItsMe) - Frm_StartFormAnchor (ActRemMaiMe,Mai_EMAIL_SECTION_ID); + Frm_StartFormAnchor (ActRemMyMai,Mai_EMAIL_SECTION_ID); else { switch (UsrDat->Roles.InCurrentCrs.Role) @@ -1337,7 +1337,7 @@ static void Mai_ShowFormChangeUsrEmail (const struct UsrData *UsrDat,bool ItsMe, { fprintf (Gbl.F.Out,"
"); if (ItsMe) - Frm_StartFormAnchor (ActNewMaiMe,Mai_EMAIL_SECTION_ID); + Frm_StartFormAnchor (ActChgMyMai,Mai_EMAIL_SECTION_ID); else { switch (UsrDat->Roles.InCurrentCrs.Role) @@ -1378,7 +1378,7 @@ static void Mai_ShowFormChangeUsrEmail (const struct UsrData *UsrDat,bool ItsMe, NumEmails ? Txt_New_email : // A new email Txt_Email); // The first email if (ItsMe) - Frm_StartFormAnchor (ActNewMaiMe,Mai_EMAIL_SECTION_ID); + Frm_StartFormAnchor (ActChgMyMai,Mai_EMAIL_SECTION_ID); else { switch (UsrDat->Roles.InCurrentCrs.Role) diff --git a/swad_mail.h b/swad_mail.h index ce87cd24..222e3dba 100644 --- a/swad_mail.h +++ b/swad_mail.h @@ -77,7 +77,7 @@ bool Mai_CheckIfEmailIsValid (const char *Email); bool Mai_GetEmailFromUsrCod (struct UsrData *UsrDat); long Mai_GetUsrCodFromEmail (const char Email[Cns_MAX_BYTES_EMAIL_ADDRESS + 1]); -void Mai_ShowFormChangeMyEmail (bool IMustFillEmail,bool IShouldConfirmEmail); +void Mai_ShowFormChangeMyEmail (bool IMustFillInEmail,bool IShouldConfirmEmail); void Mai_ShowFormChangeOtherUsrEmail (void); void Mai_RemoveMyUsrEmail (void); diff --git a/swad_main.c b/swad_main.c index 26a0f7e3..4ed75de7 100644 --- a/swad_main.c +++ b/swad_main.c @@ -108,6 +108,7 @@ int main (void) /***** Read parameters *****/ if (Par_GetQueryString ()) { + /***** Get parameters *****/ Par_CreateListOfParams (); Par_GetMainParameters (); diff --git a/swad_nickname.c b/swad_nickname.c index 465496d0..b2e09960 100644 --- a/swad_nickname.c +++ b/swad_nickname.c @@ -300,7 +300,7 @@ static void Nck_ShowFormChangeUsrNickname (const struct UsrData *UsrDat,bool Its /* Form to remove old nickname */ if (ItsMe) - Frm_StartFormAnchor (ActRemOldNicMe,Nck_NICKNAME_SECTION_ID); + Frm_StartFormAnchor (ActRemMyNck,Nck_NICKNAME_SECTION_ID); else { switch (UsrDat->Roles.InCurrentCrs.Role) @@ -338,7 +338,7 @@ static void Nck_ShowFormChangeUsrNickname (const struct UsrData *UsrDat,bool Its { fprintf (Gbl.F.Out,"
"); if (ItsMe) - Frm_StartFormAnchor (ActChgNicMe,Nck_NICKNAME_SECTION_ID); + Frm_StartFormAnchor (ActChgMyNck,Nck_NICKNAME_SECTION_ID); else { switch (UsrDat->Roles.InCurrentCrs.Role) @@ -380,7 +380,7 @@ static void Nck_ShowFormChangeUsrNickname (const struct UsrData *UsrDat,bool Its NumNicks ? Txt_New_nickname : // A new nickname Txt_Nickname); // The first nickname if (ItsMe) - Frm_StartFormAnchor (ActChgNicMe,Nck_NICKNAME_SECTION_ID); + Frm_StartFormAnchor (ActChgMyNck,Nck_NICKNAME_SECTION_ID); else { switch (UsrDat->Roles.InCurrentCrs.Role) diff --git a/swad_password.c b/swad_password.c index fbb56683..dbefc9ae 100644 --- a/swad_password.c +++ b/swad_password.c @@ -237,7 +237,7 @@ static void Pwd_CheckAndUpdateNewPwd (struct UsrData *UsrDat) NewEncryptedPassword, UsrDat->UsrCod)) // New password is good? { - /* Update user's data */ + /* Update user's data */ Str_Copy (UsrDat->Password,NewEncryptedPassword, Pwd_BYTES_ENCRYPTED_PASSWORD); Ses_UpdateSessionDataInDB (); @@ -529,7 +529,7 @@ bool Pwd_SlowCheckIfPasswordIsGood (const char *PlainPassword, { Gbl.Alert.Type = Ale_WARNING; Gbl.Alert.Section = Pwd_PASSWORD_SECTION_ID; - Str_Copy (Gbl.Alert.Txt,Txt_The_password_is_too_trivial_, + Str_Copy (Gbl.AlertToShowLater.Txt,Txt_The_password_is_too_trivial_, Ale_MAX_BYTES_ALERT); return false; } @@ -540,7 +540,7 @@ bool Pwd_SlowCheckIfPasswordIsGood (const char *PlainPassword, { Gbl.Alert.Type = Ale_WARNING; Gbl.Alert.Section = Pwd_PASSWORD_SECTION_ID; - Str_Copy (Gbl.Alert.Txt,Txt_The_password_is_too_trivial_, + Str_Copy (Gbl.AlertToShowLater.Txt,Txt_The_password_is_too_trivial_, Ale_MAX_BYTES_ALERT); return false; } @@ -674,13 +674,14 @@ void Pwd_ShowFormChgMyPwd (void) extern const char *Txt_Change_password; extern const char *Txt_Set_password; char StrRecordWidth[10 + 1]; + char *Txt; bool IHaveAPasswordInDB = (bool) Gbl.Usrs.Me.UsrDat.Password[0]; /***** Start section *****/ Lay_StartSection (Pwd_PASSWORD_SECTION_ID); /***** Start form *****/ - Frm_StartFormAnchor (ActChgPwd,Pwd_PASSWORD_SECTION_ID); + Frm_StartFormAnchor (ActChgMyPwd,Pwd_PASSWORD_SECTION_ID); /***** Start box *****/ snprintf (StrRecordWidth,sizeof (StrRecordWidth), @@ -690,7 +691,7 @@ void Pwd_ShowFormChgMyPwd (void) Hlp_PROFILE_Password,Box_NOT_CLOSABLE); /***** Show possible alert *****/ - if (Gbl.Alert.Section == (const char *) Pwd_PASSWORD_SECTION_ID) + if (Gbl.Alert.Section == Pwd_PASSWORD_SECTION_ID) Ale_ShowAlert (Gbl.Alert.Type,Gbl.Alert.Txt); /***** Help message *****/ @@ -727,10 +728,11 @@ void Pwd_ShowFormChgMyPwd (void) /***** Help message *****/ fprintf (Gbl.F.Out,"" ""); - snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), - Txt_Your_password_must_be_at_least_X_characters_and_can_not_contain_spaces_, - Pwd_MIN_CHARS_PLAIN_PASSWORD); - Ale_ShowAlert (Ale_INFO,Gbl.Alert.Txt); + if (asprintf (&Txt,Txt_Your_password_must_be_at_least_X_characters_and_can_not_contain_spaces_, + Pwd_MIN_CHARS_PLAIN_PASSWORD) < 0) + Lay_NotEnoughMemoryExit (); + Ale_ShowAlert (Ale_INFO,Txt); + free ((void *) Txt); fprintf (Gbl.F.Out,"" ""); @@ -759,23 +761,27 @@ void Pwd_PutFormToGetNewPasswordOnce (void) extern const char *Txt_Password; extern const char *Txt_HELP_password; - snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), - Txt_HELP_password, - Pwd_MIN_CHARS_PLAIN_PASSWORD); + /***** Start form element ****/ fprintf (Gbl.F.Out,"" "" "" "" "" "" - "" - "", + " size=\"18\" maxlength=\"%u\" placeholder=\"", The_ClassForm[Gbl.Prefs.Theme], Txt_Password, - Pwd_MAX_CHARS_PLAIN_PASSWORD, - Gbl.Alert.Txt); + Pwd_MAX_CHARS_PLAIN_PASSWORD); + + /***** Placeholder *****/ + fprintf (Gbl.F.Out,Txt_HELP_password, + Pwd_MIN_CHARS_PLAIN_PASSWORD); + + /***** End form element ****/ + fprintf (Gbl.F.Out,"\"" + " required=\"required\" />" + "" + ""); } /*****************************************************************************/ @@ -789,9 +795,8 @@ void Pwd_PutFormToGetNewPasswordTwice (void) extern const char *Txt_HELP_password; extern const char *Txt_Retype_new_password; - snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), - Txt_HELP_password, - Pwd_MIN_CHARS_PLAIN_PASSWORD); + /***** 1st password *****/ + /* Start form element */ fprintf (Gbl.F.Out,"" "" "" @@ -799,27 +804,42 @@ void Pwd_PutFormToGetNewPasswordTwice (void) "" "" + " placeholder=\"", + The_ClassForm[Gbl.Prefs.Theme], + Txt_New_password, + Pwd_MAX_CHARS_PLAIN_PASSWORD); + + /* Placeholder */ + fprintf (Gbl.F.Out,Txt_HELP_password, + Pwd_MIN_CHARS_PLAIN_PASSWORD); + + /* End form element */ + fprintf (Gbl.F.Out,"\" required=\"required\" />" "" - "" - "" + ""); + + /***** 2nd password *****/ + /* Start form element */ + fprintf (Gbl.F.Out,"" "" "" "" "" "" - "" - "", - The_ClassForm[Gbl.Prefs.Theme], - Txt_New_password, - Pwd_MAX_CHARS_PLAIN_PASSWORD, - Gbl.Alert.Txt, + " placeholder=\"", The_ClassForm[Gbl.Prefs.Theme], Txt_Retype_new_password, - Pwd_MAX_CHARS_PLAIN_PASSWORD, - Gbl.Alert.Txt); + Pwd_MAX_CHARS_PLAIN_PASSWORD); + + /* Placeholder */ + fprintf (Gbl.F.Out,Txt_HELP_password, + Pwd_MIN_CHARS_PLAIN_PASSWORD); + + /* End form element */ + fprintf (Gbl.F.Out,"\" required=\"required\" />" + "" + ""); } /*****************************************************************************/ diff --git a/swad_tab.c b/swad_tab.c index bb8988bd..a0890202 100644 --- a/swad_tab.c +++ b/swad_tab.c @@ -73,10 +73,6 @@ const char *Tab_TabIcons[Tab_NUM_TABS] = static bool Tab_CheckIfICanViewTab (Tab_Tab_t Tab); static const char *Tab_GetIcon (Tab_Tab_t Tab); -static void Tab_WriteBreadcrumbHome (void); -static void Tab_WriteBreadcrumbTab (void); -static void Tab_WriteBreadcrumbAction (void); - /*****************************************************************************/ /**************** Draw tabs with the current tab highlighted *****************/ /*****************************************************************************/ @@ -211,96 +207,6 @@ static const char *Tab_GetIcon (Tab_Tab_t NumTab) return Ico_GetIcon (Tab_TabIcons[NumTab]); } -/*****************************************************************************/ -/********************* Draw breadcrumb with tab and action *******************/ -/*****************************************************************************/ - -void Tab_DrawBreadcrumb (void) - { - extern const char *The_TabOnBgColors[The_NUM_THEMES]; - extern const char *The_ClassTxtTabOn[The_NUM_THEMES]; - signed int IndexInMenu; - - fprintf (Gbl.F.Out,"
", - The_TabOnBgColors[Gbl.Prefs.Theme]); - - /***** Home *****/ - Tab_WriteBreadcrumbHome (); - - IndexInMenu = Act_GetIndexInMenu (Gbl.Action.Act); - if (Gbl.Action.Act == ActMnu || IndexInMenu >= 0) - { - /***** Tab *****/ - fprintf (Gbl.F.Out," > ", - The_ClassTxtTabOn[Gbl.Prefs.Theme]); - Tab_WriteBreadcrumbTab (); - - if (IndexInMenu >= 0) - { - /***** Menu *****/ - fprintf (Gbl.F.Out," > ", - The_ClassTxtTabOn[Gbl.Prefs.Theme]); - Tab_WriteBreadcrumbAction (); - } - } - - fprintf (Gbl.F.Out,"
"); - } - -/*****************************************************************************/ -/************************ Write home in breadcrumb ***************************/ -/*****************************************************************************/ - -static void Tab_WriteBreadcrumbHome (void) - { - extern const char *The_ClassTxtTabOn[The_NUM_THEMES]; - extern const char *Txt_Home_PAGE; - - Frm_StartForm (ActHom); - Frm_LinkFormSubmit (Txt_Home_PAGE,The_ClassTxtTabOn[Gbl.Prefs.Theme],NULL); - fprintf (Gbl.F.Out,"%s", - Txt_Home_PAGE); - Frm_EndForm (); - } - -/*****************************************************************************/ -/************ Write icon and title associated to the current tab *************/ -/*****************************************************************************/ - -static void Tab_WriteBreadcrumbTab (void) - { - extern const char *The_ClassTxtTabOn[The_NUM_THEMES]; - extern const char *Txt_TABS_TXT[Tab_NUM_TABS]; - - /***** Start form *****/ - Frm_StartForm (ActMnu); - Par_PutHiddenParamUnsigned ("NxtTab",(unsigned) Gbl.Action.Tab); - Frm_LinkFormSubmit (Txt_TABS_TXT[Gbl.Action.Tab],The_ClassTxtTabOn[Gbl.Prefs.Theme],NULL); - - /***** Title and end form *****/ - fprintf (Gbl.F.Out,"%s",Txt_TABS_TXT[Gbl.Action.Tab]); - Frm_EndForm (); - } - -/*****************************************************************************/ -/***************** Write title associated to the current action **************/ -/*****************************************************************************/ - -static void Tab_WriteBreadcrumbAction (void) - { - extern const char *The_ClassTxtTabOn[The_NUM_THEMES]; - const char *Title = Act_GetTitleAction (Gbl.Action.Act); - - /***** Start form *****/ - Frm_StartForm (Act_GetSuperAction (Gbl.Action.Act)); - Frm_LinkFormSubmit (Title,The_ClassTxtTabOn[Gbl.Prefs.Theme],NULL); - - /***** Title and end form *****/ - fprintf (Gbl.F.Out,"%s", - Title); - Frm_EndForm (); - } - /*****************************************************************************/ /*************** Set current tab depending on current action *****************/ /*****************************************************************************/ diff --git a/swad_tab.h b/swad_tab.h index b8c490dd..d512264c 100644 --- a/swad_tab.h +++ b/swad_tab.h @@ -60,7 +60,6 @@ typedef enum /*****************************************************************************/ void Tab_DrawTabs (void); -void Tab_DrawBreadcrumb (void); void Tab_SetCurrentTab (void); void Tab_DisableIncompatibleTabs (void); diff --git a/swad_text.c b/swad_text.c index d54a84ed..794782df 100644 --- a/swad_text.c +++ b/swad_text.c @@ -2841,7 +2841,7 @@ const char *Txt_Before_going_to_any_other_option_you_must_fill_your_nickname = " müssen Sie Ihr Benutzernamen erstellen."; #elif L==3 // en "Before going to any other option" - " you must fill your nickname."; + " you must create your nickname."; #elif L==4 // es "Antes de acceder a cualquier otra opción" " debe crear su apodo."; @@ -2885,13 +2885,43 @@ const char *Txt_Before_going_to_any_other_option_you_must_create_your_password = "Prima di scegliere qualsiasi altra opzione" " devi creare una password."; #elif L==8 // pl - "Przed pójsciem do jakiejkolwiek" - " innej opcji nalezy utworzyć hasło."; + "Przed pójsciem do jakiejkolwiek innej opcji" + " nalezy utworzyć hasło."; #elif L==9 // pt "Antes de ir para qualquer outra opção" "você deve criar sua senha."; #endif +const char *Txt_Before_going_to_any_other_option_you_must_fill_in_your_email_address = +#if L==1 // ca + "Abans d'accedir a qualsevol altra opció" + " ha de omplir la seva adreça de correu."; +#elif L==2 // de + "Bevor ich auf jede andere Option" + " müssen Sie Ihr E-Mail-Adresse ausfüllen."; +#elif L==3 // en + "Before going to any other option" + " you must fill in your email address."; +#elif L==4 // es + "Antes de acceder a cualquier otra opción" + " debe rellenar su dirección de correo."; +#elif L==5 // fr + "Avant d'aller à une autre option" + " vous devez indiquer votre adresse email."; +#elif L==6 // gn + "Antes de acceder a cualquier otra opción" + " debe rellenar su dirección de correo."; // Okoteve traducción +#elif L==7 // it + "Prima di scegliere qualsiasi altra opzione" + " devi inserire il tuo indirizzo email."; +#elif L==8 // pl + "Przed pójsciem do jakiejkolwiek innej opcji" + " wypełnić swój adres e-mail."; +#elif L==9 // pt + "Antes de ir para qualquer outra opção" + "você deve preencher seu endereço de email."; +#endif + const char *Txt_Briefcase_of_THE_USER_X_has_been_removed = // Warning: it is very important to include %s in the following sentences #if L==1 // ca "Se ha eliminado el maletín de %s."; // Necessita traduccio @@ -28675,27 +28705,6 @@ const char *Txt_Please_fill_in_your_department = "Por favor, preencha o seu departamento."; #endif -const char *Txt_Please_fill_in_your_email_address = -#if L==1 // ca - "Si us plau, ompli la seva adreça de correu."; -#elif L==2 // de - "Bitte geben Sie Ihre E-Mail-Adresse ein."; -#elif L==3 // en - "Please fill in your email address."; -#elif L==4 // es - "Por favor, rellene su dirección de correo."; -#elif L==5 // fr - "S'il vous plaít, indiquez votre adresse email."; -#elif L==6 // gn - "Por favor, rellene su dirección de correo."; // Okoteve traducción -#elif L==7 // it - "Per favore, inserisci il tuo indirizzo email."; -#elif L==8 // pl - "Proszę, wpisz swoje w tym adresu email."; -#elif L==9 // pt - "Por favor, preencha o seu endereço de email."; -#endif - const char *Txt_Please_fill_in_your_ID = #if L==1 // ca "Si us plau, ompli el seu ID (DNI/cèdula)."