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

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

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

revision 1.3 by jonen, Sun Apr 6 01:40:35 2003 UTC revision 1.6 by joko, Tue May 13 16:24:30 2003 UTC
# Line 4  Line 4 
4  ##    $Id$  ##    $Id$
5  ##    -----------------------------------------------------------------------------  ##    -----------------------------------------------------------------------------
6  ##    $Log$  ##    $Log$
7    ##    Revision 1.6  2003/05/13 16:24:30  joko
8    ##    title addendum
9    ##    MetaBox - header style
10    ##
11    ##    Revision 1.5  2003/05/10 18:07:31  jonen
12    ##    + added values needed for 'create/add new' links
13    ##    - purged depreciated code
14    ##
15    ##    Revision 1.4  2003/04/09 09:53:13  joko
16    ##    fixes regarding modification of decode-function-behavior
17    ##
18  ##    Revision 1.3  2003/04/06 01:40:35  jonen  ##    Revision 1.3  2003/04/06 01:40:35  jonen
19  ##    + removed duplicated decode functions  ##    + removed duplicated decode functions
20  ##  ##
# Line 38  class DataItem extends InfoTable { Line 49  class DataItem extends InfoTable {
49    function DataItem($title, $options = array()) {    function DataItem($title, $options = array()) {
50      $this->_options = $options;      $this->_options = $options;
51    
52        //print "title: $title<br/>";
53        //print Dumper($options);
54    
55        $title .= $this->get_title_addendum();
56    
57      $parent =  get_parent_class($this);      $parent =  get_parent_class($this);
58      $this->$parent($title, $width="100%", "center");      $this->$parent($title, $width="100%", "center");
59    
# Line 112  class DataItem extends InfoTable { Line 128  class DataItem extends InfoTable {
128     $result = $this->_datasource->_result;     $result = $this->_datasource->_result;
129      if (is_array($result)) {      if (is_array($result)) {
130        foreach($result as $key => $value) {        foreach($result as $key => $value) {
131          if(!$value) { $value = _HTML_SPACE; }          // set empty values to 'html spacer' for render
132          // if item is match by expression we will replace it with an link object            // TODO: integer value '0' is interpretted as non-existing value! Hack this!!
133            if(!$value && !is_array($value)) { $value = _HTML_SPACE; }
134            // if decode options are true, trie to decode values(e.g. for inhiterance)
135          if($this->_options['decode']) {          if($this->_options['decode']) {
136           $utils = php::mkComponent('WebExplorer::utils');            $utils = php::mkComponent('WebExplorer::utils');
137           $hidden = $this->_hidden_elements;            $hidden = $this->_hidden_elements;
138           $options = $this->_options['decode_args'];            $options = $this->_options['decode_args'];
139           if($utils->decode_item_expr($value, $hidden, $options)) {              $options[label] = $key;
140            $this->add_element($key, $utils->decode_item_expr($value, $hidden, $options));              $options[parent_guid] = $this->_options['parent']['guid'];
141            }              $options[parent_class] = $this->_options['parent']['class'];
142            // if item is an Array we will replace it with an selection form object              // if item is matched by a special expression we will replace it with an html-link object  
143            elseif($utils->decode_item_array($value, $hidden, $options) ) {            $utils->decode_item_expr($value, $hidden, $options);
144              $this->add_element($key, $utils->decode_item_array($value, $hidden, $options));            // if item is an Array we will replace it with an html-link object  
145            } else {            $utils->decode_item_array($value, $hidden, $options);
146              $this->add_element($key, $value);            $this->add_element($key, $value);
           }  
147          } else {          } else {
148            $this->add_element($key, $value);            $this->add_element($key, $value);
149          }          }
# Line 162  class DataItem extends InfoTable { Line 179  class DataItem extends InfoTable {
179    }    }
180    
181    
182      // Please visit WebExplorer::Module::DataItem - there is a similar chooser at the top!!!
183      // TODO: abstract this out into some reusable, generic component sometimes (SimpleChooser?)
184      // (also take a look at WebExplorer::Module::DataTree)
185      function get_title_addendum() {
186        
187        // MetaBox / Chooser - resolve / display some links which probably have been declared in some other layer
188        //$this->header = html_span();
189    
190        // Build a header-style MetaBox.
191        // This will get injected into the header of the DataItem.
192        $this->header_box = php::mkComponent('MetaBox', array(
193          box_mode => 'header',
194          caption => $this->_options['caption'],
195          payload => $this->_options['links'],
196        ) );
197    
198        return $this->header_box->render();
199        
200      }
201    
202  }  }
203    
204    

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

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