update.phtml 8.3 KB

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