<%if album.sone.local>
<script language="javascript">
+
+ /* ID of the image currently being edited. */
+ var editingImageId = null;
+
+ /**
+ * Shows the form for editing an image.
+ *
+ * @param imageId The ID of the image to edit.
+ */
+ function editImage(imageId) {
+ if (editingImageId != imageId) {
+ cancelEditing();
+ } else {
+ return;
+ }
+ $(".show-data", "#image-" + imageId).hide();
+ $(".edit-data", "#image-" + imageId).show();
+ $(document).bind("click.sone", function(event) {
+ if ($(event.target).closest("#image-" + imageId).size() == 0) {
+ cancelEditing();
+ }
+ });
+ }
+
+ /**
+ * Cancels all image editing.
+ */
+ function cancelEditing() {
+ $(".show-data").show();
+ $(".edit-data").hide();
+ $("form.edit-image").each(function() {
+ this.reset();
+ });
+ $(document).unbind("click.sone");
+ editingImageId = null;
+ }
+
$(function() {
getTranslation("WebInterface.DefaultText.UploadImage.Title", function(text) {
$("#upload-image :input[name='title']").each(function() {
hideAndShowBlock(".upload-image", ".show-upload-image", ".hide-upload-image");
hideAndShowBlock(".delete-album", ".show-delete-album", ".hide-delete-album");
- hideAndShowData = function(activationElements, activeElements, hideElement, showElement) {
- $(activationElements).click(function() {
- imageId = $(this).closest(".image").find(".image-id").text();
- $(hideElement, $("#image-" + imageId)).hide();
- $(showElement, $("#image-" + imageId)).show();
- $(document).click(function(event) {
- if ($(event.target).closest("#image-" + imageId).size() == 0) {
- $(showElement).hide();
- $(hideElement).show();
- }
- return $(event.target).is("button");
+ $(".image").each(function() {
+ imageId = $(this).closest(".image").find(".image-id").text();
+ (function(element, imageId) {
+ $(".show-data", element).click(function() {
+ editImage(imageId);
});
+ })(this, imageId);
});
- };
-
- hideAndShowData(".image-title, .image-description", ".image", ".show-data", ".edit-data");
+ });
});
</script>
<%/if>
<input type="hidden" name="formPassword" value="<%formPassword|html>" />
<input type="hidden" name="album" value="<%album.id|html>" />
+ <%if ! album.images.empty>
+ <div>
+ <label for="album-image"><%= Page.ImageBrowser.Album.Label.AlbumImage|l10n|html></label>
+ <select name="album-image">
+ <option disabled="disabled"><%= Page.ImageBrowser.Album.AlbumImage.Choose|l10n|html></option>
+ <%foreach album.images image>
+ <option value="<% image.id|html>"<%if album.albumImage.id|match key=image.id> selected="selected"<%/if>><% image.title|html></option>
+ <%/foreach>
+ </select>
+ </div>
+ <%/if>
<div>
<label for="title"><%= Page.ImageBrowser.Album.Label.Title|l10n|html></label>
<input type="text" name="title" value="<%album.title|html>" />
<%/if>
</a>
</div>
- <% album.title|html>
+ <div class="show-data">
+ <div class="album-title"><% album.title|html></div>
+ <div class="album-description"><% album.description|html></div>
+ </div>
</div>
<%= false|store key=endRow>
<%if loop.count|mod divisor=3 offset=1><%= true|store key=endRow><%/if>
<div class="image-container">
<a href="imageBrowser.html?image=<%image.id|html>"><% image|image-link max-width=200 max-height=200 mode=enlarge title==image.title></a>
</div>
+ <div class="show-data">
+ <div class="image-title"><% image.title|html></div>
+ <div class="image-description"><% image.description|html></div>
+ </div>
<%if album.sone.local>
<form class="edit-image" action="editImage.html" method="post">
<input type="hidden" name="formPassword" value="<%formPassword|html>" />
<input type="hidden" name="returnPage" value="<%request.uri|html>" />
<input type="hidden" name="image" value="<%image.id|html>" />
- <div class="show-data">
- <div class="image-title"><% image.title|html></div>
- <div class="image-description"><% image.description|html></div>
- </div>
<div class="edit-data hidden">
<div>
<input type="text" name="title" value="<%image.title|html>" />
<textarea name="description"><%image.description|html></textarea>
</div>
<div>
+ <%notfirst><button type="submit" name="moveLeft" value="true"><%= Page.ImageBrowser.Image.Button.MoveLeft|l10n|html></button><%/notfirst>
<button type="submit"><%= Page.ImageBrowser.Image.Button.Save|l10n|html></button>
+ <%notlast><button type="submit" name="moveRight" value="true"><%= Page.ImageBrowser.Image.Button.MoveRight|l10n|html></button><%/notlast>
</div>
</div>
</form>
<% album.albumImage|image-link max-width=200 max-height=200 mode=enlarge title==album.title>
<%/if>
</a>
- <% album.title|html>
+ </div>
+ <div class="show-data">
+ <div class="album-title"><% album.title|html></div>
+ <div class="album-description"><% album.description|html></div>
</div>
</div>
<%= false|store key=endRow>