";
- print "
" . __("Using OPML you can export and import your feeds, filters, labels and Tiny Tiny RSS settings.") .
- __("Only main settings profile can be migrated using OPML.") . "
";
+ print_notice(__("Using OPML you can export and import your feeds, filters, labels and Tiny Tiny RSS settings.") .
+ __("Only main settings profile can be migrated using OPML."));
print "
";
print "
";
+
+ print "
";
+
+ print "
";
print "
";
- $opml_export_filename = "TinyTinyRSS_".date("Y-m-d").".opml";
-
- print "
" . __('Filename:') .
- " " .
- __('Include settings') . "";
-
- print "
";
-
- print "
";
-
- print "
" . __('Your OPML can be published publicly and can be subscribed by anyone who knows the URL below.') . "
";
+ print_notice(__('Your OPML can be published publicly and can be subscribed by anyone who knows the URL below.'));
print_warning("Published OPML does not include your Tiny Tiny RSS settings, feeds that require authentication or feeds hidden from Popular feeds.");
diff --git a/js/PrefHelpers.js b/js/PrefHelpers.js
index 749e954cc..df42547b2 100644
--- a/js/PrefHelpers.js
+++ b/js/PrefHelpers.js
@@ -148,7 +148,85 @@ define(["dojo/_base/declare"], function (declare) {
Notify.close();
});
}
- }
+ };
+
+ Prefs.OPML = {
+ import: function() {
+ const opml_file = $("opml_file");
+
+ if (opml_file.value.length == 0) {
+ alert(__("Please choose an OPML file first."));
+ return false;
+ } else {
+ Notify.progress("Importing, please wait...", true);
+
+ Element.show("upload_iframe");
+
+ return true;
+ }
+ },
+ onImportComplete: function(iframe) {
+ if (!iframe.contentDocument.body.innerHTML) return false;
+
+ Element.show(iframe);
+
+ Notify.close();
+
+ if (dijit.byId('opmlImportDlg'))
+ dijit.byId('opmlImportDlg').destroyRecursive();
+
+ const content = iframe.contentDocument.body.innerHTML;
+
+ const dialog = new dijit.Dialog({
+ id: "opmlImportDlg",
+ title: __("OPML Import"),
+ style: "width: 600px",
+ onCancel: function () {
+ window.location.reload();
+ },
+ execute: function () {
+ window.location.reload();
+ },
+ content: content
+ });
+
+ dojo.connect(dialog, "onShow", function () {
+ Element.hide(iframe);
+ });
+
+ dialog.show();
+ },
+ export: function() {
+ console.log("export");
+ window.open("backend.php?op=opml&method=export&" + dojo.formToQuery("opmlExportForm"));
+ },
+ changeKey: function() {
+ if (confirm(__("Replace current OPML publishing address with a new one?"))) {
+ Notify.progress("Trying to change address...", true);
+
+ xhrJson("backend.php", {op: "pref-feeds", method: "regenOPMLKey"}, (reply) => {
+ if (reply) {
+ const new_link = reply.link;
+ const e = $('pub_opml_url');
+
+ if (new_link) {
+ e.href = new_link;
+ e.innerHTML = new_link;
+
+ new Effect.Highlight(e);
+
+ Notify.close();
+
+ } else {
+ Notify.error("Could not change feed URL.");
+ }
+ }
+ });
+ }
+ return false;
+ },
+
+};
return Prefs;
});
diff --git a/js/prefs.js b/js/prefs.js
index edb11bc7d..4bdfb45ef 100755
--- a/js/prefs.js
+++ b/js/prefs.js
@@ -152,79 +152,4 @@ require(["dojo/_base/kernel",
exception_error(e);
}
});
-});
-
-function opmlImportComplete(iframe) {
- if (!iframe.contentDocument.body.innerHTML) return false;
-
- Element.show(iframe);
-
- Notify.close();
-
- if (dijit.byId('opmlImportDlg'))
- dijit.byId('opmlImportDlg').destroyRecursive();
-
- const content = iframe.contentDocument.body.innerHTML;
-
- const dialog = new dijit.Dialog({
- id: "opmlImportDlg",
- title: __("OPML Import"),
- style: "width: 600px",
- onCancel: function () {
- window.location.reload();
- },
- execute: function () {
- window.location.reload();
- },
- content: content
- });
-
- dialog.show();
-}
-
-function opmlImport() {
-
- const opml_file = $("opml_file");
-
- if (opml_file.value.length == 0) {
- alert(__("Please choose an OPML file first."));
- return false;
- } else {
- Notify.progress("Importing, please wait...", true);
-
- Element.show("upload_iframe");
-
- return true;
- }
-}
-
-function opmlRegenKey() {
- if (confirm(__("Replace current OPML publishing address with a new one?"))) {
- Notify.progress("Trying to change address...", true);
-
- xhrJson("backend.php", { op: "pref-feeds", method: "regenOPMLKey" }, (reply) => {
- if (reply) {
- const new_link = reply.link;
- const e = $('pub_opml_url');
-
- if (new_link) {
- e.href = new_link;
- e.innerHTML = new_link;
-
- new Effect.Highlight(e);
-
- Notify.close();
-
- } else {
- Notify.error("Could not change feed URL.");
- }
- }
- });
- }
- return false;
-}
-
-function gotoExportOpml(filename, settings) {
- const tmp = settings ? 1 : 0;
- document.location.href = "backend.php?op=opml&method=export&filename=" + filename + "&settings=" + tmp;
-}
+});
\ No newline at end of file