Răsfoiți Sursa

Improve redirection when deleting an idle feed

Marien Fressinaud 11 ani în urmă
părinte
comite
d284958d52
3 a modificat fișierele cu 16 adăugiri și 4 ștergeri
  1. 6 3
      app/Controllers/feedController.php
  2. 5 1
      app/views/stats/idle.phtml
  3. 5 0
      lib/Minz/Request.php

+ 6 - 3
app/Controllers/feedController.php

@@ -412,10 +412,13 @@ class FreshRSS_feed_Controller extends Minz_ActionController {
 
 			Minz_Session::_param ('notification', $notif);
 
-			if ($type == 'category') {
-				Minz_Request::forward (array ('c' => 'configure', 'a' => 'categorize'), true);
+			$redirect_url = Minz_Request::param('r', false, true);
+			if ($redirect_url) {
+				Minz_Request::forward($redirect_url);
+			} elseif ($type == 'category') {
+				Minz_Request::forward(array ('c' => 'configure', 'a' => 'categorize'), true);
 			} else {
-				Minz_Request::forward (array ('c' => 'configure', 'a' => 'feed'), true);
+				Minz_Request::forward(array ('c' => 'configure', 'a' => 'feed'), true);
 			}
 		}
 	}

+ 5 - 1
app/views/stats/idle.phtml

@@ -6,6 +6,10 @@
 	<h1><?php echo _t('stats_idle'); ?></h1>
 
 	<?php
+		$current_url = urlencode(Minz_Url::display(
+			array('c' => 'stats', 'a' => 'idle'),
+			'php', true
+		));
 		$nothing = true;
 		foreach ($this->idleFeeds as $period => $feeds) {
 			if (!empty($feeds)) {
@@ -22,7 +26,7 @@
 					<div class="stick">
 						<a class="btn" href="<?php echo _url('index', 'index', 'get', 'f_' . $feed['id']); ?>"><?php echo _i('link'); ?> <?php echo _t('filter'); ?></a>
 						<a class="btn" href="<?php echo _url('configure', 'feed', 'id', $feed['id']); ?>"><?php echo _i('configure'); ?> <?php echo _t('administration'); ?></a>
-						<button class="btn btn-attention confirm" form="form-delete" formaction="<?php echo _url('feed', 'delete', 'id', $feed['id']); ?>"><?php echo _t('delete'); ?></button>
+						<button class="btn btn-attention confirm" form="form-delete" formaction="<?php echo _url('feed', 'delete', 'id', $feed['id'], 'r', $current_url); ?>"><?php echo _t('delete'); ?></button>
 					</div>
 				</li>
 				<li class="item">

+ 5 - 0
lib/Minz/Request.php

@@ -124,6 +124,11 @@ class Minz_Request {
 	 *                > sinon, le dispatcher recharge en interne
 	 */
 	public static function forward($url = array(), $redirect = false) {
+		if (!is_array($url)) {
+			header('Location: ' . $url);
+			exit();
+		}
+
 		$url = Minz_Url::checkUrl($url);
 
 		if ($redirect) {