Add links to previous and next images to backlinks.
[Sone.git] / src / main / resources / templates / imageBrowser.html
1 <%include include/head.html>
2
3         <div class="page-id hidden">image-browser</div>
4
5         <script language="javascript">
6
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");
15                         });
16                         $(clickToHideElement).click(function() {
17                                 $(blockElement).slideUp();
18                                 $(clickToHideElement).addClass("hidden");
19                                 $(clickToShowElement).removeClass("hidden");
20                         });
21                 }
22
23                 /* ID of the image currently being edited. */
24                 var editingImageId = null;
25
26                 /**
27                  * Shows the form for editing an image.
28                  *
29                  * @param imageId The ID of the image to edit.
30                  */
31                 function editImage(imageId) {
32                         if (editingImageId != imageId) {
33                                 cancelImageEditing();
34                         } else {
35                                 return;
36                         }
37                         editingImageId = imageId;
38                         $(".show-data", getImage(imageId)).hide();
39                         $(".edit-data", getImage(imageId)).show();
40                         $(document).bind("click.sone", function(event) {
41                                 if ($(event.target).closest("#image-" + imageId).size() == 0) {
42                                         cancelImageEditing();
43                                 }
44                         });
45                 }
46
47                 /**
48                  * Cancels all image editing.
49                  */
50                 function cancelImageEditing() {
51                         $(".image .show-data").show();
52                         $(".image .edit-data").hide();
53                         $("form.edit-image").each(function() {
54                                 this.reset();
55                         });
56                         $(document).unbind("click.sone");
57                         editingImageId = null;
58                 }
59
60                 /**
61                  * Returns the image element with the given ID.
62                  *
63                  * @param imageId The ID of the image
64                  * @return The image element
65                  */
66                 function getImage(imageId) {
67                         return $("#sone .image .image-id:contains('" + imageId + "')").closest(".image");
68                 }
69
70                 /**
71                  * Swaps two images.
72                  *
73                  * @param sourceId The ID of the source image
74                  * @param destinationId The ID of the destionation image
75                  */
76                 function swapImage(sourceId, destinationId) {
77                         sourceElement = getImage(sourceId);
78                         destinationElement = getImage(destinationId);
79                         sourceParent = sourceElement.closest(".image-row");
80                         sourcePrevSibling = sourceElement.prev();
81                         sourceElement.detach();
82                         destinationElement.before(sourceElement);
83                         if (sourcePrevSibling.get(0) != destinationElement.get(0)) {
84                                 destinationElement.detach();
85                                 (sourcePrevSibling.size() > 0) ? sourcePrevSibling.after(destinationElement) : sourceParent.prepend(destinationElement);
86                         }
87                         if ($("button[name='moveLeft']", sourceElement).hasClass("hidden") != $("button[name='moveLeft']", destinationElement).hasClass("hidden")) {
88                                 $("button[name='moveLeft']", sourceElement).toggleClass("hidden");
89                                 $("button[name='moveLeft']", destinationElement).toggleClass("hidden");
90                         }
91                         if ($("button[name='moveRight']", sourceElement).hasClass("hidden") != $("button[name='moveRight']", destinationElement).hasClass("hidden")) {
92                                 $("button[name='moveRight']", sourceElement).toggleClass("hidden");
93                                 $("button[name='moveRight']", destinationElement).toggleClass("hidden");
94                         }
95                 }
96
97                 /**
98                  * Prepare all images for inline editing.
99                  */
100                 function prepareImages() {
101                         $(".image").each(function() {
102                                 imageId = $(this).closest(".image").find(".image-id").text();
103                                 (function(element, imageId) {
104                                         $(".show-data", element).click(function() {
105                                                 editImage(imageId);
106                                         });
107                                         $("button[name='moveLeft'], button[name='moveRight']", element).click(function() {
108                                                 ajaxGet("editImage.ajax", { "formPassword": getFormPassword(), "image": imageId, "moveLeft": this.name == "moveLeft", "moveRight": this.name == "moveRight" }, function(data) {
109                                                         if (data && data.success) {
110                                                                 swapImage(data.sourceImageId, data.destinationImageId);
111                                                         }
112                                                 });
113                                                 return false;
114                                         });
115                                         $("button[name='submit']", element).click(function() {
116                                                 title = $(":input[name='title']:enabled", this.form).val();
117                                                 description = $(":input[name='description']:enabled", this.form).val();
118                                                 ajaxGet("editImage.ajax", { "formPassword": getFormPassword(), "image": imageId, "title": title, "description": description }, function(data) {
119                                                         if (data && data.success) {
120                                                                 getImage(data.imageId).find(".image-title").text(data.title);
121                                                                 getImage(data.imageId).find(".image-description").html(data.parsedDescription);
122                                                                 getImage(data.imageId).find(":input[name='title']").attr("defaultValue", title);
123                                                                 getImage(data.imageId).find(":input[name='description']").attr("defaultValue", data.description);
124                                                                 cancelImageEditing();
125                                                         }
126                                                 });
127                                                 return false;
128                                         });
129                                 })(this, imageId);
130                         });
131                 }
132
133                 /* ID of the album currently being edited. */
134                 var editingAlbumId = null;
135
136                 /**
137                  * Shows the form for editing an album.
138                  *
139                  * @param albumId The ID of the album to edit.
140                  */
141                 function editAlbum(albumId) {
142                         if (editingAlbumId != albumId) {
143                                 if (editingAlbumId != null) {
144                                         cancelAlbumEditing();
145                                 }
146                         } else {
147                                 console.log("already editing " + albumId);
148                                 return;
149                         }
150                         editingAlbumId = albumId;
151                         $(".show-data", getAlbum(albumId)).hide();
152                         $(".edit-data", getAlbum(albumId)).show();
153                         console.log(getAlbum(albumId));
154                         $(document).bind("click.sone", function(event) {
155                                 if ($(event.target).closest("#album-" + albumId).size() == 0) {
156                                         cancelAlbumEditing();
157                                 }
158                         });
159                 }
160
161                 /**
162                  * Cancels all album editing.
163                  */
164                 function cancelAlbumEditing() {
165                         console.log("cancel-album-edit");
166                         $(".album .show-data").show();
167                         $(".album .edit-data").hide();
168                         $("form.edit-album").each(function() {
169                                 this.reset();
170                         });
171                         $(document).unbind("click.sone");
172                         editingAlbumId = null;
173                 }
174
175                 /**
176                  * Returns the album element with the given ID.
177                  *
178                  * @param albumId The ID of the album
179                  * @return The album element
180                  */
181                 function getAlbum(albumId) {
182                         return $("#sone .album .album-id:contains('" + albumId + "')").closest(".album");
183                 }
184
185                 /**
186                  * Swaps two albums.
187                  *
188                  * @param sourceId The ID of the source album
189                  * @param destinationId The ID of the destionation album
190                  */
191                 function swapAlbum(sourceId, destinationId) {
192                         sourceElement = getAlbum(sourceId);
193                         destinationElement = getAlbum(destinationId);
194                         sourceParent = sourceElement.closest(".album-row");
195                         sourcePrevSibling = sourceElement.prev();
196                         sourceElement.detach();
197                         destinationElement.before(sourceElement);
198                         if (sourcePrevSibling.get(0) != destinationElement.get(0)) {
199                                 destinationElement.detach();
200                                 (sourcePrevSibling.size() > 0) ? sourcePrevSibling.after(destinationElement) : sourceParent.prepend(destinationElement);
201                         }
202                         if ($("button[name='moveLeft']", sourceElement).hasClass("hidden") != $("button[name='moveLeft']", destinationElement).hasClass("hidden")) {
203                                 $("button[name='moveLeft']", sourceElement).toggleClass("hidden");
204                                 $("button[name='moveLeft']", destinationElement).toggleClass("hidden");
205                         }
206                         if ($("button[name='moveRight']", sourceElement).hasClass("hidden") != $("button[name='moveRight']", destinationElement).hasClass("hidden")) {
207                                 $("button[name='moveRight']", sourceElement).toggleClass("hidden");
208                                 $("button[name='moveRight']", destinationElement).toggleClass("hidden");
209                         }
210                 }
211
212                 /**
213                  * Prepare all albums for inline editing.
214                  */
215                 function prepareAlbums() {
216                         $(".album").each(function() {
217                                 albumId = $(this).closest(".album").find(".album-id").text();
218                                 (function(element, albumId) {
219                                         $(".show-data", element).click(function() {
220                                                 console.log("show-data");
221                                                 editAlbum(albumId);
222                                         });
223                                         $("button[name='moveLeft'], button[name='moveRight']", element).click(function() {
224                                                 ajaxGet("editAlbum.ajax", { "formPassword": getFormPassword(), "album": albumId, "moveLeft": this.name == "moveLeft", "moveRight": this.name == "moveRight" }, function(data) {
225                                                         if (data && data.success) {
226                                                                 swapAlbum(data.sourceAlbumId, data.destinationAlbumId);
227                                                         }
228                                                 });
229                                                 return false;
230                                         });
231                                         $("button[name='submit']", element).click(function() {
232                                                 title = $(":input[name='title']:enabled", this.form).val();
233                                                 description = $(":input[name='description']:enabled", this.form).val();
234                                                 ajaxGet("editAlbum.ajax", { "formPassword": getFormPassword(), "album": albumId, "title": title, "description": description }, function(data) {
235                                                         if (data && data.success) {
236                                                                 getAlbum(data.albumId).find(".album-title").text(data.title);
237                                                                 getAlbum(data.albumId).find(".album-description").text(data.description);
238                                                                 getAlbum(data.albumId).find(":input[name='title']").attr("defaultValue", title);
239                                                                 getAlbum(data.albumId).find(":input[name='description']").attr("defaultValue", description);
240                                                                 cancelAlbumEditing();
241                                                         }
242                                                 });
243                                                 return false;
244                                         });
245                                 })(this, albumId);
246                         });
247                 }
248
249         </script>
250
251         <%if albumRequested>
252
253                 <%ifnull album>
254
255                         <p><%= Page.ImageBrowser.Album.Error.NotFound.Text|l10n|html></p>
256
257                 <%elseifnull album.title>
258
259                         <p><%= Page.ImageBrowser.Album.Error.NotFound.Text|l10n|html></p>
260
261                 <%else>
262
263                         <%if album.sone.local>
264                                 <script language="javascript">
265
266                                         $(function() {
267                                                 getTranslation("WebInterface.DefaultText.UploadImage.Title", function(text) {
268                                                         $("#upload-image :input[name='title']").each(function() {
269                                                                 registerInputTextareaSwap(this, text, "title", false, true);
270                                                         });
271                                                 });
272                                                 getTranslation("WebInterface.DefaultText.UploadImage.Description", function(text) {
273                                                         $("#upload-image :input[name='description']").each(function() {
274                                                                 registerInputTextareaSwap(this, text, "description", true, false);
275                                                         });
276                                                 });
277                                                 $("#upload-image label").hide();
278                                                 getTranslation("WebInterface.DefaultText.CreateAlbum.Name", function(text) {
279                                                         $("#create-album input[name='name']").each(function() {
280                                                                 registerInputTextareaSwap(this, text, "name", false, true);
281                                                         });
282                                                 });
283                                                 getTranslation("WebInterface.DefaultText.CreateAlbum.Description", function(text) {
284                                                         $("#create-album input[name='description']").each(function() {
285                                                                 registerInputTextareaSwap(this, text, "description", true, true);
286                                                         });
287                                                 });
288                                                 $("#create-album label").hide();
289                                                 getTranslation("WebInterface.DefaultText.EditAlbum.Title", function(text) {
290                                                         $("#edit-album input[name='title']").each(function() {
291                                                                 registerInputTextareaSwap(this, text, "title", false, true);
292                                                         });
293                                                 });
294                                                 getTranslation("WebInterface.DefaultText.EditAlbum.Description", function(text) {
295                                                         $("#edit-album :input[name='description']").each(function() {
296                                                                 registerInputTextareaSwap(this, text, "description", true, false);
297                                                         });
298                                                 });
299                                                 $("#edit-album label").hide();
300
301                                                 /* hide non-js image move buttons. */
302                                                 $(".move-buttons").hide();
303
304                                                 hideAndShowBlock("div.edit-album", ".show-edit-album", ".hide-edit-album");
305                                                 hideAndShowBlock("div.create-album", ".show-create-album", ".hide-create-album");
306                                                 hideAndShowBlock("div.upload-image", ".show-upload-image", ".hide-upload-image");
307                                                 hideAndShowBlock("div.delete-album", ".show-delete-album", ".hide-delete-album");
308
309                                                 prepareAlbums();
310                                                 prepareImages();
311                                         });
312                                 </script>
313                         <%/if>
314
315                         <h1 class="backlink"><%= Page.ImageBrowser.Album.Title|l10n|replace needle='{album}' replacementKey=album.title|html></h1>
316
317                         <div class="backlinks">
318                                 <%foreach album.backlinks backlink backlinks>
319                                         <div class="backlink">
320                                                 <a href="<% backlink.target|html>"><% backlink.name|html></a>
321                                         </div>
322                                         <%if ! backlinks.last>
323                                                 <div class="separator">&gt;</div>
324                                         <%/if>
325                                 <%/foreach>
326                         </div>
327
328                         <p id="description"><% album.description|parse sone=album.sone></p>
329
330                         <%if album.sone.local>
331                                 <div class="show-edit-album hidden toggle-link"><a class="small-link">» <%= Page.ImageBrowser.Album.Edit.Title|l10n|html></a></div>
332                                 <div class="hide-edit-album hidden toggle-link"><a class="small-link">« <%= Page.ImageBrowser.Album.Edit.Title|l10n|html></a></div>
333                                 <div class="edit-album">
334                                         <h2><%= Page.ImageBrowser.Album.Edit.Title|l10n|html></h2>
335
336                                         <form id="edit-album" action="editAlbum.html" method="post">
337                                                 <input type="hidden" name="formPassword" value="<%formPassword|html>" />
338                                                 <input type="hidden" name="album" value="<%album.id|html>" />
339
340                                                 <%if ! album.images.empty>
341                                                         <div>
342                                                                 <label for="album-image"><%= Page.ImageBrowser.Album.Label.AlbumImage|l10n|html></label>
343                                                                 <select name="album-image">
344                                                                         <option disabled="disabled"><%= Page.ImageBrowser.Album.AlbumImage.Choose|l10n|html></option>
345                                                                         <%foreach album.images image>
346                                                                                 <option value="<% image.id|html>"<%if album.albumImage.id|match key=image.id> selected="selected"<%/if>><% image.title|html></option>
347                                                                         <%/foreach>
348                                                                 </select>
349                                                         </div>
350                                                 <%/if>
351                                                 <div>
352                                                         <label for="title"><%= Page.ImageBrowser.Album.Label.Title|l10n|html></label>
353                                                         <input type="text" name="title" value="<%album.title|html>" />
354                                                 </div>
355                                                 <div>
356                                                         <label for="description"><%= Page.ImageBrowser.Album.Label.Description|l10n|html></label>
357                                                         <textarea name="description"><%album.description|html></textarea>
358                                                 </div>
359                                                 <button type="submit"><%= Page.ImageBrowser.Album.Button.Save|l10n|html></button>
360                                         </form>
361                                 </div>
362                         <%/if>
363
364                         <%include include/browseAlbums.html albums=album.albums>
365
366                         <%if album.sone.local>
367                                 <div class="show-create-album hidden toggle-link"><a class="small-link">» <%= View.CreateAlbum.Title|l10n|html></a></div>
368                                 <div class="hide-create-album hidden toggle-link"><a class="small-link">« <%= View.CreateAlbum.Title|l10n|html></a></div>
369                                 <div class="create-album">
370                                         <%include include/createAlbum.html>
371                                 </div>
372                         <%/if>
373
374                         <%foreach album.images image>
375                                 <%first><h2><%= Page.ImageBrowser.Header.Images|l10n|html></h2><%/first>
376                                 <%if loop.count|mod divisor=3><div class="image-row"><%/if>
377                                 <div id="image-<% image.id|html>" class="image">
378                                         <div class="image-id hidden"><% image.id|html></div>
379                                         <div class="image-container">
380                                                 <a href="imageBrowser.html?image=<%image.id|html>"><% image|image-link max-width=250 max-height=250 mode=enlarge title==image.title></a>
381                                         </div>
382                                         <div class="show-data">
383                                                 <div class="image-title"><% image.title|html></div>
384                                                 <div class="image-description"><% image.description|parse sone=image.sone></div>
385                                         </div>
386                                         <%if album.sone.local>
387                                                 <form class="edit-image" action="editImage.html" method="post">
388                                                         <input type="hidden" name="formPassword" value="<%formPassword|html>" />
389                                                         <input type="hidden" name="returnPage" value="<%request.uri|html>" />
390                                                         <input type="hidden" name="image" value="<%image.id|html>" />
391
392                                                         <div class="move-buttons">
393                                                                         <button <%first>class="hidden" <%/first>type="submit" name="moveLeft" value="true"><%= Page.ImageBrowser.Image.Button.MoveLeft|l10n|html></button>
394                                                                         <button <%last>class="hidden" <%/last>type="submit" name="moveRight" value="true"><%= Page.ImageBrowser.Image.Button.MoveRight|l10n|html></button>
395                                                         </div>
396
397                                                         <div class="edit-data hidden">
398                                                                 <div>
399                                                                         <input type="text" name="title" value="<%image.title|html>" />
400                                                                 </div>
401                                                                 <div>
402                                                                         <textarea name="description"><%image.description|html></textarea>
403                                                                 </div>
404                                                                 <div>
405                                                                         <button <%first>class="hidden" <%/first>type="submit" name="moveLeft" value="true"><%= Page.ImageBrowser.Image.Button.MoveLeft|l10n|html></button>
406                                                                         <button type="submit" name="submit"><%= Page.ImageBrowser.Image.Button.Save|l10n|html></button>
407                                                                         <button <%last>class="hidden" <%/last>type="submit" name="moveRight" value="true"><%= Page.ImageBrowser.Image.Button.MoveRight|l10n|html></button>
408                                                                 </div>
409                                                         </div>
410                                                 </form>
411                                         <%/if>
412                                 </div>
413                                 <%= false|store key=endRow>
414                                 <%if loop.count|mod divisor=3 offset=1><%= true|store key=endRow><%/if>
415                                 <%last><%= true|store key=endRow><%/last>
416                                 <%if endRow></div><%/if>
417                         <%/foreach>
418
419                         <%if album.sone.local>
420                                 <div class="show-upload-image hidden toggle-link"><a class="small-link">» <%= View.UploadImage.Title|l10n|html></a></div>
421                                 <div class="hide-upload-image hidden toggle-link"><a class="small-link">« <%= View.UploadImage.Title|l10n|html></a></div>
422                                 <div class="upload-image">
423                                         <%include include/uploadImage.html>
424                                 </div>
425
426                                 <%if album.empty>
427                                         <div class="show-delete-album hidden toggle-link"><a class="small-link">» <%= Page.ImageBrowser.Album.Delete.Title|l10n|html></a></div>
428                                         <div class="hide-delete-album hidden toggle-link"><a class="small-link">« <%= Page.ImageBrowser.Album.Delete.Title|l10n|html></a></div>
429                                         <div class="delete-album">
430                                                 <form id="delete-album" action="deleteAlbum.html" method="get">
431                                                         <input type="hidden" name="album" value="<%album.id|html>" />
432                                                         <button type="submit"><%= Page.ImageBrowser.Album.Button.Delete|l10n|html></button>
433                                                 </form>
434                                         </div>
435                                 <%/if>
436
437                         <%/if>
438
439                 <%/if>
440
441         <%elseif imageRequested>
442
443                 <h1 class="backlink"><%image.title|html></h1>
444
445                 <div class="backlinks">
446                         <%foreach image.album.backlinks backlink backlinks>
447                                 <div class="backlink">
448                                         <a href="<% backlink.target|html>"><% backlink.name|html></a>
449                                 </div>
450                                 <%if ! backlinks.last>
451                                         <div class="separator">&gt;</div>
452                                 <%/if>
453                         <%/foreach>
454                         <%ifnull !image.previous><div class="backlink"><a href="imageBrowser.html?image=<%image.previous.id|html>">« <%image.previous.title|html></a></div><%/if>
455                         <%ifnull !image.next><div class="backlink"><a href="imageBrowser.html?image=<%image.next.id|html>">» <%image.next.title|html></a></div><%/if>
456                 </div>
457
458                 <%ifnull image>
459
460                 <%else>
461
462                         <%if image.sone.local>
463                                 <script language="javascript">
464                                         $(function() {
465                                                 getTranslation("WebInterface.DefaultText.EditImage.Title", function(text) {
466                                                         $("#edit-image input[name='title']").each(function() {
467                                                                 registerInputTextareaSwap(this, text, "title", false, true);
468                                                         });
469                                                 });
470                                                 getTranslation("WebInterface.DefaultText.EditImage.Description", function(text) {
471                                                         $("#edit-image :input[name='description']").each(function() {
472                                                                 registerInputTextareaSwap(this, text, "description", true, false);
473                                                         });
474                                                 });
475                                                 $("#edit-image label").hide();
476
477                                                 hideAndShowBlock(".edit-image", ".show-edit-image", ".hide-edit-image");
478                                                 hideAndShowBlock(".delete-image", ".show-delete-image", ".hide-delete-image");
479                                         });
480                                 </script>
481                         <%/if>
482
483                         <div class="single-image">
484                                 <%ifnull !image.key>
485                                         <a href="/<%image.key|html>"><% image|image-link max-width=640 max-height=480></a>
486                                 <%else>
487                                         <a href="imageBrowser.html?image=<%image.id|html>"><% image|image-link max-width=640 max-height=480></a>
488                                 <%/if>
489                         </div>
490
491                         <p class="parsed"><%image.description|parse sone=image.sone></p>
492
493                         <%if image.sone.local>
494
495                                 <div class="show-edit-image hidden toggle-link"><a class="small-link">» <%= Page.ImageBrowser.Image.Edit.Title|l10n|html></a></div>
496                                 <div class="hide-edit-image hidden toggle-link"><a class="small-link">« <%= Page.ImageBrowser.Image.Edit.Title|l10n|html></a></div>
497                                 <div class="edit-image">
498                                         <h2><%= Page.ImageBrowser.Image.Edit.Title|l10n|html></h2>
499
500                                         <form id="edit-image" action="editImage.html" method="post">
501                                                 <input type="hidden" name="formPassword" value="<%formPassword|html>" />
502                                                 <input type="hidden" name="returnPage" value="<%request.uri|html>" />
503                                                 <input type="hidden" name="image" value="<%image.id|html>" />
504
505                                                 <div>
506                                                         <label for="title"><%= Page.ImageBrowser.Image.Title.Label|l10n|html></label>
507                                                         <input type="text" name="title" value="<%image.title|html>" />
508                                                 </div>
509                                                 <div>
510                                                         <label for="description"><%= Page.ImageBrowser.Image.Description.Label|l10n|html></label>
511                                                         <textarea name="description"><%image.description|html></textarea>
512                                                 </div>
513                                                 <div>
514                                                         <button type="submit"><%= Page.ImageBrowser.Image.Button.Save|l10n|html></button>
515                                                 </div>
516                                         </form>
517                                 </div>
518
519                                 <div class="show-delete-image hidden toggle-link"><a class="small-link">» <%= Page.ImageBrowser.Image.Delete.Title|l10n|html></a></div>
520                                 <div class="hide-delete-image hidden toggle-link"><a class="small-link">« <%= Page.ImageBrowser.Image.Delete.Title|l10n|html></a></div>
521                                 <div class="delete-image">
522                                         <h2><%= Page.ImageBrowser.Image.Delete.Title|l10n|html></h2>
523
524                                         <form id="delete-image" action="deleteImage.html" method="get">
525                                                 <input type="hidden" name="image" value="<%image.id|html>" />
526                                                 <button type="submit"><%= Page.ImageBrowser.Image.Button.Delete|l10n|html></button>
527                                         </form>
528                                 </div>
529
530                         <%/if>
531
532                 <%/if>
533
534         <%elseif soneRequested>
535
536                 <%if sone.local>
537                         <script language="javascript">
538                                 $(function() {
539                                         getTranslation("WebInterface.DefaultText.CreateAlbum.Name", function(text) {
540                                                 $("#create-album input[name='name']").each(function() {
541                                                         registerInputTextareaSwap(this, text, "name", false, true);
542                                                 });
543                                         });
544                                         getTranslation("WebInterface.DefaultText.CreateAlbum.Description", function(text) {
545                                                 $("#create-album input[name='description']").each(function() {
546                                                         registerInputTextareaSwap(this, text, "description", true, true);
547                                                 });
548                                         });
549                                         $("#create-album label").hide();
550
551                                         /* hide non-js move buttons. */
552                                         $(".move-buttons").hide();
553
554                                         hideAndShowBlock(".create-album", ".show-create-album", ".hide-create-album");
555
556                                         prepareAlbums();
557                                 });
558                         </script>
559                 <%/if>
560
561                 <%ifnull sone>
562
563                         <p><%= Page.ImageBrowser.Sone.Error.NotFound.Text|l10n|html></p>
564
565                 <%else>
566
567                         <h1><%= Page.ImageBrowser.Sone.Title|l10n|replace needle='{sone}' replacementKey=sone.niceName|html></h1>
568
569                         <%include include/browseAlbums.html albums=sone.albums>
570
571                         <%if sone.local>
572                                 <div class="show-create-album hidden toggle-link"><a class="small-link">» <%= View.CreateAlbum.Title|l10n|html></a></div>
573                                 <div class="hide-create-album hidden toggle-link"><a class="small-link">« <%= View.CreateAlbum.Title|l10n|html></a></div>
574                                 <div class="create-album">
575                                         <%include include/createAlbum.html>
576                                 </div>
577                         <%/if>
578
579                 <%/if>
580
581         <%/if>
582
583 <%include include/tail.html>