4 |
## $Id$ |
## $Id$ |
5 |
## ----------------------------------------------------------------------------- |
## ----------------------------------------------------------------------------- |
6 |
## $Log$ |
## $Log$ |
7 |
|
## Revision 1.6 2003/04/11 00:48:03 joko |
8 |
|
## minor fix: calling parent constructor explicitely by name now, transparency seems not be automagically compatible with inheritance in php ,-) (non-orthogonal) |
9 |
|
## |
10 |
|
## Revision 1.5 2003/04/09 09:59:30 joko |
11 |
|
## fixes regarding modification of decode-function-behavior |
12 |
|
## |
13 |
|
## Revision 1.4 2003/04/06 01:41:33 jonen |
14 |
|
## - removed duplicated decode functions |
15 |
|
## |
16 |
## Revision 1.3 2003/04/04 23:58:02 jonen |
## Revision 1.3 2003/04/04 23:58:02 jonen |
17 |
## + saving of items sould now work with new 'GenericSource' structure |
## + saving of items sould now work with new 'GenericSource' structure |
18 |
## |
## |
68 |
// prefetch data |
// prefetch data |
69 |
$this->data_prefetch(); |
$this->data_prefetch(); |
70 |
|
|
71 |
$parent = get_parent_class($this); |
// doesn't work if EditDataItem gets inherited |
72 |
$this->$parent($title, $PHP_SELF, 600); |
//$parent = get_parent_class($this); |
73 |
|
//$this->$parent($title, $PHP_SELF, 600); |
74 |
|
|
75 |
|
$this->StandardFormContent($title, $PHP_SELF, 600); |
76 |
|
|
77 |
} |
} |
78 |
|
|
79 |
function set_data_source(&$source) { |
function set_data_source(&$source) { |
111 |
//we want an confirmation page for this form. |
//we want an confirmation page for this form. |
112 |
$this->set_confirm(); |
$this->set_confirm(); |
113 |
|
|
114 |
|
$utils = php::mkComponent('WebExplorer::utils'); |
115 |
|
$hidden = $this->get_hidden_elements(); |
116 |
|
$options = $this->_options['decode_args']; |
117 |
|
|
118 |
foreach($this->_datasource->_result as $key => $value) { |
foreach($this->_datasource->_result as $key => $value) { |
119 |
if($value) { |
if($value) { |
120 |
$validation = TRUE; |
$validation = TRUE; |
121 |
} else { |
} else { |
122 |
$validation = FALSE; |
$validation = FALSE; |
123 |
} |
} |
124 |
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)) { |
125 |
$this->add_element( new FEText($key, $validation, "350px") ); |
$this->add_element( new FEText($key, $validation, "350px") ); |
126 |
} |
} |
127 |
} |
} |
139 |
//and set the initial values of some of the |
//and set the initial values of some of the |
140 |
//form fields. |
//form fields. |
141 |
|
|
142 |
|
$utils = php::mkComponent('WebExplorer::utils'); |
143 |
|
$hidden = $this->get_hidden_elements(); |
144 |
|
$options = $this->_options['decode_args']; |
145 |
|
|
146 |
foreach($this->_datasource->_result as $key => $value) { |
foreach($this->_datasource->_result as $key => $value) { |
147 |
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)) { |
148 |
$this->set_element_value($key, $value); |
$this->set_element_value($key, $value); |
149 |
} |
} |
150 |
} |
} |
169 |
foreach($this->_datasource->_result as $key => $value) { |
foreach($this->_datasource->_result as $key => $value) { |
170 |
// 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 |
171 |
if($this->_options['decode']) { |
if($this->_options['decode']) { |
172 |
if($this->decode_item_expr($value)) { |
$utils = php::mkComponent('WebExplorer::utils'); |
173 |
$table->add_row($key, $this->decode_item_expr($value)); |
$hidden = $this->get_hidden_elements(); |
174 |
|
$options = $this->_options['decode_args']; |
175 |
|
if($utils->decode_item_expr($value, $hidden, $options)) { |
176 |
|
$table->add_row($key, $value); |
177 |
} |
} |
178 |
// 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 |
179 |
elseif($this->decode_item_array($value) ) { |
elseif($utils->decode_item_array($value, $hidden, $options) ) { |
180 |
$table->add_row($key, $this->decode_item_array($value)); |
$table->add_row($key, $value); |
181 |
} else { |
} else { |
182 |
$table->add_row($this->element_label($key), $this->element_form($key)); |
$table->add_row($this->element_label($key), $this->element_form($key)); |
183 |
} |
} |
261 |
*/ |
*/ |
262 |
function confirm_action() { |
function confirm_action() { |
263 |
|
|
264 |
|
$utils = php::mkComponent('WebExplorer::utils'); |
265 |
|
$hidden = $this->get_hidden_elements(); |
266 |
|
$options = $this->_options['decode_args']; |
267 |
|
|
268 |
foreach($this->_datasource->_result as $label => $value_old) { |
foreach($this->_datasource->_result as $label => $value_old) { |
269 |
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)) { |
270 |
$value_new = $this->_elements[$label]->get_value(); |
$value_new = $this->_elements[$label]->get_value(); |
271 |
$data[$label] = $value_new; |
$data[$label] = $value_new; |
272 |
} |
} |
312 |
} |
} |
313 |
|
|
314 |
|
|
315 |
|
function get_hidden_elements() { |
316 |
|
foreach($this->_hidden_elements as $label => $object) { |
317 |
function decode_item_array($item) { |
$value = $this->_hidden_elements[$label]->get_value(); |
318 |
$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; |
|
319 |
} |
} |
320 |
|
return $tmp_array; |
321 |
} |
} |
322 |
|
|
|
|
|
323 |
} |
} |
324 |
|
|
325 |
|
|