- Replaced hard coded strings in error handling of ObjectListPortletEditor
with GlobalizedMessages - Added Foundry support for edit link feature. git-svn-id: https://svn.libreccm.org/ccm/trunk@3104 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
26c7359b07
commit
2985663511
|
|
@ -5,6 +5,14 @@
|
|||
<content-item-title/>
|
||||
</h2>-->
|
||||
|
||||
<edit-link>
|
||||
<div class="edit-link">
|
||||
<a>
|
||||
Edit
|
||||
</a>
|
||||
</div>
|
||||
</edit-link>
|
||||
|
||||
<div class="lead">
|
||||
<lead-text/>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -620,5 +620,26 @@
|
|||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
<foundry:doc section="user" type="template-tag">
|
||||
<foundry:doc-desc>
|
||||
<p>
|
||||
Renders an link to edit an item in the content centre if the current user is
|
||||
logged in and has the permission to edit the item.
|
||||
</p>
|
||||
</foundry:doc-desc>
|
||||
</foundry:doc>
|
||||
<xsl:template match="content-item-layout//edit-link">
|
||||
|
||||
<xsl:param name="contentitem-tree" tunnel="yes"/>
|
||||
|
||||
<xsl:if test="$contentitem-tree/editLink">
|
||||
<xsl:apply-templates>
|
||||
<xsl:with-param name="href"
|
||||
tunnel="yes"
|
||||
select="concat($context-prefix, '/ccm/', $contentitem-tree/editLink)"/>
|
||||
</xsl:apply-templates>
|
||||
</xsl:if>
|
||||
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
||||
|
|
|
|||
|
|
@ -12,3 +12,6 @@ ui.quick_link.description=Description
|
|||
ui.quick_link.url=URL
|
||||
ui.quick_link.cascade_to_subcats=Cascade to subcategories
|
||||
ui.quick_link.icon=Icon
|
||||
portlet.ui.cannot_find_object_type=Can not find object type {0}.
|
||||
portlet.ui.not_a_subtype=The type {0} is not a subtype of {1}.
|
||||
portlet.ui.type_does_not_have_property=The type {0} does not a have a property {1}.
|
||||
|
|
|
|||
|
|
@ -12,3 +12,6 @@ ui.quick_link.description=Beschreibung
|
|||
ui.quick_link.url=URL
|
||||
ui.quick_link.cascade_to_subcats=An Subkategorien vererben
|
||||
ui.quick_link.icon=Icon
|
||||
portlet.ui.cannot_find_object_type=Kann Typ '{0}' nicht finden.
|
||||
portlet.ui.not_a_subtype=Der Typ '{0}' ist kein Untertyp von '{1}'.
|
||||
portlet.ui.type_does_not_have_property=Der Typ '{0}' hat keine Eigenschaft '{1}'.
|
||||
|
|
|
|||
|
|
@ -53,6 +53,7 @@ import com.arsdigita.kernel.ResourceType;
|
|||
|
||||
import com.arsdigita.categorization.ui.CategoryPicker;
|
||||
import com.arsdigita.categorization.ui.ApplicationCategoryPicker;
|
||||
import com.arsdigita.navigation.NavigationGlobalizationUtil;
|
||||
|
||||
import com.redhat.persistence.metadata.Root;
|
||||
import com.redhat.persistence.common.Path;
|
||||
|
|
@ -95,7 +96,7 @@ public class ObjectListPortletEditor extends PortletConfigFormSection {
|
|||
add(m_baseObjectType);
|
||||
|
||||
m_restrictedObjectType = buildRestrictedObjectTypeWidget(new StringParameter(
|
||||
"restrictedObjectType"));
|
||||
"restrictedObjectType"));
|
||||
add(new Label("Restricted object type:", Label.BOLD), ColumnPanel.RIGHT);
|
||||
add(m_restrictedObjectType);
|
||||
|
||||
|
|
@ -210,7 +211,7 @@ public class ObjectListPortletEditor extends PortletConfigFormSection {
|
|||
|
||||
protected void initWidgets(PageState state,
|
||||
Portlet portlet)
|
||||
throws FormProcessException {
|
||||
throws FormProcessException {
|
||||
super.initWidgets(state, portlet);
|
||||
|
||||
Iterator properties = ObjectListPortlet.getRegisteredProperties();
|
||||
|
|
@ -257,35 +258,36 @@ public class ObjectListPortletEditor extends PortletConfigFormSection {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void validateWidgets(PageState state,
|
||||
Portlet portlet)
|
||||
throws FormProcessException {
|
||||
Portlet portlet) throws FormProcessException {
|
||||
|
||||
String baseTypeName = (String) m_baseObjectType.getValue(state);
|
||||
ObjectType baseType = MetadataRoot.getMetadataRoot().getObjectType(baseTypeName);
|
||||
final String baseTypeName = (String) m_baseObjectType.getValue(state);
|
||||
final ObjectType baseType = MetadataRoot.getMetadataRoot().getObjectType(baseTypeName);
|
||||
if (baseType == null) {
|
||||
throw new FormProcessException(
|
||||
"Cannot find object type '" + baseTypeName + "'");
|
||||
throw new FormProcessException(NavigationGlobalizationUtil.globalize(
|
||||
"portlet.ui.cannot_find_object_type", new String[]{baseTypeName}));
|
||||
}
|
||||
|
||||
if (!baseType.isSubtypeOf(ACSObject.BASE_DATA_OBJECT_TYPE)) {
|
||||
throw new FormProcessException(
|
||||
"The type '" + baseTypeName + "' is not a subtype of '"
|
||||
+ ACSObject.BASE_DATA_OBJECT_TYPE + "'");
|
||||
throw new FormProcessException(NavigationGlobalizationUtil.globalize(
|
||||
"portlet.ui.not_a_subtype",
|
||||
new String[]{baseTypeName, ACSObject.BASE_DATA_OBJECT_TYPE}));
|
||||
}
|
||||
|
||||
String specificTypeName = (String) m_restrictedObjectType.getValue(state);
|
||||
final String specificTypeName = (String) m_restrictedObjectType.getValue(state);
|
||||
ObjectType specificType = null;
|
||||
if (specificTypeName != null && !"".equals(specificTypeName)) {
|
||||
specificType = MetadataRoot.getMetadataRoot().getObjectType(specificTypeName);
|
||||
if (specificType == null) {
|
||||
throw new FormProcessException(
|
||||
"Cannot find object type '" + specificTypeName + "'");
|
||||
throw new FormProcessException(NavigationGlobalizationUtil.globalize(
|
||||
"portlet.ui.cannot_find_object_type", new String[]{specificTypeName}));
|
||||
}
|
||||
|
||||
if (!specificType.isSubtypeOf(baseType)) {
|
||||
throw new FormProcessException(
|
||||
"The type '" + specificTypeName + "' is not a subtype of '" + baseTypeName + "'");
|
||||
throw new FormProcessException(NavigationGlobalizationUtil.globalize(
|
||||
"portlet.ui.not_a_subtype",
|
||||
new String[]{specificTypeName, ACSObject.BASE_DATA_OBJECT_TYPE}));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -302,11 +304,11 @@ public class ObjectListPortletEditor extends PortletConfigFormSection {
|
|||
|
||||
private void validateFields(ObjectType type,
|
||||
String str)
|
||||
throws FormProcessException {
|
||||
throws FormProcessException {
|
||||
|
||||
Root root = MetadataRoot.getMetadataRoot().getRoot();
|
||||
com.redhat.persistence.metadata.ObjectType objType = root.getObjectType(type
|
||||
.getQualifiedName());
|
||||
.getQualifiedName());
|
||||
|
||||
String[] fields = StringUtils.split(str, ',');
|
||||
for (int i = 0; i < fields.length; i++) {
|
||||
|
|
@ -325,16 +327,17 @@ public class ObjectListPortletEditor extends PortletConfigFormSection {
|
|||
}
|
||||
|
||||
if (!objType.exists(Path.get(field))) {
|
||||
throw new FormProcessException(
|
||||
"The type '" + type.getQualifiedName() + "' does not have a property '" + field
|
||||
+ "'");
|
||||
throw new FormProcessException(NavigationGlobalizationUtil.globalize(
|
||||
"portlet.ui.type_does_not_have_property",
|
||||
new String[]{type.getQualifiedName(), field}));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void processWidgets(PageState state,
|
||||
Portlet portlet)
|
||||
throws FormProcessException {
|
||||
throws FormProcessException {
|
||||
super.processWidgets(state, portlet);
|
||||
|
||||
ObjectListPortlet myportlet = (ObjectListPortlet) portlet;
|
||||
|
|
@ -348,10 +351,10 @@ public class ObjectListPortletEditor extends PortletConfigFormSection {
|
|||
|
||||
myportlet.setFilterCategory(m_filterCategory.getCategory(state));
|
||||
myportlet.setDescendCategories(((Boolean) m_descendCategories.getValue(state))
|
||||
.booleanValue());
|
||||
.booleanValue());
|
||||
myportlet.setCheckPermissions(((Boolean) m_checkPermissions.getValue(state)).booleanValue());
|
||||
myportlet.setExcludeIndexObjects(((Boolean) m_excludeIndexObjects.getValue(state))
|
||||
.booleanValue());
|
||||
.booleanValue());
|
||||
myportlet.setProperties((Object[]) m_properties.getValue(state));
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue