- 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-94f89814c4df
master
jensp 2015-01-26 15:17:04 +00:00
parent 26c7359b07
commit 2985663511
5 changed files with 62 additions and 24 deletions

View File

@ -5,6 +5,14 @@
<content-item-title/> <content-item-title/>
</h2>--> </h2>-->
<edit-link>
<div class="edit-link">
<a>
Edit
</a>
</div>
</edit-link>
<div class="lead"> <div class="lead">
<lead-text/> <lead-text/>
</div> </div>

View File

@ -620,5 +620,26 @@
</xsl:choose> </xsl:choose>
</xsl:template> </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> </xsl:stylesheet>

View File

@ -12,3 +12,6 @@ ui.quick_link.description=Description
ui.quick_link.url=URL ui.quick_link.url=URL
ui.quick_link.cascade_to_subcats=Cascade to subcategories ui.quick_link.cascade_to_subcats=Cascade to subcategories
ui.quick_link.icon=Icon 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}.

View File

@ -12,3 +12,6 @@ ui.quick_link.description=Beschreibung
ui.quick_link.url=URL ui.quick_link.url=URL
ui.quick_link.cascade_to_subcats=An Subkategorien vererben ui.quick_link.cascade_to_subcats=An Subkategorien vererben
ui.quick_link.icon=Icon 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}'.

View File

@ -53,6 +53,7 @@ import com.arsdigita.kernel.ResourceType;
import com.arsdigita.categorization.ui.CategoryPicker; import com.arsdigita.categorization.ui.CategoryPicker;
import com.arsdigita.categorization.ui.ApplicationCategoryPicker; import com.arsdigita.categorization.ui.ApplicationCategoryPicker;
import com.arsdigita.navigation.NavigationGlobalizationUtil;
import com.redhat.persistence.metadata.Root; import com.redhat.persistence.metadata.Root;
import com.redhat.persistence.common.Path; import com.redhat.persistence.common.Path;
@ -95,7 +96,7 @@ public class ObjectListPortletEditor extends PortletConfigFormSection {
add(m_baseObjectType); add(m_baseObjectType);
m_restrictedObjectType = buildRestrictedObjectTypeWidget(new StringParameter( m_restrictedObjectType = buildRestrictedObjectTypeWidget(new StringParameter(
"restrictedObjectType")); "restrictedObjectType"));
add(new Label("Restricted object type:", Label.BOLD), ColumnPanel.RIGHT); add(new Label("Restricted object type:", Label.BOLD), ColumnPanel.RIGHT);
add(m_restrictedObjectType); add(m_restrictedObjectType);
@ -210,7 +211,7 @@ public class ObjectListPortletEditor extends PortletConfigFormSection {
protected void initWidgets(PageState state, protected void initWidgets(PageState state,
Portlet portlet) Portlet portlet)
throws FormProcessException { throws FormProcessException {
super.initWidgets(state, portlet); super.initWidgets(state, portlet);
Iterator properties = ObjectListPortlet.getRegisteredProperties(); Iterator properties = ObjectListPortlet.getRegisteredProperties();
@ -257,35 +258,36 @@ public class ObjectListPortletEditor extends PortletConfigFormSection {
} }
} }
@Override
protected void validateWidgets(PageState state, protected void validateWidgets(PageState state,
Portlet portlet) Portlet portlet) throws FormProcessException {
throws FormProcessException {
String baseTypeName = (String) m_baseObjectType.getValue(state); final String baseTypeName = (String) m_baseObjectType.getValue(state);
ObjectType baseType = MetadataRoot.getMetadataRoot().getObjectType(baseTypeName); final ObjectType baseType = MetadataRoot.getMetadataRoot().getObjectType(baseTypeName);
if (baseType == null) { if (baseType == null) {
throw new FormProcessException( throw new FormProcessException(NavigationGlobalizationUtil.globalize(
"Cannot find object type '" + baseTypeName + "'"); "portlet.ui.cannot_find_object_type", new String[]{baseTypeName}));
} }
if (!baseType.isSubtypeOf(ACSObject.BASE_DATA_OBJECT_TYPE)) { if (!baseType.isSubtypeOf(ACSObject.BASE_DATA_OBJECT_TYPE)) {
throw new FormProcessException( throw new FormProcessException(NavigationGlobalizationUtil.globalize(
"The type '" + baseTypeName + "' is not a subtype of '" "portlet.ui.not_a_subtype",
+ ACSObject.BASE_DATA_OBJECT_TYPE + "'"); 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; ObjectType specificType = null;
if (specificTypeName != null && !"".equals(specificTypeName)) { if (specificTypeName != null && !"".equals(specificTypeName)) {
specificType = MetadataRoot.getMetadataRoot().getObjectType(specificTypeName); specificType = MetadataRoot.getMetadataRoot().getObjectType(specificTypeName);
if (specificType == null) { if (specificType == null) {
throw new FormProcessException( throw new FormProcessException(NavigationGlobalizationUtil.globalize(
"Cannot find object type '" + specificTypeName + "'"); "portlet.ui.cannot_find_object_type", new String[]{specificTypeName}));
} }
if (!specificType.isSubtypeOf(baseType)) { if (!specificType.isSubtypeOf(baseType)) {
throw new FormProcessException( throw new FormProcessException(NavigationGlobalizationUtil.globalize(
"The type '" + specificTypeName + "' is not a subtype of '" + baseTypeName + "'"); "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, private void validateFields(ObjectType type,
String str) String str)
throws FormProcessException { throws FormProcessException {
Root root = MetadataRoot.getMetadataRoot().getRoot(); Root root = MetadataRoot.getMetadataRoot().getRoot();
com.redhat.persistence.metadata.ObjectType objType = root.getObjectType(type com.redhat.persistence.metadata.ObjectType objType = root.getObjectType(type
.getQualifiedName()); .getQualifiedName());
String[] fields = StringUtils.split(str, ','); String[] fields = StringUtils.split(str, ',');
for (int i = 0; i < fields.length; i++) { for (int i = 0; i < fields.length; i++) {
@ -325,16 +327,17 @@ public class ObjectListPortletEditor extends PortletConfigFormSection {
} }
if (!objType.exists(Path.get(field))) { if (!objType.exists(Path.get(field))) {
throw new FormProcessException( throw new FormProcessException(NavigationGlobalizationUtil.globalize(
"The type '" + type.getQualifiedName() + "' does not have a property '" + field "portlet.ui.type_does_not_have_property",
+ "'"); new String[]{type.getQualifiedName(), field}));
} }
} }
} }
@Override
protected void processWidgets(PageState state, protected void processWidgets(PageState state,
Portlet portlet) Portlet portlet)
throws FormProcessException { throws FormProcessException {
super.processWidgets(state, portlet); super.processWidgets(state, portlet);
ObjectListPortlet myportlet = (ObjectListPortlet) portlet; ObjectListPortlet myportlet = (ObjectListPortlet) portlet;
@ -348,10 +351,10 @@ public class ObjectListPortletEditor extends PortletConfigFormSection {
myportlet.setFilterCategory(m_filterCategory.getCategory(state)); myportlet.setFilterCategory(m_filterCategory.getCategory(state));
myportlet.setDescendCategories(((Boolean) m_descendCategories.getValue(state)) myportlet.setDescendCategories(((Boolean) m_descendCategories.getValue(state))
.booleanValue()); .booleanValue());
myportlet.setCheckPermissions(((Boolean) m_checkPermissions.getValue(state)).booleanValue()); myportlet.setCheckPermissions(((Boolean) m_checkPermissions.getValue(state)).booleanValue());
myportlet.setExcludeIndexObjects(((Boolean) m_excludeIndexObjects.getValue(state)) myportlet.setExcludeIndexObjects(((Boolean) m_excludeIndexObjects.getValue(state))
.booleanValue()); .booleanValue());
myportlet.setProperties((Object[]) m_properties.getValue(state)); myportlet.setProperties((Object[]) m_properties.getValue(state));
} }