update.phtml 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. <?php /** @var FreshRSS_View $this */ ?>
  2. <div class="post">
  3. <h2><?= $this->category->name() ?></h2>
  4. <div>
  5. <a href="<?= _url('index', 'index', 'get', 'c_' . $this->category->id()) ?>"><?= _i('link') ?> <?= _t('gen.action.filter') ?></a>
  6. </div>
  7. <form method="post" action="<?= _url('subscription', 'category', 'id', $this->category->id()) ?>" autocomplete="off">
  8. <input type="hidden" name="_csrf" value="<?= FreshRSS_Auth::csrfToken() ?>" />
  9. <legend><?= _t('sub.category.information') ?></legend>
  10. <div class="form-group">
  11. <label class="group-name" for="name"><?= _t('sub.category.title') ?></label>
  12. <div class="group-controls">
  13. <input type="text" name="name" id="name" class="extend" value="<?= $this->category->name() ?>" <?php
  14. //Disallow changing the name of the default category
  15. echo $this->category->id() == FreshRSS_CategoryDAO::DEFAULTCATEGORYID ? 'disabled="disabled"' : '';
  16. ?> />
  17. </div>
  18. </div>
  19. <div class="form-group">
  20. <label class="group-name" for="position"><?= _t('sub.category.position') ?></label>
  21. <div class="group-controls">
  22. <input type="number" name="position" id="position" min="1" value="<?= $this->category->attributes('position') ?>" />
  23. <p class="help"><?= _i('help') ?> <?= _t('sub.category.position_help') ?></p>
  24. </div>
  25. </div>
  26. <div class="form-group form-actions">
  27. <div class="group-controls">
  28. <button class="btn btn-important"><?= _t('gen.action.submit') ?></button>
  29. <button type="reset" class="btn"><?= _t('gen.action.cancel') ?></button>
  30. </div>
  31. </div>
  32. <legend><?= _t('sub.category.archiving') ?></legend>
  33. <?php
  34. $archiving = $this->category->attributes('archiving');
  35. if (empty($archiving)) {
  36. $archiving = [ 'default' => true ];
  37. } else {
  38. $archiving['default'] = false;
  39. }
  40. $volatile = [
  41. 'enable_keep_period' => false,
  42. 'keep_period_count' => '3',
  43. 'keep_period_unit' => 'P1M',
  44. ];
  45. if (!empty($archiving['keep_period'])) {
  46. if (preg_match('/^PT?(?P<count>\d+)[YMWDH]$/', $archiving['keep_period'], $matches)) {
  47. $volatile['enable_keep_period'] = true;
  48. $volatile['keep_period_count'] = $matches['count'];
  49. $volatile['keep_period_unit'] = str_replace($matches['count'], '1', $archiving['keep_period']);
  50. }
  51. }
  52. //Defaults
  53. if (!isset($archiving['keep_max'])) {
  54. $archiving['keep_max'] = false;
  55. }
  56. if (!isset($archiving['keep_favourites'])) {
  57. $archiving['keep_favourites'] = true;
  58. }
  59. if (!isset($archiving['keep_labels'])) {
  60. $archiving['keep_labels'] = true;
  61. }
  62. if (!isset($archiving['keep_unreads'])) {
  63. $archiving['keep_unreads'] = false;
  64. }
  65. if (!isset($archiving['keep_min'])) {
  66. $archiving['keep_min'] = 50;
  67. }
  68. ?>
  69. <p class="alert alert-warn">
  70. <?= _t('conf.archiving.policy_warning') ?>
  71. </p>
  72. <div class="form-group">
  73. <label class="group-name"><?= _t('conf.archiving.policy') ?></label>
  74. <div class="group-controls">
  75. <label class="checkbox">
  76. <input type="checkbox" name="use_default_purge_options" id="use_default_purge_options" value="1"<?= $archiving['default'] ? ' checked="checked"' : '' ?>
  77. data-leave-validation="<?= $archiving['default'] ? 1 : 0 ?>" />
  78. <?= _t('gen.short.by_default') ?>
  79. </label>
  80. </div>
  81. </div>
  82. <div class="form-group archiving"<?= $archiving['default'] ? ' hidden="hidden"' : '' ?>>
  83. <div class="group-controls">
  84. <label class="checkbox" for="enable_keep_max">
  85. <input type="checkbox" name="enable_keep_max" id="enable_keep_max" value="1"<?= empty($archiving['keep_max']) ? '' : ' checked="checked"' ?>
  86. data-leave-validation="<?= empty($archiving['keep_max']) ? 0 : 1 ?>"/>
  87. <?= _t('conf.archiving.keep_max') ?>
  88. <input type="number" id="keep_max" name="keep_max" min="0" value="<?= empty($archiving['keep_max']) ? 200 : $archiving['keep_max'] ?>"
  89. data-leave-validation="<?= empty($archiving['keep_max']) ? 200 : $archiving['keep_max'] ?>"/>
  90. </label>
  91. </div>
  92. </div>
  93. <div class="form-group archiving"<?= $archiving['default'] ? ' hidden="hidden"' : '' ?>>
  94. <div class="group-controls">
  95. <label class="checkbox" for="enable_keep_period">
  96. <input type="checkbox" name="enable_keep_period" id="enable_keep_period" value="1"<?= $volatile['enable_keep_period'] ? ' checked="checked"' : '' ?>
  97. data-leave-validation="<?= $volatile['enable_keep_period'] ? 1 : 0 ?>"/>
  98. <?= _t('conf.archiving.keep_period') ?>
  99. <input type="number" id="keep_period_count" name="keep_period_count" min="0" value="<?= $volatile['keep_period_count'] ?>"
  100. data-leave-validation="<?= $volatile['keep_period_count'] ?>"/>
  101. <select class="number" name="keep_period_unit" id="keep_period_unit" data-leave-validation="<?= $volatile['keep_period_unit'] ?>">
  102. <option></option>
  103. <option value="P1Y" <?= 'P1Y' === $volatile['keep_period_unit'] ? 'selected="selected"' : '' ?>><?= _t('gen.period.years') ?></option>
  104. <option value="P1M" <?= 'P1M' === $volatile['keep_period_unit'] ? 'selected="selected"' : '' ?>><?= _t('gen.period.months') ?></option>
  105. <option value="P1W" <?= 'P1W' === $volatile['keep_period_unit'] ? 'selected="selected"' : '' ?>><?= _t('gen.period.weeks') ?></option>
  106. <option value="P1D" <?= 'P1D' === $volatile['keep_period_unit'] ? 'selected="selected"' : '' ?>><?= _t('gen.period.days') ?></option>
  107. <option value="PT1H" <?= 'PT1H' === $volatile['keep_period_unit'] ? 'selected="selected"' : '' ?>><?= _t('gen.period.hours') ?></option>
  108. </select>
  109. </label>
  110. </div>
  111. </div>
  112. <div class="form-group archiving"<?= $archiving['default'] ? ' hidden="hidden"' : '' ?>>
  113. <label class="group-name"><?= _t('conf.archiving.exception') ?></label>
  114. <div class="group-controls">
  115. <label class="checkbox" for="keep_favourites">
  116. <input type="checkbox" name="keep_favourites" id="keep_favourites" value="1"<?= $archiving['keep_favourites'] ? ' checked="checked"' : '' ?>
  117. data-leave-validation="<?= $archiving['keep_favourites'] ? 1 : 0 ?>"/>
  118. <?= _t('conf.archiving.keep_favourites') ?>
  119. </label>
  120. </div>
  121. </div>
  122. <div class="form-group archiving"<?= $archiving['default'] ? ' hidden="hidden"' : '' ?>>
  123. <div class="group-controls">
  124. <label class="checkbox" for="keep_labels">
  125. <input type="checkbox" name="keep_labels" id="keep_labels" value="1"<?= $archiving['keep_labels'] ? ' checked="checked"' : '' ?>
  126. data-leave-validation="<?= $archiving['keep_labels'] ? 1 : 0 ?>"/>
  127. <?= _t('conf.archiving.keep_labels') ?>
  128. </label>
  129. </div>
  130. </div>
  131. <div class="form-group archiving"<?= $archiving['default'] ? ' hidden="hidden"' : '' ?>>
  132. <div class="group-controls">
  133. <label class="checkbox" for="keep_unreads">
  134. <input type="checkbox" name="keep_unreads" id="keep_unreads" value="1"<?= $archiving['keep_unreads'] ? ' checked="checked"' : '' ?>
  135. data-leave-validation="<?= $archiving['keep_unreads'] ? 1 : 0 ?>"/>
  136. <?= _t('conf.archiving.keep_unreads') ?>
  137. </label>
  138. </div>
  139. </div>
  140. <div class="form-group archiving"<?= $archiving['default'] ? ' hidden="hidden"' : '' ?>>
  141. <div class="group-controls">
  142. <label for="keep_min"><?= _t('sub.feed.keep_min') ?>
  143. <input type="number" id="keep_min" name="keep_min" min="0" value="<?= $archiving['keep_min'] ?>"
  144. data-leave-validation="<?= $archiving['keep_min'] ?>">
  145. </label>
  146. </div>
  147. </div>
  148. <div class="form-group form-actions">
  149. <div class="group-controls">
  150. <button class="btn btn-important"><?= _t('gen.action.submit') ?></button>
  151. <button type="reset" class="btn"><?= _t('gen.action.cancel') ?></button>
  152. </div>
  153. </div>
  154. <?php if (!$this->category->isDefault()): ?>
  155. <p class="alert alert-warn">
  156. <?= _t('sub.feed.moved_category_deleted', $this->default_category->name()) ?>
  157. </p>
  158. <?php endif;?>
  159. <div class="form-group form-actions">
  160. <div class="group-controls">
  161. <button class="btn btn-attention confirm"
  162. data-str-confirm="<?= _t('gen.js.confirm_action_feed_cat') ?>"
  163. formaction="<?= _url('category', 'empty', 'id', $this->category->id()) ?>"
  164. formmethod="post"><?= _t('gen.action.empty') ?></button>
  165. <?php if (!$this->category->isDefault()): ?>
  166. <button class="btn btn-attention confirm"
  167. data-str-confirm="<?= _t('gen.js.confirm_action_feed_cat') ?>"
  168. formaction="<?= _url('category', 'delete', 'id', $this->category->id()) ?>"
  169. formmethod="post"><?= _t('gen.action.remove') ?></button>
  170. <?php endif;?>
  171. </div>
  172. </div>
  173. </form>
  174. </div>