archiving.phtml 8.0 KB

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