-----Ursprungliche Nachricht-----
Von: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Auftrag von Gary
Menzel
Gesendet: Mittwoch, 28. Januar 2004 10:32
An: FarCry Developers
Betreff: [farcry-dev] Something Useful for CustomAdmin
FarCry Custom Admin stuff is REALLY kewl (allowing you to extend the the
Admin Console with your own stuff).
And more recently we have started to build plug-in admin modules that are,
themselves, written in the FarCry framework (as inlcudeObj files). This
gives us access in our Admin modules to the whole FarCry toolset.
BUT.....
In your Custom Admin XML file (<your app>/customadmin/customadmin.xml),
you still have to hard code your URL's like:
<link>/index.cfm?objectid=2F750F2E-65B3-AE2D-D76401A56CBBB6CA</link>
So..... what I have done is knock together a useful little piece of code
that allows you to use CF variables INSIDE THE XML FILE to be able to take
advantage (primarily) of FarCry Nav Aliase
s!!!!
Then you can say in your Custom Admin XML file something like:
<link>/index.cfm?objectid=#application.navid.portablename#</link>
And there is no need to modify the FarCry core at all.
AND you can use ANY variable from any scope that may have been initialised
at the point where the code is executed (which should be mostly everything
in Application scope).
Here is what my <app instance>/www/Application.cfm looks like in my FarCry
instance to achieve this.....
<!--- Application Initialise --->
<cfif NOT IsDefined("application.bInit") OR IsDefined("url.updateapp")>
<!--- Project Specific Initialisation --->
<cfinclude template="../config/_applicationInit.cfm">
<!--- Farcry Core Initialisation --->
<cfinclude
template="/farcry/farcry_core/tags/farcry/_farcryApplicationInit.cfm">
<!--- $TODO: must have project vars set AFTER core vars! GB$ --->
<!--- ADD THIS IN TO TRANSLATE ## variables in the XML <link>
objects into the c
orrect objectID --->
<!--- Gary Menzel - 2004-01-28 --->
<CFSCRIPT>
// create up a regular expression to trap ## variables
CFVar = "\##([^\##]*)\##";
// get the <link> nodes from the XML object
nodes =
XMLSearch(application.customAdminXML,"/customtabs/parenttab/subtabs/menuitem
/link");
// loops over the array of nodes and translate any
variables found
for(i=1;i LT ArrayLen(nodes);i = i+1)
{
// do the matching
aFound = REFind(CFVar,nodes[i].XMLText,1,true);
// only process if we found one (and only
processes ONE variable)
if(ArrayLen(aFound.pos) GT 1)
{
// work out the variable name
found =
mid(nodes[i].XMLText,aFound.pos[2],aFound.len[2]);
// try a
nd get a value for it (should do
error checking here)
value = evaluate(found);
// replace the variable in the text using
a regEX
nodes[i].XMLText =
REReplace(nodes[i].XMLText,CFVar,value);
}
}
</CFSCRIPT>
</cfif>
The code basically walks over all the <link> elements in the Custom Admin
XML object, checks to see if there is something that looks like a Cold
Fusion variable, tries to evaluate it and then replace it.
There is NO error trapping, if you have not specified a valid CF variable
it will error. The error wont be nice and wont be descriptive. This is
useful for my purposes at the moment. I may look at doing a litle more
checking using IsDefined and a cfthrow of some kind to address this in the
future.
Enjoy!
Gary Menzel
Web Development Manager
IT Operations Brisbane -+- ABN AMRO Morgans Limited
Level 29, 123 Eagle Street BRISB
ANE QLD 4000
PH: 07 333 44 828 FX: 07 3834 0828
If this communication is not intended for you and you are not an authorised
recipient of this email you are prohibited by law from dealing with or
relying on the email or any file attachments. This prohibition includes
reading, printing, copying, re-transmitting, disseminating, storing or in
any other way dealing or acting in reliance on the information. If you have
received this email in error, we request you contact ABN AMRO Morgans
Limited immediately by returning the email to [EMAIL PROTECTED] and
destroy the original. We will refund any reasonable costs associated with
notifying ABN AMRO Morgans. This email is confidential and may contain
privileged client information. ABN AMRO Morgans has taken reasonable steps
to ensure the accuracy and integrity of all its communications, including
electronic communications, but accepts no liability for materials
transmitted. Materials may also be transmitted without the knowledge of ABN
A
MRO Morgans. ABN AMRO Morgans Limited its directors and employees do not
accept liability for the results of any actions taken or not on the basis of
the information in this report. ABN AMRO Morgans Limited and its associates
hold or may hold securities in the companies/trusts mentioned herein. Any
recommendation is made on the basis of our research of the investment and
may not suit the specific requirements of clients. Assessments of
suitability to an individual?s portfolio can only be made after an
examination of the particular client?s investments, financial circumstances
and requirements.
---
You are currently subscribed to farcry-dev as: [EMAIL PROTECTED]
To unsubscribe send a blank email to
[EMAIL PROTECTED]
MXDU2004 + Macromedia DevCon AsiaPac + Sydney, Australia
http://www.mxdu.com/ + 24-25 February, 2004
---
You are currently subscribed to farcry-dev as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]
MXDU2004 + Macromedia DevCon AsiaPac + Sydney, Australia
http://www.mxdu.com/ + 24-25 February, 2004