diff --git a/swad_assignment.c b/swad_assignment.c index c21e5d779..e3b3ccd7d 100644 --- a/swad_assignment.c +++ b/swad_assignment.c @@ -1005,8 +1005,6 @@ void Asg_RequestCreatOrEditAsg (void) extern const char *The_ClassForm[The_NUM_THEMES]; extern const char *Txt_New_assignment; extern const char *Txt_Edit_assignment; - extern const char *Txt_Start_date; - extern const char *Txt_End_date; extern const char *Txt_Title; extern const char *Txt_Upload_files_QUESTION; extern const char *Txt_Folder; @@ -1015,9 +1013,6 @@ void Asg_RequestCreatOrEditAsg (void) extern const char *Txt_Save; struct Assignment Asg; bool ItsANewAssignment; - Asg_StartOrEndTime_t StartOrEndTime; - const char *Id[Asg_NUM_DATES] = {"Start","End"}; - const char *Dates[Asg_NUM_DATES] = {Txt_Start_date,Txt_End_date}; char Txt[Cns_MAX_BYTES_TEXT+1]; /***** Get parameters *****/ @@ -1081,34 +1076,7 @@ void Asg_RequestCreatOrEditAsg (void) Asg_MAX_LENGTH_ASSIGNMENT_TITLE,Asg.Title); /***** Assignment start and end dates *****/ - for (StartOrEndTime = Asg_START_TIME; - StartOrEndTime <= Asg_END_TIME; - StartOrEndTime++) - { - fprintf (Gbl.F.Out,"" - "" - "%s:" - "" - "" - "" - "" - "" - "" - "
", - The_ClassForm[Gbl.Prefs.Theme], - Dates[StartOrEndTime]); - - /* Date-time */ - Dat_WriteFormClientLocalDateTime (Id[StartOrEndTime], - Asg.TimeUTC[StartOrEndTime], - Gbl.Now.Date.Year - 1, - Gbl.Now.Date.Year + 1, - false,false); - - fprintf (Gbl.F.Out,"
" - "" - ""); - } + Dat_PutFormStartEndClientLocalDateTimes (Asg.TimeUTC); /***** Send work? *****/ fprintf (Gbl.F.Out,"" diff --git a/swad_attendance.c b/swad_attendance.c index cf2d4ca5d..6de81e131 100644 --- a/swad_attendance.c +++ b/swad_attendance.c @@ -975,8 +975,6 @@ void Att_RequestCreatOrEditAttEvent (void) extern const char *Txt_New_event; extern const char *Txt_Edit_event; extern const char *Txt_Teachers_comment; - extern const char *Txt_Start_date; - extern const char *Txt_End_date; extern const char *Txt_Title; extern const char *Txt_Hidden_MALE_PLURAL; extern const char *Txt_Visible_MALE_PLURAL; @@ -985,9 +983,6 @@ void Att_RequestCreatOrEditAttEvent (void) extern const char *Txt_Save; struct AttendanceEvent Att; bool ItsANewAttEvent; - Att_StartOrEndTime_t StartOrEndTime; - const char *Id[Att_NUM_DATES] = {"Start","End"}; - const char *Dates[Att_NUM_DATES] = {Txt_Start_date,Txt_End_date}; char Txt[Cns_MAX_BYTES_TEXT+1]; /***** Get parameters *****/ @@ -1046,33 +1041,8 @@ void Att_RequestCreatOrEditAttEvent (void) The_ClassForm[Gbl.Prefs.Theme],Txt_Title, Att_MAX_LENGTH_ATTENDANCE_EVENT_TITLE,Att.Title); - /***** Attendance event start and end dates *****/ - for (StartOrEndTime = Att_START_TIME; - StartOrEndTime <= Att_END_TIME; - StartOrEndTime++) - { - fprintf (Gbl.F.Out,"" - "" - "%s:" - "" - "" - "" - "" - "" - "
", - The_ClassForm[Gbl.Prefs.Theme], - Dates[StartOrEndTime]); - - /* Date-time */ - Dat_WriteFormClientLocalDateTime (Id[StartOrEndTime], - Att.TimeUTC[StartOrEndTime], - Gbl.Now.Date.Year - 1, - Gbl.Now.Date.Year + 1, - false,false); - - fprintf (Gbl.F.Out,"
" - ""); - } + /***** Assignment start and end dates *****/ + Dat_PutFormStartEndClientLocalDateTimes (Att.TimeUTC); /***** Visibility of comments *****/ fprintf (Gbl.F.Out,"" diff --git a/swad_changelog.h b/swad_changelog.h index cbc33c887..5c01048de 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -108,11 +108,12 @@ /****************************** Public constants *****************************/ /*****************************************************************************/ -#define Log_PLATFORM_VERSION "SWAD 15.20.1 (2015/10/24)" +#define Log_PLATFORM_VERSION "SWAD 15.20.2 (2015/10/24)" // 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 15.20.2: Oct 24, 2015 Code refactoring related to date-times forms. (186294 lines) Version 15.20.1: Oct 24, 2015 Detailed clics are displayed in client local date-time. (186333 lines) Version 15.20: Oct 24, 2015 Date-times in notifications, messages and forums are displayed in client local date-time. (186334 lines) Version 15.19: Oct 23, 2015 Surveys date-times are displayed in client local date-time. (186309 lines) diff --git a/swad_date.c b/swad_date.c index 6e982c229..3ce5c566c 100644 --- a/swad_date.c +++ b/swad_date.c @@ -63,6 +63,11 @@ const unsigned Dat_NumDaysMonth[1+12] = /***************************** Private prototypes ****************************/ /*****************************************************************************/ +static void Dat_WriteFormClientLocalDateTime (const char *Id, + time_t TimeUTC, + unsigned FirstYear,unsigned LastYear, + bool SubmitFormOnChange,bool Disabled); + /*****************************************************************************/ /***************************** Get current time ******************************/ /*****************************************************************************/ @@ -267,14 +272,65 @@ void Dat_WriteFormIniEndDates (void) } +/*****************************************************************************/ +/************* Show forms to enter initial and ending date-times *************/ +/*****************************************************************************/ + +void Dat_PutFormStartEndClientLocalDateTimes (time_t TimeUTC[2]) + { + extern const char *The_ClassForm[The_NUM_THEMES]; + extern const char *Txt_Start_date; + extern const char *Txt_End_date; + Asg_StartOrEndTime_t StartOrEndTime; + const char *Id[Asg_NUM_DATES] = + { + "Start", + "End" + }; + const char *Dates[Asg_NUM_DATES] = + { + Txt_Start_date, + Txt_End_date + }; + + for (StartOrEndTime = 0; + StartOrEndTime <= 1; + StartOrEndTime++) + { + fprintf (Gbl.F.Out,"" + "" + "%s:" + "" + "" + "" + "" + "" + "" + "
", + The_ClassForm[Gbl.Prefs.Theme], + Dates[StartOrEndTime]); + + /* Date-time */ + Dat_WriteFormClientLocalDateTime (Id[StartOrEndTime], + TimeUTC[StartOrEndTime], + Gbl.Now.Date.Year - 1, + Gbl.Now.Date.Year + 1, + false,false); + + fprintf (Gbl.F.Out,"
" + "" + ""); + } + } + /*****************************************************************************/ /************************* Show a form to enter a date ***********************/ /*****************************************************************************/ -void Dat_WriteFormClientLocalDateTime (const char *Id, - time_t TimeUTC, - unsigned FirstYear,unsigned LastYear, - bool SubmitFormOnChange,bool Disabled) +static void Dat_WriteFormClientLocalDateTime (const char *Id, + time_t TimeUTC, + unsigned FirstYear,unsigned LastYear, + bool SubmitFormOnChange,bool Disabled) { extern const char *Txt_MONTHS_SMALL[12]; unsigned Day; diff --git a/swad_date.h b/swad_date.h index 083a39253..9ba02af28 100644 --- a/swad_date.h +++ b/swad_date.h @@ -78,11 +78,8 @@ void Dat_GetLocalTimeFromClock (const time_t *clock); void Dat_ConvDateToDateStr (struct Date *Date,char *DateStr); void Dat_WriteFormIniEndDates (void); +void Dat_PutFormStartEndClientLocalDateTimes (time_t TimeUTC[2]); -void Dat_WriteFormClientLocalDateTime (const char *Id, - time_t TimeUTC, - unsigned FirstYear,unsigned LastYear, - bool SubmitFormOnChange,bool Disabled); time_t Dat_GetTimeUTCFromForm (const char *ParamName); void Dat_WriteFormDate (unsigned FirstYear,unsigned LastYear, diff --git a/swad_enrollment.c b/swad_enrollment.c index 4ff1b7974..6ff3cfe67 100644 --- a/swad_enrollment.c +++ b/swad_enrollment.c @@ -2162,7 +2162,6 @@ void Enr_ShowEnrollmentRequests (void) bool ShowPhoto = false; char PhotoURL[PATH_MAX+1]; Rol_Role_t DesiredRole; - time_t RequestTimeUTC; /***** Start frame *****/ Lay_StartRoundFrame (NULL,Txt_Enrollment_requests); @@ -2641,8 +2640,7 @@ void Enr_ShowEnrollmentRequests (void) Txt_ROLES_SINGUL_abc[DesiredRole][UsrDat.Sex]); /***** Request time (row[4]) *****/ - RequestTimeUTC = Dat_GetUNIXTimeFromStr (row[4]); - Msg_WriteMsgDate (RequestTimeUTC,"DAT"); + Msg_WriteMsgDate (Dat_GetUNIXTimeFromStr (row[4]),"DAT"); /***** Button to confirm the request *****/ fprintf (Gbl.F.Out,""); diff --git a/swad_statistic.c b/swad_statistic.c index b1f20de71..96f86eaa2 100644 --- a/swad_statistic.c +++ b/swad_statistic.c @@ -1038,7 +1038,9 @@ static void Sta_ShowHits (Sta_GlobalOrCourseAccesses_t GlobalOrCourse) break; case Sta_CLICKS_CRS_PER_DAYS_AND_HOUR: case Sta_CLICKS_GBL_PER_DAYS_AND_HOUR: - sprintf (Query,"SELECT SQL_NO_CACHE DATE_FORMAT(ClickTime,'%%Y%%m%%d') AS Day,DATE_FORMAT(ClickTime,'%%H') AS Hour,%s FROM %s", + sprintf (Query,"SELECT SQL_NO_CACHE " + "DATE_FORMAT(ClickTime,'%%Y%%m%%d') AS Day," + "DATE_FORMAT(ClickTime,'%%H') AS Hour,%s FROM %s", StrQueryCountType,LogTable); break; case Sta_CLICKS_CRS_PER_WEEKS: @@ -1668,7 +1670,8 @@ static void Sta_ShowDetailedAccessesList (unsigned long NumRows,MYSQL_RES *mysql fprintf (Gbl.F.Out,"" "", + "" + "", UniqueId,Gbl.RowEvenOdd, UniqueId,(long) Dat_GetUNIXTimeFromStr (row[3])); diff --git a/swad_survey.c b/swad_survey.c index f5308b4cd..54857b5b4 100644 --- a/swad_survey.c +++ b/swad_survey.c @@ -1448,8 +1448,6 @@ void Svy_RequestCreatOrEditSvy (void) extern const char *Txt_New_survey; extern const char *Txt_Scope; extern const char *Txt_Edit_survey; - extern const char *Txt_Start_date; - extern const char *Txt_End_date; extern const char *Txt_Title; extern const char *Txt_Description; extern const char *Txt_Users; @@ -1458,9 +1456,6 @@ void Svy_RequestCreatOrEditSvy (void) struct Survey Svy; struct SurveyQuestion SvyQst; bool ItsANewSurvey; - Svy_StartOrEndTime_t StartOrEndTime; - const char *Id[Att_NUM_DATES] = {"Start","End"}; - const char *Dates[Svy_NUM_DATES] = {Txt_Start_date,Txt_End_date}; char Txt[Cns_MAX_BYTES_TEXT+1]; /***** Get parameters *****/ @@ -1552,34 +1547,7 @@ void Svy_RequestCreatOrEditSvy (void) Svy_MAX_LENGTH_SURVEY_TITLE,Svy.Title); /***** Survey start and end dates *****/ - for (StartOrEndTime = Svy_START_TIME; - StartOrEndTime <= Svy_END_TIME; - StartOrEndTime++) - { - fprintf (Gbl.F.Out,"" - "" - "%s:" - "" - "" - "" - "" - "" - "" - "
", - The_ClassForm[Gbl.Prefs.Theme], - Dates[StartOrEndTime]); - - /* Date-time */ - Dat_WriteFormClientLocalDateTime (Id[StartOrEndTime], - Svy.TimeUTC[StartOrEndTime], - Gbl.Now.Date.Year - 1, - Gbl.Now.Date.Year + 1, - false,false); - - fprintf (Gbl.F.Out,"
" - "" - ""); - } + Dat_PutFormStartEndClientLocalDateTimes (Svy.TimeUTC); /***** Survey text *****/ fprintf (Gbl.F.Out,"" diff --git a/swad_text.c b/swad_text.c index d553257bd..bc80d2760 100644 --- a/swad_text.c +++ b/swad_text.c @@ -35218,123 +35218,123 @@ const char *Txt_STAT_CLICKS_GROUPED_BY[Sta_NUM_CLICKS_GROUPED_BY] = #endif , #if L==0 - "dia" + "dia*" #elif L==1 - "Tag" + "Tag*" #elif L==2 - "day" + "day*" #elif L==3 - "día" + "día*" #elif L==4 - "jour" + "jour*" #elif L==5 - "día" // Okoteve traducción + "día*" // Okoteve traducción #elif L==6 - "giorno" + "giorno*" #elif L==7 - "dzień" + "dzień*" #elif L==8 - "dia" + "dia*" #endif , #if L==0 - "dia i hora" + "dia i hora*" #elif L==1 - "Tag und Stunde" + "Tag und Stunde*" #elif L==2 - "day and hour" + "day and hour*" #elif L==3 - "día y hora" + "día y hora*" #elif L==4 - "jour et heure" + "jour et heure*" #elif L==5 - "día y hora" // Okoteve traducción + "día y hora*" // Okoteve traducción #elif L==6 - "giorno e ora" + "giorno e ora*" #elif L==7 - "dzień i godzinę" + "dzień i godzinę*" #elif L==8 - "dia e hora" + "dia e hora*" #endif , #if L==0 - "setmana" + "setmana*" #elif L==1 - "Woche" + "Woche*" #elif L==2 - "week" + "week*" #elif L==3 - "semana" + "semana*" #elif L==4 - "semaine" + "semaine*" #elif L==5 - "arapokõindy" + "arapokõindy*" #elif L==6 - "settimana" + "settimana*" #elif L==7 - "tydzień" + "tydzień*" #elif L==8 - "semana" + "semana*" #endif , #if L==0 - "mes" + "mes*" #elif L==1 - "Monat" + "Monat*" #elif L==2 - "month" + "month*" #elif L==3 - "mes" + "mes*" #elif L==4 - "mois" + "mois*" #elif L==5 - "jasy" + "jasy*" #elif L==6 - "mese" + "mese*" #elif L==7 - "miesiąc" + "miesiąc*" #elif L==8 - "mês" + "mês*" #endif , #if L==0 - "hora" + "hora*" #elif L==1 - "Stunde" + "Stunde*" #elif L==2 - "hour" + "hour*" #elif L==3 - "hora" + "hora*" #elif L==4 - "heure" + "heure*" #elif L==5 - "aravo" + "aravo*" #elif L==6 - "ora" + "ora*" #elif L==7 - "godzina" + "godzina*" #elif L==8 - "hora" + "hora*" #endif , #if L==0 - "minut" + "minut*" #elif L==1 - "Minute" + "Minute*" #elif L==2 - "minute" + "minute*" #elif L==3 - "minuto" + "minuto*" #elif L==4 - "minute" + "minute*" #elif L==5 - "aravo'i" + "aravo'i*" #elif L==6 - "minuto" + "minuto*" #elif L==7 - "minutę" + "minutę*" #elif L==8 - "minuto" + "minuto*" #endif , #if L==0 @@ -35358,123 +35358,123 @@ const char *Txt_STAT_CLICKS_GROUPED_BY[Sta_NUM_CLICKS_GROUPED_BY] = #endif , #if L==0 - "dia" + "dia*" #elif L==1 - "Tag" + "Tag*" #elif L==2 - "day" + "day*" #elif L==3 - "día" + "día*" #elif L==4 - "jour" + "jour*" #elif L==5 - "día" // Okoteve traducción + "día*" // Okoteve traducción #elif L==6 - "giorno" + "giorno*" #elif L==7 - "dzień" + "dzień*" #elif L==8 - "dia" + "dia*" #endif , #if L==0 - "dia i hora" + "dia i hora*" #elif L==1 - "Tag und Stunde" + "Tag und Stunde*" #elif L==2 - "day and hour" + "day and hour*" #elif L==3 - "día y hora" + "día y hora*" #elif L==4 - "jour et heure" + "jour et heure*" #elif L==5 - "día y hora" // Okoteve traducción + "día y hora*" // Okoteve traducción #elif L==6 - "giorno e ora" + "giorno e ora*" #elif L==7 - "dzień i godzinę" + "dzień i godzinę*" #elif L==8 - "dia e hora" + "dia e hora*" #endif , #if L==0 - "setmana" + "setmana*" #elif L==1 - "Woche" + "Woche*" #elif L==2 - "week" + "week*" #elif L==3 - "semana" + "semana*" #elif L==4 - "semaine" + "semaine*" #elif L==5 - "arapokõindy" + "arapokõindy*" #elif L==6 - "settimana" + "settimana*" #elif L==7 - "tydzień" + "tydzień*" #elif L==8 - "semana" + "semana*" #endif , #if L==0 - "mes" + "mes*" #elif L==1 - "Monat" + "Monat*" #elif L==2 - "month" + "month*" #elif L==3 - "mes" + "mes*" #elif L==4 - "mois" + "mois*" #elif L==5 - "jasy" + "jasy*" #elif L==6 - "mese" + "mese*" #elif L==7 - "miesiąc" + "miesiąc*" #elif L==8 - "mês" + "mês*" #endif , #if L==0 - "hora" + "hora*" #elif L==1 - "Stunde" + "Stunde*" #elif L==2 - "hour" + "hour*" #elif L==3 - "hora" + "hora*" #elif L==4 - "heure" + "heure*" #elif L==5 - "aravo" + "aravo*" #elif L==6 - "ora" + "ora*" #elif L==7 - "godzina" + "godzina*" #elif L==8 - "hora" + "hora*" #endif , #if L==0 - "minut" + "minut*" #elif L==1 - "Minute" + "Minute*" #elif L==2 - "minute" + "minute*" #elif L==3 - "minuto" + "minuto*" #elif L==4 - "minute" + "minute*" #elif L==5 - "aravo'i" + "aravo'i*" #elif L==6 - "minuto" + "minuto*" #elif L==7 - "minutę" + "minutę*" #elif L==8 - "minuto" + "minuto*" #endif , #if L==0