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