/[cvs]/nfo/php/libs/org.netfrag.patches/phphtmllib/widgets/EditDataItem.php
ViewVC logotype

Diff of /nfo/php/libs/org.netfrag.patches/phphtmllib/widgets/EditDataItem.php

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.2 by jonen, Fri Apr 4 00:43:22 2003 UTC revision 1.3 by jonen, Fri Apr 4 23:58:02 2003 UTC
# Line 4  Line 4 
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  ##  ##
# Line 210  class EditDataItem extends StandardFormC Line 213  class EditDataItem extends StandardFormC
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    
# Line 235  class EditDataItem extends StandardFormC Line 238  class EditDataItem extends StandardFormC
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 {
# Line 264  class EditDataItem extends StandardFormC Line 275  class EditDataItem extends StandardFormC
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    

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.3

MailToCvsAdmin">MailToCvsAdmin
ViewVC Help
Powered by ViewVC 1.1.26 RSS 2.0 feed