From: Andrew Dolgov Date: Tue, 23 Nov 2010 10:26:02 +0000 (+0300) Subject: refactor tags dialog X-Git-Tag: 1.5.0~58 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=8386f8614b1426869490adc9bfdb06344532eba3;p=tt-rss.git refactor tags dialog --- diff --git a/feedlist.js b/feedlist.js index 9270ea4b..4c430af5 100644 --- a/feedlist.js +++ b/feedlist.js @@ -83,7 +83,6 @@ function viewfeed(feed, subop, is_cat, offset) { } hideAuxDlg(); - closeInfoBox(); Form.enable("main_toolbar_form"); diff --git a/functions.js b/functions.js index 02e93eef..1b5bfaf4 100644 --- a/functions.js +++ b/functions.js @@ -41,10 +41,6 @@ function exception_error(location, e, ext_info) { content += "
Stack trace:
" + ""; -// content += "
" + -// "
"; - content += ""; // TODO: add code to automatically report errors to tt-rss.org @@ -490,62 +486,6 @@ function infobox_callback2(transport) { } } -function createFilter() { - - try { - - var form = document.forms['filter_add_form']; - var reg_exp = form.reg_exp.value; - - if (reg_exp == "") { - alert(__("Can't add filter: nothing to match on.")); - return false; - } - - var query = "?op=rpc&subop=verifyRegexp®_exp=" + param_escape(reg_exp); - - notify_progress("Verifying regular expression..."); - - new Ajax.Request("backend.php", { - parameters: query, - onComplete: function(transport) { - handle_rpc_reply(transport); - - var response = transport.responseXML; - - if (response) { - var s = response.getElementsByTagName("status")[0].firstChild.nodeValue; - - notify(''); - - if (s == "INVALID") { - alert("Match regular expression seems to be invalid."); - return; - } else { - - var query = Form.serialize("filter_add_form"); - - // we can be called from some other tab in Prefs - if (typeof active_tab != 'undefined' && active_tab) { - active_tab = "filterConfig"; - } - - new Ajax.Request("backend.php?" + query, { - onComplete: function (transport) { - infobox_submit_callback2(transport); - } }); - - return true; - } - } - - } }); - - } catch (e) { - exception_error("createFilter", e); - } -} - function filterCR(e, f) { var key; diff --git a/modules/popup-dialog.php b/modules/popup-dialog.php index 584f6e51..52b1f94f 100644 --- a/modules/popup-dialog.php +++ b/modules/popup-dialog.php @@ -569,10 +569,7 @@ if ($id == "editArticleTags") { - print "".__('Edit Tags').""; - print ""; +# print "
"; print __("Tags for this article (separated by commas):")."
"; @@ -580,28 +577,30 @@ $tags_str = join(", ", $tags); - print ""; + print ""; + print ""; + print ""; - print ""; + print "
"; - - print "
"; - print "
-
"; + style=\"display:none\">"; - print "
"; + print ""; - print "
"; +# print ""; - print " "; - print ""; + print "
"; - print "]]>"; + print " "; + print ""; + print "
"; - //return; } if ($id == "printTagCloud") { diff --git a/prefs.js b/prefs.js index 833a99d4..f83ff0d9 100644 --- a/prefs.js +++ b/prefs.js @@ -35,14 +35,9 @@ function filterlist_callback2(transport) { } function labellist_callback2(transport) { - try { - dijit.byId('labelConfigTab').attr('content', transport.responseText); - closeInfoBox(); - notify(""); - } catch (e) { exception_error("labellist_callback2", e); } @@ -850,7 +845,6 @@ function selectTab(id, noupdate, subop) { try { if (!noupdate) { notify_progress("Loading, please wait..."); - closeInfoBox(); if (id == "feedConfig") { updateFeedList(); diff --git a/tt-rss.js b/tt-rss.js index f3aad8c1..ccb24eca 100644 --- a/tt-rss.js +++ b/tt-rss.js @@ -636,7 +636,7 @@ function rescoreCurrentFeed() { function hotkey_handler(e) { try { - if (e.target.nodeName == "INPUT") return; + if (e.target.nodeName == "INPUT" || e.target.nodeName == "TEXTAREA") return; var keycode; var shift_key = false; diff --git a/viewfeed.js b/viewfeed.js index 7fe83b42..b276a3ef 100644 --- a/viewfeed.js +++ b/viewfeed.js @@ -1083,84 +1083,70 @@ function catchupSelection() { } } -function editArticleTags(id, feed_id, cdm_enabled) { - displayDlg('editArticleTags', id, +function editArticleTags(id) { +/* displayDlg('editArticleTags', id, function () { $("tags_str").focus(); new Ajax.Autocompleter('tags_str', 'tags_choices', "backend.php?op=rpc&subop=completeTags", { tokens: ',', paramName: "search" }); - }); -} - -function editTagsSave() { - - notify_progress("Saving article tags..."); + }); */ - var form = document.forms["tag_edit_form"]; + var query = "backend.php?op=dlg&id=editArticleTags¶m=" + param_escape(id); - var query = Form.serialize("tag_edit_form"); + if (dijit.byId("editTagsDlg")) + dijit.byId("editTagsDlg").destroyRecursive(); - query = "?op=rpc&subop=setArticleTags&" + query; + dialog = new dijit.Dialog({ + id: "editTagsDlg", + title: __("Edit article Tags"), + style: "width: 600px", + execute: function() { + if (this.validate()) { + var query = dojo.objectToQuery(this.attr('value')); - console.log(query); + notify_progress("Saving article tags...", true); - new Ajax.Request("backend.php", { - parameters: query, - onComplete: function(transport) { - try { - //console.log("tags saved..."); - - closeInfoBox(); - notify(""); - - if (transport.responseXML) { - var tags_str = transport.responseXML.getElementsByTagName("tags-str")[0]; - - if (tags_str) { - var id = tags_str.getAttribute("id"); - - if (id) { - var tags = $("ATSTR-" + id); - if (tags) { - tags.innerHTML = tags_str.firstChild.nodeValue; + new Ajax.Request("backend.php", { + parameters: query, + onComplete: function(transport) { + notify(''); + dialog.hide(); + + if (transport.responseXML) { + var tags_str = transport.responseXML.getElementsByTagName("tags-str")[0]; + + if (tags_str) { + var id = tags_str.getAttribute("id"); + + if (id) { + var tags = $("ATSTR-" + id); + if (tags) { + tags.innerHTML = tags_str.firstChild.nodeValue; + } + + cache_invalidate(id); } - - cache_invalidate(id); } } - } - - } catch (e) { - exception_error("editTagsSave", e); + + }}); } - } }); -} - -function editTagsInsert() { - try { - - var form = document.forms["tag_edit_form"]; - - var found_tags = form.found_tags; - var tags_str = form.tags_str; - - var tag = found_tags[found_tags.selectedIndex].value; + }, + href: query, + }); - if (tags_str.value.length > 0 && - tags_str.value.lastIndexOf(", ") != tags_str.value.length - 2) { + var tmph = dojo.connect(dialog, 'onLoad', function() { + dojo.disconnect(tmph); - tags_str.value = tags_str.value + ", "; - } + new Ajax.Autocompleter('tags_str', 'tags_choices', + "backend.php?op=rpc&subop=completeTags", + { tokens: ',', paramName: "search" }); + }); - tags_str.value = tags_str.value + tag + ", "; + dialog.show(); - found_tags.selectedIndex = 0; - - } catch (e) { - exception_error("editTagsInsert", e); - } } function cdmScrollToArticleId(id) {