From f58c49beaa5e2e0bf924f0ea844ede18abd0bc27 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Tue, 16 Feb 2021 18:50:18 +0300 Subject: [PATCH] replace a few more controls to new style --- classes/pref/feeds.php | 2 +- classes/pref/filters.php | 105 +++++++++++++++++++++++++++++++- plugins/af_proxy_http/init.php | 10 +-- plugins/af_psql_trgm/init.php | 8 ++- plugins/af_readability/init.php | 16 +++-- plugins/af_redditimgur/init.php | 15 ++--- 6 files changed, 131 insertions(+), 25 deletions(-) diff --git a/classes/pref/feeds.php b/classes/pref/feeds.php index ce2d321bd..3d633a378 100755 --- a/classes/pref/feeds.php +++ b/classes/pref/feeds.php @@ -1325,7 +1325,7 @@ class Pref_Feeds extends Handler_Protected { diff --git a/classes/pref/filters.php b/classes/pref/filters.php index e9c58cc3e..bc3099e77 100755 --- a/classes/pref/filters.php +++ b/classes/pref/filters.php @@ -818,7 +818,7 @@ class Pref_Filters extends Handler_Protected { print "
"; print ""; - print_feed_multi_select("feed_id", + $this->feed_multi_select("feed_id", $feed_id, 'style="width : 500px; height : 300px" dojoType="dijit.form.MultiSelect"'); print ""; @@ -1070,4 +1070,107 @@ class Pref_Filters extends Handler_Protected { $this->pdo->commit(); } + + private function feed_multi_select($id, $default_ids = [], + $attributes = "", $include_all_feeds = true, + $root_id = null, $nest_level = 0) { + + $pdo = Db::pdo(); + + // print_r(in_array("CAT:6",$default_ids)); + + if (!$root_id) { + print ""; + } +} } diff --git a/plugins/af_proxy_http/init.php b/plugins/af_proxy_http/init.php index b82999281..79d2f5294 100644 --- a/plugins/af_proxy_http/init.php +++ b/plugins/af_proxy_http/init.php @@ -222,11 +222,13 @@ class Af_Proxy_Http extends Plugin { print \Controls\hidden_tag("method", "save"); print \Controls\hidden_tag("plugin", "af_proxy_http"); - $proxy_all = $this->host->get($this, "proxy_all"); - print_checkbox("proxy_all", $proxy_all); + $proxy_all = sql_bool_to_bool($this->host->get($this, "proxy_all")); + print \Controls\checkbox_tag("proxy_all", $proxy_all); print " 
"; - print "

"; print_button("submit", __("Save")); + print "


"; + + print \Controls\submit_tag(__("Save")); print ""; @@ -234,7 +236,7 @@ class Af_Proxy_Http extends Plugin { } function save() { - $proxy_all = checkbox_to_sql_bool($_POST["proxy_all"]); + $proxy_all = checkbox_to_sql_bool($_POST["proxy_all"] ?? ""); $this->host->set($this, "proxy_all", $proxy_all); diff --git a/plugins/af_psql_trgm/init.php b/plugins/af_psql_trgm/init.php index 715e63927..3662e490a 100644 --- a/plugins/af_psql_trgm/init.php +++ b/plugins/af_psql_trgm/init.php @@ -139,7 +139,7 @@ class Af_Psql_Trgm extends Plugin { $similarity = $this->host->get($this, "similarity", $this->default_similarity); $min_title_length = $this->host->get($this, "min_title_length", $this->default_min_length); - $enable_globally = $this->host->get($this, "enable_globally"); + $enable_globally = sql_bool_to_bool($this->host->get($this, "enable_globally")); print "
"; @@ -186,13 +186,14 @@ class Af_Psql_Trgm extends Plugin { print "
"; print ""; print "
"; - print_button("submit", __("Save"), "class='alt-primary'"); + print "
"; + print \Controls\submit_tag(__("Save")); print ""; /* cleanup */ @@ -202,6 +203,7 @@ class Af_Psql_Trgm extends Plugin { $this->host->set($this, "enabled_feeds", $enabled_feeds); if (count($enabled_feeds) > 0) { + print "
"; print "

" . __("Currently enabled for (click to edit):") . "

"; print "