From 031bfc97e23466ec70a13230e2305b1de448e8c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Ca=C3=B1as=20Vargas?= Date: Wed, 11 Dec 2019 00:13:09 +0100 Subject: [PATCH] Version19.89.1 --- swad_agenda.c | 14 ++++++-------- swad_assignment.c | 14 ++++++-------- swad_attendance.c | 14 ++++++-------- swad_changelog.h | 3 ++- swad_forum.c | 30 +++++++++++++----------------- swad_game.c | 14 ++++++-------- swad_message.c | 14 ++++++-------- swad_pagination.c | 18 ++++++++++-------- swad_pagination.h | 6 +++--- swad_project.c | 14 ++++++-------- swad_survey.c | 14 ++++++-------- 11 files changed, 70 insertions(+), 85 deletions(-) diff --git a/swad_agenda.c b/swad_agenda.c index 71d679e2d..8f7808d6b 100644 --- a/swad_agenda.c +++ b/swad_agenda.c @@ -461,10 +461,9 @@ static void Agd_ShowEvents (Agd_AgendaType_t AgendaType) Gbl.Agenda.CurrentPage = (unsigned) Pagination.CurrentPage; /***** Write links to pages *****/ - if (Pagination.MoreThanOnePage) - Pag_WriteLinksToPagesCentered (WhatPaginate[AgendaType], - 0, - &Pagination); + Pag_WriteLinksToPagesCentered (WhatPaginate[AgendaType], + &Pagination, + 0); if (Gbl.Agenda.Num) { @@ -487,10 +486,9 @@ static void Agd_ShowEvents (Agd_AgendaType_t AgendaType) Ale_ShowAlert (Ale_INFO,Txt_No_events); /***** Write again links to pages *****/ - if (Pagination.MoreThanOnePage) - Pag_WriteLinksToPagesCentered (WhatPaginate[AgendaType], - 0, - &Pagination); + Pag_WriteLinksToPagesCentered (WhatPaginate[AgendaType], + &Pagination, + 0); /***** Button to create a new event *****/ if (AgendaType == Agd_MY_AGENDA) diff --git a/swad_assignment.c b/swad_assignment.c index 7cad56a3f..2e4d2e7c4 100644 --- a/swad_assignment.c +++ b/swad_assignment.c @@ -151,10 +151,9 @@ static void Asg_ShowAllAssignments (void) } /***** Write links to pages *****/ - if (Pagination.MoreThanOnePage) - Pag_WriteLinksToPagesCentered (Pag_ASSIGNMENTS, - 0, - &Pagination); + Pag_WriteLinksToPagesCentered (Pag_ASSIGNMENTS, + &Pagination, + 0); if (Gbl.Asgs.Num) { @@ -176,10 +175,9 @@ static void Asg_ShowAllAssignments (void) Ale_ShowAlert (Ale_INFO,Txt_No_assignments); /***** Write again links to pages *****/ - if (Pagination.MoreThanOnePage) - Pag_WriteLinksToPagesCentered (Pag_ASSIGNMENTS, - 0, - &Pagination); + Pag_WriteLinksToPagesCentered (Pag_ASSIGNMENTS, + &Pagination, + 0); /***** Button to create a new assignment *****/ if (Asg_CheckIfICanCreateAssignments ()) diff --git a/swad_attendance.c b/swad_attendance.c index 2f4708935..8d411f997 100644 --- a/swad_attendance.c +++ b/swad_attendance.c @@ -212,10 +212,9 @@ static void Att_ShowAllAttEvents (void) } /***** Write links to pages *****/ - if (Pagination.MoreThanOnePage) - Pag_WriteLinksToPagesCentered (Pag_ATT_EVENTS, - 0, - &Pagination); + Pag_WriteLinksToPagesCentered (Pag_ATT_EVENTS, + &Pagination, + 0); if (Gbl.AttEvents.Num) { @@ -263,10 +262,9 @@ static void Att_ShowAllAttEvents (void) Ale_ShowAlert (Ale_INFO,Txt_No_events); /***** Write again links to pages *****/ - if (Pagination.MoreThanOnePage) - Pag_WriteLinksToPagesCentered (Pag_ATT_EVENTS, - 0, - &Pagination); + Pag_WriteLinksToPagesCentered (Pag_ATT_EVENTS, + &Pagination, + 0); /***** Button to create a new attendance event *****/ if (ICanEdit) diff --git a/swad_changelog.h b/swad_changelog.h index f73fc5061..dc0ffeecf 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -490,13 +490,14 @@ enscript -2 --landscape --color --file-align=2 --highlight --line-numbers -o - * En OpenSWAD: ps2pdf source.ps destination.pdf */ -#define Log_PLATFORM_VERSION "SWAD 19.89 (2019-12-10)" +#define Log_PLATFORM_VERSION "SWAD 19.89.1 (2019-12-11)" #define CSS_FILE "swad19.88.5.css" #define JS_FILE "swad19.70.js" /* // TODO: Hacer un nuevo rol en los TFG: tutor externo (profesor de áreas no vinculadas con el centro, profesionales de empresas, etc.) // TODO: Impedir la creación y edición de proyectos si no son editables. + Version 19.89.1: Dec 11, 2019 Code refactoring in pagination. (248171 lines) Version 19.89: Dec 10, 2019 Game dates are in red colour if all their matches are finished or ot don't have matches. (248186 lines) 4 changes necessary in database: ALTER TABLE mch_matches CHANGE COLUMN Showing Showing ENUM('nothing','stem','answers','results','start','end') NOT NULL DEFAULT 'nothing'; diff --git a/swad_forum.c b/swad_forum.c index 03a02eb2a..59ea561ed 100644 --- a/swad_forum.c +++ b/swad_forum.c @@ -1037,10 +1037,9 @@ static void For_ShowPostsOfAThread (Ale_AlertType_t AlertType,const char *Messag Gbl.Forum.CurrentPagePsts = (unsigned) PaginationPsts.CurrentPage; /***** Write links to pages *****/ - if (PaginationPsts.MoreThanOnePage) - Pag_WriteLinksToPagesCentered (Pag_POSTS_FORUM, - Gbl.Forum.ForumSelected.ThrCod, - &PaginationPsts); + Pag_WriteLinksToPagesCentered (Pag_POSTS_FORUM, + &PaginationPsts, + Gbl.Forum.ForumSelected.ThrCod); /***** Begin table *****/ HTM_TABLE_BeginWidePadding (2); @@ -1098,10 +1097,9 @@ static void For_ShowPostsOfAThread (Ale_AlertType_t AlertType,const char *Messag HTM_TABLE_End (); /***** Write again links to pages *****/ - if (PaginationPsts.MoreThanOnePage) - Pag_WriteLinksToPagesCentered (Pag_POSTS_FORUM, - Gbl.Forum.ForumSelected.ThrCod, - &PaginationPsts); + Pag_WriteLinksToPagesCentered (Pag_POSTS_FORUM, + &PaginationPsts, + Gbl.Forum.ForumSelected.ThrCod); } /***** Free structure that stores the query result *****/ @@ -2476,10 +2474,9 @@ static void For_ShowForumThreadsHighlightingOneThread (long ThrCodHighlighted, if (NumThrs) { /***** Write links to all the pages in the listing of threads *****/ - if (PaginationThrs.MoreThanOnePage) - Pag_WriteLinksToPagesCentered (Pag_THREADS_FORUM, - 0, - &PaginationThrs); + Pag_WriteLinksToPagesCentered (Pag_THREADS_FORUM, + &PaginationThrs, + 0); /***** Heading row *****/ HTM_TABLE_BeginWideMarginPadding (2); @@ -2530,10 +2527,9 @@ static void For_ShowForumThreadsHighlightingOneThread (long ThrCodHighlighted, HTM_TABLE_End (); /***** Write links to all the pages in the listing of threads *****/ - if (PaginationThrs.MoreThanOnePage) - Pag_WriteLinksToPagesCentered (Pag_THREADS_FORUM, - 0, - &PaginationThrs); + Pag_WriteLinksToPagesCentered (Pag_THREADS_FORUM, + &PaginationThrs, + 0); } /***** Put a form to write the first post of a new thread *****/ @@ -3360,8 +3356,8 @@ static void For_ListForumThrs (long ThrCods[Pag_ITEMS_PER_PAGE], Pag_CalculatePagination (&PaginationPsts); PaginationPsts.Anchor = For_FORUM_POSTS_SECTION_ID; Pag_WriteLinksToPages (Pag_POSTS_FORUM, - Thr.ThrCod, &PaginationPsts, + Thr.ThrCod, Thr.Enabled[For_FIRST_MSG], Thr.Subject, Thr.NumUnreadPosts ? The_ClassFormInBoxBold[Gbl.Prefs.Theme] : diff --git a/swad_game.c b/swad_game.c index 640fa0c24..74408a620 100644 --- a/swad_game.c +++ b/swad_game.c @@ -212,10 +212,9 @@ static void Gam_ListAllGames (void) Hlp_ASSESSMENT_Games,Box_NOT_CLOSABLE); /***** Write links to pages *****/ - if (Pagination.MoreThanOnePage) - Pag_WriteLinksToPagesCentered (Pag_GAMES, - 0, - &Pagination); + Pag_WriteLinksToPagesCentered (Pag_GAMES, + &Pagination, + 0); if (Gbl.Games.Num) { @@ -272,10 +271,9 @@ static void Gam_ListAllGames (void) Ale_ShowAlert (Ale_INFO,Txt_No_games); /***** Write again links to pages *****/ - if (Pagination.MoreThanOnePage) - Pag_WriteLinksToPagesCentered (Pag_GAMES, - 0, - &Pagination); + Pag_WriteLinksToPagesCentered (Pag_GAMES, + &Pagination, + 0); /***** Button to create a new game *****/ if (Gam_CheckIfICanEditGames ()) diff --git a/swad_message.c b/swad_message.c index 992f29d01..8f4481c85 100644 --- a/swad_message.c +++ b/swad_message.c @@ -1816,10 +1816,9 @@ static void Msg_ShowSentOrReceivedMessages (void) Gbl.Msg.CurrentPage); /***** Write links to pages *****/ - if (Pagination.MoreThanOnePage) - Pag_WriteLinksToPagesCentered (WhatPaginate[Gbl.Msg.TypeOfMessages], - 0, - &Pagination); + Pag_WriteLinksToPagesCentered (WhatPaginate[Gbl.Msg.TypeOfMessages], + &Pagination, + 0); /***** Show received / sent messages in this page *****/ HTM_TABLE_BeginWidePadding (2); @@ -1840,10 +1839,9 @@ static void Msg_ShowSentOrReceivedMessages (void) HTM_TABLE_End (); /***** Write again links to pages *****/ - if (Pagination.MoreThanOnePage) - Pag_WriteLinksToPagesCentered (WhatPaginate[Gbl.Msg.TypeOfMessages], - 0, - &Pagination); + Pag_WriteLinksToPagesCentered (WhatPaginate[Gbl.Msg.TypeOfMessages], + &Pagination, + 0); } /***** End box *****/ diff --git a/swad_pagination.c b/swad_pagination.c index 2040d5e62..477386ca4 100644 --- a/swad_pagination.c +++ b/swad_pagination.c @@ -128,14 +128,16 @@ void Pag_CalculatePagination (struct Pagination *Pagination) /*****************************************************************************/ void Pag_WriteLinksToPagesCentered (Pag_WhatPaginate_t WhatPaginate, - long ThrCod, - struct Pagination *Pagination) + struct Pagination *Pagination, + long ThrCod) { - HTM_DIV_Begin ("class=\"CM\""); - Pag_WriteLinksToPages (WhatPaginate, - ThrCod, - Pagination,true,NULL,"PAG_TXT",false); - HTM_DIV_End (); + if (Pagination->MoreThanOnePage) + { + HTM_DIV_Begin ("class=\"CM\""); + Pag_WriteLinksToPages (WhatPaginate,Pagination,ThrCod, + true,NULL,"PAG_TXT",false); + HTM_DIV_End (); + } } /*****************************************************************************/ @@ -143,8 +145,8 @@ void Pag_WriteLinksToPagesCentered (Pag_WhatPaginate_t WhatPaginate, /*****************************************************************************/ void Pag_WriteLinksToPages (Pag_WhatPaginate_t WhatPaginate, - long ThrCod, struct Pagination *Pagination, + long ThrCod, bool FirstMsgEnabled, const char *Subject,const char *ClassTxt, bool LinkToPagCurrent) diff --git a/swad_pagination.h b/swad_pagination.h index 07f4a001f..c55bd4171 100644 --- a/swad_pagination.h +++ b/swad_pagination.h @@ -74,11 +74,11 @@ struct Pagination // Used for threads and messages pagination void Pag_CalculatePagination (struct Pagination *Pagination); void Pag_WriteLinksToPagesCentered (Pag_WhatPaginate_t WhatPaginate, - long ThrCod, - struct Pagination *Pagination); + struct Pagination *Pagination, + long ThrCod); void Pag_WriteLinksToPages (Pag_WhatPaginate_t WhatPaginate, - long ThrCod, struct Pagination *Pagination, + long ThrCod, bool FirstMsgEnabled, const char *Subject,const char *ClassTxt, bool LinkToPagCurrent); diff --git a/swad_project.c b/swad_project.c index 84a51e061..3047033fa 100644 --- a/swad_project.c +++ b/swad_project.c @@ -425,10 +425,9 @@ static void Prj_ShowPrjsInCurrentPage (void) if (Gbl.Prjs.Num) { /***** Write links to pages *****/ - if (Pagination.MoreThanOnePage) - Pag_WriteLinksToPagesCentered (Pag_PROJECTS, - 0, - &Pagination); + Pag_WriteLinksToPagesCentered (Pag_PROJECTS, + &Pagination, + 0); /***** Allocate memory for the project *****/ Prj_AllocMemProject (&Prj); @@ -471,10 +470,9 @@ static void Prj_ShowPrjsInCurrentPage (void) Prj_FreeMemProject (&Prj); /***** Write again links to pages *****/ - if (Pagination.MoreThanOnePage) - Pag_WriteLinksToPagesCentered (Pag_PROJECTS, - 0, - &Pagination); + Pag_WriteLinksToPagesCentered (Pag_PROJECTS, + &Pagination, + 0); } else // No projects created Ale_ShowAlert (Ale_INFO,Txt_No_projects); diff --git a/swad_survey.c b/swad_survey.c index 02821e2d1..f82448c45 100644 --- a/swad_survey.c +++ b/swad_survey.c @@ -229,10 +229,9 @@ static void Svy_ListAllSurveys (void) } /***** Write links to pages *****/ - if (Pagination.MoreThanOnePage) - Pag_WriteLinksToPagesCentered (Pag_SURVEYS, - 0, - &Pagination); + Pag_WriteLinksToPagesCentered (Pag_SURVEYS, + &Pagination, + 0); if (Gbl.Svys.Num) { @@ -284,10 +283,9 @@ static void Svy_ListAllSurveys (void) Ale_ShowAlert (Ale_INFO,Txt_No_surveys); /***** Write again links to pages *****/ - if (Pagination.MoreThanOnePage) - Pag_WriteLinksToPagesCentered (Pag_SURVEYS, - 0, - &Pagination); + Pag_WriteLinksToPagesCentered (Pag_SURVEYS, + &Pagination, + 0); /***** Button to create a new survey *****/ if (Svy_CheckIfICanCreateSvy ())