From 42c329162265a17e9f8f2444de2d061fb3cfb4a5 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Fri, 2 Mar 2007 20:58:58 +0100 Subject: [PATCH] UI improvements --- backend.php | 2 +- feedlist.js | 2 +- functions.js | 89 +++++++++++++++++++------------------ images/indicator_white.gif | Bin 1542 -> 2611 bytes prefs.js | 43 +++++++++--------- tt-rss.css | 20 ++++++++- tt-rss.js | 16 +++---- viewfeed.js | 2 +- 8 files changed, 95 insertions(+), 79 deletions(-) diff --git a/backend.php b/backend.php index b1ddcd5af..1a53d1c68 100644 --- a/backend.php +++ b/backend.php @@ -54,7 +54,7 @@ header("Content-Type: application/xml"); print_error_xml(7); exit; } - + if (!($_SESSION["uid"] && validate_session($link)) && $op != "globalUpdateFeeds" && $op != "rss" && $op != "getUnread") { diff --git a/feedlist.js b/feedlist.js index 1bbb178bd..79a39f347 100644 --- a/feedlist.js +++ b/feedlist.js @@ -135,7 +135,7 @@ function viewfeed(feed, subop, is_cat, subop_param, skip_history, offset) { container.innerHTML = "
 " + "Loading, please wait...
"; */ - notify("Loading, please wait...", true); + notify_progress("Loading, please wait...", true); // xmlhttp.abort(); diff --git a/functions.js b/functions.js index da12a3c36..39b77d6a0 100644 --- a/functions.js +++ b/functions.js @@ -103,34 +103,18 @@ function delay(gap) { } var notify_hide_timerid = false; -var notify_last_doc = false; - -var notify_effect = false; function hide_notify() { - if (notify_last_doc) { - var n = notify_last_doc.getElementById("notify"); + var n = document.getElementById("notify"); + if (n) { n.style.display = "none"; - -/* if (browser_has_opacity()) { - if (notify_opacity >= 0) { - notify_opacity = notify_opacity - 0.1; - 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, no_hide, is_err) { +function notify_real(msg, no_hide, n_type) { - var n = doc.getElementById("notify"); - var nb = doc.getElementById("notify_body"); + var n = document.getElementById("notify"); + var nb = document.getElementById("notify_body"); if (!n || !nb) return; @@ -138,9 +122,6 @@ function notify_real(msg, doc, no_hide, is_err) { window.clearTimeout(notify_hide_timerid); } - notify_last_doc = doc; - notify_opacity = 1; - if (msg == "") { if (n.style.display == "block") { notify_hide_timerid = window.setTimeout("hide_notify()", 0); @@ -150,17 +131,25 @@ function notify_real(msg, doc, no_hide, is_err) { n.style.display = "block"; } - if (is_err) { + /* types: + + 1 - generic + 2 - progress + 3 - error + 4 - info + + */ + + if (n_type == 1) { + n.className = "notify"; + } else if (n_type == 2) { + n.className = "notifyProgress"; + msg = " " + msg; + } else if (n_type == 3) { n.className = "notifyError"; -// n.style.backgroundColor = "#ffcccc"; -// n.style.color = "black"; -// n.style.borderColor = "#ff0000"; msg = " " + msg; - } else { - n.className = "notify"; -// n.style.backgroundColor = "#fff7d5"; -// n.style.borderColor = "#d7c47a"; -// n.style.color = "black"; + } else if (n_type == 4) { + n.className = "notifyInfo"; msg = " " + msg; } @@ -173,16 +162,26 @@ function notify_real(msg, doc, no_hide, is_err) { } } -function p_notify(msg, no_hide, is_err) { - notify_real(msg, document, no_hide, is_err); +function notify(msg, no_hide) { + notify_real(msg, no_hide, 1); } -function notify(msg, no_hide, is_err) { - notify_real(msg, document, no_hide, is_err); +function notify_progress(msg, no_hide) { + notify_real(msg, no_hide, 2); +} + +function notify_error(msg, no_hide) { + notify_real(msg, no_hide, 3); + +} + +function notify_info(msg, no_hide) { + notify_real(msg, no_hide, 4); } function printLockingError() { - notify("Please wait until operation finishes");} + notify_info("Please wait until operation finishes."); +} function hotkey_handler(e) { @@ -668,14 +667,14 @@ function parse_counters(reply, scheduled_call) { function parse_counters_reply(xmlhttp, scheduled_call) { if (!xmlhttp.responseXML) { - notify("refetch_callback: backend did not return valid XML", true, true); + notify_error("Backend did not return valid XML", true); return; } var reply = xmlhttp.responseXML.firstChild; if (!reply) { - notify("refetch_callback: backend did not return expected XML object", true, true); + notify_error("Backend did not return expected XML object", true); updateTitle(""); return; } @@ -1344,7 +1343,7 @@ function infobox_submit_callback() { } } catch (e) { } - notify(xmlhttp.responseText); +// notify_info(xmlhttp.responseText); } } @@ -1416,7 +1415,7 @@ function qafAdd() { return false; } - notify("Adding feed...", true); + notify_progress("Adding feed..."); closeInfoBox(); @@ -1549,7 +1548,9 @@ function fatalError(code, message) { var fe = document.getElementById("fatal_error"); var fc = document.getElementById("fatal_error_msg"); - fc.innerHTML = "Code " + code + ": " + message; + if (message == "") message = "Unknown error"; + + fc.innerHTML = " " + message + " (Code " + code + ")"; fe.style.display = "block"; } @@ -1625,7 +1626,7 @@ function logoutUser() { try { if (xmlhttp_ready(xmlhttp_rpc)) { - notify("Logging out, please wait..."); + notify_progress("Logging out, please wait...", true); xmlhttp_rpc.open("GET", "backend.php?op=rpc&subop=logout", true); xmlhttp_rpc.onreadystatechange=logout_callback; diff --git a/images/indicator_white.gif b/images/indicator_white.gif index 529e72f45a2395e2eddb0487edbe79b306c92c3a..9d69aefcbf84f502866634c8367ee9698790b233 100644 GIT binary patch literal 2611 zcmeH||8EoL9mk*NzW5%W&-U4I9JiQo&O%~5lR1eOnbc|@e+igE=~0r+OmsU#mjo2G zQ3fJiJLNgsSq+I)x3pk7wAnBigKfBIQz=a162`Z}hAUN5Hx12bqGQ^`GHny7*2O!g z+A7%of~n6h_sdDo`}6v|-gj%(t`4nAxqu7Y6G5$3yLN;K zWq}upate}+!Iop&8r(#dPJp*8ta~n* ztb!kzIH8<)`}FN=1=hfPG6Mq`VAY2KC|#cc-2#*fk)>bCs~DP**Kr0=H0P|D3*Iuw z7}$kQcLB6!4JKjX9|r;@jS-#56;j$RzvA|Yc(kfrIwbO~m{i*COFn2Zn`YrcnUF8u2sYw9bsA^f8E-QP!GCo3;cDy>Nbr`s6gE&rF&5Z=#9Tx6xz zL+Lha7BYZdyS1Z$LCJ{flAw~e8Gp00NU`J#hrJ|_W!VpHMlBY`{3uW<%RU$ zeZTZ4e}ZW0!BiF<)z*(UsMS%miSvJ6b|EV?^<*p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fkvdQN;t{oK0gq+21S5uC5%{i0Rkv4w<&D zJMjZD7~PJ7Ws}GES&9V@nF^RLDT|DSF@(;5sRA*CvH-&fm&e1b*w01Co_GW)!WWmq zeOZb@C}{*uR%lI>L5yacs>LSc&yub>OO|tgQr{&M!Pxk;eM1c&ROwWXCzb>?PAMLC z1GC6JXDUc(-m@u3aTC6;$74tGFI<-5LO#4LoR#vKh>|j7m0)u&+#r4f3us)g0tH^I zt;E*mux|86(!S&sVn}Jx(E{rR@KAZe3V3OQgh*I9umtZKPs|XRegw&V z*XWil!;da!)+BwsQ-QH9Pg^G5XT1P$nS_y40Tsy z{=wwwR=Ec@H0)=_Eu4eUa{DduV&e41fhwT}-kHt$uA zb}g8vv`P8=DavZKF<526AnGep^efD4R7poT41ZImDN+S_C?KFCwamgWUZJk`!~ zT#=Z`F1h2n%sgVJokp-VKc_!QT=Ag>&W4N}ZVs1IETePLkb?bUKWr#oNjnpyd9k)?!4M?%;92?~PwtjZ=-!&#>4sNe7_}r$O zson-Y-4)nvlJpZQC&U&6uKs?SCVNj09n8wAFu|P76)3h_vPe_N8`*{Q?^VX)r(?M%vvE=b?K;_!f8 z85)&S&2)|t3TrI%&F?Itlg^Dg1pG215&^1RM0`E5g%-D^w{1v;Ej@GFf#$mhQ?td50gdL-SzT{X6={H?<9MQh zTO&IDmziQe=nz0T8Ju01Xm47?mb69O*PU)%;OZFgx!P8>>(A#M=fWq3vBN`3q^FtF zv|HfcX=>^}AYVq9-PJrn@MXK6`Md#U4{x3jGJ<^XDaW#fs!Er#ODIP}1U_W7@EKVI zd^M_Eg2^QQ6DZ*yoe{9k_B%akiPtknp;_KPPaEMp_N?@h(ODHk$K`ainr|-+$frDT zQKU?@eheS0B!m-{o=?N*C;UFVSv* diff --git a/prefs.js b/prefs.js index a072ef03c..53f9ecc98 100644 --- a/prefs.js +++ b/prefs.js @@ -126,10 +126,9 @@ function gethelp_callback() { function notify_callback() { - var container = document.getElementById('notify'); if (xmlhttp.readyState == 4) { - container.innerHTML=xmlhttp.responseText; - } + notify_info(xmlhttp.responseText); + } } function updateFeedList(sort_key) { @@ -216,7 +215,7 @@ function addFeed() { } else if (!isValidURL(link.value)) { alert("Error: Invalid feed URL."); } else { - notify("Adding feed..."); + notify_progress("Adding feed..."); xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=add&from=tt-rss&feed_url=" + param_escape(link.value), true); @@ -241,7 +240,7 @@ function addFeedCat() { if (cat.value.length == 0) { alert("Can't add category: no name specified."); } else { - notify("Adding feed category..."); + notify_progress("Adding feed category..."); xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=editCats&action=add&cat=" + param_escape(cat.value), true); @@ -265,7 +264,7 @@ function addUser() { if (sqlexp.value.length == 0) { alert("Can't add user: no login specified."); } else { - notify("Adding user..."); + notify_progress("Adding user..."); xmlhttp.open("GET", "backend.php?op=pref-users&subop=add&login=" + param_escape(sqlexp.value), true); @@ -427,7 +426,7 @@ function removeSelectedLabels() { var ok = confirm("Remove selected labels?"); if (ok) { - notify("Removing selected labels..."); + notify_progress("Removing selected labels..."); xmlhttp.open("GET", "backend.php?op=pref-labels&subop=remove&ids="+ param_escape(sel_rows.toString()), true); @@ -455,7 +454,7 @@ function removeSelectedUsers() { var ok = confirm("Remove selected users?"); if (ok) { - notify("Removing selected users..."); + notify_progress("Removing selected users..."); xmlhttp.open("GET", "backend.php?op=pref-users&subop=remove&ids="+ param_escape(sel_rows.toString()), true); @@ -484,7 +483,7 @@ function removeSelectedFilters() { var ok = confirm("Remove selected filters?"); if (ok) { - notify("Removing selected filters..."); + notify_progress("Removing selected filters..."); xmlhttp.open("GET", "backend.php?op=pref-filters&subop=remove&ids="+ param_escape(sel_rows.toString()), true); @@ -514,7 +513,7 @@ function removeSelectedFeeds() { if (ok) { - notify("Unsubscribing from selected feeds..."); + notify_progress("Unsubscribing from selected feeds..."); xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=remove&ids="+ param_escape(sel_rows.toString()), true); @@ -545,7 +544,7 @@ function removeSelectedFeedCats() { var ok = confirm("Remove selected categories?"); if (ok) { - notify("Removing selected categories..."); + notify_progress("Removing selected categories..."); xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=editCats&action=remove&ids="+ param_escape(sel_rows.toString()), true); @@ -607,7 +606,7 @@ function feedEditSave() { var query = Form.serialize("edit_feed_form"); - notify("Saving feed..."); + notify_progress("Saving feed..."); xmlhttp.open("POST", "backend.php", true); xmlhttp.onreadystatechange=feedlist_callback; @@ -630,7 +629,7 @@ function feedCatEditSave() { return } - notify("Saving category..."); + notify_progress("Saving category..."); var query = Form.serialize("feed_cat_edit_form"); @@ -746,7 +745,7 @@ function labelEditSave() { closeInfoBox(); - notify("Saving label..."); + notify_progress("Saving label..."); active_label = false; @@ -773,7 +772,7 @@ function userEditSave() { return; } - notify("Saving user..."); + notify_progress("Saving user..."); closeInfoBox(); @@ -803,7 +802,7 @@ function filterEditSave() { } } */ - notify("Saving filter..."); + notify_progress("Saving filter..."); var query = Form.serialize("filter_edit_form"); @@ -871,7 +870,7 @@ function resetSelectedUserPass() { var ok = confirm("Reset password of selected user?"); if (ok) { - notify("Resetting password for selected user..."); + notify_progress("Resetting password for selected user..."); var id = rows[0]; @@ -926,7 +925,7 @@ function selectedFeedDetails() { } if (rows.length > 1) { - notify("Please select only one feed."); + alert("Please select only one feed."); return; } @@ -965,12 +964,12 @@ function editSelectedFeed() { var rows = getSelectedFeeds(); if (rows.length == 0) { - notify("No feeds are selected."); + alert("No feeds are selected."); return; } if (rows.length > 1) { - notify("Please select one feed."); + alert("Please select one feed."); return; } @@ -1143,7 +1142,7 @@ function selectTab(id, noupdate, subop) { debug("selectTab: " + id + "(NU: " + noupdate + ")"); -// notify("Loading, please wait...", true); + notify_progress("Loading, please wait...", true); // close active infobox if needed closeInfoBox(); @@ -1313,7 +1312,7 @@ function categorizeSelectedFeeds() { if (sel_rows.length > 0) { - notify("Changing category of selected feeds..."); + notify_progress("Changing category of selected feeds..."); xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=categorize&ids="+ param_escape(sel_rows.toString()) + "&cat_id=" + param_escape(cat_id), true); diff --git a/tt-rss.css b/tt-rss.css index 73c475988..d6d81777d 100644 --- a/tt-rss.css +++ b/tt-rss.css @@ -238,6 +238,18 @@ input.editbox { vertical-align : middle; } +.notifyProgress { + border-color : #d7c47a; + background-color : #fff7d5; + color : black; +} + +.notifyInfo { + border-color : #7AD78E; + background-color : #D5FFDB; + color : black; +} + .notify { border-color : #d7c47a; background-color : #fff7d5; @@ -1065,11 +1077,11 @@ a.cdmToggleLink:hover { } #fatal_error_msg { - border : 1px solid #c0c0c0; - background-color : #f0f0f0; color : black; padding : 10px; font-weight : normal; + background-color : #ffcccc; + border : 1px solid #ff0000; } #fatal_error_msg a { @@ -1081,6 +1093,10 @@ a.cdmToggleLink:hover { text-decoration : underline; } +#fatal_error_msg img { + vertical-align : middle; +} + #noDaemonWarning { position : absolute; background-color : #ecf4ff; diff --git a/tt-rss.js b/tt-rss.js index b9f3af113..52ce95f2f 100644 --- a/tt-rss.js +++ b/tt-rss.js @@ -37,7 +37,7 @@ function toggleTags() { p.innerHTML = "display tags"; } - notify("Loading, please wait..."); + notify_progress("Loading, please wait..."); updateFeedList(); } @@ -71,7 +71,7 @@ function refetch_callback() { debug("refetch_callback: done"); if (!daemon_enabled && !daemon_refresh_only) { - notify("All feeds updated."); + notify_info("All feeds updated."); updateTitle(""); } else { //notify(""); @@ -135,7 +135,7 @@ function backend_sanity_check_callback() { function scheduleFeedUpdate(force) { if (!daemon_enabled && !daemon_refresh_only) { - notify("Updating feeds, please wait.", true); + notify_progress("Updating feeds, please wait.", true); updateTitle("Updating"); } @@ -231,7 +231,7 @@ function catchupAllFeeds() { var query_str = "backend.php?op=feeds&subop=catchupAll"; - notify("Marking all feeds as read..."); + notify_progress("Marking all feeds as read..."); debug("catchupAllFeeds Q=" + query_str); @@ -474,7 +474,7 @@ function quickMenuGo(opid) { function qfdDelete(feed_id) { - notify("Removing feed..."); + notify_progress("Removing feed..."); if (!xmlhttp_ready(xmlhttp)) { printLockingError(); @@ -552,7 +552,7 @@ function parse_runtime_info(elem) { } if (k == "daemon_is_running" && v != 1) { - notify("Update daemon is not runing.", true, true); + notify_error("Update daemon is not runing."); } /* var w = document.getElementById("noDaemonWarning"); @@ -634,7 +634,7 @@ function feedEditSave() { var query = Form.serialize("edit_feed_form"); - notify("Saving feed..."); + notify_progress("Saving feed..."); xmlhttp.open("POST", "backend.php", true); xmlhttp.onreadystatechange=dlg_frefresh_callback; @@ -701,7 +701,7 @@ function localHotkeyHandler(e) { } } else { - notify("No operation to undo"); + notify_error("No operation to undo"); } return false; diff --git a/viewfeed.js b/viewfeed.js index 7caba319d..7ff660a3b 100644 --- a/viewfeed.js +++ b/viewfeed.js @@ -514,7 +514,7 @@ function editTagsSave() { printLockingError(); } - notify("Saving article tags..."); + notify_progress("Saving article tags..."); var form = document.forms["tag_edit_form"];