UI improvements

This commit is contained in:
Andrew Dolgov 2007-03-02 20:58:58 +01:00
parent 0d32b41e36
commit 42c3291622
8 changed files with 96 additions and 80 deletions

View File

@ -135,7 +135,7 @@ function viewfeed(feed, subop, is_cat, subop_param, skip_history, offset) {
container.innerHTML = "<div class=\"loadingPrompt\"><img src=\"images/indicator_white.gif\">&nbsp;" + container.innerHTML = "<div class=\"loadingPrompt\"><img src=\"images/indicator_white.gif\">&nbsp;" +
"Loading, please wait...</div>"; */ "Loading, please wait...</div>"; */
notify("Loading, please wait...", true); notify_progress("Loading, please wait...", true);
// xmlhttp.abort(); // xmlhttp.abort();

View File

@ -103,34 +103,18 @@ function delay(gap) {
} }
var notify_hide_timerid = false; var notify_hide_timerid = false;
var notify_last_doc = false;
var notify_effect = false;
function hide_notify() { function hide_notify() {
if (notify_last_doc) { var n = document.getElementById("notify");
var n = notify_last_doc.getElementById("notify"); if (n) {
n.style.display = "none"; 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 n = document.getElementById("notify");
var nb = doc.getElementById("notify_body"); var nb = document.getElementById("notify_body");
if (!n || !nb) return; if (!n || !nb) return;
@ -138,9 +122,6 @@ function notify_real(msg, doc, no_hide, is_err) {
window.clearTimeout(notify_hide_timerid); window.clearTimeout(notify_hide_timerid);
} }
notify_last_doc = doc;
notify_opacity = 1;
if (msg == "") { if (msg == "") {
if (n.style.display == "block") { if (n.style.display == "block") {
notify_hide_timerid = window.setTimeout("hide_notify()", 0); 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"; n.style.display = "block";
} }
if (is_err) { /* types:
n.className = "notifyError";
// n.style.backgroundColor = "#ffcccc"; 1 - generic
// n.style.color = "black"; 2 - progress
// n.style.borderColor = "#ff0000"; 3 - error
msg = "<img src='images/sign_excl.png'> " + msg; 4 - info
} else {
*/
if (n_type == 1) {
n.className = "notify"; n.className = "notify";
// n.style.backgroundColor = "#fff7d5"; } else if (n_type == 2) {
// n.style.borderColor = "#d7c47a"; n.className = "notifyProgress";
// n.style.color = "black"; msg = "<img src='images/indicator_white.gif'> " + msg;
} else if (n_type == 3) {
n.className = "notifyError";
msg = "<img src='images/sign_excl.png'> " + msg;
} else if (n_type == 4) {
n.className = "notifyInfo";
msg = "<img src='images/sign_info.png'> " + msg; msg = "<img src='images/sign_info.png'> " + msg;
} }
@ -173,16 +162,26 @@ function notify_real(msg, doc, no_hide, is_err) {
} }
} }
function p_notify(msg, no_hide, is_err) { function notify(msg, no_hide) {
notify_real(msg, document, no_hide, is_err); notify_real(msg, no_hide, 1);
} }
function notify(msg, no_hide, is_err) { function notify_progress(msg, no_hide) {
notify_real(msg, document, no_hide, is_err); 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() { function printLockingError() {
notify("Please wait until operation finishes");} notify_info("Please wait until operation finishes.");
}
function hotkey_handler(e) { function hotkey_handler(e) {
@ -668,14 +667,14 @@ function parse_counters(reply, scheduled_call) {
function parse_counters_reply(xmlhttp, scheduled_call) { function parse_counters_reply(xmlhttp, scheduled_call) {
if (!xmlhttp.responseXML) { if (!xmlhttp.responseXML) {
notify("refetch_callback: backend did not return valid XML", true, true); notify_error("Backend did not return valid XML", true);
return; return;
} }
var reply = xmlhttp.responseXML.firstChild; var reply = xmlhttp.responseXML.firstChild;
if (!reply) { 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(""); updateTitle("");
return; return;
} }
@ -1344,7 +1343,7 @@ function infobox_submit_callback() {
} }
} catch (e) { } } catch (e) { }
notify(xmlhttp.responseText); // notify_info(xmlhttp.responseText);
} }
} }
@ -1416,7 +1415,7 @@ function qafAdd() {
return false; return false;
} }
notify("Adding feed...", true); notify_progress("Adding feed...");
closeInfoBox(); closeInfoBox();
@ -1549,7 +1548,9 @@ function fatalError(code, message) {
var fe = document.getElementById("fatal_error"); var fe = document.getElementById("fatal_error");
var fc = document.getElementById("fatal_error_msg"); var fc = document.getElementById("fatal_error_msg");
fc.innerHTML = "Code " + code + ": " + message; if (message == "") message = "Unknown error";
fc.innerHTML = "<img src='images/sign_excl.png'> " + message + " (Code " + code + ")";
fe.style.display = "block"; fe.style.display = "block";
} }
@ -1625,7 +1626,7 @@ function logoutUser() {
try { try {
if (xmlhttp_ready(xmlhttp_rpc)) { 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.open("GET", "backend.php?op=rpc&subop=logout", true);
xmlhttp_rpc.onreadystatechange=logout_callback; xmlhttp_rpc.onreadystatechange=logout_callback;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

@ -126,9 +126,8 @@ function gethelp_callback() {
function notify_callback() { function notify_callback() {
var container = document.getElementById('notify');
if (xmlhttp.readyState == 4) { if (xmlhttp.readyState == 4) {
container.innerHTML=xmlhttp.responseText; notify_info(xmlhttp.responseText);
} }
} }
@ -216,7 +215,7 @@ function addFeed() {
} else if (!isValidURL(link.value)) { } else if (!isValidURL(link.value)) {
alert("Error: Invalid feed URL."); alert("Error: Invalid feed URL.");
} else { } else {
notify("Adding feed..."); notify_progress("Adding feed...");
xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=add&from=tt-rss&feed_url=" + xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=add&from=tt-rss&feed_url=" +
param_escape(link.value), true); param_escape(link.value), true);
@ -241,7 +240,7 @@ function addFeedCat() {
if (cat.value.length == 0) { if (cat.value.length == 0) {
alert("Can't add category: no name specified."); alert("Can't add category: no name specified.");
} else { } else {
notify("Adding feed category..."); notify_progress("Adding feed category...");
xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=editCats&action=add&cat=" + xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=editCats&action=add&cat=" +
param_escape(cat.value), true); param_escape(cat.value), true);
@ -265,7 +264,7 @@ function addUser() {
if (sqlexp.value.length == 0) { if (sqlexp.value.length == 0) {
alert("Can't add user: no login specified."); alert("Can't add user: no login specified.");
} else { } else {
notify("Adding user..."); notify_progress("Adding user...");
xmlhttp.open("GET", "backend.php?op=pref-users&subop=add&login=" + xmlhttp.open("GET", "backend.php?op=pref-users&subop=add&login=" +
param_escape(sqlexp.value), true); param_escape(sqlexp.value), true);
@ -427,7 +426,7 @@ function removeSelectedLabels() {
var ok = confirm("Remove selected labels?"); var ok = confirm("Remove selected labels?");
if (ok) { if (ok) {
notify("Removing selected labels..."); notify_progress("Removing selected labels...");
xmlhttp.open("GET", "backend.php?op=pref-labels&subop=remove&ids="+ xmlhttp.open("GET", "backend.php?op=pref-labels&subop=remove&ids="+
param_escape(sel_rows.toString()), true); param_escape(sel_rows.toString()), true);
@ -455,7 +454,7 @@ function removeSelectedUsers() {
var ok = confirm("Remove selected users?"); var ok = confirm("Remove selected users?");
if (ok) { if (ok) {
notify("Removing selected users..."); notify_progress("Removing selected users...");
xmlhttp.open("GET", "backend.php?op=pref-users&subop=remove&ids="+ xmlhttp.open("GET", "backend.php?op=pref-users&subop=remove&ids="+
param_escape(sel_rows.toString()), true); param_escape(sel_rows.toString()), true);
@ -484,7 +483,7 @@ function removeSelectedFilters() {
var ok = confirm("Remove selected filters?"); var ok = confirm("Remove selected filters?");
if (ok) { if (ok) {
notify("Removing selected filters..."); notify_progress("Removing selected filters...");
xmlhttp.open("GET", "backend.php?op=pref-filters&subop=remove&ids="+ xmlhttp.open("GET", "backend.php?op=pref-filters&subop=remove&ids="+
param_escape(sel_rows.toString()), true); param_escape(sel_rows.toString()), true);
@ -514,7 +513,7 @@ function removeSelectedFeeds() {
if (ok) { if (ok) {
notify("Unsubscribing from selected feeds..."); notify_progress("Unsubscribing from selected feeds...");
xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=remove&ids="+ xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=remove&ids="+
param_escape(sel_rows.toString()), true); param_escape(sel_rows.toString()), true);
@ -545,7 +544,7 @@ function removeSelectedFeedCats() {
var ok = confirm("Remove selected categories?"); var ok = confirm("Remove selected categories?");
if (ok) { if (ok) {
notify("Removing selected categories..."); notify_progress("Removing selected categories...");
xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=editCats&action=remove&ids="+ xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=editCats&action=remove&ids="+
param_escape(sel_rows.toString()), true); param_escape(sel_rows.toString()), true);
@ -607,7 +606,7 @@ function feedEditSave() {
var query = Form.serialize("edit_feed_form"); var query = Form.serialize("edit_feed_form");
notify("Saving feed..."); notify_progress("Saving feed...");
xmlhttp.open("POST", "backend.php", true); xmlhttp.open("POST", "backend.php", true);
xmlhttp.onreadystatechange=feedlist_callback; xmlhttp.onreadystatechange=feedlist_callback;
@ -630,7 +629,7 @@ function feedCatEditSave() {
return return
} }
notify("Saving category..."); notify_progress("Saving category...");
var query = Form.serialize("feed_cat_edit_form"); var query = Form.serialize("feed_cat_edit_form");
@ -746,7 +745,7 @@ function labelEditSave() {
closeInfoBox(); closeInfoBox();
notify("Saving label..."); notify_progress("Saving label...");
active_label = false; active_label = false;
@ -773,7 +772,7 @@ function userEditSave() {
return; return;
} }
notify("Saving user..."); notify_progress("Saving user...");
closeInfoBox(); closeInfoBox();
@ -803,7 +802,7 @@ function filterEditSave() {
} }
} */ } */
notify("Saving filter..."); notify_progress("Saving filter...");
var query = Form.serialize("filter_edit_form"); var query = Form.serialize("filter_edit_form");
@ -871,7 +870,7 @@ function resetSelectedUserPass() {
var ok = confirm("Reset password of selected user?"); var ok = confirm("Reset password of selected user?");
if (ok) { if (ok) {
notify("Resetting password for selected user..."); notify_progress("Resetting password for selected user...");
var id = rows[0]; var id = rows[0];
@ -926,7 +925,7 @@ function selectedFeedDetails() {
} }
if (rows.length > 1) { if (rows.length > 1) {
notify("Please select only one feed."); alert("Please select only one feed.");
return; return;
} }
@ -965,12 +964,12 @@ function editSelectedFeed() {
var rows = getSelectedFeeds(); var rows = getSelectedFeeds();
if (rows.length == 0) { if (rows.length == 0) {
notify("No feeds are selected."); alert("No feeds are selected.");
return; return;
} }
if (rows.length > 1) { if (rows.length > 1) {
notify("Please select one feed."); alert("Please select one feed.");
return; return;
} }
@ -1143,7 +1142,7 @@ function selectTab(id, noupdate, subop) {
debug("selectTab: " + id + "(NU: " + noupdate + ")"); debug("selectTab: " + id + "(NU: " + noupdate + ")");
// notify("Loading, please wait...", true); notify_progress("Loading, please wait...", true);
// close active infobox if needed // close active infobox if needed
closeInfoBox(); closeInfoBox();
@ -1313,7 +1312,7 @@ function categorizeSelectedFeeds() {
if (sel_rows.length > 0) { 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="+ xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=categorize&ids="+
param_escape(sel_rows.toString()) + "&cat_id=" + param_escape(cat_id), true); param_escape(sel_rows.toString()) + "&cat_id=" + param_escape(cat_id), true);

View File

@ -238,6 +238,18 @@ input.editbox {
vertical-align : middle; vertical-align : middle;
} }
.notifyProgress {
border-color : #d7c47a;
background-color : #fff7d5;
color : black;
}
.notifyInfo {
border-color : #7AD78E;
background-color : #D5FFDB;
color : black;
}
.notify { .notify {
border-color : #d7c47a; border-color : #d7c47a;
background-color : #fff7d5; background-color : #fff7d5;
@ -1065,11 +1077,11 @@ a.cdmToggleLink:hover {
} }
#fatal_error_msg { #fatal_error_msg {
border : 1px solid #c0c0c0;
background-color : #f0f0f0;
color : black; color : black;
padding : 10px; padding : 10px;
font-weight : normal; font-weight : normal;
background-color : #ffcccc;
border : 1px solid #ff0000;
} }
#fatal_error_msg a { #fatal_error_msg a {
@ -1081,6 +1093,10 @@ a.cdmToggleLink:hover {
text-decoration : underline; text-decoration : underline;
} }
#fatal_error_msg img {
vertical-align : middle;
}
#noDaemonWarning { #noDaemonWarning {
position : absolute; position : absolute;
background-color : #ecf4ff; background-color : #ecf4ff;

View File

@ -37,7 +37,7 @@ function toggleTags() {
p.innerHTML = "display tags"; p.innerHTML = "display tags";
} }
notify("Loading, please wait..."); notify_progress("Loading, please wait...");
updateFeedList(); updateFeedList();
} }
@ -71,7 +71,7 @@ function refetch_callback() {
debug("refetch_callback: done"); debug("refetch_callback: done");
if (!daemon_enabled && !daemon_refresh_only) { if (!daemon_enabled && !daemon_refresh_only) {
notify("All feeds updated."); notify_info("All feeds updated.");
updateTitle(""); updateTitle("");
} else { } else {
//notify(""); //notify("");
@ -135,7 +135,7 @@ function backend_sanity_check_callback() {
function scheduleFeedUpdate(force) { function scheduleFeedUpdate(force) {
if (!daemon_enabled && !daemon_refresh_only) { if (!daemon_enabled && !daemon_refresh_only) {
notify("Updating feeds, please wait.", true); notify_progress("Updating feeds, please wait.", true);
updateTitle("Updating"); updateTitle("Updating");
} }
@ -231,7 +231,7 @@ function catchupAllFeeds() {
var query_str = "backend.php?op=feeds&subop=catchupAll"; 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); debug("catchupAllFeeds Q=" + query_str);
@ -474,7 +474,7 @@ function quickMenuGo(opid) {
function qfdDelete(feed_id) { function qfdDelete(feed_id) {
notify("Removing feed..."); notify_progress("Removing feed...");
if (!xmlhttp_ready(xmlhttp)) { if (!xmlhttp_ready(xmlhttp)) {
printLockingError(); printLockingError();
@ -552,7 +552,7 @@ function parse_runtime_info(elem) {
} }
if (k == "daemon_is_running" && v != 1) { if (k == "daemon_is_running" && v != 1) {
notify("<span onclick=\"javascript:explainError(1)\">Update daemon is not runing.</span>", true, true); notify_error("<span onclick=\"javascript:explainError(1)\">Update daemon is not runing.</span>");
} }
/* var w = document.getElementById("noDaemonWarning"); /* var w = document.getElementById("noDaemonWarning");
@ -634,7 +634,7 @@ function feedEditSave() {
var query = Form.serialize("edit_feed_form"); var query = Form.serialize("edit_feed_form");
notify("Saving feed..."); notify_progress("Saving feed...");
xmlhttp.open("POST", "backend.php", true); xmlhttp.open("POST", "backend.php", true);
xmlhttp.onreadystatechange=dlg_frefresh_callback; xmlhttp.onreadystatechange=dlg_frefresh_callback;
@ -701,7 +701,7 @@ function localHotkeyHandler(e) {
} }
} else { } else {
notify("No operation to undo"); notify_error("No operation to undo");
} }
return false; return false;

View File

@ -514,7 +514,7 @@ function editTagsSave() {
printLockingError(); printLockingError();
} }
notify("Saving article tags..."); notify_progress("Saving article tags...");
var form = document.forms["tag_edit_form"]; var form = document.forms["tag_edit_form"];