query.phtml 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. <?php
  2. declare(strict_types=1);
  3. /** @var FreshRSS_View $this */
  4. if ($this->query === null) {
  5. throw new FreshRSS_Context_Exception('Query not initialised!');
  6. }
  7. ?>
  8. <div class="post">
  9. <h2><?= $this->query->getName() ?></h2>
  10. <div>
  11. <a href="<?= $this->query->getUrl() ?>"><?= _i('link') ?> <?= _t('gen.action.filter') ?></a>
  12. </div>
  13. <form method="post" action="<?= _url('configure', 'query', 'id', $this->queryId, '#', 'slider') ?>" autocomplete="off" data-auto-leave-validation="1">
  14. <input type="hidden" name="_csrf" value="<?= FreshRSS_Auth::csrfToken() ?>" />
  15. <div class="form-group">
  16. <label class="group-name" for="name"><?= _t('conf.query.name') ?></label>
  17. <div class="group-controls">
  18. <input type="text" class="w100" name="name" id="name" value="<?= $this->query->getName() ?>" />
  19. <input type="hidden" name="query[token]" id="query_token" value="<?= $this->query->getToken() ?>" />
  20. </div>
  21. </div>
  22. <div class="form-group">
  23. <label class="group-name" for="description"><?= _t('conf.query.description') ?></label>
  24. <div class="group-controls">
  25. <input type="text" class="w100" name="query[description]" id="description" value="<?= $this->query->getDescription() ?>" />
  26. </div>
  27. </div>
  28. <div class="form-group">
  29. <label class="group-name" for="imageUrl"><?= _t('conf.query.image_url') ?></label>
  30. <div class="group-controls">
  31. <input type="text" class="w100" name="query[imageUrl]" id="imageUrl" value="<?= $this->query->getImageUrl() ?>" />
  32. </div>
  33. </div>
  34. <?php if (FreshRSS_Context::systemConf()->api_enabled) { ?>
  35. <fieldset>
  36. <legend><?= _t('conf.query.share') ?></legend>
  37. <div class="form-group">
  38. <div class="group-controls">
  39. <label class="checkbox" for="shareRss">
  40. <input type="checkbox" name="query[shareRss]" id="shareRss" value="1" <?= $this->query->shareRss() ? 'checked="checked"' : ''?> />
  41. <?= _t('conf.query.filter.shareRss') ?>
  42. </label>
  43. <?php if ($this->query->sharedUrlRss() !== ''): ?>
  44. <ul>
  45. <li><a href="<?= $this->query->sharedUrlHtml() ?>"><?= _i('link') ?> <?= _t('conf.query.share.html') ?></a></li>
  46. <li><a href="<?= $this->query->sharedUrlGreader() ?>"><?= _i('link') ?> <?= _t('conf.query.share.greader') ?></a></li>
  47. <li><a href="<?= $this->query->sharedUrlRss() ?>"><?= _i('link') ?> <?= _t('conf.query.share.rss') ?></a></li>
  48. </ul>
  49. <label class="checkbox" for="publishLabelsInsteadOfTags">
  50. <input type="checkbox" name="query[publishLabelsInsteadOfTags]" id="publishLabelsInsteadOfTags" value="1" <?= $this->query->publishLabelsInsteadOfTags() ? 'checked="checked"' : ''?> />
  51. <?= _t('conf.query.filter.publish_labels_instead_of_tags') ?>
  52. </label>
  53. <?php endif; ?>
  54. </div>
  55. <div class="group-controls">
  56. <label class="checkbox" for="shareOpml">
  57. <input type="checkbox" name="query[shareOpml]" id="shareOpml" value="1" <?= $this->query->shareOpml() && $this->query->safeForOpml() ? 'checked="checked"' : '' ?>
  58. <?= $this->query->safeForOpml() ? '' : 'disabled="disabled"' ?> />
  59. <?= _t('conf.query.filter.shareOpml') ?>
  60. </label>
  61. <?php if ($this->query->sharedUrlOpml() !== ''): ?>
  62. <ul>
  63. <li><a href="<?= $this->query->sharedUrlOpml() ?>"><?= _i('link') ?> <?= _t('conf.query.share.opml') ?></a></li>
  64. </ul>
  65. <?php endif; ?>
  66. </div>
  67. <p class="help"><?= _i('help') ?> <?= _t('conf.query.share.help') ?></a></p>
  68. <p class="help"><?= _i('help') ?> <?= _t('conf.query.help') ?></a></p>
  69. </div>
  70. <div class="form-group form-actions">
  71. <div class="group-controls">
  72. <button type="submit" class="btn btn-important"><?= _t('gen.action.submit') ?></button>
  73. </div>
  74. </div>
  75. </fieldset>
  76. <?php } else { ?>
  77. <div class="form-group">
  78. <label class="group-name"><?= _t('conf.query.share.disabled.title') ?></label>
  79. <div class="group-controls">
  80. <?= _t('conf.query.share.disabled') ?>
  81. <p class="help"><?= _i('help') ?> <?= _t('conf.query.help') ?></a></p>
  82. </div>
  83. </div>
  84. <?php } ?>
  85. <fieldset>
  86. <legend><?= _t('conf.query.filter') ?></legend>
  87. <div class="form-group">
  88. <label class="group-name" for=""><?= _t('conf.query.filter.search') ?></label>
  89. <div class="group-controls">
  90. <input type="text" class="w100" id="query_search" name="query[search]" value="<?=
  91. htmlspecialchars($this->query->getSearch()->toString(expandUserQueries: false), ENT_COMPAT, 'UTF-8') ?>"/>
  92. <p class="help"><?= _i('help') ?> <?= _t('gen.menu.search_help') ?></a></p>
  93. </div>
  94. </div>
  95. <div class="form-group">
  96. <label class="group-name" for=""><?= _t('conf.query.filter.state') ?></label>
  97. <div class="group-controls">
  98. <label class="checkbox" for="show_read">
  99. <input type="checkbox" name="query[state][]" id="show_read"
  100. value="<?= FreshRSS_Entry::STATE_READ ?>" <?= FreshRSS_Entry::STATE_READ & $this->query->getState() ? 'checked="checked"' : ''?> />
  101. <?= _t('index.menu.read') ?>
  102. </label>
  103. <label class="checkbox" for="show_not_read">
  104. <input type="checkbox" name="query[state][]" id="show_not_read"
  105. value="<?= FreshRSS_Entry::STATE_NOT_READ ?>" <?= FreshRSS_Entry::STATE_NOT_READ & $this->query->getState() ? 'checked="checked"' : ''?> />
  106. <?= _t('index.menu.unread') ?>
  107. </label>
  108. <label class="checkbox" for="show_favorite">
  109. <input type="checkbox" name="query[state][]" id="show_favorite"
  110. value="<?= FreshRSS_Entry::STATE_FAVORITE ?>" <?= FreshRSS_Entry::STATE_FAVORITE & $this->query->getState() ? 'checked="checked"' : ''?> />
  111. <?= _t('index.menu.starred') ?>
  112. </label>
  113. <label class="checkbox" for="show_not_favorite">
  114. <input type="checkbox" name="query[state][]" id="show_not_favorite"
  115. value="<?= FreshRSS_Entry::STATE_NOT_FAVORITE ?>" <?= FreshRSS_Entry::STATE_NOT_FAVORITE & $this->query->getState() ? 'checked="checked"' : ''?> />
  116. <?= _t('index.menu.non-starred') ?>
  117. </label>
  118. </div>
  119. </div>
  120. <div class="form-group">
  121. <label class="group-name" for="query_get"><?= _t('conf.query.filter.type') ?></label>
  122. <div class="group-controls">
  123. <select name="query[get]" class="w100" id="query_get" size="10">
  124. <option value="Z" <?= 'Z' === $this->query->getGet() ? 'selected="selected"' : '' ?>><?= _t('conf.query.get_Z') ?></option>
  125. <option value="A" <?= 'A' === $this->query->getGet() ? 'selected="selected"' : '' ?>><?= _t('conf.query.get_A') ?></option>
  126. <option value="a" <?= in_array($this->query->getGet(), ['', 'a'], true) ? 'selected="selected"' : '' ?>><?= _t('index.feed.title') ?></option>
  127. <option value="i" <?= 'i' === $this->query->getGet() ? 'selected="selected"' : '' ?>><?= _t('index.menu.important') ?></option>
  128. <option value="s" <?= 's' === $this->query->getGet() ? 'selected="selected"' : '' ?>><?= _t('index.feed.title_fav') ?></option>
  129. <option value="T" <?= 'T' === $this->query->getGet() ? 'selected="selected"' : '' ?>><?= _t('index.menu.mylabels') ?></option>
  130. <optgroup label="<?= _t('conf.query.filter.tags') ?>">
  131. <?php foreach ($this->tags as $tag): ?>
  132. <option value="t_<?= $tag->id() ?>" <?= "t_{$tag->id()}" === $this->query->getGet() ? 'selected="selected"' : '' ?>><?= $tag->name() ?></option>
  133. <?php endforeach?>
  134. </optgroup>
  135. <optgroup label="<?= _t('conf.query.filter.categories') ?>">
  136. <?php foreach ($this->categories as $category): ?>
  137. <option value="c_<?= $category->id() ?>" <?= "c_{$category->id()}" === $this->query->getGet() ? 'selected="selected"' : '' ?>><?= $category->name() ?></option>
  138. <?php endforeach?>
  139. </optgroup>
  140. <optgroup label="<?= _t('conf.query.filter.feeds') ?>">
  141. <?php foreach ($this->feeds as $feed): ?>
  142. <option value="f_<?= $feed->id() ?>" <?= "f_{$feed->id()}" === $this->query->getGet() ? 'selected="selected"' : '' ?>><?= $feed->name() ?></option>
  143. <?php endforeach?>
  144. </optgroup>
  145. </select>
  146. </div>
  147. </div>
  148. <div class="form-group">
  149. <label class="group-name" for=""><?= _t('conf.query.filter.order') ?></label>
  150. <div class="group-controls">
  151. <select name="query[order]" class="w100" id="query_order">
  152. <option value=""></option>
  153. <option value="DESC" <?= 'DESC' === $this->query->getOrder() ? 'selected="selected"' : '' ?>><?= _t('conf.query.order_desc') ?></option>
  154. <option value="ASC" <?= 'ASC' === $this->query->getOrder() ? 'selected="selected"' : '' ?>><?= _t('conf.query.order_asc') ?></option>
  155. </select>
  156. </div>
  157. </div>
  158. <div class="form-group form-actions">
  159. <div class="group-controls">
  160. <button type="submit" class="btn btn-important"><?= _t('gen.action.submit') ?></button>
  161. <button type="submit" class="btn btn-attention confirm"
  162. data-str-confirm="<?= _t('gen.js.confirm_action_feed_cat') ?>"
  163. formaction="<?= _url('configure', 'deleteQuery', 'id', $this->queryId) ?>"
  164. formmethod="post"><?= _t('gen.action.remove') ?></button>
  165. </div>
  166. </div>
  167. </fieldset>
  168. </form>
  169. </div>