diff --git a/swad_action.c b/swad_action.c index ecd1a6834..e1d5fc5b2 100644 --- a/swad_action.c +++ b/swad_action.c @@ -1311,7 +1311,6 @@ Statistics: 1124. ActSeeAccCrs Query clicks to current course 1125. ActSeeAllStaCrs Show statistics of courses NEW. ActSeeMyUsgRep Show my usage report - NEW. ActPrnMyUsgRep Print my usage report Profile: 1126. ActFrmLogIn Show landing page (forms to log in and to create a new account) 1127. ActFrmRolSes Show form to log out and to change current role in this session @@ -2742,7 +2741,6 @@ struct Act_Actions Act_Actions[Act_NUM_ACTIONS] = /* ActSeeAllStaCrs */{ 768,-1,TabSta,ActReqAccGbl ,0x1FF,0x1FF,0x1FF,Act_CONTENT_NORM,Act_NEW_WINDOW ,NULL ,Ind_ShowIndicatorsCourses ,NULL}, /* ActSeeMyUsgRep */{1582,-1,TabSta,ActReqMyUsgRep ,0x100,0x100,0x100,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Rep_ShowMyUsageReport ,NULL}, - /* ActPrnMyUsgRep */{1583, 5,TabSta,ActReqMyUsgRep ,0x100,0x100,0x100,Act_CONTENT_NORM,Act_NEW_WINDOW ,NULL ,Rep_PrintMyUsageReport ,NULL}, // TabPrf ****************************************************************** // Actions in menu: @@ -4441,7 +4439,7 @@ Act_Action_t Act_FromActCodToAction[1+Act_MAX_ACTION_COD] = // Do not reuse uniq ActRemDupUsr, // #1580 ActSeeMyAgd, // #1581 ActSeeMyUsgRep, // #1582 - ActPrnMyUsgRep, // #1583 + -1, // #1583 (obsolete action) ActChkUsrAcc, // #1584 ActAutUsrNew, // #1585 ActReqMyUsgRep, // #1586 diff --git a/swad_action.h b/swad_action.h index eb78692f6..9a069194c 100644 --- a/swad_action.h +++ b/swad_action.h @@ -72,7 +72,7 @@ typedef enum typedef int Act_Action_t; // Must be a signed type, because -1 is used to indicate obsolete action -#define Act_NUM_ACTIONS (1+9+51+15+90+70+67+246+186+156+172+36+31+87) +#define Act_NUM_ACTIONS (1+9+51+15+90+70+67+246+186+156+172+36+30+87) #define Act_MAX_ACTION_COD 1586 @@ -1364,110 +1364,109 @@ typedef int Act_Action_t; // Must be a signed type, because -1 is used to indica #define ActSeeAllStaCrs (ActUnbUsrLst+ 29) #define ActSeeMyUsgRep (ActUnbUsrLst+ 30) -#define ActPrnMyUsgRep (ActUnbUsrLst+ 31) /*****************************************************************************/ /******************************** Profile tab ********************************/ /*****************************************************************************/ // Actions in menu -#define ActFrmLogIn (ActPrnMyUsgRep+ 1) -#define ActFrmRolSes (ActPrnMyUsgRep+ 2) -#define ActMyCrs (ActPrnMyUsgRep+ 3) -#define ActSeeMyTT (ActPrnMyUsgRep+ 4) -#define ActSeeMyAgd (ActPrnMyUsgRep+ 5) -#define ActFrmUsrAcc (ActPrnMyUsgRep+ 6) -#define ActReqEdiRecCom (ActPrnMyUsgRep+ 7) -#define ActEdiPrf (ActPrnMyUsgRep+ 8) -#define ActAdmBrf (ActPrnMyUsgRep+ 9) -#define ActMFUAct (ActPrnMyUsgRep+10) +#define ActFrmLogIn (ActSeeMyUsgRep+ 1) +#define ActFrmRolSes (ActSeeMyUsgRep+ 2) +#define ActMyCrs (ActSeeMyUsgRep+ 3) +#define ActSeeMyTT (ActSeeMyUsgRep+ 4) +#define ActSeeMyAgd (ActSeeMyUsgRep+ 5) +#define ActFrmUsrAcc (ActSeeMyUsgRep+ 6) +#define ActReqEdiRecCom (ActSeeMyUsgRep+ 7) +#define ActEdiPrf (ActSeeMyUsgRep+ 8) +#define ActAdmBrf (ActSeeMyUsgRep+ 9) +#define ActMFUAct (ActSeeMyUsgRep+10) // Secondary actions -#define ActReqSndNewPwd (ActPrnMyUsgRep+11) -#define ActSndNewPwd (ActPrnMyUsgRep+12) -#define ActLogOut (ActPrnMyUsgRep+13) -#define ActAutUsrInt (ActPrnMyUsgRep+14) -#define ActAutUsrNew (ActPrnMyUsgRep+15) -#define ActAutUsrExt (ActPrnMyUsgRep+16) -#define ActAutUsrChgLan (ActPrnMyUsgRep+17) -#define ActAnnSee (ActPrnMyUsgRep+18) -#define ActChgMyRol (ActPrnMyUsgRep+19) -#define ActChkUsrAcc (ActPrnMyUsgRep+20) -#define ActCreUsrAcc (ActPrnMyUsgRep+21) -#define ActRemID_Me (ActPrnMyUsgRep+22) -#define ActNewIDMe (ActPrnMyUsgRep+23) -#define ActRemOldNic (ActPrnMyUsgRep+24) -#define ActChgNic (ActPrnMyUsgRep+25) -#define ActRemMaiMe (ActPrnMyUsgRep+26) -#define ActNewMaiMe (ActPrnMyUsgRep+27) -#define ActCnfMai (ActPrnMyUsgRep+28) -#define ActFrmChgMyPwd (ActPrnMyUsgRep+29) -#define ActChgPwd (ActPrnMyUsgRep+30) -#define ActReqRemMyAcc (ActPrnMyUsgRep+31) -#define ActRemMyAcc (ActPrnMyUsgRep+32) +#define ActReqSndNewPwd (ActSeeMyUsgRep+11) +#define ActSndNewPwd (ActSeeMyUsgRep+12) +#define ActLogOut (ActSeeMyUsgRep+13) +#define ActAutUsrInt (ActSeeMyUsgRep+14) +#define ActAutUsrNew (ActSeeMyUsgRep+15) +#define ActAutUsrExt (ActSeeMyUsgRep+16) +#define ActAutUsrChgLan (ActSeeMyUsgRep+17) +#define ActAnnSee (ActSeeMyUsgRep+18) +#define ActChgMyRol (ActSeeMyUsgRep+19) +#define ActChkUsrAcc (ActSeeMyUsgRep+20) +#define ActCreUsrAcc (ActSeeMyUsgRep+21) +#define ActRemID_Me (ActSeeMyUsgRep+22) +#define ActNewIDMe (ActSeeMyUsgRep+23) +#define ActRemOldNic (ActSeeMyUsgRep+24) +#define ActChgNic (ActSeeMyUsgRep+25) +#define ActRemMaiMe (ActSeeMyUsgRep+26) +#define ActNewMaiMe (ActSeeMyUsgRep+27) +#define ActCnfMai (ActSeeMyUsgRep+28) +#define ActFrmChgMyPwd (ActSeeMyUsgRep+29) +#define ActChgPwd (ActSeeMyUsgRep+30) +#define ActReqRemMyAcc (ActSeeMyUsgRep+31) +#define ActRemMyAcc (ActSeeMyUsgRep+32) -#define ActChgMyData (ActPrnMyUsgRep+33) +#define ActChgMyData (ActSeeMyUsgRep+33) -#define ActReqMyPho (ActPrnMyUsgRep+34) -#define ActDetMyPho (ActPrnMyUsgRep+35) -#define ActUpdMyPho (ActPrnMyUsgRep+36) -#define ActReqRemMyPho (ActPrnMyUsgRep+37) -#define ActRemMyPho (ActPrnMyUsgRep+38) +#define ActReqMyPho (ActSeeMyUsgRep+34) +#define ActDetMyPho (ActSeeMyUsgRep+35) +#define ActUpdMyPho (ActSeeMyUsgRep+36) +#define ActReqRemMyPho (ActSeeMyUsgRep+37) +#define ActRemMyPho (ActSeeMyUsgRep+38) -#define ActEdiPri (ActPrnMyUsgRep+39) -#define ActChgPriPho (ActPrnMyUsgRep+40) -#define ActChgPriPrf (ActPrnMyUsgRep+41) +#define ActEdiPri (ActSeeMyUsgRep+39) +#define ActChgPriPho (ActSeeMyUsgRep+40) +#define ActChgPriPrf (ActSeeMyUsgRep+41) -#define ActReqEdiMyIns (ActPrnMyUsgRep+42) -#define ActChgCtyMyIns (ActPrnMyUsgRep+43) -#define ActChgMyIns (ActPrnMyUsgRep+44) -#define ActChgMyCtr (ActPrnMyUsgRep+45) -#define ActChgMyDpt (ActPrnMyUsgRep+46) -#define ActChgMyOff (ActPrnMyUsgRep+47) -#define ActChgMyOffPho (ActPrnMyUsgRep+48) +#define ActReqEdiMyIns (ActSeeMyUsgRep+42) +#define ActChgCtyMyIns (ActSeeMyUsgRep+43) +#define ActChgMyIns (ActSeeMyUsgRep+44) +#define ActChgMyCtr (ActSeeMyUsgRep+45) +#define ActChgMyDpt (ActSeeMyUsgRep+46) +#define ActChgMyOff (ActSeeMyUsgRep+47) +#define ActChgMyOffPho (ActSeeMyUsgRep+48) -#define ActReqEdiMyNet (ActPrnMyUsgRep+49) -#define ActChgMyNet (ActPrnMyUsgRep+50) +#define ActReqEdiMyNet (ActSeeMyUsgRep+49) +#define ActChgMyNet (ActSeeMyUsgRep+50) -#define ActChgThe (ActPrnMyUsgRep+51) -#define ActReqChgLan (ActPrnMyUsgRep+52) -#define ActChgLan (ActPrnMyUsgRep+53) -#define ActChg1stDay (ActPrnMyUsgRep+54) -#define ActChgCol (ActPrnMyUsgRep+55) -#define ActHidLftCol (ActPrnMyUsgRep+56) -#define ActHidRgtCol (ActPrnMyUsgRep+57) -#define ActShoLftCol (ActPrnMyUsgRep+58) -#define ActShoRgtCol (ActPrnMyUsgRep+59) -#define ActChgIco (ActPrnMyUsgRep+60) -#define ActChgMnu (ActPrnMyUsgRep+61) -#define ActChgNtfPrf (ActPrnMyUsgRep+62) +#define ActChgThe (ActSeeMyUsgRep+51) +#define ActReqChgLan (ActSeeMyUsgRep+52) +#define ActChgLan (ActSeeMyUsgRep+53) +#define ActChg1stDay (ActSeeMyUsgRep+54) +#define ActChgCol (ActSeeMyUsgRep+55) +#define ActHidLftCol (ActSeeMyUsgRep+56) +#define ActHidRgtCol (ActSeeMyUsgRep+57) +#define ActShoLftCol (ActSeeMyUsgRep+58) +#define ActShoRgtCol (ActSeeMyUsgRep+59) +#define ActChgIco (ActSeeMyUsgRep+60) +#define ActChgMnu (ActSeeMyUsgRep+61) +#define ActChgNtfPrf (ActSeeMyUsgRep+62) -#define ActPrnUsrQR (ActPrnMyUsgRep+63) +#define ActPrnUsrQR (ActSeeMyUsgRep+63) -#define ActPrnMyTT (ActPrnMyUsgRep+64) -#define ActEdiTut (ActPrnMyUsgRep+65) -#define ActChgTut (ActPrnMyUsgRep+66) -#define ActChgMyTT1stDay (ActPrnMyUsgRep+67) +#define ActPrnMyTT (ActSeeMyUsgRep+64) +#define ActEdiTut (ActSeeMyUsgRep+65) +#define ActChgTut (ActSeeMyUsgRep+66) +#define ActChgMyTT1stDay (ActSeeMyUsgRep+67) -#define ActReqRemFilBrf (ActPrnMyUsgRep+68) -#define ActRemFilBrf (ActPrnMyUsgRep+69) -#define ActRemFolBrf (ActPrnMyUsgRep+70) -#define ActCopBrf (ActPrnMyUsgRep+71) -#define ActPasBrf (ActPrnMyUsgRep+72) -#define ActRemTreBrf (ActPrnMyUsgRep+73) -#define ActFrmCreBrf (ActPrnMyUsgRep+74) -#define ActCreFolBrf (ActPrnMyUsgRep+75) -#define ActCreLnkBrf (ActPrnMyUsgRep+76) -#define ActRenFolBrf (ActPrnMyUsgRep+77) -#define ActRcvFilBrfDZ (ActPrnMyUsgRep+78) -#define ActRcvFilBrfCla (ActPrnMyUsgRep+79) -#define ActExpBrf (ActPrnMyUsgRep+80) -#define ActConBrf (ActPrnMyUsgRep+81) -#define ActZIPBrf (ActPrnMyUsgRep+82) -#define ActReqDatBrf (ActPrnMyUsgRep+83) -#define ActChgDatBrf (ActPrnMyUsgRep+84) -#define ActDowBrf (ActPrnMyUsgRep+85) +#define ActReqRemFilBrf (ActSeeMyUsgRep+68) +#define ActRemFilBrf (ActSeeMyUsgRep+69) +#define ActRemFolBrf (ActSeeMyUsgRep+70) +#define ActCopBrf (ActSeeMyUsgRep+71) +#define ActPasBrf (ActSeeMyUsgRep+72) +#define ActRemTreBrf (ActSeeMyUsgRep+73) +#define ActFrmCreBrf (ActSeeMyUsgRep+74) +#define ActCreFolBrf (ActSeeMyUsgRep+75) +#define ActCreLnkBrf (ActSeeMyUsgRep+76) +#define ActRenFolBrf (ActSeeMyUsgRep+77) +#define ActRcvFilBrfDZ (ActSeeMyUsgRep+78) +#define ActRcvFilBrfCla (ActSeeMyUsgRep+79) +#define ActExpBrf (ActSeeMyUsgRep+80) +#define ActConBrf (ActSeeMyUsgRep+81) +#define ActZIPBrf (ActSeeMyUsgRep+82) +#define ActReqDatBrf (ActSeeMyUsgRep+83) +#define ActChgDatBrf (ActSeeMyUsgRep+84) +#define ActDowBrf (ActSeeMyUsgRep+85) -#define ActReqRemOldBrf (ActPrnMyUsgRep+86) -#define ActRemOldBrf (ActPrnMyUsgRep+87) +#define ActReqRemOldBrf (ActSeeMyUsgRep+86) +#define ActRemOldBrf (ActSeeMyUsgRep+87) /*****************************************************************************/ /******************************** Public types *******************************/ diff --git a/swad_changelog.h b/swad_changelog.h index ef3fb8472..ea5c22e81 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -143,14 +143,18 @@ /****************************** Public constants *****************************/ /*****************************************************************************/ -#define Log_PLATFORM_VERSION "SWAD 16.10 (2016-10-03)" +#define Log_PLATFORM_VERSION "SWAD 16.11 (2016-10-03)" #define CSS_FILE "swad15.229.css" #define JS_FILE "swad15.238.1.js" // 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 16.11: Oct 03, 2016 Created permalinks to report files. (? lines) + * + Version 16.11: Oct 03, 2016 Created permalinks to report files. (205793 lines) + 1 change necessary in database: +UPDATE actions SET Obsolete='Y' WHERE ActCod='1583'; + Version 16.10: Oct 03, 2016 All user's figures are calculated in one click. (205795 lines) Version 16.9: Oct 03, 2016 User's usage report is written into a temporary file. (205795 lines) Version 16.8.1: Oct 03, 2016 Do not show courses with a few clicks in user's usage report. (205747 lines) diff --git a/swad_file_browser.c b/swad_file_browser.c index d07824846..de606f1b7 100644 --- a/swad_file_browser.c +++ b/swad_file_browser.c @@ -1508,7 +1508,6 @@ static void Brw_PutIconNewFileOrFolder (void); static void Brw_PutIconFileWithLinkToViewMetadata (unsigned Size, struct FileMetadata *FileMetadata, const char *FileNameToShow); -static void Brw_PutIconFile (unsigned Size,Brw_FileType_t FileType,const char *FileName); static void Brw_WriteFileName (unsigned Level,bool IsPublic,Brw_FileType_t FileType, const char *PathInTree,const char *FileName,const char *FileNameToShow); static void Brw_GetFileNameToShow (Brw_FileBrowser_t FileBrowser,unsigned Level,Brw_FileType_t FileType, @@ -5860,7 +5859,7 @@ static void Brw_PutIconFileWithLinkToViewMetadata (unsigned Size, /***************************** Put icon of a file ****************************/ /*****************************************************************************/ -static void Brw_PutIconFile (unsigned Size,Brw_FileType_t FileType,const char *FileName) +void Brw_PutIconFile (unsigned Size,Brw_FileType_t FileType,const char *FileName) { extern const char *Txt_Link; extern const char *Txt_X_file; diff --git a/swad_file_browser.h b/swad_file_browser.h index 1785a79cc..4a73643a2 100644 --- a/swad_file_browser.h +++ b/swad_file_browser.h @@ -222,6 +222,8 @@ void Brw_CalcSizeOfDir (char *Path); void Brw_SetFullPathInTree (const char *PathInTreeUntilFileOrFolder,const char *FilFolLnkName); +void Brw_PutIconFile (unsigned Size,Brw_FileType_t FileType,const char *FileName); + void Brw_CreateTmpPublicLinkToPrivateFile (const char *FullPathIncludingFile, const char *FileName); diff --git a/swad_info.c b/swad_info.c index 03ba09ccd..1cc7e1c81 100644 --- a/swad_info.c +++ b/swad_info.c @@ -1887,7 +1887,6 @@ static bool Inf_CheckAndShowRichTxt (void) int Inf_WritePlainTextIntoHTMLBuffer (char **HTMLBuffer) { - extern const char *Txt_STR_LANG_ID[1+Txt_NUM_LANGUAGES]; extern const char *Txt_INFO_TITLE[Inf_NUM_INFO_TYPES]; char TxtHTML[Cns_MAX_BYTES_LONG_TEXT+1]; char FileNameHTMLTmp[PATH_MAX+1]; @@ -1914,16 +1913,7 @@ int Inf_WritePlainTextIntoHTMLBuffer (char **HTMLBuffer) "Can not create temporary file"); /***** Write start of HTML code *****/ - fprintf (FileHTMLTmp,"\n" - "\n" - "\n" - "\n" - "%s\n" - "\n" - "\n", - Txt_STR_LANG_ID[Gbl.Prefs.Language], // Language - Txt_INFO_TITLE[Gbl.CurrentCrs.Info.Type]); // Page title + Lay_StartHTMLFile (FileHTMLTmp,Txt_INFO_TITLE[Gbl.CurrentCrs.Info.Type]); /***** Write plain text into text buffer *****/ fprintf (FileHTMLTmp,"
\n"); diff --git a/swad_layout.c b/swad_layout.c index 73352a463..9827d9ae2 100644 --- a/swad_layout.c +++ b/swad_layout.c @@ -1730,6 +1730,7 @@ void Lay_IndentDependingOnLevel (unsigned Level,bool IsLastItemInLevel[]) IsLastItemInLevel[Level] ? "subend" : "submid"); } + /*****************************************************************************/ /************************** Help for the text editor *************************/ /*****************************************************************************/ @@ -1768,3 +1769,23 @@ static void Lay_HelpTextEditor (const char *Text,const char *InlineMath,const ch Txt_Inline_math,InlineMath, Txt_Equation_centered,Equation); } + +/*****************************************************************************/ +/************************** Help for the text editor *************************/ +/*****************************************************************************/ + +void Lay_StartHTMLFile (FILE *File,const char *Title) + { + extern const char *Txt_STR_LANG_ID[1+Txt_NUM_LANGUAGES]; + + fprintf (File,"\n" + "\n" + "\n" + "\n" + "%s\n" + "\n" + "\n", + Txt_STR_LANG_ID[Gbl.Prefs.Language], // Language + Title); // Page title + } diff --git a/swad_layout.h b/swad_layout.h index 0187dc17b..48a0211b7 100644 --- a/swad_layout.h +++ b/swad_layout.h @@ -118,4 +118,6 @@ void Lay_IndentDependingOnLevel (unsigned Level,bool IsLastItemInLevel[]); void Lay_HelpPlainEditor (void); void Lay_HelpRichEditor (void); +void Lay_StartHTMLFile (FILE *File,const char *Title); + #endif diff --git a/swad_report.c b/swad_report.c index 71687d4c7..220668d02 100644 --- a/swad_report.c +++ b/swad_report.c @@ -44,7 +44,7 @@ /*****************************************************************************/ #define Rep_MIN_CLICKS_CRS 100 // Minimum number of clicks to show a course in historic log -#define Rep_MAX_BAR_WIDTH 80 // Maximum width of graphic bar +#define Rep_MAX_BAR_WIDTH 40 // 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 @@ -57,12 +57,6 @@ /****************************** Internal types *******************************/ /*****************************************************************************/ -typedef enum - { - Rep_SEE, - Rep_PRINT, - } Rep_SeeOrPrint_t; - /*****************************************************************************/ /************** External global variables from others modules ****************/ /*****************************************************************************/ @@ -77,10 +71,7 @@ extern struct Globals Gbl; /***************************** Private prototypes ****************************/ /*****************************************************************************/ -static void Rep_ShowOrPrintMyUsageReport (Rep_SeeOrPrint_t SeeOrPrint); -static void Rep_PutIconToPrintMyUsageReport (void); - -static void Rep_WriteHeader (FILE *FileDst,const char *StrCurrentDateUTC); +static void Rep_WriteHeader (const char *StrCurrentDateUTC,const char *Permalink); static void Rep_WriteSectionPlatform (void); static void Rep_WriteSectionUsrInfo (void); static void Rep_WriteSectionUsrFigures (struct UsrFigures *UsrFigures, @@ -142,7 +133,8 @@ void Rep_ReqMyUsageReport (void) Lay_StartRoundFrame (NULL,Gbl.Title,NULL); /***** Header *****/ - fprintf (Gbl.F.Out,"
%s",Gbl.Usrs.Me.UsrDat.FullName); + fprintf (Gbl.F.Out,"
" + "%s",Gbl.Usrs.Me.UsrDat.FullName); if (StrCurrentDateUTC[0]) fprintf (Gbl.F.Out,"
%s",StrCurrentDateUTC); fprintf (Gbl.F.Out,"
"); @@ -156,20 +148,13 @@ void Rep_ReqMyUsageReport (void) void Rep_ShowMyUsageReport (void) { - Rep_ShowOrPrintMyUsageReport (false); - } - -void Rep_PrintMyUsageReport (void) - { - Rep_ShowOrPrintMyUsageReport (true); - } - -static void Rep_ShowOrPrintMyUsageReport (Rep_SeeOrPrint_t SeeOrPrint) - { + extern const char *Txt_Report_of_use_of_PLATFORM; extern const char *Txt_Report; + extern const char *Txt_Download; struct UsrFigures UsrFigures; char PathReports[PATH_MAX+1]; char PathFileReport[PATH_MAX+1]; + char Permalink[PATH_MAX+1]; struct tm tm_FirstClickTime; char StrCurrentDateUTC[10+1]; // Example: 2016-10-02 // 1234567890 @@ -181,27 +166,27 @@ static void Rep_ShowOrPrintMyUsageReport (Rep_SeeOrPrint_t SeeOrPrint) /***** Get current date-time *****/ Dat_GetCurrentDateTimeUTC (StrCurrentDateUTC,StrCurrentTimeUTC); - /***** Start frame *****/ - if (SeeOrPrint == Rep_SEE) - Lay_StartRoundFrame (NULL,Txt_Report, - Rep_PutIconToPrintMyUsageReport); - /***** Path for reports *****/ - sprintf (PathReports,"%s/%s",Cfg_PATH_SWAD_PRIVATE,Cfg_FOLDER_REP); + sprintf (PathReports,"%s/%s",Cfg_PATH_SWAD_PUBLIC,Cfg_FOLDER_REP); Fil_CreateDirIfNotExists (PathReports); /***** Create a new empty syllabus *****/ /* Path of the private directory for the file with the report */ sprintf (PathFileReport,"%s/%s.html", PathReports,Gbl.UniqueNameEncrypted); + sprintf (Permalink,"%s/%s/%s.html", + Cfg_URL_SWAD_PUBLIC, + Cfg_FOLDER_REP, + Gbl.UniqueNameEncrypted); if ((Gbl.F.Rep = fopen (PathFileReport,"wb")) == NULL) Lay_ShowErrorAndExit ("Can not create report file."); /***** Start file *****/ - fprintf (Gbl.F.Rep,"
\n"); + Lay_StartHTMLFile (Gbl.F.Rep,Txt_Report); + fprintf (Gbl.F.Rep,"
\n"); /***** Header *****/ - Rep_WriteHeader (Gbl.F.Rep,StrCurrentDateUTC); + Rep_WriteHeader (StrCurrentDateUTC,Permalink); /***** Platform *****/ Rep_WriteSectionPlatform (); @@ -214,7 +199,6 @@ static void Rep_ShowOrPrintMyUsageReport (Rep_SeeOrPrint_t SeeOrPrint) GetUsrFiguresAgain = Prf_GetAndStoreAllUsrFigures (Gbl.Usrs.Me.UsrDat.UsrCod,&UsrFigures); if (GetUsrFiguresAgain) Prf_GetUsrFigures (Gbl.Usrs.Me.UsrDat.UsrCod,&UsrFigures); - if (UsrFigures.FirstClickTimeUTC) gmtime_r (&UsrFigures.FirstClickTimeUTC,&tm_FirstClickTime); Rep_WriteSectionUsrFigures (&UsrFigures,&tm_FirstClickTime, @@ -233,61 +217,72 @@ static void Rep_ShowOrPrintMyUsageReport (Rep_SeeOrPrint_t SeeOrPrint) MaxHitsPerYear); /***** End file *****/ - fprintf (Gbl.F.Rep,"
\n"); + fprintf (Gbl.F.Rep,"
\n" + "\n" + "\n"); - /***** Open report file for reading *****/ - if ((Gbl.F.Rep = fopen (PathFileReport,"rb")) == NULL) - Lay_ShowErrorAndExit ("Can not open report file."); - - /***** Copy from report file to output file *****/ - Fil_FastCopyOfOpenFiles (Gbl.F.Rep,Gbl.F.Out); - - /***** Close and remove report file *****/ + /***** Close report file *****/ Fil_CloseReportFile (); - unlink (PathFileReport); + + /***** Start frame *****/ + sprintf (Gbl.Title,Txt_Report_of_use_of_PLATFORM,Cfg_PLATFORM_SHORT_NAME); + Lay_StartRoundFrame (NULL,Gbl.Title,NULL); + + /***** Header *****/ + fprintf (Gbl.F.Out,"
" + "%s",Gbl.Usrs.Me.UsrDat.FullName); + if (StrCurrentDateUTC[0]) + fprintf (Gbl.F.Out,"
%s",StrCurrentDateUTC); + fprintf (Gbl.F.Out,"
"); + + /***** Put anchor and report filename *****/ + fprintf (Gbl.F.Out,"", + Permalink, + Gbl.Prefs.IconsURL, + Txt_Download,Txt_Download); /***** End frame *****/ - if (SeeOrPrint == Rep_SEE) - Lay_EndRoundFrame (); - } - -/*****************************************************************************/ -/********************* Put icon to print my usage report *********************/ -/*****************************************************************************/ - -static void Rep_PutIconToPrintMyUsageReport (void) - { - extern const char *Txt_Print; - - Lay_PutContextualLink (ActPrnMyUsgRep,NULL, - "print64x64.png", - Txt_Print,NULL, - NULL); + Lay_EndRoundFrame (); } /*****************************************************************************/ /******************** Write header of user's usage report ********************/ /*****************************************************************************/ -static void Rep_WriteHeader (FILE *FileDst,const char *StrCurrentDateUTC) +static void Rep_WriteHeader (const char *StrCurrentDateUTC,const char *Permalink) { extern const char *Txt_Report_of_use_of_PLATFORM; /***** Start of header *****/ - fprintf (FileDst,"
"); + fprintf (Gbl.F.Rep,"
"); /***** Main title *****/ sprintf (Gbl.Title,Txt_Report_of_use_of_PLATFORM,Cfg_PLATFORM_SHORT_NAME); - fprintf (FileDst,"

%s

",Gbl.Title); + fprintf (Gbl.F.Rep,"

%s

",Gbl.Title); /***** Subtitle *****/ - fprintf (FileDst,"

%s",Gbl.Usrs.Me.UsrDat.FullName); + fprintf (Gbl.F.Rep,"

%s",Gbl.Usrs.Me.UsrDat.FullName); if (StrCurrentDateUTC[0]) - fprintf (FileDst,", %s",StrCurrentDateUTC); - fprintf (FileDst,"

"); + fprintf (Gbl.F.Rep,", %s",StrCurrentDateUTC); + fprintf (Gbl.F.Rep,""); + + /***** Permalink *****/ + fprintf (Gbl.F.Rep,"%s\n", + Permalink,Permalink); /***** End of header *****/ - fprintf (FileDst,"
\n"); + fprintf (Gbl.F.Rep,"
\n"); } /*****************************************************************************/ @@ -303,7 +298,7 @@ static void Rep_WriteSectionPlatform (void) /***** Start of section *****/ fprintf (Gbl.F.Rep,"
" - "

%s

" + "

%s

" "
    ", Txt_Teaching_platform); @@ -337,7 +332,7 @@ static void Rep_WriteSectionUsrInfo (void) /***** Start of section *****/ fprintf (Gbl.F.Rep,"
    " - "

    %s

    " + "

    %s

    " "
      ", Txt_Personal_information); @@ -402,7 +397,7 @@ static void Rep_WriteSectionUsrFigures (struct UsrFigures *UsrFigures, /***** Start of section *****/ fprintf (Gbl.F.Rep,"
      " - "

      %s

      " + "

      %s

      " "
        ", Txt_Figures); @@ -548,7 +543,7 @@ static void Rep_WriteSectionGlobalHits (struct UsrFigures *UsrFigures, /***** Start of section *****/ fprintf (Gbl.F.Rep,"
        " - "

        %s

        ", + "

        %s

        ", Txt_Hits); /***** Global (in any course) hits per year *****/ @@ -576,11 +571,11 @@ static void Rep_WriteSectionCurrentCourses (struct UsrFigures *UsrFigures, /***** Start of section *****/ fprintf (Gbl.F.Rep,"
        " - "

        %s", + "

        %s", Txt_Courses); if (StrCurrentDateUTC[0]) fprintf (Gbl.F.Rep," (%s)",StrCurrentDateUTC); - fprintf (Gbl.F.Rep,"

        " + fprintf (Gbl.F.Rep,"" "
          "); /***** Number of courses in which the user is student/teacher *****/ @@ -612,7 +607,7 @@ static void Rep_WriteSectionHistoricCourses (struct UsrFigures *UsrFigures, /***** Start of section *****/ fprintf (Gbl.F.Rep,"
          " - "

          %s (%s)

          ", + "

          %s (%s)

          ", Txt_Courses,Txt_historical_log); fprintf (Gbl.F.Rep,Txt_Only_courses_with_more_than_X_clicks_are_shown, Rep_MIN_CLICKS_CRS); @@ -956,7 +951,7 @@ static void Rep_ShowMyHitsPerYear (bool AnyCourse,long CrsCod,Rol_Role_t Role, Year--) { /* Write the year */ - fprintf (Gbl.F.Rep,"%04u ",Year); + fprintf (Gbl.F.Rep,"%04u ",Year); /* Draw bar proportional to number of hits */ Rep_DrawBarNumHits (Year == LastYear ? Hits.Num : @@ -972,7 +967,7 @@ static void Rep_ShowMyHitsPerYear (bool AnyCourse,long CrsCod,Rol_Role_t Role, Year--) { /* Write the year */ - fprintf (Gbl.F.Rep,"%04u ",Year); + fprintf (Gbl.F.Rep,"%04u ",Year); /* Draw bar proportional to number of hits */ Rep_DrawBarNumHits (0.0,Hits.Max,Rep_MAX_BAR_WIDTH); @@ -999,12 +994,8 @@ static void Rep_DrawBarNumHits (float HitsNum,float HitsMax, fprintf (Gbl.F.Rep,Rep_BLOCK); /***** Write the number of hits *****/ - fprintf (Gbl.F.Rep," "); + fprintf (Gbl.F.Rep," "); Str_WriteFloatNum (Gbl.F.Rep,HitsNum); } - else - /***** Write the number of clicks *****/ - fprintf (Gbl.F.Rep,"0"); - fprintf (Gbl.F.Rep,"
          "); } diff --git a/swad_syllabus.c b/swad_syllabus.c index 43da9d1cd..970677b57 100644 --- a/swad_syllabus.c +++ b/swad_syllabus.c @@ -836,22 +836,13 @@ int Syl_WriteSyllabusIntoHTMLBuffer (char **HTMLBuffer) static void Syl_WriteSyllabusIntoHTMLTmpFile (FILE *FileHTMLTmp) { - extern const char *Txt_STR_LANG_ID[1+Txt_NUM_LANGUAGES]; extern const char *Txt_INFO_TITLE[Inf_NUM_INFO_TYPES]; unsigned NumItem; int i; /***** Write start of HTML code *****/ - fprintf (FileHTMLTmp,"\n" - "\n" - "\n" - "\n" - "%s\n" - "\n" - "\n" - "\n", - Txt_STR_LANG_ID[Gbl.Prefs.Language], // Language - Txt_INFO_TITLE[Gbl.CurrentCrs.Info.Type]); // Page title + Lay_StartHTMLFile (FileHTMLTmp,Txt_INFO_TITLE[Gbl.CurrentCrs.Info.Type]); + fprintf (FileHTMLTmp,"
          \n"); /***** Set width of columns of the table *****/ fprintf (FileHTMLTmp,"\n");