diff --git a/swad_account.c b/swad_account.c index 95baa35a..d6da00af 100644 --- a/swad_account.c +++ b/swad_account.c @@ -115,12 +115,12 @@ void Acc_ShowFormMyAccount (void) Acc_ShowFormChgMyAccount (); else // Not logged { - /***** Links to other actions *****/ - HTM_DIV_Begin ("class=\"CONTEXT_MENU\""); + /***** Contextual menu *****/ + Mnu_ContextMenuBegin (); Usr_PutLinkToLogin (); Pwd_PutLinkToSendNewPasswd (); Lan_PutLinkToChangeLanguage (); - HTM_DIV_End (); + Mnu_ContextMenuEnd (); /**** Show form to check if I have an account *****/ Acc_ShowFormCheckIfIHaveAccount (Txt_Before_creating_a_new_account_check_if_you_have_been_already_registered); @@ -188,12 +188,12 @@ void Acc_CheckIfEmptyAccountExists (void) MYSQL_RES *mysql_res; MYSQL_ROW row; - /***** Links to other actions *****/ - HTM_DIV_Begin ("class=\"CONTEXT_MENU\""); + /***** Contextual menu *****/ + Mnu_ContextMenuBegin (); Usr_PutLinkToLogin (); Pwd_PutLinkToSendNewPasswd (); Lan_PutLinkToChangeLanguage (); - HTM_DIV_End (); + Mnu_ContextMenuEnd (); /***** Get new user's ID from form *****/ Par_GetParToText ("ID",ID,ID_MAX_BYTES_USR_ID); @@ -324,12 +324,12 @@ static void Acc_WriteRowEmptyAccount (unsigned NumUsr,const char *ID,struct UsrD void Acc_ShowFormCreateMyAccount (void) { - /***** Links to other actions *****/ - HTM_DIV_Begin ("class=\"CONTEXT_MENU\""); + /***** Contextual menu *****/ + Mnu_ContextMenuBegin (); Usr_PutLinkToLogin (); Pwd_PutLinkToSendNewPasswd (); Lan_PutLinkToChangeLanguage (); - HTM_DIV_End (); + Mnu_ContextMenuEnd (); /**** Show form to create a new account *****/ Acc_ShowFormRequestNewAccountWithParams ("",""); diff --git a/swad_attendance.c b/swad_attendance.c index 254adb63..0ebdcd6b 100644 --- a/swad_attendance.c +++ b/swad_attendance.c @@ -166,22 +166,24 @@ void Att_SeeAttEvents (void) /***** Get list of attendance events *****/ Att_GetListAttEvents (Att_NEWEST_FIRST); - /***** Put link to show list of attendance *****/ + /***** Contextual menu *****/ if (Gbl.AttEvents.Num && Gbl.Usrs.Me.UsrDat.Nickname[0]) switch (Gbl.Usrs.Me.Role.Logged) { case Rol_STD: - HTM_DIV_Begin ("class=\"CONTEXT_MENU\""); + /* List my attendance */ + Mnu_ContextMenuBegin (); Att_PutFormToListMyAttendance (); - HTM_DIV_End (); + Mnu_ContextMenuEnd (); break; case Rol_NET: case Rol_TCH: case Rol_SYS_ADM: - HTM_DIV_Begin ("class=\"CONTEXT_MENU\""); + /* List students' attendance */ + Mnu_ContextMenuBegin (); Att_PutFormToListStdsAttendance (); - HTM_DIV_End (); + Mnu_ContextMenuEnd (); break; default: break; diff --git a/swad_changelog.h b/swad_changelog.h index 4ae99239..f79cb610 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -487,7 +487,7 @@ enscript -2 --landscape --color --file-align=2 --highlight --line-numbers -o - * En OpenSWAD: ps2pdf source.ps destination.pdf */ -#define Log_PLATFORM_VERSION "SWAD 19.42.4 (2019-10-23)" +#define Log_PLATFORM_VERSION "SWAD 19.42.5 (2019-10-24)" #define CSS_FILE "swad19.41.3.css" #define JS_FILE "swad19.39.js" /* @@ -495,6 +495,7 @@ ps2pdf source.ps destination.pdf // TODO: Hacer un nuevo rol en los TFG: tutor externo (profesor de áreas no vinculadas con el centro, profesionales de empresas, etc.) // TODO: Change icon to upload file in timeline to photo-video.svg + Version 19.42.5: Oct 24, 2019 Code refactoring in contextual menus. (246011 lines) Version 19.42.4: Oct 23, 2019 Code refactoring in HTML divs. (246016 lines) Version 19.42.3: Oct 23, 2019 Code refactoring in HTML divs. (246052 lines) Version 19.42.2: Oct 23, 2019 Code refactoring in HTML divs. (246025 lines) diff --git a/swad_connected.c b/swad_connected.c index 3982e016..43c06b00 100644 --- a/swad_connected.c +++ b/swad_connected.c @@ -83,12 +83,12 @@ void Con_ShowConnectedUsrs (void) extern const char *Hlp_USERS_Connected; extern const char *Txt_Connected_users; - /***** Link to show last clicks in real time *****/ + /***** Contextual menu *****/ if (Gbl.Usrs.Me.Logged) { - HTM_DIV_Begin ("class=\"CONTEXT_MENU\""); - Sta_PutLinkToLastClicks (); - HTM_DIV_End (); + Mnu_ContextMenuBegin (); + Sta_PutLinkToLastClicks (); // Show last clicks in real time + Mnu_ContextMenuEnd (); } /***** Get scope *****/ diff --git a/swad_course.c b/swad_course.c index 233e1a6c..72999e40 100644 --- a/swad_course.c +++ b/swad_course.c @@ -197,18 +197,15 @@ static void Crs_Configuration (bool PrintView) if (Gbl.Hierarchy.Crs.CrsCod <= 0) // No course selected return; - /***** Messages and links above the box *****/ + /***** Contextual menu *****/ if (!PrintView) - { - /* Link to request enrolment in the current course */ if (Gbl.Usrs.Me.Role.Logged == Rol_GST || Gbl.Usrs.Me.Role.Logged == Rol_USR) { - HTM_DIV_Begin ("class=\"CONTEXT_MENU\""); - Enr_PutLinkToRequestSignUp (); - HTM_DIV_End (); + Mnu_ContextMenuBegin (); + Enr_PutLinkToRequestSignUp (); // Request enrolment in the current course + Mnu_ContextMenuEnd (); } - } /***** Start box *****/ if (PrintView) diff --git a/swad_enrolment.c b/swad_enrolment.c index 42d9f8eb..075b1af3 100644 --- a/swad_enrolment.c +++ b/swad_enrolment.c @@ -667,10 +667,10 @@ static void Enr_ShowFormRegRemSeveralUsrs (Rol_Role_t Role) Act_Action_t NextAction; const char *Title; - /***** Put contextual links *****/ + /***** Contextual menu *****/ if (Gbl.Hierarchy.Level == Hie_CRS) // Course selected { - HTM_DIV_Begin ("class=\"CONTEXT_MENU\""); + Mnu_ContextMenuBegin (); switch (Role) { @@ -697,7 +697,7 @@ static void Enr_ShowFormRegRemSeveralUsrs (Rol_Role_t Role) break; } - HTM_DIV_End (); + Mnu_ContextMenuEnd (); } /***** Form to send students to be enroled / removed *****/ @@ -3083,15 +3083,12 @@ void Enr_ReqRegRemOth (void) void Enr_ReqRegRemStd (void) { + /***** Contextual menu *****/ if (Enr_ICanAdminOtherUsrs[Gbl.Usrs.Me.Role.Logged]) { - /***** Put contextual links *****/ - HTM_DIV_Begin ("class=\"CONTEXT_MENU\""); - - /* Put link to go to admin several students */ - Enr_PutLinkToAdminSeveralUsrs (Rol_STD); - - HTM_DIV_End (); + Mnu_ContextMenuBegin (); + Enr_PutLinkToAdminSeveralUsrs (Rol_STD); // Admin several students + Mnu_ContextMenuEnd (); } /***** Form to request user to be administered *****/ diff --git a/swad_file_browser.c b/swad_file_browser.c index 3f8b8672..c78288c8 100644 --- a/swad_file_browser.c +++ b/swad_file_browser.c @@ -3767,26 +3767,21 @@ static void Brw_WriteTopBeforeShowingFileBrowser (void) /***** Update last access to this file browser *****/ Brw_UpdateLastAccess (); - /***** Write contextual links *****/ - HTM_DIV_Begin ("class=\"CONTEXT_MENU\""); - - /* Put checkbox to show the full tree */ - Brw_PutCheckboxFullTree (); - + /***** Contextual menu *****/ + Mnu_ContextMenuBegin (); + Brw_PutCheckboxFullTree (); // Checkbox to show the full tree if (Brw_GetIfBriefcaseFileBrowser ()) { - /* Put link to remove old files */ if (Gbl.Action.Act != ActReqRemOldBrf) - Brw_PutLinkToAskRemOldFiles (); + Brw_PutLinkToAskRemOldFiles (); // Remove old files } else if (Brw_GetIfCrsAssigWorksFileBrowser ()) { - /* Put link to create a zip file with all the works of the selected users */ if (!Gbl.FileBrowser.ZIP.CreateZIP) - ZIP_PutLinkToCreateZIPAsgWrk (); + ZIP_PutLinkToCreateZIPAsgWrk (); // Create a zip file with the + // works of the selected users } - - HTM_DIV_End (); + Mnu_ContextMenuEnd (); /***** Initialize hidden levels *****/ switch (Gbl.FileBrowser.Type) diff --git a/swad_follow.c b/swad_follow.c index f94be6f6..72b7332f 100644 --- a/swad_follow.c +++ b/swad_follow.c @@ -134,11 +134,11 @@ void Fol_SuggestUsrsToFollowMainZone (void) unsigned long NumUsr; struct UsrData UsrDat; - /***** Put links to request my public profile and another user's profile *****/ - HTM_DIV_Begin ("class=\"CONTEXT_MENU\""); - Prf_PutLinkMyPublicProfile (); - Prf_PutLinkRequestAnotherUserProfile (); - HTM_DIV_End (); + /***** Contextual menu *****/ + Mnu_ContextMenuBegin (); + Prf_PutLinkMyPublicProfile (); // My public profile + Prf_PutLinkRequestAnotherUserProfile (); // Request another user's profile + Mnu_ContextMenuEnd (); /***** Get users *****/ if ((NumUsrs = Fol_GetUsrsToFollow (Fol_MAX_USRS_TO_FOLLOW_MAIN_ZONE, diff --git a/swad_hierarchy.c b/swad_hierarchy.c index 98d34910..1281bb95 100644 --- a/swad_hierarchy.c +++ b/swad_hierarchy.c @@ -64,13 +64,10 @@ extern struct Globals Gbl; void Hie_SeePending (void) { - /***** Put contextual links *****/ - HTM_DIV_Begin ("class=\"CONTEXT_MENU\""); - - /* Put link to remove old courses */ - Crs_PutLinkToRemoveOldCrss (); - - HTM_DIV_End (); + /***** Contextual menu *****/ + Mnu_ContextMenuBegin (); + Crs_PutLinkToRemoveOldCrss (); // Remove old courses + Mnu_ContextMenuEnd (); /***** List countries with pending institutions *****/ Cty_SeeCtyWithPendingInss (); diff --git a/swad_info.c b/swad_info.c index 49e160e9..e0a24eb2 100644 --- a/swad_info.c +++ b/swad_info.c @@ -381,24 +381,27 @@ void Inf_ShowInfo (void) switch (Gbl.Usrs.Me.Role.Logged) { case Rol_STD: - /* Put checkbox to force students to read this couse info */ if (MustBeRead) { - HTM_DIV_Begin ("class=\"CONTEXT_MENU\""); - Inf_PutCheckboxConfirmIHaveReadInfo (); - HTM_DIV_End (); + /***** Contextual menu *****/ + Mnu_ContextMenuBegin (); + Inf_PutCheckboxConfirmIHaveReadInfo (); // Checkbox to confirm that... + // ...I have read this couse info + Mnu_ContextMenuEnd (); } break; case Rol_NET: case Rol_TCH: case Rol_SYS_ADM: - /* Put checkbox to force students to read this couse info */ + /* Put */ if (InfoSrc != Inf_INFO_SRC_NONE) { - HTM_DIV_Begin ("class=\"CONTEXT_MENU\""); + /***** Contextual menu *****/ + Mnu_ContextMenuBegin (); Disabled = (Gbl.Usrs.Me.Role.Logged == Rol_NET); // Non-editing teachers can not change the status of checkbox - Inf_PutCheckboxForceStdsToReadInfo (MustBeRead,Disabled); - HTM_DIV_End (); + Inf_PutCheckboxForceStdsToReadInfo (MustBeRead,Disabled); // Checkbox to force students... + // ...to read this couse info + Mnu_ContextMenuEnd (); } break; default: diff --git a/swad_mail.c b/swad_mail.c index b464331d..7034dd13 100644 --- a/swad_mail.c +++ b/swad_mail.c @@ -988,8 +988,10 @@ static void Mai_ListEmails (void) NumAcceptedUsrsWithEmail); HTM_DIV_End (); - /***** Icon to open the client email program *****/ - HTM_DIV_Begin ("class=\"CONTEXT_MENU\""); + /***** Contextual menu *****/ + Mnu_ContextMenuBegin (); + + /* Open the client email program */ fprintf (Gbl.F.Out,"", Gbl.Usrs.Me.UsrDat.Email, @@ -1001,7 +1003,8 @@ static void Mai_ListEmails (void) Ico_PutIconTextLink ("marker.svg", Txt_Create_email_message); fprintf (Gbl.F.Out,""); - HTM_DIV_End (); + + Mnu_ContextMenuEnd (); /***** End the box used to list the emails *****/ Box_EndBox (); diff --git a/swad_match_result.c b/swad_match_result.c index 6d5ca372..929fa853 100644 --- a/swad_match_result.c +++ b/swad_match_result.c @@ -93,11 +93,12 @@ void McR_PutFormToViewMchResults (Act_Action_t Action) { extern const char *Txt_Results; - HTM_DIV_Begin ("class=\"CONTEXT_MENU\""); + /***** Contextual menu *****/ + Mnu_ContextMenuBegin (); Lay_PutContextualLinkIconText (Action,NULL,NULL, "tasks.svg", - Txt_Results); - HTM_DIV_End (); + Txt_Results); // View match results + Mnu_ContextMenuEnd (); } /*****************************************************************************/ diff --git a/swad_menu.c b/swad_menu.c index 9db0755f..3ecc3b38 100644 --- a/swad_menu.c +++ b/swad_menu.c @@ -485,3 +485,17 @@ Mnu_Menu_t Mnu_GetMenuFromStr (const char *Str) return Mnu_MENU_DEFAULT; } + +/*****************************************************************************/ +/******************************** Context menu *******************************/ +/*****************************************************************************/ + +void Mnu_ContextMenuBegin (void) + { + HTM_DIV_Begin ("class=\"CONTEXT_MENU\""); + } + +void Mnu_ContextMenuEnd (void) + { + HTM_DIV_End (); + } diff --git a/swad_menu.h b/swad_menu.h index ee0d3329..0f1bc2c3 100644 --- a/swad_menu.h +++ b/swad_menu.h @@ -57,4 +57,7 @@ void Mnu_ChangeMenu (void); Mnu_Menu_t Mnu_GetParamMenu (void); Mnu_Menu_t Mnu_GetMenuFromStr (const char *Str); +void Mnu_ContextMenuBegin (void); +void Mnu_ContextMenuEnd (void); + #endif diff --git a/swad_message.c b/swad_message.c index f82a3179..d1e74083 100644 --- a/swad_message.c +++ b/swad_message.c @@ -364,13 +364,14 @@ static void Msg_PutLinkToShowMorePotentialRecipients (void) { extern const char *Txt_Show_more_recipients; - HTM_DIV_Begin ("class=\"CONTEXT_MENU\""); + /***** Contextual menu *****/ + Mnu_ContextMenuBegin (); Lay_PutContextualLinkIconTextOnSubmit (ActReqMsgUsr,NULL, Msg_PutParamsShowMorePotentialRecipients, "users.svg", Txt_Show_more_recipients, - "CopyMessageToHiddenFields();"); - HTM_DIV_End (); + "CopyMessageToHiddenFields();"); // Shor more potential recipients + Mnu_ContextMenuEnd (); } /*****************************************************************************/ @@ -1662,12 +1663,12 @@ void Msg_ShowSntMsgs (void) void Msg_ShowRecMsgs (void) { - /***** Link to view banned users *****/ if (Msg_GetNumUsrsBannedByMe ()) { - HTM_DIV_Begin ("class=\"CONTEXT_MENU\""); - Msg_PutLinkToViewBannedUsers (); - HTM_DIV_End (); + /***** Contextual menu *****/ + Mnu_ContextMenuBegin (); + Msg_PutLinkToViewBannedUsers (); // View banned users + Mnu_ContextMenuEnd (); } /***** Show the received messages *****/ @@ -1766,12 +1767,13 @@ static void Msg_ShowSentOrReceivedMessages (void) HTM_DIV_End (); Msg_ShowFormToFilterMsgs (); - HTM_DIV_Begin ("class=\"CONTEXT_MENU\""); + /***** Contextual menu *****/ + Mnu_ContextMenuBegin (); Frm_LinkFormSubmitAnimated (Txt_Update_messages, The_ClassFormInBoxBold[Gbl.Prefs.Theme], NULL); - Ico_PutCalculateIconWithText (Txt_Update_messages); - HTM_DIV_End (); + Ico_PutCalculateIconWithText (Txt_Update_messages); // Animated icon to update messages + Mnu_ContextMenuEnd (); Frm_EndForm (); diff --git a/swad_notification.c b/swad_notification.c index 80835daa..3509e1d5 100644 --- a/swad_notification.c +++ b/swad_notification.c @@ -358,29 +358,20 @@ void Ntf_ShowMyNotifications (void) " ORDER BY TimeNotif DESC", Gbl.Usrs.Me.UsrDat.UsrCod,SubQuery); - /***** Contextual links *****/ - HTM_DIV_Begin ("class=\"CONTEXT_MENU\""); - - /* Write form to show all notifications */ - Ntf_WriteFormAllNotifications (AllNotifications); - + /***** Contextual menu *****/ + Mnu_ContextMenuBegin (); + Ntf_WriteFormAllNotifications (AllNotifications); // Show all notifications if (NumNotifications) // TODO: Show message only when I don't have notificacions at all - /* Put form to change notification settings */ Lay_PutContextualLinkIconText (ActMrkNtfSee,NULL,NULL, "eye.svg", - Txt_Mark_all_NOTIFICATIONS_as_read); - - /* Put form to change notification settings */ + Txt_Mark_all_NOTIFICATIONS_as_read); // Mark notifications as read Lay_PutContextualLinkIconText (ActReqEdiSet,Ntf_NOTIFICATIONS_ID,NULL, "cog.svg", - Txt_Settings); - - /* Put form to view allowed mail domains */ + Txt_Settings); // Change notification settings Lay_PutContextualLinkIconText (ActSeeMai,NULL,NULL, "envelope.svg", - Txt_Domains); - - HTM_DIV_End (); + Txt_Domains); // View allowed mail domains + Mnu_ContextMenuEnd (); /***** Start box *****/ Box_StartBox (NULL,Txt_Notifications,Ntf_PutIconsNotif, diff --git a/swad_photo.c b/swad_photo.c index f602758a..a67ec052 100644 --- a/swad_photo.c +++ b/swad_photo.c @@ -2010,10 +2010,10 @@ static void Pho_PutLinkToCalculateDegreeStats (void) /***** Get data of the degree from database *****/ Deg_GetDataOfDegreeByCod (&Deg); - /***** Start div *****/ - HTM_DIV_Begin ("class=\"CONTEXT_MENU\""); + /***** Contextual menu *****/ + Mnu_ContextMenuBegin (); - /***** Begin form *****/ + /* Begin form */ Frm_StartForm (ActCalPhoDeg); Pho_PutHiddenParamTypeOfAvg (); Pho_PutHiddenParamPhotoSize (); @@ -2024,7 +2024,7 @@ static void Pho_PutLinkToCalculateDegreeStats (void) NULL); Ico_PutCalculateIconWithText (Txt_Calculate_average_photo_of_THE_DEGREE_X); - /***** Put selector with all the degrees with students *****/ + /* Selector with all the degrees with students */ fprintf (Gbl.F.Out,""); + + /* End form and contextual menu */ Frm_EndForm (); - HTM_DIV_End (); + Mnu_ContextMenuEnd (); /***** Free list of all the degrees with students *****/ Deg_FreeListDegs (&Degs); diff --git a/swad_profile.c b/swad_profile.c index 30287193..e79327ce 100644 --- a/swad_profile.c +++ b/swad_profile.c @@ -187,11 +187,11 @@ void Prf_RequestUserProfile (void) if (Gbl.Usrs.Me.Logged) { - /***** Put link to show my public profile and users to follow *****/ - HTM_DIV_Begin ("class=\"CONTEXT_MENU\""); - Prf_PutLinkMyPublicProfile (); - Fol_PutLinkWhoToFollow (); - HTM_DIV_End (); + /***** Contextual menu *****/ + Mnu_ContextMenuBegin (); + Prf_PutLinkMyPublicProfile (); // My public profile + Fol_PutLinkWhoToFollow (); // Users to follow + Mnu_ContextMenuEnd (); } /***** Begin form *****/ @@ -285,22 +285,16 @@ bool Prf_ShowUserProfile (struct UsrData *UsrDat) /***** Check if I can see the public profile *****/ if (Pri_ShowingIsAllowed (UsrDat->BaPrfVisibility,UsrDat)) { - /***** Contextual links *****/ if (Gbl.Usrs.Me.Logged) { - HTM_DIV_Begin ("class=\"CONTEXT_MENU\""); - + /***** Contextual menu *****/ + Mnu_ContextMenuBegin (); if (ItsMe) - /* Put link to show another user's profile */ - Prf_PutLinkRequestAnotherUserProfile (); + Prf_PutLinkRequestAnotherUserProfile (); // Request another user's profile else // Not me - /* Put link to show my public profile */ - Prf_PutLinkMyPublicProfile (); - - /* Put link to show users to follow */ - Fol_PutLinkWhoToFollow (); - - HTM_DIV_End (); + Prf_PutLinkMyPublicProfile (); // My public profile + Fol_PutLinkWhoToFollow (); // Users to follow + Mnu_ContextMenuEnd (); } /***** Shared record card *****/ diff --git a/swad_record.c b/swad_record.c index 48473ed3..213d8bc2 100644 --- a/swad_record.c +++ b/swad_record.c @@ -976,15 +976,16 @@ static void Rec_ListRecordsGsts (Rec_SharedRecordViewType_t TypeOfView) if (TypeOfView == Rec_SHA_RECORD_LIST) // Listing several records { - HTM_DIV_Begin ("class=\"CONTEXT_MENU\""); + /***** Contextual menu *****/ + Mnu_ContextMenuBegin (); - /* Link to print view */ + /* Print view */ Frm_StartForm (ActPrnRecSevGst); Usr_PutHiddenParSelectedUsrsCods (); Rec_ShowLinkToPrintPreviewOfRecords (); Frm_EndForm (); - HTM_DIV_End (); + Mnu_ContextMenuEnd (); } /***** Initialize structure with user's data *****/ @@ -1070,14 +1071,14 @@ static void Rec_ShowRecordOneStdCrs (void) /***** Get list of fields of records in current course *****/ Rec_GetListRecordFieldsInCurrentCrs (); - /***** Put contextual links *****/ - HTM_DIV_Begin ("class=\"CONTEXT_MENU\""); + /***** Contextual menu *****/ + Mnu_ContextMenuBegin (); - /* Link to edit record fields */ + /* Edit record fields */ if (Gbl.Usrs.Me.Role.Logged == Rol_TCH) Rec_PutLinkToEditRecordFields (); - /* Link to print view */ + /* Print view */ Frm_StartForm (ActPrnRecSevStd); Usr_CreateListSelectedUsrsCodsAndFillWithOtherUsr (); Usr_PutHiddenParSelectedUsrsCods (); @@ -1085,7 +1086,7 @@ static void Rec_ShowRecordOneStdCrs (void) Rec_ShowLinkToPrintPreviewOfRecords (); Frm_EndForm (); - HTM_DIV_End (); + Mnu_ContextMenuEnd (); /***** Show optional alert (result of editing data in course record) *****/ Ale_ShowAlerts (NULL); @@ -1174,19 +1175,20 @@ static void Rec_ListRecordsStds (Rec_SharedRecordViewType_t ShaTypeOfView, if (ShaTypeOfView == Rec_SHA_RECORD_LIST) { - HTM_DIV_Begin ("class=\"CONTEXT_MENU\""); + /***** Contextual menu *****/ + Mnu_ContextMenuBegin (); - /* Link to edit record fields */ + /* Edit record fields */ if (Gbl.Usrs.Me.Role.Logged == Rol_TCH) Rec_PutLinkToEditRecordFields (); - /* Link to print view */ + /* Print view */ Frm_StartForm (ActPrnRecSevStd); Usr_PutHiddenParSelectedUsrsCods (); Rec_ShowLinkToPrintPreviewOfRecords (); Frm_EndForm (); - HTM_DIV_End (); + Mnu_ContextMenuEnd (); } /***** Initialize structure with user's data *****/ @@ -1302,13 +1304,13 @@ static void Rec_ShowRecordOneTchCrs (void) /***** Get if I want to see teachers' office hours in teachers' records *****/ ShowOfficeHours = Rec_GetParamShowOfficeHours (); - /***** Show contextual menu *****/ - HTM_DIV_Begin ("class=\"CONTEXT_MENU\""); + /***** Contextual menu *****/ + Mnu_ContextMenuBegin (); /* Show office hours? */ Rec_WriteFormShowOfficeHoursOneTch (ShowOfficeHours); - /* Link to print view */ + /* Print view */ Frm_StartForm (ActPrnRecSevTch); Usr_CreateListSelectedUsrsCodsAndFillWithOtherUsr (); Usr_PutHiddenParSelectedUsrsCods (); @@ -1319,7 +1321,7 @@ static void Rec_ShowRecordOneTchCrs (void) Rec_ShowLinkToPrintPreviewOfRecords (); Frm_EndForm (); - HTM_DIV_End (); + Mnu_ContextMenuEnd (); /***** Start container for this user *****/ HTM_DIV_Begin ("class=\"REC_USR\""); @@ -1392,13 +1394,13 @@ static void Rec_ListRecordsTchs (Rec_SharedRecordViewType_t TypeOfView) if (Gbl.Action.Act == ActSeeRecSevTch) { - /***** Show contextual menu *****/ - HTM_DIV_Begin ("class=\"CONTEXT_MENU\""); + /***** Contextual menu *****/ + Mnu_ContextMenuBegin (); /* Show office hours? */ Rec_WriteFormShowOfficeHoursSeveralTchs (ShowOfficeHours); - /* Link to print view */ + /* Print view */ Frm_StartForm (ActPrnRecSevTch); Usr_PutHiddenParSelectedUsrsCods (); Par_PutHiddenParamChar ("ParamOfficeHours",'Y'); @@ -1408,7 +1410,7 @@ static void Rec_ListRecordsTchs (Rec_SharedRecordViewType_t TypeOfView) Rec_ShowLinkToPrintPreviewOfRecords (); Frm_EndForm (); - HTM_DIV_End (); + Mnu_ContextMenuEnd (); } /***** Initialize structure with user's data *****/ diff --git a/swad_statistic.c b/swad_statistic.c index 4fafb62a..29a08592 100644 --- a/swad_statistic.c +++ b/swad_statistic.c @@ -315,16 +315,11 @@ void Sta_AskShowCrsHits (void) Sta_ClicksGroupedBy_t ClicksGroupedBy; unsigned long i; - /***** Contextual links *****/ - HTM_DIV_Begin ("class=\"CONTEXT_MENU\""); - - /* Put form to go to test edition and configuration */ - Sta_PutLinkToGlobalHits (); - - /* Link to show last clicks in real time */ - Sta_PutLinkToLastClicks (); - - HTM_DIV_End (); + /***** Contextual menu *****/ + Mnu_ContextMenuBegin (); + Sta_PutLinkToGlobalHits (); // Global hits + Sta_PutLinkToLastClicks (); // Last clicks in real time + Mnu_ContextMenuEnd (); /***** Get and update type of list, number of columns in class photo @@ -522,16 +517,11 @@ void Sta_AskShowGblHits (void) Sta_Role_t RoleStat; Sta_ClicksGroupedBy_t ClicksGroupedBy; - /***** Contextual links *****/ - HTM_DIV_Begin ("class=\"CONTEXT_MENU\""); - - /* Put form to go to test edition and configuration */ - Sta_PutLinkToCourseHits (); - - /* Link to show last clicks in real time */ - Sta_PutLinkToLastClicks (); - - HTM_DIV_End (); + /***** Contextual menu *****/ + Mnu_ContextMenuBegin (); + Sta_PutLinkToCourseHits (); // Course hits + Sta_PutLinkToLastClicks (); // Last clicks in real time + Mnu_ContextMenuEnd (); /***** Begin form *****/ Frm_StartFormAnchor (ActSeeAccGbl,Sta_STAT_RESULTS_SECTION_ID); @@ -3994,16 +3984,11 @@ void Sta_ShowLastClicks (void) extern const char *Hlp_USERS_Connected_last_clicks; extern const char *Txt_Last_clicks_in_real_time; - /***** Contextual links *****/ - HTM_DIV_Begin ("class=\"CONTEXT_MENU\""); - - /* Put form to go to test edition and configuration */ - Sta_PutLinkToGlobalHits (); - - /* Put form to go to test edition and configuration */ - Sta_PutLinkToCourseHits (); - - HTM_DIV_End (); + /***** Contextual menu *****/ + Mnu_ContextMenuBegin (); + Sta_PutLinkToGlobalHits (); // Global hits + Sta_PutLinkToCourseHits (); // Course hits + Mnu_ContextMenuEnd (); /***** Start box *****/ Box_StartBox (NULL,Txt_Last_clicks_in_real_time,NULL, diff --git a/swad_test.c b/swad_test.c index 84fd063d..5d7f685a 100644 --- a/swad_test.c +++ b/swad_test.c @@ -405,11 +405,12 @@ static void Tst_PutFormToViewTstResults (Act_Action_t Action) { extern const char *Txt_Results; - HTM_DIV_Begin ("class=\"CONTEXT_MENU\""); + /***** Contextual menu *****/ + Mnu_ContextMenuBegin (); Lay_PutContextualLinkIconText (Action,NULL,NULL, "tasks.svg", - Txt_Results); - HTM_DIV_End (); + Txt_Results); // Tests results + Mnu_ContextMenuEnd (); } /*****************************************************************************/ @@ -1285,9 +1286,9 @@ void Tst_ShowFormAskEditTsts (void) unsigned long NumRows; /***** Contextual menu *****/ - HTM_DIV_Begin ("class=\"CONTEXT_MENU\""); - TsI_PutFormToImportQuestions (); // Put link (form) to import questions from XML file - HTM_DIV_End (); + Mnu_ContextMenuBegin (); + TsI_PutFormToImportQuestions (); // Import questions from XML file + Mnu_ContextMenuEnd (); /***** Start box *****/ Box_StartBox (NULL,Txt_List_edit_questions,Tst_PutIconsTests, @@ -2403,16 +2404,14 @@ void Tst_ListQuestionsToEdit (void) { if ((NumRows = Tst_GetQuestions (&mysql_res)) != 0) // Query database { - /* Buttons for edition */ - HTM_DIV_Begin ("class=\"CONTEXT_MENU\""); + /***** Contextual menu *****/ + Mnu_ContextMenuBegin (); if (Gbl.Test.XML.CreateXML) - /* Create XML file for exporting questions - and put a link to download it */ - TsI_CreateXML (NumRows,mysql_res); + TsI_CreateXML (NumRows,mysql_res); // Create XML file with exported questions... + // ...and put a link to download it else - /* Button to export questions */ - TsI_PutFormToExportQuestions (); - HTM_DIV_End (); + TsI_PutFormToExportQuestions (); // Export questions + Mnu_ContextMenuEnd (); /* Show the table with the questions */ Tst_ListOneOrMoreQuestionsForEdition (NumRows,mysql_res); diff --git a/swad_timeline.c b/swad_timeline.c index 37f1c78a..94e4f70d 100644 --- a/swad_timeline.c +++ b/swad_timeline.c @@ -1287,10 +1287,10 @@ static void TL_ShowWarningYouDontFollowAnyUser (void) /***** Show warning if I do not follow anyone *****/ Ale_ShowAlert (Ale_WARNING,Txt_You_dont_follow_any_user); - /***** Put link to show users to follow *****/ - HTM_DIV_Begin ("class=\"CONTEXT_MENU\""); - Fol_PutLinkWhoToFollow (); - HTM_DIV_End (); + /***** Contextual menu *****/ + Mnu_ContextMenuBegin (); + Fol_PutLinkWhoToFollow (); // Users to follow + Mnu_ContextMenuEnd (); } } diff --git a/swad_user.c b/swad_user.c index 02dcabe3..2ac6b2ce 100644 --- a/swad_user.c +++ b/swad_user.c @@ -2587,14 +2587,12 @@ void Usr_WriteFormLogin (Act_Action_t NextAction,void (*FuncParams) (void)) extern const char *Txt_Password; extern const char *Txt_password; - /***** Links to other actions *****/ - HTM_DIV_Begin ("class=\"CONTEXT_MENU\""); - - Acc_PutLinkToCreateAccount (); - Pwd_PutLinkToSendNewPasswd (); - Lan_PutLinkToChangeLanguage (); - - HTM_DIV_End (); + /***** Contextual menu *****/ + Mnu_ContextMenuBegin (); + Acc_PutLinkToCreateAccount (); // Create account + Pwd_PutLinkToSendNewPasswd (); // Send new password + Lan_PutLinkToChangeLanguage (); // Change language + Mnu_ContextMenuEnd (); HTM_DIV_Begin ("class=\"CM\""); @@ -7296,25 +7294,17 @@ void Usr_ListDataAdms (void) case Rol_CTR_ADM: case Rol_INS_ADM: case Rol_SYS_ADM: - HTM_DIV_Begin ("class=\"CONTEXT_MENU\""); - + /***** Contextual menu *****/ + Mnu_ContextMenuBegin (); if (Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM) { - /* Put link to remove old users */ - Usr_PutLinkToSeeGuests (); - - /* Put link to list possible duplicate users */ - Dup_PutLinkToListDupUsrs (); + Usr_PutLinkToSeeGuests (); // List guests + Dup_PutLinkToListDupUsrs (); // List possible duplicate users } - - /* Put link to go to admin one user */ - Enr_PutLinkToAdminOneUsr (ActReqMdfOneOth); - + Enr_PutLinkToAdminOneUsr (ActReqMdfOneOth); // Admin one user if (Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM) - /* Put link to remove old users */ - Enr_PutLinkToRemOldUsrs (); - - HTM_DIV_End (); + Enr_PutLinkToRemOldUsrs (); // Remove old users + Mnu_ContextMenuEnd (); break; default: break; @@ -7791,20 +7781,13 @@ void Usr_SeeGuests (void) bool ICanChooseOption[Usr_LIST_USRS_NUM_OPTIONS]; bool PutForm; - /***** Put contextual links *****/ - HTM_DIV_Begin ("class=\"CONTEXT_MENU\""); - - /* Put link to remove old users */ - Usr_PutLinkToSeeAdmins (); - - /* Put link to go to admin one user */ - Enr_PutLinkToAdminOneUsr (ActReqMdfOneOth); - + /***** Contextual menu *****/ + Mnu_ContextMenuBegin (); + Usr_PutLinkToSeeAdmins (); // List admins + Enr_PutLinkToAdminOneUsr (ActReqMdfOneOth); // Admin one user if (Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM) - /* Put link to remove old users */ - Enr_PutLinkToRemOldUsrs (); - - HTM_DIV_End (); + Enr_PutLinkToRemOldUsrs (); // Remove old users + Mnu_ContextMenuEnd (); /***** Get and update type of list, number of columns in class photo @@ -7928,22 +7911,16 @@ void Usr_SeeStudents (void) case Rol_CTR_ADM: case Rol_INS_ADM: case Rol_SYS_ADM: - HTM_DIV_Begin ("class=\"CONTEXT_MENU\""); - - /* Put link to go to admin student */ - Enr_PutLinkToAdminOneUsr (ActReqMdfOneStd); - + /***** Contextual menu *****/ + Mnu_ContextMenuBegin (); + Enr_PutLinkToAdminOneUsr (ActReqMdfOneStd); // Admin one student if (Gbl.Hierarchy.Level == Hie_CRS && // Course selected Gbl.Usrs.Me.Role.Logged != Rol_STD) // Teacher or admin { - /* Put link to go to admin several students */ - Enr_PutLinkToAdminSeveralUsrs (Rol_STD); - - /* Put link to edit record fields */ - Rec_PutLinkToEditRecordFields (); + Enr_PutLinkToAdminSeveralUsrs (Rol_STD); // Admin several students + Rec_PutLinkToEditRecordFields (); // Edit record fields } - - HTM_DIV_End (); + Mnu_ContextMenuEnd (); break; default: break; @@ -8099,21 +8076,16 @@ void Usr_SeeTeachers (void) case Rol_CTR_ADM: case Rol_INS_ADM: case Rol_SYS_ADM: - HTM_DIV_Begin ("class=\"CONTEXT_MENU\""); - - /* Put link to go to admin one user */ - Enr_PutLinkToAdminOneUsr (ActReqMdfOneTch); - - /* Put link to go to admin several users */ + /***** Contextual menu *****/ + Mnu_ContextMenuBegin (); + Enr_PutLinkToAdminOneUsr (ActReqMdfOneTch); // Admin one teacher if (Gbl.Hierarchy.Level == Hie_CRS && // Course selected Gbl.Usrs.Me.Role.Logged >= Rol_DEG_ADM) // I am logged as admin { - Enr_PutLinkToAdminSeveralUsrs (Rol_NET); - Enr_PutLinkToAdminSeveralUsrs (Rol_TCH); + Enr_PutLinkToAdminSeveralUsrs (Rol_NET); // Admin several non-editing teachers + Enr_PutLinkToAdminSeveralUsrs (Rol_TCH); // Admin several teachers } - - HTM_DIV_End (); - + Mnu_ContextMenuEnd (); break; default: break;