Переглянути джерело

Filter feeds in error (#2160)

https://github.com/FreshRSS/FreshRSS/issues/2146
Alexandre Alapetite 7 роки тому
батько
коміт
7cbfdb4e09

+ 2 - 0
app/Controllers/subscriptionController.php

@@ -33,6 +33,8 @@ class FreshRSS_subscription_Controller extends Minz_ActionController {
 		                        @filemtime(PUBLIC_PATH . '/scripts/category.js')));
 		Minz_View::prependTitle(_t('sub.title') . ' · ');
 
+		$this->view->onlyFeedsWithError = Minz_Request::paramTernary('error');
+
 		$id = Minz_Request::param('id');
 		if ($id !== false) {
 			$feedDAO = FreshRSS_Factory::createFeedDao();

+ 7 - 0
app/i18n/cz/sub.php

@@ -46,6 +46,13 @@ return array(
 			'normal' => 'Show in its category',	//TODO - Translation
 		),
 		'pubsubhubbub' => 'Okamžité oznámení s PubSubHubbub',
+		'show' => array(
+			'all' => 'Show all feeds',	//TODO - Translation
+			'error' => 'Show only feeds with error',	//TODO - Translation
+		),
+		'showing' => array(
+			'error' => 'Showing only feeds with error',	//TODO - Translation
+		),
 		'ssl_verify' => 'Verify SSL security',	//TODO - Translation
 		'stats' => 'Statistika',
 		'think_to_add' => 'Můžete přidat kanály.',

+ 7 - 0
app/i18n/de/sub.php

@@ -46,6 +46,13 @@ return array(
 			'normal' => 'Zeige in eigener Kategorie',
 		),
 		'pubsubhubbub' => 'Sofortbenachrichtigung mit PubSubHubbub',
+		'show' => array(
+			'all' => 'Show all feeds',	//TODO - Translation
+			'error' => 'Show only feeds with error',	//TODO - Translation
+		),
+		'showing' => array(
+			'error' => 'Showing only feeds with error',	//TODO - Translation
+		),
 		'ssl_verify' => 'Überprüfe SSL Sicherheit',
 		'stats' => 'Statistiken',
 		'think_to_add' => 'Sie können Feeds hinzufügen.',

+ 7 - 0
app/i18n/en/sub.php

@@ -46,6 +46,13 @@ return array(
 			'normal' => 'Show in its category',
 		),
 		'pubsubhubbub' => 'Instant notification with PubSubHubbub',
+		'show' => array(
+			'all' => 'Show all feeds',
+			'error' => 'Show only feeds with error',
+		),
+		'showing' => array(
+			'error' => 'Showing only feeds with error',
+		),
 		'ssl_verify' => 'Verify SSL security',
 		'stats' => 'Statistics',
 		'think_to_add' => 'You may add some feeds.',

+ 7 - 0
app/i18n/es/sub.php

@@ -46,6 +46,13 @@ return array(
 			'normal' => 'Show in its category',	//TODO - Translation
 		),
 		'pubsubhubbub' => 'Notificación inmedaiata con PubSubHubbub',
+		'show' => array(
+			'all' => 'Show all feeds',	//TODO - Translation
+			'error' => 'Show only feeds with error',	//TODO - Translation
+		),
+		'showing' => array(
+			'error' => 'Showing only feeds with error',	//TODO - Translation
+		),
 		'ssl_verify' => 'Verify SSL security',	//TODO - Translation
 		'stats' => 'Estadísticas',
 		'think_to_add' => 'Puedes añadir fuentes.',

+ 7 - 0
app/i18n/fr/sub.php

@@ -46,6 +46,13 @@ return array(
 			'normal' => 'Afficher dans sa catégorie',
 		),
 		'pubsubhubbub' => 'Notification instantanée par PubSubHubbub',
+		'show' => array(
+			'all' => 'Montrer tous les flux',
+			'error' => 'Montrer seulement les flux en erreur',
+		),
+		'showing' => array(
+			'error' => 'Montre seulement les flux en erreur',
+		),
 		'ssl_verify' => 'Vérification sécurité SSL',
 		'stats' => 'Statistiques',
 		'think_to_add' => 'Vous pouvez ajouter des flux.',

+ 7 - 0
app/i18n/he/sub.php

@@ -46,6 +46,13 @@ return array(
 			'normal' => 'Show in its category',	//TODO - Translation
 		),
 		'pubsubhubbub' => 'Instant notification with PubSubHubbub',	//TODO - Translation
+		'show' => array(
+			'all' => 'Show all feeds',	//TODO - Translation
+			'error' => 'Show only feeds with error',	//TODO - Translation
+		),
+		'showing' => array(
+			'error' => 'Showing only feeds with error',	//TODO - Translation
+		),
 		'ssl_verify' => 'Verify SSL security',	//TODO - Translation
 		'stats' => 'סטטיסטיקות',
 		'think_to_add' => 'ניתן להוסיף הזנות חדשות.',

+ 7 - 0
app/i18n/it/sub.php

@@ -46,6 +46,13 @@ return array(
 			'normal' => 'Show in its category',	//TODO - Translation
 		),
 		'pubsubhubbub' => 'Notifica istantanea con PubSubHubbub',
+		'show' => array(
+			'all' => 'Show all feeds',	//TODO - Translation
+			'error' => 'Show only feeds with error',	//TODO - Translation
+		),
+		'showing' => array(
+			'error' => 'Showing only feeds with error',	//TODO - Translation
+		),
 		'ssl_verify' => 'Verify SSL security',	//TODO - Translation
 		'stats' => 'Statistiche',
 		'think_to_add' => 'Aggiungi feed.',

+ 7 - 0
app/i18n/kr/sub.php

@@ -46,6 +46,13 @@ return array(
 			'normal' => '피드가 속한 카테고리에만 표시하기',
 		),
 		'pubsubhubbub' => 'PubSubHubbub을 사용한 즉시 알림',
+		'show' => array(
+			'all' => 'Show all feeds',	//TODO - Translation
+			'error' => 'Show only feeds with error',	//TODO - Translation
+		),
+		'showing' => array(
+			'error' => 'Showing only feeds with error',	//TODO - Translation
+		),
 		'ssl_verify' => 'SSL 유효성 검사',
 		'stats' => '통계',
 		'think_to_add' => '피드를 추가할 수 있습니다.',

+ 7 - 0
app/i18n/nl/sub.php

@@ -46,6 +46,13 @@ return array(
 			'normal' => 'Toon in categorie',
 		),
 		'pubsubhubbub' => 'Directe notificaties met PubSubHubbub',
+		'show' => array(
+			'all' => 'Show all feeds',	//TODO - Translation
+			'error' => 'Show only feeds with error',	//TODO - Translation
+		),
+		'showing' => array(
+			'error' => 'Showing only feeds with error',	//TODO - Translation
+		),
 		'ssl_verify' => 'SSL-veiligheid controleren',
 		'stats' => 'Statistieken',
 		'think_to_add' => 'Voeg wat feeds toe.',

+ 7 - 0
app/i18n/oc/sub.php

@@ -45,6 +45,13 @@ return array(
 			'normal' => 'Mostar dins sa categoria',
 		),
 		'pubsubhubbub' => 'Notificaciones instantáneas amb PubSubHubbub',
+		'show' => array(
+			'all' => 'Show all feeds',	//TODO - Translation
+			'error' => 'Show only feeds with error',	//TODO - Translation
+		),
+		'showing' => array(
+			'error' => 'Showing only feeds with error',	//TODO - Translation
+		),
 		'ssl_verify' => 'Verificacion de la seguretat SSL',
 		'stats' => 'Estatisticas',
 		'think_to_add' => 'Podètz ajustar de fluxes.',

+ 7 - 0
app/i18n/pt-br/sub.php

@@ -46,6 +46,13 @@ return array(
 			'normal' => 'Show in its category',	//TODO - Translation
 		),
 		'pubsubhubbub' => 'Notificação instantânea com PubSubHubbub',
+		'show' => array(
+			'all' => 'Show all feeds',	//TODO - Translation
+			'error' => 'Show only feeds with error',	//TODO - Translation
+		),
+		'showing' => array(
+			'error' => 'Showing only feeds with error',	//TODO - Translation
+		),
 		'ssl_verify' => 'Verify SSL security',	//TODO - Translation
 		'stats' => 'Estatísticas',
 		'think_to_add' => 'Você deve adicionar alguns feeds.',

+ 7 - 0
app/i18n/ru/sub.php

@@ -46,6 +46,13 @@ return array(
 			'normal' => 'Show in its category',	//TODO - Translation
 		),
 		'pubsubhubbub' => 'Instant notification with PubSubHubbub',	//TODO - Translation
+		'show' => array(
+			'all' => 'Show all feeds',	//TODO - Translation
+			'error' => 'Show only feeds with error',	//TODO - Translation
+		),
+		'showing' => array(
+			'error' => 'Showing only feeds with error',	//TODO - Translation
+		),
 		'ssl_verify' => 'Verify SSL security',	//TODO - Translation
 		'stats' => 'Statistics',	//TODO - Translation
 		'think_to_add' => 'You may add some feeds.',	//TODO - Translation

+ 7 - 0
app/i18n/tr/sub.php

@@ -46,6 +46,13 @@ return array(
 			'normal' => 'Show in its category',	//TODO - Translation
 		),
 		'pubsubhubbub' => 'PubSubHubbub ile anlık bildirim',
+		'show' => array(
+			'all' => 'Show all feeds',	//TODO - Translation
+			'error' => 'Show only feeds with error',	//TODO - Translation
+		),
+		'showing' => array(
+			'error' => 'Showing only feeds with error',	//TODO - Translation
+		),
 		'ssl_verify' => 'Verify SSL security',	//TODO - Translation
 		'stats' => 'İstatistikler',
 		'think_to_add' => 'Akış ekleyebilirsiniz.',

+ 7 - 0
app/i18n/zh-cn/sub.php

@@ -46,6 +46,13 @@ return array(
 			'normal' => '在分类中显示',
 		),
 		'pubsubhubbub' => 'PubSubHubbub 即时通知',
+		'show' => array(
+			'all' => 'Show all feeds',	//TODO - Translation
+			'error' => 'Show only feeds with error',	//TODO - Translation
+		),
+		'showing' => array(
+			'error' => 'Showing only feeds with error',	//TODO - Translation
+		),
 		'ssl_verify' => 'Verify SSL security',	//TODO - Translation
 		'stats' => '统计',
 		'think_to_add' => '你可以添加一些 RSS 源。',

+ 17 - 0
app/views/subscription/index.phtml

@@ -52,6 +52,12 @@
 		<?php echo _t('sub.feed.moved_category_deleted', $this->default_category->name()); ?>
 	</p>
 
+	<?php if ($this->onlyFeedsWithError): ?>
+	<p class="alert alert-warn">
+		<?php echo _t('sub.feed.showing.error'); ?>
+	</p>
+	<?php endif; ?>
+
 	<div class="box">
 		<div class="box-title"><label for="new-category"><?php echo _t('sub.category.add'); ?></label></div>
 
@@ -122,6 +128,9 @@
 			<?php if (!empty($feeds)) { ?>
 			<?php
 					foreach ($feeds as $feed) {
+						if ($this->onlyFeedsWithError && !$feed->inError()) {
+							continue;
+						}
 						$error = $feed->inError() ? ' error' : '';
 						$empty = $feed->nbEntries() == 0 ? ' empty' : '';
 			?>
@@ -140,6 +149,14 @@
 		</ul>
 	</div>
 	<?php } ?>
+
+	<ul>
+		<?php if ($this->onlyFeedsWithError): ?>
+		<li><a href="<?php echo _url('subscription', 'index'); ?>"><?php echo _t('sub.feed.show.all'); ?></a></li>
+		<?php else: ?>
+		<li><a href="<?php echo _url('subscription', 'index', 'error', 1); ?>"><?php echo _t('sub.feed.show.error'); ?></a></li>
+		<?php endif; ?>
+	</ul>
 </div>
 
 <?php $class = isset($this->feed) ? ' class="active"' : ''; ?>