From ddb575c744e2740611fd51d11492a5bdc6265caf Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Thu, 14 Jun 2012 21:04:14 +0400 Subject: [PATCH] add select all/none functionality to several edit dialogs --- classes/dlg.php | 53 +++++++++++++++++++++++++++++++++++++----- classes/pref_feeds.php | 22 ++++++++++++++---- classes/pref_prefs.php | 2 +- js/functions.js | 9 ++++++- tt-rss.css | 2 +- 5 files changed, 75 insertions(+), 13 deletions(-) diff --git a/classes/dlg.php b/classes/dlg.php index d39f691cb..345e0c3ef 100644 --- a/classes/dlg.php +++ b/classes/dlg.php @@ -80,12 +80,25 @@ class Dlg extends Protected_Handler { function editPrefProfiles() { print "
"; + print "
". + "" . __('Select').""; + print "
"; + print "
".__('All')."
"; + print "
".__('None')."
"; + print "
"; + + print "
"; + print "
"; + print "
"; + $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 ""; - print ""; #odd + print ""; #odd print ""; @@ -123,12 +137,13 @@ class Dlg extends Protected_Handler { $profile_id = $line["id"]; $this_row_id = "id=\"FCATR-$profile_id\""; - print ""; + print ""; $edit_title = htmlspecialchars($line["title"]); print ""; @@ -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 "
"; + print "
". + "" . __('Select').""; + print "
"; + print "
".__('All')."
"; + print "
".__('None')."
"; + print "
"; + print "
"; #toolbar + print "
"; print "
"; @@ -589,13 +615,15 @@ class Dlg extends Protected_Handler { $feed_id = $line["id"]; $this_row_id = "id=\"FUPDD-$feed_id\""; - print ""; + # class needed for selectTableRows() + print ""; $edit_title = htmlspecialchars($line["title"]); + # id needed for selectTableRows() print ""; + type=\"checkbox\" id=\"FUPDC-$feed_id\">"; print "
"; print "link, "SELECT id,title,feed_url,last_error,site_url FROM ttrss_feeds WHERE last_error != '' AND owner_uid = ".$_SESSION["uid"]); + print "
"; + print "
". + "" . __('Select').""; + print "
"; + print "
".__('All')."
"; + print "
".__('None')."
"; + print "
"; + print "
"; #toolbar + print "
"; print ""; @@ -645,13 +684,15 @@ class Dlg extends Protected_Handler { $feed_id = $line["id"]; $this_row_id = "id=\"FUPDD-$feed_id\""; - print ""; + # class needed for selectTableRows() + print ""; $edit_title = htmlspecialchars($line["title"]); + # id needed for selectTableRows() print ""; + type=\"checkbox\" id=\"FUPDC-$feed_id\">"; print ""; + print ""; $edit_title = htmlspecialchars($line["title"]); - print ""; diff --git a/classes/pref_prefs.php b/classes/pref_prefs.php index 6bc428b04..4801399e2 100644 --- a/classes/pref_prefs.php +++ b/classes/pref_prefs.php @@ -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 diff --git a/js/functions.js b/js/functions.js index 6d2a58294..0b0b475c6 100644 --- a/js/functions.js +++ b/js/functions.js @@ -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); } } } diff --git a/tt-rss.css b/tt-rss.css index 7a0ef8bbb..f87ef7cfe 100644 --- a/tt-rss.css +++ b/tt-rss.css @@ -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; }
"; print " - + print "
"; + + print "
". + "" . __('Select').""; + print "
"; + print "
".__('All')."
"; + print "
".__('None')."
"; + print "
"; + + print "
"; + + print "
"; + print "
"; + $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 "