Version 16.17.6

This commit is contained in:
Antonio Cañas Vargas 2016-10-08 21:49:04 +02:00
parent c0dacd461f
commit 93719b16c7
2 changed files with 32 additions and 42 deletions

View File

@ -148,13 +148,14 @@
/****************************** Public constants *****************************/ /****************************** Public constants *****************************/
/*****************************************************************************/ /*****************************************************************************/
#define Log_PLATFORM_VERSION "SWAD 16.17.5 (2016-10-08)" #define Log_PLATFORM_VERSION "SWAD 16.17.6 (2016-10-08)"
#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 16.17.6: Oct 08, 2016 Code refactoring in user's usage report. (206291 lines)
Version 16.17.5: Oct 08, 2016 Code refactoring in user's usage report. (206301 lines) Version 16.17.5: Oct 08, 2016 Code refactoring in user's usage report. (206301 lines)
Version 16.17.4: Oct 08, 2016 Code refactoring in user's usage report. (206292 lines) Version 16.17.4: Oct 08, 2016 Code refactoring in user's usage report. (206292 lines)
Version 16.17.3: Oct 08, 2016 Message translated in user's usage report. (206255 lines) Version 16.17.3: Oct 08, 2016 Message translated in user's usage report. (206255 lines)

View File

@ -84,8 +84,8 @@ struct Rep_Report
struct Rep_CurrentTimeUTC CurrentTimeUTC; struct Rep_CurrentTimeUTC CurrentTimeUTC;
struct Rep_Hits Hits; struct Rep_Hits Hits;
unsigned long MaxHitsPerYear; unsigned long MaxHitsPerYear;
char *FilenameReport; char FilenameReport[NAME_MAX+1];
char *Permalink; char Permalink[PATH_MAX+1];
}; };
/*****************************************************************************/ /*****************************************************************************/
@ -102,12 +102,8 @@ extern struct Globals Gbl;
/***************************** Private prototypes ****************************/ /***************************** Private prototypes ****************************/
/*****************************************************************************/ /*****************************************************************************/
static void Rep_CreateMyUsageReport (struct Rep_CurrentTimeUTC *CurrentTimeUTC, static void Rep_CreateMyUsageReport (struct Rep_Report *Report);
char *FilenameReport, static void Rep_PutLinkToMyUsageReport (struct Rep_Report *Report);
char *Permalink);
static void Rep_PutLinkToMyUsageReport (struct Rep_CurrentTimeUTC *CurrentTimeUTC,
const char *FilenameReport,
const char *Permalink);
static void Req_TitleReport (struct Rep_CurrentTimeUTC *CurrentTimeUTC); static void Req_TitleReport (struct Rep_CurrentTimeUTC *CurrentTimeUTC);
static void Rep_GetCurrentDateTimeUTC (struct tm *tm_CurrentTime, static void Rep_GetCurrentDateTimeUTC (struct tm *tm_CurrentTime,
@ -199,46 +195,41 @@ void Rep_ReqMyUsageReport (void)
void Rep_ShowMyUsageReport (void) void Rep_ShowMyUsageReport (void)
{ {
struct Rep_CurrentTimeUTC CurrentTimeUTC; struct Rep_Report Report;
char FilenameReport[NAME_MAX+1];
char Permalink[PATH_MAX+1];
/***** Create my usage report *****/ /***** Create my usage report *****/
Rep_CreateMyUsageReport (&CurrentTimeUTC,FilenameReport,Permalink); Rep_CreateMyUsageReport (&Report);
/***** Put link to my usage report *****/ /***** Put link to my usage report *****/
Rep_PutLinkToMyUsageReport (&CurrentTimeUTC,FilenameReport,Permalink); Rep_PutLinkToMyUsageReport (&Report);
} }
/*****************************************************************************/ /*****************************************************************************/
/******** Create my usage report (report on my use of the platform) **********/ /******** Create my usage report (report on my use of the platform) **********/
/*****************************************************************************/ /*****************************************************************************/
static void Rep_CreateMyUsageReport (struct Rep_CurrentTimeUTC *CurrentTimeUTC, static void Rep_CreateMyUsageReport (struct Rep_Report *Report)
char *FilenameReport,
char *Permalink)
{ {
extern const char *Txt_Report_of_use_of_PLATFORM; extern const char *Txt_Report_of_use_of_PLATFORM;
struct Rep_Report Report;
bool GetUsrFiguresAgain; bool GetUsrFiguresAgain;
/***** Get current date-time *****/ /***** Get current date-time *****/
Rep_GetCurrentDateTimeUTC (&Report.tm_CurrentTime,CurrentTimeUTC); Rep_GetCurrentDateTimeUTC (&Report->tm_CurrentTime,&Report->CurrentTimeUTC);
/***** Create a new report file *****/ /***** Create a new report file *****/
Rep_CreateNewReportFile (CurrentTimeUTC,FilenameReport,Permalink); Rep_CreateNewReportFile (&Report->CurrentTimeUTC,Report->FilenameReport,Report->Permalink);
/***** Store report entry into database *****/ /***** Store report entry into database *****/
Rep_CreateNewReportEntryIntoDB (&Report.tm_CurrentTime,FilenameReport,Permalink); Rep_CreateNewReportEntryIntoDB (&Report->tm_CurrentTime,Report->FilenameReport,Report->Permalink);
/***** Start file *****/ /***** Start file *****/
Lay_StartHTMLFile (Gbl.F.Rep,FilenameReport); Lay_StartHTMLFile (Gbl.F.Rep,Report->FilenameReport);
fprintf (Gbl.F.Rep,"<body style=\"margin:1em;" fprintf (Gbl.F.Rep,"<body style=\"margin:1em;"
" text-align:left;" " text-align:left;"
" font-family:Helvetica,Arial,sans-serif;\">\n"); " font-family:Helvetica,Arial,sans-serif;\">\n");
/***** Header *****/ /***** Header *****/
Rep_WriteHeader (CurrentTimeUTC,Permalink); Rep_WriteHeader (&Report->CurrentTimeUTC,Report->Permalink);
/***** Platform *****/ /***** Platform *****/
Rep_WriteSectionPlatform (); Rep_WriteSectionPlatform ();
@ -247,28 +238,28 @@ static void Rep_CreateMyUsageReport (struct Rep_CurrentTimeUTC *CurrentTimeUTC,
Rep_WriteSectionUsrInfo (); Rep_WriteSectionUsrInfo ();
/***** Figures *****/ /***** Figures *****/
Prf_GetUsrFigures (Gbl.Usrs.Me.UsrDat.UsrCod,&Report.UsrFigures); Prf_GetUsrFigures (Gbl.Usrs.Me.UsrDat.UsrCod,&Report->UsrFigures);
GetUsrFiguresAgain = Prf_GetAndStoreAllUsrFigures (Gbl.Usrs.Me.UsrDat.UsrCod,&Report.UsrFigures); GetUsrFiguresAgain = Prf_GetAndStoreAllUsrFigures (Gbl.Usrs.Me.UsrDat.UsrCod,&Report->UsrFigures);
if (GetUsrFiguresAgain) if (GetUsrFiguresAgain)
Prf_GetUsrFigures (Gbl.Usrs.Me.UsrDat.UsrCod,&Report.UsrFigures); Prf_GetUsrFigures (Gbl.Usrs.Me.UsrDat.UsrCod,&Report->UsrFigures);
if (Report.UsrFigures.FirstClickTimeUTC) if (Report->UsrFigures.FirstClickTimeUTC)
gmtime_r (&Report.UsrFigures.FirstClickTimeUTC,&Report.tm_FirstClickTime); gmtime_r (&Report->UsrFigures.FirstClickTimeUTC,&Report->tm_FirstClickTime);
Rep_WriteSectionUsrFigures (&Report.UsrFigures,&Report.tm_FirstClickTime,CurrentTimeUTC); Rep_WriteSectionUsrFigures (&Report->UsrFigures,&Report->tm_FirstClickTime,&Report->CurrentTimeUTC);
/***** Global count of hits *****/ /***** Global count of hits *****/
Rep_WriteSectionGlobalHits (&Report.UsrFigures,&Report.tm_FirstClickTime); Rep_WriteSectionGlobalHits (&Report->UsrFigures,&Report->tm_FirstClickTime);
/***** Global hits distributed by action *****/ /***** Global hits distributed by action *****/
Rep_WriteSectionHitsPerAction (&Report.UsrFigures); Rep_WriteSectionHitsPerAction (&Report->UsrFigures);
/***** Current courses *****/ /***** Current courses *****/
Report.MaxHitsPerYear = Rep_GetMaxHitsPerYear (Report.UsrFigures.FirstClickTimeUTC); Report->MaxHitsPerYear = Rep_GetMaxHitsPerYear (Report->UsrFigures.FirstClickTimeUTC);
Rep_WriteSectionCurrentCourses (&Report.UsrFigures,&Report.tm_FirstClickTime, Rep_WriteSectionCurrentCourses (&Report->UsrFigures,&Report->tm_FirstClickTime,
CurrentTimeUTC,Report.MaxHitsPerYear); &Report->CurrentTimeUTC,Report->MaxHitsPerYear);
/***** Historic courses *****/ /***** Historic courses *****/
Rep_WriteSectionHistoricCourses (&Report.UsrFigures,&Report.tm_FirstClickTime, Rep_WriteSectionHistoricCourses (&Report->UsrFigures,&Report->tm_FirstClickTime,
Report.MaxHitsPerYear); Report->MaxHitsPerYear);
/***** End file *****/ /***** End file *****/
fprintf (Gbl.F.Rep,"</body>\n" fprintf (Gbl.F.Rep,"</body>\n"
@ -282,9 +273,7 @@ static void Rep_CreateMyUsageReport (struct Rep_CurrentTimeUTC *CurrentTimeUTC,
/******* Put link to my usage report (report on my use of the platform) ******/ /******* Put link to my usage report (report on my use of the platform) ******/
/*****************************************************************************/ /*****************************************************************************/
static void Rep_PutLinkToMyUsageReport (struct Rep_CurrentTimeUTC *CurrentTimeUTC, static void Rep_PutLinkToMyUsageReport (struct Rep_Report *Report)
const char *FilenameReport,
const char *Permalink)
{ {
extern const char *Txt_Report_of_use_of_PLATFORM; extern const char *Txt_Report_of_use_of_PLATFORM;
extern const char *Txt_Report; extern const char *Txt_Report;
@ -295,7 +284,7 @@ static void Rep_PutLinkToMyUsageReport (struct Rep_CurrentTimeUTC *CurrentTimeUT
Lay_StartRoundFrame (NULL,Gbl.Title,NULL); Lay_StartRoundFrame (NULL,Gbl.Title,NULL);
/***** Header *****/ /***** Header *****/
Req_TitleReport (CurrentTimeUTC); Req_TitleReport (&Report->CurrentTimeUTC);
/***** Put anchor and report filename *****/ /***** Put anchor and report filename *****/
fprintf (Gbl.F.Out,"<div class=\"FILENAME CENTER_MIDDLE\">" fprintf (Gbl.F.Out,"<div class=\"FILENAME CENTER_MIDDLE\">"
@ -306,11 +295,11 @@ static void Rep_PutLinkToMyUsageReport (struct Rep_CurrentTimeUTC *CurrentTimeUT
"%s" "%s"
"</a>" "</a>"
"</div>", "</div>",
Permalink, Report->Permalink,
Txt_Report, Txt_Report,
Gbl.Prefs.IconsURL, Gbl.Prefs.IconsURL,
Txt_Report, Txt_Report,
FilenameReport); Report->FilenameReport);
fprintf (Gbl.F.Out,"<div class=\"DAT_LIGHT\">%s</div>", fprintf (Gbl.F.Out,"<div class=\"DAT_LIGHT\">%s</div>",
Txt_This_link_will_remain_active_as_long_as_your_user_s_account_exists); Txt_This_link_will_remain_active_as_long_as_your_user_s_account_exists);