templateContext.set("albumRequested", true);
templateContext.set("album", album.orNull());
templateContext.set("page", request.getHttpRequest().getParam("page"));
+ templateContext.set("albumPage", request.getHttpRequest().getParam("albumPage"));
return;
}
String imageId = request.getHttpRequest().getParam("image", null);
Optional<Sone> sone = webInterface.getCore().getSone(soneId);
templateContext.set("soneRequested", true);
templateContext.set("sone", sone.orNull());
+ templateContext.set("albumPage", request.getHttpRequest().getParam("albumPage"));
return;
}
String mode = request.getHttpRequest().getParam("mode", null);
width: 95%;
}
+#sone .images {
+ display: table;
+ width: 100%;
+}
+
#sone .album-row, #sone .image-row {
display: table-row;
border-collapse: separate;
position: relative;
margin-top: 1ex;
margin-bottom: 1ex;
- height: 120px;
+ height: 122px;
+ overflow: hidden;
}
#sone .image {
/** Timeout handler for the next-to-show Sone context menu. */
var currentSoneMenuTimeoutHandler;
+function replaceImagesWithErrorWithBrokenImages() {
+ var replaceImage = function(imageElement, sourcePath) {
+ $(imageElement).attr("src", sourcePath)
+ .attr("width", "160")
+ .attr("height", "120")
+ .attr("style", "position: absolute; top: 0px; left: 0px; opacity: .25");
+ };
+
+ $(".image-in-album .image img").error(function () {
+ replaceImage(this, "images/broken-image.png");
+ });
+ $(".album .image img").error(function () {
+ replaceImage(this, "images/broken-album.png");
+ });
+}
+
$(document).ready(function() {
/* rip out the status update textarea. */
/* activate status polling. */
setTimeout(getStatus, 5000);
+ replaceImagesWithErrorWithBrokenImages();
+
/* reset activity counter when the page has focus. */
$(window).focus(function() {
focus = true;
<%first>
<h2><%= Page.ImageBrowser.Header.Images|l10n|html></h2>
<%include include/pagination.html pageParameter=="page">
+ <div class="images">
<%/first>
- <%if loop.count|mod divisor==3><div class="image-row"><%/if>
- <div id="image-<% image.id|html>" class="image">
- <div class="image-id hidden"><% image.id|html></div>
- <div class="image-container">
- <a href="imageBrowser.html?image=<%image.id|html>"><% image|image-link max-width==250 max-height==250 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|parse sone=image.sone|render></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="move-buttons">
- <button <%first>class="hidden" <%/first>type="submit" name="moveLeft" value="true"><%= Page.ImageBrowser.Image.Button.MoveLeft|l10n|html></button>
- <button <%last>class="hidden" <%/last>type="submit" name="moveRight" value="true"><%= Page.ImageBrowser.Image.Button.MoveRight|l10n|html></button>
- </div>
-
- <div class="edit-data hidden">
- <div>
- <input type="text" name="title" value="<%image.title|html>" />
- </div>
- <div>
- <textarea name="description"><%image.description|html></textarea>
+ <%if loop.even><div class="image-row"><%/if>
+ <div id="image-<% image.id|html>" class="image-in-album">
+ <div class="image-id hidden"><% image.id|html></div>
+ <%include include/viewImage.html>
+ <%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="move-buttons">
+ <button <%if loop.first>class="hidden" <%/if>type="submit" name="moveLeft" value="true"><%= Page.ImageBrowser.Image.Button.MoveLeft|l10n|html></button>
+ <button <%if loop.last>class="hidden" <%/if>type="submit" name="moveRight" value="true"><%= Page.ImageBrowser.Image.Button.MoveRight|l10n|html></button>
</div>
- <div>
- <button <%first>class="hidden" <%/first>type="submit" name="moveLeft" value="true"><%= Page.ImageBrowser.Image.Button.MoveLeft|l10n|html></button>
- <button type="submit" name="submit"><%= Page.ImageBrowser.Image.Button.Save|l10n|html></button>
- <button <%last>class="hidden" <%/last>type="submit" name="moveRight" value="true"><%= Page.ImageBrowser.Image.Button.MoveRight|l10n|html></button>
+
+ <div class="edit-data hidden">
+ <div>
+ <input type="text" name="title" value="<%image.title|html>" />
+ </div>
+ <div>
+ <textarea name="description"><%image.description|html></textarea>
+ </div>
+ <div>
+ <button <%if loop.first>class="hidden" <%/if>type="submit" name="moveLeft" value="true"><%= Page.ImageBrowser.Image.Button.MoveLeft|l10n|html></button>
+ <button type="submit" name="submit"><%= Page.ImageBrowser.Image.Button.Save|l10n|html></button>
+ <button <%if loop.last>class="hidden" <%/if>type="submit" name="moveRight" value="true"><%= Page.ImageBrowser.Image.Button.MoveRight|l10n|html></button>
+ </div>
</div>
- </div>
- </form>
- <%/if>
- </div>
- <%= false|store key==endRow>
- <%if loop.count|mod divisor==3 offset==1><%= true|store key==endRow><%/if>
- <%last><%= true|store key==endRow><%/last>
- <%if endRow>
+ </form>
+ <%/if>
+ </div>
+ <%= false|store key==endRow>
+ <%if loop.odd><%= true|store key==endRow><%/if>
+ <%last><%= true|store key==endRow><%/last>
+ <%if endRow>
</div>
<%/if>
- <%last><%include include/pagination.html pageParameter=="page"><%/last>
+ <%last></div><%include include/pagination.html pageParameter=="page"><%/last>
<%/foreach>
<%if album.sone.local>
<%first>
<h2><%= Page.ImageBrowser.Header.Albums|l10n|html></h2>
<%include include/pagination.html pagination=albumPagination pageParameter=="page">
+ <div class="images">
<%/first>
- <%if loop.count|mod divisor==3><div class="album-row"><%/if>
+ <%if loop.even><div class="album-row"><%/if>
<div id="album-<% album.id|html>" class="album">
<div class="album-id hidden"><% album.id|html></div>
- <div class="album-container">
- <a href="imageBrowser.html?album=<% album.id|html>" title="<% album.title|html>">
- <%ifnull album.albumImage>
- <img src="images/unknown-image-0.png" width="333" height="250" alt="<% album.title|html> (<%album.sone.niceName|html>)" title="<% album.title|html> (<%album.sone.niceName|html>)" style="position: relative; top: 0px; left: -41px;" />
- <%else><!-- TODO -->
- <% album.albumImage|image-link max-width==250 max-height==250 mode==enlarge title=album.title>
- <%/if>
- </a>
- </div>
- <div class="show-data">
- <div class="album-sone"><a href="imageBrowser.html?sone=<%album.sone.id|html>"><%album.sone.niceName|html></a></div>
- <div class="album-title"><% album.title|html> (<%= View.Sone.Stats.Images|l10n 0=album.images.size>)</div>
- <div class="album-description"><% album.description|parse sone=album.sone|render></div>
- </div>
+ <%include include/viewAlbum.html>
</div>
<%= false|store key==endRow>
- <%if loop.count|mod divisor==3 offset==1><%= true|store key==endRow><%/if>
+ <%if loop.odd><%= true|store key==endRow><%/if>
<%last><%= true|store key==endRow><%/last>
- <%if endRow>
- </div>
- <%/if>
+ <%if endRow></div><%/if>
<%last>
+ </div>
<%include include/pagination.html pagination=albumPagination pageParameter=="page">
<%/last>
<%/foreach>
-<%foreach albums album>
- <%first><h2><%= Page.ImageBrowser.Header.Albums|l10n|html></h2><%/first>
- <%if loop.count|mod divisor==3><div class="album-row"><%/if>
- <%include include/viewAlbum.html>
+<%foreach albums album|paginate pageSize=core.preferences.imagesPerPage page=albumPage>
+ <%first>
+ <h2><%= Page.ImageBrowser.Header.Albums|l10n|html></h2>
+ <%include include/pagination.html pageParameter=="albumPage">
+ <div class="images">
+ <%/first>
+ <%if loop.even><div class="album-row"><%/if>
+ <div id="album-<% album.id|html>" class="album">
+ <div class="album-id hidden"><% album.id|html></div>
+ <%include include/viewAlbum.html>
+ </div>
<%= false|store key==endRow>
- <%if loop.count|mod divisor==3 offset==1><%= true|store key==endRow><%/if>
+ <%if loop.odd><%= true|store key==endRow><%/if>
<%last><%= true|store key==endRow><%/last>
<%if endRow></div><%/if>
+ <%last>
+ </div>
+ <%include include/pagination.html pageParameter=="albumPage">
+ <%/last>
+
+ <%if album.sone.local>
+ <form class="edit-album" action="editAlbum.html" method="post">
+ <input type="hidden" name="formPassword" value="<%formPassword|html>" />
+ <input type="hidden" name="returnPage" value="<%request.uri|html>" />
+ <input type="hidden" name="album" value="<%album.id|html>" />
+
+ <div class="move-buttons">
+ <button <%if loop.first>class="hidden" <%/if>type="submit" name="moveLeft" value="true"><%= Page.ImageBrowser.Image.Button.MoveLeft|l10n|html></button>
+ <button <%if loop.last>class="hidden" <%/if>type="submit" name="moveRight" value="true"><%= Page.ImageBrowser.Image.Button.MoveRight|l10n|html></button>
+ </div>
+
+ <div class="edit-data hidden">
+ <div>
+ <input type="text" name="title" value="<%album.title|html>" />
+ </div>
+ <div>
+ <textarea name="description"><%album.description|html></textarea>
+ </div>
+ <div>
+ <button <%if loop.first>class="hidden" <%/if>type="submit" name="moveLeft" value="true"><%= Page.ImageBrowser.Image.Button.MoveLeft|l10n|html></button>
+ <button type="submit" name="submit"><%= Page.ImageBrowser.Album.Button.Save|l10n|html></button>
+ <button <%if loop.last>class="hidden" <%/if>type="submit" name="moveRight" value="true"><%= Page.ImageBrowser.Image.Button.MoveRight|l10n|html></button>
+ </div>
+ </div>
+ </form>
+ <%/if>
<%/foreach>
<div class="last"><%if ! pagination.last><a href="<% request|change name=pageParameter value=pagination.lastPage>">»</a><%else><span>»</span><%/if></div>
<div class="next"><%if ! pagination.last><a href="<% request|change name=pageParameter value=pagination.nextPage>">›</a><%else><span>›</span><%/if></div>
</div>
+ <div class="clear"/>
<%/if>
-<div id="album-<% album.id|html>" class="album">
- <div class="album-id hidden"><% album.id|html></div>
- <div class="album-container">
- <a href="imageBrowser.html?album=<% album.id|html>" title="<% album.title|html>">
- <%ifnull album.albumImage>
- <img src="images/unknown-image-0.png" width="333" height="250" alt="<% album.title|html>" title="<% album.title|html>" style="position: relative; top: 0px; left: -41px;" />
- <%else><!-- TODO -->
- <div class="image-container">
- <% album.albumImage|image-link class==album-image max-width==250 max-height==250 mode==enlarge title=album.title>
- </div>
- <div class="link-to-album"><a href="album://<% album.id|html>">[link album]</a></div>
+<div class="image-with-information">
+ <div class="image">
+ <a href="imageBrowser.html?album=<% album.id|html>">
+ <%ifnull album.images.random>
+ <img src="images/broken-album.png" width="160" height="120" title="<% album.title|html>" style="opacity: 0.25;"/>
+ <%else>
+ <% album.images.random|image-link max-width==160 max-height==120 mode==enlarge title=album.title>
<%/if>
</a>
</div>
- <div class="show-data">
- <div class="album-title"><% album.title|html> (<%= View.Sone.Stats.Images|l10n 0=album.images.size>)</div>
- <div class="album-description"><% album.description|parse sone=album.sone|render></div>
+ <div class="information">
+ <div class="link"><a href="album://<% album.id|html>">[link album]</a></div>
+ <div class="title"><a href="imageBrowser.html?album=<% album.id|html>"><% album.title|html></a></div>
+ <div class="author"><% =View.Post.LinkedAlbum.SizeAndAuthor|l10n 0=album.sone.niceName 1=album.images.size|html|replace needle=="[link]" replacement=='<a href="viewSone.html?sone=<sone-id>">'|replace needle=='[/link]' replacement=='</a>'|replace needle=='<sone-id>' replacement=album.sone.id></div>
+ <div class="description"><% album.description|parse sone=album.sone|render></div>
</div>
- <%if album.sone.local>
- <form class="edit-album" action="editAlbum.html" method="post">
- <input type="hidden" name="formPassword" value="<%formPassword|html>" />
- <input type="hidden" name="returnPage" value="<%request.uri|html>" />
- <input type="hidden" name="album" value="<%album.id|html>" />
-
- <div class="move-buttons">
- <button <%if loop.first>class="hidden" <%/if>type="submit" name="moveLeft" value="true"><%= Page.ImageBrowser.Image.Button.MoveLeft|l10n|html></button>
- <button <%if loop.last>class="hidden" <%/if>type="submit" name="moveRight" value="true"><%= Page.ImageBrowser.Image.Button.MoveRight|l10n|html></button>
- </div>
-
- <div class="edit-data hidden">
- <div>
- <input type="text" name="title" value="<%album.title|html>" />
- </div>
- <div>
- <textarea name="description"><%album.description|html></textarea>
- </div>
- <div>
- <button <%if loop.first>class="hidden" <%/if>type="submit" name="moveLeft" value="true"><%= Page.ImageBrowser.Image.Button.MoveLeft|l10n|html></button>
- <button type="submit" name="submit"><%= Page.ImageBrowser.Album.Button.Save|l10n|html></button>
- <button <%if loop.last>class="hidden" <%/if>type="submit" name="moveRight" value="true"><%= Page.ImageBrowser.Image.Button.MoveRight|l10n|html></button>
- </div>
- </div>
- </form>
- <%/if>
</div>
--- /dev/null
+<div class="image-with-information">
+ <div class="image">
+ <a href="imageBrowser.html?image=<% image.id|html>">
+ <% image|image-link max-width==160 max-height==120 mode==enlarge title=image.title>
+ </a>
+ </div>
+ <div class="information">
+ <div class="link"><a href="image://<% image.id|html>">[link image]</a></div>
+ <div class="title"><a href="imageBrowser.html?image=<% image.id|html>"><% image.title|html></a></div>
+ <div class="description"><% image.description|parse sone=image.sone|render></div>
+ </div>
+</div>
</div>
<%foreach parts part>
<%if part.class.simpleName|match value==AlbumPart><!-- ← this is so ugly. -->
- <div class="linked-album">
- <div class="linked-image">
- <div class="image-left">
- <div class="image">
- <a href="imageBrowser.html?album=<% part.album.id|html>"><% part.album.albumImage|image-link max-width==160 max-height==90 mode==enlarge title=part.album.title></a>
- </div>
- </div>
- <div class="about-image">
- <div class="title"><% part.album.title|html></div>
- <div><% =View.Post.LinkedAlbum.SizeAndAuthor|l10n 0=part.album.sone.niceName 1=part.album.images.size|html|replace needle=="[link]" replacement=='<a href="viewSone.html?sone=<sone-id>">'|replace needle=='[/link]' replacement=='</a>'|replace needle=='<sone-id>' replacement=part.album.sone.id></div>
- <div class="description"><% part.album.description|parse sone=part.album.sone|render></div>
- </div>
- </div>
+ <% part.album.images.random|store key==image>
+ <div class="album images">
+ <%include include/viewAlbum.html album=part.album>
</div>
<%/if>
<%/foreach>