prefs: fix published shared URL dialog

This commit is contained in:
Andrew Dolgov 2021-02-12 19:17:50 +03:00
parent 7f0800537e
commit 157675d9fd
2 changed files with 10 additions and 8 deletions

View File

@ -1391,10 +1391,10 @@ class Pref_Feeds extends Handler_Protected {
$rss_url = htmlspecialchars(get_self_url_prefix() .
"/public.php?op=rss&id=-2&view-mode=all_articles");;
print "<button dojoType='dijit.form.Button' class='alt-primary' onclick='CommonDialogs.generatedFeed(-2, false, \"$rss_url\")'>".
__('Display URL')."</button> ";
print "<button class=\"alt-danger\" dojoType=\"dijit.form.Button\" onclick=\"return Helpers.clearFeedAccessKeys()\">".
print "<button dojoType='dijit.form.Button' class='alt-primary'
onclick='CommonDialogs.generatedFeed(-2, false, \"$rss_url\", \"".__("Published articles")."\")'>".
__('Display URL')."</button>
<button class='alt-danger' dojoType='dijit.form.Button' onclick='return Helpers.clearFeedAccessKeys()'>".
__('Clear all generated URLs')."</button> ";
PluginHost::getInstance()->run_hooks(PluginHost::HOOK_PREFS_TAB_SECTION, "prefFeedsPublishedGenerated");

View File

@ -387,17 +387,19 @@ const CommonDialogs = {
Notify.close();
} catch (e) {
this.Error.report(e);
App.Error.report(e);
}
});
},
generatedFeed: function(feed, is_cat, rss_url) {
generatedFeed: function(feed, is_cat, rss_url, feed_title) {
Notify.progress("Loading, please wait...", true);
xhrJson("backend.php", {op: "pref-feeds", method: "getFeedKey", id: feed, is_cat: is_cat}, (reply) => {
try {
const feed_title = Feeds.getName(feed, is_cat);
if (!feed_title && typeof Feeds != "undefined")
feed_title = Feeds.getName(feed, is_cat);
const secret_url = rss_url + "&key=" + encodeURIComponent(reply.link);
const dialog = new fox.SingleUseDialog({
@ -428,7 +430,7 @@ const CommonDialogs = {
Notify.close();
} catch (e) {
this.Error.report(e);
App.Error.report(e);
}
});
},