mirror of
https://git.tt-rss.org/fox/tt-rss.git
synced 2025-08-07 06:37:44 +02:00
editarticletags: load dialog via XHR
This commit is contained in:
parent
0706a328a4
commit
42b5564d1e
@ -1,12 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
class Article extends Handler_Protected {
|
class Article extends Handler_Protected {
|
||||||
|
|
||||||
function csrf_ignore($method) {
|
|
||||||
$csrf_ignored = array("editarticletags");
|
|
||||||
|
|
||||||
return array_search($method, $csrf_ignored) !== false;
|
|
||||||
}
|
|
||||||
|
|
||||||
function redirect() {
|
function redirect() {
|
||||||
$id = clean($_REQUEST['id']);
|
$id = clean($_REQUEST['id']);
|
||||||
|
|
||||||
|
@ -257,53 +257,56 @@ const Article = {
|
|||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
editTags: function (id) {
|
editTags: function (id) {
|
||||||
const query = "backend.php?op=article&method=editArticleTags¶m=" + encodeURIComponent(id);
|
|
||||||
|
|
||||||
if (dijit.byId("editTagsDlg"))
|
if (dijit.byId("editTagsDlg"))
|
||||||
dijit.byId("editTagsDlg").destroyRecursive();
|
dijit.byId("editTagsDlg").destroyRecursive();
|
||||||
|
|
||||||
const dialog = new dijit.Dialog({
|
xhrPost("backend.php", {op: "article", method: "editarticletags", param: id}, (transport) => {
|
||||||
id: "editTagsDlg",
|
|
||||||
title: __("Edit article Tags"),
|
|
||||||
style: "width: 600px",
|
|
||||||
execute: function () {
|
|
||||||
if (this.validate()) {
|
|
||||||
Notify.progress("Saving article tags...", true);
|
|
||||||
|
|
||||||
xhrPost("backend.php", this.attr('value'), (transport) => {
|
const dialog = new dijit.Dialog({
|
||||||
try {
|
id: "editTagsDlg",
|
||||||
Notify.close();
|
title: __("Edit article Tags"),
|
||||||
dialog.hide();
|
style: "width: 600px",
|
||||||
|
content: transport.responseText,
|
||||||
|
execute: function () {
|
||||||
|
if (this.validate()) {
|
||||||
|
Notify.progress("Saving article tags...", true);
|
||||||
|
|
||||||
const data = JSON.parse(transport.responseText);
|
xhrPost("backend.php", this.attr('value'), (transport) => {
|
||||||
|
try {
|
||||||
|
Notify.close();
|
||||||
|
dialog.hide();
|
||||||
|
|
||||||
if (data) {
|
const data = JSON.parse(transport.responseText);
|
||||||
const id = data.id;
|
|
||||||
|
|
||||||
const tags = $("ATSTR-" + id);
|
if (data) {
|
||||||
const tooltip = dijit.byId("ATSTRTIP-" + id);
|
const id = data.id;
|
||||||
|
|
||||||
if (tags) tags.innerHTML = data.content;
|
const tags = $("ATSTR-" + id);
|
||||||
if (tooltip) tooltip.attr('label', data.content_full);
|
const tooltip = dijit.byId("ATSTRTIP-" + id);
|
||||||
|
|
||||||
|
if (tags) tags.innerHTML = data.content;
|
||||||
|
if (tooltip) tooltip.attr('label', data.content_full);
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
App.Error.report(e);
|
||||||
}
|
}
|
||||||
} catch (e) {
|
});
|
||||||
App.Error.report(e);
|
}
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
}
|
|
||||||
},
|
const tmph = dojo.connect(dialog, 'onLoad', function () {
|
||||||
href: query
|
dojo.disconnect(tmph);
|
||||||
|
|
||||||
|
new Ajax.Autocompleter('tags_str', 'tags_choices',
|
||||||
|
"backend.php?op=article&method=completeTags",
|
||||||
|
{tokens: ',', paramName: "search"});
|
||||||
|
});
|
||||||
|
|
||||||
|
dialog.show();
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const tmph = dojo.connect(dialog, 'onLoad', function () {
|
|
||||||
dojo.disconnect(tmph);
|
|
||||||
|
|
||||||
new Ajax.Autocompleter('tags_str', 'tags_choices',
|
|
||||||
"backend.php?op=article&method=completeTags",
|
|
||||||
{tokens: ',', paramName: "search"});
|
|
||||||
});
|
|
||||||
|
|
||||||
dialog.show();
|
|
||||||
},
|
},
|
||||||
cdmMoveToId: function (id, params) {
|
cdmMoveToId: function (id, params) {
|
||||||
params = params || {};
|
params = params || {};
|
||||||
|
Loading…
Reference in New Issue
Block a user