diff options
Diffstat (limited to 'js/CommonDialogs.js')
-rw-r--r-- | js/CommonDialogs.js | 108 |
1 files changed, 104 insertions, 4 deletions
diff --git a/js/CommonDialogs.js b/js/CommonDialogs.js index b344967a7..b41065c63 100644 --- a/js/CommonDialogs.js +++ b/js/CommonDialogs.js @@ -87,7 +87,6 @@ const CommonDialogs = { const dialog = new dijit.Dialog({ id: "feedAddDlg", title: __("Subscribe to Feed"), - style: "width: 600px", content: transport.responseText, show_error: function (msg) { const elem = $("fadd_error_message"); @@ -199,7 +198,6 @@ const CommonDialogs = { const dialog = new dijit.Dialog({ id: "errorFeedsDlg", title: __("Feeds with update errors"), - style: "width: 600px", getSelectedFeeds: function () { return Tables.getSelected("error-feeds-list"); }, @@ -309,7 +307,6 @@ const CommonDialogs = { const dialog = new dijit.Dialog({ id: "feedEditDlg", title: __("Edit Feed"), - style: "width: 600px", execute: function () { if (this.validate()) { Notify.progress("Saving data...", true); @@ -359,5 +356,108 @@ const CommonDialogs = { }); } return false; - } + }, + publishedOPML: function() { + + Notify.progress("Loading, please wait...", true); + + xhrJson("backend.php", {op: "pref-feeds", method: "getOPMLKey"}, (reply) => { + try { + if (dijit.byId("publicOPMLDlg")) + dijit.byId("publicOPMLDlg").destroyRecursive(); + + const dialog = new dijit.Dialog({ + title: __("Public OPML URL"), + id: 'publicOPMLDlg', + onCancel: function () { + return true; + }, + onExecute: function () { + return true; + }, + onClose: function () { + return true; + }, + content: ` + <header>${__("Your Public OPML URL is:")}</header> + <section> + <div class='panel text-center'> + <a id='pub_opml_url' href="${App.escapeHtml(reply.link)}" target='_blank'>${reply.link}</a> + </div> + </section> + <footer class='text-center'> + <button dojoType='dijit.form.Button' onclick="return Helpers.OPML.changeKey()"> + ${__('Generate new URL')} + </button> + <button dojoType='dijit.form.Button' type='submit' class='alt-primary'> + ${__('Close this window')} + </button> + </footer> + ` + }); + + dialog.show(); + + Notify.close(); + + } catch (e) { + this.Error.report(e); + } + }); + }, + generatedFeed: function(feed, is_cat, rss_url) { + + Notify.progress("Loading, please wait...", true); + + xhrJson("backend.php", {op: "pref-feeds", method: "getFeedKey", id: feed, is_cat: is_cat}, (reply) => { + try { + if (dijit.byId("genFeedDlg")) + dijit.byId("genFeedDlg").destroyRecursive(); + + const feed_title = Feeds.getName(feed, is_cat); + + const secret_url = rss_url + "&key=" + encodeURIComponent(reply.link); + + const dialog = new dijit.Dialog({ + title: __("Show as feed"), + id: 'genFeedDlg', + onCancel: function () { + return true; + }, + onExecute: function () { + return true; + }, + onClose: function () { + return true; + }, + content: ` + <header>${__("%s can be accessed via the following secret URL:").replace("%s", feed_title)}</header> + <section> + <div class='panel text-center'> + <a id='gen_feed_url' href="${App.escapeHtml(secret_url)}" target='_blank'>${secret_url}</a> + </div> + </section> + <footer> + <button dojoType='dijit.form.Button' style='float : left' class='alt-info' + onclick='window.open("https://tt-rss.org/wiki/GeneratedFeeds")'> + <i class='material-icons'>help</i> ${__("More info...")}</button> + <button dojoType='dijit.form.Button' onclick="return CommonDialogs.genUrlChangeKey('${feed}', '${is_cat}')"> + ${__('Generate new URL')} + </button> + <button dojoType='dijit.form.Button' class='alt-primary' type='submit'> + ${__('Close this window')} + </button> + </footer> + ` + }); + + dialog.show(); + + Notify.close(); + + } catch (e) { + this.Error.report(e); + } + }); + }, }; |