Fixed path for cms administration UI

Jens Pelzetter 2021-01-20 17:43:01 +01:00
parent b2842d1c4e
commit 1c0081c990
11 changed files with 69 additions and 99 deletions

View File

@ -0,0 +1,33 @@
/*
* 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.ui.IsAuthenticatedFilter;
import java.util.HashSet;
import java.util.Set;
import javax.ws.rs.ApplicationPath;
import javax.ws.rs.core.Application;
/**
*
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/
@ApplicationPath("/@cms")
public class CmsApplication extends Application {
@Override
public Set<Class<?>> getClasses() {
final Set<Class<?>> classes = new HashSet<>();
classes.add(IsAuthenticatedFilter.class);
classes.add(CmsController.class);
return classes;
}
}

View File

@ -40,7 +40,7 @@ import javax.ws.rs.core.Response;
@RequestScoped
@Controller
@Path("/")
public class ContentSectionsController {
public class CmsController {
@Inject
private ContentSectionRepository sectionRepo;
@ -69,7 +69,7 @@ public class ContentSectionsController {
request.getServerName(),
request.getServerPort(),
String.format(
"%s/@content-sections/list",
"%s/@cms/contentsections/",
request.getContextPath()
),
"",
@ -79,42 +79,17 @@ public class ContentSectionsController {
} catch (URISyntaxException ex) {
throw new WebApplicationException(ex);
}
// return String.format(
// "redirect:/%s/@content-sections/list", request.getContextPath()
// );
}
@GET
@Path("/list")
@Path("/contentsections/")
@AuthorizationRequired
public String getContentSections() {
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/search.xhtml";
}
@GET
@Path("/{sectionIdentifier}/details")
public String getContentSectionDetails() {
throw new WebApplicationException(
Response.status(Response.Status.NOT_FOUND).build()
);
return "org/librecms/ui/cms/contentsections-list.xhtml";
}
@POST
@Path("/new")
@Path("/contentsections/new")
@AuthorizationRequired
@RequiresPrivilege(CoreConstants.PRIVILEGE_ADMIN)
@Transactional(Transactional.TxType.REQUIRED)
@ -123,11 +98,11 @@ public class ContentSectionsController {
) {
sectionManager.createContentSection(sectionName);
return "redirect:/list";
return "redirect:/contentsections/";
}
@POST
@Path("/{sectionIdentifier}/rename")
@Path("/contentsections/{sectionIdentifier}/rename")
@AuthorizationRequired
@RequiresPrivilege(CoreConstants.PRIVILEGE_ADMIN)
@Transactional(Transactional.TxType.REQUIRED)
@ -139,11 +114,11 @@ public class ContentSectionsController {
sectionManager.renameContentSection(section, sectionName);
return "redirect:list";
return "redirect:/contentsections/";
}
@POST
@Path("/{sectionIdentifier}/delete")
@Path("/contentsections/{sectionIdentifier}/delete")
@AuthorizationRequired
@RequiresPrivilege(CoreConstants.PRIVILEGE_ADMIN)
@Transactional(Transactional.TxType.REQUIRED)
@ -167,7 +142,21 @@ public class ContentSectionsController {
sectionManager.deleteContentSection(section);
}
return "redirect:/list";
return "redirect:/contentsections/";
}
@GET
@Path("/pages")
@AuthorizationRequired
public String getPages() {
return "org/librecms/ui/cms/pages.xhtml";
}
@GET
@Path("/search")
@AuthorizationRequired
public String getSearch() {
return "org/librecms/ui/cms/search.xhtml";
}
private ContentSection findContentSection(final String identifierParam) {

View File

@ -17,18 +17,19 @@ import javax.ws.rs.core.Application;
*
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/
@ApplicationPath("/@content-sections")
public class CmsUi extends Application {
@ApplicationPath("/@contentsections")
public class ContentSectionApplication extends Application {
@Override
public Set<Class<?>> getClasses() {
final Set<Class<?>> classes = new HashSet<>();
classes.add(IsAuthenticatedFilter.class);
classes.add(ContentSectionsController.class);
classes.add(ContentSectionController.class);
return classes;
}
}

View File

@ -39,7 +39,7 @@ import javax.transaction.Transactional;
public class ContentSectionsTableModel {
@Inject
private ContentSectionsController controller;
private CmsController controller;
@Inject
private ContentSectionRepository sectionRepo;

View File

@ -4,7 +4,7 @@
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-sections/content-sections.xhtml">
<ui:composition template="/WEB-INF/views/org/librecms/ui/cms/cms.xhtml">
<ui:param name="activePage" value="contentSections" />
<ui:define name="breadcrumb">
@ -33,7 +33,7 @@
id="new-content-section-dialog"
tabindex="-1">
<div class="modal-dialog">
<form action="#{mvc.basePath}/new"
<form action="#{mvc.basePath}/contentsections/new"
class="modal-content"
method="post">
<div class="modal-header">
@ -96,7 +96,7 @@
var="section">
<tr>
<td>
<a href="#{mvc.basePath}/#{section.label}/folderbrowser">
<a href="#{request.contextPath}/@contentsections/#{section.label}/folderbrowser">
#{section.label}
</a>
</td>
@ -114,7 +114,7 @@
id="content-section-#{section.label}-edit-dialog"
tabindex="-1">
<div class="modal-dialog">
<form action="#{mvc.basePath}/#{section.label}/rename"
<form action="#{mvc.basePath}/contentsections/#{section.label}/rename"
class="modal-content"
method="post">
<div class="modal-header">
@ -164,7 +164,7 @@
</td>
<td class="action-col">
<c:if test="#{section.deletable}">
<libreccm:deleteDialog actionTarget="#{mvc.basePath}/#{section.label}/delete"
<libreccm:deleteDialog actionTarget="#{mvc.basePath}/contentsections/#{section.label}/delete"
buttonText="#{CmsAdminMessages['contentsections.list.table.actions.delete']}"
cancelLabel="#{CmsAdminMessages['contentsections.delete_dialog.close']}"
confirmLabel="#{CmsAdminMessages['contentsections.delete_dialog.confirm']}"

View File

@ -4,7 +4,7 @@
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:composition template="/WEB-INF/views/org/librecms/ui/content-section/contentsection.xhtml">
<ui:param name="activePage" value="folderBrowser" />
<ui:param name="title" value="#{CmsAdminMessages['folderbrowser.title']}" />

View File

@ -1,27 +0,0 @@
<!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>
<table class="table"
<p>
Content Section Create Placeholder
</p>
<pre>MVC base path: #{mvc.basePath}</pre>
</div>
</ui:define>
</ui:composition>
</html>

View File

@ -1,26 +0,0 @@
<!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>
<table class="table"
<p>
Content Section Details Placeholder
</p>
</div>
</ui:define>
</ui:composition>
</html>