From 26d6b84a572b5cbd99acffc5ae727ea6d1be543a Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Tue, 16 Feb 2021 14:23:00 +0300 Subject: add namespaced controls with unified naming; deprecated old-style control shortcuts --- include/controls_compat.php | 312 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 312 insertions(+) create mode 100644 include/controls_compat.php (limited to 'include/controls_compat.php') diff --git a/include/controls_compat.php b/include/controls_compat.php new file mode 100644 index 000000000..3d2779b08 --- /dev/null +++ b/include/controls_compat.php @@ -0,0 +1,312 @@ +"; + foreach ($values as $v) { + if ($v == $default) + $sel = "selected=\"1\""; + else + $sel = ""; + + $v = trim($v); + + print ""; + } + print ""; +} + +function print_select_hash($id, $default, $values, $attributes = "", $name = "") { + if (!$name) $name = $id; + + print ""; +} + +function format_hidden($name, $value) { + return ""; +} + +function print_hidden($name, $value) { + print format_hidden($name, $value); +} + +function format_checkbox($id, $checked, $value = "", $attributes = "") { + $checked_str = $checked ? "checked" : ""; + $value_str = $value ? "value=\"$value\"" : ""; + + return ""; +} + +function print_checkbox($id, $checked, $value = "", $attributes = "") { + print format_checkbox($id, $checked, $value, $attributes); +} + +function format_button($type, $value, $attributes = "") { + return ""; +} + +function print_button($type, $value, $attributes = "") { + print format_button($type, $value, $attributes); +} + +function print_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 ""; + } +} + +function print_feed_cat_select($id, $default_id, $attributes, $include_all_cats = true, + $root_id = null, $nest_level = 0) { + + print format_feed_cat_select($id, $default_id, $attributes, $include_all_cats, $root_id, $nest_level); +} + +function format_feed_cat_select($id, $default_id, $attributes, $include_all_cats = true, + $root_id = null, $nest_level = 0) { + + $ret = ""; + + if (!$root_id) { + $ret .= ""; + } + + return $ret; +} + +function stylesheet_tag($filename, $id = false) { + $timestamp = filemtime($filename); + + $id_part = $id ? "id=\"$id\"" : ""; + + return "\n"; +} + +function javascript_tag($filename) { + $query = ""; + + if (!(strpos($filename, "?") === false)) { + $query = substr($filename, strpos($filename, "?")+1); + $filename = substr($filename, 0, strpos($filename, "?")); + } + + $timestamp = filemtime($filename); + + if ($query) $timestamp .= "&$query"; + + return "\n"; +} + +function format_warning($msg, $id = "") { + return "
$msg
"; +} + +function format_notice($msg, $id = "") { + return "
$msg
"; +} + +function format_error($msg, $id = "") { + return "
$msg
"; +} + +function print_notice($msg) { + return print format_notice($msg); +} + +function print_warning($msg) { + return print format_warning($msg); +} + +function print_error($msg) { + return print format_error($msg); +} + +function print_label_select($name, $value, $attributes = "") { + + $pdo = Db::pdo(); + + $sth = $pdo->prepare("SELECT caption FROM ttrss_labels2 + WHERE owner_uid = ? ORDER BY caption"); + $sth->execute([$_SESSION['uid']]); + + print ""; + + +} -- cgit v1.2.3 From 24c79d91c27d41a30e7593b7dca6b5b8bfe84199 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Tue, 16 Feb 2021 18:53:56 +0300 Subject: controls_compat: comment out most of them --- include/controls_compat.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'include/controls_compat.php') diff --git a/include/controls_compat.php b/include/controls_compat.php index 3d2779b08..597eb9879 100644 --- a/include/controls_compat.php +++ b/include/controls_compat.php @@ -2,7 +2,7 @@ // the following is deprecated and will be eventually removed -function print_select($id, $default, $values, $attributes = "", $name = "") { +/*function print_select($id, $default, $values, $attributes = "", $name = "") { if (!$name) $name = $id; print ""; -} +}*/ +/* function format_hidden($name, $value) { return ""; } @@ -44,6 +45,7 @@ function format_hidden($name, $value) { function print_hidden($name, $value) { print format_hidden($name, $value); } +*/ function format_checkbox($id, $checked, $value = "", $attributes = "") { $checked_str = $checked ? "checked" : ""; @@ -56,6 +58,7 @@ function print_checkbox($id, $checked, $value = "", $attributes = "") { print format_checkbox($id, $checked, $value, $attributes); } +/* function format_button($type, $value, $attributes = "") { return ""; } @@ -236,6 +239,7 @@ function format_feed_cat_select($id, $default_id, $attributes, $include_all_cats return $ret; } +*/ function stylesheet_tag($filename, $id = false) { $timestamp = filemtime($filename); @@ -284,6 +288,7 @@ function print_error($msg) { return print format_error($msg); } +/* function print_label_select($name, $value, $attributes = "") { $pdo = Db::pdo(); @@ -310,3 +315,4 @@ function print_label_select($name, $value, $attributes = "") { } +*/ -- cgit v1.2.3 From 91e796938301b3ca3206515e7232db938d7adccc Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Tue, 16 Feb 2021 18:57:06 +0300 Subject: replace a few more controls to new style --- include/controls_compat.php | 102 +++++++++++++++++++++----------------------- 1 file changed, 49 insertions(+), 53 deletions(-) (limited to 'include/controls_compat.php') diff --git a/include/controls_compat.php b/include/controls_compat.php index 597eb9879..d62265471 100644 --- a/include/controls_compat.php +++ b/include/controls_compat.php @@ -1,5 +1,53 @@ \n"; +} + +function javascript_tag($filename) { + $query = ""; + + if (!(strpos($filename, "?") === false)) { + $query = substr($filename, strpos($filename, "?")+1); + $filename = substr($filename, 0, strpos($filename, "?")); + } + + $timestamp = filemtime($filename); + + if ($query) $timestamp .= "&$query"; + + return "\n"; +} + +function format_warning($msg, $id = "") { + return "
$msg
"; +} + +function format_notice($msg, $id = "") { + return "
$msg
"; +} + +function format_error($msg, $id = "") { + return "
$msg
"; +} + +function print_notice($msg) { + return print format_notice($msg); +} + +function print_warning($msg) { + return print format_warning($msg); +} + +function print_error($msg) { + return print format_error($msg); +} + // the following is deprecated and will be eventually removed /*function print_select($id, $default, $values, $attributes = "", $name = "") { @@ -35,9 +83,8 @@ function print_select_hash($id, $default, $values, $attributes = "", $name = "") } print ""; -}*/ +} -/* function format_hidden($name, $value) { return ""; } @@ -45,7 +92,6 @@ function format_hidden($name, $value) { function print_hidden($name, $value) { print format_hidden($name, $value); } -*/ function format_checkbox($id, $checked, $value = "", $attributes = "") { $checked_str = $checked ? "checked" : ""; @@ -58,7 +104,6 @@ function print_checkbox($id, $checked, $value = "", $attributes = "") { print format_checkbox($id, $checked, $value, $attributes); } -/* function format_button($type, $value, $attributes = "") { return ""; } @@ -239,56 +284,7 @@ function format_feed_cat_select($id, $default_id, $attributes, $include_all_cats return $ret; } -*/ - -function stylesheet_tag($filename, $id = false) { - $timestamp = filemtime($filename); - - $id_part = $id ? "id=\"$id\"" : ""; - - return "\n"; -} - -function javascript_tag($filename) { - $query = ""; - - if (!(strpos($filename, "?") === false)) { - $query = substr($filename, strpos($filename, "?")+1); - $filename = substr($filename, 0, strpos($filename, "?")); - } - - $timestamp = filemtime($filename); - - if ($query) $timestamp .= "&$query"; - - return "\n"; -} - -function format_warning($msg, $id = "") { - return "
$msg
"; -} - -function format_notice($msg, $id = "") { - return "
$msg
"; -} - -function format_error($msg, $id = "") { - return "
$msg
"; -} - -function print_notice($msg) { - return print format_notice($msg); -} - -function print_warning($msg) { - return print format_warning($msg); -} - -function print_error($msg) { - return print format_error($msg); -} -/* function print_label_select($name, $value, $attributes = "") { $pdo = Db::pdo(); -- cgit v1.2.3