4 |
## $Id$ |
## $Id$ |
5 |
## ----------------------------------------------------------------------------- |
## ----------------------------------------------------------------------------- |
6 |
## $Log$ |
## $Log$ |
7 |
|
## Revision 1.5 2003/04/09 09:59:30 joko |
8 |
|
## fixes regarding modification of decode-function-behavior |
9 |
|
## |
10 |
|
## Revision 1.4 2003/04/06 01:41:33 jonen |
11 |
|
## - removed duplicated decode functions |
12 |
|
## |
13 |
## Revision 1.3 2003/04/04 23:58:02 jonen |
## Revision 1.3 2003/04/04 23:58:02 jonen |
14 |
## + saving of items sould now work with new 'GenericSource' structure |
## + saving of items sould now work with new 'GenericSource' structure |
15 |
## |
## |
104 |
//we want an confirmation page for this form. |
//we want an confirmation page for this form. |
105 |
$this->set_confirm(); |
$this->set_confirm(); |
106 |
|
|
107 |
|
$utils = php::mkComponent('WebExplorer::utils'); |
108 |
|
$hidden = $this->get_hidden_elements(); |
109 |
|
$options = $this->_options['decode_args']; |
110 |
|
|
111 |
foreach($this->_datasource->_result as $key => $value) { |
foreach($this->_datasource->_result as $key => $value) { |
112 |
if($value) { |
if($value) { |
113 |
$validation = TRUE; |
$validation = TRUE; |
114 |
} else { |
} else { |
115 |
$validation = FALSE; |
$validation = FALSE; |
116 |
} |
} |
117 |
if(!$this->decode_item_expr($value, $this->_options) && !$this->decode_item_array($value, $this->_options)) { |
if(!$utils->decode_item_expr($value, $hidden, $options) && !$utils->decode_item_array($value, $hidden, $options)) { |
118 |
$this->add_element( new FEText($key, $validation, "350px") ); |
$this->add_element( new FEText($key, $validation, "350px") ); |
119 |
} |
} |
120 |
} |
} |
132 |
//and set the initial values of some of the |
//and set the initial values of some of the |
133 |
//form fields. |
//form fields. |
134 |
|
|
135 |
|
$utils = php::mkComponent('WebExplorer::utils'); |
136 |
|
$hidden = $this->get_hidden_elements(); |
137 |
|
$options = $this->_options['decode_args']; |
138 |
|
|
139 |
foreach($this->_datasource->_result as $key => $value) { |
foreach($this->_datasource->_result as $key => $value) { |
140 |
if(!$this->decode_item_expr($value, $this->_options) && !$this->decode_item_array($value, $this->_options)) { |
if(!$utils->decode_item_expr($value, $hidden, $options) && !$utils->decode_item_array($value, $hidden, $options)) { |
141 |
$this->set_element_value($key, $value); |
$this->set_element_value($key, $value); |
142 |
} |
} |
143 |
} |
} |
162 |
foreach($this->_datasource->_result as $key => $value) { |
foreach($this->_datasource->_result as $key => $value) { |
163 |
// 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 |
164 |
if($this->_options['decode']) { |
if($this->_options['decode']) { |
165 |
if($this->decode_item_expr($value)) { |
$utils = php::mkComponent('WebExplorer::utils'); |
166 |
$table->add_row($key, $this->decode_item_expr($value)); |
$hidden = $this->get_hidden_elements(); |
167 |
|
$options = $this->_options['decode_args']; |
168 |
|
if($utils->decode_item_expr($value, $hidden, $options)) { |
169 |
|
$table->add_row($key, $value); |
170 |
} |
} |
171 |
// if item is an Array we will replace it with an selection form object |
// if item is an Array we will replace it with an selection form object |
172 |
elseif($this->decode_item_array($value) ) { |
elseif($utils->decode_item_array($value, $hidden, $options) ) { |
173 |
$table->add_row($key, $this->decode_item_array($value)); |
$table->add_row($key, $value); |
174 |
} else { |
} else { |
175 |
$table->add_row($this->element_label($key), $this->element_form($key)); |
$table->add_row($this->element_label($key), $this->element_form($key)); |
176 |
} |
} |
254 |
*/ |
*/ |
255 |
function confirm_action() { |
function confirm_action() { |
256 |
|
|
257 |
|
$utils = php::mkComponent('WebExplorer::utils'); |
258 |
|
$hidden = $this->get_hidden_elements(); |
259 |
|
$options = $this->_options['decode_args']; |
260 |
|
|
261 |
foreach($this->_datasource->_result as $label => $value_old) { |
foreach($this->_datasource->_result as $label => $value_old) { |
262 |
if(!$this->decode_item_expr($value_old) && !$this->decode_item_array($value_old)) { |
if(!$utils->decode_item_expr($value_old, $hidden, $options) && !$utils->decode_item_array($value_old, $hidden, $options)) { |
263 |
$value_new = $this->_elements[$label]->get_value(); |
$value_new = $this->_elements[$label]->get_value(); |
264 |
$data[$label] = $value_new; |
$data[$label] = $value_new; |
265 |
} |
} |
305 |
} |
} |
306 |
|
|
307 |
|
|
308 |
|
function get_hidden_elements() { |
309 |
|
foreach($this->_hidden_elements as $label => $object) { |
310 |
function decode_item_array($item) { |
$value = $this->_hidden_elements[$label]->get_value(); |
311 |
$options = $this->_options['decode_args']; |
$tmp_array[$label] = $value; |
|
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 => $object) { |
|
|
$value = $this->_hidden_elements[$label]->get_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 = $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 => $object) { |
|
|
$value = $this->_hidden_elements[$label]->get_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; |
|
312 |
} |
} |
313 |
|
return $tmp_array; |
314 |
} |
} |
315 |
|
|
|
|
|
316 |
} |
} |
317 |
|
|
318 |
|
|