Erster Teil der GUI für das Setzen von Berechtigungen für Content Typen
git-svn-id: https://svn.libreccm.org/ccm/trunk@1027 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
bede2ff498
commit
dce690d63d
|
|
@ -91,6 +91,7 @@ public class TemplateCreate extends BasicItemForm {
|
||||||
/**
|
/**
|
||||||
* Add the "use context" widget
|
* Add the "use context" widget
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void addWidgets() {
|
public void addWidgets() {
|
||||||
super.addWidgets();
|
super.addWidgets();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,6 @@
|
||||||
package com.arsdigita.cms.ui.type;
|
package com.arsdigita.cms.ui.type;
|
||||||
|
|
||||||
import com.arsdigita.bebop.ActionLink;
|
import com.arsdigita.bebop.ActionLink;
|
||||||
import com.arsdigita.bebop.Component;
|
|
||||||
import com.arsdigita.bebop.Form;
|
import com.arsdigita.bebop.Form;
|
||||||
import com.arsdigita.bebop.Label;
|
import com.arsdigita.bebop.Label;
|
||||||
import com.arsdigita.bebop.Page;
|
import com.arsdigita.bebop.Page;
|
||||||
|
|
@ -61,12 +60,13 @@ final class ContentTypeItemPane extends BaseItemPane {
|
||||||
private final TypeElements m_elements;
|
private final TypeElements m_elements;
|
||||||
private final AddElement m_elementAddForm;
|
private final AddElement m_elementAddForm;
|
||||||
private final SectionTemplatesListing m_templates;
|
private final SectionTemplatesListing m_templates;
|
||||||
|
private final TypePermissionsTable m_permissions;
|
||||||
// private final RelationAttributeSection m_relationAttributes;
|
// private final RelationAttributeSection m_relationAttributes;
|
||||||
|
|
||||||
ContentTypeItemPane(final ACSObjectSelectionModel model,
|
ContentTypeItemPane(final ACSObjectSelectionModel model,
|
||||||
final ContentTypeRequestLocal type,
|
final ContentTypeRequestLocal type,
|
||||||
final ActionLink editLink,
|
final ActionLink editLink,
|
||||||
final ActionLink deleteLink) {
|
final ActionLink deleteLink) {
|
||||||
m_model = model;
|
m_model = model;
|
||||||
m_type = type;
|
m_type = type;
|
||||||
|
|
||||||
|
|
@ -77,16 +77,30 @@ final class ContentTypeItemPane extends BaseItemPane {
|
||||||
m_elements = new TypeElements(m_model);
|
m_elements = new TypeElements(m_model);
|
||||||
m_elementAddForm = new AddElement();
|
m_elementAddForm = new AddElement();
|
||||||
|
|
||||||
m_templates = new SectionTemplatesListing(new ContentSectionRequestLocal(), m_type);
|
m_templates =
|
||||||
|
new SectionTemplatesListing(new ContentSectionRequestLocal(), m_type);
|
||||||
|
|
||||||
final ActionLink templateAddLink = new ActionLink(new Label(gz("cms.ui.type.template.add")));
|
m_permissions = new TypePermissionsTable(
|
||||||
|
new ContentSectionRequestLocal(), m_type);
|
||||||
|
|
||||||
|
final ActionLink templateAddLink = new ActionLink(new Label(gz(
|
||||||
|
"cms.ui.type.template.add")));
|
||||||
final TemplateCreate templateFormSection = new TemplateCreate(m_model);
|
final TemplateCreate templateFormSection = new TemplateCreate(m_model);
|
||||||
|
final Form templateForm = new CancellableForm("AddTemplate",
|
||||||
final Form templateForm = new CancellableForm("AddTemplate", templateFormSection.getSaveCancelSection().getCancelButton());
|
templateFormSection.
|
||||||
|
getSaveCancelSection().getCancelButton());
|
||||||
templateForm.add(templateFormSection);
|
templateForm.add(templateFormSection);
|
||||||
|
|
||||||
add(templateForm);
|
add(templateForm);
|
||||||
|
|
||||||
|
final ActionLink permissionAddLink = new ActionLink(new Label(gz(
|
||||||
|
"cms.ui.type.permission.add")));
|
||||||
|
final TypePermissions permissionsSection = new TypePermissions(m_model);
|
||||||
|
final Form permissionsForm = new CancellableForm("AddPermission",
|
||||||
|
permissionsSection.
|
||||||
|
getSaveCancelSection().getCancelButton());
|
||||||
|
permissionsForm.add(permissionsSection);
|
||||||
|
add(permissionsForm);
|
||||||
|
|
||||||
final AddTextElement textForm = new AddTextElement(m_model);
|
final AddTextElement textForm = new AddTextElement(m_model);
|
||||||
add(textForm);
|
add(textForm);
|
||||||
|
|
||||||
|
|
@ -105,7 +119,8 @@ final class ContentTypeItemPane extends BaseItemPane {
|
||||||
final AddFileElement fileForm = new AddFileElement(m_model);
|
final AddFileElement fileForm = new AddFileElement(m_model);
|
||||||
add(fileForm);
|
add(fileForm);
|
||||||
|
|
||||||
final AddContentItemElement itemForm = new AddContentItemElement(m_model);
|
final AddContentItemElement itemForm =
|
||||||
|
new AddContentItemElement(m_model);
|
||||||
add(itemForm);
|
add(itemForm);
|
||||||
|
|
||||||
m_detailPane.add(new SummarySection(editLink, deleteLink));
|
m_detailPane.add(new SummarySection(editLink, deleteLink));
|
||||||
|
|
@ -114,9 +129,13 @@ final class ContentTypeItemPane extends BaseItemPane {
|
||||||
m_detailPane.add(new TypeSecurityContainer(new ElementSection()));
|
m_detailPane.add(new TypeSecurityContainer(new ElementSection()));
|
||||||
m_detailPane.add(new TemplateSection(templateAddLink));
|
m_detailPane.add(new TemplateSection(templateAddLink));
|
||||||
|
|
||||||
connect(templateAddLink, templateForm);
|
m_detailPane.add(new PermissionsSection(permissionAddLink));
|
||||||
|
|
||||||
final SingleSelect elementSelect = m_elementAddForm.getElementTypeSelect();
|
connect(templateAddLink, templateForm);
|
||||||
|
connect(permissionAddLink, permissionsForm);
|
||||||
|
|
||||||
|
final SingleSelect elementSelect =
|
||||||
|
m_elementAddForm.getElementTypeSelect();
|
||||||
|
|
||||||
connect(m_elementAddForm, elementSelect,
|
connect(m_elementAddForm, elementSelect,
|
||||||
AddElement.TEXT_ELEMENT, textForm);
|
AddElement.TEXT_ELEMENT, textForm);
|
||||||
|
|
@ -166,7 +185,7 @@ final class ContentTypeItemPane extends BaseItemPane {
|
||||||
private class SummarySection extends Section {
|
private class SummarySection extends Section {
|
||||||
|
|
||||||
SummarySection(final ActionLink editLink,
|
SummarySection(final ActionLink editLink,
|
||||||
final ActionLink deleteLink) {
|
final ActionLink deleteLink) {
|
||||||
setHeading(new Label(gz("cms.ui.type.details")));
|
setHeading(new Label(gz("cms.ui.type.details")));
|
||||||
|
|
||||||
final ActionGroup group = new ActionGroup();
|
final ActionGroup group = new ActionGroup();
|
||||||
|
|
@ -194,7 +213,7 @@ final class ContentTypeItemPane extends BaseItemPane {
|
||||||
@Override
|
@Override
|
||||||
public final boolean isVisible(final PageState state) {
|
public final boolean isVisible(final PageState state) {
|
||||||
return m_model.isSelected(state) && isDynamicType(state)
|
return m_model.isSelected(state) && isDynamicType(state)
|
||||||
&& !ContentSection.getConfig().getHideUDCTUI();
|
&& !ContentSection.getConfig().getHideUDCTUI();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -216,6 +235,24 @@ final class ContentTypeItemPane extends BaseItemPane {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private class PermissionsSection extends Section {
|
||||||
|
|
||||||
|
public PermissionsSection(final ActionLink permissionsAddLink) {
|
||||||
|
setHeading(new Label(gz("cms.ui.type.permissions")));
|
||||||
|
|
||||||
|
final ActionGroup group = new ActionGroup();
|
||||||
|
setBody(group);
|
||||||
|
|
||||||
|
group.setSubject(m_permissions);
|
||||||
|
group.addAction(new TypeSecurityContainer(permissionsAddLink));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public final boolean isVisible(final PageState state) {
|
||||||
|
return m_model.isSelected(state) && !isDynamicType(state);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private class RelationAttributeSection extends Section {
|
private class RelationAttributeSection extends Section {
|
||||||
|
|
||||||
RelationAttributeSection() {
|
RelationAttributeSection() {
|
||||||
|
|
@ -233,10 +270,12 @@ final class ContentTypeItemPane extends BaseItemPane {
|
||||||
ContentItem ci = null;
|
ContentItem ci = null;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Class<? extends ContentItem> clazz = Class.forName(ct.getClassName()).asSubclass(ContentItem.class);
|
Class<? extends ContentItem> clazz = Class.forName(ct.
|
||||||
|
getClassName()).asSubclass(ContentItem.class);
|
||||||
ci = clazz.newInstance();
|
ci = clazz.newInstance();
|
||||||
if (ci instanceof RelationAttributeInterface) {
|
if (ci instanceof RelationAttributeInterface) {
|
||||||
RelationAttributeInterface rai = (RelationAttributeInterface) ci;
|
RelationAttributeInterface rai =
|
||||||
|
(RelationAttributeInterface) ci;
|
||||||
retVal = rai.hasRelationAttributes();
|
retVal = rai.hasRelationAttributes();
|
||||||
}
|
}
|
||||||
ci.delete();
|
ci.delete();
|
||||||
|
|
@ -258,8 +297,8 @@ final class ContentTypeItemPane extends BaseItemPane {
|
||||||
final PageState state = e.getPageState();
|
final PageState state = e.getPageState();
|
||||||
|
|
||||||
if (state.isVisibleOnPage(ContentTypeItemPane.this)
|
if (state.isVisibleOnPage(ContentTypeItemPane.this)
|
||||||
&& m_model.isSelected(state)
|
&& m_model.isSelected(state)
|
||||||
&& !userCanEdit(state)) {
|
&& !userCanEdit(state)) {
|
||||||
m_templates.getRemoveColumn().setVisible(state, false);
|
m_templates.getRemoveColumn().setVisible(state, false);
|
||||||
m_templates.getDefaultColumn().setVisible(state, false);
|
m_templates.getDefaultColumn().setVisible(state, false);
|
||||||
m_elements.getTable().getColumn(3).setVisible(state, false);
|
m_elements.getTable().getColumn(3).setVisible(state, false);
|
||||||
|
|
@ -287,7 +326,7 @@ final class ContentTypeItemPane extends BaseItemPane {
|
||||||
protected static boolean userCanEdit(final PageState state) {
|
protected static boolean userCanEdit(final PageState state) {
|
||||||
SecurityManager sm = Utilities.getSecurityManager(state);
|
SecurityManager sm = Utilities.getSecurityManager(state);
|
||||||
return sm.canAccess(state.getRequest(),
|
return sm.canAccess(state.getRequest(),
|
||||||
SecurityManager.CONTENT_TYPE_ADMIN);
|
SecurityManager.CONTENT_TYPE_ADMIN);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -301,8 +340,9 @@ final class ContentTypeItemPane extends BaseItemPane {
|
||||||
final ContentType type = m_type.getContentType(state);
|
final ContentType type = m_type.getContentType(state);
|
||||||
|
|
||||||
final String objectTypeString =
|
final String objectTypeString =
|
||||||
"com.arsdigita.persistence.DynamicObjectType";
|
"com.arsdigita.persistence.DynamicObjectType";
|
||||||
final DataCollection collection = SessionManager.getSession().retrieve(objectTypeString);
|
final DataCollection collection = SessionManager.getSession().retrieve(
|
||||||
|
objectTypeString);
|
||||||
collection.addEqualsFilter("dynamicType", type.getAssociatedObjectType());
|
collection.addEqualsFilter("dynamicType", type.getAssociatedObjectType());
|
||||||
|
|
||||||
final boolean b = collection.next();
|
final boolean b = collection.next();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue