RelatedInfo step save sort works now, cleanup
parent
7eaba5ee31
commit
0b2f844e49
|
|
@ -114,11 +114,11 @@ class RelatedInfoStepController {
|
||||||
.sorted((list1, list2) -> list1.compareTo(list2))
|
.sorted((list1, list2) -> list1.compareTo(list2))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
toMove.setOrder(0);
|
toMove.setListOrder(0);
|
||||||
lists
|
lists
|
||||||
.stream()
|
.stream()
|
||||||
.filter(current -> !current.equals(toMove))
|
.filter(current -> !current.equals(toMove))
|
||||||
.forEach(current -> current.setOrder(current.getOrder() + 1));
|
.forEach(current -> current.setListOrder(current.getListOrder() + 1));
|
||||||
|
|
||||||
lists.forEach(entityManager::merge);
|
lists.forEach(entityManager::merge);
|
||||||
}
|
}
|
||||||
|
|
@ -207,11 +207,11 @@ class RelatedInfoStepController {
|
||||||
final int afterIndex = lists.indexOf(after);
|
final int afterIndex = lists.indexOf(after);
|
||||||
for (int i = afterIndex + 1; i < lists.size(); i++) {
|
for (int i = afterIndex + 1; i < lists.size(); i++) {
|
||||||
final AttachmentList current = lists.get(i);
|
final AttachmentList current = lists.get(i);
|
||||||
current.setOrder(current.getOrder() + 1);
|
current.setListOrder(current.getListOrder() + 1);
|
||||||
entityManager.merge(current);
|
entityManager.merge(current);
|
||||||
}
|
}
|
||||||
|
|
||||||
toMove.setOrder(afterIndex + 1);
|
toMove.setListOrder(afterIndex + 1);
|
||||||
entityManager.merge(toMove);
|
entityManager.merge(toMove);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -85,7 +85,7 @@ import static org.librecms.CmsConstants.DB_SCHEMA;
|
||||||
query = "SELECT l FROM AttachmentList l "
|
query = "SELECT l FROM AttachmentList l "
|
||||||
+ "WHERE l.name = :name "
|
+ "WHERE l.name = :name "
|
||||||
+ "AND l.item = :item "
|
+ "AND l.item = :item "
|
||||||
+ "ORDER BY l.order")
|
+ "ORDER BY l.listOrder")
|
||||||
})
|
})
|
||||||
public class AttachmentList implements Comparable<AttachmentList>,
|
public class AttachmentList implements Comparable<AttachmentList>,
|
||||||
Identifiable,
|
Identifiable,
|
||||||
|
|
@ -121,11 +121,11 @@ public class AttachmentList implements Comparable<AttachmentList>,
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A order index for ordering multiple attachment lists with the same
|
* A listOrder index for ordering multiple attachment lists with the same
|
||||||
* {@link #name}.
|
{@link #name}.
|
||||||
*/
|
*/
|
||||||
@Column(name = "LIST_ORDER")
|
@Column(name = "LIST_ORDER")
|
||||||
private long order;
|
private long listOrder;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The localised title of the list.
|
* The localised title of the list.
|
||||||
|
|
@ -201,12 +201,12 @@ public class AttachmentList implements Comparable<AttachmentList>,
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getOrder() {
|
public long getListOrder() {
|
||||||
return order;
|
return listOrder;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setOrder(final long order) {
|
public void setListOrder(final long listOrder) {
|
||||||
this.order = order;
|
this.listOrder = listOrder;
|
||||||
}
|
}
|
||||||
|
|
||||||
public LocalizedString getTitle() {
|
public LocalizedString getTitle() {
|
||||||
|
|
@ -254,7 +254,7 @@ public class AttachmentList implements Comparable<AttachmentList>,
|
||||||
|
|
||||||
final int nameCompare = name.compareTo(other.getName());
|
final int nameCompare = name.compareTo(other.getName());
|
||||||
if (nameCompare == 0) {
|
if (nameCompare == 0) {
|
||||||
return Long.compare(order, other.getOrder());
|
return Long.compare(listOrder, other.getListOrder());
|
||||||
} else {
|
} else {
|
||||||
return nameCompare;
|
return nameCompare;
|
||||||
}
|
}
|
||||||
|
|
@ -266,7 +266,7 @@ public class AttachmentList implements Comparable<AttachmentList>,
|
||||||
hash = 29 * hash + (int) (listId ^ (listId >>> 32));
|
hash = 29 * hash + (int) (listId ^ (listId >>> 32));
|
||||||
hash = 29 * hash + Objects.hashCode(uuid);
|
hash = 29 * hash + Objects.hashCode(uuid);
|
||||||
hash = 29 * hash + Objects.hashCode(name);
|
hash = 29 * hash + Objects.hashCode(name);
|
||||||
hash = 29 * hash + (int) (order ^ (order >>> 32));
|
hash = 29 * hash + (int) (listOrder ^ (listOrder >>> 32));
|
||||||
hash = 29 * hash + Objects.hashCode(title);
|
hash = 29 * hash + Objects.hashCode(title);
|
||||||
hash = 29 * hash + Objects.hashCode(description);
|
hash = 29 * hash + Objects.hashCode(description);
|
||||||
hash = 29 * hash + Objects.hashCode(attachments);
|
hash = 29 * hash + Objects.hashCode(attachments);
|
||||||
|
|
@ -299,7 +299,7 @@ public class AttachmentList implements Comparable<AttachmentList>,
|
||||||
System.out.println("uuid is not equal");
|
System.out.println("uuid is not equal");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (order != other.getOrder()) {
|
if (listOrder != other.getListOrder()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!Objects.equals(name, other.getName())) {
|
if (!Objects.equals(name, other.getName())) {
|
||||||
|
|
@ -344,7 +344,7 @@ public class AttachmentList implements Comparable<AttachmentList>,
|
||||||
listId,
|
listId,
|
||||||
uuid,
|
uuid,
|
||||||
name,
|
name,
|
||||||
order,
|
listOrder,
|
||||||
Objects.toString(title),
|
Objects.toString(title),
|
||||||
Objects.toString(description),
|
Objects.toString(description),
|
||||||
Objects.toString(attachments),
|
Objects.toString(attachments),
|
||||||
|
|
|
||||||
|
|
@ -70,7 +70,7 @@ public class AttachmentListManager {
|
||||||
*/
|
*/
|
||||||
private void normalizeOrder(final List<AttachmentList> lists) {
|
private void normalizeOrder(final List<AttachmentList> lists) {
|
||||||
for (int i = 0; i < lists.size(); i++) {
|
for (int i = 0; i < lists.size(); i++) {
|
||||||
lists.get(i).setOrder(i);
|
lists.get(i).setListOrder(i);
|
||||||
entityManager.merge(lists.get(i));
|
entityManager.merge(lists.get(i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -201,14 +201,14 @@ public class AttachmentListManager {
|
||||||
if (lists.isEmpty()) {
|
if (lists.isEmpty()) {
|
||||||
lastOrder = 0;
|
lastOrder = 0;
|
||||||
} else {
|
} else {
|
||||||
lastOrder = lists.get(lists.size() - 1).getOrder();
|
lastOrder = lists.get(lists.size() - 1).getListOrder();
|
||||||
}
|
}
|
||||||
|
|
||||||
final AttachmentList list = new AttachmentList();
|
final AttachmentList list = new AttachmentList();
|
||||||
list.setItem(draft);
|
list.setItem(draft);
|
||||||
list.setName(name);
|
list.setName(name);
|
||||||
list.setUuid(UUID.randomUUID().toString());
|
list.setUuid(UUID.randomUUID().toString());
|
||||||
list.setOrder(lastOrder + 1);
|
list.setListOrder(lastOrder + 1);
|
||||||
|
|
||||||
draft.addAttachmentList(list);
|
draft.addAttachmentList(list);
|
||||||
|
|
||||||
|
|
@ -270,10 +270,10 @@ public class AttachmentListManager {
|
||||||
list.setItem(draft);
|
list.setItem(draft);
|
||||||
list.setName(name);
|
list.setName(name);
|
||||||
list.setUuid(UUID.randomUUID().toString());
|
list.setUuid(UUID.randomUUID().toString());
|
||||||
list.setOrder(listPos);
|
list.setListOrder(listPos);
|
||||||
|
|
||||||
for (long i = listPos; i < lists.size(); i++) {
|
for (long i = listPos; i < lists.size(); i++) {
|
||||||
lists.get((int) i).setOrder(i + 1);
|
lists.get((int) i).setListOrder(i + 1);
|
||||||
entityManager.merge(lists.get((int) i));
|
entityManager.merge(lists.get((int) i));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -336,21 +336,21 @@ public class AttachmentListManager {
|
||||||
.getAttachments();
|
.getAttachments();
|
||||||
|
|
||||||
final Optional<AttachmentList> list1 = lists.stream()
|
final Optional<AttachmentList> list1 = lists.stream()
|
||||||
.filter(list -> list.getOrder() == attachmentList.getOrder())
|
.filter(list -> list.getListOrder() == attachmentList.getListOrder())
|
||||||
.findFirst();
|
.findFirst();
|
||||||
final Optional<AttachmentList> list2 = lists.stream()
|
final Optional<AttachmentList> list2 = lists.stream()
|
||||||
.filter(list -> list.getOrder() >= attachmentList.getOrder() + 1)
|
.filter(list -> list.getListOrder() >= attachmentList.getListOrder() + 1)
|
||||||
.findFirst();
|
.findFirst();
|
||||||
|
|
||||||
if (!list2.isPresent()) {
|
if (!list2.isPresent()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final long order1 = list1.get().getOrder();
|
final long order1 = list1.get().getListOrder();
|
||||||
final long order2 = list2.get().getOrder();
|
final long order2 = list2.get().getListOrder();
|
||||||
|
|
||||||
list1.get().setOrder(order2);
|
list1.get().setListOrder(order2);
|
||||||
list2.get().setOrder(order1);
|
list2.get().setListOrder(order1);
|
||||||
|
|
||||||
entityManager.merge(list1.get());
|
entityManager.merge(list1.get());
|
||||||
entityManager.merge(list2.get());
|
entityManager.merge(list2.get());
|
||||||
|
|
@ -374,10 +374,10 @@ public class AttachmentListManager {
|
||||||
.getAttachments();
|
.getAttachments();
|
||||||
|
|
||||||
final Optional<AttachmentList> list1 = lists.stream()
|
final Optional<AttachmentList> list1 = lists.stream()
|
||||||
.filter(list -> list.getOrder() == attachmentList.getOrder())
|
.filter(list -> list.getListOrder() == attachmentList.getListOrder())
|
||||||
.findFirst();
|
.findFirst();
|
||||||
final List<AttachmentList> lower = lists.stream()
|
final List<AttachmentList> lower = lists.stream()
|
||||||
.filter(list -> list.getOrder() <= attachmentList.getOrder() - 1)
|
.filter(list -> list.getListOrder() <= attachmentList.getListOrder() - 1)
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
Collections.sort(lower);
|
Collections.sort(lower);
|
||||||
|
|
||||||
|
|
@ -392,11 +392,11 @@ public class AttachmentListManager {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final long order1 = list1.get().getOrder();
|
final long order1 = list1.get().getListOrder();
|
||||||
final long order2 = list2.get().getOrder();
|
final long order2 = list2.get().getListOrder();
|
||||||
|
|
||||||
list1.get().setOrder(order2);
|
list1.get().setListOrder(order2);
|
||||||
list2.get().setOrder(order1);
|
list2.get().setListOrder(order1);
|
||||||
|
|
||||||
entityManager.merge(list1.get());
|
entityManager.merge(list1.get());
|
||||||
entityManager.merge(list2.get());
|
entityManager.merge(list2.get());
|
||||||
|
|
|
||||||
|
|
@ -65,7 +65,6 @@ import javax.persistence.OrderBy;
|
||||||
import javax.xml.bind.annotation.XmlElement;
|
import javax.xml.bind.annotation.XmlElement;
|
||||||
import javax.xml.bind.annotation.XmlElementWrapper;
|
import javax.xml.bind.annotation.XmlElementWrapper;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Base type for all content item types. Specifies some common properties.
|
* Base type for all content item types. Specifies some common properties.
|
||||||
*
|
*
|
||||||
|
|
@ -79,105 +78,100 @@ import javax.xml.bind.annotation.XmlElementWrapper;
|
||||||
@NamedQuery(
|
@NamedQuery(
|
||||||
name = "ContentItem.findById",
|
name = "ContentItem.findById",
|
||||||
query
|
query
|
||||||
= "SELECT DISTINCT i "
|
= "SELECT DISTINCT i "
|
||||||
+ "FROM ContentItem i "
|
+ "FROM ContentItem i "
|
||||||
+ "LEFT JOIN i.permissions p "
|
+ "LEFT JOIN i.permissions p "
|
||||||
+ "WHERE i.objectId = :objectId "
|
+ "WHERE i.objectId = :objectId "
|
||||||
+ "AND ("
|
+ "AND ("
|
||||||
+ " ("
|
+ " ("
|
||||||
+ " p.grantee IN :roles "
|
+ " p.grantee IN :roles "
|
||||||
+ " AND p.grantedPrivilege = "
|
+ " AND p.grantedPrivilege = "
|
||||||
+ " (CASE WHEN i.version = 'DRAFT' "
|
+ " (CASE WHEN i.version = 'DRAFT' "
|
||||||
+ " THEN '" + ItemPrivileges.PREVIEW + "' "
|
+ " THEN '" + ItemPrivileges.PREVIEW + "' "
|
||||||
+ " ELSE '" + ItemPrivileges.VIEW_PUBLISHED + "' "
|
+ " ELSE '" + ItemPrivileges.VIEW_PUBLISHED + "' "
|
||||||
+ " END"
|
+ " END"
|
||||||
+ " )"
|
+ " )"
|
||||||
+ " ) "
|
+ " ) "
|
||||||
+ " OR true = :isSystemUser OR true = :isAdmin"
|
+ " OR true = :isSystemUser OR true = :isAdmin"
|
||||||
+ " )")
|
+ " )"),
|
||||||
,
|
|
||||||
@NamedQuery(
|
@NamedQuery(
|
||||||
name = "ContentItem.findByUuid",
|
name = "ContentItem.findByUuid",
|
||||||
query
|
query
|
||||||
= "SELECT DISTINCT i "
|
= "SELECT DISTINCT i "
|
||||||
+ "FROM ContentItem i "
|
+ "FROM ContentItem i "
|
||||||
+ "LEFT JOIN i.permissions p "
|
+ "LEFT JOIN i.permissions p "
|
||||||
+ "WHERE i.uuid = :uuid "
|
+ "WHERE i.uuid = :uuid "
|
||||||
+ "AND ("
|
+ "AND ("
|
||||||
+ " ("
|
+ " ("
|
||||||
+ " p.grantee IN :roles "
|
+ " p.grantee IN :roles "
|
||||||
+ " AND p.grantedPrivilege = "
|
+ " AND p.grantedPrivilege = "
|
||||||
+ " (CASE WHEN i.version = 'DRAFT' "
|
+ " (CASE WHEN i.version = 'DRAFT' "
|
||||||
+ " THEN '" + ItemPrivileges.PREVIEW + "' "
|
+ " THEN '" + ItemPrivileges.PREVIEW + "' "
|
||||||
+ " ELSE '" + ItemPrivileges.VIEW_PUBLISHED + "' "
|
+ " ELSE '" + ItemPrivileges.VIEW_PUBLISHED + "' "
|
||||||
+ " END"
|
+ " END"
|
||||||
+ " )"
|
+ " )"
|
||||||
+ " ) "
|
+ " ) "
|
||||||
+ " OR true = :isSystemUser OR true = :isAdmin"
|
+ " OR true = :isSystemUser OR true = :isAdmin"
|
||||||
+ " )")
|
+ " )"),
|
||||||
,
|
|
||||||
@NamedQuery(
|
@NamedQuery(
|
||||||
name = "ContentItem.findByType",
|
name = "ContentItem.findByType",
|
||||||
query
|
query
|
||||||
= "SELECT DISTINCT i "
|
= "SELECT DISTINCT i "
|
||||||
+ "FROM ContentItem i "
|
+ "FROM ContentItem i "
|
||||||
+ "LEFT JOIN i.permissions p "
|
+ "LEFT JOIN i.permissions p "
|
||||||
+ "WHERE TYPE(i) = :type "
|
+ "WHERE TYPE(i) = :type "
|
||||||
+ "AND ("
|
+ "AND ("
|
||||||
+ " ("
|
+ " ("
|
||||||
+ " p.grantee IN :roles "
|
+ " p.grantee IN :roles "
|
||||||
+ " AND p.grantedPrivilege = "
|
+ " AND p.grantedPrivilege = "
|
||||||
+ " (CASE WHEN i.version = 'DRAFT' "
|
+ " (CASE WHEN i.version = 'DRAFT' "
|
||||||
+ " THEN '" + ItemPrivileges.PREVIEW + "' "
|
+ " THEN '" + ItemPrivileges.PREVIEW + "' "
|
||||||
+ " ELSE '" + ItemPrivileges.VIEW_PUBLISHED + "' "
|
+ " ELSE '" + ItemPrivileges.VIEW_PUBLISHED + "' "
|
||||||
+ " END"
|
+ " END"
|
||||||
+ " )"
|
+ " )"
|
||||||
+ " ) "
|
+ " ) "
|
||||||
+ " OR true = :isSystemUser OR true = :isAdmin"
|
+ " OR true = :isSystemUser OR true = :isAdmin"
|
||||||
+ " )")
|
+ " )"),
|
||||||
,
|
|
||||||
@NamedQuery(
|
@NamedQuery(
|
||||||
name = "ContentItem.findByIdAndType",
|
name = "ContentItem.findByIdAndType",
|
||||||
query
|
query
|
||||||
= "SELECT DISTINCT i "
|
= "SELECT DISTINCT i "
|
||||||
+ "FROM ContentItem i "
|
+ "FROM ContentItem i "
|
||||||
+ "LEFT JOIN i.permissions p "
|
+ "LEFT JOIN i.permissions p "
|
||||||
+ "WHERE i.objectId = :objectId "
|
+ "WHERE i.objectId = :objectId "
|
||||||
+ "AND TYPE(i) = :type "
|
+ "AND TYPE(i) = :type "
|
||||||
+ "AND ("
|
+ "AND ("
|
||||||
+ " ("
|
+ " ("
|
||||||
+ " p.grantee IN :roles "
|
+ " p.grantee IN :roles "
|
||||||
+ " AND p.grantedPrivilege = "
|
+ " AND p.grantedPrivilege = "
|
||||||
+ " (CASE WHEN i.version = 'DRAFT' "
|
+ " (CASE WHEN i.version = 'DRAFT' "
|
||||||
+ " THEN '" + ItemPrivileges.PREVIEW + "' "
|
+ " THEN '" + ItemPrivileges.PREVIEW + "' "
|
||||||
+ " ELSE '" + ItemPrivileges.VIEW_PUBLISHED + "' "
|
+ " ELSE '" + ItemPrivileges.VIEW_PUBLISHED + "' "
|
||||||
+ " END"
|
+ " END"
|
||||||
+ " )"
|
+ " )"
|
||||||
+ " ) "
|
+ " ) "
|
||||||
+ " OR true = :isSystemUser OR true = :isAdmin"
|
+ " OR true = :isSystemUser OR true = :isAdmin"
|
||||||
+ " )")
|
+ " )"),
|
||||||
,
|
|
||||||
@NamedQuery(
|
@NamedQuery(
|
||||||
name = "ContentItem.findByUuidAndType",
|
name = "ContentItem.findByUuidAndType",
|
||||||
query
|
query
|
||||||
= "SELECT DISTINCT i "
|
= "SELECT DISTINCT i "
|
||||||
+ "FROM ContentItem i "
|
+ "FROM ContentItem i "
|
||||||
+ "LEFT JOIN i.permissions p "
|
+ "LEFT JOIN i.permissions p "
|
||||||
+ "WHERE i.uuid = :uuid "
|
+ "WHERE i.uuid = :uuid "
|
||||||
+ "AND TYPE(i) = :type "
|
+ "AND TYPE(i) = :type "
|
||||||
+ "AND ("
|
+ "AND ("
|
||||||
+ " ("
|
+ " ("
|
||||||
+ " p.grantee IN :roles "
|
+ " p.grantee IN :roles "
|
||||||
+ " AND p.grantedPrivilege = "
|
+ " AND p.grantedPrivilege = "
|
||||||
+ " (CASE WHEN i.version = 'DRAFT' "
|
+ " (CASE WHEN i.version = 'DRAFT' "
|
||||||
+ " THEN '" + ItemPrivileges.PREVIEW + "' "
|
+ " THEN '" + ItemPrivileges.PREVIEW + "' "
|
||||||
+ " ELSE '" + ItemPrivileges.VIEW_PUBLISHED + "' "
|
+ " ELSE '" + ItemPrivileges.VIEW_PUBLISHED + "' "
|
||||||
+ " END"
|
+ " END"
|
||||||
+ " )"
|
+ " )"
|
||||||
+ " ) "
|
+ " ) "
|
||||||
+ " OR true = :isSystemUser OR true = :isAdmin"
|
+ " OR true = :isSystemUser OR true = :isAdmin"
|
||||||
+ " )")
|
+ " )"),
|
||||||
,
|
|
||||||
@NamedQuery(
|
@NamedQuery(
|
||||||
name = "ContentItem.findByContentSection",
|
name = "ContentItem.findByContentSection",
|
||||||
query = "SELECT DISTINCT i "
|
query = "SELECT DISTINCT i "
|
||||||
|
|
@ -197,8 +191,7 @@ import javax.xml.bind.annotation.XmlElementWrapper;
|
||||||
+ " )"
|
+ " )"
|
||||||
+ " )"
|
+ " )"
|
||||||
+ " OR true = :isSystemUser OR true = :isAdmin"
|
+ " OR true = :isSystemUser OR true = :isAdmin"
|
||||||
+ ")")
|
+ ")"),
|
||||||
,
|
|
||||||
@NamedQuery(
|
@NamedQuery(
|
||||||
name = "ContentItem.findByContentSectionAndVersion",
|
name = "ContentItem.findByContentSectionAndVersion",
|
||||||
query = "SELECT DISTINCT i "
|
query = "SELECT DISTINCT i "
|
||||||
|
|
@ -219,8 +212,7 @@ import javax.xml.bind.annotation.XmlElementWrapper;
|
||||||
+ " )"
|
+ " )"
|
||||||
+ " )"
|
+ " )"
|
||||||
+ " OR true = :isSystemUser OR true = :isAdmin"
|
+ " OR true = :isSystemUser OR true = :isAdmin"
|
||||||
+ ")")
|
+ ")"),
|
||||||
,
|
|
||||||
@NamedQuery(
|
@NamedQuery(
|
||||||
name = "ContentItem.findByNameAndContentSection",
|
name = "ContentItem.findByNameAndContentSection",
|
||||||
query = "SELECT DISTINCT i "
|
query = "SELECT DISTINCT i "
|
||||||
|
|
@ -241,8 +233,7 @@ import javax.xml.bind.annotation.XmlElementWrapper;
|
||||||
+ " )"
|
+ " )"
|
||||||
+ " )"
|
+ " )"
|
||||||
+ " OR true = :isSystemUser OR true = :isAdmin"
|
+ " OR true = :isSystemUser OR true = :isAdmin"
|
||||||
+ ")")
|
+ ")"),
|
||||||
,
|
|
||||||
@NamedQuery(
|
@NamedQuery(
|
||||||
name = "ContentItem.findByNameAndContentSectionAndVersion",
|
name = "ContentItem.findByNameAndContentSectionAndVersion",
|
||||||
query = "SELECT DISTINCT i "
|
query = "SELECT DISTINCT i "
|
||||||
|
|
@ -264,9 +255,7 @@ import javax.xml.bind.annotation.XmlElementWrapper;
|
||||||
+ " )"
|
+ " )"
|
||||||
+ " )"
|
+ " )"
|
||||||
+ " OR true = :isSystemUser OR true = :isAdmin"
|
+ " OR true = :isSystemUser OR true = :isAdmin"
|
||||||
+ ")")
|
+ ")"),
|
||||||
|
|
||||||
,
|
|
||||||
@NamedQuery(
|
@NamedQuery(
|
||||||
name = "ContentItem.findByTypeAndContentSection",
|
name = "ContentItem.findByTypeAndContentSection",
|
||||||
query = "SELECT DISTINCT i "
|
query = "SELECT DISTINCT i "
|
||||||
|
|
@ -287,8 +276,7 @@ import javax.xml.bind.annotation.XmlElementWrapper;
|
||||||
+ " )"
|
+ " )"
|
||||||
+ " )"
|
+ " )"
|
||||||
+ " OR true = :isSystemUser OR true = :isAdmin"
|
+ " OR true = :isSystemUser OR true = :isAdmin"
|
||||||
+ ")")
|
+ ")"),
|
||||||
,
|
|
||||||
@NamedQuery(
|
@NamedQuery(
|
||||||
name = "ContentItem.findByTypeAndContentSectionAndVersion",
|
name = "ContentItem.findByTypeAndContentSectionAndVersion",
|
||||||
query = "SELECT DISTINCT i "
|
query = "SELECT DISTINCT i "
|
||||||
|
|
@ -311,9 +299,7 @@ import javax.xml.bind.annotation.XmlElementWrapper;
|
||||||
+ " )"
|
+ " )"
|
||||||
+ " OR true = :isSystemUser OR true = :isAdmin"
|
+ " OR true = :isSystemUser OR true = :isAdmin"
|
||||||
+ ")"
|
+ ")"
|
||||||
)
|
),
|
||||||
|
|
||||||
,
|
|
||||||
@NamedQuery(
|
@NamedQuery(
|
||||||
name = "ContentItem.findByNameAndTypeAndContentSection",
|
name = "ContentItem.findByNameAndTypeAndContentSection",
|
||||||
query = "SELECT DISTINCT i "
|
query = "SELECT DISTINCT i "
|
||||||
|
|
@ -335,9 +321,8 @@ import javax.xml.bind.annotation.XmlElementWrapper;
|
||||||
+ " )"
|
+ " )"
|
||||||
+ " )"
|
+ " )"
|
||||||
+ " OR true = :isSystemUser OR true = :isAdmin"
|
+ " OR true = :isSystemUser OR true = :isAdmin"
|
||||||
+ ")")
|
+ ")"),
|
||||||
,
|
@NamedQuery(
|
||||||
@NamedQuery(
|
|
||||||
name = "ContentItem.findByNameAndTypeAndContentSectionAndVersion",
|
name = "ContentItem.findByNameAndTypeAndContentSectionAndVersion",
|
||||||
query = "SELECT DISTINCT i "
|
query = "SELECT DISTINCT i "
|
||||||
+ "FROM ContentItem i "
|
+ "FROM ContentItem i "
|
||||||
|
|
@ -359,77 +344,73 @@ import javax.xml.bind.annotation.XmlElementWrapper;
|
||||||
+ " )"
|
+ " )"
|
||||||
+ " )"
|
+ " )"
|
||||||
+ " OR true = :isSystemUser OR true = :isAdmin"
|
+ " OR true = :isSystemUser OR true = :isAdmin"
|
||||||
+ ")")
|
+ ")"),
|
||||||
,
|
|
||||||
|
|
||||||
@NamedQuery(
|
@NamedQuery(
|
||||||
name = "ContentItem.findByFolder",
|
name = "ContentItem.findByFolder",
|
||||||
query
|
query
|
||||||
= "SELECT DISTINCT i "
|
= "SELECT DISTINCT i "
|
||||||
+ "FROM ContentItem i "
|
+ "FROM ContentItem i "
|
||||||
+ "JOIN i.categories c "
|
+ "JOIN i.categories c "
|
||||||
+ "LEFT JOIN i.permissions p "
|
+ "LEFT JOIN i.permissions p "
|
||||||
+ "WHERE c.category = :folder "
|
+ "WHERE c.category = :folder "
|
||||||
+ "AND c.type = '" + CATEGORIZATION_TYPE_FOLDER + "' "
|
+ "AND c.type = '" + CATEGORIZATION_TYPE_FOLDER + "' "
|
||||||
+ "AND ("
|
+ "AND ("
|
||||||
+ " ("
|
+ " ("
|
||||||
+ " p.grantee IN :roles "
|
+ " p.grantee IN :roles "
|
||||||
+ " AND p.grantedPrivilege = "
|
+ " AND p.grantedPrivilege = "
|
||||||
+ " (CASE WHEN i.version = 'DRAFT' "
|
+ " (CASE WHEN i.version = 'DRAFT' "
|
||||||
+ " THEN '" + ItemPrivileges.PREVIEW + "' "
|
+ " THEN '" + ItemPrivileges.PREVIEW + "' "
|
||||||
+ " ELSE '" + ItemPrivileges.VIEW_PUBLISHED + "' "
|
+ " ELSE '" + ItemPrivileges.VIEW_PUBLISHED + "' "
|
||||||
+ " END"
|
+ " END"
|
||||||
+ " )"
|
+ " )"
|
||||||
+ " )"
|
+ " )"
|
||||||
+ " OR true = :isSystemUser OR true = :isAdmin"
|
+ " OR true = :isSystemUser OR true = :isAdmin"
|
||||||
+ " )")
|
+ " )"),
|
||||||
,
|
|
||||||
@NamedQuery(
|
@NamedQuery(
|
||||||
name = "ContentItem.countItemsInFolder",
|
name = "ContentItem.countItemsInFolder",
|
||||||
query
|
query
|
||||||
= "SELECT COUNT(DISTINCT i) "
|
= "SELECT COUNT(DISTINCT i) "
|
||||||
+ "FROM ContentItem i "
|
+ "FROM ContentItem i "
|
||||||
+ "JOIN i.categories c "
|
+ "JOIN i.categories c "
|
||||||
+ "LEFT JOIN i.permissions p "
|
+ "LEFT JOIN i.permissions p "
|
||||||
+ "WHERE c.category = :folder "
|
+ "WHERE c.category = :folder "
|
||||||
+ "AND c.type = '" + CATEGORIZATION_TYPE_FOLDER + "' "
|
+ "AND c.type = '" + CATEGORIZATION_TYPE_FOLDER + "' "
|
||||||
+ "AND ("
|
+ "AND ("
|
||||||
+ " ("
|
+ " ("
|
||||||
+ " p.grantee IN :roles "
|
+ " p.grantee IN :roles "
|
||||||
+ " AND p.grantedPrivilege = "
|
+ " AND p.grantedPrivilege = "
|
||||||
+ " (CASE WHEN i.version = 'DRAFT' "
|
+ " (CASE WHEN i.version = 'DRAFT' "
|
||||||
+ " THEN '" + ItemPrivileges.PREVIEW + "' "
|
+ " THEN '" + ItemPrivileges.PREVIEW + "' "
|
||||||
+ " ELSE '" + ItemPrivileges.VIEW_PUBLISHED + "' "
|
+ " ELSE '" + ItemPrivileges.VIEW_PUBLISHED + "' "
|
||||||
+ " END"
|
+ " END"
|
||||||
+ " )"
|
+ " )"
|
||||||
+ " )"
|
+ " )"
|
||||||
+ " OR true = :isSystemUser OR true = :isAdmin"
|
+ " OR true = :isSystemUser OR true = :isAdmin"
|
||||||
+ " )")
|
+ " )"),
|
||||||
,
|
|
||||||
@NamedQuery(
|
@NamedQuery(
|
||||||
name = "ContentItem.findByNameInFolder",
|
name = "ContentItem.findByNameInFolder",
|
||||||
query
|
query
|
||||||
= "SELECT DISTINCT i "
|
= "SELECT DISTINCT i "
|
||||||
+ "FROM ContentItem i "
|
+ "FROM ContentItem i "
|
||||||
+ "JOIN i.categories c "
|
+ "JOIN i.categories c "
|
||||||
+ "LEFT JOIN i.permissions p "
|
+ "LEFT JOIN i.permissions p "
|
||||||
+ "WHERE c.category = :folder "
|
+ "WHERE c.category = :folder "
|
||||||
+ "AND c.type = '" + CATEGORIZATION_TYPE_FOLDER + "' "
|
+ "AND c.type = '" + CATEGORIZATION_TYPE_FOLDER + "' "
|
||||||
+ "AND i.displayName = :name "
|
+ "AND i.displayName = :name "
|
||||||
+ "AND i.version = 'DRAFT' "
|
+ "AND i.version = 'DRAFT' "
|
||||||
+ "AND ("
|
+ "AND ("
|
||||||
+ " ("
|
+ " ("
|
||||||
+ " p.grantee IN :roles "
|
+ " p.grantee IN :roles "
|
||||||
+ " AND p.grantedPrivilege = "
|
+ " AND p.grantedPrivilege = "
|
||||||
+ " (CASE WHEN i.version = 'DRAFT' "
|
+ " (CASE WHEN i.version = 'DRAFT' "
|
||||||
+ " THEN '" + ItemPrivileges.PREVIEW + "' "
|
+ " THEN '" + ItemPrivileges.PREVIEW + "' "
|
||||||
+ " ELSE '" + ItemPrivileges.VIEW_PUBLISHED + "' "
|
+ " ELSE '" + ItemPrivileges.VIEW_PUBLISHED + "' "
|
||||||
+ " END"
|
+ " END"
|
||||||
+ " )"
|
+ " )"
|
||||||
+ " )"
|
+ " )"
|
||||||
+ " OR true = :isSystemUser OR true = :isAdmin"
|
+ " OR true = :isSystemUser OR true = :isAdmin"
|
||||||
+ " )")
|
+ " )"),
|
||||||
,
|
|
||||||
@NamedQuery(
|
@NamedQuery(
|
||||||
name = "ContentItem.countByNameInFolder",
|
name = "ContentItem.countByNameInFolder",
|
||||||
query = "SELECT COUNT(DISTINCT i)"
|
query = "SELECT COUNT(DISTINCT i)"
|
||||||
|
|
@ -451,8 +432,7 @@ import javax.xml.bind.annotation.XmlElementWrapper;
|
||||||
+ " )"
|
+ " )"
|
||||||
+ " )"
|
+ " )"
|
||||||
+ " OR true = :isSystemUser OR true = :isAdmin"
|
+ " OR true = :isSystemUser OR true = :isAdmin"
|
||||||
+ " )")
|
+ " )"),
|
||||||
,
|
|
||||||
@NamedQuery(
|
@NamedQuery(
|
||||||
name = "ContentItem.filterByFolderAndName",
|
name = "ContentItem.filterByFolderAndName",
|
||||||
query = "SELECT DISTINCT i "
|
query = "SELECT DISTINCT i "
|
||||||
|
|
@ -474,8 +454,7 @@ import javax.xml.bind.annotation.XmlElementWrapper;
|
||||||
+ " )"
|
+ " )"
|
||||||
+ " OR true = :isSystemUser OR true = :isAdmin"
|
+ " OR true = :isSystemUser OR true = :isAdmin"
|
||||||
+ " ) "
|
+ " ) "
|
||||||
+ "ORDER BY i.displayName")
|
+ "ORDER BY i.displayName"),
|
||||||
,
|
|
||||||
@NamedQuery(
|
@NamedQuery(
|
||||||
name = "ContentItem.countFilterByFolderAndName",
|
name = "ContentItem.countFilterByFolderAndName",
|
||||||
query = "SELECT COUNT(DISTINCT i) FROM ContentItem i "
|
query = "SELECT COUNT(DISTINCT i) FROM ContentItem i "
|
||||||
|
|
@ -496,8 +475,7 @@ import javax.xml.bind.annotation.XmlElementWrapper;
|
||||||
+ " )"
|
+ " )"
|
||||||
+ " OR true = :isSystemUser OR true = :isAdmin"
|
+ " OR true = :isSystemUser OR true = :isAdmin"
|
||||||
+ " )"
|
+ " )"
|
||||||
)
|
),
|
||||||
,
|
|
||||||
@NamedQuery(
|
@NamedQuery(
|
||||||
name = "ContentItem.filterByFolderAndType",
|
name = "ContentItem.filterByFolderAndType",
|
||||||
query = "SELECT DISTINCT i "
|
query = "SELECT DISTINCT i "
|
||||||
|
|
@ -519,8 +497,7 @@ import javax.xml.bind.annotation.XmlElementWrapper;
|
||||||
+ " )"
|
+ " )"
|
||||||
+ " OR true = :isSystemUser OR true = :isAdmin"
|
+ " OR true = :isSystemUser OR true = :isAdmin"
|
||||||
+ " ) "
|
+ " ) "
|
||||||
+ "ORDER BY i.displayName")
|
+ "ORDER BY i.displayName"),
|
||||||
,
|
|
||||||
@NamedQuery(
|
@NamedQuery(
|
||||||
name = "ContentItem.filterByFolderAndTypeAndName",
|
name = "ContentItem.filterByFolderAndTypeAndName",
|
||||||
query = "SELECT DISTINCT i "
|
query = "SELECT DISTINCT i "
|
||||||
|
|
@ -543,44 +520,40 @@ import javax.xml.bind.annotation.XmlElementWrapper;
|
||||||
+ " )"
|
+ " )"
|
||||||
+ " OR true = :isSystemUser OR true = :isAdmin"
|
+ " OR true = :isSystemUser OR true = :isAdmin"
|
||||||
+ " ) "
|
+ " ) "
|
||||||
+ "ORDER BY i.displayName")
|
+ "ORDER BY i.displayName"),
|
||||||
,
|
|
||||||
@NamedQuery(
|
@NamedQuery(
|
||||||
name = "ContentItem.hasLiveVersion",
|
name = "ContentItem.hasLiveVersion",
|
||||||
query = "SELECT (CASE WHEN COUNT(i) > 0 THEN true ELSE false END) "
|
query = "SELECT (CASE WHEN COUNT(i) > 0 THEN true ELSE false END) "
|
||||||
+ "FROM ContentItem i "
|
+ "FROM ContentItem i "
|
||||||
+ "WHERE i.itemUuid = :uuid "
|
+ "WHERE i.itemUuid = :uuid "
|
||||||
+ "AND i.version = org.librecms.contentsection.ContentItemVersion.LIVE")
|
+ "AND i.version = org.librecms.contentsection.ContentItemVersion.LIVE"),
|
||||||
,
|
|
||||||
@NamedQuery(
|
@NamedQuery(
|
||||||
name = "ContentItem.findDraftVersion",
|
name = "ContentItem.findDraftVersion",
|
||||||
query
|
query
|
||||||
= "SELECT DISTINCT i "
|
= "SELECT DISTINCT i "
|
||||||
+ "FROM ContentItem i "
|
+ "FROM ContentItem i "
|
||||||
+ "LEFT JOIN i.permissions p "
|
+ "LEFT JOIN i.permissions p "
|
||||||
+ "WHERE i.itemUuid = :uuid "
|
+ "WHERE i.itemUuid = :uuid "
|
||||||
+ "AND i.version = 'DRAFT' "
|
+ "AND i.version = 'DRAFT' "
|
||||||
+ "AND "
|
+ "AND "
|
||||||
+ "((p.grantee IN :roles "
|
+ "((p.grantee IN :roles "
|
||||||
+ "AND p.grantedPrivilege = '" + ItemPrivileges.PREVIEW + "' "
|
+ "AND p.grantedPrivilege = '" + ItemPrivileges.PREVIEW + "' "
|
||||||
+ ") OR true = :isSystemUser OR true = :isAdmin)")
|
+ ") OR true = :isSystemUser OR true = :isAdmin)"),
|
||||||
,
|
|
||||||
@NamedQuery(
|
@NamedQuery(
|
||||||
name = "ContentItem.findLiveVersion",
|
name = "ContentItem.findLiveVersion",
|
||||||
query
|
query
|
||||||
= "SELECT DISTINCT i "
|
= "SELECT DISTINCT i "
|
||||||
+ "FROM ContentItem i "
|
+ "FROM ContentItem i "
|
||||||
+ "LEFT JOIN i.permissions p "
|
+ "LEFT JOIN i.permissions p "
|
||||||
+ "WHERE i.itemUuid = :uuid "
|
+ "WHERE i.itemUuid = :uuid "
|
||||||
+ "AND i.version = 'LIVE' "
|
+ "AND i.version = 'LIVE' "
|
||||||
+ "AND "
|
+ "AND "
|
||||||
+ "((p.grantee IN :roles "
|
+ "((p.grantee IN :roles "
|
||||||
+ "AND p.grantedPrivilege = "
|
+ "AND p.grantedPrivilege = "
|
||||||
+ "'"
|
+ "'"
|
||||||
+ ItemPrivileges.VIEW_PUBLISHED
|
+ ItemPrivileges.VIEW_PUBLISHED
|
||||||
+ "' "
|
+ "' "
|
||||||
+ ") OR true = :isSystemUser OR true = :isAdmin)")
|
+ ") OR true = :isSystemUser OR true = :isAdmin)"),
|
||||||
,
|
|
||||||
@NamedQuery(
|
@NamedQuery(
|
||||||
name = "ContentItem.findItemWithWorkflow",
|
name = "ContentItem.findItemWithWorkflow",
|
||||||
query = "SELECT DISTINCT i "
|
query = "SELECT DISTINCT i "
|
||||||
|
|
@ -697,7 +670,7 @@ public class ContentItem extends CcmObject implements Serializable, Exportable {
|
||||||
private String ancestors;
|
private String ancestors;
|
||||||
|
|
||||||
@OneToMany(mappedBy = "item", fetch = FetchType.LAZY)
|
@OneToMany(mappedBy = "item", fetch = FetchType.LAZY)
|
||||||
@OrderBy("order ASC")
|
@OrderBy("list_order ASC")
|
||||||
@XmlElementWrapper(name = "attachments", namespace = CMS_XML_NS)
|
@XmlElementWrapper(name = "attachments", namespace = CMS_XML_NS)
|
||||||
@JsonIgnore
|
@JsonIgnore
|
||||||
private List<AttachmentList> attachments;
|
private List<AttachmentList> attachments;
|
||||||
|
|
@ -850,7 +823,6 @@ public class ContentItem extends CcmObject implements Serializable, Exportable {
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<AttachmentList> getAttachments() {
|
public List<AttachmentList> getAttachments() {
|
||||||
Collections.sort(attachments);
|
|
||||||
return Collections.unmodifiableList(attachments);
|
return Collections.unmodifiableList(attachments);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -680,7 +680,7 @@ public class ContentItemManager {
|
||||||
.getDescription());
|
.getDescription());
|
||||||
targetList.setItem(target);
|
targetList.setItem(target);
|
||||||
targetList.setName(sourceList.getName());
|
targetList.setName(sourceList.getName());
|
||||||
targetList.setOrder(sourceList.getOrder());
|
targetList.setListOrder(sourceList.getListOrder());
|
||||||
copyLocalizedString(sourceList.getTitle(), targetList.getTitle());
|
copyLocalizedString(sourceList.getTitle(), targetList.getTitle());
|
||||||
targetList.setUuid(UUID.randomUUID().toString());
|
targetList.setUuid(UUID.randomUUID().toString());
|
||||||
|
|
||||||
|
|
@ -1116,7 +1116,7 @@ public class ContentItemManager {
|
||||||
targetList.setName(sourceList.getName());
|
targetList.setName(sourceList.getName());
|
||||||
copyLocalizedString(sourceList.getTitle(),
|
copyLocalizedString(sourceList.getTitle(),
|
||||||
targetList.getTitle());
|
targetList.getTitle());
|
||||||
targetList.setOrder(sourceList.getOrder());
|
targetList.setListOrder(sourceList.getListOrder());
|
||||||
targetList.setUuid(UUID.randomUUID().toString());
|
targetList.setUuid(UUID.randomUUID().toString());
|
||||||
} else {
|
} else {
|
||||||
targetList = liveItem.getAttachments().get(i);
|
targetList = liveItem.getAttachments().get(i);
|
||||||
|
|
|
||||||
|
|
@ -164,7 +164,7 @@ public abstract class AbstractContentItemRenderer implements Serializable {
|
||||||
* "listId": {@link AttachmentList#getListId()}
|
* "listId": {@link AttachmentList#getListId()}
|
||||||
* "uuid": {@link AttachmentList#getUuid()}
|
* "uuid": {@link AttachmentList#getUuid()}
|
||||||
* "name": {@link AttachmentList#getName()}
|
* "name": {@link AttachmentList#getName()}
|
||||||
* "order": {@link AttachmentList#getOrder()}
|
* "order": {@link AttachmentList#getListOrder()}
|
||||||
* "title": {@link AttachmentList#getTitle()}
|
* "title": {@link AttachmentList#getTitle()}
|
||||||
* "description": {@link AttachmentList#getDescription()}
|
* "description": {@link AttachmentList#getDescription()}
|
||||||
* "attachments": {@link AttachmentList#getAttachments()}
|
* "attachments": {@link AttachmentList#getAttachments()}
|
||||||
|
|
@ -189,7 +189,7 @@ public abstract class AbstractContentItemRenderer implements Serializable {
|
||||||
result.put("listId", attachmentList.getListId());
|
result.put("listId", attachmentList.getListId());
|
||||||
result.put("uuid", attachmentList.getUuid());
|
result.put("uuid", attachmentList.getUuid());
|
||||||
result.put("name", attachmentList.getName());
|
result.put("name", attachmentList.getName());
|
||||||
result.put("order", attachmentList.getOrder());
|
result.put("order", attachmentList.getListOrder());
|
||||||
result.put("title", attachmentList.getTitle().getValue(language));
|
result.put("title", attachmentList.getTitle().getValue(language));
|
||||||
result.put("description",
|
result.put("description",
|
||||||
attachmentList.getDescription().getValue(language));
|
attachmentList.getDescription().getValue(language));
|
||||||
|
|
|
||||||
|
|
@ -2141,7 +2141,7 @@ public class RelatedInfoStep extends AbstractMvcAuthoringStep {
|
||||||
);
|
);
|
||||||
dto.setListId(attachmentList.getListId());
|
dto.setListId(attachmentList.getListId());
|
||||||
dto.setName(attachmentList.getName());
|
dto.setName(attachmentList.getName());
|
||||||
dto.setOrder(attachmentList.getOrder());
|
dto.setOrder(attachmentList.getListOrder());
|
||||||
dto.setTitle(
|
dto.setTitle(
|
||||||
globalizationHelper
|
globalizationHelper
|
||||||
.getValueFromLocalizedString(
|
.getValueFromLocalizedString(
|
||||||
|
|
|
||||||
|
|
@ -55,7 +55,7 @@ public class RelatedInfoStepModel {
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<AttachmentListDto> getAttachmentsLists() {
|
public List<AttachmentListDto> getAttachmentsLists() {
|
||||||
return attachmentsLists;
|
return Collections.unmodifiableList(attachmentsLists);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAttachmentsLists(List<AttachmentListDto> attachmentsLists) {
|
public void setAttachmentsLists(List<AttachmentListDto> attachmentsLists) {
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1 @@
|
||||||
|
/home/jensp/pwi/libreccm/git/libreccm/ccm-cms/src/main/resources/WEB-INF/views/org/librecms/ui/contentsection/assets/edit-contactable.xhtml
|
||||||
|
|
@ -88,7 +88,15 @@
|
||||||
<button class="btn btn-secondary save-order-button"
|
<button class="btn btn-secondary save-order-button"
|
||||||
disabled="disabled"
|
disabled="disabled"
|
||||||
type="button">
|
type="button">
|
||||||
<bootstrap:svgIcon icon="save" />
|
<span class="save-icon">
|
||||||
|
<bootstrap:svgIcon icon="save" />
|
||||||
|
</span>
|
||||||
|
<span class="save-spinner d-none">
|
||||||
|
<span aria-hidden="true"
|
||||||
|
class="spinner-border spinner-border-sm"
|
||||||
|
role="status"></span>
|
||||||
|
<span class="sr-only">#{CmsDefaultStepsMessageBundle['relatedinfo.attachmentlists.order.save.inprogress']}</span>
|
||||||
|
</span>
|
||||||
<span>#{CmsDefaultStepsMessageBundle['relatedinfo.attachmentlists.order.save']}</span>
|
<span>#{CmsDefaultStepsMessageBundle['relatedinfo.attachmentlists.order.save']}</span>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -293,7 +301,15 @@
|
||||||
<button class="btn btn-secondary save-order-button"
|
<button class="btn btn-secondary save-order-button"
|
||||||
disabled="disabled"
|
disabled="disabled"
|
||||||
type="button">
|
type="button">
|
||||||
<bootstrap:svgIcon icon="save" />
|
<span class="save-icon">
|
||||||
|
<bootstrap:svgIcon icon="save" />
|
||||||
|
</span>
|
||||||
|
<span class="save-spinner d-none">
|
||||||
|
<span aria-hidden="true"
|
||||||
|
class="spinner-border spinner-border-sm"
|
||||||
|
role="status"></span>
|
||||||
|
<span class="sr-only">#{CmsDefaultStepsMessageBundle['relatedinfo.attachmentlists.order.save.inprogress']}</span>
|
||||||
|
</span>
|
||||||
<span>#{CmsDefaultStepsMessageBundle['relatedinfo.attachmentlists.order.save']}</span>
|
<span>#{CmsDefaultStepsMessageBundle['relatedinfo.attachmentlists.order.save']}</span>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -238,3 +238,4 @@ relatedinfo.attachments.info.dialog.title=Attachment {1} of list {0}
|
||||||
relatedinfo.attachments.info.dialog.close=Close
|
relatedinfo.attachments.info.dialog.close=Close
|
||||||
relatedinfo.attachments.info.dialog.title.label=Title
|
relatedinfo.attachments.info.dialog.title.label=Title
|
||||||
relatedinfo.attachments.info.dialog.type.label=Type
|
relatedinfo.attachments.info.dialog.type.label=Type
|
||||||
|
relatedinfo.attachmentlists.order.save.inprogress=Saving...
|
||||||
|
|
|
||||||
|
|
@ -238,3 +238,4 @@ relatedinfo.attachments.info.dialog.title=Anhang {1} der List {0}
|
||||||
relatedinfo.attachments.info.dialog.close=Schlie\u00dfen
|
relatedinfo.attachments.info.dialog.close=Schlie\u00dfen
|
||||||
relatedinfo.attachments.info.dialog.title.label=Titel
|
relatedinfo.attachments.info.dialog.title.label=Titel
|
||||||
relatedinfo.attachments.info.dialog.type.label=Typ
|
relatedinfo.attachments.info.dialog.type.label=Typ
|
||||||
|
relatedinfo.attachmentlists.order.save.inprogress=Speichere...
|
||||||
|
|
|
||||||
|
|
@ -149,6 +149,17 @@ function saveOrder() {
|
||||||
"data-baseUrl attribute on cms-attachment-lists container is missing or empty."
|
"data-baseUrl attribute on cms-attachment-lists container is missing or empty."
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const saveOrderButtons = document.querySelectorAll(".save-order-button");
|
||||||
|
for (let i = 0; i < saveOrderButtons.length; i++) {
|
||||||
|
const saveOrderButton: HTMLButtonElement = saveOrderButtons[i] as HTMLButtonElement;
|
||||||
|
saveOrderButton.disabled = true;
|
||||||
|
const saveIcon = saveOrderButton.querySelector(".save-icon");
|
||||||
|
const spinner = saveOrderButton.querySelector(".save-spinner");
|
||||||
|
saveIcon?.classList.toggle("d-none");
|
||||||
|
spinner?.classList.toggle("d-none");
|
||||||
|
}
|
||||||
|
|
||||||
const headers = new Headers();
|
const headers = new Headers();
|
||||||
headers.append("Content-Type", "application/json");
|
headers.append("Content-Type", "application/json");
|
||||||
fetch(baseUrl, {
|
fetch(baseUrl, {
|
||||||
|
|
@ -159,15 +170,30 @@ function saveOrder() {
|
||||||
})
|
})
|
||||||
.then(response => {
|
.then(response => {
|
||||||
if (response.ok) {
|
if (response.ok) {
|
||||||
const saveOrderButtons =
|
// const saveOrderButtons =
|
||||||
document.querySelectorAll("save-order-button");
|
// document.querySelectorAll(".save-order-button");
|
||||||
for (let i = 0; i < saveOrderButtons.length; i++) {
|
for (let i = 0; i < saveOrderButtons.length; i++) {
|
||||||
const saveOrderButton: HTMLButtonElement = saveOrderButtons[
|
const saveOrderButton: HTMLButtonElement = saveOrderButtons[
|
||||||
i
|
i
|
||||||
] as HTMLButtonElement;
|
] as HTMLButtonElement;
|
||||||
saveOrderButton.disabled = true;
|
// saveOrderButton.disabled = true;
|
||||||
|
const saveIcon = saveOrderButton.querySelector(".save-icon");
|
||||||
|
const spinner = saveOrderButton.querySelector(".save-spinner");
|
||||||
|
saveIcon?.classList.toggle("d-none");
|
||||||
|
spinner?.classList.toggle("d-none");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
showSaveError();
|
||||||
|
for (let i = 0; i < saveOrderButtons.length; i++) {
|
||||||
|
const saveOrderButton: HTMLButtonElement = saveOrderButtons[
|
||||||
|
i
|
||||||
|
] as HTMLButtonElement;
|
||||||
|
saveOrderButton.disabled = false;
|
||||||
|
const saveIcon = saveOrderButton.querySelector(".save-icon");
|
||||||
|
const spinner = saveOrderButton.querySelector(".save-spinner");
|
||||||
|
saveIcon?.classList.toggle("d-none");
|
||||||
|
spinner?.classList.toggle("d-none");
|
||||||
|
}
|
||||||
throw Error(
|
throw Error(
|
||||||
`Failed to save attachments order. Response status: ${response.status}, statusText: ${response.statusText}`
|
`Failed to save attachments order. Response status: ${response.status}, statusText: ${response.statusText}`
|
||||||
);
|
);
|
||||||
|
|
@ -175,6 +201,16 @@ function saveOrder() {
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
showSaveError();
|
showSaveError();
|
||||||
|
for (let i = 0; i < saveOrderButtons.length; i++) {
|
||||||
|
const saveOrderButton: HTMLButtonElement = saveOrderButtons[
|
||||||
|
i
|
||||||
|
] as HTMLButtonElement;
|
||||||
|
saveOrderButton.disabled = false;
|
||||||
|
const saveIcon = saveOrderButton.querySelector(".save-icon");
|
||||||
|
const spinner = saveOrderButton.querySelector(".save-spinner");
|
||||||
|
saveIcon?.classList.toggle("d-none");
|
||||||
|
spinner?.classList.toggle("d-none");
|
||||||
|
}
|
||||||
throw new Error(`Failed to save attachments order: ${error}`);
|
throw new Error(`Failed to save attachments order: ${error}`);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue