diff --git a/Frameworks/D2W/ERModernDirectToWeb/Components/Nonlocalized.lproj/ERMD2WUserPresentableDescriptionHeader.wo/ERMD2WUserPresentableDescriptionHeader.html b/Frameworks/D2W/ERModernDirectToWeb/Components/Nonlocalized.lproj/ERMD2WUserPresentableDescriptionHeader.wo/ERMD2WUserPresentableDescriptionHeader.html new file mode 100644 index 00000000000..1fd822a4611 --- /dev/null +++ b/Frameworks/D2W/ERModernDirectToWeb/Components/Nonlocalized.lproj/ERMD2WUserPresentableDescriptionHeader.wo/ERMD2WUserPresentableDescriptionHeader.html @@ -0,0 +1 @@ +

\ No newline at end of file diff --git a/Frameworks/D2W/ERModernDirectToWeb/Components/Nonlocalized.lproj/ERMD2WUserPresentableDescriptionHeader.wo/ERMD2WUserPresentableDescriptionHeader.wod b/Frameworks/D2W/ERModernDirectToWeb/Components/Nonlocalized.lproj/ERMD2WUserPresentableDescriptionHeader.wo/ERMD2WUserPresentableDescriptionHeader.wod new file mode 100644 index 00000000000..bd1be7585f9 --- /dev/null +++ b/Frameworks/D2W/ERModernDirectToWeb/Components/Nonlocalized.lproj/ERMD2WUserPresentableDescriptionHeader.wo/ERMD2WUserPresentableDescriptionHeader.wod @@ -0,0 +1,8 @@ +HeadingString : WOString { + value = headerString; + escapeHTML = d2wContext.escapeHTML; +} + +ShowHeading : WOConditional { + condition = showHeading; +} \ No newline at end of file diff --git a/Frameworks/D2W/ERModernDirectToWeb/Components/Nonlocalized.lproj/ERMD2WUserPresentableDescriptionHeader.wo/ERMD2WUserPresentableDescriptionHeader.woo b/Frameworks/D2W/ERModernDirectToWeb/Components/Nonlocalized.lproj/ERMD2WUserPresentableDescriptionHeader.wo/ERMD2WUserPresentableDescriptionHeader.woo new file mode 100644 index 00000000000..a076a051a7e --- /dev/null +++ b/Frameworks/D2W/ERModernDirectToWeb/Components/Nonlocalized.lproj/ERMD2WUserPresentableDescriptionHeader.wo/ERMD2WUserPresentableDescriptionHeader.woo @@ -0,0 +1,4 @@ +{ + "WebObjects Release" = "WebObjects 5.0"; + encoding = "UTF-8"; +} \ No newline at end of file diff --git a/Frameworks/D2W/ERModernDirectToWeb/Sources/er/modern/directtoweb/components/header/ERMD2WUserPresentableDescriptionHeader.java b/Frameworks/D2W/ERModernDirectToWeb/Sources/er/modern/directtoweb/components/header/ERMD2WUserPresentableDescriptionHeader.java new file mode 100644 index 00000000000..a799d5e9ef6 --- /dev/null +++ b/Frameworks/D2W/ERModernDirectToWeb/Sources/er/modern/directtoweb/components/header/ERMD2WUserPresentableDescriptionHeader.java @@ -0,0 +1,54 @@ +package er.modern.directtoweb.components.header; + +import com.webobjects.appserver.WOContext; +import com.webobjects.eocontrol.EOEnterpriseObject; + +import er.extensions.foundation.ERXStringUtilities; +import er.modern.directtoweb.components.header.ERMD2WHeader; +import er.modern.directtoweb.components.header.ERMD2WSimpleHeader; + +/** + * Simple h1 header that defaults to displaying the + * displayNameForPageConfiguration and appends the object's + * userPresentableDescription if one is available. + * + * @author fpeters + * + */ +public class ERMD2WUserPresentableDescriptionHeader extends ERMD2WSimpleHeader { + + private static final long serialVersionUID = 1L; + + public interface Keys extends ERMD2WHeader.Keys { + public static String displayNameForPageConfiguration = "displayNameForPageConfiguration"; + } + + protected String _headerString; + + public ERMD2WUserPresentableDescriptionHeader(WOContext context) { + super(context); + } + + public String headerString() { + String headerString = super.headerString(); + if (object() != null) { + String userPresentableDescription = (String) object().valueForKey( + "userPresentableDescription"); + if (!ERXStringUtilities.stringIsNullOrEmpty(userPresentableDescription)) { + // is displayNameForPageConfiguration null? + if (ERXStringUtilities.stringIsNullOrEmpty(headerString)) { + headerString = userPresentableDescription; + } else { + headerString = headerString + ": " + userPresentableDescription; + } + } + } + return headerString; + } + + public EOEnterpriseObject object() { + EOEnterpriseObject _object = (EOEnterpriseObject) valueForBinding("object"); + return _object; + } + +}