1 <%include include/head.html>
3 <div class="page-id hidden">image-browser</div>
5 <script language="javascript">
7 /* hide all those forms. */
8 function hideAndShowBlock(blockElement, clickToShowElement, clickToHideElement) {
9 $(blockElement).hide();
10 $(clickToShowElement).removeClass("hidden");
11 $(clickToShowElement).click(function() {
12 $(blockElement).slideDown();
13 $(clickToShowElement).addClass("hidden");
14 $(clickToHideElement).removeClass("hidden");
16 $(clickToHideElement).click(function() {
17 $(blockElement).slideUp();
18 $(clickToHideElement).addClass("hidden");
19 $(clickToShowElement).removeClass("hidden");
24 * Returns the image element with the given ID.
26 * @param imageId The ID of the image
27 * @return The image element
29 function getImage(imageId) {
30 return $("#sone .image-in-album .image-id:contains('" + imageId + "')").closest(".image-in-album");
36 * @param sourceId The ID of the source image
37 * @param destinationId The ID of the destionation image
39 function swapImage(sourceId, destinationId) {
40 sourceElement = getImage(sourceId);
41 destinationElement = getImage(destinationId);
42 sourceParent = sourceElement.closest(".image-row");
43 sourcePrevSibling = sourceElement.prev();
44 sourceElement.detach();
45 destinationElement.before(sourceElement);
46 if (sourcePrevSibling.get(0) != destinationElement.get(0)) {
47 destinationElement.detach();
48 (sourcePrevSibling.size() > 0) ? sourcePrevSibling.after(destinationElement) : sourceParent.prepend(destinationElement);
50 if ($("button[name='moveLeft']", sourceElement).hasClass("hidden") != $("button[name='moveLeft']", destinationElement).hasClass("hidden")) {
51 $("button[name='moveLeft']", sourceElement).toggleClass("hidden");
52 $("button[name='moveLeft']", destinationElement).toggleClass("hidden");
54 if ($("button[name='moveRight']", sourceElement).hasClass("hidden") != $("button[name='moveRight']", destinationElement).hasClass("hidden")) {
55 $("button[name='moveRight']", sourceElement).toggleClass("hidden");
56 $("button[name='moveRight']", destinationElement).toggleClass("hidden");
61 * Prepare all images for inline editing.
63 function prepareImages() {
64 $(".image").each(function() {
65 imageId = $(this).closest(".image-in-album").find(".image-id").text();
66 (function(element, imageId) {
67 $("button[name='moveLeft'], button[name='moveRight']", element).click(function() {
68 ajaxGet("editImage.ajax", { "formPassword": getFormPassword(), "image": imageId, "moveLeft": this.name == "moveLeft", "moveRight": this.name == "moveRight" }, function(data) {
69 if (data && data.success) {
70 swapImage(data.sourceImageId, data.destinationImageId);
80 * Returns the album element with the given ID.
82 * @param albumId The ID of the album
83 * @return The album element
85 function getAlbum(albumId) {
86 return $("#sone .album .album-id:contains('" + albumId + "')").closest(".album");
92 * @param sourceId The ID of the source album
93 * @param destinationId The ID of the destionation album
95 function swapAlbum(sourceId, destinationId) {
96 sourceElement = getAlbum(sourceId);
97 destinationElement = getAlbum(destinationId);
98 sourceParent = sourceElement.closest(".album-row");
99 sourcePrevSibling = sourceElement.prev();
100 sourceElement.detach();
101 destinationElement.before(sourceElement);
102 if (sourcePrevSibling.get(0) != destinationElement.get(0)) {
103 destinationElement.detach();
104 (sourcePrevSibling.size() > 0) ? sourcePrevSibling.after(destinationElement) : sourceParent.prepend(destinationElement);
106 if ($("button[name='moveLeft']", sourceElement).hasClass("hidden") != $("button[name='moveLeft']", destinationElement).hasClass("hidden")) {
107 $("button[name='moveLeft']", sourceElement).toggleClass("hidden");
108 $("button[name='moveLeft']", destinationElement).toggleClass("hidden");
110 if ($("button[name='moveRight']", sourceElement).hasClass("hidden") != $("button[name='moveRight']", destinationElement).hasClass("hidden")) {
111 $("button[name='moveRight']", sourceElement).toggleClass("hidden");
112 $("button[name='moveRight']", destinationElement).toggleClass("hidden");
117 * Prepare all albums for inline editing.
119 function prepareAlbums() {
120 $(".album").each(function() {
121 albumId = $(this).closest(".album").find(".album-id").text();
122 (function(element, albumId) {
123 $("button[name='moveLeft'], button[name='moveRight']", element).click(function() {
124 ajaxGet("editAlbum.ajax", { "formPassword": getFormPassword(), "album": albumId, "moveLeft": this.name == "moveLeft", "moveRight": this.name == "moveRight" }, function(data) {
125 if (data && data.success) {
126 swapAlbum(data.sourceAlbumId, data.destinationAlbumId);
141 <p><%= Page.ImageBrowser.Album.Error.NotFound.Text|l10n|html></p>
143 <%elseifnull album.title>
145 <p><%= Page.ImageBrowser.Album.Error.NotFound.Text|l10n|html></p>
149 <%if album.sone.local>
150 <script language="javascript">
153 getTranslation("WebInterface.DefaultText.UploadImage.Title", function(text) {
154 $("#upload-image :input[name='title']").each(function() {
155 registerInputTextareaSwap(this, text, "title", false, true);
158 getTranslation("WebInterface.DefaultText.UploadImage.Description", function(text) {
159 $("#upload-image :input[name='description']").each(function() {
160 registerInputTextareaSwap(this, text, "description", true, false);
163 $("#upload-image label").hide();
164 getTranslation("WebInterface.DefaultText.CreateAlbum.Name", function(text) {
165 $("#create-album input[name='name']").each(function() {
166 registerInputTextareaSwap(this, text, "name", false, true);
169 getTranslation("WebInterface.DefaultText.CreateAlbum.Description", function(text) {
170 $("#create-album input[name='description']").each(function() {
171 registerInputTextareaSwap(this, text, "description", true, true);
174 $("#create-album label").hide();
175 getTranslation("WebInterface.DefaultText.EditAlbum.Title", function(text) {
176 $("#edit-album input[name='title']").each(function() {
177 registerInputTextareaSwap(this, text, "title", false, true);
180 getTranslation("WebInterface.DefaultText.EditAlbum.Description", function(text) {
181 $("#edit-album :input[name='description']").each(function() {
182 registerInputTextareaSwap(this, text, "description", true, false);
185 $("#edit-album label").hide();
187 /* hide non-js image move buttons. */
188 $(".move-buttons").hide();
190 hideAndShowBlock("div.edit-album", ".show-edit-album", ".hide-edit-album");
191 hideAndShowBlock("div.create-album", ".show-create-album", ".hide-create-album");
192 hideAndShowBlock("div.upload-image", ".show-upload-image", ".hide-upload-image");
193 hideAndShowBlock("div.delete-album", ".show-delete-album", ".hide-delete-album");
201 <h1 class="backlink"><%= Page.ImageBrowser.Album.Title|l10n|replace needle=='{album}' replacement=album.title|html></h1>
203 <div class="backlinks">
204 <div class="backlink"><a href="imageBrowser.html?mode=gallery"><%= Page.ImageBrowser.Link.All|l10n|html></a></div>
205 <div class="separator">></div>
206 <%foreach album.backlinks backlink backlinks>
207 <div class="backlink">
208 <a href="<% backlink.target|html>"><% backlink.name|html></a>
210 <%if ! backlinks.last>
211 <div class="separator">></div>
216 <p id="description"><% album.description|parse sone=album.sone|render></p>
218 <%if album.sone.local>
219 <div class="show-edit-album hidden toggle-link"><a class="small-link">» <%= Page.ImageBrowser.Album.Edit.Title|l10n|html></a></div>
220 <div class="hide-edit-album hidden toggle-link"><a class="small-link">« <%= Page.ImageBrowser.Album.Edit.Title|l10n|html></a></div>
221 <div class="edit-album">
222 <h2><%= Page.ImageBrowser.Album.Edit.Title|l10n|html></h2>
224 <form id="edit-album" action="editAlbum.html" method="post">
225 <input type="hidden" name="formPassword" value="<%formPassword|html>" />
226 <input type="hidden" name="album" value="<%album.id|html>" />
228 <%if ! album.images.empty>
230 <label for="album-image"><%= Page.ImageBrowser.Album.Label.AlbumImage|l10n|html></label>
231 <select name="album-image">
232 <option disabled="disabled"><%= Page.ImageBrowser.Album.AlbumImage.Choose|l10n|html></option>
233 <%foreach album.images image>
234 <option value="<% image.id|html>"<%if album.albumImage.id|match value=image.id> selected="selected"<%/if>><% image.title|html></option>
240 <label for="title"><%= Page.ImageBrowser.Album.Label.Title|l10n|html></label>
241 <input type="text" name="title" value="<%album.title|html>" />
244 <label for="description"><%= Page.ImageBrowser.Album.Label.Description|l10n|html></label>
245 <textarea name="description"><%album.description|html></textarea>
247 <button type="submit"><%= Page.ImageBrowser.Album.Button.Save|l10n|html></button>
252 <%include include/browseAlbums.html albums=album.albums>
254 <%if album.sone.local>
255 <div class="show-create-album hidden toggle-link"><a class="small-link">» <%= View.CreateAlbum.Title|l10n|html></a></div>
256 <div class="hide-create-album hidden toggle-link"><a class="small-link">« <%= View.CreateAlbum.Title|l10n|html></a></div>
257 <div class="create-album">
258 <%include include/createAlbum.html>
262 <%foreach album.images image|paginate pageSize=core.preferences.imagesPerPage page=page>
264 <h2><%= Page.ImageBrowser.Header.Images|l10n|html></h2>
265 <%include include/pagination.html pageParameter=="page">
268 <%if loop.even><div class="image-row"><%/if>
269 <div id="image-<% image.id|html>" class="image-in-album">
270 <div class="image-id hidden"><% image.id|html></div>
271 <%include include/viewImage.html>
272 <%if album.sone.local>
273 <form class="edit-image" action="editImage.html" method="post">
274 <input type="hidden" name="formPassword" value="<%formPassword|html>" />
275 <input type="hidden" name="returnPage" value="<%request.uri|html>" />
276 <input type="hidden" name="image" value="<%image.id|html>" />
278 <div class="move-buttons">
279 <button <%if loop.first>class="hidden" <%/if>type="submit" name="moveLeft" value="true"><%= Page.ImageBrowser.Image.Button.MoveLeft|l10n|html></button>
280 <button <%if loop.last>class="hidden" <%/if>type="submit" name="moveRight" value="true"><%= Page.ImageBrowser.Image.Button.MoveRight|l10n|html></button>
283 <div class="edit-data hidden">
285 <input type="text" name="title" value="<%image.title|html>" />
288 <textarea name="description"><%image.description|html></textarea>
291 <button <%if loop.first>class="hidden" <%/if>type="submit" name="moveLeft" value="true"><%= Page.ImageBrowser.Image.Button.MoveLeft|l10n|html></button>
292 <button type="submit" name="submit"><%= Page.ImageBrowser.Image.Button.Save|l10n|html></button>
293 <button <%if loop.last>class="hidden" <%/if>type="submit" name="moveRight" value="true"><%= Page.ImageBrowser.Image.Button.MoveRight|l10n|html></button>
299 <%= false|store key==endRow>
300 <%if loop.odd><%= true|store key==endRow><%/if>
301 <%last><%= true|store key==endRow><%/last>
305 <%last></div><%include include/pagination.html pageParameter=="page"><%/last>
308 <%if album.sone.local>
309 <div class="clear show-upload-image hidden toggle-link"><a class="small-link">» <%= View.UploadImage.Title|l10n|html></a></div>
310 <div class="clear hide-upload-image hidden toggle-link"><a class="small-link">« <%= View.UploadImage.Title|l10n|html></a></div>
311 <div class="upload-image">
312 <%include include/uploadImage.html>
316 <div class="show-delete-album hidden toggle-link"><a class="small-link">» <%= Page.ImageBrowser.Album.Delete.Title|l10n|html></a></div>
317 <div class="hide-delete-album hidden toggle-link"><a class="small-link">« <%= Page.ImageBrowser.Album.Delete.Title|l10n|html></a></div>
318 <div class="delete-album">
319 <form id="delete-album" action="deleteAlbum.html" method="get">
320 <input type="hidden" name="album" value="<%album.id|html>" />
321 <button type="submit"><%= Page.ImageBrowser.Album.Button.Delete|l10n|html></button>
330 <%elseif imageRequested>
332 <h1 class="backlink"><%image.title|html></h1>
334 <div class="backlinks">
335 <div class="backlink"><a href="imageBrowser.html?mode=gallery"><%= Page.ImageBrowser.Link.All|l10n|html></a></div>
336 <div class="separator">></div>
337 <%foreach image.album.backlinks backlink backlinks>
338 <div class="backlink">
339 <a href="<% backlink.target|html>"><% backlink.name|html></a>
341 <%if ! backlinks.last>
342 <div class="separator">></div>
345 <%ifnull !image.previous><div class="backlink"><a href="imageBrowser.html?image=<%image.previous.id|html>">« <%image.previous.title|html></a></div><%/if>
346 <%ifnull !image.next><div class="backlink"><a href="imageBrowser.html?image=<%image.next.id|html>">» <%image.next.title|html></a></div><%/if>
353 <%if image.sone.local>
354 <script language="javascript">
356 getTranslation("WebInterface.DefaultText.EditImage.Title", function(text) {
357 $("#edit-image input[name='title']").each(function() {
358 registerInputTextareaSwap(this, text, "title", false, true);
361 getTranslation("WebInterface.DefaultText.EditImage.Description", function(text) {
362 $("#edit-image :input[name='description']").each(function() {
363 registerInputTextareaSwap(this, text, "description", true, false);
366 $("#edit-image label").hide();
368 hideAndShowBlock(".edit-image", ".show-edit-image", ".hide-edit-image");
369 hideAndShowBlock(".delete-image", ".show-delete-image", ".hide-delete-image");
374 <div class="single-image">
376 <a href="/<%image.key|html>"><% image|image-link max-width==640 max-height==480></a>
378 <a href="imageBrowser.html?image=<%image.id|html>"><% image|image-link max-width==640 max-height==480></a>
382 <p class="parsed"><%image.description|parse sone=image.sone|render></p>
384 <%if image.sone.local>
386 <div class="show-edit-image hidden toggle-link"><a class="small-link">» <%= Page.ImageBrowser.Image.Edit.Title|l10n|html></a></div>
387 <div class="hide-edit-image hidden toggle-link"><a class="small-link">« <%= Page.ImageBrowser.Image.Edit.Title|l10n|html></a></div>
388 <div class="edit-image">
389 <h2><%= Page.ImageBrowser.Image.Edit.Title|l10n|html></h2>
391 <form id="edit-image" action="editImage.html" method="post">
392 <input type="hidden" name="formPassword" value="<%formPassword|html>" />
393 <input type="hidden" name="returnPage" value="<%request.uri|html>" />
394 <input type="hidden" name="image" value="<%image.id|html>" />
397 <label for="title"><%= Page.ImageBrowser.Image.Title.Label|l10n|html></label>
398 <input type="text" name="title" value="<%image.title|html>" />
401 <label for="description"><%= Page.ImageBrowser.Image.Description.Label|l10n|html></label>
402 <textarea name="description"><%image.description|html></textarea>
405 <button type="submit"><%= Page.ImageBrowser.Image.Button.Save|l10n|html></button>
410 <div class="show-delete-image hidden toggle-link"><a class="small-link">» <%= Page.ImageBrowser.Image.Delete.Title|l10n|html></a></div>
411 <div class="hide-delete-image hidden toggle-link"><a class="small-link">« <%= Page.ImageBrowser.Image.Delete.Title|l10n|html></a></div>
412 <div class="delete-image">
413 <h2><%= Page.ImageBrowser.Image.Delete.Title|l10n|html></h2>
415 <form id="delete-image" action="deleteImage.html" method="get">
416 <input type="hidden" name="image" value="<%image.id|html>" />
417 <button type="submit"><%= Page.ImageBrowser.Image.Button.Delete|l10n|html></button>
425 <%elseif soneRequested>
428 <script language="javascript">
430 getTranslation("WebInterface.DefaultText.CreateAlbum.Name", function(text) {
431 $("#create-album input[name='name']").each(function() {
432 registerInputTextareaSwap(this, text, "name", false, true);
435 getTranslation("WebInterface.DefaultText.CreateAlbum.Description", function(text) {
436 $("#create-album input[name='description']").each(function() {
437 registerInputTextareaSwap(this, text, "description", true, true);
440 $("#create-album label").hide();
442 hideAndShowBlock(".create-album", ".show-create-album", ".hide-create-album");
451 <p><%= Page.ImageBrowser.Sone.Error.NotFound.Text|l10n|html></p>
455 <h1><%= Page.ImageBrowser.Sone.Title|l10n|replace needle=='{sone}' replacement=sone.niceName|html></h1>
457 <div class="backlinks">
458 <div class="backlink"><a href="imageBrowser.html?mode=gallery"><%= Page.ImageBrowser.Link.All|l10n|html></a></div>
459 <div class="separator">></div>
460 <div class="backlink"><a href="imageBrowser.html?sone=<%sone.id|html>"><%sone.niceName|html></a></div>
463 <%include include/browseAlbums.html albums=sone.rootAlbum.albums>
466 <div class="show-create-album hidden toggle-link"><a class="small-link">» <%= View.CreateAlbum.Title|l10n|html></a></div>
467 <div class="hide-create-album hidden toggle-link"><a class="small-link">« <%= View.CreateAlbum.Title|l10n|html></a></div>
468 <div class="create-album">
469 <%include include/createAlbum.html>
475 <%elseif galleryRequested>
477 <%foreach albums album|paginate pageSize=core.preferences.imagesPerPage pageParameter=request.page pagination=albumPagination>
479 <h2><%= Page.ImageBrowser.Header.Albums|l10n|html></h2>
480 <%include include/pagination.html pagination=albumPagination pageParameter=="page">
483 <%if loop.even><div class="album-row"><%/if>
484 <div id="album-<% album.id|html>" class="album">
485 <div class="album-id hidden"><% album.id|html></div>
486 <%include include/viewAlbum.html>
488 <%= false|store key==endRow>
489 <%if loop.odd><%= true|store key==endRow><%/if>
490 <%last><%= true|store key==endRow><%/last>
491 <%if endRow></div><%/if>
494 <%include include/pagination.html pagination=albumPagination pageParameter=="page">
500 <%include include/tail.html>