summaryrefslogtreecommitdiff
path: root/app/views/subscription
diff options
context:
space:
mode:
authorGravatar Marien Fressinaud <dev@marienfressinaud.fr> 2014-10-01 11:27:41 +0200
committerGravatar Marien Fressinaud <dev@marienfressinaud.fr> 2014-10-01 11:27:41 +0200
commit1eef7893068655f8d145a3e06061a9e6296ac1f3 (patch)
treeec9cc77f2dc39baedf92a155da124bb6bd800984 /app/views/subscription
parentfdb63fbbe695b6a6bc32f0e93f2ff702ca42329c (diff)
Reorganize subscription management code
There is still a lot of work to do. Some links are broken. See https://github.com/marienfressinaud/FreshRSS/issues/646
Diffstat (limited to 'app/views/subscription')
-rw-r--r--app/views/subscription/feed.phtml186
-rw-r--r--app/views/subscription/index.phtml132
2 files changed, 318 insertions, 0 deletions
diff --git a/app/views/subscription/feed.phtml b/app/views/subscription/feed.phtml
new file mode 100644
index 000000000..e047741a1
--- /dev/null
+++ b/app/views/subscription/feed.phtml
@@ -0,0 +1,186 @@
+<?php
+ if (!Minz_Request::param('ajax')) {
+ $this->partial('aside_subscription');
+ }
+?>
+
+<?php if ($this->flux) { ?>
+<div class="post">
+ <!-- <a href="<?php echo _url ('index', 'index'); ?>"><?php echo Minz_Translate::t ('back_to_rss_feeds'); ?></a> <?php echo Minz_Translate::t ('or'); ?> <a href="<?php echo _url ('index', 'index', 'get', 'f_' . $this->flux->id ()); ?>"><?php echo Minz_Translate::t ('filter'); ?></a> -->
+
+ <h1><?php echo $this->flux->name (); ?></h1>
+ <?php echo $this->flux->description (); ?>
+
+ <?php $nbEntries = $this->flux->nbEntries (); ?>
+
+ <?php if ($this->flux->inError ()) { ?>
+ <p class="alert alert-error"><span class="alert-head"><?php echo Minz_Translate::t ('damn'); ?></span> <?php echo Minz_Translate::t ('feed_in_error'); ?></p>
+ <?php } elseif ($nbEntries === 0) { ?>
+ <p class="alert alert-warn"><?php echo Minz_Translate::t ('feed_empty'); ?></p>
+ <?php } ?>
+
+ <form method="post" action="<?php echo _url ('subscription', 'feed', 'id', $this->flux->id ()); ?>" autocomplete="off">
+ <legend><?php echo Minz_Translate::t ('informations'); ?></legend>
+ <div class="form-group">
+ <label class="group-name" for="name"><?php echo Minz_Translate::t ('title'); ?></label>
+ <div class="group-controls">
+ <input type="text" name="name" id="name" class="extend" value="<?php echo $this->flux->name () ; ?>" />
+ </div>
+ </div>
+ <div class="form-group">
+ <label class="group-name" for="description"><?php echo Minz_Translate::t ('feed_description'); ?></label>
+ <div class="group-controls">
+ <textarea name="description" id="description"><?php echo htmlspecialchars($this->flux->description(), ENT_NOQUOTES, 'UTF-8'); ?></textarea>
+ </div>
+ </div>
+ <div class="form-group">
+ <label class="group-name" for="website"><?php echo Minz_Translate::t ('website_url'); ?></label>
+ <div class="group-controls">
+ <div class="stick">
+ <input type="text" name="website" id="website" class="extend" value="<?php echo $this->flux->website (); ?>" />
+ <a class="btn" target="_blank" href="<?php echo $this->flux->website (); ?>"><?php echo FreshRSS_Themes::icon('link'); ?></a>
+ </div>
+ </div>
+ </div>
+ <div class="form-group">
+ <label class="group-name" for="url"><?php echo Minz_Translate::t ('feed_url'); ?></label>
+ <div class="group-controls">
+ <div class="stick">
+ <input type="text" name="url" id="url" class="extend" value="<?php echo $this->flux->url (); ?>" />
+ <a class="btn" target="_blank" href="<?php echo $this->flux->url (); ?>"><?php echo FreshRSS_Themes::icon('link'); ?></a>
+ </div>
+
+ <a class="btn" target="_blank" href="http://validator.w3.org/feed/check.cgi?url=<?php echo $this->flux->url (); ?>"><?php echo Minz_Translate::t ('feed_validator'); ?></a>
+ </div>
+ </div>
+ <div class="form-group">
+ <label class="group-name" for="category"><?php echo Minz_Translate::t ('category'); ?></label>
+ <div class="group-controls">
+ <select name="category" id="category">
+ <?php foreach ($this->categories as $cat) { ?>
+ <option value="<?php echo $cat->id (); ?>"<?php echo $cat->id ()== $this->flux->category () ? ' selected="selected"' : ''; ?>>
+ <?php echo $cat->name (); ?>
+ </option>
+ <?php } ?>
+ </select>
+ </div>
+ </div>
+ <div class="form-group">
+ <label class="group-name" for="priority"><?php echo Minz_Translate::t ('show_in_all_flux'); ?></label>
+ <div class="group-controls">
+ <label class="checkbox" for="priority">
+ <input type="checkbox" name="priority" id="priority" value="10"<?php echo $this->flux->priority () > 0 ? ' checked="checked"' : ''; ?> />
+ <?php echo Minz_Translate::t ('yes'); ?>
+ </label>
+ </div>
+ </div>
+ <div class="form-group">
+ <div class="group-controls">
+ <a href="<?php echo _url('stats', 'repartition', 'id', $this->flux->id()); ?>">
+ <?php echo _i('stats'); ?> <?php echo _t('stats'); ?>
+ </a>
+ </div>
+ </div>
+ <div class="form-group form-actions">
+ <div class="group-controls">
+ <button class="btn btn-important"><?php echo _t('save'); ?></button>
+ <button class="btn btn-attention confirm"
+ data-str-confirm="<?php echo _t('confirm_action_feed_cat'); ?>"
+ formaction="<?php echo _url('feed', 'delete', 'id', $this->flux->id ()); ?>"
+ formmethod="post"><?php echo _t('delete'); ?></button>
+ </div>
+ </div>
+
+ <legend><?php echo Minz_Translate::t ('archiving_configuration'); ?></legend>
+
+ <div class="form-group">
+ <div class="group-controls">
+ <div class="stick">
+ <input type="text" value="<?php echo _t('number_articles', $nbEntries); ?>" disabled="disabled" />
+ <a class="btn" href="<?php echo _url('feed', 'actualize', 'id', $this->flux->id ()); ?>">
+ <?php echo _i('refresh'); ?> <?php echo _t('actualize'); ?>
+ </a>
+ </div>
+ </div>
+ </div>
+ <div class="form-group">
+ <label class="group-name" for="keep_history"><?php echo Minz_Translate::t ('keep_history'); ?></label>
+ <div class="group-controls">
+ <select class="number" name="keep_history" id="keep_history" required="required"><?php
+ foreach (array('' => '', -2 => Minz_Translate::t('by_default'), 0 => '0', 10 => '10', 50 => '50', 100 => '100', 500 => '500', 1000 => '1 000', 5000 => '5 000', 10000 => '10 000', -1 => '∞') as $v => $t) {
+ echo '<option value="' . $v . ($this->flux->keepHistory() === $v ? '" selected="selected' : '') . '">' . $t . '</option>';
+ }
+ ?></select>
+ </div>
+ </div>
+ <div class="form-group">
+ <label class="group-name" for="ttl"><?php echo Minz_Translate::t('ttl'); ?></label>
+ <div class="group-controls">
+ <select class="number" name="ttl" id="ttl" required="required"><?php
+ $found = false;
+ foreach (array(-2 => Minz_Translate::t('by_default'), 900 => '15min', 1200 => '20min', 1500 => '25min', 1800 => '30min', 2700 => '45min',
+ 3600 => '1h', 5400 => '1.5h', 7200 => '2h', 10800 => '3h', 14400 => '4h', 18800 => '5h', 21600 => '6h', 25200 => '7h', 28800 => '8h',
+ 36000 => '10h', 43200 => '12h', 64800 => '18h',
+ 86400 => '1d', 129600 => '1.5d', 172800 => '2d', 259200 => '3d', 345600 => '4d', 432000 => '5d', 518400 => '6d',
+ 604800 => '1wk', 1209600 => '2wk', 1814400 => '3wk', 2419200 => '4wk', 2629744 => '1mo', -1 => '∞') as $v => $t) {
+ echo '<option value="' . $v . ($this->flux->ttl() === $v ? '" selected="selected' : '') . '">' . $t . '</option>';
+ if ($this->flux->ttl() == $v) {
+ $found = true;
+ }
+ }
+ if (!$found) {
+ echo '<option value="' . intval($this->flux->ttl()) . '" selected="selected">' . intval($this->flux->ttl()) . 's</option>';
+ }
+ ?></select>
+ </div>
+ </div>
+ <div class="form-group form-actions">
+ <div class="group-controls">
+ <button class="btn btn-important"><?php echo Minz_Translate::t ('save'); ?></button>
+ <button class="btn btn-attention confirm" formmethod="post" formaction="<?php echo Minz_Url::display (array ('c' => 'feed', 'a' => 'truncate', 'params' => array ('id' => $this->flux->id ()))); ?>"><?php echo Minz_Translate::t ('truncate'); ?></button>
+ </div>
+ </div>
+
+ <legend><?php echo Minz_Translate::t ('login_configuration'); ?></legend>
+ <?php $auth = $this->flux->httpAuth (false); ?>
+ <div class="form-group">
+ <label class="group-name" for="http_user"><?php echo Minz_Translate::t ('http_username'); ?></label>
+ <div class="group-controls">
+ <input type="text" name="http_user" id="http_user" class="extend" value="<?php echo $auth['username']; ?>" autocomplete="off" />
+ <?php echo FreshRSS_Themes::icon('help'); ?> <?php echo Minz_Translate::t ('access_protected_feeds'); ?>
+ </div>
+
+ <label class="group-name" for="http_pass"><?php echo Minz_Translate::t ('http_password'); ?></label>
+ <div class="group-controls">
+ <input type="password" name="http_pass" id="http_pass" class="extend" value="<?php echo $auth['password']; ?>" autocomplete="off" />
+ </div>
+ </div>
+
+ <div class="form-group form-actions">
+ <div class="group-controls">
+ <button type="submit" class="btn btn-important"><?php echo Minz_Translate::t ('save'); ?></button>
+ <button type="reset" class="btn"><?php echo Minz_Translate::t ('cancel'); ?></button>
+ </div>
+ </div>
+
+ <legend><?php echo Minz_Translate::t ('advanced'); ?></legend>
+ <div class="form-group">
+ <label class="group-name" for="path_entries"><?php echo Minz_Translate::t ('css_path_on_website'); ?></label>
+ <div class="group-controls">
+ <input type="text" name="path_entries" id="path_entries" class="extend" value="<?php echo $this->flux->pathEntries (); ?>" placeholder="<?php echo Minz_Translate::t ('blank_to_disable'); ?>" />
+ <?php echo FreshRSS_Themes::icon('help'); ?> <?php echo Minz_Translate::t ('retrieve_truncated_feeds'); ?>
+ </div>
+ </div>
+
+ <div class="form-group form-actions">
+ <div class="group-controls">
+ <button type="submit" class="btn btn-important"><?php echo Minz_Translate::t ('save'); ?></button>
+ <button type="reset" class="btn"><?php echo Minz_Translate::t ('cancel'); ?></button>
+ </div>
+ </div>
+ </form>
+</div>
+
+<?php } else { ?>
+<div class="alert alert-warn"><span class="alert-head"><?php echo Minz_Translate::t ('no_selected_feed'); ?></span> <?php echo Minz_Translate::t ('think_to_add'); ?></div>
+<?php } ?>
diff --git a/app/views/subscription/index.phtml b/app/views/subscription/index.phtml
new file mode 100644
index 000000000..444dc9d9b
--- /dev/null
+++ b/app/views/subscription/index.phtml
@@ -0,0 +1,132 @@
+<?php $this->partial('aside_subscription'); ?>
+
+<div class="post">
+ <a href="<?php echo _url('index', 'index'); ?>"><?php echo _t('back_to_rss_feeds'); ?></a>
+
+ <h2><?php echo _t('subscription_management'); ?></h2>
+
+ <form id="add_rss" method="post" action="<?php echo _url('feed', 'add'); ?>" autocomplete="off">
+ <div class="stick">
+ <input type="url" name="url_rss" class="extend" placeholder="<?php echo _t('add_rss_feed'); ?>" />
+ <div class="dropdown">
+ <div id="dropdown-cat" class="dropdown-target"></div>
+
+ <a class="dropdown-toggle btn" href="#dropdown-cat"><?php echo _i('down'); ?></a>
+ <ul class="dropdown-menu">
+ <li class="dropdown-close"><a href="#close">❌</a></li>
+
+ <li class="dropdown-header"><?php echo _t('category'); ?></li>
+
+ <li class="input">
+ <select name="category" id="category">
+ <?php foreach ($this->categories as $cat) { ?>
+ <option value="<?php echo $cat->id(); ?>"<?php echo $cat->id() == 1 ? ' selected="selected"' : ''; ?>>
+ <?php echo $cat->name(); ?>
+ </option>
+ <?php } ?>
+ <option value="nc"><?php echo _t('new_category'); ?></option>
+ </select>
+ </li>
+
+ <li class="input" style="display:none">
+ <input type="text" name="new_category[name]" id="new_category_name" autocomplete="off" placeholder="<?php echo _t('new_category'); ?>" />
+ </li>
+
+ <li class="separator"></li>
+
+ <li class="dropdown-header"><?php echo _t('http_authentication'); ?></li>
+ <li class="input">
+ <input type="text" name="http_user" id="http_user_add" autocomplete="off" placeholder="<?php echo _t('username'); ?>" />
+ </li>
+ <li class="input">
+ <input type="password" name="http_pass" id="http_pass_add" autocomplete="off" placeholder="<?php echo _t('password'); ?>" />
+ </li>
+ </ul>
+ </div>
+ <button class="btn" type="submit"><?php echo _i('add'); ?></button>
+ </div>
+ </form>
+
+ <p class="alert alert-warn">
+ <?php echo _t('feeds_moved_category_deleted', $this->default_category->name()); ?>
+ </p>
+
+ <div class="box">
+ <div class="box-title"><label for="new-category"><?php echo _t('add_category'); ?></label></div>
+
+ <ul class="box-content box-content-centered">
+ <form action="<?php echo _url('category', 'create'); ?>" method="post">
+ <li class="item"><input type="text" id="new-category" name="new-category" placeholder="<?php echo _t('new_category'); ?>" /></li>
+ <li class="item"><button class="btn btn-important" type="submit"><?php echo _t('submit'); ?></button></li>
+ </form>
+ </ul>
+ </div>
+
+ <form id="controller-category" method="post" style="display: none;"></form>
+
+ <?php
+ foreach ($this->categories as $cat) {
+ $feeds = $cat->feeds();
+ ?>
+ <div class="box">
+ <div class="box-title">
+ <form action="<?php echo _url('category', 'update', 'id', $cat->id()); ?>" method="post">
+ <input type="text" name="name" value="<?php echo $cat->name(); ?>" />
+
+ <div class="dropdown">
+ <div id="dropdown-cat-<?php echo $cat->id(); ?>" class="dropdown-target"></div>
+
+ <a class="dropdown-toggle btn" href="#dropdown-cat-<?php echo $cat->id(); ?>"><?php echo _i('down'); ?></a>
+ <ul class="dropdown-menu">
+ <li class="dropdown-close"><a href="#close">❌</a></li>
+
+ <li class="item"><a href="<?php echo _url('index', 'index', 'get', 'c_' . $cat->id()); ?>"><?php echo _t('filter'); ?></a></li>
+
+ <li class="separator"></li>
+
+ <?php if (!empty($feeds)) { ?>
+ <li class="item">
+ <button class="as-link confirm"
+ data-str-confirm="<?php echo _t('confirm_action_feed_cat'); ?>"
+ type="submit"
+ form="controller-category"
+ formaction="<?php echo _url('category', 'empty', 'id', $cat->id()); ?>">
+ <?php echo _t('ask_empty'); ?></button>
+ </li>
+ <?php } ?>
+ <li class="item">
+ <button class="as-link confirm"
+ data-str-confirm="<?php echo _t('confirm_action_feed_cat'); ?>"
+ type="submit"
+ form="controller-category"
+ formaction="<?php echo _url('category', 'delete', 'id', $cat->id()); ?>">
+ <?php echo _t('delete'); ?></button>
+ </li>
+ </ul>
+ </div>
+ </form>
+ </div>
+
+ <ul class="box-content">
+ <?php if (!empty($feeds)) { ?>
+ <?php
+ foreach ($feeds as $feed) {
+ $error = $feed->inError() ? ' error' : '';
+ $empty = $feed->nbEntries() == 0 ? ' empty' : '';
+ ?>
+ <li class="item<?php echo $error, $empty; ?>">
+ <a class="configure open-slider" href="<?php echo _url('subscription', 'feed', 'id', $feed->id()); ?>"><?php echo _i('configure'); ?></a>
+ <img class="favicon" src="<?php echo $feed->favicon(); ?>" alt="✇" /> <?php echo $feed->name(); ?>
+ </li>
+ <?php }
+ } else {
+ ?>
+ <li class="item"><?php echo _t('category_empty'); ?></li>
+ <?php } ?>
+ </ul>
+ </div>
+ <?php } ?>
+</div>
+
+<div id="slider">
+</div>