From 42b5564d1e4c06b18e37071459e04f6fcd36a85a Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Tue, 15 Sep 2020 18:47:19 +0300 Subject: [PATCH] editarticletags: load dialog via XHR --- classes/article.php | 6 ---- js/Article.js | 75 +++++++++++++++++++++++---------------------- 2 files changed, 39 insertions(+), 42 deletions(-) diff --git a/classes/article.php b/classes/article.php index 9c664a8f6..42f98a489 100755 --- a/classes/article.php +++ b/classes/article.php @@ -1,12 +1,6 @@ { - xhrPost("backend.php", this.attr('value'), (transport) => { - try { - Notify.close(); - dialog.hide(); + const dialog = new dijit.Dialog({ + id: "editTagsDlg", + title: __("Edit article Tags"), + 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 id = data.id; + const data = JSON.parse(transport.responseText); - const tags = $("ATSTR-" + id); - const tooltip = dijit.byId("ATSTRTIP-" + id); + if (data) { + const id = data.id; - if (tags) tags.innerHTML = data.content; - if (tooltip) tooltip.attr('label', data.content_full); + const tags = $("ATSTR-" + id); + 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); - } - }); - } - }, - href: query + }); + } + }, + }); + + 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(); + }); - 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) { params = params || {};