]> git.wh0rd.org Git - tt-rss.git/commitdiff
add hotkeys to prefs (2)
authorAndrew Dolgov <fox@madoka.spb.ru>
Fri, 16 May 2008 06:33:19 +0000 (07:33 +0100)
committerAndrew Dolgov <fox@madoka.spb.ru>
Fri, 16 May 2008 06:33:19 +0000 (07:33 +0100)
functions.js
help/4.php
modules/pref-prefs.php
prefs.js

index eb036e3c4e17b8e2885ecbba239a9063fba95ccb..e309c5e70ccd270ea27a4a05bfc5428e060e89f0 100644 (file)
@@ -1237,6 +1237,8 @@ function infobox_callback2(transport) {
                                { tokens: ',', paramName: "search" });
                }
 
+               disableHotkeys();
+
                notify("");
        } catch (e) {
                exception_error("infobox_callback2", e);
@@ -1255,6 +1257,9 @@ function createFilter() {
 
        var query = Form.serialize("filter_add_form");
 
+       // we can be called from some other tab in Prefs
+       if (active_tab) active_tab = "filterConfig";
+
        new Ajax.Request("backend.php?" + query, {
                onComplete: function (transport) {
                        infobox_submit_callback2(transport);
index 78eed93f356405f4c5221d8be23a4bdd9a5c7f87..d66a9cc5b7e364619e9e380c85c7b9e29de02534 100644 (file)
@@ -2,15 +2,15 @@
 
 <table width='100%'><tr><td width='50%' valign='top'>
 
-       <h2><?php echo __("Navigation") ?></h2>
+       <h2><?php echo __("Go to...") ?></h2>
 
        <table>
-               <tr><td class='n'>1</td><td><?php echo __("Preferences") ?></td></tr>
-               <tr><td class='n'>2</td><td><?php echo __("My Feeds") ?></td></tr>
-               <tr><td class='n'>3</td><td><?php echo __("Other Feeds") ?></td></tr>
-               <tr><td class='n'>4</td><td><?php echo __("Content Filtering") ?></td></tr>
-               <tr><td class='n'>5</td><td><?php echo __("Label Editor") ?></td></tr>
-               <tr><td class='n'>6</td><td><?php echo __("User Manager") ?></td></tr>
+               <tr><td class='n'>1</td><td><?php echo __("Preferences") ?></td></tr>
+               <tr><td class='n'>2</td><td><?php echo __("My Feeds") ?></td></tr>
+               <tr><td class='n'>3</td><td><?php echo __("Other Feeds") ?></td></tr>
+               <tr><td class='n'>4</td><td><?php echo __("Content Filtering") ?></td></tr>
+               <tr><td class='n'>5</td><td><?php echo __("Label Editor") ?></td></tr>
+               <tr><td class='n'>6</td><td><?php echo __("User Manager") ?></td></tr>
        </table>
 
 </td><td valign='top'>
@@ -21,7 +21,7 @@
                <tr><td class='n'>c s</td><td><?php echo __("Subscribe to feed") ?></td></tr>
                <tr><td class='n'>c f</td><td><?php echo __("Create filter") ?></td></tr>
                <tr><td class='n'>c l</td><td><?php echo __("Create label") ?></td></tr>
-               <tr><td class='n'>c u</td><td><?php echo __("Create user") ?></td></tr>
+               <!-- <tr><td class='n'>c u</td><td><?php echo __("Create user") ?></td></tr> -->
        </table>
 
        <h2><?php echo __("Other actions") ?></h2>
index 20cffe5e5b14b7313e762ca63b78bcfc71893169..64d7cf6af930a693d939f17c3199db4ac4a412ef 100644 (file)
        
                                print "<tr><td width=\"40%\">".__('E-mail')."</td>";
                                print "<td><input class=\"editbox\" name=\"email\" 
+                                       onfocus=\"javascript:disableHotkeys();\" 
+                                       onblur=\"javascript:enableHotkeys();\"
                                        onkeypress=\"return filterCR(event, changeUserEmail)\"
                                        value=\"$email\"></td></tr>";
 
        
                                print "<tr><td width=\"40%\">".__("Old password")."</td>";
                                print "<td><input class=\"editbox\" type=\"password\"
+                                       onfocus=\"javascript:disableHotkeys();\" 
+                                       onblur=\"javascript:enableHotkeys();\"
                                        onkeypress=\"return filterCR(event, changeUserPassword)\"
                                        name=\"OLD_PASSWORD\"></td></tr>";
        
                                print "<tr><td width=\"40%\">".__("New password")."</td>";
                                
                                print "<td><input class=\"editbox\" type=\"password\"
+                                       onfocus=\"javascript:disableHotkeys();\" 
+                                       onblur=\"javascript:enableHotkeys();\"
                                        onkeypress=\"return filterCR(event, changeUserPassword)\"
                                        name=\"NEW_PASSWORD\"></td></tr>";
 
                                print "<tr><td width=\"40%\">".__("Confirm password")."</td>";
 
                                print "<td><input class=\"editbox\" type=\"password\"
+                                       onfocus=\"javascript:disableHotkeys();\" 
+                                       onblur=\"javascript:enableHotkeys();\"
                                        onkeypress=\"return filterCR(event, changeUserPassword)\"
                                        name=\"CONFIRM_PASSWORD\"></td></tr>";
 
                                        print_radio($pref_name, $value, __("Yes"), array(__("Yes"), __("No")));
                        
                                } else {
-                                       print "<input class=\"editbox\" name=\"$pref_name\" value=\"$value\">";
+                                       print "<input class=\"editbox\"
+                                               onfocus=\"javascript:disableHotkeys();\" 
+                                               onblur=\"javascript:enableHotkeys();\"  
+                                               name=\"$pref_name\" value=\"$value\">";
                                }
 
                                print "</td>";
index 308c7b7aa4199a04febe1092cea2c30cff05cdce..3e21ac62a8c526b78818d00621463baa8bbb47b4 100644 (file)
--- a/prefs.js
+++ b/prefs.js
@@ -316,6 +316,9 @@ function addLabel() {
 
        var query = Form.serialize("label_edit_form");
 
+       // we can be called from some other tab
+       active_tab = "labelConfig";
+
        xmlhttp.open("GET", "backend.php?op=pref-labels&subop=add&" + query, true);                     
        xmlhttp.onreadystatechange=infobox_submit_callback;
        xmlhttp.send(null);
@@ -404,6 +407,8 @@ function editLabel(id) {
                return
        }
 
+       disableHotkeys();
+
        notify_progress("Loading, please wait...");
 
        document.getElementById("label_create_btn").disabled = true;
@@ -427,6 +432,8 @@ function editUser(id) {
                return
        }
 
+       disableHotkeys();
+
        notify_progress("Loading, please wait...");
 
        selectTableRowsByIdPrefix('prefUserList', 'UMRR-', 'UMCHK-', false);
@@ -446,6 +453,8 @@ function editFilter(id) {
                return
        }
 
+       disableHotkeys();
+
        notify_progress("Loading, please wait...");
 
        document.getElementById("create_filter_btn").disabled = true;
@@ -467,6 +476,8 @@ function editFeed(feed) {
                return
        }
 
+       disableHotkeys();
+
        notify_progress("Loading, please wait...");
 
        document.getElementById("subscribe_to_feed_btn").disabled = true;
@@ -496,6 +507,8 @@ function editFeedCat(cat) {
                return
        }
 
+       disableHotkeys();
+
        notify_progress("Loading, please wait...");
 
        active_feed_cat = cat;
@@ -1293,15 +1306,21 @@ function selectTab(id, noupdate, subop) {
                                updateBigFeedBrowser();
                        }
                }
+
+               /* clean selection from all tabs */
        
-               var tab = document.getElementById(active_tab + "Tab");
-       
-               if (tab) {
-                       if (tab.className.match("Selected")) {
+               var tabs_holder = document.getElementById("prefTabs");
+               var tab = tabs_holder.firstChild;
+
+               while (tab) {
+                       if (tab.className && tab.className.match("prefsTabSelected")) {
                                tab.className = "prefsTab";
                        }
+                       tab = tab.nextSibling;
                }
-       
+
+               /* mark new tab as selected */
+
                tab = document.getElementById(id + "Tab");
        
                if (tab) {
@@ -1683,6 +1702,12 @@ function pref_hotkey_handler(e) {
 
                if (keycode == 16) return; // ignore lone shift
 
+               if ((keycode == 67 || keycode == 71) && !hotkey_prefix) {
+                       hotkey_prefix = keycode;
+                       debug("KP: PREFIX=" + keycode);
+                       return;
+               }
+
                if (Element.visible("hotkey_help_overlay")) {
                        Element.hide("hotkey_help_overlay");
                }
@@ -1718,7 +1743,38 @@ function pref_hotkey_handler(e) {
                                return;
                        }
 
-                       if (keycode == 49) { // 1
+               }
+
+               /* Prefix c */
+
+               if (hotkey_prefix == 67) { // c
+                       hotkey_prefix = false;
+
+                       if (keycode == 70) { // f
+                               return displayDlg("quickAddFilter");    
+                       }
+
+                       if (keycode == 83) { // s
+                               return displayDlg("quickAddFeed");      
+                       }
+
+                       if (keycode == 76) { // l
+                               return displayDlg("quickAddLabel");     
+                       }
+
+                       if (keycode == 85) { // u
+                               // no-op
+                       }
+
+               }
+
+               /* Prefix g */
+
+               if (hotkey_prefix == 71) { // g
+
+                       hotkey_prefix = false;
+
+                       if (keycode == 49 && document.getElementById("genConfigTab")) { // 1
                                selectTab("genConfig");
                        }