archiving.phtml 7.9 KB

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