XAO::DO::Web::Condition - allows to check various conditions
Only useful in XAO::Web context.
Example usage would be:
<%Condition NAME1.value="<%CgiParam param=test%>" NAME1.path="/bits/test-is-set" NAME2.cgiparam="foo" NAME2.path="/bits/foo-is-set" NAME3.siteconfig="product_list" NAME3.template="product_list exists in siteconfig" default.objname="Error" default.template="No required parameter set" %>
Which means to execute /bits/test-is-set if CGI has `test' parameter, otherwise execute /bits/foo-is-set if `foo' parameter is set and finally, if there is no foo and no test - execute /bits/nothing-set. For `foo' shortcut is used, because most of the time you will check for CGI parameters anyway.
Default object to be substituted is Page. Another object may be specified with objname. All arguments after NAMEx. are just passed into object without any processing.
NAME1 and NAME2 may be anything, they sorted alphabetycally before checking. So, usually if there is only one check and default - then something meaningful is used for the name. For multiple choices just numbers are better for names.
Condition checked in perl style - '0' and empty string is false.
Hides itself from object it executes - makes parent and parent_args pointing to Condition's parent.
Supports the following conditions:
Just constant value, usually substituted in template itself.
Parameter in CGI.
Parent object argument.
Site configuration parameter.
All values are treated as booleans only, no comparision is implemented yet.
No publicly available methods except overriden display().
Copyright (c) 2000-2001 XAO, Inc.
Andrew Maltsev <email@example.com>.