From 393fce3e8aaef1b00ab34bf35b7e8b329a5e3dc5 Mon Sep 17 00:00:00 2001 From: Alexis Degrugillier Date: Tue, 19 Aug 2014 08:55:44 -0400 Subject: Add a feed selector in repartition statistics. Before we could choose the feed in the statistics only from the feed options in the main view. Now with the new drop-down list, it is possible to choose it from the statistics page. The rendering needs to be polished to be nicer. --- app/Controllers/statsController.php | 2 ++ app/views/stats/repartition.phtml | 39 +++++++++++++++++++++++++------------ p/scripts/main.js | 7 +++++++ 3 files changed, 36 insertions(+), 12 deletions(-) diff --git a/app/Controllers/statsController.php b/app/Controllers/statsController.php index 06a20c2a6..934b076a5 100644 --- a/app/Controllers/statsController.php +++ b/app/Controllers/statsController.php @@ -58,9 +58,11 @@ class FreshRSS_stats_Controller extends Minz_ActionController { public function repartitionAction() { $statsDAO = FreshRSS_Factory::createStatsDAO(); + $categoryDAO = new FreshRSS_CategoryDAO(); $feedDAO = FreshRSS_Factory::createFeedDao(); Minz_View::appendScript(Minz_Url::display('/scripts/flotr2.min.js?' . @filemtime(PUBLIC_PATH . '/scripts/flotr2.min.js'))); $id = Minz_Request::param ('id', null); + $this->view->categories = $categoryDAO->listCategories (); $this->view->feed = $feedDAO->searchById($id); $this->view->days = $statsDAO->getDays(); $this->view->months = $statsDAO->getMonths(); diff --git a/app/views/stats/repartition.phtml b/app/views/stats/repartition.phtml index 09892d3c5..3dc319731 100644 --- a/app/views/stats/repartition.phtml +++ b/app/views/stats/repartition.phtml @@ -2,23 +2,38 @@
- + +

+ + + feed) {?> -

- - - feed->name(); ?> - -

- -

+ + + - +

- +

@@ -93,7 +108,7 @@ function initStats() { yaxis: {min: 0}, mouse: {relative: true, track: true, trackDecimals: 0, trackFormatter: function(obj) {return numberFormat(obj.y);}} }); - + } initStats(); diff --git a/p/scripts/main.js b/p/scripts/main.js index ae7b69364..4802e0941 100644 --- a/p/scripts/main.js +++ b/p/scripts/main.js @@ -1063,6 +1063,12 @@ function init_share_observers() { }); } +function init_stats_observers() { + $('#feed_select').on('change', function(e) { + redirect($(this).find(':selected').data('url')); + }); +} + function init_remove_observers() { $('.post').on('click', 'a.remove', function(e) { var remove_what = $(this).attr('data-remove'); @@ -1177,6 +1183,7 @@ function init_all() { init_remove_observers(); init_feed_observers(); init_password_observers(); + init_stats_observers(); } if (window.console) { -- cgit v1.2.3 From 50075bfbdcd6a7be010eb82ce1fffac0ea283de7 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Tue, 19 Aug 2014 20:58:18 +0200 Subject: Improvement for ASC order https://github.com/marienfressinaud/FreshRSS/issues/495 --- app/Models/EntryDAO.php | 2 +- app/layout/nav_menu.phtml | 14 +++++++++----- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/app/Models/EntryDAO.php b/app/Models/EntryDAO.php index a9ffa138b..488b70fb6 100644 --- a/app/Models/EntryDAO.php +++ b/app/Models/EntryDAO.php @@ -230,7 +230,7 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo { } $this->bd->beginTransaction(); - $sql = 'UPDATE `' . $this->prefix . 'entry` ' + $sql = 'UPDATE `' . $this->prefix . 'entry` ' . 'SET is_read=1 ' . 'WHERE id_feed=? AND is_read=0 AND id <= ?'; $values = array($id, $idMax); diff --git a/app/layout/nav_menu.phtml b/app/layout/nav_menu.phtml index 73a921c5d..25833c16d 100644 --- a/app/layout/nav_menu.phtml +++ b/app/layout/nav_menu.phtml @@ -164,11 +164,15 @@ break; } } - if ($this->order === 'ASC') { - $idMax = 0; - } else { - $p = isset($this->entries[0]) ? $this->entries[0] : null; - $idMax = $p === null ? '0' : $p->id(); + + $p = isset($this->entries[0]) ? $this->entries[0] : null; + $idMax = $p === null ? (time() - 1) . '000000' : $p->id(); + + if ($this->order === 'ASC') { //In this case we do not know but we guess idMax + $idMax2 = (time() - 1) . '000000'; + if (strcmp($idMax2, $idMax) > 0) { + $idMax = $idMax2; + } } $arUrl = array('c' => 'entry', 'a' => 'read', 'params' => array('get' => $get, 'nextGet' => $nextGet, 'idMax' => $idMax)); -- cgit v1.2.3 From 0d0b8cd39b8de765aa351a2e66fff850bdcb2000 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Tue, 19 Aug 2014 21:39:45 +0200 Subject: Error when feed does not exist https://github.com/marienfressinaud/FreshRSS/issues/579 --- app/Models/Feed.php | 6 ++++++ app/views/helpers/view/normal_view.phtml | 7 ++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/app/Models/Feed.php b/app/Models/Feed.php index fe1e52ea2..2a5ea45ac 100644 --- a/app/Models/Feed.php +++ b/app/Models/Feed.php @@ -28,6 +28,12 @@ class FreshRSS_Feed extends Minz_Model { } } + public static function example() { + $f = new FreshRSS_Feed('http://example.net/', false); + $f->faviconPrepare(); + return $f; + } + public function id() { return $this->id; } diff --git a/app/views/helpers/view/normal_view.phtml b/app/views/helpers/view/normal_view.phtml index 55ef6bdf6..87bf2e22a 100644 --- a/app/views/helpers/view/normal_view.phtml +++ b/app/views/helpers/view/normal_view.phtml @@ -81,7 +81,12 @@ if (!empty($this->entries)) { } } $feed = FreshRSS_CategoryDAO::findFeed($this->cat_aside, $item->feed ()); //We most likely already have the feed object in cache - if (empty($feed)) $feed = $item->feed (true); + if ($feed == null) { + $feed = $item->feed(true); + if ($feed == null) { + $feed = FreshRSS_Feed::example(); + } + } ?>
  • ✇ name(); ?>
  • title (); ?>
  • date (); ?> 
  • -- cgit v1.2.3 From ea99ac1259083ff0a9eb6131d777454b54045626 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Tue, 19 Aug 2014 21:55:49 +0200 Subject: Syntax 581 #581 --- app/Controllers/statsController.php | 2 +- app/views/stats/repartition.phtml | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/Controllers/statsController.php b/app/Controllers/statsController.php index 934b076a5..98f46f0d2 100644 --- a/app/Controllers/statsController.php +++ b/app/Controllers/statsController.php @@ -62,7 +62,7 @@ class FreshRSS_stats_Controller extends Minz_ActionController { $feedDAO = FreshRSS_Factory::createFeedDao(); Minz_View::appendScript(Minz_Url::display('/scripts/flotr2.min.js?' . @filemtime(PUBLIC_PATH . '/scripts/flotr2.min.js'))); $id = Minz_Request::param ('id', null); - $this->view->categories = $categoryDAO->listCategories (); + $this->view->categories = $categoryDAO->listCategories(); $this->view->feed = $feedDAO->searchById($id); $this->view->days = $statsDAO->getDays(); $this->view->months = $statsDAO->getMonths(); diff --git a/app/views/stats/repartition.phtml b/app/views/stats/repartition.phtml index 3dc319731..1f920a7ae 100644 --- a/app/views/stats/repartition.phtml +++ b/app/views/stats/repartition.phtml @@ -6,16 +6,16 @@

    conf->display_categories ? ' checked="checked"' : ''; ?> /> + + + +
    +
    +