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,14 +102,14 @@ 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";
|
||||||
|
|
@ -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,8 +136,9 @@ 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) {
|
||||||
|
|
||||||
|
|
@ -150,9 +152,9 @@ public class FolderManipulator extends SimpleContainer implements
|
||||||
|
|
||||||
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());
|
||||||
|
|
@ -430,7 +432,7 @@ public class FolderManipulator extends SimpleContainer implements
|
||||||
|
|
||||||
@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);
|
||||||
|
|
@ -448,7 +450,7 @@ public class FolderManipulator extends SimpleContainer implements
|
||||||
|
|
||||||
@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();
|
||||||
|
|
||||||
|
|
@ -504,7 +506,7 @@ public class FolderManipulator extends SimpleContainer implements
|
||||||
|
|
||||||
@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();
|
||||||
|
|
@ -518,7 +520,7 @@ public class FolderManipulator extends SimpleContainer implements
|
||||||
}
|
}
|
||||||
|
|
||||||
private class TargetSelectorValidationListener implements
|
private class TargetSelectorValidationListener implements
|
||||||
FormValidationListener {
|
FormValidationListener {
|
||||||
|
|
||||||
public TargetSelectorValidationListener() {
|
public TargetSelectorValidationListener() {
|
||||||
//Nothing
|
//Nothing
|
||||||
|
|
@ -526,7 +528,7 @@ public class FolderManipulator extends SimpleContainer implements
|
||||||
|
|
||||||
@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();
|
||||||
|
|
||||||
|
|
@ -538,25 +540,25 @@ public class FolderManipulator extends SimpleContainer implements
|
||||||
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);
|
||||||
}
|
}
|
||||||
|
|
@ -575,11 +577,11 @@ public class FolderManipulator extends SimpleContainer implements
|
||||||
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();
|
||||||
|
|
@ -596,7 +598,7 @@ public class FolderManipulator extends SimpleContainer implements
|
||||||
|
|
||||||
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);
|
||||||
}
|
}
|
||||||
|
|
@ -624,7 +626,7 @@ public class FolderManipulator extends SimpleContainer implements
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
private class TargetSelectorSubmissionListener implements
|
private class TargetSelectorSubmissionListener implements
|
||||||
FormSubmissionListener {
|
FormSubmissionListener {
|
||||||
|
|
||||||
public TargetSelectorSubmissionListener() {
|
public TargetSelectorSubmissionListener() {
|
||||||
//Nothing
|
//Nothing
|
||||||
|
|
@ -632,15 +634,15 @@ public class FolderManipulator extends SimpleContainer implements
|
||||||
|
|
||||||
@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));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -684,25 +686,25 @@ public class FolderManipulator extends SimpleContainer implements
|
||||||
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)}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -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);
|
||||||
|
|
@ -826,16 +828,18 @@ public class FolderManipulator extends SimpleContainer implements
|
||||||
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);
|
||||||
|
|
@ -847,19 +851,19 @@ public class FolderManipulator extends SimpleContainer implements
|
||||||
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
|
||||||
|
|
@ -886,6 +890,10 @@ public class FolderManipulator extends SimpleContainer implements
|
||||||
return folderBrowser;
|
return folderBrowser;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Paginator getPaginator() {
|
||||||
|
return paginator;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void reset(final PageState state) {
|
public void reset(final PageState state) {
|
||||||
|
|
||||||
|
|
@ -946,8 +954,8 @@ public class FolderManipulator extends SimpleContainer implements
|
||||||
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
|
||||||
|
|
@ -973,14 +981,14 @@ 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);
|
||||||
|
|
||||||
|
|
@ -992,28 +1000,28 @@ public class FolderManipulator extends SimpleContainer implements
|
||||||
|
|
||||||
@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;
|
||||||
|
|
@ -1110,7 +1118,6 @@ 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())) {
|
||||||
|
|
|
||||||
|
|
@ -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;
|
||||||
|
|
||||||
|
|
@ -66,7 +68,7 @@ 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());
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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 {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -45,3 +45,7 @@ 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
|
||||||
|
|
|
||||||
|
|
@ -44,3 +44,7 @@ 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