update.phtml 7.5 KB

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