mirror of
https://github.com/acanas/swad-core.git
synced 2024-06-16 13:44:06 +02:00
Version 16.82.2
This commit is contained in:
parent
b58dac1a7b
commit
f01d61f578
|
@ -1815,10 +1815,13 @@ a:hover img.CENTRE_PHOTO_SHOW
|
|||
.ASG_TITLE_LIGHT {color:#AFC4CC; font-size:15pt; font-weight:bold;}
|
||||
.ASG_GRP {color:#4D88A1; font-size:12pt;}
|
||||
.ASG_GRP_LIGHT {color:#AFC4CC; font-size:12pt;}
|
||||
.DATE_GREEN {color:#008000; font-size:13pt;}
|
||||
.DATE_GREEN_LIGHT {color:#89BE87; font-size:13pt;}
|
||||
|
||||
.DATE_RED {color:red; font-size:13pt;}
|
||||
.DATE_RED_LIGHT {color:#F98A8A; font-size:13pt;}
|
||||
.DATE_GREEN {color:#008000; font-size:13pt;}
|
||||
.DATE_GREEN_LIGHT {color:#89BE87; font-size:13pt;}
|
||||
.DATE_BLUE {color:#4D88A1; font-size:13pt;}
|
||||
.DATE_BLUE_LIGHT {color:#AFC4CC; font-size:13pt;}
|
||||
|
||||
.ASG_LST_DATE_GREEN {color:#008000; font-size:11pt; white-space:nowrap;}
|
||||
.ASG_LST_DATE_RED {color:red; font-size:11pt; white-space:nowrap;}
|
105
swad_agenda.c
105
swad_agenda.c
|
@ -129,7 +129,7 @@ static void Agd_ShowEvents (Agd_AgendaType_t AgendaType)
|
|||
extern const char *Txt_Event;
|
||||
extern const char *Txt_Location;
|
||||
extern const char *Txt_No_events;
|
||||
Loc_Order_t Order;
|
||||
Agd_Order_t Order;
|
||||
struct Pagination Pagination;
|
||||
unsigned NumEvent;
|
||||
Pag_WhatPaginate_t WhatPaginate[Agd_NUM_AGENDA_TYPES] =
|
||||
|
@ -176,8 +176,8 @@ static void Agd_ShowEvents (Agd_AgendaType_t AgendaType)
|
|||
/***** Table head *****/
|
||||
fprintf (Gbl.F.Out,"<table class=\"FRAME_TBL_MARGIN CELLS_PAD_2\">"
|
||||
"<tr>");
|
||||
for (Order = Loc_ORDER_BY_START_DATE;
|
||||
Order <= Loc_ORDER_BY_END_DATE;
|
||||
for (Order = Agd_ORDER_BY_START_DATE;
|
||||
Order <= Agd_ORDER_BY_END_DATE;
|
||||
Order++)
|
||||
{
|
||||
fprintf (Gbl.F.Out,"<th class=\"LEFT_MIDDLE\">");
|
||||
|
@ -285,6 +285,8 @@ static void Agd_PutParamsToCreateNewEvent (void)
|
|||
|
||||
static void Agd_ShowOneEvent (Agd_AgendaType_t AgendaType,long AgdCod)
|
||||
{
|
||||
extern const char *Dat_TimeStatusClassVisible[Dat_NUM_TIME_STATUS];
|
||||
extern const char *Dat_TimeStatusClassHidden[Dat_NUM_TIME_STATUS];
|
||||
extern const char *Txt_Today;
|
||||
static unsigned UniqueId = 0;
|
||||
struct AgendaEvent AgdEvent;
|
||||
|
@ -313,12 +315,10 @@ static void Agd_ShowOneEvent (Agd_AgendaType_t AgendaType,long AgdCod)
|
|||
"</script>"
|
||||
"</td>",
|
||||
UniqueId,
|
||||
AgdEvent.Hidden ? (AgdEvent.Open ? "DATE_GREEN_LIGHT" :
|
||||
"DATE_RED_LIGHT") :
|
||||
(AgdEvent.Open ? "DATE_GREEN" :
|
||||
"DATE_RED"),
|
||||
AgdEvent.Hidden ? Dat_TimeStatusClassHidden[AgdEvent.TimeStatus] :
|
||||
Dat_TimeStatusClassVisible[AgdEvent.TimeStatus],
|
||||
Gbl.RowEvenOdd,
|
||||
UniqueId,AgdEvent.TimeUTC[Loc_START_TIME],Txt_Today);
|
||||
UniqueId,AgdEvent.TimeUTC[Agd_START_TIME],Txt_Today);
|
||||
|
||||
/* End date/time */
|
||||
UniqueId++;
|
||||
|
@ -328,12 +328,10 @@ static void Agd_ShowOneEvent (Agd_AgendaType_t AgendaType,long AgdCod)
|
|||
"</script>"
|
||||
"</td>",
|
||||
UniqueId,
|
||||
AgdEvent.Hidden ? (AgdEvent.Open ? "DATE_GREEN_LIGHT" :
|
||||
"DATE_RED_LIGHT") :
|
||||
(AgdEvent.Open ? "DATE_GREEN" :
|
||||
"DATE_RED"),
|
||||
AgdEvent.Hidden ? Dat_TimeStatusClassHidden[AgdEvent.TimeStatus] :
|
||||
Dat_TimeStatusClassVisible[AgdEvent.TimeStatus],
|
||||
Gbl.RowEvenOdd,
|
||||
UniqueId,AgdEvent.TimeUTC[Loc_END_TIME],Txt_Today);
|
||||
UniqueId,AgdEvent.TimeUTC[Agd_END_TIME],Txt_Today);
|
||||
|
||||
/* Event */
|
||||
fprintf (Gbl.F.Out,"<td class=\"LEFT_TOP COLOR%u\">"
|
||||
|
@ -443,9 +441,9 @@ static void Agd_GetParamEventOrderType (void)
|
|||
|
||||
Par_GetParToText ("Order",UnsignedStr,10);
|
||||
if (sscanf (UnsignedStr,"%u",&UnsignedNum) == 1)
|
||||
Gbl.Agenda.SelectedOrderType = (Loc_Order_t) UnsignedNum;
|
||||
Gbl.Agenda.SelectedOrderType = (Agd_Order_t) UnsignedNum;
|
||||
else
|
||||
Gbl.Agenda.SelectedOrderType = Loc_DEFAULT_ORDER_TYPE;
|
||||
Gbl.Agenda.SelectedOrderType = Agd_DEFAULT_ORDER_TYPE;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -529,10 +527,10 @@ static void Agd_GetListEvents (Agd_AgendaType_t AgendaType)
|
|||
/***** Get list of events from database *****/
|
||||
switch (Gbl.Agenda.SelectedOrderType)
|
||||
{
|
||||
case Loc_ORDER_BY_START_DATE:
|
||||
case Agd_ORDER_BY_START_DATE:
|
||||
sprintf (OrderBySubQuery,"StartTime DESC,EndTime DESC,Location DESC,Event DESC");
|
||||
break;
|
||||
case Loc_ORDER_BY_END_DATE:
|
||||
case Agd_ORDER_BY_END_DATE:
|
||||
sprintf (OrderBySubQuery,"EndTime DESC,StartTime DESC,Location DESC,Event DESC");
|
||||
break;
|
||||
}
|
||||
|
@ -596,7 +594,8 @@ static void Agd_GetDataOfEventByCod (struct AgendaEvent *AgdEvent)
|
|||
sprintf (Query,"SELECT AgdCod,UsrCod,Hidden,"
|
||||
"UNIX_TIMESTAMP(StartTime),"
|
||||
"UNIX_TIMESTAMP(EndTime),"
|
||||
"NOW() BETWEEN StartTime AND EndTime,"
|
||||
"NOW()>EndTime," // Past event?
|
||||
"NOW()<StartTime," // Future event?
|
||||
"Event,Location"
|
||||
" FROM agendas"
|
||||
" WHERE AgdCod='%ld' AND UsrCod='%ld'",
|
||||
|
@ -620,9 +619,9 @@ static void Agd_GetDataOfEvent (struct AgendaEvent *AgdEvent,const char *Query)
|
|||
AgdEvent->AgdCod = -1L;
|
||||
AgdEvent->UsrCod = -1L;
|
||||
AgdEvent->Hidden = false;
|
||||
AgdEvent->TimeUTC[Loc_START_TIME] =
|
||||
AgdEvent->TimeUTC[Loc_END_TIME ] = (time_t) 0;
|
||||
AgdEvent->Open = false;
|
||||
AgdEvent->TimeUTC[Agd_START_TIME] =
|
||||
AgdEvent->TimeUTC[Agd_END_TIME ] = (time_t) 0;
|
||||
AgdEvent->TimeStatus = Dat_FUTURE;
|
||||
AgdEvent->Event[0] = '\0';
|
||||
AgdEvent->Location[0] = '\0';
|
||||
|
||||
|
@ -631,7 +630,17 @@ static void Agd_GetDataOfEvent (struct AgendaEvent *AgdEvent,const char *Query)
|
|||
|
||||
if (NumRows) // Event found...
|
||||
{
|
||||
/* Get row */
|
||||
/* Get row:
|
||||
row[0] AgdCod
|
||||
row[1] UsrCod
|
||||
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
|
||||
*/
|
||||
row = mysql_fetch_row (mysql_res);
|
||||
|
||||
/* Get code of the event (row[0]) */
|
||||
|
@ -644,19 +653,21 @@ static void Agd_GetDataOfEvent (struct AgendaEvent *AgdEvent,const char *Query)
|
|||
AgdEvent->Hidden = (row[2][0] == 'Y');
|
||||
|
||||
/* Get start date (row[3] holds the start UTC time) */
|
||||
AgdEvent->TimeUTC[Loc_START_TIME] = Dat_GetUNIXTimeFromStr (row[3]);
|
||||
AgdEvent->TimeUTC[Agd_START_TIME] = Dat_GetUNIXTimeFromStr (row[3]);
|
||||
|
||||
/* Get end date (row[4] holds the end UTC time) */
|
||||
AgdEvent->TimeUTC[Loc_END_TIME ] = Dat_GetUNIXTimeFromStr (row[4]);
|
||||
AgdEvent->TimeUTC[Agd_END_TIME ] = Dat_GetUNIXTimeFromStr (row[4]);
|
||||
|
||||
/* Get whether the event is open or closed (row(5)) */
|
||||
AgdEvent->Open = (row[5][0] == '1');
|
||||
|
||||
/* Get the event (row[6]) */
|
||||
strcpy (AgdEvent->Event,row[6]);
|
||||
/* Get whether the event is past, present or futur (row(5), row[6]) */
|
||||
AgdEvent->TimeStatus = ((row[5][0] == '1') ? Dat_PAST :
|
||||
((row[6][0] == '1') ? Dat_FUTURE :
|
||||
Dat_PRESENT));
|
||||
|
||||
/* Get the event (row[7]) */
|
||||
strcpy (AgdEvent->Location,row[7]);
|
||||
strcpy (AgdEvent->Event,row[7]);
|
||||
|
||||
/* Get the event (row[8]) */
|
||||
strcpy (AgdEvent->Location,row[8]);
|
||||
}
|
||||
|
||||
/***** Free structure that stores the query result *****/
|
||||
|
@ -919,9 +930,9 @@ void Agd_RequestCreatOrEditEvent (void)
|
|||
/* Initialize to empty event */
|
||||
AgdEvent.AgdCod = -1L;
|
||||
AgdEvent.UsrCod = Gbl.Usrs.Me.UsrDat.UsrCod;
|
||||
AgdEvent.TimeUTC[Loc_START_TIME] = Gbl.StartExecutionTimeUTC;
|
||||
AgdEvent.TimeUTC[Loc_END_TIME ] = Gbl.StartExecutionTimeUTC + (2 * 60 * 60); // +2 hours
|
||||
AgdEvent.Open = true;
|
||||
AgdEvent.TimeUTC[Agd_START_TIME] = Gbl.StartExecutionTimeUTC;
|
||||
AgdEvent.TimeUTC[Agd_END_TIME ] = Gbl.StartExecutionTimeUTC + (2 * 60 * 60); // +2 hours
|
||||
AgdEvent.TimeStatus = Dat_FUTURE;
|
||||
AgdEvent.Event[0] = '\0';
|
||||
AgdEvent.Location[0] = '\0';
|
||||
}
|
||||
|
@ -969,7 +980,7 @@ void Agd_RequestCreatOrEditEvent (void)
|
|||
"</tr>",
|
||||
The_ClassForm[Gbl.Prefs.Theme],
|
||||
Txt_Event,
|
||||
Loc_MAX_LENGTH_EVENT,AgdEvent.Event);
|
||||
Agd_MAX_LENGTH_EVENT,AgdEvent.Event);
|
||||
|
||||
/***** Location *****/
|
||||
fprintf (Gbl.F.Out,"<tr>"
|
||||
|
@ -984,7 +995,7 @@ void Agd_RequestCreatOrEditEvent (void)
|
|||
"</tr>",
|
||||
The_ClassForm[Gbl.Prefs.Theme],
|
||||
Txt_Location,
|
||||
Loc_MAX_LENGTH_LOCATION,AgdEvent.Location);
|
||||
Agd_MAX_LENGTH_LOCATION,AgdEvent.Location);
|
||||
|
||||
/***** Start and end dates *****/
|
||||
Dat_PutFormStartEndClientLocalDateTimes (AgdEvent.TimeUTC);
|
||||
|
@ -1043,23 +1054,23 @@ void Agd_RecFormEvent (void)
|
|||
}
|
||||
|
||||
/***** Get start/end date-times *****/
|
||||
NewAgdEvent.TimeUTC[Loc_START_TIME] = Dat_GetTimeUTCFromForm ("StartTimeUTC");
|
||||
NewAgdEvent.TimeUTC[Loc_END_TIME ] = Dat_GetTimeUTCFromForm ("EndTimeUTC" );
|
||||
NewAgdEvent.TimeUTC[Agd_START_TIME] = Dat_GetTimeUTCFromForm ("StartTimeUTC");
|
||||
NewAgdEvent.TimeUTC[Agd_END_TIME ] = Dat_GetTimeUTCFromForm ("EndTimeUTC" );
|
||||
|
||||
/***** Get event *****/
|
||||
Par_GetParToText ("Location",NewAgdEvent.Location,Loc_MAX_LENGTH_LOCATION);
|
||||
Par_GetParToText ("Location",NewAgdEvent.Location,Agd_MAX_LENGTH_LOCATION);
|
||||
|
||||
/***** Get event *****/
|
||||
Par_GetParToText ("Event",NewAgdEvent.Event,Loc_MAX_LENGTH_EVENT);
|
||||
Par_GetParToText ("Event",NewAgdEvent.Event,Agd_MAX_LENGTH_EVENT);
|
||||
|
||||
/***** Get text *****/
|
||||
Par_GetParToHTML ("Txt",Txt,Cns_MAX_BYTES_TEXT); // Store in HTML format (not rigorous)
|
||||
|
||||
/***** Adjust dates *****/
|
||||
if (NewAgdEvent.TimeUTC[Loc_START_TIME] == 0)
|
||||
NewAgdEvent.TimeUTC[Loc_START_TIME] = Gbl.StartExecutionTimeUTC;
|
||||
if (NewAgdEvent.TimeUTC[Loc_END_TIME] == 0)
|
||||
NewAgdEvent.TimeUTC[Loc_END_TIME] = NewAgdEvent.TimeUTC[Loc_START_TIME] + 2*60*60; // +2 hours
|
||||
if (NewAgdEvent.TimeUTC[Agd_START_TIME] == 0)
|
||||
NewAgdEvent.TimeUTC[Agd_START_TIME] = Gbl.StartExecutionTimeUTC;
|
||||
if (NewAgdEvent.TimeUTC[Agd_END_TIME] == 0)
|
||||
NewAgdEvent.TimeUTC[Agd_END_TIME] = NewAgdEvent.TimeUTC[Agd_START_TIME] + 2*60*60; // +2 hours
|
||||
|
||||
/***** Check if event is correct *****/
|
||||
if (!NewAgdEvent.Location[0]) // If there is no event
|
||||
|
@ -1131,8 +1142,8 @@ static void Agd_CreateEvent (struct AgendaEvent *AgdEvent,const char *Txt)
|
|||
" ('%ld',FROM_UNIXTIME('%ld'),FROM_UNIXTIME('%ld'),"
|
||||
"'%s','%s','%s')",
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||
AgdEvent->TimeUTC[Loc_START_TIME],
|
||||
AgdEvent->TimeUTC[Loc_END_TIME ],
|
||||
AgdEvent->TimeUTC[Agd_START_TIME],
|
||||
AgdEvent->TimeUTC[Agd_END_TIME ],
|
||||
AgdEvent->Event,
|
||||
AgdEvent->Location,
|
||||
Txt);
|
||||
|
@ -1153,8 +1164,8 @@ static void Agd_UpdateEvent (struct AgendaEvent *AgdEvent,const char *Txt)
|
|||
"EndTime=FROM_UNIXTIME('%ld'),"
|
||||
"Event='%s',Location='%s',Txt='%s'"
|
||||
" WHERE AgdCod='%ld' AND UsrCod='%ld'",
|
||||
AgdEvent->TimeUTC[Loc_START_TIME],
|
||||
AgdEvent->TimeUTC[Loc_END_TIME ],
|
||||
AgdEvent->TimeUTC[Agd_START_TIME],
|
||||
AgdEvent->TimeUTC[Agd_END_TIME ],
|
||||
AgdEvent->Event,AgdEvent->Location,Txt,
|
||||
AgdEvent->AgdCod,Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
DB_QueryUPDATE (Query,"can not update event");
|
||||
|
|
|
@ -34,43 +34,34 @@
|
|||
/************************** Public types and constants ***********************/
|
||||
/*****************************************************************************/
|
||||
|
||||
#define Loc_MAX_LENGTH_LOCATION 255
|
||||
#define Loc_MAX_LENGTH_EVENT 255
|
||||
#define Agd_MAX_LENGTH_LOCATION 255
|
||||
#define Agd_MAX_LENGTH_EVENT 255
|
||||
|
||||
#define Loc_MAX_LENGTH_FOLDER 32
|
||||
|
||||
#define Loc_NUM_TYPES_SEND_WORK 2
|
||||
#define Agd_NUM_DATES 2
|
||||
typedef enum
|
||||
{
|
||||
Loc_DO_NOT_SEND_WORK = 0,
|
||||
Loc_SEND_WORK = 1,
|
||||
} Loc_SendWork_t;
|
||||
|
||||
#define Loc_NUM_DATES 2
|
||||
typedef enum
|
||||
{
|
||||
Loc_START_TIME = 0,
|
||||
Loc_END_TIME = 1,
|
||||
} Loc_StartOrEndTime_t;
|
||||
Agd_START_TIME = 0,
|
||||
Agd_END_TIME = 1,
|
||||
} Agd_StartOrEndTime_t;
|
||||
|
||||
struct AgendaEvent
|
||||
{
|
||||
long AgdCod;
|
||||
bool Hidden;
|
||||
long UsrCod;
|
||||
time_t TimeUTC[Loc_NUM_DATES];
|
||||
bool Open;
|
||||
char Event[Loc_MAX_LENGTH_EVENT+1];
|
||||
char Location[Loc_MAX_LENGTH_LOCATION+1];
|
||||
time_t TimeUTC[Agd_NUM_DATES];
|
||||
Dat_TimeStatus_t TimeStatus;
|
||||
char Event[Agd_MAX_LENGTH_EVENT+1];
|
||||
char Location[Agd_MAX_LENGTH_LOCATION+1];
|
||||
};
|
||||
|
||||
typedef enum
|
||||
{
|
||||
Loc_ORDER_BY_START_DATE = 0,
|
||||
Loc_ORDER_BY_END_DATE = 1,
|
||||
} Loc_Order_t;
|
||||
Agd_ORDER_BY_START_DATE = 0,
|
||||
Agd_ORDER_BY_END_DATE = 1,
|
||||
} Agd_Order_t;
|
||||
|
||||
#define Loc_DEFAULT_ORDER_TYPE Loc_ORDER_BY_START_DATE
|
||||
#define Agd_DEFAULT_ORDER_TYPE Agd_ORDER_BY_END_DATE
|
||||
|
||||
/*****************************************************************************/
|
||||
/***************************** Public prototypes *****************************/
|
||||
|
|
|
@ -187,13 +187,15 @@
|
|||
/****************************** Public constants *****************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
#define Log_PLATFORM_VERSION "SWAD 16.82.1 (2016-12-02)"
|
||||
#define CSS_FILE "swad16.69.css"
|
||||
#define Log_PLATFORM_VERSION "SWAD 16.82.2 (2016-12-02)"
|
||||
#define CSS_FILE "swad16.82.2.css"
|
||||
#define JS_FILE "swad16.46.1.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.82.2: Dec 02, 2016 Changes in colors of dates in agenda.
|
||||
Default order of events in agenda now is "by end date". (209477 lines)
|
||||
Version 16.82.1: Dec 02, 2016 Changes in another user's agenda. (209450 lines)
|
||||
Version 16.82: Dec 02, 2016 New action to show agenda another user's agenda. (209425 lines)
|
||||
10 changes necessary in database:
|
||||
|
|
13
swad_date.c
13
swad_date.c
|
@ -61,6 +61,19 @@ const unsigned Dat_NumDaysMonth[1+12] =
|
|||
31, // 12: December
|
||||
};
|
||||
|
||||
const char *Dat_TimeStatusClassVisible[Dat_NUM_TIME_STATUS] =
|
||||
{
|
||||
"DATE_RED", // Dat_PAST
|
||||
"DATE_GREEN", // Dat_PRESENT
|
||||
"DATE_BLUE", // Dat_FUTURE
|
||||
};
|
||||
const char *Dat_TimeStatusClassHidden[Dat_NUM_TIME_STATUS] =
|
||||
{
|
||||
"DATE_RED_LIGHT", // Dat_PAST
|
||||
"DATE_GREEN_LIGHT", // Dat_PRESENT
|
||||
"DATE_BLUE_LIGHT", // Dat_FUTURE
|
||||
};
|
||||
|
||||
/*****************************************************************************/
|
||||
/***************************** Private prototypes ****************************/
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -69,6 +69,14 @@ struct DateTime
|
|||
char YYYYMMDDHHMMSS[4+2+2+2+2+2+1];
|
||||
};
|
||||
|
||||
#define Dat_NUM_TIME_STATUS 3
|
||||
typedef enum
|
||||
{
|
||||
Dat_PAST = 0,
|
||||
Dat_PRESENT = 1,
|
||||
Dat_FUTURE = 2,
|
||||
} Dat_TimeStatus_t;
|
||||
|
||||
/*****************************************************************************/
|
||||
/***************************** Public prototypes *****************************/
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -410,7 +410,7 @@ struct Globals
|
|||
bool LstIsRead; // Is the list already read from database, or it needs to be read?
|
||||
unsigned Num; // Number of events
|
||||
long *LstAgdCods; // List of agenda codes
|
||||
Loc_Order_t SelectedOrderType;
|
||||
Agd_Order_t SelectedOrderType;
|
||||
long AgdCodToEdit; // Used as parameter in contextual links
|
||||
} Agenda;
|
||||
struct
|
||||
|
|
Loading…
Reference in New Issue
Block a user