root / website / trunk / fusebox4.transformer.cfmx.cfm

Revision 217, 45.5 kB (checked in by scorfield, 3 years ago)

Initial import of partial fusebox.org site just to kick off the repository.

Line 
1<cfsilent>
2<!---
3Fusebox Software License
4Version 1.0
5
6Copyright (c) 2003, 2004, 2005 The Fusebox Corporation. All rights reserved.
7
8Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
9
101. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
11
122. Redistributions in binary form or otherwise encrypted form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
13
143. The end-user documentation included with the redistribution, if any, must include the following acknowledgment:
15
16"This product includes software developed by the Fusebox Corporation (http://www.fusebox.org/)."
17
18Alternately, this acknowledgment may appear in the software itself, if and wherever such third-party acknowledgments normally appear.
19
204. The names "Fusebox" and "Fusebox Corporation" must not be used to endorse or promote products derived from this software without prior written (non-electronic) permission. For written permission, please contact fusebox@fusebox.org.
21
225. Products derived from this software may not be called "Fusebox", nor may "Fusebox" appear in their name, without prior written (non-electronic) permission of the Fusebox Corporation. For written permission, please contact fusebox@fusebox.org.
23
24If one or more of the above conditions are violated, then this license is immediately revoked and can be re-instated only upon prior written authorization of the Fusebox Corporation.
25
26THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FUSEBOX CORPORATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
28-------------------------------------------------------------------------------
29
30This software consists of voluntary contributions made by many individuals on behalf of the Fusebox Corporation. For more information on Fusebox, please see <http://www.fusebox.org/>.
31
32--->
33
34<!--- which version of the transformer is this? --->
35<cfset myFusebox.version.transformer = "4.1.0" />
36
37<cfif myFusebox.version.runtime NEQ myFusebox.version.transformer>
38        <cfthrow type="fusebox.versionMismatchException"
39                message="The transformer is not the same version as the runtime" />
40</cfif>
41<cfscript>
42  // ok ready to start work on the actual fuseaction
43
44  /* BEGIN: THIS IS THE PREPROCESS PLUGIN SECTION */
45  fb_.phase = "preProcess";
46  for (fb_.i = 1; fb_.i LTE arrayLen(application.fusebox.pluginphases[fb_.phase]); fb_.i = fb_.i + 1) {
47    // pass in this Plugin's parameters
48    for (fb_.j = 1; fb_.j LTE arrayLen(application.fusebox.pluginphases[fb_.phase][fb_.i].parameters); fb_.j = fb_.j + 1) {
49      fb_.name = application.fusebox.pluginphases[fb_.phase][fb_.i].parameters[fb_.j].xmlAttributes.name;
50      fb_.value = application.fusebox.pluginphases[fb_.phase][fb_.i].parameters[fb_.j].xmlAttributes.value;
51      fb_.plugin = application.fusebox.pluginphases[fb_.phase][fb_.i].name;
52      fb_.temp=structNew();
53      fb_.temp.xmlName = "set";
54      fb_.temp.circuit = "";
55      fb_.temp.fuseaction = "";
56      fb_.temp.phase = fb_.phase;
57      fb_.temp.xmlAttributes = structNew();
58      fb_.temp.xmlAttributes['name'] = "myFusebox.plugins.#fb_.plugin#.parameters.#fb_.name#";
59      fb_.temp.xmlAttributes['value'] = fb_.value;
60      arrayAppend(fb_.fuseQ, fb_.temp);
61    }
62    // and the Plugin itself
63    fb_.temp=StructNew();
64    fb_.temp.xmlName = "plugin";
65    fb_.temp.circuit = myFusebox.thisCircuit;
66    fb_.temp.fuseaction = myFusebox.thisFuseaction;
67    fb_.temp.plugin = application.fusebox.pluginphases[fb_.phase][fb_.i];
68    fb_.temp.phase = fb_.phase;
69    fb_.temp.xmlAttributes = structNew();
70    fb_.temp.xmlAttributes['name'] = application.fusebox.pluginphases[fb_.phase][fb_.i].name;
71    arrayAppend(fb_.fuseQ, fb_.temp);
72  }
73  /* END: THIS IS THE PREPROCESS PLUGIN SECTION */
74
75  /* let's get started working on the fuseaction */
76  /* first add in all the preprocess fuseactions */
77  fb_.phase = "preprocessFuseactions";
78
79  fb_.xnPreprocessFA = application.fusebox.globalfuseactions.preprocess.xml.xmlChildren;
80
81  for (fb_.i = 1; fb_.i LTE arraylen(fb_.xnPreprocessFA); fb_.i = fb_.i + 1) {
82    // only calls to fuseactions via a <fuseaction action=""/>  (formerly only a <do> which has been deprecated!) are allowed here and it must have a fully qualified fuseaction
83    if (fb_.xnPreprocessFA[fb_.i].xmlName EQ "fuseaction" OR fb_.xnPreprocessFA[fb_.i].xmlName EQ "do") {
84      if (StructKeyExists(fb_.xnPreprocessFA[fb_.i].xmlAttributes, "action") AND
85          ListLen(fb_.xnPreprocessFA[fb_.i].xmlAttributes['action'], '.') GTE 2) {
86        fb_.temp=structNew();
87        fb_.temp.xmlName = "do";
88        fb_.temp.circuit = ListFirst(fb_.xnPreprocessFA[fb_.i].xmlAttributes['action'], '.');
89        fb_.temp.fuseaction = ListLast(fb_.xnPreprocessFA[fb_.i].xmlAttributes['action'], '.');
90        fb_.temp.phase = fb_.phase;
91        fb_.temp.xmlAttributes = structNew();
92        for (fb_.anItem in fb_.xnPreprocessFA[fb_.i].xmlAttributes) {
93          fb_.temp.xmlAttributes[fb_.anItem] = fb_.xnPreprocessFA[fb_.i].xmlAttributes[fb_.anItem];
94        }
95        arrayAppend(fb_.fuseQ, fb_.temp);
96      }
97    }
98  }
99
100  /* now add the actual fuseaction which is the target of this page request */
101  fb_.phase = "requestedFuseaction";
102  fb_.temp=structNew();
103  fb_.temp.xmlName = "do";
104  fb_.temp.circuit = myFusebox.thisCircuit;
105  fb_.temp.fuseaction = myFusebox.thisFuseaction;
106  fb_.temp.phase = fb_.phase;
107  fb_.temp.xmlAttributes = structNew();
108  fb_.temp.xmlAttributes['action'] = "#myFusebox.originalCircuit#.#myFusebox.originalFuseaction#";
109  arrayAppend(fb_.fuseQ, fb_.temp);
110
111  /* finally add in all the postprocess fuseactions */
112  fb_.phase = "postprocessFuseactions";
113  fb_.xnPostprocessFA = application.fusebox.globalfuseactions.postprocess.xml.xmlChildren;
114
115  for (fb_.i = 1; fb_.i LTE arraylen(fb_.xnPostprocessFA); fb_.i = fb_.i + 1) {
116    // only calls to fuseactions via a <do> are allowed here and it must have a fully qualified fuseaction
117    if (fb_.xnPostprocessFA[fb_.i].xmlName EQ "fuseaction" OR fb_.xnPostprocessFA[fb_.i].xmlName EQ "do") {
118      if (StructKeyExists(fb_.xnPostprocessFA[fb_.i].xmlAttributes, "action") AND
119          ListLen(fb_.xnPostprocessFA[fb_.i].xmlAttributes['action'], '.') GTE 2) {
120        fb_.temp=structNew();
121        fb_.temp.xmlName = "do";
122        fb_.temp.circuit = ListFirst(fb_.xnPostprocessFA[fb_.i].xmlAttributes['action'], '.');
123        fb_.temp.fuseaction = ListLast(fb_.xnPostprocessFA[fb_.i].xmlAttributes['action'], '.');
124        fb_.temp.phase = fb_.phase;
125        fb_.temp.xmlAttributes = structNew();
126        for (fb_.anItem in fb_.xnPostprocessFA[fb_.i].xmlAttributes) {
127          fb_.temp.xmlAttributes[fb_.anItem] = fb_.xnPostprocessFA[fb_.i].xmlAttributes[fb_.anItem];
128        }
129        arrayAppend(fb_.fuseQ, fb_.temp);
130      }
131    }
132  }
133
134  /* be sure to reset the myFusebox.thisCircuit to that of the originalCircuit */
135  fb_.temp=structNew();
136  fb_.temp.xmlName = "set";
137  fb_.temp.circuit = myFusebox.originalCircuit;
138  fb_.temp.fuseaction = myFusebox.originalFuseaction;
139  fb_.temp.phase = fb_.phase;
140  fb_.temp.xmlAttributes = structNew();
141  fb_.temp.xmlAttributes['name'] = "myFusebox.thisCircuit";
142  fb_.temp.xmlAttributes['value'] = myFusebox.originalCircuit;
143  arrayAppend(fb_.fuseQ, fb_.temp);
144
145  /* be sure to reset the myFusebox.thisFuseaction to that of the originalFuseaction */
146  fb_.temp=structNew();
147  fb_.temp.xmlName = "set";
148  fb_.temp.circuit = myFusebox.originalCircuit;
149  fb_.temp.fuseaction = myFusebox.originalFuseaction;
150  fb_.temp.phase = fb_.phase;
151  fb_.temp.xmlAttributes = structNew();
152  fb_.temp.xmlAttributes['name'] = "myFusebox.thisFuseaction";
153  fb_.temp.xmlAttributes['value'] = myFusebox.originalFuseaction;
154  arrayAppend(fb_.fuseQ, fb_.temp);
155
156  /* BEGIN: THIS IS THE POSTPROCESS PLUGIN SECTION */
157  fb_.phase = "postProcess";
158
159  for (fb_.i = 1; fb_.i LTE arrayLen(application.fusebox.pluginphases[fb_.phase]); fb_.i = fb_.i + 1) {
160    // pass in this Plugin's parameters
161    for (fb_.j = 1; fb_.j LTE arrayLen(application.fusebox.pluginphases[fb_.phase][fb_.i].parameters); fb_.j = fb_.j + 1) {
162      fb_.name = application.fusebox.pluginphases[fb_.phase][fb_.i].parameters[fb_.j].xmlAttributes.name;
163      fb_.value = application.fusebox.pluginphases[fb_.phase][fb_.i].parameters[fb_.j].xmlAttributes.value;
164      fb_.plugin = application.fusebox.pluginphases[fb_.phase][fb_.i].name;
165      fb_.temp=structNew();
166      fb_.temp.xmlName = "set";
167      fb_.temp.circuit = "";
168      fb_.temp.fuseaction = "";
169      fb_.temp.phase = fb_.phase;
170      fb_.temp.xmlAttributes = structNew();
171      fb_.temp.xmlAttributes['name'] = "myFusebox.plugins.#fb_.plugin#.parameters.#fb_.name#";
172      fb_.temp.xmlAttributes['value'] = fb_.value;
173      arrayAppend(fb_.fuseQ, fb_.temp);
174    }
175    // and the Plugin itself
176    fb_.temp=StructNew();
177    fb_.temp.xmlName = "plugin";
178    fb_.temp.circuit = myFusebox.thisCircuit;
179    fb_.temp.fuseaction = myFusebox.thisFuseaction;
180    fb_.temp.plugin = application.fusebox.pluginphases[fb_.phase][fb_.i];
181    fb_.temp.phase = fb_.phase;
182    fb_.temp.xmlAttributes = structNew();
183    fb_.temp.xmlAttributes['name'] = application.fusebox.pluginphases[fb_.phase][fb_.i].name;
184    arrayAppend(fb_.fuseQ, fb_.temp);
185  }
186  /* END: THIS IS THE POSTPROCESS PLUGIN SECTION */
187
188  /* BEGIN: THIS IS THE processError PLUGIN SECTION */
189  fb_.phase = "processError";
190
191  for (fb_.i = 1; fb_.i LTE arrayLen(application.fusebox.pluginphases[fb_.phase]); fb_.i = fb_.i + 1) {
192    // pass in this Plugin's parameters
193    for (fb_.j = 1; fb_.j LTE arrayLen(application.fusebox.pluginphases[fb_.phase][fb_.i].parameters); fb_.j = fb_.j + 1) {
194      fb_.name = application.fusebox.pluginphases[fb_.phase][fb_.i].parameters[fb_.j].xmlAttributes.name;
195      fb_.value = application.fusebox.pluginphases[fb_.phase][fb_.i].parameters[fb_.j].xmlAttributes.value;
196      fb_.plugin = application.fusebox.pluginphases[fb_.phase][fb_.i].name;
197      fb_.temp=structNew();
198      fb_.temp.xmlName = "set";
199      fb_.temp.circuit = "";
200      fb_.temp.fuseaction = "";
201      fb_.temp.phase = fb_.phase;
202      fb_.temp.xmlAttributes = structNew();
203      fb_.temp.xmlAttributes['name'] = "myFusebox.plugins.#fb_.plugin#.parameters.#fb_.name#";
204      fb_.temp.xmlAttributes['value'] = fb_.value;
205      arrayAppend(fb_.fuseQ, fb_.temp);
206    }
207    // and the Plugin itself
208    fb_.temp=StructNew();
209    fb_.temp.xmlName = "errorHandler";
210    fb_.temp.circuit = myFusebox.thisCircuit;
211    fb_.temp.fuseaction = myFusebox.thisFuseaction;
212    fb_.temp.plugin = application.fusebox.pluginphases[fb_.phase][fb_.i];
213    fb_.temp.phase = fb_.phase;
214    fb_.temp.xmlAttributes = structNew();
215    fb_.temp.xmlAttributes['name'] = application.fusebox.pluginphases[fb_.phase][fb_.i].name;
216    arrayAppend(fb_.fuseQ, fb_.temp);
217  }
218  /* END: THIS IS THE processError PLUGIN SECTION */
219</cfscript>
220
221<!--- now loop thru fb_.fuseQ and see if there are any <do>s to process or other special transformations such as <if> or <loop> --->
222<cfset fb_.doMore = TRUE>
223<cfloop condition="fb_.doMore IS TRUE">
224        <cfset fb_.pointer = 1>
225        <cfloop from="1" to="#arrayLen(fb_.fuseQ)#" index="fb_.pointer">
226    <cfscript>
227      fb_.doMore = FALSE;
228      fb_.phase = "requestedFuseaction";
229    </cfscript>
230
231                <cfif fb_.fuseQ[fb_.pointer].xmlName EQ "do">
232      <cfscript>
233        fb_.doMore = TRUE;
234
235        fb_.aFuseaction = fb_.fuseQ[fb_.pointer].xmlAttributes["action"];
236        if (ListLen(fb_.aFuseaction, '.') EQ 1) {
237          // assume no circuit means current circuit
238          myFusebox.thisCircuit = fb_.fuseQ[fb_.pointer].circuit;
239          myFusebox.thisFuseaction = ListFirst(fb_.aFuseaction, '.');
240        }
241        else {
242          // parse new FA
243          myFusebox.thisCircuit    = ListFirst(fb_.aFuseaction, '.');
244          myFusebox.thisFuseaction = ListLast(fb_.aFuseaction, '.');
245        }
246      </cfscript>
247
248                        <!--- catch any last minute problems with non-existant circuits --->
249                        <cfif NOT IsDefined("application.fusebox.circuits.#myFusebox.thisCircuit#")>
250                                <cfthrow type="fusebox.undefinedCircuit" message="undefined Circuit" detail="You specified a Circuit of #myFusebox.thisCircuit# which is not defined.">
251                        </cfif>
252                        <!--- catch any last minute problems with non-existant or overloaded fuseactions --->
253                        <!---<cfset fb_.xnAccess = xmlSearch(application.fusebox.circuits[myFusebox.thisCircuit].xml, "//circuit/fuseaction[@name='#fuseaction#']")>--->
254                        <cfset fb_.xnFuseactionCount = xmlSearch(application.fusebox.circuits[myFusebox.thisCircuit].xml, "//circuit/fuseaction[translate(@name,'ABCDEFGHIJKLMNOPQRSTUVWXYZ','abcdefghijklmnopqrstuvwxyz')='#lcase(myFusebox.thisFuseaction)#']")>
255                        <cfif arrayLen(fb_.xnFuseactionCount) EQ 0>
256                                <cfthrow type="fusebox.undefinedFuseaction" message="undefined Fuseaction" detail="You referenced a fuseaction, #myFusebox.thisFuseaction#, which does not exist in the circuit #myFusebox.thisCircuit#.">
257                        </cfif>
258                        <cfif arrayLen(fb_.xnFuseactionCount) GT 1>
259                                <cfthrow type="fusebox.overloadedFuseaction" message="overloaded Fuseaction" detail="You referenced a fuseaction, #myFusebox.thisFuseaction#, which has been defined multiple times in circuit #myFusebox.thisCircuit#. Fusebox does not allow overloaded methods.">
260                        </cfif>
261
262                        <!--- check this fuseaction's access permissions --->
263                        <cfset fb_.access = application.fusebox.circuits[myFusebox.thisCircuit].fuseactions[myFusebox.thisFuseaction].access>
264                        <cfif fb_.access EQ "private" and myFusebox.thisCircuit NEQ fb_.fuseQ[fb_.pointer].circuit>
265                                <cfthrow type="fusebox.invalidAccessModifier" message="invalid access modifier" detail="The fuseaction '#myFusebox.thisCircuit#.#myFusebox.thisFuseaction#' has an access modifier of private and can only be called from within its own circuit. Use an access modifier of internal or public to make it available outside its immediate circuit.">
266                        </cfif>
267
268      <cfscript>
269        // set the value of myFusebox.thisCircuit
270        // (both here and at the end of the parsing of this <do> so that we always return to the right value of myFusebox.thisCircuit)
271        fb_.temp=structNew();
272        fb_.temp.xmlName = "set";
273        fb_.temp.circuit = myFusebox.thisCircuit;
274        fb_.temp.fuseaction = myFusebox.thisFuseaction;
275        fb_.temp.phase = fb_.phase;
276        fb_.temp.xmlAttributes = structNew();
277        fb_.temp.xmlAttributes['name'] = "myFusebox.thisCircuit";
278        fb_.temp.xmlAttributes['value'] = myFusebox.thisCircuit;
279        ArrayInsertAt( fb_.fuseQ, fb_.pointer, fb_.temp);
280        fb_.pointer = fb_.pointer + 1;
281
282        // set the value of myFusebox.thisFuseaction
283        // (both here and at the end of the parsing of this <do> so that we always return to the right value of myFusebox.thisFuseaction)
284        fb_.temp=structNew();
285        fb_.temp.xmlName = "set";
286        fb_.temp.circuit = myFusebox.thisCircuit;
287        fb_.temp.fuseaction = myFusebox.thisFuseaction;
288        fb_.temp.phase = fb_.phase;
289        fb_.temp.xmlAttributes = structNew();
290        fb_.temp.xmlAttributes['name'] = "myFusebox.thisFuseaction";
291        fb_.temp.xmlAttributes['value'] = myFusebox.thisFuseaction;
292        ArrayInsertAt( fb_.fuseQ, fb_.pointer, fb_.temp);
293        fb_.pointer = fb_.pointer + 1;
294
295        // if this fuseaction has an exceptionHandler then insert space-holders for opening and closing <CFTRY></CFTRY> tags
296        if (arrayLen(application.fusebox.pluginphases['fuseactionException']) GT 0) {
297          fb_.temp=structNew();
298          fb_.temp.xmlName = "beginExceptionHandler";
299          fb_.temp.circuit = myFusebox.thisCircuit;
300          fb_.temp.fuseaction = myFusebox.thisFuseaction;
301          fb_.temp.phase = fb_.phase;
302          fb_.temp.xmlAttributes = structNew();
303          fb_.temp.xmlAttributes['name'] = "myFusebox.thisCircuit";
304          fb_.temp.xmlAttributes['value'] = myFusebox.thisCircuit;
305          ArrayInsertAt( fb_.fuseQ, fb_.pointer, fb_.temp);
306          fb_.pointer = fb_.pointer + 1;
307        }
308
309        /* BEGIN: THIS IS THE PREFUSEACTION PLUGIN SECTION */
310        fb_.phase = "preFuseaction";
311        for (fb_.i = 1; fb_.i LTE arrayLen(application.fusebox.pluginphases[fb_.phase]); fb_.i = fb_.i + 1) {
312
313          // pass in this Plugin's parameters
314          for (fb_.j = 1; fb_.j LTE arrayLen(application.fusebox.pluginphases[fb_.phase][fb_.i].parameters); fb_.j = fb_.j + 1) {
315            fb_.name = application.fusebox.pluginphases[fb_.phase][fb_.i].parameters[fb_.j].xmlAttributes.name;
316            fb_.value = application.fusebox.pluginphases[fb_.phase][fb_.i].parameters[fb_.j].xmlAttributes.value;
317            fb_.plugin = application.fusebox.pluginphases[fb_.phase][fb_.i].name;
318            fb_.temp=structNew();
319            fb_.temp.xmlName = "set";
320            fb_.temp.circuit = myFusebox.thisCircuit;
321            fb_.temp.fuseaction = myFusebox.thisFuseaction;
322            fb_.temp.phase = fb_.phase;
323            fb_.temp.xmlAttributes = structNew();
324            fb_.temp.xmlAttributes['name'] = "myFusebox.plugins.#fb_.plugin#.parameters.#fb_.name#";
325            fb_.temp.xmlAttributes['value'] = fb_.value;
326            arrayInsertAt( fb_.fuseQ, fb_.pointer, fb_.temp);
327            fb_.pointer = fb_.pointer + 1;
328          }
329          // and the Plugin itself
330          fb_.temp=StructNew();
331          fb_.temp.xmlName = "plugin";
332          fb_.temp.circuit = myFusebox.thisCircuit;
333          fb_.temp.fuseaction = myFusebox.thisFuseaction;
334          fb_.temp.plugin = application.fusebox.pluginphases[fb_.phase][fb_.i];
335          fb_.temp.phase = fb_.phase;
336          fb_.temp.xmlAttributes = structNew();
337          fb_.temp.xmlAttributes['name'] = application.fusebox.pluginphases[fb_.phase][fb_.i].name;
338          arrayInsertAt(fb_.fuseQ, fb_.pointer, fb_.temp);
339          fb_.pointer = fb_.pointer + 1;
340        }
341        /* END: THIS IS THE PREFUSEACTION PLUGIN SECTION */
342
343        // determine what this fuseaction's code is meant to do
344        // note this means (any preFuseaction fuseactions) + this Fuseaction + (any postFuseaction fuseactions)
345        fb_.CircuitXML = application.fusebox.circuits[myFusebox.thisCircuit].xml;
346        fb_.phase = "requestedFuseaction";
347
348        // first handle any preFuseaction fuseactions
349        fb_.xnPreFA = arrayNew(1);
350        fb_.xnAnyPreFA = application.fusebox.circuits[myFusebox.thisCircuit].prefuseaction.xml;
351
352        if (arrayLen(fb_.xnAnyPreFA) OR application.fusebox.circuits[myFusebox.thisCircuit].prefuseaction.callsuper) {
353          if (application.fusebox.circuits[myFusebox.thisCircuit].prefuseaction.callsuper) {
354            // the circuit's super must be called first
355            fb_.xnPreFA = arrayNew(1);
356            // loop over the circuitTrace for this circuit
357            for (fb_.k = 1; fb_.k LTE arrayLen(application.fusebox.circuits[myFusebox.thisCircuit].circuitTrace); fb_.k = fb_.k + 1) {
358              fb_.aCircuit = application.fusebox.circuits[myFusebox.thisCircuit].circuitTrace[fb_.k];
359              // grab aCircuit's common super code
360              fb_.xnSuperPreFA = application.fusebox.circuits[fb_.aCircuit].prefuseaction.xml;
361              // loop through any prefuseaction tags
362              // loop thru each entry from the super and prepend it
363              for (fb_.i = arraylen(fb_.xnSuperPreFA); fb_.i GTE 1 ; fb_.i = fb_.i - 1) {
364                for (fb_.j = arrayLen(fb_.xnSuperPreFA[fb_.i].xmlChildren); fb_.j GTE 1; fb_.j = fb_.j - 1) {
365                                        // remember that any <include> needs to know its local circuit as an attribute
366                                  if( fb_.xnSuperPreFA[ fb_.i ].xmlChildren[ fb_.j ].xmlName IS "include" ) {
367                                                fb_.xnSuperPreFA[ fb_.i ].xmlChildren[ fb_.j ].xmlAttributes[ 'circuit' ] = fb_.aCircuit;
368                                  }
369
370                  // some special handling for do's
371                  if (fb_.xnSuperPreFA[fb_.i].xmlChildren[fb_.j].xmlName EQ "do") {
372                    if (ListLen(fb_.xnSuperPreFA[fb_.i].xmlChildren[fb_.j].xmlAttributes['action'], '.') EQ 1) {
373                      // remember that any <do> might have only a fuseaction specified and only imply its local circuit do clarify all <do>s with explicit circuits
374                      fb_.xnSuperPreFA[fb_.i].xmlChildren[fb_.j].xmlAttributes['action'] = fb_.aCircuit & "." & fb_.xnSuperPreFA[fb_.i].xmlChildren[fb_.j].xmlAttributes['action'];
375                    }
376                  }
377                  // prepend it to what came from the child circuit
378                  arrayPrepend(fb_.xnPreFA, duplicate(fb_.xnSuperPreFA[fb_.i].xmlChildren[fb_.j]));
379                }
380
381                // see if it calls *its* super; if not, then break out of this loop
382                if (NOT application.fusebox.circuits[fb_.aCircuit].prefuseaction.callsuper) {
383                  break;
384                }
385              }
386              // make sure right value for myFusebox.thisCircuit is set
387              fb_.temp=structNew();
388              fb_.temp.xmlName = "set";
389              fb_.temp.circuit = myFusebox.thisCircuit;
390              fb_.temp.fuseaction = myFusebox.thisFuseaction;
391              fb_.temp.phase = fb_.phase;
392              fb_.temp.xmlAttributes = structNew();
393              fb_.temp.xmlAttributes['name'] = "myFusebox.thisCircuit";
394              fb_.temp.xmlAttributes['value'] = fb_.aCircuit;
395              arrayPrepend(fb_.xnPreFA, fb_.temp);
396            }
397            // since prefuseaction calls to super would have overwritten the myFusebox.thisCircuit we need to reset it again
398            fb_.temp=structNew();
399            fb_.temp.xmlName = "set";
400            fb_.temp.circuit = myFusebox.thisCircuit;
401            fb_.temp.fuseaction = myFusebox.thisFuseaction;
402            fb_.temp.phase = fb_.phase;
403            fb_.temp.xmlAttributes = structNew();
404            fb_.temp.xmlAttributes['name'] = "myFusebox.thisCircuit";
405            fb_.temp.xmlAttributes['value'] = myFusebox.thisCircuit;
406            arrayAppend(fb_.xnPreFA, fb_.temp);
407            // since prefuseaction calls to super would have overwritten the myFusebox.thisFuseaction we need to reset it again
408            fb_.temp=structNew();
409            fb_.temp.xmlName = "set";
410            fb_.temp.circuit = myFusebox.thisCircuit;
411            fb_.temp.fuseaction = myFusebox.thisFuseaction;
412            fb_.temp.phase = fb_.phase;
413            fb_.temp.xmlAttributes = structNew();
414            fb_.temp.xmlAttributes['name'] = "myFusebox.thisFuseaction";
415            fb_.temp.xmlAttributes['value'] = myFusebox.thisFuseaction;
416            arrayAppend(fb_.xnPreFA, fb_.temp);
417          }
418          else {
419            fb_.xnPreFA = application.fusebox.circuits[myFusebox.thisCircuit].prefuseaction.xml.xmlChildren;
420          }
421        }
422
423        /* second handle the actual fuseaction */
424        fb_.xnThisFA = application.fusebox.circuits[myFusebox.thisCircuit].fuseactions[myFusebox.thisFuseaction].xml.xmlChildren;
425
426        /* last handle any postFuseaction fuseactions */
427        fb_.xnPostFA = arrayNew(1);
428        fb_.xnAnyPostFA = application.fusebox.circuits[myFusebox.thisCircuit].postfuseaction.xml;
429
430        if (arrayLen(fb_.xnAnyPostFA) OR application.fusebox.circuits[myFusebox.thisCircuit].postfuseaction.callsuper) {
431          if (application.fusebox.circuits[myFusebox.thisCircuit].postfuseaction.callsuper) {
432            // the circuit's super must be called *last*
433            fb_.xnPostFA = arrayNew(1);
434            // loop over the circuitTrace for this circuit
435            for (fb_.k = 1; fb_.k LTE arrayLen(application.fusebox.circuits[myFusebox.thisCircuit].circuitTrace); fb_.k = fb_.k + 1) {
436              fb_.aCircuit = application.fusebox.circuits[myFusebox.thisCircuit].circuitTrace[fb_.k];
437              // grab aCircuit's common super code
438              fb_.xnSuperPostFA = application.fusebox.circuits[fb_.aCircuit].postfuseaction.xml;
439              // make sure right value for myFusebox.thisCircuit is set
440              fb_.temp=structNew();
441              fb_.temp.xmlName = "set";
442              fb_.temp.circuit = myFusebox.thisCircuit;
443              fb_.temp.fuseaction = myFusebox.thisFuseaction;
444              fb_.temp.phase = fb_.phase;
445              fb_.temp.xmlAttributes = structNew();
446              fb_.temp.xmlAttributes['name'] = "myFusebox.thisCircuit";
447              fb_.temp.xmlAttributes['value'] = fb_.aCircuit;
448              arrayAppend(fb_.xnPostFA, fb_.temp);
449              // loop thru each entry from the super and append it
450              for (fb_.i = 1; fb_.i LTE arrayLen(fb_.xnSuperPostFA); fb_.i = fb_.i + 1) {
451                for (fb_.j = 1; fb_.j LTE arrayLen(fb_.xnSuperPostFA[1].xmlChildren); fb_.j = fb_.j + 1) {
452                                        // remember that any <include> needs to know its local circuit as an attribute
453                                                if( fb_.xnSuperPostFA[ fb_.i ].xmlChildren[ fb_.j ].xmlName IS "include" ) {
454                                                fb_.xnSuperPostFA[ fb_.i ].xmlChildren[ fb_.j ].xmlAttributes[ 'circuit' ] = fb_.aCircuit;
455                                                }
456                  // remember that any <do> might have only a fuseaction specified and only imply its local circuit do clarify all <do>s with explicit circuits
457                  if ((fb_.xnSuperPostFA[fb_.i].xmlChildren[fb_.j].xmlName EQ "do") AND
458                      (ListLen(fb_.xnSuperPostFA[fb_.i].xmlChildren[fb_.j].xmlAttributes['action'], '.') EQ 1)) {
459                    fb_.xnSuperPostFA[fb_.i].xmlChildren[fb_.j].xmlAttributes['action'] = fb_.aCircuit & "." & fb_.xnSuperPostFA[fb_.i].xmlChildren[fb_.j].xmlAttributes['action'];
460                  }
461                  // append it to what came from the child circuit
462                  arrayAppend(fb_.xnPostFA, duplicate(fb_.xnSuperPostFA[fb_.i].xmlChildren[fb_.j]));
463                }
464              }
465
466                                        // see if it calls *its* super; if not, then break out of this loop
467                                        if (NOT application.fusebox.circuits[fb_.aCircuit].postfuseaction.callsuper) {
468                                                break;
469                                        }
470
471            }
472
473            // since postfuseaction calls to super would have overwritten the myFusebox.thisCircuit we need to reset it again
474            fb_.temp=structNew();
475            fb_.temp.xmlName = "set";
476            fb_.temp.circuit = myFusebox.thisCircuit;
477            fb_.temp.fuseaction = myFusebox.thisFuseaction;
478            fb_.temp.phase = fb_.phase;
479            fb_.temp.xmlAttributes = structNew();
480            fb_.temp.xmlAttributes['name'] = "myFusebox.thisCircuit";
481            fb_.temp.xmlAttributes['value'] = myFusebox.thisCircuit;
482            arrayAppend(fb_.xnPostFA, fb_.temp);
483
484            // since postfuseaction calls to super would have overwritten the myFusebox.thisFuseaction we need to reset it again
485            fb_.temp=structNew();
486            fb_.temp.xmlName = "set";
487            fb_.temp.circuit = myFusebox.thisCircuit;
488            fb_.temp.fuseaction = myFusebox.thisFuseaction;
489            fb_.temp.phase = fb_.phase;
490            fb_.temp.xmlAttributes = structNew();
491            fb_.temp.xmlAttributes['name'] = "myFusebox.thisFuseaction";
492            fb_.temp.xmlAttributes['value'] = myFusebox.thisFuseaction;
493            arrayAppend(fb_.xnPostFA, fb_.temp);
494          }
495          else {
496            fb_.xnPostFA = application.fusebox.circuits[myFusebox.thisCircuit].postfuseaction.xml.xmlChildren;
497          }
498        }
499
500        // now assemble all these together
501        fb_.xnFA = arrayNew(1);
502        for (fb_.i = 1; fb_.i LTE arrayLen(fb_.xnPreFA); fb_.i = fb_.i + 1) {
503          arrayAppend(fb_.xnFA, duplicate(fb_.xnPreFA[fb_.i]));
504        }
505        for (fb_.i = 1; fb_.i LTE arrayLen(fb_.xnThisFA); fb_.i = fb_.i + 1) {
506          arrayAppend(fb_.xnFA, duplicate(fb_.xnThisFA[fb_.i]));
507        }
508        for (fb_.i = 1; fb_.i LTE arrayLen(fb_.xnPostFA); fb_.i = fb_.i + 1) {
509          arrayAppend(fb_.xnFA, duplicate(fb_.xnPostFA[fb_.i]));
510        }
511
512                 // if we don't have any verbs to execute for the fuseaction, we can skip this section
513        if (arrayLen(fb_.xnFA) GT 0) {
514
515                fb_.position = fb_.pointer;
516                fb_.conditionpointer = 0;
517                fb_.looppointer = 0;
518                fb_.contentpointer = 0;
519
520                for (fb_.j = 1; fb_.j LTE arrayLen(fb_.xnFA); fb_.j = fb_.j + 1) {
521                  fb_.position = fb_.pointer-1 + fb_.j;
522
523                  // special handling for an <if> because its children have to be included
524                  if (fb_.xnFA[fb_.j].xmlName EQ "if") {
525                    // handle the opening of the conditional
526                    fb_.temp=StructNew();
527                    fb_.temp.circuit = myFusebox.thisCircuit;
528                    fb_.temp.fuseaction = myFusebox.thisFuseaction;
529                    fb_.temp.phase = fb_.phase;
530                    fb_.temp.xmlName = "conditional";
531                    fb_.temp.xmlAttributes = StructNew();
532                    fb_.temp.xmlAttributes['mode'] = "begin";
533                    for (fb_.anItem in fb_.xnFA[fb_.j].xmlAttributes) {
534                      fb_.temp.xmlAttributes[fb_.anItem] = fb_.xnFA[fb_.j].xmlAttributes[fb_.anItem];
535                    }
536                                                        // fixed FB4.03 loop+if bug
537                    //arrayInsertAt(fb_.fuseQ, fb_.position + fb_.conditionpointer, fb_.temp);
538                    arrayInsertAt(fb_.fuseQ, fb_.position + fb_.conditionpointer + fb_.looppointer, fb_.temp);
539
540                    // insert all the statements when conditional is TRUE
541                    for (fb_.m = 1; fb_.m LTE arraylen(fb_.xnFA[fb_.j].xmlChildren); fb_.m = fb_.m + 1) {
542                      if (fb_.xnFA[fb_.j].xmlChildren[fb_.m].xmlName EQ "true") {
543                        fb_.Conditional = fb_.xnFA[fb_.j].xmlChildren[fb_.m].xmlChildren;
544                        for (fb_.k = 1; fb_.k LTE arrayLen(fb_.Conditional); fb_.k = fb_.k + 1) {
545                          fb_.conditionpointer = fb_.conditionpointer + 1;
546                          fb_.tempChild=StructNew();
547                          fb_.tempChild.circuit = myFusebox.thisCircuit;
548                          fb_.tempChild.fuseaction = myFusebox.thisFuseaction;
549                          fb_.tempChild.phase = fb_.phase;
550                          fb_.tempChild.xmlName = fb_.Conditional[fb_.k].xmlName;
551                          fb_.tempChild.Attributes = StructNew();
552                          for (fb_.anItem in fb_.Conditional[fb_.k].xmlAttributes) {
553                            fb_.tempChild.xmlAttributes[fb_.anItem] = fb_.Conditional[fb_.k].xmlAttributes[fb_.anItem];
554                          }
555                                                                          // the circuit name is required for all include verbs
556                                                                          if (fb_.tempChild.xmlName EQ "include" AND NOT structKeyExists(fb_.tempChild.xmlAttributes, "circuit")) {
557                                                                                fb_.tempChild.xmlAttributes['circuit'] = myFusebox.thisCircuit;
558                                                                          }
559                                                                                // fixed FB4.03 loop+if bug
560                                                                                //arrayInsertAt(fb_.fuseQ, fb_.position + fb_.conditionpointer, fb_.tempChild);
561                          arrayInsertAt(fb_.fuseQ, fb_.position + fb_.conditionpointer + fb_.looppointer, fb_.tempChild);
562                        }
563                      }
564                    }
565
566                    // handle the alternate of the conditional
567                    fb_.conditionpointer = fb_.conditionpointer + 1;
568                    fb_.temp=StructNew();
569                    fb_.temp.circuit = myFusebox.thisCircuit;
570                    fb_.temp.fuseaction = myFusebox.thisFuseaction;
571                    fb_.temp.phase = fb_.phase;
572                    fb_.temp.xmlName = "conditional";
573                    fb_.temp.xmlAttributes = StructNew();
574                    fb_.temp.xmlAttributes['mode'] = "else";
575                                                        // fixed FB4.03 loop+if bug
576                                                        //arrayInsertAt(fb_.fuseQ, fb_.position + fb_.conditionpointer, duplicate(fb_.temp));
577                    arrayInsertAt(fb_.fuseQ, fb_.position + fb_.conditionpointer + fb_.looppointer, fb_.temp);
578
579                    // insert all the statements when conditional is FALSE
580                    for (fb_.m = 1; fb_.m LTE arraylen(fb_.xnFA[fb_.j].xmlChildren); fb_.m = fb_.m + 1) {
581                      if (fb_.xnFA[fb_.j].xmlChildren[fb_.m].xmlName EQ "false") {
582                        fb_.Conditional = fb_.xnFA[fb_.j].xmlChildren[fb_.m].xmlChildren;
583                        for (fb_.k = 1; fb_.k LTE arrayLen(fb_.Conditional); fb_.k = fb_.k + 1) {
584                          fb_.conditionpointer = fb_.conditionpointer + 1;
585                          fb_.tempChild=StructNew();
586                          fb_.tempChild.circuit = myFusebox.thisCircuit;
587                          fb_.tempChild.fuseaction = myFusebox.thisFuseaction;
588                          fb_.tempChild.phase = fb_.phase;
589                          fb_.tempChild.xmlName = fb_.Conditional[fb_.k].xmlName;
590                          fb_.tempChild.Attributes = StructNew();
591                          for (fb_.anItem in fb_.Conditional[fb_.k].xmlAttributes) {
592                            fb_.tempChild.xmlAttributes[fb_.anItem] = fb_.Conditional[fb_.k].xmlAttributes[fb_.anItem];
593                          }
594                                                                          // the circuit name is required for all include verbs
595                                                                          if (fb_.tempChild.xmlName EQ "include" AND NOT structKeyExists(fb_.tempChild.xmlAttributes, "circuit")) {
596                                                                                fb_.tempChild.xmlAttributes['circuit'] = myFusebox.thisCircuit;
597                                                                          }
598                                                                                // fixed FB4.03 loop+if bug
599                                                                                //arrayInsertAt(fb_.fuseQ, fb_.position + fb_.conditionpointer, fb_.tempChild);
600                          arrayInsertAt(fb_.fuseQ, fb_.position + fb_.conditionpointer + fb_.looppointer, fb_.tempChild);
601                        }
602                      }
603                    }
604
605                    // handle the closing of the conditional
606                    fb_.conditionpointer = fb_.conditionpointer + 1;
607                    fb_.temp=StructNew();
608                    fb_.temp.circuit = myFusebox.thisCircuit;
609                    fb_.temp.fuseaction = myFusebox.thisFuseaction;
610                    fb_.temp.phase = fb_.phase;
611                    fb_.temp.xmlName = "conditional";
612                    fb_.temp.xmlAttributes = StructNew();
613                    fb_.temp.xmlAttributes['mode'] = "end";
614                                                        // fixed FB4.03 loop+if bug
615                                                        //arrayInsertAt(fb_.fuseQ, fb_.position + fb_.conditionpointer, fb_.temp);
616                    arrayInsertAt(fb_.fuseQ, fb_.position + fb_.conditionpointer + fb_.looppointer, fb_.temp);
617                  }
618                  // special handling for a <loop> because its children have to be included
619                  else if (fb_.xnFA[fb_.j].xmlName EQ "loop") {
620                    // handle the opening of the loop
621                    fb_.temp=StructNew();
622                    fb_.temp.circuit = myFusebox.thisCircuit;
623                    fb_.temp.fuseaction = myFusebox.thisFuseaction;
624                    fb_.temp.phase = fb_.phase;
625                    fb_.temp.xmlName = "loop";
626                    fb_.temp.xmlAttributes = StructNew();
627                    fb_.temp.xmlAttributes['mode'] = "begin";
628                    for (fb_.anItem in fb_.xnFA[fb_.j].xmlAttributes) {
629                      fb_.temp.xmlAttributes[fb_.anItem] = fb_.xnFA[fb_.j].xmlAttributes[fb_.anItem];
630                    }
631                                                        // fixed FB4.03 loop+if bug
632                    //arrayInsertAt(fb_.fuseQ, fb_.position + fb_.looppointer, fb_.temp);
633                    arrayInsertAt(fb_.fuseQ, fb_.position + fb_.looppointer + fb_.conditionpointer, fb_.temp);
634
635                    // insert all the statements within the loop
636                    fb_.Loop = fb_.xnFA[fb_.j].xmlChildren;
637                    for (fb_.k = 1; fb_.k LTE arraylen(fb_.Loop); fb_.k = fb_.k + 1) {
638                      fb_.looppointer = fb_.looppointer + 1;
639                      fb_.tempChild=StructNew();
640                      fb_.tempChild.circuit = myFusebox.thisCircuit;
641                      fb_.tempChild.fuseaction = myFusebox.thisFuseaction;
642                      fb_.tempChild.phase = fb_.phase;
643                      fb_.tempChild.xmlName = fb_.Loop[fb_.k].xmlName;
644                      fb_.tempChild.Attributes = StructNew();
645                      for (fb_.anItem in fb_.Loop[fb_.k].xmlAttributes) {
646                        fb_.tempChild.xmlAttributes[fb_.anItem] = fb_.Loop[fb_.k].xmlAttributes[fb_.anItem];
647                      }
648                                                          // the circuit name is required for all include verbs
649                                                          if (fb_.tempChild.xmlName EQ "include" AND NOT structKeyExists(fb_.tempChild.xmlAttributes, "circuit")) {
650                                                                fb_.tempChild.xmlAttributes['circuit'] = myFusebox.thisCircuit;
651                                                          }
652                                                                // fixed FB4.03 loop+if bug
653                                                                //arrayInsertAt(fb_.fuseQ, fb_.position + fb_.looppointer, fb_.tempChild);
654                      arrayInsertAt(fb_.fuseQ, fb_.position + fb_.looppointer + fb_.conditionpointer, fb_.tempChild);
655                    }
656
657                    // handle the closing of the loop
658                    fb_.looppointer = fb_.looppointer + 1;
659                    fb_.temp=StructNew();
660                    fb_.temp.circuit = myFusebox.thisCircuit;
661                    fb_.temp.fuseaction = myFusebox.thisFuseaction;
662                    fb_.temp.phase = fb_.phase;
663                    fb_.temp.xmlName = "loop";
664                    fb_.temp.xmlAttributes = StructNew();
665                    fb_.temp.xmlAttributes['mode'] = "end";
666                                                        // fixed FB4.03 loop+if bug
667                                                        //arrayInsertAt(fb_.fuseQ, fb_.position + fb_.looppointer, fb_.temp);
668                    arrayInsertAt(fb_.fuseQ, fb_.position + fb_.looppointer + fb_.conditionpointer, fb_.temp);
669                  }
670                  else {
671                    // anything other than a <if> or <loop>
672                    fb_.temp=StructNew();
673                    fb_.temp.circuit = myFusebox.thisCircuit;
674                    fb_.temp.fuseaction = myFusebox.thisFuseaction;
675                    fb_.temp.phase = fb_.phase;
676                    fb_.temp.xmlName = fb_.xnFA[fb_.j].xmlName;
677                    fb_.temp.xmlAttributes = StructNew();
678                    for (fb_.anItem in fb_.xnFA[fb_.j].xmlAttributes) {
679                      fb_.temp.xmlAttributes[fb_.anItem] = fb_.xnFA[fb_.j].xmlAttributes[fb_.anItem];
680                    }
681                                // if it's an include and doesn't already have a circuit attribute then make sure it has a "circuit" attribute
682                                if (fb_.xnFA[fb_.j].xmlName EQ "include") {
683                                  if (NOT StructKeyExists(fb_.temp.xmlAttributes, 'circuit')){
684                                          fb_.temp.xmlAttributes['circuit'] = myFusebox.thisCircuit;
685                                  }
686                                }
687                    arrayInsertAt(fb_.fuseQ, fb_.position + fb_.conditionpointer + fb_.looppointer , fb_.temp);
688                  }
689                }
690
691                fb_.position = fb_.position + fb_.conditionpointer + fb_.looppointer;
692
693                // this is where a begin/end tag for contentvariables via a <do> would be put
694                fb_.contentpointer = 0;
695
696                if (structKeyExists(fb_.fuseQ[fb_.position+1].xmlAttributes, "contentvariable")) {
697                  fb_.temp=StructNew();
698                  fb_.temp.circuit = myFusebox.thisCircuit;
699                  fb_.temp.fuseaction = myFusebox.thisFuseaction;
700                  fb_.temp.phase = fb_.phase;
701                  fb_.temp.xmlName = "contentvariable";
702                  fb_.temp.xmlAttributes = StructNew();
703                  fb_.temp.xmlAttributes['contentvariable'] = fb_.fuseQ[fb_.position+1].xmlAttributes['contentvariable'];
704                  fb_.temp.xmlAttributes['mode'] = "begin";
705                  if (structKeyExists(fb_.fuseQ[fb_.position+1].xmlAttributes, 'append')) {
706                    fb_.temp.xmlAttributes['append'] = fb_.fuseQ[fb_.position+1].xmlAttributes['append'];
707                  }
708                  else {
709                    fb_.temp.xmlAttributes['append'] = "false";
710                  }
711                  if (structKeyExists(fb_.fuseQ[fb_.position+1].xmlAttributes, 'prepend')) {
712                    fb_.temp.xmlAttributes['prepend'] = fb_.fuseQ[fb_.position+1].xmlAttributes['prepend'];
713                  }
714                  else {
715                    fb_.temp.xmlAttributes['prepend'] = "false";
716                  }                                             
717                  if (structKeyExists(fb_.fuseQ[fb_.position+1].xmlAttributes, 'overwrite')) {
718                    fb_.temp.xmlAttributes['overwrite'] = fb_.fuseQ[fb_.position+1].xmlAttributes['overwrite'];
719                  }
720                  else {
721                    fb_.temp.xmlAttributes['overwrite'] = "true";
722                  }
723                  arrayInsertAt(fb_.fuseQ, fb_.pointer, duplicate(fb_.temp));
724
725                  fb_.temp.xmlAttributes['mode'] = "end";
726                  arrayInsertAt(fb_.fuseQ, fb_.position+2, fb_.temp);
727                  fb_.contentpointer = 2;
728                }
729
730                        fb_.pointer = fb_.position + 1 + fb_.contentpointer;
731        } // end of skip for verbless fuseaction
732
733        // BEGIN: THIS IS THE POSTFUSEACTION PLUGIN SECTION
734        fb_.phase = "postFuseaction";
735        for (fb_.i = 1; fb_.i LTE arrayLen(application.fusebox.pluginphases[fb_.phase]); fb_.i = fb_.i + 1) {
736
737          // pass in this Plugin's parameters
738          for (fb_.j = 1; fb_.j LTE arrayLen(application.fusebox.pluginphases[fb_.phase][fb_.i].parameters); fb_.j = fb_.j + 1) {
739            fb_.name = application.fusebox.pluginphases[fb_.phase][fb_.i].parameters[fb_.j].xmlAttributes.name;
740            fb_.value = application.fusebox.pluginphases[fb_.phase][fb_.i].parameters[fb_.j].xmlAttributes.value;
741            fb_.plugin = application.fusebox.pluginphases[fb_.phase][fb_.i].name;
742            fb_.temp=structNew();
743            fb_.temp.xmlName = "set";
744            fb_.temp.circuit = myFusebox.thisCircuit;
745            fb_.temp.fuseaction = myFusebox.thisFuseaction;
746            fb_.temp.phase = fb_.phase;
747            fb_.temp.xmlAttributes = structNew();
748            fb_.temp.xmlAttributes['name'] = "myFusebox.plugins.#fb_.plugin#.parameters.#fb_.name#";
749            fb_.temp.xmlAttributes['value'] = fb_.value;
750            arrayInsertAt( fb_.fuseQ, fb_.pointer, fb_.temp);
751            fb_.pointer = fb_.pointer + 1;
752          }
753          // and the Plugin itself
754          fb_.temp=StructNew();
755          fb_.temp.xmlName = "plugin";
756          fb_.temp.circuit = myFusebox.thisCircuit;
757          fb_.temp.fuseaction = myFusebox.thisFuseaction;
758          fb_.temp.phase = fb_.phase;
759          fb_.temp.plugin = application.fusebox.pluginphases[fb_.phase][fb_.i];
760          fb_.temp.xmlAttributes = structNew();
761          fb_.temp.xmlAttributes['name'] = application.fusebox.pluginphases[fb_.phase][fb_.i].name;
762          arrayInsertAt(fb_.fuseQ, fb_.pointer, fb_.temp);
763          fb_.pointer = fb_.pointer + 1;
764        }
765        // END: THIS IS THE POSTFUSEACTION PLUGIN SECTION
766
767        /* BEGIN: THIS IS THE fuseactionException PLUGIN SECTION */
768        fb_.phase = "fuseactionException";
769        for (fb_.i = 1; fb_.i LTE arrayLen(application.fusebox.pluginphases[fb_.phase]); fb_.i = fb_.i + 1) {
770
771          // pass in this Plugin's parameters
772          for (fb_.j = 1; fb_.j LTE arrayLen(application.fusebox.pluginphases[fb_.phase][fb_.i].parameters); fb_.j = fb_.j + 1) {
773            fb_.name = application.fusebox.pluginphases[fb_.phase][fb_.i].parameters[fb_.j].xmlAttributes.name;
774            fb_.value = application.fusebox.pluginphases[fb_.phase][fb_.i].parameters[fb_.j].xmlAttributes.value;
775            fb_.plugin = application.fusebox.pluginphases[fb_.phase][fb_.i].name;
776            fb_.temp=structNew();
777            fb_.temp.circuit = myFusebox.thisCircuit;
778            fb_.temp.fuseaction = myFusebox.thisFuseaction;
779            fb_.temp.phase = fb_.phase;
780            fb_.temp.xmlName = "set";
781            fb_.temp.xmlAttributes = structNew();
782            fb_.temp.xmlAttributes['name'] = "myFusebox.plugins.#fb_.plugin#.parameters.#fb_.name#";
783            fb_.temp.xmlAttributes['value'] = fb_.value;
784            arrayInsertAt( fb_.fuseQ, fb_.pointer, fb_.temp);
785            fb_.pointer = fb_.pointer + 1;
786          }
787          // and the Plugin itself
788          fb_.temp=StructNew();
789          fb_.temp.xmlName = "exceptionHandler";
790          fb_.temp.circuit = myFusebox.thisCircuit;
791          fb_.temp.fuseaction = myFusebox.thisFuseaction;
792          fb_.temp.phase = fb_.phase;
793          fb_.temp.plugin = application.fusebox.pluginphases[fb_.phase][fb_.i];
794          fb_.temp.xmlAttributes = structNew();
795          fb_.temp.xmlAttributes['name'] = application.fusebox.pluginphases[fb_.phase][fb_.i].name;
796          arrayInsertAt(fb_.fuseQ, fb_.pointer, fb_.temp);
797          fb_.pointer = fb_.pointer + 1;
798        }
799        /* END: THIS IS THE fuseactionException PLUGIN SECTION */
800
801        // if this fuseaction has an exceptionHandler then insert space-holders for opening and closing <CFTRY></CFTRY> tags
802        // we also did this when first parsing this <do>
803        if (arrayLen(application.fusebox.pluginphases['fuseactionException']) GT 0) {
804          fb_.temp=structNew();
805          fb_.temp.xmlName = "endExceptionHandler";
806          fb_.temp.circuit = myFusebox.thisCircuit;
807          fb_.temp.fuseaction = myFusebox.thisFuseaction;
808          fb_.temp.phase = fb_.phase;
809          fb_.temp.xmlAttributes = structNew();
810          fb_.temp.xmlAttributes['name'] = "myFusebox.thisCircuit";
811          fb_.temp.xmlAttributes['value'] = myFusebox.thisCircuit;
812          arrayInsertAt( fb_.fuseQ, fb_.pointer, fb_.temp);
813          fb_.pointer = fb_.pointer + 1;
814        }
815
816        // set the value of myFusebox.thisFuseaction
817        // (this was also done at the beginning of the parsing of this <do> so that we always return to the right value of myFusebox.thisFuseaction)
818        fb_.temp=structNew();
819        fb_.temp.xmlName = "set";
820        fb_.temp.circuit = fb_.fuseQ[fb_.pointer].circuit;
821        fb_.temp.fuseaction = fb_.fuseQ[fb_.pointer].fuseaction;
822        fb_.temp.phase = fb_.phase;
823        fb_.temp.xmlAttributes = structNew();
824        fb_.temp.xmlAttributes['name'] = "myFusebox.thisFuseaction";
825        fb_.temp.xmlAttributes['value'] = fb_.fuseQ[fb_.pointer].fuseaction;
826        arrayInsertAt( fb_.fuseQ, fb_.pointer, fb_.temp);
827        fb_.pointer = fb_.pointer + 1;
828
829        // set the value of myFusebox.thisCircuit
830        // (this was also done at the beginning of the parsing of this <do> so that we always return to the right value of myFusebox.thisCircuit)
831        fb_.temp=structNew();
832        fb_.temp.xmlName = "set";
833        fb_.temp.circuit = fb_.fuseQ[fb_.pointer].circuit;
834        fb_.temp.fuseaction = fb_.fuseQ[fb_.pointer].fuseaction;
835        fb_.temp.phase = fb_.phase;
836        fb_.temp.xmlAttributes = structNew();
837        fb_.temp.xmlAttributes['name'] = "myFusebox.thisCircuit";
838        fb_.temp.xmlAttributes['value'] = fb_.fuseQ[fb_.pointer].circuit;
839        arrayInsertAt( fb_.fuseQ, fb_.pointer, fb_.temp);
840        fb_.pointer = fb_.pointer + 1;
841
842        // we're done substituting for this "do", so we kill it off
843        arrayDeleteAt(fb_.fuseQ, fb_.pointer);
844      </cfscript>
845
846                        <cfbreak>
847                </cfif>
848
849        </cfloop>
850</cfloop>
851
852
853</cfsilent>
Note: See TracBrowser for help on using the browser.