summaryrefslogtreecommitdiff
path: root/classes
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2018-12-03 12:26:49 +0300
committerAndrew Dolgov <[email protected]>2018-12-03 12:26:49 +0300
commitb3bc638a9fa87cdaf61bff446f8aa0534d2b49ee (patch)
treef5bd8fa16550252660cda74ec7267889efaa6cb7 /classes
parent78cc470193448048759b3f315ee630e50acb064b (diff)
refactor OPML export/import code to be less horrible
Diffstat (limited to 'classes')
-rw-r--r--classes/dlg.php2
-rw-r--r--classes/opml.php7
-rwxr-xr-xclasses/pref/feeds.php33
3 files changed, 22 insertions, 20 deletions
diff --git a/classes/dlg.php b/classes/dlg.php
index 32c41ee34..6617dfe07 100644
--- a/classes/dlg.php
+++ b/classes/dlg.php
@@ -49,7 +49,7 @@ class Dlg extends Handler_Protected {
print "<div align='center'>";
- print "<button dojoType=\"dijit.form.Button\" onclick=\"return opmlRegenKey()\">".
+ print "<button dojoType=\"dijit.form.Button\" onclick=\"return Prefs.OPML.changeKey()\">".
__('Generate new URL')."</button> ";
print "<button dojoType=\"dijit.form.Button\" onclick=\"return CommonDialogs.closeInfoBox()\">".
diff --git a/classes/opml.php b/classes/opml.php
index 5b7690375..1b1897e7d 100644
--- a/classes/opml.php
+++ b/classes/opml.php
@@ -8,11 +8,8 @@ class Opml extends Handler_Protected {
}
function export() {
- $output_name = $_REQUEST["filename"];
- if (!$output_name) $output_name = "TinyTinyRSS.opml";
-
- $show_settings = $_REQUEST["settings"];
-
+ $output_name = "tt-rss_".date("Y-m-d").".opml";
+ $show_settings = $_REQUEST["include_settings"];
$owner_uid = $_SESSION["uid"];
$rc = $this->opml_export($output_name, $owner_uid, false, ($show_settings == 1));
diff --git a/classes/pref/feeds.php b/classes/pref/feeds.php
index 961a09c28..ff91120ec 100755
--- a/classes/pref/feeds.php
+++ b/classes/pref/feeds.php
@@ -1270,11 +1270,11 @@ class Pref_Feeds extends Handler_Protected {
print "<div dojoType=\"dijit.layout.AccordionPane\" title=\"".__('OPML')."\">";
- print "<p>" . __("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.") . "</p>";
+ 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 "<iframe id=\"upload_iframe\"
- name=\"upload_iframe\" onload=\"opmlImportComplete(this)\"
+ name=\"upload_iframe\" onload=\"Prefs.OPML.onImportComplete(this)\"
style=\"width: 400px; height: 100px; display: none;\"></iframe>";
print "<form name=\"opml_form\" style='display : block' target=\"upload_iframe\"
@@ -1285,24 +1285,29 @@ class Pref_Feeds extends Handler_Protected {
</label>
<input type=\"hidden\" name=\"op\" value=\"dlg\">
<input type=\"hidden\" name=\"method\" value=\"importOpml\">
- <button dojoType=\"dijit.form.Button\" onclick=\"return opmlImport();\" type=\"submit\">" .
- __('Import my OPML') . "</button>";
+ <button dojoType=\"dijit.form.Button\" onclick=\"return Prefs.OPML.import();\" type=\"submit\">" .
+ __('Import OPML') . "</button>";
- print "<hr>";
+ print "</form>";
+
+ print "<p/>";
- $opml_export_filename = "TinyTinyRSS_".date("Y-m-d").".opml";
+ print "<form dojoType=\"dijit.form.Form\" id=\"opmlExportForm\">";
- print "<p>" . __('Filename:') .
- " <input class=\"input input-text\" type=\"text\" id=\"filename\" value=\"$opml_export_filename\" />&nbsp;" .
- __('Include settings') . "<input type=\"checkbox\" id=\"settings\" checked=\"1\"/>";
+ print "<button dojoType=\"dijit.form.Button\"
+ onclick=\"Prefs.OPML.export()\" >" .
+ __('Export OPML') . "</button>";
- print "</p><button dojoType=\"dijit.form.Button\"
- onclick=\"gotoExportOpml(document.opml_form.filename.value, document.opml_form.settings.checked)\" >" .
- __('Export OPML') . "</button></p></form>";
+ print "<label>";
+ print_checkbox("include_settings", true, "1", "");
+ print "&nbsp;" . __("Include settings");
+ print "</label>";
+
+ print "</form>";
print "<hr>";
- print "<p>" . __('Your OPML can be published publicly and can be subscribed by anyone who knows the URL below.') . "</p>";
+ 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.");