From 444b1552364b39761c3278c7da5152fd3998f216 Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Fri, 26 Sep 2014 14:47:48 +0200 Subject: [PATCH 01/12] Version 0.8.0 --- CHANGELOG | 2 +- README.fr.md | 4 ++-- README.md | 4 ++-- constants.php | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index d7de86d9b..44d3452ae 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,6 +1,6 @@ # Journal des modifications -## 2014-09-xx FreshRSS 0.8.0 +## 2014-09-26 FreshRSS 0.8.0 / 0.9.0 (beta) * UI * New interface for statistics diff --git a/README.fr.md b/README.fr.md index df43ef7e8..46f1e7c8f 100644 --- a/README.fr.md +++ b/README.fr.md @@ -10,8 +10,8 @@ Il permet de gérer plusieurs utilisateurs, et dispose d’un mode de lecture an * Site officiel : http://freshrss.org * Démo : http://demo.freshrss.org/ * Développeur : Marien Fressinaud -* Version actuelle : 0.8-dev -* Date de publication 2014-0x-xx +* Version actuelle : 0.8.0 +* Date de publication 2014-09-26 * License [GNU AGPL 3](http://www.gnu.org/licenses/agpl-3.0.html) ![Logo de FreshRSS](http://marienfressinaud.fr/data/images/freshrss/freshrss_title.png) diff --git a/README.md b/README.md index 0a22df8f1..501dca342 100644 --- a/README.md +++ b/README.md @@ -10,8 +10,8 @@ It is a multi-user application with an anonymous reading mode. * Official website: http://freshrss.org * Demo: http://demo.freshrss.org/ * Developer: Marien Fressinaud -* Current version: 0.8-dev -* Publication date: 2014-0x-xx +* Current version: 0.8.0 +* Publication date: 2014-09-26 * License [GNU AGPL 3](http://www.gnu.org/licenses/agpl-3.0.html) ![FreshRSS logo](http://marienfressinaud.fr/data/images/freshrss/freshrss_title.png) diff --git a/constants.php b/constants.php index 4c515d121..464e2da66 100644 --- a/constants.php +++ b/constants.php @@ -1,5 +1,5 @@ Date: Thu, 2 Oct 2014 10:05:26 +0200 Subject: [PATCH 02/12] Fix a bug in main.js In global view, there is no ".category.all>a" element so we tried to apply str2int on an undefined value. In consequence, we were not able to mark several articles as read This patch need to apply on 0.8.1 and 0.9.1 See https://github.com/marienfressinaud/FreshRSS/issues/649 --- p/scripts/main.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/p/scripts/main.js b/p/scripts/main.js index f6d5d2907..9e39010bd 100644 --- a/p/scripts/main.js +++ b/p/scripts/main.js @@ -33,7 +33,7 @@ function needsScroll($elem) { } function str2int(str) { - if (str == '') { + if (str == '' || str === undefined) { return 0; } return parseInt(str.replace(/\D/g, ''), 10) || 0; From 2fc3068d1b796152f374cfba3528f4273ad37bce Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Tue, 30 Sep 2014 11:08:30 +0200 Subject: [PATCH 03/12] Add space after tag icon Fix https://github.com/marienfressinaud/FreshRSS/issues/643 --- app/views/helpers/view/normal_view.phtml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/app/views/helpers/view/normal_view.phtml b/app/views/helpers/view/normal_view.phtml index 1dbf14f4c..6d9789f8d 100644 --- a/app/views/helpers/view/normal_view.phtml +++ b/app/views/helpers/view/normal_view.phtml @@ -153,14 +153,15 @@ if (!empty($this->entries)) { if (!empty($tags)) { ?>
  • + + From e7c36d515286079491c5dd6d6db7cc87d47dd043 Mon Sep 17 00:00:00 2001 From: Alexis Degrugillier Date: Sat, 27 Sep 2014 08:20:13 -0400 Subject: [PATCH 04/12] Fix read all shortcut Before, the read all shortcut raised a javascript exception when we use the confirmation option. The confirmation was not even displayed. The code was failling since there was a missing variable. Now, the shortcut ask for confirmation when the option is selected in the reading configuration page. The definition of the shortcut was buggy since the confirmation was handled properly in an other location. I simplified the code by removing the confirmation code in the shortcut. --- p/scripts/main.js | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/p/scripts/main.js b/p/scripts/main.js index 9e39010bd..00cd96fbe 100644 --- a/p/scripts/main.js +++ b/p/scripts/main.js @@ -538,14 +538,7 @@ function init_shortcuts() { }); shortcut.add("shift+" + shortcuts.mark_read, function () { // on marque tout comme lu - var btn = $(".nav_menu .read_all"); - if (btn.hasClass('confirm')) { - if (confirm(str_confirmation)) { - btn.click(); - } - } else { - btn.click(); - } + $(".nav_menu .read_all").click(); }, { 'disable_in_input': true }); From d6396be41ad140fb61f9d31a6a5d51aab427cc65 Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Thu, 2 Oct 2014 22:02:09 +0200 Subject: [PATCH 05/12] Fix category not appear on feed.add page (GET) Must apply to 0.8.1 and 0.9.1 See https://github.com/marienfressinaud/FreshRSS/issues/649 --- app/Controllers/feedController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Controllers/feedController.php b/app/Controllers/feedController.php index c7cc25fbb..f75c969d9 100755 --- a/app/Controllers/feedController.php +++ b/app/Controllers/feedController.php @@ -171,7 +171,7 @@ class FreshRSS_feed_Controller extends Minz_ActionController { // GET request so we must ask confirmation to user Minz_View::prependTitle(Minz_Translate::t('add_rss_feed') . ' · '); - $this->view->categories = $this->catDAO->listCategories(); + $this->view->categories = $this->catDAO->listCategories(false); $this->view->feed = new FreshRSS_Feed($url); try { // We try to get some more information about the feed From 0965aecefef0fa1e67e649d24c6d4b3ba0e143c1 Mon Sep 17 00:00:00 2001 From: Alexis Degrugillier Date: Mon, 29 Sep 2014 18:57:40 -0400 Subject: [PATCH 06/12] Add string delimiters for averages. Before, if the average was equal to 0, it was displayed on the graph but the label was not displayed. Now, the label is displayed. Conflicts: app/views/stats/index.phtml --- app/views/stats/index.phtml | 9 ++++++++- app/views/stats/repartition.phtml | 6 +++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/app/views/stats/index.phtml b/app/views/stats/index.phtml index 412e77e16..bbdcfaec8 100644 --- a/app/views/stats/index.phtml +++ b/app/views/stats/index.phtml @@ -92,7 +92,14 @@ function initStats() { } // Entry per day Flotr.draw(document.getElementById('statsEntryPerDay'), - [count ?>], + [{ + data: count ?>, + bars: {horizontal: false, show: true} + },{ + data: avg, + lines: {show: true}, + label: "average?>" + }], { grid: {verticalLines: false}, bars: {horizontal: false, show: true}, diff --git a/app/views/stats/repartition.phtml b/app/views/stats/repartition.phtml index b425c1458..750a3ffdc 100644 --- a/app/views/stats/repartition.phtml +++ b/app/views/stats/repartition.phtml @@ -67,7 +67,7 @@ function initStats() { }, { data: avg_h, lines: {show: true}, - label: averageHour?>, + label: "averageHour?>", yaxis: 2 }], { @@ -96,7 +96,7 @@ function initStats() { }, { data: avg_dow, lines: {show: true}, - label: averageDayOfWeek?>, + label: "averageDayOfWeek?>", yaxis: 2 }], { @@ -126,7 +126,7 @@ function initStats() { }, { data: avg_m, lines: {show: true}, - label: averageMonth?>, + label: "averageMonth?>", yaxis: 2 }], { From 57d4914bf81f3380fe55fa06b7b312f1c463e3e3 Mon Sep 17 00:00:00 2001 From: Alexis Degrugillier Date: Mon, 29 Sep 2014 18:54:03 -0400 Subject: [PATCH 07/12] Add an average per day for the 30 day period Conflicts: app/views/stats/index.phtml --- app/Controllers/statsController.php | 1 + app/Models/StatsDAO.php | 27 ++++++++++++++++++++++++--- app/Models/StatsDAOSQLite.php | 23 +++++++++++++++++++++++ app/views/stats/index.phtml | 7 +++++-- 4 files changed, 53 insertions(+), 5 deletions(-) diff --git a/app/Controllers/statsController.php b/app/Controllers/statsController.php index 256543f37..3069be34d 100644 --- a/app/Controllers/statsController.php +++ b/app/Controllers/statsController.php @@ -21,6 +21,7 @@ class FreshRSS_stats_Controller extends Minz_ActionController { Minz_View::appendScript(Minz_Url::display('/scripts/flotr2.min.js?' . @filemtime(PUBLIC_PATH . '/scripts/flotr2.min.js'))); $this->view->repartition = $statsDAO->calculateEntryRepartition(); $this->view->count = $statsDAO->calculateEntryCount(); + $this->view->average = $statsDAO->calculateEntryAverage(); $this->view->feedByCategory = $statsDAO->calculateFeedByCategory(); $this->view->entryByCategory = $statsDAO->calculateEntryByCategory(); $this->view->topFeed = $statsDAO->calculateTopFeed(); diff --git a/app/Models/StatsDAO.php b/app/Models/StatsDAO.php index 40505ab3e..08dd4cd5c 100644 --- a/app/Models/StatsDAO.php +++ b/app/Models/StatsDAO.php @@ -79,6 +79,27 @@ SQL; return $this->convertToSerie($count); } + /** + * Calculates entry average per day on a 30 days period. + * + * @return integer + */ + public function calculateEntryAverage() { + $period = self::ENTRY_COUNT_PERIOD; + + // Get stats per day for the last 30 days + $sql = <<prefix}entry AS e +WHERE FROM_UNIXTIME(e.date, '%Y%m%d') BETWEEN DATE_FORMAT(DATE_ADD(NOW(), INTERVAL -{$period} DAY), '%Y%m%d') AND DATE_FORMAT(DATE_ADD(NOW(), INTERVAL -1 DAY), '%Y%m%d') +SQL; + $stm = $this->bd->prepare($sql); + $stm->execute(); + $res = $stm->fetch(PDO::FETCH_NAMED); + + return round($res['average'], 2); + } + /** * Initialize an array for the entry count. * @@ -160,7 +181,7 @@ SQL; public function calculateEntryAveragePerFeedPerHour($feed = null) { return $this->calculateEntryAveragePerFeedPerPeriod(1/24, $feed); } - + /** * Calculates the average number of article per day of week per feed * @@ -180,10 +201,10 @@ SQL; public function calculateEntryAveragePerFeedPerMonth($feed = null) { return $this->calculateEntryAveragePerFeedPerPeriod(30, $feed); } - + /** * Calculates the average number of article per feed - * + * * @param float $period number used to divide the number of day in the period * @param integer $feed id * @return integer diff --git a/app/Models/StatsDAOSQLite.php b/app/Models/StatsDAOSQLite.php index 3b1256de1..bb2336532 100644 --- a/app/Models/StatsDAOSQLite.php +++ b/app/Models/StatsDAOSQLite.php @@ -34,6 +34,29 @@ SQL; return $this->convertToSerie($count); } + /** + * Calculates entry average per day on a 30 days period. + * + * @return integer + */ + public function calculateEntryAverage() { + $period = self::ENTRY_COUNT_PERIOD; + + // Get stats per day for the last 30 days + $sql = <<prefix}entry AS e +WHERE strftime('%Y%m%d', e.date, 'unixepoch') + BETWEEN strftime('%Y%m%d', 'now', '-{$period} days') + AND strftime('%Y%m%d', 'now', '-1 day') +SQL; + $stm = $this->bd->prepare($sql); + $stm->execute(); + $res = $stm->fetch(PDO::FETCH_NAMED); + + return round($res['average'], 2); + } + protected function calculateEntryRepartitionPerFeedPerPeriod($period, $feed = null) { if ($feed) { $restrict = "WHERE e.id_feed = {$feed}"; diff --git a/app/views/stats/index.phtml b/app/views/stats/index.phtml index bbdcfaec8..37803f2f9 100644 --- a/app/views/stats/index.phtml +++ b/app/views/stats/index.phtml @@ -91,6 +91,10 @@ function initStats() { return; } // Entry per day + var avg = []; + for (var i = -31; i <= 0; i++) { + avg.push([i, average?>]); + } Flotr.draw(document.getElementById('statsEntryPerDay'), [{ data: count ?>, @@ -102,8 +106,7 @@ function initStats() { }], { grid: {verticalLines: false}, - bars: {horizontal: false, show: true}, - xaxis: {noTicks: 6, showLabels: false, tickDecimals: 0}, + xaxis: {noTicks: 6, showLabels: false, tickDecimals: 0, min: -30.75, max: -0.25}, yaxis: {min: 0}, mouse: {relative: true, track: true, trackDecimals: 0, trackFormatter: function(obj) {return numberFormat(obj.y);}} }); From 8a09958281e7a4352c86d5734cbc9c6dc90b3c96 Mon Sep 17 00:00:00 2001 From: Alexis Degrugillier Date: Mon, 29 Sep 2014 18:26:28 -0400 Subject: [PATCH 08/12] Add percent of total on top 10 feeds --- app/i18n/en.php | 1 + app/i18n/fr.php | 1 + app/views/stats/index.phtml | 2 ++ 3 files changed, 4 insertions(+) diff --git a/app/i18n/en.php b/app/i18n/en.php index beba02c4d..0d3654744 100644 --- a/app/i18n/en.php +++ b/app/i18n/en.php @@ -56,6 +56,7 @@ return array ( 'stats_entry_per_hour' => 'Per hour', 'stats_entry_per_day_of_week' => 'Per day of week', 'stats_entry_per_month' => 'Per month', + 'stats_percent_of_total' => '%% of total', 'last_week' => 'Last week', 'last_month' => 'Last month', diff --git a/app/i18n/fr.php b/app/i18n/fr.php index b0fbf15ae..c72fc3e93 100644 --- a/app/i18n/fr.php +++ b/app/i18n/fr.php @@ -56,6 +56,7 @@ return array ( 'stats_entry_per_hour' => 'Par heure', 'stats_entry_per_day_of_week' => 'Par jour de la semaine', 'stats_entry_per_month' => 'Par mois', + 'stats_percent_of_total' => '%% du total', 'last_week' => 'Depuis la semaine dernière', 'last_month' => 'Depuis le mois dernier', diff --git a/app/views/stats/index.phtml b/app/views/stats/index.phtml index 37803f2f9..fa57a77c0 100644 --- a/app/views/stats/index.phtml +++ b/app/views/stats/index.phtml @@ -48,6 +48,7 @@ + @@ -56,6 +57,7 @@ + repartition['all_feeds']['total'] * 100, 1);?> From d842f85966b2873f1074c73ad79ec5169e7090f2 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Sun, 5 Oct 2014 16:53:43 +0200 Subject: [PATCH 09/12] SimplePie enclosure bug workaround https://github.com/marienfressinaud/FreshRSS/issues/504 --- app/Models/Feed.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/Models/Feed.php b/app/Models/Feed.php index 2a5ea45ac..03baf3ad2 100644 --- a/app/Models/Feed.php +++ b/app/Models/Feed.php @@ -288,6 +288,8 @@ class FreshRSS_Feed extends Minz_Model { $content .= '