add functions for easily adding images
[php-utility-classes.git] / include / cbsm / util / document.php-class
1 <?php
2 /* ***** BEGIN LICENSE BLOCK *****
3  *
4  * The contents of this file are subject to Austrian copyright reegulations
5  * ("Urheberrecht"); you may not use this file except in compliance with
6  * those laws.
7  * This contents and any derived work, if it gets distributed in any way,
8  * is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND,
9  * either express or implied.
10  *
11  * The Original Code is KaiRo's extended DOM document classes.
12  *
13  * The Initial Developer of the Original Code is
14  * KaiRo - Robert Kaiser.
15  * Portions created by the Initial Developer are Copyright (C) 2010
16  * the Initial Developer. All Rights Reserved.
17  *
18  * Contributor(s): Robert Kaiser <kairo@kairo.at>
19  *
20  * ***** END LICENSE BLOCK ***** */
21
22 class ExtendedDocument extends DOMDocument {
23   // ExtendedDocument PHP class
24   // this extends the general PHP DOM Document class to simplify some usual constructs
25   //
26   // function __construct([$version], [$encoding])
27   //   CONSTRUCTOR
28   //   construct a new DOM Document that uses our element definitions
29   //
30   // private $xmheader
31   //   the default XML header
32   //
33   // private $xhtmldtype
34   //   the XHTML doctype to use by default
35   //
36   // function appendElement($name, [$value])
37   //   appends a DOMDocument::createElement() as a child of this document (see there for params)
38   //     returns the new child
39   //
40   // function appendElementXML($name, $xmldata)
41   //   appends a DOMDocument::createElement() with the given name as a child of this document,
42   //   with an ExtendedDocument::createXMLFragment() of the given XML data inside
43   //     returns the new child
44   //
45   // function appendLink($target, [$value])
46   //   appends an ExtendedDocument::createElementLink() as a child of this document (see there for params)
47   //     returns the new child
48   //
49   // function appendFormDiv($action, $method, $name)
50   //   appends an ExtendedDocument::createElementForm() as a child of this document (see there for params)
51   //     returns an HTML <div> that is a child of the new child
52   //
53   // function appendInputHidden($name, $value)
54   //   appends an ExtendedDocument::createElementInputHidden() as a child of this document (see there for params)
55   //     returns the new child
56   //
57   // function appendInputText($name, $maxlength, $size, [$id], [$value])
58   //   appends an ExtendedDocument::createElementInputText() as a child of this document (see there for params)
59   //     returns the new child
60   //
61   // function appendInputRadio($name, $id, $value, $checked)
62   //   appends an ExtendedDocument::createElementInputRadio() as a child of this document (see there for params)
63   //     returns the new child
64   //
65   // function appendInputCheckbox($name, $id, $value, $checked)
66   //   appends an ExtendedDocument::createElementInputCheckbox() as a child of this document (see there for params)
67   //     returns the new child
68   //
69   // function appendInputSubmit($value)
70   //   appends an ExtendedDocument::createElementInputSubmit() as a child of this document (see there for params)
71   //     returns the new child
72   //
73   // function appendTextArea($name, $columns, $rows, [$id], [$value])
74   //   appends an ExtendedDocument::createElementTextArea() as a child of this document (see there for params)
75   //     returns the new child
76   //
77   // function appendElementSelect($name, [$id], [$options], [$default])
78   //   appends an ExtendedDocument::createElementSelect() as a child of this document (see there for params)
79   //     returns the new child
80   //
81   // function appendElementOption($key, $desc, [$selected])
82   //   appends an ExtendedDocument::createElementOption() as a child of this document (see there for params)
83   //     returns the new child
84   //
85   // function appendLabel($for_id, $value)
86   //   appends an ExtendedDocument::createElementLabel() as a child of this document (see there for params)
87   //     returns the new child
88   //
89   // function appendText($text)
90   //   appends a DOMDocument::createTextNode() as a child of this document (see there for params)
91   //     returns the new child
92   //
93   // function appendHTMLMarkup($htmldata, [$parentNode])
94   //   appends a representation of the HTML data as children of the given parent node, by default this document
95   //     NO return value!
96   //
97   // function appendXMLMarkup($xmldata, [$parentNode])
98   //   appends a representation of the XML data as children of the given parent node, by default this document
99   //     NO return value!
100   //
101   // function appendJSElement($jsdata)
102   //   appends an ExtendedDocument::createElementJS() as a child of this document (see there for params)
103   //     NO return value!
104   //
105   // function appendCOMElement($module, $attributes)
106   //   appends an ExtendedDocument::createCOMElement() as a child of this document (see there for params)
107   //     returns the new child
108   //
109   // function createElementLink($target, [$value])
110   //   returns an ExtendedElement that is an HTML <a> with the given target (href) and (optional) value
111   //
112   // function createElementForm($action, $method, $name)
113   //   returns an ExtendedElement that is an HTML <div> that is a child of an HTML <form>
114   //   with the given action, method, and name
115   //
116   // function createElementInputHidden($name, $value)
117   //   returns an ExtendedElement that is an HTML <input> of type 'hidden' with the given name and value
118   //
119   // function createElementInputText($name, $maxlength, $size, [$id], [$value])
120   //   returns an ExtendedElement that is an HTML <input> of type 'text' with the given name, maxlength, size,
121   //   and optionally id and value
122   //
123   // function createElementInputRadio($name, $id, $value, $checked)
124   //   returns an ExtendedElement that is an HTML <input> of type 'radio' with the given name, id, value and
125   //   checked state
126   //
127   // function createElementInputCheckbox($name, $id, $value, $checked)
128   //   returns an ExtendedElement that is an HTML <input> of type 'checkbox' with the given name, id, value and
129   //   checked state
130   //
131   // function createElementInputSubmit($value)
132   //   returns an ExtendedElement that is an HTML <input> of type 'submit' with the given name and value
133   //
134   // function createElementTextArea($name, $columns, $rows, [$id], [$value])
135   //   returns an ExtendedElement that is an HTML <textarea> with the given name, columns, rows,
136   //   and optionally id and value
137   //
138   // function createElementSelect($name, [$id], [$options], [$default])
139   //   returns an ExtendedElement that is an HTML <select> with the given name, and optionally id,
140   //   array of options (key => description) and key of the by-default selected entry
141   //
142   // function createElementOption($key, $desc, [$selected])
143   //   returns an ExtendedElement that is an HTML <option> with the given key (value) and description (content)
144   //   and optionally bool that tells if the entry is selected
145   //
146   // function createElementLabel($for_id, $value)
147   //   returns an ExtendedElement that is an HTML <label> with the given 'for' and value
148   //
149   // function createElementJS($jsdata)
150   //   returns an ExtendedElement that is an HTML <script> of JavaScript type with the JS data inside
151   //
152   // function createCOMElement($module, $attributes)
153   //   returns an ExtendedElement that is in COM_NS namespace, with the given module as name and the
154   //     given name=>value array as attributes
155
156   function __construct($version = '1.0', $encoding = 'utf-8') {
157     // make sure the default DOMDocument constructor runs
158     parent::__construct($version, $encoding);
159     $this->registerNodeClass('DOMElement', 'ExtendedElement');
160     $this->registerNodeClass('DOMDocumentFragment', 'ExtendedDocumentFragment');
161   }
162
163   function appendElement($name, $value = '') {
164     return $this->appendChild($this->createElement($name, $value));
165   }
166   function appendElementXML($name, $xmldata) {
167     $aelem = $this->appendChild($this->createElement($name));
168     $aelem->appendXMLMarkup($xmldata);
169     //$aelem->appendChild($this->createXMLFragment($xmldata));
170     return $aelem;
171   }
172   function appendLink($target, $value = '') {
173     return $this->appendChild($this->createElementLink($target, $value));
174   }
175   function appendImage($src, $alt_text = '') {
176     return $this->appendChild($this->createElementImage($src, $alt_text));
177   }
178   function appendFormDiv($action, $method, $name) {
179     $formelem = $this->appendChild($this->createElementForm($action, $method, $name));
180     return $formelem->appendElement('div');
181   }
182   function appendInputHidden($name, $value) {
183     return $this->appendChild($this->createElementInputHidden($name, $value));
184   }
185   function appendInputText($name, $maxlength, $size, $id = null, $value = null) {
186     return $this->appendChild($this->createElementInputText($name, $maxlength, $size, $id, $value));
187   }
188   function appendInputRadio($name, $id, $value, $checked) {
189     return $this->appendChild($this->createElementInputRadio($name, $id, $value, $checked));
190   }
191   function appendInputCheckbox($name, $id, $value, $checked) {
192     return $this->appendChild($this->createElementInputCheckbox($name, $id, $value, $checked));
193   }
194   function appendInputSubmit($value) {
195     return $this->appendChild($this->createElementInputSubmit($value));
196   }
197   function appendTextArea($name, $columns, $rows, $id = null, $value = null) {
198     return $this->appendChild($this->createElementTextArea($name, $columns, $rows, $id, $value));
199   }
200   function appendElementSelect($name, $id = null, $options = array(), $default = null) {
201     return $this->appendChild($this->createElementSelect($name, $id, $options, $default));
202   }
203   function appendElementOption($key, $desc, $selected = false) {
204     return $this->appendChild($this->createElementOption($key, $desc, $selected));
205   }
206   function appendLabel($for_id, $value) {
207     return $this->appendChild($this->createElementLabel($for_id, $value));
208   }
209   function appendText($text) {
210     return $this->appendChild($this->createTextNode($text));
211   }
212   function appendJSElement($jsdata) {
213     $this->appendChild($this->createElementJS($jsdata));
214   }
215   function appendCOMElement($module, $attributes) {
216     $this->appendChild($this->ownerDocument->createCOMElement($module, $attributes));
217   }
218
219   function appendHTMLMarkup($htmldata, $parentNode = null) {
220     if (is_null($parentNode)) { $parentNode =& $this; }
221     // XXX: just a workaround for now!
222     $parentNode->appendChild($this->createCDATASection($htmldata));
223   }
224
225   function appendXMLMarkup($xmldata, $parentNode = null) {
226     if (is_null($parentNode)) { $parentNode =& $this; }
227     $tmpdoc = new ExtendedDocument;
228     $tmpxml = '<?xml version="1.0" encoding="utf-8"?>'."\n";
229     $tmpxml .= '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">'."\n";
230     $tmpxml .= '<root>'.$xmldata.'</root>';
231     $tmpdoc->loadXML($tmpxml);
232     foreach ($tmpdoc->getElementsByTagName('root')->item(0)->childNodes as $child) {
233       $parentNode->appendChild($this->importNode($child, true));
234     }
235   }
236
237   function createElementLink($target, $value = '') {
238     $link = $this->createElement('a', $value);
239     $link->setAttribute('href', $target); // XXX: take care of & etc. in links
240     return $link;
241   }
242
243   function createElementImage($src, $alt_text = '') {
244     $link = $this->createElement('img');
245     $link->setAttribute('src', $src);
246     $link->setAttribute('alt', $alt_text);
247     return $link;
248   }
249
250   function createElementForm($action, $method, $name) {
251     $formelem = $this->createElement('form');
252     $formelem->setAttribute('action', $action);
253     $formelem->setAttribute('method', $method);
254     $formelem->setAttribute('name', $name);
255     return $formelem;
256   }
257
258   function createElementInputHidden($name, $value) {
259     $hidden = $this->createElement('input');
260     $hidden->setAttribute('type', 'hidden');
261     $hidden->setAttribute('name', $name);
262     $hidden->setAttribute('value', $value);
263     return $hidden;
264   }
265
266   function createElementInputText($name, $maxlength, $size, $id = null, $value = null) {
267     $txfield = $this->createElement('input');
268     $txfield->setAttribute('type', 'text');
269     if (!is_null($id)) { $txfield->setAttribute('id', $id); }
270     $txfield->setAttribute('name', $name);
271     $txfield->setAttribute('maxlength', $maxlength);
272     $txfield->setAttribute('size', $size);
273     if (!is_null($value)) { $txfield->setAttribute('value', $value); }
274     return $txfield;
275   }
276
277   function createElementInputRadio($name, $id, $value, $checked) {
278     $radio = $this->createElement('input');
279     $radio->setAttribute('type', 'radio');
280     $radio->setAttribute('name', $name);
281     $radio->setAttribute('id', $id);
282     $radio->setAttribute('value', $value);
283     if ($checked) { $radio->setAttribute('checked', ''); }
284     return $radio;
285   }
286
287   function createElementInputCheckbox($name, $id, $value, $checked) {
288     $cbox = $this->createElement('input');
289     $cbox->setAttribute('type', 'checkbox');
290     $cbox->setAttribute('name', $name);
291     $cbox->setAttribute('id', $id);
292     $cbox->setAttribute('value', $value);
293     if ($checked) { $cbox->setAttribute('checked', ''); }
294     return $cbox;
295   }
296
297   function createElementInputSubmit($value) {
298     $submitbtn = $this->createElement('input');
299     $submitbtn->setAttribute('type', 'submit');
300     $submitbtn->setAttribute('value', $value);
301     return $submitbtn;
302   }
303
304   function createElementTextArea($name, $columns, $rows, $id = null, $value = null) {
305     $txtarea = $this->createElement('textarea', $value);
306     $txtarea->setAttribute('name', $name);
307     $txtarea->setAttribute('cols', $columns);
308     $txtarea->setAttribute('rows', $rows);
309     if (!is_null($id)) { $txtarea->setAttribute('id', $id); }
310     return $txtarea;
311   }
312
313   function createElementSelect($name, $id = null, $options = array(), $default = null) {
314     $select = $this->createElement('select');
315     $select->setAttribute('name', $name);
316     if (!is_null($id)) { $select->setAttribute('id', $id); }
317     foreach ($options as $key => $desc) {
318       $select->appendElementOption($key, $desc, ($key == $default));
319     }
320     return $select;
321   }
322
323   function createElementOption($key, $desc, $selected = false) {
324     $option = $this->createElement('option', $desc);
325     $option->setAttribute('value', $key);
326     if ($selected) { $option->setAttribute('selected', ''); }
327     return $option;
328   }
329
330   function createElementLabel($for_id, $value) {
331     $label = $this->createElement('label', $value);
332     $label->setAttribute('for', $for_id);
333     return $label;
334   }
335
336   function createElementJS($jsdata) {
337     $jselem = $this->createElement('script');
338     $jselem->setAttribute('type', 'text/javascript');
339     $jselem->appendChild($this->createCDATASection($jsdata));
340     return $jselem;
341   }
342
343   function createCOMElement($module, $attributes) {
344     $com_elem = $this->createElementNS(COM_NS, $module);
345     if (is_array($attributes) && count($attributes)) {
346       foreach ($attributes as $name=>$value) {
347         $com_elem->setAttribute($name, $value);
348       }
349     }
350     return $com_elem;
351   }
352 }
353
354 class ExtendedElement extends DOMElement {
355   // ExtendedElement PHP class
356   // this extends the general PHP DOM Element class to simplify some usual constructs
357   //
358   // function appendElement($name, [$value])
359   //   appends a DOMDocument::createElement() as a child of this element (see there for params)
360   //     returns the new child
361   //
362   // function appendElementXML($name, $xmldata)
363   //   appends a DOMDocument::createElement() with the given name as a child of this element,
364   //   with an ExtendedDocument::createXMLFragment() of the given XML data inside
365   //     returns the new child
366   //
367   // function appendLink($target, [$value])
368   //   appends an ExtendedDocument::createElementLink() as a child of this element (see there for params)
369   //     returns the new child
370   //
371   // function appendFormDiv($action, $method, $name)
372   //   appends an ExtendedDocument::createElementForm() as a child of this element (see there for params)
373   //     returns an HTML <div> that is a child of the new child
374   //
375   // function appendInputHidden($name, $value)
376   //   appends an ExtendedDocument::createElementInputHidden() as a child of this element (see there for params)
377   //     returns the new child
378   //
379   // function appendInputText($name, $maxlength, $size, [$id], [$value])
380   //   appends an ExtendedDocument::createElementInputText() as a child of this element (see there for params)
381   //     returns the new child
382   //
383   // function appendInputRadio($name, $id, $value, $checked)
384   //   appends an ExtendedDocument::createElementInputRadio() as a child of this element (see there for params)
385   //     returns the new child
386   //
387   // function appendInputCheckbox($name, $id, $value, $checked)
388   //   appends an ExtendedDocument::createElementInputCheckbox() as a child of this element (see there for params)
389   //     returns the new child
390   //
391   // function appendInputSubmit($value)
392   //   appends an ExtendedDocument::createElementInputSubmit() as a child of this element (see there for params)
393   //     returns the new child
394   //
395   // function appendTextArea($name, $columns, $rows, [$id], [$value])
396   //   appends an ExtendedDocument::createElementTextArea() as a child of this element (see there for params)
397   //     returns the new child
398   //
399   // function appendElementSelect($name, [$id], [$options], [$default])
400   //   appends an ExtendedDocument::createElementSelect() as a child of this element (see there for params)
401   //     returns the new child
402   //
403   // function appendElementOption($key, $desc, [$selected])
404   //   appends an ExtendedDocument::createElementOption() as a child of this element (see there for params)
405   //     returns the new child
406   //
407   // function appendLabel($for_id, $value)
408   //   appends an ExtendedDocument::createElementLabel() as a child of this element (see there for params)
409   //     returns the new child
410   //
411   // function appendText($text)
412   //   appends a DOMDocument::createTextNode() as a child of this element (see there for params)
413   //     returns the new child
414   //
415   // function appendHTMLMarkup($htmldata)
416   //   appends a representation of the HTML data as children of this element
417   //     NO return value!
418   //
419   // function appendXMLMarkup($xmldata)
420   //   appends a representation of the XML data as children of this element
421   //     NO return value!
422   //
423   // function appendJSElement($jsdata)
424   //   appends an ExtendedDocument::createElementJS() as a child of this element (see there for params)
425   //     NO return value!
426   //
427   // function appendCOMElement($module, $attributes)
428   //   appends an ExtendedDocument::createCOMElement() as a child of this element (see there for params)
429   //     returns the new child
430
431   function appendElement($name, $value = '') {
432     return $this->appendChild($this->ownerDocument->createElement($name, $value));
433   }
434   function appendElementXML($name, $xmldata) {
435     $aelem = $this->appendChild($this->ownerDocument->createElement($name));
436     $aelem->appendXMLMarkup($xmldata);
437     return $aelem;
438   }
439   function appendLink($target, $value = '') {
440     return $this->appendChild($this->ownerDocument->createElementLink($target, $value));
441   }
442   function appendFormDiv($action, $method, $name) {
443     $formelem = $this->appendChild($this->ownerDocument->createElementForm($action, $method, $name));
444     return $formelem->appendElement('div');
445   }
446   function appendInputHidden($name, $value) {
447     return $this->appendChild($this->ownerDocument->createElementInputHidden($name, $value));
448   }
449   function appendInputText($name, $maxlength, $size, $id = null, $value = null) {
450     return $this->appendChild($this->ownerDocument->createElementInputText($name, $maxlength, $size, $id, $value));
451   }
452   function appendInputRadio($name, $id, $value, $checked) {
453     return $this->appendChild($this->ownerDocument->createElementInputRadio($name, $id, $value, $checked));
454   }
455   function appendInputCheckbox($name, $id, $value, $checked) {
456     return $this->appendChild($this->ownerDocument->createElementInputCheckbox($name, $id, $value, $checked));
457   }
458   function appendInputSubmit($value) {
459     return $this->appendChild($this->ownerDocument->createElementInputSubmit($value));
460   }
461   function appendTextArea($name, $columns, $rows, $id = null, $value = null) {
462     return $this->appendChild($this->ownerDocument->createElementTextArea($name, $columns, $rows, $id, $value));
463   }
464   function appendElementSelect($name, $id = null, $options = array(), $default = null) {
465     return $this->appendChild($this->ownerDocument->createElementSelect($name, $id, $options, $default));
466   }
467   function appendElementOption($key, $desc, $selected = false) {
468     return $this->appendChild($this->ownerDocument->createElementOption($key, $desc, $selected));
469   }
470   function appendLabel($for_id, $value) {
471     return $this->appendChild($this->ownerDocument->createElementLabel($for_id, $value));
472   }
473   function appendText($text) {
474     return $this->appendChild($this->ownerDocument->createTextNode($text));
475   }
476   function appendHTMLMarkup($htmldata) {
477     $this->ownerDocument->appendHTMLMarkup($htmldata, $this);
478   }
479   function appendXMLMarkup($xmldata) {
480     $this->ownerDocument->appendXMLMarkup($xmldata, $this);
481   }
482   function appendJSElement($jsdata) {
483     $this->appendChild($this->ownerDocument->createElementJS($jsdata));
484   }
485   function appendCOMElement($module, $attributes) {
486     $this->appendChild($this->ownerDocument->createCOMElement($module, $attributes));
487   }
488 }
489
490 class ExtendedDocumentFragment extends DOMDocumentFragment {
491   // ExtendedDocumentFragment PHP class
492   // this extends the general PHP DOM Document Fragment class to simplify some usual constructs
493   //
494   // function appendElement($name, [$value])
495   //   appends a DOMDocument::createElement() as a child of this fragment (see there for params)
496   //     returns the new child
497   //
498   // function appendElementXML($name, $xmldata)
499   //   appends a DOMDocument::createElement() with the given name as a child of this fragment,
500   //   with an ExtendedDocument::createXMLFragment() of the given XML data inside
501   //     returns the new child
502   //
503   // function appendLink($target, [$value])
504   //   appends an ExtendedDocument::createElementLink() as a child of this fragment (see there for params)
505   //     returns the new child
506   //
507   // function appendFormDiv($action, $method, $name)
508   //   appends an ExtendedDocument::createElementForm() as a child of this fragment (see there for params)
509   //     returns an HTML <div> that is a child of the new child
510   //
511   // function appendInputHidden($name, $value)
512   //   appends an ExtendedDocument::createElementInputHidden() as a child of this fragment (see there for params)
513   //     returns the new child
514   //
515   // function appendInputText($name, $maxlength, $size, [$id], [$value])
516   //   appends an ExtendedDocument::createElementInputText() as a child of this fragment (see there for params)
517   //     returns the new child
518   //
519   // function appendInputRadio($name, $id, $value, $checked)
520   //   appends an ExtendedDocument::createElementInputRadio() as a child of this fragment (see there for params)
521   //     returns the new child
522   //
523   // function appendInputCheckbox($name, $id, $value, $checked)
524   //   appends an ExtendedDocument::createElementInputCheckbox() as a child of this fragment (see there for params)
525   //     returns the new child
526   //
527   // function appendInputSubmit($value)
528   //   appends an ExtendedDocument::createElementInputSubmit() as a child of this fragment (see there for params)
529   //     returns the new child
530   //
531   // function appendTextArea($name, $columns, $rows, [$id], [$value])
532   //   appends an ExtendedDocument::createElementTextArea() as a child of this fragment (see there for params)
533   //     returns the new child
534   //
535   // function appendElementSelect($name, [$id], [$options], [$default])
536   //   appends an ExtendedDocument::createElementSelect() as a child of this fragment (see there for params)
537   //     returns the new child
538   //
539   // function appendElementOption($key, $desc, [$selected])
540   //   appends an ExtendedDocument::createElementOption() as a child of this fragment (see there for params)
541   //     returns the new child
542   //
543   // function appendLabel($for_id, $value)
544   //   appends an ExtendedDocument::createElementLabel() as a child of this fragment (see there for params)
545   //     returns the new child
546   //
547   // function appendText($text)
548   //   appends a DOMDocument::createTextNode() as a child of this fragment (see there for params)
549   //     returns the new child
550   //
551   // function appendHTMLMarkup($htmldata)
552   //   appends a representation of the HTML data as children of this fragment
553   //     NO return value!
554   //
555   // function appendXMLMarkup($xmldata)
556   //   appends a representation of the XML data as children of this fragment
557   //     NO return value!
558   //
559   // function appendJSElement($jsdata)
560   //   appends an ExtendedDocument::createElementJS() as a child of this fragment (see there for params)
561   //     NO return value!
562   //
563   // function appendCOMElement($module, $attributes)
564   //   appends an ExtendedDocument::createCOMElement() as a child of this fragment (see there for params)
565   //     returns the new child
566
567   function appendElement($name, $value = '') {
568     return $this->appendChild($this->ownerDocument->createElement($name, $value));
569   }
570   function appendElementXML($name, $xmldata) {
571     $aelem = $this->appendChild($this->ownerDocument->createElement($name));
572     $aelem->appendXMLMarkup($xmldata);
573     return $aelem;
574   }
575   function appendLink($target, $value = '') {
576     return $this->appendChild($this->ownerDocument->createElementLink($target, $value));
577   }
578   function appendFormDiv($action, $method, $name) {
579     $formelem = $this->appendChild($this->ownerDocument->createElementForm($action, $method, $name));
580     return $formelem->appendElement('div');
581   }
582   function appendInputHidden($name, $value) {
583     return $this->appendChild($this->ownerDocument->createElementInputHidden($name, $value));
584   }
585   function appendInputText($name, $maxlength, $size, $id = null, $value = null) {
586     return $this->appendChild($this->ownerDocument->createElementInputText($name, $maxlength, $size, $id, $value));
587   }
588   function appendInputRadio($name, $id, $value, $checked) {
589     return $this->appendChild($this->ownerDocument->createElementInputRadio($name, $id, $value, $checked));
590   }
591   function appendInputCheckbox($name, $id, $value, $checked) {
592     return $this->appendChild($this->ownerDocument->createElementInputCheckbox($name, $id, $value, $checked));
593   }
594   function appendInputSubmit($value) {
595     return $this->appendChild($this->ownerDocument->createElementInputSubmit($value));
596   }
597   function appendTextArea($name, $columns, $rows, $id = null, $value = null) {
598     return $this->appendChild($this->ownerDocument->createElementTextArea($name, $columns, $rows, $id, $value));
599   }
600   function appendElementSelect($name, $id = null, $options = array(), $default = null) {
601     return $this->appendChild($this->ownerDocument->createElementSelect($name, $id, $options, $default));
602   }
603   function appendElementOption($key, $desc, $selected = false) {
604     return $this->appendChild($this->ownerDocument->createElementOption($key, $desc, $selected));
605   }
606   function appendLabel($for_id, $value) {
607     return $this->appendChild($this->ownerDocument->createElementLabel($for_id, $value));
608   }
609   function appendText($text) {
610     return $this->appendChild($this->ownerDocument->createTextNode($text));
611   }
612   function appendHTMLMarkup($htmldata) {
613     $this->ownerDocument->appendHTMLMarkup($htmldata, $this);
614   }
615   function appendXMLMarkup($xmldata) {
616     $this->ownerDocument->appendXMLMarkup($xmldata, $this);
617   }
618   function appendJSElement($jsdata) {
619     $this->appendChild($this->ownerDocument->createElementJS($jsdata));
620   }
621   function appendCOMElement($module, $attributes) {
622     $this->appendChild($this->ownerDocument->createCOMElement($module, $attributes));
623   }
624 }
625 ?>