Extend OPML preferences pane, to provide more control of Export OPML
User is prompted for filename, and also whether to include settings. Default filename is: TinyTinyRSS.opml modules/pref-feeds.php Prompt for output OPML filename (Default: TinyTinyRSS.opml ) opml.php Modify to support passing in name=<filename>&settings=[0|1] functions.js Modify to support passing in name=<filename>&settings=[0|1]
This commit is contained in:
parent
9949bd154e
commit
08ae2a5ba6
3 changed files with 23 additions and 11 deletions
|
@ -277,8 +277,9 @@ function gotoMain() {
|
||||||
document.location.href = "tt-rss.php";
|
document.location.href = "tt-rss.php";
|
||||||
}
|
}
|
||||||
|
|
||||||
function gotoExportOpml() {
|
function gotoExportOpml(filename, settings) {
|
||||||
document.location.href = "opml.php?op=Export";
|
tmp = settings ? 1 : 0;
|
||||||
|
document.location.href = "opml.php?op=Export&filename=" + filename + "&settings=" + tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1440,16 +1440,21 @@
|
||||||
name=\"upload_iframe\" onload=\"opmlImportComplete(this)\"
|
name=\"upload_iframe\" onload=\"opmlImportComplete(this)\"
|
||||||
style=\"width: 400px; height: 100px; display: none;\"></iframe>";
|
style=\"width: 400px; height: 100px; display: none;\"></iframe>";
|
||||||
|
|
||||||
print "<form style='display : block' target=\"upload_iframe\"
|
print "<form name=\"opml_form\" style='display : block' target=\"upload_iframe\"
|
||||||
enctype=\"multipart/form-data\" method=\"POST\"
|
enctype=\"multipart/form-data\" method=\"POST\"
|
||||||
action=\"backend.php\">
|
action=\"backend.php\">
|
||||||
<input id=\"opml_file\" name=\"opml_file\" type=\"file\">
|
<input id=\"opml_file\" name=\"opml_file\" type=\"file\">
|
||||||
<input type=\"hidden\" name=\"op\" value=\"dlg\">
|
<input type=\"hidden\" name=\"op\" value=\"dlg\">
|
||||||
<input type=\"hidden\" name=\"id\" value=\"importOpml\">
|
<input type=\"hidden\" name=\"id\" value=\"importOpml\">
|
||||||
<button dojoType=\"dijit.form.Button\" onclick=\"return opmlImport();\"
|
<button dojoType=\"dijit.form.Button\" onclick=\"return opmlImport();\" type=\"submit\">" .
|
||||||
type=\"submit\">".__('Import')."</button>
|
__('Import') . "</button>" .
|
||||||
<button dojoType=\"dijit.form.Button\" onclick=\"gotoExportOpml()\">".__('Export OPML')."</button>
|
"<p>" . __('Export Name: ') .
|
||||||
</form>";
|
"<input type=\"text\" id=\"filename\" value=\"TinyTinyRSS.opml\" /> " .
|
||||||
|
__('Include Settings? ') . "<input type=\"checkbox\" id=\"settings\" CHECKED />" .
|
||||||
|
|
||||||
|
"<button dojoType=\"dijit.form.Button\"
|
||||||
|
onclick=\"gotoExportOpml(document.opml_form.filename.value, document.opml_form.settings.checked)\" >" .
|
||||||
|
__('Export OPML') . "</button></p></form>";
|
||||||
|
|
||||||
print "<p>".__('Your OPML can be published publicly and can be subscribed by anyone who knows the URL below.');
|
print "<p>".__('Your OPML can be published publicly and can be subscribed by anyone who knows the URL below.');
|
||||||
|
|
||||||
|
|
14
opml.php
14
opml.php
|
@ -10,12 +10,14 @@
|
||||||
|
|
||||||
init_connection($link);
|
init_connection($link);
|
||||||
|
|
||||||
function opml_export($link, $owner_uid, $hide_private_feeds=false, $include_settings=true) {
|
function opml_export($link, $name, $owner_uid, $hide_private_feeds=false, $include_settings=true) {
|
||||||
if (!$_REQUEST["debug"]) {
|
if (!$_REQUEST["debug"]) {
|
||||||
header("Content-type: application/xml+opml");
|
header("Content-type: application/xml+opml");
|
||||||
} else {
|
} else {
|
||||||
header("Content-type: text/xml");
|
header("Content-type: text/xml");
|
||||||
}
|
}
|
||||||
|
header("Content-Disposition: attachment; filename=" . $name );
|
||||||
|
|
||||||
print "<?xml version=\"1.0\" encoding=\"utf-8\"?>";
|
print "<?xml version=\"1.0\" encoding=\"utf-8\"?>";
|
||||||
|
|
||||||
print "<opml version=\"1.0\">";
|
print "<opml version=\"1.0\">";
|
||||||
|
@ -119,14 +121,18 @@
|
||||||
// FIXME there are some brackets issues here
|
// FIXME there are some brackets issues here
|
||||||
|
|
||||||
$op = $_REQUEST["op"];
|
$op = $_REQUEST["op"];
|
||||||
|
if (!$op) $op = "Export";
|
||||||
|
|
||||||
if (!$op) $op = "Export";
|
$output_name = $_REQUEST["filename"];
|
||||||
|
if (!$output_name) $output_name = "TinyTinyRSS.opml";
|
||||||
|
|
||||||
|
$show_settings = $_REQUEST["settings"];
|
||||||
|
|
||||||
if ($op == "Export") {
|
if ($op == "Export") {
|
||||||
|
|
||||||
login_sequence($link);
|
login_sequence($link);
|
||||||
$owner_uid = $_SESSION["uid"];
|
$owner_uid = $_SESSION["uid"];
|
||||||
return opml_export($link, $owner_uid);
|
return opml_export($link, $output_name, $owner_uid, false, ($show_settings == 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($op == "publish"){
|
if ($op == "publish"){
|
||||||
|
@ -138,7 +144,7 @@
|
||||||
|
|
||||||
if (db_num_rows($result) == 1) {
|
if (db_num_rows($result) == 1) {
|
||||||
$owner_uid = db_fetch_result($result, 0, "owner_uid");
|
$owner_uid = db_fetch_result($result, 0, "owner_uid");
|
||||||
return opml_export($link, $owner_uid, true, false);
|
return opml_export($link, "", $owner_uid, true, false);
|
||||||
} else {
|
} else {
|
||||||
print "<error>User not found</error>";
|
print "<error>User not found</error>";
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue