mirror of https://github.com/acanas/swad-core.git
Version 15.16
This commit is contained in:
parent
74ca4647c3
commit
96b3b5223c
|
@ -229,6 +229,7 @@ static void Asg_ShowOneAssignment (long AsgCod)
|
||||||
extern const char *Txt_ASSIGNMENT_TYPES[Asg_NUM_TYPES_SEND_WORK];
|
extern const char *Txt_ASSIGNMENT_TYPES[Asg_NUM_TYPES_SEND_WORK];
|
||||||
extern const char *Txt_Yes;
|
extern const char *Txt_Yes;
|
||||||
extern const char *Txt_No;
|
extern const char *Txt_No;
|
||||||
|
static unsigned UniqueId = 0;
|
||||||
struct Assignment Asg;
|
struct Assignment Asg;
|
||||||
char Txt[Cns_MAX_BYTES_TEXT+1];
|
char Txt[Cns_MAX_BYTES_TEXT+1];
|
||||||
|
|
||||||
|
@ -238,37 +239,35 @@ static void Asg_ShowOneAssignment (long AsgCod)
|
||||||
|
|
||||||
/***** Write first row of data of this assignment *****/
|
/***** Write first row of data of this assignment *****/
|
||||||
/* Start date/time */
|
/* Start date/time */
|
||||||
|
UniqueId++;
|
||||||
fprintf (Gbl.F.Out,"<tr>"
|
fprintf (Gbl.F.Out,"<tr>"
|
||||||
"<td class=\"%s LEFT_TOP COLOR%u\">"
|
"<td id=\"asg_date%u\" class=\"%s LEFT_TOP COLOR%u\">"
|
||||||
"%02u/%02u/%02u<br />"
|
"<script type=\"text/javascript\">"
|
||||||
"%02u:%02u h"
|
"writeLocalDateTimeFromUTC('asg_date%u',%ld);"
|
||||||
|
"</script>"
|
||||||
"</td>",
|
"</td>",
|
||||||
|
UniqueId,
|
||||||
Asg.Hidden ? (Asg.Open ? "DATE_GREEN_LIGHT" :
|
Asg.Hidden ? (Asg.Open ? "DATE_GREEN_LIGHT" :
|
||||||
"DATE_RED_LIGHT") :
|
"DATE_RED_LIGHT") :
|
||||||
(Asg.Open ? "DATE_GREEN" :
|
(Asg.Open ? "DATE_GREEN" :
|
||||||
"DATE_RED"),
|
"DATE_RED"),
|
||||||
Gbl.RowEvenOdd,
|
Gbl.RowEvenOdd,
|
||||||
Asg.DateTimes[Asg_START_TIME].Date.Day,
|
UniqueId,Asg.DateTimes[Asg_START_TIME]);
|
||||||
Asg.DateTimes[Asg_START_TIME].Date.Month,
|
|
||||||
Asg.DateTimes[Asg_START_TIME].Date.Year % 100,
|
|
||||||
Asg.DateTimes[Asg_START_TIME].Time.Hour,
|
|
||||||
Asg.DateTimes[Asg_START_TIME].Time.Minute);
|
|
||||||
|
|
||||||
/* End date/time */
|
/* End date/time */
|
||||||
fprintf (Gbl.F.Out,"<td class=\"%s LEFT_TOP COLOR%u\">"
|
UniqueId++;
|
||||||
"%02u/%02u/%02u<br />"
|
fprintf (Gbl.F.Out,"<td id=\"asg_date%u\" class=\"%s LEFT_TOP COLOR%u\">"
|
||||||
"%02u:%02u h"
|
"<script type=\"text/javascript\">"
|
||||||
|
"writeLocalDateTimeFromUTC('asg_date%u',%ld);"
|
||||||
|
"</script>"
|
||||||
"</td>",
|
"</td>",
|
||||||
|
UniqueId,
|
||||||
Asg.Hidden ? (Asg.Open ? "DATE_GREEN_LIGHT" :
|
Asg.Hidden ? (Asg.Open ? "DATE_GREEN_LIGHT" :
|
||||||
"DATE_RED_LIGHT") :
|
"DATE_RED_LIGHT") :
|
||||||
(Asg.Open ? "DATE_GREEN" :
|
(Asg.Open ? "DATE_GREEN" :
|
||||||
"DATE_RED"),
|
"DATE_RED"),
|
||||||
Gbl.RowEvenOdd,
|
Gbl.RowEvenOdd,
|
||||||
Asg.DateTimes[Asg_END_TIME].Date.Day,
|
UniqueId,Asg.DateTimes[Asg_END_TIME]);
|
||||||
Asg.DateTimes[Asg_END_TIME].Date.Month,
|
|
||||||
Asg.DateTimes[Asg_END_TIME].Date.Year % 100,
|
|
||||||
Asg.DateTimes[Asg_END_TIME].Time.Hour,
|
|
||||||
Asg.DateTimes[Asg_END_TIME].Time.Minute);
|
|
||||||
|
|
||||||
/* Assignment title */
|
/* Assignment title */
|
||||||
fprintf (Gbl.F.Out,"<td class=\"LEFT_TOP COLOR%u\">"
|
fprintf (Gbl.F.Out,"<td class=\"LEFT_TOP COLOR%u\">"
|
||||||
|
@ -619,6 +618,7 @@ void Asg_GetDataOfAssignmentByCod (struct Assignment *Asg)
|
||||||
char Query[1024];
|
char Query[1024];
|
||||||
|
|
||||||
/***** Build query *****/
|
/***** Build query *****/
|
||||||
|
/*
|
||||||
sprintf (Query,"SELECT AsgCod,Hidden,UsrCod,"
|
sprintf (Query,"SELECT AsgCod,Hidden,UsrCod,"
|
||||||
"DATE_FORMAT(StartTime,'%%Y%%m%%d%%H%%i%%S'),"
|
"DATE_FORMAT(StartTime,'%%Y%%m%%d%%H%%i%%S'),"
|
||||||
"DATE_FORMAT(EndTime,'%%Y%%m%%d%%H%%i%%S'),"
|
"DATE_FORMAT(EndTime,'%%Y%%m%%d%%H%%i%%S'),"
|
||||||
|
@ -627,6 +627,15 @@ void Asg_GetDataOfAssignmentByCod (struct Assignment *Asg)
|
||||||
" FROM assignments"
|
" FROM assignments"
|
||||||
" WHERE AsgCod='%ld' AND CrsCod='%ld'",
|
" WHERE AsgCod='%ld' AND CrsCod='%ld'",
|
||||||
Asg->AsgCod,Gbl.CurrentCrs.Crs.CrsCod);
|
Asg->AsgCod,Gbl.CurrentCrs.Crs.CrsCod);
|
||||||
|
*/
|
||||||
|
sprintf (Query,"SELECT AsgCod,Hidden,UsrCod,"
|
||||||
|
"UNIX_TIMESTAMP(StartTime),"
|
||||||
|
"UNIX_TIMESTAMP(EndTime),"
|
||||||
|
"NOW() BETWEEN StartTime AND EndTime,"
|
||||||
|
"Title,Folder"
|
||||||
|
" FROM assignments"
|
||||||
|
" WHERE AsgCod='%ld' AND CrsCod='%ld'",
|
||||||
|
Asg->AsgCod,Gbl.CurrentCrs.Crs.CrsCod);
|
||||||
|
|
||||||
/***** Get data of assignment *****/
|
/***** Get data of assignment *****/
|
||||||
Asg_GetDataOfAssignment (Asg,Query);
|
Asg_GetDataOfAssignment (Asg,Query);
|
||||||
|
@ -641,6 +650,7 @@ void Asg_GetDataOfAssignmentByFolder (struct Assignment *Asg)
|
||||||
char Query[1024];
|
char Query[1024];
|
||||||
|
|
||||||
/***** Query database *****/
|
/***** Query database *****/
|
||||||
|
/*
|
||||||
sprintf (Query,"SELECT AsgCod,Hidden,UsrCod,"
|
sprintf (Query,"SELECT AsgCod,Hidden,UsrCod,"
|
||||||
"DATE_FORMAT(StartTime,'%%Y%%m%%d%%H%%i%%S'),"
|
"DATE_FORMAT(StartTime,'%%Y%%m%%d%%H%%i%%S'),"
|
||||||
"DATE_FORMAT(EndTime,'%%Y%%m%%d%%H%%i%%S'),"
|
"DATE_FORMAT(EndTime,'%%Y%%m%%d%%H%%i%%S'),"
|
||||||
|
@ -649,6 +659,15 @@ void Asg_GetDataOfAssignmentByFolder (struct Assignment *Asg)
|
||||||
" FROM assignments"
|
" FROM assignments"
|
||||||
" WHERE CrsCod='%ld' AND Folder='%s'",
|
" WHERE CrsCod='%ld' AND Folder='%s'",
|
||||||
Gbl.CurrentCrs.Crs.CrsCod,Asg->Folder);
|
Gbl.CurrentCrs.Crs.CrsCod,Asg->Folder);
|
||||||
|
*/
|
||||||
|
sprintf (Query,"SELECT AsgCod,Hidden,UsrCod,"
|
||||||
|
"UNIX_TIMESTAMP(StartTime),"
|
||||||
|
"UNIX_TIMESTAMP(EndTime),"
|
||||||
|
"NOW() BETWEEN StartTime AND EndTime,"
|
||||||
|
"Title,Folder"
|
||||||
|
" FROM assignments"
|
||||||
|
" WHERE CrsCod='%ld' AND Folder='%s'",
|
||||||
|
Gbl.CurrentCrs.Crs.CrsCod,Asg->Folder);
|
||||||
|
|
||||||
/***** Get data of assignment *****/
|
/***** Get data of assignment *****/
|
||||||
Asg_GetDataOfAssignment (Asg,Query);
|
Asg_GetDataOfAssignment (Asg,Query);
|
||||||
|
@ -665,9 +684,8 @@ static void Asg_GetDataOfAssignment (struct Assignment *Asg,const char *Query)
|
||||||
unsigned long NumRows;
|
unsigned long NumRows;
|
||||||
|
|
||||||
/***** Clear data *****/
|
/***** Clear data *****/
|
||||||
Asg->DateTimes[Asg_START_TIME].Date.Day =
|
Asg->DateTimes[Asg_START_TIME] =
|
||||||
Asg->DateTimes[Asg_START_TIME].Date.Month =
|
Asg->DateTimes[Asg_END_TIME ] = (time_t) 0;
|
||||||
Asg->DateTimes[Asg_START_TIME].Date.Year = 0;
|
|
||||||
Asg->Title[0] = '\0';
|
Asg->Title[0] = '\0';
|
||||||
|
|
||||||
/***** Get data of assignment from database *****/
|
/***** Get data of assignment from database *****/
|
||||||
|
@ -688,12 +706,18 @@ static void Asg_GetDataOfAssignment (struct Assignment *Asg,const char *Query)
|
||||||
Asg->UsrCod = Str_ConvertStrCodToLongCod (row[2]);
|
Asg->UsrCod = Str_ConvertStrCodToLongCod (row[2]);
|
||||||
|
|
||||||
/* Get start date (row[3] holds the start date in YYYYMMDDHHMMSS format) */
|
/* Get start date (row[3] holds the start date in YYYYMMDDHHMMSS format) */
|
||||||
|
/*
|
||||||
if (!(Dat_GetDateTimeFromYYYYMMDDHHMMSS (&(Asg->DateTimes[Asg_START_TIME]),row[3])))
|
if (!(Dat_GetDateTimeFromYYYYMMDDHHMMSS (&(Asg->DateTimes[Asg_START_TIME]),row[3])))
|
||||||
Lay_ShowErrorAndExit ("Error when reading start date of assignment.");
|
Lay_ShowErrorAndExit ("Error when reading start date of assignment.");
|
||||||
|
*/
|
||||||
|
Asg->DateTimes[Asg_START_TIME] = Dat_GetUNIXTimeFromStr (row[3]);
|
||||||
|
|
||||||
/* Get end date (row[4] holds the end date in YYYYMMDDHHMMSS format) */
|
/* Get end date (row[4] holds the end date in YYYYMMDDHHMMSS format) */
|
||||||
|
/*
|
||||||
if (!(Dat_GetDateTimeFromYYYYMMDDHHMMSS (&(Asg->DateTimes[Asg_END_TIME]),row[4])))
|
if (!(Dat_GetDateTimeFromYYYYMMDDHHMMSS (&(Asg->DateTimes[Asg_END_TIME]),row[4])))
|
||||||
Lay_ShowErrorAndExit ("Error when reading end date of assignment.");
|
Lay_ShowErrorAndExit ("Error when reading end date of assignment.");
|
||||||
|
*/
|
||||||
|
Asg->DateTimes[Asg_END_TIME] = Dat_GetUNIXTimeFromStr (row[4]);
|
||||||
|
|
||||||
/* Get whether the assignment is open or closed (row(5)) */
|
/* Get whether the assignment is open or closed (row(5)) */
|
||||||
Asg->Open = (row[5][0] == '1');
|
Asg->Open = (row[5][0] == '1');
|
||||||
|
@ -752,7 +776,8 @@ static void Asg_GetAssignmentTxtFromDB (long AsgCod,char *Txt)
|
||||||
unsigned long NumRows;
|
unsigned long NumRows;
|
||||||
|
|
||||||
/***** Get text of assignment from database *****/
|
/***** Get text of assignment from database *****/
|
||||||
sprintf (Query,"SELECT Txt FROM assignments WHERE AsgCod='%ld' AND CrsCod='%ld'",
|
sprintf (Query,"SELECT Txt FROM assignments"
|
||||||
|
" WHERE AsgCod='%ld' AND CrsCod='%ld'",
|
||||||
AsgCod,Gbl.CurrentCrs.Crs.CrsCod);
|
AsgCod,Gbl.CurrentCrs.Crs.CrsCod);
|
||||||
NumRows = DB_QuerySELECT (Query,&mysql_res,"can not get assignment text");
|
NumRows = DB_QuerySELECT (Query,&mysql_res,"can not get assignment text");
|
||||||
|
|
||||||
|
@ -776,27 +801,22 @@ static void Asg_GetAssignmentTxtFromDB (long AsgCod,char *Txt)
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/***************** Get summary and content of an assignment *****************/
|
/***************** Get summary and content of an assignment *****************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
// This function may be called inside a web service, so don't report error
|
// This function may be called inside a web service
|
||||||
|
|
||||||
void Asg_GetNotifAssignment (char *SummaryStr,char **ContentStr,
|
void Asg_GetNotifAssignment (char *SummaryStr,char **ContentStr,
|
||||||
long AsgCod,unsigned MaxChars,bool GetContent)
|
long AsgCod,unsigned MaxChars,bool GetContent)
|
||||||
{
|
{
|
||||||
extern const char *Txt_Start_date;
|
// extern const char *Txt_Start_date;
|
||||||
extern const char *Txt_End_date;
|
// extern const char *Txt_End_date;
|
||||||
char Query[512];
|
char Query[512];
|
||||||
MYSQL_RES *mysql_res;
|
MYSQL_RES *mysql_res;
|
||||||
MYSQL_ROW row;
|
MYSQL_ROW row;
|
||||||
struct DateTime DateTimes[Asg_NUM_DATES];
|
// struct DateTime DateTimes[Asg_NUM_DATES];
|
||||||
|
|
||||||
SummaryStr[0] = '\0'; // Return nothing on error
|
SummaryStr[0] = '\0'; // Return nothing on error
|
||||||
|
|
||||||
/***** Build query *****/
|
/***** Build query *****/
|
||||||
sprintf (Query,"SELECT Title,"
|
sprintf (Query,"SELECT Title,Txt FROM assignments WHERE AsgCod='%ld'",
|
||||||
"DATE_FORMAT(StartTime,'%%Y%%m%%d%%H%%i%%S'),"
|
|
||||||
"DATE_FORMAT(EndTime,'%%Y%%m%%d%%H%%i%%S'),"
|
|
||||||
"Txt"
|
|
||||||
" FROM assignments"
|
|
||||||
" WHERE AsgCod='%ld'",
|
|
||||||
AsgCod);
|
AsgCod);
|
||||||
if (!mysql_query (&Gbl.mysql,Query))
|
if (!mysql_query (&Gbl.mysql,Query))
|
||||||
if ((mysql_res = mysql_store_result (&Gbl.mysql)) != NULL)
|
if ((mysql_res = mysql_store_result (&Gbl.mysql)) != NULL)
|
||||||
|
@ -817,30 +837,7 @@ void Asg_GetNotifAssignment (char *SummaryStr,char **ContentStr,
|
||||||
{
|
{
|
||||||
if ((*ContentStr = (char *) malloc (512+Cns_MAX_BYTES_TEXT)) == NULL)
|
if ((*ContentStr = (char *) malloc (512+Cns_MAX_BYTES_TEXT)) == NULL)
|
||||||
Lay_ShowErrorAndExit ("Error allocating memory for notification content.");
|
Lay_ShowErrorAndExit ("Error allocating memory for notification content.");
|
||||||
(*ContentStr)[0] = '\0'; // Return nothing on error
|
strcpy (*ContentStr,row[1]);
|
||||||
|
|
||||||
/* Get start date (row[1] holds the start date in YYYYMMDDHHMMSS format) */
|
|
||||||
if (!(Dat_GetDateTimeFromYYYYMMDDHHMMSS (&DateTimes[Asg_START_TIME],row[1])))
|
|
||||||
Lay_ShowErrorAndExit ("Error when reading start date of assignment.");
|
|
||||||
|
|
||||||
/* Get end date (row[2] holds the end date in YYYYMMDDHHMMSS format) */
|
|
||||||
if (!(Dat_GetDateTimeFromYYYYMMDDHHMMSS (&DateTimes[Asg_END_TIME ],row[2])))
|
|
||||||
Lay_ShowErrorAndExit ("Error when reading end date of assignment.");
|
|
||||||
|
|
||||||
sprintf (*ContentStr,"%s: %02u/%02u/%04u %02u:%02u<br />%s: %02u/%02u/%04u %02u:%02u<br />%s",
|
|
||||||
Txt_Start_date,
|
|
||||||
DateTimes[Asg_START_TIME].Date.Day,
|
|
||||||
DateTimes[Asg_START_TIME].Date.Month,
|
|
||||||
DateTimes[Asg_START_TIME].Date.Year,
|
|
||||||
DateTimes[Asg_START_TIME].Time.Hour,
|
|
||||||
DateTimes[Asg_START_TIME].Time.Minute,
|
|
||||||
Txt_End_date,
|
|
||||||
DateTimes[Asg_END_TIME].Date.Day,
|
|
||||||
DateTimes[Asg_END_TIME].Date.Month,
|
|
||||||
DateTimes[Asg_END_TIME].Date.Year,
|
|
||||||
DateTimes[Asg_END_TIME].Time.Hour,
|
|
||||||
DateTimes[Asg_END_TIME].Time.Minute,
|
|
||||||
row[3]);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mysql_free_result (mysql_res);
|
mysql_free_result (mysql_res);
|
||||||
|
@ -1071,18 +1068,23 @@ void Asg_RequestCreatOrEditAsg (void)
|
||||||
{
|
{
|
||||||
/* Initialize to empty assignment */
|
/* Initialize to empty assignment */
|
||||||
Asg.AsgCod = -1L;
|
Asg.AsgCod = -1L;
|
||||||
|
/*
|
||||||
Asg.DateTimes[Asg_START_TIME].Date.Day = Gbl.Now.Date.Day;
|
Asg.DateTimes[Asg_START_TIME].Date.Day = Gbl.Now.Date.Day;
|
||||||
Asg.DateTimes[Asg_START_TIME].Date.Month = Gbl.Now.Date.Month;
|
Asg.DateTimes[Asg_START_TIME].Date.Month = Gbl.Now.Date.Month;
|
||||||
Asg.DateTimes[Asg_START_TIME].Date.Year = Gbl.Now.Date.Year;
|
Asg.DateTimes[Asg_START_TIME].Date.Year = Gbl.Now.Date.Year;
|
||||||
Asg.DateTimes[Asg_START_TIME].Time.Hour = Gbl.Now.Time.Hour;
|
Asg.DateTimes[Asg_START_TIME].Time.Hour = Gbl.Now.Time.Hour;
|
||||||
Asg.DateTimes[Asg_START_TIME].Time.Minute = Gbl.Now.Time.Minute;
|
Asg.DateTimes[Asg_START_TIME].Time.Minute = Gbl.Now.Time.Minute;
|
||||||
Asg.DateTimes[Asg_START_TIME].Time.Second = Gbl.Now.Time.Second;
|
Asg.DateTimes[Asg_START_TIME].Time.Second = Gbl.Now.Time.Second;
|
||||||
|
*/
|
||||||
|
Asg.DateTimes[Asg_START_TIME] = Gbl.TimeStartExecution;
|
||||||
|
/*
|
||||||
Asg.DateTimes[Asg_END_TIME ].Date.Day = Gbl.Now.Date.Day;
|
Asg.DateTimes[Asg_END_TIME ].Date.Day = Gbl.Now.Date.Day;
|
||||||
Asg.DateTimes[Asg_END_TIME ].Date.Month = Gbl.Now.Date.Month;
|
Asg.DateTimes[Asg_END_TIME ].Date.Month = Gbl.Now.Date.Month;
|
||||||
Asg.DateTimes[Asg_END_TIME ].Date.Year = Gbl.Now.Date.Year;
|
Asg.DateTimes[Asg_END_TIME ].Date.Year = Gbl.Now.Date.Year;
|
||||||
Asg.DateTimes[Asg_END_TIME ].Time.Hour = 23;
|
Asg.DateTimes[Asg_END_TIME ].Time.Hour = 23;
|
||||||
Asg.DateTimes[Asg_END_TIME ].Time.Minute = 59;
|
Asg.DateTimes[Asg_END_TIME ].Time.Minute = 59;
|
||||||
|
*/
|
||||||
|
Asg.DateTimes[Asg_END_TIME ] = Gbl.TimeStartExecution + (2 * 60 * 60); // +2 hours
|
||||||
Asg.Open = true;
|
Asg.Open = true;
|
||||||
Asg.Title[0] = '\0';
|
Asg.Title[0] = '\0';
|
||||||
Asg.SendWork = false;
|
Asg.SendWork = false;
|
||||||
|
@ -1144,21 +1146,29 @@ void Asg_RequestCreatOrEditAsg (void)
|
||||||
Dates[StartOrEndTime]);
|
Dates[StartOrEndTime]);
|
||||||
|
|
||||||
/* Date */
|
/* Date */
|
||||||
|
/*
|
||||||
Dat_WriteFormDate (Gbl.Now.Date.Year-1,Gbl.Now.Date.Year+1,
|
Dat_WriteFormDate (Gbl.Now.Date.Year-1,Gbl.Now.Date.Year+1,
|
||||||
NameSelectDay [StartOrEndTime],
|
NameSelectDay [StartOrEndTime],
|
||||||
NameSelectMonth[StartOrEndTime],
|
NameSelectMonth[StartOrEndTime],
|
||||||
NameSelectYear [StartOrEndTime],
|
NameSelectYear [StartOrEndTime],
|
||||||
&(Asg.DateTimes[StartOrEndTime].Date),
|
&(Asg.DateTimes[StartOrEndTime].Date),
|
||||||
false,false);
|
false,false);
|
||||||
|
*/
|
||||||
fprintf (Gbl.F.Out,"</td>"
|
Dat_WriteFormClientLocalDateTime (Gbl.Now.Date.Year-1,Gbl.Now.Date.Year+1,
|
||||||
"<td class=\"LEFT_TOP\">");
|
NameSelectDay [StartOrEndTime],
|
||||||
|
NameSelectMonth [StartOrEndTime],
|
||||||
|
NameSelectYear [StartOrEndTime],
|
||||||
|
NameSelectHour [StartOrEndTime],
|
||||||
|
NameSelectMinute[StartOrEndTime],
|
||||||
|
false,false);
|
||||||
|
|
||||||
/* Time */
|
/* Time */
|
||||||
|
/*
|
||||||
Dat_WriteFormHourMinute (NameSelectHour [StartOrEndTime],
|
Dat_WriteFormHourMinute (NameSelectHour [StartOrEndTime],
|
||||||
NameSelectMinute[StartOrEndTime],
|
NameSelectMinute[StartOrEndTime],
|
||||||
&(Asg.DateTimes[StartOrEndTime].Time),
|
&(Asg.DateTimes[StartOrEndTime].Time),
|
||||||
false,false);
|
false,false);
|
||||||
|
*/
|
||||||
|
|
||||||
fprintf (Gbl.F.Out,"</td>"
|
fprintf (Gbl.F.Out,"</td>"
|
||||||
"</tr>"
|
"</tr>"
|
||||||
|
@ -1291,6 +1301,7 @@ void Asg_RecFormAssignment (void)
|
||||||
}
|
}
|
||||||
|
|
||||||
/***** Get start date *****/
|
/***** Get start date *****/
|
||||||
|
/*
|
||||||
Dat_GetDateFromForm ("StartDay","StartMonth","StartYear",
|
Dat_GetDateFromForm ("StartDay","StartMonth","StartYear",
|
||||||
&(NewAsg.DateTimes[Asg_START_TIME].Date.Day),
|
&(NewAsg.DateTimes[Asg_START_TIME].Date.Day),
|
||||||
&(NewAsg.DateTimes[Asg_START_TIME].Date.Month),
|
&(NewAsg.DateTimes[Asg_START_TIME].Date.Month),
|
||||||
|
@ -1299,8 +1310,11 @@ void Asg_RecFormAssignment (void)
|
||||||
&(NewAsg.DateTimes[Asg_START_TIME].Time.Hour),
|
&(NewAsg.DateTimes[Asg_START_TIME].Time.Hour),
|
||||||
&(NewAsg.DateTimes[Asg_START_TIME].Time.Minute));
|
&(NewAsg.DateTimes[Asg_START_TIME].Time.Minute));
|
||||||
NewAsg.DateTimes[Asg_START_TIME].Time.Second = 0;
|
NewAsg.DateTimes[Asg_START_TIME].Time.Second = 0;
|
||||||
|
*/
|
||||||
|
NewAsg.DateTimes[Asg_START_TIME] = Dat_GetDateTimeFromForm ("StartDateTime");
|
||||||
|
|
||||||
/***** Get end date *****/
|
/***** Get end date *****/
|
||||||
|
/*
|
||||||
Dat_GetDateFromForm ("EndDay","EndMonth","EndYear",
|
Dat_GetDateFromForm ("EndDay","EndMonth","EndYear",
|
||||||
&(NewAsg.DateTimes[Asg_END_TIME].Date.Day),
|
&(NewAsg.DateTimes[Asg_END_TIME].Date.Day),
|
||||||
&(NewAsg.DateTimes[Asg_END_TIME].Date.Month),
|
&(NewAsg.DateTimes[Asg_END_TIME].Date.Month),
|
||||||
|
@ -1309,6 +1323,8 @@ void Asg_RecFormAssignment (void)
|
||||||
&(NewAsg.DateTimes[Asg_END_TIME].Time.Hour),
|
&(NewAsg.DateTimes[Asg_END_TIME].Time.Hour),
|
||||||
&(NewAsg.DateTimes[Asg_END_TIME].Time.Minute));
|
&(NewAsg.DateTimes[Asg_END_TIME].Time.Minute));
|
||||||
NewAsg.DateTimes[Asg_END_TIME].Time.Second = 59;
|
NewAsg.DateTimes[Asg_END_TIME].Time.Second = 59;
|
||||||
|
*/
|
||||||
|
NewAsg.DateTimes[Asg_END_TIME] = Dat_GetDateTimeFromForm ("EndDateTime");
|
||||||
|
|
||||||
/***** Get assignment title *****/
|
/***** Get assignment title *****/
|
||||||
Par_GetParToText ("Title",NewAsg.Title,Asg_MAX_LENGTH_ASSIGNMENT_TITLE);
|
Par_GetParToText ("Title",NewAsg.Title,Asg_MAX_LENGTH_ASSIGNMENT_TITLE);
|
||||||
|
@ -1322,6 +1338,7 @@ void Asg_RecFormAssignment (void)
|
||||||
Par_GetParToHTML ("Txt",Txt,Cns_MAX_BYTES_TEXT); // Store in HTML format (not rigorous)
|
Par_GetParToHTML ("Txt",Txt,Cns_MAX_BYTES_TEXT); // Store in HTML format (not rigorous)
|
||||||
|
|
||||||
/***** Adjust dates *****/
|
/***** Adjust dates *****/
|
||||||
|
/*
|
||||||
if (NewAsg.DateTimes[Asg_START_TIME].Date.Day == 0 ||
|
if (NewAsg.DateTimes[Asg_START_TIME].Date.Day == 0 ||
|
||||||
NewAsg.DateTimes[Asg_START_TIME].Date.Month == 0 ||
|
NewAsg.DateTimes[Asg_START_TIME].Date.Month == 0 ||
|
||||||
NewAsg.DateTimes[Asg_START_TIME].Date.Year == 0)
|
NewAsg.DateTimes[Asg_START_TIME].Date.Year == 0)
|
||||||
|
@ -1342,6 +1359,11 @@ void Asg_RecFormAssignment (void)
|
||||||
NewAsg.DateTimes[Asg_END_TIME].Time.Hour = 23;
|
NewAsg.DateTimes[Asg_END_TIME].Time.Hour = 23;
|
||||||
NewAsg.DateTimes[Asg_END_TIME].Time.Minute = 59;
|
NewAsg.DateTimes[Asg_END_TIME].Time.Minute = 59;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
if (NewAsg.DateTimes[Asg_START_TIME] == 0)
|
||||||
|
NewAsg.DateTimes[Asg_START_TIME] = Gbl.TimeStartExecution;
|
||||||
|
if (NewAsg.DateTimes[Asg_END_TIME] == 0)
|
||||||
|
NewAsg.DateTimes[Asg_END_TIME] = NewAsg.DateTimes[Asg_START_TIME] + 2*60*60; // +2 hours
|
||||||
|
|
||||||
/***** Check if title is correct *****/
|
/***** Check if title is correct *****/
|
||||||
if (NewAsg.Title[0]) // If there's an assignment title
|
if (NewAsg.Title[0]) // If there's an assignment title
|
||||||
|
@ -1450,6 +1472,7 @@ static void Asg_CreateAssignment (struct Assignment *Asg,const char *Txt)
|
||||||
char Query[1024+Cns_MAX_BYTES_TEXT];
|
char Query[1024+Cns_MAX_BYTES_TEXT];
|
||||||
|
|
||||||
/***** Create a new assignment *****/
|
/***** Create a new assignment *****/
|
||||||
|
/*
|
||||||
sprintf (Query,"INSERT INTO assignments (CrsCod,UsrCod,StartTime,EndTime,Title,Folder,Txt)"
|
sprintf (Query,"INSERT INTO assignments (CrsCod,UsrCod,StartTime,EndTime,Title,Folder,Txt)"
|
||||||
" VALUES ('%ld','%ld','%04u%02u%02u%02u%02u%02u','%04u%02u%02u%02u%02u%02u','%s','%s','%s')",
|
" VALUES ('%ld','%ld','%04u%02u%02u%02u%02u%02u','%04u%02u%02u%02u%02u%02u','%s','%s','%s')",
|
||||||
Gbl.CurrentCrs.Crs.CrsCod,
|
Gbl.CurrentCrs.Crs.CrsCod,
|
||||||
|
@ -1469,6 +1492,19 @@ static void Asg_CreateAssignment (struct Assignment *Asg,const char *Txt)
|
||||||
Asg->Title,
|
Asg->Title,
|
||||||
Asg->Folder,
|
Asg->Folder,
|
||||||
Txt);
|
Txt);
|
||||||
|
*/
|
||||||
|
sprintf (Query,"INSERT INTO assignments"
|
||||||
|
" (CrsCod,UsrCod,StartTime,EndTime,Title,Folder,Txt)"
|
||||||
|
" VALUES"
|
||||||
|
" ('%ld','%ld',FROM_UNIXTIME('%ld'),FROM_UNIXTIME('%ld'),"
|
||||||
|
"'%s','%s','%s')",
|
||||||
|
Gbl.CurrentCrs.Crs.CrsCod,
|
||||||
|
Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||||
|
Asg->DateTimes[Asg_START_TIME],
|
||||||
|
Asg->DateTimes[Asg_END_TIME ],
|
||||||
|
Asg->Title,
|
||||||
|
Asg->Folder,
|
||||||
|
Txt);
|
||||||
Asg->AsgCod = DB_QueryINSERTandReturnCode (Query,"can not create new assignment");
|
Asg->AsgCod = DB_QueryINSERTandReturnCode (Query,"can not create new assignment");
|
||||||
|
|
||||||
/***** Create groups *****/
|
/***** Create groups *****/
|
||||||
|
@ -1491,7 +1527,9 @@ static void Asg_UpdateAssignment (struct Assignment *Asg,const char *Txt)
|
||||||
char Query[1024+Cns_MAX_BYTES_TEXT];
|
char Query[1024+Cns_MAX_BYTES_TEXT];
|
||||||
|
|
||||||
/***** Update the data of the assignment *****/
|
/***** Update the data of the assignment *****/
|
||||||
sprintf (Query,"UPDATE assignments SET StartTime='%04u%02u%02u%02u%02u%02u',EndTime='%04u%02u%02u%02u%02u%02u',"
|
/*
|
||||||
|
sprintf (Query,"UPDATE assignments"
|
||||||
|
" SET StartTime='%04u%02u%02u%02u%02u%02u',EndTime='%04u%02u%02u%02u%02u%02u',"
|
||||||
"Title='%s',Folder='%s',Txt='%s'"
|
"Title='%s',Folder='%s',Txt='%s'"
|
||||||
" WHERE AsgCod='%ld' AND CrsCod='%ld'",
|
" WHERE AsgCod='%ld' AND CrsCod='%ld'",
|
||||||
Asg->DateTimes[Asg_START_TIME].Date.Year,
|
Asg->DateTimes[Asg_START_TIME].Date.Year,
|
||||||
|
@ -1510,6 +1548,18 @@ static void Asg_UpdateAssignment (struct Assignment *Asg,const char *Txt)
|
||||||
Asg->Folder,
|
Asg->Folder,
|
||||||
Txt,
|
Txt,
|
||||||
Asg->AsgCod,Gbl.CurrentCrs.Crs.CrsCod);
|
Asg->AsgCod,Gbl.CurrentCrs.Crs.CrsCod);
|
||||||
|
*/
|
||||||
|
sprintf (Query,"UPDATE assignments SET "
|
||||||
|
"StartTime=FROM_UNIXTIME('%ld'),"
|
||||||
|
"EndTime=FROM_UNIXTIME('%ld'),"
|
||||||
|
"Title='%s',Folder='%s',Txt='%s'"
|
||||||
|
" WHERE AsgCod='%ld' AND CrsCod='%ld'",
|
||||||
|
Asg->DateTimes[Asg_START_TIME],
|
||||||
|
Asg->DateTimes[Asg_END_TIME ],
|
||||||
|
Asg->Title,
|
||||||
|
Asg->Folder,
|
||||||
|
Txt,
|
||||||
|
Asg->AsgCod,Gbl.CurrentCrs.Crs.CrsCod);
|
||||||
DB_QueryUPDATE (Query,"can not update assignment");
|
DB_QueryUPDATE (Query,"can not update assignment");
|
||||||
|
|
||||||
/***** Update groups *****/
|
/***** Update groups *****/
|
||||||
|
|
|
@ -57,7 +57,8 @@ struct Assignment
|
||||||
long AsgCod;
|
long AsgCod;
|
||||||
bool Hidden;
|
bool Hidden;
|
||||||
long UsrCod;
|
long UsrCod;
|
||||||
struct DateTime DateTimes[Asg_NUM_DATES];
|
// struct DateTime DateTimes[Asg_NUM_DATES];
|
||||||
|
time_t DateTimes[Asg_NUM_DATES];
|
||||||
bool Open;
|
bool Open;
|
||||||
char Title[Asg_MAX_LENGTH_ASSIGNMENT_TITLE+1];
|
char Title[Asg_MAX_LENGTH_ASSIGNMENT_TITLE+1];
|
||||||
Asg_SendWork_t SendWork;
|
Asg_SendWork_t SendWork;
|
||||||
|
|
|
@ -107,11 +107,12 @@
|
||||||
/****************************** Public constants *****************************/
|
/****************************** Public constants *****************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
#define Log_PLATFORM_VERSION "SWAD 15.15.3 (2015/10/21)"
|
#define Log_PLATFORM_VERSION "SWAD 15.16 (2015/10/22)"
|
||||||
|
|
||||||
// Number of lines (includes comments but not blank lines) has been got with the following command:
|
// 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
|
// nl swad*.c swad*.h css/swad*.css py/swad*.py js/swad*.js soap/swad*.h sql/swad*.sql | tail -1
|
||||||
/*
|
/*
|
||||||
|
Version 15.16: Oct 22, 2015 Assignment date-times are displayed in client local date-time. Not finished. (186436 lines)
|
||||||
Version 15.15.3: Oct 21, 2015 File date-time is displayed in client local date-time. (186264 lines)
|
Version 15.15.3: Oct 21, 2015 File date-time is displayed in client local date-time. (186264 lines)
|
||||||
Version 15.15.2: Oct 21, 2015 Fixed bug in client local date-time. (186254 lines)
|
Version 15.15.2: Oct 21, 2015 Fixed bug in client local date-time. (186254 lines)
|
||||||
Version 15.15.1: Oct 21, 2015 Top-left date-time is now displayed in local time. (186249 lines)
|
Version 15.15.1: Oct 21, 2015 Top-left date-time is now displayed in local time. (186249 lines)
|
||||||
|
|
181
swad_date.c
181
swad_date.c
|
@ -101,6 +101,20 @@ void Dat_GetAndConvertCurrentDateTime (void)
|
||||||
Dat_GetDateBefore (&Gbl.Now.Date,&Gbl.Yesterday);
|
Dat_GetDateBefore (&Gbl.Now.Date,&Gbl.Yesterday);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/************ Get UNIX time (seconds since 1970 UTC) from string *************/
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
time_t Dat_GetUNIXTimeFromStr (const char *Str)
|
||||||
|
{
|
||||||
|
time_t Time;
|
||||||
|
|
||||||
|
if (sscanf (Str,"%ld",&Time) != 1)
|
||||||
|
Time = (time_t) 0;
|
||||||
|
|
||||||
|
return Time;
|
||||||
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/*********** Get a struct Date from a string in YYYYMMDD format **************/
|
/*********** Get a struct Date from a string in YYYYMMDD format **************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -152,40 +166,13 @@ bool Dat_GetDateTimeFromYYYYMMDDHHMMSS (struct DateTime *DateTime,const char *YY
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/***************************** Show date ant time ****************************/
|
/******************** Write div for client local time ************************/
|
||||||
/*****************************************************************************/
|
|
||||||
/*
|
|
||||||
void Dat_ShowCurrentDateTime (void)
|
|
||||||
{
|
|
||||||
extern const char *The_ClassCurrentTime[The_NUM_THEMES];
|
|
||||||
extern const char *Txt_MONTHS_SMALL_SHORT[12];
|
|
||||||
|
|
||||||
fprintf (Gbl.F.Out,"<div id=\"hm\" class=\"%s\""
|
|
||||||
" style=\"padding-top:10px;\">"
|
|
||||||
"%u %s, %u:%02u"
|
|
||||||
"</div>",
|
|
||||||
The_ClassCurrentTime[Gbl.Prefs.Theme],
|
|
||||||
Gbl.Now.Date.Day,
|
|
||||||
Txt_MONTHS_SMALL_SHORT[Gbl.Now.Date.Month-1],
|
|
||||||
Gbl.Now.Time.Hour,Gbl.Now.Time.Minute);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
/*****************************************************************************/
|
|
||||||
/***************************** Show date ant time ****************************/
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
void Dat_ShowCurrentDateTime (void)
|
void Dat_ShowClientLocalTime (void)
|
||||||
{
|
{
|
||||||
extern const char *The_ClassCurrentTime[The_NUM_THEMES];
|
extern const char *The_ClassCurrentTime[The_NUM_THEMES];
|
||||||
/*
|
|
||||||
<script type="text/javascript">
|
|
||||||
function localize(t)
|
|
||||||
{
|
|
||||||
var d=new Date(t+" UTC");
|
|
||||||
document.write(d.toString());
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
*/
|
|
||||||
fprintf (Gbl.F.Out,"<div id=\"hm\" class=\"%s\""
|
fprintf (Gbl.F.Out,"<div id=\"hm\" class=\"%s\""
|
||||||
" style=\"padding-top:10px;\">"
|
" style=\"padding-top:10px;\">"
|
||||||
"</div>",
|
"</div>",
|
||||||
|
@ -279,6 +266,137 @@ void Dat_WriteFormIniEndDates (void)
|
||||||
"</tr>");
|
"</tr>");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/************************* Show a form to enter a date ***********************/
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
void Dat_WriteFormClientLocalDateTime (unsigned FirstYear,unsigned LastYear,
|
||||||
|
const char *NameSelectDay,
|
||||||
|
const char *NameSelectMonth,
|
||||||
|
const char *NameSelectYear,
|
||||||
|
const char *NameSelectHour,
|
||||||
|
const char *NameSelectMinute,
|
||||||
|
bool SubmitFormOnChange,bool Disabled)
|
||||||
|
{
|
||||||
|
extern const char *Txt_MONTHS_SMALL[12];
|
||||||
|
unsigned Day;
|
||||||
|
unsigned Month;
|
||||||
|
unsigned Year;
|
||||||
|
unsigned Hour;
|
||||||
|
unsigned Minute;
|
||||||
|
|
||||||
|
/***** Day *****/
|
||||||
|
fprintf (Gbl.F.Out,"<table>"
|
||||||
|
"<tr>"
|
||||||
|
"<td class=\"CENTER_MIDDLE\">"
|
||||||
|
"<select id=\"%s\" name=\"%s\"",
|
||||||
|
NameSelectDay,NameSelectDay);
|
||||||
|
if (SubmitFormOnChange)
|
||||||
|
fprintf (Gbl.F.Out," onchange=\"javascript:document.getElementById('%s').submit();\"",
|
||||||
|
Gbl.FormId);
|
||||||
|
if (Disabled)
|
||||||
|
fprintf (Gbl.F.Out," disabled=\"disabled\"");
|
||||||
|
fprintf (Gbl.F.Out,"><option value=\"0\">-</option>");
|
||||||
|
for (Day = 1;
|
||||||
|
Day <= 31;
|
||||||
|
Day++)
|
||||||
|
fprintf (Gbl.F.Out,"<option value=\"%u\">%u</option>",
|
||||||
|
Day,Day);
|
||||||
|
|
||||||
|
/***** Month *****/
|
||||||
|
fprintf (Gbl.F.Out,"</select>"
|
||||||
|
"</td>"
|
||||||
|
"<td class=\"CENTER_MIDDLE\">"
|
||||||
|
"<select id=\"%s\" name=\"%s\""
|
||||||
|
" onchange=\"adjustDateForm(this.form.%s,this.form.%s,this.form.%s)",
|
||||||
|
NameSelectMonth,NameSelectMonth,NameSelectDay,NameSelectMonth,NameSelectYear);
|
||||||
|
if (SubmitFormOnChange)
|
||||||
|
fprintf (Gbl.F.Out,";javascript:document.getElementById('%s').submit();",
|
||||||
|
Gbl.FormId);
|
||||||
|
fprintf (Gbl.F.Out,"\"");
|
||||||
|
if (Disabled)
|
||||||
|
fprintf (Gbl.F.Out," disabled=\"disabled\"");
|
||||||
|
fprintf (Gbl.F.Out,"><option value=\"0\">-</option>");
|
||||||
|
for (Month = 1;
|
||||||
|
Month <= 12;
|
||||||
|
Month++)
|
||||||
|
fprintf (Gbl.F.Out,"<option value=\"%u\">%s</option>",
|
||||||
|
Month,Txt_MONTHS_SMALL[Month-1]);
|
||||||
|
|
||||||
|
/***** Year *****/
|
||||||
|
fprintf (Gbl.F.Out,"</select>"
|
||||||
|
"</td>"
|
||||||
|
"<td class=\"CENTER_MIDDLE\">"
|
||||||
|
"<select id=\"%s\" name=\"%s\" onchange=\"adjustDateForm(this.form.%s,this.form.%s,this.form.%s)",
|
||||||
|
NameSelectYear,NameSelectYear,NameSelectDay,NameSelectMonth,NameSelectYear);
|
||||||
|
if (SubmitFormOnChange)
|
||||||
|
fprintf (Gbl.F.Out,";javascript:document.getElementById('%s').submit();",
|
||||||
|
Gbl.FormId);
|
||||||
|
fprintf (Gbl.F.Out,"\"");
|
||||||
|
if (Disabled)
|
||||||
|
fprintf (Gbl.F.Out," disabled=\"disabled\"");
|
||||||
|
fprintf (Gbl.F.Out,"><option value=\"0\">-</option>");
|
||||||
|
for (Year = FirstYear;
|
||||||
|
Year <= LastYear;
|
||||||
|
Year++)
|
||||||
|
fprintf (Gbl.F.Out,"<option value=\"%u\">%u</option>",
|
||||||
|
Year,Year);
|
||||||
|
fprintf (Gbl.F.Out,"</select>"
|
||||||
|
"</td>");
|
||||||
|
|
||||||
|
/***** Hour *****/
|
||||||
|
fprintf (Gbl.F.Out,"<td class=\"LEFT_MIDDLE\">"
|
||||||
|
"<select name=\"%s\"",
|
||||||
|
NameSelectHour);
|
||||||
|
if (SubmitFormOnChange)
|
||||||
|
fprintf (Gbl.F.Out," onchange=\"javascript:document.getElementById('%s').submit();\"",
|
||||||
|
Gbl.FormId);
|
||||||
|
if (Disabled)
|
||||||
|
fprintf (Gbl.F.Out," disabled=\"disabled\"");
|
||||||
|
fprintf (Gbl.F.Out,">");
|
||||||
|
for (Hour = 0;
|
||||||
|
Hour <= 23;
|
||||||
|
Hour++)
|
||||||
|
fprintf (Gbl.F.Out,"<option value=\"%u\">%02u h</option>",
|
||||||
|
Hour,Hour);
|
||||||
|
|
||||||
|
/***** Minute *****/
|
||||||
|
fprintf (Gbl.F.Out,"</select>"
|
||||||
|
"</td>"
|
||||||
|
"<td class=\"LEFT_MIDDLE\">"
|
||||||
|
"<select name=\"%s\"",
|
||||||
|
NameSelectMinute);
|
||||||
|
if (SubmitFormOnChange)
|
||||||
|
fprintf (Gbl.F.Out," onchange=\"javascript:document.getElementById('%s').submit();\"",
|
||||||
|
Gbl.FormId);
|
||||||
|
if (Disabled)
|
||||||
|
fprintf (Gbl.F.Out," disabled=\"disabled\"");
|
||||||
|
fprintf (Gbl.F.Out,">");
|
||||||
|
for (Minute = 0;
|
||||||
|
Minute <= 59;
|
||||||
|
Minute++)
|
||||||
|
fprintf (Gbl.F.Out,"<option value=\"%u\">%02u '</option>",
|
||||||
|
Minute,Minute);
|
||||||
|
fprintf (Gbl.F.Out,"</select>"
|
||||||
|
"</td>"
|
||||||
|
"</tr>"
|
||||||
|
"</table>");
|
||||||
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/***************** Get an hour-minute time from a form ***********************/
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
time_t Dat_GetDateTimeFromForm (const char *NameParam)
|
||||||
|
{
|
||||||
|
char LongStr[1+10+1];
|
||||||
|
|
||||||
|
/**** Get time ****/
|
||||||
|
Par_GetParToText (NameParam,LongStr,1+10);
|
||||||
|
return Dat_GetUNIXTimeFromStr (LongStr);
|
||||||
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/************************* Show a form to enter a date ***********************/
|
/************************* Show a form to enter a date ***********************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -391,7 +509,8 @@ void Dat_WriteFormHourMinute (const char *NameSelectHour,const char *NameSelectM
|
||||||
struct Time *TimeSelected,
|
struct Time *TimeSelected,
|
||||||
bool SubmitFormOnChange,bool Disabled)
|
bool SubmitFormOnChange,bool Disabled)
|
||||||
{
|
{
|
||||||
unsigned Hour,Minute;
|
unsigned Hour;
|
||||||
|
unsigned Minute;
|
||||||
|
|
||||||
/***** Hour *****/
|
/***** Hour *****/
|
||||||
fprintf (Gbl.F.Out,"<table>"
|
fprintf (Gbl.F.Out,"<table>"
|
||||||
|
|
13
swad_date.h
13
swad_date.h
|
@ -68,15 +68,26 @@ struct DateTime
|
||||||
void Dat_GetTimeStartExecution (void);
|
void Dat_GetTimeStartExecution (void);
|
||||||
void Dat_GetAndConvertCurrentDateTime (void);
|
void Dat_GetAndConvertCurrentDateTime (void);
|
||||||
|
|
||||||
|
time_t Dat_GetUNIXTimeFromStr (const char *Str);
|
||||||
bool Dat_GetDateFromYYYYMMDD (struct Date *Date,const char *YYYYMMDDString);
|
bool Dat_GetDateFromYYYYMMDD (struct Date *Date,const char *YYYYMMDDString);
|
||||||
bool Dat_GetDateTimeFromYYYYMMDDHHMMSS (struct DateTime *DateTime,const char *YYYYMMDDHHMMSS);
|
bool Dat_GetDateTimeFromYYYYMMDDHHMMSS (struct DateTime *DateTime,const char *YYYYMMDDHHMMSS);
|
||||||
|
|
||||||
void Dat_ShowCurrentDateTime (void);
|
void Dat_ShowClientLocalTime (void);
|
||||||
|
|
||||||
void Dat_GetLocalTimeFromClock (const time_t *clock);
|
void Dat_GetLocalTimeFromClock (const time_t *clock);
|
||||||
void Dat_ConvDateToDateStr (struct Date *Date,char *DateStr);
|
void Dat_ConvDateToDateStr (struct Date *Date,char *DateStr);
|
||||||
|
|
||||||
void Dat_WriteFormIniEndDates (void);
|
void Dat_WriteFormIniEndDates (void);
|
||||||
|
|
||||||
|
void Dat_WriteFormClientLocalDateTime (unsigned FirstYear,unsigned LastYear,
|
||||||
|
const char *NameSelectDay,
|
||||||
|
const char *NameSelectMonth,
|
||||||
|
const char *NameSelectYear,
|
||||||
|
const char *NameSelectHour,
|
||||||
|
const char *NameSelectMinute,
|
||||||
|
bool SubmitFormOnChange,bool Disabled);
|
||||||
|
time_t Dat_GetDateTimeFromForm (const char *NameParam);
|
||||||
|
|
||||||
void Dat_WriteFormDate (unsigned FirstYear,unsigned LastYear,
|
void Dat_WriteFormDate (unsigned FirstYear,unsigned LastYear,
|
||||||
const char *NameSelectDay,
|
const char *NameSelectDay,
|
||||||
const char *NameSelectMonth,
|
const char *NameSelectMonth,
|
||||||
|
|
|
@ -5765,6 +5765,7 @@ void Brw_ParamListFiles (Brw_FileType_t FileType,const char *PathInTree,const ch
|
||||||
static void Brw_WriteDatesAssignment (void)
|
static void Brw_WriteDatesAssignment (void)
|
||||||
{
|
{
|
||||||
extern const char *Txt_unknown_assignment;
|
extern const char *Txt_unknown_assignment;
|
||||||
|
static unsigned UniqueId;
|
||||||
|
|
||||||
fprintf (Gbl.F.Out,"<td colspan=\"2\""
|
fprintf (Gbl.F.Out,"<td colspan=\"2\""
|
||||||
" class=\"ASG_LST_DATE_GREEN RIGHT_MIDDLE COLOR%u\">",
|
" class=\"ASG_LST_DATE_GREEN RIGHT_MIDDLE COLOR%u\">",
|
||||||
|
@ -5772,20 +5773,21 @@ static void Brw_WriteDatesAssignment (void)
|
||||||
|
|
||||||
if (Gbl.FileBrowser.Asg.AsgCod > 0)
|
if (Gbl.FileBrowser.Asg.AsgCod > 0)
|
||||||
{
|
{
|
||||||
fprintf (Gbl.F.Out,"<table>"
|
UniqueId++;
|
||||||
"<tr>");
|
|
||||||
|
|
||||||
/***** Write start date *****/
|
/***** Write start date *****/
|
||||||
fprintf (Gbl.F.Out,"<td class=\"%s RIGHT_MIDDLE\">"
|
fprintf (Gbl.F.Out,"<table>"
|
||||||
" %02u/%02u/%02u %02u:%02u"
|
"<tr>"
|
||||||
"</td>",
|
"<td id=\"asg_start_date%u\" class=\"%s RIGHT_MIDDLE\">",
|
||||||
|
UniqueId,
|
||||||
Gbl.FileBrowser.Asg.Open ? "ASG_LST_DATE_GREEN" :
|
Gbl.FileBrowser.Asg.Open ? "ASG_LST_DATE_GREEN" :
|
||||||
"ASG_LST_DATE_RED",
|
"ASG_LST_DATE_RED");
|
||||||
Gbl.FileBrowser.Asg.DateTimes[Asg_START_TIME].Date.Day,
|
fprintf (Gbl.F.Out,"<script type=\"text/javascript\">"
|
||||||
Gbl.FileBrowser.Asg.DateTimes[Asg_START_TIME].Date.Month,
|
"writeLocalDateTimeFromUTC('asg_start_date%u',%ld);"
|
||||||
Gbl.FileBrowser.Asg.DateTimes[Asg_START_TIME].Date.Year % 100,
|
"</script>",
|
||||||
Gbl.FileBrowser.Asg.DateTimes[Asg_START_TIME].Time.Hour,
|
UniqueId,
|
||||||
Gbl.FileBrowser.Asg.DateTimes[Asg_START_TIME].Time.Minute);
|
(long) Gbl.FileBrowser.Asg.DateTimes[Asg_START_TIME]);
|
||||||
|
fprintf (Gbl.F.Out,"</td>");
|
||||||
|
|
||||||
/***** Arrow *****/
|
/***** Arrow *****/
|
||||||
fprintf (Gbl.F.Out,"<td class=\"RIGHT_MIDDLE\" style=\"width:20px;\">"
|
fprintf (Gbl.F.Out,"<td class=\"RIGHT_MIDDLE\" style=\"width:20px;\">"
|
||||||
|
@ -5797,19 +5799,18 @@ static void Brw_WriteDatesAssignment (void)
|
||||||
Gbl.FileBrowser.Asg.Open ? "green" :
|
Gbl.FileBrowser.Asg.Open ? "green" :
|
||||||
"red");
|
"red");
|
||||||
|
|
||||||
/***** Write start date *****/
|
/***** Write end date *****/
|
||||||
fprintf (Gbl.F.Out,"<td class=\"%s RIGHT_MIDDLE\">"
|
fprintf (Gbl.F.Out,"<td id=\"asg_end_date%u\" class=\"%s RIGHT_MIDDLE\">",
|
||||||
"%02u/%02u/%02u %02u:%02u"
|
UniqueId,
|
||||||
"</td>",
|
|
||||||
Gbl.FileBrowser.Asg.Open ? "ASG_LST_DATE_GREEN" :
|
Gbl.FileBrowser.Asg.Open ? "ASG_LST_DATE_GREEN" :
|
||||||
"ASG_LST_DATE_RED",
|
"ASG_LST_DATE_RED");
|
||||||
Gbl.FileBrowser.Asg.DateTimes[Asg_END_TIME].Date.Day,
|
fprintf (Gbl.F.Out,"<script type=\"text/javascript\">"
|
||||||
Gbl.FileBrowser.Asg.DateTimes[Asg_END_TIME].Date.Month,
|
"writeLocalDateTimeFromUTC('asg_end_date%u',%ld);"
|
||||||
Gbl.FileBrowser.Asg.DateTimes[Asg_END_TIME].Date.Year % 100,
|
"</script>",
|
||||||
Gbl.FileBrowser.Asg.DateTimes[Asg_END_TIME].Time.Hour,
|
UniqueId,
|
||||||
Gbl.FileBrowser.Asg.DateTimes[Asg_END_TIME].Time.Minute);
|
(long) Gbl.FileBrowser.Asg.DateTimes[Asg_END_TIME]);
|
||||||
|
fprintf (Gbl.F.Out,"</td>"
|
||||||
fprintf (Gbl.F.Out,"</tr>"
|
"</tr>"
|
||||||
"</table>");
|
"</table>");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -705,7 +705,7 @@ static void Lay_WritePageTopHeading (void)
|
||||||
/* Clock with hour:minute (server hour is shown) */
|
/* Clock with hour:minute (server hour is shown) */
|
||||||
fprintf (Gbl.F.Out,"<td class=\"CENTER_TOP\""
|
fprintf (Gbl.F.Out,"<td class=\"CENTER_TOP\""
|
||||||
" style=\"width:160px; height:80px;\">");
|
" style=\"width:160px; height:80px;\">");
|
||||||
Dat_ShowCurrentDateTime ();
|
Dat_ShowClientLocalTime ();
|
||||||
fprintf (Gbl.F.Out,"</td>"); // End of first column
|
fprintf (Gbl.F.Out,"</td>"); // End of first column
|
||||||
|
|
||||||
/***** 2nd. row, 2nd. column: degree and course *****/
|
/***** 2nd. row, 2nd. column: degree and course *****/
|
||||||
|
|
Loading…
Reference in New Issue