]> git.wh0rd.org Git - tt-rss.git/commitdiff
rework editSelectedFeeds to use http POST
authorAndrew Dolgov <fox@madoka.volgo-balt.ru>
Fri, 11 Nov 2011 10:20:54 +0000 (14:20 +0400)
committerAndrew Dolgov <fox@madoka.volgo-balt.ru>
Fri, 11 Nov 2011 10:20:54 +0000 (14:20 +0400)
prefs.js

index 98564dfa79546ee03893ff7ba14f193b5668dd04..13dc93b1c374e6d56d9588f6ef5e8e0153dbde1a 100644 (file)
--- a/prefs.js
+++ b/prefs.js
@@ -680,97 +680,107 @@ function editSelectedFeeds() {
                        return;
                }
 
-               notify("");
+               notify_progress("Loading, please wait...");
 
                var query = "backend.php?op=pref-feeds&subop=editfeeds&ids=" +
                        param_escape(rows.toString());
 
+               console.log(query);
+
                if (dijit.byId("feedEditDlg"))
                        dijit.byId("feedEditDlg").destroyRecursive();
 
-               dialog = new dijit.Dialog({
-                       id: "feedEditDlg",
-                       title: __("Edit Multiple Feeds"),
-                       style: "width: 600px",
-                       getChildByName: function (name) {
-                               var rv = null
-                               this.getChildren().each(
-                                       function(child) {
-                                               if (child.name == name) {
-                                                       rv = child;
-                                                       return;
-                                               }
-                                       });
-                               return rv;
-                       },
-                       toggleField: function (checkbox, elem, label) {
-                               this.getChildByName(elem).attr('disabled', !checkbox.checked);
-
-                               if ($(label))
-                                       if (checkbox.checked)
-                                               $(label).removeClassName('insensitive');
-                                       else
-                                               $(label).addClassName('insensitive');
-
-                       },
-                       execute: function() {
-                               if (this.validate() && confirm(__("Save changes to selected feeds?"))) {
-                                       var query = dojo.objectToQuery(this.attr('value'));
+               new Ajax.Request("backend.php", {
+                       parameters: query,
+                       onComplete: function(transport) {
 
-                                       /* Form.serialize ignores unchecked checkboxes */
+                               notify("");
+
+                               var dialog = new dijit.Dialog({
+                                       id: "feedEditDlg",
+                                       title: __("Edit Multiple Feeds"),
+                                       style: "width: 600px",
+                                       getChildByName: function (name) {
+                                               var rv = null
+                                               this.getChildren().each(
+                                                       function(child) {
+                                                               if (child.name == name) {
+                                                                       rv = child;
+                                                                       return;
+                                                               }
+                                                       });
+                                               return rv;
+                                       },
+                                       toggleField: function (checkbox, elem, label) {
+                                               this.getChildByName(elem).attr('disabled', !checkbox.checked);
+
+                                               if ($(label))
+                                                       if (checkbox.checked)
+                                                               $(label).removeClassName('insensitive');
+                                                       else
+                                                               $(label).addClassName('insensitive');
+
+                                       },
+                                       execute: function() {
+                                               if (this.validate() && confirm(__("Save changes to selected feeds?"))) {
+                                                       var query = dojo.objectToQuery(this.attr('value'));
+
+                                                       /* Form.serialize ignores unchecked checkboxes */
+
+                                                       if (!query.match("&rtl_content=") &&
+                                                                       this.getChildByName('rtl_content').attr('disabled') == false) {
+                                                               query = query + "&rtl_content=false";
+                                                       }
 
-                                       if (!query.match("&rtl_content=") &&
-                                                       this.getChildByName('rtl_content').attr('disabled') == false) {
-                                               query = query + "&rtl_content=false";
-                                       }
+                                                       if (!query.match("&private=") &&
+                                                                       this.getChildByName('private').attr('disabled') == false) {
+                                                               query = query + "&private=false";
+                                                       }
 
-                                       if (!query.match("&private=") &&
-                                                       this.getChildByName('private').attr('disabled') == false) {
-                                               query = query + "&private=false";
-                                       }
+                                                       try {
+                                                               if (!query.match("&cache_images=") &&
+                                                                               this.getChildByName('cache_images').attr('disabled') == false) {
+                                                                       query = query + "&cache_images=false";
+                                                               }
+                                                       } catch (e) { }
 
-                                       try {
-                                               if (!query.match("&cache_images=") &&
-                                                               this.getChildByName('cache_images').attr('disabled') == false) {
-                                                       query = query + "&cache_images=false";
-                                               }
-                                       } catch (e) { }
+                                                       if (!query.match("&include_in_digest=") &&
+                                                                       this.getChildByName('include_in_digest').attr('disabled') == false) {
+                                                               query = query + "&include_in_digest=false";
+                                                       }
 
-                                       if (!query.match("&include_in_digest=") &&
-                                                       this.getChildByName('include_in_digest').attr('disabled') == false) {
-                                               query = query + "&include_in_digest=false";
-                                       }
+                                                       if (!query.match("&always_display_enclosures=") &&
+                                                                       this.getChildByName('always_display_enclosures').attr('disabled') == false) {
+                                                               query = query + "&always_display_enclosures=false";
+                                                       }
 
-                                       if (!query.match("&always_display_enclosures=") &&
-                                                       this.getChildByName('always_display_enclosures').attr('disabled') == false) {
-                                               query = query + "&always_display_enclosures=false";
-                                       }
+                                                       if (!query.match("&mark_unread_on_update=") &&
+                                                                       this.getChildByName('mark_unread_on_update').attr('disabled') == false) {
+                                                               query = query + "&mark_unread_on_update=false";
+                                                       }
 
-                                       if (!query.match("&mark_unread_on_update=") &&
-                                                       this.getChildByName('mark_unread_on_update').attr('disabled') == false) {
-                                               query = query + "&mark_unread_on_update=false";
-                                       }
+                                                       if (!query.match("&update_on_checksum_change=") &&
+                                                                       this.getChildByName('update_on_checksum_change').attr('disabled') == false) {
+                                                               query = query + "&update_on_checksum_change=false";
+                                                       }
 
-                                       if (!query.match("&update_on_checksum_change=") &&
-                                                       this.getChildByName('update_on_checksum_change').attr('disabled') == false) {
-                                               query = query + "&update_on_checksum_change=false";
-                                       }
+                                                       console.log(query);
 
-                                       console.log(query);
+                                                       notify_progress("Saving data...", true);
 
-                                       notify_progress("Saving data...", true);
+                                                       new Ajax.Request("backend.php", {
+                                                               parameters: query,
+                                                               onComplete: function(transport) {
+                                                                       dialog.hide();
+                                                                       updateFeedList();
+                                                       }})
+                                               }
+                                       },
+                                       content: transport.responseText});
 
-                                       new Ajax.Request("backend.php", {
-                                               parameters: query,
-                                               onComplete: function(transport) {
-                                                       dialog.hide();
-                                                       updateFeedList();
-                                       }})
-                               }
-                       },
-                       href: query});
+                                       dialog.show();
 
-               dialog.show();
+                       } });
 
        } catch (e) {
                exception_error("editSelectedFeeds", e);