diff --git a/ccm-cms/src/main/java/org/librecms/ui/CmsApplication.java b/ccm-cms/src/main/java/org/librecms/ui/CmsApplication.java new file mode 100644 index 000000000..ebd7b7854 --- /dev/null +++ b/ccm-cms/src/main/java/org/librecms/ui/CmsApplication.java @@ -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 Jens Pelzetter + */ +@ApplicationPath("/@cms") +public class CmsApplication extends Application { + + @Override + public Set> getClasses() { + final Set> classes = new HashSet<>(); + + classes.add(IsAuthenticatedFilter.class); + classes.add(CmsController.class); + + return classes; + } + +} diff --git a/ccm-cms/src/main/java/org/librecms/ui/ContentSectionsController.java b/ccm-cms/src/main/java/org/librecms/ui/CmsController.java similarity index 88% rename from ccm-cms/src/main/java/org/librecms/ui/ContentSectionsController.java rename to ccm-cms/src/main/java/org/librecms/ui/CmsController.java index c7d0154a2..5d0ff1e29 100644 --- a/ccm-cms/src/main/java/org/librecms/ui/ContentSectionsController.java +++ b/ccm-cms/src/main/java/org/librecms/ui/CmsController.java @@ -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) { diff --git a/ccm-cms/src/main/java/org/librecms/ui/CmsUi.java b/ccm-cms/src/main/java/org/librecms/ui/ContentSectionApplication.java similarity index 84% rename from ccm-cms/src/main/java/org/librecms/ui/CmsUi.java rename to ccm-cms/src/main/java/org/librecms/ui/ContentSectionApplication.java index 1d2d58937..25f0334ac 100644 --- a/ccm-cms/src/main/java/org/librecms/ui/CmsUi.java +++ b/ccm-cms/src/main/java/org/librecms/ui/ContentSectionApplication.java @@ -17,18 +17,19 @@ import javax.ws.rs.core.Application; * * @author Jens Pelzetter */ -@ApplicationPath("/@content-sections") -public class CmsUi extends Application { +@ApplicationPath("/@contentsections") +public class ContentSectionApplication extends Application { @Override public Set> getClasses() { final Set> classes = new HashSet<>(); classes.add(IsAuthenticatedFilter.class); - classes.add(ContentSectionsController.class); classes.add(ContentSectionController.class); return classes; } - + + + } diff --git a/ccm-cms/src/main/java/org/librecms/ui/ContentSectionsTableModel.java b/ccm-cms/src/main/java/org/librecms/ui/ContentSectionsTableModel.java index 87e7fdaee..978e0d02a 100644 --- a/ccm-cms/src/main/java/org/librecms/ui/ContentSectionsTableModel.java +++ b/ccm-cms/src/main/java/org/librecms/ui/ContentSectionsTableModel.java @@ -39,7 +39,7 @@ import javax.transaction.Transactional; public class ContentSectionsTableModel { @Inject - private ContentSectionsController controller; + private CmsController controller; @Inject private ContentSectionRepository sectionRepo; diff --git a/ccm-cms/src/main/resources/WEB-INF/views/org/librecms/ui/content-sections/content-sections.xhtml b/ccm-cms/src/main/resources/WEB-INF/views/org/librecms/ui/cms/cms.xhtml similarity index 100% rename from ccm-cms/src/main/resources/WEB-INF/views/org/librecms/ui/content-sections/content-sections.xhtml rename to ccm-cms/src/main/resources/WEB-INF/views/org/librecms/ui/cms/cms.xhtml diff --git a/ccm-cms/src/main/resources/WEB-INF/views/org/librecms/ui/content-sections/list.xhtml b/ccm-cms/src/main/resources/WEB-INF/views/org/librecms/ui/cms/contentsections-list.xhtml similarity index 96% rename from ccm-cms/src/main/resources/WEB-INF/views/org/librecms/ui/content-sections/list.xhtml rename to ccm-cms/src/main/resources/WEB-INF/views/org/librecms/ui/cms/contentsections-list.xhtml index 95937bf1a..9540eb474 100644 --- a/ccm-cms/src/main/resources/WEB-INF/views/org/librecms/ui/content-sections/list.xhtml +++ b/ccm-cms/src/main/resources/WEB-INF/views/org/librecms/ui/cms/contentsections-list.xhtml @@ -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"> - + @@ -33,7 +33,7 @@ id="new-content-section-dialog" tabindex="-1">