Commit 1bd062e8 authored by Matija Obreza's avatar Matija Obreza

Admin Image gallery management

parent c8257178
......@@ -16,7 +16,6 @@
package org.genesys2.server.servlet.controller;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.UUID;
......@@ -25,12 +24,13 @@ import javax.servlet.http.HttpServletResponse;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.velocity.exception.ResourceNotFoundException;
import org.genesys2.server.filerepository.NoSuchRepositoryFileException;
import org.genesys2.server.filerepository.model.RepositoryFile;
import org.genesys2.server.filerepository.service.BytesStorageService;
import org.genesys2.server.filerepository.service.RepositoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.HandlerMapping;
......@@ -43,39 +43,70 @@ public class FileRepositoryController extends BaseController {
@Autowired
private RepositoryService repositoryService;
@RequestMapping(value = "/repository/d/{uuid:[\\d+\\-]+}.{ext}", method = RequestMethod.GET)
public void downloadFile(@PathVariable String uuid, @PathVariable String ext, HttpServletResponse response) throws IOException {
try {
RepositoryFile repositoryFile = repositoryService.getFile(UUID.fromString(uuid));
@Autowired
private BytesStorageService byteStorageService;
private void downloadFile(final String path, final String uuid, final String ext, final HttpServletResponse response) throws IOException {
byte[] data;
if (path.endsWith("_thumb/") && ext.equals(".png")) {
final String filename = uuid + ext;
if (LOG.isDebugEnabled()) {
LOG.debug("_thumb path=" + path + " filename=" + filename);
}
data = this.byteStorageService.get(path, filename);
response.setContentType("image/png");
} else {
// Regular repo file
try {
final RepositoryFile repositoryFile = this.repositoryService.getFile(UUID.fromString(uuid));
if (repositoryFile == null) {
throw new ResourceNotFoundException("No such thing");
}
byte[] data = repositoryService.getFileBytes(repositoryFile.getPath(), repositoryFile.getFilename());
if (!repositoryFile.getPath().equals(path) || !repositoryFile.getExtension().equals(ext)) {
LOG.warn(repositoryFile.getPath() + "!=" + path);
LOG.warn(repositoryFile.getExtension() + "!=" + ext);
throw new ResourceNotFoundException("No such thing");
}
data = this.repositoryService.getFileBytes(repositoryFile.getPath(), repositoryFile.getFilename());
if (repositoryFile != null && data != null) {
response.setContentType(repositoryFile.getMimeType());
response.addHeader("Content-Disposition", String.format("attachment; filename=\"%s\"", repositoryFile.getOriginalFilename()));
response.getOutputStream().write(data);
response.flushBuffer();
}
} catch (NoSuchRepositoryFileException e) {
LOG.error("File doesn't exist!", e);
throw new FileNotFoundException(e.getMessage());
} catch (final NumberFormatException e) {
LOG.warn("404 - UUID in wrong format.");
throw new ResourceNotFoundException("No such thing");
} catch (final NoSuchRepositoryFileException e) {
LOG.warn("404 - No such repository file ", e);
throw new ResourceNotFoundException("No such thing");
}
}
response.setContentLength(data.length);
response.getOutputStream().write(data);
response.flushBuffer();
}
@RequestMapping(value = "/repository/d/**", method = RequestMethod.GET)
public void downloadFile(HttpServletRequest request, HttpServletResponse response) throws IOException {
String fullpath = (String) request.getAttribute(HandlerMapping.PATH_WITHIN_HANDLER_MAPPING_ATTRIBUTE);
System.err.println("Fullname: " + fullpath);
String ext = fullpath.substring(fullpath.lastIndexOf("."));
String uuid = fullpath.substring(fullpath.lastIndexOf("/") + 1, fullpath.lastIndexOf("."));
System.err.println(ext);
System.err.println(uuid);
public void downloadFile(final HttpServletRequest request, final HttpServletResponse response) throws IOException {
final String fullpath = (String) request.getAttribute(HandlerMapping.PATH_WITHIN_HANDLER_MAPPING_ATTRIBUTE);
if (LOG.isTraceEnabled()) {
LOG.trace("Fullname: " + fullpath);
}
final String ext = fullpath.substring(fullpath.lastIndexOf("."));
final String uuid = fullpath.substring(fullpath.lastIndexOf("/") + 1, fullpath.lastIndexOf("."));
final String path = fullpath.substring("/repository/d".length(), fullpath.lastIndexOf("/") + 1);
// System.err.println(path + "- " + uuid + " -" + ext);
if (LOG.isDebugEnabled()) {
LOG.debug("ext=" + ext + " uuid=" + uuid);
LOG.debug(path + " " + uuid + ext);
}
downloadFile(uuid, ext, response);
downloadFile(path, uuid, ext, response);
}
}
......@@ -23,17 +23,20 @@ import java.util.Date;
import java.util.List;
import java.util.UUID;
import org.apache.commons.lang.StringUtils;
import javax.servlet.http.HttpServletRequest;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.genesys2.server.filerepository.InvalidRepositoryFileDataException;
import org.genesys2.server.filerepository.InvalidRepositoryPathException;
import org.genesys2.server.filerepository.NoSuchRepositoryFileException;
import org.genesys2.server.filerepository.model.RepositoryFile;
import org.genesys2.server.filerepository.service.ImageGalleryService;
import org.genesys2.server.filerepository.service.RepositoryService;
import org.genesys2.server.servlet.controller.BaseController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.propertyeditors.CustomDateEditor;
import org.springframework.data.domain.PageRequest;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
......@@ -44,98 +47,97 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.servlet.HandlerMapping;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
@Controller
@RequestMapping("/admin/repository")
@RequestMapping(RepositoryController.CONTROLLER_PATH)
@PreAuthorize("hasRole('ADMINISTRATOR')")
public class RepositoryController extends BaseController {
public static final String CONTROLLER_PATH = "/admin/r";
public static final String JSP_PATH = "/admin/repository";
public static final Log LOG = LogFactory.getLog(RepositoryController.class);
@Autowired
private RepositoryService repositoryService;
@Autowired
private ImageGalleryService imageGalleryService;
@RequestMapping(value = "/files/**", method = RequestMethod.GET)
public String listAllFiles(HttpServletRequest request, ModelMap model) {
String fullpath = (String) request.getAttribute(HandlerMapping.PATH_WITHIN_HANDLER_MAPPING_ATTRIBUTE);
fullpath = fullpath.substring(CONTROLLER_PATH.length() + "/files".length());
// System.err.println(fullpath);
return listAllFiles(fullpath, model);
}
@RequestMapping(value = "/files", method = RequestMethod.GET)
public String listAllFiles(@RequestParam(defaultValue="/") String repositoryPath, @RequestParam(required = false) String errorMessage,
ModelMap model) {
public String listAllFiles(@RequestParam(defaultValue = "/") String repositoryPath, ModelMap model) {
List<RepositoryFile> fileList = repositoryService.getFiles(repositoryPath);
model.addAttribute("fileList", fileList);
model.addAttribute("currentPath", repositoryPath);
model.addAttribute("subPaths", repositoryService.listPaths(repositoryPath, new PageRequest(0, 10)));
if (StringUtils.isNotEmpty(errorMessage)) {
model.addAttribute("errorMessage", errorMessage);
}
model.addAttribute("imageGallery", imageGalleryService.loadImageGallery(repositoryPath));
return "/admin/filerepository/index";
return JSP_PATH + "/index";
}
@RequestMapping(value = "/edit", method = RequestMethod.GET)
public String getEditPage(@RequestParam String uuid, @RequestParam String repositoryPath, ModelMap model)
throws NoSuchRepositoryFileException {
public String getEditPage(@RequestParam String uuid, ModelMap model) throws NoSuchRepositoryFileException {
RepositoryFile file = repositoryService.getFile(UUID.fromString(uuid));
model.addAttribute("file", file);
model.addAttribute("currentPath", repositoryPath);
return "/admin/filerepository/edit";
return JSP_PATH + "/edit";
}
@RequestMapping(value = "/upload", method = RequestMethod.POST)
public String uploadFile(@RequestParam MultipartFile file, @RequestParam String repositoryPath,
RedirectAttributes redirectAttributes) throws IOException {
public String uploadFile(@RequestParam MultipartFile file, @RequestParam String repositoryPath, RedirectAttributes redirectAttributes) throws IOException {
String mimeType = file.getContentType();
try {
if (mimeType.startsWith("image")) {
repositoryService.addImage(repositoryPath, file.getOriginalFilename(), file.getContentType(),
file.getBytes(), null);
repositoryService.addImage(repositoryPath, file.getOriginalFilename(), file.getContentType(), file.getBytes(), null);
} else {
repositoryService.addFile(repositoryPath, file.getOriginalFilename(), file.getContentType(),
file.getBytes(), null);
repositoryService.addFile(repositoryPath, file.getOriginalFilename(), file.getContentType(), file.getBytes(), null);
}
} catch (InvalidRepositoryPathException e) {
LOG.error("Invalid repository path!", e);
redirectAttributes.addAttribute("errorMessage", "Invalid repository path!");
redirectAttributes.addFlashAttribute("errorMessage", "Invalid repository path!");
} catch (InvalidRepositoryFileDataException e) {
LOG.error("Invalid file data!", e);
redirectAttributes.addAttribute("errorMessage", "Invalid file data!");
redirectAttributes.addFlashAttribute("errorMessage", "Invalid file data!");
}
redirectAttributes.addAttribute("repositoryPath", repositoryPath);
return "redirect:/admin/repository/files";
return "redirect:" + CONTROLLER_PATH + "/files" + repositoryPath;
}
@RequestMapping(value = "/update", method = RequestMethod.POST)
public String updateMetadata(@ModelAttribute RepositoryFile repositoryFile, @RequestParam String uuid,
@RequestParam String repositoryPath, RedirectAttributes redirectAttributes)
public String updateMetadata(@ModelAttribute RepositoryFile repositoryFile, @RequestParam String uuid, RedirectAttributes redirectAttributes)
throws NoSuchRepositoryFileException {
RepositoryFile updatedFile = repositoryService.getFile(UUID.fromString(uuid));
try {
updateMetadata(repositoryFile, updatedFile);
} catch (ParseException e) {
LOG.error("Incorrect date format. Should be 'yyyy-MM-dd HH:mm:ss'.", e);
redirectAttributes.addAttribute("errorMessage", "Incorrect date format. Should be 'yyyy-MM-dd HH:mm:ss'.");
redirectAttributes.addFlashAttribute("errorMessage", "Incorrect date format. Should be 'yyyy-MM-dd HH:mm:ss'.");
redirectAttributes.addAttribute("uuid", updatedFile.getUuid().toString());
return "redirect:/admin/repository/edit";
return "redirect:" + CONTROLLER_PATH + "/edit";
}
repositoryService.updateFile(updatedFile);
redirectAttributes.addAttribute("repositoryPath", repositoryPath);
updatedFile = repositoryService.updateFile(updatedFile);
return "redirect:/admin/repository/files";
return "redirect:" + CONTROLLER_PATH + "/files" + updatedFile.getPath();
}
@RequestMapping(value = "/delete", method = RequestMethod.POST)
public String deleteFile(@RequestParam String uuid, @RequestParam String repositoryPath,
RedirectAttributes redirectAttributes) throws NoSuchRepositoryFileException, IOException {
public String deleteFile(@RequestParam String uuid, RedirectAttributes redirectAttributes) throws NoSuchRepositoryFileException, IOException {
RepositoryFile repositoryFile = repositoryService.getFile(UUID.fromString(uuid));
repositoryService.removeFile(repositoryFile);
redirectAttributes.addAttribute("repositoryPath", repositoryPath);
return "redirect:/admin/repository/files";
return "redirect:" + CONTROLLER_PATH + "/files" + repositoryFile.getPath();
}
@InitBinder
......
/**
* Copyright 2016 Global Crop Diversity Trust
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
**/
package org.genesys2.server.servlet.controller.admin;
import javax.servlet.http.HttpServletRequest;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.genesys2.server.filerepository.NoSuchRepositoryFileException;
import org.genesys2.server.filerepository.model.ImageGallery;
import org.genesys2.server.filerepository.service.ImageGalleryService;
import org.genesys2.server.servlet.controller.BaseController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Sort;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.HandlerMapping;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
@Controller
@RequestMapping(RepositoryGalleryController.CONTROLLER_PATH)
@PreAuthorize("hasRole('ADMINISTRATOR')")
public class RepositoryGalleryController extends BaseController {
public static final String CONTROLLER_PATH = "/admin/r/g";
public static final String JSP_PATH = "/admin/repository/gallery";
public static final Log LOG = LogFactory.getLog(RepositoryGalleryController.class);
@Autowired
private ImageGalleryService imageGalleryService;
@RequestMapping(value = "", method = RequestMethod.GET)
public String listAllFiles(ModelMap model) {
return "redirect:" + CONTROLLER_PATH + "/1";
}
@RequestMapping(value = "/{page:\\d+}", method = RequestMethod.GET)
public String listAllFiles(ModelMap model, @PathVariable("page") int page) {
Page<ImageGallery> pagedData = imageGalleryService.listImageGalleries(new PageRequest(page - 1, 50, new Sort("path")));
model.addAttribute("pagedData", pagedData);
return JSP_PATH + "/index";
}
@RequestMapping(value = "/**", method = RequestMethod.GET)
public String listAllFiles(ModelMap model, HttpServletRequest request) {
String fullpath = (String) request.getAttribute(HandlerMapping.PATH_WITHIN_HANDLER_MAPPING_ATTRIBUTE);
fullpath = fullpath.substring(CONTROLLER_PATH.length());
ImageGallery imageGallery = imageGalleryService.loadImageGallery(fullpath);
imageGalleryService.ensureThumbnails(imageGallery, 200, 200);
model.addAttribute("thumbnailFormat", "200x200");
model.addAttribute("imageGallery", imageGallery);
return JSP_PATH + "/details";
}
@RequestMapping(value = "/edit", method = RequestMethod.GET)
public String getEditPage(@RequestParam String galleryPath, ModelMap model) throws NoSuchRepositoryFileException {
ImageGallery imageGallery = imageGalleryService.loadImageGallery(galleryPath);
if (imageGallery == null) {
imageGallery = new ImageGallery();
imageGallery.setPath(galleryPath);
}
model.addAttribute("imageGallery", imageGallery);
return JSP_PATH + "/edit";
}
@RequestMapping(value = "/update", method = RequestMethod.POST)
public String updateMetadata(@ModelAttribute ImageGallery imageGallery, RedirectAttributes redirectAttributes) throws NoSuchRepositoryFileException {
ImageGallery updatedGallery = imageGalleryService.loadImageGallery(imageGallery.getPath());
if (updatedGallery == null) {
updatedGallery = imageGalleryService.createImageGallery(imageGallery.getPath(), imageGallery.getTitle(), imageGallery.getDescription());
} else {
updatedGallery = imageGalleryService.updateImageGalery(updatedGallery, imageGallery.getTitle(), imageGallery.getDescription());
}
redirectAttributes.addFlashAttribute("successMessage", "repository.gallery.successfully-updated");
return "redirect:" + CONTROLLER_PATH;
}
@RequestMapping(value = "/delete", method = RequestMethod.POST)
public String deleteFile(@RequestParam String galleryPath, RedirectAttributes redirectAttributes) {
ImageGallery imageGallery = imageGalleryService.loadImageGallery(galleryPath);
imageGalleryService.removeGallery(imageGallery);
redirectAttributes.addFlashAttribute("successMessage", "repository.gallery.removed");
return "redirect:" + CONTROLLER_PATH;
}
}
......@@ -62,6 +62,7 @@ save=Save
create=Create
cancel=Cancel
delete=Delete
prompt.confirm-delete=Should we really delete the selected record?
jump-to-top=Back to top!
......@@ -649,6 +650,7 @@ session.expiry-extend=Extend session
download=Download
download.kml=Download KML
data-overview=Statistical overview
data-overview.intro=A statistical overview of the information stored in Genesys for the currently applied filters – everything from the total number of accessions by country, to the diversity of the collections.
data-overview.short=Overview
......@@ -683,6 +685,8 @@ menu.admin.caches=Caches
menu.admin.ds2=DS2 Datasets
menu.admin.usermanagement=User management
menu.admin.repository=Repository
menu.admin.repository.files=Repository file manager
menu.admin.repository.galleries=Image galleries
news.content.page.all.title=News list
news.archive.title=News Archive
......@@ -792,3 +796,15 @@ repository.file.extent=Extent
repository.file.bibliographicCitation=Bibliographic citation
repository.file.dateSubmitted=Date of submission
repository.file.lastModifiedDate=Last modified date
file.upload-file=Upload file
file.upload-file.help=Select file for upload from local computer
repository.gallery=Image gallery
repository.gallery.title=Title of image gallery:
repository.gallery.description=Description of the image gallery:
repository.gallery.path=Path for gallery images in the repository:
repository.gallery.successfully-updated=Image gallery successfully updated!
repository.gallery.removed=Image gallery was removed.
repository.gallery.create-here=Create image gallery!
repository.gallery.navigate=View image gallery!
......@@ -99,10 +99,23 @@
</li>
</ul>
</li>
<li>
<a class="" href="<c:url value="/1/admin/repository/files" />">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">
<spring:message code="menu.admin.repository" />
<span class="caret"></span>
</a>
<ul class="dropdown-menu pull-left">
<li>
<a href="<c:url value="/1/admin/r/files/" />">
<spring:message code="menu.admin.repository.files" />
</a>
</li>
<li>
<a href="<c:url value="/1/admin/r/g" />">
<spring:message code="menu.admin.repository.galleries" />
</a>
</li>
</ul>
</li>
<li>
<a class="" href="<c:url value="/1/admin/logger/" />">
......
<!DOCTYPE html>
<%@include file="/WEB-INF/jsp/init.jsp"%>
<html>
<head>
<title><spring:message code="admin.page.title" /></title>
</head>
<body>
<c:if test="${not empty errorMessage}">
<div class="alert alert-warning">${errorMessage}</div>
</c:if>
<div class="row">
<div class="col-md-12">
<form action="<c:url value="/admin/repository/upload"><c:param name="${_csrf.parameterName}" value="${_csrf.token}" /></c:url>"
method="post" enctype="multipart/form-data" class="form-inline">
<input type="hidden" name="repositoryPath" value="${currentPath}" />
<div class="form-group">
<label for="file">File to upload</label>
<input type="file" name="file" class="form-control" />
</div>
<button type="submit" class="btn btn-primary">Upload</button>
</form>
</div>
<%--<div class="col-md-1">--%>
<%--<form action="<c:out value="/admin/repository/upload" />" method="post">--%>
<%--<input type="file" name="image">--%>
<%--<button type="submit">Upload image</button>--%>
<%--</form>--%>
<%--</div>--%>
</div>
<table class="table table-striped">
<thead>
<tr>
<th class="col-xs-4"><spring:message code="repository.file.title" /> <small><spring:message code="repository.file.originalFilename" /></small></th>
<th class="col-xs-4"><spring:message code="repository.file.path" /></th>
<th class="col-xs-2"></th>
<th class="col-xs-5"></th>
</tr>
</thead>
<tbody>
<c:forEach var="file" items="${fileList}" varStatus="i">
<tr>
<td class="col-md-4">
<a href="<c:url value="/repository/d/${file.uuid}${file.extension}" />"> <c:out value="${file.title}" /> <small>${file.originalFilename}</small></a>
</td>
<td class="col-md-4">
<c:out value="${file.path}" />
</td>
<td class="col-md-2">
<a href="<c:url value="/admin/repository/edit" />?uuid=${file.uuid}&repositoryPath=${currentPath}"
class="btn btn-default">Edit metadata</a>
</td>
<td class="col-md-2">
<form action="<c:url value="/admin/repository/delete"><c:param name="${_csrf.parameterName}" value="${_csrf.token}" /></c:url>" method="post">
<input type="hidden" name="uuid" value="${file.uuid}">
<input type="hidden" name="repositoryPath" value="${currentPath}">
<input type="submit" value="Delete file" class="btn btn-default">
</form>
</td>
</tr>
</c:forEach>
</tbody>
</table>
</body>
</html>
......@@ -7,6 +7,6 @@
code="menu.admin.ds2"
/></a> <a class="" href="<c:url value="/admin/kpi/" />"><spring:message code="menu.admin.kpi" /></a>
<a href="<c:url value="/admin/elastic/" />" class="">Elasticsearch</a>
<a href="<c:url value="/admin/repository/files" />" class="">Repository</a>
<a href="<c:url value="/admin/r/files" />" class="">Repository</a>
</div>
</div>
<!DOCTYPE html>
<!DOCTYPE html>
<%@include file="/WEB-INF/jsp/init.jsp" %>
......@@ -9,12 +9,12 @@
<body>
<div class="row">
<div class="col-md-12">
<a href="<c:url value="/admin/repository/files" />?repositoryPath=${currentPath}" class="btn btn-default"><spring:message code="cancel" /></a>
<a href="<c:url value="/admin/r/files${currentPath}" />" class="btn btn-default"><spring:message code="cancel" /></a>
<h4>Updating metadata for file '${file.originalFilename}'</h4><br/>
<form action="<c:url value="/admin/repository/update" />?${_csrf.parameterName}=${_csrf.token}" method="post">
<form action="<c:url value="/admin/r/update" />" method="post">
<input type="hidden" name="${_csrf.parameterName}" value="${_csrf.token}" />
<input type="hidden" name="uuid" value="${file.uuid}">
<input type="hidden" name="repositoryPath" value="${currentPath}">
<div class="form-group">
<label for="title"><spring:message code="repository.file.title" /></label>
......@@ -28,7 +28,7 @@
<div class="form-group">
<label for="description"><spring:message code="repository.file.description" /></label>
<input type="text" id="description" name="description" value="${file.description}" class="form-control">
<textarea id="description" name="description" class="form-control"><c:out escapeXml="false" value="${file.description}" /></textarea>
</div>
<div class="form-group">
......
<!DOCTYPE html>
<%@include file="/WEB-INF/jsp/init.jsp"%>
<html>
<head>
<title><spring:message code="repository.gallery" /></title>
</head>
<body>
<h1>
<c:out value="${imageGallery.title}" />
</h1>
<div class="free-text">
<c:out value="${imageGallery.description}" />
</div>
<a href="<c:url value="/admin/r/g" />" class="btn btn-default"><spring:message code="cancel" /></a>
<a href="<c:url value="/admin/r/files${imageGallery.path}" />" class="btn btn-default"><spring:message code="navigate.back" /></a>
<div class="row">
<c:forEach items="${imageGallery.images}" var="image">
<div class="col-xs-6 col-sm-3 col-md-2 col-lg-2">
<img style="width: 100%; margin-bottom: 15px; margin-top: 15px;" src="<c:url value="/repository/d${image.path}_thumb/${thumbnailFormat}_${image.uuid}.png" />" alt="${image.title}" />
</div>
</c:forEach>
</div>
<div class="imagegallery-image-frame">
<img id="imagegallery-image" />
</div>
<content tag="javascript"> <script type="text/javascript">
$(document).ready(function() {
var imageViewer=$('#imagegallery-image')[0];
var baseHref = '<c:url value="/repository/d${imageGallery.path}" />';
var galleryImages = [<c:forEach items="${imageGallery.images}" var="image" varStatus="i">
'${image.uuid}${image.extension}'<c:if test="${not i.last}">,</c:if></c:forEach>
];
if (galleryImages.length > 0) {
imageViewer.src = baseHref + galleryImages[0];
}
});
</script> </content>
</body>
</html>
<!DOCTYPE html>
<%@include file="/WEB-INF/jsp/init.jsp"%>
<html>
<head>
<title><spring:message code="repository.gallery" /></title>
</head>
<body>
<div class="row">
<div class="col-md-12">
<a href="<c:url value="/admin/r/g" />" class="btn btn-default"><spring:message
code="cancel" /></a>
<h4>
Updating metadata for image gallery
<c:out value="${imageGallery.path}" />
</h4>
<form action="<c:url value="/admin/r/g/update" />" method="post">
<input type="hidden" name="${_csrf.parameterName}" value="${_csrf.token}" />
<input type="hidden" name="path" value="<c:out value="${imageGallery.path}" />">
<div class="form-group">
<label for="title"><spring:message
code="repository.gallery.title" /></label> <input type="text" id="title"
name="title" value="<c:out value="${imageGallery.title}" />"
class="form-control">
</div>
<div class="form-group">
<label for="title"><spring:message
code="repository.gallery.path" /></label> <span class=""><c:out
value="${imageGallery.path}" /></span>
</div>
<div class="form-group">
<label for="subject"><spring:message
code="repository.gallery.description" /></label>
<textarea id="description" name="description" class="form-control"><c:out
escapeXml="false" value="${imageGallery.description}" /></textarea>
</div>
<button type="submit" class="btn btn-default">
<spring:message code="save" />
</button>
</form>
</div>
</div>
</body>
</html>
<!DOCTYPE html>
<%@include file="/WEB-INF/jsp/init.jsp"%>
<html>
<head>
<title><spring:message code="menu.admin.repository.galleries" /></title>
</head>
<body>
<c:if test="${not empty errorMessage}">
<div class="alert alert-warning">${errorMessage}</div>