query.phtml 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  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="<?= htmlspecialchars($this->query->getSearch()->__toString(), ENT_COMPAT, 'UTF-8') ?>"/>
  91. <p class="help"><?= _i('help') ?> <?= _t('gen.menu.search_help') ?></a></p>
  92. </div>
  93. </div>
  94. <div class="form-group">
  95. <label class="group-name" for=""><?= _t('conf.query.filter.state') ?></label>
  96. <div class="group-controls">
  97. <label class="checkbox" for="show_read">
  98. <input type="checkbox" name="query[state][]" id="show_read"
  99. value="<?= FreshRSS_Entry::STATE_READ ?>" <?= FreshRSS_Entry::STATE_READ & $this->query->getState() ? 'checked="checked"' : ''?> />
  100. <?= _t('index.menu.read') ?>
  101. </label>
  102. <label class="checkbox" for="show_not_read">
  103. <input type="checkbox" name="query[state][]" id="show_not_read"
  104. value="<?= FreshRSS_Entry::STATE_NOT_READ ?>" <?= FreshRSS_Entry::STATE_NOT_READ & $this->query->getState() ? 'checked="checked"' : ''?> />
  105. <?= _t('index.menu.unread') ?>
  106. </label>
  107. <label class="checkbox" for="show_favorite">
  108. <input type="checkbox" name="query[state][]" id="show_favorite"
  109. value="<?= FreshRSS_Entry::STATE_FAVORITE ?>" <?= FreshRSS_Entry::STATE_FAVORITE & $this->query->getState() ? 'checked="checked"' : ''?> />
  110. <?= _t('index.menu.starred') ?>
  111. </label>
  112. <label class="checkbox" for="show_not_favorite">
  113. <input type="checkbox" name="query[state][]" id="show_not_favorite"
  114. value="<?= FreshRSS_Entry::STATE_NOT_FAVORITE ?>" <?= FreshRSS_Entry::STATE_NOT_FAVORITE & $this->query->getState() ? 'checked="checked"' : ''?> />
  115. <?= _t('index.menu.non-starred') ?>
  116. </label>
  117. </div>
  118. </div>
  119. <div class="form-group">
  120. <label class="group-name" for="query_get"><?= _t('conf.query.filter.type') ?></label>
  121. <div class="group-controls">
  122. <select name="query[get]" class="w100" id="query_get" size="10">
  123. <option value="Z" <?= 'Z' === $this->query->getGet() ? 'selected="selected"' : '' ?>><?= _t('conf.query.get_Z') ?></option>
  124. <option value="A" <?= 'A' === $this->query->getGet() ? 'selected="selected"' : '' ?>><?= _t('conf.query.get_A') ?></option>
  125. <option value="a" <?= in_array($this->query->getGet(), ['', 'a'], true) ? 'selected="selected"' : '' ?>><?= _t('index.feed.title') ?></option>
  126. <option value="i" <?= 'i' === $this->query->getGet() ? 'selected="selected"' : '' ?>><?= _t('index.menu.important') ?></option>
  127. <option value="s" <?= 's' === $this->query->getGet() ? 'selected="selected"' : '' ?>><?= _t('index.feed.title_fav') ?></option>
  128. <option value="T" <?= 'T' === $this->query->getGet() ? 'selected="selected"' : '' ?>><?= _t('index.menu.mylabels') ?></option>
  129. <optgroup label="<?= _t('conf.query.filter.tags') ?>">
  130. <?php foreach ($this->tags as $tag): ?>
  131. <option value="t_<?= $tag->id() ?>" <?= "t_{$tag->id()}" === $this->query->getGet() ? 'selected="selected"' : '' ?>><?= $tag->name() ?></option>
  132. <?php endforeach?>
  133. </optgroup>
  134. <optgroup label="<?= _t('conf.query.filter.categories') ?>">
  135. <?php foreach ($this->categories as $category): ?>
  136. <option value="c_<?= $category->id() ?>" <?= "c_{$category->id()}" === $this->query->getGet() ? 'selected="selected"' : '' ?>><?= $category->name() ?></option>
  137. <?php endforeach?>
  138. </optgroup>
  139. <optgroup label="<?= _t('conf.query.filter.feeds') ?>">
  140. <?php foreach ($this->feeds as $feed): ?>
  141. <option value="f_<?= $feed->id() ?>" <?= "f_{$feed->id()}" === $this->query->getGet() ? 'selected="selected"' : '' ?>><?= $feed->name() ?></option>
  142. <?php endforeach?>
  143. </optgroup>
  144. </select>
  145. </div>
  146. </div>
  147. <div class="form-group">
  148. <label class="group-name" for=""><?= _t('conf.query.filter.order') ?></label>
  149. <div class="group-controls">
  150. <select name="query[order]" class="w100" id="query_order">
  151. <option value=""></option>
  152. <option value="DESC" <?= 'DESC' === $this->query->getOrder() ? 'selected="selected"' : '' ?>><?= _t('conf.query.order_desc') ?></option>
  153. <option value="ASC" <?= 'ASC' === $this->query->getOrder() ? 'selected="selected"' : '' ?>><?= _t('conf.query.order_asc') ?></option>
  154. </select>
  155. </div>
  156. </div>
  157. <div class="form-group form-actions">
  158. <div class="group-controls">
  159. <button type="submit" class="btn btn-important"><?= _t('gen.action.submit') ?></button>
  160. <button type="submit" class="btn btn-attention confirm"
  161. data-str-confirm="<?= _t('gen.js.confirm_action_feed_cat') ?>"
  162. formaction="<?= _url('configure', 'deleteQuery', 'id', $this->queryId) ?>"
  163. formmethod="post"><?= _t('gen.action.remove') ?></button>
  164. </div>
  165. </div>
  166. </fieldset>
  167. </form>
  168. </div>