2016-07-07 00:21:10 +02:00
|
|
|
|
// swad_agenda.c: user's agenda (personal organizer)
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
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.
|
2021-02-09 12:43:45 +01:00
|
|
|
|
Copyright (C) 1999-2021 Antonio Ca<EFBFBD>as Vargas
|
2016-07-07 00:21:10 +02:00
|
|
|
|
|
|
|
|
|
This program is free software: you can redistribute it and/or modify
|
|
|
|
|
it under the terms of the GNU Affero General 3 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/>.
|
|
|
|
|
*/
|
|
|
|
|
/*****************************************************************************/
|
2016-11-30 22:49:48 +01:00
|
|
|
|
/********************************* Headers ***********************************/
|
2016-07-07 00:21:10 +02:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2018-10-18 21:32:06 +02:00
|
|
|
|
#define _GNU_SOURCE // For asprintf
|
2016-11-30 22:49:48 +01:00
|
|
|
|
#include <linux/limits.h> // For PATH_MAX
|
2019-12-29 12:39:00 +01:00
|
|
|
|
#include <stddef.h> // For NULL
|
2018-10-18 21:32:06 +02:00
|
|
|
|
#include <stdio.h> // For asprintf
|
2016-11-30 22:49:48 +01:00
|
|
|
|
#include <stdlib.h> // For calloc
|
|
|
|
|
#include <string.h> // For string functions
|
2016-07-07 00:21:10 +02:00
|
|
|
|
|
2016-11-30 22:49:48 +01:00
|
|
|
|
#include "swad_agenda.h"
|
2021-05-10 22:23:10 +02:00
|
|
|
|
#include "swad_agenda_database.h"
|
2021-11-28 00:49:23 +01:00
|
|
|
|
#include "swad_autolink.h"
|
2017-06-10 21:38:10 +02:00
|
|
|
|
#include "swad_box.h"
|
2016-11-30 22:49:48 +01:00
|
|
|
|
#include "swad_database.h"
|
2020-04-28 13:12:18 +02:00
|
|
|
|
#include "swad_date.h"
|
2021-04-26 15:27:27 +02:00
|
|
|
|
#include "swad_error.h"
|
2022-01-03 02:47:16 +01:00
|
|
|
|
#include "swad_figure.h"
|
2018-11-09 20:47:39 +01:00
|
|
|
|
#include "swad_form.h"
|
2016-11-30 22:49:48 +01:00
|
|
|
|
#include "swad_global.h"
|
|
|
|
|
#include "swad_group.h"
|
2019-10-23 19:05:05 +02:00
|
|
|
|
#include "swad_HTML.h"
|
2016-11-30 22:49:48 +01:00
|
|
|
|
#include "swad_notification.h"
|
|
|
|
|
#include "swad_pagination.h"
|
|
|
|
|
#include "swad_parameter.h"
|
|
|
|
|
#include "swad_photo.h"
|
2016-12-09 14:50:21 +01:00
|
|
|
|
#include "swad_privacy.h"
|
2016-12-05 09:50:35 +01:00
|
|
|
|
#include "swad_QR.h"
|
2019-03-26 11:53:21 +01:00
|
|
|
|
#include "swad_setting.h"
|
2016-11-30 22:49:48 +01:00
|
|
|
|
#include "swad_string.h"
|
2016-07-07 00:21:10 +02:00
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
2016-11-30 22:49:48 +01:00
|
|
|
|
/************** External global variables from others modules ****************/
|
2016-07-07 00:21:10 +02:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2016-11-30 22:49:48 +01:00
|
|
|
|
extern struct Globals Gbl;
|
|
|
|
|
|
2016-07-07 00:21:10 +02:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/***************************** Private constants *****************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2017-03-21 14:36:22 +01:00
|
|
|
|
static const char *ParamPast__FutureName = "Past__Future";
|
|
|
|
|
static const char *ParamPrivatPublicName = "PrivatPublic";
|
|
|
|
|
static const char *ParamHiddenVisiblName = "HiddenVisibl";
|
|
|
|
|
|
2016-07-07 00:21:10 +02:00
|
|
|
|
/*****************************************************************************/
|
2016-11-30 22:49:48 +01:00
|
|
|
|
/***************************** Private prototypes ****************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2020-04-12 14:42:32 +02:00
|
|
|
|
static void Agd_ResetAgenda (struct Agd_Agenda *Agenda);
|
|
|
|
|
|
|
|
|
|
static void Agd_ShowMyAgenda (struct Agd_Agenda *Agenda);
|
|
|
|
|
|
|
|
|
|
static void Agd_ShowFormToSelPast__FutureEvents (const struct Agd_Agenda *Agenda);
|
|
|
|
|
static void Agd_ShowFormToSelPrivatPublicEvents (const struct Agd_Agenda *Agenda);
|
|
|
|
|
static void Agd_ShowFormToSelHiddenVisiblEvents (const struct Agd_Agenda *Agenda);
|
2017-03-21 14:36:22 +01:00
|
|
|
|
|
|
|
|
|
static void Agd_PutHiddenParamPast__FutureEvents (unsigned Past__FutureEvents);
|
|
|
|
|
static void Agd_PutHiddenParamPrivatPublicEvents (unsigned PrivatPublicEvents);
|
|
|
|
|
static void Agd_PutHiddenParamHiddenVisiblEvents (unsigned HiddenVisiblEvents);
|
2020-04-12 14:42:32 +02:00
|
|
|
|
static unsigned Agd_GetParamsPast__FutureEvents (void);
|
|
|
|
|
static unsigned Agd_GetParamsPrivatPublicEvents (void);
|
|
|
|
|
static unsigned Agd_GetParamsHiddenVisiblEvents (void);
|
2017-03-21 00:57:11 +01:00
|
|
|
|
|
2020-04-12 14:42:32 +02:00
|
|
|
|
static void Agd_ShowEvents (struct Agd_Agenda *Agenda,
|
|
|
|
|
Agd_AgendaType_t AgendaType);
|
|
|
|
|
static void Agd_ShowEventsToday (struct Agd_Agenda *Agenda,
|
|
|
|
|
Agd_AgendaType_t AgendaType);
|
|
|
|
|
static void Agd_WriteHeaderListEvents (const struct Agd_Agenda *Agenda,
|
|
|
|
|
Agd_AgendaType_t AgendaType);
|
2016-12-02 00:24:16 +01:00
|
|
|
|
|
2020-03-26 02:54:30 +01:00
|
|
|
|
static void Agd_PutIconsMyFullAgenda (void *Agenda);
|
|
|
|
|
static void Agd_PutIconsMyPublicAgenda (void *EncryptedUsrCod);
|
|
|
|
|
static void Agd_PutIconToCreateNewEvent (void *Agenda);
|
|
|
|
|
static void Agd_PutIconToViewEditMyFullAgenda (void *EncryptedUsrCod);
|
2016-12-05 03:16:25 +01:00
|
|
|
|
static void Agd_PutIconToShowQR (void);
|
2020-03-26 02:54:30 +01:00
|
|
|
|
static void Agd_PutIconsOtherPublicAgenda (void *EncryptedUsrCod);
|
2016-12-06 21:08:28 +01:00
|
|
|
|
|
2020-04-12 14:42:32 +02:00
|
|
|
|
static void Agd_PutButtonToCreateNewEvent (const struct Agd_Agenda *Agenda);
|
|
|
|
|
static void Agd_ShowOneEvent (struct Agd_Agenda *Agenda,
|
|
|
|
|
Agd_AgendaType_t AgendaType,long AgdCod);
|
|
|
|
|
static void Agd_GetParamEventOrder (struct Agd_Agenda *Agenda);
|
|
|
|
|
static void Agd_PutFormsToRemEditOneEvent (struct Agd_Agenda *Agenda,
|
|
|
|
|
struct Agd_Event *AgdEvent,
|
2019-04-20 19:04:05 +02:00
|
|
|
|
const char *Anchor);
|
2017-03-21 14:36:22 +01:00
|
|
|
|
|
2020-03-26 02:54:30 +01:00
|
|
|
|
static void Agd_PutCurrentParamsMyAgenda (void *Agenda);
|
2020-04-12 14:42:32 +02:00
|
|
|
|
static void Agd_GetParams (struct Agd_Agenda *Agenda,
|
|
|
|
|
Agd_AgendaType_t AgendaType);
|
2017-03-21 14:36:22 +01:00
|
|
|
|
|
2020-04-12 14:42:32 +02:00
|
|
|
|
static void Agd_GetListEvents (struct Agd_Agenda *Agenda,
|
|
|
|
|
Agd_AgendaType_t AgendaType);
|
2020-04-08 03:06:45 +02:00
|
|
|
|
static void Agd_GetDataOfEventByCod (struct Agd_Event *AgdEvent);
|
2020-04-12 14:42:32 +02:00
|
|
|
|
|
|
|
|
|
static void Agd_FreeListEvents (struct Agd_Agenda *Agenda);
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/*************************** Reset agenda context ****************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
static void Agd_ResetAgenda (struct Agd_Agenda *Agenda)
|
|
|
|
|
{
|
|
|
|
|
Agenda->LstIsRead = false;
|
|
|
|
|
Agenda->Num = 0;
|
|
|
|
|
Agenda->LstAgdCods = NULL;
|
|
|
|
|
Agenda->Past__FutureEvents = Agd_DEFAULT_PAST___EVENTS |
|
|
|
|
|
Agd_DEFAULT_FUTURE_EVENTS;
|
|
|
|
|
Agenda->PrivatPublicEvents = Agd_DEFAULT_PRIVAT_EVENTS |
|
|
|
|
|
Agd_DEFAULT_PUBLIC_EVENTS;
|
|
|
|
|
Agenda->HiddenVisiblEvents = Agd_DEFAULT_HIDDEN_EVENTS |
|
|
|
|
|
Agd_DEFAULT_VISIBL_EVENTS;
|
|
|
|
|
Agenda->SelectedOrder = Agd_ORDER_DEFAULT;
|
|
|
|
|
Agenda->AgdCodToEdit = -1L;
|
|
|
|
|
Agenda->CurrentPage = 0;
|
|
|
|
|
}
|
|
|
|
|
|
2016-12-01 00:53:50 +01:00
|
|
|
|
/*****************************************************************************/
|
2016-12-04 04:22:36 +01:00
|
|
|
|
/********** Put form to log in and then show another user's agenda ***********/
|
2016-12-01 00:53:50 +01:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2016-12-04 04:22:36 +01:00
|
|
|
|
void Agd_PutFormLogInToShowUsrAgenda (void)
|
2016-12-04 03:50:25 +01:00
|
|
|
|
{
|
|
|
|
|
/***** Form to log in *****/
|
2016-12-05 13:26:12 +01:00
|
|
|
|
Usr_WriteFormLogin (ActLogInUsrAgd,Agd_PutParamAgd);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Agd_PutParamAgd (void)
|
|
|
|
|
{
|
2021-10-21 20:33:55 +02:00
|
|
|
|
char NickWithArr[Nck_MAX_BYTES_NICK_WITH_ARROBA + 1];
|
2016-12-05 13:26:12 +01:00
|
|
|
|
|
2021-10-21 20:33:55 +02:00
|
|
|
|
snprintf (NickWithArr,sizeof (NickWithArr),"@%s",Gbl.Usrs.Other.UsrDat.Nickname);
|
|
|
|
|
Par_PutHiddenParamString (NULL,"agd",NickWithArr);
|
2016-12-04 04:22:36 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
2016-12-06 21:26:02 +01:00
|
|
|
|
/******************************* Show my agenda ******************************/
|
2016-12-04 04:22:36 +01:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2020-04-12 14:42:32 +02:00
|
|
|
|
void Agd_GetParamsAndShowMyAgenda (void)
|
2016-12-04 04:22:36 +01:00
|
|
|
|
{
|
2020-04-12 14:42:32 +02:00
|
|
|
|
struct Agd_Agenda Agenda;
|
|
|
|
|
|
|
|
|
|
/***** Reset agenda context *****/
|
|
|
|
|
Agd_ResetAgenda (&Agenda);
|
2016-12-06 21:26:02 +01:00
|
|
|
|
|
2017-03-21 14:36:22 +01:00
|
|
|
|
/***** Get parameters *****/
|
2020-04-12 14:42:32 +02:00
|
|
|
|
Agd_GetParams (&Agenda,Agd_MY_AGENDA);
|
|
|
|
|
|
|
|
|
|
/***** Show my agenda *****/
|
|
|
|
|
Agd_ShowMyAgenda (&Agenda);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void Agd_ShowMyAgenda (struct Agd_Agenda *Agenda)
|
|
|
|
|
{
|
|
|
|
|
extern const char *Hlp_PROFILE_Agenda;
|
|
|
|
|
extern const char *Txt_My_agenda;
|
2017-03-21 14:36:22 +01:00
|
|
|
|
|
2019-10-26 02:19:42 +02:00
|
|
|
|
/***** Begin box *****/
|
2020-03-26 02:54:30 +01:00
|
|
|
|
Box_BoxBegin ("100%",Txt_My_agenda,
|
2020-04-12 14:42:32 +02:00
|
|
|
|
Agd_PutIconsMyFullAgenda,Agenda,
|
2017-06-12 15:03:29 +02:00
|
|
|
|
Hlp_PROFILE_Agenda,Box_NOT_CLOSABLE);
|
2016-12-06 21:26:02 +01:00
|
|
|
|
|
2021-05-10 22:23:10 +02:00
|
|
|
|
/***** Put forms to choice which events to show *****/
|
|
|
|
|
Set_BeginSettingsHead ();
|
|
|
|
|
Agd_ShowFormToSelPast__FutureEvents (Agenda);
|
|
|
|
|
Agd_ShowFormToSelPrivatPublicEvents (Agenda);
|
|
|
|
|
Agd_ShowFormToSelHiddenVisiblEvents (Agenda);
|
|
|
|
|
Set_EndSettingsHead ();
|
2017-03-21 00:57:11 +01:00
|
|
|
|
|
2021-05-10 22:23:10 +02:00
|
|
|
|
/***** Show the current events in the user's agenda *****/
|
|
|
|
|
Agd_ShowEventsToday (Agenda,Agd_MY_AGENDA_TODAY);
|
2016-12-06 21:26:02 +01:00
|
|
|
|
|
2021-05-10 22:23:10 +02:00
|
|
|
|
/***** Show all my events *****/
|
|
|
|
|
Agd_ShowEvents (Agenda,Agd_MY_AGENDA);
|
2016-12-06 21:26:02 +01:00
|
|
|
|
|
2017-06-12 14:16:33 +02:00
|
|
|
|
/***** End box *****/
|
2019-10-25 22:48:34 +02:00
|
|
|
|
Box_BoxEnd ();
|
2016-12-06 21:26:02 +01:00
|
|
|
|
}
|
|
|
|
|
|
2017-03-21 00:57:11 +01:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/*************** Show form to select past / future events ********************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2020-04-12 14:42:32 +02:00
|
|
|
|
static void Agd_ShowFormToSelPast__FutureEvents (const struct Agd_Agenda *Agenda)
|
2017-03-21 00:57:11 +01:00
|
|
|
|
{
|
2017-03-21 14:36:22 +01:00
|
|
|
|
extern const char *Txt_AGENDA_PAST___FUTURE_EVENTS[2];
|
|
|
|
|
Agd_Past__FutureEvents_t PstFut;
|
2019-02-21 21:12:04 +01:00
|
|
|
|
static const char *Icon[2] =
|
2017-03-21 00:57:11 +01:00
|
|
|
|
{
|
2019-11-20 17:53:51 +01:00
|
|
|
|
[Agd_PAST___EVENTS] = "calendar-minus.svg",
|
|
|
|
|
[Agd_FUTURE_EVENTS] = "calendar-plus.svg",
|
2017-03-21 00:57:11 +01:00
|
|
|
|
};
|
|
|
|
|
|
2021-03-02 16:47:58 +01:00
|
|
|
|
Set_BeginOneSettingSelector ();
|
2021-12-15 20:42:47 +01:00
|
|
|
|
for (PstFut = Agd_PAST___EVENTS;
|
2017-03-21 00:57:11 +01:00
|
|
|
|
PstFut <= Agd_FUTURE_EVENTS;
|
|
|
|
|
PstFut++)
|
|
|
|
|
{
|
2022-04-25 19:45:05 +02:00
|
|
|
|
Set_BeginPref ((Agenda->Past__FutureEvents & (1 << PstFut)));
|
|
|
|
|
Frm_BeginForm (ActSeeMyAgd);
|
|
|
|
|
Agd_PutParamsMyAgenda (Agenda->Past__FutureEvents ^ (1 << PstFut), // Toggle
|
|
|
|
|
Agenda->PrivatPublicEvents,
|
|
|
|
|
Agenda->HiddenVisiblEvents,
|
|
|
|
|
Agenda->SelectedOrder,
|
|
|
|
|
Agenda->CurrentPage,
|
|
|
|
|
-1L);
|
|
|
|
|
Ico_PutSettingIconLink (Icon[PstFut],Ico_BLACK,
|
|
|
|
|
Txt_AGENDA_PAST___FUTURE_EVENTS[PstFut]);
|
|
|
|
|
Frm_EndForm ();
|
|
|
|
|
Set_EndPref ();
|
2017-03-21 00:57:11 +01:00
|
|
|
|
}
|
2019-03-26 11:53:21 +01:00
|
|
|
|
Set_EndOneSettingSelector ();
|
2017-03-21 00:57:11 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/************** Show form to select private / public events ******************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2020-04-12 14:42:32 +02:00
|
|
|
|
static void Agd_ShowFormToSelPrivatPublicEvents (const struct Agd_Agenda *Agenda)
|
2017-03-21 00:57:11 +01:00
|
|
|
|
{
|
2017-03-21 14:36:22 +01:00
|
|
|
|
extern const char *Txt_AGENDA_PRIVAT_PUBLIC_EVENTS[2];
|
|
|
|
|
Agd_PrivatPublicEvents_t PrvPub;
|
2021-12-22 00:20:06 +01:00
|
|
|
|
static const struct
|
|
|
|
|
{
|
|
|
|
|
const char *Icon;
|
|
|
|
|
Ico_Color_t Color;
|
|
|
|
|
} Icon[2] =
|
2017-03-21 00:57:11 +01:00
|
|
|
|
{
|
2021-12-22 00:20:06 +01:00
|
|
|
|
[Agd_PRIVAT_EVENTS] = {"lock.svg" ,Ico_RED },
|
|
|
|
|
[Agd_PUBLIC_EVENTS] = {"unlock.svg",Ico_GREEN},
|
2017-03-21 00:57:11 +01:00
|
|
|
|
};
|
|
|
|
|
|
2021-03-02 16:47:58 +01:00
|
|
|
|
Set_BeginOneSettingSelector ();
|
2021-12-15 20:42:47 +01:00
|
|
|
|
for (PrvPub = Agd_PRIVAT_EVENTS;
|
2017-03-21 14:36:22 +01:00
|
|
|
|
PrvPub <= Agd_PUBLIC_EVENTS;
|
2017-03-21 00:57:11 +01:00
|
|
|
|
PrvPub++)
|
|
|
|
|
{
|
2022-04-25 19:45:05 +02:00
|
|
|
|
Set_BeginPref ((Agenda->PrivatPublicEvents & (1 << PrvPub)));
|
|
|
|
|
Frm_BeginForm (ActSeeMyAgd);
|
|
|
|
|
Agd_PutParamsMyAgenda (Agenda->Past__FutureEvents,
|
|
|
|
|
Agenda->PrivatPublicEvents ^ (1 << PrvPub), // Toggle
|
|
|
|
|
Agenda->HiddenVisiblEvents,
|
|
|
|
|
Agenda->SelectedOrder,
|
|
|
|
|
Agenda->CurrentPage,
|
|
|
|
|
-1L);
|
|
|
|
|
Ico_PutSettingIconLink (Icon[PrvPub].Icon,Icon[PrvPub].Color,
|
|
|
|
|
Txt_AGENDA_PRIVAT_PUBLIC_EVENTS[PrvPub]);
|
|
|
|
|
Frm_EndForm ();
|
|
|
|
|
Set_EndPref ();
|
2017-03-21 00:57:11 +01:00
|
|
|
|
}
|
2019-03-26 11:53:21 +01:00
|
|
|
|
Set_EndOneSettingSelector ();
|
2017-03-21 00:57:11 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/************* Show form to select hidden / visible events *******************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2020-04-12 14:42:32 +02:00
|
|
|
|
static void Agd_ShowFormToSelHiddenVisiblEvents (const struct Agd_Agenda *Agenda)
|
2017-03-21 00:57:11 +01:00
|
|
|
|
{
|
2017-03-21 14:36:22 +01:00
|
|
|
|
extern const char *Txt_AGENDA_HIDDEN_VISIBL_EVENTS[2];
|
|
|
|
|
Agd_HiddenVisiblEvents_t HidVis;
|
2021-12-22 00:20:06 +01:00
|
|
|
|
static const struct
|
|
|
|
|
{
|
|
|
|
|
const char *Icon;
|
|
|
|
|
Ico_Color_t Color;
|
|
|
|
|
} Icon[2] =
|
2017-03-21 00:57:11 +01:00
|
|
|
|
{
|
2021-12-22 00:20:06 +01:00
|
|
|
|
[Agd_HIDDEN_EVENTS] = {"eye-slash.svg",Ico_RED },
|
|
|
|
|
[Agd_VISIBL_EVENTS] = {"eye.svg" ,Ico_GREEN},
|
2017-03-21 00:57:11 +01:00
|
|
|
|
};
|
|
|
|
|
|
2021-03-02 16:47:58 +01:00
|
|
|
|
Set_BeginOneSettingSelector ();
|
2021-12-15 20:42:47 +01:00
|
|
|
|
for (HidVis = Agd_HIDDEN_EVENTS;
|
2017-03-21 14:36:22 +01:00
|
|
|
|
HidVis <= Agd_VISIBL_EVENTS;
|
2017-03-21 00:57:11 +01:00
|
|
|
|
HidVis++)
|
|
|
|
|
{
|
2022-04-25 19:45:05 +02:00
|
|
|
|
Set_BeginPref ((Agenda->HiddenVisiblEvents & (1 << HidVis)));
|
|
|
|
|
Frm_BeginForm (ActSeeMyAgd);
|
|
|
|
|
Agd_PutParamsMyAgenda (Agenda->Past__FutureEvents,
|
|
|
|
|
Agenda->PrivatPublicEvents,
|
|
|
|
|
Agenda->HiddenVisiblEvents ^ (1 << HidVis), // Toggle
|
|
|
|
|
Agenda->SelectedOrder,
|
|
|
|
|
Agenda->CurrentPage,
|
|
|
|
|
-1L);
|
|
|
|
|
Ico_PutSettingIconLink (Icon[HidVis].Icon,Icon[HidVis].Color,
|
|
|
|
|
Txt_AGENDA_HIDDEN_VISIBL_EVENTS[HidVis]);
|
|
|
|
|
Frm_EndForm ();
|
|
|
|
|
Set_EndPref ();
|
2017-03-21 00:57:11 +01:00
|
|
|
|
}
|
2019-03-26 11:53:21 +01:00
|
|
|
|
Set_EndOneSettingSelector ();
|
2017-03-21 00:57:11 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
2017-03-21 14:36:22 +01:00
|
|
|
|
/************************ Put hidden params for events ***********************/
|
2017-03-21 00:57:11 +01:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2017-03-21 14:36:22 +01:00
|
|
|
|
static void Agd_PutHiddenParamPast__FutureEvents (unsigned Past__FutureEvents)
|
2017-03-21 00:57:11 +01:00
|
|
|
|
{
|
2019-11-03 13:19:32 +01:00
|
|
|
|
Par_PutHiddenParamUnsigned (NULL,ParamPast__FutureName,Past__FutureEvents);
|
2017-03-21 00:57:11 +01:00
|
|
|
|
}
|
|
|
|
|
|
2017-03-21 14:36:22 +01:00
|
|
|
|
static void Agd_PutHiddenParamPrivatPublicEvents (unsigned PrivatPublicEvents)
|
2017-03-21 00:57:11 +01:00
|
|
|
|
{
|
2019-11-03 13:19:32 +01:00
|
|
|
|
Par_PutHiddenParamUnsigned (NULL,ParamPrivatPublicName,PrivatPublicEvents);
|
2017-03-21 14:36:22 +01:00
|
|
|
|
}
|
2017-03-21 00:57:11 +01:00
|
|
|
|
|
2017-03-21 14:36:22 +01:00
|
|
|
|
static void Agd_PutHiddenParamHiddenVisiblEvents (unsigned HiddenVisiblEvents)
|
|
|
|
|
{
|
2019-11-03 13:19:32 +01:00
|
|
|
|
Par_PutHiddenParamUnsigned (NULL,ParamHiddenVisiblName,HiddenVisiblEvents);
|
2017-03-21 00:57:11 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
2017-03-21 14:36:22 +01:00
|
|
|
|
/************************ Get hidden params for events ***********************/
|
2017-03-21 00:57:11 +01:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2020-04-12 14:42:32 +02:00
|
|
|
|
static unsigned Agd_GetParamsPast__FutureEvents (void)
|
2017-03-21 00:57:11 +01:00
|
|
|
|
{
|
2020-04-12 14:42:32 +02:00
|
|
|
|
return (unsigned) Par_GetParToUnsignedLong (ParamPast__FutureName,
|
|
|
|
|
0,
|
|
|
|
|
(1 << Agd_PAST___EVENTS) |
|
|
|
|
|
(1 << Agd_FUTURE_EVENTS),
|
|
|
|
|
Agd_DEFAULT_PAST___EVENTS |
|
|
|
|
|
Agd_DEFAULT_FUTURE_EVENTS);
|
2017-03-21 14:36:22 +01:00
|
|
|
|
}
|
2017-03-21 00:57:11 +01:00
|
|
|
|
|
2020-04-12 14:42:32 +02:00
|
|
|
|
static unsigned Agd_GetParamsPrivatPublicEvents (void)
|
2017-03-21 14:36:22 +01:00
|
|
|
|
{
|
2020-04-12 14:42:32 +02:00
|
|
|
|
return (unsigned) Par_GetParToUnsignedLong (ParamPrivatPublicName,
|
|
|
|
|
0,
|
|
|
|
|
(1 << Agd_PRIVAT_EVENTS) |
|
|
|
|
|
(1 << Agd_PUBLIC_EVENTS),
|
|
|
|
|
Agd_DEFAULT_PRIVAT_EVENTS |
|
|
|
|
|
Agd_DEFAULT_PUBLIC_EVENTS);
|
2017-03-21 14:36:22 +01:00
|
|
|
|
}
|
|
|
|
|
|
2020-04-12 14:42:32 +02:00
|
|
|
|
static unsigned Agd_GetParamsHiddenVisiblEvents (void)
|
2017-03-21 14:36:22 +01:00
|
|
|
|
{
|
2020-04-12 14:42:32 +02:00
|
|
|
|
return (unsigned) Par_GetParToUnsignedLong (ParamHiddenVisiblName,
|
|
|
|
|
0,
|
|
|
|
|
(1 << Agd_HIDDEN_EVENTS) |
|
|
|
|
|
(1 << Agd_VISIBL_EVENTS),
|
|
|
|
|
Agd_DEFAULT_HIDDEN_EVENTS |
|
|
|
|
|
Agd_DEFAULT_VISIBL_EVENTS);
|
2017-03-21 00:57:11 +01:00
|
|
|
|
}
|
|
|
|
|
|
2016-12-04 03:50:25 +01:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/************************ Show another user's agenda *************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2016-12-02 00:24:16 +01:00
|
|
|
|
void Agd_ShowUsrAgenda (void)
|
2016-11-30 22:49:48 +01:00
|
|
|
|
{
|
2016-12-07 10:16:39 +01:00
|
|
|
|
extern const char *Hlp_PROFILE_Agenda_public_agenda;
|
2016-12-06 03:10:06 +01:00
|
|
|
|
extern const char *Txt_Public_agenda_USER;
|
2020-04-12 14:42:32 +02:00
|
|
|
|
struct Agd_Agenda Agenda;
|
2016-12-09 13:59:33 +01:00
|
|
|
|
bool Error = true;
|
2021-12-29 21:31:49 +01:00
|
|
|
|
bool ItsMe;
|
|
|
|
|
char *Title;
|
2016-11-30 22:49:48 +01:00
|
|
|
|
|
2016-12-02 00:24:16 +01:00
|
|
|
|
/***** Get user *****/
|
|
|
|
|
if (Usr_GetParamOtherUsrCodEncryptedAndGetUsrData ())
|
2016-12-09 13:59:33 +01:00
|
|
|
|
if (Usr_CheckIfICanViewUsrAgenda (&Gbl.Usrs.Other.UsrDat))
|
|
|
|
|
{
|
|
|
|
|
Error = false;
|
|
|
|
|
|
2020-04-12 14:42:32 +02:00
|
|
|
|
/***** Reset agenda context *****/
|
|
|
|
|
Agd_ResetAgenda (&Agenda);
|
|
|
|
|
|
2019-10-26 02:19:42 +02:00
|
|
|
|
/***** Begin box *****/
|
2021-12-29 21:31:49 +01:00
|
|
|
|
ItsMe = Usr_ItsMe (Gbl.Usrs.Other.UsrDat.UsrCod);
|
|
|
|
|
if (asprintf (&Title,Txt_Public_agenda_USER,
|
|
|
|
|
ItsMe ? Gbl.Usrs.Me.UsrDat.FullName :
|
|
|
|
|
Gbl.Usrs.Other.UsrDat.FullName) < 0)
|
|
|
|
|
Err_NotEnoughMemoryExit ();
|
|
|
|
|
Box_BoxBegin ("100%",Title,
|
|
|
|
|
ItsMe ? Agd_PutIconsMyPublicAgenda :
|
|
|
|
|
Agd_PutIconsOtherPublicAgenda,
|
|
|
|
|
ItsMe ? Gbl.Usrs.Me.UsrDat.EnUsrCod :
|
|
|
|
|
Gbl.Usrs.Other.UsrDat.EnUsrCod,
|
|
|
|
|
Hlp_PROFILE_Agenda_public_agenda,Box_NOT_CLOSABLE);
|
|
|
|
|
free (Title);
|
2016-12-09 13:59:33 +01:00
|
|
|
|
|
2021-05-10 22:23:10 +02:00
|
|
|
|
/***** Show the current events in the user's agenda *****/
|
|
|
|
|
Agd_ShowEventsToday (&Agenda,Agd_ANOTHER_AGENDA_TODAY);
|
2016-12-09 13:59:33 +01:00
|
|
|
|
|
2021-10-30 13:28:48 +02:00
|
|
|
|
/***** Show all visible events in the user's agenda *****/
|
2021-05-10 22:23:10 +02:00
|
|
|
|
Agd_ShowEvents (&Agenda,Agd_ANOTHER_AGENDA);
|
2016-12-09 13:59:33 +01:00
|
|
|
|
|
2017-06-12 14:16:33 +02:00
|
|
|
|
/***** End box *****/
|
2019-10-25 22:48:34 +02:00
|
|
|
|
Box_BoxEnd ();
|
2016-12-09 13:59:33 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (Error)
|
2019-03-09 20:12:44 +01:00
|
|
|
|
Ale_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
|
2016-11-30 22:49:48 +01:00
|
|
|
|
}
|
|
|
|
|
|
2016-07-07 00:21:10 +02:00
|
|
|
|
/*****************************************************************************/
|
2016-12-06 21:26:02 +01:00
|
|
|
|
/***************** Show another user's agenda after log in *******************/
|
2016-12-06 21:08:28 +01:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2016-12-06 21:26:02 +01:00
|
|
|
|
void Agd_ShowOtherAgendaAfterLogIn (void)
|
2016-12-06 21:08:28 +01:00
|
|
|
|
{
|
2016-12-07 10:16:39 +01:00
|
|
|
|
extern const char *Hlp_PROFILE_Agenda_public_agenda;
|
2018-12-09 10:46:57 +01:00
|
|
|
|
extern const unsigned Txt_Current_CGI_SWAD_Language;
|
2016-12-06 21:08:28 +01:00
|
|
|
|
extern const char *Txt_Public_agenda_USER;
|
2018-12-08 16:43:13 +01:00
|
|
|
|
extern const char *Txt_Switching_to_LANGUAGE[1 + Lan_NUM_LANGUAGES];
|
2020-04-12 14:42:32 +02:00
|
|
|
|
struct Agd_Agenda Agenda;
|
2021-12-29 21:31:49 +01:00
|
|
|
|
bool ItsMe;
|
|
|
|
|
char *Title;
|
2016-12-06 21:08:28 +01:00
|
|
|
|
|
2016-12-06 21:26:02 +01:00
|
|
|
|
if (Gbl.Usrs.Me.Logged)
|
|
|
|
|
{
|
2018-12-09 10:46:57 +01:00
|
|
|
|
if (Gbl.Usrs.Me.UsrDat.Prefs.Language == Txt_Current_CGI_SWAD_Language)
|
2016-12-06 21:26:02 +01:00
|
|
|
|
{
|
|
|
|
|
/***** Get user *****/
|
|
|
|
|
/* If nickname is correct, user code is already got from nickname */
|
2021-04-24 15:10:07 +02:00
|
|
|
|
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat, // Existing user
|
|
|
|
|
Usr_DONT_GET_PREFS,
|
|
|
|
|
Usr_DONT_GET_ROLE_IN_CURRENT_CRS))
|
2016-12-06 21:26:02 +01:00
|
|
|
|
{
|
2020-04-12 14:42:32 +02:00
|
|
|
|
/***** Reset agenda context *****/
|
|
|
|
|
Agd_ResetAgenda (&Agenda);
|
|
|
|
|
|
2019-10-26 02:19:42 +02:00
|
|
|
|
/***** Begin box *****/
|
2021-12-29 21:31:49 +01:00
|
|
|
|
ItsMe = Usr_ItsMe (Gbl.Usrs.Other.UsrDat.UsrCod);
|
|
|
|
|
if (asprintf (&Title,Txt_Public_agenda_USER,
|
|
|
|
|
ItsMe ? Gbl.Usrs.Me.UsrDat.FullName :
|
|
|
|
|
Gbl.Usrs.Other.UsrDat.FullName) < 0)
|
|
|
|
|
Err_NotEnoughMemoryExit ();
|
|
|
|
|
Box_BoxBegin ("100%",Title,
|
|
|
|
|
ItsMe ? Agd_PutIconToViewEditMyFullAgenda :
|
|
|
|
|
Agd_PutIconsOtherPublicAgenda,
|
|
|
|
|
ItsMe ? Gbl.Usrs.Me.UsrDat.EnUsrCod :
|
|
|
|
|
Gbl.Usrs.Other.UsrDat.EnUsrCod,
|
|
|
|
|
Hlp_PROFILE_Agenda_public_agenda,Box_NOT_CLOSABLE);
|
|
|
|
|
free (Title);
|
2016-12-06 03:10:06 +01:00
|
|
|
|
|
2021-05-10 22:23:10 +02:00
|
|
|
|
/***** Show the current events in the user's agenda *****/
|
|
|
|
|
Agd_ShowEventsToday (&Agenda,Agd_ANOTHER_AGENDA_TODAY);
|
2016-12-06 03:10:06 +01:00
|
|
|
|
|
2021-10-30 13:28:48 +02:00
|
|
|
|
/***** Show all visible events in the user's agenda *****/
|
2021-05-10 22:23:10 +02:00
|
|
|
|
Agd_ShowEvents (&Agenda,Agd_ANOTHER_AGENDA);
|
2016-12-06 03:10:06 +01:00
|
|
|
|
|
2017-06-12 14:16:33 +02:00
|
|
|
|
/***** End box *****/
|
2019-10-25 22:48:34 +02:00
|
|
|
|
Box_BoxEnd ();
|
2016-12-06 21:26:02 +01:00
|
|
|
|
}
|
|
|
|
|
else
|
2019-03-09 20:12:44 +01:00
|
|
|
|
Ale_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
|
2016-12-06 21:26:02 +01:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
/* The current language is not my preferred language
|
|
|
|
|
==> change automatically to my language */
|
2019-02-16 14:37:34 +01:00
|
|
|
|
Ale_ShowAlert (Ale_INFO,Txt_Switching_to_LANGUAGE[Gbl.Usrs.Me.UsrDat.Prefs.Language]);
|
2016-12-06 21:26:02 +01:00
|
|
|
|
}
|
2016-12-02 00:24:16 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/*************************** Show events in agenda ***************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2020-04-12 14:42:32 +02:00
|
|
|
|
static void Agd_ShowEvents (struct Agd_Agenda *Agenda,
|
|
|
|
|
Agd_AgendaType_t AgendaType)
|
2016-11-30 22:49:48 +01:00
|
|
|
|
{
|
2016-12-01 00:53:50 +01:00
|
|
|
|
extern const char *Hlp_PROFILE_Agenda;
|
2016-12-03 23:48:03 +01:00
|
|
|
|
extern const char *Txt_Public_agenda_USER;
|
2016-12-02 00:24:16 +01:00
|
|
|
|
extern const char *Txt_My_agenda;
|
2016-12-01 00:53:50 +01:00
|
|
|
|
extern const char *Txt_No_events;
|
2016-11-30 22:49:48 +01:00
|
|
|
|
struct Pagination Pagination;
|
2016-12-02 00:24:16 +01:00
|
|
|
|
unsigned NumEvent;
|
2019-11-21 11:39:30 +01:00
|
|
|
|
static const Pag_WhatPaginate_t WhatPaginate[Agd_NUM_AGENDA_TYPES] =
|
2016-12-02 00:24:16 +01:00
|
|
|
|
{
|
2019-11-20 17:53:51 +01:00
|
|
|
|
[Agd_MY_AGENDA_TODAY ] = Pag_MY_AGENDA, // not used
|
|
|
|
|
[Agd_MY_AGENDA ] = Pag_MY_AGENDA,
|
|
|
|
|
[Agd_ANOTHER_AGENDA_TODAY] = Pag_ANOTHER_AGENDA, // not used
|
|
|
|
|
[Agd_ANOTHER_AGENDA ] = Pag_ANOTHER_AGENDA,
|
2016-12-02 00:24:16 +01:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/***** Get parameters *****/
|
2020-04-12 14:42:32 +02:00
|
|
|
|
Agd_GetParams (Agenda,AgendaType);
|
2016-11-30 22:49:48 +01:00
|
|
|
|
|
2016-12-01 00:53:50 +01:00
|
|
|
|
/***** Get list of events *****/
|
2020-04-12 14:42:32 +02:00
|
|
|
|
Agd_GetListEvents (Agenda,AgendaType);
|
2016-11-30 22:49:48 +01:00
|
|
|
|
|
|
|
|
|
/***** Compute variables related to pagination *****/
|
2020-04-12 14:42:32 +02:00
|
|
|
|
Pagination.NumItems = Agenda->Num;
|
|
|
|
|
Pagination.CurrentPage = (int) Agenda->CurrentPage;
|
2016-11-30 22:49:48 +01:00
|
|
|
|
Pag_CalculatePagination (&Pagination);
|
2020-04-12 14:42:32 +02:00
|
|
|
|
Agenda->CurrentPage = (unsigned) Pagination.CurrentPage;
|
2016-11-30 22:49:48 +01:00
|
|
|
|
|
|
|
|
|
/***** Write links to pages *****/
|
2020-04-10 19:14:08 +02:00
|
|
|
|
Pag_WriteLinksToPagesCentered (WhatPaginate[AgendaType],&Pagination,
|
2020-04-12 14:42:32 +02:00
|
|
|
|
Agenda,-1L);
|
2016-11-30 22:49:48 +01:00
|
|
|
|
|
2020-04-12 14:42:32 +02:00
|
|
|
|
if (Agenda->Num)
|
2016-11-30 22:49:48 +01:00
|
|
|
|
{
|
2019-10-20 22:00:28 +02:00
|
|
|
|
/***** Begin table *****/
|
2019-10-23 19:05:05 +02:00
|
|
|
|
HTM_TABLE_BeginWideMarginPadding (2);
|
2016-12-06 03:10:06 +01:00
|
|
|
|
|
2021-05-10 22:23:10 +02:00
|
|
|
|
/***** Table head *****/
|
|
|
|
|
Agd_WriteHeaderListEvents (Agenda,AgendaType);
|
2016-11-30 22:49:48 +01:00
|
|
|
|
|
2021-10-30 13:28:48 +02:00
|
|
|
|
/***** Write all events *****/
|
|
|
|
|
for (NumEvent = Pagination.FirstItemVisible;
|
2021-05-10 22:23:10 +02:00
|
|
|
|
NumEvent <= Pagination.LastItemVisible;
|
|
|
|
|
NumEvent++)
|
|
|
|
|
Agd_ShowOneEvent (Agenda,AgendaType,Agenda->LstAgdCods[NumEvent - 1]);
|
2016-11-30 22:49:48 +01:00
|
|
|
|
|
|
|
|
|
/***** End table *****/
|
2019-10-23 19:05:05 +02:00
|
|
|
|
HTM_TABLE_End ();
|
2016-11-30 22:49:48 +01:00
|
|
|
|
}
|
2016-12-06 03:10:06 +01:00
|
|
|
|
else
|
2019-02-16 14:37:34 +01:00
|
|
|
|
Ale_ShowAlert (Ale_INFO,Txt_No_events);
|
2016-11-30 22:49:48 +01:00
|
|
|
|
|
2016-12-06 03:10:06 +01:00
|
|
|
|
/***** Write again links to pages *****/
|
2020-04-10 19:14:08 +02:00
|
|
|
|
Pag_WriteLinksToPagesCentered (WhatPaginate[AgendaType],&Pagination,
|
2020-04-12 14:42:32 +02:00
|
|
|
|
Agenda,-1L);
|
2016-12-06 03:10:06 +01:00
|
|
|
|
|
2016-12-01 00:53:50 +01:00
|
|
|
|
/***** Button to create a new event *****/
|
2017-03-21 14:52:07 +01:00
|
|
|
|
if (AgendaType == Agd_MY_AGENDA)
|
2020-04-12 14:42:32 +02:00
|
|
|
|
Agd_PutButtonToCreateNewEvent (Agenda);
|
2016-11-30 22:49:48 +01:00
|
|
|
|
|
2016-12-06 03:10:06 +01:00
|
|
|
|
/***** Free list of events *****/
|
2020-04-12 14:42:32 +02:00
|
|
|
|
Agd_FreeListEvents (Agenda);
|
2016-12-06 03:10:06 +01:00
|
|
|
|
}
|
2016-11-30 22:49:48 +01:00
|
|
|
|
|
2016-12-06 03:10:06 +01:00
|
|
|
|
/*****************************************************************************/
|
2016-12-06 21:08:28 +01:00
|
|
|
|
/************************ Show today events in agenda ************************/
|
2016-12-06 03:10:06 +01:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2020-04-12 14:42:32 +02:00
|
|
|
|
static void Agd_ShowEventsToday (struct Agd_Agenda *Agenda,
|
|
|
|
|
Agd_AgendaType_t AgendaType)
|
2016-12-06 03:10:06 +01:00
|
|
|
|
{
|
|
|
|
|
extern const char *Hlp_PROFILE_Agenda;
|
2016-12-07 10:16:39 +01:00
|
|
|
|
extern const char *Hlp_PROFILE_Agenda_public_agenda;
|
2016-12-06 18:04:12 +01:00
|
|
|
|
extern const char *Txt_Today;
|
2016-12-06 03:10:06 +01:00
|
|
|
|
extern const char *Txt_Public_agenda_USER;
|
|
|
|
|
extern const char *Txt_My_agenda;
|
|
|
|
|
extern const char *Txt_No_events;
|
|
|
|
|
unsigned NumEvent;
|
|
|
|
|
|
|
|
|
|
/***** Get parameters *****/
|
2020-04-12 14:42:32 +02:00
|
|
|
|
Agd_GetParams (Agenda,AgendaType);
|
2016-12-06 03:10:06 +01:00
|
|
|
|
|
|
|
|
|
/***** Get list of events *****/
|
2020-04-12 14:42:32 +02:00
|
|
|
|
Agd_GetListEvents (Agenda,AgendaType);
|
2016-12-06 03:10:06 +01:00
|
|
|
|
|
2020-04-12 14:42:32 +02:00
|
|
|
|
if (Agenda->Num)
|
2016-12-06 03:10:06 +01:00
|
|
|
|
{
|
2019-10-26 02:19:42 +02:00
|
|
|
|
/***** Begin box and table *****/
|
2016-12-06 19:14:58 +01:00
|
|
|
|
switch (AgendaType)
|
|
|
|
|
{
|
2017-03-21 14:52:07 +01:00
|
|
|
|
case Agd_MY_AGENDA_TODAY:
|
2020-03-26 02:54:30 +01:00
|
|
|
|
Box_BoxTableShadowBegin (NULL,Txt_Today,
|
|
|
|
|
NULL,NULL,
|
2017-06-11 22:26:40 +02:00
|
|
|
|
Hlp_PROFILE_Agenda,
|
|
|
|
|
2);
|
2016-12-06 19:14:58 +01:00
|
|
|
|
break;
|
2017-03-21 14:52:07 +01:00
|
|
|
|
case Agd_ANOTHER_AGENDA_TODAY:
|
2020-03-26 02:54:30 +01:00
|
|
|
|
Box_BoxTableShadowBegin (NULL,Txt_Today,
|
|
|
|
|
NULL,NULL,
|
2017-06-11 22:26:40 +02:00
|
|
|
|
Hlp_PROFILE_Agenda_public_agenda,
|
|
|
|
|
2);
|
2016-12-06 21:26:02 +01:00
|
|
|
|
break;
|
2016-12-06 21:08:28 +01:00
|
|
|
|
default:
|
2016-12-06 19:14:58 +01:00
|
|
|
|
break;
|
|
|
|
|
}
|
2016-12-06 03:10:06 +01:00
|
|
|
|
|
2021-05-10 22:23:10 +02:00
|
|
|
|
/***** Table head *****/
|
|
|
|
|
Agd_WriteHeaderListEvents (Agenda,AgendaType);
|
2016-12-06 03:10:06 +01:00
|
|
|
|
|
2021-10-30 13:28:48 +02:00
|
|
|
|
/***** Write all events *****/
|
2021-05-10 22:23:10 +02:00
|
|
|
|
for (NumEvent = 0;
|
|
|
|
|
NumEvent < Agenda->Num;
|
|
|
|
|
NumEvent++)
|
|
|
|
|
Agd_ShowOneEvent (Agenda,AgendaType,Agenda->LstAgdCods[NumEvent]);
|
2016-12-06 03:10:06 +01:00
|
|
|
|
|
2017-06-12 14:16:33 +02:00
|
|
|
|
/***** End table and box *****/
|
2019-11-25 23:18:08 +01:00
|
|
|
|
Box_BoxTableEnd ();
|
2016-12-06 03:10:06 +01:00
|
|
|
|
}
|
2016-11-30 22:49:48 +01:00
|
|
|
|
|
2016-12-01 00:53:50 +01:00
|
|
|
|
/***** Free list of events *****/
|
2020-04-12 14:42:32 +02:00
|
|
|
|
Agd_FreeListEvents (Agenda);
|
2016-11-30 22:49:48 +01:00
|
|
|
|
}
|
|
|
|
|
|
2016-12-05 23:13:58 +01:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/*************** Put contextual icon to view/edit my agenda ******************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2020-04-12 14:42:32 +02:00
|
|
|
|
static void Agd_WriteHeaderListEvents (const struct Agd_Agenda *Agenda,
|
|
|
|
|
Agd_AgendaType_t AgendaType)
|
2016-12-06 03:10:06 +01:00
|
|
|
|
{
|
2016-12-15 00:39:52 +01:00
|
|
|
|
extern const char *Txt_START_END_TIME_HELP[2];
|
|
|
|
|
extern const char *Txt_START_END_TIME[Dat_NUM_START_END_TIME];
|
2016-12-06 03:10:06 +01:00
|
|
|
|
extern const char *Txt_Event;
|
|
|
|
|
extern const char *Txt_Location;
|
2020-04-05 22:53:58 +02:00
|
|
|
|
Dat_StartEndTime_t Order;
|
2016-12-06 03:10:06 +01:00
|
|
|
|
|
|
|
|
|
/***** Table head *****/
|
2019-10-23 19:05:05 +02:00
|
|
|
|
HTM_TR_Begin (NULL);
|
2019-10-11 01:02:51 +02:00
|
|
|
|
|
2022-01-02 00:39:26 +01:00
|
|
|
|
for (Order = (Dat_StartEndTime_t) 0;
|
|
|
|
|
Order <= (Dat_StartEndTime_t) (Dat_NUM_START_END_TIME - 1);
|
2021-05-10 22:23:10 +02:00
|
|
|
|
Order++)
|
2016-12-06 03:10:06 +01:00
|
|
|
|
{
|
2022-01-02 15:17:30 +01:00
|
|
|
|
HTM_TH_Begin (HTM_HEAD_LEFT);
|
2021-05-10 22:23:10 +02:00
|
|
|
|
switch (AgendaType)
|
|
|
|
|
{
|
|
|
|
|
case Agd_MY_AGENDA_TODAY:
|
|
|
|
|
case Agd_MY_AGENDA:
|
|
|
|
|
Frm_BeginForm (ActSeeMyAgd);
|
2021-12-01 01:43:13 +01:00
|
|
|
|
Pag_PutHiddenParamPagNum (Pag_MY_AGENDA,Agenda->CurrentPage);
|
2021-05-10 22:23:10 +02:00
|
|
|
|
break;
|
|
|
|
|
case Agd_ANOTHER_AGENDA_TODAY:
|
|
|
|
|
case Agd_ANOTHER_AGENDA:
|
|
|
|
|
Frm_BeginForm (ActSeeUsrAgd);
|
2021-12-01 01:43:13 +01:00
|
|
|
|
Usr_PutParamOtherUsrCodEncrypted (Gbl.Usrs.Other.UsrDat.EnUsrCod);
|
|
|
|
|
Pag_PutHiddenParamPagNum (Pag_ANOTHER_AGENDA,Agenda->CurrentPage);
|
2021-05-10 22:23:10 +02:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
Agd_PutParamsMyAgenda (Agenda->Past__FutureEvents,
|
|
|
|
|
Agenda->PrivatPublicEvents,
|
|
|
|
|
Agenda->HiddenVisiblEvents,
|
|
|
|
|
Order,
|
|
|
|
|
Agenda->CurrentPage,
|
|
|
|
|
-1L);
|
|
|
|
|
|
2022-04-01 01:06:44 +02:00
|
|
|
|
HTM_BUTTON_Submit_Begin (Txt_START_END_TIME_HELP[Order],
|
|
|
|
|
"class=\"BT_LINK\"");
|
2021-05-10 22:23:10 +02:00
|
|
|
|
if (Order == Agenda->SelectedOrder)
|
|
|
|
|
HTM_U_Begin ();
|
|
|
|
|
|
|
|
|
|
HTM_Txt (Txt_START_END_TIME[Order]);
|
|
|
|
|
|
|
|
|
|
if (Order == Agenda->SelectedOrder)
|
|
|
|
|
HTM_U_End ();
|
|
|
|
|
HTM_BUTTON_End ();
|
|
|
|
|
|
|
|
|
|
Frm_EndForm ();
|
|
|
|
|
HTM_TH_End ();
|
2016-12-06 03:10:06 +01:00
|
|
|
|
}
|
2019-10-11 01:02:51 +02:00
|
|
|
|
|
2022-01-02 15:17:30 +01:00
|
|
|
|
HTM_TH (Txt_Event ,HTM_HEAD_LEFT);
|
|
|
|
|
HTM_TH (Txt_Location,HTM_HEAD_LEFT);
|
2019-10-11 01:02:51 +02:00
|
|
|
|
|
2019-10-23 19:05:05 +02:00
|
|
|
|
HTM_TR_End ();
|
2016-12-06 03:10:06 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
2016-12-06 21:08:28 +01:00
|
|
|
|
/********************** Put contextual icons in agenda ***********************/
|
2016-12-06 03:10:06 +01:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2020-03-26 02:54:30 +01:00
|
|
|
|
static void Agd_PutIconsMyFullAgenda (void *Agenda)
|
2016-12-05 23:13:58 +01:00
|
|
|
|
{
|
2016-12-06 21:08:28 +01:00
|
|
|
|
/***** Put icon to create a new event *****/
|
2020-03-26 02:54:30 +01:00
|
|
|
|
Agd_PutIconToCreateNewEvent (Agenda);
|
2016-12-05 23:13:58 +01:00
|
|
|
|
|
2016-12-06 21:08:28 +01:00
|
|
|
|
/***** Put icon to show QR code *****/
|
|
|
|
|
Agd_PutIconToShowQR ();
|
|
|
|
|
}
|
2016-12-05 03:16:25 +01:00
|
|
|
|
|
2020-03-26 02:54:30 +01:00
|
|
|
|
static void Agd_PutIconsMyPublicAgenda (void *EncryptedUsrCod)
|
2016-12-05 03:16:25 +01:00
|
|
|
|
{
|
2016-12-06 21:08:28 +01:00
|
|
|
|
/***** Put icon to view/edit my full agenda *****/
|
2020-03-26 02:54:30 +01:00
|
|
|
|
Agd_PutIconToViewEditMyFullAgenda (EncryptedUsrCod);
|
2016-12-05 03:16:25 +01:00
|
|
|
|
|
|
|
|
|
/***** Put icon to show QR code *****/
|
|
|
|
|
Agd_PutIconToShowQR ();
|
|
|
|
|
}
|
|
|
|
|
|
2020-03-26 02:54:30 +01:00
|
|
|
|
static void Agd_PutIconToCreateNewEvent (void *Agenda)
|
2016-11-30 22:49:48 +01:00
|
|
|
|
{
|
|
|
|
|
extern const char *Txt_New_event;
|
|
|
|
|
|
2016-12-01 00:53:50 +01:00
|
|
|
|
/***** Put form to create a new event *****/
|
2020-04-12 14:42:32 +02:00
|
|
|
|
((struct Agd_Agenda *) Agenda)->AgdCodToEdit = -1L;
|
2019-01-10 15:26:33 +01:00
|
|
|
|
Ico_PutContextualIconToAdd (ActFrmNewEvtMyAgd,NULL,
|
2020-04-12 14:42:32 +02:00
|
|
|
|
Agd_PutCurrentParamsMyAgenda,Agenda,
|
2019-01-10 15:26:33 +01:00
|
|
|
|
Txt_New_event);
|
2016-11-30 22:49:48 +01:00
|
|
|
|
}
|
|
|
|
|
|
2020-03-26 02:54:30 +01:00
|
|
|
|
static void Agd_PutIconToViewEditMyFullAgenda (void *EncryptedUsrCod)
|
2016-12-06 21:08:28 +01:00
|
|
|
|
{
|
2020-03-26 02:54:30 +01:00
|
|
|
|
Ico_PutContextualIconToEdit (ActSeeMyAgd,NULL,
|
|
|
|
|
NULL,EncryptedUsrCod);
|
2016-12-06 21:08:28 +01:00
|
|
|
|
}
|
2016-12-05 03:16:25 +01:00
|
|
|
|
|
|
|
|
|
static void Agd_PutIconToShowQR (void)
|
|
|
|
|
{
|
2021-09-30 20:11:00 +02:00
|
|
|
|
char URL[Cns_MAX_BYTES_WWW + 1];
|
2018-12-08 16:43:13 +01:00
|
|
|
|
extern const char *Lan_STR_LANG_ID[1 + Lan_NUM_LANGUAGES];
|
2016-12-05 09:50:35 +01:00
|
|
|
|
|
2021-02-15 16:25:55 +01:00
|
|
|
|
snprintf (URL,sizeof (URL),"%s/%s?agd=@%s",
|
|
|
|
|
Cfg_URL_SWAD_CGI,Lan_STR_LANG_ID[Gbl.Prefs.Language],
|
2018-10-17 01:08:42 +02:00
|
|
|
|
Gbl.Usrs.Me.UsrDat.Nickname);
|
2020-03-26 02:54:30 +01:00
|
|
|
|
QR_PutLinkToPrintQRCode (ActPrnAgdQR,
|
2020-03-27 14:56:54 +01:00
|
|
|
|
QR_PutParamQRString,URL);
|
2016-12-05 03:16:25 +01:00
|
|
|
|
}
|
|
|
|
|
|
2020-03-26 02:54:30 +01:00
|
|
|
|
static void Agd_PutIconsOtherPublicAgenda (void *EncryptedUsrCod)
|
2016-12-09 14:50:21 +01:00
|
|
|
|
{
|
2017-02-17 01:59:58 +01:00
|
|
|
|
extern const char *Txt_Another_user_s_profile;
|
2016-12-09 14:50:21 +01:00
|
|
|
|
extern const char *Txt_View_record_for_this_course;
|
|
|
|
|
extern const char *Txt_View_record_and_office_hours;
|
|
|
|
|
|
|
|
|
|
/***** Button to view user's public profile *****/
|
2019-03-22 15:21:46 +01:00
|
|
|
|
if (Pri_ShowingIsAllowed (Gbl.Usrs.Other.UsrDat.BaPrfVisibility,
|
2017-02-17 01:59:58 +01:00
|
|
|
|
&Gbl.Usrs.Other.UsrDat))
|
2019-01-12 03:00:59 +01:00
|
|
|
|
Lay_PutContextualLinkOnlyIcon (ActSeeOthPubPrf,NULL,
|
2020-03-26 02:54:30 +01:00
|
|
|
|
Usr_PutParamOtherUsrCodEncrypted,EncryptedUsrCod,
|
2021-12-22 00:20:06 +01:00
|
|
|
|
"user.svg",Ico_BLACK,
|
2019-01-12 03:00:59 +01:00
|
|
|
|
Txt_Another_user_s_profile);
|
2016-12-09 14:50:21 +01:00
|
|
|
|
|
|
|
|
|
/***** Button to view user's record card *****/
|
|
|
|
|
if (Usr_CheckIfICanViewRecordStd (&Gbl.Usrs.Other.UsrDat))
|
|
|
|
|
/* View student's records: common record card and course record card */
|
2019-01-12 03:00:59 +01:00
|
|
|
|
Lay_PutContextualLinkOnlyIcon (ActSeeRecOneStd,NULL,
|
2020-03-26 02:54:30 +01:00
|
|
|
|
Usr_PutParamOtherUsrCodEncrypted,EncryptedUsrCod,
|
2021-12-22 00:20:06 +01:00
|
|
|
|
"address-card.svg",Ico_BLACK,
|
2019-01-12 03:00:59 +01:00
|
|
|
|
Txt_View_record_for_this_course);
|
2016-12-09 14:50:21 +01:00
|
|
|
|
else if (Usr_CheckIfICanViewRecordTch (&Gbl.Usrs.Other.UsrDat))
|
2019-01-12 03:00:59 +01:00
|
|
|
|
Lay_PutContextualLinkOnlyIcon (ActSeeRecOneTch,NULL,
|
2020-03-26 02:54:30 +01:00
|
|
|
|
Usr_PutParamOtherUsrCodEncrypted,EncryptedUsrCod,
|
2021-12-22 00:20:06 +01:00
|
|
|
|
"address-card.svg",Ico_BLACK,
|
2019-01-12 03:00:59 +01:00
|
|
|
|
Txt_View_record_and_office_hours);
|
2016-12-09 14:50:21 +01:00
|
|
|
|
}
|
|
|
|
|
|
2016-11-30 22:49:48 +01:00
|
|
|
|
/*****************************************************************************/
|
2016-12-01 00:53:50 +01:00
|
|
|
|
/********************* Put button to create a new event **********************/
|
2016-11-30 22:49:48 +01:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2020-04-12 14:42:32 +02:00
|
|
|
|
static void Agd_PutButtonToCreateNewEvent (const struct Agd_Agenda *Agenda)
|
2016-11-30 22:49:48 +01:00
|
|
|
|
{
|
|
|
|
|
extern const char *Txt_New_event;
|
|
|
|
|
|
2021-05-10 22:23:10 +02:00
|
|
|
|
/***** Begin form *****/
|
2021-03-02 00:54:26 +01:00
|
|
|
|
Frm_BeginForm (ActFrmNewEvtMyAgd);
|
2021-12-01 01:43:13 +01:00
|
|
|
|
Agd_PutParamsMyAgenda (Agenda->Past__FutureEvents,
|
|
|
|
|
Agenda->PrivatPublicEvents,
|
|
|
|
|
Agenda->HiddenVisiblEvents,
|
|
|
|
|
Agenda->SelectedOrder,
|
|
|
|
|
Agenda->CurrentPage,
|
|
|
|
|
-1L);
|
2021-05-10 22:23:10 +02:00
|
|
|
|
|
|
|
|
|
/***** Confirm button *****/
|
|
|
|
|
Btn_PutConfirmButton (Txt_New_event);
|
|
|
|
|
|
|
|
|
|
/***** End form *****/
|
2018-11-09 20:47:39 +01:00
|
|
|
|
Frm_EndForm ();
|
2016-11-30 22:49:48 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
2016-12-01 00:53:50 +01:00
|
|
|
|
/******************************* Show one event ******************************/
|
2016-11-30 22:49:48 +01:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2020-04-12 14:42:32 +02:00
|
|
|
|
static void Agd_ShowOneEvent (struct Agd_Agenda *Agenda,
|
|
|
|
|
Agd_AgendaType_t AgendaType,long AgdCod)
|
2016-11-30 22:49:48 +01:00
|
|
|
|
{
|
2016-12-02 10:45:53 +01:00
|
|
|
|
extern const char *Dat_TimeStatusClassVisible[Dat_NUM_TIME_STATUS];
|
|
|
|
|
extern const char *Dat_TimeStatusClassHidden[Dat_NUM_TIME_STATUS];
|
2019-04-20 19:04:05 +02:00
|
|
|
|
char *Anchor = NULL;
|
2016-11-30 22:49:48 +01:00
|
|
|
|
static unsigned UniqueId = 0;
|
2019-11-01 22:53:39 +01:00
|
|
|
|
char *Id;
|
2020-04-08 03:06:45 +02:00
|
|
|
|
struct Agd_Event AgdEvent;
|
2019-09-27 00:30:05 +02:00
|
|
|
|
Dat_StartEndTime_t StartEndTime;
|
2017-01-28 15:58:46 +01:00
|
|
|
|
char Txt[Cns_MAX_BYTES_TEXT + 1];
|
2016-11-30 22:49:48 +01:00
|
|
|
|
|
2016-12-01 00:53:50 +01:00
|
|
|
|
/***** Get data of this event *****/
|
|
|
|
|
AgdEvent.AgdCod = AgdCod;
|
2016-12-02 00:24:16 +01:00
|
|
|
|
switch (AgendaType)
|
|
|
|
|
{
|
2017-03-21 14:52:07 +01:00
|
|
|
|
case Agd_MY_AGENDA_TODAY:
|
|
|
|
|
case Agd_MY_AGENDA:
|
2016-12-02 00:24:16 +01:00
|
|
|
|
AgdEvent.UsrCod = Gbl.Usrs.Me.UsrDat.UsrCod;
|
|
|
|
|
break;
|
2017-03-21 14:52:07 +01:00
|
|
|
|
case Agd_ANOTHER_AGENDA_TODAY:
|
|
|
|
|
case Agd_ANOTHER_AGENDA:
|
2016-12-06 21:26:02 +01:00
|
|
|
|
AgdEvent.UsrCod = Gbl.Usrs.Other.UsrDat.UsrCod;
|
|
|
|
|
break;
|
2016-12-02 00:24:16 +01:00
|
|
|
|
}
|
2016-12-01 00:53:50 +01:00
|
|
|
|
Agd_GetDataOfEventByCod (&AgdEvent);
|
2016-11-30 22:49:48 +01:00
|
|
|
|
|
2019-04-20 19:04:05 +02:00
|
|
|
|
/***** Set anchor string *****/
|
2019-04-20 21:11:44 +02:00
|
|
|
|
Frm_SetAnchorStr (AgdEvent.AgdCod,&Anchor);
|
2019-04-20 19:04:05 +02:00
|
|
|
|
|
2016-12-01 00:53:50 +01:00
|
|
|
|
/***** Write first row of data of this event *****/
|
2019-10-23 19:05:05 +02:00
|
|
|
|
HTM_TR_Begin (NULL);
|
2016-11-30 22:49:48 +01:00
|
|
|
|
|
2021-05-10 22:23:10 +02:00
|
|
|
|
/* Start/end date/time */
|
|
|
|
|
UniqueId++;
|
|
|
|
|
for (StartEndTime = (Dat_StartEndTime_t) 0;
|
|
|
|
|
StartEndTime <= (Dat_StartEndTime_t) (Dat_NUM_START_END_TIME - 1);
|
|
|
|
|
StartEndTime++)
|
|
|
|
|
{
|
|
|
|
|
if (asprintf (&Id,"agd_date_%u_%u",(unsigned) StartEndTime,UniqueId) < 0)
|
|
|
|
|
Err_NotEnoughMemoryExit ();
|
2022-04-07 13:04:45 +02:00
|
|
|
|
HTM_TD_Begin ("id=\"%s\" class=\"LB %s_%s %s\"",
|
2021-05-10 22:23:10 +02:00
|
|
|
|
Id,
|
|
|
|
|
AgdEvent.Hidden ? Dat_TimeStatusClassHidden[AgdEvent.TimeStatus] :
|
|
|
|
|
Dat_TimeStatusClassVisible[AgdEvent.TimeStatus],
|
2022-04-07 13:04:45 +02:00
|
|
|
|
The_GetSuffix (),
|
2022-03-19 02:05:53 +01:00
|
|
|
|
The_GetColorRows ());
|
2021-05-10 22:23:10 +02:00
|
|
|
|
Dat_WriteLocalDateHMSFromUTC (Id,AgdEvent.TimeUTC[StartEndTime],
|
|
|
|
|
Gbl.Prefs.DateFormat,Dat_SEPARATOR_BREAK,
|
|
|
|
|
true,true,true,0x6);
|
|
|
|
|
HTM_TD_End ();
|
|
|
|
|
free (Id);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Event */
|
2022-04-22 13:33:30 +02:00
|
|
|
|
HTM_TD_Begin ("class=\"LT %s\"",The_GetColorRows ());
|
2021-05-10 22:23:10 +02:00
|
|
|
|
HTM_ARTICLE_Begin (Anchor);
|
2022-04-22 13:33:30 +02:00
|
|
|
|
HTM_SPAN_Begin ("class=\"%s_%s\"",
|
|
|
|
|
AgdEvent.Hidden ? "ASG_TITLE_LIGHT" :
|
|
|
|
|
"ASG_TITLE",
|
|
|
|
|
The_GetSuffix ());
|
|
|
|
|
HTM_Txt (AgdEvent.Event);
|
|
|
|
|
HTM_SPAN_End ();
|
2021-05-10 22:23:10 +02:00
|
|
|
|
HTM_ARTICLE_End ();
|
2019-10-23 19:05:05 +02:00
|
|
|
|
HTM_TD_End ();
|
2016-11-30 22:49:48 +01:00
|
|
|
|
|
2021-05-10 22:23:10 +02:00
|
|
|
|
/* Location */
|
2022-03-19 02:05:53 +01:00
|
|
|
|
HTM_TD_Begin ("class=\"LT %s\"",The_GetColorRows ());
|
2022-04-22 13:33:30 +02:00
|
|
|
|
HTM_SPAN_Begin ("class=\"%s_%s\"",
|
|
|
|
|
AgdEvent.Hidden ? "ASG_TITLE_LIGHT" :
|
|
|
|
|
"ASG_TITLE",
|
|
|
|
|
The_GetSuffix ());
|
2021-05-10 22:23:10 +02:00
|
|
|
|
HTM_Txt (AgdEvent.Location);
|
2022-04-22 13:33:30 +02:00
|
|
|
|
HTM_SPAN_End ();
|
2021-05-10 22:23:10 +02:00
|
|
|
|
HTM_TD_End ();
|
2016-11-30 22:49:48 +01:00
|
|
|
|
|
2019-10-23 19:05:05 +02:00
|
|
|
|
HTM_TR_End ();
|
2019-09-27 00:30:05 +02:00
|
|
|
|
|
2016-12-01 00:53:50 +01:00
|
|
|
|
/***** Write second row of data of this event *****/
|
2019-10-23 19:05:05 +02:00
|
|
|
|
HTM_TR_Begin (NULL);
|
2016-11-30 22:49:48 +01:00
|
|
|
|
|
2022-03-19 02:05:53 +01:00
|
|
|
|
HTM_TD_Begin ("colspan=\"2\" class=\"LT %s\"",The_GetColorRows ());
|
2021-05-10 22:23:10 +02:00
|
|
|
|
switch (AgendaType)
|
|
|
|
|
{
|
|
|
|
|
case Agd_MY_AGENDA_TODAY:
|
|
|
|
|
case Agd_MY_AGENDA:
|
|
|
|
|
/* Forms to remove/edit this event */
|
|
|
|
|
Agd_PutFormsToRemEditOneEvent (Agenda,&AgdEvent,Anchor);
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
HTM_TD_End ();
|
2019-10-07 22:28:16 +02:00
|
|
|
|
|
2021-05-10 22:23:10 +02:00
|
|
|
|
/* Text of the event */
|
2022-03-19 02:05:53 +01:00
|
|
|
|
HTM_TD_Begin ("colspan=\"2\" class=\"LT %s\"",The_GetColorRows ());
|
2022-03-25 11:09:51 +01:00
|
|
|
|
HTM_DIV_Begin ("class=\"PAR %s_%s\"",
|
|
|
|
|
AgdEvent.Hidden ? "DAT_LIGHT" :
|
|
|
|
|
"DAT",
|
2022-04-05 01:00:24 +02:00
|
|
|
|
The_GetSuffix ());
|
2021-05-10 22:23:10 +02:00
|
|
|
|
Agd_DB_GetEventTxt (&AgdEvent,Txt);
|
|
|
|
|
Str_ChangeFormat (Str_FROM_HTML,Str_TO_RIGOROUS_HTML,
|
|
|
|
|
Txt,Cns_MAX_BYTES_TEXT,false); // Convert from HTML to recpectful HTML
|
2021-11-28 00:49:23 +01:00
|
|
|
|
ALn_InsertLinks (Txt,Cns_MAX_BYTES_TEXT,60); // Insert links
|
2021-05-10 22:23:10 +02:00
|
|
|
|
HTM_Txt (Txt);
|
|
|
|
|
HTM_DIV_End ();
|
|
|
|
|
HTM_TD_End ();
|
2019-10-07 22:28:16 +02:00
|
|
|
|
|
2019-10-23 19:05:05 +02:00
|
|
|
|
HTM_TR_End ();
|
2016-11-30 22:49:48 +01:00
|
|
|
|
|
2019-04-20 19:04:05 +02:00
|
|
|
|
/***** Free anchor string *****/
|
2019-04-20 21:11:44 +02:00
|
|
|
|
Frm_FreeAnchorStr (Anchor);
|
2019-04-20 19:04:05 +02:00
|
|
|
|
|
2022-03-24 01:18:19 +01:00
|
|
|
|
The_ChangeRowColor ();
|
2016-11-30 22:49:48 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
2016-12-01 00:53:50 +01:00
|
|
|
|
/******************* Put a link (form) to edit one event *********************/
|
2016-11-30 22:49:48 +01:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2020-04-12 14:42:32 +02:00
|
|
|
|
static void Agd_PutFormsToRemEditOneEvent (struct Agd_Agenda *Agenda,
|
|
|
|
|
struct Agd_Event *AgdEvent,
|
2019-04-20 19:04:05 +02:00
|
|
|
|
const char *Anchor)
|
2016-11-30 22:49:48 +01:00
|
|
|
|
{
|
2016-12-01 19:28:52 +01:00
|
|
|
|
extern const char *Txt_Event_private_click_to_make_it_visible_to_the_users_of_your_courses;
|
|
|
|
|
extern const char *Txt_Event_visible_to_the_users_of_your_courses_click_to_make_it_private;
|
2016-11-30 22:49:48 +01:00
|
|
|
|
|
2020-04-12 14:42:32 +02:00
|
|
|
|
Agenda->AgdCodToEdit = AgdEvent->AgdCod; // Used as parameter in contextual links
|
2016-11-30 22:49:48 +01:00
|
|
|
|
|
2016-12-01 00:53:50 +01:00
|
|
|
|
/***** Put form to remove event *****/
|
2020-10-13 22:34:31 +02:00
|
|
|
|
Ico_PutContextualIconToRemove (ActReqRemEvtMyAgd,NULL,
|
2020-04-12 14:42:32 +02:00
|
|
|
|
Agd_PutCurrentParamsMyAgenda,Agenda);
|
2016-11-30 22:49:48 +01:00
|
|
|
|
|
2016-12-03 19:22:06 +01:00
|
|
|
|
/***** Put form to hide/show event *****/
|
|
|
|
|
if (AgdEvent->Hidden)
|
2020-03-26 02:54:30 +01:00
|
|
|
|
Ico_PutContextualIconToUnhide (ActShoEvtMyAgd,Anchor,
|
2020-04-12 14:42:32 +02:00
|
|
|
|
Agd_PutCurrentParamsMyAgenda,Agenda);
|
2016-12-03 19:22:06 +01:00
|
|
|
|
else
|
2020-03-26 02:54:30 +01:00
|
|
|
|
Ico_PutContextualIconToHide (ActHidEvtMyAgd,Anchor,
|
2020-04-12 14:42:32 +02:00
|
|
|
|
Agd_PutCurrentParamsMyAgenda,Agenda);
|
2016-12-03 19:22:06 +01:00
|
|
|
|
|
2016-12-01 00:53:50 +01:00
|
|
|
|
/***** Put form to edit event *****/
|
2020-03-26 02:54:30 +01:00
|
|
|
|
Ico_PutContextualIconToEdit (ActEdiOneEvtMyAgd,NULL,
|
2020-04-12 14:42:32 +02:00
|
|
|
|
Agd_PutCurrentParamsMyAgenda,Agenda);
|
2016-11-30 22:49:48 +01:00
|
|
|
|
|
2016-12-03 19:22:06 +01:00
|
|
|
|
/***** Put form to make event public/private *****/
|
2016-12-06 19:50:32 +01:00
|
|
|
|
if (AgdEvent->Public)
|
2019-01-12 03:00:59 +01:00
|
|
|
|
Lay_PutContextualLinkOnlyIcon (ActPrvEvtMyAgd,NULL,
|
2020-04-12 14:42:32 +02:00
|
|
|
|
Agd_PutCurrentParamsMyAgenda,Agenda,
|
2021-12-22 00:20:06 +01:00
|
|
|
|
"unlock.svg",Ico_GREEN,
|
2019-01-12 03:00:59 +01:00
|
|
|
|
Txt_Event_visible_to_the_users_of_your_courses_click_to_make_it_private);
|
2016-12-06 19:50:32 +01:00
|
|
|
|
else
|
2019-01-12 03:00:59 +01:00
|
|
|
|
Lay_PutContextualLinkOnlyIcon (ActPubEvtMyAgd,NULL,
|
2020-04-12 14:42:32 +02:00
|
|
|
|
Agd_PutCurrentParamsMyAgenda,Agenda,
|
2021-12-22 00:20:06 +01:00
|
|
|
|
"lock.svg",Ico_RED,
|
2019-01-12 03:00:59 +01:00
|
|
|
|
Txt_Event_private_click_to_make_it_visible_to_the_users_of_your_courses);
|
2016-11-30 22:49:48 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
2017-04-13 20:09:22 +02:00
|
|
|
|
/****************** Parameters passed in my agenda forms *********************/
|
2016-11-30 22:49:48 +01:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2020-03-26 02:54:30 +01:00
|
|
|
|
static void Agd_PutCurrentParamsMyAgenda (void *Agenda)
|
2016-11-30 22:49:48 +01:00
|
|
|
|
{
|
2020-03-26 02:54:30 +01:00
|
|
|
|
if (Agenda)
|
|
|
|
|
Agd_PutParamsMyAgenda (((struct Agd_Agenda *) Agenda)->Past__FutureEvents,
|
|
|
|
|
((struct Agd_Agenda *) Agenda)->PrivatPublicEvents,
|
|
|
|
|
((struct Agd_Agenda *) Agenda)->HiddenVisiblEvents,
|
|
|
|
|
((struct Agd_Agenda *) Agenda)->SelectedOrder,
|
|
|
|
|
((struct Agd_Agenda *) Agenda)->CurrentPage,
|
|
|
|
|
((struct Agd_Agenda *) Agenda)->AgdCodToEdit);
|
2017-03-21 14:36:22 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* The following function is called
|
|
|
|
|
when one or more parameters must be passed explicitely.
|
|
|
|
|
Each parameter is passed only if its value is distinct to default. */
|
|
|
|
|
|
2017-04-13 20:09:22 +02:00
|
|
|
|
void Agd_PutParamsMyAgenda (unsigned Past__FutureEvents,
|
|
|
|
|
unsigned PrivatPublicEvents,
|
|
|
|
|
unsigned HiddenVisiblEvents,
|
2020-04-05 22:53:58 +02:00
|
|
|
|
Dat_StartEndTime_t Order,
|
2017-04-13 20:09:22 +02:00
|
|
|
|
unsigned NumPage,
|
|
|
|
|
long AgdCodToEdit)
|
2017-03-21 14:36:22 +01:00
|
|
|
|
{
|
|
|
|
|
if (Past__FutureEvents != (Agd_DEFAULT_PAST___EVENTS |
|
|
|
|
|
Agd_DEFAULT_FUTURE_EVENTS))
|
|
|
|
|
Agd_PutHiddenParamPast__FutureEvents (Past__FutureEvents);
|
|
|
|
|
|
|
|
|
|
if (PrivatPublicEvents != (Agd_DEFAULT_PRIVAT_EVENTS |
|
|
|
|
|
Agd_DEFAULT_PUBLIC_EVENTS))
|
|
|
|
|
Agd_PutHiddenParamPrivatPublicEvents (PrivatPublicEvents);
|
|
|
|
|
|
|
|
|
|
if (HiddenVisiblEvents != (Agd_DEFAULT_HIDDEN_EVENTS |
|
|
|
|
|
Agd_DEFAULT_VISIBL_EVENTS))
|
|
|
|
|
Agd_PutHiddenParamHiddenVisiblEvents (HiddenVisiblEvents);
|
|
|
|
|
|
2019-11-18 09:20:44 +01:00
|
|
|
|
if (Order != Agd_ORDER_DEFAULT)
|
2020-04-05 22:53:58 +02:00
|
|
|
|
Dat_PutHiddenParamOrder (Order);
|
2017-04-13 20:09:22 +02:00
|
|
|
|
|
|
|
|
|
if (NumPage > 1)
|
|
|
|
|
Pag_PutHiddenParamPagNum (Pag_MY_AGENDA,NumPage);
|
2017-03-21 14:36:22 +01:00
|
|
|
|
|
|
|
|
|
if (AgdCodToEdit > 0)
|
2019-11-03 13:19:32 +01:00
|
|
|
|
Par_PutHiddenParamLong (NULL,"AgdCod",AgdCodToEdit);
|
2017-03-21 14:36:22 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/********** Get parameter with the type or order in list of events ***********/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2020-04-12 14:42:32 +02:00
|
|
|
|
static void Agd_GetParams (struct Agd_Agenda *Agenda,
|
|
|
|
|
Agd_AgendaType_t AgendaType)
|
2017-03-21 14:36:22 +01:00
|
|
|
|
{
|
2019-11-21 11:39:30 +01:00
|
|
|
|
static const Pag_WhatPaginate_t WhatPaginate[Agd_NUM_AGENDA_TYPES] =
|
2017-03-21 14:36:22 +01:00
|
|
|
|
{
|
2019-11-20 17:53:51 +01:00
|
|
|
|
[Agd_MY_AGENDA_TODAY ] = Pag_MY_AGENDA, // not used
|
|
|
|
|
[Agd_MY_AGENDA ] = Pag_MY_AGENDA,
|
|
|
|
|
[Agd_ANOTHER_AGENDA_TODAY] = Pag_ANOTHER_AGENDA, // not used
|
|
|
|
|
[Agd_ANOTHER_AGENDA ] = Pag_ANOTHER_AGENDA,
|
2017-03-21 14:36:22 +01:00
|
|
|
|
};
|
|
|
|
|
|
2017-03-21 14:52:07 +01:00
|
|
|
|
if (AgendaType == Agd_MY_AGENDA)
|
2017-03-21 14:36:22 +01:00
|
|
|
|
{
|
2020-04-12 14:42:32 +02:00
|
|
|
|
Agenda->Past__FutureEvents = Agd_GetParamsPast__FutureEvents ();
|
|
|
|
|
Agenda->PrivatPublicEvents = Agd_GetParamsPrivatPublicEvents ();
|
|
|
|
|
Agenda->HiddenVisiblEvents = Agd_GetParamsHiddenVisiblEvents ();
|
2017-03-21 14:36:22 +01:00
|
|
|
|
}
|
2020-04-12 14:42:32 +02:00
|
|
|
|
Agd_GetParamEventOrder (Agenda);
|
|
|
|
|
Agenda->CurrentPage = Pag_GetParamPagNum (WhatPaginate[AgendaType]);
|
2017-03-21 14:36:22 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/****** Put a hidden parameter with the type of order in list of events ******/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2020-04-05 22:53:58 +02:00
|
|
|
|
void Agd_PutHiddenParamEventsOrder (Dat_StartEndTime_t SelectedOrder)
|
2017-03-21 14:36:22 +01:00
|
|
|
|
{
|
2020-04-12 14:42:32 +02:00
|
|
|
|
if (SelectedOrder != Agd_ORDER_DEFAULT)
|
2020-04-05 22:53:58 +02:00
|
|
|
|
Dat_PutHiddenParamOrder (SelectedOrder);
|
2017-03-21 14:36:22 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/********** Get parameter with the type or order in list of events ***********/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2020-04-12 14:42:32 +02:00
|
|
|
|
static void Agd_GetParamEventOrder (struct Agd_Agenda *Agenda)
|
2017-03-21 14:36:22 +01:00
|
|
|
|
{
|
|
|
|
|
static bool AlreadyGot = false;
|
|
|
|
|
|
|
|
|
|
if (!AlreadyGot)
|
|
|
|
|
{
|
2020-04-12 14:42:32 +02:00
|
|
|
|
Agenda->SelectedOrder = (Dat_StartEndTime_t)
|
|
|
|
|
Par_GetParToUnsignedLong ("Order",
|
|
|
|
|
0,
|
|
|
|
|
Dat_NUM_START_END_TIME - 1,
|
|
|
|
|
(unsigned long) Agd_ORDER_DEFAULT);
|
2017-03-21 14:36:22 +01:00
|
|
|
|
AlreadyGot = true;
|
|
|
|
|
}
|
2016-11-30 22:49:48 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
2016-12-02 00:24:16 +01:00
|
|
|
|
/************************* Get list of agenda events *************************/
|
2016-11-30 22:49:48 +01:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2017-03-22 01:14:48 +01:00
|
|
|
|
#define Agd_MAX_BYTES_SUBQUERY 128
|
|
|
|
|
|
2020-04-12 14:42:32 +02:00
|
|
|
|
static void Agd_GetListEvents (struct Agd_Agenda *Agenda,
|
|
|
|
|
Agd_AgendaType_t AgendaType)
|
2016-11-30 22:49:48 +01:00
|
|
|
|
{
|
|
|
|
|
MYSQL_RES *mysql_res;
|
2016-12-02 00:24:16 +01:00
|
|
|
|
unsigned NumEvent;
|
2016-11-30 22:49:48 +01:00
|
|
|
|
|
2017-03-22 01:14:48 +01:00
|
|
|
|
/***** Initialize list of events *****/
|
2020-04-12 14:42:32 +02:00
|
|
|
|
Agd_FreeListEvents (Agenda);
|
2016-11-30 22:49:48 +01:00
|
|
|
|
|
2021-05-10 22:23:10 +02:00
|
|
|
|
/***** Trivial check: anything to get from database? *****/
|
2016-12-02 00:24:16 +01:00
|
|
|
|
switch (AgendaType)
|
|
|
|
|
{
|
2017-03-21 14:52:07 +01:00
|
|
|
|
case Agd_MY_AGENDA_TODAY:
|
|
|
|
|
case Agd_MY_AGENDA:
|
2020-04-12 14:42:32 +02:00
|
|
|
|
if (Agenda->Past__FutureEvents == 0 ||
|
|
|
|
|
Agenda->PrivatPublicEvents == 0 ||
|
|
|
|
|
Agenda->HiddenVisiblEvents == 0) // All selectors are off
|
2017-03-21 16:45:26 +01:00
|
|
|
|
{
|
2021-05-10 22:23:10 +02:00
|
|
|
|
// Nothing to get from database
|
|
|
|
|
Agenda->LstIsRead = true;
|
|
|
|
|
return;
|
2017-03-21 16:45:26 +01:00
|
|
|
|
}
|
2016-12-06 21:26:02 +01:00
|
|
|
|
break;
|
2021-05-10 22:23:10 +02:00
|
|
|
|
default:
|
|
|
|
|
break;
|
2016-12-02 00:24:16 +01:00
|
|
|
|
}
|
2016-11-30 22:49:48 +01:00
|
|
|
|
|
2021-05-10 22:23:10 +02:00
|
|
|
|
/***** Get list of events from database *****/
|
|
|
|
|
if ((Agenda->Num = Agd_DB_GetListEvents (&mysql_res,Agenda,AgendaType))) // Events found...
|
2016-11-30 22:49:48 +01:00
|
|
|
|
{
|
2021-05-10 22:23:10 +02:00
|
|
|
|
/***** Create list of events *****/
|
|
|
|
|
if ((Agenda->LstAgdCods = calloc ((size_t) Agenda->Num,
|
|
|
|
|
sizeof (*Agenda->LstAgdCods))) == NULL)
|
|
|
|
|
Err_NotEnoughMemoryExit ();
|
2017-03-22 01:14:48 +01:00
|
|
|
|
|
2021-05-10 22:23:10 +02:00
|
|
|
|
/***** Get the events codes *****/
|
|
|
|
|
for (NumEvent = 0;
|
|
|
|
|
NumEvent < Agenda->Num;
|
|
|
|
|
NumEvent++)
|
|
|
|
|
/* Get next event code */
|
|
|
|
|
if ((Agenda->LstAgdCods[NumEvent] = DB_GetNextCode (mysql_res)) < 0)
|
|
|
|
|
Err_WrongEventExit ();
|
2016-11-30 22:49:48 +01:00
|
|
|
|
}
|
|
|
|
|
|
2021-05-10 22:23:10 +02:00
|
|
|
|
/***** Free structure that stores the query result *****/
|
|
|
|
|
DB_FreeMySQLResult (&mysql_res);
|
|
|
|
|
|
2020-04-12 14:42:32 +02:00
|
|
|
|
Agenda->LstIsRead = true;
|
2016-11-30 22:49:48 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
2016-12-01 00:53:50 +01:00
|
|
|
|
/*********************** Get event data using its code ***********************/
|
2016-11-30 22:49:48 +01:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2020-04-08 03:06:45 +02:00
|
|
|
|
static void Agd_GetDataOfEventByCod (struct Agd_Event *AgdEvent)
|
2016-11-30 22:49:48 +01:00
|
|
|
|
{
|
2016-12-09 00:44:15 +01:00
|
|
|
|
MYSQL_RES *mysql_res;
|
|
|
|
|
MYSQL_ROW row;
|
2016-11-30 22:49:48 +01:00
|
|
|
|
|
2016-12-01 00:53:50 +01:00
|
|
|
|
/***** Get data of event from database *****/
|
2021-05-10 22:23:10 +02:00
|
|
|
|
if (Agd_DB_GetDataOfEventByCod (&mysql_res,AgdEvent)) // Event found...
|
2016-11-30 22:49:48 +01:00
|
|
|
|
{
|
2016-12-02 10:45:53 +01:00
|
|
|
|
/* Get row:
|
|
|
|
|
row[0] AgdCod
|
2016-12-09 00:44:15 +01:00
|
|
|
|
row[1] Public
|
|
|
|
|
row[2] Hidden
|
|
|
|
|
row[3] UNIX_TIMESTAMP(StartTime)
|
|
|
|
|
row[4] UNIX_TIMESTAMP(EndTime)
|
|
|
|
|
row[5] NOW()>EndTime // Past event?
|
|
|
|
|
row[6] NOW()<StartTime // Future event?
|
|
|
|
|
row[7] Event
|
|
|
|
|
row[8] Location
|
2016-12-02 10:45:53 +01:00
|
|
|
|
*/
|
2016-11-30 22:49:48 +01:00
|
|
|
|
row = mysql_fetch_row (mysql_res);
|
|
|
|
|
|
2016-12-01 00:53:50 +01:00
|
|
|
|
/* Get code of the event (row[0]) */
|
|
|
|
|
AgdEvent->AgdCod = Str_ConvertStrCodToLongCod (row[0]);
|
2016-11-30 22:49:48 +01:00
|
|
|
|
|
2021-02-15 22:49:44 +01:00
|
|
|
|
/* Get whether the event is public or not (row[1])
|
|
|
|
|
and whether it is hidden or not (row[2]) */
|
2016-12-09 00:44:15 +01:00
|
|
|
|
AgdEvent->Public = (row[1][0] == 'Y');
|
|
|
|
|
AgdEvent->Hidden = (row[2][0] == 'Y');
|
2016-11-30 22:49:48 +01:00
|
|
|
|
|
2021-02-15 22:49:44 +01:00
|
|
|
|
/* Get start date (row[3]) and end date (row[4]) in UTC time */
|
2021-09-18 18:22:26 +02:00
|
|
|
|
AgdEvent->TimeUTC[Dat_STR_TIME] = Dat_GetUNIXTimeFromStr (row[3]);
|
|
|
|
|
AgdEvent->TimeUTC[Dat_END_TIME] = Dat_GetUNIXTimeFromStr (row[4]);
|
2016-11-30 22:49:48 +01:00
|
|
|
|
|
2016-12-09 00:44:15 +01:00
|
|
|
|
/* Get whether the event is past, present or future (row(5), row[6]) */
|
|
|
|
|
AgdEvent->TimeStatus = ((row[5][0] == '1') ? Dat_PAST :
|
|
|
|
|
((row[6][0] == '1') ? Dat_FUTURE :
|
2016-12-03 19:22:06 +01:00
|
|
|
|
Dat_PRESENT));
|
2016-12-02 10:45:53 +01:00
|
|
|
|
|
2021-02-15 22:49:44 +01:00
|
|
|
|
/* Get the event (row[7]) and its location (row[8]) */
|
2021-02-15 16:25:55 +01:00
|
|
|
|
Str_Copy (AgdEvent->Event ,row[7],sizeof (AgdEvent->Event ) - 1);
|
|
|
|
|
Str_Copy (AgdEvent->Location,row[8],sizeof (AgdEvent->Location) - 1);
|
2016-12-09 00:44:15 +01:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
/***** Clear all event data *****/
|
2021-09-18 18:22:26 +02:00
|
|
|
|
AgdEvent->AgdCod = -1L;
|
|
|
|
|
AgdEvent->Public = false;
|
|
|
|
|
AgdEvent->Hidden = false;
|
|
|
|
|
AgdEvent->TimeUTC[Dat_STR_TIME] =
|
|
|
|
|
AgdEvent->TimeUTC[Dat_END_TIME] = (time_t) 0;
|
|
|
|
|
AgdEvent->TimeStatus = Dat_FUTURE;
|
|
|
|
|
AgdEvent->Event[0] = '\0';
|
|
|
|
|
AgdEvent->Location[0] = '\0';
|
2016-11-30 22:49:48 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/***** Free structure that stores the query result *****/
|
|
|
|
|
DB_FreeMySQLResult (&mysql_res);
|
|
|
|
|
}
|
|
|
|
|
|
2016-07-07 00:21:10 +02:00
|
|
|
|
/*****************************************************************************/
|
2016-12-01 00:53:50 +01:00
|
|
|
|
/*************************** Free list of events *****************************/
|
2016-11-30 22:49:48 +01:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2020-04-12 14:42:32 +02:00
|
|
|
|
static void Agd_FreeListEvents (struct Agd_Agenda *Agenda)
|
2016-11-30 22:49:48 +01:00
|
|
|
|
{
|
2020-04-12 14:42:32 +02:00
|
|
|
|
if (Agenda->LstIsRead && Agenda->LstAgdCods)
|
2016-11-30 22:49:48 +01:00
|
|
|
|
{
|
2016-12-01 00:53:50 +01:00
|
|
|
|
/***** Free memory used by the list of events *****/
|
2020-04-12 14:42:32 +02:00
|
|
|
|
free (Agenda->LstAgdCods);
|
|
|
|
|
Agenda->LstAgdCods = NULL;
|
|
|
|
|
Agenda->Num = 0;
|
|
|
|
|
Agenda->LstIsRead = false;
|
2016-11-30 22:49:48 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
2016-12-01 00:53:50 +01:00
|
|
|
|
/******************** Get parameter with code of event ***********************/
|
2016-11-30 22:49:48 +01:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2016-12-01 00:53:50 +01:00
|
|
|
|
long Agd_GetParamAgdCod (void)
|
2016-11-30 22:49:48 +01:00
|
|
|
|
{
|
2017-01-28 20:32:50 +01:00
|
|
|
|
/***** Get code of event *****/
|
|
|
|
|
return Par_GetParToLong ("AgdCod");
|
2016-11-30 22:49:48 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
2016-12-01 00:53:50 +01:00
|
|
|
|
/************** Ask for confirmation of removing of an event *****************/
|
2016-11-30 22:49:48 +01:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2016-12-01 00:53:50 +01:00
|
|
|
|
void Agd_AskRemEvent (void)
|
2016-11-30 22:49:48 +01:00
|
|
|
|
{
|
2016-12-01 00:53:50 +01:00
|
|
|
|
extern const char *Txt_Do_you_really_want_to_remove_the_event_X;
|
|
|
|
|
extern const char *Txt_Remove_event;
|
2020-04-12 14:42:32 +02:00
|
|
|
|
struct Agd_Agenda Agenda;
|
2020-04-08 03:06:45 +02:00
|
|
|
|
struct Agd_Event AgdEvent;
|
2016-11-30 22:49:48 +01:00
|
|
|
|
|
2020-04-12 14:42:32 +02:00
|
|
|
|
/***** Reset agenda context *****/
|
|
|
|
|
Agd_ResetAgenda (&Agenda);
|
|
|
|
|
|
2016-11-30 22:49:48 +01:00
|
|
|
|
/***** Get parameters *****/
|
2020-04-12 14:42:32 +02:00
|
|
|
|
Agd_GetParams (&Agenda,Agd_MY_AGENDA);
|
2016-11-30 22:49:48 +01:00
|
|
|
|
|
2016-12-01 00:53:50 +01:00
|
|
|
|
/***** Get event code *****/
|
2021-04-24 17:02:25 +02:00
|
|
|
|
if ((AgdEvent.AgdCod = Agd_GetParamAgdCod ()) < 0)
|
2021-04-26 15:27:27 +02:00
|
|
|
|
Err_WrongEventExit ();
|
2016-11-30 22:49:48 +01:00
|
|
|
|
|
2016-12-01 00:53:50 +01:00
|
|
|
|
/***** Get data of the event from database *****/
|
2016-12-02 00:24:16 +01:00
|
|
|
|
AgdEvent.UsrCod = Gbl.Usrs.Me.UsrDat.UsrCod;
|
2016-12-01 00:53:50 +01:00
|
|
|
|
Agd_GetDataOfEventByCod (&AgdEvent);
|
2016-11-30 22:49:48 +01:00
|
|
|
|
|
2017-04-28 10:44:28 +02:00
|
|
|
|
/***** Show question and button to remove event *****/
|
2020-04-12 14:42:32 +02:00
|
|
|
|
Agenda.AgdCodToEdit = AgdEvent.AgdCod;
|
2019-02-17 01:14:55 +01:00
|
|
|
|
Ale_ShowAlertAndButton (ActRemEvtMyAgd,NULL,NULL,
|
2020-04-12 14:42:32 +02:00
|
|
|
|
Agd_PutCurrentParamsMyAgenda,&Agenda,
|
2019-02-17 01:14:55 +01:00
|
|
|
|
Btn_REMOVE_BUTTON,Txt_Remove_event,
|
|
|
|
|
Ale_QUESTION,Txt_Do_you_really_want_to_remove_the_event_X,
|
|
|
|
|
AgdEvent.Event);
|
2016-11-30 22:49:48 +01:00
|
|
|
|
|
2016-12-01 00:53:50 +01:00
|
|
|
|
/***** Show events again *****/
|
2020-04-12 14:42:32 +02:00
|
|
|
|
Agd_ShowMyAgenda (&Agenda);
|
2016-11-30 22:49:48 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
2016-12-01 00:53:50 +01:00
|
|
|
|
/****************************** Remove an event ******************************/
|
2016-11-30 22:49:48 +01:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2016-12-01 00:53:50 +01:00
|
|
|
|
void Agd_RemoveEvent (void)
|
2016-11-30 22:49:48 +01:00
|
|
|
|
{
|
2016-12-01 01:39:06 +01:00
|
|
|
|
extern const char *Txt_Event_X_removed;
|
2020-04-12 14:42:32 +02:00
|
|
|
|
struct Agd_Agenda Agenda;
|
2020-04-08 03:06:45 +02:00
|
|
|
|
struct Agd_Event AgdEvent;
|
2016-11-30 22:49:48 +01:00
|
|
|
|
|
2020-04-12 14:42:32 +02:00
|
|
|
|
/***** Reset agenda context *****/
|
|
|
|
|
Agd_ResetAgenda (&Agenda);
|
|
|
|
|
|
|
|
|
|
/***** Get parameters *****/
|
|
|
|
|
Agd_GetParams (&Agenda,Agd_MY_AGENDA);
|
|
|
|
|
|
2016-12-01 00:53:50 +01:00
|
|
|
|
/***** Get event code *****/
|
2021-04-24 17:02:25 +02:00
|
|
|
|
if ((AgdEvent.AgdCod = Agd_GetParamAgdCod ()) < 0)
|
2021-04-26 15:27:27 +02:00
|
|
|
|
Err_WrongEventExit ();
|
2016-11-30 22:49:48 +01:00
|
|
|
|
|
2016-12-01 00:53:50 +01:00
|
|
|
|
/***** Get data of the event from database *****/
|
2016-12-02 00:24:16 +01:00
|
|
|
|
AgdEvent.UsrCod = Gbl.Usrs.Me.UsrDat.UsrCod;
|
2016-12-09 00:44:15 +01:00
|
|
|
|
Agd_GetDataOfEventByCod (&AgdEvent);
|
2016-11-30 22:49:48 +01:00
|
|
|
|
|
2016-12-01 00:53:50 +01:00
|
|
|
|
/***** Remove event *****/
|
2021-05-10 22:23:10 +02:00
|
|
|
|
Agd_DB_RemoveEvent (&AgdEvent);
|
2016-11-30 22:49:48 +01:00
|
|
|
|
|
|
|
|
|
/***** Write message to show the change made *****/
|
2019-02-16 14:37:34 +01:00
|
|
|
|
Ale_ShowAlert (Ale_SUCCESS,Txt_Event_X_removed,
|
2019-02-15 23:38:44 +01:00
|
|
|
|
AgdEvent.Event);
|
2016-11-30 22:49:48 +01:00
|
|
|
|
|
2016-12-01 00:53:50 +01:00
|
|
|
|
/***** Show events again *****/
|
2020-04-12 14:42:32 +02:00
|
|
|
|
Agd_ShowMyAgenda (&Agenda);
|
2016-11-30 22:49:48 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
2016-12-03 19:22:06 +01:00
|
|
|
|
/********************************* Hide event ********************************/
|
2016-11-30 22:49:48 +01:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2016-12-03 19:22:06 +01:00
|
|
|
|
void Agd_HideEvent (void)
|
2016-11-30 22:49:48 +01:00
|
|
|
|
{
|
2020-04-12 14:42:32 +02:00
|
|
|
|
struct Agd_Agenda Agenda;
|
2020-04-08 03:06:45 +02:00
|
|
|
|
struct Agd_Event AgdEvent;
|
2016-11-30 22:49:48 +01:00
|
|
|
|
|
2020-04-12 14:42:32 +02:00
|
|
|
|
/***** Reset agenda context *****/
|
|
|
|
|
Agd_ResetAgenda (&Agenda);
|
|
|
|
|
|
|
|
|
|
/***** Get parameters *****/
|
|
|
|
|
Agd_GetParams (&Agenda,Agd_MY_AGENDA);
|
|
|
|
|
|
2016-12-01 00:53:50 +01:00
|
|
|
|
/***** Get event code *****/
|
2021-04-24 17:02:25 +02:00
|
|
|
|
if ((AgdEvent.AgdCod = Agd_GetParamAgdCod ()) < 0)
|
2021-04-26 15:27:27 +02:00
|
|
|
|
Err_WrongEventExit ();
|
2016-11-30 22:49:48 +01:00
|
|
|
|
|
2016-12-01 00:53:50 +01:00
|
|
|
|
/***** Get data of the event from database *****/
|
2016-12-02 00:24:16 +01:00
|
|
|
|
AgdEvent.UsrCod = Gbl.Usrs.Me.UsrDat.UsrCod;
|
2016-12-01 00:53:50 +01:00
|
|
|
|
Agd_GetDataOfEventByCod (&AgdEvent);
|
2016-11-30 22:49:48 +01:00
|
|
|
|
|
2021-10-24 16:55:47 +02:00
|
|
|
|
/***** Hide event *****/
|
|
|
|
|
Agd_DB_HideOrUnhideEvent (AgdEvent.AgdCod,AgdEvent.UsrCod,true);
|
2016-12-03 19:22:06 +01:00
|
|
|
|
|
|
|
|
|
/***** Show events again *****/
|
2020-04-12 14:42:32 +02:00
|
|
|
|
Agd_ShowMyAgenda (&Agenda);
|
2016-12-03 19:22:06 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
2016-12-06 19:14:58 +01:00
|
|
|
|
/****************************** Unhide event *********************************/
|
2016-12-03 19:22:06 +01:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2016-12-06 19:14:58 +01:00
|
|
|
|
void Agd_UnhideEvent (void)
|
2016-12-03 19:22:06 +01:00
|
|
|
|
{
|
2020-04-12 14:42:32 +02:00
|
|
|
|
struct Agd_Agenda Agenda;
|
2020-04-08 03:06:45 +02:00
|
|
|
|
struct Agd_Event AgdEvent;
|
2016-12-03 19:22:06 +01:00
|
|
|
|
|
2020-04-12 14:42:32 +02:00
|
|
|
|
/***** Reset agenda context *****/
|
|
|
|
|
Agd_ResetAgenda (&Agenda);
|
|
|
|
|
|
|
|
|
|
/***** Get parameters *****/
|
|
|
|
|
Agd_GetParams (&Agenda,Agd_MY_AGENDA);
|
|
|
|
|
|
2016-12-03 19:22:06 +01:00
|
|
|
|
/***** Get event code *****/
|
2021-04-24 17:02:25 +02:00
|
|
|
|
if ((AgdEvent.AgdCod = Agd_GetParamAgdCod ()) < 0)
|
2021-04-26 15:27:27 +02:00
|
|
|
|
Err_WrongEventExit ();
|
2016-12-03 19:22:06 +01:00
|
|
|
|
|
|
|
|
|
/***** Get data of the event from database *****/
|
|
|
|
|
AgdEvent.UsrCod = Gbl.Usrs.Me.UsrDat.UsrCod;
|
|
|
|
|
Agd_GetDataOfEventByCod (&AgdEvent);
|
|
|
|
|
|
2021-10-24 16:55:47 +02:00
|
|
|
|
/***** Unhide event *****/
|
|
|
|
|
Agd_DB_HideOrUnhideEvent (AgdEvent.AgdCod,AgdEvent.UsrCod,false);
|
2016-12-03 19:22:06 +01:00
|
|
|
|
|
|
|
|
|
/***** Show events again *****/
|
2020-04-12 14:42:32 +02:00
|
|
|
|
Agd_ShowMyAgenda (&Agenda);
|
2016-12-03 19:22:06 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/****************************** Make event private ***************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
void Agd_MakeEventPrivate (void)
|
|
|
|
|
{
|
|
|
|
|
extern const char *Txt_Event_X_is_now_private;
|
2020-04-12 14:42:32 +02:00
|
|
|
|
struct Agd_Agenda Agenda;
|
2020-04-08 03:06:45 +02:00
|
|
|
|
struct Agd_Event AgdEvent;
|
2016-12-03 19:22:06 +01:00
|
|
|
|
|
2020-04-12 14:42:32 +02:00
|
|
|
|
/***** Reset agenda context *****/
|
|
|
|
|
Agd_ResetAgenda (&Agenda);
|
|
|
|
|
|
|
|
|
|
/***** Get parameters *****/
|
|
|
|
|
Agd_GetParams (&Agenda,Agd_MY_AGENDA);
|
|
|
|
|
|
2016-12-03 19:22:06 +01:00
|
|
|
|
/***** Get event code *****/
|
2021-04-24 17:02:25 +02:00
|
|
|
|
if ((AgdEvent.AgdCod = Agd_GetParamAgdCod ()) < 0)
|
2021-04-26 15:27:27 +02:00
|
|
|
|
Err_WrongEventExit ();
|
2016-12-03 19:22:06 +01:00
|
|
|
|
|
|
|
|
|
/***** Get data of the event from database *****/
|
|
|
|
|
AgdEvent.UsrCod = Gbl.Usrs.Me.UsrDat.UsrCod;
|
|
|
|
|
Agd_GetDataOfEventByCod (&AgdEvent);
|
|
|
|
|
|
|
|
|
|
/***** Make event private *****/
|
2021-05-10 22:23:10 +02:00
|
|
|
|
Agd_DB_MakeEventPrivate (&AgdEvent);
|
2016-11-30 22:49:48 +01:00
|
|
|
|
|
|
|
|
|
/***** Write message to show the change made *****/
|
2019-02-16 14:37:34 +01:00
|
|
|
|
Ale_ShowAlert (Ale_SUCCESS,Txt_Event_X_is_now_private,
|
2019-02-15 23:38:44 +01:00
|
|
|
|
AgdEvent.Event);
|
2016-11-30 22:49:48 +01:00
|
|
|
|
|
2016-12-01 00:53:50 +01:00
|
|
|
|
/***** Show events again *****/
|
2020-04-12 14:42:32 +02:00
|
|
|
|
Agd_ShowMyAgenda (&Agenda);
|
2016-11-30 22:49:48 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
2016-12-03 19:22:06 +01:00
|
|
|
|
/******** Make event public (make it visible to users of my courses) *********/
|
2016-11-30 22:49:48 +01:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2016-12-03 19:22:06 +01:00
|
|
|
|
void Agd_MakeEventPublic (void)
|
2016-11-30 22:49:48 +01:00
|
|
|
|
{
|
2016-12-01 19:28:52 +01:00
|
|
|
|
extern const char *Txt_Event_X_is_now_visible_to_users_of_your_courses;
|
2020-04-12 14:42:32 +02:00
|
|
|
|
struct Agd_Agenda Agenda;
|
2020-04-08 03:06:45 +02:00
|
|
|
|
struct Agd_Event AgdEvent;
|
2016-11-30 22:49:48 +01:00
|
|
|
|
|
2020-04-12 14:42:32 +02:00
|
|
|
|
/***** Reset agenda context *****/
|
|
|
|
|
Agd_ResetAgenda (&Agenda);
|
|
|
|
|
|
|
|
|
|
/***** Get parameters *****/
|
|
|
|
|
Agd_GetParams (&Agenda,Agd_MY_AGENDA);
|
|
|
|
|
|
2016-12-01 00:53:50 +01:00
|
|
|
|
/***** Get event code *****/
|
2021-04-24 17:02:25 +02:00
|
|
|
|
if ((AgdEvent.AgdCod = Agd_GetParamAgdCod ()) < 0)
|
2021-04-26 15:27:27 +02:00
|
|
|
|
Err_WrongEventExit ();
|
2016-11-30 22:49:48 +01:00
|
|
|
|
|
2016-12-01 00:53:50 +01:00
|
|
|
|
/***** Get data of the event from database *****/
|
2016-12-02 00:24:16 +01:00
|
|
|
|
AgdEvent.UsrCod = Gbl.Usrs.Me.UsrDat.UsrCod;
|
2016-12-01 00:53:50 +01:00
|
|
|
|
Agd_GetDataOfEventByCod (&AgdEvent);
|
2016-11-30 22:49:48 +01:00
|
|
|
|
|
2016-12-03 19:22:06 +01:00
|
|
|
|
/***** Make event public *****/
|
2021-05-10 22:23:10 +02:00
|
|
|
|
Agd_DB_MakeEventPublic (&AgdEvent);
|
2016-11-30 22:49:48 +01:00
|
|
|
|
|
|
|
|
|
/***** Write message to show the change made *****/
|
2019-02-16 14:37:34 +01:00
|
|
|
|
Ale_ShowAlert (Ale_SUCCESS,Txt_Event_X_is_now_visible_to_users_of_your_courses,
|
2019-02-15 23:38:44 +01:00
|
|
|
|
AgdEvent.Event);
|
2016-11-30 22:49:48 +01:00
|
|
|
|
|
2016-12-01 00:53:50 +01:00
|
|
|
|
/***** Show events again *****/
|
2020-04-12 14:42:32 +02:00
|
|
|
|
Agd_ShowMyAgenda (&Agenda);
|
2016-11-30 22:49:48 +01:00
|
|
|
|
}
|
|
|
|
|
|
2016-07-07 00:21:10 +02:00
|
|
|
|
/*****************************************************************************/
|
2016-12-01 00:53:50 +01:00
|
|
|
|
/******************** Put a form to create a new event ***********************/
|
2016-07-07 00:21:10 +02:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2016-12-01 00:53:50 +01:00
|
|
|
|
void Agd_RequestCreatOrEditEvent (void)
|
2016-07-07 00:21:10 +02:00
|
|
|
|
{
|
2016-12-01 00:53:50 +01:00
|
|
|
|
extern const char *Hlp_PROFILE_Agenda_new_event;
|
|
|
|
|
extern const char *Hlp_PROFILE_Agenda_edit_event;
|
2016-11-30 22:49:48 +01:00
|
|
|
|
extern const char *Txt_New_event;
|
2016-12-01 00:53:50 +01:00
|
|
|
|
extern const char *Txt_Edit_event;
|
2016-11-30 22:49:48 +01:00
|
|
|
|
extern const char *Txt_Location;
|
|
|
|
|
extern const char *Txt_Event;
|
|
|
|
|
extern const char *Txt_Description;
|
|
|
|
|
extern const char *Txt_Create_event;
|
2019-02-18 18:27:45 +01:00
|
|
|
|
extern const char *Txt_Save_changes;
|
2020-04-12 14:42:32 +02:00
|
|
|
|
struct Agd_Agenda Agenda;
|
2020-04-08 03:06:45 +02:00
|
|
|
|
struct Agd_Event AgdEvent;
|
2016-12-01 00:53:50 +01:00
|
|
|
|
bool ItsANewEvent;
|
2017-01-17 03:10:43 +01:00
|
|
|
|
char Txt[Cns_MAX_BYTES_TEXT + 1];
|
2020-02-26 19:35:33 +01:00
|
|
|
|
static const Dat_SetHMS SetHMS[Dat_NUM_START_END_TIME] =
|
|
|
|
|
{
|
2021-09-18 18:22:26 +02:00
|
|
|
|
[Dat_STR_TIME] = Dat_HMS_DO_NOT_SET,
|
|
|
|
|
[Dat_END_TIME] = Dat_HMS_DO_NOT_SET
|
2020-02-26 19:35:33 +01:00
|
|
|
|
};
|
2016-11-30 22:49:48 +01:00
|
|
|
|
|
2020-04-12 14:42:32 +02:00
|
|
|
|
/***** Reset agenda context *****/
|
|
|
|
|
Agd_ResetAgenda (&Agenda);
|
|
|
|
|
|
2016-11-30 22:49:48 +01:00
|
|
|
|
/***** Get parameters *****/
|
2020-04-12 14:42:32 +02:00
|
|
|
|
Agd_GetParams (&Agenda,Agd_MY_AGENDA);
|
2016-11-30 22:49:48 +01:00
|
|
|
|
|
2016-12-01 00:53:50 +01:00
|
|
|
|
/***** Get the code of the event *****/
|
2021-04-25 20:36:48 +02:00
|
|
|
|
ItsANewEvent = ((AgdEvent.AgdCod = Agd_GetParamAgdCod ()) <= 0);
|
2016-11-30 22:49:48 +01:00
|
|
|
|
|
2016-12-01 00:53:50 +01:00
|
|
|
|
/***** Get from the database the data of the event *****/
|
2016-12-09 00:44:15 +01:00
|
|
|
|
AgdEvent.UsrCod = Gbl.Usrs.Me.UsrDat.UsrCod;
|
2016-12-01 00:53:50 +01:00
|
|
|
|
if (ItsANewEvent)
|
2016-11-30 22:49:48 +01:00
|
|
|
|
{
|
2016-12-01 00:53:50 +01:00
|
|
|
|
/* Initialize to empty event */
|
|
|
|
|
AgdEvent.AgdCod = -1L;
|
2021-09-18 18:22:26 +02:00
|
|
|
|
AgdEvent.TimeUTC[Dat_STR_TIME] = Gbl.StartExecutionTimeUTC;
|
|
|
|
|
AgdEvent.TimeUTC[Dat_END_TIME] = Gbl.StartExecutionTimeUTC + (2 * 60 * 60); // +2 hours
|
2016-12-02 10:45:53 +01:00
|
|
|
|
AgdEvent.TimeStatus = Dat_FUTURE;
|
2016-12-01 00:53:50 +01:00
|
|
|
|
AgdEvent.Event[0] = '\0';
|
|
|
|
|
AgdEvent.Location[0] = '\0';
|
2016-11-30 22:49:48 +01:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2016-12-01 00:53:50 +01:00
|
|
|
|
/* Get data of the event from database */
|
|
|
|
|
Agd_GetDataOfEventByCod (&AgdEvent);
|
2016-11-30 22:49:48 +01:00
|
|
|
|
|
2016-12-01 00:53:50 +01:00
|
|
|
|
/* Get text of the event from database */
|
2021-05-10 22:23:10 +02:00
|
|
|
|
Agd_DB_GetEventTxt (&AgdEvent,Txt);
|
2016-11-30 22:49:48 +01:00
|
|
|
|
}
|
|
|
|
|
|
2019-10-20 22:00:28 +02:00
|
|
|
|
/***** Begin form *****/
|
2016-12-01 00:53:50 +01:00
|
|
|
|
if (ItsANewEvent)
|
2017-03-21 14:36:22 +01:00
|
|
|
|
{
|
2021-03-02 00:54:26 +01:00
|
|
|
|
Frm_BeginForm (ActNewEvtMyAgd);
|
2020-04-12 14:42:32 +02:00
|
|
|
|
Agenda.AgdCodToEdit = -1L;
|
2017-03-21 14:36:22 +01:00
|
|
|
|
}
|
2016-11-30 22:49:48 +01:00
|
|
|
|
else
|
|
|
|
|
{
|
2021-03-02 00:54:26 +01:00
|
|
|
|
Frm_BeginForm (ActChgEvtMyAgd);
|
2020-04-12 14:42:32 +02:00
|
|
|
|
Agenda.AgdCodToEdit = AgdEvent.AgdCod;
|
2016-11-30 22:49:48 +01:00
|
|
|
|
}
|
2020-04-12 14:42:32 +02:00
|
|
|
|
Agd_PutCurrentParamsMyAgenda (&Agenda);
|
2016-11-30 22:49:48 +01:00
|
|
|
|
|
2021-05-10 22:23:10 +02:00
|
|
|
|
/***** Begin box and table *****/
|
|
|
|
|
if (ItsANewEvent)
|
|
|
|
|
Box_BoxTableBegin (NULL,Txt_New_event,
|
|
|
|
|
NULL,NULL,
|
|
|
|
|
Hlp_PROFILE_Agenda_new_event,Box_NOT_CLOSABLE,2);
|
|
|
|
|
else
|
|
|
|
|
Box_BoxTableBegin (NULL,Txt_Edit_event,
|
|
|
|
|
NULL,NULL,
|
|
|
|
|
Hlp_PROFILE_Agenda_edit_event,Box_NOT_CLOSABLE,2);
|
|
|
|
|
|
|
|
|
|
/***** Event *****/
|
|
|
|
|
/* Begin table row */
|
|
|
|
|
HTM_TR_Begin (NULL);
|
|
|
|
|
|
|
|
|
|
/* Label */
|
|
|
|
|
Frm_LabelColumn ("RT","Event",Txt_Event);
|
|
|
|
|
|
|
|
|
|
/* Data */
|
|
|
|
|
HTM_TD_Begin ("class=\"LT\"");
|
|
|
|
|
HTM_INPUT_TEXT ("Event",Agd_MAX_CHARS_EVENT,AgdEvent.Event,
|
|
|
|
|
HTM_DONT_SUBMIT_ON_CHANGE,
|
2022-03-30 00:46:18 +02:00
|
|
|
|
"id=\"Event\" class=\"TITLE_DESCRIPTION_WIDTH INPUT_%s\""
|
2021-12-17 00:17:35 +01:00
|
|
|
|
" required=\"required\"",
|
2022-04-05 01:00:24 +02:00
|
|
|
|
The_GetSuffix ());
|
2021-05-10 22:23:10 +02:00
|
|
|
|
HTM_TD_End ();
|
|
|
|
|
|
|
|
|
|
/* End table row */
|
|
|
|
|
HTM_TR_End ();
|
|
|
|
|
|
|
|
|
|
/***** Location *****/
|
|
|
|
|
/* Begin table row */
|
|
|
|
|
HTM_TR_Begin (NULL);
|
|
|
|
|
|
|
|
|
|
/* Label */
|
|
|
|
|
Frm_LabelColumn ("RT","Location",Txt_Location);
|
|
|
|
|
|
|
|
|
|
/* Data */
|
|
|
|
|
HTM_TD_Begin ("class=\"LT\"");
|
|
|
|
|
HTM_INPUT_TEXT ("Location",Agd_MAX_CHARS_LOCATION,AgdEvent.Location,
|
|
|
|
|
HTM_DONT_SUBMIT_ON_CHANGE,
|
2022-03-30 00:46:18 +02:00
|
|
|
|
"id=\"Location\" class=\"TITLE_DESCRIPTION_WIDTH INPUT_%s\""
|
2021-12-17 00:17:35 +01:00
|
|
|
|
" required=\"required\"",
|
2022-04-05 01:00:24 +02:00
|
|
|
|
The_GetSuffix ());
|
2021-05-10 22:23:10 +02:00
|
|
|
|
HTM_TD_End ();
|
|
|
|
|
|
|
|
|
|
/* End table row */
|
|
|
|
|
HTM_TR_End ();
|
|
|
|
|
|
|
|
|
|
/***** Start and end dates *****/
|
|
|
|
|
Dat_PutFormStartEndClientLocalDateTimes (AgdEvent.TimeUTC,
|
|
|
|
|
Dat_FORM_SECONDS_OFF,
|
|
|
|
|
SetHMS);
|
|
|
|
|
|
|
|
|
|
/***** Text *****/
|
|
|
|
|
/* Begin table row */
|
|
|
|
|
HTM_TR_Begin (NULL);
|
|
|
|
|
|
|
|
|
|
/* Label */
|
|
|
|
|
Frm_LabelColumn ("RT","Txt",Txt_Description);
|
|
|
|
|
|
|
|
|
|
/* Data */
|
|
|
|
|
HTM_TD_Begin ("class=\"LT\"");
|
|
|
|
|
HTM_TEXTAREA_Begin ("id=\"Txt\" name=\"Txt\" rows=\"5\""
|
2022-03-30 00:46:18 +02:00
|
|
|
|
" class=\"TITLE_DESCRIPTION_WIDTH INPUT_%s\"",
|
2022-04-05 01:00:24 +02:00
|
|
|
|
The_GetSuffix ());
|
2021-05-11 11:08:21 +02:00
|
|
|
|
if (!ItsANewEvent)
|
|
|
|
|
HTM_Txt (Txt);
|
2021-05-10 22:23:10 +02:00
|
|
|
|
HTM_TEXTAREA_End ();
|
|
|
|
|
HTM_TD_End ();
|
|
|
|
|
|
|
|
|
|
/* End table row */
|
|
|
|
|
HTM_TR_End ();
|
|
|
|
|
|
|
|
|
|
/***** End table, send button and end box *****/
|
|
|
|
|
if (ItsANewEvent)
|
|
|
|
|
Box_BoxTableWithButtonEnd (Btn_CREATE_BUTTON,Txt_Create_event);
|
|
|
|
|
else
|
|
|
|
|
Box_BoxTableWithButtonEnd (Btn_CONFIRM_BUTTON,Txt_Save_changes);
|
2017-06-12 14:16:33 +02:00
|
|
|
|
|
|
|
|
|
/***** End form *****/
|
2018-11-09 20:47:39 +01:00
|
|
|
|
Frm_EndForm ();
|
2016-11-30 22:49:48 +01:00
|
|
|
|
|
2016-12-01 00:53:50 +01:00
|
|
|
|
/***** Show current events, if any *****/
|
2020-04-12 14:42:32 +02:00
|
|
|
|
Agd_ShowMyAgenda (&Agenda);
|
2016-11-30 22:49:48 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
2016-12-01 00:53:50 +01:00
|
|
|
|
/********************* Receive form to create a new event ********************/
|
2016-11-30 22:49:48 +01:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2020-05-05 21:49:00 +02:00
|
|
|
|
void Agd_ReceiveFormEvent (void)
|
2016-11-30 22:49:48 +01:00
|
|
|
|
{
|
2016-12-01 00:53:50 +01:00
|
|
|
|
extern const char *Txt_Created_new_event_X;
|
2016-11-30 22:49:48 +01:00
|
|
|
|
extern const char *Txt_The_event_has_been_modified;
|
2020-04-12 14:42:32 +02:00
|
|
|
|
struct Agd_Agenda Agenda;
|
2020-04-08 03:06:45 +02:00
|
|
|
|
struct Agd_Event AgdEvent;
|
2016-12-01 00:53:50 +01:00
|
|
|
|
bool ItsANewEvent;
|
|
|
|
|
bool NewEventIsCorrect = true;
|
2019-02-15 21:09:18 +01:00
|
|
|
|
char EventTxt[Cns_MAX_BYTES_TEXT + 1];
|
2016-11-30 22:49:48 +01:00
|
|
|
|
|
2020-04-12 14:42:32 +02:00
|
|
|
|
/***** Reset agenda context *****/
|
|
|
|
|
Agd_ResetAgenda (&Agenda);
|
|
|
|
|
|
|
|
|
|
/***** Get parameters *****/
|
|
|
|
|
Agd_GetParams (&Agenda,Agd_MY_AGENDA);
|
|
|
|
|
|
2016-12-09 18:22:25 +01:00
|
|
|
|
/***** Set author of the event *****/
|
|
|
|
|
AgdEvent.UsrCod = Gbl.Usrs.Me.UsrDat.UsrCod;
|
|
|
|
|
|
2016-12-01 00:53:50 +01:00
|
|
|
|
/***** Get the code of the event *****/
|
2021-04-25 20:36:48 +02:00
|
|
|
|
ItsANewEvent = ((AgdEvent.AgdCod = Agd_GetParamAgdCod ()) <= 0);
|
2016-11-30 22:49:48 +01:00
|
|
|
|
|
|
|
|
|
/***** Get start/end date-times *****/
|
2021-09-18 18:22:26 +02:00
|
|
|
|
AgdEvent.TimeUTC[Dat_STR_TIME] = Dat_GetTimeUTCFromForm ("StartTimeUTC");
|
|
|
|
|
AgdEvent.TimeUTC[Dat_END_TIME] = Dat_GetTimeUTCFromForm ("EndTimeUTC" );
|
2016-11-30 22:49:48 +01:00
|
|
|
|
|
2020-04-28 13:12:18 +02:00
|
|
|
|
/***** Get event location *****/
|
2017-03-07 01:56:41 +01:00
|
|
|
|
Par_GetParToText ("Location",AgdEvent.Location,Agd_MAX_BYTES_LOCATION);
|
2016-11-30 22:49:48 +01:00
|
|
|
|
|
2020-04-28 13:12:18 +02:00
|
|
|
|
/***** Get event title *****/
|
2017-03-07 01:56:41 +01:00
|
|
|
|
Par_GetParToText ("Event",AgdEvent.Event,Agd_MAX_BYTES_EVENT);
|
2016-11-30 22:49:48 +01:00
|
|
|
|
|
2020-04-28 13:12:18 +02:00
|
|
|
|
/***** Get event description *****/
|
2019-02-15 21:09:18 +01:00
|
|
|
|
Par_GetParToHTML ("Txt",EventTxt,Cns_MAX_BYTES_TEXT); // Store in HTML format (not rigorous)
|
2016-11-30 22:49:48 +01:00
|
|
|
|
|
|
|
|
|
/***** Adjust dates *****/
|
2021-09-18 18:22:26 +02:00
|
|
|
|
if (AgdEvent.TimeUTC[Dat_STR_TIME] == 0)
|
|
|
|
|
AgdEvent.TimeUTC[Dat_STR_TIME] = Gbl.StartExecutionTimeUTC;
|
2020-04-28 13:12:18 +02:00
|
|
|
|
if (AgdEvent.TimeUTC[Dat_END_TIME] == 0)
|
2021-09-18 18:22:26 +02:00
|
|
|
|
AgdEvent.TimeUTC[Dat_END_TIME] = AgdEvent.TimeUTC[Dat_STR_TIME] + 2 * 60 * 60; // +2 hours
|
2016-11-30 22:49:48 +01:00
|
|
|
|
|
2016-12-01 00:53:50 +01:00
|
|
|
|
/***** Check if event is correct *****/
|
2016-12-09 00:44:15 +01:00
|
|
|
|
if (!AgdEvent.Location[0]) // If there is no event
|
2016-11-30 22:49:48 +01:00
|
|
|
|
{
|
2016-12-01 00:53:50 +01:00
|
|
|
|
NewEventIsCorrect = false;
|
2022-06-18 19:50:40 +02:00
|
|
|
|
Ale_ShowAlertYouMustSpecifyTheTitle ();
|
2016-11-30 22:49:48 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/***** Check if event is correct *****/
|
2017-03-22 01:39:43 +01:00
|
|
|
|
if (!AgdEvent.Event[0]) // If there is no event
|
2016-11-30 22:49:48 +01:00
|
|
|
|
{
|
2016-12-01 00:53:50 +01:00
|
|
|
|
NewEventIsCorrect = false;
|
2022-06-18 19:50:40 +02:00
|
|
|
|
Ale_ShowAlertYouMustSpecifyTheTitle ();
|
2016-11-30 22:49:48 +01:00
|
|
|
|
}
|
|
|
|
|
|
2016-12-01 00:53:50 +01:00
|
|
|
|
/***** Create a new event or update an existing one *****/
|
|
|
|
|
if (NewEventIsCorrect)
|
2016-11-30 22:49:48 +01:00
|
|
|
|
{
|
2016-12-01 00:53:50 +01:00
|
|
|
|
if (ItsANewEvent)
|
2016-11-30 22:49:48 +01:00
|
|
|
|
{
|
2021-05-10 22:23:10 +02:00
|
|
|
|
AgdEvent.AgdCod = Agd_DB_CreateEvent (&AgdEvent,EventTxt); // Add new event to database
|
2016-11-30 22:49:48 +01:00
|
|
|
|
|
|
|
|
|
/***** Write success message *****/
|
2019-02-16 14:37:34 +01:00
|
|
|
|
Ale_ShowAlert (Ale_SUCCESS,Txt_Created_new_event_X,
|
2019-02-15 23:38:44 +01:00
|
|
|
|
AgdEvent.Event);
|
2016-11-30 22:49:48 +01:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2021-05-10 22:23:10 +02:00
|
|
|
|
Agd_DB_UpdateEvent (&AgdEvent,EventTxt);
|
2016-11-30 22:49:48 +01:00
|
|
|
|
|
|
|
|
|
/***** Write success message *****/
|
2019-02-16 14:37:34 +01:00
|
|
|
|
Ale_ShowAlert (Ale_SUCCESS,Txt_The_event_has_been_modified);
|
2016-11-30 22:49:48 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Free memory for list of selected groups */
|
|
|
|
|
Grp_FreeListCodSelectedGrps ();
|
|
|
|
|
|
2016-12-01 00:53:50 +01:00
|
|
|
|
/***** Show events again *****/
|
2020-04-12 14:42:32 +02:00
|
|
|
|
Agd_ShowMyAgenda (&Agenda);
|
2016-11-30 22:49:48 +01:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
// TODO: The form should be filled with partial data, now is always empty
|
2016-12-01 00:53:50 +01:00
|
|
|
|
Agd_RequestCreatOrEditEvent ();
|
2016-11-30 22:49:48 +01:00
|
|
|
|
}
|
|
|
|
|
|
2016-12-07 00:41:36 +01:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/************************** Show an agenda QR code ***************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
void Agd_PrintAgdQRCode (void)
|
|
|
|
|
{
|
|
|
|
|
extern const char *Txt_Where_s_USER;
|
2021-12-29 21:31:49 +01:00
|
|
|
|
char *Title;
|
2016-12-07 00:41:36 +01:00
|
|
|
|
|
2019-10-26 02:19:42 +02:00
|
|
|
|
/***** Begin box *****/
|
2021-12-29 21:31:49 +01:00
|
|
|
|
if (asprintf (&Title,Txt_Where_s_USER,Gbl.Usrs.Me.UsrDat.FullName) < 0)
|
|
|
|
|
Err_NotEnoughMemoryExit ();
|
|
|
|
|
Box_BoxBegin (NULL,Title,NULL,NULL,NULL,Box_NOT_CLOSABLE);
|
|
|
|
|
free (Title);
|
2016-12-07 00:41:36 +01:00
|
|
|
|
|
2021-05-10 22:23:10 +02:00
|
|
|
|
/***** Print QR code ****/
|
|
|
|
|
QR_PrintQRCode ();
|
2016-12-07 00:41:36 +01:00
|
|
|
|
|
2017-06-12 14:16:33 +02:00
|
|
|
|
/***** End box *****/
|
2019-10-25 22:48:34 +02:00
|
|
|
|
Box_BoxEnd ();
|
2016-12-07 00:41:36 +01:00
|
|
|
|
}
|
2022-01-03 02:47:16 +01:00
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/********* Get and show number of users who have chosen a language ***********/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
void Agd_GetAndShowAgendasStats (void)
|
|
|
|
|
{
|
|
|
|
|
extern const char *Hlp_ANALYTICS_Figures_agendas;
|
|
|
|
|
extern const char *Txt_FIGURE_TYPES[Fig_NUM_FIGURES];
|
|
|
|
|
extern const char *Txt_Number_of_events;
|
|
|
|
|
extern const char *Txt_Number_of_users;
|
|
|
|
|
extern const char *Txt_PERCENT_of_users;
|
|
|
|
|
extern const char *Txt_Number_of_events_per_user;
|
|
|
|
|
unsigned NumEvents;
|
|
|
|
|
unsigned NumUsrs;
|
|
|
|
|
unsigned NumUsrsTotal;
|
|
|
|
|
|
|
|
|
|
/***** Begin box and table *****/
|
|
|
|
|
Box_BoxTableBegin (NULL,Txt_FIGURE_TYPES[Fig_AGENDAS],
|
|
|
|
|
NULL,NULL,
|
|
|
|
|
Hlp_ANALYTICS_Figures_agendas,Box_NOT_CLOSABLE,2);
|
|
|
|
|
|
|
|
|
|
/***** Heading row *****/
|
|
|
|
|
HTM_TR_Begin (NULL);
|
|
|
|
|
HTM_TH (Txt_Number_of_events ,HTM_HEAD_RIGHT);
|
|
|
|
|
HTM_TH (Txt_Number_of_users ,HTM_HEAD_RIGHT);
|
|
|
|
|
HTM_TH (Txt_PERCENT_of_users ,HTM_HEAD_RIGHT);
|
|
|
|
|
HTM_TH (Txt_Number_of_events_per_user,HTM_HEAD_RIGHT);
|
|
|
|
|
HTM_TR_End ();
|
|
|
|
|
|
|
|
|
|
/***** Number of agenda events *****/
|
|
|
|
|
NumEvents = Agd_DB_GetNumEvents (Gbl.Scope.Current);
|
|
|
|
|
|
|
|
|
|
/***** Number of users with agenda events *****/
|
|
|
|
|
NumUsrs = Agd_DB_GetNumUsrsWithEvents (Gbl.Scope.Current);
|
|
|
|
|
|
|
|
|
|
/***** Get total number of users in current scope *****/
|
|
|
|
|
NumUsrsTotal = Usr_GetTotalNumberOfUsers ();
|
|
|
|
|
|
|
|
|
|
/***** Write number of users who have chosen each language *****/
|
|
|
|
|
HTM_TR_Begin (NULL);
|
|
|
|
|
|
2022-04-05 01:00:24 +02:00
|
|
|
|
HTM_TD_Begin ("class=\"RM DAT_%s\"",The_GetSuffix ());
|
2022-01-03 02:47:16 +01:00
|
|
|
|
HTM_Unsigned (NumEvents);
|
|
|
|
|
HTM_TD_End ();
|
|
|
|
|
|
2022-04-05 01:00:24 +02:00
|
|
|
|
HTM_TD_Begin ("class=\"RM DAT_%s\"",The_GetSuffix ());
|
2022-01-03 02:47:16 +01:00
|
|
|
|
HTM_Unsigned (NumUsrs);
|
|
|
|
|
HTM_TD_End ();
|
|
|
|
|
|
2022-04-05 01:00:24 +02:00
|
|
|
|
HTM_TD_Begin ("class=\"RM DAT_%s\"",The_GetSuffix ());
|
2022-01-03 02:47:16 +01:00
|
|
|
|
HTM_Percentage (NumUsrsTotal ? (double) NumUsrs * 100.0 /
|
|
|
|
|
(double) NumUsrsTotal :
|
|
|
|
|
0);
|
|
|
|
|
HTM_TD_End ();
|
|
|
|
|
|
2022-04-05 01:00:24 +02:00
|
|
|
|
HTM_TD_Begin ("class=\"RM DAT_%s\"",The_GetSuffix ());
|
2022-01-03 02:47:16 +01:00
|
|
|
|
HTM_Double2Decimals (NumUsrs ? (double) NumEvents /
|
|
|
|
|
(double) NumUsrs :
|
|
|
|
|
0);
|
|
|
|
|
HTM_TD_End ();
|
|
|
|
|
|
|
|
|
|
HTM_TR_End ();
|
|
|
|
|
|
|
|
|
|
/***** End table and box *****/
|
|
|
|
|
Box_BoxTableEnd ();
|
|
|
|
|
}
|