4 |
## $Id$ |
## $Id$ |
5 |
## ----------------------------------------------------------------------------- |
## ----------------------------------------------------------------------------- |
6 |
## $Log$ |
## $Log$ |
7 |
|
## Revision 1.7 2003/11/22 18:44:41 udo |
8 |
|
## update for expand data item |
9 |
|
## |
10 |
|
## Revision 1.6 2003/05/13 14:55:52 joko |
11 |
|
## parameters for MetaBox |
12 |
|
## |
13 |
|
## Revision 1.5 2003/05/10 18:27:17 jonen |
14 |
|
## + supports now mode 'create' via widget 'CreateDataItem' |
15 |
|
## |
16 |
|
## Revision 1.4 2003/04/11 00:52:19 joko |
17 |
|
## minor update: prepared for being one level more abstract by using $negotiation_options |
18 |
|
## |
19 |
|
## Revision 1.3 2003/04/10 06:27:36 joko |
20 |
|
## ++ _args[mode] == 'delete' => new FlexibleDataItem |
21 |
|
## |
22 |
|
## Revision 1.2 2003/04/06 01:33:45 jonen |
23 |
|
## + purged code |
24 |
|
## |
25 |
## Revision 1.1 2003/04/04 00:50:44 jonen |
## Revision 1.1 2003/04/04 00:50:44 jonen |
26 |
## + initial commit |
## + initial commit |
27 |
## |
## |
32 |
## ----------------------------------------------------------------------------- |
## ----------------------------------------------------------------------------- |
33 |
*/ |
*/ |
34 |
|
|
35 |
|
|
36 |
|
loadModule('WebExplorer::Module::AbstractGUIModule'); |
37 |
|
|
38 |
class WebExplorer_Module_DataItem extends WebExplorer_Module_AbstractGUIModule { |
class WebExplorer_Module_DataItem extends WebExplorer_Module_AbstractGUIModule { |
39 |
|
|
40 |
|
|
41 |
function set_gui_object() { |
function set_gui_object() { |
42 |
if($this->_args['mode'] == 'view') { |
|
43 |
|
// NEW [2003-04-22]: inject metadata about chooser (item|list|tree) into _args[options] |
44 |
|
// Please visit WebExplorer::Module::DataTree - there is a similar chooser at the top!!! |
45 |
|
// TODO: abstract this out into some reusable, generic component sometimes (SimpleChooser?) |
46 |
|
$this->_args[options][links] = array( |
47 |
|
'list' => array( |
48 |
|
array( name => 'item', url => url::view_as('item') ), |
49 |
|
array( name => 'tree', url => url::view_as('tree', array( ecdid => $_GET[ecdm] )) ), |
50 |
|
//array( name => 'reset filter', url => url::filter('tree') ), |
51 |
|
), |
52 |
|
'meta' => array( |
53 |
|
'selected' => $this->_args[options][data_locator_meta][abstract_type] |
54 |
|
) |
55 |
|
); |
56 |
|
|
57 |
|
// debug |
58 |
|
//print Dumper($this->_args) . "<br>"; |
59 |
|
|
60 |
|
|
61 |
|
if($this->_args['mode'] == 'view') { |
62 |
$this->_gui_object = new DataItem($this->_args['caption'], $this->_args['options']); |
$this->_gui_object = new DataItem($this->_args['caption'], $this->_args['options']); |
63 |
} |
} |
64 |
elseif($this->_args['mode'] == 'edit') { |
elseif($this->_args['mode'] == 'edit') { |
65 |
$this->_gui_object = new EditDataItem($this->_args['caption'], $this->_args['options'] ); |
$this->_gui_object = new EditDataItem($this->_args['caption'], $this->_args['options'] ); |
66 |
|
} |
67 |
|
elseif($this->_args['mode'] == 'delete') { |
68 |
|
// 'EditDataItem' already has an infrastructure to do "Confirm"ations, |
69 |
|
// so we just try to use it here to let the user confirm the new "delete"-action. |
70 |
|
|
71 |
|
// TODO: |
72 |
|
// Try to implement this aspect of the required infrastructure independent of |
73 |
|
// an 'EditDataItem'. Maybe it should become a 'GenericNegotiation'-ecom-component?! |
74 |
|
// Aim: Abstract way of handling 'Confirm', 'Cancel' actions on arbitrary "question"??? |
75 |
|
$negotiation_options = array( |
76 |
|
); |
77 |
|
|
78 |
|
$this->_gui_object = new FlexibleNegotiation($this->_args['caption'], $this->_args['options'], $negotiation_options ); |
79 |
} |
} |
|
} |
|
80 |
|
|
81 |
/* |
elseif($this->_args['mode'] == 'create') { |
82 |
function view_DataItem() { |
$this->_gui_object = new CreateDataItem($this->_args['caption'], $this->_args['options'] ); |
83 |
$initial_locator = php::mkComponent( 'DataSource::Locator', array( adapter_type => 'phpHtmlLib' ) ); |
} |
84 |
$proxy = php::mkComponent('DataSource::Generic', $initial_locator, $this->_args['options']['data_locator_meta']); |
// added this for full expanded objects |
85 |
$source = $proxy->get_adapter(); |
elseif($this->_args['mode'] == 'expand') { |
86 |
$source->do_query(); |
$this->_gui_object = new ExpandDataItem($this->_args['caption'], $this->_args['options'] ); |
87 |
$result = $source->_result; |
} |
88 |
//print Dumper($source->_result); |
elseif($this->_args['mode'] == 'expandedit') { |
89 |
|
$this->_gui_object = new ExpandEditDataItem($this->_args['caption'], $this->_args['options'] ); |
|
$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); |
|
|
} |
|
90 |
} |
} |
|
// 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; |
|
91 |
} |
} |
92 |
*/ |
|
|
|
|
93 |
|
|
94 |
} |
} |
95 |
|
|