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

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

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

revision 1.3 by joko, Fri Apr 4 21:26:06 2003 UTC revision 1.4 by jonen, Sun Apr 6 01:41:07 2003 UTC
# Line 4  Line 4 
4  ##    $Id$  ##    $Id$
5  ##    -----------------------------------------------------------------------------  ##    -----------------------------------------------------------------------------
6  ##    $Log$  ##    $Log$
7    ##    Revision 1.4  2003/04/06 01:41:07  jonen
8    ##    - removed duplicated decode functions
9    ##
10  ##    Revision 1.3  2003/04/04 21:26:06  joko  ##    Revision 1.3  2003/04/04 21:26:06  joko
11  ##    added comments regarding possible (future) refactoring using the Data::Lift-infrastructure  ##    added comments regarding possible (future) refactoring using the Data::Lift-infrastructure
12  ##  ##
# Line 212  class GenericGUIDataList extends Default Line 215  class GenericGUIDataList extends Default
215                        
216            */            */
217    
218              $utils = php::mkComponent('WebExplorer::utils');
219              $hidden = $this->_hidden_elements;
220              $options = $this->_options['decode_args'];
221              
222            // 1. if item is match by expression we will replace it with an link object              // 1. if item is match by expression we will replace it with an link object  
223            if ($this->decode_item_expr($obj)) {              if ($utils->decode_item_expr($obj, $hidden, $options)) {  
224              $obj = $this->decode_item_expr($obj);                $obj = $utils->decode_item_expr($obj, $hidden, $options);  
225            }            }
226    
227            // 2. if item is an Array we will replace it with an selection form object              // 2. if item is an Array we will replace it with an selection form object  
228            elseif ( $this->decode_item_array($obj) ) {            elseif ( $utils->decode_item_array($obj, $hidden, $options) ) {
229              $obj = $this->decode_item_array($obj);                $obj = $utils->decode_item_array($obj, $hidden, $options);  
230            }            }
231    
232          }          }
# Line 254  class GenericGUIDataList extends Default Line 260  class GenericGUIDataList extends Default
260      }      }
261    
262    
   // TODO: refactor to Data::Lift - subcomponent: handling will get way more easy!  
   function decode_item_array($item) {  
     $options = $this->_options['decode_args'];  
     //print "item: " . Dumper($item);  
     //print "options: " . Dumper($options);  
     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 {  
           //print "<b>2</b><br/>";  
           $container = container();  
           foreach($item as $key => $value) {  
                 $tmp = split($options['seperator'], $value);  
                 $ident = $tmp['1'];  
                 $meta = $tmp['2'];  
                      foreach($this->_hidden_elements as $label => $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;  
     }  
   }  
263    
   // decodes serialized string representations of object-references  
   // TODO: refactor to Data::Lift - subcomponent: handling will get way more easy!  
   function decode_item_expr($item) {  
     $options = $this->_options['decode_args'];  
     //print "item: $item<br/>";  
     if(substr($item, 0, 2) == "o_") {  
           $tmp = split($options['seperator'], $item);  
           $ident = $tmp['1'];  
           $meta = $tmp['2'];  
           foreach($this->_hidden_elements as $label => $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;  
     }  
   }  
264    
265  }  }
266  ?>  ?>

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

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