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-in-album").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 hideAndShowBlock("div.edit-album", ".show-edit-album", ".hide-edit-album");
188 hideAndShowBlock("div.create-album", ".show-create-album", ".hide-create-album");
189 hideAndShowBlock("div.upload-image", ".show-upload-image", ".hide-upload-image");
190 hideAndShowBlock("div.delete-album", ".show-delete-album", ".hide-delete-album");
198 <h1 class="backlink"><%= Page.ImageBrowser.Album.Title|l10n|replace needle=='{album}' replacement=album.title|html></h1>
200 <div class="backlinks">
201 <div class="backlink"><a href="imageBrowser.html?mode=gallery"><%= Page.ImageBrowser.Link.All|l10n|html></a></div>
202 <div class="separator">></div>
203 <%foreach album.backlinks backlink backlinks>
204 <div class="backlink">
205 <a href="<% backlink.target|html>"><% backlink.name|html></a>
207 <%if ! backlinks.last>
208 <div class="separator">></div>
213 <p id="description"><% album.description|parse sone=album.sone|render></p>
215 <%if album.sone.local>
216 <div class="show-edit-album hidden toggle-link"><a class="small-link">» <%= Page.ImageBrowser.Album.Edit.Title|l10n|html></a></div>
217 <div class="hide-edit-album hidden toggle-link"><a class="small-link">« <%= Page.ImageBrowser.Album.Edit.Title|l10n|html></a></div>
218 <div class="edit-album">
219 <h2><%= Page.ImageBrowser.Album.Edit.Title|l10n|html></h2>
221 <form id="edit-album" action="editAlbum.html" method="post">
222 <input type="hidden" name="formPassword" value="<%formPassword|html>" />
223 <input type="hidden" name="album" value="<%album.id|html>" />
225 <%if ! album.images.empty>
227 <label for="album-image"><%= Page.ImageBrowser.Album.Label.AlbumImage|l10n|html></label>
228 <select name="album-image">
229 <option disabled="disabled"><%= Page.ImageBrowser.Album.AlbumImage.Choose|l10n|html></option>
230 <%foreach album.images image>
231 <option value="<% image.id|html>"<%if album.albumImage.id|match value=image.id> selected="selected"<%/if>><% image.title|html></option>
237 <label for="title"><%= Page.ImageBrowser.Album.Label.Title|l10n|html></label>
238 <input type="text" name="title" value="<%album.title|html>" />
241 <label for="description"><%= Page.ImageBrowser.Album.Label.Description|l10n|html></label>
242 <textarea name="description"><%album.description|html></textarea>
244 <button type="submit"><%= Page.ImageBrowser.Album.Button.Save|l10n|html></button>
249 <%include include/browseAlbums.html albums=album.albums>
251 <%if album.sone.local>
252 <div class="show-create-album hidden toggle-link"><a class="small-link">» <%= View.CreateAlbum.Title|l10n|html></a></div>
253 <div class="hide-create-album hidden toggle-link"><a class="small-link">« <%= View.CreateAlbum.Title|l10n|html></a></div>
254 <div class="create-album">
255 <%include include/createAlbum.html>
259 <%foreach album.images image|paginate pageSize=core.preferences.imagesPerPage page=page>
261 <h2><%= Page.ImageBrowser.Header.Images|l10n|html></h2>
262 <%include include/pagination.html pageParameter=="page">
265 <%if loop.even><div class="image-row"><%/if>
266 <div id="image-<% image.id|html>" class="image-in-album">
267 <div class="image-id hidden"><% image.id|html></div>
268 <%include include/viewImage.html>
270 <%= false|store key==endRow>
271 <%if loop.odd><%= true|store key==endRow><%/if>
272 <%last><%= true|store key==endRow><%/last>
276 <%last></div><%include include/pagination.html pageParameter=="page"><%/last>
279 <%if album.sone.local>
280 <div class="clear show-upload-image hidden toggle-link"><a class="small-link">» <%= View.UploadImage.Title|l10n|html></a></div>
281 <div class="clear hide-upload-image hidden toggle-link"><a class="small-link">« <%= View.UploadImage.Title|l10n|html></a></div>
282 <div class="upload-image">
283 <%include include/uploadImage.html>
287 <div class="show-delete-album hidden toggle-link"><a class="small-link">» <%= Page.ImageBrowser.Album.Delete.Title|l10n|html></a></div>
288 <div class="hide-delete-album hidden toggle-link"><a class="small-link">« <%= Page.ImageBrowser.Album.Delete.Title|l10n|html></a></div>
289 <div class="delete-album">
290 <form id="delete-album" action="deleteAlbum.html" method="get">
291 <input type="hidden" name="album" value="<%album.id|html>" />
292 <button type="submit"><%= Page.ImageBrowser.Album.Button.Delete|l10n|html></button>
301 <%elseif imageRequested>
303 <h1 class="backlink"><%image.title|html></h1>
305 <div class="backlinks">
306 <div class="backlink"><a href="imageBrowser.html?mode=gallery"><%= Page.ImageBrowser.Link.All|l10n|html></a></div>
307 <div class="separator">></div>
308 <%foreach image.album.backlinks backlink backlinks>
309 <div class="backlink">
310 <a href="<% backlink.target|html>"><% backlink.name|html></a>
312 <%if ! backlinks.last>
313 <div class="separator">></div>
316 <%ifnull !image.previous><div class="backlink"><a href="imageBrowser.html?image=<%image.previous.id|html>">« <%image.previous.title|html></a></div><%/if>
317 <%ifnull !image.next><div class="backlink"><a href="imageBrowser.html?image=<%image.next.id|html>">» <%image.next.title|html></a></div><%/if>
324 <%if image.sone.local>
325 <script language="javascript">
327 getTranslation("WebInterface.DefaultText.EditImage.Title", function(text) {
328 $("#edit-image input[name='title']").each(function() {
329 registerInputTextareaSwap(this, text, "title", false, true);
332 getTranslation("WebInterface.DefaultText.EditImage.Description", function(text) {
333 $("#edit-image :input[name='description']").each(function() {
334 registerInputTextareaSwap(this, text, "description", true, false);
337 $("#edit-image label").hide();
339 hideAndShowBlock(".edit-image", ".show-edit-image", ".hide-edit-image");
340 hideAndShowBlock(".delete-image", ".show-delete-image", ".hide-delete-image");
345 <div class="single-image">
347 <a href="/<%image.key|html>"><% image|image-link max-width==640 max-height==480></a>
349 <a href="imageBrowser.html?image=<%image.id|html>"><% image|image-link max-width==640 max-height==480></a>
353 <p class="parsed"><%image.description|parse sone=image.sone|render></p>
355 <%if image.sone.local>
357 <div class="show-edit-image hidden toggle-link"><a class="small-link">» <%= Page.ImageBrowser.Image.Edit.Title|l10n|html></a></div>
358 <div class="hide-edit-image hidden toggle-link"><a class="small-link">« <%= Page.ImageBrowser.Image.Edit.Title|l10n|html></a></div>
359 <div class="edit-image">
360 <h2><%= Page.ImageBrowser.Image.Edit.Title|l10n|html></h2>
362 <form id="edit-image" action="editImage.html" method="post">
363 <input type="hidden" name="formPassword" value="<%formPassword|html>" />
364 <input type="hidden" name="returnPage" value="<%request.uri|html>" />
365 <input type="hidden" name="image" value="<%image.id|html>" />
368 <label for="title"><%= Page.ImageBrowser.Image.Title.Label|l10n|html></label>
369 <input type="text" name="title" value="<%image.title|html>" />
372 <label for="description"><%= Page.ImageBrowser.Image.Description.Label|l10n|html></label>
373 <textarea name="description"><%image.description|html></textarea>
376 <button type="submit"><%= Page.ImageBrowser.Image.Button.Save|l10n|html></button>
381 <div class="show-delete-image hidden toggle-link"><a class="small-link">» <%= Page.ImageBrowser.Image.Delete.Title|l10n|html></a></div>
382 <div class="hide-delete-image hidden toggle-link"><a class="small-link">« <%= Page.ImageBrowser.Image.Delete.Title|l10n|html></a></div>
383 <div class="delete-image">
384 <h2><%= Page.ImageBrowser.Image.Delete.Title|l10n|html></h2>
386 <form id="delete-image" action="deleteImage.html" method="get">
387 <input type="hidden" name="image" value="<%image.id|html>" />
388 <button type="submit"><%= Page.ImageBrowser.Image.Button.Delete|l10n|html></button>
396 <%elseif soneRequested>
399 <script language="javascript">
401 getTranslation("WebInterface.DefaultText.CreateAlbum.Name", function(text) {
402 $("#create-album input[name='name']").each(function() {
403 registerInputTextareaSwap(this, text, "name", false, true);
406 getTranslation("WebInterface.DefaultText.CreateAlbum.Description", function(text) {
407 $("#create-album input[name='description']").each(function() {
408 registerInputTextareaSwap(this, text, "description", true, true);
411 $("#create-album label").hide();
413 hideAndShowBlock(".create-album", ".show-create-album", ".hide-create-album");
422 <p><%= Page.ImageBrowser.Sone.Error.NotFound.Text|l10n|html></p>
426 <h1><%= Page.ImageBrowser.Sone.Title|l10n|replace needle=='{sone}' replacement=sone.niceName|html></h1>
428 <div class="backlinks">
429 <div class="backlink"><a href="imageBrowser.html?mode=gallery"><%= Page.ImageBrowser.Link.All|l10n|html></a></div>
430 <div class="separator">></div>
431 <div class="backlink"><a href="imageBrowser.html?sone=<%sone.id|html>"><%sone.niceName|html></a></div>
434 <%include include/browseAlbums.html albums=sone.rootAlbum.albums>
437 <div class="show-create-album hidden toggle-link"><a class="small-link">» <%= View.CreateAlbum.Title|l10n|html></a></div>
438 <div class="hide-create-album hidden toggle-link"><a class="small-link">« <%= View.CreateAlbum.Title|l10n|html></a></div>
439 <div class="create-album">
440 <%include include/createAlbum.html>
446 <%elseif galleryRequested>
448 <%foreach albums album|paginate pageSize=core.preferences.imagesPerPage pageParameter=request.page pagination=albumPagination>
450 <h2><%= Page.ImageBrowser.Header.Albums|l10n|html></h2>
451 <%include include/pagination.html pagination=albumPagination pageParameter=="page">
454 <%if loop.even><div class="album-row"><%/if>
455 <div id="album-<% album.id|html>" class="album">
456 <div class="album-id hidden"><% album.id|html></div>
457 <%include include/viewAlbum.html>
459 <%= false|store key==endRow>
460 <%if loop.odd><%= true|store key==endRow><%/if>
461 <%last><%= true|store key==endRow><%/last>
462 <%if endRow></div><%/if>
465 <%include include/pagination.html pagination=albumPagination pageParameter=="page">
471 <%include include/tail.html>