--- nfo/php/libs/org.netfrag.patches/phphtmllib/widgets/EditDataItem.php 2003/04/04 00:43:22 1.2 +++ nfo/php/libs/org.netfrag.patches/phphtmllib/widgets/EditDataItem.php 2003/04/04 23:58:02 1.3 @@ -1,9 +1,12 @@ 2, "class" => "contentnovertical", "align" => "center"), - form_submit('ecfedit', "Confirm"), + form_submit('ecdfe', "Confirm"), _HTML_SPACE, $this->add_action("Edit")); @@ -235,18 +238,26 @@ function confirm_action() { foreach($this->_datasource->_result as $label => $value_old) { - print $label . "
"; if(!$this->decode_item_expr($value_old) && !$this->decode_item_array($value_old)) { $value_new = $this->_elements[$label]->get_value(); $data[$label] = $value_new; } } + // write new data to datasource $this->_options['data_locator_meta']['action'] = "write"; $this->_options['data_locator_meta']['data'] = $data; + // TODO: 'data_prefetch()' will never return ANYTHING! + // Implement some error-handling there or somewhere. $error = $this->data_prefetch(); - + //$error = $this->_datasource->set($item); if(!$error) { + // fetch fresh data + $this->_options['data_locator_meta']['action'] = "read"; + // unset previous initialed 'data' var + $this->_options['data_locator_meta']['data'] = NULL; + $this->data_prefetch(); + $this->set_action_message($this->_confirm_msg); return TRUE; } else { @@ -264,9 +275,11 @@ $div = new DIVtag( array("style" => "background-color: #eeeeee;". "padding-top:5px;padding-bottom:5px", "align"=>"center", "nowrap"), - form_submit('ecfedit', "Save"), + form_submit('ecdfe', "Save"), _HTML_SPACE, - $this->add_cancel() ); + //$this->add_cancel() + form_submit('ecdfc', "Cancel") + ); return $div; }