diff --git a/js/swad.js b/js/swad.js index 9689f163d..ba1bd143d 100644 --- a/js/swad.js +++ b/js/swad.js @@ -432,11 +432,13 @@ function enableDisableContAns(Elem,IsDisabled) { } // Selection of statistics of current course ****/ -function enableRowsPage () { +function enableDetailedClicks () { document.getElementById('CountType').disabled = true; + document.getElementById('GroupedBy').disabled = true; document.getElementById('RowsPage').disabled = false; } -function disableRowsPage () { +function disableDetailedClicks () { document.getElementById('CountType').disabled = false; + document.getElementById('GroupedBy').disabled = false; document.getElementById('RowsPage').disabled = true; } diff --git a/swad_changelog.h b/swad_changelog.h index 3b2ed93c9..f16944b27 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -98,11 +98,14 @@ /****************************** Public constants *****************************/ /*****************************************************************************/ -#define Log_PLATFORM_VERSION "SWAD 15.0.3 (2015/09/24)" +#define Log_PLATFORM_VERSION "SWAD 15.1 (2015/09/25)" // 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 /* +BUG: Stats from country: "Wrong scope" + + Version 15.1: Sep 25, 2015 Changes in layout of statistics of clicks. (185058 lines) Version 15.0.3: Sep 24, 2015 Fixed bug when printing country information. (185013 lines) Version 15.0.2: Sep 24, 2015 New layout in preferences. (185011 lines) Version 15.0.1: Sep 23, 2015 Fix bugs in size of background images. (185006 lines) diff --git a/swad_global.c b/swad_global.c index 692d69c3b..26136ca08 100644 --- a/swad_global.c +++ b/swad_global.c @@ -400,12 +400,12 @@ void Gbl_InitializeGlobals (void) Gbl.DateRange.DateEnd.Month = Gbl.Now.Date.Month; Gbl.DateRange.DateEnd.Day = Gbl.Now.Date.Day; - Gbl.Stat.ClicksStatType = Sta_ACC_CRS_PER_USR; - Gbl.Stat.CountType = Sta_TOTAL_CLICKS; - Gbl.Stat.Role = Sta_IDENTIFIED_USRS; - Gbl.Stat.NumAction = ActAll; - Gbl.Stat.RowsPerPage = 50; - Gbl.Stat.UseStatType = Sta_USERS; + Gbl.Stat.ClicksGroupedBy = Sta_CLICKS_CRS_PER_USR; + Gbl.Stat.CountType = Sta_TOTAL_CLICKS; + Gbl.Stat.Role = Sta_IDENTIFIED_USRS; + Gbl.Stat.NumAction = ActAll; + Gbl.Stat.RowsPerPage = 50; + Gbl.Stat.UseStatType = Sta_USERS; Gbl.Scope.Current = Sco_SCOPE_CRS; diff --git a/swad_global.h b/swad_global.h index fc63edfa5..e8f253798 100644 --- a/swad_global.h +++ b/swad_global.h @@ -653,8 +653,8 @@ struct Globals } Svys; struct { - Sta_ClicksStatType_t ClicksStatType; - Sta_UseStatType_t UseStatType; + Sta_ClicksGroupedBy_t ClicksGroupedBy; + Sta_FigureType_t UseStatType; Sta_Role_t Role; Sta_CountType_t CountType; Act_Action_t NumAction; diff --git a/swad_network.c b/swad_network.c index 3e8a972e3..eb21acd56 100644 --- a/swad_network.c +++ b/swad_network.c @@ -360,7 +360,7 @@ static void Net_GetMyWebsAndSocialNetsFromForm (void) void Net_ShowWebAndSocialNetworksStats (void) { - extern const char *Txt_STAT_USE_STAT_TYPES[Sta_NUM_TYPES_USE_STATS]; + extern const char *Txt_STAT_USE_STAT_TYPES[Sta_NUM_FIGURES]; extern const char *Txt_Web_social_network; extern const char *Txt_No_of_users; extern const char *Txt_PERCENT_of_users; diff --git a/swad_statistic.c b/swad_statistic.c index d50319dae..f8a3f8881 100644 --- a/swad_statistic.c +++ b/swad_statistic.c @@ -395,14 +395,17 @@ static void Sta_PutFormToRequestAccessesCrs (void) void Sta_AskSeeCrsAccesses (void) { extern const char *The_ClassForm[The_NUM_THEMES]; + extern const char *Txt_Statistics_of_access; + extern const char *Txt_Users; + extern const char *Txt_Show; extern const char *Txt_distributed_by; - extern const char *Txt_STAT_CLICK_STAT_TYPES[Sta_NUM_TYPES_CLICK_STATS]; + extern const char *Txt_STAT_CLICKS_GROUPED_BY[Sta_NUM_CLICKS_GROUPED_BY]; extern const char *Txt_results_per_page; extern const char *Txt_Show_visits; extern const char *Txt_No_teachers_or_students_found; static unsigned long RowsPerPage[] = {10,20,30,40,50,100,500,1000,5000,10000,50000,100000}; #define NUM_OPTIONS_ROWS_PER_PAGE (sizeof (RowsPerPage) / sizeof (RowsPerPage[0])) - Sta_ClicksStatType_t ClicksStatType; + Sta_ClicksGroupedBy_t ClicksGroupedBy; unsigned long i; /***** Get and update type of list, number of columns in class photo and preference about view photos *****/ @@ -432,20 +435,22 @@ void Sta_AskSeeCrsAccesses (void) Par_PutHiddenParamLong ("FirstRow",0); Par_PutHiddenParamLong ("LastRow",0); - /***** Draw two class photographs with the users: one for teachers of the course and another one for students *****/ - /* Start the table */ - fprintf (Gbl.F.Out,"" - "" - "" + "" + "" ""); /***** Initial and final dates of the search *****/ @@ -454,49 +459,57 @@ void Sta_AskSeeCrsAccesses (void) /***** Selection of action *****/ Sta_WriteSelectorAction (); - /***** Selection of count type (number of pages generated, accesses per user, etc.) *****/ + /***** Option a) Listing of clicks distributed by some metric *****/ + fprintf (Gbl.F.Out,"" + "" + "" - "" - "" - ""); + fprintf (Gbl.F.Out,"" + "
"); - /* Listing of clicks to this course */ - fprintf (Gbl.F.Out,"" - "" - "" - "
"); - Lay_StartRoundFrameTable (NULL,0,NULL); + /***** Start frame *****/ + Lay_StartRoundFrameTable (NULL,2,Txt_Statistics_of_access); - /* Put list of users to select some users */ + /***** Put list of users to select some of them *****/ + fprintf (Gbl.F.Out,"
" + "%s:" + "" + "", + The_ClassForm[Gbl.Prefs.Theme],Txt_Users, + The_ClassForm[Gbl.Prefs.Theme]); Usr_ListUsersToSelect (Rol_TEACHER); Usr_ListUsersToSelect (Rol_STUDENT); - - /* End the table */ - Lay_EndRoundFrameTable (); - fprintf (Gbl.F.Out,"" + fprintf (Gbl.F.Out,"
" + "
" + "%s:" + "", + The_ClassForm[Gbl.Prefs.Theme],Txt_Show, + The_ClassForm[Gbl.Prefs.Theme]); + + if ((Gbl.Stat.ClicksGroupedBy < Sta_CLICKS_CRS_PER_USR || + Gbl.Stat.ClicksGroupedBy > Sta_CLICKS_CRS_PER_ACTION) && + Gbl.Stat.ClicksGroupedBy != Sta_CLICKS_CRS_DETAILED_LIST) + Gbl.Stat.ClicksGroupedBy = Sta_CLICKS_CRS_PER_USR; + + fprintf (Gbl.F.Out,""); + + /* Selection of count type (number of pages generated, accesses per user, etc.) */ Sta_WriteSelectorCountType (); - /***** Type of statistic *****/ - fprintf (Gbl.F.Out,"
" - "%s:" - "", - The_ClassForm[Gbl.Prefs.Theme],Txt_distributed_by); - if ((Gbl.Stat.ClicksStatType < Sta_ACC_CRS_PER_USR || - Gbl.Stat.ClicksStatType > Sta_ACC_CRS_PER_ACTION) && - Gbl.Stat.ClicksStatType != Sta_ACC_CRS_LISTING) - Gbl.Stat.ClicksStatType = Sta_ACC_CRS_PER_USR; - for (ClicksStatType = Sta_ACC_CRS_PER_USR; - ClicksStatType <= Sta_ACC_CRS_PER_ACTION; - ClicksStatType++) + fprintf (Gbl.F.Out," %s %s
", - Txt_STAT_CLICK_STAT_TYPES[ClicksStatType]); + fprintf (Gbl.F.Out,"
" - "%s", - Txt_STAT_CLICK_STAT_TYPES[Sta_ACC_CRS_LISTING]); + fprintf (Gbl.F.Out," onclick=\"enableDetailedClicks()\" />%s", + Txt_STAT_CLICKS_GROUPED_BY[Sta_CLICKS_CRS_DETAILED_LIST]); /* Number of rows per page */ // To use getElementById in Firefox, it's necessary to have the id attribute fprintf (Gbl.F.Out," (%s: )" "
"); + ""); - /***** Submit button *****/ - Lay_PutConfirmButton (Txt_Show_visits); + /***** End frame *****/ + Lay_EndRoundFrameTableWithButton (Lay_CONFIRM_BUTTON,Txt_Show_visits); /***** End form *****/ Act_FormEnd (); @@ -541,14 +553,16 @@ void Sta_AskSeeCrsAccesses (void) void Sta_AskSeeGblAccesses (void) { extern const char *The_ClassForm[The_NUM_THEMES]; + extern const char *Txt_Statistics_of_access; extern const char *Txt_Users; extern const char *Txt_ROLE_STATS[Sta_NUM_ROLES_STAT]; extern const char *Txt_Scope; + extern const char *Txt_Show; extern const char *Txt_distributed_by; - extern const char *Txt_STAT_CLICK_STAT_TYPES[Sta_NUM_TYPES_CLICK_STATS]; + extern const char *Txt_STAT_CLICKS_GROUPED_BY[Sta_NUM_CLICKS_GROUPED_BY]; extern const char *Txt_Show_visits; Sta_Role_t RoleStat; - Sta_ClicksStatType_t ClicksStatType; + Sta_ClicksGroupedBy_t ClicksGroupedBy; /***** Put form to go to test edition and configuration *****/ if (Gbl.CurrentCrs.Crs.CrsCod > 0 && // Course selected @@ -563,7 +577,9 @@ void Sta_AskSeeGblAccesses (void) /***** Start form *****/ Act_FormStart (ActSeeAccGbl); - fprintf (Gbl.F.Out,""); + + /***** Start frame *****/ + Lay_StartRoundFrameTable (NULL,2,Txt_Statistics_of_access); /***** Start and end dates for the search *****/ Dat_WriteFormIniEndDates (); @@ -612,35 +628,39 @@ void Sta_AskSeeGblAccesses (void) ""); /***** Count type for the statistic *****/ - Sta_WriteSelectorCountType (); - - /***** Type of statistic *****/ fprintf (Gbl.F.Out,"" "" - "" - "" - "
" "%s:" "", - The_ClassForm[Gbl.Prefs.Theme],Txt_distributed_by); - if (Gbl.Stat.ClicksStatType < Sta_ACC_GBL_PER_DAYS || - Gbl.Stat.ClicksStatType > Sta_ACC_GBL_PER_COURSE) - Gbl.Stat.ClicksStatType = Sta_ACC_GBL_PER_DAYS; - for (ClicksStatType = Sta_ACC_GBL_PER_DAYS; - ClicksStatType <= Sta_ACC_GBL_PER_COURSE; - ClicksStatType++) - { - fprintf (Gbl.F.Out,"%s
", - Txt_STAT_CLICK_STAT_TYPES[ClicksStatType]); - } - fprintf (Gbl.F.Out,"
"); + "", + The_ClassForm[Gbl.Prefs.Theme],Txt_Show, + The_ClassForm[Gbl.Prefs.Theme]); + Sta_WriteSelectorCountType (); - /***** Submit button *****/ - Lay_PutConfirmButton (Txt_Show_visits); + /***** Type of statistic *****/ + fprintf (Gbl.F.Out," %s ",Txt_distributed_by); + + if (Gbl.Stat.ClicksGroupedBy < Sta_CLICKS_GBL_PER_DAYS || + Gbl.Stat.ClicksGroupedBy > Sta_CLICKS_GBL_PER_COURSE) + Gbl.Stat.ClicksGroupedBy = Sta_CLICKS_GBL_PER_DAYS; + + fprintf (Gbl.F.Out,"" + "" + ""); + + /***** End frame *****/ + Lay_EndRoundFrameTableWithButton (Lay_CONFIRM_BUTTON,Txt_Show_visits); /***** End form *****/ Act_FormEnd (); @@ -652,21 +672,13 @@ void Sta_AskSeeGblAccesses (void) static void Sta_WriteSelectorCountType (void) { - extern const char *The_ClassForm[The_NUM_THEMES]; - extern const char *Txt_Show; - extern const char *Txt_STAT_TYPE_COUNT_SMALL[Sta_NUM_STAT_COUNT_TYPES]; + extern const char *Txt_STAT_TYPE_COUNT_SMALL[Sta_NUM_COUNT_TYPES]; Sta_CountType_t StatCountType; /**** Count type *****/ - fprintf (Gbl.F.Out,"" - "" - "%s:" - "" - "" - ""); for (StatCountType = (Sta_CountType_t) 0; - StatCountType < Sta_NUM_STAT_COUNT_TYPES; + StatCountType < Sta_NUM_COUNT_TYPES; StatCountType++) { fprintf (Gbl.F.Out,"