2018-12-03 07:51:14 +00:00
|
|
|
Plugins.Note = {
|
|
|
|
edit: function(id) {
|
|
|
|
const query = "backend.php?op=pluginhandler&plugin=note&method=edit¶m=" + encodeURIComponent(id);
|
2011-12-21 06:58:06 +00:00
|
|
|
|
|
|
|
if (dijit.byId("editNoteDlg"))
|
|
|
|
dijit.byId("editNoteDlg").destroyRecursive();
|
|
|
|
|
2018-12-03 07:51:14 +00:00
|
|
|
const dialog = new dijit.Dialog({
|
2011-12-21 06:58:06 +00:00
|
|
|
id: "editNoteDlg",
|
|
|
|
title: __("Edit article note"),
|
|
|
|
style: "width: 600px",
|
2018-12-03 07:51:14 +00:00
|
|
|
execute: function () {
|
2011-12-21 06:58:06 +00:00
|
|
|
if (this.validate()) {
|
2018-12-02 17:56:30 +00:00
|
|
|
Notify.progress("Saving article note...", true);
|
2011-12-21 06:58:06 +00:00
|
|
|
|
2018-11-30 11:39:06 +00:00
|
|
|
xhrJson("backend.php", this.attr('value'), (reply) => {
|
2018-12-03 07:51:14 +00:00
|
|
|
Notify.close();
|
|
|
|
dialog.hide();
|
2011-12-21 06:58:06 +00:00
|
|
|
|
2018-12-03 07:51:14 +00:00
|
|
|
if (reply) {
|
|
|
|
ArticleCache.del(id);
|
2011-12-21 06:58:06 +00:00
|
|
|
|
2018-12-06 17:55:51 +00:00
|
|
|
const elem = $("POSTNOTE-" + id);
|
2011-12-21 06:58:06 +00:00
|
|
|
|
2018-12-03 07:51:14 +00:00
|
|
|
if (elem) {
|
|
|
|
elem.innerHTML = reply.note;
|
2011-12-21 06:58:06 +00:00
|
|
|
|
2018-12-03 07:51:14 +00:00
|
|
|
if (reply.raw_length != 0)
|
2018-12-06 17:55:51 +00:00
|
|
|
Element.show(elem);
|
|
|
|
else
|
|
|
|
Element.hide(elem);
|
2018-12-03 07:51:14 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
2011-12-21 06:58:06 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
href: query,
|
|
|
|
});
|
|
|
|
|
|
|
|
dialog.show();
|
|
|
|
}
|
2018-12-03 07:51:14 +00:00
|
|
|
};
|