]> git.wh0rd.org Git - tt-rss.git/commitdiff
tmp color-ops toolbar (2)
authorAndrew Dolgov <fox@bah.spb.su>
Mon, 26 Jan 2009 11:30:13 +0000 (12:30 +0100)
committerAndrew Dolgov <fox@bah.spb.su>
Mon, 26 Jan 2009 11:30:13 +0000 (12:30 +0100)
modules/pref-labels.php
prefs.js

index 1c8fd02ada3da2519e32d0cdb1a89c4f88c63ee8..162592625df78b3deff732765c330644099f51fb 100644 (file)
@@ -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"]);
        
                        print "<p id=\"labelOpToolbar\">";
 
-                       print "<div style='float : right'>";
+                       print "<input type=\"submit\" class=\"button\" disabled=\"true\"
+                               onclick=\"javascript:removeSelectedLabels()\" value=\"".__('Remove')."\">";
+
+                       print "&nbsp;&nbsp;";
                        print __("Color:");
-                       print " <input type=\"submit\" class=\"button\" disabled=\"true\"
-                               onclick=\"\" value=\"".__('Fg')."\">&nbsp;";
+                       print "&nbsp;<input type=\"submit\" class=\"button\" disabled=\"true\"
+                               onclick=\"labelColorSet('fg')\" value=\"".__('Fg')."\">&nbsp;";
                        print "<input type=\"submit\" class=\"button\" disabled=\"true\"
-                               onclick=\"\" value=\"".__('Bg')."\">&nbsp;";
+                               onclick=\"labelColorSet('bg')\" value=\"".__('Bg')."\">&nbsp;";
                        print "<input type=\"submit\" class=\"button\" disabled=\"true\"
-                               onclick=\"\" value=\"".__('Clear')."\">";
+                               onclick=\"labelColorReset()\" value=\"".__('Clear')."\">";
 
-                       print "</div>";
-
-                       print "<input type=\"submit\" class=\"button\" disabled=\"true\"
-                               onclick=\"javascript:removeSelectedLabels()\" value=\"".__('Remove')."\">";
                        print "</p>";
 
                } else {
index 334bed379e3632870943a137c4ec8f371ec3e4be..790d4a6993babf7a1c1743597d856f21600b5234 100644 (file)
--- 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 {