Changeset 1494
- Timestamp:
- 01/13/07 19:32:37 (2 years ago)
- Location:
- branches/david-execution_flow/src
- Files:
-
- 6 modified
-
controller/AgaviController.class.php (modified) (3 diffs)
-
controller/AgaviExecutionContainer.class.php (modified) (1 diff)
-
filter/AgaviExecutionFilter.class.php (modified) (1 diff)
-
response/AgaviResponse.class.php (modified) (3 diffs)
-
response/AgaviWebResponse.class.php (modified) (1 diff)
-
response/AgaviXmlrpcepiphpResponse.class.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/david-execution_flow/src/controller/AgaviController.class.php
r1477 r1494 119 119 * @param string The name of the action. 120 120 * @param array Optional additional parameters. 121 * @param string The name of the initial output type to set. 121 122 * 122 123 * @return AgaviExecutionContainer A new execution container instance, … … 126 127 * @since 0.11.0 127 128 */ 128 public function createExecutionContainer($moduleName = null, $actionName = null, array $parameters = array() )129 public function createExecutionContainer($moduleName = null, $actionName = null, array $parameters = array(), AgaviOutputType $outputType = null) 129 130 { 130 131 // create a new filter chain … … 135 136 $container->setActionName($actionName); 136 137 $container->setParameters($parameters); 138 $container->setOutputType($outputType === null ? $this->context->getController()->getOutputType() : $outputType); 137 139 return $container; 138 140 } -
branches/david-execution_flow/src/controller/AgaviExecutionContainer.class.php
r1477 r1494 98 98 $this->response = new $rfi['class']; 99 99 $this->response->initialize($this->context, $rfi['parameters']); 100 101 $this->outputType = $context->getController()->getOutputType();102 100 } 103 101 -
branches/david-execution_flow/src/filter/AgaviExecutionFilter.class.php
r1489 r1494 366 366 $request->toggleLock($key); 367 367 368 if( $next instanceof AgaviExecutionContainer) {369 $container->setNext($ next);368 if(is_array($next) && count($next) >= 2) { 369 $container->setNext($controller->createExecutionContainer($next[0], $next[1], isset($next[2]) ? $next[2] : array(), isset($next[3]) ? ($next[3] instanceof AgaviOutputType ? $next[3] : $controller->getOutputType($next[3])) : $container->getOutputType())); 370 370 } else { 371 371 $attributes =& $viewInstance->getAttributes(); -
branches/david-execution_flow/src/response/AgaviResponse.class.php
r1239 r1494 72 72 73 73 /** 74 * Export the contents of this response.75 *76 * @return array An array of data.77 *78 * @author David Zuelke <du@bitxtender.com>79 * @since 0.11.080 */81 public function export()82 {83 return array('content' => $this->getContent(), 'locked' => $this->isLocked());84 }85 86 /**87 * Export the information data (e.g. HTTP Headers, Cookies) for this response.88 *89 * @return array An array of data.90 *91 * @author David Zuelke <dz@bitxtender.com>92 * @since 0.11.093 */94 public function exportInfo()95 {96 return array('locked' => $this->isLocked());97 }98 99 /**100 * Import data for this response.101 *102 * @param array An array of data.103 *104 * @return bool Whether or not the operation was successful.105 *106 * @author David Zuelke <dz@bitxtender.com>107 * @since 0.11.0108 */109 public function import(array $data)110 {111 $retval = true;112 if(isset($data['content'])) {113 $retval = $this->setContent($data['content']);114 }115 if(isset($data['locked']) && $data['locked']) {116 $this->lock();117 }118 return $retval;119 }120 121 /**122 * Merge in data for this response.123 *124 * @param array An array of data.125 *126 * @return bool Whether or not the operation was successful.127 *128 * @author David Zuelke <dz@bitxtender.com>129 * @since 0.11.0130 */131 public function merge(array $data)132 {133 // do not lock the response even if $data has locked=true!134 135 if(isset($data['content'])) {136 return $this->appendContent($data['content']);137 }138 return true;139 }140 141 /**142 * Append data to this response.143 *144 * @param array An array of data.145 *146 * @return bool Whether or not the operation was successful.147 *148 * @author David Zuelke <dz@bitxtender.com>149 * @since 0.11.0150 */151 public function append(array $data)152 {153 // do not lock the response even if $data has locked=true!154 155 if(isset($data['content'])) {156 return $this->appendContent($data['content']);157 }158 return true;159 }160 161 /**162 * Check if this Response is locked, i.e. whether or not new content and other163 * output information can be set.164 *165 * @return bool Whether the response is locked.166 *167 * @author David Zuelke <dz@bitxtender.com>168 * @since 0.11.0169 */170 public function isLocked()171 {172 return $this->locked;173 }174 175 /**176 * Lock this Response so that it does not accept any modifications.177 *178 * @author David Zuelke <dz@bitxtender.com>179 * @since 0.11.0180 */181 public function lock()182 {183 $this->locked = true;184 }185 186 /**187 74 * Retrieve the content set for this Response 188 75 * … … 209 96 public function setContent($content) 210 97 { 211 if(!$this->locked) { 212 $this->content = $content; 213 return true; 214 } 215 return false; 98 $this->content = $content; 99 return true; 216 100 } 217 101 … … 256 140 public function clearContent() 257 141 { 258 if(!$this->locked) { 259 $this->content = ''; 260 return true; 261 } 262 return false; 142 $this->content = ''; 143 return true; 263 144 } 264 145 -
branches/david-execution_flow/src/response/AgaviWebResponse.class.php
r1475 r1494 136 136 public function clear() 137 137 { 138 if(!$this->locked) { 139 $this->clearContent(); 140 $this->httpHeaders = array(); 141 $this->cookies = array(); 142 } 143 } 144 145 /** 146 * Export the contents of this response. 147 * 148 * @return array An array of data. 149 * 150 * @author David Zuelke <du@bitxtender.com> 151 * @since 0.11.0 152 */ 153 public function export() 154 { 155 return array_merge(parent::export(), array('httpStatusCode' => $this->getHttpStatusCode(), 'httpHeaders' => $this->getHttpHeaders(), 'cookies' => $this->cookies)); 156 } 157 158 /** 159 * Export the information data (e.g. HTTP Headers, Cookies) for this response. 160 * 161 * @return array An array of data. 162 * 163 * @author David Zuelke <dz@bitxtender.com> 164 * @since 0.11.0 165 */ 166 public function exportInfo() 167 { 168 return array_merge(parent::exportInfo(), array('httpStatusCode' => $this->getHttpStatusCode(), 'httpHeaders' => $this->getHttpHeaders(), 'cookies' => $this->cookies)); 169 } 170 171 /** 172 * Import data for this response. 173 * 174 * @param array An array of data. 175 * 176 * @return bool Whether or not the operation was successful. 177 * 178 * @author David Zuelke <dz@bitxtender.com> 179 * @since 0.11.0 180 */ 181 public function import(array $data) 182 { 183 if(!$this->locked) { 184 if(isset($data['httpStatusCode'])) { 185 $this->httpStatusCode = $data['httpStatusCode']; 186 } 187 if(isset($data['httpHeaders'])) { 188 $this->httpHeaders = $data['httpHeaders']; 189 } 190 if(isset($data['cookies'])) { 191 $this->cookies = $data['cookies']; 192 } 193 return parent::import($data) && true; 194 } 195 parent::import($data); 196 return false; 197 } 198 199 /** 200 * Merge in data for this response. 201 * 202 * @param array An array of data. 203 * 204 * @return bool Whether or not the operation was successful. 205 * 206 * @author David Zuelke <dz@bitxtender.com> 207 * @since 0.11.0 208 */ 209 public function merge(array $data) 210 { 211 $retval = parent::merge($data); 212 if(!$this->locked) { 213 if(isset($data['cookies'])) { 214 $this->cookies = array_merge($data['cookies'], $this->cookies); 215 } 216 return $retval && true; 217 } 218 return $retval && false; 219 } 220 221 /** 222 * Append data to this response. 223 * 224 * @param array An array of data. 225 * 226 * @return bool Whether or not the operation was successful. 227 * 228 * @author David Zuelke <dz@bitxtender.com> 229 * @since 0.11.0 230 */ 231 public function append(array $data) 232 { 233 $retval = parent::append($data); 234 if(!$this->locked) { 235 if(isset($data['httpStatusCode'])) { 236 $this->httpStatusCode = $data['httpStatusCode']; 237 } 238 if(isset($data['httpHeaders'])) { 239 $this->httpHeaders = array_merge($this->httpHeaders, $data['httpHeaders']); 240 } 241 if(isset($data['cookies'])) { 242 $this->cookies = array_merge($this->cookies, $data['cookies']); 243 } 244 return $retval && true; 245 } 246 return $retval && false; 138 $this->clearContent(); 139 $this->httpHeaders = array(); 140 $this->cookies = array(); 247 141 } 248 142 -
branches/david-execution_flow/src/response/AgaviXmlrpcepiphpResponse.class.php
r1239 r1494 91 91 public function clearContent() 92 92 { 93 if(!$this->locked) { 94 $this->content = array(); 95 return true; 96 } 97 return false; 93 $this->content = array(); 94 return true; 98 95 } 99 96 … … 126 123 public function clear() 127 124 { 128 if(!$this->locked) { 129 $this->clearContent(); 130 $this->httpHeaders = array(); 131 $this->cookies = array(); 132 } 125 $this->clearContent(); 126 $this->httpHeaders = array(); 127 $this->cookies = array(); 133 128 } 134 129 }

