CCM NG: Several bugfixes
git-svn-id: https://svn.libreccm.org/ccm/ccm_ng@5147 8810af33-2d31-482b-a856-94f89814c4df
parent
cec82010a0
commit
d31f3781c0
|
|
@ -71,6 +71,15 @@
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.fasterxml.jackson.jaxrs</groupId>
|
||||||
|
<artifactId>jackson-jaxrs-json-provider</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.fasterxml.jackson.jaxrs</groupId>
|
||||||
|
<artifactId>jackson-jaxrs-xml-provider</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<!-- Dependencies for log4j 2 -->
|
<!-- Dependencies for log4j 2 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.logging.log4j</groupId>
|
<groupId>org.apache.logging.log4j</groupId>
|
||||||
|
|
|
||||||
|
|
@ -142,7 +142,9 @@ public class ItemListComponentForm
|
||||||
|
|
||||||
final ItemListComponent component = getComponentModel();
|
final ItemListComponent component = getComponentModel();
|
||||||
|
|
||||||
if (component != null) {
|
if (component == null) {
|
||||||
|
pageSizeField.setValue(state, "30");
|
||||||
|
}else {
|
||||||
final Object[] descendingValue;
|
final Object[] descendingValue;
|
||||||
if (component.isDescending()) {
|
if (component.isDescending()) {
|
||||||
descendingValue = new Object[]{DESCENDING};
|
descendingValue = new Object[]{DESCENDING};
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,10 @@ package org.librecms.pages;
|
||||||
|
|
||||||
import com.arsdigita.kernel.KernelConfig;
|
import com.arsdigita.kernel.KernelConfig;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||||
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
import com.fasterxml.jackson.dataformat.xml.JacksonXmlModule;
|
||||||
|
import com.fasterxml.jackson.dataformat.xml.XmlMapper;
|
||||||
import org.libreccm.categorization.Category;
|
import org.libreccm.categorization.Category;
|
||||||
import org.libreccm.categorization.CategoryRepository;
|
import org.libreccm.categorization.CategoryRepository;
|
||||||
import org.libreccm.configuration.ConfigurationManager;
|
import org.libreccm.configuration.ConfigurationManager;
|
||||||
|
|
@ -43,6 +47,7 @@ import javax.enterprise.context.RequestScoped;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.transaction.Transactional;
|
import javax.transaction.Transactional;
|
||||||
import javax.ws.rs.DefaultValue;
|
import javax.ws.rs.DefaultValue;
|
||||||
|
import javax.ws.rs.GET;
|
||||||
import javax.ws.rs.NotFoundException;
|
import javax.ws.rs.NotFoundException;
|
||||||
import javax.ws.rs.Path;
|
import javax.ws.rs.Path;
|
||||||
import javax.ws.rs.PathParam;
|
import javax.ws.rs.PathParam;
|
||||||
|
|
@ -61,7 +66,8 @@ import static org.librecms.pages.PagesConstants.*;
|
||||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
*/
|
*/
|
||||||
@RequestScoped
|
@RequestScoped
|
||||||
@Path("/{page:.+}")
|
//@Path("/{page:.+}")
|
||||||
|
@Path("/")
|
||||||
public class PagesRouter {
|
public class PagesRouter {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
|
|
@ -100,6 +106,272 @@ public class PagesRouter {
|
||||||
defaultLocale = kernelConfig.getDefaultLocale();
|
defaultLocale = kernelConfig.getDefaultLocale();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GET
|
||||||
|
@Path("/")
|
||||||
|
@Transactional(Transactional.TxType.REQUIRED)
|
||||||
|
public Response getIndexPage(@Context UriInfo uriInfo) {
|
||||||
|
|
||||||
|
final String domain = uriInfo.getBaseUri().getHost();
|
||||||
|
final Pages pages = getPages(domain);
|
||||||
|
final Category category = getCategory(domain, pages, "/");
|
||||||
|
|
||||||
|
final Locale negoidatedLocale = globalizationHelper
|
||||||
|
.getNegotiatedLocale();
|
||||||
|
|
||||||
|
final String language;
|
||||||
|
if (category.getTitle().hasValue(negoidatedLocale)) {
|
||||||
|
language = negoidatedLocale.toString();
|
||||||
|
} else if (category.getTitle().hasValue(defaultLocale)) {
|
||||||
|
language = defaultLocale.toString();
|
||||||
|
} else {
|
||||||
|
throw new NotFoundException();
|
||||||
|
}
|
||||||
|
|
||||||
|
final String indexPage = String.format("/index.%s.html", language);
|
||||||
|
final URI uri = uriInfo.getBaseUriBuilder().path(indexPage).build();
|
||||||
|
return Response.temporaryRedirect(uri).build();
|
||||||
|
}
|
||||||
|
|
||||||
|
@GET
|
||||||
|
@Path("/index.html")
|
||||||
|
@Transactional(Transactional.TxType.REQUIRED)
|
||||||
|
public Response getIndexPageAsHtml(@Context final UriInfo uriInfo) {
|
||||||
|
|
||||||
|
final String domain = uriInfo.getBaseUri().getHost();
|
||||||
|
final Pages pages = getPages(domain);
|
||||||
|
final Category category = getCategory(domain, pages, "/");
|
||||||
|
|
||||||
|
final Locale negoiatedLocale = globalizationHelper
|
||||||
|
.getNegotiatedLocale();
|
||||||
|
final String language;
|
||||||
|
if (category.getTitle().hasValue(negoiatedLocale)) {
|
||||||
|
language = negoiatedLocale.toString();
|
||||||
|
} else if (category.getTitle().hasValue(defaultLocale)) {
|
||||||
|
language = defaultLocale.toString();
|
||||||
|
} else {
|
||||||
|
throw new NotFoundException();
|
||||||
|
}
|
||||||
|
|
||||||
|
final String indexPage = String.format("/index.%s.html", language);
|
||||||
|
final String path = uriInfo.getPath().replace("index.html", indexPage);
|
||||||
|
|
||||||
|
final URI uri = uriInfo.getBaseUriBuilder().replacePath(path).build();
|
||||||
|
return Response.temporaryRedirect(uri).build();
|
||||||
|
}
|
||||||
|
|
||||||
|
@GET
|
||||||
|
@Path("/index.{lang}.html")
|
||||||
|
@Produces("text/html")
|
||||||
|
@Transactional(Transactional.TxType.REQUIRED)
|
||||||
|
public String getIndexPageAsHtml(
|
||||||
|
@Context
|
||||||
|
final UriInfo uriInfo,
|
||||||
|
@PathParam("lang")
|
||||||
|
final String language,
|
||||||
|
@QueryParam("theme")
|
||||||
|
@DefaultValue("--DEFAULT--")
|
||||||
|
final String theme,
|
||||||
|
@QueryParam("theme-version")
|
||||||
|
@DefaultValue("LIVE")
|
||||||
|
final String themeVersion,
|
||||||
|
@QueryParam("pagemodel-version")
|
||||||
|
@DefaultValue("LIVE") final String pageModelVersion) {
|
||||||
|
|
||||||
|
final Map<String, Object> buildResult = getCategoryIndexPage(
|
||||||
|
uriInfo, "/", language, pageModelVersion);
|
||||||
|
final Site site = getSite(uriInfo);
|
||||||
|
final ThemeInfo themeInfo = getTheme(site, theme, themeVersion);
|
||||||
|
|
||||||
|
return themes.process(buildResult, themeInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GET
|
||||||
|
@Path("/index.{lang}.json")
|
||||||
|
@Produces("text/json")
|
||||||
|
@Transactional(Transactional.TxType.REQUIRED)
|
||||||
|
public String getIndexPageAsJson(
|
||||||
|
@Context
|
||||||
|
final UriInfo uriInfo,
|
||||||
|
@PathParam("lang")
|
||||||
|
final String language,
|
||||||
|
@QueryParam("pagemodel-version")
|
||||||
|
@DefaultValue("LIVE")
|
||||||
|
final String pageModelVersion) {
|
||||||
|
|
||||||
|
final ObjectMapper mapper = new ObjectMapper();
|
||||||
|
|
||||||
|
try {
|
||||||
|
return mapper
|
||||||
|
.writeValueAsString(getCategoryIndexPage(uriInfo,
|
||||||
|
"/",
|
||||||
|
language,
|
||||||
|
pageModelVersion));
|
||||||
|
} catch (JsonProcessingException ex) {
|
||||||
|
throw new WebApplicationException(ex);
|
||||||
|
}
|
||||||
|
// return getCategoryIndexPage(uriInfo, "/", language, pageModelVersion);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GET
|
||||||
|
@Path("/index.{lang}.xml")
|
||||||
|
@Produces("text/xml")
|
||||||
|
@Transactional(Transactional.TxType.REQUIRED)
|
||||||
|
public String getIndexPageAsXml(
|
||||||
|
@Context
|
||||||
|
final UriInfo uriInfo,
|
||||||
|
@PathParam("lang")
|
||||||
|
final String language,
|
||||||
|
@QueryParam("pagemodel-version")
|
||||||
|
@DefaultValue("LIVE")
|
||||||
|
final String pageModelVersion) {
|
||||||
|
|
||||||
|
final JacksonXmlModule xmlModule = new JacksonXmlModule();
|
||||||
|
final ObjectMapper mapper = new XmlMapper(xmlModule);
|
||||||
|
|
||||||
|
try {
|
||||||
|
return mapper
|
||||||
|
.writeValueAsString(getCategoryIndexPage(uriInfo, "/",
|
||||||
|
language,
|
||||||
|
pageModelVersion));
|
||||||
|
} catch (JsonProcessingException ex) {
|
||||||
|
throw new WebApplicationException(ex);
|
||||||
|
}
|
||||||
|
// return getCategoryIndexPage(uriInfo, "/", language, pageModelVersion);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GET
|
||||||
|
@Path("/{name}")
|
||||||
|
@Transactional(Transactional.TxType.REQUIRED)
|
||||||
|
public Response getRootItemPage(
|
||||||
|
@Context final UriInfo uriInfo,
|
||||||
|
@PathParam("name") final String itemName) {
|
||||||
|
|
||||||
|
final String domain = uriInfo.getBaseUri().getHost();
|
||||||
|
final Pages pages = getPages(domain);
|
||||||
|
final Category category = getCategory(domain, pages, "/");
|
||||||
|
|
||||||
|
final Locale negoiatedLocale = globalizationHelper
|
||||||
|
.getNegotiatedLocale();
|
||||||
|
|
||||||
|
final String language;
|
||||||
|
if (category.getTitle().hasValue(negoiatedLocale)) {
|
||||||
|
language = negoiatedLocale.toString();
|
||||||
|
} else if (category.getTitle().hasValue(defaultLocale)) {
|
||||||
|
language = defaultLocale.toString();
|
||||||
|
} else {
|
||||||
|
throw new NotFoundException();
|
||||||
|
}
|
||||||
|
|
||||||
|
final String itemPage = String.format("/%s.%s.html", itemName, language);
|
||||||
|
final URI uri = uriInfo.getBaseUriBuilder().path(itemPage).build();
|
||||||
|
return Response.temporaryRedirect(uri).build();
|
||||||
|
}
|
||||||
|
|
||||||
|
@GET
|
||||||
|
@Path("/{name}.html")
|
||||||
|
@Transactional(Transactional.TxType.REQUIRED)
|
||||||
|
public Response getRootItemPageAsHtml(
|
||||||
|
@Context final UriInfo uriInfo,
|
||||||
|
@PathParam("name") final String itemName) {
|
||||||
|
|
||||||
|
final String domain = uriInfo.getBaseUri().getHost();
|
||||||
|
final Pages pages = getPages(domain);
|
||||||
|
final Category category = getCategory(domain, pages, "/");
|
||||||
|
|
||||||
|
final Locale negoiatedLocale = globalizationHelper
|
||||||
|
.getNegotiatedLocale();
|
||||||
|
|
||||||
|
final String language;
|
||||||
|
if (category.getTitle().hasValue(negoiatedLocale)) {
|
||||||
|
language = negoiatedLocale.toString();
|
||||||
|
} else if (category.getTitle().hasValue(defaultLocale)) {
|
||||||
|
language = defaultLocale.toString();
|
||||||
|
} else {
|
||||||
|
throw new NotFoundException();
|
||||||
|
}
|
||||||
|
|
||||||
|
final String itemPage = String.format("/%s.%s.html", itemName, language);
|
||||||
|
final String path = uriInfo
|
||||||
|
.getPath()
|
||||||
|
.replace(String.format("%s.html", itemName), itemPage);
|
||||||
|
|
||||||
|
final URI uri = uriInfo.getBaseUriBuilder().replacePath(path).build();
|
||||||
|
return Response.temporaryRedirect(uri).build();
|
||||||
|
}
|
||||||
|
|
||||||
|
@GET
|
||||||
|
@Path("/{name}.{lang}.html")
|
||||||
|
@Produces("text/html")
|
||||||
|
@Transactional(Transactional.TxType.REQUIRED)
|
||||||
|
public String getRootItemPageAsHtml(
|
||||||
|
@Context
|
||||||
|
final UriInfo uriInfo,
|
||||||
|
@PathParam("name")
|
||||||
|
final String itemName,
|
||||||
|
@PathParam("lang")
|
||||||
|
final String language,
|
||||||
|
@QueryParam("theme")
|
||||||
|
@DefaultValue("--DEFAULT--")
|
||||||
|
final String theme,
|
||||||
|
@QueryParam("theme-version")
|
||||||
|
@DefaultValue("LIVE")
|
||||||
|
final String themeVersion,
|
||||||
|
@QueryParam("pagemodel-version")
|
||||||
|
@DefaultValue("LIVE")
|
||||||
|
final String pageModelVersion) {
|
||||||
|
|
||||||
|
final Map<String, Object> buildResult = getCategoryItemPage(
|
||||||
|
uriInfo, "/", itemName, language, pageModelVersion);
|
||||||
|
final Site site = getSite(uriInfo);
|
||||||
|
final ThemeInfo themeInfo = getTheme(site, "/", themeVersion);
|
||||||
|
|
||||||
|
return themes.process(buildResult, themeInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GET
|
||||||
|
@Path("/{name}.{lang}.json")
|
||||||
|
@Produces("text/json")
|
||||||
|
@Transactional(Transactional.TxType.REQUIRED)
|
||||||
|
public Map<String, Object> getRootItemPageAsJson(
|
||||||
|
@Context
|
||||||
|
final UriInfo uriInfo,
|
||||||
|
@PathParam("name")
|
||||||
|
final String itemName,
|
||||||
|
@PathParam("lang")
|
||||||
|
final String language,
|
||||||
|
@QueryParam("pagemodel-version")
|
||||||
|
@DefaultValue("LIVE")
|
||||||
|
final String pageModelVersion) {
|
||||||
|
|
||||||
|
return getCategoryItemPage(uriInfo,
|
||||||
|
"/",
|
||||||
|
itemName,
|
||||||
|
language,
|
||||||
|
pageModelVersion);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GET
|
||||||
|
@Path("/{name}.{lang}.xml")
|
||||||
|
@Produces("text/xml")
|
||||||
|
@Transactional(Transactional.TxType.REQUIRED)
|
||||||
|
public Map<String, Object> getItemPageAsXml(
|
||||||
|
@Context
|
||||||
|
final UriInfo uriInfo,
|
||||||
|
@PathParam("name")
|
||||||
|
final String itemName,
|
||||||
|
@PathParam("lang")
|
||||||
|
final String language,
|
||||||
|
@QueryParam("pagemodel-version")
|
||||||
|
@DefaultValue("LIVE")
|
||||||
|
final String pageModelVersion) {
|
||||||
|
|
||||||
|
return getCategoryItemPage(uriInfo,
|
||||||
|
"/",
|
||||||
|
itemName,
|
||||||
|
language,
|
||||||
|
pageModelVersion);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieve the index page of a category. Redirects to
|
* Retrieve the index page of a category. Redirects to
|
||||||
* {@link #getCategoryIndexPageAsHtml(javax.ws.rs.core.UriInfo, java.lang.String)}.
|
* {@link #getCategoryIndexPageAsHtml(javax.ws.rs.core.UriInfo, java.lang.String)}.
|
||||||
|
|
@ -109,7 +381,9 @@ public class PagesRouter {
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Path("/")
|
@GET
|
||||||
|
@Path("/{page:.+}/")
|
||||||
|
@Transactional(Transactional.TxType.REQUIRED)
|
||||||
public Response getCategoryIndexPage(
|
public Response getCategoryIndexPage(
|
||||||
@Context
|
@Context
|
||||||
final UriInfo uriInfo,
|
final UriInfo uriInfo,
|
||||||
|
|
@ -146,7 +420,9 @@ public class PagesRouter {
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Path("/index.html")
|
@GET
|
||||||
|
@Path("/{page:.+}/index.html")
|
||||||
|
@Transactional(Transactional.TxType.REQUIRED)
|
||||||
public Response getCategoryIndexPageAsHtml(
|
public Response getCategoryIndexPageAsHtml(
|
||||||
@Context
|
@Context
|
||||||
final UriInfo uriInfo,
|
final UriInfo uriInfo,
|
||||||
|
|
@ -187,7 +463,8 @@ public class PagesRouter {
|
||||||
*
|
*
|
||||||
* @return The HTML representation of the index page.
|
* @return The HTML representation of the index page.
|
||||||
*/
|
*/
|
||||||
@Path("/index.{lang}.html")
|
@GET
|
||||||
|
@Path("/{page:.+}/index.{lang}.html")
|
||||||
@Produces("text/html")
|
@Produces("text/html")
|
||||||
@Transactional(Transactional.TxType.REQUIRED)
|
@Transactional(Transactional.TxType.REQUIRED)
|
||||||
public String getCategoryIndexPageAsHtml(
|
public String getCategoryIndexPageAsHtml(
|
||||||
|
|
@ -225,7 +502,8 @@ public class PagesRouter {
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Path("/index.{lang}.json")
|
@GET
|
||||||
|
@Path("/{page:.+}/index.{lang}.json")
|
||||||
@Produces("text/json")
|
@Produces("text/json")
|
||||||
@Transactional(Transactional.TxType.REQUIRED)
|
@Transactional(Transactional.TxType.REQUIRED)
|
||||||
public Map<String, Object> getCategoryIndexPageAsJson(
|
public Map<String, Object> getCategoryIndexPageAsJson(
|
||||||
|
|
@ -252,7 +530,8 @@ public class PagesRouter {
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Path("/index.{lang}.xml")
|
@GET
|
||||||
|
@Path("/{page:.+}/index.{lang}.xml")
|
||||||
@Produces("text/xml")
|
@Produces("text/xml")
|
||||||
@Transactional(Transactional.TxType.REQUIRED)
|
@Transactional(Transactional.TxType.REQUIRED)
|
||||||
public Map<String, Object> getCategoryIndexPageAsXml(
|
public Map<String, Object> getCategoryIndexPageAsXml(
|
||||||
|
|
@ -282,7 +561,9 @@ public class PagesRouter {
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Path("/{name}")
|
@GET
|
||||||
|
@Path("/{page:.+}/{name}")
|
||||||
|
@Transactional(Transactional.TxType.REQUIRED)
|
||||||
public Response getItemPage(
|
public Response getItemPage(
|
||||||
@Context final UriInfo uriInfo,
|
@Context final UriInfo uriInfo,
|
||||||
@PathParam("page") final String page,
|
@PathParam("page") final String page,
|
||||||
|
|
@ -320,7 +601,9 @@ public class PagesRouter {
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Path("/{name}.html")
|
@GET
|
||||||
|
@Path("/{page:.+}/{name}.html")
|
||||||
|
@Transactional(Transactional.TxType.REQUIRED)
|
||||||
public Response getItemPageAsHtml(
|
public Response getItemPageAsHtml(
|
||||||
@Context final UriInfo uriInfo,
|
@Context final UriInfo uriInfo,
|
||||||
@PathParam("page") final String page,
|
@PathParam("page") final String page,
|
||||||
|
|
@ -365,7 +648,9 @@ public class PagesRouter {
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Path("/{name}.{lang}.html")
|
@GET
|
||||||
|
@Path("/{page:.+}/{name}.{lang}.html")
|
||||||
|
@Transactional(Transactional.TxType.REQUIRED)
|
||||||
public String getItemPageAsHtml(
|
public String getItemPageAsHtml(
|
||||||
@Context
|
@Context
|
||||||
final UriInfo uriInfo,
|
final UriInfo uriInfo,
|
||||||
|
|
@ -405,8 +690,10 @@ public class PagesRouter {
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Path("/{name}.{lang}.json")
|
@GET
|
||||||
|
@Path("/{page:.+}/{name}.{lang}.json")
|
||||||
@Produces("text/json")
|
@Produces("text/json")
|
||||||
|
@Transactional(Transactional.TxType.REQUIRED)
|
||||||
public Map<String, Object> getItemPageAsJson(
|
public Map<String, Object> getItemPageAsJson(
|
||||||
@Context
|
@Context
|
||||||
final UriInfo uriInfo,
|
final UriInfo uriInfo,
|
||||||
|
|
@ -439,8 +726,10 @@ public class PagesRouter {
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Path("/{name}.{lang}.xml")
|
@GET
|
||||||
|
@Path("/{page:.+}/{name}.{lang}.xml")
|
||||||
@Produces("text/xml")
|
@Produces("text/xml")
|
||||||
|
@Transactional(Transactional.TxType.REQUIRED)
|
||||||
public Map<String, Object> getItemPageAsXml(
|
public Map<String, Object> getItemPageAsXml(
|
||||||
@Context
|
@Context
|
||||||
final UriInfo uriInfo,
|
final UriInfo uriInfo,
|
||||||
|
|
@ -513,8 +802,8 @@ public class PagesRouter {
|
||||||
.orElseThrow(() -> new WebApplicationException(
|
.orElseThrow(() -> new WebApplicationException(
|
||||||
String.format("The configured default theme \"%s\" for "
|
String.format("The configured default theme \"%s\" for "
|
||||||
+ "site \"%s\" is not available.",
|
+ "site \"%s\" is not available.",
|
||||||
site.getDomainOfSite(),
|
site.getDefaultTheme(),
|
||||||
site.getDefaultTheme()),
|
site.getDomainOfSite()),
|
||||||
Response.Status.INTERNAL_SERVER_ERROR));
|
Response.Status.INTERNAL_SERVER_ERROR));
|
||||||
} else {
|
} else {
|
||||||
return themes.getTheme(theme,
|
return themes.getTheme(theme,
|
||||||
|
|
@ -578,8 +867,8 @@ public class PagesRouter {
|
||||||
|
|
||||||
final PageModel pageModel;
|
final PageModel pageModel;
|
||||||
if ("DRAFT".equals(pageModelVersion)) {
|
if ("DRAFT".equals(pageModelVersion)) {
|
||||||
pageModel = pageModelManager.getDraftVersion(page
|
pageModel = pageModelManager
|
||||||
.getIndexPageModel());
|
.getDraftVersion(page.getIndexPageModel());
|
||||||
} else {
|
} else {
|
||||||
pageModel = pageModelManager
|
pageModel = pageModelManager
|
||||||
.getLiveVersion(page.getIndexPageModel())
|
.getLiveVersion(page.getIndexPageModel())
|
||||||
|
|
|
||||||
|
|
@ -30,10 +30,6 @@ import org.libreccm.web.ApplicationType;
|
||||||
import org.libreccm.web.CcmApplication;
|
import org.libreccm.web.CcmApplication;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.ResourceBundle;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
@ -64,6 +60,7 @@ class ApplicationTreeDataProvider
|
||||||
rootNode = new ApplicationTreeNode();
|
rootNode = new ApplicationTreeNode();
|
||||||
rootNode.setNodeId(ApplicationTreeNode.ROOT);
|
rootNode.setNodeId(ApplicationTreeNode.ROOT);
|
||||||
rootNode.setNodeType(ApplicationTreeNodeType.ROOT_NODE);
|
rootNode.setNodeType(ApplicationTreeNodeType.ROOT_NODE);
|
||||||
|
rootNode.setTitle("/");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional(Transactional.TxType.REQUIRED)
|
@Transactional(Transactional.TxType.REQUIRED)
|
||||||
|
|
|
||||||
|
|
@ -56,9 +56,7 @@ class PageModelsTab extends CustomComponent {
|
||||||
|
|
||||||
final Tree<ApplicationTreeNode> applicationTree = new Tree<>(
|
final Tree<ApplicationTreeNode> applicationTree = new Tree<>(
|
||||||
adminViewController.getApplicationTreeDataProvider());
|
adminViewController.getApplicationTreeDataProvider());
|
||||||
|
|
||||||
applicationTree.setItemCaptionGenerator(ApplicationTreeNode::getTitle);
|
applicationTree.setItemCaptionGenerator(ApplicationTreeNode::getTitle);
|
||||||
|
|
||||||
applicationTree.setItemCollapseAllowedProvider(node -> {
|
applicationTree.setItemCollapseAllowedProvider(node -> {
|
||||||
return !node.getNodeType().equals(ApplicationTreeNodeType.ROOT_NODE);
|
return !node.getNodeType().equals(ApplicationTreeNodeType.ROOT_NODE);
|
||||||
});
|
});
|
||||||
|
|
@ -99,27 +97,41 @@ class PageModelsTab extends CustomComponent {
|
||||||
.addComponentColumn(row -> buildDeleteButton(row,
|
.addComponentColumn(row -> buildDeleteButton(row,
|
||||||
adminViewController))
|
adminViewController))
|
||||||
.setId(COL_DELETE);
|
.setId(COL_DELETE);
|
||||||
|
|
||||||
pageModelsGrid.setVisible(false);
|
pageModelsGrid.setVisible(false);
|
||||||
|
pageModelsGrid.setWidth("100%");
|
||||||
|
|
||||||
final Label placeholder = new Label(localizedTextsUtil.getText(
|
final Label placeholder = new Label(localizedTextsUtil.getText(
|
||||||
"ui.admin.pagemodels.select_application"));
|
"ui.admin.pagemodels.select_application"));
|
||||||
|
|
||||||
final VerticalLayout layout = new VerticalLayout(pageModelsGrid,
|
final VerticalLayout layout = new VerticalLayout(pageModelsGrid,
|
||||||
placeholder);
|
placeholder);
|
||||||
|
layout.setWidth("100%");
|
||||||
|
|
||||||
applicationTree.addItemClickListener(event -> {
|
applicationTree.addItemClickListener(event -> {
|
||||||
|
|
||||||
|
final ApplicationTreeNode node = event.getItem();
|
||||||
|
final ApplicationTreeNodeType nodeType = node.getNodeType();
|
||||||
|
|
||||||
|
if (nodeType == ApplicationTreeNodeType.APPLICATION_NODE
|
||||||
|
|| nodeType
|
||||||
|
== ApplicationTreeNodeType.SINGLETON_APPLICATION_NODE) {
|
||||||
final PageModelsTableDataProvider dataProvider
|
final PageModelsTableDataProvider dataProvider
|
||||||
= (PageModelsTableDataProvider) pageModelsGrid
|
= (PageModelsTableDataProvider) pageModelsGrid
|
||||||
.getDataProvider();
|
.getDataProvider();
|
||||||
dataProvider.setApplicationUuid(event.getItem().getNodeId());
|
dataProvider.setApplicationUuid(node.getNodeId());
|
||||||
pageModelsGrid.setVisible(true);
|
pageModelsGrid.setVisible(true);
|
||||||
placeholder.setVisible(false);
|
placeholder.setVisible(false);
|
||||||
|
} else {
|
||||||
|
pageModelsGrid.setVisible(false);
|
||||||
|
placeholder.setVisible(true);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
final VerticalLayout treeLayout = new VerticalLayout(applicationTree);
|
||||||
|
|
||||||
final HorizontalSplitPanel panel = new HorizontalSplitPanel(
|
final HorizontalSplitPanel panel = new HorizontalSplitPanel(
|
||||||
applicationTree, layout);
|
treeLayout, layout);
|
||||||
panel.setSplitPosition(33.0f);
|
panel.setSplitPosition(20.0f);
|
||||||
super.setCompositionRoot(panel);
|
super.setCompositionRoot(panel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -160,6 +160,9 @@ public class CategoryRepository extends AbstractEntityRepository<Long, Category>
|
||||||
+ "domain \"{}\".",
|
+ "domain \"{}\".",
|
||||||
normalizedPath,
|
normalizedPath,
|
||||||
domain.getDomainKey());
|
domain.getDomainKey());
|
||||||
|
if (normalizedPath.isEmpty()) {
|
||||||
|
return Optional.of(domain.getRoot());
|
||||||
|
}
|
||||||
final String[] tokens = normalizedPath.split("/");
|
final String[] tokens = normalizedPath.split("/");
|
||||||
Category current = domain.getRoot();
|
Category current = domain.getRoot();
|
||||||
for (final String token : tokens) {
|
for (final String token : tokens) {
|
||||||
|
|
|
||||||
|
|
@ -194,11 +194,11 @@ public class StaticThemeProvider implements ThemeProvider {
|
||||||
Objects.requireNonNull(theme);
|
Objects.requireNonNull(theme);
|
||||||
|
|
||||||
final String manifestJsonPath = String.format("/" + THEMES_PACKAGE
|
final String manifestJsonPath = String.format("/" + THEMES_PACKAGE
|
||||||
+ "%s/"
|
+ "/%s/"
|
||||||
+ THEME_MANIFEST_JSON,
|
+ THEME_MANIFEST_JSON,
|
||||||
theme);
|
theme);
|
||||||
final String manifestXmlPath = String.format("/" + THEMES_PACKAGE
|
final String manifestXmlPath = String.format("/" + THEMES_PACKAGE
|
||||||
+ "%s/"
|
+ "/%s/"
|
||||||
+ THEME_MANIFEST_XML,
|
+ THEME_MANIFEST_XML,
|
||||||
theme);
|
theme);
|
||||||
|
|
||||||
|
|
@ -227,11 +227,11 @@ public class StaticThemeProvider implements ThemeProvider {
|
||||||
Objects.requireNonNull(theme);
|
Objects.requireNonNull(theme);
|
||||||
|
|
||||||
final String manifestJsonPath = String.format("/" + THEMES_PACKAGE
|
final String manifestJsonPath = String.format("/" + THEMES_PACKAGE
|
||||||
+ "%s/"
|
+ "/%s/"
|
||||||
+ THEME_MANIFEST_JSON,
|
+ THEME_MANIFEST_JSON,
|
||||||
theme);
|
theme);
|
||||||
final String manifestXmlPath = String.format("/" + THEMES_PACKAGE
|
final String manifestXmlPath = String.format("/" + THEMES_PACKAGE
|
||||||
+ "%s/"
|
+ "/%s/"
|
||||||
+ THEME_MANIFEST_XML,
|
+ THEME_MANIFEST_XML,
|
||||||
theme);
|
theme);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,7 @@ import javax.xml.parsers.ParserConfigurationException;
|
||||||
|
|
||||||
import static org.libreccm.theming.ThemeConstants.*;
|
import static org.libreccm.theming.ThemeConstants.*;
|
||||||
|
|
||||||
import org.libreccm.theming.ThemeVersion;
|
import org.libreccm.theming.ProcessesThemes;
|
||||||
import org.libreccm.theming.manifest.ThemeTemplate;
|
import org.libreccm.theming.manifest.ThemeTemplate;
|
||||||
|
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
|
@ -50,7 +50,6 @@ import java.io.UnsupportedEncodingException;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
import javax.xml.transform.Result;
|
import javax.xml.transform.Result;
|
||||||
import javax.xml.transform.Source;
|
|
||||||
import javax.xml.transform.Transformer;
|
import javax.xml.transform.Transformer;
|
||||||
import javax.xml.transform.TransformerConfigurationException;
|
import javax.xml.transform.TransformerConfigurationException;
|
||||||
import javax.xml.transform.TransformerException;
|
import javax.xml.transform.TransformerException;
|
||||||
|
|
@ -64,6 +63,7 @@ import javax.xml.transform.stream.StreamSource;
|
||||||
*
|
*
|
||||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
*/
|
*/
|
||||||
|
@ProcessesThemes("xsl")
|
||||||
@RequestScoped
|
@RequestScoped
|
||||||
public class XsltThemeProcessor implements ThemeProcessor {
|
public class XsltThemeProcessor implements ThemeProcessor {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1081,7 +1081,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
.v-vaadin-version:after {
|
.v-vaadin-version:after {
|
||||||
content: "8.1.6";
|
content: "8.1.7";
|
||||||
}
|
}
|
||||||
|
|
||||||
.v-widget {
|
.v-widget {
|
||||||
|
|
@ -1172,7 +1172,7 @@
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
.v-assistive-device-only {
|
.v-assistive-device-only, .v-assistive-device-only-label label {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: -2000px;
|
top: -2000px;
|
||||||
left: -2000px;
|
left: -2000px;
|
||||||
|
|
|
||||||
28
pom.xml
28
pom.xml
|
|
@ -272,7 +272,7 @@
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>com.vaadin</groupId>
|
<groupId>com.vaadin</groupId>
|
||||||
<artifactId>vaadin-maven-plugin</artifactId>
|
<artifactId>vaadin-maven-plugin</artifactId>
|
||||||
<version>8.1.6</version>
|
<version>8.1.7</version>
|
||||||
</plugin>
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
</pluginManagement>
|
</pluginManagement>
|
||||||
|
|
@ -422,7 +422,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.vaadin</groupId>
|
<groupId>com.vaadin</groupId>
|
||||||
<artifactId>vaadin-bom</artifactId>
|
<artifactId>vaadin-bom</artifactId>
|
||||||
<version>8.1.6</version>
|
<version>8.1.7</version>
|
||||||
<scope>import</scope>
|
<scope>import</scope>
|
||||||
<type>pom</type>
|
<type>pom</type>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
@ -606,10 +606,17 @@
|
||||||
<version>1.2</version>
|
<version>1.2</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.fasterxml.jackson</groupId>
|
||||||
|
<artifactId>jackson-bom</artifactId>
|
||||||
|
<version>2.9.0</version>
|
||||||
|
<scope>import</scope>
|
||||||
|
<type>pom</type>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<!-- Export Import Libraries -->
|
<!-- Export Import Libraries -->
|
||||||
|
|
||||||
<dependency>
|
<!--<dependency>
|
||||||
<groupId>com.fasterxml.jackson.core</groupId>
|
<groupId>com.fasterxml.jackson.core</groupId>
|
||||||
<artifactId>jackson-core</artifactId>
|
<artifactId>jackson-core</artifactId>
|
||||||
<version>${jackson-core-version}</version>
|
<version>${jackson-core-version}</version>
|
||||||
|
|
@ -628,22 +635,27 @@
|
||||||
<groupId>com.fasterxml.jackson.datatype</groupId>
|
<groupId>com.fasterxml.jackson.datatype</groupId>
|
||||||
<artifactId>jackson-datatype-jdk8</artifactId>
|
<artifactId>jackson-datatype-jdk8</artifactId>
|
||||||
<version>${jackson-core-version}</version>
|
<version>${jackson-core-version}</version>
|
||||||
</dependency>
|
</dependency>-->
|
||||||
<dependency> <!-- for xml ex-/import -->
|
<!-- for xml ex-/import -->
|
||||||
|
<!--<dependency>
|
||||||
<groupId>com.fasterxml.jackson.dataformat</groupId>
|
<groupId>com.fasterxml.jackson.dataformat</groupId>
|
||||||
<artifactId>jackson-dataformat-xml</artifactId>
|
<artifactId>jackson-dataformat-xml</artifactId>
|
||||||
<version>${jackson-core-version}</version>
|
<version>${jackson-core-version}</version>
|
||||||
</dependency>
|
</dependency>-->
|
||||||
<dependency> <!-- better xml library -->
|
<!-- better xml library -->
|
||||||
|
<dependency>
|
||||||
<groupId>org.codehaus.woodstox</groupId>
|
<groupId>org.codehaus.woodstox</groupId>
|
||||||
<artifactId>woodstox-core-asl</artifactId>
|
<artifactId>woodstox-core-asl</artifactId>
|
||||||
<version>4.4.1</version>
|
<version>4.4.1</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency> <!-- for csv ex-/import -->
|
<!-- for csv ex-/import -->
|
||||||
|
<!--
|
||||||
|
<dependency>
|
||||||
<groupId>com.fasterxml.jackson.dataformat</groupId>
|
<groupId>com.fasterxml.jackson.dataformat</groupId>
|
||||||
<artifactId>jackson-dataformat-csv</artifactId>
|
<artifactId>jackson-dataformat-csv</artifactId>
|
||||||
<version>${jackson-core-version}</version>
|
<version>${jackson-core-version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
-->
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
**********************
|
**********************
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue