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 @RequestScoped
@Controller @Controller
@Path("/") @Path("/")
public class ContentSectionsController { public class CmsController {
@Inject @Inject
private ContentSectionRepository sectionRepo; private ContentSectionRepository sectionRepo;
@ -69,7 +69,7 @@ public class ContentSectionsController {
request.getServerName(), request.getServerName(),
request.getServerPort(), request.getServerPort(),
String.format( String.format(
"%s/@content-sections/list", "%s/@cms/contentsections/",
request.getContextPath() request.getContextPath()
), ),
"", "",
@ -79,42 +79,17 @@ public class ContentSectionsController {
} catch (URISyntaxException ex) { } catch (URISyntaxException ex) {
throw new WebApplicationException(ex); throw new WebApplicationException(ex);
} }
// return String.format(
// "redirect:/%s/@content-sections/list", request.getContextPath()
// );
} }
@GET @GET
@Path("/list") @Path("/contentsections/")
@AuthorizationRequired @AuthorizationRequired
public String getContentSections() { public String getContentSections() {
return "org/librecms/ui/content-sections/list.xhtml"; return "org/librecms/ui/cms/contentsections-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()
);
} }
@POST @POST
@Path("/new") @Path("/contentsections/new")
@AuthorizationRequired @AuthorizationRequired
@RequiresPrivilege(CoreConstants.PRIVILEGE_ADMIN) @RequiresPrivilege(CoreConstants.PRIVILEGE_ADMIN)
@Transactional(Transactional.TxType.REQUIRED) @Transactional(Transactional.TxType.REQUIRED)
@ -123,11 +98,11 @@ public class ContentSectionsController {
) { ) {
sectionManager.createContentSection(sectionName); sectionManager.createContentSection(sectionName);
return "redirect:/list"; return "redirect:/contentsections/";
} }
@POST @POST
@Path("/{sectionIdentifier}/rename") @Path("/contentsections/{sectionIdentifier}/rename")
@AuthorizationRequired @AuthorizationRequired
@RequiresPrivilege(CoreConstants.PRIVILEGE_ADMIN) @RequiresPrivilege(CoreConstants.PRIVILEGE_ADMIN)
@Transactional(Transactional.TxType.REQUIRED) @Transactional(Transactional.TxType.REQUIRED)
@ -139,11 +114,11 @@ public class ContentSectionsController {
sectionManager.renameContentSection(section, sectionName); sectionManager.renameContentSection(section, sectionName);
return "redirect:list"; return "redirect:/contentsections/";
} }
@POST @POST
@Path("/{sectionIdentifier}/delete") @Path("/contentsections/{sectionIdentifier}/delete")
@AuthorizationRequired @AuthorizationRequired
@RequiresPrivilege(CoreConstants.PRIVILEGE_ADMIN) @RequiresPrivilege(CoreConstants.PRIVILEGE_ADMIN)
@Transactional(Transactional.TxType.REQUIRED) @Transactional(Transactional.TxType.REQUIRED)
@ -167,7 +142,21 @@ public class ContentSectionsController {
sectionManager.deleteContentSection(section); 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) { 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> * @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/ */
@ApplicationPath("/@content-sections") @ApplicationPath("/@contentsections")
public class CmsUi extends Application { public class ContentSectionApplication extends Application {
@Override @Override
public Set<Class<?>> getClasses() { public Set<Class<?>> getClasses() {
final Set<Class<?>> classes = new HashSet<>(); final Set<Class<?>> classes = new HashSet<>();
classes.add(IsAuthenticatedFilter.class); classes.add(IsAuthenticatedFilter.class);
classes.add(ContentSectionsController.class);
classes.add(ContentSectionController.class); classes.add(ContentSectionController.class);
return classes; return classes;
} }
} }

View File

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

View File

@ -4,7 +4,7 @@
xmlns:c="http://xmlns.jcp.org/jsp/jstl/core" xmlns:c="http://xmlns.jcp.org/jsp/jstl/core"
xmlns:libreccm="http://xmlns.jcp.org/jsf/composite/components/libreccm" xmlns:libreccm="http://xmlns.jcp.org/jsf/composite/components/libreccm"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets"> 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:param name="activePage" value="contentSections" />
<ui:define name="breadcrumb"> <ui:define name="breadcrumb">
@ -33,7 +33,7 @@
id="new-content-section-dialog" id="new-content-section-dialog"
tabindex="-1"> tabindex="-1">
<div class="modal-dialog"> <div class="modal-dialog">
<form action="#{mvc.basePath}/new" <form action="#{mvc.basePath}/contentsections/new"
class="modal-content" class="modal-content"
method="post"> method="post">
<div class="modal-header"> <div class="modal-header">
@ -96,7 +96,7 @@
var="section"> var="section">
<tr> <tr>
<td> <td>
<a href="#{mvc.basePath}/#{section.label}/folderbrowser"> <a href="#{request.contextPath}/@contentsections/#{section.label}/folderbrowser">
#{section.label} #{section.label}
</a> </a>
</td> </td>
@ -114,7 +114,7 @@
id="content-section-#{section.label}-edit-dialog" id="content-section-#{section.label}-edit-dialog"
tabindex="-1"> tabindex="-1">
<div class="modal-dialog"> <div class="modal-dialog">
<form action="#{mvc.basePath}/#{section.label}/rename" <form action="#{mvc.basePath}/contentsections/#{section.label}/rename"
class="modal-content" class="modal-content"
method="post"> method="post">
<div class="modal-header"> <div class="modal-header">
@ -164,7 +164,7 @@
</td> </td>
<td class="action-col"> <td class="action-col">
<c:if test="#{section.deletable}"> <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']}" buttonText="#{CmsAdminMessages['contentsections.list.table.actions.delete']}"
cancelLabel="#{CmsAdminMessages['contentsections.delete_dialog.close']}" cancelLabel="#{CmsAdminMessages['contentsections.delete_dialog.close']}"
confirmLabel="#{CmsAdminMessages['contentsections.delete_dialog.confirm']}" confirmLabel="#{CmsAdminMessages['contentsections.delete_dialog.confirm']}"

View File

@ -4,7 +4,7 @@
xmlns:c="http://xmlns.jcp.org/jsp/jstl/core" xmlns:c="http://xmlns.jcp.org/jsp/jstl/core"
xmlns:libreccm="http://xmlns.jcp.org/jsf/composite/components/libreccm" xmlns:libreccm="http://xmlns.jcp.org/jsf/composite/components/libreccm"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets"> 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="activePage" value="folderBrowser" />
<ui:param name="title" value="#{CmsAdminMessages['folderbrowser.title']}" /> <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>