| 4 |
* $Id$ |
* $Id$ |
| 5 |
* |
* |
| 6 |
* $Log$ |
* $Log$ |
| 7 |
|
* Revision 1.9 2004/08/31 14:22:03 jonen |
| 8 |
|
* added removing of 'template' hash-value, needed to recognize empty hash-refs |
| 9 |
|
* |
| 10 |
|
* Revision 1.8 2003/12/14 01:52:26 jonen |
| 11 |
|
* implemented 'SELECT' mode for selecting existing object-refereneces as child-nodes |
| 12 |
|
* |
| 13 |
|
* Revision 1.7 2003/07/02 12:32:27 jonen |
| 14 |
|
* fixed bugs |
| 15 |
|
* |
| 16 |
|
* Revision 1.6 2003/05/10 18:17:19 jonen |
| 17 |
|
* + added 'create/add new' links |
| 18 |
|
* |
| 19 |
|
* Revision 1.5 2003/04/18 13:38:40 jonen |
| 20 |
|
* + added use of url::short function at 'decode_item_expr' |
| 21 |
|
* |
| 22 |
* Revision 1.4 2003/04/16 16:22:01 joko |
* Revision 1.4 2003/04/16 16:22:01 joko |
| 23 |
* + introduced url::short |
* + introduced url::short |
| 24 |
* |
* |
| 60 |
//print "item: " . Dumper($item); |
//print "item: " . Dumper($item); |
| 61 |
//print "options: " . Dumper($options); |
//print "options: " . Dumper($options); |
| 62 |
if( is_array($item) ) { |
if( is_array($item) ) { |
| 63 |
|
//print "is_array($item)<br>"; |
| 64 |
//$cur_row_index = $this->_datasource->get_cur_data_index(); |
//$cur_row_index = $this->_datasource->get_cur_data_index(); |
| 65 |
//$parent_guid = $this->_datasource->_data[$cur_row_index]['guid']; |
//$parent_guid = $this->_datasource->_data[$cur_row_index]['guid']; |
| 66 |
// build list for selection form |
// build list for selection form |
| 67 |
if($options['form']) { |
if($options['form']) { |
| 68 |
foreach($item as $key => $value) { |
foreach($item as $key => $value) { |
| 69 |
$tmp = split($options['seperator'], $value); |
$link_meta = php::untwingle_reference($value, $options); |
|
$ident = $tmp['1']; |
|
|
$meta = $tmp['2']; |
|
|
|
|
| 70 |
$link_vars = array( |
$link_vars = array( |
| 71 |
'ecdid' => $ident, |
'ecdid' => $link_meta[ident], |
| 72 |
'ecdm' => $meta |
'ecdm' => $link_meta[type] |
| 73 |
); |
); |
| 74 |
|
|
| 75 |
foreach($hidden_elements as $label => $value) { |
foreach($hidden_elements as $label => $value) { |
| 96 |
} else { |
} else { |
| 97 |
//print "<b>2</b><br/>"; |
//print "<b>2</b><br/>"; |
| 98 |
$container = container(); |
$container = container(); |
| 99 |
foreach($item as $key => $value) { |
|
| 100 |
$tmp = split($options['seperator'], $value); |
// add default 'add new' link |
| 101 |
$ident = $tmp['1']; |
$link_vars_create = array( |
| 102 |
$meta = $tmp['2']; |
'ecdid' => $options[label], |
| 103 |
|
'ecdm' => $options[parent_guid], |
| 104 |
$link_vars = array( |
'ecdmx' => $options[parent_class], |
| 105 |
'ecdid' => $ident, |
'ecmod' => "create", |
| 106 |
'ecdm' => $meta, |
'ecat' => 'item' |
| 107 |
); |
); |
| 108 |
|
foreach($hidden_elements as $label => $value) { |
| 109 |
|
if(!$link_vars_create[$label]) { |
| 110 |
|
$link_vars_create[$label] = $value; |
| 111 |
|
} |
| 112 |
|
} |
| 113 |
|
$url_short = url::short($_SERVER["PHP_SELF"], $link_vars_create); |
| 114 |
|
$container->add(_HTML_SPACE, html_a( $url_short, $key . " add new"), html_br()); |
| 115 |
|
|
| 116 |
|
if($item[tmp]) { unset($item[tmp]); } |
| 117 |
|
|
| 118 |
|
if(count($item) != 0) { |
| 119 |
|
foreach($item as $key => $value) { |
| 120 |
|
$link_meta = php::untwingle_reference($value, $options); |
| 121 |
|
$link_vars = array( |
| 122 |
|
'ecdid' => $link_meta[ident], |
| 123 |
|
'ecdm' => $link_meta[type], |
| 124 |
|
'ecat' => 'item' |
| 125 |
|
); |
| 126 |
|
|
| 127 |
foreach($hidden_elements as $label => $value) { |
foreach($hidden_elements as $label => $value) { |
| 128 |
$link_vars[$label] = $value; |
if(!$link_vars[$label]) { |
| 129 |
|
$link_vars[$label] = $value; |
| 130 |
|
} |
| 131 |
//$tmp_array[] = $label . "=" . $value; |
//$tmp_array[] = $label . "=" . $value; |
| 132 |
} |
} |
| 133 |
|
|
| 140 |
|
|
| 141 |
// V2 - more flexible - adjustable link shrinking via some constant defined elsewhere |
// V2 - more flexible - adjustable link shrinking via some constant defined elsewhere |
| 142 |
$url_short = url::short($_SERVER["PHP_SELF"], $link_vars); |
$url_short = url::short($_SERVER["PHP_SELF"], $link_vars); |
| 143 |
$container->add("->", html_a( $url_short, $key . " view"), html_br()); |
$container->add( _HTML_SPACE, html_a( $url_short, $key . " - " . " view"), html_br()); |
| 144 |
|
|
| 145 |
|
} |
| 146 |
} |
} |
| 147 |
$item = $container; |
$item = $container; |
| 148 |
} |
} |
| 159 |
|
|
| 160 |
// debug |
// debug |
| 161 |
//$options = $this->_options['decode_args']; |
//$options = $this->_options['decode_args']; |
| 162 |
//print "item: $item<br/>"; |
//print "item(expr): " . Dumper($item); |
| 163 |
|
//print "options(expr): " . Dumper($options); |
| 164 |
|
|
| 165 |
// resolve 'o_{guid}_{classname}' - encoded string |
if($item == "_REF") { |
| 166 |
$link_meta = php::untwingle_reference($item); |
$link_vars_create = array( |
| 167 |
//print Dumper($link_meta); |
'ecdid' => $options[label], |
| 168 |
|
'ecdm' => $options[parent_guid], |
| 169 |
if (!is_array($link_meta)) { |
'ecdmx' => $options[parent_class], |
| 170 |
//return $item; |
'ecmod' => "create", |
| 171 |
//print "NO<br/>"; |
'ecat' => 'item' |
| 172 |
return; |
); |
| 173 |
} |
foreach($hidden_elements as $label => $value) { |
| 174 |
|
if(!$link_vars_create[$label]) { |
| 175 |
$link_vars = array( |
$link_vars_create[$label] = $value; |
| 176 |
'ecdid' => $link_meta[ident], |
} |
| 177 |
'ecdm' => $link_meta[type], |
} |
| 178 |
); |
$url_short = url::short($_SERVER["PHP_SELF"], $link_vars_create); |
| 179 |
|
$item = html_a( $url_short, " create"); |
| 180 |
foreach($hidden_elements as $label => $value) { |
} elseif($item == "_REF_SELECT") { |
| 181 |
$link_vars[$label] = $value; |
$link_vars_create = array( |
| 182 |
} |
'ecdid' => $options[label], |
| 183 |
|
'ecdm' => $options[parent_guid], |
| 184 |
|
'ecdmx' => $options[parent_class], |
| 185 |
|
'ecmod' => "select", |
| 186 |
|
'ecat' => 'list' |
| 187 |
|
); |
| 188 |
|
foreach($hidden_elements as $label => $value) { |
| 189 |
|
if(!$link_vars_create[$label]) { |
| 190 |
|
$link_vars_create[$label] = $value; |
| 191 |
|
} |
| 192 |
|
} |
| 193 |
|
$url_short = url::short($_SERVER["PHP_SELF"], $link_vars_create); |
| 194 |
|
$item = html_a( $url_short, " select"); |
| 195 |
|
} else { |
| 196 |
|
// resolve 'o_{guid}_{classname}' - encoded string |
| 197 |
|
$link_meta = php::untwingle_reference($item); |
| 198 |
|
|
| 199 |
|
if (!is_array($link_meta)) { |
| 200 |
|
//return $item; |
| 201 |
|
//print "NO<br/>"; |
| 202 |
|
return; |
| 203 |
|
} |
| 204 |
|
|
| 205 |
|
$link_vars = array( |
| 206 |
|
'ecdid' => $link_meta[ident], |
| 207 |
|
'ecdm' => $link_meta[type], |
| 208 |
|
'ecat' => 'item' |
| 209 |
|
); |
| 210 |
|
|
| 211 |
|
foreach($hidden_elements as $label => $value) { |
| 212 |
|
if(!$link_vars[$label]) { |
| 213 |
|
$link_vars[$label] = $value; |
| 214 |
|
} |
| 215 |
|
} |
| 216 |
|
|
| 217 |
//$str_hidden = join("&", $tmp_array); |
// V1 |
| 218 |
//$item = html_a($_SERVER["PHP_SELF"] . "?ecdid=" . $ident . "&ecdm=" . $meta . "&" . $str_hidden, "view"); |
//$str_hidden = join("&", $tmp_array); |
| 219 |
|
//$item = html_a($_SERVER["PHP_SELF"] . "?ecdid=" . $ident . "&ecdm=" . $meta . "&" . $str_hidden, "view"); |
| 220 |
$link_guid = link::store($link_vars); |
|
| 221 |
$item = html_a($_SERVER["PHP_SELF"] . "?lbid=" . $link_guid, "view"); |
// V2 |
| 222 |
|
//$link_guid = link::store($link_vars); |
| 223 |
|
//$item = html_a($_SERVER["PHP_SELF"] . "?lbid=" . $link_guid, "view"); |
| 224 |
|
|
| 225 |
|
// V3 - more flexible - adjustable link shrinking via some constant defined elsewhere |
| 226 |
|
$url_short = url::short($_SERVER["PHP_SELF"], $link_vars); |
| 227 |
|
$item = html_a( $url_short, " view"); |
| 228 |
|
} |
| 229 |
|
|
| 230 |
return 1; |
return 1; |
| 231 |
} |
} |