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