query.phtml 6.9 KB

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