4 |
## $Id$ |
## $Id$ |
5 |
## ----------------------------------------------------------------------------- |
## ----------------------------------------------------------------------------- |
6 |
## $Log$ |
## $Log$ |
7 |
|
## Revision 1.3 2003/04/04 23:58:02 jonen |
8 |
|
## + saving of items sould now work with new 'GenericSource' structure |
9 |
|
## |
10 |
## Revision 1.2 2003/04/04 00:43:22 jonen |
## Revision 1.2 2003/04/04 00:43:22 jonen |
11 |
## + complete rework |
## + complete rework |
12 |
## |
## |
213 |
$td = new TDtag(array("colspan" => 2, |
$td = new TDtag(array("colspan" => 2, |
214 |
"class" => "contentnovertical", |
"class" => "contentnovertical", |
215 |
"align" => "center"), |
"align" => "center"), |
216 |
form_submit('ecfedit', "Confirm"), |
form_submit('ecdfe', "Confirm"), |
217 |
_HTML_SPACE, |
_HTML_SPACE, |
218 |
$this->add_action("Edit")); |
$this->add_action("Edit")); |
219 |
|
|
238 |
function confirm_action() { |
function confirm_action() { |
239 |
|
|
240 |
foreach($this->_datasource->_result as $label => $value_old) { |
foreach($this->_datasource->_result as $label => $value_old) { |
|
print $label . "<br>"; |
|
241 |
if(!$this->decode_item_expr($value_old) && !$this->decode_item_array($value_old)) { |
if(!$this->decode_item_expr($value_old) && !$this->decode_item_array($value_old)) { |
242 |
$value_new = $this->_elements[$label]->get_value(); |
$value_new = $this->_elements[$label]->get_value(); |
243 |
$data[$label] = $value_new; |
$data[$label] = $value_new; |
244 |
} |
} |
245 |
} |
} |
246 |
|
// write new data to datasource |
247 |
$this->_options['data_locator_meta']['action'] = "write"; |
$this->_options['data_locator_meta']['action'] = "write"; |
248 |
$this->_options['data_locator_meta']['data'] = $data; |
$this->_options['data_locator_meta']['data'] = $data; |
249 |
|
// TODO: 'data_prefetch()' will never return ANYTHING! |
250 |
|
// Implement some error-handling there or somewhere. |
251 |
$error = $this->data_prefetch(); |
$error = $this->data_prefetch(); |
252 |
|
|
253 |
//$error = $this->_datasource->set($item); |
//$error = $this->_datasource->set($item); |
254 |
if(!$error) { |
if(!$error) { |
255 |
|
// fetch fresh data |
256 |
|
$this->_options['data_locator_meta']['action'] = "read"; |
257 |
|
// unset previous initialed 'data' var |
258 |
|
$this->_options['data_locator_meta']['data'] = NULL; |
259 |
|
$this->data_prefetch(); |
260 |
|
|
261 |
$this->set_action_message($this->_confirm_msg); |
$this->set_action_message($this->_confirm_msg); |
262 |
return TRUE; |
return TRUE; |
263 |
} else { |
} else { |
275 |
$div = new DIVtag( array("style" => "background-color: #eeeeee;". |
$div = new DIVtag( array("style" => "background-color: #eeeeee;". |
276 |
"padding-top:5px;padding-bottom:5px", |
"padding-top:5px;padding-bottom:5px", |
277 |
"align"=>"center", "nowrap"), |
"align"=>"center", "nowrap"), |
278 |
form_submit('ecfedit', "Save"), |
form_submit('ecdfe', "Save"), |
279 |
_HTML_SPACE, |
_HTML_SPACE, |
280 |
$this->add_cancel() ); |
//$this->add_cancel() |
281 |
|
form_submit('ecdfc', "Cancel") |
282 |
|
); |
283 |
return $div; |
return $div; |
284 |
} |
} |
285 |
|
|