add support for number inputs to ExtendedDocument
[php-utility-classes.git] / include / cbsm / util / document.php-class
index 46d4293fe81d105c8aa025e4bd6e75ba9f06957f..c64d9a4a81c3f6e501036f9136beeca86bc4e962 100755 (executable)
@@ -46,7 +46,15 @@ class ExtendedDocument extends DOMDocument {
   //   appends an ExtendedDocument::createElementLink() as a child of this document (see there for params)
   //     returns the new child
   //
   //   appends an ExtendedDocument::createElementLink() as a child of this document (see there for params)
   //     returns the new child
   //
-  // function appendFormDiv($action, $method, $name)
+  // function appendImage($src, [$alt_text])
+  //   appends an ExtendedDocument::createElementImage() as a child of this document (see there for params)
+  //     returns the new child
+  //
+  // function appendForm($action, $method, $name, [$id])
+  //   appends an ExtendedDocument::createElementForm() as a child of this document (see there for params)
+  //     returns the new child
+  //
+  // function appendFormDiv($action, $method, $name, [$id])
   //   appends an ExtendedDocument::createElementForm() as a child of this document (see there for params)
   //     returns an HTML <div> that is a child of the new child
   //
   //   appends an ExtendedDocument::createElementForm() as a child of this document (see there for params)
   //     returns an HTML <div> that is a child of the new child
   //
@@ -58,6 +66,14 @@ class ExtendedDocument extends DOMDocument {
   //   appends an ExtendedDocument::createElementInputText() as a child of this document (see there for params)
   //     returns the new child
   //
   //   appends an ExtendedDocument::createElementInputText() as a child of this document (see there for params)
   //     returns the new child
   //
+  // function appendInputNumber($name, $maxlength, $size, [$id], [$value])
+  //   appends an ExtendedDocument::createElementInputNumber() as a child of this document (see there for params)
+  //     returns the new child
+  //
+  // function appendInputPassword($name, $maxlength, $size, [$id], [$value])
+  //   appends an ExtendedDocument::createElementInputPassword() as a child of this document (see there for params)
+  //     returns the new child
+  //
   // function appendInputRadio($name, $id, $value, $checked)
   //   appends an ExtendedDocument::createElementInputRadio() as a child of this document (see there for params)
   //     returns the new child
   // function appendInputRadio($name, $id, $value, $checked)
   //   appends an ExtendedDocument::createElementInputRadio() as a child of this document (see there for params)
   //     returns the new child
@@ -70,6 +86,10 @@ class ExtendedDocument extends DOMDocument {
   //   appends an ExtendedDocument::createElementInputSubmit() as a child of this document (see there for params)
   //     returns the new child
   //
   //   appends an ExtendedDocument::createElementInputSubmit() as a child of this document (see there for params)
   //     returns the new child
   //
+  // function appendButton($value, $onclick = null)
+  //   appends an ExtendedDocument::createElementButton() as a child of this document (see there for params)
+  //     returns the new child
+  //
   // function appendTextArea($name, $columns, $rows, [$id], [$value])
   //   appends an ExtendedDocument::createElementTextArea() as a child of this document (see there for params)
   //     returns the new child
   // function appendTextArea($name, $columns, $rows, [$id], [$value])
   //   appends an ExtendedDocument::createElementTextArea() as a child of this document (see there for params)
   //     returns the new child
@@ -90,6 +110,10 @@ class ExtendedDocument extends DOMDocument {
   //   appends a DOMDocument::createTextNode() as a child of this document (see there for params)
   //     returns the new child
   //
   //   appends a DOMDocument::createTextNode() as a child of this document (see there for params)
   //     returns the new child
   //
+  // function appendComment($comment_data)
+  //   appends a DOMDocument::createComment() as a child of this document (see there for params)
+  //     returns the new child
+  //
   // function appendHTMLMarkup($htmldata, [$parentNode])
   //   appends a representation of the HTML data as children of the given parent node, by default this document
   //     NO return value!
   // function appendHTMLMarkup($htmldata, [$parentNode])
   //   appends a representation of the HTML data as children of the given parent node, by default this document
   //     NO return value!
@@ -102,9 +126,16 @@ class ExtendedDocument extends DOMDocument {
   //   appends an ExtendedDocument::createElementJS() as a child of this document (see there for params)
   //     NO return value!
   //
   //   appends an ExtendedDocument::createElementJS() as a child of this document (see there for params)
   //     NO return value!
   //
+  // function appendCOMElement($module, $attributes)
+  //   appends an ExtendedDocument::createCOMElement() as a child of this document (see there for params)
+  //     returns the new child
+  //
   // function createElementLink($target, [$value])
   //   returns an ExtendedElement that is an HTML <a> with the given target (href) and (optional) value
   //
   // function createElementLink($target, [$value])
   //   returns an ExtendedElement that is an HTML <a> with the given target (href) and (optional) value
   //
+  // function createElementImage($src, [$alt_text])
+  //   returns an ExtendedElement that is an HTML <img> with the given (src) and alt attributes (set to '' by default)
+  //
   // function createElementForm($action, $method, $name)
   //   returns an ExtendedElement that is an HTML <div> that is a child of an HTML <form>
   //   with the given action, method, and name
   // function createElementForm($action, $method, $name)
   //   returns an ExtendedElement that is an HTML <div> that is a child of an HTML <form>
   //   with the given action, method, and name
@@ -116,6 +147,14 @@ class ExtendedDocument extends DOMDocument {
   //   returns an ExtendedElement that is an HTML <input> of type 'text' with the given name, maxlength, size,
   //   and optionally id and value
   //
   //   returns an ExtendedElement that is an HTML <input> of type 'text' with the given name, maxlength, size,
   //   and optionally id and value
   //
+  // function createElementInputNumber($name, $maxlength, $size, [$id], [$value])
+  //   returns an ExtendedElement that is an HTML <input> of type 'number' with the given name, maxlength, size,
+  //   and optionally id and value
+  //
+  // function createElementInputPassword($name, $maxlength, $size, [$id], [$value])
+  //   returns an ExtendedElement that is an HTML <input> of type 'password' with the given name, maxlength, size,
+  //   and optionally id and value
+  //
   // function createElementInputRadio($name, $id, $value, $checked)
   //   returns an ExtendedElement that is an HTML <input> of type 'radio' with the given name, id, value and
   //   checked state
   // function createElementInputRadio($name, $id, $value, $checked)
   //   returns an ExtendedElement that is an HTML <input> of type 'radio' with the given name, id, value and
   //   checked state
@@ -125,7 +164,10 @@ class ExtendedDocument extends DOMDocument {
   //   checked state
   //
   // function createElementInputSubmit($value)
   //   checked state
   //
   // function createElementInputSubmit($value)
-  //   returns an ExtendedElement that is an HTML <input> of type 'submit' with the given name and value
+  //   returns an ExtendedElement that is an HTML <input> of type 'submit' with the given value as label
+  //
+  // function createElementButton($value, $onclick = null)
+  //   returns an ExtendedElement that is an HTML button with the given value as label and optionally onclick attribute
   //
   // function createElementTextArea($name, $columns, $rows, [$id], [$value])
   //   returns an ExtendedElement that is an HTML <textarea> with the given name, columns, rows,
   //
   // function createElementTextArea($name, $columns, $rows, [$id], [$value])
   //   returns an ExtendedElement that is an HTML <textarea> with the given name, columns, rows,
@@ -144,6 +186,10 @@ class ExtendedDocument extends DOMDocument {
   //
   // function createElementJS($jsdata)
   //   returns an ExtendedElement that is an HTML <script> of JavaScript type with the JS data inside
   //
   // function createElementJS($jsdata)
   //   returns an ExtendedElement that is an HTML <script> of JavaScript type with the JS data inside
+  //
+  // function createCOMElement($module, $attributes)
+  //   returns an ExtendedElement that is in COM_NS namespace, with the given module as name and the
+  //     given name=>value array as attributes
 
   function __construct($version = '1.0', $encoding = 'utf-8') {
     // make sure the default DOMDocument constructor runs
 
   function __construct($version = '1.0', $encoding = 'utf-8') {
     // make sure the default DOMDocument constructor runs
@@ -153,7 +199,10 @@ class ExtendedDocument extends DOMDocument {
   }
 
   function appendElement($name, $value = '') {
   }
 
   function appendElement($name, $value = '') {
-    return $this->appendChild($this->createElement($name, $value));
+    // Adding the $value in createElement does NOT escape it, so use appendText to support that.
+    $aelem = $this->appendChild($this->createElement($name));
+    $aelem->appendText($value);
+    return $aelem;
   }
   function appendElementXML($name, $xmldata) {
     $aelem = $this->appendChild($this->createElement($name));
   }
   function appendElementXML($name, $xmldata) {
     $aelem = $this->appendChild($this->createElement($name));
@@ -164,8 +213,14 @@ class ExtendedDocument extends DOMDocument {
   function appendLink($target, $value = '') {
     return $this->appendChild($this->createElementLink($target, $value));
   }
   function appendLink($target, $value = '') {
     return $this->appendChild($this->createElementLink($target, $value));
   }
-  function appendFormDiv($action, $method, $name) {
-    $formelem = $this->appendChild($this->createElementForm($action, $method, $name));
+  function appendImage($src, $alt_text = '') {
+    return $this->appendChild($this->createElementImage($src, $alt_text));
+  }
+  function appendForm($action, $method, $name, $id = null) {
+    return $this->appendChild($this->createElementForm($action, $method, $name, $id));
+  }
+  function appendFormDiv($action, $method, $name, $id = null) {
+    $formelem = $this->appendChild($this->createElementForm($action, $method, $name, $id));
     return $formelem->appendElement('div');
   }
   function appendInputHidden($name, $value) {
     return $formelem->appendElement('div');
   }
   function appendInputHidden($name, $value) {
@@ -174,6 +229,12 @@ class ExtendedDocument extends DOMDocument {
   function appendInputText($name, $maxlength, $size, $id = null, $value = null) {
     return $this->appendChild($this->createElementInputText($name, $maxlength, $size, $id, $value));
   }
   function appendInputText($name, $maxlength, $size, $id = null, $value = null) {
     return $this->appendChild($this->createElementInputText($name, $maxlength, $size, $id, $value));
   }
+  function appendInputNumber($name, $maxlength, $size, $id = null, $value = null) {
+    return $this->appendChild($this->createElementInputNumber($name, $maxlength, $size, $id, $value));
+  }
+  function appendInputPassword($name, $maxlength, $size, $id = null, $value = null) {
+    return $this->appendChild($this->createElementInputPassword($name, $maxlength, $size, $id, $value));
+  }
   function appendInputRadio($name, $id, $value, $checked) {
     return $this->appendChild($this->createElementInputRadio($name, $id, $value, $checked));
   }
   function appendInputRadio($name, $id, $value, $checked) {
     return $this->appendChild($this->createElementInputRadio($name, $id, $value, $checked));
   }
@@ -183,6 +244,9 @@ class ExtendedDocument extends DOMDocument {
   function appendInputSubmit($value) {
     return $this->appendChild($this->createElementInputSubmit($value));
   }
   function appendInputSubmit($value) {
     return $this->appendChild($this->createElementInputSubmit($value));
   }
+  function appendButton($value, $onclick = null) {
+    return $this->appendChild($this->createElementButton($value, $onclick));
+  }
   function appendTextArea($name, $columns, $rows, $id = null, $value = null) {
     return $this->appendChild($this->createElementTextArea($name, $columns, $rows, $id, $value));
   }
   function appendTextArea($name, $columns, $rows, $id = null, $value = null) {
     return $this->appendChild($this->createElementTextArea($name, $columns, $rows, $id, $value));
   }
@@ -198,9 +262,15 @@ class ExtendedDocument extends DOMDocument {
   function appendText($text) {
     return $this->appendChild($this->createTextNode($text));
   }
   function appendText($text) {
     return $this->appendChild($this->createTextNode($text));
   }
+  function appendComment($comment_data) {
+    return $this->appendChild($this->createComment($comment_data));
+  }
   function appendJSElement($jsdata) {
     $this->appendChild($this->createElementJS($jsdata));
   }
   function appendJSElement($jsdata) {
     $this->appendChild($this->createElementJS($jsdata));
   }
+  function appendCOMElement($module, $attributes) {
+    $this->appendChild($this->ownerDocument->createCOMElement($module, $attributes));
+  }
 
   function appendHTMLMarkup($htmldata, $parentNode = null) {
     if (is_null($parentNode)) { $parentNode =& $this; }
 
   function appendHTMLMarkup($htmldata, $parentNode = null) {
     if (is_null($parentNode)) { $parentNode =& $this; }
@@ -221,16 +291,25 @@ class ExtendedDocument extends DOMDocument {
   }
 
   function createElementLink($target, $value = '') {
   }
 
   function createElementLink($target, $value = '') {
-    $link = $this->createElement('a', $value);
+    $link = $this->createElement('a');
+    $link->appendText($value);
     $link->setAttribute('href', $target); // XXX: take care of & etc. in links
     return $link;
   }
 
     $link->setAttribute('href', $target); // XXX: take care of & etc. in links
     return $link;
   }
 
-  function createElementForm($action, $method, $name) {
+  function createElementImage($src, $alt_text = '') {
+    $img = $this->createElement('img');
+    $img->setAttribute('src', $src);
+    $img->setAttribute('alt', $alt_text);
+    return $img;
+  }
+
+  function createElementForm($action, $method, $name, $id = null) {
     $formelem = $this->createElement('form');
     $formelem->setAttribute('action', $action);
     $formelem->setAttribute('method', $method);
     $formelem->setAttribute('name', $name);
     $formelem = $this->createElement('form');
     $formelem->setAttribute('action', $action);
     $formelem->setAttribute('method', $method);
     $formelem->setAttribute('name', $name);
+    $formelem->setAttribute('id', $id);
     return $formelem;
   }
 
     return $formelem;
   }
 
@@ -253,6 +332,28 @@ class ExtendedDocument extends DOMDocument {
     return $txfield;
   }
 
     return $txfield;
   }
 
+  function createElementInputNumber($name, $maxlength, $size, $id = null, $value = null) {
+    $txfield = $this->createElement('input');
+    $txfield->setAttribute('type', 'number');
+    if (!is_null($id)) { $txfield->setAttribute('id', $id); }
+    $txfield->setAttribute('name', $name);
+    $txfield->setAttribute('maxlength', $maxlength);
+    $txfield->setAttribute('size', $size);
+    if (!is_null($value)) { $txfield->setAttribute('value', $value); }
+    return $txfield;
+  }
+
+  function createElementInputPassword($name, $maxlength, $size, $id = null, $value = null) {
+    $pwfield = $this->createElement('input');
+    $pwfield->setAttribute('type', 'password');
+    if (!is_null($id)) { $pwfield->setAttribute('id', $id); }
+    $pwfield->setAttribute('name', $name);
+    $pwfield->setAttribute('maxlength', $maxlength);
+    $pwfield->setAttribute('size', $size);
+    if (!is_null($value)) { $pwfield->setAttribute('value', $value); }
+    return $pwfield;
+  }
+
   function createElementInputRadio($name, $id, $value, $checked) {
     $radio = $this->createElement('input');
     $radio->setAttribute('type', 'radio');
   function createElementInputRadio($name, $id, $value, $checked) {
     $radio = $this->createElement('input');
     $radio->setAttribute('type', 'radio');
@@ -280,6 +381,14 @@ class ExtendedDocument extends DOMDocument {
     return $submitbtn;
   }
 
     return $submitbtn;
   }
 
+  function createElementButton($value, $onclick = null) {
+    $btn = $this->createElement('input');
+    $btn->setAttribute('type', 'button');
+    $btn->setAttribute('value', $value);
+    if (!is_null($onclick)) { $btn->setAttribute('onclick', $onclick); }
+    return $btn;
+  }
+
   function createElementTextArea($name, $columns, $rows, $id = null, $value = null) {
     $txtarea = $this->createElement('textarea', $value);
     $txtarea->setAttribute('name', $name);
   function createElementTextArea($name, $columns, $rows, $id = null, $value = null) {
     $txtarea = $this->createElement('textarea', $value);
     $txtarea->setAttribute('name', $name);
@@ -318,6 +427,16 @@ class ExtendedDocument extends DOMDocument {
     $jselem->appendChild($this->createCDATASection($jsdata));
     return $jselem;
   }
     $jselem->appendChild($this->createCDATASection($jsdata));
     return $jselem;
   }
+
+  function createCOMElement($module, $attributes) {
+    $com_elem = $this->createElementNS(COM_NS, $module);
+    if (is_array($attributes) && count($attributes)) {
+      foreach ($attributes as $name=>$value) {
+        $com_elem->setAttribute($name, $value);
+      }
+    }
+    return $com_elem;
+  }
 }
 
 class ExtendedElement extends DOMElement {
 }
 
 class ExtendedElement extends DOMElement {
@@ -337,7 +456,15 @@ class ExtendedElement extends DOMElement {
   //   appends an ExtendedDocument::createElementLink() as a child of this element (see there for params)
   //     returns the new child
   //
   //   appends an ExtendedDocument::createElementLink() as a child of this element (see there for params)
   //     returns the new child
   //
-  // function appendFormDiv($action, $method, $name)
+  // function appendImage($src, [$alt_text])
+  //   appends an ExtendedDocument::createElementImage() as a child of this document (see there for params)
+  //     returns the new child
+  //
+  // function appendForm($action, $method, $name, [$id])
+  //   appends an ExtendedDocument::createElementForm() as a child of this element (see there for params)
+  //     returns the new child
+  //
+  // function appendFormDiv($action, $method, $name, [$id])
   //   appends an ExtendedDocument::createElementForm() as a child of this element (see there for params)
   //     returns an HTML <div> that is a child of the new child
   //
   //   appends an ExtendedDocument::createElementForm() as a child of this element (see there for params)
   //     returns an HTML <div> that is a child of the new child
   //
@@ -349,6 +476,14 @@ class ExtendedElement extends DOMElement {
   //   appends an ExtendedDocument::createElementInputText() as a child of this element (see there for params)
   //     returns the new child
   //
   //   appends an ExtendedDocument::createElementInputText() as a child of this element (see there for params)
   //     returns the new child
   //
+  // function appendInputNumber($name, $maxlength, $size, [$id], [$value])
+  //   appends an ExtendedDocument::createElementInputNumber() as a child of this element (see there for params)
+  //     returns the new child
+  //
+  // function appendInputPassword($name, $maxlength, $size, [$id], [$value])
+  //   appends an ExtendedDocument::createElementInputPassword() as a child of this element (see there for params)
+  //     returns the new child
+  //
   // function appendInputRadio($name, $id, $value, $checked)
   //   appends an ExtendedDocument::createElementInputRadio() as a child of this element (see there for params)
   //     returns the new child
   // function appendInputRadio($name, $id, $value, $checked)
   //   appends an ExtendedDocument::createElementInputRadio() as a child of this element (see there for params)
   //     returns the new child
@@ -361,6 +496,10 @@ class ExtendedElement extends DOMElement {
   //   appends an ExtendedDocument::createElementInputSubmit() as a child of this element (see there for params)
   //     returns the new child
   //
   //   appends an ExtendedDocument::createElementInputSubmit() as a child of this element (see there for params)
   //     returns the new child
   //
+  // function appendButton($value, $onclick = null)
+  //   appends an ExtendedDocument::createElementButton() as a child of this element (see there for params)
+  //     returns the new child
+  //
   // function appendTextArea($name, $columns, $rows, [$id], [$value])
   //   appends an ExtendedDocument::createElementTextArea() as a child of this element (see there for params)
   //     returns the new child
   // function appendTextArea($name, $columns, $rows, [$id], [$value])
   //   appends an ExtendedDocument::createElementTextArea() as a child of this element (see there for params)
   //     returns the new child
@@ -381,6 +520,10 @@ class ExtendedElement extends DOMElement {
   //   appends a DOMDocument::createTextNode() as a child of this element (see there for params)
   //     returns the new child
   //
   //   appends a DOMDocument::createTextNode() as a child of this element (see there for params)
   //     returns the new child
   //
+  // function appendComment($comment_data)
+  //   appends a DOMDocument::createComment() as a child of this element (see there for params)
+  //     returns the new child
+  //
   // function appendHTMLMarkup($htmldata)
   //   appends a representation of the HTML data as children of this element
   //     NO return value!
   // function appendHTMLMarkup($htmldata)
   //   appends a representation of the HTML data as children of this element
   //     NO return value!
@@ -392,9 +535,16 @@ class ExtendedElement extends DOMElement {
   // function appendJSElement($jsdata)
   //   appends an ExtendedDocument::createElementJS() as a child of this element (see there for params)
   //     NO return value!
   // function appendJSElement($jsdata)
   //   appends an ExtendedDocument::createElementJS() as a child of this element (see there for params)
   //     NO return value!
+  //
+  // function appendCOMElement($module, $attributes)
+  //   appends an ExtendedDocument::createCOMElement() as a child of this element (see there for params)
+  //     returns the new child
 
   function appendElement($name, $value = '') {
 
   function appendElement($name, $value = '') {
-    return $this->appendChild($this->ownerDocument->createElement($name, $value));
+    // Adding the $value in createElement does NOT escape it, so use appendText to support that.
+    $aelem = $this->appendChild($this->ownerDocument->createElement($name));
+    $aelem->appendText($value);
+    return $aelem;
   }
   function appendElementXML($name, $xmldata) {
     $aelem = $this->appendChild($this->ownerDocument->createElement($name));
   }
   function appendElementXML($name, $xmldata) {
     $aelem = $this->appendChild($this->ownerDocument->createElement($name));
@@ -404,8 +554,14 @@ class ExtendedElement extends DOMElement {
   function appendLink($target, $value = '') {
     return $this->appendChild($this->ownerDocument->createElementLink($target, $value));
   }
   function appendLink($target, $value = '') {
     return $this->appendChild($this->ownerDocument->createElementLink($target, $value));
   }
-  function appendFormDiv($action, $method, $name) {
-    $formelem = $this->appendChild($this->ownerDocument->createElementForm($action, $method, $name));
+  function appendImage($src, $alt_text = '') {
+    return $this->appendChild($this->ownerDocument->createElementImage($src, $alt_text));
+  }
+  function appendForm($action, $method, $name, $id = null) {
+    return $this->appendChild($this->ownerDocument->createElementForm($action, $method, $name, $id));
+  }
+  function appendFormDiv($action, $method, $name, $id = null) {
+    $formelem = $this->appendChild($this->ownerDocument->createElementForm($action, $method, $name, $id));
     return $formelem->appendElement('div');
   }
   function appendInputHidden($name, $value) {
     return $formelem->appendElement('div');
   }
   function appendInputHidden($name, $value) {
@@ -414,6 +570,12 @@ class ExtendedElement extends DOMElement {
   function appendInputText($name, $maxlength, $size, $id = null, $value = null) {
     return $this->appendChild($this->ownerDocument->createElementInputText($name, $maxlength, $size, $id, $value));
   }
   function appendInputText($name, $maxlength, $size, $id = null, $value = null) {
     return $this->appendChild($this->ownerDocument->createElementInputText($name, $maxlength, $size, $id, $value));
   }
+  function appendInputNumber($name, $maxlength, $size, $id = null, $value = null) {
+    return $this->appendChild($this->ownerDocument->createElementInputNumber($name, $maxlength, $size, $id, $value));
+  }
+  function appendInputPassword($name, $maxlength, $size, $id = null, $value = null) {
+    return $this->appendChild($this->ownerDocument->createElementInputPassword($name, $maxlength, $size, $id, $value));
+  }
   function appendInputRadio($name, $id, $value, $checked) {
     return $this->appendChild($this->ownerDocument->createElementInputRadio($name, $id, $value, $checked));
   }
   function appendInputRadio($name, $id, $value, $checked) {
     return $this->appendChild($this->ownerDocument->createElementInputRadio($name, $id, $value, $checked));
   }
@@ -423,6 +585,9 @@ class ExtendedElement extends DOMElement {
   function appendInputSubmit($value) {
     return $this->appendChild($this->ownerDocument->createElementInputSubmit($value));
   }
   function appendInputSubmit($value) {
     return $this->appendChild($this->ownerDocument->createElementInputSubmit($value));
   }
+  function appendButton($value, $onclick = null) {
+    return $this->appendChild($this->ownerDocument->createElementButton($value, $onclick));
+  }
   function appendTextArea($name, $columns, $rows, $id = null, $value = null) {
     return $this->appendChild($this->ownerDocument->createElementTextArea($name, $columns, $rows, $id, $value));
   }
   function appendTextArea($name, $columns, $rows, $id = null, $value = null) {
     return $this->appendChild($this->ownerDocument->createElementTextArea($name, $columns, $rows, $id, $value));
   }
@@ -438,6 +603,9 @@ class ExtendedElement extends DOMElement {
   function appendText($text) {
     return $this->appendChild($this->ownerDocument->createTextNode($text));
   }
   function appendText($text) {
     return $this->appendChild($this->ownerDocument->createTextNode($text));
   }
+  function appendComment($comment_data) {
+    return $this->appendChild($this->ownerDocument->createComment($comment_data));
+  }
   function appendHTMLMarkup($htmldata) {
     $this->ownerDocument->appendHTMLMarkup($htmldata, $this);
   }
   function appendHTMLMarkup($htmldata) {
     $this->ownerDocument->appendHTMLMarkup($htmldata, $this);
   }
@@ -447,6 +615,9 @@ class ExtendedElement extends DOMElement {
   function appendJSElement($jsdata) {
     $this->appendChild($this->ownerDocument->createElementJS($jsdata));
   }
   function appendJSElement($jsdata) {
     $this->appendChild($this->ownerDocument->createElementJS($jsdata));
   }
+  function appendCOMElement($module, $attributes) {
+    $this->appendChild($this->ownerDocument->createCOMElement($module, $attributes));
+  }
 }
 
 class ExtendedDocumentFragment extends DOMDocumentFragment {
 }
 
 class ExtendedDocumentFragment extends DOMDocumentFragment {
@@ -466,7 +637,15 @@ class ExtendedDocumentFragment extends DOMDocumentFragment {
   //   appends an ExtendedDocument::createElementLink() as a child of this fragment (see there for params)
   //     returns the new child
   //
   //   appends an ExtendedDocument::createElementLink() as a child of this fragment (see there for params)
   //     returns the new child
   //
-  // function appendFormDiv($action, $method, $name)
+  // function appendImage($src, [$alt_text])
+  //   appends an ExtendedDocument::createElementImage() as a child of this document (see there for params)
+  //     returns the new child
+  //
+  // function appendForm($action, $method, $name, [$id])
+  //   appends an ExtendedDocument::createElementForm() as a child of this fragment (see there for params)
+  //     returns the new child
+  //
+  // function appendFormDiv($action, $method, $name, [$id])
   //   appends an ExtendedDocument::createElementForm() as a child of this fragment (see there for params)
   //     returns an HTML <div> that is a child of the new child
   //
   //   appends an ExtendedDocument::createElementForm() as a child of this fragment (see there for params)
   //     returns an HTML <div> that is a child of the new child
   //
@@ -478,6 +657,14 @@ class ExtendedDocumentFragment extends DOMDocumentFragment {
   //   appends an ExtendedDocument::createElementInputText() as a child of this fragment (see there for params)
   //     returns the new child
   //
   //   appends an ExtendedDocument::createElementInputText() as a child of this fragment (see there for params)
   //     returns the new child
   //
+  // function appendInputNumber($name, $maxlength, $size, [$id], [$value])
+  //   appends an ExtendedDocument::createElementInputNumber() as a child of this fragment (see there for params)
+  //     returns the new child
+  //
+  // function appendInputPassword($name, $maxlength, $size, [$id], [$value])
+  //   appends an ExtendedDocument::createElementInputPassword() as a child of this fragment (see there for params)
+  //     returns the new child
+  //
   // function appendInputRadio($name, $id, $value, $checked)
   //   appends an ExtendedDocument::createElementInputRadio() as a child of this fragment (see there for params)
   //     returns the new child
   // function appendInputRadio($name, $id, $value, $checked)
   //   appends an ExtendedDocument::createElementInputRadio() as a child of this fragment (see there for params)
   //     returns the new child
@@ -490,6 +677,10 @@ class ExtendedDocumentFragment extends DOMDocumentFragment {
   //   appends an ExtendedDocument::createElementInputSubmit() as a child of this fragment (see there for params)
   //     returns the new child
   //
   //   appends an ExtendedDocument::createElementInputSubmit() as a child of this fragment (see there for params)
   //     returns the new child
   //
+  // function appendButton($value, $onclick = null)
+  //   appends an ExtendedDocument::createElementButton() as a child of this fragment (see there for params)
+  //     returns the new child
+  //
   // function appendTextArea($name, $columns, $rows, [$id], [$value])
   //   appends an ExtendedDocument::createElementTextArea() as a child of this fragment (see there for params)
   //     returns the new child
   // function appendTextArea($name, $columns, $rows, [$id], [$value])
   //   appends an ExtendedDocument::createElementTextArea() as a child of this fragment (see there for params)
   //     returns the new child
@@ -510,6 +701,10 @@ class ExtendedDocumentFragment extends DOMDocumentFragment {
   //   appends a DOMDocument::createTextNode() as a child of this fragment (see there for params)
   //     returns the new child
   //
   //   appends a DOMDocument::createTextNode() as a child of this fragment (see there for params)
   //     returns the new child
   //
+  // function appendComment($comment_data)
+  //   appends a DOMDocument::createComment() as a child of this fragment (see there for params)
+  //     returns the new child
+  //
   // function appendHTMLMarkup($htmldata)
   //   appends a representation of the HTML data as children of this fragment
   //     NO return value!
   // function appendHTMLMarkup($htmldata)
   //   appends a representation of the HTML data as children of this fragment
   //     NO return value!
@@ -521,9 +716,16 @@ class ExtendedDocumentFragment extends DOMDocumentFragment {
   // function appendJSElement($jsdata)
   //   appends an ExtendedDocument::createElementJS() as a child of this fragment (see there for params)
   //     NO return value!
   // function appendJSElement($jsdata)
   //   appends an ExtendedDocument::createElementJS() as a child of this fragment (see there for params)
   //     NO return value!
+  //
+  // function appendCOMElement($module, $attributes)
+  //   appends an ExtendedDocument::createCOMElement() as a child of this fragment (see there for params)
+  //     returns the new child
 
   function appendElement($name, $value = '') {
 
   function appendElement($name, $value = '') {
-    return $this->appendChild($this->ownerDocument->createElement($name, $value));
+    // Adding the $value in createElement does NOT escape it, so use appendText to support that.
+    $aelem = $this->appendChild($this->ownerDocument->createElement($name));
+    $aelem->appendText($value);
+    return $aelem;
   }
   function appendElementXML($name, $xmldata) {
     $aelem = $this->appendChild($this->ownerDocument->createElement($name));
   }
   function appendElementXML($name, $xmldata) {
     $aelem = $this->appendChild($this->ownerDocument->createElement($name));
@@ -533,8 +735,14 @@ class ExtendedDocumentFragment extends DOMDocumentFragment {
   function appendLink($target, $value = '') {
     return $this->appendChild($this->ownerDocument->createElementLink($target, $value));
   }
   function appendLink($target, $value = '') {
     return $this->appendChild($this->ownerDocument->createElementLink($target, $value));
   }
-  function appendFormDiv($action, $method, $name) {
-    $formelem = $this->appendChild($this->ownerDocument->createElementForm($action, $method, $name));
+  function appendImage($src, $alt_text = '') {
+    return $this->appendChild($this->ownerDocument->createElementImage($src, $alt_text));
+  }
+  function appendForm($action, $method, $name, $id = null) {
+    return $this->appendChild($this->ownerDocument->createElementForm($action, $method, $name, $id));
+  }
+  function appendFormDiv($action, $method, $name, $id = null) {
+    $formelem = $this->appendChild($this->ownerDocument->createElementForm($action, $method, $name, $id));
     return $formelem->appendElement('div');
   }
   function appendInputHidden($name, $value) {
     return $formelem->appendElement('div');
   }
   function appendInputHidden($name, $value) {
@@ -543,6 +751,12 @@ class ExtendedDocumentFragment extends DOMDocumentFragment {
   function appendInputText($name, $maxlength, $size, $id = null, $value = null) {
     return $this->appendChild($this->ownerDocument->createElementInputText($name, $maxlength, $size, $id, $value));
   }
   function appendInputText($name, $maxlength, $size, $id = null, $value = null) {
     return $this->appendChild($this->ownerDocument->createElementInputText($name, $maxlength, $size, $id, $value));
   }
+  function appendInputNumber($name, $maxlength, $size, $id = null, $value = null) {
+    return $this->appendChild($this->ownerDocument->createElementInputNumber($name, $maxlength, $size, $id, $value));
+  }
+  function appendInputPassword($name, $maxlength, $size, $id = null, $value = null) {
+    return $this->appendChild($this->ownerDocument->createElementInputPassword($name, $maxlength, $size, $id, $value));
+  }
   function appendInputRadio($name, $id, $value, $checked) {
     return $this->appendChild($this->ownerDocument->createElementInputRadio($name, $id, $value, $checked));
   }
   function appendInputRadio($name, $id, $value, $checked) {
     return $this->appendChild($this->ownerDocument->createElementInputRadio($name, $id, $value, $checked));
   }
@@ -552,6 +766,9 @@ class ExtendedDocumentFragment extends DOMDocumentFragment {
   function appendInputSubmit($value) {
     return $this->appendChild($this->ownerDocument->createElementInputSubmit($value));
   }
   function appendInputSubmit($value) {
     return $this->appendChild($this->ownerDocument->createElementInputSubmit($value));
   }
+  function appendButton($value, $onclick = null) {
+    return $this->appendChild($this->ownerDocument->createElementButton($value, $onclick));
+  }
   function appendTextArea($name, $columns, $rows, $id = null, $value = null) {
     return $this->appendChild($this->ownerDocument->createElementTextArea($name, $columns, $rows, $id, $value));
   }
   function appendTextArea($name, $columns, $rows, $id = null, $value = null) {
     return $this->appendChild($this->ownerDocument->createElementTextArea($name, $columns, $rows, $id, $value));
   }
@@ -567,6 +784,9 @@ class ExtendedDocumentFragment extends DOMDocumentFragment {
   function appendText($text) {
     return $this->appendChild($this->ownerDocument->createTextNode($text));
   }
   function appendText($text) {
     return $this->appendChild($this->ownerDocument->createTextNode($text));
   }
+  function appendComment($comment_data) {
+    return $this->appendChild($this->ownerDocument->createComment($comment_data));
+  }
   function appendHTMLMarkup($htmldata) {
     $this->ownerDocument->appendHTMLMarkup($htmldata, $this);
   }
   function appendHTMLMarkup($htmldata) {
     $this->ownerDocument->appendHTMLMarkup($htmldata, $this);
   }
@@ -576,5 +796,8 @@ class ExtendedDocumentFragment extends DOMDocumentFragment {
   function appendJSElement($jsdata) {
     $this->appendChild($this->ownerDocument->createElementJS($jsdata));
   }
   function appendJSElement($jsdata) {
     $this->appendChild($this->ownerDocument->createElementJS($jsdata));
   }
+  function appendCOMElement($module, $attributes) {
+    $this->appendChild($this->ownerDocument->createCOMElement($module, $attributes));
+  }
 }
 ?>
 }
 ?>