aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar maTh <math-home@web.de> 2022-02-05 10:57:36 +0100
committerGravatar GitHub <noreply@github.com> 2022-02-05 10:57:36 +0100
commitbe9c06fd5c1bfed8e0147c938b96e4876df98133 (patch)
tree3113a9d106ee19f3d5a43dce6620a1b03d72341e
parentdc27baa7d67f4bc601ced80229844a88a7ca23d4 (diff)
Improved: Idle feeds list in a new layout (#4192)
* that should work fine * fixed phpcs * fixed phpcs
-rw-r--r--app/Controllers/statsController.php36
-rw-r--r--app/Controllers/subscriptionController.php7
-rw-r--r--app/views/helpers/feed/update.phtml10
-rw-r--r--app/views/stats/idle.phtml46
4 files changed, 75 insertions, 24 deletions
diff --git a/app/Controllers/statsController.php b/app/Controllers/statsController.php
index d03c4fa3d..170d35d6f 100644
--- a/app/Controllers/statsController.php
+++ b/app/Controllers/statsController.php
@@ -20,6 +20,14 @@ class FreshRSS_stats_Controller extends FreshRSS_ActionController {
'style-src' => "'self' 'unsafe-inline'",
]);
+ $catDAO = FreshRSS_Factory::createCategoryDao();
+ $feedDAO = FreshRSS_Factory::createFeedDao();
+
+ $catDAO->checkDefault();
+ $feedDAO->updateTTL();
+ $this->view->categories = $catDAO->listSortedCategories(false);
+ $this->view->default_category = $catDAO->getDefault();
+
FreshRSS_View::prependTitle(_t('admin.stats.title') . ' · ');
}
@@ -92,6 +100,23 @@ class FreshRSS_stats_Controller extends FreshRSS_ActionController {
}
/**
+ * This action handles the feed action on the idle statistic page.
+ * set the 'from' parameter to remember that it had a redirection coming from stats controller,
+ * to use the subscription controller to save it,
+ * but shows the stats idle page
+ */
+ public function feedAction() {
+ $id = Minz_Request::param('id');
+ $ajax = Minz_Request::param('ajax');
+ if ($ajax) {
+ $url_redirect = array('c' => 'subscription', 'a' => 'feed', 'params' => array('id' => $id, 'from' => 'stats', 'ajax' => $ajax));
+ } else {
+ $url_redirect = array('c' => 'subscription', 'a' => 'feed', 'params' => array('id' => $id, 'from' => 'stats'));
+ }
+ Minz_Request::forward($url_redirect, true);
+ }
+
+ /**
* This action handles the idle feed statistic page.
*
* It displays the list of idle feed for different period. The supported
@@ -138,6 +163,9 @@ class FreshRSS_stats_Controller extends FreshRSS_ActionController {
$last5Year->modify('-5 year');
foreach ($feeds as $feed) {
+ $feedDAO = FreshRSS_Factory::createFeedDao();
+ $feed['favicon'] = $feedDAO->searchById($feed['id'])->favicon();
+
$feedDate->setTimestamp($feed['last_date']);
if ($feedDate >= $lastWeek) {
continue;
@@ -162,6 +190,14 @@ class FreshRSS_stats_Controller extends FreshRSS_ActionController {
}
$this->view->idleFeeds = $idleFeeds;
+
+ $id = Minz_Request::param('id');
+ $this->view->displaySlider = false;
+ if (false !== $id) {
+ $this->view->displaySlider = true;
+ $feedDAO = FreshRSS_Factory::createFeedDao();
+ $this->view->feed = $feedDAO->searchById($id);
+ }
}
/**
diff --git a/app/Controllers/subscriptionController.php b/app/Controllers/subscriptionController.php
index eb0d86c3b..7d2c58714 100644
--- a/app/Controllers/subscriptionController.php
+++ b/app/Controllers/subscriptionController.php
@@ -207,7 +207,12 @@ class FreshRSS_subscription_Controller extends FreshRSS_ActionController {
invalidateHttpCache();
- $url_redirect = array('c' => 'subscription', 'params' => array('id' => $id));
+ $from = Minz_Request::param('from');
+ if ($from === false) {
+ $url_redirect = array('c' => 'subscription', 'params' => array('id' => $id));
+ } else {
+ $url_redirect = array('c' => 'stats', 'a' => 'idle', 'params' => array('id' => $id, 'from' => 'stats'));
+ }
if ($feedDAO->updateFeed($id, $values) !== false) {
$feed->_category($cat);
$feed->faviconPrepare();
diff --git a/app/views/helpers/feed/update.phtml b/app/views/helpers/feed/update.phtml
index a1567afc0..ed6db9b1f 100644
--- a/app/views/helpers/feed/update.phtml
+++ b/app/views/helpers/feed/update.phtml
@@ -18,7 +18,15 @@
<p class="alert alert-warn"><?= _t('sub.feed.empty') ?></p>
<?php } ?>
- <form method="post" action="<?= _url('subscription', 'feed', 'id', $this->feed->id()) ?>" autocomplete="off">
+ <?php
+ $from = Minz_Request::param('from');
+ if ($from === false) {
+ $url = _url('subscription', 'feed', 'id', $this->feed->id());
+ } else {
+ $url = _url('subscription', 'feed', 'id', $this->feed->id(), 'from', $from);
+ }
+ ?>
+ <form method="post" action="<?= $url ?>" autocomplete="off">
<input type="hidden" name="_csrf" value="<?= FreshRSS_Auth::csrfToken() ?>" />
<legend><?= _t('sub.feed.information') ?></legend>
<div class="form-group">
diff --git a/app/views/stats/idle.phtml b/app/views/stats/idle.phtml
index 40feb4a03..6b2141ba2 100644
--- a/app/views/stats/idle.phtml
+++ b/app/views/stats/idle.phtml
@@ -20,29 +20,19 @@
if (!empty($feeds)) {
$nothing = false;
?>
- <div class="stat">
- <h2><?= _t('gen.date.' . $period) ?></h2>
-
- <form id="form-delete" method="post">
- <input type="hidden" name="_csrf" value="<?= FreshRSS_Auth::csrfToken() ?>" />
- <?php foreach ($feeds as $feed) { ?>
- <ul class="horizontal-list">
- <li class="item">
- <div class="stick">
- <a class="btn" href="<?= _url('index', 'index', 'get', 'f_' . $feed['id']) ?>"><?= _i('link') ?> <?= _t('gen.action.filter') ?></a>
- <a class="btn" href="<?= _url('subscription', 'index', 'id', $feed['id']) ?>"><?= _i('configure') ?> <?= _t('gen.action.manage') ?></a>
- <button class="btn btn-attention confirm" form="form-delete"
- formaction="<?= _url('feed', 'delete', 'id', $feed['id'], 'r', $current_url) ?>"><?= _t('gen.action.remove') ?></button>
- </div>
- </li>
- <li class="item">
- <span title="<?= timestamptodate($feed['last_date'], false) ?>"><?= $feed['name'] ?>
- (<?= _t('admin.stats.number_entries', $feed['nb_articles']) ?>)</span>
- </li>
+ <div class="box">
+ <div class="box-title"><?= _t('gen.date.' . $period) ?></div>
+ <ul class="box-content">
+ <?php foreach ($feeds as $feed) { ?>
+ <li class="item feed">
+ <a class="configure open-slider" href="<?= _url('stats', 'feed', 'id', $feed['id'], 'sub', 'idle') ?>" title="<?= _t('gen.action.manage') ?>"><?= _i('configure') ?></a>
+ <?php if (FreshRSS_Context::$user_conf->show_favicons): ?><img class="favicon" src="<?= $feed['favicon'] ?>" alt="✇" loading="lazy" /><?php endif; ?>
+ <span title="<?= timestamptodate($feed['last_date'], false) ?>"><?= $feed['name'] ?>
+ (<?= _t('admin.stats.number_entries', $feed['nb_articles']) ?>)</span>
+ </li>
+ <?php } ?>
</ul>
- <?php } ?>
- </form>
- </div>
+ </div>
<?php
}
}
@@ -53,4 +43,16 @@
<span class="alert-head"><?= _t('admin.stats.no_idle') ?></span>
</p>
<?php } ?>
+
+ <?php $class = $this->displaySlider ? ' class="active"' : ''; ?>
+ <a href="#" id="close-slider"<?= $class ?>>
+ <?= _i('close') ?>
+ </a>
+ <div id="slider"<?= $class ?>>
+ <?php
+ if (isset($this->feed)) {
+ $this->renderHelper('feed/update');
+ }
+ ?>
+ </div>
</main>