+ <%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() {
+ registerInputTextareaSwap(this, text, "title", false, true);
+ });
+ });
+ getTranslation("WebInterface.DefaultText.UploadImage.Description", function(text) {
+ $("#upload-image :input[name='description']").each(function() {
+ registerInputTextareaSwap(this, text, "description", true, false);
+ });
+ });
+ $("#upload-image label").hide();
+ getTranslation("WebInterface.DefaultText.CreateAlbum.Name", function(text) {
+ $("#create-album input[name='name']").each(function() {
+ registerInputTextareaSwap(this, text, "name", false, true);
+ });
+ });
+ getTranslation("WebInterface.DefaultText.CreateAlbum.Description", function(text) {
+ $("#create-album input[name='description']").each(function() {
+ registerInputTextareaSwap(this, text, "description", true, true);
+ });
+ });
+ $("#create-album label").hide();
+ getTranslation("WebInterface.DefaultText.EditAlbum.Title", function(text) {
+ $("#edit-album input[name='title']").each(function() {
+ registerInputTextareaSwap(this, text, "title", false, true);
+ });
+ });
+ getTranslation("WebInterface.DefaultText.EditAlbum.Description", function(text) {
+ $("#edit-album :input[name='description']").each(function() {
+ registerInputTextareaSwap(this, text, "description", true, false);
+ });
+ });
+ $("#edit-album label").hide();
+
+ hideAndShowBlock(".edit-album", ".show-edit-album", ".hide-edit-album");
+ hideAndShowBlock(".create-album", ".show-create-album", ".hide-create-album");
+ hideAndShowBlock(".upload-image", ".show-upload-image", ".hide-upload-image");
+ hideAndShowBlock(".delete-album", ".show-delete-album", ".hide-delete-album");
+
+ $(".image").each(function() {
+ imageId = $(this).closest(".image").find(".image-id").text();
+ (function(element, imageId) {
+ $(".show-data", element).click(function() {
+ editImage(imageId);
+ });
+ })(this, imageId);
+ });
+ });
+ });
+ </script>
+ <%/if>
+
+ <h1 class="backlink"><%= Page.ImageBrowser.Album.Title|l10n|replace needle='{album}' replacementKey=album.title|html></h1>