<div class="page-id hidden">image-browser</div>
- <script language="javascript">
+ <script type="application/javascript">
/* hide all those forms. */
function hideAndShowBlock(blockElement, clickToShowElement, clickToHideElement) {
}
/* ID of the image currently being edited. */
- var editingImageId = null;
+ let editingImageId = null;
/**
* Shows the form for editing an image.
* @param imageId The ID of the image to edit.
*/
function editImage(imageId) {
- if (editingImageId != imageId) {
+ if (editingImageId !== imageId) {
cancelImageEditing();
} else {
return;
$(".show-data", getImage(imageId)).hide();
$(".edit-data", getImage(imageId)).show();
$(document).bind("click.sone", function(event) {
- if ($(event.target).closest("#image-" + imageId).size() == 0) {
+ if ($(event.target).closest("#image-" + imageId).size() === 0) {
cancelImageEditing();
}
});
* @param destinationId The ID of the destionation image
*/
function swapImage(sourceId, destinationId) {
- sourceElement = getImage(sourceId);
- destinationElement = getImage(destinationId);
- sourceParent = sourceElement.closest(".image-row");
- sourcePrevSibling = sourceElement.prev();
+ const sourceElement = getImage(sourceId);
+ const destinationElement = getImage(destinationId);
+ const sourceParent = sourceElement.closest(".image-row");
+ const sourcePrevSibling = sourceElement.prev();
sourceElement.detach();
destinationElement.before(sourceElement);
- if (sourcePrevSibling.get(0) != destinationElement.get(0)) {
+ if (sourcePrevSibling.get(0) !== destinationElement.get(0)) {
destinationElement.detach();
(sourcePrevSibling.size() > 0) ? sourcePrevSibling.after(destinationElement) : sourceParent.prepend(destinationElement);
}
- if ($("button[name='moveLeft']", sourceElement).hasClass("hidden") != $("button[name='moveLeft']", destinationElement).hasClass("hidden")) {
+ if ($("button[name='moveLeft']", sourceElement).hasClass("hidden") !== $("button[name='moveLeft']", destinationElement).hasClass("hidden")) {
$("button[name='moveLeft']", sourceElement).toggleClass("hidden");
$("button[name='moveLeft']", destinationElement).toggleClass("hidden");
}
- if ($("button[name='moveRight']", sourceElement).hasClass("hidden") != $("button[name='moveRight']", destinationElement).hasClass("hidden")) {
+ if ($("button[name='moveRight']", sourceElement).hasClass("hidden") !== $("button[name='moveRight']", destinationElement).hasClass("hidden")) {
$("button[name='moveRight']", sourceElement).toggleClass("hidden");
$("button[name='moveRight']", destinationElement).toggleClass("hidden");
}
*/
function prepareImages() {
$(".image").each(function() {
- imageId = $(this).closest(".image").find(".image-id").text();
+ const imageId = $(this).closest(".image").find(".image-id").text();
(function(element, imageId) {
$(".show-data", element).click(function() {
editImage(imageId);
});
$("button[name='moveLeft'], button[name='moveRight']", element).click(function() {
- ajaxGet("editImage.ajax", { "formPassword": getFormPassword(), "image": imageId, "moveLeft": this.name == "moveLeft", "moveRight": this.name == "moveRight" }, function(data) {
+ ajaxGet("editImage.ajax", { "formPassword": getFormPassword(), "image": imageId, "moveLeft": this.name === "moveLeft", "moveRight": this.name === "moveRight" }, function(data) {
if (data && data.success) {
swapImage(data.sourceImageId, data.destinationImageId);
}
return false;
});
$("button[name='submit']", element).click(function() {
- title = $(":input[name='title']:enabled", this.form).val();
- description = $(":input[name='description']:enabled", this.form).val();
+ const title = $(":input[name='title']:enabled", this.form).val();
+ const description = $(":input[name='description']:enabled", this.form).val();
ajaxGet("editImage.ajax", { "formPassword": getFormPassword(), "image": imageId, "title": title, "description": description }, function(data) {
- if (data && data.success) {
- getImage(data.imageId).find(".image-title").text(data.title);
- getImage(data.imageId).find(".image-description").html(data.parsedDescription);
- getImage(data.imageId).find(":input[name='title']").attr("defaultValue", title);
- getImage(data.imageId).find(":input[name='description']").attr("defaultValue", data.description);
+ const imageElement = getImage(data.imageId);
+ const imageTitleInput = imageElement.find(":input[name='title']");
+ const imageDescriptionInput = imageElement.find(":input[name='description']");
+ if (data && data.success) {
+ imageElement.find(".image-title").text(data.title);
+ imageElement.find(".image-description").html(data.parsedDescription);
+ imageTitleInput.prop("defaultValue", data.title);
+ imageDescriptionInput.prop("defaultValue", data.description);
cancelImageEditing();
- }
+ } else if (data && !data.success) {
+ imageTitleInput.prop("value", imageTitleInput.prop("defaultValue"));
+ imageDescriptionInput.prop("value", imageDescriptionInput.prop("defaultValue"));
+ cancelImageEditing();
+ }
});
return false;
});
}
/* ID of the album currently being edited. */
- var editingAlbumId = null;
+ let editingAlbumId = null;
/**
* Shows the form for editing an album.
* @param albumId The ID of the album to edit.
*/
function editAlbum(albumId) {
- if (editingAlbumId != albumId) {
+ if (editingAlbumId !== albumId) {
if (editingAlbumId != null) {
cancelAlbumEditing();
}
$(".edit-data", getAlbum(albumId)).show();
console.log(getAlbum(albumId));
$(document).bind("click.sone", function(event) {
- if ($(event.target).closest("#album-" + albumId).size() == 0) {
+ if ($(event.target).closest("#album-" + albumId).size() === 0) {
cancelAlbumEditing();
}
});
* @param destinationId The ID of the destionation album
*/
function swapAlbum(sourceId, destinationId) {
- sourceElement = getAlbum(sourceId);
- destinationElement = getAlbum(destinationId);
- sourceParent = sourceElement.closest(".album-row");
- sourcePrevSibling = sourceElement.prev();
+ const sourceElement = getAlbum(sourceId);
+ const destinationElement = getAlbum(destinationId);
+ const sourceParent = sourceElement.closest(".album-row");
+ const sourcePrevSibling = sourceElement.prev();
sourceElement.detach();
destinationElement.before(sourceElement);
- if (sourcePrevSibling.get(0) != destinationElement.get(0)) {
+ if (sourcePrevSibling.get(0) !== destinationElement.get(0)) {
destinationElement.detach();
(sourcePrevSibling.size() > 0) ? sourcePrevSibling.after(destinationElement) : sourceParent.prepend(destinationElement);
}
- if ($("button[name='moveLeft']", sourceElement).hasClass("hidden") != $("button[name='moveLeft']", destinationElement).hasClass("hidden")) {
+ if ($("button[name='moveLeft']", sourceElement).hasClass("hidden") !== $("button[name='moveLeft']", destinationElement).hasClass("hidden")) {
$("button[name='moveLeft']", sourceElement).toggleClass("hidden");
$("button[name='moveLeft']", destinationElement).toggleClass("hidden");
}
- if ($("button[name='moveRight']", sourceElement).hasClass("hidden") != $("button[name='moveRight']", destinationElement).hasClass("hidden")) {
+ if ($("button[name='moveRight']", sourceElement).hasClass("hidden") !== $("button[name='moveRight']", destinationElement).hasClass("hidden")) {
$("button[name='moveRight']", sourceElement).toggleClass("hidden");
$("button[name='moveRight']", destinationElement).toggleClass("hidden");
}
*/
function prepareAlbums() {
$(".album").each(function() {
- albumId = $(this).closest(".album").find(".album-id").text();
+ const albumId = $(this).closest(".album").find(".album-id").text();
(function(element, albumId) {
$(".show-data", element).click(function() {
console.log("show-data");
editAlbum(albumId);
});
$("button[name='moveLeft'], button[name='moveRight']", element).click(function() {
- ajaxGet("editAlbum.ajax", { "formPassword": getFormPassword(), "album": albumId, "moveLeft": this.name == "moveLeft", "moveRight": this.name == "moveRight" }, function(data) {
+ ajaxGet("editAlbum.ajax", { "formPassword": getFormPassword(), "album": albumId, "moveLeft": this.name === "moveLeft", "moveRight": this.name === "moveRight" }, function(data) {
if (data && data.success) {
swapAlbum(data.sourceAlbumId, data.destinationAlbumId);
}
return false;
});
$("button[name='submit']", element).click(function() {
- title = $(":input[name='title']:enabled", this.form).val();
- description = $(":input[name='description']:enabled", this.form).val();
+ const title = $(":input[name='title']:enabled", this.form).val();
+ const description = $(":input[name='description']:enabled", this.form).val();
ajaxGet("editAlbum.ajax", { "formPassword": getFormPassword(), "album": albumId, "title": title, "description": description }, function(data) {
- if (data && data.success) {
- getAlbum(data.albumId).find(".album-title").text(data.title);
- getAlbum(data.albumId).find(".album-description").text(data.description);
- getAlbum(data.albumId).find(":input[name='title']").attr("defaultValue", title);
- getAlbum(data.albumId).find(":input[name='description']").attr("defaultValue", description);
- cancelAlbumEditing();
- }
+ if (data) {
+ const albumTitleField = getAlbum(data.albumId).find(".album-title");
+ const albumDescriptionField = getAlbum(data.albumId).find(".album-description");
+ if (data.success) {
+ albumTitleField.text(data.title);
+ albumDescriptionField.text(data.description);
+ getAlbum(data.albumId).find(":input[name='title']").prop("defaultValue", title);
+ getAlbum(data.albumId).find(":input[name='description']").prop("defaultValue", description);
+ } else {
+ albumTitleField.prop("value", albumTitleField.prop("defaultValue"));
+ albumDescriptionField.prop("value", albumDescriptionField.prop("defaultValue"));
+ }
+ cancelAlbumEditing();
+ }
});
return false;
});
<%else>
<%if album.sone.local>
- <script language="javascript">
+ <script type="application/javascript">
$(function() {
getTranslation("WebInterface.DefaultText.UploadImage.Title", function(text) {
</script>
<%/if>
- <h1 class="backlink"><%= Page.ImageBrowser.Album.Title|l10n|replace needle='{album}' replacementKey=album.title|html></h1>
+ <h1 class="backlink"><%= Page.ImageBrowser.Album.Title|l10n|replace needle=='{album}' replacement=album.title|html></h1>
<div class="backlinks">
<div class="backlink"><a href="imageBrowser.html?mode=gallery"><%= Page.ImageBrowser.Link.All|l10n|html></a></div>
<%/foreach>
</div>
- <p id="description"><% album.description|parse sone=album.sone></p>
+ <p id="description"><% album.description|parse sone=album.sone|render></p>
<%if album.sone.local>
<div class="show-edit-album hidden toggle-link"><a class="small-link">» <%= Page.ImageBrowser.Album.Edit.Title|l10n|html></a></div>
<input type="hidden" name="formPassword" value="<%formPassword|html>" />
<input type="hidden" name="album" value="<%album.id|html>" />
- <%if ! album.images.empty>
- <div>
- <label for="album-image"><%= Page.ImageBrowser.Album.Label.AlbumImage|l10n|html></label>
- <select name="album-image">
- <option disabled="disabled"><%= Page.ImageBrowser.Album.AlbumImage.Choose|l10n|html></option>
- <%foreach album.images image>
- <option value="<% image.id|html>"<%if album.albumImage.id|match key=image.id> selected="selected"<%/if>><% image.title|html></option>
- <%/foreach>
- </select>
- </div>
- <%/if>
<div>
<label for="title"><%= Page.ImageBrowser.Album.Label.Title|l10n|html></label>
<input type="text" name="title" value="<%album.title|html>" />
</div>
<%/if>
- <%foreach album.images image>
- <%first><h2><%= Page.ImageBrowser.Header.Images|l10n|html></h2><%/first>
- <%if loop.count|mod divisor=3><div class="image-row"><%/if>
+ <%foreach album.images image|paginate pageSize=preferences.imagesPerPage page=page>
+ <%first>
+ <h2><%= Page.ImageBrowser.Header.Images|l10n|html></h2>
+ <%include include/pagination.html pageParameter=="page">
+ <%/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>
+ <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></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">
</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></div><%/if>
+ <%= 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>
+ </div>
+ <%/if>
+ <%last><%include include/pagination.html pageParameter=="page"><%/last>
<%/foreach>
<%if album.sone.local>
- <div class="show-upload-image hidden toggle-link"><a class="small-link">» <%= View.UploadImage.Title|l10n|html></a></div>
- <div class="hide-upload-image hidden toggle-link"><a class="small-link">« <%= View.UploadImage.Title|l10n|html></a></div>
+ <div class="clear show-upload-image hidden toggle-link"><a class="small-link">» <%= View.UploadImage.Title|l10n|html></a></div>
+ <div class="clear hide-upload-image hidden toggle-link"><a class="small-link">« <%= View.UploadImage.Title|l10n|html></a></div>
<div class="upload-image">
<%include include/uploadImage.html>
</div>
<%else>
<%if image.sone.local>
- <script language="javascript">
+ <script type="application/javascript">
$(function() {
getTranslation("WebInterface.DefaultText.EditImage.Title", function(text) {
$("#edit-image input[name='title']").each(function() {
<div class="single-image">
<%ifnull !image.key>
- <a href="/<%image.key|html>"><% image|image-link max-width=640 max-height=480></a>
+ <a href="/<%image.key|html>"><% image|image-link max-width==640 max-height==480></a>
<%else>
- <a href="imageBrowser.html?image=<%image.id|html>"><% image|image-link max-width=640 max-height=480></a>
+ <a href="imageBrowser.html?image=<%image.id|html>"><% image|image-link max-width==640 max-height==480></a>
<%/if>
</div>
- <p class="parsed"><%image.description|parse sone=image.sone></p>
+ <p class="parsed"><%image.description|parse sone=image.sone|render></p>
<%if image.sone.local>
<%elseif soneRequested>
<%if sone.local>
- <script language="javascript">
+ <script type="application/javascript">
$(function() {
getTranslation("WebInterface.DefaultText.CreateAlbum.Name", function(text) {
$("#create-album input[name='name']").each(function() {
<%else>
- <h1><%= Page.ImageBrowser.Sone.Title|l10n|replace needle='{sone}' replacementKey=sone.niceName|html></h1>
+ <h1><%= Page.ImageBrowser.Sone.Title|l10n|replace needle=='{sone}' replacement=sone.niceName|html></h1>
<div class="backlinks">
<div class="backlink"><a href="imageBrowser.html?mode=gallery"><%= Page.ImageBrowser.Link.All|l10n|html></a></div>
<div class="separator">></div>
- <div class="backlink"><a href="imageBrowser.html?sone=<%sone.id|html>"><%sone.niceName|l10n|html></a></div>
+ <div class="backlink"><a href="imageBrowser.html?sone=<%sone.id|html>"><%sone.niceName|html></a></div>
</div>
- <%include include/browseAlbums.html albums=sone.albums>
+ <%include include/browseAlbums.html albums=sone.rootAlbum.albums>
<%if sone.local>
<div class="show-create-album hidden toggle-link"><a class="small-link">» <%= View.CreateAlbum.Title|l10n|html></a></div>
<%/if>
+ <%elseif galleryRequested>
+
+ <%foreach albums album|paginate pageSize=preferences.imagesPerPage pageParameter=request.page pagination=albumPagination>
+ <%first>
+ <h2><%= Page.ImageBrowser.Header.Albums|l10n|html></h2>
+ <%include include/pagination.html pagination=albumPagination pageParameter=="page">
+ <%/first>
+ <%if loop.count|mod divisor==3><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>
+ </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>
+ </div>
+ <%/if>
+ <%last>
+ <%include include/pagination.html pagination=albumPagination pageParameter=="page">
+ <%/last>
+ <%/foreach>
+
<%/if>
<%include include/tail.html>