Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
titlePass An Array of Columns
<cfscript>
	//This data structure is used to create the grid columns
	//remember to delimit dynamic expressions ##
	aDefaultColumns=arrayNew(1);
	mytypename = "dmEvent";
	editobjectURL = "#application.url.farcry#/conjuror/invocation.cfm?objectid=##recordset.objectID[recordset.currentrow]##&typename=#mytypename#&ref=typeadmin";
	
	//select
	stCol=structNew();
	stCol.columnType="expression";
	stCol.title="#application.adminBundle[session.dmProfile.locale].select#";
	stCol.value="<input type=""checkbox"" class=""f-checkbox"" name=""objectid"" value=""##recordset.objectid##"" onclick=""setRowBackground(this);"" />";
	stCol.style="text-align: center;";
	//stCol.orderby="";
	arrayAppend(aDefaultColumns,stCol);
	
	//edit icon
	stCol=structNew();
	stCol.columnType="evaluate";
	stCol.title="#application.adminBundle[session.dmProfile.locale].edit#";
	stCol.value="iif(stPermissions.iEdit eq 1,DE(iif(locked and lockedby neq '##session.dmSec.authentication.userlogin##_##session.dmSec.authentication.userDirectory##',DE('<span style=""color:red"">Locked</span>'),DE('<a href=''#editObjectURL#''><img src=""#application.url.farcry#/images/treeImages/edit.gif"" alt=""#application.adminBundle[session.dmProfile.locale].edit#"" title=""#application.adminBundle[session.dmProfile.locale].edit#""/></a>'))),DE('-'))";
	stCol.style="text-align: center;";
	//stCol.orderby="";
	arrayAppend(aDefaultColumns,stCol);
	
	//preview
	stCol=structNew();
	stCol.columnType="expression";
	stCol.title="#application.adminBundle[session.dmProfile.locale].view#";
	stCol.value="<a href=""#application.url.webroot#/index.cfm?objectID=##recordset.objectID##&flushcache=1"" target=""_blank""><img src=""#application.url.farcry#/images/treeImages/preview.gif"" alt=""#application.adminBundle[session.dmProfile.locale].view#"" title=""#application.adminBundle[session.dmProfile.locale].view#"" /></a>";
	stCol.style="text-align: center;";
	//stCol.orderby="";
	arrayAppend(aDefaultColumns,stCol);
	
	//label and edit
	stCol=structNew();
	stCol.columnType="evaluate";
	stCol.title="#application.adminBundle[session.dmProfile.locale].label#";
	stCol.value = "iif(stPermissions.iEdit eq 1,DE(iif(locked and lockedby neq '#session.dmSec.authentication.userlogin#_#session.dmSec.authentication.userDirectory#',DE('##replace(recordset.label[recordset.currentrow],'####','','all')##'),DE('<a href=''#editObjectURL#''>##replace(recordset.label[recordset.currentrow],'####','','all')##</a>'))),DE('##replace(recordset.label[recordset.currentrow],'####','','all')##'))";
	stCol.style="text-align: left;";
	stCol.orderby="label";
	arrayAppend(aDefaultColumns,stCol);
	
	//datetimelastupdated
	stCol=structNew();
	stCol.columnType="evaluate";
	stCol.title="#application.adminBundle[session.dmProfile.locale].lastUpdatedLC#";
	stCol.value="application.thisCalendar.i18nDateFormat('##datetimelastupdated##',session.dmProfile.locale,application.mediumF)";
	stCol.style="text-align: center;";
	stCol.orderby="datetimelastupdated";
	arrayAppend(aDefaultColumns,stCol);
	
	//status
	if (structKeyExists(application.types[attributes.typenamemytypename].stprops, "status")) {
		stCol=structNew();
		stCol.columnType="value";
		stCol.title="#application.adminBundle[session.dmProfile.locale].status#";
		stCol.value="status";
		stCol.style="text-align: center;";
		stCol.orderby="status";
		arrayAppend(aDefaultColumns,stCol);
	}
	
	//lastupdatedby
	stCol=structNew();
	stCol.columnType="value";
	stCol.title="#application.adminBundle[session.dmProfile.locale].by#";
	stCol.value="lastupdatedby";
	stCol.style="text-align: center;";
	stCol.orderby="lastupdatedby";
	arrayAppend(aDefaultColumns,stCol);
</cfscript>

<widgets:typeadmin 
	typename="#mytypename#"
	title="Your title"
	permissionset="news"
	aColumns="#aDefaultColumns#">

...