From fb8b2153acbdfe42edd2dddbc10778812a60c869 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Thu, 18 Nov 2010 20:04:57 +0300 Subject: update label editor --- modules/pref-labels.php | 299 ++++++++++++++++++++---------------------------- 1 file changed, 127 insertions(+), 172 deletions(-) (limited to 'modules/pref-labels.php') diff --git a/modules/pref-labels.php b/modules/pref-labels.php index 467928416..386b9c6a2 100644 --- a/modules/pref-labels.php +++ b/modules/pref-labels.php @@ -3,6 +3,114 @@ $subop = $_REQUEST["subop"]; + if ($subop == "edit") { + $label_id = db_escape_string($_REQUEST['id']); + + header("Content-Type: text/xml"); + print ""; + print "" . __("Label Editor") . ""; + print "".__("Caption").""; + + print "
"; + + print "" . $line["caption"] . + " + "; + + print "
"; + print "
" . __("Change colors") . "
"; + print "
"; + + print ""; + + print "
"; + + print "
".__("Foreground color:")."".__("Background color:"). + "
"; + + print "
+ +
"; + print ""; + + print "
"; + + print "
+ +
"; + print ""; + + print "
"; + print "
"; + + print "
"; + print ""; + print "
"; + + print "]]>
"; + return; + } + + if ($subop == "getlabeltree") { + $root = array(); + $root['id'] = 'root'; + $root['name'] = __('Labels'); + $root['items'] = array(); + + $result = db_query($link, "SELECT * + FROM ttrss_labels2 + WHERE owner_uid = ".$_SESSION["uid"]." + ORDER BY caption"); + + while ($line = db_fetch_assoc($result)) { + $label = array(); + $label['id'] = 'LABEL:' . $line['id']; + $label['bare_id'] = $line['id']; + $label['name'] = $line['caption']; + $label['fg_color'] = $line['fg_color']; + $label['bg_color'] = $line['bg_color']; + $label['type'] = 'label'; + $label['checkbox'] = false; + + array_push($root['items'], $label); + } + + $fl = array(); + $fl['identifier'] = 'id'; + $fl['label'] = 'name'; + $fl['items'] = array($root); + + print json_encode($fl); + return; + } + if ($subop == "color-set") { $kind = db_escape_string($_REQUEST["kind"]); $ids = split(',', db_escape_string($_REQUEST["ids"])); @@ -154,21 +262,12 @@ print "
"; print "
"; - print "
- - -
"; - print "
". "" . __('Select').""; print "
"; - print "
".__('All')."
"; - print "
".__('None')."
"; print "
"; @@ -186,170 +285,26 @@ print "
"; #pane print "
"; - if ($label_search) { - - $label_search = split(" ", $label_search); - $tokens = array(); - - foreach ($label_search as $token) { - - $token = trim($token); - array_push($tokens, "(UPPER(caption) LIKE UPPER('%$token%'))"); - - } - - $label_search_query = "(" . join($tokens, " AND ") . ") AND "; - - } else { - $label_search_query = ""; - } - - $result = db_query($link, "SELECT - * - FROM - ttrss_labels2 - WHERE - $label_search_query - owner_uid = ".$_SESSION["uid"]." - ORDER BY $sort"); - - if (db_num_rows($result) != 0) { - - print "

"; - - $lnum = 0; - - while ($line = db_fetch_assoc($result)) { - - $class = ($lnum % 2) ? "even" : "odd"; - - $label_id = $line["id"]; - $this_row_id = "id=\"LILRR-$label_id\""; - - print ""; - - $line["caption"] = htmlspecialchars($line["caption"]); - - $fg_color = $line["fg_color"]; - $bg_color = $line["bg_color"]; - - if (!$fg_color) $fg_color = ""; - if (!$bg_color) $bg_color = ""; - - print ""; - - $id = $line['id']; - - print ""; - - print ""; - - ++$lnum; - } - - print "
"; - - print "
α"; - print_color_picker($id); - print "
"; - - print "" . $line["caption"] . - " - "; - - print "
"; - - - } else { - print "

"; - if (!$label_search) { - print_warning(__('No labels defined.')); - } else { - print_warning(__('No matching labels found.')); - } - print "

"; - - } + print "
+ ". + __("Loading, please wait...")."
"; + + print "
+
+
+
+
+ +
"; print "
"; #pane print "
"; #container } - function print_color_picker($id) { - - print ""; - } - ?> -- cgit v1.2.3-54-g00ecf