Version 15.253

This commit is contained in:
Antonio Cañas Vargas 2016-09-12 10:02:17 +02:00
parent 8291baa9c0
commit 944165424d
2 changed files with 29 additions and 44 deletions

View File

@ -135,13 +135,14 @@
/****************************** Public constants *****************************/ /****************************** Public constants *****************************/
/*****************************************************************************/ /*****************************************************************************/
#define Log_PLATFORM_VERSION "SWAD 15.252.1 (2016-09-12)" #define Log_PLATFORM_VERSION "SWAD 15.253 (2016-09-12)"
#define CSS_FILE "swad15.229.css" #define CSS_FILE "swad15.229.css"
#define JS_FILE "swad15.238.1.js" #define JS_FILE "swad15.238.1.js"
// 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.253: Sep 12, 2016 Changes in layout of hits per month in user's usage report. (204608 lines)
Version 15.252.1: Sep 12, 2016 Hits in user's usage report. Not finished. (204619 lines) Version 15.252.1: Sep 12, 2016 Hits in user's usage report. Not finished. (204619 lines)
Version 15.252: Sep 12, 2016 Hits in user's usage report. Not finished. (204589 lines) Version 15.252: Sep 12, 2016 Hits in user's usage report. Not finished. (204589 lines)
Version 15.251.2: Sep 11, 2016 Changes in layout of user's usage report. (204465 lines) Version 15.251.2: Sep 11, 2016 Changes in layout of user's usage report. (204465 lines)

View File

@ -42,6 +42,14 @@
/***************************** Private constants *****************************/ /***************************** Private constants *****************************/
/*****************************************************************************/ /*****************************************************************************/
#define Rep_MAX_BAR_WIDTH 75 // Maximum width of graphic bar
// #define Rep_BLOCK "═" // HTML code for a block in graphic bar
// #define Rep_BLOCK "▒" // HTML code for a block in graphic bar
// #define Rep_BLOCK "█" // HTML code for a block in graphic bar
// #define Rep_BLOCK "≡" // HTML code for a block in graphic bar
// #define Rep_BLOCK "•" // HTML code for a block in graphic bar
#define Rep_BLOCK "▪" // HTML code for a block in graphic bar
/*****************************************************************************/ /*****************************************************************************/
/****************************** Internal types *******************************/ /****************************** Internal types *******************************/
/*****************************************************************************/ /*****************************************************************************/
@ -73,7 +81,8 @@ static void Rep_GetAndWriteCrssOfAUsr (const struct UsrData *UsrDat,Rol_Role_t R
static void Rep_WriteRowCrsData (MYSQL_ROW row); static void Rep_WriteRowCrsData (MYSQL_ROW row);
static void Rep_ShowMyHits (time_t FirstClickTimeUTC,struct tm *tm_FirstClickTime); static void Rep_ShowMyHits (time_t FirstClickTimeUTC,struct tm *tm_FirstClickTime);
static void Rep_DrawBarNumHits (char Color,float HitsNum,float HitsMax,unsigned MaxBarWidth); static void Rep_DrawBarNumHits (float HitsNum,float HitsMax,
unsigned MaxBarWidth);
/*****************************************************************************/ /*****************************************************************************/
/********* Show my usage report (report on my use of the platform) ***********/ /********* Show my usage report (report on my use of the platform) ***********/
@ -346,13 +355,6 @@ static void Rep_ShowOrPrintMyUsageReport (Rep_SeeOrPrint_t SeeOrPrint)
/***** Hits *****/ /***** Hits *****/
fprintf (Gbl.F.Out,"<h2>%s</h2>",Txt_Hits); fprintf (Gbl.F.Out,"<h2>%s</h2>",Txt_Hits);
fprintf (Gbl.F.Out,"<tt>2016-04: &block;&block;&block; 300</tt><br />");
fprintf (Gbl.F.Out,"<tt>2016-05: &block; 100</tt><br />");
fprintf (Gbl.F.Out,"<tt>2016-06: 0</tt><br />");
fprintf (Gbl.F.Out,"<tt>2016-07: &block;&block;&block;&block;&block; 500</tt><br />");
fprintf (Gbl.F.Out,"<tt>2016-08: &block;&block;&block;&block;&block;&block;&block;&block;&block; 900</tt><br />");
fprintf (Gbl.F.Out,"<tt>2016-09: &block;&block;&block;&block;&block;&block; 600</tt><br />");
Rep_ShowMyHits (UsrFigures.FirstClickTimeUTC,&tm_FirstClickTime); Rep_ShowMyHits (UsrFigures.FirstClickTimeUTC,&tm_FirstClickTime);
/***** End frame *****/ /***** End frame *****/
@ -532,8 +534,6 @@ static void Rep_ShowMyHits (time_t FirstClickTimeUTC,struct tm *tm_FirstClickTim
/***** Compute maximum number of pages generated per month *****/ /***** Compute maximum number of pages generated per month *****/
Sta_ComputeMaxAndTotalHits (&Hits,NumRows,mysql_res,1,1); Sta_ComputeMaxAndTotalHits (&Hits,NumRows,mysql_res,1,1);
fprintf (Gbl.F.Out,"<table>");
/***** Write rows *****/ /***** Write rows *****/
mysql_data_seek (mysql_res,0); mysql_data_seek (mysql_res,0);
for (NumRow = 1; for (NumRow = 1;
@ -546,7 +546,7 @@ static void Rep_ShowMyHits (time_t FirstClickTimeUTC,struct tm *tm_FirstClickTim
if (sscanf (row[0],"%04u%02u",&ReadDate.Year,&ReadDate.Month) != 2) if (sscanf (row[0],"%04u%02u",&ReadDate.Year,&ReadDate.Month) != 2)
Lay_ShowErrorAndExit ("Wrong date."); Lay_ShowErrorAndExit ("Wrong date.");
/* Get number of pages generated (in row[1]) */ /* Get number hits (in row[1]) */
Hits.Num = Str_GetFloatNumFromStr (row[1]); Hits.Num = Str_GetFloatNumFromStr (row[1]);
Dat_AssignDate (&Date,&LastDate); Dat_AssignDate (&Date,&LastDate);
@ -556,17 +556,12 @@ static void Rep_ShowMyHits (time_t FirstClickTimeUTC,struct tm *tm_FirstClickTim
M++) M++)
{ {
/* Write the month */ /* Write the month */
fprintf (Gbl.F.Out,"<tr>" fprintf (Gbl.F.Out,"%04u-%02u ",Date.Year,Date.Month);
"<td class=\"LOG LEFT_TOP\">"
"%04u-%02u: "
"</td>",
Date.Year,Date.Month);
/* Draw bar proportional to number of pages generated */ /* Draw bar proportional to number of hits */
Rep_DrawBarNumHits ('c', Rep_DrawBarNumHits (M == NumMonthsBetweenLastDateAndCurrentDate ? Hits.Num :
M == NumMonthsBetweenLastDateAndCurrentDate ? Hits.Num :
0.0, 0.0,
Hits.Max,500); Hits.Max,Rep_MAX_BAR_WIDTH);
/* Decrease month */ /* Decrease month */
Dat_GetMonthBefore (&Date,&Date); Dat_GetMonthBefore (&Date,&Date);
@ -581,53 +576,42 @@ static void Rep_ShowMyHits (time_t FirstClickTimeUTC,struct tm *tm_FirstClickTim
M++) M++)
{ {
/* Write the month */ /* Write the month */
fprintf (Gbl.F.Out,"<tr>" fprintf (Gbl.F.Out,"%04u-%02u ",Date.Year,Date.Month);
"<td class=\"LOG LEFT_TOP\">"
"%04u-%02u"
"</td>",
Date.Year,Date.Month);
/* Draw bar proportional to number of pages generated */ /* Draw bar proportional to number of hits */
Rep_DrawBarNumHits ('c',0.0,Hits.Max,500); Rep_DrawBarNumHits (0.0,Hits.Max,Rep_MAX_BAR_WIDTH);
/* Decrease month */ /* Decrease month */
Dat_GetMonthBefore (&Date,&Date); Dat_GetMonthBefore (&Date,&Date);
} }
fprintf (Gbl.F.Out,"</table>");
} }
/*****************************************************************************/ /*****************************************************************************/
/********************* Draw a bar with the number of hits ********************/ /********************* Draw a bar with the number of hits ********************/
/*****************************************************************************/ /*****************************************************************************/
static void Rep_DrawBarNumHits (char Color,float HitsNum,float HitsMax,unsigned MaxBarWidth) static void Rep_DrawBarNumHits (float HitsNum,float HitsMax,
unsigned MaxBarWidth)
{ {
unsigned BarWidth; unsigned BarWidth;
unsigned i;
fprintf (Gbl.F.Out,"<td class=\"LOG LEFT_MIDDLE\">");
if (HitsNum != 0.0) if (HitsNum != 0.0)
{ {
/***** Draw bar with a with proportional to the number of hits *****/ /***** Draw bar with a with proportional to the number of hits *****/
BarWidth = (unsigned) (((HitsNum * (float) MaxBarWidth) / HitsMax) + 0.5); BarWidth = (unsigned) (((HitsNum * (float) MaxBarWidth) / HitsMax) + 0.5);
if (BarWidth == 0) for (i = 0;
BarWidth = 1; i < BarWidth;
fprintf (Gbl.F.Out,"<img src=\"%s/%c1x14.gif\"" i++)
" alt=\"\" title=\"\"" fprintf (Gbl.F.Out,Rep_BLOCK);
" class=\"LEFT_TOP\""
" style=\"width:%upx; height:18px;\" />"
"&nbsp;",
Gbl.Prefs.IconsURL,Color,BarWidth);
/***** Write the number of hits *****/ /***** Write the number of hits *****/
fprintf (Gbl.F.Out," ");
Str_WriteFloatNum (HitsNum); Str_WriteFloatNum (HitsNum);
} }
else else
/***** Write the number of clicks *****/ /***** Write the number of clicks *****/
fprintf (Gbl.F.Out,"0"); fprintf (Gbl.F.Out,"0");
fprintf (Gbl.F.Out,"</td>" fprintf (Gbl.F.Out,"<br />");
"</tr>");
} }