Manage objects in category for cms admin
Former-commit-id: fe6b3a8e06245e6810662a9ec9e4301bb48e29e8pull/10/head
parent
086a8622de
commit
6effd9f73b
|
|
@ -548,8 +548,8 @@ public class CategoriesController {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@POST
|
@GET
|
||||||
@Path("/{context}/categories/{categoryPath:(.+)?}/@index-element")
|
@Path("/{context}/categories/{categoryPath:(.+)?}/@index-element/{indexElementUuid}")
|
||||||
@AuthorizationRequired
|
@AuthorizationRequired
|
||||||
@Transactional(Transactional.TxType.REQUIRED)
|
@Transactional(Transactional.TxType.REQUIRED)
|
||||||
public String setIndexElement(
|
public String setIndexElement(
|
||||||
|
|
@ -592,7 +592,7 @@ public class CategoriesController {
|
||||||
return "org/librecms/ui/contentsection/categorysystems/categorization-not-found.xhtml";
|
return "org/librecms/ui/contentsection/categorysystems/categorization-not-found.xhtml";
|
||||||
}
|
}
|
||||||
return String.format(
|
return String.format(
|
||||||
"redirect:/%s/categorysystems/%s/categories/%s",
|
"redirect:/%s/categorysystems/%s/categories/%s#objects-sections",
|
||||||
sectionIdentifier,
|
sectionIdentifier,
|
||||||
context,
|
context,
|
||||||
categoryPath
|
categoryPath
|
||||||
|
|
@ -602,7 +602,7 @@ public class CategoriesController {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@POST
|
@GET
|
||||||
@Path("/{context}/categories/{categoryPath:(.+)?}/@index-element/reset")
|
@Path("/{context}/categories/{categoryPath:(.+)?}/@index-element/reset")
|
||||||
@AuthorizationRequired
|
@AuthorizationRequired
|
||||||
@Transactional(Transactional.TxType.REQUIRED)
|
@Transactional(Transactional.TxType.REQUIRED)
|
||||||
|
|
@ -618,7 +618,7 @@ public class CategoriesController {
|
||||||
final Category category = result.getResult();
|
final Category category = result.getResult();
|
||||||
categoryManager.resetIndexObject(category);
|
categoryManager.resetIndexObject(category);
|
||||||
return String.format(
|
return String.format(
|
||||||
"redirect:/%s/categorysystems/%s/categories/%s",
|
"redirect:/%s/categorysystems/%s/categories/%s#objects-sections",
|
||||||
sectionIdentifier,
|
sectionIdentifier,
|
||||||
context,
|
context,
|
||||||
categoryPath
|
categoryPath
|
||||||
|
|
@ -851,7 +851,7 @@ public class CategoriesController {
|
||||||
|
|
||||||
@POST
|
@POST
|
||||||
@Path(
|
@Path(
|
||||||
"/{context}/categories/{categoryPath:(.+)?}/objects/{objectIdentifier}/@order")
|
"/{context}/categories/{categoryPath:(.+)?}/@objects/{objectIdentifier}/order")
|
||||||
@AuthorizationRequired
|
@AuthorizationRequired
|
||||||
@Transactional(Transactional.TxType.REQUIRED)
|
@Transactional(Transactional.TxType.REQUIRED)
|
||||||
public String orderObjects(
|
public String orderObjects(
|
||||||
|
|
@ -898,7 +898,7 @@ public class CategoriesController {
|
||||||
}
|
}
|
||||||
} catch (ObjectNotAssignedToCategoryException ex) {
|
} catch (ObjectNotAssignedToCategoryException ex) {
|
||||||
return String.format(
|
return String.format(
|
||||||
"redirect:/%s/categorysystems/%s/categories/%s",
|
"redirect:/%s/categorysystems/%s/categories/%s#objects-sections",
|
||||||
sectionIdentifier,
|
sectionIdentifier,
|
||||||
context,
|
context,
|
||||||
categoryManager.getCategoryPath(category)
|
categoryManager.getCategoryPath(category)
|
||||||
|
|
@ -1168,6 +1168,8 @@ public class CategoriesController {
|
||||||
) {
|
) {
|
||||||
final CcmObject object = categorization.getCategorizedObject();
|
final CcmObject object = categorization.getCategorizedObject();
|
||||||
final CategorizedObjectModel model = new CategorizedObjectModel();
|
final CategorizedObjectModel model = new CategorizedObjectModel();
|
||||||
|
model.setObjectId(object.getObjectId());
|
||||||
|
model.setObjectUuid(object.getUuid());
|
||||||
model.setDisplayName(object.getDisplayName());
|
model.setDisplayName(object.getDisplayName());
|
||||||
model.setIndexObject(categorization.isIndexObject());
|
model.setIndexObject(categorization.isIndexObject());
|
||||||
model.setObjectOrder(categorization.getObjectOrder());
|
model.setObjectOrder(categorization.getObjectOrder());
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,10 @@ package org.librecms.ui.contentsections;
|
||||||
*/
|
*/
|
||||||
public class CategorizedObjectModel {
|
public class CategorizedObjectModel {
|
||||||
|
|
||||||
|
private long objectId;
|
||||||
|
|
||||||
|
private String objectUuid;
|
||||||
|
|
||||||
private String displayName;
|
private String displayName;
|
||||||
|
|
||||||
private String title;
|
private String title;
|
||||||
|
|
@ -21,6 +25,22 @@ public class CategorizedObjectModel {
|
||||||
|
|
||||||
private long objectOrder;
|
private long objectOrder;
|
||||||
|
|
||||||
|
public long getObjectId() {
|
||||||
|
return objectId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setObjectId(final long objectId) {
|
||||||
|
this.objectId = objectId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getObjectUuid() {
|
||||||
|
return objectUuid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setObjectUuid(final String objectUuid) {
|
||||||
|
this.objectUuid = objectUuid;
|
||||||
|
}
|
||||||
|
|
||||||
public String getDisplayName() {
|
public String getDisplayName() {
|
||||||
return displayName;
|
return displayName;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -437,6 +437,121 @@
|
||||||
</table>
|
</table>
|
||||||
</c:otherwise>
|
</c:otherwise>
|
||||||
</c:choose>
|
</c:choose>
|
||||||
|
|
||||||
|
<h2 id="objects-sections">#{CmsAdminMessages['contentsections.categorystems.category.objects.heading']}</h2>
|
||||||
|
<c:choose>
|
||||||
|
<c:when test="#{CategorySystemModel.selectedCategory.objects.isEmpty()}">
|
||||||
|
<p>
|
||||||
|
#{CmsAdminMessages['contentsections.categorystems.category.objects.none']}
|
||||||
|
</p>
|
||||||
|
</c:when>
|
||||||
|
<c:otherwise>
|
||||||
|
<table class="categories-table contentsections table table-hover">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th scope="col">
|
||||||
|
#{CmsAdminMessages['contentsections.categorystems.category.objects.name']}
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th scope="col">
|
||||||
|
#{CmsAdminMessages['contentsections.categorystems.category.objects.title']}
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th scope="col">
|
||||||
|
#{CmsAdminMessages['contentsections.categorystems.category.objects.type']}
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th scope="col">
|
||||||
|
#{CmsAdminMessages['contentsections.categorystems.category.objects.index']}
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th colspan="3">
|
||||||
|
#{CmsAdminMessages['contentsections.categorystems.category.objects.actions']}
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<c:forEach items="#{CategorySystemModel.selectedCategory.objects}"
|
||||||
|
var="object">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
#{object.displayName}
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
#{object.title}
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
#{object.type}
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<c:choose>
|
||||||
|
<c:when test="#{object.indexObject}">
|
||||||
|
#{CmsAdminMessages['contentsections.categorystems.category.objects.index.yes']}
|
||||||
|
</c:when>
|
||||||
|
<c:otherwise>
|
||||||
|
#{CmsAdminMessages['contentsections.categorystems.category.objects.no']}
|
||||||
|
</c:otherwise>
|
||||||
|
</c:choose>
|
||||||
|
</td>
|
||||||
|
<td class="actions-order-col">
|
||||||
|
<c:if test="#{object.objectOrder != 1}">
|
||||||
|
<form action="#"
|
||||||
|
method="post">
|
||||||
|
<input name="direction"
|
||||||
|
value="DECREASE"
|
||||||
|
type="hidden" />
|
||||||
|
<button class="btn btn-info"
|
||||||
|
type="submit">
|
||||||
|
<bootstrap:svgIcon icon="caret-up-fill" />
|
||||||
|
<span class="sr-only">#{CmsAdminMessages['contentsections.categorystems.category.objects.reorder.decrease']}</span>
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
|
</c:if>
|
||||||
|
</td>
|
||||||
|
<td class="actions-order-col">
|
||||||
|
<c:if test="#{object.objectOrder lt CategorySystemModel.selectedCategory.objects.size()}">
|
||||||
|
<form action="#{mvc.basePath}/#{ContentSectionModel.sectionName}/categorysystems/#{CategorySystemModel.selectedCategorySystem.context}/@objects/#{object.objectId}/order"
|
||||||
|
method="post">
|
||||||
|
<input name="direction"
|
||||||
|
value="INCREASE"
|
||||||
|
type="hidden" />
|
||||||
|
<button class="btn btn-info"
|
||||||
|
type="submit">
|
||||||
|
<bootstrap:svgIcon icon="caret-up-fill" />
|
||||||
|
<span class="sr-only">#{CmsAdminMessages['contentsections.categorystems.category.objects.reorder.increase']}</span>
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
|
</c:if>
|
||||||
|
</td>
|
||||||
|
<td class="actions-setindex-col">
|
||||||
|
<c:choose>
|
||||||
|
<c:when test="#{object.indexObject}">
|
||||||
|
<a class="btn btn-danger"
|
||||||
|
href="#{mvc.basePath}/#{ContentSectionModel.sectionName}/categorysystems/#{CategorySystemModel.selectedCategorySystem.context}/@index-element/#{object.objectUuid}">
|
||||||
|
<bootstrap:svgIcon icon="bookmark-x" />
|
||||||
|
<span>#{CmsAdminMessages['contentsections.categorystems.category.objects.index_object.reset']}</span>
|
||||||
|
</a>
|
||||||
|
</c:when>
|
||||||
|
<c:otherwise>
|
||||||
|
<a class="btn btn-info"
|
||||||
|
href="#{mvc.basePath}/#{ContentSectionModel.sectionName}/categorysystems/#{CategorySystemModel.selectedCategorySystem.context}/@index-element/reset">
|
||||||
|
<bootstrap:svgIcon icon="bookmark-star" />
|
||||||
|
<span>#{CmsAdminMessages['contentsections.categorystems.category.objects.index_object.set']}</span>
|
||||||
|
</a>
|
||||||
|
</c:otherwise>
|
||||||
|
</c:choose>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</c:forEach>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</c:otherwise>
|
||||||
|
</c:choose>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -262,3 +262,16 @@ contentsections.categorysystems.category.subcategories.add.label=Unique ID
|
||||||
contentsections.categorysystems.category.subcategories.add.enabled.label=Enabled?
|
contentsections.categorysystems.category.subcategories.add.enabled.label=Enabled?
|
||||||
contentsections.categorysystems.category.subcategories.add.visible.label=Visible?
|
contentsections.categorysystems.category.subcategories.add.visible.label=Visible?
|
||||||
contentsections.categorysystems.category.subcategories.add.abstractCategory.label=Abstract?
|
contentsections.categorysystems.category.subcategories.add.abstractCategory.label=Abstract?
|
||||||
|
contentsections.categorystems.category.objects.heading=Objects in this category
|
||||||
|
contentsections.categorystems.category.objects.name=Name
|
||||||
|
contentsections.categorystems.category.objects.title=Title
|
||||||
|
contentsections.categorystems.category.objects.type=Type
|
||||||
|
contentsections.categorystems.category.objects.index=Is Index Object?
|
||||||
|
contentsections.categorystems.category.objects.actions=Actions
|
||||||
|
contentsections.categorystems.category.objects.index.yes=Yes
|
||||||
|
contentsections.categorystems.category.objects.no=No
|
||||||
|
contentsections.categorystems.category.objects.reorder.decrease=Up
|
||||||
|
contentsections.categorystems.category.objects.reorder.increase=Down
|
||||||
|
contentsections.categorystems.category.objects.index_object.reset=Reset index object
|
||||||
|
contentsections.categorystems.category.objects.index_object.set=Use as index object
|
||||||
|
contentsections.categorystems.category.objects.none=No objects in this category
|
||||||
|
|
|
||||||
|
|
@ -263,3 +263,16 @@ contentsections.categorysystems.category.subcategories.add.label=Eindeutige ID
|
||||||
contentsections.categorysystems.category.subcategories.add.enabled.label=Aktiv?
|
contentsections.categorysystems.category.subcategories.add.enabled.label=Aktiv?
|
||||||
contentsections.categorysystems.category.subcategories.add.visible.label=Sichtbar?
|
contentsections.categorysystems.category.subcategories.add.visible.label=Sichtbar?
|
||||||
contentsections.categorysystems.category.subcategories.add.abstractCategory.label=Abstrakt?
|
contentsections.categorysystems.category.subcategories.add.abstractCategory.label=Abstrakt?
|
||||||
|
contentsections.categorystems.category.objects.heading=Objekte in dieser Kategorie
|
||||||
|
contentsections.categorystems.category.objects.name=Name
|
||||||
|
contentsections.categorystems.category.objects.title=Titel
|
||||||
|
contentsections.categorystems.category.objects.type=Typ
|
||||||
|
contentsections.categorystems.category.objects.index=Index-Objekt?
|
||||||
|
contentsections.categorystems.category.objects.actions=Aktionen
|
||||||
|
contentsections.categorystems.category.objects.index.yes=Ja
|
||||||
|
contentsections.categorystems.category.objects.no=Nein
|
||||||
|
contentsections.categorystems.category.objects.reorder.decrease=Hoch
|
||||||
|
contentsections.categorystems.category.objects.reorder.increase=Runter
|
||||||
|
contentsections.categorystems.category.objects.index_object.reset=Index Objekt zur\u00fccksetzen
|
||||||
|
contentsections.categorystems.category.objects.index_object.set=Als Index-Objekt nutzen
|
||||||
|
contentsections.categorystems.category.objects.none=Dieser Kategorie sind keine Objekte zugeordnet
|
||||||
|
|
|
||||||
|
|
@ -99,4 +99,8 @@ table.contentsections.categories-table {
|
||||||
td.actions-delete-col {
|
td.actions-delete-col {
|
||||||
width: 9em;
|
width: 9em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
td.actions-setindex-col {
|
||||||
|
width: 11em;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -714,6 +714,8 @@ public class CategoryManager implements Serializable {
|
||||||
categoryRepo.save(parentCategory);
|
categoryRepo.save(parentCategory);
|
||||||
categoryRepo.save(subCategory);
|
categoryRepo.save(subCategory);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
fixSubCategoryOrder(parentCategory);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue