None Found
"); - } - - break; - } - // one to many display - case "one-to-one" : { - // A new or persisted entity? If new, then skip out - if( NOT loc.orm.contains(arguments.entity) OR NOT arguments.showRelations){ - break; - } - - arguments["data-ormtype"] = "one-to-one"; - // We just show them as a nice table because we are not scaffolding, just display - // values should be an array of objects, so let's convert them - loc.data = invoke( arguments.entity, "get#prop.name#" ); - if( isNull(loc.data) ){ loc.relArray = []; } - else{ loc.relArray = [ loc.data ]; } - - // Label Generation - args = { - field=prop.name, wrapper=arguments.labelWrapper, class=arguments.labelClass, inputInsideLabel=arguments.inputInsideLabel - }; - structAppend(args,arguments); - buffer.append( this.label(argumentCollection=args) ); - - // Table Generation - if( arrayLen(loc.relArray) ){ - args = { - name=prop.name, data=loc.relArray - }; - structAppend(args,arguments); - buffer.append( this.table(argumentCollection=args) ); - } - else{ - buffer.append("None Found
"); - } - break; - } - // many to one - case "many-to-one" : { - // A new or persisted entity? If new, then skip out - if( NOT loc.orm.contains(arguments.entity) OR NOT arguments.showRelations){ - break; - } - arguments["data-ormtype"] = "many-to-one"; - // prepare lookup args - loc.criteria = {}; - loc.sortorder = ""; - loc.column = ""; - loc.nameColumn = ""; - // is key found in manytoone arg - if( structKeyExists(arguments.manytoone, prop.name) ){ - // Verify the valueColumn which is mandatory - if( structKeyExists(arguments.manytoone[prop.name],"valueColumn") ){ loc.column = arguments.manytoone[prop.name].valueColumn; } - else{ - throw(message="The 'valueColumn' property is missing from the '#prop.name#' relationship data, which is mandatory", - detail="A structure of data to help with many to one relationships on how they are presented. Possible key values for each key are [valuecolumn='',namecolumn='',criteria={},sortorder=string]. Example: {criteria={productid=1},sortorder='Department desc'}", - type="EntityFieldsInvalidRelationData"); - } - if( structKeyExists(arguments.manytoone[prop.name],"nameColumn") ){ loc.nameColumn = arguments.manytoone[prop.name].nameColumn; } - else { loc.nameColumn = arguments.manytoone[prop.name].valueColumn; } - if( structKeyExists(arguments.manytoone[prop.name],"criteria") ){ loc.criteria = arguments.manytoone[prop.name].criteria; } - if( structKeyExists(arguments.manytoone[prop.name],"sortorder") ){ loc.sortorder = arguments.manytoone[prop.name].sortorder; } - } - else{ - throw(message="There is no many to one information for the '#prop.name#' relationship in the entityFields() arguments. Please make sure you create one", - detail="A structure of data to help with many to one relationships on how they are presented. Possible key values for each key are [valuecolumn='',namecolumn='',criteria={},sortorder=string]. Example: {criteria={productid=1},sortorder='Department desc'}", - type="EntityFieldsInvalidRelationData"); - } - // generation args - args = { - name=prop.name, options=entityLoad( prop.cfc, loc.criteria, loc.sortorder ), - column=loc.column, nameColumn=loc.nameColumn, - label=prop.name, bind=arguments.entity, labelwrapper=arguments.labelWrapper, labelWrapperAttrs=arguments.labelWrapperAttrs, labelClass=arguments.labelClass, - wrapper=arguments.fieldwrapper, wrapperAttrs=arguments.fieldWrapperAttrs, groupWrapper=arguments.groupWrapper, groupWrapperAttrs=arguments.groupWrapperAttrs, - inputInsideLabel=arguments.inputInsideLabel - }; - structAppend(args,arguments); - buffer.append( this.select(argumentCollection=args) ); - break; - } - // columns - case "column" : { - - // booleans? - if( structKeyExists(prop,"ormtype") and prop.ormtype eq "boolean"){ - // boolean select or radio buttons - if( arguments.booleanSelect ){ - args = { - name=prop.name, options=[true,false], label=prop.name, bind=arguments.entity, labelwrapper=arguments.labelWrapper, labelWrapperAttrs=arguments.labelWrapperAttrs, labelClass=arguments.labelClass, - wrapper=arguments.fieldwrapper, wrapperAttrs=arguments.wrapperAttrs, groupWrapper=arguments.groupWrapper, groupWrapperAttrs=arguments.groupWrapperAttrs, inputInsideLabel=arguments.inputInsideLabel - }; - structAppend(args,arguments); - buffer.append( this.select(argumentCollection=args) ); - } - else{ - args = { - name=prop.name, value="true", label="True", bind=arguments.entity, labelwrapper=arguments.labelWrapper, labelWrapperAttrs=arguments.labelWrapperAttrs, labelClass=arguments.labelClass, - groupWrapper=arguments.groupWrapper, groupWrapperAttrs = arguments.groupWrapperAttrs, wrapper=arguments.fieldWrapper, wrapperAttrs=arguments.fieldWrapperAttrs,inputInsideLabel=arguments.inputInsideLabel - }; - structAppend(args,arguments); - buffer.append( this.radioButton(argumentCollection=args) ); - args.value="false"; - args.label="false"; - buffer.append( this.radioButton(argumentCollection=args) ); - } - continue; - } - // text args - args = { - name=prop.name, label=prop.name, bind=arguments.entity, labelwrapper=arguments.labelWrapper, labelWrapperAttrs=arguments.labelWrapperAttrs, labelClass=arguments.labelClass, - wrapper=arguments.fieldwrapper, wrapperAttrs=arguments.fieldWrapperAttrs, groupWrapper=arguments.groupWrapper, groupWrapperAttrs=arguments.groupWrapperAttrs, inputInsideLabel=arguments.inputInsideLabel - }; - structAppend(args,arguments); - // text and textarea fields - if( len(arguments.textareas) AND listFindNoCase(arguments.textareas, prop.name) ){ - buffer.append( this.textarea(argumentCollection=args) ); - } - else{ - buffer.append( this.textfield(argumentCollection=args) ); - } - }// end case column - - }// end switch - - }// end for loop - - return buffer.toString(); -