CCM NG/ccm-cms: FolderBrowser now shows up, buts needs more testing
git-svn-id: https://svn.libreccm.org/ccm/ccm_ng@4561 8810af33-2d31-482b-a856-94f89814c4dfpull/2/head
parent
82d0ceffbd
commit
0a51a89ca9
|
|
@ -186,8 +186,10 @@ public abstract class NewItemForm extends Form {
|
||||||
if (isVisible(state)) {
|
if (isVisible(state)) {
|
||||||
final ContentSection section = getContentSection(state);
|
final ContentSection section = getContentSection(state);
|
||||||
|
|
||||||
final List<ContentType> types = section.getContentTypes();
|
final CdiUtil cdiUtil = CdiUtil.createCdiUtil();
|
||||||
boolean isEmpty = types.isEmpty();
|
final NewItemFormController controller = cdiUtil.findBean(
|
||||||
|
NewItemFormController.class);
|
||||||
|
boolean isEmpty = !controller.hasContentTypes(section);
|
||||||
|
|
||||||
createLabel.setVisible(state, !isEmpty);
|
createLabel.setVisible(state, !isEmpty);
|
||||||
typeSelect.setVisible(state, !isEmpty);
|
typeSelect.setVisible(state, !isEmpty);
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -22,6 +22,7 @@ import com.arsdigita.kernel.KernelConfig;
|
||||||
|
|
||||||
import org.libreccm.configuration.ConfigurationManager;
|
import org.libreccm.configuration.ConfigurationManager;
|
||||||
import org.libreccm.core.CcmObject;
|
import org.libreccm.core.CcmObject;
|
||||||
|
import org.libreccm.core.CcmObjectRepository;
|
||||||
import org.libreccm.l10n.GlobalizationHelper;
|
import org.libreccm.l10n.GlobalizationHelper;
|
||||||
import org.libreccm.l10n.LocalizedString;
|
import org.libreccm.l10n.LocalizedString;
|
||||||
import org.librecms.contentsection.ContentItem;
|
import org.librecms.contentsection.ContentItem;
|
||||||
|
|
@ -32,6 +33,7 @@ import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
import java.util.Optional;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import javax.annotation.PostConstruct;
|
import javax.annotation.PostConstruct;
|
||||||
|
|
@ -51,6 +53,9 @@ public class FolderBrowserController {
|
||||||
@Inject
|
@Inject
|
||||||
private EntityManager entityManager;
|
private EntityManager entityManager;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private CcmObjectRepository objectRepo;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private ConfigurationManager confManager;
|
private ConfigurationManager confManager;
|
||||||
|
|
||||||
|
|
@ -164,7 +169,7 @@ public class FolderBrowserController {
|
||||||
final TypedQuery<CcmObject> query = entityManager.createNamedQuery(
|
final TypedQuery<CcmObject> query = entityManager.createNamedQuery(
|
||||||
"Folder.findObjects", CcmObject.class);
|
"Folder.findObjects", CcmObject.class);
|
||||||
query.setParameter("folder", folder);
|
query.setParameter("folder", folder);
|
||||||
query.setParameter(filterTerm, filterTerm);
|
query.setParameter("term", filterTerm);
|
||||||
|
|
||||||
if (first > 0 && maxResults > 0) {
|
if (first > 0 && maxResults > 0) {
|
||||||
query.setFirstResult(first);
|
query.setFirstResult(first);
|
||||||
|
|
@ -174,40 +179,22 @@ public class FolderBrowserController {
|
||||||
return query.getResultList();
|
return query.getResultList();
|
||||||
}
|
}
|
||||||
|
|
||||||
public int countObjects(final Folder folder) {
|
public long countObjects(final Folder folder) {
|
||||||
return countObjects(folder, -1, -1);
|
return countObjects(folder, "%");
|
||||||
}
|
}
|
||||||
|
|
||||||
public int countObjects(final Folder folder,
|
public long countObjects(final Folder folder,
|
||||||
final int frist,
|
final String filterTerm) {
|
||||||
final int maxResults) {
|
final TypedQuery<Long> query = entityManager.createNamedQuery(
|
||||||
return countObjects(folder, "%", frist, maxResults);
|
"Folder.countObjects", Long.class);
|
||||||
}
|
|
||||||
|
|
||||||
public int countObjects(final Folder folder,
|
|
||||||
final String filterTerm) {
|
|
||||||
return countObjects(folder, filterTerm, -1, -1);
|
|
||||||
}
|
|
||||||
|
|
||||||
public int countObjects(final Folder folder,
|
|
||||||
final String filterTerm,
|
|
||||||
final int first,
|
|
||||||
final int maxResults) {
|
|
||||||
final TypedQuery<Integer> query = entityManager.createNamedQuery(
|
|
||||||
"Folder.countObjects", Integer.class);
|
|
||||||
query.setParameter("folder", folder);
|
query.setParameter("folder", folder);
|
||||||
query.setParameter(filterTerm, filterTerm);
|
query.setParameter("term", filterTerm);
|
||||||
|
|
||||||
if (first > 0 && maxResults > 0) {
|
|
||||||
query.setFirstResult(first);
|
|
||||||
query.setMaxResults(maxResults);
|
|
||||||
}
|
|
||||||
|
|
||||||
return query.getSingleResult();
|
return query.getSingleResult();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional(Transactional.TxType.REQUIRED)
|
@Transactional(Transactional.TxType.REQUIRED)
|
||||||
protected List<FolderBrowserTableRow> getObjectRows(final Folder folder) {
|
List<FolderBrowserTableRow> getObjectRows(final Folder folder) {
|
||||||
final List<CcmObject> objects = findObjects(folder);
|
final List<CcmObject> objects = findObjects(folder);
|
||||||
|
|
||||||
return objects.stream()
|
return objects.stream()
|
||||||
|
|
@ -216,8 +203,8 @@ public class FolderBrowserController {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional(Transactional.TxType.REQUIRED)
|
@Transactional(Transactional.TxType.REQUIRED)
|
||||||
protected List<FolderBrowserTableRow> getObjectRows(final Folder folder,
|
List<FolderBrowserTableRow> getObjectRows(final Folder folder,
|
||||||
final String filterTerm) {
|
final String filterTerm) {
|
||||||
final List<CcmObject> objects = findObjects(folder,
|
final List<CcmObject> objects = findObjects(folder,
|
||||||
filterTerm);
|
filterTerm);
|
||||||
|
|
||||||
|
|
@ -227,9 +214,9 @@ public class FolderBrowserController {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional(Transactional.TxType.REQUIRED)
|
@Transactional(Transactional.TxType.REQUIRED)
|
||||||
protected List<FolderBrowserTableRow> getObjectRows(final Folder folder,
|
List<FolderBrowserTableRow> getObjectRows(final Folder folder,
|
||||||
final int first,
|
final int first,
|
||||||
final int maxResults) {
|
final int maxResults) {
|
||||||
final List<CcmObject> objects = findObjects(folder, first, maxResults);
|
final List<CcmObject> objects = findObjects(folder, first, maxResults);
|
||||||
|
|
||||||
return objects.stream()
|
return objects.stream()
|
||||||
|
|
@ -238,10 +225,10 @@ public class FolderBrowserController {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional(Transactional.TxType.REQUIRED)
|
@Transactional(Transactional.TxType.REQUIRED)
|
||||||
protected List<FolderBrowserTableRow> getObjectRows(final Folder folder,
|
List<FolderBrowserTableRow> getObjectRows(final Folder folder,
|
||||||
final String filterTerm,
|
final String filterTerm,
|
||||||
final int first,
|
final int first,
|
||||||
final int maxResults) {
|
final int maxResults) {
|
||||||
final List<CcmObject> objects = findObjects(folder,
|
final List<CcmObject> objects = findObjects(folder,
|
||||||
filterTerm,
|
filterTerm,
|
||||||
first,
|
first,
|
||||||
|
|
@ -297,4 +284,13 @@ public class FolderBrowserController {
|
||||||
return row;
|
return row;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Transactional(Transactional.TxType.REQUIRED)
|
||||||
|
protected void deleteObject(final long objectId) {
|
||||||
|
final Optional<CcmObject> object = objectRepo.findById(objectId);
|
||||||
|
|
||||||
|
if (object.isPresent()) {
|
||||||
|
objectRepo.delete(object.get());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,6 @@ package com.arsdigita.cms.ui.folder;
|
||||||
import com.arsdigita.bebop.PageState;
|
import com.arsdigita.bebop.PageState;
|
||||||
import com.arsdigita.bebop.PaginationModelBuilder;
|
import com.arsdigita.bebop.PaginationModelBuilder;
|
||||||
import com.arsdigita.bebop.Paginator;
|
import com.arsdigita.bebop.Paginator;
|
||||||
import com.arsdigita.bebop.Table;
|
|
||||||
|
|
||||||
import org.libreccm.cdi.utils.CdiUtil;
|
import org.libreccm.cdi.utils.CdiUtil;
|
||||||
import org.librecms.contentsection.Folder;
|
import org.librecms.contentsection.Folder;
|
||||||
|
|
@ -66,9 +65,10 @@ class FolderBrowserPaginationModelBuilder implements PaginationModelBuilder {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (filterTerm == null) {
|
if (filterTerm == null) {
|
||||||
return controller.countObjects(folder, first, pageSize);
|
return (int) controller.countObjects(folder);
|
||||||
} else {
|
} else {
|
||||||
return controller.countObjects(folder, filter, first, pageSize);
|
return (int) controller.countObjects(folder,
|
||||||
|
filter);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -26,11 +26,9 @@ import com.arsdigita.bebop.table.TableModelBuilder;
|
||||||
import com.arsdigita.util.LockableImpl;
|
import com.arsdigita.util.LockableImpl;
|
||||||
|
|
||||||
import org.libreccm.cdi.utils.CdiUtil;
|
import org.libreccm.cdi.utils.CdiUtil;
|
||||||
import org.librecms.contentsection.ContentItem;
|
|
||||||
import org.librecms.contentsection.Folder;
|
import org.librecms.contentsection.Folder;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -102,19 +102,19 @@ import org.librecms.contentsection.privileges.ItemPrivileges;
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("PMD.BeanMembersShouldSerialize")
|
@SuppressWarnings("PMD.BeanMembersShouldSerialize")
|
||||||
public class FolderManipulator extends SimpleContainer implements
|
public class FolderManipulator extends SimpleContainer implements
|
||||||
//FormProcessListener,
|
//FormProcessListener,
|
||||||
//FormValidationListener,
|
//FormValidationListener,
|
||||||
//FormSubmissionListener,
|
//FormSubmissionListener,
|
||||||
Resettable {
|
Resettable {
|
||||||
|
|
||||||
//public static final String RESOURCE_BUNDLE = "com.arsdigita.cms.ui.folder.CMSFolderResources";
|
//public static final String RESOURCE_BUNDLE = "com.arsdigita.cms.ui.folder.CMSFolderResources";
|
||||||
private static final Logger LOGGER = LogManager.getLogger(
|
private static final Logger LOGGER = LogManager.getLogger(
|
||||||
FolderManipulator.class);
|
FolderManipulator.class);
|
||||||
|
|
||||||
private static final String ATOZ_FILTER_PARAM = "aToZfilter";
|
private static final String ATOZ_FILTER_PARAM = "aToZfilter";
|
||||||
private static final String ACTION_PARAM = "act";
|
private static final String ACTION_PARAM = "act";
|
||||||
private static final String FILTER_PARAM = "filter";
|
private static final String FILTER_PARAM = "filter";
|
||||||
|
|
||||||
private static final String SOURCES_PARAM = "srcs";
|
private static final String SOURCES_PARAM = "srcs";
|
||||||
private static final String MOVE = "Move";
|
private static final String MOVE = "Move";
|
||||||
private static final String COPY = "Copy";
|
private static final String COPY = "Copy";
|
||||||
|
|
@ -122,8 +122,9 @@ public class FolderManipulator extends SimpleContainer implements
|
||||||
//private static final String UNPUBLISH = "UnPublish";
|
//private static final String UNPUBLISH = "UnPublish";
|
||||||
|
|
||||||
private final ArrayParameter sourcesParam = new ArrayParameter(
|
private final ArrayParameter sourcesParam = new ArrayParameter(
|
||||||
new BigDecimalParameter(SOURCES_PARAM));
|
new BigDecimalParameter(SOURCES_PARAM));
|
||||||
private final StringParameter actionParam = new StringParameter(ACTION_PARAM);
|
private final StringParameter actionParam
|
||||||
|
= new StringParameter(ACTION_PARAM);
|
||||||
;
|
;
|
||||||
/**
|
/**
|
||||||
* The folder in which the source items live.
|
* The folder in which the source items live.
|
||||||
|
|
@ -135,32 +136,33 @@ public class FolderManipulator extends SimpleContainer implements
|
||||||
|
|
||||||
private FilterForm filterForm;
|
private FilterForm filterForm;
|
||||||
private final StringParameter atozFilterParam = new StringParameter(
|
private final StringParameter atozFilterParam = new StringParameter(
|
||||||
ATOZ_FILTER_PARAM);
|
ATOZ_FILTER_PARAM);
|
||||||
private final StringParameter filterParam = new StringParameter(FILTER_PARAM);
|
private final StringParameter filterParam
|
||||||
|
= new StringParameter(FILTER_PARAM);
|
||||||
|
|
||||||
public FolderManipulator(final FolderSelectionModel folderModel) {
|
public FolderManipulator(final FolderSelectionModel folderModel) {
|
||||||
|
|
||||||
super();
|
super();
|
||||||
|
|
||||||
sourceFolderModel = folderModel;
|
sourceFolderModel = folderModel;
|
||||||
itemView = new ItemView();
|
itemView = new ItemView();
|
||||||
itemView.addProcessListener(new ItemViewProcessListener());
|
itemView.addProcessListener(new ItemViewProcessListener());
|
||||||
itemView.addValidationListener(new ItemViewValidationListener());
|
itemView.addValidationListener(new ItemViewValidationListener());
|
||||||
add(itemView);
|
add(itemView);
|
||||||
|
|
||||||
targetSelector.addProcessListener(new TargetSelectorProcessListener());
|
targetSelector.addProcessListener(new TargetSelectorProcessListener());
|
||||||
targetSelector.addValidationListener(
|
targetSelector.addValidationListener(
|
||||||
new TargetSelectorValidationListener());
|
new TargetSelectorValidationListener());
|
||||||
targetSelector.addSubmissionListener(
|
targetSelector.addSubmissionListener(
|
||||||
new TargetSelectorSubmissionListener());
|
new TargetSelectorSubmissionListener());
|
||||||
add(targetSelector);
|
add(targetSelector);
|
||||||
|
|
||||||
//publishDialog.addProcessListener(new PublishDialogProcessListener());
|
//publishDialog.addProcessListener(new PublishDialogProcessListener());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void register(final Page page) {
|
public void register(final Page page) {
|
||||||
|
|
||||||
super.register(page);
|
super.register(page);
|
||||||
page.setVisibleDefault(targetSelector, false);
|
page.setVisibleDefault(targetSelector, false);
|
||||||
page.setVisibleDefault(filterForm, true);
|
page.setVisibleDefault(filterForm, true);
|
||||||
|
|
@ -168,11 +170,11 @@ public class FolderManipulator extends SimpleContainer implements
|
||||||
page.addComponentStateParam(this, actionParam);
|
page.addComponentStateParam(this, actionParam);
|
||||||
page.addComponentStateParam(this, atozFilterParam);
|
page.addComponentStateParam(this, atozFilterParam);
|
||||||
page.addComponentStateParam(this, filterParam);
|
page.addComponentStateParam(this, filterParam);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public final Long[] getSources(final PageState state) {
|
public final Long[] getSources(final PageState state) {
|
||||||
|
|
||||||
final Long[] result = (Long[]) state.getValue(sourcesParam);
|
final Long[] result = (Long[]) state.getValue(sourcesParam);
|
||||||
|
|
||||||
//Return empty array instead of null.
|
//Return empty array instead of null.
|
||||||
|
|
@ -182,19 +184,19 @@ public class FolderManipulator extends SimpleContainer implements
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public final FolderSelectionModel getSourceFolderModel() {
|
public final FolderSelectionModel getSourceFolderModel() {
|
||||||
return sourceFolderModel;
|
return sourceFolderModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
public final Category getTarget(final PageState state) {
|
public final Category getTarget(final PageState state) {
|
||||||
return targetSelector.getTarget(state);
|
return targetSelector.getTarget(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected final boolean isMove(final PageState state) {
|
protected final boolean isMove(final PageState state) {
|
||||||
return MOVE.equals(getAction(state));
|
return MOVE.equals(getAction(state));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected final boolean isCopy(final PageState state) {
|
protected final boolean isCopy(final PageState state) {
|
||||||
return COPY.equals(getAction(state));
|
return COPY.equals(getAction(state));
|
||||||
}
|
}
|
||||||
|
|
@ -209,18 +211,18 @@ public class FolderManipulator extends SimpleContainer implements
|
||||||
private String getAction(final PageState state) {
|
private String getAction(final PageState state) {
|
||||||
return (String) state.getValue(actionParam);
|
return (String) state.getValue(actionParam);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void moveItems(final Category target,
|
protected void moveItems(final Category target,
|
||||||
final Long[] itemIds) {
|
final Long[] itemIds) {
|
||||||
|
|
||||||
for (Long itemId : itemIds) {
|
for (Long itemId : itemIds) {
|
||||||
|
|
||||||
changeItemParent(itemId, target);
|
changeItemParent(itemId, target);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void changeItemParent(final Long itemId, final Category newParent) {
|
private void changeItemParent(final Long itemId, final Category newParent) {
|
||||||
|
|
||||||
//ToDo
|
//ToDo
|
||||||
|
|
@ -239,7 +241,7 @@ public class FolderManipulator extends SimpleContainer implements
|
||||||
// item.setParent(newParent);
|
// item.setParent(newParent);
|
||||||
// item.save();
|
// item.save();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void copyItems(final Category target,
|
protected void copyItems(final Category target,
|
||||||
final Long[] itemIds) {
|
final Long[] itemIds) {
|
||||||
|
|
||||||
|
|
@ -421,53 +423,53 @@ public class FolderManipulator extends SimpleContainer implements
|
||||||
public final FolderBrowser getBrowser() {
|
public final FolderBrowser getBrowser() {
|
||||||
return itemView.getBrowser();
|
return itemView.getBrowser();
|
||||||
}
|
}
|
||||||
|
|
||||||
private class ItemViewProcessListener implements FormProcessListener {
|
private class ItemViewProcessListener implements FormProcessListener {
|
||||||
|
|
||||||
public ItemViewProcessListener() {
|
public ItemViewProcessListener() {
|
||||||
//Nothing
|
//Nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void process(final FormSectionEvent event) throws
|
public void process(final FormSectionEvent event) throws
|
||||||
FormProcessException {
|
FormProcessException {
|
||||||
final PageState state = event.getPageState();
|
final PageState state = event.getPageState();
|
||||||
|
|
||||||
itemView.setVisible(state, false);
|
itemView.setVisible(state, false);
|
||||||
targetSelector.setVisible(state, true);
|
targetSelector.setVisible(state, true);
|
||||||
targetSelector.expose(state);
|
targetSelector.expose(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private class TargetSelectorProcessListener implements FormProcessListener {
|
private class TargetSelectorProcessListener implements FormProcessListener {
|
||||||
|
|
||||||
public TargetSelectorProcessListener() {
|
public TargetSelectorProcessListener() {
|
||||||
//Nothing
|
//Nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void process(final FormSectionEvent event) throws
|
public void process(final FormSectionEvent event) throws
|
||||||
FormProcessException {
|
FormProcessException {
|
||||||
|
|
||||||
final PageState state = event.getPageState();
|
final PageState state = event.getPageState();
|
||||||
|
|
||||||
itemView.setVisible(state, true);
|
itemView.setVisible(state, true);
|
||||||
targetSelector.setVisible(state, false);
|
targetSelector.setVisible(state, false);
|
||||||
|
|
||||||
final Category folder = targetSelector.getTarget(state);
|
final Category folder = targetSelector.getTarget(state);
|
||||||
final Long[] itemIds = getSources(state);
|
final Long[] itemIds = getSources(state);
|
||||||
|
|
||||||
if (isCopy(state)) {
|
if (isCopy(state)) {
|
||||||
copyItems(folder, itemIds);
|
copyItems(folder, itemIds);
|
||||||
} else if (isMove(state)) {
|
} else if (isMove(state)) {
|
||||||
moveItems(folder, itemIds);
|
moveItems(folder, itemIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
reset(state);
|
reset(state);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// private class PublishDialogProcessListener implements FormProcessListener {
|
// private class PublishDialogProcessListener implements FormProcessListener {
|
||||||
|
|
@ -497,113 +499,113 @@ public class FolderManipulator extends SimpleContainer implements
|
||||||
//
|
//
|
||||||
// }
|
// }
|
||||||
private class ItemViewValidationListener implements FormValidationListener {
|
private class ItemViewValidationListener implements FormValidationListener {
|
||||||
|
|
||||||
public ItemViewValidationListener() {
|
public ItemViewValidationListener() {
|
||||||
//Nothing
|
//Nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void validate(final FormSectionEvent event) throws
|
public void validate(final FormSectionEvent event) throws
|
||||||
FormProcessException {
|
FormProcessException {
|
||||||
|
|
||||||
final PageState state = event.getPageState();
|
final PageState state = event.getPageState();
|
||||||
final FormData data = event.getFormData();
|
final FormData data = event.getFormData();
|
||||||
|
|
||||||
if (getSources(state).length <= 0) {
|
if (getSources(state).length <= 0) {
|
||||||
data.addError("cms.ui.folder.must_select_item",
|
data.addError("cms.ui.folder.must_select_item",
|
||||||
CmsConstants.CMS_FOLDER_BUNDLE);
|
CmsConstants.CMS_FOLDER_BUNDLE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private class TargetSelectorValidationListener implements
|
private class TargetSelectorValidationListener implements
|
||||||
FormValidationListener {
|
FormValidationListener {
|
||||||
|
|
||||||
public TargetSelectorValidationListener() {
|
public TargetSelectorValidationListener() {
|
||||||
//Nothing
|
//Nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void validate(final FormSectionEvent event) throws
|
public void validate(final FormSectionEvent event) throws
|
||||||
FormProcessException {
|
FormProcessException {
|
||||||
|
|
||||||
final PageState state = event.getPageState();
|
final PageState state = event.getPageState();
|
||||||
|
|
||||||
if (getSources(state).length <= 0) {
|
if (getSources(state).length <= 0) {
|
||||||
throw new IllegalStateException("No source items specified");
|
throw new IllegalStateException("No source items specified");
|
||||||
}
|
}
|
||||||
|
|
||||||
final Category target = targetSelector.getTarget(state);
|
final Category target = targetSelector.getTarget(state);
|
||||||
final FormData data = event.getFormData();
|
final FormData data = event.getFormData();
|
||||||
if (target == null) {
|
if (target == null) {
|
||||||
data.addError(new GlobalizedMessage(
|
data.addError(new GlobalizedMessage(
|
||||||
"cms.ui.folder.need_select_target_folder",
|
"cms.ui.folder.need_select_target_folder",
|
||||||
CmsConstants.CMS_FOLDER_BUNDLE));
|
CmsConstants.CMS_FOLDER_BUNDLE));
|
||||||
//If the target is null, we can skip the rest of the checks
|
//If the target is null, we can skip the rest of the checks
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (target.equals(sourceFolderModel.getSelectedObject(state))) {
|
if (target.equals(sourceFolderModel.getSelectedObject(state))) {
|
||||||
data.addError(new GlobalizedMessage(
|
data.addError(new GlobalizedMessage(
|
||||||
"cms.ui.folder.not_within_same_folder",
|
"cms.ui.folder.not_within_same_folder",
|
||||||
CmsConstants.CMS_FOLDER_BUNDLE));
|
CmsConstants.CMS_FOLDER_BUNDLE));
|
||||||
}
|
}
|
||||||
|
|
||||||
// check create item permission
|
// check create item permission
|
||||||
final CdiUtil cdiUtil = CdiUtil.createCdiUtil();
|
final CdiUtil cdiUtil = CdiUtil.createCdiUtil();
|
||||||
final Shiro shiro = cdiUtil.findBean(Shiro.class);
|
final Shiro shiro = cdiUtil.findBean(Shiro.class);
|
||||||
final PermissionChecker permissionChecker = cdiUtil.findBean(
|
final PermissionChecker permissionChecker = cdiUtil.findBean(
|
||||||
PermissionChecker.class);
|
PermissionChecker.class);
|
||||||
if (!permissionChecker.isPermitted(
|
if (!permissionChecker.isPermitted(
|
||||||
ItemPrivileges.CREATE_NEW, target)) {
|
ItemPrivileges.CREATE_NEW, target)) {
|
||||||
data.addError("cms.ui.folder.no_permission_for_item",
|
data.addError("cms.ui.folder.no_permission_for_item",
|
||||||
CmsConstants.CMS_FOLDER_BUNDLE);
|
CmsConstants.CMS_FOLDER_BUNDLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Long source : getSources(state)) {
|
for (Long source : getSources(state)) {
|
||||||
|
|
||||||
validateItem(source, target, state, data);
|
validateItem(source, target, state, data);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void validateItem(final Long itemId,
|
private void validateItem(final Long itemId,
|
||||||
final Category target,
|
final Category target,
|
||||||
final PageState state,
|
final PageState state,
|
||||||
final FormData data) {
|
final FormData data) {
|
||||||
final CdiUtil cdiUtil = CdiUtil.createCdiUtil();
|
final CdiUtil cdiUtil = CdiUtil.createCdiUtil();
|
||||||
final ContentItemRepository itemRepo = cdiUtil.findBean(
|
final ContentItemRepository itemRepo = cdiUtil.findBean(
|
||||||
ContentItemRepository.class);
|
ContentItemRepository.class);
|
||||||
final ContentItemManager itemManager = cdiUtil.findBean(
|
final ContentItemManager itemManager = cdiUtil.findBean(
|
||||||
ContentItemManager.class);
|
ContentItemManager.class);
|
||||||
final PermissionChecker permissionChecker = cdiUtil.findBean(
|
final PermissionChecker permissionChecker = cdiUtil.findBean(
|
||||||
PermissionChecker.class);
|
PermissionChecker.class);
|
||||||
|
|
||||||
final ContentItem item = itemRepo.findById(itemId).get();
|
final ContentItem item = itemRepo.findById(itemId).get();
|
||||||
final String name = item.getDisplayName();
|
final String name = item.getDisplayName();
|
||||||
|
|
||||||
final long count = itemRepo.countByNameInFolder(target, name);
|
final long count = itemRepo.countByNameInFolder(target, name);
|
||||||
if (count > 0) {
|
if (count > 0) {
|
||||||
// there is an item in the target folder that already has this name
|
// there is an item in the target folder that already has this name
|
||||||
addErrorMessage(data, "cms.ui.folder.item_already_exists", name);
|
addErrorMessage(data, "cms.ui.folder.item_already_exists", name);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (itemManager.isLive(item) && isMove(state)) {
|
if (itemManager.isLive(item) && isMove(state)) {
|
||||||
addErrorMessage(data, "cms.ui.folder.item_is_live", name);
|
addErrorMessage(data, "cms.ui.folder.item_is_live", name);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(permissionChecker.isPermitted(
|
if (!(permissionChecker.isPermitted(
|
||||||
ItemPrivileges.DELETE, item))
|
ItemPrivileges.DELETE, item))
|
||||||
&& isMove(state)) {
|
&& isMove(state)) {
|
||||||
addErrorMessage(data, "cms.ui.folder.no_permission_for_item",
|
addErrorMessage(data, "cms.ui.folder.no_permission_for_item",
|
||||||
name);
|
name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addErrorMessage(final FormData data,
|
private void addErrorMessage(final FormData data,
|
||||||
final String message,
|
final String message,
|
||||||
final String itemName) {
|
final String itemName) {
|
||||||
|
|
@ -624,32 +626,32 @@ public class FolderManipulator extends SimpleContainer implements
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
private class TargetSelectorSubmissionListener implements
|
private class TargetSelectorSubmissionListener implements
|
||||||
FormSubmissionListener {
|
FormSubmissionListener {
|
||||||
|
|
||||||
public TargetSelectorSubmissionListener() {
|
public TargetSelectorSubmissionListener() {
|
||||||
//Nothing
|
//Nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void submitted(final FormSectionEvent event) throws
|
public void submitted(final FormSectionEvent event) throws
|
||||||
FormProcessException {
|
FormProcessException {
|
||||||
|
|
||||||
final PageState state = event.getPageState();
|
final PageState state = event.getPageState();
|
||||||
|
|
||||||
if (targetSelector.isCancelled(state)) {
|
if (targetSelector.isCancelled(state)) {
|
||||||
reset(state);
|
reset(state);
|
||||||
throw new FormProcessException(new GlobalizedMessage(
|
throw new FormProcessException(new GlobalizedMessage(
|
||||||
"cms.ui.folder.cancelled",
|
"cms.ui.folder.cancelled",
|
||||||
CmsConstants.CMS_FOLDER_BUNDLE));
|
CmsConstants.CMS_FOLDER_BUNDLE));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void reset(final PageState state) {
|
public void reset(final PageState state) {
|
||||||
|
|
||||||
itemView.setVisible(state, true);
|
itemView.setVisible(state, true);
|
||||||
itemView.reset(state);
|
itemView.reset(state);
|
||||||
targetSelector.setVisible(state, false);
|
targetSelector.setVisible(state, false);
|
||||||
|
|
@ -659,55 +661,55 @@ public class FolderManipulator extends SimpleContainer implements
|
||||||
state.setValue(sourcesParam, null);
|
state.setValue(sourcesParam, null);
|
||||||
//s.setValue(m_aToZfilter, null);
|
//s.setValue(m_aToZfilter, null);
|
||||||
state.setValue(filterParam, null);
|
state.setValue(filterParam, null);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// The form containing the tree to select the target folder from
|
// The form containing the tree to select the target folder from
|
||||||
private class TargetSelector extends Form implements Resettable {
|
private class TargetSelector extends Form implements Resettable {
|
||||||
|
|
||||||
private final FolderSelectionModel targetModel;
|
private final FolderSelectionModel targetModel;
|
||||||
private final FolderTree folderTree;
|
private final FolderTree folderTree;
|
||||||
private final Submit cancelButton;
|
private final Submit cancelButton;
|
||||||
|
|
||||||
public TargetSelector() {
|
public TargetSelector() {
|
||||||
super("targetSel", new BoxPanel());
|
super("targetSel", new BoxPanel());
|
||||||
setMethod(GET);
|
setMethod(GET);
|
||||||
targetModel = new FolderSelectionModel("target");
|
targetModel = new FolderSelectionModel("target");
|
||||||
folderTree = new FolderTree(targetModel);
|
folderTree = new FolderTree(targetModel);
|
||||||
folderTree.setCellRenderer(new FolderTreeCellRenderer());
|
folderTree.setCellRenderer(new FolderTreeCellRenderer());
|
||||||
|
|
||||||
final Label label = new Label(new PrintListener() {
|
final Label label = new Label(new PrintListener() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void prepare(final PrintEvent event) {
|
public void prepare(final PrintEvent event) {
|
||||||
final PageState state = event.getPageState();
|
final PageState state = event.getPageState();
|
||||||
final Label label = (Label) event.getTarget();
|
final Label label = (Label) event.getTarget();
|
||||||
final int numberOfItems = getSources(state).length;
|
final int numberOfItems = getSources(state).length;
|
||||||
final Category folder = (Category) sourceFolderModel.
|
final Category folder = (Category) sourceFolderModel.
|
||||||
getSelectedObject(state);
|
getSelectedObject(state);
|
||||||
final CdiUtil cdiUtil = CdiUtil.createCdiUtil();
|
final CdiUtil cdiUtil = CdiUtil.createCdiUtil();
|
||||||
final CategoryManager categoryManager = cdiUtil.
|
final CategoryManager categoryManager = cdiUtil.
|
||||||
findBean(CategoryManager.class);
|
findBean(CategoryManager.class);
|
||||||
|
|
||||||
if (isMove(state)) {
|
if (isMove(state)) {
|
||||||
|
|
||||||
label.setLabel(new GlobalizedMessage(
|
label.setLabel(new GlobalizedMessage(
|
||||||
"cms.ui.folder.move",
|
"cms.ui.folder.move",
|
||||||
CmsConstants.CMS_FOLDER_BUNDLE,
|
CmsConstants.CMS_FOLDER_BUNDLE,
|
||||||
new Object[]{numberOfItems,
|
new Object[]{numberOfItems,
|
||||||
categoryManager.getCategoryPath(
|
categoryManager.getCategoryPath(
|
||||||
folder)}));
|
folder)}));
|
||||||
} else if (isCopy(state)) {
|
} else if (isCopy(state)) {
|
||||||
label.setLabel(new GlobalizedMessage(
|
label.setLabel(new GlobalizedMessage(
|
||||||
"cms.ui.folder.copy",
|
"cms.ui.folder.copy",
|
||||||
new Object[]{numberOfItems,
|
new Object[]{numberOfItems,
|
||||||
categoryManager.getCategoryPath(
|
categoryManager.getCategoryPath(
|
||||||
folder)}));
|
folder)}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
label.setOutputEscaping(false);
|
label.setOutputEscaping(false);
|
||||||
add(label);
|
add(label);
|
||||||
add(folderTree);
|
add(folderTree);
|
||||||
|
|
@ -716,7 +718,7 @@ public class FolderManipulator extends SimpleContainer implements
|
||||||
cancelButton = saveCancelSection.getCancelButton();
|
cancelButton = saveCancelSection.getCancelButton();
|
||||||
add(saveCancelSection);
|
add(saveCancelSection);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void register(final Page page) {
|
public void register(final Page page) {
|
||||||
super.register(page);
|
super.register(page);
|
||||||
|
|
@ -726,13 +728,13 @@ public class FolderManipulator extends SimpleContainer implements
|
||||||
// Set things up the first time the selector gets visible
|
// Set things up the first time the selector gets visible
|
||||||
public void expose(final PageState state) {
|
public void expose(final PageState state) {
|
||||||
final Category folder = (Category) sourceFolderModel.
|
final Category folder = (Category) sourceFolderModel.
|
||||||
getSelectedObject(
|
getSelectedObject(
|
||||||
state);
|
state);
|
||||||
targetModel.clearSelection(state);
|
targetModel.clearSelection(state);
|
||||||
if (folder != null) {
|
if (folder != null) {
|
||||||
final CdiUtil cdiUtil = CdiUtil.createCdiUtil();
|
final CdiUtil cdiUtil = CdiUtil.createCdiUtil();
|
||||||
final ContentItemManager itemManager = cdiUtil.findBean(
|
final ContentItemManager itemManager = cdiUtil.findBean(
|
||||||
ContentItemManager.class);
|
ContentItemManager.class);
|
||||||
|
|
||||||
//ToDo
|
//ToDo
|
||||||
// final ItemCollection items = folder.getPathInfo(true);
|
// final ItemCollection items = folder.getPathInfo(true);
|
||||||
|
|
@ -742,7 +744,7 @@ public class FolderManipulator extends SimpleContainer implements
|
||||||
// items.close();
|
// items.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void reset(final PageState state) {
|
public void reset(final PageState state) {
|
||||||
folderTree.clearSelection(state);
|
folderTree.clearSelection(state);
|
||||||
|
|
@ -751,15 +753,15 @@ public class FolderManipulator extends SimpleContainer implements
|
||||||
state.setValue(folderTree.getSelectionModel().getStateParameter(),
|
state.setValue(folderTree.getSelectionModel().getStateParameter(),
|
||||||
null);
|
null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Category getTarget(final PageState state) {
|
public Category getTarget(final PageState state) {
|
||||||
return (Category) targetModel.getSelectedObject(state);
|
return (Category) targetModel.getSelectedObject(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isCancelled(final PageState state) {
|
public boolean isCancelled(final PageState state) {
|
||||||
return cancelButton.isSelected(state);
|
return cancelButton.isSelected(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//The form which is show for the publish and unpublish action
|
//The form which is show for the publish and unpublish action
|
||||||
|
|
@ -803,63 +805,65 @@ public class FolderManipulator extends SimpleContainer implements
|
||||||
// The form containing the browser and the drop down for selecting an
|
// The form containing the browser and the drop down for selecting an
|
||||||
// action
|
// action
|
||||||
private class ItemView extends Form implements Resettable {
|
private class ItemView extends Form implements Resettable {
|
||||||
|
|
||||||
private static final String ITEM_VIEW = "itemView";
|
private static final String ITEM_VIEW = "itemView";
|
||||||
|
|
||||||
private final FolderBrowser folderBrowser;
|
private final FolderBrowser folderBrowser;
|
||||||
private final Paginator paginator;
|
private final Paginator paginator;
|
||||||
private final OptionGroup checkboxGroup;
|
private final OptionGroup checkboxGroup;
|
||||||
private final SingleSelect actionSelect;
|
private final SingleSelect actionSelect;
|
||||||
private final Submit submit;
|
private final Submit submit;
|
||||||
|
|
||||||
public ItemView() {
|
public ItemView() {
|
||||||
|
|
||||||
super(ITEM_VIEW, new SimpleContainer());
|
super(ITEM_VIEW, new SimpleContainer());
|
||||||
setMethod(GET);
|
setMethod(GET);
|
||||||
|
|
||||||
final ActionGroup group = new ActionGroup();
|
final ActionGroup group = new ActionGroup();
|
||||||
add(group);
|
add(group);
|
||||||
|
|
||||||
final GridPanel panel = new GridPanel(1);
|
final GridPanel panel = new GridPanel(1);
|
||||||
group.setSubject(panel);
|
group.setSubject(panel);
|
||||||
|
|
||||||
folderBrowser = new FolderBrowser(sourceFolderModel);
|
folderBrowser = new FolderBrowser(sourceFolderModel);
|
||||||
folderBrowser.setAtoZfilterParameter(atozFilterParam);
|
folderBrowser.setAtoZfilterParameter(atozFilterParam);
|
||||||
folderBrowser.setFilterParameter(filterParam);
|
folderBrowser.setFilterParameter(filterParam);
|
||||||
folderBrowser.setFilterForm(filterForm);
|
// folderBrowser.setFilterForm(filterForm);
|
||||||
|
folderBrowser.setFolderManipulator(FolderManipulator.this);
|
||||||
paginator = new Paginator(
|
paginator = new Paginator(
|
||||||
(PaginationModelBuilder) folderBrowser.getModelBuilder(),
|
new FolderBrowserPaginationModelBuilder(folderBrowser),
|
||||||
CMSConfig.getConfig().getFolderBrowseListSize());
|
CMSConfig.getConfig().getFolderBrowseListSize());
|
||||||
|
folderBrowser.setPaginator(paginator);
|
||||||
panel.add(paginator);
|
panel.add(paginator);
|
||||||
panel.add(folderBrowser);
|
panel.add(folderBrowser);
|
||||||
|
|
||||||
LOGGER.debug("Adding filter form...");
|
LOGGER.debug("Adding filter form...");
|
||||||
filterForm = new FilterForm((FilterFormModelBuilder) folderBrowser.
|
filterForm = new FilterForm(new FolderBrowserFilterFormModelBuilder(
|
||||||
getModelBuilder());
|
folderBrowser));
|
||||||
FolderManipulator.this.add(filterForm);
|
FolderManipulator.this.add(filterForm);
|
||||||
|
|
||||||
checkboxGroup = new CheckboxGroup(sourcesParam);
|
checkboxGroup = new CheckboxGroup(sourcesParam);
|
||||||
panel.add(checkboxGroup);
|
panel.add(checkboxGroup);
|
||||||
|
|
||||||
panel.add(new FormErrorDisplay(this));
|
panel.add(new FormErrorDisplay(this));
|
||||||
|
|
||||||
final Container container = new SimpleContainer();
|
final Container container = new SimpleContainer();
|
||||||
group.addAction(container);
|
group.addAction(container);
|
||||||
|
|
||||||
container.add(new Label(new GlobalizedMessage(
|
container.add(new Label(new GlobalizedMessage(
|
||||||
"cms.ui.folder.edit_selection",
|
"cms.ui.folder.edit_selection",
|
||||||
CmsConstants.CMS_FOLDER_BUNDLE)));
|
CmsConstants.CMS_FOLDER_BUNDLE)));
|
||||||
actionSelect = new SingleSelect(actionParam);
|
actionSelect = new SingleSelect(actionParam);
|
||||||
actionSelect.addOption(
|
actionSelect.addOption(
|
||||||
new Option(COPY,
|
new Option(COPY,
|
||||||
new Label(new GlobalizedMessage(
|
new Label(new GlobalizedMessage(
|
||||||
"cms.ui.folder.copy.action",
|
"cms.ui.folder.copy.action",
|
||||||
CmsConstants.CMS_FOLDER_BUNDLE))));
|
CmsConstants.CMS_FOLDER_BUNDLE))));
|
||||||
actionSelect.addOption(
|
actionSelect.addOption(
|
||||||
new Option(MOVE,
|
new Option(MOVE,
|
||||||
new Label(new GlobalizedMessage(
|
new Label(new GlobalizedMessage(
|
||||||
"cms.ui.folder.move.action",
|
"cms.ui.folder.move.action",
|
||||||
CmsConstants.CMS_FOLDER_BUNDLE))));
|
CmsConstants.CMS_FOLDER_BUNDLE))));
|
||||||
//Publishing in the folder browser only works if threaded publishing is active
|
//Publishing in the folder browser only works if threaded publishing is active
|
||||||
// if (CMSConfig.getInstanceOf().getThreadedPublishing()) {
|
// if (CMSConfig.getInstanceOf().getThreadedPublishing()) {
|
||||||
// actionSelect.addOption(new Option(PUBLISH,
|
// actionSelect.addOption(new Option(PUBLISH,
|
||||||
|
|
@ -872,8 +876,8 @@ public class FolderManipulator extends SimpleContainer implements
|
||||||
container.add(actionSelect);
|
container.add(actionSelect);
|
||||||
submit = new Submit("Go",
|
submit = new Submit("Go",
|
||||||
new GlobalizedMessage(
|
new GlobalizedMessage(
|
||||||
"cms.ui.folder.go",
|
"cms.ui.folder.go",
|
||||||
CmsConstants.CMS_FOLDER_BUNDLE));
|
CmsConstants.CMS_FOLDER_BUNDLE));
|
||||||
container.add(submit);
|
container.add(submit);
|
||||||
|
|
||||||
// Add a new first column to the table
|
// Add a new first column to the table
|
||||||
|
|
@ -881,14 +885,18 @@ public class FolderManipulator extends SimpleContainer implements
|
||||||
column.setCellRenderer(new CheckboxRenderer());
|
column.setCellRenderer(new CheckboxRenderer());
|
||||||
folderBrowser.getColumnModel().add(0, column);
|
folderBrowser.getColumnModel().add(0, column);
|
||||||
}
|
}
|
||||||
|
|
||||||
public final FolderBrowser getBrowser() {
|
public final FolderBrowser getBrowser() {
|
||||||
return folderBrowser;
|
return folderBrowser;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Paginator getPaginator() {
|
||||||
|
return paginator;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void reset(final PageState state) {
|
public void reset(final PageState state) {
|
||||||
|
|
||||||
checkboxGroup.setValue(state, null);
|
checkboxGroup.setValue(state, null);
|
||||||
actionSelect.setValue(state, null);
|
actionSelect.setValue(state, null);
|
||||||
paginator.reset(state);
|
paginator.reset(state);
|
||||||
|
|
@ -899,11 +907,11 @@ public class FolderManipulator extends SimpleContainer implements
|
||||||
|
|
||||||
// The renderer for the first column in the itemView table
|
// The renderer for the first column in the itemView table
|
||||||
private class CheckboxRenderer implements TableCellRenderer {
|
private class CheckboxRenderer implements TableCellRenderer {
|
||||||
|
|
||||||
public CheckboxRenderer() {
|
public CheckboxRenderer() {
|
||||||
//Nothing to do
|
//Nothing to do
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Component getComponent(final Table table,
|
public Component getComponent(final Table table,
|
||||||
final PageState state,
|
final PageState state,
|
||||||
|
|
@ -918,44 +926,44 @@ public class FolderManipulator extends SimpleContainer implements
|
||||||
result.setGroup(checkboxGroup);
|
result.setGroup(checkboxGroup);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected class FilterForm extends Form implements FormProcessListener,
|
protected class FilterForm extends Form implements FormProcessListener,
|
||||||
FormInitListener,
|
FormInitListener,
|
||||||
FormSubmissionListener {
|
FormSubmissionListener {
|
||||||
|
|
||||||
private final SimpleContainer panel;
|
private final SimpleContainer panel;
|
||||||
private boolean visible;
|
private boolean visible;
|
||||||
private final FilterFormModelBuilder modelBuilder;
|
private final FilterFormModelBuilder modelBuilder;
|
||||||
private final TextField filterField;
|
private final TextField filterField;
|
||||||
|
|
||||||
public FilterForm(final FilterFormModelBuilder modelBuilder) {
|
public FilterForm(final FilterFormModelBuilder modelBuilder) {
|
||||||
super("folderFilterForm");
|
super("folderFilterForm");
|
||||||
|
|
||||||
LOGGER.debug("Creating filter form...");
|
LOGGER.debug("Creating filter form...");
|
||||||
|
|
||||||
this.modelBuilder = modelBuilder;
|
this.modelBuilder = modelBuilder;
|
||||||
|
|
||||||
addProcessListener(this);
|
addProcessListener(this);
|
||||||
addInitListener(this);
|
addInitListener(this);
|
||||||
addSubmissionListener(this);
|
addSubmissionListener(this);
|
||||||
|
|
||||||
panel = new BoxPanel(BoxPanel.HORIZONTAL);
|
panel = new BoxPanel(BoxPanel.HORIZONTAL);
|
||||||
|
|
||||||
final ActionLink allLink = new ActionLink(
|
final ActionLink allLink = new ActionLink(
|
||||||
new GlobalizedMessage("cms.ui.folder.filter.all",
|
new GlobalizedMessage("cms.ui.folder.filter.all",
|
||||||
CmsConstants.CMS_FOLDER_BUNDLE));
|
CmsConstants.CMS_FOLDER_BUNDLE));
|
||||||
allLink.addActionListener(new ActionListener() {
|
allLink.addActionListener(new ActionListener() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(final ActionEvent event) {
|
public void actionPerformed(final ActionEvent event) {
|
||||||
//event.getPageState().setValue(m_aToZfilter, "");
|
//event.getPageState().setValue(m_aToZfilter, "");
|
||||||
event.getPageState().setValue(filterParam, "");
|
event.getPageState().setValue(filterParam, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
panel.add(allLink);
|
panel.add(allLink);
|
||||||
|
|
||||||
|
|
@ -973,59 +981,59 @@ public class FolderManipulator extends SimpleContainer implements
|
||||||
// panel.add(link);
|
// panel.add(link);
|
||||||
// }
|
// }
|
||||||
panel.add(new Label(new GlobalizedMessage(
|
panel.add(new Label(new GlobalizedMessage(
|
||||||
"cms.ui.folder.filter",
|
"cms.ui.folder.filter",
|
||||||
CmsConstants.CMS_FOLDER_BUNDLE)));
|
CmsConstants.CMS_FOLDER_BUNDLE)));
|
||||||
filterField = new TextField(filterParam);
|
filterField = new TextField(filterParam);
|
||||||
panel.add(filterField);
|
panel.add(filterField);
|
||||||
panel.add(new Submit("filterFolderSubmit",
|
panel.add(new Submit("filterFolderSubmit",
|
||||||
new GlobalizedMessage(
|
new GlobalizedMessage(
|
||||||
"cms.ui.folder.filter_do",
|
"cms.ui.folder.filter_do",
|
||||||
CmsConstants.CMS_FOLDER_BUNDLE)));
|
CmsConstants.CMS_FOLDER_BUNDLE)));
|
||||||
|
|
||||||
add(panel);
|
add(panel);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public TextField getFilterField() {
|
public TextField getFilterField() {
|
||||||
return filterField;
|
return filterField;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void process(final FormSectionEvent event) throws
|
public void process(final FormSectionEvent event) throws
|
||||||
FormProcessException {
|
FormProcessException {
|
||||||
//Nothing
|
//Nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init(final FormSectionEvent event) throws
|
public void init(final FormSectionEvent event) throws
|
||||||
FormProcessException {
|
FormProcessException {
|
||||||
//fse.getPageState().setValue(FolderManipulator.this.m_filter, null);
|
//fse.getPageState().setValue(FolderManipulator.this.m_filter, null);
|
||||||
//filterField.setValue(fse.getPageState(), null);
|
//filterField.setValue(fse.getPageState(), null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void submitted(final FormSectionEvent event) throws
|
public void submitted(final FormSectionEvent event) throws
|
||||||
FormProcessException {
|
FormProcessException {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isVisible(PageState state) {
|
public boolean isVisible(PageState state) {
|
||||||
if (super.isVisible(state)
|
if (super.isVisible(state)
|
||||||
&& (modelBuilder.getFolderSize(state)
|
&& (modelBuilder.getFolderSize(state)
|
||||||
>= CMSConfig.getConfig().
|
>= CMSConfig.getConfig().
|
||||||
getFolderAtoZShowLimit())) {
|
getFolderAtoZShowLimit())) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected interface FilterFormModelBuilder {
|
protected interface FilterFormModelBuilder {
|
||||||
|
|
||||||
public long getFolderSize(PageState state);
|
public long getFolderSize(PageState state);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -1043,7 +1051,7 @@ public class FolderManipulator extends SimpleContainer implements
|
||||||
// return new GlobalizedMessage(key, RESOURCE_BUNDLE, args);
|
// return new GlobalizedMessage(key, RESOURCE_BUNDLE, args);
|
||||||
// }
|
// }
|
||||||
private class FolderTreeCellRenderer implements TreeCellRenderer {
|
private class FolderTreeCellRenderer implements TreeCellRenderer {
|
||||||
|
|
||||||
private RequestLocal m_invalidFolders = new RequestLocal();
|
private RequestLocal m_invalidFolders = new RequestLocal();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -1110,9 +1118,8 @@ public class FolderManipulator extends SimpleContainer implements
|
||||||
// // Save the invalid folder list
|
// // Save the invalid folder list
|
||||||
// m_invalidFolders.set(state, invalidFolders);
|
// m_invalidFolders.set(state, invalidFolders);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
final Label label = new Label(value.toString());
|
final Label label = new Label(value.toString());
|
||||||
|
|
||||||
if (invalidFolders.contains(key.toString())) {
|
if (invalidFolders.contains(key.toString())) {
|
||||||
return label;
|
return label;
|
||||||
}
|
}
|
||||||
|
|
@ -1122,10 +1129,10 @@ public class FolderManipulator extends SimpleContainer implements
|
||||||
label.setFontWeight(Label.BOLD);
|
label.setFontWeight(Label.BOLD);
|
||||||
return label;
|
return label;
|
||||||
}
|
}
|
||||||
|
|
||||||
return new ControlLink(label);
|
return new ControlLink(label);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -56,16 +56,30 @@ import static org.librecms.CmsConstants.*;
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "CONTENT_SECTIONS", schema = DB_SCHEMA)
|
@Table(name = "CONTENT_SECTIONS", schema = DB_SCHEMA)
|
||||||
@NamedQueries({
|
@NamedQueries({
|
||||||
|
@NamedQuery(
|
||||||
|
name = "ContentSection.findById",
|
||||||
|
query = "SELECT S FROM ContentSection s WHERE s.objectId = :objectId")
|
||||||
|
,
|
||||||
@NamedQuery(
|
@NamedQuery(
|
||||||
name = "ContentSection.findByLabel",
|
name = "ContentSection.findByLabel",
|
||||||
query = "SELECT s FROM ContentSection s WHERE s.label = :label")
|
query = "SELECT s FROM ContentSection s WHERE s.label = :label")
|
||||||
,
|
,
|
||||||
|
@NamedQuery(
|
||||||
|
name = "ContentSection.findContentTypes",
|
||||||
|
query = "SELECT t FROM ContentType t WHERE t.contentSection = :section")
|
||||||
|
,
|
||||||
|
@NamedQuery(
|
||||||
|
name = "ContentSection.countContentTypes",
|
||||||
|
query
|
||||||
|
= "SELECT COUNT(t) FROM ContentType t WHERE t.contentSection = :section"
|
||||||
|
)
|
||||||
|
,
|
||||||
@NamedQuery(
|
@NamedQuery(
|
||||||
name = "ContentSection.findPermissions",
|
name = "ContentSection.findPermissions",
|
||||||
query = "SELECT p FROM Permission p "
|
query = "SELECT p FROM Permission p "
|
||||||
+ "WHERE (p.object = :section "
|
+ "WHERE (p.object = :section "
|
||||||
+ " OR p.object = :rootDocumentsFolder"
|
+ " OR p.object = :rootDocumentsFolder"
|
||||||
+ " OR p.object = :rootAssetsFolder) "
|
+ " OR p.object = :rootAssetsFolder) "
|
||||||
+ "AND p.grantee = :role")
|
+ "AND p.grantee = :role")
|
||||||
})
|
})
|
||||||
//@ApplicationType(
|
//@ApplicationType(
|
||||||
|
|
|
||||||
|
|
@ -23,9 +23,11 @@ import org.libreccm.core.CoreConstants;
|
||||||
import org.libreccm.security.AuthorizationRequired;
|
import org.libreccm.security.AuthorizationRequired;
|
||||||
import org.libreccm.security.RequiresPrivilege;
|
import org.libreccm.security.RequiresPrivilege;
|
||||||
|
|
||||||
|
import java.util.Optional;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import javax.enterprise.context.RequestScoped;
|
import javax.enterprise.context.RequestScoped;
|
||||||
|
import javax.persistence.NoResultException;
|
||||||
import javax.persistence.TypedQuery;
|
import javax.persistence.TypedQuery;
|
||||||
import javax.transaction.Transactional;
|
import javax.transaction.Transactional;
|
||||||
|
|
||||||
|
|
@ -42,12 +44,12 @@ public class ContentSectionRepository
|
||||||
throw new IllegalArgumentException(
|
throw new IllegalArgumentException(
|
||||||
"The label of a ContentSection can't be empty.");
|
"The label of a ContentSection can't be empty.");
|
||||||
}
|
}
|
||||||
|
|
||||||
final TypedQuery<ContentSection> query = getEntityManager()
|
final TypedQuery<ContentSection> query = getEntityManager()
|
||||||
.createNamedQuery("ContentSection.findByLabel",
|
.createNamedQuery("ContentSection.findByLabel",
|
||||||
ContentSection.class);
|
ContentSection.class);
|
||||||
query.setParameter("label", label);
|
query.setParameter("label", label);
|
||||||
|
|
||||||
return query.getSingleResult();
|
return query.getSingleResult();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -66,11 +68,11 @@ public class ContentSectionRepository
|
||||||
@Transactional(Transactional.TxType.REQUIRED)
|
@Transactional(Transactional.TxType.REQUIRED)
|
||||||
@Override
|
@Override
|
||||||
public void save(final ContentSection section) {
|
public void save(final ContentSection section) {
|
||||||
if(isNew(section)) {
|
if (isNew(section)) {
|
||||||
section.setUuid(UUID.randomUUID().toString());
|
section.setUuid(UUID.randomUUID().toString());
|
||||||
section.setApplicationType(ContentSection.class.getName());
|
section.setApplicationType(ContentSection.class.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
super.save(section);
|
super.save(section);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@ package org.librecms.contentsection;
|
||||||
|
|
||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
|
import org.libreccm.core.UnexpectedErrorException;
|
||||||
import org.libreccm.modules.InstallEvent;
|
import org.libreccm.modules.InstallEvent;
|
||||||
import org.libreccm.security.Role;
|
import org.libreccm.security.Role;
|
||||||
import org.libreccm.web.AbstractCcmApplicationSetup;
|
import org.libreccm.web.AbstractCcmApplicationSetup;
|
||||||
|
|
@ -32,8 +33,15 @@ import static org.librecms.contentsection.ContentSection.*;
|
||||||
import org.librecms.contentsection.privileges.AdminPrivileges;
|
import org.librecms.contentsection.privileges.AdminPrivileges;
|
||||||
import org.librecms.contentsection.privileges.AssetPrivileges;
|
import org.librecms.contentsection.privileges.AssetPrivileges;
|
||||||
import org.librecms.contentsection.privileges.ItemPrivileges;
|
import org.librecms.contentsection.privileges.ItemPrivileges;
|
||||||
|
import org.librecms.contenttypes.Article;
|
||||||
|
import org.librecms.contenttypes.Event;
|
||||||
|
import org.librecms.contenttypes.MultiPartArticle;
|
||||||
|
import org.librecms.contenttypes.News;
|
||||||
import org.librecms.dispatcher.MultilingualItemResolver;
|
import org.librecms.dispatcher.MultilingualItemResolver;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.logging.Level;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
|
|
@ -47,6 +55,11 @@ public class ContentSectionSetup extends AbstractCcmApplicationSetup {
|
||||||
= "org.librecms.initial_content_sections";
|
= "org.librecms.initial_content_sections";
|
||||||
private static final String DEFAULT_ITEM_RESOLVER
|
private static final String DEFAULT_ITEM_RESOLVER
|
||||||
= "org.librecms.default_item_resolver";
|
= "org.librecms.default_item_resolver";
|
||||||
|
private static final String[] DEFAULT_TYPES = new String[]{
|
||||||
|
Article.class.getName(),
|
||||||
|
Event.class.getName(),
|
||||||
|
MultiPartArticle.class.getName(),
|
||||||
|
News.class.getName()};
|
||||||
|
|
||||||
public ContentSectionSetup(final InstallEvent event) {
|
public ContentSectionSetup(final InstallEvent event) {
|
||||||
super(event);
|
super(event);
|
||||||
|
|
@ -241,22 +254,61 @@ public class ContentSectionSetup extends AbstractCcmApplicationSetup {
|
||||||
section.addRole(publisher);
|
section.addRole(publisher);
|
||||||
section.addRole(contentReader);
|
section.addRole(contentReader);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
final String itemResolverClassName;
|
final String itemResolverClassName;
|
||||||
if (getIntegrationProps().containsKey(String.format("%s.item_resolver",
|
if (getIntegrationProps().containsKey(String.format("%s.item_resolver",
|
||||||
sectionName))) {
|
sectionName))) {
|
||||||
itemResolverClassName = getIntegrationProps().getProperty(
|
itemResolverClassName = getIntegrationProps().getProperty(
|
||||||
String.format("%s.item_resolver",
|
String.format("%s.item_resolver",
|
||||||
sectionName));
|
sectionName));
|
||||||
} else if(getIntegrationProps().containsKey("default_item_resolver")) {
|
} else if (getIntegrationProps().containsKey("default_item_resolver")) {
|
||||||
itemResolverClassName = getIntegrationProps().getProperty("default_item_resolver_name");
|
itemResolverClassName = getIntegrationProps().getProperty(
|
||||||
|
"default_item_resolver_name");
|
||||||
} else {
|
} else {
|
||||||
itemResolverClassName = MultilingualItemResolver.class.getName();
|
itemResolverClassName = MultilingualItemResolver.class.getName();
|
||||||
}
|
}
|
||||||
section.setItemResolverClass(itemResolverClassName);
|
section.setItemResolverClass(itemResolverClassName);
|
||||||
|
|
||||||
|
final String[] types;
|
||||||
|
if (getIntegrationProps().containsKey(String.format("%s.content_types",
|
||||||
|
sectionName))) {
|
||||||
|
final String typesStr = getIntegrationProps().getProperty(String
|
||||||
|
.format("%s.content_types", sectionName));
|
||||||
|
types = typesStr.split(",");
|
||||||
|
} else if (getIntegrationProps().containsKey("default_content_types")) {
|
||||||
|
final String typesStr = getIntegrationProps().getProperty(
|
||||||
|
"default_content_types");
|
||||||
|
types = typesStr.split(",");
|
||||||
|
} else {
|
||||||
|
types = DEFAULT_TYPES;
|
||||||
|
}
|
||||||
|
Arrays.stream(types).forEach(type -> addContentTypeToSection(section,
|
||||||
|
type));
|
||||||
|
|
||||||
getEntityManager().merge(section);
|
getEntityManager().merge(section);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void addContentTypeToSection(final ContentSection section,
|
||||||
|
final String contentType) {
|
||||||
|
final String typeClassName = contentType.trim();
|
||||||
|
final Class<?> clazz;
|
||||||
|
try {
|
||||||
|
clazz = Class.forName(typeClassName);
|
||||||
|
} catch (ClassNotFoundException ex) {
|
||||||
|
throw new UnexpectedErrorException(String.format(
|
||||||
|
"No class for content type '%s'.", typeClassName));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ContentItem.class.isAssignableFrom(clazz)) {
|
||||||
|
final ContentType type = new ContentType();
|
||||||
|
type.setContentSection(section);
|
||||||
|
type.setContentItemClass(clazz.getName());
|
||||||
|
section.addContentType(type);
|
||||||
|
} else {
|
||||||
|
throw new UnexpectedErrorException(String.format(
|
||||||
|
"The class '%s' is not a sub class of '%s'.",
|
||||||
|
clazz.getName(),
|
||||||
|
ContentItem.class.getName()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -68,71 +68,97 @@ import static org.librecms.CmsConstants.*;
|
||||||
+ "ORDER BY f.name"
|
+ "ORDER BY f.name"
|
||||||
)
|
)
|
||||||
,
|
,
|
||||||
@NamedQuery(
|
// @NamedQuery(
|
||||||
name = "Folder.countSubFolders",
|
// name = "Folder.countSubFolders",
|
||||||
query
|
// query
|
||||||
= "SELECT COUNT(f) FROM Folder f WHERE f.parentCategory = :parent "
|
// = "SELECT COUNT(f) FROM Folder f WHERE f.parentCategory = :parent "
|
||||||
+ "AND LOWER(f.name) LIKE :term"
|
// + "AND LOWER(f.name) LIKE :term"
|
||||||
)
|
// )
|
||||||
,
|
// ,
|
||||||
@NamedQuery(
|
// @NamedQuery(
|
||||||
name = "Folder.findItems",
|
// name = "Folder.findItems",
|
||||||
query = "SELECT c.categorizedObject "
|
// query = "SELECT c.categorizedObject "
|
||||||
+ "FROM Categorization c "
|
// + "FROM Categorization c "
|
||||||
+ "WHERE c.category = :folder "
|
// + "WHERE c.category = :folder "
|
||||||
+ "AND TYPE(c.categorizedObject) IN ContentItem "
|
// + "AND TYPE(c.categorizedObject) IN ContentItem "
|
||||||
+ "AND c.type = '" + CATEGORIZATION_TYPE_FOLDER + "' "
|
// + "AND c.type = '" + CATEGORIZATION_TYPE_FOLDER + "' "
|
||||||
+ "AND c.version = "
|
// + "AND c.version = "
|
||||||
+ "org.librecms.contentsection.ContentItemVersion.DRAFT"
|
// + "org.librecms.contentsection.ContentItemVersion.DRAFT"
|
||||||
+ "AND (LOWER(c.categorizedObject.displayName) LIKE :term "
|
// + "AND (LOWER(c.categorizedObject.displayName) LIKE :term "
|
||||||
+ "OR LOWER(c.categorizedObject.name.value) LIKE :term) "
|
// + "OR LOWER(c.categorizedObject.name.value) LIKE :term) "
|
||||||
+ "ORDER BY c.categorizedObject.name")
|
// + "ORDER BY c.categorizedObject.name")
|
||||||
,
|
// ,
|
||||||
@NamedQuery(
|
// @NamedQuery(
|
||||||
name = "Folder.countItems",
|
// name = "Folder.countItems",
|
||||||
query = "SELECT COUNT(c).categorizedObject "
|
// query = "SELECT COUNT(c).categorizedObject "
|
||||||
+ "FROM Categorization c "
|
// + "FROM Categorization c "
|
||||||
+ "WHERE c.category = :folder "
|
// + "WHERE c.category = :folder "
|
||||||
+ "AND Type(c.categorizedObject) IN ContentItem "
|
// + "AND Type(c.categorizedObject) IN ContentItem "
|
||||||
+ "AND c.type = '" + CATEGORIZATION_TYPE_FOLDER + "' "
|
// + "AND c.type = '" + CATEGORIZATION_TYPE_FOLDER + "' "
|
||||||
+ "AND c.version = "
|
// + "AND c.version = "
|
||||||
+ "org.librecms.contentsection.ContentItemVersion.DRAFT"
|
// + "org.librecms.contentsection.ContentItemVersion.DRAFT"
|
||||||
+ "AND (LOWER(c.categorizedObject.displayName) LIKE :term "
|
// + "AND (LOWER(c.categorizedObject.displayName) LIKE :term "
|
||||||
+ "OR LOWER(c.categorizedObject.name.value) LIKE :term)")
|
// + "OR LOWER(c.categorizedObject.name.value) LIKE :term)")
|
||||||
,
|
// ,
|
||||||
@NamedQuery(
|
@NamedQuery(
|
||||||
name = "Folder.findObjects",
|
name = "Folder.findObjects",
|
||||||
query = "SELECT o FROM CcmObject o "
|
query = "SELECT o FROM CcmObject o "
|
||||||
+ "WHERE o IN (SELECT f FROM Folder f "
|
+ "WHERE o IN (SELECT f FROM Folder f "
|
||||||
+ "WHERE f.parentCategory = :parent "
|
+ "WHERE f.parentCategory = :folder "
|
||||||
+ "AND lower(f.name) LIKE :term) "
|
+ "AND LOWER(f.name) LIKE :term) "
|
||||||
+ "OR o IN (SELECT c.categorizedObject "
|
+ "OR o IN (SELECT i FROM ContentItem i JOIN i.categories c "
|
||||||
+ "FROM Categorization c "
|
+ "WHERE c.category = :folder "
|
||||||
+ "WHERE c.category = :folder "
|
|
||||||
+ "AND TYPE(c.categorizedObject) IN ContentItem "
|
|
||||||
+ "AND c.type = '" + CATEGORIZATION_TYPE_FOLDER + "' "
|
+ "AND c.type = '" + CATEGORIZATION_TYPE_FOLDER + "' "
|
||||||
+ "AND c.version = "
|
+ "AND i.version = "
|
||||||
+ "org.librecms.contentsection.ContentItemVersion.DRAFT"
|
+ "org.librecms.contentsection.ContentItemVersion.DRAFT "
|
||||||
+ "AND (LOWER(c.categorizedObject.displayName) LIKE :term "
|
+ "AND (LOWER(i.displayName) LIKE LOWER(:term) "
|
||||||
+ "OR LOWER(c.categorizedObject.name.value) LIKE :term)) "
|
// + "OR LOWER(i.name.values) LIKE LOWER(:term)"
|
||||||
+ "ORDER BY o.displayName")
|
+ ")) "
|
||||||
|
+ "ORDER BY o.displayName"
|
||||||
|
// query = "SELECT o FROM CcmObject o "
|
||||||
|
// + "WHERE o IN (SELECT f FROM Folder f "
|
||||||
|
// + "WHERE f.parentCategory = :parent "
|
||||||
|
// + "AND lower(f.name) LIKE :term) "
|
||||||
|
// + "OR o IN (SELECT c.categorizedObject "
|
||||||
|
// + "FROM Categorization c "
|
||||||
|
// + "WHERE c.category = :folder "
|
||||||
|
// + "AND TYPE(c.categorizedObject) IN ContentItem "
|
||||||
|
// + "AND c.type = '" + CATEGORIZATION_TYPE_FOLDER + "' "
|
||||||
|
// + "AND c.version = "
|
||||||
|
// + "org.librecms.contentsection.ContentItemVersion.DRAFT"
|
||||||
|
// + "AND (LOWER(c.categorizedObject.displayName) LIKE :term "
|
||||||
|
// + "OR LOWER(c.categorizedObject.name.value) LIKE :term)) "
|
||||||
|
// + "ORDER BY o.displayName"
|
||||||
|
)
|
||||||
,
|
,
|
||||||
@NamedQuery(
|
@NamedQuery(
|
||||||
name = "Folder.countObjects",
|
name = "Folder.countObjects",
|
||||||
query = "SELECT COUNT(o) FROM CcmObject o "
|
query = "SELECT COUNT(o) FROM CcmObject o "
|
||||||
+ "WHERE o IN (SELECT f FROM Folder f "
|
+ "WHERE o IN (SELECT f FROM Folder f "
|
||||||
+ "WHERE f.parentCategory = :parent "
|
+ "WHERE f.parentCategory = :folder "
|
||||||
+ "AND lower(f.name) LIKE :term) "
|
+ "AND LOWER(f.name) LIKE :term) "
|
||||||
+ "OR o IN (SELECT c.categorizedObject "
|
+ "OR o IN (SELECT i FROM ContentItem i JOIN i.categories c "
|
||||||
+ "FROM Categorization c "
|
+ "WHERE c.category = :folder "
|
||||||
+ "WHERE c.category = :folder "
|
|
||||||
+ "AND TYPE(c.categorizedObject) IN ContentItem "
|
|
||||||
+ "AND c.type = '" + CATEGORIZATION_TYPE_FOLDER + "' "
|
+ "AND c.type = '" + CATEGORIZATION_TYPE_FOLDER + "' "
|
||||||
+ "AND c.version = "
|
+ "AND i.version = "
|
||||||
+ "org.librecms.contentsection.ContentItemVersion.DRAFT"
|
+ "org.librecms.contentsection.ContentItemVersion.DRAFT "
|
||||||
+ "AND (LOWER(c.categorizedObject.displayName) LIKE :term "
|
+ "AND (LOWER(i.displayName) LIKE LOWER(:term) "
|
||||||
+ "OR LOWER(c.categorizedObject.name.value) LIKE :term)) "
|
// + "OR LOWER(i.name.values) LIKE LOWER(:term)"
|
||||||
+ "ORDER BY o.displayName")
|
+ "))"
|
||||||
|
// query = "SELECT COUNT(o) FROM CcmObject o "
|
||||||
|
// + "WHERE o IN (SELECT f FROM Folder f "
|
||||||
|
// + "WHERE f.parentCategory = :parent "
|
||||||
|
// + "AND lower(f.name) LIKE :term) "
|
||||||
|
// + "OR o IN (SELECT c.categorizedObject AS co "
|
||||||
|
// + "FROM Categorization c "
|
||||||
|
// + "WHERE c.category = :folder "
|
||||||
|
// // + "AND TYPE(co) IN ContentItem "
|
||||||
|
// + "AND c.type = '" + CATEGORIZATION_TYPE_FOLDER + "' "
|
||||||
|
// + "AND co.version = "
|
||||||
|
// + "org.librecms.contentsection.ContentItemVersion.DRAFT "
|
||||||
|
// + "AND ((LOWER(co.displayName) LIKE :term "
|
||||||
|
// + "OR LOWER(co.name.value) LIKE :term)))"
|
||||||
|
)
|
||||||
})
|
})
|
||||||
public class Folder extends Category implements Serializable {
|
public class Folder extends Category implements Serializable {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -44,4 +44,8 @@ cms.ui.permissions.table.remove_all.header=Remove all
|
||||||
|
|
||||||
cms.ui.category.select_index_item=Select index item for category
|
cms.ui.category.select_index_item=Select index item for category
|
||||||
cms.ui.category.non_option=None
|
cms.ui.category.non_option=None
|
||||||
cms.ui.category.inherit_parent=Inherit Index from Parent Category
|
cms.ui.category.inherit_parent=Inherit Index from Parent Category
|
||||||
|
cms.ui.authoring.no_types_registered=No types registered
|
||||||
|
cms.ui.contents_of=Contents of
|
||||||
|
cms.ui.new_folder=Create new folder
|
||||||
|
cms.ui.edit_folder=Rename the current folder
|
||||||
|
|
|
||||||
|
|
@ -43,4 +43,8 @@ cms.ui.permissions.table.actions.remove_all.confirm=Sind Sie sicher, dass Sie al
|
||||||
cms.ui.permissions.table.remove_all.header=Alle entfernen
|
cms.ui.permissions.table.remove_all.header=Alle entfernen
|
||||||
|
|
||||||
cms.ui.category.select_index_item=Index Element f\u00fcr diese Kategorie ausw\u00e4hlen
|
cms.ui.category.select_index_item=Index Element f\u00fcr diese Kategorie ausw\u00e4hlen
|
||||||
cms.ui.category.inherit_parent=Inherit Index from Parent Category
|
cms.ui.category.inherit_parent=Inherit Index from Parent Category
|
||||||
|
cms.ui.authoring.no_types_registered=Keine Typen registiert
|
||||||
|
cms.ui.contents_of=Inhalt von
|
||||||
|
cms.ui.new_folder=Neuen Ordner erstellen
|
||||||
|
cms.ui.edit_folder=Aktuellen Ordner umbenennen
|
||||||
|
|
|
||||||
|
|
@ -44,3 +44,7 @@ cms.ui.folder_browser=Folders
|
||||||
cms.ui.permissions.table.actions.remove_all=Remove all permissions
|
cms.ui.permissions.table.actions.remove_all=Remove all permissions
|
||||||
cms.ui.permissions.table.actions.remove_all.confirm=Are you sure to remove all permissions for this role from the current object?
|
cms.ui.permissions.table.actions.remove_all.confirm=Are you sure to remove all permissions for this role from the current object?
|
||||||
cms.ui.permissions.table.remove_all.header=Remove all
|
cms.ui.permissions.table.remove_all.header=Remove all
|
||||||
|
cms.ui.authoring.no_types_registered=No types registered
|
||||||
|
cms.ui.contents_of=Contents of
|
||||||
|
cms.ui.new_folder=Create new folder
|
||||||
|
cms.ui.edit_folder=Rename the current folder
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue