archiving.phtml 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  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">' . intval(FreshRSS_Context::$user_conf->ttl_default) . 's</option>';
  25. }
  26. ?></select> (<?= _t('gen.short.by_default') ?>)
  27. </div>
  28. </div>
  29. <p class="alert alert-warn">
  30. <?= _t('conf.archiving.policy_warning') ?>
  31. </p>
  32. <div class="form-group">
  33. <label class="group-name"><?= _t('conf.archiving.policy') ?><br /><small>(<?= _t('gen.short.by_default') ?>)</small></label>
  34. <div class="group-controls">
  35. <label class="checkbox" for="enable_keep_max">
  36. <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 ?>"/>
  37. <?= _t('conf.archiving.keep_max') ?>
  38. <?php $keepMax = empty(FreshRSS_Context::$user_conf->archiving['keep_max']) ? 200 : FreshRSS_Context::$user_conf->archiving['keep_max']; ?>
  39. <input type="number" id="keep_max" name="keep_max" min="0" value="<?= $keepMax ?>" data-leave-validation="<?= $keepMax ?>"/>
  40. </label>
  41. </div>
  42. </div>
  43. <div class="form-group">
  44. <div class="group-controls">
  45. <label class="checkbox" for="enable_keep_period">
  46. <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 ?>"/>
  47. <?= _t('conf.archiving.keep_period') ?>
  48. <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'] ?>"/>
  49. <select class="number" name="keep_period_unit" id="keep_period_unit" data-leave-validation="<?= FreshRSS_Context::$user_conf->volatile['keep_period_unit'] ?>">
  50. <option></option>
  51. <option value="P1Y" <?= 'P1Y' === FreshRSS_Context::$user_conf->volatile['keep_period_unit'] ? 'selected="selected"' : '' ?>><?= _t('gen.period.years') ?></option>
  52. <option value="P1M" <?= 'P1M' === FreshRSS_Context::$user_conf->volatile['keep_period_unit'] ? 'selected="selected"' : '' ?>><?= _t('gen.period.months') ?></option>
  53. <option value="P1W" <?= 'P1W' === FreshRSS_Context::$user_conf->volatile['keep_period_unit'] ? 'selected="selected"' : '' ?>><?= _t('gen.period.weeks') ?></option>
  54. <option value="P1D" <?= 'P1D' === FreshRSS_Context::$user_conf->volatile['keep_period_unit'] ? 'selected="selected"' : '' ?>><?= _t('gen.period.days') ?></option>
  55. <option value="PT1H" <?= 'PT1H' === FreshRSS_Context::$user_conf->volatile['keep_period_unit'] ? 'selected="selected"' : '' ?>><?= _t('gen.period.hours') ?></option>
  56. </select>
  57. </label>
  58. </div>
  59. </div>
  60. <div class="form-group">
  61. <label class="group-name"><?= _t('conf.archiving.exception') ?><br /><small>(<?= _t('gen.short.by_default') ?>)</small></label>
  62. <div class="group-controls">
  63. <label class="checkbox" for="keep_favourites">
  64. <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 ?>"/>
  65. <?= _t('conf.archiving.keep_favourites') ?>
  66. </label>
  67. </div>
  68. </div>
  69. <div class="form-group">
  70. <div class="group-controls">
  71. <label class="checkbox" for="keep_labels">
  72. <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 ?>"/>
  73. <?= _t('conf.archiving.keep_labels') ?>
  74. </label>
  75. </div>
  76. </div>
  77. <div class="form-group">
  78. <div class="group-controls">
  79. <label class="checkbox" for="keep_unreads">
  80. <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 ?>"/>
  81. <?= _t('conf.archiving.keep_unreads') ?>
  82. </label>
  83. </div>
  84. </div>
  85. <div class="form-group">
  86. <div class="group-controls">
  87. <label for="keep_min_default"><?= _t('conf.archiving.keep_min_by_feed') ?>
  88. <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'] ?>">
  89. </label>
  90. </div>
  91. </div>
  92. <div class="form-group form-actions">
  93. <div class="group-controls">
  94. <button type="submit" class="btn btn-important"><?= _t('gen.action.submit') ?></button>
  95. <button type="reset" class="btn"><?= _t('gen.action.cancel') ?></button>
  96. </div>
  97. </div>
  98. </form>
  99. <legend><?= _t('conf.archiving.maintenance') ?></legend>
  100. <form method="post" action="<?= _url('entry', 'purge') ?>">
  101. <input type="hidden" name="_csrf" value="<?= FreshRSS_Auth::csrfToken() ?>" />
  102. <div class="form-group">
  103. <label class="group-name"><?= _t('conf.user.current') ?></label>
  104. <div class="group-controls">
  105. <?= _t('conf.user.articles_and_size', format_number($this->nb_total), format_bytes($this->size_user)) ?>
  106. </div>
  107. </div>
  108. <div class="form-group">
  109. <div class="group-controls">
  110. <button type="submit" class="btn btn-important confirm"><?= _t('conf.archiving.purge_now') ?></button>
  111. </div>
  112. </div>
  113. </form>
  114. <form method="post" action="<?= _url('entry', 'optimize') ?>">
  115. <input type="hidden" name="_csrf" value="<?= FreshRSS_Auth::csrfToken() ?>" />
  116. <div class="form-group">
  117. <div class="group-controls">
  118. <input type="hidden" name="optimiseDatabase" value="1" />
  119. <button type="submit" class="btn btn-important"><?= _t('conf.archiving.optimize') ?></button>
  120. <p class="help"><?= _i('help') ?> <?= _t('conf.archiving.optimize_help') ?></p>
  121. </div>
  122. </div>
  123. </form>
  124. <?php if (FreshRSS_Auth::hasAccess('admin')): ?>
  125. <div class="form-group">
  126. <label class="group-name"><?= _t('conf.user.users') ?></label>
  127. <div class="group-controls">
  128. <?= format_bytes($this->size_total) ?>
  129. </div>
  130. </div>
  131. <?php endif; ?>
  132. </div>