update.phtml 10 KB

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