parent
5adf223121
commit
379251371d
|
|
@ -26,6 +26,7 @@ public class CmsUi extends Application {
|
||||||
|
|
||||||
classes.add(IsAuthenticatedFilter.class);
|
classes.add(IsAuthenticatedFilter.class);
|
||||||
classes.add(ContentSectionsController.class);
|
classes.add(ContentSectionsController.class);
|
||||||
|
classes.add(ContentSectionController.class);
|
||||||
|
|
||||||
return classes;
|
return classes;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,106 @@
|
||||||
|
/*
|
||||||
|
* To change this license header, choose License Headers in Project Properties.
|
||||||
|
* To change this template file, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
package org.librecms.ui;
|
||||||
|
|
||||||
|
import org.libreccm.api.Identifier;
|
||||||
|
import org.libreccm.api.IdentifierParser;
|
||||||
|
import org.libreccm.security.AuthorizationRequired;
|
||||||
|
import org.librecms.contentsection.ContentSection;
|
||||||
|
import org.librecms.contentsection.ContentSectionRepository;
|
||||||
|
|
||||||
|
import javax.enterprise.context.RequestScoped;
|
||||||
|
import javax.inject.Inject;
|
||||||
|
import javax.mvc.Controller;
|
||||||
|
import javax.mvc.Models;
|
||||||
|
import javax.ws.rs.GET;
|
||||||
|
import javax.ws.rs.Path;
|
||||||
|
import javax.ws.rs.PathParam;
|
||||||
|
import javax.ws.rs.WebApplicationException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
|
*/
|
||||||
|
@RequestScoped
|
||||||
|
@Controller
|
||||||
|
@Path("/{sectionIdentifier}")
|
||||||
|
public class ContentSectionController {
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private CmsAdminMessages cmsAdminMessages;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private ContentSectionModel contentSectionModel;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private FolderBrowserModel folderBrowserModel;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private Models models;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private ContentSectionRepository sectionRepo;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private IdentifierParser identifierParser;
|
||||||
|
|
||||||
|
@GET
|
||||||
|
@Path("/folderbrowser")
|
||||||
|
@AuthorizationRequired
|
||||||
|
public String listItems(
|
||||||
|
@PathParam("sectionIdentifier") final String sectionIdentifier
|
||||||
|
) {
|
||||||
|
final Identifier identifier = identifierParser.parseIdentifier(
|
||||||
|
sectionIdentifier
|
||||||
|
);
|
||||||
|
final ContentSection section;
|
||||||
|
switch (identifier.getType()) {
|
||||||
|
case ID:
|
||||||
|
section = sectionRepo
|
||||||
|
.findById(Long.parseLong(identifier.getIdentifier()))
|
||||||
|
.orElseThrow(
|
||||||
|
() -> new WebApplicationException(
|
||||||
|
String.format(
|
||||||
|
"No ContentSection with ID %s found.",
|
||||||
|
identifier.getIdentifier()
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
case UUID:
|
||||||
|
section = sectionRepo
|
||||||
|
.findByUuid(identifier.getIdentifier())
|
||||||
|
.orElseThrow(
|
||||||
|
() -> new WebApplicationException(
|
||||||
|
String.format(
|
||||||
|
"No ContentSection with UUID %s found.",
|
||||||
|
identifier.getIdentifier()
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
section = sectionRepo
|
||||||
|
.findByLabel(identifier.getIdentifier())
|
||||||
|
.orElseThrow(
|
||||||
|
() -> new WebApplicationException(
|
||||||
|
String.format(
|
||||||
|
"No ContentSection named %s found.",
|
||||||
|
identifier.getIdentifier()
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
contentSectionModel.setSection(section);
|
||||||
|
folderBrowserModel.setSection(section);
|
||||||
|
|
||||||
|
return "org/librecms/ui/content-section/folderbrowser.xhtml";
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,35 @@
|
||||||
|
/*
|
||||||
|
* To change this license header, choose License Headers in Project Properties.
|
||||||
|
* To change this template file, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
package org.librecms.ui;
|
||||||
|
|
||||||
|
import org.librecms.contentsection.ContentSection;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import javax.enterprise.context.RequestScoped;
|
||||||
|
import javax.inject.Named;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
|
*/
|
||||||
|
@RequestScoped
|
||||||
|
@Named("ContentSectionModel")
|
||||||
|
public class ContentSectionModel {
|
||||||
|
|
||||||
|
private ContentSection section;
|
||||||
|
|
||||||
|
protected void setSection(final ContentSection section) {
|
||||||
|
this.section = Objects.requireNonNull(
|
||||||
|
section, "Parameter section can't be null"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSectionName() {
|
||||||
|
return section.getLabel();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -11,7 +11,6 @@ import org.libreccm.core.CoreConstants;
|
||||||
import org.libreccm.security.AuthorizationRequired;
|
import org.libreccm.security.AuthorizationRequired;
|
||||||
import org.libreccm.security.PermissionChecker;
|
import org.libreccm.security.PermissionChecker;
|
||||||
import org.libreccm.security.RequiresPrivilege;
|
import org.libreccm.security.RequiresPrivilege;
|
||||||
import org.libreccm.security.Shiro;
|
|
||||||
import org.librecms.contentsection.ContentSection;
|
import org.librecms.contentsection.ContentSection;
|
||||||
import org.librecms.contentsection.ContentSectionManager;
|
import org.librecms.contentsection.ContentSectionManager;
|
||||||
import org.librecms.contentsection.ContentSectionRepository;
|
import org.librecms.contentsection.ContentSectionRepository;
|
||||||
|
|
@ -24,7 +23,6 @@ import java.util.Objects;
|
||||||
import javax.enterprise.context.RequestScoped;
|
import javax.enterprise.context.RequestScoped;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.mvc.Controller;
|
import javax.mvc.Controller;
|
||||||
import javax.servlet.ServletContext;
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.transaction.Transactional;
|
import javax.transaction.Transactional;
|
||||||
import javax.ws.rs.FormParam;
|
import javax.ws.rs.FormParam;
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,31 @@
|
||||||
|
/*
|
||||||
|
* To change this license header, choose License Headers in Project Properties.
|
||||||
|
* To change this template file, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
package org.librecms.ui;
|
||||||
|
|
||||||
|
import org.librecms.contentsection.ContentSection;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import javax.enterprise.context.RequestScoped;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
|
*/
|
||||||
|
@RequestScoped
|
||||||
|
public class FolderBrowserModel {
|
||||||
|
|
||||||
|
private ContentSection section;
|
||||||
|
|
||||||
|
protected void setSection(final ContentSection section) {
|
||||||
|
this.section = Objects.requireNonNull(
|
||||||
|
section, "Parameter section can't be null"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,57 @@
|
||||||
|
<!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:ui="http://xmlns.jcp.org/jsf/facelets"
|
||||||
|
>
|
||||||
|
<head>
|
||||||
|
<title>Content Section #{ContentSectionModel.sectionName} #{title} - LibreCMS</title>
|
||||||
|
<link href="#{request.contextPath}/assets/@content-sections/cms-admin.css"
|
||||||
|
rel="stylesheet"/>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<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 == 'folderBrowser' ? 'active' : ''}"
|
||||||
|
href='#{mvc.basePath}/#{ContentSectionModel.sectionName}/folderbrowser'>
|
||||||
|
<bootstrap:svgIcon icon="folder2-open" />
|
||||||
|
<span>#{CmsAdminMessages['folderbrowser.title']}</span>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
<nav aria-label="breadcrumb">
|
||||||
|
<ol class="breadcrumb">
|
||||||
|
<li class="breadcrumb-item">
|
||||||
|
<a href="#{mvc.basePath}/contentsections/list">
|
||||||
|
#{CmsAdminMessages['contentsections.list.label']}
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li class="breadcrumb-item">
|
||||||
|
#{ContentSectionModel.sectionName}
|
||||||
|
</li>
|
||||||
|
<ui:insert name="breadcrumb"></ui:insert>
|
||||||
|
</ol>
|
||||||
|
</nav>
|
||||||
|
</header>
|
||||||
|
<main>
|
||||||
|
<ui:insert name="main"></ui:insert>
|
||||||
|
</main>
|
||||||
|
<script src="#{request.contextPath}/assets/@content-sections/cms-admin.js"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
@ -0,0 +1,26 @@
|
||||||
|
<!DOCTYPE html [<!ENTITY times '×'>]>
|
||||||
|
<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:libreccm="http://xmlns.jcp.org/jsf/composite/components/libreccm"
|
||||||
|
xmlns:ui="http://xmlns.jcp.org/jsf/facelets">
|
||||||
|
<ui:composition template="/WEB-INF/views/org/librecms/ui/content-section/content-section.xhtml">
|
||||||
|
|
||||||
|
<ui:param name="activePage" value="folderBrowser" />
|
||||||
|
<ui:param name="title" value="#{CmsAdminMessages['folderbrowser.title']}" />
|
||||||
|
<ui:define name="breadcrumb">
|
||||||
|
<li class="breadcrumb-item">
|
||||||
|
#{CmsAdminMessages['contentsections.list.label']}
|
||||||
|
</li>
|
||||||
|
</ui:define>
|
||||||
|
|
||||||
|
<ui:define name="main">
|
||||||
|
<div class="container-fluid">
|
||||||
|
<h1>#{CmsAdminMessages.getMessage("folderbrowser.heading", [ContentSectionModel.sectionName])}</h1>
|
||||||
|
|
||||||
|
<p>placeholder</p>
|
||||||
|
</div>
|
||||||
|
</ui:define>
|
||||||
|
|
||||||
|
</ui:composition>
|
||||||
|
</html>
|
||||||
|
|
@ -2,7 +2,6 @@
|
||||||
<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: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:ui="http://xmlns.jcp.org/jsf/facelets"
|
xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
|
||||||
>
|
>
|
||||||
<head>
|
<head>
|
||||||
|
|
|
||||||
|
|
@ -96,7 +96,7 @@
|
||||||
var="section">
|
var="section">
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<a href="#{mvc.basePath}/#{section.label}/items">
|
<a href="#{mvc.basePath}/#{section.label}/folderbrowser">
|
||||||
#{section.label}
|
#{section.label}
|
||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
|
|
|
||||||
|
|
@ -24,3 +24,5 @@ contentsections.edit_dialog.close=Cancel
|
||||||
contentsections.edit_dialog.name.label=Name
|
contentsections.edit_dialog.name.label=Name
|
||||||
contentsections.edit_dialog.save=Rename content section
|
contentsections.edit_dialog.save=Rename content section
|
||||||
contentsections.edit_dialog.name.help=The name of the content section. Can only contain the letters a to z, the numbers 0-9, the hyphen and the underscore.
|
contentsections.edit_dialog.name.help=The name of the content section. Can only contain the letters a to z, the numbers 0-9, the hyphen and the underscore.
|
||||||
|
folderbrowser.title=Folder Browser
|
||||||
|
folderbrowser.heading=Content Section {0} Folderbrowser
|
||||||
|
|
|
||||||
|
|
@ -24,3 +24,5 @@ contentsections.edit_dialog.close=Abbrechen
|
||||||
contentsections.edit_dialog.name.label=Name
|
contentsections.edit_dialog.name.label=Name
|
||||||
contentsections.edit_dialog.save=Content Section umbenennen
|
contentsections.edit_dialog.save=Content Section umbenennen
|
||||||
contentsections.edit_dialog.name.help=Der Name der Content Section. Darf nur die Zeichen a bis z, 0-9, the Bindestrich und den Unterstrich enthalten.
|
contentsections.edit_dialog.name.help=Der Name der Content Section. Darf nur die Zeichen a bis z, 0-9, the Bindestrich und den Unterstrich enthalten.
|
||||||
|
folderbrowser.title=Ordner
|
||||||
|
folderbrowser.heading=Content Section {0} Ordner
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue