]> git.wh0rd.org Git - tt-rss.git/commitdiff
select all/none prompt for pref tables + related API
authorAndrew Dolgov <fox@bah.spb.su>
Fri, 25 Nov 2005 15:14:45 +0000 (16:14 +0100)
committerAndrew Dolgov <fox@bah.spb.su>
Fri, 25 Nov 2005 15:14:45 +0000 (16:14 +0100)
backend.php
functions.js
tt-rss.css

index a831028aa87b2220bc69735e8c6f820a43870483..aa0c271a149805abf31741c99be0fd51927f01be 100644 (file)
                if (db_num_rows($result) != 0) {
 
                        print "<div id=\"infoBoxShadow\"><div id=\"infoBox\">PLACEHOLDER</div></div>";
-       
+
                        print "<p><table width=\"100%\" class=\"prefFeedList\" id=\"prefFeedList\">";
+                       print "<tr><td class=\"selectPrompt\" colspan=\"8\">
+                               Select: 
+                                       <a href=\"javascript:selectTableRowsByIdPrefix('prefFeedList', 
+                                               'FEEDR-', true)\">All</a>,
+                                       <a href=\"javascript:selectTableRowsByIdPrefix('prefFeedList', 
+                                               'FEEDR-', false)\">None</a>
+                               </td</tr>";
+
                        print "<tr class=\"title\">
                                                <td width=\"3%\">&nbsp;</td>
                                                <td width=\"3%\">Select</td>
 
                        if (db_num_rows($result) != 0) {
        
-                               print "<p><table width=\"100%\" class=\"prefFeedCatList\" id=\"prefFeedCatList\">";
+                               print "<p><table width=\"100%\" class=\"prefFeedCatList\" 
+                                       id=\"prefFeedCatList\">";
+
+                               print "<tr><td class=\"selectPrompt\" colspan=\"8\">
+                               Select: 
+                                       <a href=\"javascript:selectTableRowsByIdPrefix('prefFeedCatList', 
+                                               'FCATR-', true)\">All</a>,
+                                       <a href=\"javascript:selectTableRowsByIdPrefix('prefFeedCatList', 
+                                               'FCATR-', false)\">None</a>
+                               </td</tr>";
+
                                print "<tr class=\"title\">
                                                        <td width=\"10%\">Select</td><td width=\"80%\">Title</td>
                                                </tr>";
                if (db_num_rows($result) != 0) {
 
                        print "<p><table width=\"100%\" class=\"prefFilterList\" id=\"prefFilterList\">";
-       
+
+                       print "<tr><td class=\"selectPrompt\" colspan=\"8\">
+                               Select: 
+                                       <a href=\"javascript:selectTableRowsByIdPrefix('prefFilterList', 
+                                               'FILRR-', true)\">All</a>,
+                                       <a href=\"javascript:selectTableRowsByIdPrefix('prefFilterList', 
+                                               'FILRR-', false)\">None</a>
+                               </td</tr>";
+
                        print "<tr class=\"title\">
                                                <td width=\"5%\">Select</td><td width=\"30%\">Filter expression</td>
                                                <td width=\"30%\">Feed</td><td width=\"10%\">Match</td>
                if (db_num_rows($result) != 0) {
 
                        print "<p><table width=\"100%\" class=\"prefLabelList\" id=\"prefLabelList\">";
-       
+
+                       print "<tr><td class=\"selectPrompt\" colspan=\"8\">
+                               Select: 
+                                       <a href=\"javascript:selectTableRowsByIdPrefix('prefLabelList', 
+                                               'LILRR-', true)\">All</a>,
+                                       <a href=\"javascript:selectTableRowsByIdPrefix('prefLabelList', 
+                                               'LILRR-', false)\">None</a>
+                               </td</tr>";
+
                        print "<tr class=\"title\">
                                                <td width=\"5%\">Select</td><td width=\"40%\">SQL expression
                                                <a class=\"helpLink\" href=\"javascript:popupHelp(1)\">(?)</a>
 
                print "<p><table width=\"100%\" class=\"prefUserList\" id=\"prefUserList\">";
 
+               print "<tr><td class=\"selectPrompt\" colspan=\"8\">
+                               Select: 
+                                       <a href=\"javascript:selectTableRowsByIdPrefix('prefUserList', 
+                                               'UMRR-', true)\">All</a>,
+                                       <a href=\"javascript:selectTableRowsByIdPrefix('prefUserList', 
+                                               'UMRR-', false)\">None</a>
+                               </td</tr>";
+
                print "<tr class=\"title\">
                                        <td width=\"5%\">Select</td>
                                        <td width='30%'>Username</td>
index fcf22b73b2d61a46a270d829de16199ba79e76a0..c03e623f26d920e7353e706cc2c7bb31eb356fb9 100644 (file)
@@ -199,7 +199,21 @@ function getLastVisibleHeadlineId() {
 function markHeadline(id) {
        var row = document.getElementById("RROW-" + id);
        if (row) {
-               row.className = row.className + "Selected";
+               var is_active = false;
+       
+               if (row.className.match("Active")) {
+                       is_active = true;
+               }
+               row.className = row.className.replace("Selected", "");
+               row.className = row.className.replace("Active", "");
+               row.className = row.className.replace("Insensitive", "");
+               
+               if (is_active) {
+                       row.className = row.className = "Active";
+               }
+               
+               row.className = row.className + "Selected"; 
+               
        }
 }
 
@@ -427,7 +441,30 @@ function hideOrShowFeeds(doc, hide) {
 
 function fatalError(code) {
        window.location = "error.php?c=" + param_escape(code);
+}
+
+function selectTableRow(r, do_select) {
+       r.className = r.className.replace("Selected", "");
+       
+       if (do_select) {
+               r.className = r.className + "Selected";
+       }
+}
+
+function selectTableRowsByIdPrefix(content_id, prefix, do_select) {
 
+       var content = document.getElementById(content_id);
+
+       if (!content) {
+               alert("[selectTableRows] Element " + content_id + " not found.");
+               return;
+       }
+
+       for (i = 0; i < content.rows.length; i++) {
+               if (content.rows[i].id.match(prefix)) {
+                       selectTableRow(content.rows[i], do_select);
+               }
+       }
 }
 
 function getSelectedTableRowIds(content_id, prefix) {
index 6c9735c4c316a8214b15bdb56b4db74acf650d71..d32a390882d78c7a194e2d00095abc870ecf68ea 100644 (file)
@@ -666,3 +666,8 @@ table.innerFeedTable td {
        margin : 0px;
        padding : 0px;
 }
+
+td.selectPrompt {
+       font-size : x-small;
+       color : gray;
+}