diff options
author | Andrew Dolgov <[email protected]> | 2011-12-13 15:08:07 +0400 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2011-12-13 15:08:07 +0400 |
commit | d043c0069ed6e7e33e5ee019eca725fa4029ef1e (patch) | |
tree | 258ff28f95fa10e55af5bfb47168c12f85bf97dd /js | |
parent | 43dd8898bd8d82d526b6d56b9f6b2afd53af9162 (diff) | |
parent | 80edb8b4d7002edffbf26da4bf98c51e32dd51b6 (diff) |
Merge branch 'tiny-oop'
Diffstat (limited to 'js')
-rw-r--r-- | js/PrefFeedTree.js | 2 | ||||
-rw-r--r-- | js/digest.js | 26 | ||||
-rw-r--r-- | js/feedlist.js | 20 | ||||
-rw-r--r-- | js/functions.js | 38 | ||||
-rw-r--r-- | js/prefs.js | 190 | ||||
-rw-r--r-- | js/tt-rss.js | 32 | ||||
-rw-r--r-- | js/viewfeed.js | 52 |
7 files changed, 157 insertions, 203 deletions
diff --git a/js/PrefFeedTree.js b/js/PrefFeedTree.js index 4ea486609..9e2ee0662 100644 --- a/js/PrefFeedTree.js +++ b/js/PrefFeedTree.js @@ -11,7 +11,7 @@ dojo.declare("fox.PrefFeedStore", dojo.data.ItemFileWriteStore, { dojo.xhrPost({ url: "backend.php", - content: {op: "pref-feeds", subop: "savefeedorder", + content: {op: "pref-feeds", method: "savefeedorder", payload: newFileContentString}, error: saveFailedCallback, load: saveCompleteCallback}); diff --git a/js/digest.js b/js/digest.js index 7dba6d36e..12d45e536 100644 --- a/js/digest.js +++ b/js/digest.js @@ -26,7 +26,7 @@ function catchup_feed(feed_id, callback) { if (feed_id < 0) is_cat = "true"; // KLUDGE - var query = "?op=rpc&subop=catchupFeed&feed_id=" + + var query = "?op=rpc&method=catchupFeed&feed_id=" + feed_id + "&is_cat=" + is_cat; new Ajax.Request("backend.php", { @@ -68,7 +68,7 @@ function catchup_visible_articles(callback) { if (confirm(__("Mark %d displayed articles as read?").replace("%d", ids.length))) { - var query = "?op=rpc&subop=catchupSelected" + + var query = "?op=rpc&method=catchupSelected" + "&cmode=0&ids=" + param_escape(ids); new Ajax.Request("backend.php", { @@ -88,7 +88,7 @@ function catchup_visible_articles(callback) { function catchup_article(article_id, callback) { try { - var query = "?op=rpc&subop=catchupSelected" + + var query = "?op=rpc&method=catchupSelected" + "&cmode=0&ids=" + article_id; new Ajax.Request("backend.php", { @@ -169,7 +169,7 @@ function update(callback) { window.clearTimeout(_update_timeout); new Ajax.Request("backend.php", { - parameters: "?op=rpc&subop=digest-init", + parameters: "?op=rpc&method=digestinit", onComplete: function(transport) { fatal_error_check(transport); parse_feeds(transport); @@ -220,7 +220,7 @@ function view(article_id) { }, 500); new Ajax.Request("backend.php", { - parameters: "?op=rpc&subop=digest-get-contents&article_id=" + + parameters: "?op=rpc&method=digestgetcontents&article_id=" + article_id, onComplete: function(transport) { fatal_error_check(transport); @@ -315,14 +315,14 @@ function viewfeed(feed_id, offset, replace, no_effects, no_indicator, callback) if (!offset) $("headlines").scrollTop = 0; - var query = "backend.php?op=rpc&subop=digest-update&feed_id=" + + var query = "backend.php?op=rpc&method=digestupdate&feed_id=" + param_escape(feed_id) + "&offset=" + offset + "&seq=" + _update_seq; console.log(query); var img = false; - + if ($("F-" + feed_id)) { img = $("F-" + feed_id).getElementsByTagName("IMG")[0]; @@ -648,7 +648,7 @@ function parse_headlines(transport, replace, no_effects) { function init_second_stage() { try { new Ajax.Request("backend.php", { - parameters: "backend.php?op=rpc&subop=digest-init", + parameters: "backend.php?op=rpc&method=digestinit", onComplete: function(transport) { parse_feeds(transport); Element.hide("overlay"); @@ -667,7 +667,7 @@ function init() { dojo.require("dijit.Dialog"); new Ajax.Request("backend.php", { - parameters: "?op=rpc&subop=sanityCheck", + parameters: "?op=rpc&method=sanityCheck", onComplete: function(transport) { backend_sanity_check_callback(transport); } }); @@ -681,7 +681,7 @@ function toggle_mark(img, id) { try { - var query = "?op=rpc&id=" + id + "&subop=mark"; + var query = "?op=rpc&id=" + id + "&method=mark"; if (!img) return; @@ -710,7 +710,7 @@ function toggle_pub(img, id, note) { try { - var query = "?op=rpc&id=" + id + "&subop=publ"; + var query = "?op=rpc&id=" + id + "&method=publ"; if (note != undefined) { query = query + "¬e=" + param_escape(note); @@ -798,14 +798,14 @@ function update_title(unread) { function tweet_article(id) { try { - var query = "?op=rpc&subop=getTweetInfo&id=" + param_escape(id); + var query = "?op=rpc&method=getTweetInfo&id=" + param_escape(id); console.log(query); var d = new Date(); var ts = d.getTime(); - var w = window.open('backend.php?op=loading', 'ttrss_tweet', + var w = window.open('backend.php?op=backend&method=loading', 'ttrss_tweet', "status=0,toolbar=0,location=0,width=500,height=400,scrollbars=1,menubar=0"); new Ajax.Request("backend.php", { diff --git a/js/feedlist.js b/js/feedlist.js index eaaeaad81..75e97e884 100644 --- a/js/feedlist.js +++ b/js/feedlist.js @@ -48,14 +48,14 @@ function loadMoreHeadlines() { } -function viewfeed(feed, subop, is_cat, offset, background, infscroll_req) { +function viewfeed(feed, method, is_cat, offset, background, infscroll_req) { try { if (is_cat == undefined) is_cat = false; else is_cat = !!is_cat; - if (subop == undefined) subop = ''; + if (method == undefined) method = ''; if (offset == undefined) offset = 0; if (background == undefined) background = false; if (infscroll_req == undefined) infscroll_req = false; @@ -110,7 +110,7 @@ function viewfeed(feed, subop, is_cat, offset, background, infscroll_req) { _infscroll_disable = 0; } - if (!offset && !subop && cached_headlines && !background) { + if (!offset && !method && cached_headlines && !background) { try { render_local_headlines(feed, is_cat, JSON.parse(cached_headlines)); return; @@ -119,7 +119,7 @@ function viewfeed(feed, subop, is_cat, offset, background, infscroll_req) { } } - if (offset != 0 && !subop) { + if (offset != 0 && !method) { var date = new Date(); var timestamp = Math.round(date.getTime() / 1000); @@ -138,8 +138,8 @@ function viewfeed(feed, subop, is_cat, offset, background, infscroll_req) { var toolbar_query = Form.serialize("main_toolbar_form"); - var query = "?op=viewfeed&feed=" + feed + "&" + - toolbar_query + "&subop=" + param_escape(subop); + var query = "?op=feeds&method=view&feed=" + feed + "&" + + toolbar_query + "&m=" + param_escape(method); if (!background) { if (_search_query) { @@ -148,7 +148,7 @@ function viewfeed(feed, subop, is_cat, offset, background, infscroll_req) { _search_query = false; } - if (subop == "MarkAllRead") { + if (method == "MarkAllRead") { var show_next_feed = getInitParam("on_catchup_show_next_feed") == "1"; @@ -162,7 +162,7 @@ function viewfeed(feed, subop, is_cat, offset, background, infscroll_req) { render_local_headlines(nuf, false, JSON.parse(cached_nuf)); - var catchup_query = "?op=rpc&subop=catchupFeed&feed_id=" + + var catchup_query = "?op=rpc&method=catchupFeed&feed_id=" + feed + "&is_cat=" + is_cat; console.log(catchup_query); @@ -246,7 +246,7 @@ function request_counters_real() { try { console.log("requesting counters..."); - var query = "?op=rpc&subop=getAllCounters&seq=" + next_seq(); + var query = "?op=rpc&method=getAllCounters&seq=" + next_seq(); query = query + "&omode=flc"; @@ -487,7 +487,7 @@ function catchupFeed(feed, is_cat) { return; } - var catchup_query = "?op=rpc&subop=catchupFeed&feed_id=" + + var catchup_query = "?op=rpc&method=catchupFeed&feed_id=" + feed + "&is_cat=" + is_cat; notify_progress("Loading, please wait...", true); diff --git a/js/functions.js b/js/functions.js index 02fbadf53..69406f3e1 100644 --- a/js/functions.js +++ b/js/functions.js @@ -411,7 +411,7 @@ function displayDlg(id, param, callback) { notify_progress("Loading, please wait...", true); - var query = "?op=dlg&id=" + + var query = "?op=dlg&method=" + param_escape(id) + "¶m=" + param_escape(param); new Ajax.Request("backend.php", { @@ -607,7 +607,7 @@ function filterDlgCheckDate() { var reg_exp = dialog.attr('value').reg_exp; - var query = "?op=rpc&subop=checkDate&date=" + reg_exp; + var query = "?op=rpc&method=checkDate&date=" + reg_exp; new Ajax.Request("backend.php", { parameters: query, @@ -636,7 +636,7 @@ function explainError(code) { function displayHelpInfobox(topic_id) { - var url = "backend.php?op=help&tid=" + param_escape(topic_id); + var url = "backend.php?op=backend&method=help&tid=" + param_escape(topic_id); window.open(url, "ttrss_help", "status=0,toolbar=0,location=0,width=450,height=500,scrollbars=1,menubar=0"); @@ -756,7 +756,7 @@ function removeFeedIcon(id) { try { if (confirm(__("Remove stored feed icon?"))) { - var query = "backend.php?op=pref-feeds&subop=removeicon&feed_id=" + param_escape(id); + var query = "backend.php?op=pref-feeds&method=removeicon&feed_id=" + param_escape(id); console.log(query); @@ -815,7 +815,7 @@ function addLabel(select, callback) { return false; } - var query = "?op=pref-labels&subop=add&caption=" + + var query = "?op=pref-labels&method=add&caption=" + param_escape(caption); if (select) @@ -846,7 +846,7 @@ function addLabel(select, callback) { function quickAddFeed() { try { - var query = "backend.php?op=dlg&id=quickAddFeed"; + var query = "backend.php?op=dlg&method=quickAddFeed"; if (dijit.byId("feedAddDlg")) dijit.byId("feedAddDlg").destroyRecursive(); @@ -893,7 +893,7 @@ function quickAddFeed() { notify_progress("Searching for feed urls...", true); new Ajax.Request("backend.php", { - parameters: 'op=rpc&subop=extractfeedurls&url=' + param_escape(feed_url), + parameters: 'op=rpc&method=extractfeedurls&url=' + param_escape(feed_url), onComplete: function(transport, dialog, feed_url) { notify(''); @@ -948,7 +948,7 @@ function quickAddFeed() { function quickAddFilter() { try { - var query = "backend.php?op=dlg&id=quickAddFilter"; + var query = "backend.php?op=dlg&method=quickAddFilter"; if (dijit.byId("filterEditDlg")) dijit.byId("filterEditDlg").destroyRecursive(); @@ -978,7 +978,7 @@ function quickAddFilter() { execute: function() { if (this.validate()) { - var query = "?op=rpc&subop=verifyRegexp®_exp=" + + var query = "?op=rpc&method=verifyRegexp®_exp=" + param_escape(dialog.attr('value').reg_exp); notify_progress("Verifying regular expression..."); @@ -1028,7 +1028,7 @@ function resetPubSub(feed_id, title) { if (title == undefined || confirm(msg)) { notify_progress("Loading, please wait..."); - var query = "?op=pref-feeds&quiet=1&subop=resetPubSub&ids=" + feed_id; + var query = "?op=pref-feeds&quiet=1&method=resetPubSub&ids=" + feed_id; new Ajax.Request("backend.php", { parameters: query, @@ -1049,7 +1049,7 @@ function unsubscribeFeed(feed_id, title) { if (title == undefined || confirm(msg)) { notify_progress("Removing feed..."); - var query = "?op=pref-feeds&quiet=1&subop=remove&ids=" + feed_id; + var query = "?op=pref-feeds&quiet=1&method=remove&ids=" + feed_id; new Ajax.Request("backend.php", { parameters: query, @@ -1155,7 +1155,7 @@ function quickAddCat(elem) { if (cat) { - var query = "?op=rpc&subop=quickAddCat&cat=" + param_escape(cat); + var query = "?op=rpc&method=quickAddCat&cat=" + param_escape(cat); notify_progress("Loading, please wait...", true); @@ -1188,7 +1188,7 @@ function genUrlChangeKey(feed, is_cat) { notify_progress("Trying to change address...", true); - var query = "?op=rpc&subop=regenFeedKey&id=" + param_escape(feed) + + var query = "?op=rpc&method=regenFeedKey&id=" + param_escape(feed) + "&is_cat=" + param_escape(is_cat); new Ajax.Request("backend.php", { @@ -1368,7 +1368,7 @@ function editFeed(feed, event) { if (feed <= 0) return alert(__("You can't edit this kind of feed.")); - var query = "backend.php?op=pref-feeds&subop=editfeed&id=" + + var query = "backend.php?op=pref-feeds&method=editfeed&id=" + param_escape(feed); console.log(query); @@ -1406,7 +1406,7 @@ function editFeed(feed, event) { function feedBrowser() { try { - var query = "backend.php?op=dlg&id=feedBrowser"; + var query = "backend.php?op=dlg&method=feedBrowser"; if (dijit.byId("feedAddDlg")) dijit.byId("feedAddDlg").hide(); @@ -1464,7 +1464,7 @@ function feedBrowser() { // we use dojo.toJson instead of JSON.stringify because // it somehow escapes everything TWICE, at least in Chrome 9 - var query = "?op=rpc&subop=massSubscribe&payload="+ + var query = "?op=rpc&method=massSubscribe&payload="+ param_escape(dojo.toJson(selected)) + "&mode=" + param_escape(mode); console.log(query); @@ -1524,7 +1524,7 @@ function feedBrowser() { if (confirm(pr)) { Element.show('feed_browser_spinner'); - var query = "?op=rpc&subop=remarchived&ids=" + + var query = "?op=rpc&method=remarchived&ids=" + param_escape(selected.toString());; new Ajax.Request("backend.php", { @@ -1551,7 +1551,7 @@ function feedBrowser() { function showFeedsWithErrors() { try { - var query = "backend.php?op=dlg&id=feedsWithErrors"; + var query = "backend.php?op=dlg&method=feedsWithErrors"; if (dijit.byId("errorFeedsDlg")) dijit.byId("errorFeedsDlg").destroyRecursive(); @@ -1574,7 +1574,7 @@ function showFeedsWithErrors() { if (ok) { notify_progress("Removing selected feeds...", true); - var query = "?op=pref-feeds&subop=remove&ids="+ + var query = "?op=pref-feeds&method=remove&ids="+ param_escape(sel_rows.toString()); new Ajax.Request("backend.php", { diff --git a/js/prefs.js b/js/prefs.js index e40d6d723..896a787c6 100644 --- a/js/prefs.js +++ b/js/prefs.js @@ -5,62 +5,8 @@ var hotkey_prefix_pressed = false; var seq = ""; -function instancelist_callback2(transport) { - try { - dijit.byId('instanceConfigTab').attr('content', transport.responseText); - selectTab("instanceConfig", true); - notify(""); - } catch (e) { - exception_error("instancelist_callback2", e); - } -} - -function feedlist_callback2(transport) { - try { - dijit.byId('feedConfigTab').attr('content', transport.responseText); - selectTab("feedConfig", true); - notify(""); - } catch (e) { - exception_error("feedlist_callback2", e); - } -} - -function filterlist_callback2(transport) { - dijit.byId('filterConfigTab').attr('content', transport.responseText); - notify(""); -} - -function labellist_callback2(transport) { - try { - dijit.byId('labelConfigTab').attr('content', transport.responseText); - notify(""); - } catch (e) { - exception_error("labellist_callback2", e); - } -} - -function userlist_callback2(transport) { - try { - dijit.byId('userConfigTab').attr('content', transport.responseText); - - notify(""); - } catch (e) { - exception_error("userlist_callback2", e); - } -} - -function prefslist_callback2(transport) { - try { - dijit.byId('genConfigTab').attr('content', transport.responseText); - - notify(""); - } catch (e) { - exception_error("prefslist_callback2", e); - } -} - -function notify_callback2(transport) { - notify_info(transport.responseText); +function notify_callback2(transport, sticky) { + notify_info(transport.responseText, sticky); } function updateFeedList(sort_key) { @@ -72,7 +18,9 @@ function updateFeedList(sort_key) { new Ajax.Request("backend.php", { parameters: "?op=pref-feeds&search=" + param_escape(search), onComplete: function(transport) { - feedlist_callback2(transport); + dijit.byId('feedConfigTab').attr('content', transport.responseText); + selectTab("feedConfig", true); + notify(""); } }); } @@ -80,14 +28,14 @@ function updateInstanceList(sort_key) { new Ajax.Request("backend.php", { parameters: "?op=pref-instances&sort=" + param_escape(sort_key), onComplete: function(transport) { - instancelist_callback2(transport); + dijit.byId('instanceConfigTab').attr('content', transport.responseText); + selectTab("instanceConfig", true); + notify(""); } }); } function updateUsersList(sort_key) { - try { - var user_search = $("user_search"); var search = ""; if (user_search) { search = user_search.value; } @@ -99,7 +47,9 @@ function updateUsersList(sort_key) { new Ajax.Request("backend.php", { parameters: query, onComplete: function(transport) { - userlist_callback2(transport); + dijit.byId('userConfigTab').attr('content', transport.responseText); + selectTab("userConfig", true) + notify(""); } }); } catch (e) { @@ -124,13 +74,14 @@ function addUser() { notify_progress("Adding user..."); - var query = "?op=pref-users&subop=add&login=" + + var query = "?op=pref-users&method=add&login=" + param_escape(login); new Ajax.Request("backend.php", { parameters: query, onComplete: function(transport) { - userlist_callback2(transport); + notify_callback2(transport); + updateUsersList(); } }); } catch (e) { @@ -148,7 +99,7 @@ function editUser(id, event) { selectTableRows('prefUserList', 'none'); selectTableRowById('UMRR-'+id, 'UMCHK-'+id, true); - var query = "?op=pref-users&subop=edit&id=" + + var query = "?op=pref-users&method=edit&id=" + param_escape(id); new Ajax.Request("backend.php", { @@ -173,7 +124,7 @@ function editUser(id, event) { function editFilter(id) { try { - var query = "backend.php?op=pref-filters&subop=edit&id=" + param_escape(id); + var query = "backend.php?op=pref-filters&method=edit&id=" + param_escape(id); if (dijit.byId("filterEditDlg")) dijit.byId("filterEditDlg").destroyRecursive(); @@ -193,7 +144,7 @@ function editFilter(id) { var id = this.attr('value').id; - var query = "?op=pref-filters&subop=remove&ids="+ + var query = "?op=pref-filters&method=remove&ids="+ param_escape(id); new Ajax.Request("backend.php", { @@ -224,7 +175,7 @@ function editFilter(id) { execute: function() { if (this.validate()) { - var query = "?op=rpc&subop=verifyRegexp®_exp=" + + var query = "?op=rpc&method=verifyRegexp®_exp=" + param_escape(dialog.attr('value').reg_exp); notify_progress("Verifying regular expression..."); @@ -323,13 +274,13 @@ function removeSelectedLabels() { if (ok) { notify_progress("Removing selected labels..."); - var query = "?op=pref-labels&subop=remove&ids="+ + var query = "?op=pref-labels&method=remove&ids="+ param_escape(sel_rows.toString()); new Ajax.Request("backend.php", { parameters: query, onComplete: function(transport) { - labellist_callback2(transport); + updateLabelList(); } }); } @@ -353,13 +304,13 @@ function removeSelectedUsers() { if (ok) { notify_progress("Removing selected users..."); - var query = "?op=pref-users&subop=remove&ids="+ + var query = "?op=pref-users&method=remove&ids="+ param_escape(sel_rows.toString()); new Ajax.Request("backend.php", { parameters: query, onComplete: function(transport) { - userlist_callback2(transport); + updateUsersList(); } }); } @@ -388,7 +339,7 @@ function removeSelectedFilters() { if (ok) { notify_progress("Removing selected filters..."); - var query = "?op=pref-filters&subop=remove&ids="+ + var query = "?op=pref-filters&method=remove&ids="+ param_escape(sel_rows.toString()); new Ajax.Request("backend.php", { @@ -423,7 +374,7 @@ function removeSelectedFeeds() { notify_progress("Unsubscribing from selected feeds...", true); - var query = "?op=pref-feeds&subop=remove&ids="+ + var query = "?op=pref-feeds&method=remove&ids="+ param_escape(sel_rows.toString()); console.log(query); @@ -484,7 +435,7 @@ function purgeSelectedFeeds() { if (pr != undefined) { notify_progress("Purging selected feed..."); - var query = "?op=rpc&subop=purge&ids="+ + var query = "?op=rpc&method=purge&ids="+ param_escape(sel_rows.toString()) + "&days=" + pr; console.log(query); @@ -530,7 +481,7 @@ function userEditSave() { new Ajax.Request("backend.php", { parameters: query, onComplete: function(transport) { - userlist_callback2(transport); + updateUsersList(); } }); } catch (e) { @@ -583,13 +534,13 @@ function resetSelectedUserPass() { var id = rows[0]; - var query = "?op=pref-users&subop=resetPass&id=" + + var query = "?op=pref-users&method=resetPass&id=" + param_escape(id); new Ajax.Request("backend.php", { parameters: query, onComplete: function(transport) { - userlist_callback2(transport); + notify_info(transport.responseText); } }); } @@ -619,7 +570,7 @@ function selectedUserDetails() { var id = rows[0]; - var query = "?op=pref-users&subop=user-details&id=" + id; + var query = "?op=pref-users&method=userdetails&id=" + id; new Ajax.Request("backend.php", { parameters: query, @@ -682,7 +633,7 @@ function editSelectedFeeds() { notify_progress("Loading, please wait..."); - var query = "backend.php?op=pref-feeds&subop=editfeeds&ids=" + + var query = "backend.php?op=pref-feeds&method=editfeeds&ids=" + param_escape(rows.toString()); console.log(query); @@ -843,7 +794,8 @@ function updateFilterList() { new Ajax.Request("backend.php", { parameters: "?op=pref-filters", onComplete: function(transport) { - filterlist_callback2(transport); + dijit.byId('filterConfigTab').attr('content', transport.responseText); + notify(""); } }); } @@ -851,7 +803,8 @@ function updateLabelList() { new Ajax.Request("backend.php", { parameters: "?op=pref-labels", onComplete: function(transport) { - labellist_callback2(transport); + dijit.byId('labelConfigTab').attr('content', transport.responseText); + notify(""); } }); } @@ -859,11 +812,12 @@ function updatePrefsList() { new Ajax.Request("backend.php", { parameters: "?op=pref-prefs", onComplete: function(transport) { - prefslist_callback2(transport); + dijit.byId('genConfigTab').attr('content', transport.responseText); + notify(""); } }); } -function selectTab(id, noupdate, subop) { +function selectTab(id, noupdate, method) { try { if (!noupdate) { notify_progress("Loading, please wait..."); @@ -905,10 +859,10 @@ function init_second_stage() { if (tab) dijit.byId("pref-tabs").selectChild(tab); } - var subop = getURLParam('subop'); + var method = getURLParam('method'); - if (subop == 'editFeed') { - var param = getURLParam('subopparam'); + if (method == 'editFeed') { + var param = getURLParam('methodparam'); window.setTimeout('editFeed(' + param + ')', 100); } @@ -938,7 +892,7 @@ function init() { loading_set_progress(50); new Ajax.Request("backend.php", { - parameters: {op: "rpc", subop: "sanityCheck"}, + parameters: {op: "rpc", method: "sanityCheck"}, onComplete: function(transport) { backend_sanity_check_callback(transport); } }); @@ -955,7 +909,7 @@ function validatePrefsReset() { if (ok) { - query = "?op=pref-prefs&subop=reset-config"; + query = "?op=pref-prefs&method=resetconfig"; console.log(query); new Ajax.Request("backend.php", { @@ -1160,7 +1114,7 @@ function pref_hotkey_handler(e) { function editFeedCats() { try { - var query = "backend.php?op=pref-feeds&subop=editCats"; + var query = "backend.php?op=pref-feeds&method=editCats"; if (dijit.byId("feedCatEditDlg")) dijit.byId("feedCatEditDlg").destroyRecursive(); @@ -1181,7 +1135,7 @@ function editFeedCats() { if (ok) { notify_progress("Removing selected categories...", true); - var query = "?op=pref-feeds&subop=editCats&action=remove&ids="+ + var query = "?op=pref-feeds&method=editCats&action=remove&ids="+ param_escape(sel_rows.toString()); new Ajax.Request("backend.php", { @@ -1202,7 +1156,7 @@ function editFeedCats() { if (this.validate()) { notify_progress("Creating category..."); - var query = "?op=pref-feeds&subop=editCats&action=add&cat=" + + var query = "?op=pref-feeds&method=editCats&action=add&cat=" + param_escape(this.attr('value').newcat); new Ajax.Request("backend.php", { @@ -1229,7 +1183,7 @@ function editFeedCats() { function showInactiveFeeds() { try { - var query = "backend.php?op=dlg&id=inactiveFeeds"; + var query = "backend.php?op=dlg&method=inactiveFeeds"; if (dijit.byId("inactiveFeedsDlg")) dijit.byId("inactiveFeedsDlg").destroyRecursive(); @@ -1252,7 +1206,7 @@ function showInactiveFeeds() { if (ok) { notify_progress("Removing selected feeds...", true); - var query = "?op=pref-feeds&subop=remove&ids="+ + var query = "?op=pref-feeds&method=remove&ids="+ param_escape(sel_rows.toString()); new Ajax.Request("backend.php", { @@ -1291,7 +1245,7 @@ function opmlRegenKey() { notify_progress("Trying to change address...", true); - var query = "?op=rpc&subop=regenOPMLKey"; + var query = "?op=rpc&method=regenOPMLKey"; new Ajax.Request("backend.php", { parameters: query, @@ -1376,7 +1330,7 @@ function clearFeedArticles(feed_id) { notify_progress("Clearing feed..."); - var query = "?op=pref-feeds&quiet=1&subop=clear&id=" + feed_id; + var query = "?op=pref-feeds&quiet=1&method=clear&id=" + feed_id; new Ajax.Request("backend.php", { parameters: query, @@ -1399,7 +1353,7 @@ function rescoreSelectedFeeds() { if (ok) { notify_progress("Rescoring selected feeds...", true); - var query = "?op=pref-feeds&subop=rescore&quiet=1&ids="+ + var query = "?op=pref-feeds&method=rescore&quiet=1&ids="+ param_escape(sel_rows.toString()); new Ajax.Request("backend.php", { @@ -1422,7 +1376,7 @@ function rescore_all_feeds() { if (ok) { notify_progress("Rescoring feeds...", true); - var query = "?op=pref-feeds&subop=rescoreAll&quiet=1"; + var query = "?op=pref-feeds&method=rescoreAll&quiet=1"; new Ajax.Request("backend.php", { parameters: query, @@ -1440,13 +1394,13 @@ function labelColorReset() { var ok = confirm(__("Reset selected labels to default colors?")); if (ok) { - var query = "?op=pref-labels&subop=color-reset&ids="+ + var query = "?op=pref-labels&method=colorreset&ids="+ param_escape(labels.toString()); new Ajax.Request("backend.php", { parameters: query, onComplete: function(transport) { - labellist_callback2(transport); + updateLabelList(); } }); } @@ -1470,7 +1424,7 @@ function editProfiles() { if (dijit.byId("profileEditDlg")) dijit.byId("profileEditDlg").destroyRecursive(); - var query = "backend.php?op=dlg&id=editPrefProfiles"; + var query = "backend.php?op=dlg&method=editPrefProfiles"; dialog = new dijit.Dialog({ id: "profileEditDlg", @@ -1488,7 +1442,7 @@ function editProfiles() { if (ok) { notify_progress("Removing selected profiles...", true); - var query = "?op=rpc&subop=remprofiles&ids="+ + var query = "?op=rpc&method=remprofiles&ids="+ param_escape(sel_rows.toString()); new Ajax.Request("backend.php", { @@ -1514,7 +1468,7 @@ function editProfiles() { if (ok) { notify_progress("Loading, please wait..."); - var query = "?op=rpc&subop=setprofile&id="+ + var query = "?op=rpc&method=setprofile&id="+ param_escape(sel_rows.toString()); new Ajax.Request("backend.php", { @@ -1532,7 +1486,7 @@ function editProfiles() { if (this.validate()) { notify_progress("Creating profile...", true); - var query = "?op=rpc&subop=addprofile&title=" + + var query = "?op=rpc&method=addprofile&title=" + param_escape(dialog.attr('value').newprofile); new Ajax.Request("backend.php", { @@ -1567,7 +1521,7 @@ function activatePrefProfile() { if (ok) { notify_progress("Loading, please wait..."); - var query = "?op=rpc&subop=setprofile&id="+ + var query = "?op=rpc&method=setprofile&id="+ param_escape(sel_rows.toString()); new Ajax.Request("backend.php", { @@ -1591,7 +1545,7 @@ function clearFeedAccessKeys() { if (ok) { notify_progress("Clearing URLs..."); - var query = "?op=rpc&subop=clearKeys"; + var query = "?op=rpc&method=clearKeys"; new Ajax.Request("backend.php", { parameters: query, @@ -1610,7 +1564,7 @@ function clearArticleAccessKeys() { if (ok) { notify_progress("Clearing URLs..."); - var query = "?op=rpc&subop=clearArticleKeys"; + var query = "?op=rpc&method=clearArticleKeys"; new Ajax.Request("backend.php", { parameters: query, @@ -1626,7 +1580,7 @@ function resetFeedOrder() { notify_progress("Loading, please wait..."); new Ajax.Request("backend.php", { - parameters: "?op=pref-feeds&subop=feedsortreset", + parameters: "?op=pref-feeds&method=feedsortreset", onComplete: function(transport) { updateFeedList(); } }); @@ -1642,7 +1596,7 @@ function resetCatOrder() { notify_progress("Loading, please wait..."); new Ajax.Request("backend.php", { - parameters: "?op=pref-feeds&subop=catsortreset", + parameters: "?op=pref-feeds&method=catsortreset", onComplete: function(transport) { updateFeedList(); } }); @@ -1664,7 +1618,7 @@ function editCat(id, item, event) { new Ajax.Request("backend.php", { parameters: { op: 'pref-feeds', - subop: 'renamecat', + method: 'renamecat', id: id, title: new_name, }, @@ -1680,7 +1634,7 @@ function editCat(id, item, event) { function editLabel(id, event) { try { - var query = "backend.php?op=pref-labels&subop=edit&id=" + + var query = "backend.php?op=pref-labels&method=edit&id=" + param_escape(id); if (dijit.byId("labelEditDlg")) @@ -1705,7 +1659,7 @@ function editLabel(id, event) { color = bg; } - var query = "?op=pref-labels&subop=color-set&kind="+kind+ + var query = "?op=pref-labels&method=colorset&kind="+kind+ "&ids=" + param_escape(id) + "&fg=" + param_escape(fg) + "&bg=" + param_escape(bg) + "&color=" + param_escape(color); @@ -1756,7 +1710,7 @@ function clearTwitterCredentials() { if (ok) { notify_progress("Clearing credentials..."); - var query = "?op=pref-feeds&subop=remtwitterinfo"; + var query = "?op=pref-feeds&method=remtwitterinfo"; new Ajax.Request("backend.php", { parameters: query, @@ -1773,7 +1727,7 @@ function clearTwitterCredentials() { function customizeCSS() { try { - var query = "backend.php?op=dlg&id=customizeCSS"; + var query = "backend.php?op=dlg&method=customizeCSS"; if (dijit.byId("cssEditDlg")) dijit.byId("cssEditDlg").destroyRecursive(); @@ -1815,7 +1769,7 @@ function getSelectedInstances() { function addInstance() { try { - var query = "backend.php?op=dlg&id=addInstance"; + var query = "backend.php?op=dlg&method=addInstance"; if (dijit.byId("instanceAddDlg")) dijit.byId("instanceAddDlg").destroyRecursive(); @@ -1826,7 +1780,7 @@ function addInstance() { style: "width: 600px", regenKey: function() { new Ajax.Request("backend.php", { - parameters: "?op=rpc&subop=genHash", + parameters: "?op=rpc&method=genHash", onComplete: function(transport) { var reply = JSON.parse(transport.responseText); if (reply) @@ -1865,7 +1819,7 @@ function editInstance(id, event) { selectTableRows('prefInstanceList', 'none'); selectTableRowById('LIRR-'+id, 'LICHK-'+id, true); - var query = "backend.php?op=pref-instances&subop=edit&id=" + + var query = "backend.php?op=pref-instances&method=edit&id=" + param_escape(id); if (dijit.byId("instanceEditDlg")) @@ -1877,7 +1831,7 @@ function editInstance(id, event) { style: "width: 600px", regenKey: function() { new Ajax.Request("backend.php", { - parameters: "?op=rpc&subop=genHash", + parameters: "?op=rpc&method=genHash", onComplete: function(transport) { var reply = JSON.parse(transport.responseText); if (reply) @@ -1927,7 +1881,7 @@ function removeSelectedInstances() { if (ok) { notify_progress("Removing selected instances..."); - var query = "?op=pref-instances&subop=remove&ids="+ + var query = "?op=pref-instances&method=remove&ids="+ param_escape(sel_rows.toString()); new Ajax.Request("backend.php", { diff --git a/js/tt-rss.js b/js/tt-rss.js index 589091959..38232bdfe 100644 --- a/js/tt-rss.js +++ b/js/tt-rss.js @@ -82,7 +82,7 @@ function updateFeedList() { var cat_id = id.substr(id.indexOf(":")+1); new Ajax.Request("backend.php", - { parameters: "backend.php?op=feeds&subop=collapse&cid=" + + { parameters: "backend.php?op=feeds&method=collapse&cid=" + param_escape(cat_id) + "&mode=0" } ); }, onClose: function (item, node) { @@ -90,7 +90,7 @@ function updateFeedList() { var cat_id = id.substr(id.indexOf(":")+1); new Ajax.Request("backend.php", - { parameters: "backend.php?op=feeds&subop=collapse&cid=" + + { parameters: "backend.php?op=feeds&method=collapse&cid=" + param_escape(cat_id) + "&mode=1" } ); }, @@ -148,7 +148,7 @@ function catchupAllFeeds() { if (getInitParam("confirm_feed_catchup") != 1 || confirm(str)) { - var query_str = "backend.php?op=feeds&subop=catchupAll"; + var query_str = "backend.php?op=feeds&method=catchupAll"; notify_progress("Marking all feeds as read..."); @@ -165,10 +165,10 @@ function catchupAllFeeds() { } } -function viewCurrentFeed(subop) { +function viewCurrentFeed(method) { if (getActiveFeedId() != undefined) { - viewfeed(getActiveFeedId(), subop, activeFeedIsCat()); + viewfeed(getActiveFeedId(), method, activeFeedIsCat()); } return false; // block unneeded form submits } @@ -186,7 +186,7 @@ function timeout() { window.clearTimeout(counter_timeout_id); - var query_str = "?op=rpc&subop=getAllCounters&seq=" + next_seq(); + var query_str = "?op=rpc&method=getAllCounters&seq=" + next_seq(); var omode; @@ -222,7 +222,7 @@ function timeout() { } function search() { - var query = "backend.php?op=dlg&id=search¶m=" + + var query = "backend.php?op=dlg&method=search¶m=" + param_escape(getActiveFeedId() + ":" + activeFeedIsCat()); if (dijit.byId("searchDlg")) @@ -302,7 +302,7 @@ function init() { var hasAudio = !!((myAudioTag = document.createElement('audio')).canPlayType); new Ajax.Request("backend.php", { - parameters: {op: "rpc", subop: "sanityCheck", hasAudio: hasAudio}, + parameters: {op: "rpc", method: "sanityCheck", hasAudio: hasAudio}, onComplete: function(transport) { backend_sanity_check_callback(transport); } }); @@ -436,7 +436,7 @@ function quickMenuGo(opid) { dialog = new dijit.Dialog({ title: __("About..."), style: "width: 400px", - href: "backend.php?op=dlg&id=about", + href: "backend.php?op=dlg&method=about", }); dialog.show(); @@ -454,7 +454,7 @@ function toggleDispRead() { hideOrShowFeeds(hide); - var query = "?op=rpc&subop=setpref&key=HIDE_READ_FEEDS&value=" + + var query = "?op=rpc&method=setpref&key=HIDE_READ_FEEDS&value=" + param_escape(hide); setInitParam("hide_read_feeds", hide); @@ -555,7 +555,7 @@ function collapse_feedlist() { dijit.byId("main").resize(); - query = "?op=rpc&subop=setpref&key=_COLLAPSED_FEEDLIST&value=true"; + query = "?op=rpc&method=setpref&key=_COLLAPSED_FEEDLIST&value=true"; new Ajax.Request("backend.php", { parameters: query }); } catch (e) { @@ -577,7 +577,7 @@ function viewLimitChanged() { var pr = prompt(__("Assign score to article:"), score); if (pr != undefined) { - var query = "?op=rpc&subop=setScore&id=" + id + "&score=" + pr; + var query = "?op=rpc&method=setScore&id=" + id + "&score=" + pr; new Ajax.Request("backend.php", { parameters: query, @@ -611,7 +611,7 @@ function rescoreCurrentFeed() { if (confirm(pr)) { notify_progress("Rescoring articles..."); - var query = "?op=pref-feeds&subop=rescore&quiet=1&ids=" + actid; + var query = "?op=pref-feeds&method=rescore&quiet=1&ids=" + actid; new Ajax.Request("backend.php", { parameters: query, @@ -1024,7 +1024,7 @@ function inPreferences() { function reverseHeadlineOrder() { try { - var query_str = "?op=rpc&subop=togglepref&key=REVERSE_HEADLINES"; + var query_str = "?op=rpc&method=togglepref&key=REVERSE_HEADLINES"; new Ajax.Request("backend.php", { parameters: query_str, @@ -1049,7 +1049,7 @@ function scheduleFeedUpdate(id, is_cat) { return; } - var query = "?op=rpc&subop=scheduleFeedUpdate&id=" + + var query = "?op=rpc&method=scheduleFeedUpdate&id=" + param_escape(id) + "&is_cat=" + param_escape(is_cat); @@ -1078,7 +1078,7 @@ function scheduleFeedUpdate(id, is_cat) { function newVersionDlg() { try { - var query = "backend.php?op=dlg&id=newVersion"; + var query = "backend.php?op=dlg&method=newVersion"; if (dijit.byId("newVersionDlg")) dijit.byId("newVersionDlg").destroyRecursive(); diff --git a/js/viewfeed.js b/js/viewfeed.js index 9cb902315..d267c7693 100644 --- a/js/viewfeed.js +++ b/js/viewfeed.js @@ -322,7 +322,7 @@ function view(id) { hideAuxDlg(); - var query = "?op=view&id=" + param_escape(id); + var query = "?op=article&method=view&id=" + param_escape(id); var neighbor_ids = getRelativePostIds(id); @@ -406,7 +406,7 @@ function view(id) { function toggleMark(id, client_only) { try { - var query = "?op=rpc&id=" + id + "&subop=mark"; + var query = "?op=rpc&id=" + id + "&method=mark"; var img = $("FMPIC-" + id); @@ -440,7 +440,7 @@ function toggleMark(id, client_only) { function togglePub(id, client_only, no_effects, note) { try { - var query = "?op=rpc&id=" + id + "&subop=publ"; + var query = "?op=rpc&id=" + id + "&method=publ"; if (note != undefined) { query = query + "¬e=" + param_escape(note); @@ -601,7 +601,7 @@ function toggleUnread(id, cmode, effect) { if (cmode == undefined) cmode = 2; - var query = "?op=rpc&subop=catchupSelected" + + var query = "?op=rpc&method=catchupSelected" + "&cmode=" + param_escape(cmode) + "&ids=" + param_escape(id); // notify_progress("Loading, please wait..."); @@ -629,7 +629,7 @@ function selectionRemoveLabel(id, ids) { return; } - var query = "?op=rpc&subop=removeFromLabel&ids=" + + var query = "?op=rpc&method=removeFromLabel&ids=" + param_escape(ids.toString()) + "&lid=" + param_escape(id); console.log(query); @@ -657,7 +657,7 @@ function selectionAssignLabel(id, ids) { return; } - var query = "?op=rpc&subop=assignToLabel&ids=" + + var query = "?op=rpc&method=assignToLabel&ids=" + param_escape(ids.toString()) + "&lid=" + param_escape(id); console.log(query); @@ -717,7 +717,7 @@ function selectionToggleUnread(set_state, callback, no_error) { cmode = "0"; } - var query = "?op=rpc&subop=catchupSelected" + + var query = "?op=rpc&method=catchupSelected" + "&cmode=" + cmode + "&ids=" + param_escape(rows.toString()); notify_progress("Loading, please wait..."); @@ -752,7 +752,7 @@ function selectionToggleMarked() { if (rows.length > 0) { - var query = "?op=rpc&subop=markSelected&ids=" + + var query = "?op=rpc&method=markSelected&ids=" + param_escape(rows.toString()) + "&cmode=2"; new Ajax.Request("backend.php", { @@ -784,7 +784,7 @@ function selectionTogglePublished() { if (rows.length > 0) { - var query = "?op=rpc&subop=publishSelected&ids=" + + var query = "?op=rpc&method=publishSelected&ids=" + param_escape(rows.toString()) + "&cmode=2"; new Ajax.Request("backend.php", { @@ -910,7 +910,7 @@ function deleteSelection() { return; } - query = "?op=rpc&subop=delete&ids=" + param_escape(rows); + query = "?op=rpc&method=delete&ids=" + param_escape(rows); console.log(query); @@ -956,7 +956,7 @@ function archiveSelection() { return; } - query = "?op=rpc&subop="+op+"&ids=" + param_escape(rows); + query = "?op=rpc&method="+op+"&ids=" + param_escape(rows); console.log(query); @@ -1006,7 +1006,7 @@ function catchupSelection() { } function editArticleTags(id) { - var query = "backend.php?op=dlg&id=editArticleTags¶m=" + param_escape(id); + var query = "backend.php?op=dlg&method=editArticleTags¶m=" + param_escape(id); if (dijit.byId("editTagsDlg")) dijit.byId("editTagsDlg").destroyRecursive(); @@ -1052,7 +1052,7 @@ function editArticleTags(id) { dojo.disconnect(tmph); new Ajax.Autocompleter('tags_str', 'tags_choices', - "backend.php?op=rpc&subop=completeTags", + "backend.php?op=rpc&method=completeTags", { tokens: ',', paramName: "search" }); }); @@ -1141,7 +1141,7 @@ function catchupBatchedArticles() { try { if (catchup_id_batch.length > 0 && !_infscroll_request_sent) { - var query = "?op=rpc&subop=catchupSelected" + + var query = "?op=rpc&method=catchupSelected" + "&cmode=0&ids=" + param_escape(catchup_id_batch.toString()); new Ajax.Request("backend.php", { @@ -1216,7 +1216,7 @@ function catchupRelativeToArticle(below, id) { e.removeClassName("Unread"); } - var query = "?op=rpc&subop=catchupSelected" + + var query = "?op=rpc&method=catchupSelected" + "&cmode=0" + "&ids=" + param_escape(ids_to_mark.toString()); new Ajax.Request("backend.php", { @@ -1275,7 +1275,7 @@ function cdmExpandArticle(id) { $("CWRAP-" + id).innerHTML = "<div class=\"insensitive\">" + __("Loading, please wait...") + "</div>"; - var query = "?op=rpc&subop=cdmGetArticle&id=" + param_escape(id); + var query = "?op=rpc&method=cdmGetArticle&id=" + param_escape(id); var neighbor_ids = getRelativePostIds(id); @@ -1386,7 +1386,7 @@ function zoomToArticle(event, id) { } else { - var query = "?op=rpc&subop=getArticles&ids=" + param_escape(id); + var query = "?op=rpc&method=getArticles&ids=" + param_escape(id); notify_progress("Loading, please wait...", true); @@ -1514,7 +1514,7 @@ function emailArticle(id) { if (dijit.byId("emailArticleDlg")) dijit.byId("emailArticleDlg").destroyRecursive(); - var query = "backend.php?op=dlg&id=emailArticle¶m=" + param_escape(id); + var query = "backend.php?op=dlg&method=emailArticle¶m=" + param_escape(id); dialog = new dijit.Dialog({ id: "emailArticleDlg", @@ -1547,7 +1547,7 @@ function emailArticle(id) { dojo.disconnect(tmph); new Ajax.Autocompleter('emailArticleDlg_destination', 'emailArticleDlg_dst_choices', - "backend.php?op=rpc&subop=completeEmails", + "backend.php?op=rpc&method=completeEmails", { tokens: '', paramName: "search" }); }); @@ -1558,7 +1558,7 @@ function emailArticle(id) { document.forms['article_email_form'].destination.focus(); new Ajax.Autocompleter('destination', 'destination_choices', - "backend.php?op=rpc&subop=completeEmails", + "backend.php?op=rpc&method=completeEmails", { tokens: '', paramName: "search" }); }); */ @@ -1685,7 +1685,7 @@ function cdmClicked(event, id) { active_post_id = id; - var query = "?op=rpc&subop=catchupSelected" + + var query = "?op=rpc&method=catchupSelected" + "&cmode=0&ids=" + param_escape(id); new Ajax.Request("backend.php", { @@ -1770,7 +1770,7 @@ function getLastVisibleHeadlineId() { function openArticleInNewWindow(id) { toggleUnread(id, 0, false); - window.open("backend.php?op=la&id=" + id); + window.open("backend.php?op=article&method=redirect&id=" + id); } function isCdmMode() { @@ -1996,14 +1996,14 @@ function initHeadlinesMenu() { function tweetArticle(id) { try { - var query = "?op=rpc&subop=getTweetInfo&id=" + param_escape(id); + var query = "?op=rpc&method=getTweetInfo&id=" + param_escape(id); console.log(query); var d = new Date(); var ts = d.getTime(); - var w = window.open('backend.php?op=loading', 'ttrss_tweet', + var w = window.open('backend.php?op=backend&method=loading', 'ttrss_tweet', "status=0,toolbar=0,location=0,width=500,height=400,scrollbars=1,menubar=0"); new Ajax.Request("backend.php", { @@ -2028,7 +2028,7 @@ function tweetArticle(id) { function editArticleNote(id) { try { - var query = "backend.php?op=dlg&id=editArticleNote¶m=" + param_escape(id); + var query = "backend.php?op=dlg&method=editArticleNote¶m=" + param_escape(id); if (dijit.byId("editNoteDlg")) dijit.byId("editNoteDlg").destroyRecursive(); @@ -2227,7 +2227,7 @@ function shareArticle(id) { if (dijit.byId("shareArticleDlg")) dijit.byId("shareArticleDlg").destroyRecursive(); - var query = "backend.php?op=dlg&id=shareArticle¶m=" + param_escape(id); + var query = "backend.php?op=dlg&method=shareArticle¶m=" + param_escape(id); dialog = new dijit.Dialog({ id: "shareArticleDlg", |