archiving.phtml 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. <?php
  2. /** @var FreshRSS_View $this */
  3. $this->partial('aside_configure');
  4. ?>
  5. <main class="post">
  6. <div class="link-back-wrapper">
  7. <a class="link-back" href="<?= _url('index', 'index') ?>"><?= _t('gen.action.back_to_rss_feeds') ?></a>
  8. </div>
  9. <h1><?= _t('conf.archiving') ?></h1>
  10. <p class="help"><?= _i('help') ?> <?= _t('conf.archiving.help') ?></p>
  11. <form method="post" action="<?= _url('configure', 'archiving') ?>">
  12. <input type="hidden" name="_csrf" value="<?= FreshRSS_Auth::csrfToken() ?>" />
  13. <div class="form-group">
  14. <label class="group-name" for="ttl_default"><?= _t('conf.archiving.ttl') ?></label>
  15. <div class="group-controls">
  16. <select class="number" name="ttl_default" id="ttl_default" required="required" data-leave-validation="<?= FreshRSS_Context::$user_conf->ttl_default ?>"><?php
  17. $found = false;
  18. foreach (array(1200 => '20min', 1500 => '25min', 1800 => '30min', 2700 => '45min',
  19. 3600 => '1h', 5400 => '1.5h', 7200 => '2h', 10800 => '3h', 14400 => '4h', 18800 => '5h', 21600 => '6h', 25200 => '7h', 28800 => '8h',
  20. 36000 => '10h', 43200 => '12h', 64800 => '18h',
  21. 86400 => '1d', 129600 => '1.5d', 172800 => '2d', 259200 => '3d', 345600 => '4d', 432000 => '5d', 518400 => '6d',
  22. 604800 => '1wk') as $v => $t) {
  23. echo '<option value="' . $v . (FreshRSS_Context::$user_conf->ttl_default == $v ? '" selected="selected' : '') . '">' . $t . '</option>';
  24. if (FreshRSS_Context::$user_conf->ttl_default == $v) {
  25. $found = true;
  26. }
  27. }
  28. if (!$found) {
  29. echo '<option value="' . intval(FreshRSS_Context::$user_conf->ttl_default) . '" selected="selected">'
  30. . intval(FreshRSS_Context::$user_conf->ttl_default) . 's</option>';
  31. }
  32. ?></select> (<?= _t('gen.short.by_default') ?>)
  33. </div>
  34. </div>
  35. <p class="alert alert-warn">
  36. <?= _t('conf.archiving.policy_warning') ?>
  37. </p>
  38. <div class="form-group">
  39. <label class="group-name"><?= _t('conf.archiving.policy') ?><br /><small>(<?= _t('gen.short.by_default') ?>)</small></label>
  40. <div class="group-controls">
  41. <label class="checkbox" for="enable_keep_max">
  42. <input type="checkbox" name="enable_keep_max" id="enable_keep_max" value="1"<?=
  43. empty(FreshRSS_Context::$user_conf->archiving['keep_max']) ? '' : ' checked="checked"' ?>
  44. data-leave-validation="<?= empty(FreshRSS_Context::$user_conf->archiving['keep_max']) ? 0 : 1 ?>"/>
  45. <?= _t('conf.archiving.keep_max') ?>
  46. <?php $keepMax = empty(FreshRSS_Context::$user_conf->archiving['keep_max']) ? 200 : FreshRSS_Context::$user_conf->archiving['keep_max']; ?>
  47. <input type="number" id="keep_max" name="keep_max" min="0" value="<?= $keepMax ?>" data-leave-validation="<?= $keepMax ?>"/>
  48. </label>
  49. </div>
  50. </div>
  51. <div class="form-group">
  52. <div class="group-controls">
  53. <label class="checkbox" for="enable_keep_period">
  54. <input type="checkbox" name="enable_keep_period" id="enable_keep_period" value="1"<?=
  55. FreshRSS_Context::$user_conf->volatile['enable_keep_period'] ? ' checked="checked"' : '' ?>
  56. data-leave-validation="<?= FreshRSS_Context::$user_conf->volatile['enable_keep_period'] ? 1 : 0 ?>"/>
  57. <?= _t('conf.archiving.keep_period') ?>
  58. <input type="number" id="keep_period_count" name="keep_period_count" min="0" value="<?= FreshRSS_Context::$user_conf->volatile['keep_period_count'] ?>"
  59. data-leave-validation="<?= FreshRSS_Context::$user_conf->volatile['keep_period_count'] ?>"/>
  60. <select class="number" name="keep_period_unit" id="keep_period_unit" data-leave-validation="<?= FreshRSS_Context::$user_conf->volatile['keep_period_unit'] ?>">
  61. <option></option>
  62. <option value="P1Y" <?= 'P1Y' === FreshRSS_Context::$user_conf->volatile['keep_period_unit'] ? 'selected="selected"' : '' ?>><?= _t('gen.period.years') ?></option>
  63. <option value="P1M" <?= 'P1M' === FreshRSS_Context::$user_conf->volatile['keep_period_unit'] ? 'selected="selected"' : '' ?>><?= _t('gen.period.months') ?></option>
  64. <option value="P1W" <?= 'P1W' === FreshRSS_Context::$user_conf->volatile['keep_period_unit'] ? 'selected="selected"' : '' ?>><?= _t('gen.period.weeks') ?></option>
  65. <option value="P1D" <?= 'P1D' === FreshRSS_Context::$user_conf->volatile['keep_period_unit'] ? 'selected="selected"' : '' ?>><?= _t('gen.period.days') ?></option>
  66. <option value="PT1H" <?= 'PT1H' === FreshRSS_Context::$user_conf->volatile['keep_period_unit'] ? 'selected="selected"' : '' ?>><?= _t('gen.period.hours') ?></option>
  67. </select>
  68. </label>
  69. </div>
  70. </div>
  71. <div class="form-group">
  72. <label class="group-name"><?= _t('conf.archiving.exception') ?><br /><small>(<?= _t('gen.short.by_default') ?>)</small></label>
  73. <div class="group-controls">
  74. <label class="checkbox" for="keep_favourites">
  75. <input type="checkbox" name="keep_favourites" id="keep_favourites" value="1"<?=
  76. FreshRSS_Context::$user_conf->archiving['keep_favourites'] !== false ? ' checked="checked"' : '' ?>
  77. data-leave-validation="<?= FreshRSS_Context::$user_conf->archiving['keep_favourites'] !== false ? 1 : 0 ?>"/>
  78. <?= _t('conf.archiving.keep_favourites') ?>
  79. </label>
  80. </div>
  81. </div>
  82. <div class="form-group">
  83. <div class="group-controls">
  84. <label class="checkbox" for="keep_labels">
  85. <input type="checkbox" name="keep_labels" id="keep_labels" value="1"<?=
  86. FreshRSS_Context::$user_conf->archiving['keep_labels'] !== false ? ' checked="checked"' : '' ?>
  87. data-leave-validation="<?= FreshRSS_Context::$user_conf->archiving['keep_labels'] !== false ? 1 : 0 ?>"/>
  88. <?= _t('conf.archiving.keep_labels') ?>
  89. </label>
  90. </div>
  91. </div>
  92. <div class="form-group">
  93. <div class="group-controls">
  94. <label class="checkbox" for="keep_unreads">
  95. <input type="checkbox" name="keep_unreads" id="keep_unreads" value="1"<?=
  96. FreshRSS_Context::$user_conf->archiving['keep_unreads'] ? ' checked="checked"' : '' ?>
  97. data-leave-validation="<?= FreshRSS_Context::$user_conf->archiving['keep_unreads'] ? 1 : 0 ?>"/>
  98. <?= _t('conf.archiving.keep_unreads') ?>
  99. </label>
  100. </div>
  101. </div>
  102. <div class="form-group">
  103. <div class="group-controls">
  104. <label for="keep_min_default"><?= _t('conf.archiving.keep_min_by_feed') ?>
  105. <input type="number" id="keep_min_default" name="keep_min_default" min="0" value="<?=
  106. FreshRSS_Context::$user_conf->archiving['keep_min'] ?>"
  107. data-leave-validation="<?= FreshRSS_Context::$user_conf->archiving['keep_min'] ?>">
  108. </label>
  109. </div>
  110. </div>
  111. <div class="form-group form-actions">
  112. <div class="group-controls">
  113. <button type="submit" class="btn btn-important"><?= _t('gen.action.submit') ?></button>
  114. <button type="reset" class="btn"><?= _t('gen.action.cancel') ?></button>
  115. </div>
  116. </div>
  117. </form>
  118. <h2><?= _t('conf.archiving.maintenance') ?></h2>
  119. <form method="post" action="<?= _url('entry', 'purge') ?>">
  120. <input type="hidden" name="_csrf" value="<?= FreshRSS_Auth::csrfToken() ?>" />
  121. <div class="form-group">
  122. <label class="group-name"><?= _t('conf.user.current') ?></label>
  123. <div class="group-controls">
  124. <?= _t('conf.user.articles_and_size', format_number($this->nb_total), format_bytes($this->size_user)) ?>
  125. </div>
  126. </div>
  127. <div class="form-group">
  128. <div class="group-controls">
  129. <button type="submit" class="btn btn-important confirm"><?= _t('conf.archiving.purge_now') ?></button>
  130. </div>
  131. </div>
  132. </form>
  133. <form method="post" action="<?= _url('entry', 'optimize') ?>">
  134. <input type="hidden" name="_csrf" value="<?= FreshRSS_Auth::csrfToken() ?>" />
  135. <div class="form-group">
  136. <div class="group-controls">
  137. <input type="hidden" name="optimiseDatabase" value="1" />
  138. <button type="submit" class="btn btn-important"><?= _t('conf.archiving.optimize') ?></button>
  139. <p class="help"><?= _i('help') ?> <?= _t('conf.archiving.optimize_help') ?></p>
  140. </div>
  141. </div>
  142. </form>
  143. <?php if (FreshRSS_Auth::hasAccess('admin')): ?>
  144. <div class="form-group">
  145. <label class="group-name"><?= _t('conf.user.users') ?></label>
  146. <div class="group-controls">
  147. <?= format_bytes($this->size_total) ?>
  148. </div>
  149. </div>
  150. <?php endif; ?>
  151. </main>