Some improvements for the PagesAdmin
parent
f9606862f2
commit
f22df77bfe
|
|
@ -30,6 +30,8 @@ import java.util.Map;
|
||||||
*/
|
*/
|
||||||
public class PageTreeNodeModel {
|
public class PageTreeNodeModel {
|
||||||
|
|
||||||
|
private String uuid;
|
||||||
|
|
||||||
private String categoryName;
|
private String categoryName;
|
||||||
|
|
||||||
private String categoryPath;
|
private String categoryPath;
|
||||||
|
|
@ -45,6 +47,14 @@ public class PageTreeNodeModel {
|
||||||
properties = new HashMap<>();
|
properties = new HashMap<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getUuid() {
|
||||||
|
return uuid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUuid(final String uuid) {
|
||||||
|
this.uuid = uuid;
|
||||||
|
}
|
||||||
|
|
||||||
public String getCategoryName() {
|
public String getCategoryName() {
|
||||||
return categoryName;
|
return categoryName;
|
||||||
}
|
}
|
||||||
|
|
@ -54,7 +64,7 @@ public class PageTreeNodeModel {
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getCategoryPath() {
|
public String getCategoryPath() {
|
||||||
return categoryName;
|
return categoryPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void setCategoryPath(final String categoryPath) {
|
protected void setCategoryPath(final String categoryPath) {
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,7 @@ package org.librecms.ui;
|
||||||
import org.libreccm.api.Identifier;
|
import org.libreccm.api.Identifier;
|
||||||
import org.libreccm.api.IdentifierParser;
|
import org.libreccm.api.IdentifierParser;
|
||||||
import org.libreccm.categorization.Category;
|
import org.libreccm.categorization.Category;
|
||||||
|
import org.libreccm.categorization.CategoryManager;
|
||||||
import org.libreccm.categorization.CategoryRepository;
|
import org.libreccm.categorization.CategoryRepository;
|
||||||
import org.libreccm.categorization.Domain;
|
import org.libreccm.categorization.Domain;
|
||||||
import org.libreccm.categorization.DomainRepository;
|
import org.libreccm.categorization.DomainRepository;
|
||||||
|
|
@ -64,6 +65,9 @@ public class PagesController {
|
||||||
private static final String PAGES_LIST_TEMPLATE
|
private static final String PAGES_LIST_TEMPLATE
|
||||||
= "org/librecms/ui/cms/pages.xhtml";
|
= "org/librecms/ui/cms/pages.xhtml";
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private CategoryManager categoryManager;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private CategoryRepository categoryRepo;
|
private CategoryRepository categoryRepo;
|
||||||
|
|
||||||
|
|
@ -241,7 +245,7 @@ public class PagesController {
|
||||||
}
|
}
|
||||||
|
|
||||||
@POST
|
@POST
|
||||||
@Path("/{pagesInstance}/{category}/@add")
|
@Path("/{pagesInstance}/{category:[\\w\\-/]+}/@add")
|
||||||
@AuthorizationRequired
|
@AuthorizationRequired
|
||||||
@RequiresPrivilege(CoreConstants.PRIVILEGE_ADMIN)
|
@RequiresPrivilege(CoreConstants.PRIVILEGE_ADMIN)
|
||||||
@Transactional(Transactional.TxType.REQUIRED)
|
@Transactional(Transactional.TxType.REQUIRED)
|
||||||
|
|
@ -281,7 +285,7 @@ public class PagesController {
|
||||||
}
|
}
|
||||||
|
|
||||||
@GET
|
@GET
|
||||||
@Path("/{pagesInstance}/{category}/@details")
|
@Path("/{pagesInstance}/{category:[\\w\\-/]+}/@details")
|
||||||
@AuthorizationRequired
|
@AuthorizationRequired
|
||||||
@RequiresPrivilege(CoreConstants.PRIVILEGE_ADMIN)
|
@RequiresPrivilege(CoreConstants.PRIVILEGE_ADMIN)
|
||||||
@Transactional(Transactional.TxType.REQUIRED)
|
@Transactional(Transactional.TxType.REQUIRED)
|
||||||
|
|
@ -331,7 +335,7 @@ public class PagesController {
|
||||||
}
|
}
|
||||||
|
|
||||||
@POST
|
@POST
|
||||||
@Path("/{pagesInstance}/{category}/@remove")
|
@Path("/{pagesInstance}/{category:[\\w\\-/]+}/@remove")
|
||||||
@AuthorizationRequired
|
@AuthorizationRequired
|
||||||
@RequiresPrivilege(CoreConstants.PRIVILEGE_ADMIN)
|
@RequiresPrivilege(CoreConstants.PRIVILEGE_ADMIN)
|
||||||
@Transactional(Transactional.TxType.REQUIRED)
|
@Transactional(Transactional.TxType.REQUIRED)
|
||||||
|
|
@ -368,7 +372,7 @@ public class PagesController {
|
||||||
}
|
}
|
||||||
|
|
||||||
@POST
|
@POST
|
||||||
@Path("/{pagesInstance}/{category}/@add-property")
|
@Path("/{pagesInstance}/{category:[\\w\\-/]+}/@add-property")
|
||||||
@AuthorizationRequired
|
@AuthorizationRequired
|
||||||
@RequiresPrivilege(CoreConstants.PRIVILEGE_ADMIN)
|
@RequiresPrivilege(CoreConstants.PRIVILEGE_ADMIN)
|
||||||
@Transactional(Transactional.TxType.REQUIRED)
|
@Transactional(Transactional.TxType.REQUIRED)
|
||||||
|
|
@ -422,7 +426,7 @@ public class PagesController {
|
||||||
}
|
}
|
||||||
|
|
||||||
@POST
|
@POST
|
||||||
@Path("/{pagesInstance}/{category}/{propertyKey}/@edit")
|
@Path("/{pagesInstance}/{category:[\\w\\-/]+}/{propertyKey}/@edit")
|
||||||
@AuthorizationRequired
|
@AuthorizationRequired
|
||||||
@RequiresPrivilege(CoreConstants.PRIVILEGE_ADMIN)
|
@RequiresPrivilege(CoreConstants.PRIVILEGE_ADMIN)
|
||||||
@Transactional(Transactional.TxType.REQUIRED)
|
@Transactional(Transactional.TxType.REQUIRED)
|
||||||
|
|
@ -441,7 +445,7 @@ public class PagesController {
|
||||||
}
|
}
|
||||||
|
|
||||||
@POST
|
@POST
|
||||||
@Path("/{pagesInstance}/{category}/{propertyKey}/@remove")
|
@Path("/{pagesInstance}/{category:[\\w\\-/]+}/{propertyKey}/@remove")
|
||||||
@AuthorizationRequired
|
@AuthorizationRequired
|
||||||
@RequiresPrivilege(CoreConstants.PRIVILEGE_ADMIN)
|
@RequiresPrivilege(CoreConstants.PRIVILEGE_ADMIN)
|
||||||
@Transactional(Transactional.TxType.REQUIRED)
|
@Transactional(Transactional.TxType.REQUIRED)
|
||||||
|
|
@ -522,6 +526,8 @@ public class PagesController {
|
||||||
);
|
);
|
||||||
|
|
||||||
final PageTreeNodeModel node = new PageTreeNodeModel();
|
final PageTreeNodeModel node = new PageTreeNodeModel();
|
||||||
|
node.setUuid(pageResult.map(Page::getUuid).orElse(""));
|
||||||
|
node.setCategoryPath(categoryManager.getCategoryPath(category));
|
||||||
node.setCategoryName(category.getName());
|
node.setCategoryName(category.getName());
|
||||||
node.setPageAssigned(pageResult.isPresent());
|
node.setPageAssigned(pageResult.isPresent());
|
||||||
node.setProperties(
|
node.setProperties(
|
||||||
|
|
|
||||||
|
|
@ -93,6 +93,13 @@
|
||||||
<dd>#{CmsPagesDetailsModel.categoryDomain}</dd>
|
<dd>#{CmsPagesDetailsModel.categoryDomain}</dd>
|
||||||
</dl>
|
</dl>
|
||||||
|
|
||||||
|
<c:if test="#{categoryNotFound}">
|
||||||
|
<div class="alert alert-danger"
|
||||||
|
role="alert">
|
||||||
|
#{CmsAdminMessages.getMessage('pages.details.errors.category_not_found', [categoryDomain, category])}
|
||||||
|
</div>
|
||||||
|
</c:if>
|
||||||
|
|
||||||
<ul>
|
<ul>
|
||||||
<ui:include src="pages-tree-node.xhtml">
|
<ui:include src="pages-tree-node.xhtml">
|
||||||
<ui:param name="basePath" value="#{mvc.basePath}/pages/ID-#{CmsPagesDetailsModel.pagesId}" />
|
<ui:param name="basePath" value="#{mvc.basePath}/pages/ID-#{CmsPagesDetailsModel.pagesId}" />
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,12 @@
|
||||||
xmlns:ui="http://xmlns.jcp.org/jsf/facelets">
|
xmlns:ui="http://xmlns.jcp.org/jsf/facelets">
|
||||||
<ui:composition>
|
<ui:composition>
|
||||||
<li class="pt-3">
|
<li class="pt-3">
|
||||||
|
<pre>
|
||||||
|
basePath = #{basePath}
|
||||||
|
root = #{root}
|
||||||
|
node.categoryName = #{node.categoryName}
|
||||||
|
node.categoryPath = #{node.categoryPath}
|
||||||
|
</pre>
|
||||||
<c:choose>
|
<c:choose>
|
||||||
<c:when test="#{root}">
|
<c:when test="#{root}">
|
||||||
<span>/ (Root)</span>
|
<span>/ (Root)</span>
|
||||||
|
|
@ -22,10 +28,20 @@
|
||||||
<span class="sr-only">#{CmsAdminMessages['pages.page.details']}</span>
|
<span class="sr-only">#{CmsAdminMessages['pages.page.details']}</span>
|
||||||
</button>
|
</button>
|
||||||
<a class="btn btn-secondary btn-sm"
|
<a class="btn btn-secondary btn-sm"
|
||||||
href="#{basePath}/#{categoryName}/@edit">
|
href="#{basePath}/#{node.categoryName}/@edit">
|
||||||
<bootstrap:svgIcon icon="pen" />
|
<bootstrap:svgIcon icon="pen" />
|
||||||
<span class="sr-only">#{CmsAdminMessages['pages.page.edit']}</span>
|
<span class="sr-only">#{CmsAdminMessages['pages.page.edit']}</span>
|
||||||
</a>
|
</a>
|
||||||
|
<libreccm:deleteDialog
|
||||||
|
actionTarget="#{basePath}/#{node.categoryName}"
|
||||||
|
buttonText="#{CmsAdminMessages['pages.page.remove']}"
|
||||||
|
buttonTextClass="sr-only"
|
||||||
|
cancelLabel="#{CmsAdminMessages['pages.page.remove.cancel']}"
|
||||||
|
confirmLabel="#{CmsAdminMessages['pages.page.remove.confim']}"
|
||||||
|
dialogId="#{node.uuid}"
|
||||||
|
dialogTitle="#{CmsAdminMessages['pages.page.remove.title']}"
|
||||||
|
message="#{CmsAdminMessages.getMessage('pages.page.remove.message', [node.categoryPath])}"
|
||||||
|
/>
|
||||||
<button class="btn btn-danger btn-sm"
|
<button class="btn btn-danger btn-sm"
|
||||||
type="button">
|
type="button">
|
||||||
<bootstrap:svgIcon icon="x" />
|
<bootstrap:svgIcon icon="x" />
|
||||||
|
|
@ -33,11 +49,14 @@
|
||||||
</button>
|
</button>
|
||||||
</c:when>
|
</c:when>
|
||||||
<c:otherwise>
|
<c:otherwise>
|
||||||
<a class="btn btn-secondary btn-sm"
|
<form action="#{basePath}/#{node.categoryName}/@add"
|
||||||
href="#{basePath}/#{categoryName}@add">
|
method="post">
|
||||||
<bootstrap:svgIcon icon="plus-circle" />
|
<button class="btn btn-secondary btn-sm"
|
||||||
<span class="sr-only">#{CmsAdminMessages['pages.page.add']}</span>
|
type="submit">
|
||||||
</a>
|
<bootstrap:svgIcon icon="plus-circle" />
|
||||||
|
<span class="sr-only">#{CmsAdminMessages['pages.page.add']}</span>
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
</c:otherwise>
|
</c:otherwise>
|
||||||
</c:choose>
|
</c:choose>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -969,3 +969,9 @@ pages.page.details.properties.remove.label=Remove property
|
||||||
pages.page.details.properties.actions.header=Actions
|
pages.page.details.properties.actions.header=Actions
|
||||||
pages.page.details.properties.value.header=Value
|
pages.page.details.properties.value.header=Value
|
||||||
pages.page.details.properties.name.header=Name
|
pages.page.details.properties.name.header=Name
|
||||||
|
pages.page.details.breadcrumbs=Page Details {0}
|
||||||
|
pages.page.remove.cancel=Cancel
|
||||||
|
pages.page.remove.confim=Remove page
|
||||||
|
pages.page.remove.title=Confirm remove of page
|
||||||
|
pages.page.remove.message=Are sure to remove this page for ceategory {0}
|
||||||
|
pages.details.errors.category_not_found=Category {1} does not exist in category system {0}.
|
||||||
|
|
|
||||||
|
|
@ -970,3 +970,9 @@ pages.page.details.properties.remove.label=Eigenschaft entfernen
|
||||||
pages.page.details.properties.actions.header=Aktionen
|
pages.page.details.properties.actions.header=Aktionen
|
||||||
pages.page.details.properties.value.header=Wert
|
pages.page.details.properties.value.header=Wert
|
||||||
pages.page.details.properties.name.header=Name
|
pages.page.details.properties.name.header=Name
|
||||||
|
pages.page.details.breadcrumbs=Details Seite {0}
|
||||||
|
pages.page.remove.cancel=Abbrechen
|
||||||
|
pages.page.remove.confim=Seite entfernen
|
||||||
|
pages.page.remove.title=Entfernen der Seite best\u00e4tigen
|
||||||
|
pages.page.remove.message=Sind Sie sicher, dass Sie die Seite f\u00fcr die Kategorie {0} entfernen wollen?
|
||||||
|
pages.details.errors.category_not_found=Das Kategoriensystem {0} hat keine Kategorie {1}.
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue