query.phtml 7.8 KB

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