From 521d0b65c73f90d6e86c1a38dcab492b5a23982b Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Sun, 21 Feb 2021 16:02:57 +0300 Subject: batch feed editor: use tab layout, cleanup --- classes/pref/feeds.php | 243 +++++++++++++++++++------------------------------ 1 file changed, 95 insertions(+), 148 deletions(-) (limited to 'classes') diff --git a/classes/pref/feeds.php b/classes/pref/feeds.php index 8d3f84a03..c901bc96e 100755 --- a/classes/pref/feeds.php +++ b/classes/pref/feeds.php @@ -22,11 +22,6 @@ class Pref_Feeds extends Handler_Protected { return $rv; } - function batch_edit_cbox($elem, $label = false) { - print ""; - } - function renamecat() { $title = clean($_REQUEST['title']); $id = clean($_REQUEST['id']); @@ -571,165 +566,117 @@ class Pref_Feeds extends Handler_Protected { } } + private function _batch_toggle_checkbox($name) { + return \Controls\checkbox_tag("", false, "", + ["data-control-for" => $name, "title" => __("Check to enable field"), "onchange" => "App.dialogOf(this).toggleField(this)"]); + } + function editfeeds() { global $purge_intervals; global $update_intervals; $feed_ids = clean($_REQUEST["ids"]); - print_notice("Enable the options you wish to apply using checkboxes on the right:"); - - print \Controls\hidden_tag("ids", "$feed_ids"); - print \Controls\hidden_tag("op", "pref-feeds"); - print \Controls\hidden_tag("method", "batchEditSave"); - - print "
".__("Feed")."
"; - print "
"; - - /* Category */ - - if (get_pref('ENABLE_FEED_CATS')) { - - print "
"; - - print " "; - - print \Controls\select_feeds_cats("cat_id", null, ['disabled' => '1']); - - $this->batch_edit_cbox("cat_id"); - - print "
"; - } - - /* FTS Stemming Language */ - - if (DB_TYPE == "pgsql") { - print "
"; - - print " "; - print \Controls\select_tag("feed_language", "", $this::get_ts_languages(), ["disabled"=> 1]); - - $this->batch_edit_cbox("feed_language"); - - print "
"; - } - - print "
"; - - print "
".__("Update")."
"; - print "
"; - - /* Update Interval */ - - print "
"; - - print " "; - $local_update_intervals = $update_intervals; $local_update_intervals[0] .= sprintf(" (%s)", $update_intervals[get_pref("DEFAULT_UPDATE_INTERVAL")]); - print \Controls\select_hash("update_interval", "", $local_update_intervals, ["disabled" => 1]); - - $this->batch_edit_cbox("update_interval"); - - print "
"; - - /* Purge intl */ - - if (FORCE_ARTICLE_PURGE == 0) { - - print "
"; - - print " "; - - $local_purge_intervals = $purge_intervals; - $default_purge_interval = get_pref("PURGE_OLD_DAYS"); - - if ($default_purge_interval > 0) - $local_purge_intervals[0] .= " " . T_sprintf("(%d days)", $default_purge_interval); - else - $local_purge_intervals[0] .= " " . sprintf("(%s)", __("Disabled")); + $local_purge_intervals = $purge_intervals; + $default_purge_interval = get_pref("PURGE_OLD_DAYS"); - print \Controls\select_hash("purge_interval", "", $local_purge_intervals, ["disabled" => 1]); - - $this->batch_edit_cbox("purge_interval"); - - print "
"; - } - - print "
"; - print "
".__("Authentication")."
"; - print "
"; - - print "
"; - - print ""; - - $this->batch_edit_cbox("auth_login"); - - print ""; - - $this->batch_edit_cbox("auth_pass"); - - print "
"; - - print "
"; - print "
".__("Options")."
"; - print "
"; - - print "
"; - print ""; - - print " "; $this->batch_edit_cbox("include_in_digest", "include_in_digest_l"); - - print "
"; - - print ""; - - print " "; $this->batch_edit_cbox("always_display_enclosures", "always_display_enclosures_l"); - - print "
"; - - print ""; - - print " "; $this->batch_edit_cbox("hide_images", "hide_images_l"); - - print "
"; - - print ""; - - print " "; $this->batch_edit_cbox("cache_images", "cache_images_l"); - - print "
"; + if ($default_purge_interval > 0) + $local_purge_intervals[0] .= " " . T_sprintf("(%d days)", $default_purge_interval); + else + $local_purge_intervals[0] .= " " . sprintf("(%s)", __("Disabled")); - print ""; + $options = [ + "include_in_digest" => __('Include in e-mail digest'), + "always_display_enclosures" => __('Always display image attachments'), + "hide_images" => __('Do not embed media'), + "cache_images" => __('Cache media'), + "mark_unread_on_update" => __('Mark updated articles as unread') + ]; - print " "; $this->batch_edit_cbox("mark_unread_on_update", "mark_unread_on_update_l"); + print_notice("Enable the options you wish to apply using checkboxes on the right."); + ?> - print "
"; + + + - print "
"; +
+
+
+ +
+ + '1']) ?> + _batch_toggle_checkbox("cat_id") ?> +
+ - print "
- - -
"; + +
+ + 1]) ?> + _batch_toggle_checkbox("feed_language") ?> +
+ +
+ +
+ +
+
+ + 1]) ?> + _batch_toggle_checkbox("update_interval") ?> +
+ + +
+ + 1]) ?> + _batch_toggle_checkbox("purge_interval") ?> +
+ +
+
+
+
+
+ + + _batch_toggle_checkbox("auth_login") ?> +
+
+ + + _batch_toggle_checkbox("auth_pass") ?> +
+
+
+
+ $caption) { + ?> +
+ +
+ +
+
- return; + +