2014-12-01 23:55:08 +01:00
|
|
|
|
// swad_pagination.c: pagination of assignments, forums and messages
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
SWAD (Shared Workspace At a Distance),
|
|
|
|
|
is a web platform developed at the University of Granada (Spain),
|
|
|
|
|
and used to support university teaching.
|
|
|
|
|
|
|
|
|
|
This file is part of SWAD core.
|
2019-01-07 21:52:19 +01:00
|
|
|
|
Copyright (C) 1999-2019 Antonio Ca<EFBFBD>as Vargas
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
This program is free software: you can redistribute it and/or modify
|
|
|
|
|
it under the terms of the GNU Affero General Public License as
|
|
|
|
|
published by the Free Software Foundation, either version 3 of the
|
|
|
|
|
License, or (at your option) any later version.
|
|
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
GNU Affero General Public License for more details.
|
|
|
|
|
|
|
|
|
|
You should have received a copy of the GNU Affero General Public License
|
|
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
*/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/********************************** Headers **********************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2019-11-18 18:19:41 +01:00
|
|
|
|
#define _GNU_SOURCE // For asprintf
|
2014-12-01 23:55:08 +01:00
|
|
|
|
#include <linux/stddef.h> // For NULL
|
2019-11-18 18:19:41 +01:00
|
|
|
|
#include <stdio.h> // For asprintf
|
2019-11-19 00:17:23 +01:00
|
|
|
|
#include <stdlib.h> // For free
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
#include "swad_action.h"
|
|
|
|
|
#include "swad_database.h"
|
2018-11-09 20:47:39 +01:00
|
|
|
|
#include "swad_form.h"
|
2014-12-01 23:55:08 +01:00
|
|
|
|
#include "swad_forum.h"
|
|
|
|
|
#include "swad_global.h"
|
2019-10-23 20:07:56 +02:00
|
|
|
|
#include "swad_HTML.h"
|
2014-12-01 23:55:08 +01:00
|
|
|
|
#include "swad_parameter.h"
|
2017-09-17 16:58:09 +02:00
|
|
|
|
#include "swad_project.h"
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/*************** External global variables from others modules ***************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
extern struct Globals Gbl;
|
|
|
|
|
extern const Act_Action_t For_ActionsSeeFor[For_NUM_TYPES_FORUM];
|
|
|
|
|
extern const Act_Action_t For_ActionsSeePstFor[For_NUM_TYPES_FORUM];
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
2017-04-13 20:09:22 +02:00
|
|
|
|
/***************************** Private constants *****************************/
|
2014-12-01 23:55:08 +01:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2017-04-13 20:09:22 +02:00
|
|
|
|
static const char *Pag_ParamNumPag[Pag_NUM_WHAT_PAGINATE] =
|
|
|
|
|
{
|
2019-11-21 01:27:17 +01:00
|
|
|
|
[Pag_ASSIGNMENTS ] = "NumPagAsg",
|
|
|
|
|
[Pag_PROJECTS ] = "NumPagPrj",
|
|
|
|
|
[Pag_GAMES ] = "NumPagGam",
|
|
|
|
|
[Pag_SURVEYS ] = "NumPagSvy",
|
|
|
|
|
[Pag_ATT_EVENTS ] = "NumPagAtt",
|
|
|
|
|
[Pag_THREADS_FORUM ] = "NumPagThr",
|
|
|
|
|
[Pag_POSTS_FORUM ] = "NumPagPst",
|
|
|
|
|
[Pag_MESSAGES_RECEIVED] = "NumPagRcv",
|
|
|
|
|
[Pag_MESSAGES_SENT ] = "NumPagSnt",
|
|
|
|
|
[Pag_MY_AGENDA ] = "NumPagMyAgd",
|
|
|
|
|
[Pag_ANOTHER_AGENDA ] = "NumPagOthAgd",
|
2017-04-13 20:09:22 +02:00
|
|
|
|
};
|
|
|
|
|
|
2014-12-01 23:55:08 +01:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/***************************** Private prototypes ****************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/******* Calculate variables related to the pagination of the messages *******/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
// Return the number of subsets of N elements in a set of NumElements elements
|
|
|
|
|
#define NumSubsetsOfNElements(NumElements,N) ((NumElements+(N-1)) / N)
|
|
|
|
|
#define NUM_PAGES_BEFORE_CURRENT 1
|
|
|
|
|
#define NUM_PAGES_AFTER_CURRENT 1
|
|
|
|
|
|
|
|
|
|
void Pag_CalculatePagination (struct Pagination *Pagination)
|
|
|
|
|
{
|
2017-04-18 16:44:44 +02:00
|
|
|
|
Pagination->StartPage =
|
|
|
|
|
Pagination->LeftPage =
|
|
|
|
|
Pagination->RightPage =
|
|
|
|
|
Pagination->EndPage = 1;
|
2014-12-01 23:55:08 +01:00
|
|
|
|
Pagination->MoreThanOnePage = false;
|
|
|
|
|
if ((Pagination->NumPags = NumSubsetsOfNElements (Pagination->NumItems,Pag_ITEMS_PER_PAGE)) > 1)
|
|
|
|
|
{
|
|
|
|
|
Pagination->MoreThanOnePage = true;
|
|
|
|
|
|
|
|
|
|
/* If page to show is 0 (special code), then last page must be shown.
|
|
|
|
|
If page to show is greater than number of pages, then show last page also */
|
|
|
|
|
if (Pagination->CurrentPage == 0 ||
|
|
|
|
|
Pagination->CurrentPage > Pagination->NumPags)
|
|
|
|
|
Pagination->CurrentPage = Pagination->NumPags;
|
|
|
|
|
|
|
|
|
|
/* Compute first page with link around the current */
|
2017-04-18 16:44:44 +02:00
|
|
|
|
if (Pagination->CurrentPage <= NUM_PAGES_BEFORE_CURRENT)
|
2014-12-01 23:55:08 +01:00
|
|
|
|
Pagination->StartPage = 1;
|
2017-04-18 16:44:44 +02:00
|
|
|
|
else
|
|
|
|
|
Pagination->StartPage = Pagination->CurrentPage - NUM_PAGES_BEFORE_CURRENT;
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
/* Compute last page with link around the current */
|
|
|
|
|
if ((Pagination->EndPage = Pagination->CurrentPage + NUM_PAGES_AFTER_CURRENT) > Pagination->NumPags)
|
|
|
|
|
Pagination->EndPage = Pagination->NumPags;
|
|
|
|
|
|
|
|
|
|
/* Compute left page with link in the middle of first page and current page */
|
|
|
|
|
Pagination->LeftPage = (1 + Pagination->StartPage) / 2;
|
|
|
|
|
|
|
|
|
|
/* Compute right page with link in the middle of current page and last page */
|
|
|
|
|
Pagination->RightPage = (Pagination->EndPage + Pagination->NumPags) / 2;
|
|
|
|
|
}
|
|
|
|
|
else // Only one page
|
|
|
|
|
Pagination->CurrentPage = 1; // If there is only a page, the number of page to show is 1
|
|
|
|
|
|
|
|
|
|
Pagination->LastItemVisible = Pagination->CurrentPage * Pag_ITEMS_PER_PAGE;
|
2016-10-26 01:23:02 +02:00
|
|
|
|
Pagination->FirstItemVisible = Pagination->LastItemVisible - (Pag_ITEMS_PER_PAGE - 1);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
if (Pagination->LastItemVisible > Pagination->NumItems)
|
|
|
|
|
Pagination->LastItemVisible = Pagination->NumItems;
|
2017-04-11 15:17:27 +02:00
|
|
|
|
|
|
|
|
|
/* Default anchor */
|
|
|
|
|
Pagination->Anchor = NULL;
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/************** Show enlaces a distintas p<>ginas of messages *****************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2017-04-17 11:57:55 +02:00
|
|
|
|
void Pag_WriteLinksToPagesCentered (Pag_WhatPaginate_t WhatPaginate,
|
|
|
|
|
long ThrCod,
|
|
|
|
|
struct Pagination *Pagination)
|
2014-12-01 23:55:08 +01:00
|
|
|
|
{
|
2019-10-24 00:04:40 +02:00
|
|
|
|
HTM_DIV_Begin ("class=\"CM\"");
|
2017-04-17 11:57:55 +02:00
|
|
|
|
Pag_WriteLinksToPages (WhatPaginate,
|
|
|
|
|
ThrCod,
|
2017-04-18 22:46:43 +02:00
|
|
|
|
Pagination,true,NULL,"PAG_TXT",false);
|
2019-10-23 20:07:56 +02:00
|
|
|
|
HTM_DIV_End ();
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/********************** Show links to pages of messages **********************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2017-04-17 11:57:55 +02:00
|
|
|
|
void Pag_WriteLinksToPages (Pag_WhatPaginate_t WhatPaginate,
|
|
|
|
|
long ThrCod,
|
|
|
|
|
struct Pagination *Pagination,
|
2019-11-18 18:19:41 +01:00
|
|
|
|
bool FirstMsgEnabled,
|
|
|
|
|
const char *Subject,const char *ClassTxt,
|
2014-12-01 23:55:08 +01:00
|
|
|
|
bool LinkToPagCurrent)
|
|
|
|
|
{
|
2017-04-18 22:46:43 +02:00
|
|
|
|
extern const char *Txt_Page_X_of_Y;
|
2019-03-06 10:13:39 +01:00
|
|
|
|
extern const char *Txt_FORUM_Post_banned;
|
2017-04-18 16:44:44 +02:00
|
|
|
|
unsigned NumPage;
|
2019-11-18 18:19:41 +01:00
|
|
|
|
char *ClassLink;
|
|
|
|
|
|
2014-12-01 23:55:08 +01:00
|
|
|
|
/***** Link to page 1, including a text *****/
|
|
|
|
|
if (Subject)
|
|
|
|
|
{
|
2019-10-24 23:03:19 +02:00
|
|
|
|
HTM_DIV_Begin (NULL);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
if (LinkToPagCurrent)
|
|
|
|
|
{
|
|
|
|
|
switch (WhatPaginate)
|
|
|
|
|
{
|
|
|
|
|
case Pag_ASSIGNMENTS:
|
2018-11-09 20:47:39 +01:00
|
|
|
|
Frm_StartFormAnchor (ActSeeAsg,Pagination->Anchor);
|
2017-04-13 20:09:22 +02:00
|
|
|
|
Pag_PutHiddenParamPagNum (WhatPaginate,1);
|
2017-01-29 12:42:19 +01:00
|
|
|
|
Asg_PutHiddenParamAsgOrder ();
|
2014-12-01 23:55:08 +01:00
|
|
|
|
Grp_PutParamWhichGrps ();
|
|
|
|
|
break;
|
2017-09-17 16:58:09 +02:00
|
|
|
|
case Pag_PROJECTS:
|
2018-11-09 20:47:39 +01:00
|
|
|
|
Frm_StartFormAnchor (ActSeePrj,Pagination->Anchor);
|
2017-10-10 12:52:02 +02:00
|
|
|
|
Prj_PutParams (&Gbl.Prjs.Filter,
|
2017-10-10 01:26:45 +02:00
|
|
|
|
Gbl.Prjs.SelectedOrder,
|
|
|
|
|
1,
|
|
|
|
|
-1L);
|
2017-09-17 16:58:09 +02:00
|
|
|
|
break;
|
2017-09-13 16:24:29 +02:00
|
|
|
|
case Pag_GAMES:
|
2018-11-09 20:47:39 +01:00
|
|
|
|
Frm_StartFormAnchor (ActSeeAllGam,Pagination->Anchor);
|
2017-09-13 16:24:29 +02:00
|
|
|
|
Pag_PutHiddenParamPagNum (WhatPaginate,1);
|
|
|
|
|
Asg_PutHiddenParamAsgOrder ();
|
|
|
|
|
Grp_PutParamWhichGrps ();
|
|
|
|
|
break;
|
2017-04-27 10:15:07 +02:00
|
|
|
|
case Pag_SURVEYS:
|
2018-11-09 20:47:39 +01:00
|
|
|
|
Frm_StartFormAnchor (ActSeeAllSvy,Pagination->Anchor);
|
2017-04-27 10:15:07 +02:00
|
|
|
|
Pag_PutHiddenParamPagNum (WhatPaginate,1);
|
|
|
|
|
Asg_PutHiddenParamAsgOrder ();
|
|
|
|
|
Grp_PutParamWhichGrps ();
|
|
|
|
|
break;
|
2014-12-01 23:55:08 +01:00
|
|
|
|
case Pag_ATT_EVENTS:
|
2018-11-09 20:47:39 +01:00
|
|
|
|
Frm_StartFormAnchor (ActSeeAtt,Pagination->Anchor);
|
2017-04-13 20:09:22 +02:00
|
|
|
|
Pag_PutHiddenParamPagNum (WhatPaginate,1);
|
2017-01-29 12:42:19 +01:00
|
|
|
|
Att_PutHiddenParamAttOrder ();
|
2014-12-01 23:55:08 +01:00
|
|
|
|
Grp_PutParamWhichGrps ();
|
|
|
|
|
break;
|
|
|
|
|
case Pag_THREADS_FORUM:
|
2018-11-09 20:47:39 +01:00
|
|
|
|
Frm_StartFormAnchor (For_ActionsSeeFor[Gbl.Forum.ForumSelected.Type],
|
2017-04-11 15:17:27 +02:00
|
|
|
|
Pagination->Anchor);
|
2017-04-18 16:44:44 +02:00
|
|
|
|
For_PutAllHiddenParamsForum (1, // Page of threads = first
|
|
|
|
|
1, // Page of posts = first
|
|
|
|
|
Gbl.Forum.ForumSet,
|
2017-04-18 13:17:40 +02:00
|
|
|
|
Gbl.Forum.ThreadsOrder,
|
2017-04-18 01:25:44 +02:00
|
|
|
|
Gbl.Forum.ForumSelected.Location,
|
|
|
|
|
-1L,
|
|
|
|
|
-1L);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
break;
|
|
|
|
|
case Pag_POSTS_FORUM:
|
2018-11-09 20:47:39 +01:00
|
|
|
|
Frm_StartFormAnchor (For_ActionsSeePstFor[Gbl.Forum.ForumSelected.Type],
|
2017-04-11 15:17:27 +02:00
|
|
|
|
Pagination->Anchor);
|
2017-04-18 16:44:44 +02:00
|
|
|
|
For_PutAllHiddenParamsForum (Gbl.Forum.CurrentPageThrs, // Page of threads = current
|
|
|
|
|
1, // Page of posts = first
|
|
|
|
|
Gbl.Forum.ForumSet,
|
2017-04-18 13:17:40 +02:00
|
|
|
|
Gbl.Forum.ThreadsOrder,
|
2017-04-18 01:25:44 +02:00
|
|
|
|
Gbl.Forum.ForumSelected.Location,
|
|
|
|
|
ThrCod,
|
|
|
|
|
-1L);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
break;
|
2017-04-13 20:09:22 +02:00
|
|
|
|
case Pag_MESSAGES_RECEIVED:
|
2018-11-09 20:47:39 +01:00
|
|
|
|
Frm_StartFormAnchor (ActSeeRcvMsg,Pagination->Anchor);
|
2017-04-13 20:09:22 +02:00
|
|
|
|
Pag_PutHiddenParamPagNum (WhatPaginate,1);
|
|
|
|
|
Msg_PutHiddenParamsMsgsFilters ();
|
|
|
|
|
break;
|
|
|
|
|
case Pag_MESSAGES_SENT:
|
2018-11-09 20:47:39 +01:00
|
|
|
|
Frm_StartFormAnchor (ActSeeSntMsg,Pagination->Anchor);
|
2017-04-13 20:09:22 +02:00
|
|
|
|
Pag_PutHiddenParamPagNum (WhatPaginate,1);
|
|
|
|
|
Msg_PutHiddenParamsMsgsFilters ();
|
|
|
|
|
break;
|
2017-03-21 14:52:07 +01:00
|
|
|
|
case Pag_MY_AGENDA:
|
2018-11-09 20:47:39 +01:00
|
|
|
|
Frm_StartFormAnchor (ActSeeMyAgd,Pagination->Anchor);
|
2017-04-13 20:09:22 +02:00
|
|
|
|
Agd_PutParamsMyAgenda (Gbl.Agenda.Past__FutureEvents,
|
|
|
|
|
Gbl.Agenda.PrivatPublicEvents,
|
|
|
|
|
Gbl.Agenda.HiddenVisiblEvents,
|
2019-11-18 09:20:44 +01:00
|
|
|
|
Gbl.Agenda.SelectedOrder,
|
2017-04-13 20:09:22 +02:00
|
|
|
|
1,
|
|
|
|
|
-1L);
|
2016-12-06 21:08:28 +01:00
|
|
|
|
break;
|
2017-03-21 14:52:07 +01:00
|
|
|
|
case Pag_ANOTHER_AGENDA:
|
2018-11-09 20:47:39 +01:00
|
|
|
|
Frm_StartFormAnchor (ActSeeUsrAgd,Pagination->Anchor);
|
2017-01-29 12:42:19 +01:00
|
|
|
|
Agd_PutHiddenParamEventsOrder ();
|
2017-04-13 20:09:22 +02:00
|
|
|
|
Pag_PutHiddenParamPagNum (WhatPaginate,1);
|
2016-12-06 21:26:02 +01:00
|
|
|
|
Usr_PutParamOtherUsrCodEncrypted ();
|
|
|
|
|
break;
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
2018-10-18 02:02:32 +02:00
|
|
|
|
snprintf (Gbl.Title,sizeof (Gbl.Title),
|
|
|
|
|
Txt_Page_X_of_Y,
|
|
|
|
|
1,Pagination->NumPags);
|
2019-11-18 20:12:10 +01:00
|
|
|
|
if (asprintf (&ClassLink,"BT_LINK LT %s",ClassTxt) < 0)
|
|
|
|
|
Lay_NotEnoughMemoryExit ();
|
2019-11-20 10:17:42 +01:00
|
|
|
|
HTM_BUTTON_SUBMIT_Begin (Gbl.Title,ClassLink,NULL);
|
2019-11-18 20:12:10 +01:00
|
|
|
|
free (ClassLink);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
|
|
|
|
else
|
2019-11-18 18:19:41 +01:00
|
|
|
|
HTM_SPAN_Begin ("class=\"%s\"",ClassTxt);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
if (FirstMsgEnabled)
|
2019-11-10 12:36:37 +01:00
|
|
|
|
HTM_Txt (Subject);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
else
|
2019-11-11 00:15:44 +01:00
|
|
|
|
HTM_TxtF ("[%s]",Txt_FORUM_Post_banned);
|
2015-03-13 00:16:02 +01:00
|
|
|
|
if (LinkToPagCurrent)
|
|
|
|
|
{
|
2019-11-18 18:19:41 +01:00
|
|
|
|
HTM_BUTTON_End ();
|
2018-11-09 20:47:39 +01:00
|
|
|
|
Frm_EndForm ();
|
2015-03-13 00:16:02 +01:00
|
|
|
|
}
|
|
|
|
|
else
|
2019-11-07 10:24:00 +01:00
|
|
|
|
HTM_SPAN_End ();
|
2019-10-23 20:07:56 +02:00
|
|
|
|
HTM_DIV_End ();
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
|
|
|
|
|
2017-04-18 22:46:43 +02:00
|
|
|
|
/***** Links to several pages start here *****/
|
2014-12-01 23:55:08 +01:00
|
|
|
|
if (Pagination->MoreThanOnePage)
|
|
|
|
|
{
|
2019-11-18 20:12:10 +01:00
|
|
|
|
if (asprintf (&ClassLink,"BT_LINK PAG %s",ClassTxt) < 0)
|
|
|
|
|
Lay_NotEnoughMemoryExit ();
|
|
|
|
|
|
2014-12-01 23:55:08 +01:00
|
|
|
|
/***** Possible link to page 1 *****/
|
|
|
|
|
if (Pagination->StartPage > 1)
|
|
|
|
|
{
|
|
|
|
|
switch (WhatPaginate)
|
|
|
|
|
{
|
|
|
|
|
case Pag_ASSIGNMENTS:
|
2018-11-09 20:47:39 +01:00
|
|
|
|
Frm_StartFormAnchor (ActSeeAsg,Pagination->Anchor);
|
2017-04-13 20:09:22 +02:00
|
|
|
|
Pag_PutHiddenParamPagNum (WhatPaginate,1);
|
2017-01-29 12:42:19 +01:00
|
|
|
|
Asg_PutHiddenParamAsgOrder ();
|
2014-12-01 23:55:08 +01:00
|
|
|
|
Grp_PutParamWhichGrps ();
|
|
|
|
|
break;
|
2017-09-17 16:58:09 +02:00
|
|
|
|
case Pag_PROJECTS:
|
2018-11-09 20:47:39 +01:00
|
|
|
|
Frm_StartFormAnchor (ActSeePrj,Pagination->Anchor);
|
2017-10-10 12:52:02 +02:00
|
|
|
|
Prj_PutParams (&Gbl.Prjs.Filter,
|
2017-10-10 01:26:45 +02:00
|
|
|
|
Gbl.Prjs.SelectedOrder,
|
|
|
|
|
1,
|
|
|
|
|
-1L);
|
2017-09-17 16:58:09 +02:00
|
|
|
|
break;
|
2017-09-13 16:24:29 +02:00
|
|
|
|
case Pag_GAMES:
|
2018-11-09 20:47:39 +01:00
|
|
|
|
Frm_StartFormAnchor (ActSeeAllGam,Pagination->Anchor);
|
2017-09-13 16:24:29 +02:00
|
|
|
|
Pag_PutHiddenParamPagNum (WhatPaginate,1);
|
|
|
|
|
Asg_PutHiddenParamAsgOrder ();
|
|
|
|
|
Grp_PutParamWhichGrps ();
|
|
|
|
|
break;
|
2017-04-27 10:15:07 +02:00
|
|
|
|
case Pag_SURVEYS:
|
2018-11-09 20:47:39 +01:00
|
|
|
|
Frm_StartFormAnchor (ActSeeAllSvy,Pagination->Anchor);
|
2017-04-27 10:15:07 +02:00
|
|
|
|
Pag_PutHiddenParamPagNum (WhatPaginate,1);
|
|
|
|
|
Asg_PutHiddenParamAsgOrder ();
|
|
|
|
|
Grp_PutParamWhichGrps ();
|
|
|
|
|
break;
|
2014-12-01 23:55:08 +01:00
|
|
|
|
case Pag_ATT_EVENTS:
|
2018-11-09 20:47:39 +01:00
|
|
|
|
Frm_StartFormAnchor (ActSeeAtt,Pagination->Anchor);
|
2017-04-13 20:09:22 +02:00
|
|
|
|
Pag_PutHiddenParamPagNum (WhatPaginate,1);
|
2017-01-29 12:42:19 +01:00
|
|
|
|
Att_PutHiddenParamAttOrder ();
|
2014-12-01 23:55:08 +01:00
|
|
|
|
Grp_PutParamWhichGrps ();
|
|
|
|
|
break;
|
|
|
|
|
case Pag_THREADS_FORUM:
|
2018-11-09 20:47:39 +01:00
|
|
|
|
Frm_StartFormAnchor (For_ActionsSeeFor[Gbl.Forum.ForumSelected.Type],
|
2017-04-11 15:17:27 +02:00
|
|
|
|
Pagination->Anchor);
|
2017-04-18 16:44:44 +02:00
|
|
|
|
For_PutAllHiddenParamsForum (1, // Page of threads = first
|
|
|
|
|
1, // Page of posts = first
|
|
|
|
|
Gbl.Forum.ForumSet,
|
2017-04-18 13:17:40 +02:00
|
|
|
|
Gbl.Forum.ThreadsOrder,
|
2017-04-18 01:25:44 +02:00
|
|
|
|
Gbl.Forum.ForumSelected.Location,
|
|
|
|
|
-1L,
|
|
|
|
|
-1L);
|
|
|
|
|
break;
|
2014-12-01 23:55:08 +01:00
|
|
|
|
case Pag_POSTS_FORUM:
|
2018-11-09 20:47:39 +01:00
|
|
|
|
Frm_StartFormAnchor (For_ActionsSeePstFor[Gbl.Forum.ForumSelected.Type],
|
2017-04-11 15:17:27 +02:00
|
|
|
|
Pagination->Anchor);
|
2017-04-18 16:44:44 +02:00
|
|
|
|
For_PutAllHiddenParamsForum (Gbl.Forum.CurrentPageThrs, // Page of threads = current
|
|
|
|
|
1, // Page of posts = first
|
|
|
|
|
Gbl.Forum.ForumSet,
|
2017-04-18 13:17:40 +02:00
|
|
|
|
Gbl.Forum.ThreadsOrder,
|
2017-04-18 01:25:44 +02:00
|
|
|
|
Gbl.Forum.ForumSelected.Location,
|
|
|
|
|
ThrCod,
|
|
|
|
|
-1L);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
break;
|
2017-04-13 20:09:22 +02:00
|
|
|
|
case Pag_MESSAGES_RECEIVED:
|
2018-11-09 20:47:39 +01:00
|
|
|
|
Frm_StartFormAnchor (ActSeeRcvMsg,Pagination->Anchor);
|
2017-04-13 20:09:22 +02:00
|
|
|
|
Pag_PutHiddenParamPagNum (WhatPaginate,1);
|
|
|
|
|
Msg_PutHiddenParamsMsgsFilters ();
|
|
|
|
|
break;
|
|
|
|
|
case Pag_MESSAGES_SENT:
|
2018-11-09 20:47:39 +01:00
|
|
|
|
Frm_StartFormAnchor (ActSeeSntMsg,Pagination->Anchor);
|
2017-04-13 20:09:22 +02:00
|
|
|
|
Pag_PutHiddenParamPagNum (WhatPaginate,1);
|
|
|
|
|
Msg_PutHiddenParamsMsgsFilters ();
|
|
|
|
|
break;
|
2017-03-21 14:52:07 +01:00
|
|
|
|
case Pag_MY_AGENDA:
|
2018-11-09 20:47:39 +01:00
|
|
|
|
Frm_StartFormAnchor (ActSeeMyAgd,Pagination->Anchor);
|
2017-04-13 20:09:22 +02:00
|
|
|
|
Agd_PutParamsMyAgenda (Gbl.Agenda.Past__FutureEvents,
|
|
|
|
|
Gbl.Agenda.PrivatPublicEvents,
|
|
|
|
|
Gbl.Agenda.HiddenVisiblEvents,
|
2019-11-18 09:20:44 +01:00
|
|
|
|
Gbl.Agenda.SelectedOrder,
|
2017-04-13 20:09:22 +02:00
|
|
|
|
1,
|
|
|
|
|
-1L);
|
2016-12-06 21:08:28 +01:00
|
|
|
|
break;
|
2017-03-21 14:52:07 +01:00
|
|
|
|
case Pag_ANOTHER_AGENDA:
|
2018-11-09 20:47:39 +01:00
|
|
|
|
Frm_StartFormAnchor (ActSeeUsrAgd,Pagination->Anchor);
|
2017-01-29 12:42:19 +01:00
|
|
|
|
Agd_PutHiddenParamEventsOrder ();
|
2017-04-13 20:09:22 +02:00
|
|
|
|
Pag_PutHiddenParamPagNum (WhatPaginate,1);
|
2016-12-06 21:26:02 +01:00
|
|
|
|
Usr_PutParamOtherUsrCodEncrypted ();
|
|
|
|
|
break;
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
2018-10-18 02:02:32 +02:00
|
|
|
|
snprintf (Gbl.Title,sizeof (Gbl.Title),
|
|
|
|
|
Txt_Page_X_of_Y,
|
|
|
|
|
1,Pagination->NumPags);
|
2019-11-20 10:17:42 +01:00
|
|
|
|
HTM_BUTTON_SUBMIT_Begin (Gbl.Title,ClassLink,NULL);
|
2019-11-11 00:15:44 +01:00
|
|
|
|
HTM_Unsigned (1);
|
2019-11-18 18:19:41 +01:00
|
|
|
|
HTM_BUTTON_End ();
|
2018-11-09 20:47:39 +01:00
|
|
|
|
Frm_EndForm ();
|
2014-12-01 23:55:08 +01:00
|
|
|
|
if (Pagination->LeftPage > 2)
|
2019-11-07 10:24:00 +01:00
|
|
|
|
{
|
2019-11-18 18:19:41 +01:00
|
|
|
|
HTM_SPAN_Begin ("class=\"%s\"",ClassTxt);
|
2019-11-11 00:15:44 +01:00
|
|
|
|
HTM_Txt ("…");
|
2019-11-07 10:24:00 +01:00
|
|
|
|
HTM_SPAN_End ();
|
|
|
|
|
}
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/***** Posible link to page left *****/
|
2017-04-18 16:44:44 +02:00
|
|
|
|
if (Pagination->LeftPage > 1 &&
|
|
|
|
|
Pagination->LeftPage < Pagination->StartPage)
|
2014-12-01 23:55:08 +01:00
|
|
|
|
{
|
|
|
|
|
switch (WhatPaginate)
|
|
|
|
|
{
|
|
|
|
|
case Pag_ASSIGNMENTS:
|
2018-11-09 20:47:39 +01:00
|
|
|
|
Frm_StartFormAnchor (ActSeeAsg,Pagination->Anchor);
|
2017-04-13 20:09:22 +02:00
|
|
|
|
Pag_PutHiddenParamPagNum (WhatPaginate,Pagination->LeftPage);
|
2017-01-29 12:42:19 +01:00
|
|
|
|
Asg_PutHiddenParamAsgOrder ();
|
2014-12-01 23:55:08 +01:00
|
|
|
|
Grp_PutParamWhichGrps ();
|
|
|
|
|
break;
|
2017-09-17 16:58:09 +02:00
|
|
|
|
case Pag_PROJECTS:
|
2018-11-09 20:47:39 +01:00
|
|
|
|
Frm_StartFormAnchor (ActSeePrj,Pagination->Anchor);
|
2017-10-10 12:52:02 +02:00
|
|
|
|
Prj_PutParams (&Gbl.Prjs.Filter,
|
2017-10-10 01:26:45 +02:00
|
|
|
|
Gbl.Prjs.SelectedOrder,
|
|
|
|
|
Pagination->LeftPage,
|
|
|
|
|
-1L);
|
2017-09-17 16:58:09 +02:00
|
|
|
|
break;
|
2017-09-13 16:24:29 +02:00
|
|
|
|
case Pag_GAMES:
|
2018-11-09 20:47:39 +01:00
|
|
|
|
Frm_StartFormAnchor (ActSeeAllGam,Pagination->Anchor);
|
2017-09-13 16:24:29 +02:00
|
|
|
|
Pag_PutHiddenParamPagNum (WhatPaginate,Pagination->LeftPage);
|
|
|
|
|
Asg_PutHiddenParamAsgOrder ();
|
|
|
|
|
Grp_PutParamWhichGrps ();
|
|
|
|
|
break;
|
2017-04-27 10:15:07 +02:00
|
|
|
|
case Pag_SURVEYS:
|
2018-11-09 20:47:39 +01:00
|
|
|
|
Frm_StartFormAnchor (ActSeeAllSvy,Pagination->Anchor);
|
2017-04-27 10:15:07 +02:00
|
|
|
|
Pag_PutHiddenParamPagNum (WhatPaginate,Pagination->LeftPage);
|
|
|
|
|
Asg_PutHiddenParamAsgOrder ();
|
|
|
|
|
Grp_PutParamWhichGrps ();
|
|
|
|
|
break;
|
2014-12-01 23:55:08 +01:00
|
|
|
|
case Pag_ATT_EVENTS:
|
2018-11-09 20:47:39 +01:00
|
|
|
|
Frm_StartFormAnchor (ActSeeAtt,Pagination->Anchor);
|
2017-04-13 20:09:22 +02:00
|
|
|
|
Pag_PutHiddenParamPagNum (WhatPaginate,Pagination->LeftPage);
|
2017-01-29 12:42:19 +01:00
|
|
|
|
Att_PutHiddenParamAttOrder ();
|
2014-12-01 23:55:08 +01:00
|
|
|
|
Grp_PutParamWhichGrps ();
|
|
|
|
|
break;
|
|
|
|
|
case Pag_THREADS_FORUM:
|
2018-11-09 20:47:39 +01:00
|
|
|
|
Frm_StartFormAnchor (For_ActionsSeeFor[Gbl.Forum.ForumSelected.Type],
|
2017-04-11 15:17:27 +02:00
|
|
|
|
Pagination->Anchor);
|
2017-04-18 16:44:44 +02:00
|
|
|
|
For_PutAllHiddenParamsForum (Pagination->LeftPage, // Page of threads = left
|
|
|
|
|
1, // Page of posts = first
|
|
|
|
|
Gbl.Forum.ForumSet,
|
2017-04-18 13:17:40 +02:00
|
|
|
|
Gbl.Forum.ThreadsOrder,
|
2017-04-18 01:25:44 +02:00
|
|
|
|
Gbl.Forum.ForumSelected.Location,
|
|
|
|
|
-1L,
|
|
|
|
|
-1L);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
break;
|
|
|
|
|
case Pag_POSTS_FORUM:
|
2018-11-09 20:47:39 +01:00
|
|
|
|
Frm_StartFormAnchor (For_ActionsSeePstFor[Gbl.Forum.ForumSelected.Type],
|
2017-04-11 15:17:27 +02:00
|
|
|
|
Pagination->Anchor);
|
2017-04-18 16:44:44 +02:00
|
|
|
|
For_PutAllHiddenParamsForum (Gbl.Forum.CurrentPageThrs, // Page of threads = current
|
|
|
|
|
Pagination->LeftPage, // Page of posts = left
|
|
|
|
|
Gbl.Forum.ForumSet,
|
2017-04-18 13:17:40 +02:00
|
|
|
|
Gbl.Forum.ThreadsOrder,
|
2017-04-18 01:25:44 +02:00
|
|
|
|
Gbl.Forum.ForumSelected.Location,
|
|
|
|
|
ThrCod,
|
|
|
|
|
-1L);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
break;
|
2017-04-13 20:09:22 +02:00
|
|
|
|
case Pag_MESSAGES_RECEIVED:
|
2018-11-09 20:47:39 +01:00
|
|
|
|
Frm_StartFormAnchor (ActSeeRcvMsg,Pagination->Anchor);
|
2017-04-13 20:09:22 +02:00
|
|
|
|
Pag_PutHiddenParamPagNum (WhatPaginate,Pagination->LeftPage);
|
|
|
|
|
Msg_PutHiddenParamsMsgsFilters ();
|
|
|
|
|
break;
|
|
|
|
|
case Pag_MESSAGES_SENT:
|
2018-11-09 20:47:39 +01:00
|
|
|
|
Frm_StartFormAnchor (ActSeeSntMsg,Pagination->Anchor);
|
2017-04-13 20:09:22 +02:00
|
|
|
|
Pag_PutHiddenParamPagNum (WhatPaginate,Pagination->LeftPage);
|
|
|
|
|
Msg_PutHiddenParamsMsgsFilters ();
|
|
|
|
|
break;
|
2017-03-21 14:52:07 +01:00
|
|
|
|
case Pag_MY_AGENDA:
|
2018-11-09 20:47:39 +01:00
|
|
|
|
Frm_StartFormAnchor (ActSeeMyAgd,Pagination->Anchor);
|
2017-04-13 20:09:22 +02:00
|
|
|
|
Agd_PutParamsMyAgenda (Gbl.Agenda.Past__FutureEvents,
|
|
|
|
|
Gbl.Agenda.PrivatPublicEvents,
|
|
|
|
|
Gbl.Agenda.HiddenVisiblEvents,
|
2019-11-18 09:20:44 +01:00
|
|
|
|
Gbl.Agenda.SelectedOrder,
|
2017-04-13 20:09:22 +02:00
|
|
|
|
Pagination->LeftPage,
|
|
|
|
|
-1L);
|
2016-12-06 21:08:28 +01:00
|
|
|
|
break;
|
2017-03-21 14:52:07 +01:00
|
|
|
|
case Pag_ANOTHER_AGENDA:
|
2018-11-09 20:47:39 +01:00
|
|
|
|
Frm_StartFormAnchor (ActSeeUsrAgd,Pagination->Anchor);
|
2017-01-29 12:42:19 +01:00
|
|
|
|
Agd_PutHiddenParamEventsOrder ();
|
2017-04-13 20:09:22 +02:00
|
|
|
|
Pag_PutHiddenParamPagNum (WhatPaginate,Pagination->LeftPage);
|
2016-12-06 21:26:02 +01:00
|
|
|
|
Usr_PutParamOtherUsrCodEncrypted ();
|
|
|
|
|
break;
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
2018-10-18 02:02:32 +02:00
|
|
|
|
snprintf (Gbl.Title,sizeof (Gbl.Title),
|
|
|
|
|
Txt_Page_X_of_Y,
|
|
|
|
|
Pagination->LeftPage,
|
|
|
|
|
Pagination->NumPags);
|
2019-11-20 10:17:42 +01:00
|
|
|
|
HTM_BUTTON_SUBMIT_Begin (Gbl.Title,ClassLink,NULL);
|
2019-11-10 13:31:47 +01:00
|
|
|
|
HTM_Unsigned (Pagination->LeftPage);
|
2019-11-18 18:19:41 +01:00
|
|
|
|
HTM_BUTTON_End ();
|
2018-11-09 20:47:39 +01:00
|
|
|
|
Frm_EndForm ();
|
2017-04-18 16:44:44 +02:00
|
|
|
|
if (Pagination->LeftPage < Pagination->StartPage - 1)
|
2019-11-07 10:24:00 +01:00
|
|
|
|
{
|
2019-11-18 18:19:41 +01:00
|
|
|
|
HTM_SPAN_Begin ("class=\"%s\"",ClassTxt);
|
2019-11-11 00:15:44 +01:00
|
|
|
|
HTM_Txt ("…");
|
2019-11-07 10:24:00 +01:00
|
|
|
|
HTM_SPAN_End ();
|
|
|
|
|
}
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/***** Loop to put links to the pages around the current one *****/
|
|
|
|
|
for (NumPage = Pagination->StartPage;
|
|
|
|
|
NumPage <= Pagination->EndPage;
|
|
|
|
|
NumPage++)
|
|
|
|
|
{
|
2018-10-18 02:02:32 +02:00
|
|
|
|
snprintf (Gbl.Title,sizeof (Gbl.Title),
|
|
|
|
|
Txt_Page_X_of_Y,
|
|
|
|
|
NumPage,Pagination->NumPags);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
if (!LinkToPagCurrent && NumPage == Pagination->CurrentPage)
|
2019-11-07 10:24:00 +01:00
|
|
|
|
{
|
2019-11-18 18:19:41 +01:00
|
|
|
|
HTM_SPAN_Begin ("title=\"%s\" class=\"PAG_CUR %s\"",Gbl.Title,ClassTxt);
|
2019-11-10 13:31:47 +01:00
|
|
|
|
HTM_Unsigned (NumPage);
|
2019-11-07 10:24:00 +01:00
|
|
|
|
HTM_SPAN_End ();
|
|
|
|
|
}
|
2014-12-01 23:55:08 +01:00
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
switch (WhatPaginate)
|
|
|
|
|
{
|
|
|
|
|
case Pag_ASSIGNMENTS:
|
2018-11-09 20:47:39 +01:00
|
|
|
|
Frm_StartFormAnchor (ActSeeAsg,Pagination->Anchor);
|
2017-04-13 20:09:22 +02:00
|
|
|
|
Pag_PutHiddenParamPagNum (WhatPaginate,NumPage);
|
2017-01-29 12:42:19 +01:00
|
|
|
|
Asg_PutHiddenParamAsgOrder ();
|
2014-12-01 23:55:08 +01:00
|
|
|
|
Grp_PutParamWhichGrps ();
|
|
|
|
|
break;
|
2017-09-17 16:58:09 +02:00
|
|
|
|
case Pag_PROJECTS:
|
2018-11-09 20:47:39 +01:00
|
|
|
|
Frm_StartFormAnchor (ActSeePrj,Pagination->Anchor);
|
2017-10-10 12:52:02 +02:00
|
|
|
|
Prj_PutParams (&Gbl.Prjs.Filter,
|
2017-10-10 01:26:45 +02:00
|
|
|
|
Gbl.Prjs.SelectedOrder,
|
|
|
|
|
NumPage,
|
|
|
|
|
-1L);
|
2017-09-17 16:58:09 +02:00
|
|
|
|
break;
|
2017-09-13 16:24:29 +02:00
|
|
|
|
case Pag_GAMES:
|
2018-11-09 20:47:39 +01:00
|
|
|
|
Frm_StartFormAnchor (ActSeeAllGam,Pagination->Anchor);
|
2017-09-13 16:24:29 +02:00
|
|
|
|
Pag_PutHiddenParamPagNum (WhatPaginate,NumPage);
|
|
|
|
|
Asg_PutHiddenParamAsgOrder ();
|
|
|
|
|
Grp_PutParamWhichGrps ();
|
|
|
|
|
break;
|
2017-04-27 10:15:07 +02:00
|
|
|
|
case Pag_SURVEYS:
|
2018-11-09 20:47:39 +01:00
|
|
|
|
Frm_StartFormAnchor (ActSeeAllSvy,Pagination->Anchor);
|
2017-04-27 10:15:07 +02:00
|
|
|
|
Pag_PutHiddenParamPagNum (WhatPaginate,NumPage);
|
|
|
|
|
Asg_PutHiddenParamAsgOrder ();
|
|
|
|
|
Grp_PutParamWhichGrps ();
|
|
|
|
|
break;
|
2014-12-01 23:55:08 +01:00
|
|
|
|
case Pag_ATT_EVENTS:
|
2018-11-09 20:47:39 +01:00
|
|
|
|
Frm_StartFormAnchor (ActSeeAtt,Pagination->Anchor);
|
2017-04-13 20:09:22 +02:00
|
|
|
|
Pag_PutHiddenParamPagNum (WhatPaginate,NumPage);
|
2017-01-29 12:42:19 +01:00
|
|
|
|
Att_PutHiddenParamAttOrder ();
|
2014-12-01 23:55:08 +01:00
|
|
|
|
Grp_PutParamWhichGrps ();
|
|
|
|
|
break;
|
|
|
|
|
case Pag_THREADS_FORUM:
|
2018-11-09 20:47:39 +01:00
|
|
|
|
Frm_StartFormAnchor (For_ActionsSeeFor[Gbl.Forum.ForumSelected.Type],
|
2017-04-11 15:17:27 +02:00
|
|
|
|
Pagination->Anchor);
|
2017-04-18 16:44:44 +02:00
|
|
|
|
For_PutAllHiddenParamsForum (NumPage, // Page of threads = number of page
|
|
|
|
|
1, // Page of posts = first
|
|
|
|
|
Gbl.Forum.ForumSet,
|
2017-04-18 13:17:40 +02:00
|
|
|
|
Gbl.Forum.ThreadsOrder,
|
2017-04-18 01:25:44 +02:00
|
|
|
|
Gbl.Forum.ForumSelected.Location,
|
|
|
|
|
-1L,
|
|
|
|
|
-1L);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
break;
|
|
|
|
|
case Pag_POSTS_FORUM:
|
2018-11-09 20:47:39 +01:00
|
|
|
|
Frm_StartFormAnchor (For_ActionsSeePstFor[Gbl.Forum.ForumSelected.Type],
|
2017-04-11 15:17:27 +02:00
|
|
|
|
Pagination->Anchor);
|
2017-04-18 16:44:44 +02:00
|
|
|
|
For_PutAllHiddenParamsForum (Gbl.Forum.CurrentPageThrs, // Page of threads = current
|
|
|
|
|
NumPage, // Page of posts = number of page
|
|
|
|
|
Gbl.Forum.ForumSet,
|
2017-04-18 13:17:40 +02:00
|
|
|
|
Gbl.Forum.ThreadsOrder,
|
2017-04-18 01:25:44 +02:00
|
|
|
|
Gbl.Forum.ForumSelected.Location,
|
|
|
|
|
ThrCod,
|
|
|
|
|
-1L);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
break;
|
2017-04-13 20:09:22 +02:00
|
|
|
|
case Pag_MESSAGES_RECEIVED:
|
2018-11-09 20:47:39 +01:00
|
|
|
|
Frm_StartFormAnchor (ActSeeRcvMsg,Pagination->Anchor);
|
2017-04-13 20:09:22 +02:00
|
|
|
|
Pag_PutHiddenParamPagNum (WhatPaginate,NumPage);
|
|
|
|
|
Msg_PutHiddenParamsMsgsFilters ();
|
|
|
|
|
break;
|
|
|
|
|
case Pag_MESSAGES_SENT:
|
2018-11-09 20:47:39 +01:00
|
|
|
|
Frm_StartFormAnchor (ActSeeSntMsg,Pagination->Anchor);
|
2017-04-13 20:09:22 +02:00
|
|
|
|
Pag_PutHiddenParamPagNum (WhatPaginate,NumPage);
|
|
|
|
|
Msg_PutHiddenParamsMsgsFilters ();
|
|
|
|
|
break;
|
|
|
|
|
case Pag_MY_AGENDA:
|
2018-11-09 20:47:39 +01:00
|
|
|
|
Frm_StartFormAnchor (ActSeeMyAgd,Pagination->Anchor);
|
2017-04-13 20:09:22 +02:00
|
|
|
|
Agd_PutParamsMyAgenda (Gbl.Agenda.Past__FutureEvents,
|
|
|
|
|
Gbl.Agenda.PrivatPublicEvents,
|
|
|
|
|
Gbl.Agenda.HiddenVisiblEvents,
|
2019-11-18 09:20:44 +01:00
|
|
|
|
Gbl.Agenda.SelectedOrder,
|
2017-04-13 20:09:22 +02:00
|
|
|
|
NumPage,
|
|
|
|
|
-1L);
|
|
|
|
|
break;
|
|
|
|
|
case Pag_ANOTHER_AGENDA:
|
2018-11-09 20:47:39 +01:00
|
|
|
|
Frm_StartFormAnchor (ActSeeUsrAgd,Pagination->Anchor);
|
2017-04-13 20:09:22 +02:00
|
|
|
|
Agd_PutHiddenParamEventsOrder ();
|
|
|
|
|
Pag_PutHiddenParamPagNum (WhatPaginate,NumPage);
|
|
|
|
|
Usr_PutParamOtherUsrCodEncrypted ();
|
|
|
|
|
break;
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
2019-11-20 10:17:42 +01:00
|
|
|
|
HTM_BUTTON_SUBMIT_Begin (Gbl.Title,ClassLink,NULL);
|
2019-11-10 13:31:47 +01:00
|
|
|
|
HTM_Unsigned (NumPage);
|
2019-11-18 18:19:41 +01:00
|
|
|
|
HTM_BUTTON_End ();
|
2018-11-09 20:47:39 +01:00
|
|
|
|
Frm_EndForm ();
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/***** Posible link to page right *****/
|
2015-08-24 11:25:20 +02:00
|
|
|
|
if (Pagination->RightPage > Pagination->EndPage &&
|
|
|
|
|
Pagination->RightPage < Pagination->NumPags)
|
2014-12-01 23:55:08 +01:00
|
|
|
|
{
|
2017-01-28 15:58:46 +01:00
|
|
|
|
if (Pagination->RightPage > Pagination->EndPage + 1)
|
2019-11-07 10:24:00 +01:00
|
|
|
|
{
|
2019-11-18 18:19:41 +01:00
|
|
|
|
HTM_SPAN_Begin ("class=\"%s\"",ClassTxt);
|
2019-11-11 00:15:44 +01:00
|
|
|
|
HTM_Txt ("…");
|
2019-11-07 10:24:00 +01:00
|
|
|
|
HTM_SPAN_End ();
|
|
|
|
|
}
|
2014-12-01 23:55:08 +01:00
|
|
|
|
switch (WhatPaginate)
|
|
|
|
|
{
|
|
|
|
|
case Pag_ASSIGNMENTS:
|
2018-11-09 20:47:39 +01:00
|
|
|
|
Frm_StartFormAnchor (ActSeeAsg,Pagination->Anchor);
|
2017-04-13 20:09:22 +02:00
|
|
|
|
Pag_PutHiddenParamPagNum (WhatPaginate,Pagination->RightPage);
|
2017-01-29 12:42:19 +01:00
|
|
|
|
Asg_PutHiddenParamAsgOrder ();
|
2014-12-01 23:55:08 +01:00
|
|
|
|
Grp_PutParamWhichGrps ();
|
|
|
|
|
break;
|
2017-09-17 16:58:09 +02:00
|
|
|
|
case Pag_PROJECTS:
|
2018-11-09 20:47:39 +01:00
|
|
|
|
Frm_StartFormAnchor (ActSeePrj,Pagination->Anchor);
|
2017-10-10 12:52:02 +02:00
|
|
|
|
Prj_PutParams (&Gbl.Prjs.Filter,
|
2017-10-10 01:26:45 +02:00
|
|
|
|
Gbl.Prjs.SelectedOrder,
|
|
|
|
|
Pagination->RightPage,
|
|
|
|
|
-1L);
|
2017-09-17 16:58:09 +02:00
|
|
|
|
break;
|
2017-09-13 16:24:29 +02:00
|
|
|
|
case Pag_GAMES:
|
2018-11-09 20:47:39 +01:00
|
|
|
|
Frm_StartFormAnchor (ActSeeAllGam,Pagination->Anchor);
|
2017-09-13 16:24:29 +02:00
|
|
|
|
Pag_PutHiddenParamPagNum (WhatPaginate,Pagination->RightPage);
|
|
|
|
|
Asg_PutHiddenParamAsgOrder ();
|
|
|
|
|
Grp_PutParamWhichGrps ();
|
|
|
|
|
break;
|
2017-04-27 10:15:07 +02:00
|
|
|
|
case Pag_SURVEYS:
|
2018-11-09 20:47:39 +01:00
|
|
|
|
Frm_StartFormAnchor (ActSeeAllSvy,Pagination->Anchor);
|
2017-04-27 10:15:07 +02:00
|
|
|
|
Pag_PutHiddenParamPagNum (WhatPaginate,Pagination->RightPage);
|
|
|
|
|
Asg_PutHiddenParamAsgOrder ();
|
|
|
|
|
Grp_PutParamWhichGrps ();
|
|
|
|
|
break;
|
2014-12-01 23:55:08 +01:00
|
|
|
|
case Pag_ATT_EVENTS:
|
2018-11-09 20:47:39 +01:00
|
|
|
|
Frm_StartFormAnchor (ActSeeAtt,Pagination->Anchor);
|
2017-04-13 20:09:22 +02:00
|
|
|
|
Pag_PutHiddenParamPagNum (WhatPaginate,Pagination->RightPage);
|
2017-01-29 12:42:19 +01:00
|
|
|
|
Att_PutHiddenParamAttOrder ();
|
2014-12-01 23:55:08 +01:00
|
|
|
|
Grp_PutParamWhichGrps ();
|
|
|
|
|
break;
|
|
|
|
|
case Pag_THREADS_FORUM:
|
2018-11-09 20:47:39 +01:00
|
|
|
|
Frm_StartFormAnchor (For_ActionsSeeFor[Gbl.Forum.ForumSelected.Type],
|
2017-04-11 15:17:27 +02:00
|
|
|
|
Pagination->Anchor);
|
2017-04-18 16:44:44 +02:00
|
|
|
|
For_PutAllHiddenParamsForum (Pagination->RightPage, // Page of threads = right
|
|
|
|
|
1, // Page of posts = first
|
|
|
|
|
Gbl.Forum.ForumSet,
|
2017-04-18 13:17:40 +02:00
|
|
|
|
Gbl.Forum.ThreadsOrder,
|
2017-04-18 01:25:44 +02:00
|
|
|
|
Gbl.Forum.ForumSelected.Location,
|
|
|
|
|
-1L,
|
|
|
|
|
-1L);
|
|
|
|
|
break;
|
2014-12-01 23:55:08 +01:00
|
|
|
|
case Pag_POSTS_FORUM:
|
2018-11-09 20:47:39 +01:00
|
|
|
|
Frm_StartFormAnchor (For_ActionsSeePstFor[Gbl.Forum.ForumSelected.Type],
|
2017-04-11 15:17:27 +02:00
|
|
|
|
Pagination->Anchor);
|
2017-04-18 16:44:44 +02:00
|
|
|
|
For_PutAllHiddenParamsForum (Gbl.Forum.CurrentPageThrs, // Page of threads = current
|
|
|
|
|
Pagination->RightPage, // Page of posts = right
|
|
|
|
|
Gbl.Forum.ForumSet,
|
2017-04-18 13:17:40 +02:00
|
|
|
|
Gbl.Forum.ThreadsOrder,
|
2017-04-18 01:25:44 +02:00
|
|
|
|
Gbl.Forum.ForumSelected.Location,
|
|
|
|
|
ThrCod,
|
|
|
|
|
-1L);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
break;
|
2017-04-13 20:09:22 +02:00
|
|
|
|
case Pag_MESSAGES_RECEIVED:
|
2018-11-09 20:47:39 +01:00
|
|
|
|
Frm_StartFormAnchor (ActSeeRcvMsg,Pagination->Anchor);
|
2017-04-13 20:09:22 +02:00
|
|
|
|
Pag_PutHiddenParamPagNum (WhatPaginate,Pagination->RightPage);
|
|
|
|
|
Msg_PutHiddenParamsMsgsFilters ();
|
|
|
|
|
break;
|
|
|
|
|
case Pag_MESSAGES_SENT:
|
2018-11-09 20:47:39 +01:00
|
|
|
|
Frm_StartFormAnchor (ActSeeSntMsg,Pagination->Anchor);
|
2017-04-13 20:09:22 +02:00
|
|
|
|
Pag_PutHiddenParamPagNum (WhatPaginate,Pagination->RightPage);
|
|
|
|
|
Msg_PutHiddenParamsMsgsFilters ();
|
|
|
|
|
break;
|
2017-03-21 14:52:07 +01:00
|
|
|
|
case Pag_MY_AGENDA:
|
2018-11-09 20:47:39 +01:00
|
|
|
|
Frm_StartFormAnchor (ActSeeMyAgd,Pagination->Anchor);
|
2017-04-13 20:09:22 +02:00
|
|
|
|
Agd_PutParamsMyAgenda (Gbl.Agenda.Past__FutureEvents,
|
|
|
|
|
Gbl.Agenda.PrivatPublicEvents,
|
|
|
|
|
Gbl.Agenda.HiddenVisiblEvents,
|
2019-11-18 09:20:44 +01:00
|
|
|
|
Gbl.Agenda.SelectedOrder,
|
2017-04-13 20:09:22 +02:00
|
|
|
|
Pagination->RightPage,
|
|
|
|
|
-1L);
|
2016-12-06 21:08:28 +01:00
|
|
|
|
break;
|
2017-03-21 14:52:07 +01:00
|
|
|
|
case Pag_ANOTHER_AGENDA:
|
2018-11-09 20:47:39 +01:00
|
|
|
|
Frm_StartFormAnchor (ActSeeUsrAgd,Pagination->Anchor);
|
2017-01-29 12:42:19 +01:00
|
|
|
|
Agd_PutHiddenParamEventsOrder ();
|
2017-04-13 20:09:22 +02:00
|
|
|
|
Pag_PutHiddenParamPagNum (WhatPaginate,Pagination->RightPage);
|
2016-12-06 21:26:02 +01:00
|
|
|
|
Usr_PutParamOtherUsrCodEncrypted ();
|
|
|
|
|
break;
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
2018-10-18 02:02:32 +02:00
|
|
|
|
snprintf (Gbl.Title,sizeof (Gbl.Title),
|
|
|
|
|
Txt_Page_X_of_Y,
|
|
|
|
|
Pagination->RightPage,Pagination->NumPags);
|
2019-11-20 10:17:42 +01:00
|
|
|
|
HTM_BUTTON_SUBMIT_Begin (Gbl.Title,ClassLink,NULL);
|
2019-11-10 13:31:47 +01:00
|
|
|
|
HTM_Unsigned (Pagination->RightPage);
|
2019-11-18 18:19:41 +01:00
|
|
|
|
HTM_BUTTON_End ();
|
2018-11-09 20:47:39 +01:00
|
|
|
|
Frm_EndForm ();
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/***** Possible link to last page *****/
|
|
|
|
|
if (Pagination->EndPage < Pagination->NumPags)
|
|
|
|
|
{
|
2017-01-28 15:58:46 +01:00
|
|
|
|
if (Pagination->NumPags > Pagination->RightPage + 1)
|
2019-11-07 10:24:00 +01:00
|
|
|
|
{
|
2019-11-18 18:19:41 +01:00
|
|
|
|
HTM_SPAN_Begin ("class=\"%s\"",ClassTxt);
|
2019-11-11 00:15:44 +01:00
|
|
|
|
HTM_Txt ("…");
|
2019-11-07 10:24:00 +01:00
|
|
|
|
HTM_SPAN_End ();
|
|
|
|
|
}
|
2014-12-01 23:55:08 +01:00
|
|
|
|
switch (WhatPaginate)
|
|
|
|
|
{
|
|
|
|
|
case Pag_ASSIGNMENTS:
|
2018-11-09 20:47:39 +01:00
|
|
|
|
Frm_StartFormAnchor (ActSeeAsg,Pagination->Anchor);
|
2017-04-13 20:09:22 +02:00
|
|
|
|
Pag_PutHiddenParamPagNum (WhatPaginate,Pagination->NumPags);
|
2017-01-29 12:42:19 +01:00
|
|
|
|
Asg_PutHiddenParamAsgOrder ();
|
2014-12-01 23:55:08 +01:00
|
|
|
|
Grp_PutParamWhichGrps ();
|
|
|
|
|
break;
|
2017-09-17 16:58:09 +02:00
|
|
|
|
case Pag_PROJECTS:
|
2018-11-09 20:47:39 +01:00
|
|
|
|
Frm_StartFormAnchor (ActSeePrj,Pagination->Anchor);
|
2017-10-10 12:52:02 +02:00
|
|
|
|
Prj_PutParams (&Gbl.Prjs.Filter,
|
2017-10-10 01:26:45 +02:00
|
|
|
|
Gbl.Prjs.SelectedOrder,
|
|
|
|
|
Pagination->NumPags,
|
|
|
|
|
-1L);
|
2017-09-17 16:58:09 +02:00
|
|
|
|
break;
|
2017-09-13 16:24:29 +02:00
|
|
|
|
case Pag_GAMES:
|
2018-11-09 20:47:39 +01:00
|
|
|
|
Frm_StartFormAnchor (ActSeeAllGam,Pagination->Anchor);
|
2017-09-13 16:24:29 +02:00
|
|
|
|
Pag_PutHiddenParamPagNum (WhatPaginate,Pagination->NumPags);
|
|
|
|
|
Asg_PutHiddenParamAsgOrder ();
|
|
|
|
|
Grp_PutParamWhichGrps ();
|
|
|
|
|
break;
|
2017-04-27 10:15:07 +02:00
|
|
|
|
case Pag_SURVEYS:
|
2018-11-09 20:47:39 +01:00
|
|
|
|
Frm_StartFormAnchor (ActSeeAllSvy,Pagination->Anchor);
|
2017-04-27 10:15:07 +02:00
|
|
|
|
Pag_PutHiddenParamPagNum (WhatPaginate,Pagination->NumPags);
|
|
|
|
|
Asg_PutHiddenParamAsgOrder ();
|
|
|
|
|
Grp_PutParamWhichGrps ();
|
|
|
|
|
break;
|
2014-12-01 23:55:08 +01:00
|
|
|
|
case Pag_ATT_EVENTS:
|
2018-11-09 20:47:39 +01:00
|
|
|
|
Frm_StartFormAnchor (ActSeeAtt,Pagination->Anchor);
|
2017-04-13 20:09:22 +02:00
|
|
|
|
Pag_PutHiddenParamPagNum (WhatPaginate,Pagination->NumPags);
|
2017-01-29 12:42:19 +01:00
|
|
|
|
Att_PutHiddenParamAttOrder ();
|
2014-12-01 23:55:08 +01:00
|
|
|
|
Grp_PutParamWhichGrps ();
|
|
|
|
|
break;
|
|
|
|
|
case Pag_THREADS_FORUM:
|
2018-11-09 20:47:39 +01:00
|
|
|
|
Frm_StartFormAnchor (For_ActionsSeeFor[Gbl.Forum.ForumSelected.Type],
|
2017-04-11 15:17:27 +02:00
|
|
|
|
Pagination->Anchor);
|
2017-04-18 16:44:44 +02:00
|
|
|
|
For_PutAllHiddenParamsForum (Pagination->NumPags, // Page of threads = last
|
|
|
|
|
1, // Page of posts = first
|
|
|
|
|
Gbl.Forum.ForumSet,
|
2017-04-18 13:17:40 +02:00
|
|
|
|
Gbl.Forum.ThreadsOrder,
|
2017-04-18 01:25:44 +02:00
|
|
|
|
Gbl.Forum.ForumSelected.Location,
|
|
|
|
|
-1L,
|
|
|
|
|
-1L);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
break;
|
|
|
|
|
case Pag_POSTS_FORUM:
|
2018-11-09 20:47:39 +01:00
|
|
|
|
Frm_StartFormAnchor (For_ActionsSeePstFor[Gbl.Forum.ForumSelected.Type],
|
2017-04-11 15:17:27 +02:00
|
|
|
|
Pagination->Anchor);
|
2017-04-18 16:44:44 +02:00
|
|
|
|
For_PutAllHiddenParamsForum (Gbl.Forum.CurrentPageThrs, // Page of threads = current
|
|
|
|
|
Pagination->NumPags, // Page of posts = last
|
|
|
|
|
Gbl.Forum.ForumSet,
|
2017-04-18 13:17:40 +02:00
|
|
|
|
Gbl.Forum.ThreadsOrder,
|
2017-04-18 01:25:44 +02:00
|
|
|
|
Gbl.Forum.ForumSelected.Location,
|
|
|
|
|
ThrCod,
|
|
|
|
|
-1L);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
break;
|
2017-04-13 20:09:22 +02:00
|
|
|
|
case Pag_MESSAGES_RECEIVED:
|
2018-11-09 20:47:39 +01:00
|
|
|
|
Frm_StartFormAnchor (ActSeeRcvMsg,Pagination->Anchor);
|
2017-04-13 20:09:22 +02:00
|
|
|
|
Pag_PutHiddenParamPagNum (WhatPaginate,Pagination->NumPags);
|
|
|
|
|
Msg_PutHiddenParamsMsgsFilters ();
|
|
|
|
|
break;
|
|
|
|
|
case Pag_MESSAGES_SENT:
|
2018-11-09 20:47:39 +01:00
|
|
|
|
Frm_StartFormAnchor (ActSeeSntMsg,Pagination->Anchor);
|
2017-04-13 20:09:22 +02:00
|
|
|
|
Pag_PutHiddenParamPagNum (WhatPaginate,Pagination->NumPags);
|
|
|
|
|
Msg_PutHiddenParamsMsgsFilters ();
|
|
|
|
|
break;
|
2017-03-21 14:52:07 +01:00
|
|
|
|
case Pag_MY_AGENDA:
|
2018-11-09 20:47:39 +01:00
|
|
|
|
Frm_StartFormAnchor (ActSeeMyAgd,Pagination->Anchor);
|
2017-04-13 20:09:22 +02:00
|
|
|
|
Agd_PutParamsMyAgenda (Gbl.Agenda.Past__FutureEvents,
|
|
|
|
|
Gbl.Agenda.PrivatPublicEvents,
|
|
|
|
|
Gbl.Agenda.HiddenVisiblEvents,
|
2019-11-18 09:20:44 +01:00
|
|
|
|
Gbl.Agenda.SelectedOrder,
|
2017-04-13 20:09:22 +02:00
|
|
|
|
Pagination->NumPags,
|
|
|
|
|
-1L);
|
2016-12-06 21:08:28 +01:00
|
|
|
|
break;
|
2017-03-21 14:52:07 +01:00
|
|
|
|
case Pag_ANOTHER_AGENDA:
|
2018-11-09 20:47:39 +01:00
|
|
|
|
Frm_StartFormAnchor (ActSeeUsrAgd,Pagination->Anchor);
|
2017-01-29 12:42:19 +01:00
|
|
|
|
Agd_PutHiddenParamEventsOrder ();
|
2017-04-13 20:09:22 +02:00
|
|
|
|
Pag_PutHiddenParamPagNum (WhatPaginate,Pagination->NumPags);
|
2016-12-06 21:26:02 +01:00
|
|
|
|
Usr_PutParamOtherUsrCodEncrypted ();
|
|
|
|
|
break;
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
2018-10-18 02:02:32 +02:00
|
|
|
|
snprintf (Gbl.Title,sizeof (Gbl.Title),
|
|
|
|
|
Txt_Page_X_of_Y,
|
|
|
|
|
Pagination->NumPags,Pagination->NumPags);
|
2019-11-20 10:17:42 +01:00
|
|
|
|
HTM_BUTTON_SUBMIT_Begin (Gbl.Title,ClassLink,NULL);
|
2019-11-10 13:31:47 +01:00
|
|
|
|
HTM_Unsigned (Pagination->NumPags);
|
2019-11-18 18:19:41 +01:00
|
|
|
|
HTM_BUTTON_End ();
|
2018-11-09 20:47:39 +01:00
|
|
|
|
Frm_EndForm ();
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
2019-11-18 18:19:41 +01:00
|
|
|
|
|
2019-11-18 20:12:10 +01:00
|
|
|
|
free (ClassLink);
|
|
|
|
|
}
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/******************* Put hidden parameter number of page *********************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2017-04-13 20:09:22 +02:00
|
|
|
|
void Pag_PutHiddenParamPagNum (Pag_WhatPaginate_t WhatPaginate,unsigned NumPage)
|
2014-12-01 23:55:08 +01:00
|
|
|
|
{
|
2019-11-03 13:19:32 +01:00
|
|
|
|
Par_PutHiddenParamUnsigned (NULL,Pag_ParamNumPag[WhatPaginate],NumPage);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/************************ Get parameter number of page ***********************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2017-04-13 20:09:22 +02:00
|
|
|
|
unsigned Pag_GetParamPagNum (Pag_WhatPaginate_t WhatPaginate)
|
2014-12-01 23:55:08 +01:00
|
|
|
|
{
|
2017-04-13 20:09:22 +02:00
|
|
|
|
unsigned CurrentPage;
|
|
|
|
|
|
|
|
|
|
/***** Try to get parameter with the number of page *****/
|
|
|
|
|
CurrentPage = (unsigned) Par_GetParToUnsignedLong (Pag_ParamNumPag[WhatPaginate],
|
|
|
|
|
1,
|
|
|
|
|
UINT_MAX,
|
|
|
|
|
0);
|
|
|
|
|
if (CurrentPage == 0)
|
|
|
|
|
/***** If there's no parameter page, return a default value *****/
|
|
|
|
|
switch (WhatPaginate)
|
|
|
|
|
{
|
|
|
|
|
case Pag_MESSAGES_RECEIVED:
|
|
|
|
|
if (Gbl.Action.Act == ActExpRcvMsg)
|
|
|
|
|
/* Expanding a message, perhaps it is the result of following a link
|
|
|
|
|
from a notification of received message */
|
|
|
|
|
/* Show the page corresponding to the expanded message */
|
|
|
|
|
CurrentPage = 1; // Now set the current page to the first,
|
|
|
|
|
// but later the correct page will be calculated
|
|
|
|
|
else
|
|
|
|
|
/* Show the last visited page */
|
|
|
|
|
CurrentPage = Pag_GetLastPageMsgFromSession (Pag_MESSAGES_RECEIVED);
|
|
|
|
|
break;
|
|
|
|
|
case Pag_MESSAGES_SENT:
|
|
|
|
|
/* Show the last visited page */
|
|
|
|
|
CurrentPage = Pag_GetLastPageMsgFromSession (Pag_MESSAGES_SENT);
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
CurrentPage = 1;
|
|
|
|
|
break;
|
|
|
|
|
}
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2017-04-13 20:09:22 +02:00
|
|
|
|
return CurrentPage;
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/********* Save last page of received/sent messages into session *************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
void Pag_SaveLastPageMsgIntoSession (Pag_WhatPaginate_t WhatPaginate,unsigned NumPage)
|
|
|
|
|
{
|
|
|
|
|
/***** Save last page of received/sent messages *****/
|
2018-11-03 12:16:40 +01:00
|
|
|
|
DB_QueryUPDATE ("can not update last page of messages",
|
|
|
|
|
"UPDATE sessions SET %s=%u WHERE SessionId='%s'",
|
|
|
|
|
WhatPaginate == Pag_MESSAGES_RECEIVED ? "LastPageMsgRcv" :
|
|
|
|
|
"LastPageMsgSnt",
|
|
|
|
|
NumPage,Gbl.Session.Id);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/********* Get last page of received/sent messages stored in session *********/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
unsigned Pag_GetLastPageMsgFromSession (Pag_WhatPaginate_t WhatPaginate)
|
|
|
|
|
{
|
|
|
|
|
MYSQL_RES *mysql_res;
|
|
|
|
|
MYSQL_ROW row;
|
|
|
|
|
unsigned long NumRows;
|
|
|
|
|
unsigned NumPage;
|
|
|
|
|
|
|
|
|
|
/***** Get last page of received/sent messages from database *****/
|
2018-11-01 13:03:25 +01:00
|
|
|
|
NumRows = DB_QuerySELECT (&mysql_res,"can not get last page of messages",
|
|
|
|
|
"SELECT %s FROM sessions"
|
|
|
|
|
" WHERE SessionId='%s'",
|
|
|
|
|
WhatPaginate == Pag_MESSAGES_RECEIVED ? "LastPageMsgRcv" :
|
|
|
|
|
"LastPageMsgSnt",
|
|
|
|
|
Gbl.Session.Id);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
/***** Check number of rows of the result ****/
|
|
|
|
|
if (NumRows != 1)
|
|
|
|
|
Lay_ShowErrorAndExit ("Error when getting last page of messages.");
|
|
|
|
|
|
|
|
|
|
/***** Get last page of messages *****/
|
|
|
|
|
row = mysql_fetch_row (mysql_res);
|
|
|
|
|
if (sscanf (row[0],"%u",&NumPage) == 1)
|
|
|
|
|
if (NumPage == 0)
|
|
|
|
|
NumPage = 1;
|
|
|
|
|
|
|
|
|
|
return NumPage;
|
|
|
|
|
}
|