Version19.204.5

This commit is contained in:
acanas 2020-04-28 13:12:18 +02:00
parent 1bae89e3e7
commit 9c71d16323
5 changed files with 33 additions and 32 deletions

View File

@ -35,6 +35,7 @@
#include "swad_agenda.h" #include "swad_agenda.h"
#include "swad_box.h" #include "swad_box.h"
#include "swad_database.h" #include "swad_database.h"
#include "swad_date.h"
#include "swad_form.h" #include "swad_form.h"
#include "swad_global.h" #include "swad_global.h"
#include "swad_group.h" #include "swad_group.h"
@ -1239,10 +1240,10 @@ static void Agd_GetDataOfEventByCod (struct Agd_Event *AgdEvent)
AgdEvent->Hidden = (row[2][0] == 'Y'); AgdEvent->Hidden = (row[2][0] == 'Y');
/* Get start date (row[3] holds the start UTC time) */ /* Get start date (row[3] holds the start UTC time) */
AgdEvent->TimeUTC[Agd_START_TIME] = Dat_GetUNIXTimeFromStr (row[3]); AgdEvent->TimeUTC[Dat_START_TIME] = Dat_GetUNIXTimeFromStr (row[3]);
/* Get end date (row[4] holds the end UTC time) */ /* Get end date (row[4] holds the end UTC time) */
AgdEvent->TimeUTC[Agd_END_TIME ] = Dat_GetUNIXTimeFromStr (row[4]); AgdEvent->TimeUTC[Dat_END_TIME ] = Dat_GetUNIXTimeFromStr (row[4]);
/* Get whether the event is past, present or future (row(5), row[6]) */ /* Get whether the event is past, present or future (row(5), row[6]) */
AgdEvent->TimeStatus = ((row[5][0] == '1') ? Dat_PAST : AgdEvent->TimeStatus = ((row[5][0] == '1') ? Dat_PAST :
@ -1263,8 +1264,8 @@ static void Agd_GetDataOfEventByCod (struct Agd_Event *AgdEvent)
AgdEvent->AgdCod = -1L; AgdEvent->AgdCod = -1L;
AgdEvent->Public = false; AgdEvent->Public = false;
AgdEvent->Hidden = false; AgdEvent->Hidden = false;
AgdEvent->TimeUTC[Agd_START_TIME] = AgdEvent->TimeUTC[Dat_START_TIME] =
AgdEvent->TimeUTC[Agd_END_TIME ] = (time_t) 0; AgdEvent->TimeUTC[Dat_END_TIME ] = (time_t) 0;
AgdEvent->TimeStatus = Dat_FUTURE; AgdEvent->TimeStatus = Dat_FUTURE;
AgdEvent->Event[0] = '\0'; AgdEvent->Event[0] = '\0';
AgdEvent->Location[0] = '\0'; AgdEvent->Location[0] = '\0';
@ -1591,8 +1592,8 @@ void Agd_RequestCreatOrEditEvent (void)
{ {
/* Initialize to empty event */ /* Initialize to empty event */
AgdEvent.AgdCod = -1L; AgdEvent.AgdCod = -1L;
AgdEvent.TimeUTC[Agd_START_TIME] = Gbl.StartExecutionTimeUTC; AgdEvent.TimeUTC[Dat_START_TIME] = Gbl.StartExecutionTimeUTC;
AgdEvent.TimeUTC[Agd_END_TIME ] = Gbl.StartExecutionTimeUTC + (2 * 60 * 60); // +2 hours AgdEvent.TimeUTC[Dat_END_TIME ] = Gbl.StartExecutionTimeUTC + (2 * 60 * 60); // +2 hours
AgdEvent.TimeStatus = Dat_FUTURE; AgdEvent.TimeStatus = Dat_FUTURE;
AgdEvent.Event[0] = '\0'; AgdEvent.Event[0] = '\0';
AgdEvent.Location[0] = '\0'; AgdEvent.Location[0] = '\0';
@ -1724,23 +1725,23 @@ void Agd_RecFormEvent (void)
ItsANewEvent = ((AgdEvent.AgdCod = Agd_GetParamAgdCod ()) == -1L); ItsANewEvent = ((AgdEvent.AgdCod = Agd_GetParamAgdCod ()) == -1L);
/***** Get start/end date-times *****/ /***** Get start/end date-times *****/
AgdEvent.TimeUTC[Agd_START_TIME] = Dat_GetTimeUTCFromForm ("StartTimeUTC"); AgdEvent.TimeUTC[Dat_START_TIME] = Dat_GetTimeUTCFromForm ("StartTimeUTC");
AgdEvent.TimeUTC[Agd_END_TIME ] = Dat_GetTimeUTCFromForm ("EndTimeUTC" ); AgdEvent.TimeUTC[Dat_END_TIME ] = Dat_GetTimeUTCFromForm ("EndTimeUTC" );
/***** Get event *****/ /***** Get event location *****/
Par_GetParToText ("Location",AgdEvent.Location,Agd_MAX_BYTES_LOCATION); Par_GetParToText ("Location",AgdEvent.Location,Agd_MAX_BYTES_LOCATION);
/***** Get event *****/ /***** Get event title *****/
Par_GetParToText ("Event",AgdEvent.Event,Agd_MAX_BYTES_EVENT); Par_GetParToText ("Event",AgdEvent.Event,Agd_MAX_BYTES_EVENT);
/***** Get text *****/ /***** Get event description *****/
Par_GetParToHTML ("Txt",EventTxt,Cns_MAX_BYTES_TEXT); // Store in HTML format (not rigorous) Par_GetParToHTML ("Txt",EventTxt,Cns_MAX_BYTES_TEXT); // Store in HTML format (not rigorous)
/***** Adjust dates *****/ /***** Adjust dates *****/
if (AgdEvent.TimeUTC[Agd_START_TIME] == 0) if (AgdEvent.TimeUTC[Dat_START_TIME] == 0)
AgdEvent.TimeUTC[Agd_START_TIME] = Gbl.StartExecutionTimeUTC; AgdEvent.TimeUTC[Dat_START_TIME] = Gbl.StartExecutionTimeUTC;
if (AgdEvent.TimeUTC[Agd_END_TIME] == 0) if (AgdEvent.TimeUTC[Dat_END_TIME] == 0)
AgdEvent.TimeUTC[Agd_END_TIME] = AgdEvent.TimeUTC[Agd_START_TIME] + 2 * 60 * 60; // +2 hours AgdEvent.TimeUTC[Dat_END_TIME] = AgdEvent.TimeUTC[Dat_START_TIME] + 2 * 60 * 60; // +2 hours
/***** Check if event is correct *****/ /***** Check if event is correct *****/
if (!AgdEvent.Location[0]) // If there is no event if (!AgdEvent.Location[0]) // If there is no event
@ -1801,8 +1802,8 @@ static void Agd_CreateEvent (struct Agd_Event *AgdEvent,const char *Txt)
" (%ld,FROM_UNIXTIME(%ld),FROM_UNIXTIME(%ld)," " (%ld,FROM_UNIXTIME(%ld),FROM_UNIXTIME(%ld),"
"'%s','%s','%s')", "'%s','%s','%s')",
AgdEvent->UsrCod, AgdEvent->UsrCod,
AgdEvent->TimeUTC[Agd_START_TIME], AgdEvent->TimeUTC[Dat_START_TIME],
AgdEvent->TimeUTC[Agd_END_TIME ], AgdEvent->TimeUTC[Dat_END_TIME ],
AgdEvent->Event, AgdEvent->Event,
AgdEvent->Location, AgdEvent->Location,
Txt); Txt);
@ -1821,8 +1822,8 @@ static void Agd_UpdateEvent (struct Agd_Event *AgdEvent,const char *Txt)
"EndTime=FROM_UNIXTIME(%ld)," "EndTime=FROM_UNIXTIME(%ld),"
"Event='%s',Location='%s',Txt='%s'" "Event='%s',Location='%s',Txt='%s'"
" WHERE AgdCod=%ld AND UsrCod=%ld", " WHERE AgdCod=%ld AND UsrCod=%ld",
AgdEvent->TimeUTC[Agd_START_TIME], AgdEvent->TimeUTC[Dat_START_TIME],
AgdEvent->TimeUTC[Agd_END_TIME ], AgdEvent->TimeUTC[Dat_END_TIME ],
AgdEvent->Event,AgdEvent->Location,Txt, AgdEvent->Event,AgdEvent->Location,Txt,
AgdEvent->AgdCod,AgdEvent->UsrCod); AgdEvent->AgdCod,AgdEvent->UsrCod);
} }

View File

@ -40,20 +40,13 @@
#define Agd_MAX_CHARS_LOCATION (128 - 1) // 127 #define Agd_MAX_CHARS_LOCATION (128 - 1) // 127
#define Agd_MAX_BYTES_LOCATION ((Agd_MAX_CHARS_LOCATION + 1) * Str_MAX_BYTES_PER_CHAR - 1) // 2047 #define Agd_MAX_BYTES_LOCATION ((Agd_MAX_CHARS_LOCATION + 1) * Str_MAX_BYTES_PER_CHAR - 1) // 2047
#define Agd_NUM_DATES 2
typedef enum
{
Agd_START_TIME = 0,
Agd_END_TIME = 1,
} Agd_StartOrEndTime_t;
struct Agd_Event struct Agd_Event
{ {
long AgdCod; long AgdCod;
long UsrCod; long UsrCod;
bool Public; bool Public;
bool Hidden; bool Hidden;
time_t TimeUTC[Agd_NUM_DATES]; time_t TimeUTC[Dat_NUM_START_END_TIME];
Dat_TimeStatus_t TimeStatus; Dat_TimeStatus_t TimeStatus;
char Event[Agd_MAX_BYTES_EVENT + 1]; char Event[Agd_MAX_BYTES_EVENT + 1];
char Location[Agd_MAX_BYTES_LOCATION + 1]; char Location[Agd_MAX_BYTES_LOCATION + 1];

View File

@ -544,10 +544,11 @@ enscript -2 --landscape --color --file-align=2 --highlight --line-numbers -o - *
En OpenSWAD: En OpenSWAD:
ps2pdf source.ps destination.pdf ps2pdf source.ps destination.pdf
*/ */
#define Log_PLATFORM_VERSION "SWAD 19.204.4 (2020-04-28)" #define Log_PLATFORM_VERSION "SWAD 19.204.5 (2020-04-28)"
#define CSS_FILE "swad19.193.1.css" #define CSS_FILE "swad19.193.1.css"
#define JS_FILE "swad19.193.1.js" #define JS_FILE "swad19.193.1.js"
/* /*
Version 19.204.5: Apr 28, 2020 Save start and end dates on creation of exam event. (300471 lines)
Version 19.204.4: Apr 28, 2020 Fixed bug in creation of new exam. (300470 lines) Version 19.204.4: Apr 28, 2020 Fixed bug in creation of new exam. (300470 lines)
Version 19.204.3: Apr 28, 2020 List updated exam events after creation. (300521 lines) Version 19.204.3: Apr 28, 2020 List updated exam events after creation. (300521 lines)
Version 19.204.2: Apr 28, 2020 Changes in creation of exam events. (300503 lines) Version 19.204.2: Apr 28, 2020 Changes in creation of exam events. (300503 lines)

View File

@ -1534,6 +1534,10 @@ void ExaEvt_CreateNewEventTch (void)
/* Get event title */ /* Get event title */
Par_GetParToText ("Title",Event.Title,Exa_MAX_BYTES_TITLE); Par_GetParToText ("Title",Event.Title,Exa_MAX_BYTES_TITLE);
/* Get start/end date-times */
Event.TimeUTC[Dat_START_TIME] = Dat_GetTimeUTCFromForm ("StartTimeUTC");
Event.TimeUTC[Dat_END_TIME ] = Dat_GetTimeUTCFromForm ("EndTimeUTC" );
/* Get groups associated to the event */ /* Get groups associated to the event */
Grp_GetParCodsSeveralGrps (); Grp_GetParCodsSeveralGrps ();
@ -1606,8 +1610,8 @@ static void ExaEvt_CreateEvent (struct ExaEvt_Event *Event)
" VALUES " " VALUES "
"(%ld," // ExaCod "(%ld," // ExaCod
"%ld," // UsrCod "%ld," // UsrCod
"NOW()," // StartTime "FROM_UNIXTIME(%ld)," // Start time
"NOW()," // EndTime "FROM_UNIXTIME(%ld)," // End time
"'%s'," // Title "'%s'," // Title
"0," // QstInd: Event has not started, so not the first question yet "0," // QstInd: Event has not started, so not the first question yet
"-1," // QstCod: Non-existent question "-1," // QstCod: Non-existent question
@ -1618,6 +1622,8 @@ static void ExaEvt_CreateEvent (struct ExaEvt_Event *Event)
"'N')", // ShowUsrResults: Don't show user results initially "'N')", // ShowUsrResults: Don't show user results initially
Event->ExaCod, Event->ExaCod,
Gbl.Usrs.Me.UsrDat.UsrCod, // Event creator Gbl.Usrs.Me.UsrDat.UsrCod, // Event creator
Event->TimeUTC[Dat_START_TIME], // Start time
Event->TimeUTC[Dat_END_TIME ], // End time
Event->Title, Event->Title,
ExaEvt_ShowingStringsDB[ExaEvt_SHOWING_DEFAULT], ExaEvt_ShowingStringsDB[ExaEvt_SHOWING_DEFAULT],
ExaEvt_NUM_COLS_DEFAULT); ExaEvt_NUM_COLS_DEFAULT);

View File

@ -42,10 +42,10 @@
typedef enum typedef enum
{ {
ExaEvt_START, // Start: don't show anything ExaEvt_START, // Start: don't show anything
ExaEvt_STEM, // Showing only the question stem ExaEvt_STEM, // Showing only the question stem
ExaEvt_ANSWERS, // Showing the question stem and the answers ExaEvt_ANSWERS, // Showing the question stem and the answers
ExaEvt_RESULTS, // Showing the results ExaEvt_RESULTS, // Showing the results
ExaEvt_END, // End: don't show anything ExaEvt_END, // End: don't show anything
} ExaEvt_Showing_t; } ExaEvt_Showing_t;
#define ExaEvt_SHOWING_DEFAULT ExaEvt_START #define ExaEvt_SHOWING_DEFAULT ExaEvt_START