var active_tab = false;
var feed_to_expand = false;
-var piggie_top = -400;
-var piggie_fwd = true;
-
var xmlhttp = Ajax.getTransport();
var init_params = new Array();
var sanity_check_done = false;
-/*
+function infobox_callback() {
+ if (xmlhttp.readyState == 4) {
+ infobox_callback2(xmlhttp);
+ }
+}
+
+function infobox_submit_callback() {
+ if (xmlhttp.readyState == 4) {
+ infobox_submit_callback2(xmlhttp);
+ }
+}
+
+
function replace_pubkey_callback() {
if (xmlhttp.readyState == 4) {
try {
if (xmlhttp.responseXML) {
+ var new_link = xmlhttp.responseXML.getElementsByTagName("link")[0];
+
+ if (new_link) {
+ link.href = new_link.firstChild.nodeValue;
+ link.innerHTML = new_link.firstChild.nodeValue;
+
+ new Effect.Highlight(link);
+
+ notify_info("Address changed.");
+ } else {
+ notify_error("Could not change address.");
+ }
} else {
- notify_error("Error while changing adress");
+ notify_error("Could not change address.");
}
} catch (e) {
exception_error("replace_pubkey_callback", e);
}
}
-} */
+}
function expand_feed_callback() {
if (xmlhttp.readyState == 4) {
try {
var container = document.getElementById("BRDET-" + feed_to_expand);
container.innerHTML=xmlhttp.responseText;
- container.style.display = "block";
-// p_notify("");
+// container.style.display = "block";
+ Effect.Appear(container, {duration : 0.5});
} catch (e) {
exception_error("expand_feed_callback", e);
}
/* stub for subscription dialog */
-function dlg_frefresh_callback() {
- if (xmlhttp.readyState == 4) {
- // setTimeout("updateFeedList()", 500);
+function dlg_frefresh_callback(transport) {
- try {
- var container = document.getElementById('prefContent');
- container.innerHTML=xmlhttp.responseText;
- selectTab("feedConfig", true);
+ try {
+ var container = document.getElementById('prefContent');
+ container.innerHTML=transport.responseText;
+ selectTab("feedConfig", true);
- if (caller_subop) {
- var tuple = caller_subop.split(":");
- if (tuple[0] == 'editFeed') {
- window.setTimeout('editFeed('+tuple[1]+')', 100);
- }
+ if (caller_subop) {
+ var tuple = caller_subop.split(":");
+ if (tuple[0] == 'editFeed') {
+ window.setTimeout('editFeed('+tuple[1]+')', 100);
+ }
- caller_subop = false;
- }
- if (typeof correctPNG != 'undefined') {
- correctPNG();
- }
- notify("");
- } catch (e) {
- exception_error("feedlist_callback", e);
+ caller_subop = false;
+ }
+ if (typeof correctPNG != 'undefined') {
+ correctPNG();
}
+ notify("");
+ } catch (e) {
+ exception_error("feedlist_callback", e);
}
+
}
function filterlist_callback() {
}
}
-function labeltest_callback() {
- var container = document.getElementById('label_test_result');
- if (xmlhttp.readyState == 4) {
- container.innerHTML=xmlhttp.responseText;
- notify("");
- }
-}
-
function feed_browser_callback() {
var container = document.getElementById('prefContent');
if (xmlhttp.readyState == 4) {
}
}
+function prefs_reset_callback() {
+ if (xmlhttp.readyState == 4) {
+ notify_info(xmlhttp.responseText);
+ selectTab();
+ }
+}
+
function changepass_callback() {
try {
}
}
+function infobox_feed_cat_callback() {
+ if (xmlhttp.readyState == 4) {
+ try {
+
+ infobox_callback();
+
+ if (document.getElementById("prefFeedCatList")) {
+ var elems = document.getElementById("prefFeedCatList").getElementsByTagName("SPAN");
+
+ for (var i = 0; i < elems.length; i++) {
+ if (elems[i].id && elems[i].id.match("FCATT-")) {
+ var cat_id = elems[i].id.replace("FCATT-", "");
+
+ new Ajax.InPlaceEditor(elems[i],
+ 'backend.php?op=pref-feeds&subop=editCats&action=save&cid=' + cat_id);
+ }
+ }
+ }
+
+ } catch (e) {
+ exception_error("infobox_feed_cat_callback", e);
+ }
+ }
+}
+
function updateFeedList(sort_key) {
if (!xmlhttp_ready(xmlhttp)) {
return
}
-// document.getElementById("prefContent").innerHTML = "Loading feeds, please wait...";
-
-// p_notify("Loading, please wait...");
-
var feed_search = document.getElementById("feed_search");
var search = "";
if (feed_search) { search = feed_search.value; }
return
}
-// document.getElementById("prefContent").innerHTML = "Loading feeds, please wait...";
-
-// p_notify("Loading, please wait...");
-
xmlhttp.open("GET", "backend.php?op=pref-users&sort="
+ param_escape(sort_key), true);
xmlhttp.onreadystatechange=userlist_callback;
var description = form.description.value;
if (sql_exp == "") {
- alert("Can't create label: missing SQL expression.");
+ alert(__("Can't create label: missing SQL expression."));
return false;
}
if (description == "") {
- alert("Can't create label: missing caption.");
+ alert(__("Can't create label: missing caption."));
return false;
}
var sqlexp = document.getElementById("uadd_box");
if (sqlexp.value.length == 0) {
- alert("Can't add user: no login specified.");
+ alert(__("Can't add user: no login specified."));
} else {
notify_progress("Adding user...");
if (sel_rows.length > 0) {
- var ok = confirm("Remove selected labels?");
+ var ok = confirm(__("Remove selected labels?"));
if (ok) {
notify_progress("Removing selected labels...");
xmlhttp.send(null);
}
} else {
- alert("No labels are selected.");
+ alert(__("No labels are selected."));
}
return false;
if (sel_rows.length > 0) {
- var ok = confirm("Remove selected users?");
+ var ok = confirm(__("Remove selected users?"));
if (ok) {
notify_progress("Removing selected users...");
}
} else {
- alert("No users are selected.");
+ alert(__("No users are selected."));
}
return false;
if (sel_rows.length > 0) {
- var ok = confirm("Remove selected filters?");
+ var ok = confirm(__("Remove selected filters?"));
if (ok) {
notify_progress("Removing selected filters...");
xmlhttp.send(null);
}
} else {
- alert("No filters are selected.");
+ alert(__("No filters are selected."));
}
return false;
if (sel_rows.length > 0) {
- var ok = confirm("Unsubscribe from selected feeds?");
+ var ok = confirm(__("Unsubscribe from selected feeds?"));
if (ok) {
} else {
- alert("No feeds are selected.");
+ alert(__("No feeds are selected."));
+
+ }
+
+ return false;
+}
+
+function clearSelectedFeeds() {
+
+ if (!xmlhttp_ready(xmlhttp)) {
+ printLockingError();
+ return
+ }
+
+ var sel_rows = getSelectedFeeds();
+
+ if (sel_rows.length > 1) {
+ alert(__("Please select only one feed."));
+ return;
+ }
+
+ if (sel_rows.length > 0) {
+
+ var ok = confirm(__("Erase all non-starred articles in selected feed?"));
+
+ if (ok) {
+ notify_progress("Clearing selected feed...");
+ clearFeedArticles(sel_rows[0]);
+ }
+
+ } else {
+
+ alert(__("No feeds are selected."));
+
+ }
+
+ return false;
+}
+
+function purgeSelectedFeeds() {
+
+ if (!xmlhttp_ready(xmlhttp)) {
+ printLockingError();
+ return
+ }
+
+ var sel_rows = getSelectedFeeds();
+
+ if (sel_rows.length > 0) {
+
+ var pr = prompt(__("How many days of articles to keep (0 - use default)?"), "0");
+
+ if (pr != undefined) {
+ notify_progress("Purging selected feed...");
+
+ var query = "backend.php?op=rpc&subop=purge&ids="+
+ param_escape(sel_rows.toString()) + "&days=" + pr;
+
+ debug(query);
+
+ new Ajax.Request(query, {
+ onComplete: function(transport) {
+ notify('');
+ } });
+ }
+
+ } else {
+
+ alert(__("No feeds are selected."));
}
if (sel_rows.length > 0) {
- var ok = confirm("Remove selected categories?");
+ var ok = confirm(__("Remove selected categories?"));
if (ok) {
notify_progress("Removing selected categories...");
} else {
- alert("No categories are selected.");
+ alert(__("No categories are selected."));
}
return false;
}
-
-function labelTest() {
-
- var container = document.getElementById('label_test_result');
- container.style.display = "block";
- container.innerHTML = "<p>Loading, please wait...</p>";
-
- var form = document.forms['label_edit_form'];
-
- var sql_exp = form.sql_exp.value;
- var description = form.description.value;
-
- xmlhttp.open("GET", "backend.php?op=pref-labels&subop=test&expr=" +
- param_escape(sql_exp) + "&descr=" + param_escape(description), true);
-
- xmlhttp.onreadystatechange=labeltest_callback;
- xmlhttp.send(null);
-
- return false;
-}
-
-function displayHelpInfobox(topic_id) {
-
-/* if (!xmlhttp_ready(xmlhttp)) {
- printLockingError();
- return
- }
-
- notify_progress("Loading help...");
-
- xmlhttp.open("GET", "backend.php?op=help&tid=" +
- param_escape(topic_id), true);
-
- xmlhttp.onreadystatechange=helpbox_callback;
- xmlhttp.send(null); */
-
- var url = "backend.php?op=help&tid=" + param_escape(topic_id);
-
- var w = window.open(url, "ttrss_help",
- "status=0,toolbar=0,location=0,width=400,height=450,menubar=0");
-
-}
-
function labelEditCancel() {
if (!xmlhttp_ready(xmlhttp)) {
var login = document.forms["user_edit_form"].login.value;
if (login.length == 0) {
- alert("Login field cannot be blank.");
+ alert(__("Login field cannot be blank."));
return;
}
}
-function piggie_callback() {
- var piggie = document.getElementById("piggie");
-
- piggie.style.top = piggie_top;
- piggie.style.backgroundColor = "white";
- piggie.style.borderWidth = "1px";
-
- if (piggie_fwd && piggie_top < 0) {
- setTimeout("piggie_callback()", 50);
- piggie_top = piggie_top + 10;
- } else if (piggie_fwd && piggie_top >= 0) {
- piggie_fwd = false;
- setTimeout("piggie_callback()", 50);
- } else if (!piggie_fwd && piggie_top > -400) {
- setTimeout("piggie_callback()", 50);
- piggie_top = piggie_top - 10;
- } else if (!piggie_fwd && piggie_top <= -400) {
- piggie.style.display = "none";
- piggie_fwd = true;
- }
-}
-
-var piggie_opacity = 0;
-
-function piggie2_callback() {
- var piggie = document.getElementById("piggie");
- piggie.style.top = 0;
- piggie.style.opacity = piggie_opacity;
- piggie.style.backgroundColor = "transparent";
- piggie.style.borderWidth = "0px";
-
- if (piggie_fwd && piggie_opacity < 1) {
- setTimeout("piggie2_callback()", 50);
- piggie_opacity = piggie_opacity + 0.03;
- } else if (piggie_fwd && piggie_opacity >= 1) {
- piggie_fwd = false;
- setTimeout("piggie2_callback()", 50);
- } else if (!piggie_fwd && piggie_opacity > 0) {
- setTimeout("piggie2_callback()", 50);
- piggie_opacity = piggie_opacity - 0.03;
- } else if (!piggie_fwd && piggie_opacity <= 0) {
- piggie.style.display = "none";
- piggie_fwd = true;
- }
-}
-
function localPiggieFunction(enable) {
if (enable) {
debug("I LOVEDED IT!");
var piggie = document.getElementById("piggie");
- piggie.style.display = "block";
- if (navigator.userAgent.match("Gecko") && Math.random(1) > 0.5) {
- piggie2_callback();
- } else {
- piggie_callback();
- }
+ Element.show(piggie);
+ Position.Center(piggie);
+ Effect.Puff(piggie);
+
}
}
return
}
-// document.getElementById("prefContent").innerHTML = "Loading filters, please wait...";
-
-// p_notify("Loading, please wait...");
-
xmlhttp.open("GET", "backend.php?op=pref-filters&sort=" +
param_escape(sort_key), true);
xmlhttp.onreadystatechange=filterlist_callback;
return
}
-// p_notify("Loading, please wait...");
-
-// document.getElementById("prefContent").innerHTML = "Loading labels, please wait...";
-
xmlhttp.open("GET", "backend.php?op=pref-labels&sort=" +
param_escape(sort_key), true);
xmlhttp.onreadystatechange=labellist_callback;
return
}
-// p_notify("Loading, please wait...");
-
xmlhttp.open("GET", "backend.php?op=pref-prefs", true);
xmlhttp.onreadystatechange=prefslist_callback;
xmlhttp.send(null);
// clean up all current selections, just in case
active_feed_cat = false;
active_label = false;
-
+
+// Effect.Fade("prefContent", {duration: 1, to: 0.01,
+// queue: { position:'end', scope: 'FEED_TAB', limit: 1 } } );
+
if (id == "feedConfig") {
updateFeedList();
} else if (id == "filterConfig") {
}
function validatePrefsReset() {
- return confirm(__("Reset to defaults?"));
+ try {
+ var ok = confirm(__("Reset to defaults?"));
+
+ if (ok) {
+
+ var query = Form.serialize("pref_prefs_form");
+ query = query + "&subop=reset-config";
+ debug(query);
+
+ xmlhttp.open("POST", "backend.php", true);
+ xmlhttp.onreadystatechange=prefs_reset_callback;
+ xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
+ xmlhttp.send(query);
+ }
+
+ } catch (e) {
+ exception_error("validatePrefsSave", e);
+ }
+
+ return false;
+
}
function browseFeeds(limit) {
xmlhttp.onreadystatechange=feedlist_callback;
xmlhttp.send(null);
} else {
- alert("No feeds are selected.");
+ alert(__("No feeds are selected."));
}
} catch (e) {
return
}
-// p_notify("Loading, please wait...");
-
var query = "backend.php?op=pref-feed-browser";
var limit_sel = document.getElementById("feedBrowserLimit");
return
}
- var d = document.getElementById("BRDET-" + id);
+/* if (feed_to_expand && id != feed_to_expand) {
+ Effect.Fade('BRDET-' + feed_to_expand, {duration : 0.5});
+ } */
- if (d.style.display == "block") {
- d.style.display = "none";
-
- } else {
+ var d = document.getElementById("BRDET-" + id);
+ if (Element.visible(d)) {
+ Effect.Fade(d, {duration : 0.5});
+ } else {
feed_to_expand = id;
- d.style.display = "block";
- d.innerHTML = "Loading, please wait...";
-
xmlhttp.open("GET", "backend.php?op=pref-feed-browser&subop=details&id="
+ param_escape(id), true);
xmlhttp.onreadystatechange=expand_feed_callback;
}
} catch (e) {
- exception_error("browserExpand", e);
+ exception_error("browserToggleExpand", e);
}
}
}
}
-function userSwitch() {
- var chooser = document.getElementById("userSwitch");
- var user = chooser[chooser.selectedIndex].value;
- window.location = "prefs.php?swu=" + user;
-}
-
function editFeedCats() {
if (!xmlhttp_ready(xmlhttp)) {
printLockingError();
}
xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=editCats", true);
- xmlhttp.onreadystatechange=infobox_callback;
+ xmlhttp.onreadystatechange=infobox_feed_cat_callback;
xmlhttp.send(null);
}
return false;
}
+ var f = document.forms["change_pass_form"];
+
+ if (f) {
+ if (f.OLD_PASSWORD.value == "") {
+ new Effect.Highlight(f.OLD_PASSWORD);
+ notify_error("Old password cannot be blank.");
+ return false;
+ }
+
+ if (f.NEW_PASSWORD.value == "") {
+ new Effect.Highlight(f.NEW_PASSWORD);
+ notify_error("New password cannot be blank.");
+ return false;
+ }
+
+ if (f.CONFIRM_PASSWORD.value == "") {
+ new Effect.Highlight(f.CONFIRM_PASSWORD);
+ notify_error("Entered passwords do not match.");
+ return false;
+ }
+
+ if (f.CONFIRM_PASSWORD.value != f.NEW_PASSWORD.value) {
+ new Effect.Highlight(f.CONFIRM_PASSWORD);
+ new Effect.Highlight(f.NEW_PASSWORD);
+ notify_error("Entered passwords do not match.");
+ return false;
+ }
+
+ }
+
var query = Form.serialize("change_pass_form");
notify_progress("Trying to change password...");
updateFeedList()
}
-/*
function pubRegenKey() {
if (!xmlhttp_ready(xmlhttp)) {
return false;
}
- var ok = confirm("Replace current publishing address with a new one?");
+ var ok = confirm(__("Replace current publishing address with a new one?"));
if (ok) {
notify_progress("Trying to change address...");
- xmlhttp.open("GET", "backend.php?op=backend-rpc&subop=regen-pub-key");
+ xmlhttp.open("GET", "backend.php?op=rpc&subop=regenPubKey");
xmlhttp.onreadystatechange=replace_pubkey_callback;
xmlhttp.send(null);
}
return false;
-} */
+}
+
+function validatePrefsSave() {
+ try {
+
+ var ok = confirm(__("Save current configuration?"));
+
+ if (ok) {
+
+ var query = Form.serialize("pref_prefs_form");
+ query = query + "&subop=save-config";
+ debug(query);
+
+ xmlhttp.open("POST", "backend.php", true);
+ xmlhttp.onreadystatechange=notify_callback;
+ xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
+ xmlhttp.send(query);
+ }
+
+ } catch (e) {
+ exception_error("validatePrefsSave", e);
+ }
+
+ return false;
+}
+
+function feedActionChange() {
+ try {
+ var chooser = document.getElementById("feedActionChooser");
+ var opid = chooser[chooser.selectedIndex].value;
+
+ chooser.selectedIndex = 0;
+ feedActionGo(opid);
+ } catch (e) {
+ exception_error("feedActionChange", e);
+ }
+}
+
+function feedActionGo(op) {
+ try {
+ if (op == "facEdit") {
+ editSelectedFeed();
+ }
+
+ if (op == "facClear") {
+ clearSelectedFeeds();
+ }
+
+ if (op == "facPurge") {
+ purgeSelectedFeeds();
+ }
+
+ if (op == "facEditCats") {
+ editFeedCats();
+ }
+
+ if (op == "facUnsubscribe") {
+ removeSelectedFeeds();
+ }
+
+ } catch (e) {
+ exception_error("feedActionGo", e);
+
+ }
+}
+
+function clearFeedArticles(feed_id) {
+
+ notify_progress("Clearing feed...");
+
+ var query = "backend.php?op=pref-feeds&quiet=1&subop=clear&id=" + feed_id;
+
+ new Ajax.Request(query, {
+ onComplete: function(transport) {
+ notify('');
+ } });
+
+ return false;
+}
+
+