From 17413078a72e1298c6dc8953c40e8d83ce38c49c Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Sat, 13 Feb 2021 18:32:02 +0300 Subject: pref feeds: index cleanup, split into several methods, use tabs to maximize space for feed tree, persist feed tree state --- classes/pref/feeds.php | 333 +++++++++++++++++++++++++---------------------- classes/pref/filters.php | 6 - classes/pref/labels.php | 7 - 3 files changed, 177 insertions(+), 169 deletions(-) (limited to 'classes') diff --git a/classes/pref/feeds.php b/classes/pref/feeds.php index ff9e69336..d8495a59c 100755 --- a/classes/pref/feeds.php +++ b/classes/pref/feeds.php @@ -1197,12 +1197,7 @@ class Pref_Feeds extends Handler_Protected { $opml->opml_import($_SESSION["uid"]); } - function index() { - - print "
"; - print "
rss_feed ".__('Feeds')."\">"; - + private function index_feeds() { $sth = $this->pdo->prepare("SELECT COUNT(id) AS num_errors FROM ttrss_feeds WHERE last_error != '' AND owner_uid = ?"); $sth->execute([$_SESSION['uid']]); @@ -1214,16 +1209,15 @@ class Pref_Feeds extends Handler_Protected { } if ($num_errors > 0) { - $error_button = ""; + $error_button = ""; } else { $error_button = ""; } - $inactive_button = ""; @@ -1235,175 +1229,202 @@ class Pref_Feeds extends Handler_Protected { $feed_search = $_SESSION["prefs_feed_search"] ?? ""; } - print '
'; - - print "
"; #toolbar - - print "
- - -
"; - - print "
". - "" . __('Select').""; - print "
"; - print "
".__('All')."
"; - print "
".__('None')."
"; - print "
"; - - print "
". - "" . __('Feeds').""; - print "
"; - print "
".__('Subscribe to feed')."
"; - print "
".__('Edit selected feeds')."
"; - print "
".__('Reset sort order')."
"; - print "
".__('Batch subscribe')."
"; - print "
" - .__('Unsubscribe')."
"; - print "
"; - - if (get_pref('ENABLE_FEED_CATS')) { - print "
". - "" . __('Categories').""; - print "
"; - print "
".__('Add category')."
"; - print "
".__('Reset sort order')."
"; - print "
".__('Remove selected')."
"; - print "
"; - - } - - print $error_button; - print $inactive_button; - - print "
"; # toolbar - - //print '
'; - print '
'; - - print "
- ". - __("Loading, please wait...")."
"; - - $auto_expand = $feed_search != "" ? "true" : "false"; - - print "
-
-
+ ?> + +
+
+
+ + +
+ +
+ +
+
+
+
+
+ +
+ +
+
+
+
+
+
+
+
+
+ + +
+ +
+
+
+
+
+
+ + + +
+
+
+
+ +
+
+ +
" + persist="true" + model="feedModel" + openOnClick="false"> + + +
+
-
- - -
"; - -# print "
-# ".__('Hint: you can drag feeds and categories around.')." -#
"; + '; - print '
'; - - print "
"; # feeds pane + } - print "
"; + private function index_opml() { + ?> - print "

" . __("Using OPML you can export and import your feeds, filters, labels and Tiny Tiny RSS settings.") . "

"; +

- print_notice("Only main settings profile can be migrated using OPML."); + - print "
-
"; # pane - - print "
share ".__('Published & shared articles / Generated feeds')."\">"; - - print "

" . __('Published articles can be subscribed by anyone who knows the following URL:') . "

"; - + private function index_shared() { $rss_url = htmlspecialchars(get_self_url_prefix() . - "/public.php?op=rss&id=-2&view-mode=all_articles");; + "/public.php?op=rss&id=-2&view-mode=all_articles"); + ?> - print " - "; +

- PluginHost::getInstance()->run_hooks(PluginHost::HOOK_PREFS_TAB_SECTION, "prefFeedsPublishedGenerated"); + - print "
"; #pane + - PluginHost::getInstance()->run_hooks(PluginHost::HOOK_PREFS_TAB, "prefFeeds"); + run_hooks(PluginHost::HOOK_PREFS_TAB_SECTION, "prefFeedsPublishedGenerated"); + } - print "
"; #container + function index() { + ?> + +
+
+ index_feeds() ?> +
+ +
+ index_opml() ?> +
+ +
+ index_shared() ?> +
+ + run_hooks(PluginHost::HOOK_PREFS_TAB, "prefFeeds"); + $plugin_data = trim((string)ob_get_contents()); + ob_end_clean(); + ?> + + +
+ +
+ +
+
+ +
+
-
- -
@@ -758,9 +755,6 @@ class Pref_Filters extends Handler_Protected {
-