| 54 | | // name - string - required, must be varname or varname.varname |
| 55 | | if (not structKeyExists(fb_.verbInfo.attributes,"name")) { |
| 56 | | fb_throw("fusebox.badGrammar.requiredAttributeMissing", |
| 57 | | "Required attribute is missing", |
| 58 | | "The attribute 'name' is required, for a 'parameter' verb in fuseaction #fb_.verbInfo.circuit#.#fb_.verbInfo.fuseaction#."); |
| | 54 | // <parameter> is actually two verbs and behaves differently depending on its |
| | 55 | // parent: |
| | 56 | // - inside an <include>, it saves / sets variables for the duration of the |
| | 57 | // include just as it does inside a <do> directive |
| | 58 | // - inside an <xfa>, it defines URL parameters to add to the XFA value |
| | 59 | if (structKeyExists(fb_.verbInfo,"parent")) { |
| | 60 | |
| | 61 | if (fb_.verbInfo.parent.lexiconVerb is "include") { |
| | 62 | |
| | 63 | // name - string - required, must be varname or varname.varname |
| | 64 | if (not structKeyExists(fb_.verbInfo.attributes,"name")) { |
| | 65 | fb_throw("fusebox.badGrammar.requiredAttributeMissing", |
| | 66 | "Required attribute is missing", |
| | 67 | "The attribute 'name' is required, for a 'parameter' verb in fuseaction #fb_.verbInfo.circuit#.#fb_.verbInfo.fuseaction#."); |
| | 68 | } |
| | 69 | fb_.match1 = REFind("[A-Za-z0-9_]*",fb_.verbInfo.attributes.name,1,true); |
| | 70 | fb_.match2 = REFind("[A-Za-z0-9_]*\.[A-Za-z0-9_]*",fb_.verbInfo.attributes.name,1,true); |
| | 71 | fb_.nameLen = len(fb_.verbInfo.attributes.name); |
| | 72 | if (fb_.match1.pos[1] eq 1 and fb_.match1.len[1] eq fb_.nameLen) { |
| | 73 | fb_.name = "variables." & fb_.verbInfo.attributes.name; |
| | 74 | } else if (fb_.match2.pos[1] eq 1 and fb_.match2.len[1] eq fb_.nameLen) { |
| | 75 | fb_.name = fb_.verbInfo.attributes.name; |
| | 76 | } else { |
| | 77 | fb_throw("fusebox.badGrammar.invalidAttributeValue", |
| | 78 | "Attribute has invalid value", |
| | 79 | "The attribute 'name' must be a simple variable name, optionally qualified by a scope name, for a 'parameter' verb in fuseaction #fb_.verbInfo.circuit#.#fb_.verbInfo.fuseaction#."); |
| | 80 | } |
| | 81 | // value - string - optional |
| | 82 | // strict mode - check attribute count: |
| | 83 | if (fb_.verbInfo.action.getCircuit().getApplication().strictMode) { |
| | 84 | if (structCount(fb_.verbInfo.attributes) neq 2) { |
| | 85 | fb_throw("fusebox.badGrammar.unexpectedAttributes", |
| | 86 | "Unexpected attributes", |
| | 87 | "Unexpected attributes were found in a 'parameter' verb in fuseaction #fb_.verbInfo.circuit#.#fb_.verbInfo.fuseaction#."); |
| | 88 | } |
| | 89 | } |
| | 90 | |
| | 91 | // append this parameter to the parent data: |
| | 92 | arrayAppend(fb_.verbInfo.parent.parameters,fb_.name); |
| | 93 | // output the push code: |
| | 94 | fb_appendLine('<' & 'cfif isDefined("#fb_.name#")><' & |
| | 95 | 'cfset myFusebox.stack["#fb_.name#"] = #fb_.name# ></' & 'cfif>'); |
| | 96 | // reset the value of the "local" variable, if appropriate: |
| | 97 | if (structKeyExists(fb_.verbInfo.attributes,"value")) { |
| | 98 | fb_appendLine('<' & 'cfset #fb_.name# = "#fb_.verbInfo.attributes.value#" />'); |
| | 99 | } |
| | 100 | |
| | 101 | } else if (fb_.verbInfo.parent.lexiconVerb is "xfa") { |
| | 102 | |
| | 103 | // name - string - required |
| | 104 | if (not structKeyExists(fb_.verbInfo.attributes,"name")) { |
| | 105 | fb_throw("fusebox.badGrammar.requiredAttributeMissing", |
| | 106 | "Required attribute is missing", |
| | 107 | "The attribute 'name' is required, for a 'parameter' verb in fuseaction #fb_.verbInfo.circuit#.#fb_.verbInfo.fuseaction#."); |
| | 108 | } |
| | 109 | // value - string - required |
| | 110 | if (not structKeyExists(fb_.verbInfo.attributes,"value")) { |
| | 111 | fb_throw("fusebox.badGrammar.requiredAttributeMissing", |
| | 112 | "Required attribute is missing", |
| | 113 | "The attribute 'value' is required, for a 'parameter' verb in fuseaction #fb_.verbInfo.circuit#.#fb_.verbInfo.fuseaction#."); |
| | 114 | } |
| | 115 | fb_.parameter = structNew(); |
| | 116 | fb_.parameter.name = fb_.verbInfo.attributes.name; |
| | 117 | fb_.parameter.value = fb_.verbInfo.attributes.value; |
| | 118 | // append this parameter to the parent data: |
| | 119 | arrayAppend(fb_.verbInfo.parent.parameters,fb_.parameter); |
| | 120 | |
| | 121 | } else { |
| | 122 | |
| | 123 | fb_throw("fusebox.badGrammar.parameterInvalidParent", |
| | 124 | "Verb 'parameter' has invalid parent verb", |
| | 125 | "Found 'parameter' verb with no valid parent verb (either 'include' or 'xfa') in fuseaction #fb_.verbInfo.circuit#.#fb_.verbInfo.fuseaction#."); |
| | 126 | |
| | 127 | } |
| | 128 | |
| | 129 | } else { |
| | 130 | |
| | 131 | fb_throw("fusebox.badGrammar.parameterInvalidParent", |
| | 132 | "Verb 'parameter' has invalid parent verb", |
| | 133 | "Found 'parameter' verb with no valid parent verb (either 'include' or 'xfa') in fuseaction #fb_.verbInfo.circuit#.#fb_.verbInfo.fuseaction#."); |
| | 134 | |
| 60 | | fb_.match1 = REFind("[A-Za-z0-9_]*",fb_.verbInfo.attributes.name,1,true); |
| 61 | | fb_.match2 = REFind("[A-Za-z0-9_]*\.[A-Za-z0-9_]*",fb_.verbInfo.attributes.name,1,true); |
| 62 | | fb_.nameLen = len(fb_.verbInfo.attributes.name); |
| 63 | | if (fb_.match1.pos[1] eq 1 and fb_.match1.len[1] eq fb_.nameLen) { |
| 64 | | fb_.name = "variables." & fb_.verbInfo.attributes.name; |
| 65 | | } else if (fb_.match2.pos[1] eq 1 and fb_.match2.len[1] eq fb_.nameLen) { |
| 66 | | fb_.name = fb_.verbInfo.attributes.name; |
| 67 | | } else { |
| 68 | | fb_throw("fusebox.badGrammar.invalidAttributeValue", |
| 69 | | "Attribute has invalid value", |
| 70 | | "The attribute 'name' must be a simple variable name, optionally qualified by a scope name, for a 'parameter' verb in fuseaction #fb_.verbInfo.circuit#.#fb_.verbInfo.fuseaction#."); |
| 71 | | } |
| 72 | | // value - string - optional |
| 73 | | // must be nested inside an <include> |
| 74 | | if (not structKeyExists(fb_.verbInfo,"parent") or fb_.verbInfo.parent.lexiconVerb is not "include") { |
| 75 | | fb_throw("fusebox.badGrammar.parameterNeedsInclude", |
| 76 | | "Verb 'parameter' has no parent 'include' verb", |
| 77 | | "Found 'parameter' verb with no valid parent 'include' verb in fuseaction #fb_.verbInfo.circuit#.#fb_.verbInfo.fuseaction#."); |
| 78 | | } |
| 79 | | // strict mode - check attribute count: |
| 80 | | if (fb_.verbInfo.action.getCircuit().getApplication().strictMode) { |
| 81 | | if (structCount(fb_.verbInfo.attributes) neq 2) { |
| 82 | | fb_throw("fusebox.badGrammar.unexpectedAttributes", |
| 83 | | "Unexpected attributes", |
| 84 | | "Unexpected attributes were found in a 'parameter' verb in fuseaction #fb_.verbInfo.circuit#.#fb_.verbInfo.fuseaction#."); |
| 85 | | } |
| 86 | | } |
| 87 | | |
| 88 | | // append this argument to the parent data: |
| 89 | | arrayAppend(fb_.verbInfo.parent.parameters,fb_.name); |
| 90 | | // output the push code: |
| 91 | | fb_appendLine('<' & 'cfif isDefined("#fb_.name#")><' & |
| 92 | | 'cfset myFusebox.stack["#fb_.name#"] = #fb_.name# ></' & 'cfif>'); |
| 93 | | // reset the value of the "local" variable, if appropriate: |
| 94 | | if (structKeyExists(fb_.verbInfo.attributes,"value")) { |
| 95 | | fb_appendLine('<' & 'cfset #fb_.name# = "#fb_.verbInfo.attributes.value#" />'); |
| 96 | | } |
| | 136 | |