query.phtml 7.7 KB

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