update external subscribe dialog

This commit is contained in:
Andrew Dolgov 2019-02-20 12:32:52 +03:00
parent 205a75dfb9
commit d9e20f8b16
1 changed files with 92 additions and 72 deletions

View File

@ -737,21 +737,40 @@ class Handler_Public extends Handler {
$feed_url = trim(clean($_REQUEST["feed_url"])); $feed_url = trim(clean($_REQUEST["feed_url"]));
header('Content-Type: text/html; charset=utf-8'); header('Content-Type: text/html; charset=utf-8');
print "<html> ?>
<html>
<head> <head>
<title>Tiny Tiny RSS</title>"; <title>Tiny Tiny RSS</title>
print stylesheet_tag("css/default.css"); <?php
echo stylesheet_tag("css/default.css");
print "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\"/> echo javascript_tag("lib/prototype.js");
<link rel=\"shortcut icon\" type=\"image/png\" href=\"images/favicon.png\"> echo javascript_tag("lib/dojo/dojo.js");
<link rel=\"icon\" type=\"image/png\" sizes=\"72x72\" href=\"images/favicon-72px.png\"> echo javascript_tag("lib/dojo/tt-rss-layer.js");
?>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<link rel="shortcut icon" type="image/png" href="images/favicon.png">
<link rel="icon" type="image/png" sizes="72x72" href="images/favicon-72px.png">
</head> </head>
<body class='claro ttrss_utility'> <body class='flat ttrss_utility'>
<div class=\"container\"> <script type="text/javascript">
<h1>".__("Subscribe to feed...")."</h1><div class='content'>"; require(['dojo/parser', "dojo/ready", 'dijit/form/Button','dijit/form/CheckBox', 'dijit/form/Form',
'dijit/form/Select','dijit/form/TextBox','dijit/form/ValidationTextBox'],function(parser, ready){
ready(function() {
parser.parse();
});
});
</script>
<div class="container">
<h1><?php echo __("Subscribe to feed...") ?></h1>
<div class='content'>
<?php
if (!$feed_url) {
print_error("No feed to subscribe to.");
} else {
$rc = Feeds::subscribe_to_feed($feed_url); $rc = Feeds::subscribe_to_feed($feed_url);
$feed_urls = false;
switch ($rc['code']) { switch ($rc['code']) {
case 0: case 0:
@ -767,7 +786,6 @@ class Handler_Public extends Handler {
print_error(T_sprintf("No feeds found in <b>%s</b>.", $feed_url)); print_error(T_sprintf("No feeds found in <b>%s</b>.", $feed_url));
break; break;
case 4: case 4:
print_notice(__("Multiple feed URLs found."));
$feed_urls = $rc["feeds"]; $feed_urls = $rc["feeds"];
break; break;
case 5: case 5:
@ -777,10 +795,12 @@ class Handler_Public extends Handler {
if ($feed_urls) { if ($feed_urls) {
print "<form action=\"public.php\">"; print "<form action='public.php'>";
print "<input type=\"hidden\" name=\"op\" value=\"subscribe\">"; print "<input type='hidden' name='op' value='subscribe'>";
print "<select name=\"feed_url\">"; print "<fieldset>";
print "<label style='display : inline'>" . __("Multiple feed URLs found:") . "</label>";
print "<select name='feed_url' dojoType='dijit.form.Select'>";
foreach ($feed_urls as $url => $name) { foreach ($feed_urls as $url => $name) {
$url = htmlspecialchars($url); $url = htmlspecialchars($url);
@ -789,14 +809,14 @@ class Handler_Public extends Handler {
print "<option value=\"$url\">$name</option>"; print "<option value=\"$url\">$name</option>";
} }
print "<input type=\"submit\" value=\"".__("Subscribe to selected feed"). print "</select>";
"\">"; print "<button class='alt-primary' dojoType='dijit.form.Button' type='submit'>".__("Subscribe to selected feed")."</button>";
print "</fieldset>";
print "</form>"; print "</form>";
} }
$tp_uri = get_self_url_prefix() . "/prefs.php"; $tp_uri = get_self_url_prefix() . "/prefs.php";
$tt_uri = get_self_url_prefix();
if ($rc['code'] <= 2){ if ($rc['code'] <= 2){
$sth = $this->pdo->prepare("SELECT id FROM ttrss_feeds WHERE $sth = $this->pdo->prepare("SELECT id FROM ttrss_feeds WHERE
@ -811,18 +831,18 @@ class Handler_Public extends Handler {
print "<p>"; print "<p>";
if ($feed_id) { if ($feed_id) {
print "<form method=\"GET\" style='display: inline' print "<form method='GET' style='float : left' action=\"$tp_uri\">
action=\"$tp_uri\"> <input type='hidden' name='tab' value='feedConfig'>
<input type=\"hidden\" name=\"tab\" value=\"feedConfig\"> <input type='hidden' name='method' value='editfeed'>
<input type=\"hidden\" name=\"method\" value=\"editfeed\"> <input type='hidden' name='methodparam' value='$feed_id'>
<input type=\"hidden\" name=\"methodparam\" value=\"$feed_id\"> <button dojoType='dijit.form.Button' class='alt-info' type='submit'>".__("Edit subscription options")."</button>
<input type=\"submit\" value=\"".__("Edit subscription options")."\">
</form>"; </form>";
} }
}
print "<form style='display: inline' method=\"GET\" action=\"$tt_uri\"> print "<form method='get' action='index.php'>
<input type=\"submit\" value=\"".__("Return to Tiny Tiny RSS")."\"> <button type='submit' dojoType='dijit.form.Button'>".__("Return to Tiny Tiny RSS")."</button>
</form></p>"; </form>";
print "</div></div></body></html>"; print "</div></div></body></html>";