update.phtml 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. <div class="post">
  2. <h1><?= $this->category->name() ?></h1>
  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 class="btn btn-attention confirm"
  29. data-str-confirm="<?= _t('gen.js.confirm_action_feed_cat') ?>"
  30. formaction="<?= _url('category', 'empty', 'id', $this->category->id()) ?>"
  31. formmethod="post"><?= _t('gen.action.empty') ?></button>
  32. <?php if (!$this->category->isDefault()): ?>
  33. <button class="btn btn-attention confirm"
  34. data-str-confirm="<?= _t('gen.js.confirm_action_feed_cat') ?>"
  35. formaction="<?= _url('category', 'delete', 'id', $this->category->id()) ?>"
  36. formmethod="post"><?= _t('gen.action.remove') ?></button>
  37. <?php endif;?>
  38. </div>
  39. </div>
  40. <legend><?= _t('sub.category.archiving') ?></legend>
  41. <?php
  42. $archiving = $this->category->attributes('archiving');
  43. if (empty($archiving)) {
  44. $archiving = [ 'default' => true ];
  45. } else {
  46. $archiving['default'] = false;
  47. }
  48. $volatile = [
  49. 'enable_keep_period' => false,
  50. 'keep_period_count' => '3',
  51. 'keep_period_unit' => 'P1M',
  52. ];
  53. if (!empty($archiving['keep_period'])) {
  54. if (preg_match('/^PT?(?P<count>\d+)[YMWDH]$/', $archiving['keep_period'], $matches)) {
  55. $volatile['enable_keep_period'] = true;
  56. $volatile['keep_period_count'] = $matches['count'];
  57. $volatile['keep_period_unit'] = str_replace($matches['count'], '1', $archiving['keep_period']);
  58. }
  59. }
  60. //Defaults
  61. if (!isset($archiving['keep_max'])) {
  62. $archiving['keep_max'] = false;
  63. }
  64. if (!isset($archiving['keep_favourites'])) {
  65. $archiving['keep_favourites'] = true;
  66. }
  67. if (!isset($archiving['keep_labels'])) {
  68. $archiving['keep_labels'] = true;
  69. }
  70. if (!isset($archiving['keep_unreads'])) {
  71. $archiving['keep_unreads'] = false;
  72. }
  73. if (!isset($archiving['keep_min'])) {
  74. $archiving['keep_min'] = 50;
  75. }
  76. ?>
  77. <p class="alert alert-warn">
  78. <?= _t('conf.archiving.policy_warning') ?>
  79. </p>
  80. <div class="form-group">
  81. <label class="group-name"><?= _t('conf.archiving.policy') ?></label>
  82. <div class="group-controls">
  83. <label class="checkbox">
  84. <input type="checkbox" name="use_default_purge_options" id="use_default_purge_options" value="1"<?= $archiving['default'] ? ' checked="checked"' : '' ?> data-leave-validation="<?= $archiving['default'] ? 1 : 0 ?>" />
  85. <?= _t('gen.short.by_default') ?>
  86. </label>
  87. </div>
  88. </div>
  89. <div class="form-group archiving"<?= $archiving['default'] ? ' hidden="hidden"' : '' ?>>
  90. <div class="group-controls">
  91. <label class="checkbox" for="enable_keep_max">
  92. <input type="checkbox" name="enable_keep_max" id="enable_keep_max" value="1"<?= empty($archiving['keep_max']) ? '' : ' checked="checked"' ?> data-leave-validation="<?= empty($archiving['keep_max']) ? 0 : 1 ?>"/>
  93. <?= _t('conf.archiving.keep_max') ?>
  94. <input type="number" id="keep_max" name="keep_max" min="0" value="<?= empty($archiving['keep_max']) ? 200 : $archiving['keep_max'] ?>" data-leave-validation="<?= empty($archiving['keep_max']) ? 200 : $archiving['keep_max'] ?>"/>
  95. </label>
  96. </div>
  97. </div>
  98. <div class="form-group archiving"<?= $archiving['default'] ? ' hidden="hidden"' : '' ?>>
  99. <div class="group-controls">
  100. <label class="checkbox" for="enable_keep_period">
  101. <input type="checkbox" name="enable_keep_period" id="enable_keep_period" value="1"<?= $volatile['enable_keep_period'] ? ' checked="checked"' : '' ?> data-leave-validation="<?= $volatile['enable_keep_period'] ? 1 : 0 ?>"/>
  102. <?= _t('conf.archiving.keep_period') ?>
  103. <input type="number" id="keep_period_count" name="keep_period_count" min="0" value="<?= $volatile['keep_period_count'] ?>" data-leave-validation="<?= $volatile['keep_period_count'] ?>"/>
  104. <select class="number" name="keep_period_unit" id="keep_period_unit" data-leave-validation="<?= $volatile['keep_period_unit'] ?>">
  105. <option></option>
  106. <option value="P1Y" <?= 'P1Y' === $volatile['keep_period_unit'] ? 'selected="selected"' : '' ?>><?= _t('gen.period.years') ?></option>
  107. <option value="P1M" <?= 'P1M' === $volatile['keep_period_unit'] ? 'selected="selected"' : '' ?>><?= _t('gen.period.months') ?></option>
  108. <option value="P1W" <?= 'P1W' === $volatile['keep_period_unit'] ? 'selected="selected"' : '' ?>><?= _t('gen.period.weeks') ?></option>
  109. <option value="P1D" <?= 'P1D' === $volatile['keep_period_unit'] ? 'selected="selected"' : '' ?>><?= _t('gen.period.days') ?></option>
  110. <option value="PT1H" <?= 'PT1H' === $volatile['keep_period_unit'] ? 'selected="selected"' : '' ?>><?= _t('gen.period.hours') ?></option>
  111. </select>
  112. </label>
  113. </div>
  114. </div>
  115. <div class="form-group archiving"<?= $archiving['default'] ? ' hidden="hidden"' : '' ?>>
  116. <label class="group-name"><?= _t('conf.archiving.exception') ?></label>
  117. <div class="group-controls">
  118. <label class="checkbox" for="keep_favourites">
  119. <input type="checkbox" name="keep_favourites" id="keep_favourites" value="1"<?= $archiving['keep_favourites'] ? ' checked="checked"' : '' ?> data-leave-validation="<?= $archiving['keep_favourites'] ? 1 : 0 ?>"/>
  120. <?= _t('conf.archiving.keep_favourites') ?>
  121. </label>
  122. </div>
  123. </div>
  124. <div class="form-group archiving"<?= $archiving['default'] ? ' hidden="hidden"' : '' ?>>
  125. <div class="group-controls">
  126. <label class="checkbox" for="keep_labels">
  127. <input type="checkbox" name="keep_labels" id="keep_labels" value="1"<?= $archiving['keep_labels'] ? ' checked="checked"' : '' ?> data-leave-validation="<?= $archiving['keep_labels'] ? 1 : 0 ?>"/>
  128. <?= _t('conf.archiving.keep_labels') ?>
  129. </label>
  130. </div>
  131. </div>
  132. <div class="form-group archiving"<?= $archiving['default'] ? ' hidden="hidden"' : '' ?>>
  133. <div class="group-controls">
  134. <label class="checkbox" for="keep_unreads">
  135. <input type="checkbox" name="keep_unreads" id="keep_unreads" value="1"<?= $archiving['keep_unreads'] ? ' checked="checked"' : '' ?> 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'] ?>" 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. </form>
  154. </div>