Some work on the content sections admin app

Jens Pelzetter 2021-01-11 20:30:25 +01:00
parent f5058a665c
commit 6fee82e83b
9 changed files with 174 additions and 12 deletions

View File

@ -29,6 +29,7 @@ public class CmsConstants {
public static final String DB_SCHEMA = "CCM_CMS"; public static final String DB_SCHEMA = "CCM_CMS";
public static final String CMS_BUNDLE = "org.librecms.CmsResources"; public static final String CMS_BUNDLE = "org.librecms.CmsResources";
public static final String CMS_ADMIN_BUNDLE = "org.librecms.CmsAdminMessages";
public static final String CMS_FOLDER_BUNDLE public static final String CMS_FOLDER_BUNDLE
= "com.arsdigita.cms.ui.folder.CMSFolderResources"; = "com.arsdigita.cms.ui.folder.CMSFolderResources";

View File

@ -6,13 +6,14 @@
package org.librecms.ui; package org.librecms.ui;
import org.libreccm.security.AuthorizationRequired; import org.libreccm.security.AuthorizationRequired;
import org.libreccm.security.RequiresPrivilege;
import org.librecms.CmsConstants;
import javax.enterprise.context.RequestScoped; import javax.enterprise.context.RequestScoped;
import javax.inject.Inject;
import javax.mvc.Controller; import javax.mvc.Controller;
import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.GET; import javax.ws.rs.GET;
import javax.ws.rs.Path; import javax.ws.rs.Path;
import javax.ws.rs.core.Response;
/** /**
* *
@ -23,11 +24,40 @@ import javax.ws.rs.Path;
@Path("/") @Path("/")
public class ContentSectionsController { public class ContentSectionsController {
@Inject
private HttpServletRequest request;
@GET @GET
@Path("/") @Path("/")
@AuthorizationRequired @AuthorizationRequired
public Response getRoot() {
return Response
.status(Response.Status.MOVED_PERMANENTLY)
.entity(
String.format("%s/@content-sections/list", request
.getContextPath())
).build();
}
@GET
@Path("/list")
@AuthorizationRequired
public String getContentSections() { public String getContentSections() {
return "org/librecms/ui/content-sections.xhtml"; return "org/librecms/ui/content-sections/list.xhtml";
}
@GET
@Path("/pages")
@AuthorizationRequired
public String getPages() {
return "org/librecms/ui/content-sections/pages.xhtml";
}
@GET
@Path("/search")
@AuthorizationRequired
public String getSearch() {
return "org/librecms/ui/content-sections/pages.xhtml";
} }
} }

View File

@ -1,9 +1,9 @@
<!DOCTYPE html> <!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" <html xmlns="http://www.w3.org/1999/xhtml"
xmlns:bootstrap="http://xmlns.jcp.org/jsf/composite/components/bootstrap"
xmlns:c="http://xmlns.jcp.org/jsp/jstl/core" xmlns:c="http://xmlns.jcp.org/jsp/jstl/core"
xmlns:h="http://xmlns.jcp.org/jsf/html" xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets" xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
xmlns:xlink="http://www.w3.org/1999/xlink"
> >
<head> <head>
<title>#{title} - LibreCMS Content Sections</title> <title>#{title} - LibreCMS Content Sections</title>
@ -12,10 +12,52 @@
</head> </head>
<body> <body>
<header> <header>
<nav class="navbar navbar-expand-lg navbar-dark bg-primary">
<button
class="navbar-toggler"
type="button"
data-toggle="collapse"
data-target="#navbarSupportedContent"
aria-controls="navbarSupportedContent"
aria-expanded="false"
aria-label="Toggle navigation"
>
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav mr-auto">
<li class="nav-item">
<a class="nav-link #{activePage == 'contentSections'} ? 'active' : ''}"
href="#{mvc.uri('ContentSectionsController#getContentSections')}">
<bootstrap:svgIcon icon="bookshelf" />
<span>#{CmsAdminMessages['contentsections.list.nav.link.title']}</span>
</a>
</li>
<li class="nav-item">
<a class="nav-link #{activePage == 'pages'} ? 'active' : ''}"
href="#{mvc.uri('ContentSectionsController#getPages')}">
<bootstrap:svgIcon icon="diagram-3" />
<span>#{CmsAdminMessages['contentsections.pages.nav.link.title']}</span>
</a>
</li>
<li class="nav-item">
<a class="nav-link #{activePage == 'search'} ? 'active' : ''}"
href="#{mvc.uri('ContentSectionsController#getSearch')}">
<bootstrap:svgIcon icon="search" />
<span>#{CmsAdminMessages['contentsections.search.nav.link.title']}</span>
</a>
</li>
</ul>
</div>
</nav>
<nav aria-label="breadcrumb">
<ol class="breadcrumb">
<ui:insert name="breadcrumb"></ui:insert>
</ol>
</nav>
</header> </header>
<main> <main>
<p><em>Content Sections Placeholder</em></p> <ui:insert name="main"></ui:insert>
</main> </main>
<script src="#{request.contextPath}/assets/@content-sections/cms-admin.js"></script> <script src="#{request.contextPath}/assets/@content-sections/cms-admin.js"></script>
</body> </body>

View File

@ -0,0 +1,26 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:bootstrap="http://xmlns.jcp.org/jsf/composite/components/bootstrap"
xmlns:c="http://xmlns.jcp.org/jsp/jstl/core"
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets">
<ui:composition template="/WEB-INF/views/org/librecms/ui/content-sections/content-sections.xhtml">
<ui:param name="activePage" value="contentSections" />
<ui:define name="breadcrumb">
<li class="breadcrumb-item">
#{CmsAdminMessages['contentsections.list.label']}
</li>
</ui:define>
<ui:define name="main">
<div class="container">
<h1>#{CmsAdminMessages['contentsections.list.label']}</h1>
<p>
Content Sections List Placeholder
</p>
</div>
</ui:define>
</ui:composition>
</html>

View File

@ -0,0 +1,27 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:bootstrap="http://xmlns.jcp.org/jsf/composite/components/bootstrap"
xmlns:c="http://xmlns.jcp.org/jsp/jstl/core"
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets">
<ui:composition template="/WEB-INF/views/org/librecms/ui/content-sections/content-sections.xhtml">
<ui:param name="activePage" value="contentSections" />
<ui:define name="breadcrumb">
<li class="breadcrumb-item">
#{CmsAdminMessages['contentsections.pages.label']}
</li>
</ui:define>
<ui:define name="main">
<div class="container">
<h1>#{CmsAdminMessages['contentsections.pages.label']}</h1>
<p>
Content Sections Pages Placeholder
</p>
</div>
</ui:define>
</ui:composition>
</html>

View File

@ -0,0 +1,27 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:bootstrap="http://xmlns.jcp.org/jsf/composite/components/bootstrap"
xmlns:c="http://xmlns.jcp.org/jsp/jstl/core"
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets">
<ui:composition template="/WEB-INF/views/org/librecms/ui/content-sections/content-sections.xhtml">
<ui:param name="activePage" value="contentSections" />
<ui:define name="breadcrumb">
<li class="breadcrumb-item">
#{CmsAdminMessages['contentsections.search.label']}
</li>
</ui:define>
<ui:define name="main">
<div class="container">
<h1>#{CmsAdminMessages['contentsections.search.label']}</h1>
<p>
Content Sections Search Placeholder
</p>
</div>
</ui:define>
</ui:composition>
</html>

View File

@ -0,0 +1,6 @@
contentsections.list.nav.link.title=Content Sections
contentsections.pages.nav.link.title=Pages
contentsections.search.nav.link.title=Search
contentsections.list.label=Content Sections
contentsections.pages.label=Pages
contentsections.search.label=Search

View File

@ -0,0 +1,6 @@
contentsections.list.nav.link.title=Content Sections
contentsections.pages.nav.link.title=Seitenb\u00e4ume
contentsections.search.nav.link.title=Suche
contentsections.list.label=Content Sections
contentsections.pages.label=Seitenb\u00e4ume
contentsections.search.label=Suche

View File

@ -38,7 +38,6 @@ import javax.inject.Inject;
import javax.mail.MessagingException; import javax.mail.MessagingException;
import javax.mvc.Controller; import javax.mvc.Controller;
import javax.mvc.Models; import javax.mvc.Models;
import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.DefaultValue; import javax.ws.rs.DefaultValue;
import javax.ws.rs.FormParam; import javax.ws.rs.FormParam;
@ -46,11 +45,9 @@ import javax.ws.rs.GET;
import javax.ws.rs.POST; import javax.ws.rs.POST;
import javax.ws.rs.Path; import javax.ws.rs.Path;
import javax.ws.rs.QueryParam; import javax.ws.rs.QueryParam;
import javax.ws.rs.RedirectionException;
import javax.ws.rs.WebApplicationException; import javax.ws.rs.WebApplicationException;
import javax.ws.rs.core.Context; import javax.ws.rs.core.Context;
import javax.ws.rs.core.Response; import javax.ws.rs.core.Response;
import javax.ws.rs.core.UriBuilder;
import javax.ws.rs.core.UriInfo; import javax.ws.rs.core.UriInfo;
/** /**