]> git.wh0rd.org - tt-rss.git/commitdiff
add select all/none functionality to several edit dialogs
authorAndrew Dolgov <fox@madoka.volgo-balt.ru>
Thu, 14 Jun 2012 17:04:14 +0000 (21:04 +0400)
committerAndrew Dolgov <fox@madoka.volgo-balt.ru>
Thu, 14 Jun 2012 17:04:14 +0000 (21:04 +0400)
classes/dlg.php
classes/pref_feeds.php
classes/pref_prefs.php
js/functions.js
tt-rss.css

index d39f691cb1d691a20f479d0714b4f7c05e0eafed..345e0c3ef715649b1fc936d9b0474cde481650e7 100644 (file)
@@ -80,12 +80,25 @@ class Dlg extends Protected_Handler {
        function editPrefProfiles() {
                print "<div dojoType=\"dijit.Toolbar\">";
 
+               print "<div dojoType=\"dijit.form.DropDownButton\">".
+                               "<span>" . __('Select')."</span>";
+               print "<div dojoType=\"dijit.Menu\" style=\"display: none;\">";
+               print "<div onclick=\"selectTableRows('prefFeedProfileList', 'all')\"
+                       dojoType=\"dijit.MenuItem\">".__('All')."</div>";
+               print "<div onclick=\"selectTableRows('prefFeedProfileList', 'none')\"
+                       dojoType=\"dijit.MenuItem\">".__('None')."</div>";
+               print "</div></div>";
+
+               print "<div style=\"float : right\">";
+
                print "<input name=\"newprofile\" dojoType=\"dijit.form.ValidationTextBox\"
                                required=\"1\">
                        <button dojoType=\"dijit.form.Button\"
                        onclick=\"dijit.byId('profileEditDlg').addProfile()\">".
                                __('Create profile')."</button></div>";
 
+               print "</div>";
+
                $result = db_query($this->link, "SELECT title,id FROM ttrss_settings_profiles
                        WHERE owner_uid = ".$_SESSION["uid"]." ORDER BY title");
 
@@ -96,9 +109,10 @@ class Dlg extends Protected_Handler {
                print "<table width=\"100%\" class=\"prefFeedProfileList\"
                        cellspacing=\"0\" id=\"prefFeedProfileList\">";
 
-               print "<tr class=\"\" id=\"FCATR-0\">"; #odd
+               print "<tr class=\"placeholder\" id=\"FCATR-0\">"; #odd
 
                print "<td width='5%' align='center'><input
+                       id='FCATC-0'
                        onclick='toggleSelectRow2(this);'
                        dojoType=\"dijit.form.CheckBox\"
                        type=\"checkbox\"></td>";
@@ -123,12 +137,13 @@ class Dlg extends Protected_Handler {
                        $profile_id = $line["id"];
                        $this_row_id = "id=\"FCATR-$profile_id\"";
 
-                       print "<tr class=\"\" $this_row_id>";
+                       print "<tr class=\"placeholder\" $this_row_id>";
 
                        $edit_title = htmlspecialchars($line["title"]);
 
                        print "<td width='5%' align='center'><input
                                onclick='toggleSelectRow2(this);'
+                               id='FCATC-$profile_id'
                                dojoType=\"dijit.form.CheckBox\"
                                type=\"checkbox\"></td>";
 
@@ -577,6 +592,17 @@ class Dlg extends Protected_Handler {
 
                print __("These feeds have not been updated with new content for 3 months (oldest first):");
 
+               print "<div dojoType=\"dijit.Toolbar\">";
+               print "<div dojoType=\"dijit.form.DropDownButton\">".
+                               "<span>" . __('Select')."</span>";
+               print "<div dojoType=\"dijit.Menu\" style=\"display: none;\">";
+               print "<div onclick=\"selectTableRows('prefInactiveFeedList', 'all')\"
+                       dojoType=\"dijit.MenuItem\">".__('All')."</div>";
+               print "<div onclick=\"selectTableRows('prefInactiveFeedList', 'none')\"
+                       dojoType=\"dijit.MenuItem\">".__('None')."</div>";
+               print "</div></div>";
+               print "</div>"; #toolbar
+
                print "<div class=\"inactiveFeedHolder\">";
 
                print "<table width=\"100%\" cellspacing=\"0\" id=\"prefInactiveFeedList\">";
@@ -589,13 +615,15 @@ class Dlg extends Protected_Handler {
                        $feed_id = $line["id"];
                        $this_row_id = "id=\"FUPDD-$feed_id\"";
 
-                       print "<tr class=\"\" $this_row_id>";
+                       # class needed for selectTableRows()
+                       print "<tr class=\"placeholder\" $this_row_id>";
 
                        $edit_title = htmlspecialchars($line["title"]);
 
+                       # id needed for selectTableRows()
                        print "<td width='5%' align='center'><input
                                onclick='toggleSelectRow2(this);' dojoType=\"dijit.form.CheckBox\"
-                               type=\"checkbox\"></td>";
+                               type=\"checkbox\" id=\"FUPDC-$feed_id\"></td>";
                        print "<td>";
 
                        print "<a class=\"visibleLink\" href=\"#\" ".
@@ -633,6 +661,17 @@ class Dlg extends Protected_Handler {
                $result = db_query($this->link, "SELECT id,title,feed_url,last_error,site_url
                FROM ttrss_feeds WHERE last_error != '' AND owner_uid = ".$_SESSION["uid"]);
 
+               print "<div dojoType=\"dijit.Toolbar\">";
+               print "<div dojoType=\"dijit.form.DropDownButton\">".
+                               "<span>" . __('Select')."</span>";
+               print "<div dojoType=\"dijit.Menu\" style=\"display: none;\">";
+               print "<div onclick=\"selectTableRows('prefErrorFeedList', 'all')\"
+                       dojoType=\"dijit.MenuItem\">".__('All')."</div>";
+               print "<div onclick=\"selectTableRows('prefErrorFeedList', 'none')\"
+                       dojoType=\"dijit.MenuItem\">".__('None')."</div>";
+               print "</div></div>";
+               print "</div>"; #toolbar
+
                print "<div class=\"inactiveFeedHolder\">";
 
                print "<table width=\"100%\" cellspacing=\"0\" id=\"prefErrorFeedList\">";
@@ -645,13 +684,15 @@ class Dlg extends Protected_Handler {
                        $feed_id = $line["id"];
                        $this_row_id = "id=\"FUPDD-$feed_id\"";
 
-                       print "<tr class=\"\" $this_row_id>";
+                       # class needed for selectTableRows()
+                       print "<tr class=\"placeholder\" $this_row_id>";
 
                        $edit_title = htmlspecialchars($line["title"]);
 
+                       # id needed for selectTableRows()
                        print "<td width='5%' align='center'><input
                                onclick='toggleSelectRow2(this);' dojoType=\"dijit.form.CheckBox\"
-                               type=\"checkbox\"></td>";
+                               type=\"checkbox\" id=\"FUPDC-$feed_id\"></td>";
                        print "<td>";
 
                        print "<a class=\"visibleLink\" href=\"#\" ".
index 61eeb598b439810ad9c0a840a7f8a9d59bd7cda0..257c1f9c38a9cabf9d32361116dc0f844bbfc122 100644 (file)
@@ -1171,11 +1171,25 @@ class Pref_Feeds extends Protected_Handler {
                        }
                }
 
-               print "<div dojoType=\"dijit.Toolbar\">
-                       <input dojoType=\"dijit.form.ValidationTextBox\" required=\"1\" name=\"newcat\">
+               print "<div dojoType=\"dijit.Toolbar\">";
+
+               print "<div dojoType=\"dijit.form.DropDownButton\">".
+                               "<span>" . __('Select')."</span>";
+               print "<div dojoType=\"dijit.Menu\" style=\"display: none;\">";
+               print "<div onclick=\"selectTableRows('prefFeedCatList', 'all')\"
+                       dojoType=\"dijit.MenuItem\">".__('All')."</div>";
+               print "<div onclick=\"selectTableRows('prefFeedCatList', 'none')\"
+                       dojoType=\"dijit.MenuItem\">".__('None')."</div>";
+               print "</div></div>";
+
+               print "<div style='float : right'>";
+
+               print "<input dojoType=\"dijit.form.ValidationTextBox\" required=\"1\" name=\"newcat\">
                                <button dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('feedCatEditDlg').addCategory()\">".
                                        __('Create category')."</button></div>";
 
+               print "</div>";
+
                $result = db_query($this->link, "SELECT title,id FROM ttrss_feed_categories
                        WHERE owner_uid = ".$_SESSION["uid"]."
                        ORDER BY title");
@@ -1196,11 +1210,11 @@ class Pref_Feeds extends Protected_Handler {
                                $cat_id = $line["id"];
                                $this_row_id = "id=\"FCATR-$cat_id\"";
 
-                               print "<tr class=\"\" $this_row_id>";
+                               print "<tr class=\"placeholder\" $this_row_id>";
 
                                $edit_title = htmlspecialchars($line["title"]);
 
-                               print "<td width='5%' align='center'><input
+                               print "<td width='5%' align='center'><input id=\"FCATC-$cat_id\"
                                        onclick='toggleSelectRow2(this);' dojoType=\"dijit.form.CheckBox\"
                                        type=\"checkbox\"></td>";
 
index 6bc428b04566157f8aed1a870b148f38163a624d..4801399e2e925e293b9cd80bc757ac1a96117876 100644 (file)
@@ -313,7 +313,7 @@ class Pref_Prefs extends Protected_Handler {
                        $profile_qpart = "profile IS NULL";
                }
 
-               $result = db_query($this->link, "SELECT
+               $result = db_query($this->link, "SELECT DISTINCT
                        ttrss_user_prefs.pref_name,short_desc,help_text,value,type_name,
                        section_name,def_value,section_id
                        FROM ttrss_prefs,ttrss_prefs_types,ttrss_prefs_sections,ttrss_user_prefs
index 6d2a5829427918c4135b8bdfb891144cf66d6c37..0b0b475c6710bb4d8d4ae16f5f0343e92cf5404f 100644 (file)
@@ -1340,6 +1340,7 @@ function selectTableRows(id, mode) {
                for (var i = 0; i < rows.length; i++) {
                        var row = rows[i];
                        var cb = false;
+                       var dcb = false;
 
                        if (row.id && row.className) {
                                var bare_id = row.id.replace(/^[A-Z]*?-/, "");
@@ -1352,27 +1353,33 @@ function selectTableRows(id, mode) {
                                                        input.id.match(bare_id)) {
 
                                                cb = input;
+                                               dcb = dijit.getEnclosingWidget(cb);
                                                break;
                                        }
                                }
 
-                               if (cb) {
+                               if (cb || dcb) {
                                        var issel = row.hasClassName("Selected");
 
                                        if (mode == "all" && !issel) {
                                                row.addClassName("Selected");
                                                cb.checked = true;
+                                               if (dcb) dcb.set("checked", true);
                                        } else if (mode == "none" && issel) {
                                                row.removeClassName("Selected");
                                                cb.checked = false;
+                                               if (dcb) dcb.set("checked", false);
+
                                        } else if (mode == "invert") {
 
                                                if (issel) {
                                                        row.removeClassName("Selected");
                                                        cb.checked = false;
+                                                       if (dcb) dcb.set("checked", false);
                                                } else {
                                                        row.addClassName("Selected");
                                                        cb.checked = true;
+                                                       if (dcb) dcb.set("checked", true);
                                                }
                                        }
                                }
index 7a0ef8bbbdccbda234a42be80c4e2dda2860d329..f87ef7cfe9d27d313ea6db0c1bdb6ca633de424f 100644 (file)
@@ -377,7 +377,7 @@ div.prefFeedCatHolder, div.prefFeedOPMLHolder, div.inactiveFeedHolder {
        background-color : #ecf4ff;
 }
 
-div.prefFeedOPMLHolder, div.inactiveFeedHolder {
+div.prefFeedOPMLHolder {
        border-width : 1px 1px 1px 1px;
 }