1 |
<? |
<? |
2 |
/* |
/* |
3 |
## ----------------------------------------------------------------------------- |
## ------------------------------------------------------------------------- |
4 |
## $Id$ |
## $Id$ |
5 |
## ----------------------------------------------------------------------------- |
## ------------------------------------------------------------------------- |
6 |
## $Log$ |
## $Log$ |
7 |
|
## Revision 1.10 2003/04/18 18:40:02 jonen |
8 |
|
## + fixed bugs at 'actionbar_cell' relating to html-form and js |
9 |
|
## |
10 |
|
## Revision 1.9 2003/04/11 00:44:46 joko |
11 |
|
## minor update: shortened seperators |
12 |
|
## |
13 |
|
## Revision 1.8 2003/04/09 07:54:42 joko |
14 |
|
## cleaned up decoding part |
15 |
|
## |
16 |
|
## Revision 1.7 2003/04/09 00:37:53 jonen |
17 |
|
## + added actionbar |
18 |
|
## + some changes according to request vars |
19 |
|
## |
20 |
## Revision 1.6 2003/04/08 17:48:31 jonen |
## Revision 1.6 2003/04/08 17:48:31 jonen |
21 |
## + bugfix again |
## + bugfix again |
22 |
## |
## |
44 |
## Revision 1.1 2003/03/01 22:57:40 cvsmax |
## Revision 1.1 2003/03/01 22:57:40 cvsmax |
45 |
## + inital commit |
## + inital commit |
46 |
## |
## |
47 |
## |
## ------------------------------------------------------------------------- |
|
## ----------------------------------------------------------------------------- |
|
48 |
*/ |
*/ |
49 |
|
|
50 |
|
|
51 |
/** |
/** |
52 |
* Need to make sure we have the DefaultGUIDataList object |
* Need to make sure we have the DefaultGUIDataList object |
53 |
*/ |
*/ |
73 |
*/ |
*/ |
74 |
var $_hidden_elements = array(); |
var $_hidden_elements = array(); |
75 |
|
|
76 |
|
|
77 |
/** |
/** |
78 |
* The constructor is used to pass in some additional |
* The constructor is used to pass in some additional |
79 |
* metadata informations as "options". |
* metadata informations as "options". |
96 |
*/ |
*/ |
97 |
function GenericGUIDataList($title, $width = "100%", $default_orderby='', $default_reverseorder=FALSE, $options = array()) { |
function GenericGUIDataList($title, $width = "100%", $default_orderby='', $default_reverseorder=FALSE, $options = array()) { |
98 |
if ($options) { $this->_options = $options; } |
if ($options) { $this->_options = $options; } |
99 |
|
|
100 |
|
// call parent constructor |
101 |
$parent = get_parent_class($this); |
$parent = get_parent_class($this); |
102 |
$this->$parent($title, $width = "100%", $default_orderby='', $default_reverseorder=FALSE); |
$this->$parent($title, $width = "100%", $default_orderby='', $default_reverseorder=FALSE); |
103 |
} |
} |
104 |
|
|
105 |
|
|
106 |
function get_data_source( ) { |
function get_data_source( ) { |
107 |
|
|
108 |
// finally: create phpHtmlLib source handle (XyzDataListSource) |
// finally: create phpHtmlLib source handle (XyzDataListSource) |
242 |
$hidden = $this->_hidden_elements; |
$hidden = $this->_hidden_elements; |
243 |
$options = $this->_options['decode_args']; |
$options = $this->_options['decode_args']; |
244 |
|
|
245 |
// 1. if item is match by expression we will replace it with an link object |
// a) Iterate through the attributes of the item and replace each |
246 |
if ($utils->decode_item_expr($obj, $hidden, $options)) { |
// value with an appropriate link object if it has a certain format. |
247 |
$obj = $utils->decode_item_expr($obj, $hidden, $options); |
if ($utils->decode_item_expr($obj, $hidden, $options)) { |
248 |
} |
|
249 |
|
// b) Otherwise: If item is an Array we will replace it with a selection form object. |
250 |
// 2. if item is an Array we will replace it with an selection form object |
} else { |
251 |
elseif ( $utils->decode_item_array($obj, $hidden, $options) ) { |
$utils->decode_item_array($obj, $hidden, $options); |
|
$obj = $utils->decode_item_array($obj, $hidden, $options); |
|
252 |
} |
} |
253 |
|
|
254 |
} |
} |
298 |
} |
} |
299 |
|
|
300 |
$container = new ContainerWidget; |
$container = new ContainerWidget; |
301 |
|
|
302 |
|
// get current request vars and add them ad hidden items |
303 |
|
$url_vars = $this->_get_current_url_vars(); |
304 |
|
foreach($url_vars as $label => $value) { |
305 |
|
$container->push(form_hidden($label, $value)); |
306 |
|
} |
307 |
|
|
308 |
if ($cnt == 1) { |
if ($cnt == 1) { |
309 |
//user only has 1 field to show. |
//user only has 1 field to show. |
332 |
$container->push(form_hidden($this->_vars["search_fieldVar"], $field)); |
$container->push(form_hidden($this->_vars["search_fieldVar"], $field)); |
333 |
} |
} |
334 |
|
|
|
// find variables attached at base URL and add them as hidden fields, |
|
|
// so the search method will reach its starting point at deep frameworks |
|
|
$base_url = $this->build_base_url(); |
|
|
$url_vars = split("&", $base_url); |
|
|
$tmp = split("\?", $url_vars[0]); |
|
|
$url_vars[0] = $tmp[1]; |
|
|
if(is_array($url_vars)) { |
|
|
foreach($url_vars as $value) { |
|
|
$var = split("=", $value); |
|
|
if($var[0] && $var[1]) { |
|
|
$container->push(form_hidden($var[0], $var[1])); |
|
|
} |
|
|
} |
|
|
} |
|
335 |
|
|
336 |
$container->push(form_close() ); |
//$container->push(form_close() ); |
337 |
return $container; |
return $container; |
338 |
} |
} |
339 |
|
|
340 |
|
|
341 |
|
/** |
342 |
|
* this is the method that builds |
343 |
|
* the contents for the middle actionbar |
344 |
|
* td cell. |
345 |
|
* |
346 |
|
* @return ContainerWidget object |
347 |
|
*/ |
348 |
|
function actionbar_cell() { |
349 |
|
$action_list = $this->_options['actionbar']['list']; |
350 |
|
$action_name = $this->_options['actionbar']['name']; |
351 |
|
|
352 |
|
if($action_name && is_array($action_list)) { |
353 |
|
$action_form = container("Select action", _HTML_SPACE, |
354 |
|
form_select($action_name, $action_list), |
355 |
|
form_submit("ok","OK" ) |
356 |
|
); |
357 |
|
return $action_form; |
358 |
|
} else { |
359 |
|
return _HTML_SPACE; |
360 |
|
} |
361 |
|
} |
362 |
|
|
363 |
|
|
364 |
|
/* |
365 |
|
* this method returns the current requested variables |
366 |
|
* |
367 |
|
* @return array |
368 |
|
*/ |
369 |
|
function _get_current_url_vars() { |
370 |
|
$cur_url_vars = array(); |
371 |
|
|
372 |
|
// get new LinkBuilder instance |
373 |
|
$linkbuilder = new LinkBuilder(); |
374 |
|
|
375 |
|
$url_vars = php::array_join_merge($_GET, $_POST); |
376 |
|
if(is_array($url_vars)) { |
377 |
|
foreach($url_vars as $key => $value) { |
378 |
|
// if there is an LinkBuilder guid instead of variables, encode it |
379 |
|
if($key == 'lbid') { |
380 |
|
$lb_vars = $linkbuilder->load($value); |
381 |
|
foreach($lb_vars as $lbkey => $lbval) { |
382 |
|
$cur_url_vars[$lbkey] = $lbval; |
383 |
|
} |
384 |
|
} else { |
385 |
|
$cur_url_vars[$key] = $value; |
386 |
|
} |
387 |
|
} |
388 |
|
} |
389 |
|
return $cur_url_vars; |
390 |
|
} |
391 |
|
|
392 |
} |
} |
393 |
?> |
?> |