aboutsummaryrefslogtreecommitdiff
path: root/app/views
diff options
context:
space:
mode:
authorGravatar Alexis Degrugillier <aledeg@users.noreply.github.com> 2019-10-23 00:52:15 +0200
committerGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2019-10-23 00:52:15 +0200
commitcc0db9af4f980829faa4bf0960617807b32fb4fa (patch)
tree8a418edeee15e878a12dbff02e241d2d76820be6 /app/views
parentd7f888392678d711478ed64f4a52f43021d143af (diff)
Feature/new archiving (#2335)
* Change archiving config page layout I've changed some wording and moved actions into a maintenance section. * Update purge action Now we have more control on the purge action. The configuration allows us to choose what to keep and what to discard in a more precise way. At the moment, the configuration applies for all feeds. * Add purge configuration on feed level Now the extend purge configuration is available on feed level. It is stored as attributes and will be used in the purge action. * Update purge action Now the purge action uses the feed configuration if it exists and defaults on user configuration if not. * Add empty option in period list * Fix configuration warnings * Add archiving configuration on categories See #2369 * Add user info back * Add explanations in UI * Fixes for SQLite + error + misc. * Fix invalid feed reference * Short array syntax Only for new code, so far * Fix prefix error * Query performance, default values Work in progress * Fix default values and confirm before leaving Form cancel and confirm changes before leaving were broken. And start taking advantage of the short echo syntax `<?= ?>` as we have moved to PHP 5.4+ * More work * Tuning SQL * Fix MariaDB + performance issue * SQL performance * Fix SQLite bug * Fix some attributes JSON encoding bugs Especially for SQLite export/import * More uniform, fix bugs More uniform between global, category, feed settings * Drop special cases for old articles during refresh Instead will use lastSeen date with the new archiving logic. This was generating problems anyway https://github.com/FreshRSS/FreshRSS/issues/2154 * Draft drop index keep_history Not needed anymore * MySQL typo Now properly tested with MySQL, PostgreSQL, SQLite * More work for legacy values Important to avoid overriding user's preference and risking deleting data erroneously * Fix PHP 7.3 / 7.4 warnings @aledeg "Trying to use values of type null, bool, int, float or resource as an array (such as $null["key"]) will now generate a notice. " https://php.net/migration74.incompatible * Reintroduce min articles and take care of legacy parameters * A few changes forgotten * Draft of migration + DROP of feed.keep_history * Fix several errors And give up using const for SQL to allow multiple database types (and we cannot redefine a const) * Add keep_min to categories + factorise archiving logic * Legacy fix * Fix bug yield from * Minor: Use JSON_UNESCAPED_SLASHE for attributes And make more uniform * Fix sign and missing variable * Fine tune the logic
Diffstat (limited to 'app/views')
-rw-r--r--app/views/configure/archiving.phtml110
-rw-r--r--app/views/helpers/category/update.phtml116
-rw-r--r--app/views/helpers/feed/update.phtml113
3 files changed, 309 insertions, 30 deletions
diff --git a/app/views/configure/archiving.phtml b/app/views/configure/archiving.phtml
index 09be55fd9..0387a2b96 100644
--- a/app/views/configure/archiving.phtml
+++ b/app/views/configure/archiving.phtml
@@ -9,23 +9,6 @@
<p><?php echo _i('help'); ?> <?php echo _t('conf.archiving.help'); ?></p>
<div class="form-group">
- <label class="group-name" for="old_entries"><?php echo _t('conf.archiving.delete_after'); ?></label>
- <div class="group-controls">
- <input type="number" id="old_entries" name="old_entries" min="1" max="1200" value="<?php echo FreshRSS_Context::$user_conf->old_entries; ?>" data-leave-validation="<?php echo FreshRSS_Context::$user_conf->old_entries; ?>"/> <?php echo _t('gen.date.month'); ?>
-   <a class="btn confirm" href="<?php echo _url('entry', 'purge'); ?>"><?php echo _t('conf.archiving.purge_now'); ?></a>
- </div>
- </div>
- <div class="form-group">
- <label class="group-name" for="keep_history_default"><?php echo _t('conf.archiving.keep_history_by_feed'); ?></label>
- <div class="group-controls">
- <select class="number" name="keep_history_default" id="keep_history_default" required="required" data-leave-validation="<?php echo FreshRSS_Context::$user_conf->keep_history_default; ?>"><?php
- foreach (array('' => '', 0 => '0', 10 => '10', 50 => '50', 100 => '100', 500 => '500', 1000 => '1 000', 5000 => '5 000', 10000 => '10 000', FreshRSS_Feed::KEEP_HISTORY_INFINITE => '∞') as $v => $t) {
- echo '<option value="' . $v . (FreshRSS_Context::$user_conf->keep_history_default == $v ? '" selected="selected' : '') . '">' . $t . ' </option>';
- }
- ?></select> (<?php echo _t('gen.short.by_default'); ?>)
- </div>
- </div>
- <div class="form-group">
<label class="group-name" for="ttl_default"><?php echo _t('conf.archiving.ttl'); ?></label>
<div class="group-controls">
<select class="number" name="ttl_default" id="ttl_default" required="required" data-leave-validation="<?php echo FreshRSS_Context::$user_conf->ttl_default; ?>"><?php
@@ -47,6 +30,76 @@
</div>
</div>
+ <p class="alert alert-warn">
+ <?= _t('conf.archiving.policy_warning') ?>
+ </p>
+
+ <div class="form-group">
+ <label class="group-name"><?= _t('conf.archiving.policy') ?><br /><small>(<?= _t('gen.short.by_default') ?>)</small></label>
+ <div class="group-controls">
+ <label class="checkbox" for="enable_keep_max">
+ <input type="checkbox" name="enable_keep_max" id="enable_keep_max" value="1"<?= empty(FreshRSS_Context::$user_conf->archiving['keep_max']) ? '' : ' checked="checked"' ?> data-leave-validation="<?= empty(FreshRSS_Context::$user_conf->archiving['keep_max']) ? 0 : 1 ?>"/>
+ <?= _t('conf.archiving.keep_max') ?>
+ <?php $keepMax = empty(FreshRSS_Context::$user_conf->archiving['keep_max']) ? 200 : FreshRSS_Context::$user_conf->archiving['keep_max']; ?>
+ <input type="number" id="keep_max" name="keep_max" min="0" value="<?= $keepMax ?>" data-leave-validation="<?= $keepMax ?>"/>
+ </label>
+ </div>
+ </div>
+
+ <div class="form-group">
+ <div class="group-controls">
+ <label class="checkbox" for="enable_keep_period">
+ <input type="checkbox" name="enable_keep_period" id="enable_keep_period" value="1"<?= FreshRSS_Context::$user_conf->volatile['enable_keep_period'] ? ' checked="checked"' : '' ?> data-leave-validation="<?= FreshRSS_Context::$user_conf->volatile['enable_keep_period'] ? 1 : 0 ?>"/>
+ <?= _t('conf.archiving.keep_period') ?>
+ <input type="number" id="keep_period_count" name="keep_period_count" min="0" value="<?= FreshRSS_Context::$user_conf->volatile['keep_period_count'] ?>" data-leave-validation="<?= FreshRSS_Context::$user_conf->volatile['keep_period_count'] ?>"/>
+ <select class="number" name="keep_period_unit" id="keep_period_unit" data-leave-validation="<?= FreshRSS_Context::$user_conf->volatile['keep_period_unit'] ?>">
+ <option></option>
+ <option value="P1Y" <?= 'P1Y' === FreshRSS_Context::$user_conf->volatile['keep_period_unit'] ? 'selected="selected"' : '' ?>><?= _t('gen.period.years') ?></option>
+ <option value="P1M" <?= 'P1M' === FreshRSS_Context::$user_conf->volatile['keep_period_unit'] ? 'selected="selected"' : '' ?>><?= _t('gen.period.months') ?></option>
+ <option value="P1W" <?= 'P1W' === FreshRSS_Context::$user_conf->volatile['keep_period_unit'] ? 'selected="selected"' : '' ?>><?= _t('gen.period.weeks') ?></option>
+ <option value="P1D" <?= 'P1D' === FreshRSS_Context::$user_conf->volatile['keep_period_unit'] ? 'selected="selected"' : '' ?>><?= _t('gen.period.days') ?></option>
+ <option value="PT1H" <?= 'PT1H' === FreshRSS_Context::$user_conf->volatile['keep_period_unit'] ? 'selected="selected"' : '' ?>><?= _t('gen.period.hours') ?></option>
+ </select>
+ </label>
+ </div>
+ </div>
+
+ <div class="form-group">
+ <label class="group-name"><?= _t('conf.archiving.exception') ?><br /><small>(<?= _t('gen.short.by_default') ?>)</small></label>
+ <div class="group-controls">
+ <label class="checkbox" for="keep_favourites">
+ <input type="checkbox" name="keep_favourites" id="keep_favourites" value="1"<?= FreshRSS_Context::$user_conf->archiving['keep_favourites'] !== false ? ' checked="checked"' : '' ?> data-leave-validation="<?= FreshRSS_Context::$user_conf->archiving['keep_favourites'] !== false ? 1 : 0 ?>"/>
+ <?= _t('conf.archiving.keep_favourites') ?>
+ </label>
+ </div>
+ </div>
+
+ <div class="form-group">
+ <div class="group-controls">
+ <label class="checkbox" for="keep_labels">
+ <input type="checkbox" name="keep_labels" id="keep_labels" value="1"<?= FreshRSS_Context::$user_conf->archiving['keep_labels'] !== false ? ' checked="checked"' : '' ?> data-leave-validation="<?= FreshRSS_Context::$user_conf->archiving['keep_labels'] !== false ? 1 : 0 ?>"/>
+ <?= _t('conf.archiving.keep_labels') ?>
+ </label>
+ </div>
+ </div>
+
+ <div class="form-group">
+ <div class="group-controls">
+ <label class="checkbox" for="keep_unreads">
+ <input type="checkbox" name="keep_unreads" id="keep_unreads" value="1"<?= FreshRSS_Context::$user_conf->archiving['keep_unreads'] ? ' checked="checked"' : '' ?> data-leave-validation="<?= FreshRSS_Context::$user_conf->archiving['keep_unreads'] ? 1 : 0 ?>"/>
+ <?= _t('conf.archiving.keep_unreads') ?>
+ </label>
+ </div>
+ </div>
+
+ <div class="form-group">
+ <div class="group-controls">
+ <label for="keep_min_default"><?php echo _t('conf.archiving.keep_min_by_feed'); ?>
+ <input type="number" id="keep_min_default" name="keep_min_default" min="0" value="<?= FreshRSS_Context::$user_conf->archiving['keep_min'] ?>" data-leave-validation="<?= FreshRSS_Context::$user_conf->archiving['keep_min'] ?>">
+ </label>
+ </div>
+ </div>
+
<div class="form-group form-actions">
<div class="group-controls">
<button type="submit" class="btn btn-important"><?php echo _t('gen.action.submit'); ?></button>
@@ -55,9 +108,9 @@
</div>
</form>
- <form method="post" action="<?php echo _url('entry', 'optimize'); ?>">
+ <legend><?php echo _t('conf.archiving.maintenance'); ?></legend>
+ <form method="post" action="<?php echo _url('entry', 'purge'); ?>">
<input type="hidden" name="_csrf" value="<?php echo FreshRSS_Auth::csrfToken(); ?>" />
- <legend><?php echo _t('conf.archiving.advanced'); ?></legend>
<div class="form-group">
<label class="group-name"><?php echo _t('conf.user.current'); ?></label>
@@ -66,21 +119,30 @@
</div>
</div>
- <?php if (FreshRSS_Auth::hasAccess('admin')) { ?>
<div class="form-group">
- <label class="group-name"><?php echo _t('conf.user.users'); ?></label>
<div class="group-controls">
- <?php echo format_bytes($this->size_total); ?>
+ <button type="submit" class="btn btn-important confirm"><?php echo _t('conf.archiving.purge_now'); ?></button>
</div>
</div>
+ </form>
- <div class="form-group form-actions">
+ <form method="post" action="<?php echo _url('entry', 'optimize'); ?>">
+ <input type="hidden" name="_csrf" value="<?php echo FreshRSS_Auth::csrfToken(); ?>" />
+ <div class="form-group">
<div class="group-controls">
<input type="hidden" name="optimiseDatabase" value="1" />
<button type="submit" class="btn btn-important"><?php echo _t('conf.archiving.optimize'); ?></button>
<?php echo _i('help'); ?> <?php echo _t('conf.archiving.optimize_help'); ?>
</div>
</div>
- <?php } ?>
</form>
+
+ <?php if (FreshRSS_Auth::hasAccess('admin')): ?>
+ <div class="form-group">
+ <label class="group-name"><?php echo _t('conf.user.users'); ?></label>
+ <div class="group-controls">
+ <?php echo format_bytes($this->size_total); ?>
+ </div>
+ </div>
+ <?php endif; ?>
</div>
diff --git a/app/views/helpers/category/update.phtml b/app/views/helpers/category/update.phtml
index b64bd786a..31482f163 100644
--- a/app/views/helpers/category/update.phtml
+++ b/app/views/helpers/category/update.phtml
@@ -33,5 +33,121 @@
<?php endif;?>
</div>
</div>
+
+ <legend><?php echo _t('sub.category.archiving'); ?></legend>
+ <?php
+ $archiving = $this->category->attributes('archiving');
+ if (empty($archiving)) {
+ $archiving = [ 'default' => true ];
+ } else {
+ $archiving['default'] = false;
+ }
+ $volatile = [
+ 'enable_keep_period' => false,
+ 'keep_period_count' => '3',
+ 'keep_period_unit' => 'P1M',
+ ];
+ if (!empty($archiving['keep_period'])) {
+ if (preg_match('/^PT?(?P<count>\d+)[YMWDH]$/', $archiving['keep_period'], $matches)) {
+ $volatile['enable_keep_period'] = true;
+ $volatile['keep_period_count'] = $matches['count'];
+ $volatile['keep_period_unit'] = str_replace($matches['count'], '1', $archiving['keep_period']);
+ }
+ }
+ //Defaults
+ if (!isset($archiving['keep_max'])) {
+ $archiving['keep_max'] = false;
+ }
+ if (!isset($archiving['keep_favourites'])) {
+ $archiving['keep_favourites'] = true;
+ }
+ if (!isset($archiving['keep_labels'])) {
+ $archiving['keep_labels'] = true;
+ }
+ if (!isset($archiving['keep_unreads'])) {
+ $archiving['keep_unreads'] = false;
+ }
+ if (!isset($archiving['keep_min'])) {
+ $archiving['keep_min'] = 50;
+ }
+ ?>
+
+ <p class="alert alert-warn">
+ <?= _t('conf.archiving.policy_warning') ?>
+ </p>
+
+ <div class="form-group">
+ <label class="group-name"><?= _t('conf.archiving.policy') ?></label>
+ <div class="group-controls">
+ <label class="checkbox">
+ <input type="checkbox" name="use_default_purge_options" id="use_default_purge_options" value="1"<?= $archiving['default'] ? ' checked="checked"' : '' ?> data-leave-validation="<?= $archiving['default'] ? 1 : 0 ?>" />
+ <?= _t('gen.short.by_default') ?>
+ </label>
+ </div>
+ </div>
+ <div class="form-group archiving"<?= $archiving['default'] ? ' hidden="hidden"' : '' ?>>
+ <div class="group-controls">
+ <label class="checkbox" for="enable_keep_max">
+ <input type="checkbox" name="enable_keep_max" id="enable_keep_max" value="1"<?= empty($archiving['keep_max']) ? '' : ' checked="checked"' ?> data-leave-validation="<?= empty($archiving['keep_max']) ? 0 : 1 ?>"/>
+ <?= _t('conf.archiving.keep_max') ?>
+ <input type="number" id="keep_max" name="keep_max" min="0" value="<?= empty($archiving['keep_max']) ? 200 : $archiving['keep_max'] ?>" data-leave-validation="<?= empty($archiving['keep_max']) ? 200 : $archiving['keep_max'] ?>"/>
+ </label>
+ </div>
+ </div>
+ <div class="form-group archiving"<?= $archiving['default'] ? ' hidden="hidden"' : '' ?>>
+ <div class="group-controls">
+ <label class="checkbox" for="enable_keep_period">
+ <input type="checkbox" name="enable_keep_period" id="enable_keep_period" value="1"<?= $volatile['enable_keep_period'] ? ' checked="checked"' : '' ?> data-leave-validation="<?= $volatile['enable_keep_period'] ? 1 : 0 ?>"/>
+ <?= _t('conf.archiving.keep_period') ?>
+ <input type="number" id="keep_period_count" name="keep_period_count" min="0" value="<?= $volatile['keep_period_count'] ?>" data-leave-validation="<?= $volatile['keep_period_count'] ?>"/>
+ <select class="number" name="keep_period_unit" id="keep_period_unit" data-leave-validation="<?= $volatile['keep_period_unit'] ?>">
+ <option></option>
+ <option value="P1Y" <?= 'P1Y' === $volatile['keep_period_unit'] ? 'selected="selected"' : '' ?>><?= _t('gen.period.years') ?></option>
+ <option value="P1M" <?= 'P1M' === $volatile['keep_period_unit'] ? 'selected="selected"' : '' ?>><?= _t('gen.period.months') ?></option>
+ <option value="P1W" <?= 'P1W' === $volatile['keep_period_unit'] ? 'selected="selected"' : '' ?>><?= _t('gen.period.weeks') ?></option>
+ <option value="P1D" <?= 'P1D' === $volatile['keep_period_unit'] ? 'selected="selected"' : '' ?>><?= _t('gen.period.days') ?></option>
+ <option value="PT1H" <?= 'PT1H' === $volatile['keep_period_unit'] ? 'selected="selected"' : '' ?>><?= _t('gen.period.hours') ?></option>
+ </select>
+ </label>
+ </div>
+ </div>
+ <div class="form-group archiving"<?= $archiving['default'] ? ' hidden="hidden"' : '' ?>>
+ <label class="group-name"><?= _t('conf.archiving.exception') ?></label>
+ <div class="group-controls">
+ <label class="checkbox" for="keep_favourites">
+ <input type="checkbox" name="keep_favourites" id="keep_favourites" value="1"<?= $archiving['keep_favourites'] ? ' checked="checked"' : '' ?> data-leave-validation="<?= $archiving['keep_favourites'] ? 1 : 0 ?>"/>
+ <?= _t('conf.archiving.keep_favourites') ?>
+ </label>
+ </div>
+ </div>
+ <div class="form-group archiving"<?= $archiving['default'] ? ' hidden="hidden"' : '' ?>>
+ <div class="group-controls">
+ <label class="checkbox" for="keep_labels">
+ <input type="checkbox" name="keep_labels" id="keep_labels" value="1"<?= $archiving['keep_labels'] ? ' checked="checked"' : '' ?> data-leave-validation="<?= $archiving['keep_labels'] ? 1 : 0 ?>"/>
+ <?= _t('conf.archiving.keep_labels') ?>
+ </label>
+ </div>
+ </div>
+ <div class="form-group archiving"<?= $archiving['default'] ? ' hidden="hidden"' : '' ?>>
+ <div class="group-controls">
+ <label class="checkbox" for="keep_unreads">
+ <input type="checkbox" name="keep_unreads" id="keep_unreads" value="1"<?= $archiving['keep_unreads'] ? ' checked="checked"' : '' ?> data-leave-validation="<?= $archiving['keep_unreads'] ? 1 : 0 ?>"/>
+ <?= _t('conf.archiving.keep_unreads') ?>
+ </label>
+ </div>
+ </div>
+ <div class="form-group archiving"<?= $archiving['default'] ? ' hidden="hidden"' : '' ?>>
+ <div class="group-controls">
+ <label for="keep_min"><?php echo _t('sub.feed.keep_min'); ?>
+ <input type="number" id="keep_min" name="keep_min" min="0" value="<?= $archiving['keep_min'] ?>" data-leave-validation="<?= $archiving['keep_min'] ?>">
+ </label>
+ </div>
+ </div>
+ <div class="form-group form-actions">
+ <div class="group-controls">
+ <button class="btn btn-important"><?= _t('gen.action.submit') ?></button>
+ <button type="reset" class="btn"><?= _t('gen.action.cancel') ?></button>
+ </div>
+ </div>
</form>
</div>
diff --git a/app/views/helpers/feed/update.phtml b/app/views/helpers/feed/update.phtml
index 620806d7b..84461ed03 100644
--- a/app/views/helpers/feed/update.phtml
+++ b/app/views/helpers/feed/update.phtml
@@ -78,6 +78,7 @@
<div class="form-group form-actions">
<div class="group-controls">
<button class="btn btn-important"><?php echo _t('gen.action.submit'); ?></button>
+ <button type="reset" class="btn"><?php echo _t('gen.action.cancel'); ?></button>
<button class="btn btn-attention confirm"
data-str-confirm="<?php echo _t('gen.js.confirm_action_feed_cat'); ?>"
formaction="<?php echo _url('feed', 'delete', 'id', $this->feed->id()); ?>"
@@ -97,16 +98,115 @@
</div>
</div>
</div>
+ <?php
+ $archiving = $this->feed->attributes('archiving');
+ if (empty($archiving)) {
+ $archiving = [ 'default' => true ];
+ } else {
+ $archiving['default'] = false;
+ }
+ $volatile = [
+ 'enable_keep_period' => false,
+ 'keep_period_count' => '3',
+ 'keep_period_unit' => 'P1M',
+ ];
+ if (!empty($archiving['keep_period'])) {
+ if (preg_match('/^PT?(?P<count>\d+)[YMWDH]$/', $archiving['keep_period'], $matches)) {
+ $volatile['enable_keep_period'] = true;
+ $volatile['keep_period_count'] = $matches['count'];
+ $volatile['keep_period_unit'] = str_replace($matches['count'], '1', $archiving['keep_period']);
+ }
+ }
+ //Defaults
+ if (!isset($archiving['keep_max'])) {
+ $archiving['keep_max'] = false;
+ }
+ if (!isset($archiving['keep_min'])) {
+ $archiving['keep_min'] = 50;
+ }
+ if (!isset($archiving['keep_favourites'])) {
+ $archiving['keep_favourites'] = true;
+ }
+ if (!isset($archiving['keep_labels'])) {
+ $archiving['keep_labels'] = true;
+ }
+ if (!isset($archiving['keep_unreads'])) {
+ $archiving['keep_unreads'] = false;
+ }
+ ?>
+
+ <p class="alert alert-warn">
+ <?= _t('conf.archiving.policy_warning') ?>
+ </p>
+
<div class="form-group">
- <label class="group-name" for="keep_history"><?php echo _t('sub.feed.keep_history'); ?></label>
+ <label class="group-name"><?= _t('conf.archiving.policy') ?></label>
<div class="group-controls">
- <select class="number" name="keep_history" id="keep_history" required="required"><?php
- foreach (array('' => '', FreshRSS_Feed::KEEP_HISTORY_DEFAULT => _t('gen.short.by_default'), 0 => '0', 10 => '10', 50 => '50', 100 => '100', 500 => '500', 1000 => '1 000', 5000 => '5 000', 10000 => '10 000', FreshRSS_Feed::KEEP_HISTORY_INFINITE => '∞') as $v => $t) {
- echo '<option value="' . $v . ($this->feed->keepHistory() === $v ? '" selected="selected' : '') . '">' . $t . '</option>';
- }
- ?></select>
+ <label class="checkbox">
+ <input type="checkbox" name="use_default_purge_options" id="use_default_purge_options" value="1"<?= $archiving['default'] ? ' checked="checked"' : '' ?> data-leave-validation="<?= $archiving['default'] ? 1 : 0 ?>" />
+ <?= _t('gen.short.by_default') ?>
+ </label>
</div>
</div>
+ <div class="form-group archiving"<?= $archiving['default'] ? ' hidden="hidden"' : '' ?>>
+ <div class="group-controls">
+ <label class="checkbox" for="enable_keep_max">
+ <input type="checkbox" name="enable_keep_max" id="enable_keep_max" value="1"<?= empty($archiving['keep_max']) ? '' : ' checked="checked"' ?> data-leave-validation="<?= empty($archiving['keep_max']) ? 0 : 1 ?>"/>
+ <?= _t('conf.archiving.keep_max') ?>
+ <input type="number" id="keep_max" name="keep_max" min="0" value="<?= empty($archiving['keep_max']) ? 200 : $archiving['keep_max'] ?>" data-leave-validation="<?= empty($archiving['keep_max']) ? 200 : $archiving['keep_max'] ?>"/>
+ </label>
+ </div>
+ </div>
+ <div class="form-group archiving"<?= $archiving['default'] ? ' hidden="hidden"' : '' ?>>
+ <div class="group-controls">
+ <label class="checkbox" for="enable_keep_period">
+ <input type="checkbox" name="enable_keep_period" id="enable_keep_period" value="1"<?= $volatile['enable_keep_period'] ? ' checked="checked"' : '' ?> data-leave-validation="<?= $volatile['enable_keep_period'] ? 1 : 0 ?>"/>
+ <?= _t('conf.archiving.keep_period') ?>
+ <input type="number" id="keep_period_count" name="keep_period_count" min="0" value="<?= $volatile['keep_period_count'] ?>" data-leave-validation="<?= $volatile['keep_period_count'] ?>"/>
+ <select class="number" name="keep_period_unit" id="keep_period_unit" data-leave-validation="<?= $volatile['keep_period_unit'] ?>">
+ <option></option>
+ <option value="P1Y" <?= 'P1Y' === $volatile['keep_period_unit'] ? 'selected="selected"' : '' ?>><?= _t('gen.period.years') ?></option>
+ <option value="P1M" <?= 'P1M' === $volatile['keep_period_unit'] ? 'selected="selected"' : '' ?>><?= _t('gen.period.months') ?></option>
+ <option value="P1W" <?= 'P1W' === $volatile['keep_period_unit'] ? 'selected="selected"' : '' ?>><?= _t('gen.period.weeks') ?></option>
+ <option value="P1D" <?= 'P1D' === $volatile['keep_period_unit'] ? 'selected="selected"' : '' ?>><?= _t('gen.period.days') ?></option>
+ <option value="PT1H" <?= 'PT1H' === $volatile['keep_period_unit'] ? 'selected="selected"' : '' ?>><?= _t('gen.period.hours') ?></option>
+ </select>
+ </label>
+ </div>
+ </div>
+ <div class="form-group archiving"<?= $archiving['default'] ? ' hidden="hidden"' : '' ?>>
+ <label class="group-name"><?= _t('conf.archiving.exception') ?></label>
+ <div class="group-controls">
+ <label class="checkbox" for="keep_favourites">
+ <input type="checkbox" name="keep_favourites" id="keep_favourites" value="1"<?= $archiving['keep_favourites'] ? ' checked="checked"' : '' ?> data-leave-validation="<?= $archiving['keep_favourites'] ? 1 : 0 ?>"/>
+ <?= _t('conf.archiving.keep_favourites') ?>
+ </label>
+ </div>
+ </div>
+ <div class="form-group archiving"<?= $archiving['default'] ? ' hidden="hidden"' : '' ?>>
+ <div class="group-controls">
+ <label class="checkbox" for="keep_labels">
+ <input type="checkbox" name="keep_labels" id="keep_labels" value="1"<?= $archiving['keep_labels'] ? ' checked="checked"' : '' ?> data-leave-validation="<?= $archiving['keep_labels'] ? 1 : 0 ?>"/>
+ <?= _t('conf.archiving.keep_labels') ?>
+ </label>
+ </div>
+ </div>
+ <div class="form-group archiving"<?= $archiving['default'] ? ' hidden="hidden"' : '' ?>>
+ <div class="group-controls">
+ <label class="checkbox" for="keep_unreads">
+ <input type="checkbox" name="keep_unreads" id="keep_unreads" value="1"<?= $archiving['keep_unreads'] ? ' checked="checked"' : '' ?> data-leave-validation="<?= $archiving['keep_unreads'] ?>"/>
+ <?= _t('conf.archiving.keep_unreads') ?>
+ </label>
+ </div>
+ </div>
+ <div class="form-group archiving"<?= $archiving['default'] ? ' hidden="hidden"' : '' ?>>
+ <div class="group-controls">
+ <label for="keep_min"><?php echo _t('sub.feed.keep_min'); ?>
+ <input type="number" id="keep_min" name="keep_min" min="0" value="<?= $archiving['keep_min'] ?>" data-leave-validation="<?= $archiving['keep_min'] ?>">
+ </label>
+ </div>
+ </div>
+
<div class="form-group">
<label class="group-name" for="ttl"><?php echo _t('sub.feed.ttl'); ?></label>
<div class="group-controls">
@@ -143,6 +243,7 @@
<div class="form-group form-actions">
<div class="group-controls">
<button class="btn btn-important"><?php echo _t('gen.action.submit'); ?></button>
+ <button type="reset" class="btn"><?php echo _t('gen.action.cancel'); ?></button>
<button class="btn btn-attention confirm" formmethod="post" formaction="<?php echo _url('feed', 'truncate', 'id', $this->feed->id()); ?>"><?php echo _t('gen.action.truncate'); ?></button>
</div>
</div>