The following are the default buttons for typeadmin. A similar set of buttons can be passed into the typeadmin custom tag using the abuttons attribute, and modified to get the desired effect for your type administration interface.
recordset is a special query object variable that houses the final filtered query object used to build the grid.
Code Block |
---|
<cfscript> //This data structure is used to create the buttons //remember to delimit dynamic expressions ## aDefaultButtons=arrayNew(1); editobjectURL = "#application.url.farcry#/conjuror/invocation.cfm?objectid=##recordset.objectID[recordset.currentrow]##&typename=#attributes.typename#&ref=typeadmin"; // check for base permissions oAuthorisation=request.dmsec.oAuthorisation; // set bunlock for now, needs to be set if locked objects exist bUnlock=true; //add, delete, unlock, dump, requestapproval, approve, sendtodraft // add button stBut=structNew(); stBut.type="button"; stBut.name="add"; stBut.value="#application.adminBundle[session.dmProfile.locale].add#"; stBut.class="f-submit"; stBut.onClick="window.location='#application.url.farcry#/conjuror/evocation.cfm?typename=#attributes.typename#&ref=typeadmin';"; stBut.permission="#attributes.permissionset#Create"; stBut.buttontype="add"; arrayAppend(aDefaultButtons,stBut); // delete object(s) stBut=structNew(); stBut.type="button"; stBut.name="deleteAction"; stBut.value="#application.adminBundle[session.dmProfile.locale].delete#"; stBut.class="f-submit"; // todo: i18n stBut.onClick="if(confirm('Are you sure you wish to delete these objects?')){document['typeadmin']['delete'].value=1;this.form.submit();}"; stBut.permission="#attributes.permissionset#Delete"; stBut.buttontype="delete"; arrayAppend(aDefaultButtons,stBut); // check if object uses status if (structKeyExists(application.types['#attributes.typename#'].stProps,"status")) { // Set status to pending stBut=structNew(); stBut.type="submit"; stBut.name="status"; stBut.value="#application.adminBundle[session.dmProfile.locale].requestApproval#"; stBut.class="f-submit"; stBut.onClick=""; stBut.permission="#attributes.permissionset#RequestApproval"; stBut.buttontype="requestapproval"; arrayAppend(aDefaultButtons,stBut); // set status to approved/draft //approve stBut=structNew(); stBut.type="submit"; stBut.name="status"; stBut.value="#application.adminBundle[session.dmProfile.locale].approve#"; stBut.class="f-submit"; stBut.onClick=""; stBut.permission="#attributes.permissionset#Approve"; stBut.buttontype="approve"; arrayAppend(aDefaultButtons,stBut); //send to draft stBut=structNew(); stBut.type="submit"; stBut.name="status"; stBut.value="#application.adminBundle[session.dmProfile.locale].sendToDraft#"; stBut.class="f-submit"; stBut.onClick=""; stBut.permission="#attributes.permissionset#Approve"; stBut.buttontype="sendtodraft"; arrayAppend(aDefaultButtons,stBut); } // dump objects stBut=structNew(); stBut.type="submit"; stBut.name="dump"; stBut.value="#application.adminBundle[session.dmProfile.locale].dump#"; stBut.class="f-submit"; stBut.onClick=""; stBut.permission="ObjectDumpTab"; stBut.buttontype="dump"; arrayAppend(aDefaultButtons,stBut); // check if there are locked objects if (isdefined("bUnlock")) { stBut=structNew(); stBut.type="Submit"; stBut.name="unlock"; stBut.value="#application.adminBundle[session.dmProfile.locale].unlockUC#"; stBut.class="f-submit"; stBut.onClick=""; stBut.permission=""; stBut.buttontype="unlock"; arrayAppend(aDefaultButtons,stBut); } </cfscript> |