summaryrefslogtreecommitdiff
path: root/inc/form.php
diff options
context:
space:
mode:
Diffstat (limited to 'inc/form.php')
-rw-r--r--inc/form.php26
1 files changed, 15 insertions, 11 deletions
diff --git a/inc/form.php b/inc/form.php
index bdf520a2e..25c65bd55 100644
--- a/inc/form.php
+++ b/inc/form.php
@@ -176,7 +176,7 @@ class Doku_Form {
* Gets the position of the first of a type of element.
*
* @param string $type Element type to look for.
- * @return array pseudo-element if found, false otherwise
+ * @return int position of element if found, otherwise false
* @author Tom N Harris <tnharris@whoopdedo.org>
*/
function findElementByType($type) {
@@ -193,7 +193,7 @@ class Doku_Form {
* Gets the position of the element with an ID attribute.
*
* @param string $id ID of the element to find.
- * @return array pseudo-element if found, false otherwise
+ * @return int position of element if found, otherwise false
* @author Tom N Harris <tnharris@whoopdedo.org>
*/
function findElementById($id) {
@@ -211,7 +211,7 @@ class Doku_Form {
*
* @param string $name Attribute name.
* @param string $value Attribute value.
- * @return array pseudo-element if found, false otherwise
+ * @return int position of element if found, otherwise false
* @author Tom N Harris <tnharris@whoopdedo.org>
*/
function findElementByAttribute($name, $value) {
@@ -565,10 +565,11 @@ function form_makeListboxField($name, $values, $selected='', $label=null, $id=''
if (is_null($label)) $label = $name;
$options = array();
reset($values);
- if (is_null($selected) || $selected == '')
+ if (is_null($selected) || $selected == '') {
$selected = array();
- elseif (!is_array($selected))
+ } elseif (!is_array($selected)) {
$selected = array($selected);
+ }
// FIXME: php doesn't know the difference between a string and an integer
if (is_string(key($values))) {
foreach ($values as $val=>$text) {
@@ -576,11 +577,13 @@ function form_makeListboxField($name, $values, $selected='', $label=null, $id=''
}
} else {
foreach ($values as $val) {
- if (is_array($val))
- @list($val,$text) = $val;
- else
+ $disabled = false;
+ if (is_array($val)) {
+ @list($val,$text,$disabled) = $val;
+ } else {
$text = null;
- $options[] = array($val,$text,in_array($val,$selected));
+ }
+ $options[] = array($val,$text,in_array($val,$selected),$disabled);
}
}
$elem = array('_elem'=>'listboxfield', '_options'=>$options, '_text'=>$label, '_class'=>$class,
@@ -680,7 +683,7 @@ function form_wikitext($attrs) {
// mandatory attributes
unset($attrs['name']);
unset($attrs['id']);
- return '<textarea name="wikitext" id="wiki__text" '
+ return '<textarea name="wikitext" id="wiki__text" dir="auto" '
.buildAttributes($attrs,true).'>'.DOKU_LF
.formText($attrs['_text'])
.'</textarea>';
@@ -934,11 +937,12 @@ function form_listboxfield($attrs) {
$s .= '<select '.buildAttributes($attrs,true).'>'.DOKU_LF;
if (!empty($attrs['_options'])) {
foreach ($attrs['_options'] as $opt) {
- @list($value,$text,$select) = $opt;
+ @list($value,$text,$select,$disabled) = $opt;
$p = '';
if(is_null($text)) $text = $value;
$p .= ' value="'.formText($value).'"';
if (!empty($select)) $p .= ' selected="selected"';
+ if ($disabled) $p .= ' disabled="disabled"';
$s .= '<option'.$p.'>'.formText($text).'</option>';
}
} else {