]> git.wh0rd.org Git - tt-rss.git/commitdiff
allow to edit labels from main interface
authorAndrew Dolgov <fox@madoka.spb.ru>
Mon, 20 Aug 2007 05:44:05 +0000 (06:44 +0100)
committerAndrew Dolgov <fox@madoka.spb.ru>
Mon, 20 Aug 2007 05:44:05 +0000 (06:44 +0100)
functions.js
prefs.js
tt-rss.js

index e9c14b63ce53a88ab9a51d3e44d90c924aa8a1ad..9e21e0d4e42658f614c8a96b710780f9e5bdaea8 100644 (file)
@@ -1921,3 +1921,31 @@ Position.Center = function(element, parent) {
         element.style.left = (pw/2) - (w/2) -  Position.deltaX + "px";
 }
 
+function labeltest_callback() {
+       var container = document.getElementById('label_test_result');
+       if (xmlhttp.readyState == 4) {
+               container.innerHTML=xmlhttp.responseText;
+               notify("");
+       }
+}
+
+function labelTest() {
+
+       var container = document.getElementById('label_test_result');
+       container.style.display = "block";
+       container.innerHTML = "<p>Loading, please wait...</p>";
+
+       var form = document.forms['label_edit_form'];
+
+       var sql_exp = form.sql_exp.value;
+       var description = form.description.value;
+
+       xmlhttp.open("GET", "backend.php?op=pref-labels&subop=test&expr=" +
+               param_escape(sql_exp) + "&descr=" + param_escape(description), true);
+
+       xmlhttp.onreadystatechange=labeltest_callback;
+       xmlhttp.send(null);
+
+       return false;
+}
+
index 0debf270c93fdcb83fdb3a054cf1fc11065735ad..b1739bc95375d6355c57225f604b820dd1277191 100644 (file)
--- a/prefs.js
+++ b/prefs.js
@@ -144,14 +144,6 @@ function labellist_callback() {
        }
 }
 
-function labeltest_callback() {
-       var container = document.getElementById('label_test_result');
-       if (xmlhttp.readyState == 4) {
-               container.innerHTML=xmlhttp.responseText;
-               notify("");
-       }
-}
-
 function feed_browser_callback() {
        var container = document.getElementById('prefContent');
        if (xmlhttp.readyState == 4) {
@@ -761,25 +753,6 @@ function feedCatEditSave() {
 }
 
 
-function labelTest() {
-
-       var container = document.getElementById('label_test_result');
-       container.style.display = "block";
-       container.innerHTML = "<p>Loading, please wait...</p>";
-
-       var form = document.forms['label_edit_form'];
-
-       var sql_exp = form.sql_exp.value;
-       var description = form.description.value;
-
-       xmlhttp.open("GET", "backend.php?op=pref-labels&subop=test&expr=" +
-               param_escape(sql_exp) + "&descr=" + param_escape(description), true);
-
-       xmlhttp.onreadystatechange=labeltest_callback;
-       xmlhttp.send(null);
-
-       return false;
-}
 
 function displayHelpInfobox(topic_id) {
 
index e7a21a73d9cdf83fed8b3edb99782f4db3afbaaa..0e47069f7f38bf77c818c4e4e0553443452d05c0 100644 (file)
--- a/tt-rss.js
+++ b/tt-rss.js
@@ -673,16 +673,24 @@ function editFeedDlg(feed) {
                return;
        }
 
-       if (feed <= 0 || activeFeedIsCat() || tagsAreDisplayed()) {
+       if ((feed <= 0 && feed > -10) || activeFeedIsCat() || tagsAreDisplayed()) {
                alert(__("You can't edit this kind of feed."));
                return;
        }
 
        if (xmlhttp_ready(xmlhttp)) {
-               xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=editfeed&id=" +
-                       param_escape(feed), true);
-               xmlhttp.onreadystatechange=infobox_callback;
-               xmlhttp.send(null);
+
+               if (feed > 0) {
+                       xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=editfeed&id=" +
+                               param_escape(feed), true);
+                       xmlhttp.onreadystatechange=infobox_callback;
+                       xmlhttp.send(null);
+               } else {
+                       xmlhttp.open("GET", "backend.php?op=pref-labels&subop=edit&id=" +
+                               param_escape(-feed-11), true);
+                       xmlhttp.onreadystatechange=infobox_callback;
+                       xmlhttp.send(null);
+               }
        } else {
                printLockingError();
        }
@@ -725,4 +733,35 @@ function feedEditSave() {
        } 
 }
 
+function labelEditCancel() {
+       closeInfoBox();
+       return false;
+}
+
+function labelEditSave() {
+
+       try {
+
+               if (!xmlhttp_ready(xmlhttp)) {
+                       printLockingError();
+                       return
+               }
+       
+               closeInfoBox();
+       
+               notify_progress("Saving label...");
+       
+               query = Form.serialize("label_edit_form");
+       
+               xmlhttp.open("GET", "backend.php?" + query, true);              
+               xmlhttp.onreadystatechange=dlg_frefresh_callback;
+               xmlhttp.send(null);
+       
+               return false;
+
+       } catch (e) {
+               exception_error("feedEditSave (main)", e);
+       } 
+
+}