From: Andrew Dolgov Date: Mon, 26 Jan 2009 11:30:13 +0000 (+0100) Subject: tmp color-ops toolbar (2) X-Git-Tag: git2svn-syncpoint-master~7 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=b8776a07f1c125955a9e8ad1ca13097411568fbd;p=tt-rss.git tmp color-ops toolbar (2) --- diff --git a/modules/pref-labels.php b/modules/pref-labels.php index 1c8fd02a..16259262 100644 --- a/modules/pref-labels.php +++ b/modules/pref-labels.php @@ -3,6 +3,19 @@ $subop = $_GET["subop"]; + if ($subop == "color-set") { + $kind = db_escape_string($_REQUEST["kind"]); + $ids = split(',', db_escape_string($_REQUEST["ids"])); + $color = db_escape_string($_REQUEST["color"]); + + foreach ($ids as $id) { + db_query($link, "UPDATE ttrss_labels2 SET + ${kind}_color = '$color' WHERE id = '$id' + AND owner_uid = " . $_SESSION["uid"]); + } + + } + if ($subop == "save") { $id = db_escape_string($_REQUEST["id"]); @@ -211,19 +224,18 @@ print "

"; - print "

"; + print ""; + + print "  "; print __("Color:"); - print "  "; + print "  "; print " "; + onclick=\"labelColorSet('bg')\" value=\"".__('Bg')."\"> "; print ""; + onclick=\"labelColorReset()\" value=\"".__('Clear')."\">"; - print "
"; - - print ""; print "

"; } else { diff --git a/prefs.js b/prefs.js index 334bed37..790d4a69 100644 --- a/prefs.js +++ b/prefs.js @@ -1968,6 +1968,51 @@ function batchFeedsToggleField(cb, elem, label) { } } +function labelColorReset() { + try { + var labels = getSelectedLabels(); + + var ok = confirm(__("Clear colors of labels?")); + + if (ok) { + + var query = "backend.php?op=pref-labels&subop=color-reset&ids="+ + param_escape(labels.toString()); + + new Ajax.Request(query, { + onComplete: function(transport) { + labellist_callback2(transport); + } }); + } + + } catch (e) { + exception_error("labelColorReset", e); + } +} + +function labelColorSet(kind) { + try { + var labels = getSelectedLabels(); + + var p = prompt(__("Please enter new label color:")); + + if (p != null) { + + var query = "backend.php?op=pref-labels&subop=color-set&kind=" + kind + + "&ids="+ param_escape(labels.toString()) + "&color=" + param_escape(p); + + new Ajax.Request(query, { + onComplete: function(transport) { + labellist_callback2(transport); + } }); + } + + } catch (e) { + exception_error("labelColorReset", e); + } +} + + /* function colorPicker(caller, id, fg, bg) { try {