4 |
## $Id$ |
## $Id$ |
5 |
## ----------------------------------------------------------------------------- |
## ----------------------------------------------------------------------------- |
6 |
## $Log$ |
## $Log$ |
7 |
|
## Revision 1.3 2003/04/10 06:27:36 joko |
8 |
|
## ++ _args[mode] == 'delete' => new FlexibleDataItem |
9 |
|
## |
10 |
|
## Revision 1.2 2003/04/06 01:33:45 jonen |
11 |
|
## + purged code |
12 |
|
## |
13 |
## Revision 1.1 2003/04/04 00:50:44 jonen |
## Revision 1.1 2003/04/04 00:50:44 jonen |
14 |
## + initial commit |
## + initial commit |
15 |
## |
## |
20 |
## ----------------------------------------------------------------------------- |
## ----------------------------------------------------------------------------- |
21 |
*/ |
*/ |
22 |
|
|
23 |
|
|
24 |
|
loadModule('WebExplorer::Module::AbstractGUIModule'); |
25 |
|
|
26 |
class WebExplorer_Module_DataItem extends WebExplorer_Module_AbstractGUIModule { |
class WebExplorer_Module_DataItem extends WebExplorer_Module_AbstractGUIModule { |
27 |
|
|
28 |
|
|
29 |
function set_gui_object() { |
function set_gui_object() { |
30 |
|
//print Dumper($this->_args); |
31 |
if($this->_args['mode'] == 'view') { |
if($this->_args['mode'] == 'view') { |
32 |
$this->_gui_object = new DataItem($this->_args['caption'], $this->_args['options']); |
$this->_gui_object = new DataItem($this->_args['caption'], $this->_args['options']); |
33 |
} |
} |
34 |
elseif($this->_args['mode'] == 'edit') { |
elseif($this->_args['mode'] == 'edit') { |
35 |
$this->_gui_object = new EditDataItem($this->_args['caption'], $this->_args['options'] ); |
$this->_gui_object = new EditDataItem($this->_args['caption'], $this->_args['options'] ); |
36 |
|
} |
37 |
|
elseif($this->_args['mode'] == 'delete') { |
38 |
|
// 'EditDataItem' already has an infrastructure to do "Confirm"ations, |
39 |
|
// so we just try to use it here to let the user confirm the new "delete"-action. |
40 |
|
|
41 |
|
// TODO: |
42 |
|
// Try to implement this aspect of the required infrastructure independent of |
43 |
|
// an 'EditDataItem'. Maybe it should become a 'GenericNegotiation'-ecom-component?! |
44 |
|
// Aim: Abstract way of handling 'Confirm', 'Cancel' actions on arbitrary "question"??? |
45 |
|
$this->_gui_object = new FlexibleDataItem($this->_args['caption'], $this->_args['options'] ); |
46 |
} |
} |
47 |
} |
} |
48 |
|
|
|
/* |
|
|
function view_DataItem() { |
|
|
$initial_locator = php::mkComponent( 'DataSource::Locator', array( adapter_type => 'phpHtmlLib' ) ); |
|
|
$proxy = php::mkComponent('DataSource::Generic', $initial_locator, $this->_args['options']['data_locator_meta']); |
|
|
$source = $proxy->get_adapter(); |
|
|
$source->do_query(); |
|
|
$result = $source->_result; |
|
|
//print Dumper($source->_result); |
|
|
|
|
|
$table = new InfoTable($this->_args['caption'], $width="100%", "center"); |
|
|
if (is_array($result)) { |
|
|
foreach($result as $key => $value) { |
|
|
if(!$value) { $value = " "; } |
|
|
$table->add_row(span_font10bold($key), $value); |
|
|
} |
|
|
} |
|
|
// build submit form |
|
|
$container = container( |
|
|
form_open($this->_args['caption'], $_SERVER['PHP_SELF'], 'POST'), |
|
|
form_submit('ecitem', "edit"), |
|
|
form_close() |
|
|
); |
|
|
//$table->add_row(div_build_spacergif_tag(), $container); |
|
|
$table->add_row(" ", $container); |
|
|
return $table; |
|
|
} |
|
|
*/ |
|
|
|
|
49 |
|
|
50 |
} |
} |
51 |
|
|