Versions Compared

Key

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

The following are the default columns for typeadmin. A similar set of columns can be passed into the typeadmin custom tag using the acolumns attribute, and modified to get the desired effect for your type administration interface.

Alternatively you can use the typeadmincolumn custom tag.

recordset is a special query object variable that houses the final filtered query object used to build the grid.

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);
	editobjectURL = "#application.url.farcry#/conjuror/invocation.cfm?objectid=##recordset.objectID[recordset.currentrow]##&typename=#attributes.typename#&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.typename].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>