1 |
joko |
1.1 |
<? |
2 |
|
|
/** |
3 |
|
|
* This file contains the abstract MVCPage class. |
4 |
|
|
* It inherits from phpHtmlLib's abstract PageWidget |
5 |
|
|
* class to seamlessly integrate into its render queue. |
6 |
|
|
* |
7 |
|
|
* @author Andreas Motl <andreas.motl@ilo.de> |
8 |
joko |
1.2 |
* @package org.netfrag.glib |
9 |
|
|
* @name Site::WebBlock |
10 |
joko |
1.1 |
* |
11 |
|
|
*/ |
12 |
|
|
|
13 |
|
|
/** |
14 |
joko |
1.2 |
* $Id: WebBlock.php,v 1.1 2003/03/05 12:18:47 joko Exp $ |
15 |
|
|
* |
16 |
|
|
* $Log: WebBlock.php,v $ |
17 |
|
|
* Revision 1.1 2003/03/05 12:18:47 joko |
18 |
|
|
* from GenericPage.php |
19 |
joko |
1.1 |
* |
20 |
|
|
* Revision 1.1 2003/03/03 22:11:59 joko |
21 |
|
|
* + initial commit |
22 |
|
|
* |
23 |
|
|
* |
24 |
|
|
*/ |
25 |
|
|
|
26 |
|
|
|
27 |
|
|
/** |
28 |
joko |
1.2 |
* Make sure we have the required parent class |
29 |
|
|
*/ |
30 |
|
|
//class Site_WebPageMVC extends PageWidget { |
31 |
|
|
//loadModule('DesignPattern::MVC'); |
32 |
|
|
//class Site_GenericPage extends DesignPattern_MVC { |
33 |
|
|
//loadModule('DesignPattern::Proxy'); |
34 |
|
|
loadModule('DesignPattern::TransparentProxy'); |
35 |
|
|
|
36 |
|
|
|
37 |
|
|
/** |
38 |
joko |
1.1 |
* This class is used to build content |
39 |
|
|
* for an MVC controlled page. It instantiates |
40 |
|
|
* an concrete helper MVC object which does the |
41 |
|
|
* dispatching stuff. (phpHtmlLib::controller::WebMVC, |
42 |
|
|
* inherited from the abstract DesignPattern::MVC) |
43 |
|
|
* |
44 |
|
|
* This class is established here to act as a wrapper |
45 |
|
|
* bringing MVC and phpHtmlLib together. |
46 |
|
|
* |
47 |
|
|
* By now we inherit from the PageWidget, but this has |
48 |
|
|
* to be broken using the ProxyPattern or s.th.l.th. |
49 |
|
|
* I guess we'll have to dispatch to arbitrary concrete |
50 |
|
|
* Page-implementations here in future... |
51 |
|
|
* |
52 |
|
|
* @author Andreas Motl <andreas.motl@ilo.de> |
53 |
joko |
1.2 |
* @package org.netfrag.glib |
54 |
|
|
* @subpackage Site |
55 |
|
|
* @name Site::WebBlock |
56 |
|
|
* |
57 |
|
|
* @todo x phpHtmlLib::PageWidget-Adapter |
58 |
|
|
* @todo o php-include-file-Adapter |
59 |
joko |
1.1 |
* |
60 |
|
|
*/ |
61 |
|
|
//class Site_GenericPage extends DesignPattern_Proxy { |
62 |
|
|
class Site_WebBlock extends DesignPattern_TransparentProxy { |
63 |
|
|
|
64 |
|
|
/* |
65 |
|
|
var $_controller_module; |
66 |
|
|
var $_controller; |
67 |
|
|
*/ |
68 |
|
|
|
69 |
|
|
var $_page; |
70 |
|
|
|
71 |
|
|
|
72 |
|
|
function call_handler() { |
73 |
|
|
//print Dumper(func_get_args()); |
74 |
|
|
//print Dumper($this); |
75 |
|
|
//exit; |
76 |
|
|
//$this->make_handler_transparent(); |
77 |
|
|
} |
78 |
|
|
|
79 |
|
|
/* |
80 |
|
|
function @render() { |
81 |
|
|
print "render!<br/>"; |
82 |
|
|
} |
83 |
|
|
*/ |
84 |
|
|
|
85 |
|
|
//function MVCPage($title, $render_type = HTML, $ub_view = 'UB_LIST') { |
86 |
|
|
function Site_WebBlock(&$args) { |
87 |
|
|
|
88 |
|
|
//print("<h1>Site::GenericPage!</h1><br/>"); |
89 |
|
|
|
90 |
|
|
if (!$args[adapter]) { |
91 |
|
|
user_error("Please specify adapter in constructor or s.th.l.th."); |
92 |
|
|
//$args[type] = 'Page::Overview'; |
93 |
|
|
return; |
94 |
|
|
} |
95 |
|
|
|
96 |
|
|
// merge args to object attributes |
97 |
|
|
// FIXME!!! |
98 |
|
|
//$this->merge_args($args); |
99 |
|
|
|
100 |
|
|
|
101 |
|
|
// --- Proxy selector (an Adapter acts as a Proxy here to get transparent....) |
102 |
|
|
|
103 |
|
|
switch ($args[adapter]) { |
104 |
|
|
case 'phpHtmlLib': |
105 |
|
|
$this->_component_name = 'Site::Adapter::phpHtmlLib::PageWidget'; |
106 |
|
|
$this->_component_options[title] = $args[title]; |
107 |
|
|
break; |
108 |
|
|
case 'php_file': |
109 |
|
|
$this->_component_name = 'Site::Adapter::php::IncludeFile'; |
110 |
|
|
$this->_component_options = $args['block']; |
111 |
|
|
break; |
112 |
|
|
case 'php_class': |
113 |
|
|
$this->_component_name = 'Site::Adapter::php::Class'; |
114 |
|
|
$this->_component_options = $args['block']; |
115 |
|
|
break; |
116 |
|
|
case 'php_object': |
117 |
|
|
$this->_component_name = 'Site::Adapter::php::Object'; |
118 |
|
|
$this->_component_options = $args['block']; |
119 |
|
|
break; |
120 |
|
|
default: |
121 |
|
|
user_error("Site::GenericPage: no component selected!"); |
122 |
|
|
break; |
123 |
|
|
} |
124 |
|
|
|
125 |
|
|
|
126 |
|
|
//parent::constructor(); |
127 |
|
|
//exit; |
128 |
|
|
|
129 |
|
|
// test transparency here |
130 |
|
|
$test_before = 0; |
131 |
|
|
$test_after = 0; |
132 |
|
|
|
133 |
|
|
$this->create_proxy(); |
134 |
|
|
|
135 |
|
|
if ($test_before) { |
136 |
|
|
if ($this->_component_name == 'Site::Adapter::php::Class') { |
137 |
|
|
print "before:<br/>" . Dumper($this); |
138 |
|
|
} |
139 |
|
|
} |
140 |
|
|
|
141 |
|
|
$this->make_transparent(); |
142 |
|
|
|
143 |
|
|
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
144 |
|
|
// this code isn't executed any more since transparency occours above!!!! |
145 |
|
|
|
146 |
|
|
if ($test_after) { |
147 |
|
|
if ($this->_component_name == 'Site::Adapter::php::Class') { |
148 |
|
|
print "after:<br/>" . Dumper($this); |
149 |
|
|
} |
150 |
|
|
} |
151 |
|
|
|
152 |
|
|
//print Dumper($this); |
153 |
|
|
//exit; |
154 |
|
|
|
155 |
|
|
//return $this; |
156 |
|
|
|
157 |
|
|
} |
158 |
|
|
|
159 |
|
|
//switch ($thi |
160 |
|
|
|
161 |
|
|
/* |
162 |
|
|
|
163 |
|
|
// create controller instance |
164 |
|
|
$this->create_controller_instance(); |
165 |
|
|
|
166 |
|
|
// trace |
167 |
|
|
//print Dumper($this->_controller); |
168 |
|
|
//exit; |
169 |
|
|
|
170 |
|
|
// propagate phpHtmlLib page widget arguments: |
171 |
|
|
// - title: The title of the page |
172 |
|
|
// - render_type: An identifier specifying the output type: |
173 |
|
|
// used by now: HTML (possible: WML|SVG, i guess...? XML|DHTML also...?) |
174 |
|
|
$title = $args[title]; |
175 |
|
|
$render_type = $args[render_type]; |
176 |
|
|
$parent = get_parent_class($this); |
177 |
|
|
$this->$parent($title, $render_type); |
178 |
|
|
*/ |
179 |
|
|
|
180 |
|
|
|
181 |
|
|
|
182 |
|
|
/* |
183 |
|
|
function @old_create_controller_instance() { |
184 |
|
|
// V1: |
185 |
|
|
//$this->_controller = mkObject('ExplorerController.inc'); |
186 |
|
|
|
187 |
|
|
// V2: |
188 |
|
|
//loadModule('widgets/explorer/modules/ExplorerController', 'inc'); |
189 |
|
|
//$this->_controller = mkObject('ExplorerController'); |
190 |
|
|
|
191 |
|
|
// V3: (now being completely abstract here...) |
192 |
|
|
$this->_controller = mkObject($this->_controller_module); |
193 |
|
|
} |
194 |
|
|
*/ |
195 |
|
|
|
196 |
|
|
} |
197 |
|
|
|
198 |
|
|
?> |