From ce3bf4089f536dede0778ff5283578571b840c0d Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Thu, 18 May 2006 13:01:09 +0100 Subject: [PATCH] disable pref toolbars when nothing is selected --- backend.php | 167 +++++++++++++++++++++------------------------------ functions.js | 58 ++++++++++++------ prefs.js | 90 +++++++++++++++++++++++++-- tt-rss.css | 30 +++++---- 4 files changed, 211 insertions(+), 134 deletions(-) diff --git a/backend.php b/backend.php index 66d52ae9e..4b174e858 100644 --- a/backend.php +++ b/backend.php @@ -1888,10 +1888,8 @@ class=\"prefFeedList\" id=\"prefFeedList\">"; print " Select: - All, - None + All, + None "; if (!get_pref($link, 'ENABLE_FEED_CATS')) { @@ -1958,7 +1956,7 @@ $feed_icon = ""; } - print ""; if (get_pref($link, 'ENABLE_FEED_ICONS')) { @@ -1980,17 +1978,6 @@ print "" . $edit_link . ""; -/* if (get_pref($link, 'ENABLE_FEED_CATS')) { - print "" . - $edit_cat . ""; - } */ - -/* print "" . - $update_intervals[$line["update_interval"]] . ""; - - print "" . - $purge_intervals[$line["purge_interval"]] . ""; */ - print "" . "$last_updated"; @@ -2001,7 +1988,7 @@ print ""; - print "

"; + print "

"; if ($subop == "edit") { print "Edit feed:  @@ -2013,11 +2000,9 @@ print " Selection:  - - - "; if (get_pref($link, 'ENABLE_FEED_CATS')) { @@ -2028,7 +2013,7 @@ WHERE owner_uid = ".$_SESSION["uid"]." ORDER BY title"); - print ""; print ""; if (db_num_rows($result) != 0) { @@ -2043,12 +2028,12 @@ print ""; - print " "; } - print " + print "  All feeds: "; @@ -2068,9 +2053,10 @@ print "

 
"; $result = db_query($link, "SELECT title,id FROM ttrss_feed_categories @@ -2084,10 +2070,8 @@ print " Select: - All, - None + All, + None "; print " @@ -2117,8 +2101,8 @@ if (!$edit_cat_id || $subop != "editCat") { - print ""; + print ""; print "" . $edit_title . ""; @@ -2145,21 +2129,21 @@ print ""; - print "

"; + print "

"; if ($subop == "editCat") { print "Edit category:  - - "; } else { print " Selection:  - - "; } @@ -2332,10 +2316,8 @@ print " Select: - All, - None + All, + None "; print " @@ -2369,7 +2351,7 @@ if (!$edit_filter_id || $subop != "edit") { - print ""; print "" . @@ -2462,7 +2444,7 @@ print ""; - print "

"; + print "

"; if ($subop == "edit") { print "Edit filter: @@ -2475,9 +2457,9 @@ print " Selection: - - "; } @@ -2620,10 +2602,8 @@ print " Select: - All, - None + All, + None "; print " @@ -2658,7 +2638,7 @@ if (!$line["description"]) $line["description"] = "[No caption]"; - print ""; print "" . @@ -2685,8 +2665,7 @@ "\">"; print ""; - + "\">"; } @@ -2701,7 +2680,7 @@ print ""; - print "

"; + print "

"; if ($subop == "edit") { print "Edit label: @@ -2712,13 +2691,12 @@ "; - } else { - + } else { print " Selection: - - "; } } else { @@ -3394,28 +3372,37 @@ $tmp_user_pwd = make_password(8); $pwd_hash = 'SHA1:' . sha1($tmp_user_pwd); - db_query($link, "INSERT INTO ttrss_users - (login,pwd_hash,access_level,last_login) - VALUES ('$login', '$pwd_hash', 0, NOW())"); - - $result = db_query($link, "SELECT id FROM ttrss_users WHERE - login = '$login' AND pwd_hash = '$pwd_hash'"); + login = '$login'"); - if (db_num_rows($result) == 1) { - - $new_uid = db_fetch_result($result, 0, "id"); - - print "

Added user ".$_GET["login"]. - " with password $tmp_user_pwd.
"; - - initialize_user($link, $new_uid); + if (db_num_rows($result) == 0) { + db_query($link, "INSERT INTO ttrss_users + (login,pwd_hash,access_level,last_login) + VALUES ('$login', '$pwd_hash', 0, NOW())"); + + + $result = db_query($link, "SELECT id FROM ttrss_users WHERE + login = '$login' AND pwd_hash = '$pwd_hash'"); + + if (db_num_rows($result) == 1) { + + $new_uid = db_fetch_result($result, 0, "id"); + + print "
Added user ".$_GET["login"]. + " with password $tmp_user_pwd.
"; + + initialize_user($link, $new_uid); + + } else { + + print "
Could not create user ". + $_GET["login"]."
"; + + } } else { - - print "
Error while adding user ". - $_GET["login"].".
"; - + print "
User ". + $_GET["login"]." already exists.
"; } } } else if ($subop == "resetPass") { @@ -3481,10 +3468,8 @@ print " Select: -
All, - None + All, + None "; print " @@ -3519,18 +3504,9 @@ $access_level_names = array(0 => "User", 10 => "Administrator"); -/* if ($uid == $_SESSION["uid"]) { + if (!$edit_uid || $subop != "edit") { - print ""; - - print "".$line["login"].""; - print "".$line["email"].""; - print "".$line["access_level"].""; - - } else */ if (!$edit_uid || $subop != "edit") { - - print ""; print "" . @@ -3566,9 +3542,6 @@ print ""; -// print ""; - print ""; print " - - - "; } diff --git a/functions.js b/functions.js index 6b064b2f0..bcbc93b36 100644 --- a/functions.js +++ b/functions.js @@ -28,7 +28,6 @@ function xmlhttp_ready(obj) { return obj.readyState == 4 || obj.readyState == 0 || !obj.readyState; } - function notify_callback() { var container = document.getElementById('notify'); if (xmlhttp.readyState == 4) { @@ -73,10 +72,31 @@ function delay(gap) { } } -function p_notify(msg) { +var notify_hide_timerid = false; +var notify_last_doc = false; - var n = parent.document.getElementById("notify"); - var nb = parent.document.getElementById("notify_body"); +function hide_notify() { + if (notify_last_doc) { + var n = notify_last_doc.getElementById("notify"); + if (navigator.userAgent.match("Firefox")) { + if (notify_opacity >= 0) { + notify_opacity = notify_opacity - 0.2; + n.style.opacity = notify_opacity; + notify_hide_timerid = window.setTimeout(hide_notify, 20); + } else { + n.style.display = "none"; + n.style.opacity = 1; + } + } else { + n.style.display = "none"; + } + } +} + +function notify_real(msg, doc) { + + var n = doc.getElementById("notify"); + var nb = doc.getElementById("notify_body"); if (!n || !nb) return; @@ -85,25 +105,25 @@ function p_notify(msg) { } else { n.style.display = "block"; } - + nb.innerHTML = msg; + + if (notify_hide_timerid) { + window.clearTimeout(notify_hide_timerid); + } + + notify_last_doc = doc; + notify_opacity = 1; + + notify_hide_timerid = window.setTimeout(hide_notify, 3000); +} + +function p_notify(msg) { + notify_real(msg, parent.document); } function notify(msg) { - - var n = document.getElementById("notify"); - var nb = document.getElementById("notify_body"); - - if (!n || !nb) return; - - if (msg == "") { - n.style.display = "none"; - } else { - n.style.display = "block"; - } - - nb.innerHTML = msg; - + notify_real(msg, document); } function printLockingError() { diff --git a/prefs.js b/prefs.js index 8622526dd..fc3d6eb05 100644 --- a/prefs.js +++ b/prefs.js @@ -182,7 +182,7 @@ function updateFeedList(sort_key) { // document.getElementById("prefContent").innerHTML = "Loading feeds, please wait..."; - p_notify("Loading, please wait..."); +// p_notify("Loading, please wait..."); var feed_search = document.getElementById("feed_search"); var search = ""; @@ -205,7 +205,7 @@ function updateUsersList() { // document.getElementById("prefContent").innerHTML = "Loading feeds, please wait..."; - p_notify("Loading, please wait..."); +// p_notify("Loading, please wait..."); xmlhttp.open("GET", "backend.php?op=pref-users", true); xmlhttp.onreadystatechange=userlist_callback; @@ -1220,7 +1220,7 @@ function updateFilterList() { // document.getElementById("prefContent").innerHTML = "Loading filters, please wait..."; - p_notify("Loading, please wait..."); +// p_notify("Loading, please wait..."); xmlhttp.open("GET", "backend.php?op=pref-filters", true); xmlhttp.onreadystatechange=filterlist_callback; @@ -1235,7 +1235,7 @@ function updateLabelList() { return } - p_notify("Loading, please wait..."); +// p_notify("Loading, please wait..."); // document.getElementById("prefContent").innerHTML = "Loading labels, please wait..."; @@ -1251,7 +1251,7 @@ function updatePrefsList() { return } - p_notify("Loading, please wait..."); +// p_notify("Loading, please wait..."); xmlhttp.open("GET", "backend.php?op=pref-prefs", true); xmlhttp.onreadystatechange=prefslist_callback; @@ -1417,7 +1417,7 @@ function updateBigFeedBrowser(limit) { return } - p_notify("Loading, please wait..."); +// p_notify("Loading, please wait..."); var query = "backend.php?op=pref-feed-browser"; @@ -1471,3 +1471,81 @@ function validateNewPassword(form) { } return true; } + +function selectPrefRows(kind, select) { + + if (kind) { + var opbarid = false; + var nchk = false; + var nrow = false; + var lname = false; + + if (kind == "feed") { + opbarid = "feedOpToolbar"; + nrow = "FEEDR-"; + nchk = "FRCHK-"; + lname = "prefFeedList"; + } else if (kind == "fcat") { + opbarid = "catOpToolbar"; + nrow = "FCATR-"; + nchk = "FCHK-"; + lname = "prefFeedCatList"; + } else if (kind == "filter") { + opbarid = "filterOpToolbar"; + nrow = "FILRR-"; + nchk = "FICHK-"; + lname = "prefFilterList"; + } else if (kind == "label") { + opbarid = "labelOpToolbar"; + nrow = "LILRR-"; + nchk = "LCHK-"; + lname = "prefLabelList"; + } else if (kind == "user") { + opbarid = "userOpToolbar"; + nrow = "UMRR-"; + nchk = "UMCHK-"; + lname = "prefUserList"; + } + + if (opbarid) { + selectTableRowsByIdPrefix(lname, nrow, nchk, select); + disableContainerChildren(opbarid, !select); + } + + } +} + + +function toggleSelectPrefRow(sender, kind) { + + toggleSelectRow(sender); + + if (kind) { + var opbarid = false; + var nsel = -1; + + if (kind == "feed") { + opbarid = "feedOpToolbar"; + nsel = getSelectedFeeds(); + } else if (kind == "fcat") { + opbarid = "catOpToolbar"; + nsel = getSelectedFeedCats(); + } else if (kind == "filter") { + opbarid = "filterOpToolbar"; + nsel = getSelectedFilters(); + } else if (kind == "label") { + opbarid = "labelOpToolbar"; + nsel = getSelectedLabels(); + } else if (kind == "user") { + opbarid = "userOpToolbar"; + nsel = getSelectedUsers(); + } + + if (opbarid && nsel != -1) { + disableContainerChildren(opbarid, nsel == false); + } + + } +} + + diff --git a/tt-rss.css b/tt-rss.css index b1b2a23a8..09678ec42 100644 --- a/tt-rss.css +++ b/tt-rss.css @@ -299,13 +299,16 @@ td.notifyBox { background : #fff7d5; border : 1px solid #d7c47a; padding : 3px; - top : 2px; - right : 2px; - float : right; + top : 25px; + right : 150px; + min-width : 300px; position : absolute; -moz-border-radius : 3px; font-size : x-small; font-weight : bold; + text-align : center; + float : right; + padding : 3px 20px 3px 20px; } #dispSwitch { @@ -522,23 +525,26 @@ div.helpResponse { #infoBoxTitle { border-width : 1px 1px 1px 1px; - border-style : solid; - border-color : #88b0f0; - background-color : #88b0f0; - padding : 2px; - color : white; + border-style : solid; + border-color : #88b0f0; + background-color : #88b0f0; + padding : 2px; + color : white; } #infoBox { border-width : 1px 1px 1px 1px; - border-style : solid; - border-color : #88b0f0; + border-style : solid; + border-color : #88b0f0; font-size : small; position : relative; bottom : 2px; right : 2px; - background-color : #ecf4ff; - padding-bottom : 5px; + padding-bottom : 5px; + background-image : url("images/prefs-content.png"); + background-position : top left; + background-repeat : repeat-x; + background-color : white; } #infoBoxShadow {