diff --git a/swad_RSS.c b/swad_RSS.c
index be38eddce..a15717081 100644
--- a/swad_RSS.c
+++ b/swad_RSS.c
@@ -155,7 +155,7 @@ static void RSS_WriteNotices (FILE *FileRSS,struct Course *Crs)
char Content[Cns_MAX_BYTES_TEXT+1];
/***** Get active notices in course *****/
- sprintf (Query,"SELECT NotCod,UNIX_TIMESTAMP(CreatTime) AS T,DATE_FORMAT(CreatTime,'%%d/%%m/%%Y %%H:%%i'),UsrCod,Content"
+ sprintf (Query,"SELECT NotCod,UNIX_TIMESTAMP(CreatTime) AS T,UsrCod,Content"
" FROM notices WHERE CrsCod='%ld' AND Status='%u' ORDER BY T DESC",
Crs->CrsCod,(unsigned) Not_ACTIVE_NOTICE);
NumNotices = DB_QuerySELECT (Query,&mysql_res,"can not get notices from database");
@@ -182,14 +182,14 @@ static void RSS_WriteNotices (FILE *FileRSS,struct Course *Crs)
sscanf (row[1],"%ld",&CreatTimeUTC);
/* Get author */
- UsrDat.UsrCod = Str_ConvertStrCodToLongCod (row[3]);
+ UsrDat.UsrCod = Str_ConvertStrCodToLongCod (row[2]);
Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat); // Get from the database the data of the autor
/***** Write item with notice *****/
fprintf (FileRSS,"- \n");
/* Write title (first characters) of the notice */
- strncpy (Content,row[4],Cns_MAX_BYTES_TEXT);
+ strncpy (Content,row[3],Cns_MAX_BYTES_TEXT);
Content[Cns_MAX_BYTES_TEXT] = '\0';
Str_LimitLengthHTMLStr (Content,40);
fprintf (FileRSS,"%s: ",Txt_Notice);
@@ -201,11 +201,11 @@ static void RSS_WriteNotices (FILE *FileRSS,struct Course *Crs)
Cfg_HTTPS_URL_SWAD_CGI,Crs->CrsCod);
/* Write full content of the notice */
- strncpy (Content,row[4],Cns_MAX_BYTES_TEXT);
+ strncpy (Content,row[3],Cns_MAX_BYTES_TEXT);
Content[Cns_MAX_BYTES_TEXT] = '\0';
Str_InsertLinkInURLs (Content,Cns_MAX_BYTES_TEXT,40);
- fprintf (FileRSS,"%s, %s %s %s:
%s
]]>\n",
- row[2],UsrDat.FirstName,UsrDat.Surname1,UsrDat.Surname2,Content);
+ fprintf (FileRSS,"%s %s %s:%s
]]>\n",
+ UsrDat.FirstName,UsrDat.Surname1,UsrDat.Surname2,Content);
/* Write author */
if (UsrDat.Email[0])
@@ -252,7 +252,8 @@ static void RSS_WriteExamAnnouncements (FILE *FileRSS,struct Course *Crs)
if (Gbl.DB.DatabaseIsOpen)
{
/***** Get exam announcements (only future exams) in current course from database *****/
- sprintf (Query,"SELECT ExaCod,UNIX_TIMESTAMP(CallDate) AS T,DATE_FORMAT(ExamDate,'%%d/%%m/%%Y %%H:%%i')"
+ sprintf (Query,"SELECT ExaCod,UNIX_TIMESTAMP(CallDate) AS T,"
+ "DATE_FORMAT(ExamDate,'%%d/%%m/%%Y %%H:%%i')"
" FROM exam_announcements"
" WHERE CrsCod='%ld' AND ExamDate>=NOW() AND Status<>'%u' ORDER BY T",
Gbl.CurrentCrs.Crs.CrsCod,(unsigned) Exa_DELETED_EXAM_ANNOUNCEMENT);
diff --git a/swad_changelog.h b/swad_changelog.h
index 5072a44ea..8a425afe8 100644
--- a/swad_changelog.h
+++ b/swad_changelog.h
@@ -108,11 +108,12 @@
/****************************** Public constants *****************************/
/*****************************************************************************/
-#define Log_PLATFORM_VERSION "SWAD 15.25.1 (2015/10/26)"
+#define Log_PLATFORM_VERSION "SWAD 15.25.2 (2015/10/26)"
// 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.25.2: Oct 26, 2015 Changes related to date-times. (186247 lines)
Version 15.25.1: Oct 26, 2015 Warning about stats computed in server time instead of user's local time. (186263 lines)
Version 15.25: Oct 26, 2015 Clicks in real time are displayed as time ago. (186211 lines)
Version 15.24.2: Oct 26, 2015 Change in function that write clock. (186219 lines)
diff --git a/swad_enrollment.c b/swad_enrollment.c
index 6ff3cfe67..42f7e8454 100644
--- a/swad_enrollment.c
+++ b/swad_enrollment.c
@@ -1977,8 +1977,7 @@ void Enr_GetNotifEnrollmentRequest (char *SummaryStr,char **ContentStr,
SummaryStr[0] = '\0'; // Return nothing on error
/***** Get user and requested role from database *****/
- sprintf (Query,"SELECT UsrCod,Role,"
- "DATE_FORMAT(RequestTime,'%%Y%%m%%d%%H%%i%%S')"
+ sprintf (Query,"SELECT UsrCod,Role"
" FROM crs_usr_requests"
" WHERE ReqCod='%ld'",
ReqCod);
@@ -2006,14 +2005,10 @@ void Enr_GetNotifEnrollmentRequest (char *SummaryStr,char **ContentStr,
Str_LimitLengthHTMLStr (SummaryStr,MaxChars);
if (GetContent)
- if ((*ContentStr = (char *) malloc (16+1)))
- /* Write date (row[2]) into content */
- sprintf (*ContentStr,"%c%c/%c%c/%c%c%c%c %c%c:%c%c",
- row[2][ 6],row[2][ 7],
- row[2][ 4],row[2][ 5],
- row[2][ 0],row[2][ 1],row[2][ 2],row[2][ 3],
- row[2][ 8],row[2][ 9],
- row[2][10],row[2][11]);
+ if ((*ContentStr = (char *) malloc (256)))
+ /* Write desired role into content */
+ sprintf (*ContentStr,"%s", // TODO: Write more info in this content
+ Txt_ROLES_SINGUL_Abc[DesiredRole][UsrDat.Sex]);
/* Free memory used for user's data */
Usr_UsrDataDestructor (&UsrDat);
diff --git a/swad_notification.c b/swad_notification.c
index 935c51b02..a784283e7 100644
--- a/swad_notification.c
+++ b/swad_notification.c
@@ -1365,8 +1365,7 @@ static void Ntf_SendPendingNotifByEMailToOneUsr (struct UsrData *ToUsrDat,unsign
if (Mai_CheckIfMailDomainIsAllowedForNotifications (MailDomain))
{
/***** Get pending notifications of this user from database ******/
- sprintf (Query,"SELECT NotifyEvent,FromUsrCod,InsCod,CtrCod,DegCod,CrsCod,"
- "Cod,DATE_FORMAT(TimeNotif,'%%Y-%%m-%%d %%H:%%i:%%S')"
+ sprintf (Query,"SELECT NotifyEvent,FromUsrCod,InsCod,CtrCod,DegCod,CrsCod,Cod"
" FROM notif WHERE ToUsrCod='%ld'"
" AND (Status & %u)<>0 AND (Status & %u)=0 AND (Status & %u)=0"
" ORDER BY TimeNotif,NotifyEvent",
@@ -1431,9 +1430,6 @@ static void Ntf_SendPendingNotifByEMailToOneUsr (struct UsrData *ToUsrDat,unsign
NotifyEvent == Ntf_EVENT_FORUM_REPLY)
ForumType = For_GetForumTypeOfAPost (Cod);
- /* Write date and time when the event happened (row[7], in YYYY-MM-DD HH:MM:SS format) */
- fprintf (Gbl.Msg.FileMail,"\n%s: ",row[7]);
-
/* Information about the type of this event */
fprintf (Gbl.Msg.FileMail,Txt_NOTIFY_EVENTS_SINGULAR_NO_HTML[NotifyEvent][ToUsrDat->Prefs.Language],
Cfg_PLATFORM_SHORT_NAME);
diff --git a/swad_photo.c b/swad_photo.c
index 316789028..0a4dd7621 100644
--- a/swad_photo.c
+++ b/swad_photo.c
@@ -116,7 +116,7 @@ static void Pho_BuildQueryOfDegrees (char *Query);
static void Pho_GetNumStdsInDegree (long DegCod,Usr_Sex_t Sex,int *NumStds,int *NumStdsWithPhoto);
static void Pho_UpdateDegStats (long DegCod,Usr_Sex_t Sex,unsigned NumStds,unsigned NumStdsWithPhoto,long TimeToComputeAvgPhoto);
static void Pho_ShowDegreeStat (int NumStds,int NumStdsWithPhoto);
-static void Pho_ShowDegreeAvgPhotoAndStat (struct Degree *Deg,Pho_AvgPhotoSeeOrPrint_t SeeOrPrint,Usr_Sex_t Sex,int NumStds,int NumStdsWithPhoto,struct Date *DateAvgPhoto);
+static void Pho_ShowDegreeAvgPhotoAndStat (struct Degree *Deg,Pho_AvgPhotoSeeOrPrint_t SeeOrPrint,Usr_Sex_t Sex,int NumStds,int NumStdsWithPhoto);
static void Pho_ComputePhotoSize (int NumStds,int NumStdsWithPhoto,unsigned *PhotoWidth,unsigned *PhotoHeight);
/*****************************************************************************/
@@ -1895,7 +1895,6 @@ static void Pho_ShowOrPrintClassPhotoDegrees (Pho_AvgPhotoSeeOrPrint_t SeeOrPrin
unsigned NumDegsNotEmpty;
int NumStds;
int NumStdsWithPhoto;
- struct Date DateAvgPhoto;
bool TRIsOpen = false;
/***** Get degrees from database *****/
@@ -1932,10 +1931,6 @@ static void Pho_ShowOrPrintClassPhotoDegrees (Pho_AvgPhotoSeeOrPrint_t SeeOrPrin
if (NumStds > 0)
{
- /* Get year, month and day (row[1] holds the date in YYYYMMDD format) */
- if (!(Dat_GetDateFromYYYYMMDD (&DateAvgPhoto,row[1])))
- Lay_ShowErrorAndExit ("Wrong date.");
-
if ((NumDegsNotEmpty % Gbl.Usrs.ClassPhoto.Cols) == 0)
{
fprintf (Gbl.F.Out,"");
@@ -1944,7 +1939,7 @@ static void Pho_ShowOrPrintClassPhotoDegrees (Pho_AvgPhotoSeeOrPrint_t SeeOrPrin
/***** Show average photo of students belonging to this degree *****/
fprintf (Gbl.F.Out,"");
- Pho_ShowDegreeAvgPhotoAndStat (&Deg,SeeOrPrint,Usr_SEX_ALL,NumStds,NumStdsWithPhoto,&DateAvgPhoto);
+ Pho_ShowDegreeAvgPhotoAndStat (&Deg,SeeOrPrint,Usr_SEX_ALL,NumStds,NumStdsWithPhoto);
fprintf (Gbl.F.Out," | ");
if ((++NumDegsNotEmpty % Gbl.Usrs.ClassPhoto.Cols) == 0)
@@ -1989,7 +1984,6 @@ static void Pho_ShowOrPrintListDegrees (Pho_AvgPhotoSeeOrPrint_t SeeOrPrint)
unsigned NumDegsNotEmpty;
int NumStds;
int NumStdsWithPhoto;
- struct Date DateAvgPhoto;
struct Degree Deg;
Usr_Sex_t Sex;
@@ -2041,10 +2035,6 @@ static void Pho_ShowOrPrintListDegrees (Pho_AvgPhotoSeeOrPrint_t SeeOrPrint)
if ((Deg.DegCod = Str_ConvertStrCodToLongCod (row[0])) < 0)
Lay_ShowErrorAndExit ("Wrong code of degree.");
- /* Get year, month and day (row[1] holds the date in YYYYMMDD format) */
- if (!(Dat_GetDateFromYYYYMMDD (&DateAvgPhoto,row[1])))
- Lay_ShowErrorAndExit ("Wrong date.");
-
/* Get data of degree */
Deg_GetDataOfDegreeByCod (&Deg);
@@ -2078,7 +2068,7 @@ static void Pho_ShowOrPrintListDegrees (Pho_AvgPhotoSeeOrPrint_t SeeOrPrint)
fprintf (Gbl.F.Out,"",
Gbl.RowEvenOdd);
if (Gbl.Usrs.Listing.WithPhotos)
- Pho_ShowDegreeAvgPhotoAndStat (&Deg,SeeOrPrint,Sex,NumStds,NumStdsWithPhoto,&DateAvgPhoto);
+ Pho_ShowDegreeAvgPhotoAndStat (&Deg,SeeOrPrint,Sex,NumStds,NumStdsWithPhoto);
else
Pho_ShowDegreeStat (NumStds,NumStdsWithPhoto);
fprintf (Gbl.F.Out," | ");
@@ -2107,7 +2097,7 @@ static void Pho_BuildQueryOfDegrees (char *Query)
switch (Gbl.Stat.DegPhotos.HowOrderDegrees)
{
case Pho_NUMBER_OF_STUDENTS:
- sprintf (Query,"SELECT degrees.DegCod,DATE_FORMAT(sta_degrees.TimeAvgPhoto,'%%Y%%m%%d')"
+ sprintf (Query,"SELECT degrees.DegCod"
" FROM degrees,sta_degrees"
" WHERE sta_degrees.Sex='all'"
" AND sta_degrees.NumStds>'0'"
@@ -2115,7 +2105,7 @@ static void Pho_BuildQueryOfDegrees (char *Query)
" ORDER BY sta_degrees.NumStds DESC,sta_degrees.NumStdsWithPhoto DESC,degrees.ShortName");
break;
case Pho_NUMBER_OF_PHOTOS:
- sprintf (Query,"SELECT degrees.DegCod,DATE_FORMAT(sta_degrees.TimeAvgPhoto,'%%Y%%m%%d')"
+ sprintf (Query,"SELECT degrees.DegCod"
" FROM degrees,sta_degrees"
" WHERE sta_degrees.Sex='all'"
" AND sta_degrees.NumStds>'0'"
@@ -2123,7 +2113,7 @@ static void Pho_BuildQueryOfDegrees (char *Query)
" ORDER BY sta_degrees.NumStdsWithPhoto DESC,sta_degrees.NumStds DESC,degrees.ShortName");
break;
case Pho_PERCENT:
- sprintf (Query,"SELECT degrees.DegCod,DATE_FORMAT(sta_degrees.TimeAvgPhoto,'%%Y%%m%%d')"
+ sprintf (Query,"SELECT degrees.DegCod"
" FROM degrees,sta_degrees"
" WHERE sta_degrees.Sex='all'"
" AND sta_degrees.NumStds>'0'"
@@ -2131,7 +2121,7 @@ static void Pho_BuildQueryOfDegrees (char *Query)
" ORDER BY sta_degrees.NumStdsWithPhoto/sta_degrees.NumStds DESC,degrees.ShortName");
break;
case Pho_DEGREE_NAME:
- sprintf (Query,"SELECT degrees.DegCod,DATE_FORMAT(sta_degrees.TimeAvgPhoto,'%%Y%%m%%d')"
+ sprintf (Query,"SELECT degrees.DegCod"
" FROM degrees,sta_degrees"
" WHERE sta_degrees.Sex='all'"
" AND sta_degrees.NumStds>'0'"
@@ -2209,7 +2199,7 @@ static void Pho_ShowDegreeStat (int NumStds,int NumStdsWithPhoto)
/******************* Show the average photo of a degree **********************/
/*****************************************************************************/
-static void Pho_ShowDegreeAvgPhotoAndStat (struct Degree *Deg,Pho_AvgPhotoSeeOrPrint_t SeeOrPrint,Usr_Sex_t Sex,int NumStds,int NumStdsWithPhoto,struct Date *DateAvgPhoto)
+static void Pho_ShowDegreeAvgPhotoAndStat (struct Degree *Deg,Pho_AvgPhotoSeeOrPrint_t SeeOrPrint,Usr_Sex_t Sex,int NumStds,int NumStdsWithPhoto)
{
extern const char *Usr_StringsSexDB[Usr_NUM_SEXS];
extern const char *Txt_students_ABBREVIATION;
@@ -2256,14 +2246,12 @@ static void Pho_ShowDegreeAvgPhotoAndStat (struct Degree *Deg,Pho_AvgPhotoSeeOrP
{
sprintf (PhotoCaption,"%s
"
"%d %s (%s)
"
- "%d %s (%d%%)
"
- "%02u/%02u/%04u",
+ "%d %s (%d%%)",
Deg->ShortName,
NumStds,Txt_students_ABBREVIATION,Txt_SEX_PLURAL_abc[Sex],
NumStdsWithPhoto,Txt_photos,
NumStds > 0 ? (int) (((NumStdsWithPhoto * 100.0) / NumStds) + 0.5) :
- 0,
- DateAvgPhoto->Day,DateAvgPhoto->Month,DateAvgPhoto->Year);
+ 0);
fprintf (Gbl.F.Out," onmouseover=\"zoom(this,'%s','%s')\" onmouseout=\"noZoom(this);\"",
PhotoURL,PhotoCaption);
}