manage.view 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. @Title{Gallery}@
  2. @CSS{
  3. #main-header{
  4. box-shadow:none !important;
  5. }
  6. #tabs{
  7. background:#f44336;
  8. margin:-20px;
  9. margin-bottom:10px;
  10. position:fixed;
  11. width:100%;
  12. box-shadow: 0px 4px 5px -2px rgba(50, 50, 50, 0.8);
  13. }
  14. #tabs a{
  15. display:inline-block;
  16. color:#ffcdd2;
  17. padding:15px 30px;
  18. text-decoration:none;
  19. text-transform: uppercase;
  20. }
  21. #tabs a.active{
  22. color:#fff;
  23. border-bottom:3px solid #fff;
  24. }
  25. .image{
  26. width:25%;
  27. display:inline-block;
  28. vertical-align:top;
  29. text-align:center;
  30. }
  31. .image>div{
  32. margin:5px;
  33. padding:5px;
  34. background:#e0e0e0;
  35. }
  36. }@
  37. @CSSSmall{
  38. @media(orientation:portrait){
  39. #albums td:nth-child(3), #albums th:nth-child(3){
  40. display:none;
  41. }
  42. }
  43. #albums td:first-child, #albums th:first-child{
  44. display:none;
  45. }
  46. table{
  47. width:100%;
  48. }
  49. #albums td:last-child, #albums th:last-child, #albums td:nth-child(3), #albums th:nth-child(3){
  50. width:1px;
  51. }
  52. }@
  53. @ButtonsRight{
  54. <button onclick="Navigate('/gallery/createalbum/')" title="Create Album">
  55. <img src="/images/add_album.svg" alt="Add Album" />
  56. </button>
  57. }@
  58. @JavaScript{
  59. $(function(){
  60. $("#tabs>a").click(function(){
  61. $("#tabs-content>*").hide();
  62. $($(this).attr("href")).show();
  63. $("#tabs>a").removeClass("active");
  64. $(this).addClass("active");
  65. return false;
  66. });
  67. $("#tabs a.active").click();
  68. });
  69. }@
  70. @Body{
  71. <div id="tabs">
  72. <a class="active" href="#images">Images</a><a href="#albums">Albums</a>
  73. </div>
  74. <div id="tabs-content" style="margin-top:55px">
  75. <div id="images">
  76. <?php if (isset($errors) && count($errors)>0) {
  77. echo '<div class="errors">The following errors occured with the image submission:<ul>';
  78. foreach ($errors as $error)
  79. echo '<li>',$error,'</li>';
  80. echo '</ul>Please rectify them and try again.</div>';
  81. } ?>
  82. <h3>New Image</h3>
  83. <form action="/gallery/upload/" method="post" enctype="multipart/form-data">
  84. <table>
  85. <tr>
  86. <td><label for="imageTitle">Image title:</label></td>
  87. <td><input type="text" name="imageTitle" id="imageTitle" /></td>
  88. </tr>
  89. <tr>
  90. <td><label for="imageDesc">Image description</label></td>
  91. <td><textarea name="imageDesc" id="imageDesc"></textarea></td>
  92. </tr>
  93. <tr>
  94. <td><label for="imageFile">Select image:</label></td>
  95. <td><input type="file" name="imageFile" id="imageFile"></td>
  96. </tr>
  97. <tr>
  98. <td colspan="2" align="right">
  99. <button type="submit" title="Upload" name="imageUpload">
  100. <img src="/images/send.svg" alt="Upload" />
  101. </button>
  102. </td>
  103. </tr>
  104. </table>
  105. </form>
  106. <div>
  107. <?php
  108. foreach ($images as $image)
  109. echo '<div class="image">',
  110. '<div>',
  111. '<img src="/',$image->/*Thumbnail*/Path,'" alt="',$image->ImageTitle,'" />',
  112. '<span>',$image->ImageTitle,'</span>',
  113. '</div>',
  114. '</div>';
  115. ?>
  116. </div>
  117. </div>
  118. <div id="albums">
  119. <form action="" method="post" id="manageForm">
  120. <input type="hidden" name="formSubmitted" value="yes" />
  121. <table>
  122. <tr>
  123. <th>ID</th>
  124. <th>Title</th>
  125. <th>Timestamp</th>
  126. <th>Actions</th>
  127. </tr>
  128. <?php foreach ($albums as $album){?>
  129. <tr>
  130. <td><?=$album->AlbumId?></td>
  131. <td><a href="/gallery/view/<?=$album->AlbumUrl?>"><?=$album->AlbumTitle?></a></td>
  132. <td><?=$album->AlbumTimestamp?></td>
  133. <td>
  134. <button value="<?=$album->AlbumId?>" name="delete" title="Delete">
  135. <img src="/images/delete.svg" alt="Delete" />
  136. </button>
  137. <button value="/blog/edit/<?=$album->AlbumId?>" name="edit" title="Edit" class="jsNav">
  138. <img src="/images/edit.svg" alt="Edit" />
  139. </button>
  140. </td>
  141. </tr>
  142. <?php } ?>
  143. </table>
  144. </form>
  145. </div>
  146. </div>
  147. }@