From: uw
Date: Fri May 11 22:53:49 2001
Modified files:
php-lib/php/form/form.inc
php-lib/php/form/form_xmlfactory.inc
php-lib/php/form/elements/form_element.inc
php-lib/php/form/elements/form_element_combo.inc
php-lib/php/form/elements/form_element_select.inc
php-lib/php/form/xml/form.xml
Log message:
- finished the work on the XML format of elements beside textedit
DTD does not match the XML file, no the format is still not final
- updated the xml parser
Index: php-lib/php/form/form.inc
diff -u php-lib/php/form/form.inc:1.25 php-lib/php/form/form.inc:1.26
--- php-lib/php/form/form.inc:1.25 Thu May 10 22:47:06 2001
+++ php-lib/php/form/form.inc Fri May 11 22:53:16 2001
@@ -28,7 +28,7 @@
* - tree (select box with options show as a tree)
*
* @author Ulf Wendel <[EMAIL PROTECTED]>
-* @version $Id: form.inc,v 1.25 2001/05/10 20:47:06 uw Exp $
+* @version $Id: form.inc,v 1.26 2001/05/11 20:53:16 uw Exp $
* @access public
* @package Form
*/
@@ -578,14 +578,6 @@
$el = new $objectname($element_data, $this->method,
$this->js_name, $this->js_mode);
- // FIXME
- if (!$el->flag_config_ok) {
- print "<pre>";
- print $objectname;
- print_r($el);
- print "</pre>";
- }
-
if ($el->isHidden())
$this->hidden_elements[] = $element_data["name"];
Index: php-lib/php/form/form_xmlfactory.inc
diff -u php-lib/php/form/form_xmlfactory.inc:1.1
php-lib/php/form/form_xmlfactory.inc:1.2
--- php-lib/php/form/form_xmlfactory.inc:1.1 Thu May 10 22:47:06 2001
+++ php-lib/php/form/form_xmlfactory.inc Fri May 11 22:53:16 2001
@@ -52,7 +52,7 @@
*/
var $options = array();
-
+
/**
* Intros
*
@@ -99,6 +99,15 @@
* @var string
*/
var $name = "";
+
+
+ /**
+ * Name of the currently processed tag
+ *
+ * @var string
+ */
+ var $current_tag = "";
+
/**
* Returns a form object build from the given xml file.
@@ -145,30 +154,81 @@
*/
function startElement($parser, $name, $attrs) {
- $name = strtolower($name);
+ $this->current_tag = $name = strtolower($name);
$tmp = array();
- foreach ($attrs as $k => $v)
- $tmp[strtolower($k)] = $v;
+ foreach ($attrs as $k => $v) {
+
+ $k = strtolower($k);
+
+ switch ($k) {
+ case "frozen":
+ case "multiple":
+ case "readonly":
+ case "preload":
+ case "checked":
+ $v = ("false" == $v) ? false : true;
+ break;
+
+ case "size":
+ case "tabindex":
+ case "maxfilesize":
+ case "width":
+ case "height":
+ case "hspace":
+ case "vspace":
+ case "border":
+ case "inputsize":
+ case "rows":
+ case "cols":
+ case "minyear":
+ case "maxyear":
+ $v = (int)$size;
+ break;
+
+ }
+
+ $tmp[$k] = $v;
+ }
+
$attrs = &$tmp;
switch ($name) {
+ case "calendar":
+ case "checkbox":
+ case "combo":
+ case "date":
case "file":
case "fileupload":
- case "submit":
+ case "hidden":
case "image":
+ case "password":
+ case "radio":
+ case "reset":
case "select":
- case "combo":
- case "date":
+ case "submit":
case "text":
- case "password":
- case "testarea":
- case "hidden":
+ case "textarea":
+ case "textedit":
$this->attributes = $attrs;
$this->attributes["type"] = $name;
break;
-
+
+ case "css":
+ if (isset($attrs["class"]))
+ $this->attributes["class"] = (string)$attrs["class"];
+ if (isset($attrs["id"]))
+ $this->attributes["id"] = (string)$attrs["id"];
+ break;
+
+ case "html":
+ if (isset($attrs["accesskey"]))
+ $this->attributes["accesskey"] = (string)$attrs["accesskey"];
+ if (isset($attrs["tabindex"]))
+ $this->attributes["tabindex"] = (int)$attrs["tabindex"];
+ break;
+
case "yearlong":
if (isset($attrs["min"]))
$this->attributes["min_year_long"] = (int)$attrs["min"];
@@ -195,16 +255,13 @@
case "regexp":
if (isset($attrs["reg"]))
- $this->attributes["valid_regexp"] = $attrs["reg"];
+ $this->attributes["valid_regex"] = $attrs["reg"];
if (isset($attrs["icase"]))
$this->attributes["valid_icase"] = ("false" == $attrs["icase"]) ? false :
true;
-
+ if (isset($attrs["global"]))
+ $this->attributes["valid_global"] = ("false" == $attrs["icase"]) ? false :
+true;
break;
- case "seperators":
- case "seperator":
- break;
-
case "options":
$this->options = array();
break;
@@ -249,24 +306,28 @@
$name = strtolower($name);
switch ($name) {
- case "value":
- case "additionalhtml":
- case "frozen":
- case "format":
- case "id":
- case "class":
- case "style":
- $this->atrributes[$name] = $this->cdata;
+ case "day":
+ case "month":
+ case "year":
+ $this->attributes[$name] = (int)$this->cdata;
break;
- case "format":
- $this->attributes["format"] = (string)$this->cdata;
+ case "phpfunction":
+ $this->attributes["validator"] = (string)$this->cdata;
break;
- case "now":
- $this->attributes["now"] = (string)$this->cdata;
+ case "jsfunction":
+ $this->attributes["js_validator"] = (string)$this->cdata;
+ break;
+
+ case "css":
+ $this->attributes["style"] = (string)$this->cdata;
break;
-
+
+ case "html":
+ $this->attributes["additional_html"] = (string)$this->cdata;
+ break;
+
case "intro":
$this->attributes["intro"] = array($this->attrs["value"] =>
(string)$this->cdata);
break;
@@ -283,10 +344,6 @@
$this->attributes["options"] = $this->options;
break;
- case "maxfilesize":
- $this->attributes["maxfilesize"] = (int)$this->cdata;
- break;
-
case "length":
$this->attributes["length_e"] = (string)$this->cdata;
break;
@@ -295,17 +352,22 @@
$this->attributes["valid_e"] = (string)$this->cdata;
break;
+ case "calendar":
+ case "checkbox":
+ case "combo":
+ case "date":
case "file":
case "fileupload":
- case "submit":
+ case "hidden":
case "image":
+ case "password":
+ case "radio":
+ case "reset":
case "select":
- case "combo":
- case "date":
+ case "submit":
case "text":
- case "password":
- case "testarea":
- case "hidden":
+ case "textarea":
+ case "textedit":
$this->form->addElement($this->attributes);
break;
@@ -323,6 +385,34 @@
* @param string cdata
*/
function cdata($parser, $cdata) {
+
+ switch ($this->current_tag) {
+
+ case "calendar":
+ case "checkbox":
+ case "combo":
+ case "date":
+ case "file":
+ case "fileupload":
+ case "hidden":
+ case "password":
+ case "radio":
+ case "reset":
+ case "select":
+ case "submit":
+ case "text":
+ case "textarea":
+ case "textedit":
+
+ $this->attributes["value"] = (string)$cdata;
+ break;
+
+ case "image":
+ $this->attributes["src"] = (string)$cdata;
+ break;
+
+ }
+
$this->cdata = $cdata;
} // end func cdata
Index: php-lib/php/form/elements/form_element.inc
diff -u php-lib/php/form/elements/form_element.inc:1.2
php-lib/php/form/elements/form_element.inc:1.3
--- php-lib/php/form/elements/form_element.inc:1.2 Thu May 10 18:36:01 2001
+++ php-lib/php/form/elements/form_element.inc Fri May 11 22:53:17 2001
@@ -5,7 +5,7 @@
* Superclass of all form elements.
*
* @author Ulf Wendel <[EMAIL PROTECTED]>
-* @version $Id: form_element.inc,v 1.2 2001/05/10 16:36:01 uw Exp $
+* @version $Id: form_element.inc,v 1.3 2001/05/11 20:53:17 uw Exp $
* @access public
* @package Form
* @abstract
@@ -210,7 +210,7 @@
*
All other values start JavaScript
validation with "onSubmit".
*/
function form_element ($element_data, $method, $form_name = "", $js_mode = "") {
-
+
$ok = $this->checkConfiguration($element_data);
if (!$ok)
return;
Index: php-lib/php/form/elements/form_element_combo.inc
diff -u php-lib/php/form/elements/form_element_combo.inc:1.3
php-lib/php/form/elements/form_element_combo.inc:1.4
--- php-lib/php/form/elements/form_element_combo.inc:1.3 Thu May 10 22:47:08
2001
+++ php-lib/php/form/elements/form_element_combo.inc Fri May 11 22:53:17 2001
@@ -6,7 +6,7 @@
*
* @author Ulf Wendel <[EMAIL PROTECTED]>
* @package Form
-* @version $Id: form_element_combo.inc,v 1.3 2001/05/10 20:47:08 uw Exp $
+* @version $Id: form_element_combo.inc,v 1.4 2001/05/11 20:53:17 uw Exp $
*/
class form_element_combo extends form_element_selectobject {
@@ -14,8 +14,6 @@
"size"
=> "integer",
"intro"
=> "mixed",
"intro_e"
=> "string",
-
"seperators" =>
"array",
-
"seperators_e" => "string",
"accesskey"
=> "string",
"tabindex"
=> "integer",
Index: php-lib/php/form/elements/form_element_select.inc
diff -u php-lib/php/form/elements/form_element_select.inc:1.3
php-lib/php/form/elements/form_element_select.inc:1.4
--- php-lib/php/form/elements/form_element_select.inc:1.3 Thu May 10 22:47:11
2001
+++ php-lib/php/form/elements/form_element_select.inc Fri May 11 22:53:18 2001
@@ -6,7 +6,7 @@
*
* @author Ulf Wendel <[EMAIL PROTECTED]>
* @package Form
-* @version $Id: form_element_select.inc,v 1.3 2001/05/10 20:47:11 uw Exp $
+* @version $Id: form_element_select.inc,v 1.4 2001/05/11 20:53:18 uw Exp $
*/
class form_element_select extends form_element_selectobject {
@@ -14,8 +14,6 @@
"size"
=> "integer",
"intro"
=> "mixed",
"intro_e"
=> "string",
-
"seperators" =>
"array",
-
"seperators_e" => "string",
"accesskey"
=> "string",
"tabindex"
=> "integer",
Index: php-lib/php/form/xml/form.xml
diff -u php-lib/php/form/xml/form.xml:1.2 php-lib/php/form/xml/form.xml:1.3
--- php-lib/php/form/xml/form.xml:1.2 Thu May 10 22:47:15 2001
+++ php-lib/php/form/xml/form.xml Fri May 11 22:53:18 2001
@@ -2,135 +2,204 @@
<!DOCTYPE form SYSTEM "C:\www\apache\form\form.dtd">
<form jsname="" method="POST" action="" target="" name="">
<additionalhtml/>
+
<javascript>
<mode>weak or strong</mode>
</javascript>
+
<elements>
<nameprefix>prefix_</nameprefix>
</elements>
- <file size="-1" accept="" accesskey="" tabindex="" name="" elname=""
frozen="false">
- <css>
- <class/>
- <style/>
- <id/>
- </css>
- <additionalhtml/>
- <value/>
- <validation>
- <length min="0" max="-1">length_e</length>
- <regexp reg="" icase="false">valid_e</regexp>
- </validation>
- </file>
- <fileupload size="-1" accept="" accesskey="" tabindex="-1" name="" elname=""
frozen="false">
- <css>
- <class/>
- <style/>
- <id/>
- </css>
- <additionalhtml/>
- <value/>
- <maxfilesize>100000</maxfilesize>
- <validation>
- <length min="0" max="-1">length_e</length>
- <regexp reg="" icase="false">valid_e</regexp>
- </validation>
- </fileupload>
- <submit name="" elname="" width="-1" height="-1" frozen="false">
- <css>
- <class/>
- <style/>
- <id/>
- </css>
- <additionalhtml/>
- <frozen>false</frozen>
- <value/>
- </submit>
- <image name="" elname="" align="" alt="" hspace="-1" vspace="-1" border="-1"
width="-1" height="-1" accesskey="" tabindex="-1" usemap="" frozen="false">
- <css>
- <class/>
- <style/>
- <id/>
- </css>
- <additionalhtml/>
- <value/>
- </image>
- <select name="" elname="" frozen="false" accesskey="" tabindex="-1" size="0"
multiple="false">
+
+ <calendar name="calendar" elname="calendar" frozen="false" minyear="" maxyear=""
+now="" prev="" next="">
+ <preselect>
+ <day></day>
+ <month></month>
+ <year></year>
+ </preselect>
+ <css class="css class" id="id">style</css>
+ <html>additional html</html>
+ <validation>
+ <phpfunction></phpfunction>
+ <jsfunction></jsfunction>
+ </validation>
+ </calendar>
+
+ <checkbox name="checkbox" elname="checkbox" frozen="false" checked="false">
+ value
+ <css class="css class" id="id">style</css>
+ <html accesskey="" tabindex="">additional html</html>
+ <validation>
+ <phpfunction></phpfunction>
+ <jsfunction></jsfunction>
+ </validation>
+ </checkbox>
+
+ <combo name="combo" elname="combo" inputsize="1" readonly="false" sort=""
+frozen="false" add="true" size="1">
+ value
<options>
<option value=""/>
</options>
- <value/>
- <intros errormsg="error">
+ <intros errormsg = "error">
<intro value="">intro</intro>
</intros>
- <seperators errormsg="error">
- <seperator value=""/>
- </seperators>
- </select>
- <combo name="" elname="" accesskey="" tabindex="-1" inputsize="-1"
readonly="false" sort="" frozen="false">
- <validation>
+ <validation>
<length min="0" max="-1">length_e</length>
<regexp reg="" icase="false">valid_e</regexp>
+ <phpfunction></phpfunction>
+ <jsfunction></jsfunction>
</validation>
- <options>
- <option value=""/>
- </options>
- <value/>
- <intros errormsg = "error">
- <intro value="">intro</intro>
- </intros>
- <seperators errormsg = "error">
- <seperator value=""/>
- </seperators>
+ <css class="css class" id="id">style</css>
+ <html accesskey="" tabindex="">additional html</html>
</combo>
- <date name="" elname="" language="en" frozen="false" preload="false">
- <format>d.m.Y</format>
+
+ <date name="date" elname="date" language="en" frozen="false" preload="false"
+format="d.m.Y" now="jetzt" intro="" intro_e="">
+ value
<limits>
<yearlong min="1990" max="-1"/>
<yearshort min="90" max="-1"/>
</limits>
- <value/>
- <now>jetzt</now>
- <intros errormsg="error">
- <intro value="">intro</intro>
- </intros>
- </date>
- <hidden name="" elname="">
- <value/>
- </hidden>
- <text name="" elname="" size="-1" readonly="false" accesskey="" tabindex="-1"
frozen="false">
- <css>
- <class/>
- <style/>
- <id/>
- </css>
+ <html>additional html</html>
+ <css class="css class" id="id">style</css>
+ <validation>
+ <phpfunction></phpfunction>
+ <jsfunction></jsfunction>
+ </validation>
+ </date>
+
+ <file size="1" accept="" name="file" elname="file" frozen="false">
+ value
+ <html accesskey="" tabindex="">additional html</html>
+ <css class="css class" id="id">style</css>
<validation>
- <length min="0" max="-1">length_e</length>
+ <length min="0" max="1">length_e</length>
<regexp reg="" icase="false">valid_e</regexp>
+ <phpfunction></phpfunction>
+ <jsfunction></jsfunction>
</validation>
- <value/>
- </text>
- <password name="" elname="" size="-1" readonly="false" accesskey=""
tabindex="-1" frozen="false">
- <css>
- <class/>
- <style/>
- <id/>
- </css>
+ </file>
+
+ <fileupload size="1" maxfilesize="100" accept="" name="fileupload"
+elname="fileupload" frozen="false">
+ value
+ <html accesskey="" tabindex="">additional html</html>
+ <css class="css class" id="id">style</css>
<validation>
+ <length min="0" max="1">length_e</length>
+ <regexp reg="" icase="false">valid_e</regexp>
+ <phpfunction></phpfunction>
+ <jsfunction></jsfunction>
+ </validation>
+ </fileupload>
+
+ <hidden name="hidden" elname="hidden" frozen="false">
+ value
+ <html>additional html</html>
+ <css class="css class" id="id">style</css>
+ <validation>
+ <phpfunction></phpfunction>
+ <jsfunction></jsfunction>
+ </validation>
+ </hidden>
+
+ <image name="image" elname="image" align="" alt="" hspace="1" vspace="1" border="1"
+width="1" height="1" usemap="" frozen="false">
+ src
+ <html accesskey="" tabindex="">additional html</html>
+ <css class="css class" id="id">style</css>
+ <validation>
+ <phpfunction></phpfunction>
+ <jsfunction></jsfunction>
+ </validation>
+ </image>
+
+ <password name="password" elname="password" size="-1" readonly="false"
+frozen="false">
+ value
+ <css class="css class" id="id">style</css>
+ <html accesskey="" tabindex="">additional html</html>
+ <validation>
<length min="0" max="-1">length_e</length>
<regexp reg="" icase="false">valid_e</regexp>
+ <phpfunction></phpfunction>
+ <jsfunction></jsfunction>
</validation>
- <value/>
</password>
- <Textarea name="" elname="" rows="-1" cols="-1" wrap="virtual"
readonly="false" accesskey="" tabindex="-1" frozen="false">
- <css>
- <class/>
- <style/>
- <id/>
- </css>
- <validation>
+
+ <radio name="radio" elname="radio" checked="false" frozen="false">
+ value
+ <css class="css class" id="id">style</css>
+ <html accesskey="" tabindex="">additional html</html>
+ <validation>
+ <phpfunction></phpfunction>
+ <jsfunction></jsfunction>
+ </validation>
+ </radio>
+
+ <reset name="reset" elname="reset" frozen="false" width="1" height="1">
+ <css class="css class" id="id">style</css>
+ <html accesskey="" tabindex="">additional html</html>
+ <validation>
+ <phpfunction></phpfunction>
+ <jsfunction></jsfunction>
+ </validation>
+ </reset>
+
+ <select name="select" elname="select" frozen="false" size="0" multiple="false">
+ value
+ <options>
+ <option value=""/>
+ </options>
+ <intros errormsg="error">
+ <intro value="">intro</intro>
+ </intros>
+ <html accesskey="" tabindex="">additional html</html>
+ <css class="css class" id="id">style</css>
+ <validation>
+ <phpfunction></phpfunction>
+ <jsfunction></jsfunction>
+ </validation>
+ </select>
+
+ <submit name="submit" elname="submit" width="1" height="1" frozen="false"
+accesskey="" tabindex="">
+ value
+ <html accesskey="" tabindex="">additional html</html>
+ <css class="css class" id="id">style</css>
+ <validation>
+ <phpfunction></phpfunction>
+ <jsfunction></jsfunction>
+ </validation>
+ </submit>
+
+ <text name="text" elname="text" size="-1" readonly="false" frozen="false">
+ value
+ <css class="css class" id="id">style</css>
+ <html accesskey="" tabindex="">additional html</html>
+ <validation>
<length min="0" max="-1">length_e</length>
+ <regexp reg="" icase="false">valid_e</regexp>
+ <phpfunction></phpfunction>
+ <jsfunction></jsfunction>
+ </validation>
+ </text>
+
+ <textarea name="textarea" elname="textarea" rows="1" cols="1" wrap="virtual"
+readonly="false" frozen="false">
+ value
+ <css class="css class" id="id">style</css>
+ <html accesskey="" tabindex="">additional html</html>
+ <validation>
+ <length min="0" max="-1">length_e</length>
<regexp reg="" icase="false" global="false">valid_e</regexp>
+ <phpfunction></phpfunction>
+ <jsfunction></jsfunction>
</validation>
- <value/>
</textarea>
+
+ <textedit name="textedit" elname="textedit" frozen="false">
+ value
+ <css class="css class" id="id">style</css>
+ <html accesskey="" tabindex="">additional html</html>
+ <validation>
+ <phpfunction></phpfunction>
+ <jsfunction></jsfunction>
+ </validation>
+ </textedit>
+
</form>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]