]> git.wh0rd.org - tt-rss.git/blobdiff - prefs.js
misc typo fixes
[tt-rss.git] / prefs.js
index c13f0e0d41339a9c4350ef83efe10200ca5d05d2..5a75060d6c256ad0aa68b4c2ebad5a29066dca09 100644 (file)
--- a/prefs.js
+++ b/prefs.js
@@ -250,7 +250,7 @@ function editFilter(id) {
                                                                                onComplete: function(transport) {
                                                                                        dialog.hide();
                                                                                        updateFilterList();
-                                                                       }})
+                                                                       }});
                                                                }
                                                        }
                                        }});
@@ -288,7 +288,8 @@ function getSelectedFeeds() {
        var rv = [];
 
        items.each(function(item) {
-               rv.push(tree.model.store.getValue(item, 'bare_id'));
+               if (item.id[0].match("FEED:"))
+                       rv.push(tree.model.store.getValue(item, 'bare_id'));
        });
 
        return rv;
@@ -679,95 +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) { }
 
-                                       if (!query.match("&cache_images=") &&
-                                                       this.getChildByName('cache_images').attr('disabled') == false) {
-                                               query = query + "&cache_images=false";
-                                       }
+                                                       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);
@@ -972,7 +985,7 @@ function pref_hotkey_handler(e) {
        try {
                if (e.target.nodeName == "INPUT") return;
 
-               var keycode;
+               var keycode = false;
                var shift_key = false;
 
                var cmdline = $('cmdline');
@@ -1036,7 +1049,7 @@ function pref_hotkey_handler(e) {
                        if ((keycode == 191 || keychar == '?') && shift_key) { // ?
                                if (!Element.visible("hotkey_help_overlay")) {
                                        //Element.show("hotkey_help_overlay");
-                                       Effect.Appear("hotkey_help_overlay", {duration : 0.3});
+                                       Effect.Appear("hotkey_help_overlay", {duration : 0.3, to: 0.9});
                                } else {
                                        Element.hide("hotkey_help_overlay");
                                }
@@ -1590,6 +1603,24 @@ function clearFeedAccessKeys() {
        return false;
 }
 
+function clearArticleAccessKeys() {
+
+       var ok = confirm(__("This will invalidate all previously shared article URLs. Continue?"));
+
+       if (ok) {
+               notify_progress("Clearing URLs...");
+
+               var query = "?op=rpc&subop=clearArticleKeys";
+
+               new Ajax.Request("backend.php", {
+                       parameters: query,
+                       onComplete: function(transport) {
+                               notify_info("Shared URLs cleared.");
+                       } });
+       }
+
+       return false;
+}
 function resetFeedOrder() {
        try {
                notify_progress("Loading, please wait...");
@@ -1693,7 +1724,6 @@ function editLabel(id, event) {
                        },
                        execute: function() {
                                if (this.validate()) {
-                                       var caption = this.attr('value').id;
                                        var caption = this.attr('value').caption;
                                        var fg_color = this.attr('value').fg_color;
                                        var bg_color = this.attr('value').bg_color;
@@ -1785,8 +1815,43 @@ function getSelectedInstances() {
 
 function addInstance() {
        try {
-               alert("TODO: function not implemented.");
+               var query = "backend.php?op=dlg&id=addInstance";
 
+               if (dijit.byId("instanceAddDlg"))
+                       dijit.byId("instanceAddDlg").destroyRecursive();
+
+               dialog = new dijit.Dialog({
+                       id: "instanceAddDlg",
+                       title: __("Link Instance"),
+                       style: "width: 600px",
+                       regenKey: function() {
+                               new Ajax.Request("backend.php", {
+                                       parameters: "?op=rpc&subop=genHash",
+                                       onComplete: function(transport) {
+                                               var reply = JSON.parse(transport.responseText);
+                                               if (reply)
+                                                       dijit.byId('instance_add_key').attr('value', reply.hash);
+
+                                       } });
+                       },
+                       execute: function() {
+                               if (this.validate()) {
+                                       console.warn(dojo.objectToQuery(this.attr('value')));
+
+                                       notify_progress('Saving data...', true);
+                                       new Ajax.Request("backend.php", {
+                                               parameters: dojo.objectToQuery(this.attr('value')),
+                                               onComplete: function(transport) {
+                                                       dialog.hide();
+                                                       notify('');
+                                                       updateInstanceList();
+                                       } });
+                               }
+                       },
+                       href: query,
+               });
+
+               dialog.show();
 
        } catch (e) {
                exception_error("addInstance", e);
@@ -1810,6 +1875,30 @@ function editInstance(id, event) {
                        id: "instanceEditDlg",
                        title: __("Edit Instance"),
                        style: "width: 600px",
+                       regenKey: function() {
+                               new Ajax.Request("backend.php", {
+                                       parameters: "?op=rpc&subop=genHash",
+                                       onComplete: function(transport) {
+                                               var reply = JSON.parse(transport.responseText);
+                                               if (reply)
+                                                       dijit.byId('instance_edit_key').attr('value', reply.hash);
+
+                                       } });
+                       },
+                       execute: function() {
+                               if (this.validate()) {
+//                                     console.warn(dojo.objectToQuery(this.attr('value')));
+
+                                       notify_progress('Saving data...', true);
+                                       new Ajax.Request("backend.php", {
+                                               parameters: dojo.objectToQuery(this.attr('value')),
+                                               onComplete: function(transport) {
+                                                       dialog.hide();
+                                                       notify('');
+                                                       updateInstanceList();
+                                       } });
+                               }
+                       },
                        href: query,
                });
 
@@ -1829,7 +1918,29 @@ function editInstance(id, event) {
 
 function removeSelectedInstances() {
        try {
-               alert("TODO: function not implemented.");
+               var sel_rows = getSelectedInstances();
+
+               if (sel_rows.length > 0) {
+
+                       var ok = confirm(__("Remove selected instances?"));
+
+                       if (ok) {
+                               notify_progress("Removing selected instances...");
+
+                               var query = "?op=pref-instances&subop=remove&ids="+
+                                       param_escape(sel_rows.toString());
+
+                               new Ajax.Request("backend.php", {
+                                       parameters: query,
+                                       onComplete: function(transport) {
+                                               notify('');
+                                               updateInstanceList();
+                                       } });
+                       }
+
+               } else {
+                       alert(__("No instances are selected."));
+               }
 
        } catch (e) {
                exception_error("removeInstance", e);