diff --git a/swad_attendance.c b/swad_attendance.c index b5d72b439..1d10cf094 100644 --- a/swad_attendance.c +++ b/swad_attendance.c @@ -1928,10 +1928,10 @@ static void Att_ListAttStudents (struct AttendanceEvent *Att) Lay_StartRoundFrame (NULL,Txt_Attendance,NULL,Hlp_USERS_Attendance); /***** Form to select groups *****/ - Grp_ShowFormToSelectSeveralGroups (ActSeeOneAtt,"user_list"); + Grp_ShowFormToSelectSeveralGroups (ActSeeOneAtt); /***** Start section with user list *****/ - fprintf (Gbl.F.Out,"
"); + Lay_StartSection (Usr_USER_LIST_SECTION_ID); if (Gbl.Usrs.LstUsrs[Rol_STD].NumUsrs) { @@ -1998,7 +1998,7 @@ static void Att_ListAttStudents (struct AttendanceEvent *Att) Usr_ShowWarningNoUsersFound (Rol_STD); /***** End section with user list *****/ - fprintf (Gbl.F.Out,"
"); + Lay_EndSection (); /***** End frame *****/ Lay_EndRoundFrame (); @@ -2664,10 +2664,10 @@ void Usr_ReqListStdsAttendanceCrs (void) NULL,Hlp_USERS_Attendance_attendance_list); /***** Form to select groups *****/ - Grp_ShowFormToSelectSeveralGroups (ActReqLstStdAtt,"user_list"); + Grp_ShowFormToSelectSeveralGroups (ActReqLstStdAtt); /***** Start section with user list *****/ - fprintf (Gbl.F.Out,"
"); + Lay_StartSection (Usr_USER_LIST_SECTION_ID); if (Gbl.Usrs.LstUsrs[Rol_STD].NumUsrs) { @@ -2703,7 +2703,7 @@ void Usr_ReqListStdsAttendanceCrs (void) Usr_ShowWarningNoUsersFound (Rol_STD); /***** End section with user list *****/ - fprintf (Gbl.F.Out,"
"); + Lay_EndSection (); /***** End frame *****/ Lay_EndRoundFrame (); diff --git a/swad_changelog.h b/swad_changelog.h index 0845f21d8..e655e8c72 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -237,13 +237,14 @@ /****************************** Public constants *****************************/ /*****************************************************************************/ -#define Log_PLATFORM_VERSION "SWAD 16.223.2 (2017-05-25)" +#define Log_PLATFORM_VERSION "SWAD 16.224 (2017-05-25)" #define CSS_FILE "swad16.222.css" #define JS_FILE "swad16.206.3.js" // Number of lines (includes comments but not blank lines) has been got with the following command: // nl swad*.c swad*.h css/swad*.css py/swad*.py js/swad*.js soap/swad*?.h sql/swad*.sql | tail -1 /* + Version 16.224: May 25, 2017 Code refactoring related to sections. (220459 lines) Version 16.223.2: May 25, 2017 User lists are shown when clicking on "Update students". (220435 lines) Version 16.223.1: May 25, 2017 Alerts closable or not depending on their type. (220400 lines) Version 16.223: May 24, 2017 Changes in lists of users related with new role. (220384 lines) diff --git a/swad_file_browser.c b/swad_file_browser.c index 0c4487410..21bf27172 100644 --- a/swad_file_browser.c +++ b/swad_file_browser.c @@ -3120,10 +3120,10 @@ void Brw_AskEditWorksCrs (void) NULL,Hlp_FILES_Homework_for_teachers); /***** Show form to select the groups *****/ - Grp_ShowFormToSelectSeveralGroups (ActReqAsgWrkCrs,"user_list"); + Grp_ShowFormToSelectSeveralGroups (ActReqAsgWrkCrs); /***** Start section with user list *****/ - fprintf (Gbl.F.Out,"
"); + Lay_StartSection (Usr_USER_LIST_SECTION_ID); if (NumTotalUsrs) { @@ -3156,7 +3156,7 @@ void Brw_AskEditWorksCrs (void) Usr_ShowWarningNoUsersFound (Rol_UNK); /***** End section with user list *****/ - fprintf (Gbl.F.Out,"
"); + Lay_EndSection (); /***** End frame *****/ Lay_EndRoundFrame (); @@ -3549,6 +3549,7 @@ static void Brw_ShowFileBrowser (void) const char *Brw_TitleOfFileBrowser[Brw_NUM_TYPES_FILE_BROWSER]; const char *Brw_HelpOfFileBrowser[Brw_NUM_TYPES_FILE_BROWSER]; struct Brw_NumObjects Removed; + char FileBrowserSectionId[32]; bool IAmTeacherOrSysAdm = Gbl.Usrs.Me.LoggedRole == Rol_TCH || Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM; @@ -3676,7 +3677,8 @@ static void Brw_ShowFileBrowser (void) /***** Start frame *****/ Gbl.FileBrowser.Id++; - fprintf (Gbl.F.Out,"
",Gbl.FileBrowser.Id); + sprintf (FileBrowserSectionId,"file_browser_%u",Gbl.FileBrowser.Id); + Lay_StartSection (FileBrowserSectionId); Lay_StartRoundFrame ("100%",Brw_TitleOfFileBrowser[Gbl.FileBrowser.Type], Brw_PutIconsFileBrowser, Brw_HelpOfFileBrowser[Gbl.FileBrowser.Type]); @@ -3700,7 +3702,7 @@ static void Brw_ShowFileBrowser (void) /***** End of frame *****/ Lay_EndRoundFrame (); - fprintf (Gbl.F.Out,"
"); + Lay_EndSection (); } /*****************************************************************************/ @@ -5628,7 +5630,7 @@ static void Brw_IndentAndWriteIconExpandContract (unsigned Level,Brw_ExpandTree_ { extern const char *Txt_Expand; extern const char *Txt_Contract; - char Anchor[32]; + char FileBrowserId[32]; fprintf (Gbl.F.Out,"" "" @@ -5646,8 +5648,8 @@ static void Brw_IndentAndWriteIconExpandContract (unsigned Level,Brw_ExpandTree_ break; case Brw_EXPAND_TREE_PLUS: /***** Form to expand folder *****/ - sprintf (Anchor,"file_browser_%u",Gbl.FileBrowser.Id); - Act_FormStartAnchor (Brw_ActExpandFolder[Gbl.FileBrowser.Type],Anchor); + sprintf (FileBrowserId,"file_browser_%u",Gbl.FileBrowser.Id); + Act_FormStartAnchor (Brw_ActExpandFolder[Gbl.FileBrowser.Type],FileBrowserId); Brw_PutParamsFileBrowser (Brw_ActExpandFolder[Gbl.FileBrowser.Type], PathInTree,FileName, Brw_IS_FOLDER,-1L); @@ -5659,12 +5661,12 @@ static void Brw_IndentAndWriteIconExpandContract (unsigned Level,Brw_ExpandTree_ Gbl.Title, Gbl.Title); Act_FormEnd (); - fprintf (Gbl.F.Out,""); + Lay_EndSection (); break; case Brw_EXPAND_TREE_MINUS: /***** Form to contract folder *****/ - sprintf (Anchor,"file_browser_%u",Gbl.FileBrowser.Id); - Act_FormStartAnchor (Brw_ActContractFolder[Gbl.FileBrowser.Type],Anchor); + sprintf (FileBrowserId,"file_browser_%u",Gbl.FileBrowser.Id); + Act_FormStartAnchor (Brw_ActContractFolder[Gbl.FileBrowser.Type],FileBrowserId); Brw_PutParamsFileBrowser (Brw_ActContractFolder[Gbl.FileBrowser.Type], PathInTree,FileName, Brw_IS_FOLDER,-1L); @@ -5676,7 +5678,7 @@ static void Brw_IndentAndWriteIconExpandContract (unsigned Level,Brw_ExpandTree_ Gbl.Title, Gbl.Title); Act_FormEnd (); - fprintf (Gbl.F.Out,""); + Lay_EndSection (); break; } diff --git a/swad_follow.c b/swad_follow.c index 5ea87cba1..2aaa7ab03 100644 --- a/swad_follow.c +++ b/swad_follow.c @@ -47,6 +47,8 @@ #define Fol_NUM_COLUMNS_FOLLOW 3 +#define Fol_FOLLOW_SECTION_ID "follow_section" + /*****************************************************************************/ /****************************** Internal types *******************************/ /*****************************************************************************/ @@ -497,7 +499,7 @@ void Fol_ShowFollowingAndFollowers (const struct UsrData *UsrDat, bool ItsMe = (UsrDat->UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod); /***** Start section *****/ - fprintf (Gbl.F.Out,"
"); + Lay_StartSection (Fol_FOLLOW_SECTION_ID); /***** Followed users *****/ fprintf (Gbl.F.Out,"
" @@ -571,7 +573,7 @@ void Fol_ShowFollowingAndFollowers (const struct UsrData *UsrDat, "
"); /***** End section *****/ - fprintf (Gbl.F.Out,"
"); + Lay_EndSection (); } /*****************************************************************************/ @@ -593,7 +595,7 @@ static void Fol_ShowNumberOfFollowingOrFollowers (const struct UsrData *UsrDat, if (NumUsrs) { /* Form to list users */ - Act_FormStartAnchor (Action,"follow_section"); + Act_FormStartAnchor (Action,Fol_FOLLOW_SECTION_ID); Usr_PutParamUsrCodEncrypted (UsrDat->EncryptedUsrCod); Act_LinkFormSubmit (Title, (Gbl.Action.Act == Action) ? "FOLLOW_NUM_B" : @@ -619,7 +621,7 @@ static void Fol_ShowNumberOfFollowingOrFollowers (const struct UsrData *UsrDat, if (NumUsrs) { /* Form to list users */ - Act_FormStartAnchor (Action,"follow_section"); + Act_FormStartAnchor (Action,Fol_FOLLOW_SECTION_ID); Usr_PutParamUsrCodEncrypted (UsrDat->EncryptedUsrCod); Act_LinkFormSubmit (Title, (Gbl.Action.Act == Action) ? The_ClassFormBold[Gbl.Prefs.Theme] : diff --git a/swad_forum.c b/swad_forum.c index 827517ea4..d188a0f8d 100644 --- a/swad_forum.c +++ b/swad_forum.c @@ -251,11 +251,11 @@ const Act_Action_t For_ActionsDisPstFor[For_NUM_TYPES_FORUM] = }; // Links to go to
-#define For_ID_REMOVE_THREAD_SECTION "remove_thread" -#define For_ID_FORUM_THREADS_SECTION "forum_threads" -#define For_ID_NEW_THREAD_SECTION "new_thread" -#define For_ID_FORUM_POSTS_SECTION "thread_posts" -#define For_ID_NEW_POST_SECTION "new_post" +#define For_REMOVE_THREAD_SECTION_ID "remove_thread" +#define For_FORUM_THREADS_SECTION_ID "forum_threads" +#define For_NEW_THREAD_SECTION_ID "new_thread" +#define For_FORUM_POSTS_SECTION_ID "thread_posts" +#define For_NEW_POST_SECTION_ID "new_post" // Forum images will be saved with: // - maximum width of For_IMAGE_SAVED_MAX_HEIGHT @@ -1001,7 +1001,7 @@ static void For_ShowPostsOfAThread (Ale_AlertType_t AlertType,const char *Messag ReadTimeUTC = For_GetThrReadTime (Gbl.Forum.ForumSelected.ThrCod); /***** Show alert after action *****/ - fprintf (Gbl.F.Out,"
",For_ID_FORUM_POSTS_SECTION); + Lay_StartSection (For_FORUM_POSTS_SECTION_ID); if (Message) if (Message[0]) Ale_ShowAlert (AlertType,Message); @@ -1055,7 +1055,7 @@ static void For_ShowPostsOfAThread (Ale_AlertType_t AlertType,const char *Messag PaginationPsts.NumItems = NumPsts; PaginationPsts.CurrentPage = (int) Gbl.Forum.CurrentPagePsts; Pag_CalculatePagination (&PaginationPsts); - PaginationPsts.Anchor = For_ID_FORUM_POSTS_SECTION; + PaginationPsts.Anchor = For_FORUM_POSTS_SECTION_ID; Gbl.Forum.CurrentPagePsts = (unsigned) PaginationPsts.CurrentPage; /***** Write links to pages *****/ @@ -1130,13 +1130,13 @@ static void For_ShowPostsOfAThread (Ale_AlertType_t AlertType,const char *Messag DB_FreeMySQLResult (&mysql_res); /***** Form to write a new post in the thread *****/ - fprintf (Gbl.F.Out,"
",For_ID_NEW_POST_SECTION); + Lay_StartSection (For_NEW_POST_SECTION_ID); For_WriteFormForumPst (true,LastSubject); - fprintf (Gbl.F.Out,"
"); + Lay_EndSection (); /***** End frame *****/ Lay_EndRoundFrame (); - fprintf (Gbl.F.Out,"
"); + Lay_EndSection (); } /*****************************************************************************/ @@ -1148,7 +1148,7 @@ static void For_PutIconNewPost (void) extern const char *Txt_New_post; Lay_PutContextualLink (For_ActionsSeePstFor[Gbl.Forum.ForumSelected.Type], - For_ID_NEW_POST_SECTION,For_PutAllHiddenParamsNewPost, + For_NEW_POST_SECTION_ID,For_PutAllHiddenParamsNewPost, "plus64x64.png", Txt_New_post,NULL, NULL); @@ -1255,7 +1255,7 @@ static void For_ShowAForumPost (unsigned PstNum,long PstCod, { Act_FormStartAnchor (Enabled ? For_ActionsDisPstFor[Gbl.Forum.ForumSelected.Type] : For_ActionsEnbPstFor[Gbl.Forum.ForumSelected.Type], - For_ID_FORUM_POSTS_SECTION); + For_FORUM_POSTS_SECTION_ID); For_PutAllHiddenParamsForum (Gbl.Forum.CurrentPageThrs, // Page of threads = current Gbl.Forum.CurrentPagePsts, // Page of posts = current Gbl.Forum.ForumSet, @@ -1301,10 +1301,10 @@ static void For_ShowAForumPost (unsigned PstNum,long PstCod, { if (PstNum == 1) // First and unique post in thread Act_FormStartAnchor (For_ActionsDelPstFor[Gbl.Forum.ForumSelected.Type], - For_ID_FORUM_THREADS_SECTION); + For_FORUM_THREADS_SECTION_ID); else // Last of several posts in thread Act_FormStartAnchor (For_ActionsDelPstFor[Gbl.Forum.ForumSelected.Type], - For_ID_FORUM_POSTS_SECTION); + For_FORUM_POSTS_SECTION_ID); For_PutAllHiddenParamsForum (Gbl.Forum.CurrentPageThrs, // Page of threads = current Gbl.Forum.CurrentPagePsts, // Page of posts = current Gbl.Forum.ForumSet, @@ -2097,7 +2097,7 @@ static void For_WriteLinkToForum (struct Forum *Forum, else { Act_FormStartAnchor (For_ActionsPasThrFor[Forum->Type], - For_ID_FORUM_THREADS_SECTION); + For_FORUM_THREADS_SECTION_ID); For_PutAllHiddenParamsForum (1, // Page of threads = first 1, // Page of posts = first Gbl.Forum.ForumSet, @@ -2117,7 +2117,7 @@ static void For_WriteLinkToForum (struct Forum *Forum, /***** Write link to forum *****/ Act_FormStartAnchor (For_ActionsSeeFor[Forum->Type], - For_ID_FORUM_THREADS_SECTION); + For_FORUM_THREADS_SECTION_ID); For_PutAllHiddenParamsForum (1, // Page of threads = first 1, // Page of posts = first Gbl.Forum.ForumSet, @@ -2538,7 +2538,7 @@ static void For_ShowForumThreadsHighlightingOneThread (long ThrCodHighlighted, PaginationThrs.NumItems = NumThrs; PaginationThrs.CurrentPage = (int) Gbl.Forum.CurrentPageThrs; Pag_CalculatePagination (&PaginationThrs); - PaginationThrs.Anchor = For_ID_FORUM_THREADS_SECTION; + PaginationThrs.Anchor = For_FORUM_THREADS_SECTION_ID; Gbl.Forum.CurrentPageThrs = (unsigned) PaginationThrs.CurrentPage; /***** Fill the list of threads for current page *****/ @@ -2558,7 +2558,7 @@ static void For_ShowForumThreadsHighlightingOneThread (long ThrCodHighlighted, DB_FreeMySQLResult (&mysql_res); /***** Show alert after action *****/ - fprintf (Gbl.F.Out,"
",For_ID_FORUM_THREADS_SECTION); + Lay_StartSection (For_FORUM_THREADS_SECTION_ID); if (Message) if (Message[0]) Ale_ShowAlert (AlertType,Message); @@ -2590,7 +2590,7 @@ static void For_ShowForumThreadsHighlightingOneThread (long ThrCodHighlighted, { fprintf (Gbl.F.Out,"
" "" @@ -1339,7 +1339,7 @@ static void Grp_PutIconToCreateNewGroupType (void) extern const char *Txt_New_type_of_group; /***** Put form to create a new type of group *****/ - Lay_PutContextualLink (ActReqEdiGrp,Grp_SECTION_NEW_GROUP_TYPE,NULL, + Lay_PutContextualLink (ActReqEdiGrp,Grp_NEW_GROUP_TYPE_SECTION_ID,NULL, "plus64x64.png", Txt_New_type_of_group,NULL, NULL); @@ -1419,7 +1419,7 @@ static void Grp_ListGroupsForEdition (void) /* Write icon to remove group */ fprintf (Gbl.F.Out,"" "
"); Act_FormStartAnchor (For_ActionsSeeFor[Gbl.Forum.ForumSelected.Type], - For_ID_FORUM_THREADS_SECTION); + For_FORUM_THREADS_SECTION_ID); For_PutAllHiddenParamsForum (Gbl.Forum.CurrentPageThrs, // Page of threads = current 1, // Page of posts = first Gbl.Forum.ForumSet, @@ -2640,13 +2640,13 @@ static void For_ShowForumThreadsHighlightingOneThread (long ThrCodHighlighted, } /***** Put a form to write the first post of a new thread *****/ - fprintf (Gbl.F.Out,"
",For_ID_NEW_THREAD_SECTION); + Lay_StartSection (For_NEW_THREAD_SECTION_ID); For_WriteFormForumPst (false,NULL); - fprintf (Gbl.F.Out,"
"); + Lay_EndSection (); /***** End frame with threads of this forum ****/ Lay_EndRoundFrame (); - fprintf (Gbl.F.Out,""); + Lay_EndSection (); } /*****************************************************************************/ @@ -2658,7 +2658,7 @@ static void For_PutIconNewThread (void) extern const char *Txt_New_thread; Lay_PutContextualLink (For_ActionsSeeFor[Gbl.Forum.ForumSelected.Type], - For_ID_NEW_THREAD_SECTION,For_PutAllHiddenParamsNewThread, + For_NEW_THREAD_SECTION_ID,For_PutAllHiddenParamsNewThread, "plus64x64.png", Txt_New_thread,NULL, NULL); @@ -3355,7 +3355,7 @@ static void For_ListForumThrs (long ThrCods[Pag_ITEMS_PER_PAGE], { fprintf (Gbl.F.Out,"
"); Act_FormStartAnchor (For_ActionsReqDelThr[Gbl.Forum.ForumSelected.Type], - For_ID_REMOVE_THREAD_SECTION); + For_REMOVE_THREAD_SECTION_ID); For_PutAllHiddenParamsForum (Gbl.Forum.CurrentPageThrs, // Page of threads = current 1, // Page of posts = first Gbl.Forum.ForumSet, @@ -3372,7 +3372,7 @@ static void For_ListForumThrs (long ThrCods[Pag_ITEMS_PER_PAGE], { fprintf (Gbl.F.Out,"
"); Act_FormStartAnchor (For_ActionsCutThrFor[Gbl.Forum.ForumSelected.Type], - For_ID_FORUM_THREADS_SECTION); + For_FORUM_THREADS_SECTION_ID); For_PutAllHiddenParamsForum (Gbl.Forum.CurrentPageThrs, // Page of threads = current 1, // Page of posts = first Gbl.Forum.ForumSet, @@ -3396,7 +3396,7 @@ static void For_ListForumThrs (long ThrCods[Pag_ITEMS_PER_PAGE], PaginationPsts.NumItems = Thr.NumPosts; PaginationPsts.CurrentPage = 1; // First page Pag_CalculatePagination (&PaginationPsts); - PaginationPsts.Anchor = For_ID_FORUM_POSTS_SECTION; + PaginationPsts.Anchor = For_FORUM_POSTS_SECTION_ID; Pag_WriteLinksToPages (Pag_POSTS_FORUM, Thr.ThrCod, &PaginationPsts, @@ -3860,13 +3860,13 @@ static void For_WriteFormForumPst (bool IsReply,const char *Subject) if (IsReply) // Form to write a reply to a post of an existing thread { Act_FormStartAnchor (For_ActionsRecRepFor[Gbl.Forum.ForumSelected.Type], - For_ID_FORUM_POSTS_SECTION); + For_FORUM_POSTS_SECTION_ID); For_PutAllHiddenParamsNewPost (); } else // Form to write the first post of a new thread { Act_FormStartAnchor (For_ActionsRecThrFor[Gbl.Forum.ForumSelected.Type], - For_ID_FORUM_POSTS_SECTION); + For_FORUM_POSTS_SECTION_ID); For_PutAllHiddenParamsNewThread (); } @@ -4147,7 +4147,7 @@ void For_RequestRemoveThread (void) For_ShowForumList (); /***** Show question and button to remove the thread *****/ - fprintf (Gbl.F.Out,"
",For_ID_REMOVE_THREAD_SECTION); + Lay_StartSection (For_REMOVE_THREAD_SECTION_ID); if (Subject[0]) sprintf (Gbl.Alert.Txt,Txt_Do_you_really_want_to_remove_the_entire_thread_X, Subject); @@ -4156,10 +4156,10 @@ void For_RequestRemoveThread (void) Txt_Do_you_really_want_to_remove_the_entire_thread); Ale_ShowAlertAndButton (Ale_QUESTION,Gbl.Alert.Txt, For_ActionsDelThrFor[Gbl.Forum.ForumSelected.Type], - For_ID_FORUM_THREADS_SECTION, + For_FORUM_THREADS_SECTION_ID, For_PutAllHiddenParamsRemThread, Lay_REMOVE_BUTTON,Txt_Remove_thread); - fprintf (Gbl.F.Out,"
"); + Lay_EndSection (); /***** Show the threads again *****/ For_ShowForumThreadsHighlightingOneThread (Gbl.Forum.ForumSelected.ThrCod, diff --git a/swad_group.c b/swad_group.c index 79bd20388..d61a568fa 100644 --- a/swad_group.c +++ b/swad_group.c @@ -40,10 +40,10 @@ /*************************** Internal constants ******************************/ /*****************************************************************************/ -#define Grp_SECTION_GROUP_TYPES "grp_types" -#define Grp_SECTION_NEW_GROUP_TYPE "new_grp_type" -#define Grp_SECTION_GROUPS "grps" -#define Grp_SECTION_NEW_GROUP "new_grp" +#define Grp_GROUP_TYPES_SECTION_ID "grp_types" +#define Grp_NEW_GROUP_TYPE_SECTION_ID "new_grp_type" +#define Grp_GROUPS_SECTION_ID "grps" +#define Grp_NEW_GROUP_SECTION_ID "new_grp" /*****************************************************************************/ /***************************** Internal types ********************************/ @@ -196,7 +196,7 @@ static void Grp_ReqEditGroupsInternal (Ale_AlertType_t AlertTypeGroupTypes,const static void Grp_ReqEditGroupsInternal0 (void) { /***** Start groups types section *****/ - fprintf (Gbl.F.Out,"
",Grp_SECTION_GROUP_TYPES); + Lay_StartSection (Grp_GROUP_TYPES_SECTION_ID); } static void Grp_ReqEditGroupsInternal1 (Ale_AlertType_t AlertTypeGroupTypes,const char *MessageGroupTypes) @@ -213,10 +213,10 @@ static void Grp_ReqEditGroupsInternal1 (Ale_AlertType_t AlertTypeGroupTypes,cons Grp_EditGroupTypes (); /***** End groups types section *****/ - fprintf (Gbl.F.Out,"
"); + Lay_EndSection (); /***** Start groups section *****/ - fprintf (Gbl.F.Out,"
",Grp_SECTION_GROUPS); + Lay_StartSection (Grp_GROUPS_SECTION_ID); } static void Grp_ReqEditGroupsInternal2 (Ale_AlertType_t AlertTypeGroups,const char *MessageGroups) @@ -231,7 +231,7 @@ static void Grp_ReqEditGroupsInternal2 (Ale_AlertType_t AlertTypeGroups,const ch Grp_EditGroups (); /***** End groups section *****/ - fprintf (Gbl.F.Out,"
"); + Lay_EndSection (); /***** Free list of groups types and groups in this course *****/ Grp_FreeListGrpTypesAndGrps (); @@ -318,7 +318,7 @@ static void Grp_PutIconToCreateNewGroup (void) extern const char *Txt_New_group; /***** Put form to create a new group *****/ - Lay_PutContextualLink (ActReqEdiGrp,Grp_SECTION_NEW_GROUP,NULL, + Lay_PutContextualLink (ActReqEdiGrp,Grp_NEW_GROUP_SECTION_ID,NULL, "plus64x64.png", Txt_New_group,NULL, NULL); @@ -328,7 +328,7 @@ static void Grp_PutIconToCreateNewGroup (void) /*************** Show form to select one or several groups *******************/ /*****************************************************************************/ -void Grp_ShowFormToSelectSeveralGroups (Act_Action_t NextAction,const char *Anchor) +void Grp_ShowFormToSelectSeveralGroups (Act_Action_t NextAction) { extern const char *Hlp_USERS_Groups; extern const char *The_ClassForm[The_NUM_THEMES]; @@ -354,7 +354,7 @@ void Grp_ShowFormToSelectSeveralGroups (Act_Action_t NextAction,const char *Anch /***** Start form to update the students listed depending on the groups selected *****/ - Act_FormStartAnchor (NextAction,Anchor); + Act_FormStartAnchor (NextAction,Usr_USER_LIST_SECTION_ID); Usr_PutParamsPrefsAboutUsrList (); /***** Put parameters needed depending on the action *****/ @@ -1207,7 +1207,7 @@ static void Grp_ListGroupTypesForEdition (void) /* Put icon to remove group type */ fprintf (Gbl.F.Out,"
"); - Act_FormStartAnchor (ActReqRemGrpTyp,Grp_SECTION_GROUP_TYPES); + Act_FormStartAnchor (ActReqRemGrpTyp,Grp_GROUP_TYPES_SECTION_ID); Grp_PutParamGrpTypCod (Gbl.CurrentCrs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].GrpTypCod); Lay_PutIconRemove (); Act_FormEnd (); @@ -1215,7 +1215,7 @@ static void Grp_ListGroupTypesForEdition (void) /* Name of group type */ fprintf (Gbl.F.Out,""); - Act_FormStartAnchor (ActRenGrpTyp,Grp_SECTION_GROUP_TYPES); + Act_FormStartAnchor (ActRenGrpTyp,Grp_GROUP_TYPES_SECTION_ID); Grp_PutParamGrpTypCod (Gbl.CurrentCrs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].GrpTypCod); fprintf (Gbl.F.Out,""); - Act_FormStartAnchor (ActChgMdtGrpTyp,Grp_SECTION_GROUP_TYPES); + Act_FormStartAnchor (ActChgMdtGrpTyp,Grp_GROUP_TYPES_SECTION_ID); Grp_PutParamGrpTypCod (Gbl.CurrentCrs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].GrpTypCod); fprintf (Gbl.F.Out,""); - Act_FormStartAnchor (ActChgTimGrpTyp,Grp_SECTION_GROUP_TYPES); + Act_FormStartAnchor (ActChgTimGrpTyp,Grp_GROUP_TYPES_SECTION_ID); Grp_PutParamGrpTypCod (Gbl.CurrentCrs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].GrpTypCod); Lay_StartTableCenter (2); fprintf (Gbl.F.Out,"
"); - Act_FormStartAnchor (ActReqRemGrp,Grp_SECTION_GROUPS); + Act_FormStartAnchor (ActReqRemGrp,Grp_GROUPS_SECTION_ID); Grp_PutParamGrpCod (Grp->GrpCod); Lay_PutIconRemove (); Act_FormEnd (); @@ -1429,7 +1429,7 @@ static void Grp_ListGroupsForEdition (void) fprintf (Gbl.F.Out,""); Act_FormStartAnchor (Grp->Open ? ActCloGrp : ActOpeGrp, - Grp_SECTION_GROUPS); + Grp_GROUPS_SECTION_ID); Grp_PutParamGrpCod (Grp->GrpCod); sprintf (Gbl.Title, Grp->Open ? Txt_Group_X_open_click_to_close_it : @@ -1450,7 +1450,7 @@ static void Grp_ListGroupsForEdition (void) fprintf (Gbl.F.Out,""); Act_FormStartAnchor (Grp->FileZones ? ActDisFilZonGrp : ActEnaFilZonGrp, - Grp_SECTION_GROUPS); + Grp_GROUPS_SECTION_ID); Grp_PutParamGrpCod (Grp->GrpCod); sprintf (Gbl.Title, Grp->FileZones ? Txt_File_zones_of_the_group_X_enabled_click_to_disable_them : @@ -1469,7 +1469,7 @@ static void Grp_ListGroupsForEdition (void) /* Group type */ fprintf (Gbl.F.Out,""); - Act_FormStartAnchor (ActChgGrpTyp,Grp_SECTION_GROUPS); + Act_FormStartAnchor (ActChgGrpTyp,Grp_GROUPS_SECTION_ID); Grp_PutParamGrpCod (Grp->GrpCod); fprintf (Gbl.F.Out,""); - Act_FormStartAnchor (ActRenGrp,Grp_SECTION_GROUPS); + Act_FormStartAnchor (ActRenGrp,Grp_GROUPS_SECTION_ID); Grp_PutParamGrpCod (Grp->GrpCod); fprintf (Gbl.F.Out,""); - Act_FormStartAnchor (ActChgMaxStdGrp,Grp_SECTION_GROUPS); + Act_FormStartAnchor (ActChgMaxStdGrp,Grp_GROUPS_SECTION_ID); Grp_PutParamGrpCod (Grp->GrpCod); fprintf (Gbl.F.Out,"",Grp_SECTION_NEW_GROUP_TYPE); - Act_FormStartAnchor (ActNewGrpTyp,Grp_SECTION_GROUP_TYPES); + Lay_StartSection (Grp_NEW_GROUP_TYPE_SECTION_ID); + Act_FormStartAnchor (ActNewGrpTyp,Grp_GROUP_TYPES_SECTION_ID); /***** Start of frame *****/ Lay_StartRoundFrameTable (NULL,Txt_New_type_of_group, @@ -2291,7 +2291,7 @@ static void Grp_PutFormToCreateGroupType (void) /***** End form *****/ Act_FormEnd (); - fprintf (Gbl.F.Out,""); + Lay_EndSection (); } /*****************************************************************************/ @@ -2307,8 +2307,8 @@ static void Grp_PutFormToCreateGroup (void) unsigned NumGrpTyp; /***** Start form *****/ - fprintf (Gbl.F.Out,"
",Grp_SECTION_NEW_GROUP); - Act_FormStartAnchor (ActNewGrp,Grp_SECTION_GROUPS); + Lay_StartSection (Grp_NEW_GROUP_SECTION_ID); + Act_FormStartAnchor (ActNewGrp,Grp_GROUPS_SECTION_ID); /***** Start of frame *****/ Lay_StartRoundFrameTable (NULL,Txt_New_group,NULL,NULL,2); @@ -2380,7 +2380,7 @@ static void Grp_PutFormToCreateGroup (void) /***** End of form *****/ Act_FormEnd (); - fprintf (Gbl.F.Out,"
"); + Lay_EndSection (); } /*****************************************************************************/ @@ -3509,7 +3509,7 @@ static void Grp_AskConfirmRemGrpTypWithGrps (unsigned NumGrps) sprintf (Gbl.Alert.Txt,Txt_Do_you_really_want_to_remove_the_type_of_group_X_Y_groups_, Gbl.CurrentCrs.Grps.GrpTyp.GrpTypName,NumGrps); Ale_ShowAlertAndButton (Ale_QUESTION,Gbl.Alert.Txt, - ActRemGrpTyp,Grp_SECTION_GROUP_TYPES, + ActRemGrpTyp,Grp_GROUP_TYPES_SECTION_ID, Grp_PutParamRemGrpTyp, Lay_REMOVE_BUTTON,Txt_Remove_type_of_group); @@ -3562,7 +3562,7 @@ static void Grp_AskConfirmRemGrp (void) sprintf (Gbl.Alert.Txt,Txt_Do_you_really_want_to_remove_the_group_X_Y_students_, GrpDat.GrpName,NumStds); Ale_ShowAlertAndButton (Ale_QUESTION,Gbl.Alert.Txt, - ActRemGrp,Grp_SECTION_GROUPS,Grp_PutParamRemGrp, + ActRemGrp,Grp_GROUPS_SECTION_ID,Grp_PutParamRemGrp, Lay_REMOVE_BUTTON,Txt_Remove_group); /***** Show the form to edit groups again *****/ diff --git a/swad_group.h b/swad_group.h index 7c50bb053..e2910ffbb 100644 --- a/swad_group.h +++ b/swad_group.h @@ -135,7 +135,7 @@ typedef enum void Grp_WriteNamesOfSelectedGrps (void); void Grp_ReqEditGroups (void); -void Grp_ShowFormToSelectSeveralGroups (Act_Action_t NextAction,const char *Anchor); +void Grp_ShowFormToSelectSeveralGroups (Act_Action_t NextAction); void Grp_PutParamsCodGrps (void); void Grp_GetParCodsSeveralGrpsToShowUsrs (void); void Grp_GetParCodsSeveralGrps (void); diff --git a/swad_layout.c b/swad_layout.c index 643df831a..df77f48b8 100644 --- a/swad_layout.c +++ b/swad_layout.c @@ -1569,6 +1569,20 @@ void Lay_EndTable (void) fprintf (Gbl.F.Out,"
"); } +/*****************************************************************************/ +/****************************** Start/end section ****************************/ +/*****************************************************************************/ + +void Lay_StartSection (const char *SectionId) + { + fprintf (Gbl.F.Out,"
",SectionId); + } + +void Lay_EndSection (void) + { + fprintf (Gbl.F.Out,"
"); + } + /*****************************************************************************/ /******* Write error message, close files, remove lock file, and exit ********/ /*****************************************************************************/ diff --git a/swad_layout.h b/swad_layout.h index 768e4dc6e..20a9d07e9 100644 --- a/swad_layout.h +++ b/swad_layout.h @@ -117,6 +117,9 @@ void Lay_StartTableWide (unsigned CellPadding); void Lay_StartTableWideMargin (unsigned CellPadding); void Lay_EndTable (void); +void Lay_StartSection (const char *SectionId); +void Lay_EndSection (void); + void Lay_ShowErrorAndExit (const char *Txt); void Lay_RefreshNotifsAndConnected (void); diff --git a/swad_mail.c b/swad_mail.c index 31f73f041..29d60cb00 100644 --- a/swad_mail.c +++ b/swad_mail.c @@ -887,10 +887,10 @@ void Mai_ListEmails (void) NULL,Hlp_MESSAGES_Email); /***** Form to select groups *****/ - Grp_ShowFormToSelectSeveralGroups (ActMaiStd,"user_list"); + Grp_ShowFormToSelectSeveralGroups (ActMaiStd); /***** Start section with user list *****/ - fprintf (Gbl.F.Out,"
"); + Lay_StartSection (Usr_USER_LIST_SECTION_ID); if (Gbl.Usrs.LstUsrs[Rol_STD].NumUsrs) { @@ -982,7 +982,7 @@ void Mai_ListEmails (void) Usr_ShowWarningNoUsersFound (Rol_STD); /***** End section with user list *****/ - fprintf (Gbl.F.Out,"
"); + Lay_EndSection (); /***** End of the frame used to list the emails *****/ Lay_EndRoundFrame (); diff --git a/swad_message.c b/swad_message.c index 04c0b5a5f..c323ced0b 100644 --- a/swad_message.c +++ b/swad_message.c @@ -237,10 +237,10 @@ static void Msg_PutFormMsgUsrs (char Content[Cns_MAX_BYTES_LONG_TEXT + 1]) if (GetUsrsInCrs) { /***** Form to select groups *****/ - Grp_ShowFormToSelectSeveralGroups (ActReqMsgUsr,"user_list"); + Grp_ShowFormToSelectSeveralGroups (ActReqMsgUsr); /***** Start section with user list *****/ - fprintf (Gbl.F.Out,"
"); + Lay_StartSection (Usr_USER_LIST_SECTION_ID); if (NumUsrsInCrs) { @@ -256,7 +256,7 @@ static void Msg_PutFormMsgUsrs (char Content[Cns_MAX_BYTES_LONG_TEXT + 1]) } /***** End section with user list *****/ - fprintf (Gbl.F.Out,"
"); + Lay_EndSection (); } /***** Get list of users' IDs or nicknames written explicitely *****/ diff --git a/swad_profile.c b/swad_profile.c index ce0a40455..0b1410e3a 100644 --- a/swad_profile.c +++ b/swad_profile.c @@ -220,9 +220,9 @@ void Prf_GetUsrDatAndShowUserProfile (void) if (Gbl.Usrs.Me.Logged) // Timeline visible only by logged users { /* Show timeline */ - fprintf (Gbl.F.Out,"
"); + Lay_StartSection (Soc_TIMELINE_SECTION_ID); Soc_ShowTimelineUsr (); - fprintf (Gbl.F.Out,"
"); + Lay_EndSection (); } } diff --git a/swad_record.c b/swad_record.c index cc5b47ea5..6b4698ea9 100644 --- a/swad_record.c +++ b/swad_record.c @@ -997,7 +997,7 @@ static void Rec_ListRecordsGsts (Rec_SharedRecordViewType_t TypeOfView) unsigned NumUsr = 0; const char *Ptr; struct UsrData UsrDat; - char Anchor[32]; + char RecordSectionId[32]; /***** Assign users listing type depending on current action *****/ Gbl.Usrs.Listing.RecsUsrs = Rec_RECORD_USERS_GUESTS; @@ -1045,9 +1045,9 @@ static void Rec_ListRecordsGsts (Rec_SharedRecordViewType_t TypeOfView) if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat)) // Get from the database the data of the student { /* Start container for this user */ - sprintf (Anchor,"record_%u",NumUsr); - fprintf (Gbl.F.Out,"
"); - Rec_ShowSharedUsrRecord (TypeOfView,&UsrDat,Anchor); - fprintf (Gbl.F.Out,"
"); + fprintf (Gbl.F.Out,"
"); + Rec_ShowSharedUsrRecord (TypeOfView,&UsrDat,RecordSectionId); + fprintf (Gbl.F.Out,"
"); /* End container for this user */ - fprintf (Gbl.F.Out,""); + fprintf (Gbl.F.Out,""); + Lay_EndSection (); NumUsr++; } @@ -1126,12 +1127,12 @@ static void Rec_ShowRecordOneStdCrs (void) Ale_ShowPendingAlert (); /***** Start container for this user *****/ - fprintf (Gbl.F.Out,"
"); + fprintf (Gbl.F.Out,"
"); /***** Shared record *****/ - fprintf (Gbl.F.Out,"
"); + fprintf (Gbl.F.Out,"
"); Rec_ShowSharedUsrRecord (Rec_SHA_RECORD_LIST,&Gbl.Usrs.Other.UsrDat,NULL); - fprintf (Gbl.F.Out,"
"); + fprintf (Gbl.F.Out,"
"); /***** Record of the student in the course *****/ if (Gbl.CurrentCrs.Records.LstFields.Num) // There are fields in the record @@ -1140,21 +1141,21 @@ static void Rec_ShowRecordOneStdCrs (void) Gbl.Usrs.Me.LoggedRole == Rol_TCH || Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM) { - fprintf (Gbl.F.Out,"
"); + fprintf (Gbl.F.Out,"
"); Rec_ShowCrsRecord (Rec_CRS_LIST_ONE_RECORD,&Gbl.Usrs.Other.UsrDat,NULL); - fprintf (Gbl.F.Out,"
"); + fprintf (Gbl.F.Out,""); } else if (Gbl.Usrs.Me.LoggedRole == Rol_STD && Gbl.Usrs.Me.UsrDat.UsrCod == Gbl.Usrs.Other.UsrDat.UsrCod) // It's me { - fprintf (Gbl.F.Out,"
"); + fprintf (Gbl.F.Out,"
"); Rec_ShowCrsRecord (Rec_CRS_MY_RECORD_AS_STUDENT_FORM,&Gbl.Usrs.Other.UsrDat,NULL); - fprintf (Gbl.F.Out,"
"); + fprintf (Gbl.F.Out,""); } } /***** End container for this user *****/ - fprintf (Gbl.F.Out,"
"); + fprintf (Gbl.F.Out,""); /***** Free list of fields of records *****/ Rec_FreeListFields (); @@ -1185,7 +1186,7 @@ static void Rec_ListRecordsStds (Rec_SharedRecordViewType_t ShaTypeOfView, unsigned NumUsr = 0; const char *Ptr; struct UsrData UsrDat; - char Anchor[32]; + char RecordSectionId[32]; /***** Assign users listing type depending on current action *****/ Gbl.Usrs.Listing.RecsUsrs = Rec_RECORD_USERS_STUDENTS; @@ -1246,9 +1247,9 @@ static void Rec_ListRecordsStds (Rec_SharedRecordViewType_t ShaTypeOfView, true); /* Start container for this user */ - sprintf (Anchor,"record_%u",NumUsr); - fprintf (Gbl.F.Out,"
"); - Rec_ShowSharedUsrRecord (ShaTypeOfView,&UsrDat,Anchor); - fprintf (Gbl.F.Out,"
"); + fprintf (Gbl.F.Out,"
"); + Rec_ShowSharedUsrRecord (ShaTypeOfView,&UsrDat,RecordSectionId); + fprintf (Gbl.F.Out,"
"); /* Record of the student in the course */ if (Gbl.CurrentCrs.Records.LstFields.Num) // There are fields in the record @@ -1272,13 +1273,14 @@ static void Rec_ListRecordsStds (Rec_SharedRecordViewType_t ShaTypeOfView, (Gbl.Usrs.Me.LoggedRole == Rol_STD && // I am student in this course... UsrDat.UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod)) // ...and it's me { - fprintf (Gbl.F.Out,"
"); - Rec_ShowCrsRecord (CrsTypeOfView,&UsrDat,Anchor); - fprintf (Gbl.F.Out,"
"); + fprintf (Gbl.F.Out,"
"); + Rec_ShowCrsRecord (CrsTypeOfView,&UsrDat,RecordSectionId); + fprintf (Gbl.F.Out,"
"); } /* End container for this user */ - fprintf (Gbl.F.Out,""); + fprintf (Gbl.F.Out,""); + Lay_EndSection (); NumUsr++; } @@ -1351,27 +1353,27 @@ static void Rec_ShowRecordOneTchCrs (void) fprintf (Gbl.F.Out,""); /***** Start container for this user *****/ - fprintf (Gbl.F.Out,"
"); + fprintf (Gbl.F.Out,"
"); /***** Shared record *****/ - fprintf (Gbl.F.Out,"
"); + fprintf (Gbl.F.Out,"
"); Rec_ShowSharedUsrRecord (Rec_SHA_RECORD_LIST,&Gbl.Usrs.Other.UsrDat,NULL); - fprintf (Gbl.F.Out,"
"); + fprintf (Gbl.F.Out,"
"); /***** Office hours *****/ if (ShowOfficeHours) { - fprintf (Gbl.F.Out,"
"); + fprintf (Gbl.F.Out,"
"); Gbl.TimeTable.Type = TT_TUTORING_TIMETABLE; Lay_StartRoundFrame (Width,Txt_TIMETABLE_TYPES[Gbl.TimeTable.Type], NULL,Hlp_USERS_Teachers_timetable); TT_ShowTimeTable (Gbl.Usrs.Other.UsrDat.UsrCod); Lay_EndRoundFrame (); - fprintf (Gbl.F.Out,"
"); + fprintf (Gbl.F.Out,""); } /***** Start container for this user *****/ - fprintf (Gbl.F.Out,"
"); + fprintf (Gbl.F.Out,""); } /*****************************************************************************/ @@ -1397,7 +1399,7 @@ static void Rec_ListRecordsTchs (Rec_SharedRecordViewType_t TypeOfView) unsigned NumUsr = 0; const char *Ptr; struct UsrData UsrDat; - char Anchor[32]; + char RecordSectionId[32]; bool ShowOfficeHours; char Width[10 + 2 + 1]; @@ -1468,9 +1470,9 @@ static void Rec_ListRecordsTchs (Rec_SharedRecordViewType_t TypeOfView) true); /* Start container for this user */ - sprintf (Anchor,"record_%u",NumUsr); - fprintf (Gbl.F.Out,"
"); - Rec_ShowSharedUsrRecord (TypeOfView,&UsrDat,Anchor); - fprintf (Gbl.F.Out,"
"); + fprintf (Gbl.F.Out,"
"); + Rec_ShowSharedUsrRecord (TypeOfView,&UsrDat,RecordSectionId); + fprintf (Gbl.F.Out,"
"); /* Office hours */ if (ShowOfficeHours) { - fprintf (Gbl.F.Out,"
"); + fprintf (Gbl.F.Out,"
"); Gbl.TimeTable.Type = TT_TUTORING_TIMETABLE; Lay_StartRoundFrame (Width,Txt_TIMETABLE_TYPES[Gbl.TimeTable.Type], NULL,Hlp_USERS_Teachers_timetable); TT_ShowTimeTable (UsrDat.UsrCod); Lay_EndRoundFrame (); - fprintf (Gbl.F.Out,"
"); + fprintf (Gbl.F.Out,""); } /* End container for this user */ - fprintf (Gbl.F.Out,""); + fprintf (Gbl.F.Out,""); + Lay_EndSection (); NumUsr++; } diff --git a/swad_social.c b/swad_social.c index cefc8c6f8..233a393f0 100644 --- a/swad_social.c +++ b/swad_social.c @@ -2256,7 +2256,7 @@ void Soc_ReceiveSocialPostUsr (void) Prf_ShowUserProfile (&Gbl.Usrs.Other.UsrDat); /***** Start section *****/ - fprintf (Gbl.F.Out,"
"); + Lay_StartSection (Soc_TIMELINE_SECTION_ID); /***** Receive and store social post *****/ NotCod = Soc_ReceiveSocialPost (); @@ -2265,7 +2265,7 @@ void Soc_ReceiveSocialPostUsr (void) Soc_ShowTimelineUsrHighlightingNot (NotCod); /***** End section *****/ - fprintf (Gbl.F.Out,"
"); + Lay_EndSection (); } // Returns the code of the social note just created @@ -2953,7 +2953,7 @@ void Soc_ReceiveCommentUsr (void) Prf_ShowUserProfile (&Gbl.Usrs.Other.UsrDat); /***** Start section *****/ - fprintf (Gbl.F.Out,"
"); + Lay_StartSection (Soc_TIMELINE_SECTION_ID); /***** Receive comment in a social note *****/ NotCod = Soc_ReceiveComment (); @@ -2962,7 +2962,7 @@ void Soc_ReceiveCommentUsr (void) Soc_ShowTimelineUsrHighlightingNot (NotCod); /***** End section *****/ - fprintf (Gbl.F.Out,"
"); + Lay_EndSection (); } static long Soc_ReceiveComment (void) @@ -3081,7 +3081,7 @@ void Soc_ShareSocialNoteUsr (void) Prf_ShowUserProfile (&Gbl.Usrs.Other.UsrDat); /***** Start section *****/ - fprintf (Gbl.F.Out,"
"); + Lay_StartSection (Soc_TIMELINE_SECTION_ID); /***** Share social note *****/ NotCod = Soc_ShareSocialNote (); @@ -3090,7 +3090,7 @@ void Soc_ShareSocialNoteUsr (void) Soc_ShowTimelineUsrHighlightingNot (NotCod); /***** End section *****/ - fprintf (Gbl.F.Out,"
"); + Lay_EndSection (); } static long Soc_ShareSocialNote (void) @@ -3159,7 +3159,7 @@ void Soc_FavSocialNoteUsr (void) Prf_ShowUserProfile (&Gbl.Usrs.Other.UsrDat); /***** Start section *****/ - fprintf (Gbl.F.Out,"
"); + Lay_StartSection (Soc_TIMELINE_SECTION_ID); /***** Mark social note as favourite *****/ NotCod = Soc_FavSocialNote (); @@ -3168,7 +3168,7 @@ void Soc_FavSocialNoteUsr (void) Soc_ShowTimelineUsrHighlightingNot (NotCod); /***** End section *****/ - fprintf (Gbl.F.Out,"
"); + Lay_EndSection (); } static long Soc_FavSocialNote (void) @@ -3245,7 +3245,7 @@ void Soc_FavSocialCommentUsr (void) Prf_ShowUserProfile (&Gbl.Usrs.Other.UsrDat); /***** Start section *****/ - fprintf (Gbl.F.Out,"
"); + Lay_StartSection (Soc_TIMELINE_SECTION_ID); /***** Mark social comment as favourite *****/ NotCod = Soc_FavSocialComment (); @@ -3254,7 +3254,7 @@ void Soc_FavSocialCommentUsr (void) Soc_ShowTimelineUsrHighlightingNot (NotCod); /***** End section *****/ - fprintf (Gbl.F.Out,"
"); + Lay_EndSection (); } static long Soc_FavSocialComment (void) @@ -3369,7 +3369,7 @@ void Soc_UnshareSocialNoteUsr (void) Prf_ShowUserProfile (&Gbl.Usrs.Other.UsrDat); /***** Start section *****/ - fprintf (Gbl.F.Out,"
"); + Lay_StartSection (Soc_TIMELINE_SECTION_ID); /***** Unshare a previously shared social note *****/ NotCod = Soc_UnshareSocialNote (); @@ -3378,7 +3378,7 @@ void Soc_UnshareSocialNoteUsr (void) Soc_ShowTimelineUsrHighlightingNot (NotCod); /***** End section *****/ - fprintf (Gbl.F.Out,"
"); + Lay_EndSection (); } static long Soc_UnshareSocialNote (void) @@ -3457,7 +3457,7 @@ void Soc_UnfavSocialNoteUsr (void) Prf_ShowUserProfile (&Gbl.Usrs.Other.UsrDat); /***** Start section *****/ - fprintf (Gbl.F.Out,"
"); + Lay_StartSection (Soc_TIMELINE_SECTION_ID); /***** Unfav a social note previously marked as favourite *****/ NotCod = Soc_UnfavSocialNote (); @@ -3466,7 +3466,7 @@ void Soc_UnfavSocialNoteUsr (void) Soc_ShowTimelineUsrHighlightingNot (NotCod); /***** End section *****/ - fprintf (Gbl.F.Out,"
"); + Lay_EndSection (); } static long Soc_UnfavSocialNote (void) @@ -3541,7 +3541,7 @@ void Soc_UnfavSocialCommentUsr (void) Prf_ShowUserProfile (&Gbl.Usrs.Other.UsrDat); /***** Start section *****/ - fprintf (Gbl.F.Out,"
"); + Lay_StartSection (Soc_TIMELINE_SECTION_ID); /***** Unfav a social comment previously marked as favourite *****/ NotCod = Soc_UnfavSocialComment (); @@ -3550,7 +3550,7 @@ void Soc_UnfavSocialCommentUsr (void) Soc_ShowTimelineUsrHighlightingNot (NotCod); /***** End section *****/ - fprintf (Gbl.F.Out,"
"); + Lay_EndSection (); } static long Soc_UnfavSocialComment (void) @@ -3624,7 +3624,7 @@ void Soc_RequestRemSocialNoteUsr (void) Prf_ShowUserProfile (&Gbl.Usrs.Other.UsrDat); /***** Start section *****/ - fprintf (Gbl.F.Out,"
"); + Lay_StartSection (Soc_TIMELINE_SECTION_ID); /***** Request the removal of social note *****/ Soc_RequestRemovalSocialNote (); @@ -3633,7 +3633,7 @@ void Soc_RequestRemSocialNoteUsr (void) Soc_ShowTimelineUsr (); /***** End section *****/ - fprintf (Gbl.F.Out,"
"); + Lay_EndSection (); } static void Soc_RequestRemovalSocialNote (void) @@ -3712,7 +3712,7 @@ void Soc_RemoveSocialNoteUsr (void) Prf_ShowUserProfile (&Gbl.Usrs.Other.UsrDat); /***** Start section *****/ - fprintf (Gbl.F.Out,"
"); + Lay_StartSection (Soc_TIMELINE_SECTION_ID); /***** Remove a social note *****/ Soc_RemoveSocialNote (); @@ -3721,7 +3721,7 @@ void Soc_RemoveSocialNoteUsr (void) Soc_ShowTimelineUsr (); /***** End section *****/ - fprintf (Gbl.F.Out,"
"); + Lay_EndSection (); } static void Soc_RemoveSocialNote (void) @@ -3959,7 +3959,7 @@ void Soc_RequestRemSocialComUsr (void) Prf_ShowUserProfile (&Gbl.Usrs.Other.UsrDat); /***** Start section *****/ - fprintf (Gbl.F.Out,"
"); + Lay_StartSection (Soc_TIMELINE_SECTION_ID); /***** Request the removal of comment in social note *****/ Soc_RequestRemovalSocialComment (); @@ -3968,7 +3968,7 @@ void Soc_RequestRemSocialComUsr (void) Soc_ShowTimelineUsr (); /***** End section *****/ - fprintf (Gbl.F.Out,"
"); + Lay_EndSection (); } static void Soc_RequestRemovalSocialComment (void) @@ -4053,7 +4053,7 @@ void Soc_RemoveSocialComUsr (void) Prf_ShowUserProfile (&Gbl.Usrs.Other.UsrDat); /***** Start section *****/ - fprintf (Gbl.F.Out,"
"); + Lay_StartSection (Soc_TIMELINE_SECTION_ID); /***** Remove a social comment *****/ Soc_RemoveSocialComment (); @@ -4062,7 +4062,7 @@ void Soc_RemoveSocialComUsr (void) Soc_ShowTimelineUsr (); /***** End section *****/ - fprintf (Gbl.F.Out,"
"); + Lay_EndSection (); } static void Soc_RemoveSocialComment (void) diff --git a/swad_social.h b/swad_social.h index 1353e19c2..0cd1d10cd 100644 --- a/swad_social.h +++ b/swad_social.h @@ -31,6 +31,8 @@ /****************************** Public constants *****************************/ /*****************************************************************************/ +#define Soc_TIMELINE_SECTION_ID "timeline" + /*****************************************************************************/ /******************************** Public types *******************************/ /*****************************************************************************/ diff --git a/swad_statistic.c b/swad_statistic.c index f2424b71d..0f948808c 100644 --- a/swad_statistic.c +++ b/swad_statistic.c @@ -95,6 +95,9 @@ const unsigned Sta_CellPadding[Sta_NUM_CLICKS_GROUPED_BY] = 1, // Sta_CLICKS_GBL_PER_COURSE }; +#define Sta_STAT_FORM_SECTION_ID "stat_form" +#define Sta_STAT_RESULTS_SECTION_ID "stat_results" + /*****************************************************************************/ /******************************* Private types *******************************/ /*****************************************************************************/ @@ -474,10 +477,10 @@ void Sta_AskShowCrsHits (void) Lay_StartRoundFrame (NULL,Gbl.Title,NULL,Hlp_STATS_Visits_visits_to_course); /***** Show form to select the groups *****/ - Grp_ShowFormToSelectSeveralGroups (ActReqAccCrs,"user_list"); + Grp_ShowFormToSelectSeveralGroups (ActReqAccCrs); /***** Start section with user list *****/ - fprintf (Gbl.F.Out,"
"); + Lay_StartSection (Usr_USER_LIST_SECTION_ID); if (NumTotalUsrs) { @@ -490,7 +493,7 @@ void Sta_AskShowCrsHits (void) Usr_ShowFormsToSelectUsrListType (ActReqAccCrs); /***** Start form *****/ - Act_FormStartAnchor (ActSeeAccCrs,"stat_results"); + Act_FormStartAnchor (ActSeeAccCrs,Sta_STAT_RESULTS_SECTION_ID); Grp_PutParamsCodGrps (); Par_PutHiddenParamLong ("FirstRow",0); @@ -608,7 +611,7 @@ void Sta_AskShowCrsHits (void) Ale_ShowAlert (Ale_WARNING,Txt_No_teachers_or_students_found); /***** End section with user list *****/ - fprintf (Gbl.F.Out,"
"); + Lay_EndSection (); /***** End frame *****/ Lay_EndRoundFrame (); @@ -660,10 +663,10 @@ void Sta_AskShowGblHits (void) fprintf (Gbl.F.Out,""); /***** Start form *****/ - Act_FormStartAnchor (ActSeeAccGbl,"stat_form"); + Act_FormStartAnchor (ActSeeAccGbl,Sta_STAT_FORM_SECTION_ID); /***** Start frame *****/ - fprintf (Gbl.F.Out,"
"); + Lay_StartSection (Sta_STAT_FORM_SECTION_ID); Lay_StartRoundFrameTable (NULL,Txt_Statistics_of_all_visits,NULL, Hlp_STATS_Visits_global_visits,2); @@ -752,7 +755,7 @@ void Sta_AskShowGblHits (void) /***** End frame with button *****/ Lay_EndRoundFrameWithButton (Lay_CONFIRM_BUTTON,Txt_Show_hits); - fprintf (Gbl.F.Out,"
"); + Lay_EndSection (); /***** End form *****/ Act_FormEnd (); @@ -1445,7 +1448,7 @@ static void Sta_ShowHits (Sta_GlobalOrCourseAccesses_t GlobalOrCourse) { /***** Put the table with the clicks *****/ /* Write start of table frame */ - fprintf (Gbl.F.Out,"
"); + Lay_StartSection (Sta_STAT_RESULTS_SECTION_ID); if (Gbl.Stat.ClicksGroupedBy == Sta_CLICKS_CRS_DETAILED_LIST) Lay_StartRoundFrame ("95%",Txt_List_of_detailed_clicks, NULL,NULL); @@ -1524,7 +1527,7 @@ static void Sta_ShowHits (Sta_GlobalOrCourseAccesses_t GlobalOrCourse) /* End of frame */ Lay_EndRoundFrame (); - fprintf (Gbl.F.Out,"
"); + Lay_EndSection (); } /***** Free structure that stores the query result *****/ @@ -1639,7 +1642,7 @@ static void Sta_ShowDetailedAccessesList (unsigned long NumRows,MYSQL_RES *mysql /* Put link to jump to previous page (older clicks) */ if (FirstRow > 1) { - Act_FormStartAnchor (ActSeeAccCrs,"stat_results"); + Act_FormStartAnchor (ActSeeAccCrs,Sta_STAT_RESULTS_SECTION_ID); Sta_WriteParamsDatesSeeAccesses (); Par_PutHiddenParamUnsigned ("GroupedBy",(unsigned) Sta_CLICKS_CRS_DETAILED_LIST); Par_PutHiddenParamUnsigned ("StatAct" ,(unsigned) Gbl.Stat.NumAction); @@ -1674,7 +1677,7 @@ static void Sta_ShowDetailedAccessesList (unsigned long NumRows,MYSQL_RES *mysql /* Put link to jump to next page (more recent clicks) */ if (LastRow < NumRows) { - Act_FormStartAnchor (ActSeeAccCrs,"stat_results"); + Act_FormStartAnchor (ActSeeAccCrs,Sta_STAT_RESULTS_SECTION_ID); Sta_WriteParamsDatesSeeAccesses (); Par_PutHiddenParamUnsigned ("GroupedBy",(unsigned) Sta_CLICKS_CRS_DETAILED_LIST); Par_PutHiddenParamUnsigned ("StatAct" ,(unsigned) Gbl.Stat.NumAction); @@ -2149,7 +2152,7 @@ static void Sta_ShowDistrAccessesPerDaysAndHour (unsigned long NumRows,MYSQL_RES fprintf (Gbl.F.Out,"" ""); - Act_FormStartAnchor (Gbl.Action.Act,"stat_form"); + Act_FormStartAnchor (Gbl.Action.Act,Sta_STAT_FORM_SECTION_ID); Sta_WriteParamsDatesSeeAccesses (); Par_PutHiddenParamUnsigned ("GroupedBy",(unsigned) Gbl.Stat.ClicksGroupedBy); Par_PutHiddenParamUnsigned ("CountType",(unsigned) Gbl.Stat.CountType); diff --git a/swad_test.c b/swad_test.c index 14554ca6c..679524610 100644 --- a/swad_test.c +++ b/swad_test.c @@ -6980,10 +6980,10 @@ void Tst_SelUsrsToSeeUsrsTestResults (void) NULL,Hlp_ASSESSMENT_Tests_test_results); /***** Show form to select the groups *****/ - Grp_ShowFormToSelectSeveralGroups (ActReqSeeUsrTstRes,"user_list"); + Grp_ShowFormToSelectSeveralGroups (ActReqSeeUsrTstRes); /***** Start section with user list *****/ - fprintf (Gbl.F.Out,"
"); + Lay_StartSection (Usr_USER_LIST_SECTION_ID); if (NumTotalUsrs) { @@ -7029,7 +7029,7 @@ void Tst_SelUsrsToSeeUsrsTestResults (void) Usr_ShowWarningNoUsersFound (Rol_UNK); /***** End section with user list *****/ - fprintf (Gbl.F.Out,"
"); + Lay_EndSection (); /***** End frame *****/ Lay_EndRoundFrame (); diff --git a/swad_user.c b/swad_user.c index c7e367a6c..d219ce344 100644 --- a/swad_user.c +++ b/swad_user.c @@ -7447,10 +7447,10 @@ void Usr_SeeStudents (void) /***** Form to select groups *****/ if (Gbl.Scope.Current == Sco_SCOPE_CRS) - Grp_ShowFormToSelectSeveralGroups (ActLstStd,"user_list"); + Grp_ShowFormToSelectSeveralGroups (ActLstStd); /***** Start section with user list *****/ - fprintf (Gbl.F.Out,"
"); + Lay_StartSection (Usr_USER_LIST_SECTION_ID); if (Usr_GetIfShowBigList (Gbl.Usrs.LstUsrs[Rol_STD].NumUsrs,NULL)) { @@ -7459,7 +7459,6 @@ void Usr_SeeStudents (void) if (Gbl.Usrs.LstUsrs[Rol_STD].NumUsrs) { - /***** Form to select type of list of users *****/ Usr_ShowFormsToSelectUsrListType (ActLstStd); @@ -7534,7 +7533,7 @@ void Usr_SeeStudents (void) } /***** End section with user list *****/ - fprintf (Gbl.F.Out,"
"); + Lay_EndSection (); /***** End frame *****/ Lay_EndRoundFrame (); diff --git a/swad_user.h b/swad_user.h index 53f396535..ac36492b8 100644 --- a/swad_user.h +++ b/swad_user.h @@ -80,6 +80,8 @@ #define Usr_NUM_MAIN_FIELDS_DATA_USR 8 +#define Usr_USER_LIST_SECTION_ID "user_list" + /*****************************************************************************/ /******************************** Public types *******************************/ /*****************************************************************************/