]> git.wh0rd.org Git - tt-rss.git/commitdiff
disable pref toolbars when nothing is selected (take two)
authorAndrew Dolgov <fox@bah.spb.su>
Thu, 18 May 2006 12:09:53 +0000 (13:09 +0100)
committerAndrew Dolgov <fox@bah.spb.su>
Thu, 18 May 2006 12:09:53 +0000 (13:09 +0100)
backend.php
prefs.js

index 4b174e858218004a3362a74bb52171694bff0f3f..766fe218f71f24fee7f4e4a85d7bb9b4847aef84 100644 (file)
 
                $login = db_fetch_result($result, 0, "login");
 
-               print "<h1>$login</h1>";
+#              print "<h1>$login</h1>";
 
                print "<table width='100%'>";
 
                $stored_articles = db_fetch_result($result, 0, "stored_articles");
 
 #              print "<tr><td>Username</td><td>$login</td></tr>";
-               print "<tr><td>Access level</td><td>$access_level</td></tr>";
+#              print "<tr><td>Access level</td><td>$access_level</td></tr>";
                print "<tr><td>Last logged in</td><td>$last_login</td></tr>";
                print "<tr><td>Stored articles</td><td>$stored_articles</td></tr>";
 
                                onclick=\"updateBigFeedBrowser()\" value=\"Show\">
                </div>";
 
-               print "<p>Selection: 
+               print "<p id=\"fbrOpToolbar\">Selection: 
                        <input type='submit' class='button' onclick=\"feedBrowserSubscribe()\" 
-                       value=\"Subscribe\">";
+                       disabled=\"true\" value=\"Subscribe\">";
 
                print "<ul class='nomarks' id='browseBigFeedList'>";
 
                                $feed_icon = "<img class=\"tinyFeedIcon\" src=\"images/blank_icon.gif\">";
                        }
 
-                       $check_box = "<input onclick='toggleSelectListRow(this)' class='feedBrowseCB' 
+                       $check_box = "<input onclick='toggleSelectFBListRow(this)' class='feedBrowseCB' 
                                type=\"checkbox\" id=\"FBCHK-" . $details["id"] . "\">";
 
                        $class = ($feedctr % 2) ? "even" : "odd";
index fc3d6eb05134c12dd294b2195e69d083c85e04b2..b10e257cb33f05d4967755ad3c1a7a32d3559e72 100644 (file)
--- a/prefs.js
+++ b/prefs.js
@@ -462,6 +462,29 @@ function getSelectedFeedCats() {
        return getSelectedTableRowIds("prefFeedCatList", "FCATR");
 }
 
+function getSelectedFeedsFromBrowser() {
+
+       var list = document.getElementById("browseFeedList");
+       if (!list) list = document.getElementById("browseBigFeedList");
+
+       var selected = new Array();
+       
+       for (i = 0; i < list.childNodes.length; i++) {
+               var child = list.childNodes[i];
+               if (child.id && child.id.match("FBROW-")) {
+                       var id = child.id.replace("FBROW-", "");
+                       
+                       var cb = document.getElementById("FBCHK-" + id);
+
+                       if (cb.checked) {
+                               selected.push(id);
+                       }
+               }
+       }
+
+       return selected;
+}
+
 
 /*function readSelectedFeeds(read) {
 
@@ -585,7 +608,7 @@ function removeSelectedFeeds() {
 
        if (sel_rows.length > 0) {
 
-               var ok = confirm("Remove selected feeds?");
+               var ok = confirm("Unsubscribe from selected feeds?");
 
                if (ok) {
 
@@ -1376,24 +1399,8 @@ function browseFeeds(limit) {
 
 function feedBrowserSubscribe() {
        try {
-               var list = document.getElementById("browseFeedList");
-
-               if (!list) list = document.getElementById("browseBigFeedList");
-
-               var selected = new Array();
 
-               for (i = 0; i < list.childNodes.length; i++) {
-                       var child = list.childNodes[i];
-                       if (child.id && child.id.match("FBROW-")) {
-                               var id = child.id.replace("FBROW-", "");
-                               
-                               var cb = document.getElementById("FBCHK-" + id);
-
-                               if (cb.checked) {
-                                       selected.push(id);
-                               }
-                       }
-               }
+               var selected = getSelectedFeedsFromBrowser();
 
                if (selected.length > 0) {
                        closeInfoBox();
@@ -1548,4 +1555,7 @@ function toggleSelectPrefRow(sender, kind) {
        } 
 }
 
-
+function toggleSelectFBListRow(sender) {
+       toggleSelectListRow(sender);
+       disableContainerChildren("fbrOpToolbar", getSelectedFeedsFromBrowser() == 0);
+}