query.phtml 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  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">
  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" 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. <fieldset>
  23. <legend><?= _t('conf.query.share') ?></legend>
  24. <div class="form-group">
  25. <div class="group-controls">
  26. <label class="checkbox" for="shareRss">
  27. <input type="checkbox" name="query[shareRss]" id="shareRss" value="1" <?= $this->query->shareRss() ? 'checked="checked"' : ''?> />
  28. <?= _t('conf.query.filter.shareRss') ?>
  29. </label>
  30. <?php if ($this->query->sharedUrlRss() !== ''): ?>
  31. <ul>
  32. <li><a href="<?= $this->query->sharedUrlHtml() ?>"><?= _i('link') ?> <?= _t('conf.query.share.html') ?></a></li>
  33. <li><a href="<?= $this->query->sharedUrlRss() ?>"><?= _i('link') ?> <?= _t('conf.query.share.rss') ?></a></li>
  34. </ul>
  35. <?php endif; ?>
  36. </div>
  37. <div class="group-controls">
  38. <label class="checkbox" for="shareOpml">
  39. <input type="checkbox" name="query[shareOpml]" id="shareOpml" value="1" <?= $this->query->shareOpml() && $this->query->safeForOpml() ? 'checked="checked"' : '' ?>
  40. <?= $this->query->safeForOpml() ? '' : 'disabled="disabled"' ?> />
  41. <?= _t('conf.query.filter.shareOpml') ?>
  42. </label>
  43. <?php if ($this->query->sharedUrlOpml() !== ''): ?>
  44. <ul>
  45. <li><a href="<?= $this->query->sharedUrlOpml() ?>"><?= _i('link') ?> <?= _t('conf.query.share.opml') ?></a></li>
  46. </ul>
  47. <?php endif; ?>
  48. </div>
  49. <p class="help"><?= _i('help') ?> <?= _t('conf.query.share.help') ?></a></p>
  50. <p class="help"><?= _i('help') ?> <?= _t('conf.query.help') ?></a></p>
  51. </div>
  52. <div class="form-group form-actions">
  53. <div class="group-controls">
  54. <button type="submit" class="btn btn-important"><?= _t('gen.action.submit') ?></button>
  55. </div>
  56. </div>
  57. </fieldset>
  58. <fieldset>
  59. <legend><?= _t('conf.query.filter') ?></legend>
  60. <div class="form-group">
  61. <label class="group-name" for=""><?= _t('conf.query.filter.search') ?></label>
  62. <div class="group-controls">
  63. <input type="text" id="query_search" name="query[search]" value="<?= htmlspecialchars($this->query->getSearch()->getRawInput(), ENT_COMPAT, 'UTF-8') ?>"/>
  64. <p class="help"><?= _i('help') ?> <?= _t('gen.menu.search_help') ?></a></p>
  65. </div>
  66. </div>
  67. <div class="form-group">
  68. <label class="group-name" for=""><?= _t('conf.query.filter.state') ?></label>
  69. <div class="group-controls">
  70. <label class="checkbox" for="show_read">
  71. <input type="checkbox" name="query[state][]" id="show_read"
  72. value="<?= FreshRSS_Entry::STATE_READ ?>" <?= FreshRSS_Entry::STATE_READ & $this->query->getState() ? 'checked="checked"' : ''?> />
  73. <?= _t('index.menu.read') ?>
  74. </label>
  75. <label class="checkbox" for="show_not_read">
  76. <input type="checkbox" name="query[state][]" id="show_not_read"
  77. value="<?= FreshRSS_Entry::STATE_NOT_READ ?>" <?= FreshRSS_Entry::STATE_NOT_READ & $this->query->getState() ? 'checked="checked"' : ''?> />
  78. <?= _t('index.menu.unread') ?>
  79. </label>
  80. <label class="checkbox" for="show_favorite">
  81. <input type="checkbox" name="query[state][]" id="show_favorite"
  82. value="<?= FreshRSS_Entry::STATE_FAVORITE ?>" <?= FreshRSS_Entry::STATE_FAVORITE & $this->query->getState() ? 'checked="checked"' : ''?> />
  83. <?= _t('index.menu.starred') ?>
  84. </label>
  85. <label class="checkbox" for="show_not_favorite">
  86. <input type="checkbox" name="query[state][]" id="show_not_favorite"
  87. value="<?= FreshRSS_Entry::STATE_NOT_FAVORITE ?>" <?= FreshRSS_Entry::STATE_NOT_FAVORITE & $this->query->getState() ? 'checked="checked"' : ''?> />
  88. <?= _t('index.menu.non-starred') ?>
  89. </label>
  90. </div>
  91. </div>
  92. <div class="form-group">
  93. <label class="group-name" for="query_get"><?= _t('conf.query.filter.type') ?></label>
  94. <div class="group-controls">
  95. <select name="query[get]" id="query_get" size="10">
  96. <option value="a" <?= in_array($this->query->getGet(), ['', 'a'], true) ? 'selected="selected"' : '' ?>><?= _t('index.feed.title') ?></option>
  97. <option value="i" <?= 'i' === $this->query->getGet() ? 'selected="selected"' : '' ?>><?= _t('index.menu.important') ?></option>
  98. <option value="s" <?= 's' === $this->query->getGet() ? 'selected="selected"' : '' ?>><?= _t('index.feed.title_fav') ?></option>
  99. <option value="T" <?= 'T' === $this->query->getGet() ? 'selected="selected"' : '' ?>><?= _t('index.menu.tags') ?></option>
  100. <optgroup label="<?= _t('conf.query.filter.tags') ?>">
  101. <?php foreach ($this->tags as $tag): ?>
  102. <option value="t_<?= $tag->id() ?>" <?= "t_{$tag->id()}" === $this->query->getGet() ? 'selected="selected"' : '' ?>><?= $tag->name() ?></option>
  103. <?php endforeach?>
  104. </optgroup>
  105. <optgroup label="<?= _t('conf.query.filter.categories') ?>">
  106. <?php foreach ($this->categories as $category): ?>
  107. <option value="c_<?= $category->id() ?>" <?= "c_{$category->id()}" === $this->query->getGet() ? 'selected="selected"' : '' ?>><?= $category->name() ?></option>
  108. <?php endforeach?>
  109. </optgroup>
  110. <optgroup label="<?= _t('conf.query.filter.feeds') ?>">
  111. <?php foreach ($this->feeds as $feed): ?>
  112. <option value="f_<?= $feed->id() ?>" <?= "f_{$feed->id()}" === $this->query->getGet() ? 'selected="selected"' : '' ?>><?= $feed->name() ?></option>
  113. <?php endforeach?>
  114. </optgroup>
  115. </select>
  116. </div>
  117. </div>
  118. <div class="form-group">
  119. <label class="group-name" for=""><?= _t('conf.query.filter.order') ?></label>
  120. <div class="group-controls">
  121. <select name="query[order]" id="query_order">
  122. <option value=""></option>
  123. <option value="DESC" <?= 'DESC' === $this->query->getOrder() ? 'selected="selected"' : '' ?>><?= _t('conf.query.order_desc') ?></option>
  124. <option value="ASC" <?= 'ASC' === $this->query->getOrder() ? 'selected="selected"' : '' ?>><?= _t('conf.query.order_asc') ?></option>
  125. </select>
  126. </div>
  127. </div>
  128. <div class="form-group form-actions">
  129. <div class="group-controls">
  130. <button type="submit" class="btn btn-important"><?= _t('gen.action.submit') ?></button>
  131. <button type="submit" class="btn btn-attention confirm"
  132. data-str-confirm="<?= _t('gen.js.confirm_action_feed_cat') ?>"
  133. formaction="<?= _url('configure', 'deleteQuery', 'id', $this->queryId) ?>"
  134. formmethod="post"><?= _t('gen.action.remove') ?></button>
  135. </div>
  136. </div>
  137. </fieldset>
  138. </form>
  139. </div>