From: Andrew Dolgov Date: Mon, 1 Apr 2013 07:14:27 +0000 (+0400) Subject: move several methods from dlg; fix displayed tags not updated after editing X-Git-Tag: 1.7.6~80 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=1c9bda915bb8a734af27cc3a2d2dd1cc16f2d5fd;p=tt-rss.git move several methods from dlg; fix displayed tags not updated after editing --- diff --git a/classes/article.php b/classes/article.php index b10766bf..79c94f59 100644 --- a/classes/article.php +++ b/classes/article.php @@ -2,7 +2,7 @@ class Article extends Handler_Protected { function csrf_ignore($method) { - $csrf_ignored = array("redirect"); + $csrf_ignored = array("redirect", "editarticletags"); return array_search($method, $csrf_ignored) !== false; } @@ -174,6 +174,39 @@ class Article extends Handler_Protected { return $rc; } + function editArticleTags() { + + print __("Tags for this article (separated by commas):")."
"; + + $param = db_escape_string($this->link, $_REQUEST['param']); + + $tags = get_article_tags($this->link, db_escape_string($this->link, $param)); + + $tags_str = join(", ", $tags); + + print ""; + print ""; + print ""; + + print "
"; + + print " +
"; + + print "
"; + + print "
"; + + print " "; + print ""; + print "
"; + + } } diff --git a/classes/dlg.php b/classes/dlg.php index 90b0d6d6..75cbbd74 100644 --- a/classes/dlg.php +++ b/classes/dlg.php @@ -213,220 +213,6 @@ class Dlg extends Handler_Protected { //return; } - function quickAddFeed() { - print ""; - print ""; - - print "
".__("Feed or site URL")."
"; - print "
"; - - print "
-
"; - - print ""; - - print "
"; - - if (get_pref($this->link, 'ENABLE_FEED_CATS')) { - print __('Place in category:') . " "; - print_feed_cat_select($this->link, "cat", false, 'dojoType="dijit.form.Select"'); - } - - print "
"; - - print ''; - - print ""; - - - print "
- -
"; - - print ""; - - print "
- "; - - if (!(defined('_DISABLE_FEED_BROWSER') && _DISABLE_FEED_BROWSER)) { - print ""; - } - - print " -
"; - - //return; - } - - function feedBrowser() { - if (defined('_DISABLE_FEED_BROWSER') && _DISABLE_FEED_BROWSER) return; - - $browser_search = db_escape_string($this->link, $_REQUEST["search"]); - - print ""; - print ""; - - print "
-
- - - -
"; - - print " "; - - print __("limit:"); - - print " "; - - print "
"; - - $owner_uid = $_SESSION["uid"]; - - require_once "feedbrowser.php"; - - print ""; - - print "
- - -
"; - - } - - function search() { - $this->params = explode(":", db_escape_string($this->link, $_REQUEST["param"]), 2); - - $active_feed_id = sprintf("%d", $this->params[0]); - $is_cat = $this->params[1] != "false"; - - print "
".__('Look for')."
"; - - print "
"; - - print ""; - - print "
".__('Limit search to:')." "; - - print ""; - - print "
"; - - print "
"; - - if (!SPHINX_ENABLED) { - print "
- Search syntax -
"; - } - - print " - -
"; - } - - function editArticleTags() { - - print __("Tags for this article (separated by commas):")."
"; - - $tags = get_article_tags($this->link, $this->param); - - $tags_str = join(", ", $tags); - - print "param\">"; - print ""; - print ""; - - print "
"; - - print " -
"; - - print "
"; - - print "
"; - - print " "; - print ""; - print "
"; - - } - function printTagCloud() { print "
"; diff --git a/classes/feeds.php b/classes/feeds.php index a80ae4b3..d2df9410 100644 --- a/classes/feeds.php +++ b/classes/feeds.php @@ -4,7 +4,7 @@ require_once "colors.php"; class Feeds extends Handler_Protected { function csrf_ignore($method) { - $csrf_ignored = array("index"); + $csrf_ignored = array("index", "feedbrowser", "quickaddfeed", "search"); return array_search($method, $csrf_ignored) !== false; } @@ -968,5 +968,188 @@ class Feeds extends Handler_Protected { return $reply; } + function quickAddFeed() { + print ""; + print ""; + + print "
".__("Feed or site URL")."
"; + print "
"; + + print "
+
"; + + print ""; + + print "
"; + + if (get_pref($this->link, 'ENABLE_FEED_CATS')) { + print __('Place in category:') . " "; + print_feed_cat_select($this->link, "cat", false, 'dojoType="dijit.form.Select"'); + } + + print "
"; + + print ''; + + print ""; + + + print "
+ +
"; + + print ""; + + print "
+ "; + + if (!(defined('_DISABLE_FEED_BROWSER') && _DISABLE_FEED_BROWSER)) { + print ""; + } + + print " +
"; + + //return; + } + + function feedBrowser() { + if (defined('_DISABLE_FEED_BROWSER') && _DISABLE_FEED_BROWSER) return; + + $browser_search = db_escape_string($this->link, $_REQUEST["search"]); + + print ""; + print ""; + + print "
+
+ + + +
"; + + print " "; + + print __("limit:"); + + print " "; + + print "
"; + + $owner_uid = $_SESSION["uid"]; + + require_once "feedbrowser.php"; + + print ""; + + print "
+ + +
"; + + } + + function search() { + $this->params = explode(":", db_escape_string($this->link, $_REQUEST["param"]), 2); + + $active_feed_id = sprintf("%d", $this->params[0]); + $is_cat = $this->params[1] != "false"; + + print "
".__('Look for')."
"; + + print "
"; + + print ""; + + print "
".__('Limit search to:')." "; + + print ""; + + print "
"; + + print "
"; + + if (!SPHINX_ENABLED) { + print "
+ Search syntax +
"; + } + + print " + +
"; + } + + } ?> diff --git a/classes/rpc.php b/classes/rpc.php index 3a20db6f..34f623b0 100644 --- a/classes/rpc.php +++ b/classes/rpc.php @@ -407,8 +407,8 @@ class RPC extends Handler_Protected { if (!$tags_str_full) $tags_str_full = __("no tags"); - print json_encode(array("tags_str" => array("id" => $id, - "content" => $tags_str, "content_full" => $tags_str_full))); + print json_encode(array("id" => (int)$id, + "content" => $tags_str, "content_full" => $tags_str_full)); } function regenOPMLKey() { diff --git a/js/functions.js b/js/functions.js index 987b9670..0b39cc46 100644 --- a/js/functions.js +++ b/js/functions.js @@ -830,7 +830,7 @@ function addLabel(select, callback) { function quickAddFeed() { try { - var query = "backend.php?op=dlg&method=quickAddFeed"; + var query = "backend.php?op=feeds&method=quickAddFeed"; // overlapping widgets if (dijit.byId("batchSubDlg")) dijit.byId("batchSubDlg").destroyRecursive(); @@ -1635,7 +1635,7 @@ function editFeed(feed, event) { function feedBrowser() { try { - var query = "backend.php?op=dlg&method=feedBrowser"; + var query = "backend.php?op=feeds&method=feedBrowser"; if (dijit.byId("feedAddDlg")) dijit.byId("feedAddDlg").hide(); diff --git a/js/tt-rss.js b/js/tt-rss.js index 80eacbac..51257a69 100644 --- a/js/tt-rss.js +++ b/js/tt-rss.js @@ -159,7 +159,7 @@ function timeout() { } function search() { - var query = "backend.php?op=dlg&method=search¶m=" + + var query = "backend.php?op=feeds&method=search¶m=" + param_escape(getActiveFeedId() + ":" + activeFeedIsCat()); if (dijit.byId("searchDlg")) diff --git a/js/viewfeed.js b/js/viewfeed.js index a163dda2..c24dec62 100644 --- a/js/viewfeed.js +++ b/js/viewfeed.js @@ -1067,7 +1067,7 @@ function catchupSelection() { } function editArticleTags(id) { - var query = "backend.php?op=dlg&method=editArticleTags¶m=" + param_escape(id); + var query = "backend.php?op=article&method=editArticleTags¶m=" + param_escape(id); if (dijit.byId("editTagsDlg")) dijit.byId("editTagsDlg").destroyRecursive(); @@ -1085,22 +1085,25 @@ function editArticleTags(id) { new Ajax.Request("backend.php", { parameters: query, onComplete: function(transport) { - notify(''); - dialog.hide(); + try { + notify(''); + dialog.hide(); - var data = JSON.parse(transport.responseText); + var data = JSON.parse(transport.responseText); - if (data) { - var tags_str = article.tags; - var id = tags_str.id; + if (data) { + var id = data.id; - var tags = $("ATSTR-" + id); - var tooltip = dijit.byId("ATSTRTIP-" + id); + console.log(id); - if (tags) tags.innerHTML = tags_str.content; - if (tooltip) tooltip.attr('label', tags_str.content_full); + var tags = $("ATSTR-" + id); + var tooltip = dijit.byId("ATSTRTIP-" + id); - cache_delete("article:" + id); + if (tags) tags.innerHTML = data.content; + if (tooltip) tooltip.attr('label', data.content_full); + } + } catch (e) { + exception_error("editArticleTags/inner", e); } }});