refactor tags dialog
This commit is contained in:
parent
8cd576a12a
commit
8386f8614b
|
@ -83,7 +83,6 @@ function viewfeed(feed, subop, is_cat, offset) {
|
|||
}
|
||||
|
||||
hideAuxDlg();
|
||||
closeInfoBox();
|
||||
|
||||
Form.enable("main_toolbar_form");
|
||||
|
||||
|
|
60
functions.js
60
functions.js
|
@ -41,10 +41,6 @@ function exception_error(location, e, ext_info) {
|
|||
content += "<div><b>Stack trace:</b></div>" +
|
||||
"<textarea readonly=\"1\">" + e.stack + "</textarea>";
|
||||
|
||||
// content += "<div style='text-align : center'>" +
|
||||
// "<button onclick=\"closeInfoBox()\">" +
|
||||
// "Close this window" + "</button></div>";
|
||||
|
||||
content += "</div>";
|
||||
|
||||
// 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;
|
||||
|
|
|
@ -569,10 +569,7 @@
|
|||
|
||||
if ($id == "editArticleTags") {
|
||||
|
||||
print "<title>".__('Edit Tags')."</title>";
|
||||
print "<content><![CDATA[";
|
||||
|
||||
print "<form id=\"tag_edit_form\" onsubmit='return false'>";
|
||||
# print "<form id=\"tag_edit_form\" onsubmit='return false'>";
|
||||
|
||||
print __("Tags for this article (separated by commas):")."<br>";
|
||||
|
||||
|
@ -580,28 +577,30 @@
|
|||
|
||||
$tags_str = join(", ", $tags);
|
||||
|
||||
print "<table width='100%'>";
|
||||
print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"id\" value=\"$param\">";
|
||||
print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"op\" value=\"rpc\">";
|
||||
print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"subop\" value=\"setArticleTags\">";
|
||||
|
||||
print "<tr><td colspan='2'><input type=\"hidden\" name=\"id\" value=\"$param\"></td></tr>";
|
||||
print "<table width='100%'><tr><td>";
|
||||
|
||||
print "<tr><td colspan='2'><textarea rows='4' class='iedit' id='tags_str'
|
||||
print "<textarea dojoType=\"dijit.form.SimpleTextarea\" rows='4'
|
||||
style='font-size : 12px; width : 100%' id=\"tags_str\"
|
||||
name='tags_str'>$tags_str</textarea>
|
||||
<div class=\"autocomplete\" id=\"tags_choices\"
|
||||
style=\"display:none\"></div>
|
||||
</td></tr>";
|
||||
style=\"display:none\"></div>";
|
||||
|
||||
print "</table>";
|
||||
print "</td></tr></table>";
|
||||
|
||||
print "</form>";
|
||||
# print "</form>";
|
||||
|
||||
print "<div align='right'>";
|
||||
print "<div class='dlgButtons'>";
|
||||
|
||||
print "<button onclick=\"return editTagsSave()\">".__('Save')."</button> ";
|
||||
print "<button onclick=\"return closeInfoBox()\">".__('Cancel')."</button>";
|
||||
print "<button dojoType=\"dijit.form.Button\"
|
||||
onclick=\"dijit.byId('editTagsDlg').execute()\">".__('Save')."</button> ";
|
||||
print "<button dojoType=\"dijit.form.Button\"
|
||||
onclick=\"dijit.byId('editTagsDlg').hide()\">".__('Cancel')."</button>";
|
||||
print "</div>";
|
||||
|
||||
print "]]></content>";
|
||||
|
||||
//return;
|
||||
}
|
||||
|
||||
if ($id == "printTagCloud") {
|
||||
|
|
6
prefs.js
6
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();
|
||||
|
|
|
@ -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;
|
||||
|
|
68
viewfeed.js
68
viewfeed.js
|
@ -1083,37 +1083,36 @@ 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() {
|
||||
var query = "backend.php?op=dlg&id=editArticleTags¶m=" + param_escape(id);
|
||||
|
||||
notify_progress("Saving article tags...");
|
||||
if (dijit.byId("editTagsDlg"))
|
||||
dijit.byId("editTagsDlg").destroyRecursive();
|
||||
|
||||
var form = document.forms["tag_edit_form"];
|
||||
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'));
|
||||
|
||||
var query = Form.serialize("tag_edit_form");
|
||||
|
||||
query = "?op=rpc&subop=setArticleTags&" + query;
|
||||
|
||||
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("");
|
||||
notify('');
|
||||
dialog.hide();
|
||||
|
||||
if (transport.responseXML) {
|
||||
var tags_str = transport.responseXML.getElementsByTagName("tags-str")[0];
|
||||
|
@ -1132,35 +1131,22 @@ function editTagsSave() {
|
|||
}
|
||||
}
|
||||
|
||||
} catch (e) {
|
||||
exception_error("editTagsSave", e);
|
||||
}});
|
||||
}
|
||||
} });
|
||||
}
|
||||
},
|
||||
href: query,
|
||||
});
|
||||
|
||||
function editTagsInsert() {
|
||||
try {
|
||||
var tmph = dojo.connect(dialog, 'onLoad', function() {
|
||||
dojo.disconnect(tmph);
|
||||
|
||||
var form = document.forms["tag_edit_form"];
|
||||
new Ajax.Autocompleter('tags_str', 'tags_choices',
|
||||
"backend.php?op=rpc&subop=completeTags",
|
||||
{ tokens: ',', paramName: "search" });
|
||||
});
|
||||
|
||||
var found_tags = form.found_tags;
|
||||
var tags_str = form.tags_str;
|
||||
dialog.show();
|
||||
|
||||
var tag = found_tags[found_tags.selectedIndex].value;
|
||||
|
||||
if (tags_str.value.length > 0 &&
|
||||
tags_str.value.lastIndexOf(", ") != tags_str.value.length - 2) {
|
||||
|
||||
tags_str.value = tags_str.value + ", ";
|
||||
}
|
||||
|
||||
tags_str.value = tags_str.value + tag + ", ";
|
||||
|
||||
found_tags.selectedIndex = 0;
|
||||
|
||||
} catch (e) {
|
||||
exception_error("editTagsInsert", e);
|
||||
}
|
||||
}
|
||||
|
||||
function cdmScrollToArticleId(id) {
|
||||
|
|
Loading…
Reference in New Issue