4 |
## $Id$ |
## $Id$ |
5 |
## ----------------------------------------------------------------------------- |
## ----------------------------------------------------------------------------- |
6 |
## $Log$ |
## $Log$ |
7 |
|
## Revision 1.4 2003/04/09 09:53:13 joko |
8 |
|
## fixes regarding modification of decode-function-behavior |
9 |
|
## |
10 |
|
## Revision 1.3 2003/04/06 01:40:35 jonen |
11 |
|
## + removed duplicated decode functions |
12 |
|
## |
13 |
|
## Revision 1.2 2003/04/04 23:58:33 jonen |
14 |
|
## + minor changes |
15 |
|
## |
16 |
## Revision 1.1 2003/04/04 00:32:57 jonen |
## Revision 1.1 2003/04/04 00:32:57 jonen |
17 |
## + initial commit |
## + initial commit |
18 |
## |
## |
115 |
$result = $this->_datasource->_result; |
$result = $this->_datasource->_result; |
116 |
if (is_array($result)) { |
if (is_array($result)) { |
117 |
foreach($result as $key => $value) { |
foreach($result as $key => $value) { |
118 |
if(!$value) { $value = " "; } |
if(!$value) { $value = _HTML_SPACE; } |
119 |
// if item is match by expression we will replace it with an link object |
// if item is match by expression we will replace it with an link object |
120 |
if($this->_options['decode']) { |
if($this->_options['decode']) { |
121 |
if($this->decode_item_expr($value)) { |
$utils = php::mkComponent('WebExplorer::utils'); |
122 |
$this->add_element($key, $this->decode_item_expr($value)); |
$hidden = $this->_hidden_elements; |
123 |
|
$options = $this->_options['decode_args']; |
124 |
|
|
125 |
|
/* |
126 |
|
if($utils->decode_item_expr($value, $hidden, $options)) { |
127 |
|
$this->add_element($key, $utils->decode_item_expr($value, $hidden, $options)); |
128 |
} |
} |
129 |
// if item is an Array we will replace it with an selection form object |
elseif($utils->decode_item_array($value, $hidden, $options) ) { |
130 |
elseif($this->decode_item_array($value) ) { |
$this->add_element($key, $utils->decode_item_array($value, $hidden, $options)); |
|
$this->add_element($key, $this->decode_item_array($value)); |
|
131 |
} else { |
} else { |
132 |
$this->add_element($key, $value); |
$this->add_element($key, $value); |
133 |
} |
} |
134 |
|
*/ |
135 |
|
|
136 |
|
$utils->decode_item_expr($value, $hidden, $options); |
137 |
|
// if item is an Array we will replace it with an selection form object |
138 |
|
$utils->decode_item_array($value, $hidden, $options); |
139 |
|
$this->add_element($key, $value); |
140 |
|
|
141 |
} else { |
} else { |
142 |
$this->add_element($key, $value); |
$this->add_element($key, $value); |
143 |
} |
} |
144 |
|
|
145 |
|
|
146 |
} |
} |
147 |
} |
} |
148 |
} |
} |
166 |
} |
} |
167 |
} |
} |
168 |
// submit button |
// submit button |
169 |
$container->add(form_submit('ecfedit', "edit")); |
$container->add(form_submit('ecdfe', "edit")); |
170 |
// close form |
// close form |
171 |
$container->add(form_close()); |
$container->add(form_close()); |
172 |
|
|
173 |
// add container to InfoTable |
// add container to InfoTable |
174 |
$this->add_row(" ", $container); |
$this->add_row(_HTML_SPACE, $container); |
|
} |
|
|
|
|
|
function decode_item_array($item) { |
|
|
$options = $this->_options['decode_args']; |
|
|
if( is_array($item) ) { |
|
|
//$cur_row_index = $this->_datasource->get_cur_data_index(); |
|
|
//$parent_guid = $this->_datasource->_data[$cur_row_index]['guid']; |
|
|
// build list for selection form |
|
|
if($options['form']) { |
|
|
foreach($item as $key => $value) { |
|
|
$tmp = split($options['seperator'], $value); |
|
|
$ident = $tmp['1']; |
|
|
$meta = $tmp['2']; |
|
|
$list[$key] = $ident; |
|
|
} |
|
|
if(is_array($list) ) { |
|
|
$container = container( |
|
|
form_open( $item[0], $_SERVER["PHP_SELF"], "POST" ), |
|
|
form_hidden("ecdm", $meta), |
|
|
form_select("ecdid", $list), |
|
|
form_submit("submit","view" ) |
|
|
); |
|
|
foreach($this->_hidden_elements as $label => $value) { |
|
|
$container->add(form_hidden($label, $value)); |
|
|
} |
|
|
$container->add(form_close() ); |
|
|
$item = $container; |
|
|
} |
|
|
} else { |
|
|
$container = container(); |
|
|
foreach($item as $key => $value) { |
|
|
$tmp = split($options['seperator'], $value); |
|
|
$ident = $tmp['1']; |
|
|
$meta = $tmp['2']; |
|
|
foreach($this->_hidden_elements as $label => $value) { |
|
|
$tmp_array[] = $label . "=" . $value; |
|
|
} |
|
|
$str_hidden = join("&", $tmp_array); |
|
|
$container->add("->", html_a($_SERVER["PHP_SELF"] . "?ecdid=" . $ident . "&ecdm=" . $meta . "&" . $str_hidden, $key . " view"), html_br()); |
|
|
} |
|
|
$item = $container; |
|
|
} |
|
|
return $item; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
function decode_item_expr($item, $options=array()) { |
|
|
$options = $this->_options['decode_args']; |
|
|
if(substr($item, 0, 2) == "o_") { |
|
|
$tmp = split($options['seperator'], $item); |
|
|
$ident = $tmp['1']; |
|
|
$meta = $tmp['2']; |
|
|
foreach($this->_hidden_elements as $label => $value) { |
|
|
$tmp_array[] = $label . "=" . $value; |
|
|
} |
|
|
$str_hidden = join("&", $tmp_array); |
|
|
$item = html_a($_SERVER["PHP_SELF"] . "?ecdid=" . $ident . "&ecdm=" . $meta . "&" . $str_hidden, "view"); |
|
|
return $item; |
|
|
} |
|
175 |
} |
} |
176 |
|
|
177 |
|
|