/[cvs]/nfo/php/libs/org.netfrag.app/WebExplorer/utils.php
ViewVC logotype

Diff of /nfo/php/libs/org.netfrag.app/WebExplorer/utils.php

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

revision 1.5 by jonen, Fri Apr 18 13:38:40 2003 UTC revision 1.8 by jonen, Sun Dec 14 01:52:26 2003 UTC
# Line 4  Line 4 
4   * $Id$   * $Id$
5   *   *
6   * $Log$   * $Log$
7     * Revision 1.8  2003/12/14 01:52:26  jonen
8     * implemented 'SELECT' mode for selecting existing object-refereneces as child-nodes
9     *
10     * Revision 1.7  2003/07/02 12:32:27  jonen
11     * fixed bugs
12     *
13     * Revision 1.6  2003/05/10 18:17:19  jonen
14     * + added 'create/add new' links
15     *
16   * Revision 1.5  2003/04/18 13:38:40  jonen   * Revision 1.5  2003/04/18 13:38:40  jonen
17   * + added use of url::short function at 'decode_item_expr'   * + added use of url::short function at 'decode_item_expr'
18   *   *
# Line 83  Line 92 
92          } else {          } else {
93            //print "<b>2</b><br/>";            //print "<b>2</b><br/>";
94            $container = container();            $container = container();
95            foreach($item as $key => $value) {            
96              // add default 'add new' link
97                    $link_vars_create = array(
98                                        'ecdid' => $options[label],
99                                        'ecdm' => $options[parent_guid],
100                                        'ecdmx' => $options[parent_class],
101                                        'ecmod' => "create",
102                                        'ecat' => 'item'
103                                        );
104                         foreach($hidden_elements as $label => $value) {
105                           if(!$link_vars_create[$label]) {
106                           $link_vars_create[$label] = $value;
107                         }
108                         }
109                    $url_short = url::short($_SERVER["PHP_SELF"], $link_vars_create);
110                    $container->add(_HTML_SPACE, html_a( $url_short, $key . " add new"), html_br());              
111              
112              if(count($item) != 0) {
113                foreach($item as $key => $value) {
114                  $link_meta = php::untwingle_reference($value, $options);                  $link_meta = php::untwingle_reference($value, $options);
115                  $link_vars = array(                  $link_vars = array(
116                                      'ecdid' => $link_meta[ident],                                      'ecdid' => $link_meta[ident],
117                                      'ecdm' => $link_meta[type]                                      'ecdm' => $link_meta[type],
118                                        'ecat' => 'item'
119                                      );                                      );
120                                            
121                       foreach($hidden_elements as $label => $value) {                       foreach($hidden_elements as $label => $value) {
122                         $link_vars[$label] = $value;                         if(!$link_vars[$label]) {
123                           $link_vars[$label] = $value;
124                         }
125                         //$tmp_array[] = $label . "=" . $value;                         //$tmp_array[] = $label . "=" . $value;
126                       }                       }
127                                            
# Line 104  Line 134 
134    
135                  // V2 - more flexible - adjustable link shrinking via some constant defined elsewhere                  // V2 - more flexible - adjustable link shrinking via some constant defined elsewhere
136                  $url_short = url::short($_SERVER["PHP_SELF"], $link_vars);                  $url_short = url::short($_SERVER["PHP_SELF"], $link_vars);
137                  $container->add("->", html_a( $url_short, $key . " view"), html_br());                                $container->add( _HTML_SPACE, html_a( $url_short, $key . " - " . " view"), html_br());              
138                                    
139                }
140            }            }
141            $item = $container;            $item = $container;
142          }          }
# Line 124  Line 155 
155        //$options = $this->_options['decode_args'];        //$options = $this->_options['decode_args'];
156        //print "item: $item<br/>";        //print "item: $item<br/>";
157    
158        // resolve 'o_{guid}_{classname}' - encoded string        if($item == "_REF") {
159        $link_meta = php::untwingle_reference($item);          $link_vars_create = array(
160        //print Dumper($link_meta);            'ecdid' => $options[label],
161              'ecdm' => $options[parent_guid],
162        if (!is_array($link_meta)) {            'ecdmx' => $options[parent_class],
163          //return $item;            'ecmod' => "create",
164          //print "NO<br/>";            'ecat' => 'item'
165          return;          );
166        }          foreach($hidden_elements as $label => $value) {
167              if(!$link_vars_create[$label]) {
168        $link_vars = array(             $link_vars_create[$label] = $value;
169          'ecdid' => $link_meta[ident],            }
170          'ecdm' => $link_meta[type],               }
171        );          $url_short = url::short($_SERVER["PHP_SELF"], $link_vars_create);
172            $item = html_a( $url_short,  " create");
173        foreach($hidden_elements as $label => $value) {        } elseif($item == "_REF_SELECT") {
174          $link_vars[$label] = $value;          $link_vars_create = array(
175        }            'ecdid' => $options[label],
176              'ecdm' => $options[parent_guid],
177              'ecdmx' => $options[parent_class],
178              'ecmod' => "select",
179              'ecat' => 'list'
180            );
181            foreach($hidden_elements as $label => $value) {
182              if(!$link_vars_create[$label]) {
183               $link_vars_create[$label] = $value;
184              }
185                 }
186            $url_short = url::short($_SERVER["PHP_SELF"], $link_vars_create);
187            $item = html_a( $url_short,  " select");
188          } else {
189            // resolve 'o_{guid}_{classname}' - encoded string
190            $link_meta = php::untwingle_reference($item);
191            //print Dumper($link_meta);
192    
193            if (!is_array($link_meta)) {
194              //return $item;
195              //print "NO<br/>";
196              return;
197            }
198    
199            $link_vars = array(
200              'ecdid' => $link_meta[ident],
201              'ecdm' => $link_meta[type],
202              'ecat' => 'item'
203            );
204    
205            foreach($hidden_elements as $label => $value) {
206              if(!$link_vars[$label]) {
207                $link_vars[$label] = $value;
208              }
209            }
210                
211        // V1          // V1
212        //$str_hidden = join("&", $tmp_array);          //$str_hidden = join("&", $tmp_array);
213        //$item = html_a($_SERVER["PHP_SELF"] . "?ecdid=" . $ident . "&ecdm=" . $meta . "&" . $str_hidden, "view");          //$item = html_a($_SERVER["PHP_SELF"] . "?ecdid=" . $ident . "&ecdm=" . $meta . "&" . $str_hidden, "view");
214    
215        // V2          // V2
216        //$link_guid = link::store($link_vars);          //$link_guid = link::store($link_vars);
217        //$item = html_a($_SERVER["PHP_SELF"] . "?lbid=" . $link_guid, "view");          //$item = html_a($_SERVER["PHP_SELF"] . "?lbid=" . $link_guid, "view");
218    
219         // V3 - more flexible - adjustable link shrinking via some constant defined elsewhere           // V3 - more flexible - adjustable link shrinking via some constant defined elsewhere
220        $url_short = url::short($_SERVER["PHP_SELF"], $link_vars);          $url_short = url::short($_SERVER["PHP_SELF"], $link_vars);
221        $item = html_a( $url_short,  " view");                        $item = html_a( $url_short,  " view");
222          }
223    
224        return 1;        return 1;
225      }      }

Legend:
Removed from v.1.5  
changed lines
  Added in v.1.8

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