home.php 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254
  1. <?php
  2. /**
  3. * Insipid
  4. * Personal web-bookmark-system
  5. *
  6. * Copyright 2016-2021 Johannes Keßler
  7. *
  8. * Development starting from 2011: Johannes Keßler
  9. * https://www.bananas-playground.net/projekt/insipid/
  10. *
  11. * creator:
  12. * Luke Reeves <luke@neuro-tech.net>
  13. *
  14. * This program is free software: you can redistribute it and/or modify
  15. * it under the terms of the GNU General Public License as published by
  16. * the Free Software Foundation, either version 3 of the License, or
  17. * (at your option) any later version.
  18. *
  19. * This program is distributed in the hope that it will be useful,
  20. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  21. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  22. * GNU General Public License for more details.
  23. *
  24. * You should have received a copy of the GNU General Public License
  25. * along with this program. If not, see http://www.gnu.org/licenses/gpl-3.0.
  26. *
  27. */
  28. ?>
  29. <section class="section">
  30. <div class="columns">
  31. <div class="column">
  32. <form method="post" action="index.php">
  33. <input type="hidden" name="password" />
  34. <input type="hidden" name="username" />
  35. <div class="field has-addons">
  36. <div class="control is-expanded">
  37. <div class="control has-icons-left">
  38. <input class="input" type="text" name="data[searchfield]" placeholder="<?php echo $T->t('home.input.placeholder'); ?>">
  39. <span class="icon is-small is-left">
  40. <i class="ion-link"></i>
  41. </span>
  42. </div>
  43. </div>
  44. <div class="control">
  45. <input type="submit" class="button is-info" value="<?php echo $T->t('home.input.search'); ?>" name="submitsearch">
  46. </div>
  47. </div>
  48. </form>
  49. </div>
  50. <?php require('_headNavIcons.inc.php'); ?>
  51. </div>
  52. <?php require('_displaySubmitStatus.inc.php'); ?>
  53. </section>
  54. <?php if(!empty($searchResult)) { ?>
  55. <section class="section">
  56. <div class="columns">
  57. <div class="column">
  58. <div class="content">
  59. <h3><?php echo $T->t('home.input.search.found'); ?></h3>
  60. <div class="field is-grouped is-grouped-multiline">
  61. <?php foreach ($searchResult as $sr) { ?>
  62. <div class="control">
  63. <div class="tags has-addons">
  64. <a class="tag is-dark" href="<?php echo $sr['link']; ?>" target="_blank" ><?php echo $sr['title']; ?></a>
  65. <a class="tag is-info" title="<?php echo $T->t('view.more.details'); ?>" href="index.php?p=linkinfo&id=<?php echo $sr['hash']; ?>" ><i class="ion-md-information-circle-outline"></i></a>
  66. </div>
  67. </div>
  68. <?php } ?>
  69. </div>
  70. </div>
  71. </div>
  72. </div>
  73. </section>
  74. <?php } ?>
  75. <?php if($showAddForm) { ?>
  76. <section class="section">
  77. <form method="post" autocomplete=off>
  78. <input type="hidden" name="password" />
  79. <input type="hidden" name="username" />
  80. <div class="columns">
  81. <div class="column">
  82. <div class="content">
  83. <h3><?php echo $T->t('home.input.url.not.found.add'); ?></h3>
  84. </div>
  85. <div class="field has-addons">
  86. <div class="control is-expanded">
  87. <div class="control has-icons-left">
  88. <input type="url" name="data[url]" class="input" value="<?php echo $formData['url'] ?? ''; ?>" />
  89. <span class="icon is-small is-left">
  90. <i class="ion-link"></i>
  91. </span>
  92. </div>
  93. </div>
  94. </div>
  95. </div>
  96. </div>
  97. <div class="columns">
  98. <div class="column is-half">
  99. <div class="field">
  100. <label class="label"><?php echo $T->t('view.title'); ?></label>
  101. <div class="control">
  102. <input class="input" type="text" name="data[title]" value="<?php echo $formData['title'] ?? ''; ?>" />
  103. </div>
  104. </div>
  105. </div>
  106. <div class="column is-half">
  107. <div class="field">
  108. <label class="label"><?php echo $T->t('view.description'); ?></label>
  109. <div class="control">
  110. <input class="input" type="text" name="data[description]" value="<?php echo $formData['description'] ?? ''; ?>" />
  111. </div>
  112. </div>
  113. </div>
  114. </div>
  115. <div class="columns">
  116. <div class="column is-half">
  117. <img class="linkthumbnail" src="<?php echo $formData['imageToShow'] ?? ''; ?>" alt="<?php echo $T->t('view.image.of.link'); ?>" />
  118. </div>
  119. <div class="column is-half">
  120. <div class="field">
  121. <label class="label"><?php echo $T->t('view.image.link'); ?></label>
  122. <div class="control">
  123. <input class="input" type="url" name="data[image]" value="<?php echo $formData['image'] ?? ''; ?>" />
  124. </div>
  125. </div>
  126. </div>
  127. </div>
  128. <div class="columns">
  129. <div class="column is-half">
  130. <label class="label"><?php echo $T->t('view.categories'); ?></label>
  131. <div class="field is-grouped is-grouped-multiline" id="category-listbox">
  132. <div class="control" id="category-template" style="display: none;">
  133. <div class="tags has-addons">
  134. <span class="tag"></span>
  135. <a class="tag is-delete" onclick="removeTag('','category')"></a>
  136. </div>
  137. </div>
  138. <?php foreach($formData['categories'] as $t) { ?>
  139. <div class="control" id="category-<?php echo $t; ?>">
  140. <div class="tags has-addons">
  141. <span class="tag"><?php echo $t; ?></span>
  142. <a class="tag is-delete" onclick="removeTag('<?php echo $t; ?>','category')"></a>
  143. </div>
  144. </div>
  145. <?php } ?>
  146. </div>
  147. <div class="field">
  148. <div class="control">
  149. <input type="text" placeholder="categoryname"
  150. name="categorylistinput" list="category-datalist" value="" onkeypress="addTag(event,'category')" />
  151. </div>
  152. <p class="help"><?php echo $T->t('view.tag.help'); ?></p>
  153. </div>
  154. <datalist id="category-datalist">
  155. <?php foreach($existingCategories as $c) { ?>
  156. <option value="<?php echo $c['name']; ?>"><?php echo $c['name']; ?></option>
  157. <?php } ?>
  158. </datalist>
  159. <input type="hidden" name="data[category]" id="category-save" value="<?php echo implode(',',$formData['categories']); ?>" />
  160. </div>
  161. <div class="column is-half">
  162. <label class="label"><?php echo $T->t('view.tag'); ?></label>
  163. <div class="field is-grouped is-grouped-multiline" id="tag-listbox">
  164. <div class="control" id="tag-template" style="display: none;">
  165. <div class="tags has-addons">
  166. <span class="tag"></span>
  167. <a class="tag is-delete" onclick="removeTag('','tag')"></a>
  168. </div>
  169. </div>
  170. <?php foreach($formData['tags'] as $t) { ?>
  171. <div class="control" id="tag-<?php echo $t; ?>">
  172. <div class="tags has-addons">
  173. <span class="tag"><?php echo $t; ?></span>
  174. <a class="tag is-delete" onclick="removeTag('<?php echo $t; ?>','tag')"></a>
  175. </div>
  176. </div>
  177. <?php } ?>
  178. </div>
  179. <div class="field">
  180. <div class="control">
  181. <input type="text" placeholder="tagname"
  182. name="taglistinput" list="tag-datalist" value="" onkeypress="addTag(event,'tag')" />
  183. </div>
  184. <p class="help"><?php echo $T->t('view.tag.help'); ?></p>
  185. </div>
  186. <datalist id="tag-datalist">
  187. <?php foreach($existingTags as $t) { ?>
  188. <option value="<?php echo $t['name']; ?>"><?php echo $t['name']; ?></option>
  189. <?php } ?>
  190. </datalist>
  191. <input type="hidden" name="data[tag]" id="tag-save" value="<?php echo implode(',',$formData['tags']); ?>" />
  192. </div>
  193. </div>
  194. <div class="columns">
  195. <div class="column is-half">
  196. <label class="checkbox is-pulled-right">
  197. <input type="checkbox" name="data[private]" value="1" <?php if(isset($formData['private'])) echo "checked"; ?> />
  198. <?php echo $T->t('view.private'); ?>
  199. </label>
  200. </div>
  201. <div class="column is-half">
  202. <div class="control">
  203. <input type="submit" class="button is-primary" name="addnewone" value="<?php echo $T->t('home.input.new.link'); ?>">
  204. </div>
  205. </div>
  206. </div>
  207. </form>
  208. </section>
  209. <script type="text/javascript" src="asset/js/editlink.js"></script>
  210. <?php } ?>
  211. <section class="section">
  212. <div class="columns">
  213. <div class="column">
  214. <div class="content">
  215. <h4><a href="index.php?p=overview&m=all"><?php echo $T->t('home.last.added'); ?></a></h4>
  216. <?php if(!empty($latestLinks)) { ?>
  217. <dl>
  218. <?php foreach ($latestLinks as $ll) { ?>
  219. <dt>
  220. <a href="<?php echo $ll['link']; ?>" target="_blank"><?php echo $ll['title']; ?></a>
  221. <a href="index.php?p=linkinfo&id=<?php echo $ll['hash']; ?>"><i class="ion-md-information-circle-outline"></i></a>
  222. </dt>
  223. <dd class="tags ddTags">
  224. <?php foreach ($ll['tags'] as $tid=>$tname) {
  225. echo '<a href="index.php?p=overview&m=tag&id='.$tid.'" class="tag is-white" title="'.$T->t('view.tag').'">'.$tname.'</a>';
  226. } ?>
  227. <?php foreach ($ll['categories'] as $cid=>$cname) {
  228. echo '<a href="index.php?p=overview&m=category&id='.$cid.'" class="tag is-white" title="'.$T->t('view.category').'">'.$cname.'</a>';
  229. } ?>
  230. </dd>
  231. <?php } ?>
  232. </dl>
  233. <?php } ?>
  234. </div>
  235. </div>
  236. </div>
  237. </section>