|
@@ -1,203 +1,35 @@
|
|
|
-@Title{Gallery}@
|
|
|
-@CSS{
|
|
|
- <?=file_get_contents("css/gallery.css")?>
|
|
|
-
|
|
|
- #main-header .header{
|
|
|
- box-shadow:none !important;
|
|
|
- }
|
|
|
-}@
|
|
|
-@CSSMed{
|
|
|
- @media(orientation:portrait){
|
|
|
- .image{
|
|
|
- width:33.3%;
|
|
|
- }
|
|
|
- }
|
|
|
+@Init{
|
|
|
+ $this->RegisterCSSFile("gallery.css");
|
|
|
+ $this->RegisterJSFile("controllers/galleryManage.js");
|
|
|
+ $this->RegisterJSFile("directives/contextMenu.js");
|
|
|
}@
|
|
|
-@CSSSmall{
|
|
|
- @media(orientation:portrait){
|
|
|
- #albums td:nth-child(3), #albums th:nth-child(3){
|
|
|
- display:none;
|
|
|
- }
|
|
|
-
|
|
|
- .image{
|
|
|
- width:50%;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- @media(orientation:landscape){
|
|
|
- .image{
|
|
|
- width:33.3%;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- #albums td:first-child, #albums th:first-child{
|
|
|
- display:none;
|
|
|
- }
|
|
|
-
|
|
|
- table{
|
|
|
- width:100%;
|
|
|
- }
|
|
|
-
|
|
|
- #albums td:last-child, #albums th:last-child, #albums td:nth-child(3), #albums th:nth-child(3){
|
|
|
- width:1px;
|
|
|
- }
|
|
|
+@Title{Gallery}@
|
|
|
+@ButtonsLeft{
|
|
|
+ <button onclick="Navigate('/gallery/createalbum/')" title="Upload Images">
|
|
|
+ <img src="/images/upload.svg" alt="Add Album" />
|
|
|
+ </button>
|
|
|
}@
|
|
|
@ButtonsRight{
|
|
|
<button onclick="Navigate('/gallery/createalbum/')" title="Create Album">
|
|
|
<img src="/images/add_album.svg" alt="Add Album" />
|
|
|
</button>
|
|
|
}@
|
|
|
-@JavaScript{
|
|
|
- $(function(){
|
|
|
- $("#tabs-content").css("margin-top",$("#tabs").height()+"px");
|
|
|
-
|
|
|
- $("#tabs>a").click(function(){
|
|
|
- $("#tabs-content>*").hide();
|
|
|
- $($(this).attr("href")).show();
|
|
|
- $("#tabs>a").removeClass("active");
|
|
|
- $(this).addClass("active");
|
|
|
-
|
|
|
- return false;
|
|
|
- });
|
|
|
-
|
|
|
- $("#tabs a.active").click();
|
|
|
-
|
|
|
- $(".image input[type=checkbox]").click(function(){
|
|
|
- return false;
|
|
|
- });
|
|
|
-
|
|
|
- function SetupSelectedImageClass(elem){
|
|
|
- var tick=elem.find("input[type=checkbox]");
|
|
|
- if (tick.prop("checked"))
|
|
|
- elem.addClass("selected");
|
|
|
- else
|
|
|
- elem.removeClass("selected");
|
|
|
- }
|
|
|
-
|
|
|
- function ApplyImageClick(){
|
|
|
- $(".image").click(function(){
|
|
|
- var tick=$(this).find("input[type=checkbox]");
|
|
|
- tick.prop("checked",!tick.prop("checked"));
|
|
|
-
|
|
|
- SetupSelectedImageClass($(this));
|
|
|
- });
|
|
|
- }
|
|
|
-
|
|
|
- $(".image").each(function(e){ // refresh hack
|
|
|
- SetupSelectedImageClass($(this));
|
|
|
- });
|
|
|
-
|
|
|
- $("#selectAlbumOld").change(function(){
|
|
|
- $.ajax("/gallery/jsonLoadAlbum/"+this.selectedIndex).done(function(data){
|
|
|
- var images=JSON.parse(data);
|
|
|
- html="";
|
|
|
- for (i=0;i<images.length;i++)
|
|
|
- html+='<div class="image">'+
|
|
|
- '<div>'+
|
|
|
- '<img src="/'+images[i].ThumbnailPath+'" alt="'+images[i].ImageTitle+'" />'+
|
|
|
- '<span>'+images[i].ImageTitle+'</span>'+
|
|
|
- '<input type="checkbox" value="'+images[i].ImageId+'" name="selected[]" />'+
|
|
|
- '</div>'+
|
|
|
- '</div>';
|
|
|
- if (html=="")
|
|
|
- html="<p>There are no images in this album</p>";
|
|
|
- $("#imageSelector").html(html);
|
|
|
- ApplyImageClick();
|
|
|
- });
|
|
|
- });
|
|
|
-
|
|
|
- ApplyImageClick();
|
|
|
- });
|
|
|
-}@
|
|
|
@Body{
|
|
|
-<div id="tabs">
|
|
|
- <a href="#images">Images</a><a href="#albums">Albums</a><a class="active" href="#organise">Organise</a>
|
|
|
-</div>
|
|
|
-<div id="tabs-content" style="margin-top:55px">
|
|
|
- <div id="images">
|
|
|
- <h3>New Image</h3>
|
|
|
- <form action="/gallery/upload/" method="post" enctype="multipart/form-data">
|
|
|
- <table>
|
|
|
- <tr>
|
|
|
- <td><label for="imageTitle">Image title:</label></td>
|
|
|
- <td><input type="text" name="imageTitle" id="imageTitle" value="<?=$image->ImageTitle?>" /></td>
|
|
|
- </tr>
|
|
|
- <tr>
|
|
|
- <td><label for="imageDesc">Image description</label></td>
|
|
|
- <td><textarea name="imageDesc" id="imageDesc"><?=$image->ImageDescription?></textarea></td>
|
|
|
- </tr>
|
|
|
- <tr>
|
|
|
- <td><label for="imageFile">Select image:</label></td>
|
|
|
- <td><input type="file" name="imageFile" id="imageFile" /></td>
|
|
|
- </tr>
|
|
|
- <tr>
|
|
|
- <td colspan="2" align="right">
|
|
|
- <button type="submit" title="Upload" name="imageUpload">
|
|
|
- <img src="/images/send.svg" alt="Upload" />
|
|
|
- </button>
|
|
|
- </td>
|
|
|
- </tr>
|
|
|
- </table>
|
|
|
- </form>
|
|
|
- </div>
|
|
|
- <div id="albums">
|
|
|
- <form action="" method="post" id="manageForm">
|
|
|
- <input type="hidden" name="formSubmitted" value="yes" />
|
|
|
- <table>
|
|
|
- <tr>
|
|
|
- <th>ID</th>
|
|
|
- <th>Title</th>
|
|
|
- <th>Timestamp</th>
|
|
|
- <th>Actions</th>
|
|
|
- </tr>
|
|
|
- <?php foreach ($albums as $album){?>
|
|
|
- <tr>
|
|
|
- <td><?=$album->AlbumId?></td>
|
|
|
- <td><a href="/gallery/view/<?=$album->AlbumUrl?>"><?=$album->AlbumTitle?></a></td>
|
|
|
- <td><?=$album->AlbumTimestamp?></td>
|
|
|
- <td>
|
|
|
- <button value="<?=$album->AlbumId?>" name="delete" title="Delete">
|
|
|
- <img src="/images/delete.svg" alt="Delete" />
|
|
|
- </button>
|
|
|
- <button value="/blog/edit/<?=$album->AlbumId?>" name="edit" title="Edit" class="jsNav">
|
|
|
- <img src="/images/edit.svg" alt="Edit" />
|
|
|
- </button>
|
|
|
- </td>
|
|
|
- </tr>
|
|
|
- <?php } ?>
|
|
|
- </table>
|
|
|
- </form>
|
|
|
- </div>
|
|
|
- <div id="organise">
|
|
|
- <form action="/gallery/move" method="post">
|
|
|
- <label for="selectAlbumOld">Move from album </label>
|
|
|
- <select id="selectAlbumOld" name="selectAlbumOld">
|
|
|
- <option value="0">No album</option>
|
|
|
- <?php foreach ($albums as $album)
|
|
|
- echo '<option value="',$album->AlbumId,'">',$album->AlbumTitle,'</option>';
|
|
|
- ?>
|
|
|
- </select>
|
|
|
- <label for="selectAlbumNew"> to album </label>
|
|
|
- <select id="selectAlbumNew" name="selectAlbumNew">
|
|
|
- <option value="0">No album</option>
|
|
|
- <?php foreach ($albums as $album)
|
|
|
- echo '<option value="',$album->AlbumId,'">',$album->AlbumTitle,'</option>';
|
|
|
- ?>
|
|
|
- </select>
|
|
|
- <input type="submit" name="moveImages" value="go" />
|
|
|
- <div id="imageSelector">
|
|
|
- <?php
|
|
|
- foreach ($images as $image)
|
|
|
- echo '<div class="image">',
|
|
|
- '<div>',
|
|
|
- '<img src="/',$image->ThumbnailPath,'" alt="',$image->ImageTitle,'" />',
|
|
|
- '<span>',$image->ImageTitle,'</span>',
|
|
|
- '<input type="checkbox" value="',$image->ImageId,'" name="selected[]" />',
|
|
|
- '</div>',
|
|
|
- '</div>';
|
|
|
- ?>
|
|
|
+<div ng-controller="galleryManage">
|
|
|
+ <select ng-model="selectedAlbum" ng-options="album.AlbumTitle for album in albums"></select>
|
|
|
+ <button ng-click="editAlbum(selectedAlbum)" title="Edit Album">
|
|
|
+ <img src="/images/edit.svg" alt="Edit" />
|
|
|
+ </button>
|
|
|
+ <div class="imageSelector">
|
|
|
+ <context-menu actions="contextMenuActions"></context-menu>
|
|
|
+ <div class="image" ng-repeat="image in selectedAlbum.Images" ng-click="selectImage(image)" ng-class="{selected:image.selected}">
|
|
|
+ <div>
|
|
|
+ <img ng-src="/{{image.ThumbnailPath}}" alt="{{image.ImageTitle}}" />
|
|
|
+ <span>{{image.ImageTitle}}</span>
|
|
|
+ <input type="checkbox" value="{{image.ImageId}}" name="selected[]" />
|
|
|
</div>
|
|
|
- </form>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
+ <scope-init value="albums"><?=json_encode($albums)?></scope-init>
|
|
|
</div>
|
|
|
}@
|