| 4 |
* $Id$ |
* $Id$ |
| 5 |
* |
* |
| 6 |
* $Log$ |
* $Log$ |
| 7 |
|
* Revision 1.10 2005/08/11 14:12:24 jonen |
| 8 |
|
* + bugfix |
| 9 |
|
* + added function to get allowed writeable entries for a TerminalOwner |
| 10 |
|
* |
| 11 |
|
* Revision 1.9 2004/08/31 14:22:03 jonen |
| 12 |
|
* added removing of 'template' hash-value, needed to recognize empty hash-refs |
| 13 |
|
* |
| 14 |
|
* Revision 1.8 2003/12/14 01:52:26 jonen |
| 15 |
|
* implemented 'SELECT' mode for selecting existing object-refereneces as child-nodes |
| 16 |
|
* |
| 17 |
|
* Revision 1.7 2003/07/02 12:32:27 jonen |
| 18 |
|
* fixed bugs |
| 19 |
|
* |
| 20 |
|
* Revision 1.6 2003/05/10 18:17:19 jonen |
| 21 |
|
* + added 'create/add new' links |
| 22 |
|
* |
| 23 |
|
* Revision 1.5 2003/04/18 13:38:40 jonen |
| 24 |
|
* + added use of url::short function at 'decode_item_expr' |
| 25 |
|
* |
| 26 |
|
* Revision 1.4 2003/04/16 16:22:01 joko |
| 27 |
|
* + introduced url::short |
| 28 |
|
* |
| 29 |
* Revision 1.3 2003/04/09 07:57:15 joko |
* Revision 1.3 2003/04/09 07:57:15 joko |
| 30 |
* revamped 'function decode_item_expr' |
* revamped 'function decode_item_expr' |
| 31 |
* introduced shortcut 'link::store' |
* introduced shortcut 'link::store' |
| 64 |
//print "item: " . Dumper($item); |
//print "item: " . Dumper($item); |
| 65 |
//print "options: " . Dumper($options); |
//print "options: " . Dumper($options); |
| 66 |
if( is_array($item) ) { |
if( is_array($item) ) { |
| 67 |
|
//print "is_array($item)<br>"; |
| 68 |
//$cur_row_index = $this->_datasource->get_cur_data_index(); |
//$cur_row_index = $this->_datasource->get_cur_data_index(); |
| 69 |
//$parent_guid = $this->_datasource->_data[$cur_row_index]['guid']; |
//$parent_guid = $this->_datasource->_data[$cur_row_index]['guid']; |
| 70 |
// build list for selection form |
// build list for selection form |
| 71 |
if($options['form']) { |
if($options['form']) { |
| 72 |
foreach($item as $key => $value) { |
foreach($item as $key => $value) { |
| 73 |
$tmp = split($options['seperator'], $value); |
$link_meta = php::untwingle_reference($value, $options); |
|
$ident = $tmp['1']; |
|
|
$meta = $tmp['2']; |
|
|
|
|
| 74 |
$link_vars = array( |
$link_vars = array( |
| 75 |
'ecdid' => $ident, |
'ecdid' => $link_meta[ident], |
| 76 |
'ecdm' => $meta |
'ecdm' => $link_meta[type] |
| 77 |
); |
); |
| 78 |
|
|
| 79 |
foreach($hidden_elements as $label => $value) { |
foreach($hidden_elements as $label => $value) { |
| 80 |
$link_vars[$label] = $value; |
$link_vars[$label] = $value; |
| 81 |
} |
} |
| 82 |
|
|
| 83 |
// create new LinkBuilder instance and get link GUID by saving vars |
// V1 - create new LinkBuilder instance and get link GUID by saving vars |
| 84 |
$link_guid = link::store($link_vars); |
$link_guid = link::store($link_vars); |
| 85 |
|
|
| 86 |
|
// V2 - more flexible - adjustable link shrinking via some constant defined elsewhere |
| 87 |
|
//$link_guid = url::short('', $link_vars); |
| 88 |
|
|
| 89 |
$list[$key] = $link_guid; |
$list[$key] = $link_guid; |
| 90 |
} |
} |
| 91 |
if(is_array($list) ) { |
if(is_array($list) ) { |
| 100 |
} else { |
} else { |
| 101 |
//print "<b>2</b><br/>"; |
//print "<b>2</b><br/>"; |
| 102 |
$container = container(); |
$container = container(); |
| 103 |
foreach($item as $key => $value) { |
|
| 104 |
$tmp = split($options['seperator'], $value); |
// add default 'add new' link |
| 105 |
$ident = $tmp['1']; |
$link_vars_create = array( |
| 106 |
$meta = $tmp['2']; |
'ecdid' => $options[label], |
| 107 |
|
'ecdm' => $options[parent_guid], |
| 108 |
$link_vars = array( |
'ecdmx' => $options[parent_class], |
| 109 |
'ecdid' => $ident, |
'ecmod' => "create", |
| 110 |
'ecdm' => $meta, |
'ecat' => 'item' |
| 111 |
); |
); |
| 112 |
|
foreach($hidden_elements as $label => $value) { |
| 113 |
|
if(!$link_vars_create[$label]) { |
| 114 |
|
$link_vars_create[$label] = $value; |
| 115 |
|
} |
| 116 |
|
} |
| 117 |
|
$url_short = url::short($_SERVER["PHP_SELF"], $link_vars_create); |
| 118 |
|
$container->add(_HTML_SPACE, html_a( $url_short, $key . " add new"), html_br()); |
| 119 |
|
|
| 120 |
|
if($item[tmp]) { unset($item[tmp]); } |
| 121 |
|
if($item[0] == "_REF") { unset($item[0]); } |
| 122 |
|
|
| 123 |
|
if(count($item) != 0) { |
| 124 |
|
foreach($item as $key => $value) { |
| 125 |
|
$link_meta = php::untwingle_reference($value, $options); |
| 126 |
|
$link_vars = array( |
| 127 |
|
'ecdid' => $link_meta[ident], |
| 128 |
|
'ecdm' => $link_meta[type], |
| 129 |
|
'ecat' => 'item' |
| 130 |
|
); |
| 131 |
|
|
| 132 |
foreach($hidden_elements as $label => $value) { |
foreach($hidden_elements as $label => $value) { |
| 133 |
$link_vars[$label] = $value; |
if(!$link_vars[$label]) { |
| 134 |
|
$link_vars[$label] = $value; |
| 135 |
|
} |
| 136 |
//$tmp_array[] = $label . "=" . $value; |
//$tmp_array[] = $label . "=" . $value; |
| 137 |
} |
} |
| 138 |
|
|
| 139 |
//$str_hidden = join("&", $tmp_array); |
//$str_hidden = join("&", $tmp_array); |
| 140 |
//$container->add("->", html_a($_SERVER["PHP_SELF"] . "?ecdid=" . $ident . "&ecdm=" . $meta . "&" . $str_hidden, $key . " view"), html_br()); |
//$container->add("->", html_a($_SERVER["PHP_SELF"] . "?ecdid=" . $ident . "&ecdm=" . $meta . "&" . $str_hidden, $key . " view"), html_br()); |
| 141 |
|
|
| 142 |
// create new LinkBuilder instance and get link GUID by saving vars |
// V1 - create new LinkBuilder instance and get link GUID by saving vars |
| 143 |
$link_guid = link::store($link_vars); |
//$link_guid = link::store($link_vars); |
| 144 |
|
//$container->add("->", html_a($_SERVER["PHP_SELF"] . "?lbid=" . $link_guid, $key . " view"), html_br()); |
| 145 |
|
|
| 146 |
|
// V2 - more flexible - adjustable link shrinking via some constant defined elsewhere |
| 147 |
|
$url_short = url::short($_SERVER["PHP_SELF"], $link_vars); |
| 148 |
|
$container->add( _HTML_SPACE, html_a( $url_short, $key . " - " . " view"), html_br()); |
| 149 |
|
|
| 150 |
$container->add("->", html_a($_SERVER["PHP_SELF"] . "?lbid=" . $link_guid, $key . " view"), html_br()); |
} |
| 151 |
} |
} |
| 152 |
$item = $container; |
$item = $container; |
| 153 |
} |
} |
| 164 |
|
|
| 165 |
// debug |
// debug |
| 166 |
//$options = $this->_options['decode_args']; |
//$options = $this->_options['decode_args']; |
| 167 |
//print "item: $item<br/>"; |
//print "item(expr): " . Dumper($item); |
| 168 |
|
//print "options(expr): " . Dumper($options); |
|
// resolve 'o_{guid}_{classname}' - encoded string |
|
|
$link_meta = php::untwingle_reference($item); |
|
|
//print Dumper($link_meta); |
|
|
|
|
|
if (!is_array($link_meta)) { |
|
|
//return $item; |
|
|
//print "NO<br/>"; |
|
|
return; |
|
|
} |
|
|
|
|
|
$link_vars = array( |
|
|
'ecdid' => $link_meta[ident], |
|
|
'ecdm' => $link_meta[type], |
|
|
); |
|
| 169 |
|
|
| 170 |
foreach($hidden_elements as $label => $value) { |
if($item == "_REF") { |
| 171 |
$link_vars[$label] = $value; |
$link_vars_create = array( |
| 172 |
} |
'ecdid' => $options[label], |
| 173 |
|
'ecdm' => $options[parent_guid], |
| 174 |
|
'ecdmx' => $options[parent_class], |
| 175 |
|
'ecmod' => "create", |
| 176 |
|
'ecat' => 'item' |
| 177 |
|
); |
| 178 |
|
foreach($hidden_elements as $label => $value) { |
| 179 |
|
if(!$link_vars_create[$label]) { |
| 180 |
|
$link_vars_create[$label] = $value; |
| 181 |
|
} |
| 182 |
|
} |
| 183 |
|
$url_short = url::short($_SERVER["PHP_SELF"], $link_vars_create); |
| 184 |
|
$item = html_a( $url_short, " create"); |
| 185 |
|
} elseif($item == "_REF_SELECT") { |
| 186 |
|
$link_vars_create = array( |
| 187 |
|
'ecdid' => $options[label], |
| 188 |
|
'ecdm' => $options[parent_guid], |
| 189 |
|
'ecdmx' => $options[parent_class], |
| 190 |
|
'ecmod' => "select", |
| 191 |
|
'ecat' => 'list' |
| 192 |
|
); |
| 193 |
|
foreach($hidden_elements as $label => $value) { |
| 194 |
|
if(!$link_vars_create[$label]) { |
| 195 |
|
$link_vars_create[$label] = $value; |
| 196 |
|
} |
| 197 |
|
} |
| 198 |
|
$url_short = url::short($_SERVER["PHP_SELF"], $link_vars_create); |
| 199 |
|
$item = html_a( $url_short, " select"); |
| 200 |
|
} else { |
| 201 |
|
// resolve 'o_{guid}_{classname}' - encoded string |
| 202 |
|
$link_meta = php::untwingle_reference($item); |
| 203 |
|
|
| 204 |
|
if (!is_array($link_meta)) { |
| 205 |
|
//return $item; |
| 206 |
|
//print "NO<br/>"; |
| 207 |
|
return; |
| 208 |
|
} |
| 209 |
|
|
| 210 |
|
$link_vars = array( |
| 211 |
|
'ecdid' => $link_meta[ident], |
| 212 |
|
'ecdm' => $link_meta[type], |
| 213 |
|
'ecat' => 'item' |
| 214 |
|
); |
| 215 |
|
|
| 216 |
|
foreach($hidden_elements as $label => $value) { |
| 217 |
|
if(!$link_vars[$label]) { |
| 218 |
|
$link_vars[$label] = $value; |
| 219 |
|
} |
| 220 |
|
} |
| 221 |
|
|
| 222 |
//$str_hidden = join("&", $tmp_array); |
// V1 |
| 223 |
//$item = html_a($_SERVER["PHP_SELF"] . "?ecdid=" . $ident . "&ecdm=" . $meta . "&" . $str_hidden, "view"); |
//$str_hidden = join("&", $tmp_array); |
| 224 |
|
//$item = html_a($_SERVER["PHP_SELF"] . "?ecdid=" . $ident . "&ecdm=" . $meta . "&" . $str_hidden, "view"); |
| 225 |
$link_guid = link::store($link_vars); |
|
| 226 |
$item = html_a($_SERVER["PHP_SELF"] . "?lbid=" . $link_guid, "view"); |
// V2 |
| 227 |
|
//$link_guid = link::store($link_vars); |
| 228 |
|
//$item = html_a($_SERVER["PHP_SELF"] . "?lbid=" . $link_guid, "view"); |
| 229 |
|
|
| 230 |
|
// V3 - more flexible - adjustable link shrinking via some constant defined elsewhere |
| 231 |
|
$url_short = url::short($_SERVER["PHP_SELF"], $link_vars); |
| 232 |
|
$item = html_a( $url_short, " view"); |
| 233 |
|
} |
| 234 |
|
|
| 235 |
return 1; |
return 1; |
| 236 |
} |
} |
| 237 |
|
|
| 238 |
|
|
| 239 |
|
function getWriteableEntries($userclass) { |
| 240 |
|
if($userclass == 'TerminalOwner') { |
| 241 |
|
$we = array( |
| 242 |
|
'password', |
| 243 |
|
'question', |
| 244 |
|
'answer', |
| 245 |
|
'phone', |
| 246 |
|
'mobile', |
| 247 |
|
'address1', |
| 248 |
|
'address2', |
| 249 |
|
'state', |
| 250 |
|
'city', |
| 251 |
|
'zip', |
| 252 |
|
'fax', |
| 253 |
|
); |
| 254 |
|
} |
| 255 |
|
return $we; |
| 256 |
|
} |
| 257 |
|
|
| 258 |
} |
} |
| 259 |
|
|