mirror of https://github.com/acanas/swad-core.git
Version 16.85
This commit is contained in:
parent
a531bb9268
commit
1c8aea677a
|
@ -74,6 +74,8 @@ static void Agd_ShowEvents (Agd_AgendaType_t AgendaType);
|
|||
static void Agd_PutIconToCreateNewEvent (void);
|
||||
static void Agd_PutButtonToCreateNewEvent (void);
|
||||
static void Agd_PutParamsToCreateNewEvent (void);
|
||||
static void Agd_ShowSelectorWhichEvents (void);
|
||||
static void Agd_GetParamWhichEvents (void);
|
||||
static void Agd_ShowOneEvent (Agd_AgendaType_t AgendaType,long AgdCod);
|
||||
static void Agd_WriteEventAuthor (struct AgendaEvent *AgdEvent);
|
||||
static void Agd_GetParamEventOrderType (void);
|
||||
|
@ -111,6 +113,10 @@ void Agd_ShowUsrAgenda (void)
|
|||
|
||||
void Agd_ShowMyAgenda (void)
|
||||
{
|
||||
/***** Get whether to show all events or only my events ******/
|
||||
if (Gbl.Usrs.Me.AvailableRoles & (1 << Rol_TEACHER)) // I am a teacher in some courses
|
||||
Agd_GetParamWhichEvents ();
|
||||
|
||||
/***** Show all my events *****/
|
||||
Agd_ShowEvents (Agd_MY_AGENDA);
|
||||
}
|
||||
|
@ -155,19 +161,26 @@ static void Agd_ShowEvents (Agd_AgendaType_t AgendaType)
|
|||
if (Pagination.MoreThanOnePage)
|
||||
Pag_WriteLinksToPagesCentered (WhatPaginate[AgendaType],0,&Pagination);
|
||||
|
||||
/***** Start frame *****/
|
||||
switch (AgendaType)
|
||||
{
|
||||
case Agd_USR_AGENDA:
|
||||
/***** Start frame *****/
|
||||
sprintf (Gbl.Title,Txt_Agenda_USER,Gbl.Usrs.Other.UsrDat.FullName); // TODO: Need translation!!!!!
|
||||
Lay_StartRoundFrame ("100%",Gbl.Title,
|
||||
NULL,
|
||||
Hlp_PROFILE_Agenda); // TODO: Change
|
||||
break;
|
||||
case Agd_MY_AGENDA:
|
||||
/***** Start frame *****/
|
||||
Lay_StartRoundFrame ("100%",Txt_My_agenda,
|
||||
Agd_PutIconToCreateNewEvent,
|
||||
Hlp_PROFILE_Agenda);
|
||||
|
||||
/***** Put form to choice whether to show
|
||||
all events or only public events *****/
|
||||
Act_FormStart (ActSeeMyAgd);
|
||||
Agd_ShowSelectorWhichEvents ();
|
||||
Act_FormEnd ();
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -279,6 +292,57 @@ static void Agd_PutParamsToCreateNewEvent (void)
|
|||
Pag_PutHiddenParamPagNum (Gbl.Pag.CurrentPage);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/** Show selector to choice whether to show all events or only public events */
|
||||
/*****************************************************************************/
|
||||
|
||||
static void Agd_ShowSelectorWhichEvents (void)
|
||||
{
|
||||
extern const char *Txt_Show_WHICH_events[2];
|
||||
Agd_WhichEvents_t WhichEvents;
|
||||
|
||||
fprintf (Gbl.F.Out,"<div style=\"margin:12px 0;\">"
|
||||
"<ul class=\"LIST_CENTER\">");
|
||||
for (WhichEvents = Agd_ALL_EVENTS;
|
||||
WhichEvents <= Agd_ONLY_PUBLIC_EVENTS;
|
||||
WhichEvents++)
|
||||
{
|
||||
fprintf (Gbl.F.Out,"<li class=\"DAT LEFT_MIDDLE\""
|
||||
" style=\"display:inline;\">"
|
||||
"<input type=\"radio\" name=\"WhichEvents\" value=\"%u\"",
|
||||
(unsigned) WhichEvents);
|
||||
if (WhichEvents == Gbl.Agenda.WhichEvents)
|
||||
fprintf (Gbl.F.Out," checked=\"checked\"");
|
||||
fprintf (Gbl.F.Out," onclick=\"document.getElementById('%s').submit();\" />"
|
||||
" %s"
|
||||
"</li>",
|
||||
Gbl.Form.Id,Txt_Show_WHICH_events[WhichEvents]);
|
||||
}
|
||||
fprintf (Gbl.F.Out,"</ul>"
|
||||
"</div>");
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/************* Get whether to show all events or only my events **************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void Agd_GetParamWhichEvents (void)
|
||||
{
|
||||
char UnsignedStr[10+1];
|
||||
unsigned UnsignedNum;
|
||||
|
||||
/***** Get which events (all events or my events) *****/
|
||||
Par_GetParToText ("WhichEvents",UnsignedStr,1);
|
||||
if (UnsignedStr[0])
|
||||
{
|
||||
if (sscanf (UnsignedStr,"%u",&UnsignedNum) != 1)
|
||||
Lay_ShowErrorAndExit ("Which events to show is missing.");
|
||||
if (UnsignedNum >= 2)
|
||||
Lay_ShowErrorAndExit ("Wrong parameter with which events to show.");
|
||||
Gbl.Agenda.WhichEvents = (Agd_WhichEvents_t) UnsignedNum;
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/******************************* Show one event ******************************/
|
||||
/*****************************************************************************/
|
||||
|
@ -560,19 +624,28 @@ static void Agd_GetListEvents (Agd_AgendaType_t AgendaType)
|
|||
switch (AgendaType)
|
||||
{
|
||||
case Agd_USR_AGENDA:
|
||||
sprintf (Query,"SELECT AgdCod"
|
||||
" FROM agendas"
|
||||
sprintf (Query,"SELECT AgdCod FROM agendas"
|
||||
" WHERE UsrCod='%ld' AND Public='Y' AND Hidden='N'"
|
||||
" AND EndTime>NOW()" // Only present and future events
|
||||
" ORDER BY %s",
|
||||
Gbl.Usrs.Other.UsrDat.UsrCod,OrderBySubQuery);
|
||||
break;
|
||||
case Agd_MY_AGENDA:
|
||||
sprintf (Query,"SELECT AgdCod"
|
||||
" FROM agendas"
|
||||
" WHERE UsrCod='%ld'"
|
||||
" ORDER BY %s",
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod,OrderBySubQuery);
|
||||
switch (Gbl.Agenda.WhichEvents)
|
||||
{
|
||||
case Agd_ALL_EVENTS:
|
||||
sprintf (Query,"SELECT AgdCod FROM agendas"
|
||||
" WHERE UsrCod='%ld'"
|
||||
" ORDER BY %s",
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod,OrderBySubQuery);
|
||||
break;
|
||||
case Agd_ONLY_PUBLIC_EVENTS:
|
||||
sprintf (Query,"SELECT AgdCod FROM agendas"
|
||||
" WHERE UsrCod='%ld' AND Public='Y'"
|
||||
" ORDER BY %s",
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod,OrderBySubQuery);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
NumRows = DB_QuerySELECT (Query,&mysql_res,"can not get agenda events");
|
||||
|
|
|
@ -56,6 +56,12 @@ struct AgendaEvent
|
|||
char Location[Agd_MAX_LENGTH_LOCATION+1];
|
||||
};
|
||||
|
||||
typedef enum
|
||||
{
|
||||
Agd_ALL_EVENTS,
|
||||
Agd_ONLY_PUBLIC_EVENTS,
|
||||
} Agd_WhichEvents_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
Agd_ORDER_BY_START_DATE = 0,
|
||||
|
|
|
@ -179,19 +179,18 @@
|
|||
// TODO: When teacher sees "No hay estudiantes", put a button to add students
|
||||
// TODO: When admin sees "No hay profesores", put a button to add teachers
|
||||
|
||||
// TODO: Sólo horas y minutos en la agenda
|
||||
|
||||
/*****************************************************************************/
|
||||
/****************************** Public constants *****************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
#define Log_PLATFORM_VERSION "SWAD 16.84.2 (2016-12-03)"
|
||||
#define Log_PLATFORM_VERSION "SWAD 16.85 (2016-12-03)"
|
||||
#define CSS_FILE "swad16.82.2.css"
|
||||
#define JS_FILE "swad16.84.2.js"
|
||||
|
||||
// Number of lines (includes comments but not blank lines) has been got with the following command:
|
||||
// nl swad*.c swad*.h css/swad*.css py/swad*.py js/swad*.js soap/swad*?.h sql/swad*.sql | tail -1
|
||||
/*
|
||||
Version 16.85: Dec 03, 2016 Form to choice between all events / only public events in agenda. (209721 lines)
|
||||
Version 16.84.2: Dec 03, 2016 Only hours and minutes (seconds = 0) in agenda events. (209606 lines)
|
||||
Version 16.84.1: Dec 03, 2016 Remove user's agenda when removing user's account. (? lines)
|
||||
Version 16.84: Dec 03, 2016 Agenda events can be hidden. (209580 lines)
|
||||
|
|
|
@ -418,6 +418,9 @@ void Gbl_InitializeGlobals (void)
|
|||
Gbl.FileBrowser.FileType = Brw_IS_UNKNOWN;
|
||||
Gbl.FileBrowser.UploadingWithDropzone = false;
|
||||
|
||||
/* Agenda */
|
||||
Gbl.Agenda.WhichEvents = Agd_ALL_EVENTS;
|
||||
|
||||
/* To alternate colors where listing rows */
|
||||
Gbl.RowEvenOdd = 0;
|
||||
Gbl.ColorRows[0] = "COLOR0"; // Darker
|
||||
|
|
|
@ -412,6 +412,7 @@ struct Globals
|
|||
long *LstAgdCods; // List of agenda codes
|
||||
Agd_Order_t SelectedOrderType;
|
||||
long AgdCodToEdit; // Used as parameter in contextual links
|
||||
Agd_WhichEvents_t WhichEvents; // All events / only public events
|
||||
} Agenda;
|
||||
struct
|
||||
{
|
||||
|
|
|
@ -4222,7 +4222,7 @@ void Grp_ShowSelectorWhichGrps (void)
|
|||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/***** Get whether to show only my groups or all groups or in timetable ******/
|
||||
/************* Get whether to show only my groups or all groups **************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Grp_GetParamWhichGrps (void)
|
||||
|
@ -4235,14 +4235,14 @@ void Grp_GetParamWhichGrps (void)
|
|||
{
|
||||
FirstTime = false;
|
||||
|
||||
/***** Get groups type (my groups or all groups) *****/
|
||||
/***** Get which grous (my groups or all groups) *****/
|
||||
Par_GetParToText ("WhichGrps",UnsignedStr,1);
|
||||
if (UnsignedStr[0])
|
||||
{
|
||||
if (sscanf (UnsignedStr,"%u",&UnsignedNum) != 1)
|
||||
Lay_ShowErrorAndExit ("Types of groups to show is missing.");
|
||||
Lay_ShowErrorAndExit ("Which groups to show is missing.");
|
||||
if (UnsignedNum >= 2)
|
||||
Lay_ShowErrorAndExit ("Wrong types of groups to show.");
|
||||
Lay_ShowErrorAndExit ("Wrong parameter with which groups to show.");
|
||||
Gbl.CurrentCrs.Grps.WhichGrps = (Grp_WhichGroups_t) UnsignedNum;
|
||||
}
|
||||
else // This parameter does not exist ==> set default value
|
||||
|
|
43
swad_text.c
43
swad_text.c
|
@ -36851,6 +36851,49 @@ const char *Txt_Show_list =
|
|||
"Mostrar lista";
|
||||
#endif
|
||||
|
||||
const char *Txt_Show_WHICH_events[2] =
|
||||
{
|
||||
#if L==1
|
||||
"Tots els esdeveniments"
|
||||
#elif L==2
|
||||
"Alle Ereignisse"
|
||||
#elif L==3
|
||||
"All events"
|
||||
#elif L==4
|
||||
"Todos los eventos"
|
||||
#elif L==5
|
||||
"Tous les événements"
|
||||
#elif L==6
|
||||
"Todos los eventos" // Okoteve traducción
|
||||
#elif L==7
|
||||
"Tutti i eventi"
|
||||
#elif L==8
|
||||
"Wszystkie imprezy"
|
||||
#elif L==9
|
||||
"Todos os eventos"
|
||||
#endif
|
||||
,
|
||||
#if L==1
|
||||
"Només els esdeveniments públics"
|
||||
#elif L==2
|
||||
"Nur öffentliche Ereignisse"
|
||||
#elif L==3
|
||||
"Only public events"
|
||||
#elif L==4
|
||||
"Solo eventos públicos"
|
||||
#elif L==5
|
||||
"Uniquement les événements publics"
|
||||
#elif L==6
|
||||
"Solo eventos públicos" // Okoteve traducción
|
||||
#elif L==7
|
||||
"Solo eventi pubblici"
|
||||
#elif L==8
|
||||
"Tylko wydarzenia publiczne"
|
||||
#elif L==9
|
||||
"Apenas eventos públicos"
|
||||
#endif
|
||||
};
|
||||
|
||||
const char *Txt_Show_WHICH_groups[2] =
|
||||
{
|
||||
#if L==1
|
||||
|
|
Loading…
Reference in New Issue