diff --git a/system/handlers/renderers/labels/email_layout_config_item.cfc b/system/handlers/renderers/labels/email_layout_config_item.cfc new file mode 100644 index 0000000000..5c35381166 --- /dev/null +++ b/system/handlers/renderers/labels/email_layout_config_item.cfc @@ -0,0 +1,37 @@ +component { + private array function _selectFields( event, rc, prc ) { + return [ + "email_template.name as template_name" + , "email_blueprint.name as blueprint_name" + , "email_layout_config_item.layout as layout" + , "email_layout_config_item.custom_layout as custom_layout" + , "item" + ]; + } + + private string function _orderBy( event, rc, prc ) { + return "layout, email_template, email_blueprint, custom_layout, item" + } + + private string function _renderLabel( event, rc, prc ) { + var layout = arguments.layout ?: ""; + var template_name = arguments.template_name ?: ""; + var blueprint_name = arguments.blueprint_name ?: ""; + var custom_layout = arguments.custom_layout ?: ""; + var item = arguments.item ?: ""; + + var label = [ item ]; + if( Len( template_name ) ){ + ArrayPrepend( label, translateResource( uri="preside-objects.email_layout_config_item:renderer.labels.template_prefix", data=[ template_name ] ) ) + } else if( Len( blueprint_name ) ){ + ArrayPrepend( label, translateResource( uri="preside-objects.email_layout_config_item:renderer.labels.blueprint_prefix", data=[ blueprint_name ] ) ); + } else if( Len( custom_layout ) ){ + ArrayPrepend( label, translateResource( uri="preside-objects.email_layout_config_item:renderer.labels.custom_layout_prefix", data=[ custom_layout ] ) ); + } else { + var layoutLabel = translateResource( "email.layout.#layout#:title" ); + ArrayPrepend( label, translateResource( uri="preside-objects.email_layout_config_item:renderer.labels.layout_prefix", data=[ layoutLabel ] ) ); + } + + return ArrayToList( label, " - " ); + } +} \ No newline at end of file diff --git a/system/handlers/rules/fieldtypes/Object.cfc b/system/handlers/rules/fieldtypes/Object.cfc index 7ec1125599..2c5e35e38d 100644 --- a/system/handlers/rules/fieldtypes/Object.cfc +++ b/system/handlers/rules/fieldtypes/Object.cfc @@ -19,12 +19,12 @@ component { return renderLabel( objectName=objectName, recordId=ids[1] ); } - var records = presideObjectService.selectData( - objectName = objectName - , selectFields = [ "${labelfield} as label" ] - , filter = { id=ids } - ); - return ValueList( records.label, ", " ); + var labels = []; + for( var id in ids ){ + ArrayAppend( labels, renderLabel( objectName, id ) ); + } + + return arrayToList( labels, ", " ); } private string function renderConfigScreen( string value="", struct config={} ) { diff --git a/system/i18n/preside-objects/email_layout_config_item.properties b/system/i18n/preside-objects/email_layout_config_item.properties new file mode 100644 index 0000000000..f6a964e4d6 --- /dev/null +++ b/system/i18n/preside-objects/email_layout_config_item.properties @@ -0,0 +1,14 @@ +title=Email layout config items +title.singular=Email layout config item + +field.layout.title=Layout +field.email_template.title=Email template +field.email_blueprint.title=Email blueprint +field.custom_layout.title=Custom layout +field.item.title=Item +field.value.title=Value + +renderer.labels.layout_prefix=Layout: {1} +renderer.labels.template_prefix=Template: {1} +renderer.labels.blueprint_prefix=Blueprint: {1} +renderer.labels.custom_layout_prefix=Custom layout: {1} \ No newline at end of file diff --git a/system/preside-objects/email/email_layout_config_item.cfc b/system/preside-objects/email/email_layout_config_item.cfc index 48359bebcd..a4d7efa461 100644 --- a/system/preside-objects/email/email_layout_config_item.cfc +++ b/system/preside-objects/email/email_layout_config_item.cfc @@ -1,10 +1,10 @@ /** * Represents a saved configuration item for an email layout (see [[emailtemplatingv1]]) * - * @nolabel true - * @versioned false - * @feature emailCenter - * + * @nolabel true + * @versioned false + * @feature emailCenter + * @labelRenderer email_layout_config_item */ component extends="preside.system.base.SystemPresideObject" displayname="Email layout configuration item" { property name="layout" type="string" dbtype="varchar" maxlength=200 required=true uniqueindexes="layoutconfigitem|1" indexes="layout,layouttemplate|1,layoutblueprint|1,layoutcustom|3" cloneable=true;