Changeset 2629
- Timestamp:
- 07/29/08 13:50:05 (5 months ago)
- Location:
- branches/0.11
- Files:
-
- 6 modified
-
CHANGELOG (modified) (1 diff)
-
samples/app/config/output_types.xml (modified) (3 diffs)
-
samples/app/config/routing.xml (modified) (1 diff)
-
samples/app/lib/view/AgaviSampleAppBaseView.class.php (modified) (1 diff)
-
samples/app/modules/Default/views/SearchEngineSpamErrorView.class.php (modified) (1 diff)
-
samples/app/modules/Default/views/SearchEngineSpamSuccessView.class.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/0.11/CHANGELOG
r2614 r2629 8 8 ADD: Support for doctrine connection settings and options (#788) (David) 9 9 10 CHG: Dump "xhtml" output type from sample app and introduce a replacement (#802) (David) 10 11 CHG: Assigning of "inner" content to $slots template array should be configurable (#793) (David) 11 12 -
branches/0.11/samples/app/config/output_types.xml
r2370 r2629 2 2 <configurations xmlns="http://agavi.org/agavi/1.0/config" xmlns:xi="http://www.w3.org/2001/XInclude"> 3 3 4 <!-- the sandbox. we can put anything in here. very useful for sharing stuff inside the document using XIncludes --> 4 5 <sandbox> 5 6 <renderers default="php"> 7 8 <renderer name="php" class="AgaviPhpRenderer"> 9 <parameter name="assigns"> 10 <parameter name="routing">ro</parameter> 11 <parameter name="request">rq</parameter> 12 <parameter name="controller">ct</parameter> 13 <parameter name="user">us</parameter> 14 <parameter name="translation_manager">tm</parameter> 15 <parameter name="request_data">rd</parameter> 16 </parameter> 17 </renderer> 18 19 </renderers> 20 21 <layouts default="default"> 22 23 <layout name="default"> 24 <layer name="content" /> 25 <layer name="decorator"> 26 <slot name="menu" module="Default" action="Menu" /> 27 <parameter name="directory">%core.template_dir%</parameter> 28 <parameter name="template">Master</parameter> 29 </layer> 30 </layout> 31 32 <layout name="slot"> 33 <layer name="content" /> 34 </layout> 35 36 </layouts> 37 6 <!-- our common layers that all layouts use. only the content layer in here, and empty, but who knows! --> 7 <layers> 8 <layer name="content" /> 9 </layers> 38 10 </sandbox> 39 11 … … 42 14 43 15 <output_type name="html"> 44 <xi:include xpointer="xmlns(a=http://agavi.org/agavi/1.0/config) xpointer(/a:configurations/a:sandbox/a:renderers)" /> 45 <xi:include xpointer="xmlns(a=http://agavi.org/agavi/1.0/config) xpointer(/a:configurations/a:sandbox/a:layouts)" /> 46 16 <renderers default="php"> 17 18 <renderer name="php" class="AgaviPhpRenderer"> 19 <parameter name="assigns"> 20 <parameter name="routing">ro</parameter> 21 <parameter name="request">rq</parameter> 22 <parameter name="controller">ct</parameter> 23 <parameter name="user">us</parameter> 24 <parameter name="translation_manager">tm</parameter> 25 <parameter name="request_data">rd</parameter> 26 </parameter> 27 </renderer> 28 29 </renderers> 30 31 <layouts default="default"> 32 33 <layout name="default"> 34 <!-- include common layer definitions from the sandbox --> 35 <xi:include xpointer="xmlns(a=http://agavi.org/agavi/1.0/config) xpointer(/a:configurations/a:sandbox/a:layers/*)" /> 36 <!-- and then define those special tp this layout --> 37 <layer name="decorator"> 38 <slot name="menu" module="Default" action="Menu" /> 39 <parameter name="directory">%core.template_dir%</parameter> 40 <parameter name="template">Master</parameter> 41 </layer> 42 </layout> 43 44 <layout name="slot"> 45 <!-- include common layer definitions from the sandbox --> 46 <xi:include xpointer="xmlns(a=http://agavi.org/agavi/1.0/config) xpointer(/a:configurations/a:sandbox/a:layers/*)" /> 47 </layout> 48 49 </layouts> 50 47 51 <parameter name="http_headers"> 48 52 <parameter name="Content-Type">text/html; charset=UTF-8</parameter> … … 50 54 </output_type> 51 55 52 <output_type name="xhtml"> 53 <xi:include xpointer="xmlns(a=http://agavi.org/agavi/1.0/config) xpointer(/a:configurations/a:sandbox/a:renderers)" /> 54 <xi:include xpointer="xmlns(a=http://agavi.org/agavi/1.0/config) xpointer(/a:configurations/a:sandbox/a:layouts)" /> 55 56 <output_type name="json"> 56 57 <parameter name="http_headers"> 57 <parameter name="Content-Type">application/ xhtml+xml; charset=UTF-8</parameter>58 <parameter name="Content-Type">application/json; charset=UTF-8</parameter> 58 59 </parameter> 59 60 </output_type> -
branches/0.11/samples/app/config/routing.xml
r1949 r2629 11 11 </route> 12 12 13 <!-- If the HTTP Accept: header contains "application/ xhtml+xml", set the output type to "xhtml". Look at output_types.xml for the declaration of that output type. Execution will not stop if this route matches. -->14 <route pattern="application/ xhtml+xml" source="_SERVER[HTTP_ACCEPT]" output_type="xhtml" stop="false" />15 13 <!-- If the HTTP Accept: header contains "application/json" (i.e. if you do an XMLHTTPRequest with one of the usual JS frameworks), set the output type to "json". Look at output_types.xml for the declaration of that output type. Execution will not stop if this route matches. This is nice for making XMLHTTPRequest calls. --> 14 <route pattern="application/json" source="_SERVER[HTTP_ACCEPT]" output_type="json" stop="false" /> 15 16 16 <route name="disabled" pattern="^/disabled" module="Disabled" action="Index" /> 17 17 -
branches/0.11/samples/app/lib/view/AgaviSampleAppBaseView.class.php
r2370 r2629 58 58 } 59 59 60 public function execute Xhtml(AgaviRequestDataHolder $rd)60 public function executeJson(AgaviRequestDataHolder $rd) 61 61 { 62 if(method_exists($this, 'executeHtml')) { 63 return $this->executeHtml($rd); 64 } else { 65 return $this->execute($rd); 66 } 62 throw new AgaviViewException(sprintf( 63 'The View "%1$s" does not implement an "execute%3$s()" method to serve '. 64 'the Output Type "%2$s". It is recommended that you change the code of '. 65 'the method "execute%3$s()" in the base View "%4$s" that is throwing '. 66 'this exception to deal with this situation in a more appropriate '. 67 'way, for example by forwarding to the default 404 error action, or by '. 68 'showing some other meaningful error message to the user which explains '. 69 'that the operation was unsuccessful beacuse the desired Output Type is '. 70 'not implemented.', 71 get_class($this), 72 $this->container->getOutputType()->getName(), 73 ucfirst(strtolower($this->container->getOutputType()->getName())), 74 get_class() 75 )); 67 76 } 68 77 -
branches/0.11/samples/app/modules/Default/views/SearchEngineSpamErrorView.class.php
r1898 r2629 10 10 { 11 11 return $this->createForwardContainer(AgaviConfig::get('actions.error_404_module'), AgaviConfig::get('actions.error_404_action')); 12 } 13 14 /** 15 * Execute any presentation logic for JSON requests. 16 */ 17 public function executeJson(AgaviRequestDataHolder $rd) 18 { 19 return json_encode( 20 array( 21 '_error' => 404, 22 ) 23 ); 12 24 } 13 25 -
branches/0.11/samples/app/modules/Default/views/SearchEngineSpamSuccessView.class.php
r2370 r2629 14 14 // set the title 15 15 $this->setAttribute('title', $this->getContext()->getTranslationManager()->_('Congratulations!', 'default.SearchEngineSpam')); 16 } 17 18 /** 19 * Execute any presentation logic for JSON requests. 20 */ 21 public function executeJson(AgaviRequestDataHolder $rd) 22 { 23 return json_encode( 24 array( 25 'product_price' => $this->getAttribute('product_price'), 26 ) 27 ); 16 28 } 17 29

