1 |
<? |
2 |
/** |
3 |
* This file contains the WebExplorer_Module_AbstractNavigationList child class, |
4 |
* it inherits from the WebExplorer_Module_AbstractGUIModule. |
5 |
* |
6 |
* @author Sebastian Utz <seut@tunemedia.de> |
7 |
* @package org.netfrag.app |
8 |
* @name WebExplorer::Module::AbstractNavigationList |
9 |
* |
10 |
*/ |
11 |
|
12 |
/** |
13 |
* Cvs-Log: |
14 |
* |
15 |
* $Id: JobGroups.php,v 1.1 2003/04/18 14:04:26 joko Exp $ |
16 |
* |
17 |
* $Log: JobGroups.php,v $ |
18 |
* |
19 |
* Revision 1.2 2003/04/08 17:58:28 joko |
20 |
* minor fix: new shortcut(s) to LinkMaker |
21 |
* |
22 |
* Revision 1.1 2003/04/05 20:34:03 joko |
23 |
* code from NavigationList.php |
24 |
* |
25 |
* Revision 1.2 2003/03/28 03:06:48 joko |
26 |
* enhanced: now aware of "No data." |
27 |
* |
28 |
* Revision 1.1 2003/03/27 01:26:18 jonen |
29 |
* + initial commit, example of a simple NavigationList |
30 |
* |
31 |
* Revision 1.1 2003/03/01 22:57:23 cvsmax |
32 |
* + inital commit |
33 |
* |
34 |
*/ |
35 |
|
36 |
/** |
37 |
* This requires the WebExplorer::Module::AbstractGUIModule |
38 |
* component as base class. |
39 |
* |
40 |
*/ |
41 |
loadModule('WebExplorer::Module::AbstractGUIModule'); |
42 |
|
43 |
/** |
44 |
* The abstract WebExplorer_Module_AbstractNavigationList class |
45 |
* includes the base/common/generic infrastructure to display |
46 |
* a table of navigation links which point to arbitrary other items. |
47 |
* |
48 |
* The structure making up the navigation table is loaded from |
49 |
* an arbitrary data source. It contains information about labels |
50 |
* urls, alt-texts and such. |
51 |
* |
52 |
* It handles the actual querying of data sources for child classes |
53 |
* inheriting from it. |
54 |
* |
55 |
* It's using the DataSource::Generic chain to access the common |
56 |
* backend datasource query API (queryData/querySchema). |
57 |
* |
58 |
* Metadata about the data source access is bundled inside a |
59 |
* helper object called Data::Locator. |
60 |
* |
61 |
* The results - probably a simple list - are displayed inside |
62 |
* a VerticalCSSNavTable. For being able to handle arbitrary |
63 |
* results here, the 'propagate' method has to be overwritten. |
64 |
* |
65 |
* The links contain http query arguments which should trigger |
66 |
* the request processor (MVC) to navigate into the selected |
67 |
* top-level node. |
68 |
* This displays a list of second level nodes inside the content area |
69 |
* which are most probably full blown row-based results. |
70 |
* (ms-lingo: recordsets) |
71 |
* |
72 |
* |
73 |
* @link http://www.netfrag.org/~jonen/ |
74 |
* @author Sebastian Utz <seut@tunemedia.de> |
75 |
* |
76 |
* @copyright (c) 2003 - All Rights reserved. |
77 |
* |
78 |
* @link http://www.gnu.org/licenses/lgpl.txt |
79 |
* @license GNU LGPL (GNU Lesser General Public License) |
80 |
* |
81 |
* |
82 |
* @package org.netfrag.app |
83 |
* @subpackage WebExplorer |
84 |
* @name WebExplorer::Module::AbstractNavigationList |
85 |
* |
86 |
* |
87 |
*/ |
88 |
class WebExplorer_Module_AbstractNavigationList extends WebExplorer_Module_AbstractGUIModule { |
89 |
|
90 |
var $source; |
91 |
var $nav; |
92 |
var $result; |
93 |
|
94 |
function set_gui_object() { |
95 |
$this->_gui_object = $this->buildNavList(); |
96 |
} |
97 |
|
98 |
|
99 |
function buildNavList() { |
100 |
|
101 |
$data_locator_meta = $this->_args['options']['data_locator_meta']; |
102 |
|
103 |
// NEW [2003-04-18]: pre-flight checks |
104 |
if (!$data_locator_meta || !is_array($data_locator_meta) || !sizeof($data_locator_meta)) { |
105 |
user_error(get_class($this) . ' [isa AbstractNavigationList]: Locator error. [caption=' . $this->_args[caption] . ']'); |
106 |
return; |
107 |
} |
108 |
|
109 |
// query data |
110 |
$initial_locator = php::mkComponent( 'DataSource::Locator', array( adapter_type => 'phpHtmlLib' ) ); |
111 |
$proxy = php::mkComponent('DataSource::Generic', $initial_locator, $data_locator_meta); |
112 |
$this->source = $proxy->get_adapter(); |
113 |
//print get_class($this->source); |
114 |
$this->source->do_query(); |
115 |
|
116 |
//return; |
117 |
|
118 |
// trace |
119 |
//print Dumper($initial_locator); |
120 |
//print Dumper($this->_args); |
121 |
|
122 |
$this->nav = new VerticalCSSNavTable($this->_args['caption'], "", $width="100%"); |
123 |
|
124 |
// check valid/non-empty result |
125 |
if ($itemCount = $this->source->get_total_rows()) { |
126 |
$this->result = $this->source->_result; |
127 |
|
128 |
// trace |
129 |
//print Dumper($source->_result); |
130 |
|
131 |
//if (is_array($result)) { |
132 |
$this->propagate(); |
133 |
//} |
134 |
|
135 |
} else { |
136 |
|
137 |
// both are valid! (at least - should be...) |
138 |
//$nav->add(pageLink('explorer'), "No data."); |
139 |
$this->nav->add(link::topic('DataBrowser'), "No data."); |
140 |
|
141 |
} |
142 |
|
143 |
return $this->nav; |
144 |
|
145 |
} |
146 |
|
147 |
function propagate() { |
148 |
//print get_class($this) . ": " . "Please implement 'propagate |
149 |
$this->_abstract_method('propagate', get_class($this)); |
150 |
} |
151 |
|
152 |
} |
153 |
|
154 |
|
155 |
?> |