Changeset 2370

Show
Ignore:
Timestamp:
03/16/08 17:58:52 (10 months ago)
Author:
david
Message:

Brought sample app and code templates up to date, refs #719

Location:
branches/0.11
Files:
18 added
36 modified
1 moved

Legend:

Unmodified
Added
Removed
  • branches/0.11/CHANGELOG

    r2368 r2370  
    55--------------------------- 
    66 
     7CHG: Bring sample app and code templates up to date (#719) (David) 
    78CHG: Update timezone database to 2008a (#727) (David) 
    89CHG: List of matches for a route should be populated by the time onMatched() is called on a callback (#730) (David) 
  • branches/0.11/samples/app/config/action_filters.xml

    r2045 r2370  
    22<configurations xmlns="http://agavi.org/agavi/1.0/config"> 
    33 
    4   <configuration environment="development" context="web"> 
     4  <configuration environment="development.*" context="web"> 
    55    <filters> 
    66 
  • branches/0.11/samples/app/config/autoload.xml

    r1910 r2370  
    33  <configuration> 
    44    <autoloads> 
     5      <autoload name="AgaviSampleAppBaseAction">%core.lib_dir%/action/AgaviSampleAppBaseAction.class.php</autoload> 
     6      <autoload name="AgaviSampleAppBaseModel">%core.lib_dir%/model/AgaviSampleAppBaseModel.class.php</autoload> 
     7      <autoload name="AgaviSampleAppBaseView">%core.lib_dir%/view/AgaviSampleAppBaseView.class.php</autoload> 
     8       
    59      <autoload name="AgaviSampleAppLanguageRoutingCallback">%core.lib_dir%/routing/AgaviSampleAppLanguageRoutingCallback.class.php</autoload> 
    610       
  • branches/0.11/samples/app/config/databases.xml

    r1910 r2370  
    11<?xml version="1.0" encoding="UTF-8"?> 
    22<configurations xmlns="http://agavi.org/agavi/1.0/config"> 
     3   
    34  <configuration> 
    4     <databases default="postgres"> 
    5       <database name="postgres" class="AgaviPostgresqlDatabase"> 
    6         <parameters> 
    7           <parameter name="host">localhost</parameter> 
    8           <parameter name="username">username</parameter> 
    9           <parameter name="password">passphrase</parameter> 
    10           <parameter name="database">sample</parameter> 
    11         </parameters> 
     5    <databases default="pdo_mysql_main"> 
     6       
     7      <database name="pdo_mysql_main" class="AgaviPdoDatabase"> 
     8        <parameter name="dsn">mysql:host=localhost;dbname=agsmplapp</parameter> 
     9        <parameter name="username">root</parameter> 
     10        <parameter name="password"></parameter> 
    1211      </database> 
    13 <!-- 
    14       <database name="propel" class="AgaviPropelDatabase"> 
    15         <parameters> 
    16           <parameter name="config">%core.app_dir%/config/project-conf.php</parameter> 
    17         </parameters> 
     12       
     13      <database name="propelom" class="AgaviPropelDatabase"> 
     14        <parameter name="config">%core.app_dir%/config/project-conf.php</parameter> 
    1815      </database> 
    19 --> 
     16       
    2017    </databases> 
    2118  </configuration> 
     19   
     20  <configuration environment="development-joecool"> 
     21    <databases default="pdo_mysql_main"> 
     22       
     23      <database name="pdo_mysql_main"> 
     24        <parameter name="dsn">mysql:host=localhost;dbname=agavisample</parameter> 
     25        <parameter name="username">agavisample</parameter> 
     26        <parameter name="password">123qwe</parameter> 
     27      </database> 
     28       
     29    </databases> 
     30  </configuration> 
     31   
    2232</configurations> 
  • branches/0.11/samples/app/config/factories.xml

    r1962 r2370  
    4040  </configuration> 
    4141   
    42   <configuration context="web" environment="development"> 
     42  <configuration context="web" environment="development.*"> 
    4343     
    4444    <response class="AgaviWebResponse"> 
  • branches/0.11/samples/app/config/output_types.xml

    r1949 r2370  
    2525        <layer name="decorator"> 
    2626          <slot name="menu" module="Default" action="Menu" /> 
     27          <parameter name="directory">%core.template_dir%</parameter> 
    2728          <parameter name="template">Master</parameter> 
    2829        </layer> 
  • branches/0.11/samples/app/config/settings.xml

    r1958 r2370  
    4242      <setting name="available">true</setting> 
    4343      <setting name="debug">false</setting> 
    44       <setting name="modpub">/modpub</setting> 
    4544       
    4645      <setting name="use_database">false</setting> 
     
    5857  </configuration> 
    5958   
    60   <configuration environment="development"> 
     59  <configuration environment="development.*"> 
    6160    <settings> 
    6261      <setting name="debug">true</setting> 
  • branches/0.11/samples/app/config/translation.xml

    r1910 r2370  
    7878  </configuration> 
    7979   
    80   <configuration environment="development"> 
     80  <configuration environment="development.*"> 
    8181    <translators default_domain="default"> 
    8282      <translator domain="default"> 
  • branches/0.11/samples/app/modules/Default/config/autoload.xml

    r1910 r2370  
    44    <autoloads> 
    55      <autoload name="AgaviSampleAppDefaultBaseAction">%core.module_dir%/Default/lib/action/AgaviSampleAppDefaultBaseAction.class.php</autoload> 
    6        
     6      <autoload name="AgaviSampleAppDefaultBaseModel">%core.module_dir%/Default/lib/model/AgaviSampleAppDefaultBaseModel.class.php</autoload> 
    77      <autoload name="AgaviSampleAppDefaultBaseView">%core.module_dir%/Default/lib/view/AgaviSampleAppDefaultBaseView.class.php</autoload> 
    88    </autoloads> 
  • branches/0.11/samples/app/modules/Default/config/module.xml

    r1910 r2370  
    33  <configuration> 
    44    <enabled>On</enabled> 
    5     <title>Default Agavi Module</title> 
    6     <version>0.1</version> 
     5    <title>Default Agavi Sample App Module</title> 
     6    <version>1.0</version> 
    77    <name>Default</name> 
    88    <authors> 
    9       <author>Sean Kerr (skerr@mojavi.org)</author> 
     9      <author>David Zülke</author> 
    1010    </authors> 
    1111    <homepage>http://www.agavi.org</homepage> 
  • branches/0.11/samples/app/modules/Default/lib/action/AgaviSampleAppDefaultBaseAction.class.php

    r1648 r2370  
    11<?php 
    22 
    3 class AgaviSampleAppDefaultBaseAction extends AgaviAction 
     3class AgaviSampleAppDefaultBaseAction extends AgaviSampleAppBaseAction 
    44{ 
    55  /* 
    6     This is the base action all your application's actions should extend. 
    7     This way, you can easily inject new functionality into all of your actions. 
     6    This is the base action all your module's actions should extend. This way, 
     7    you can easily inject new functionality into all of this module's actions. 
    88     
    9     One example would be to extend the initialize() method and assign commonly 
    10     used objects such as the request as protected class members. 
    11      
    12     Another example would be a custom isSimple() method that returns true if the 
    13     current container has the "is_slot" parameter set - that way, all actions 
    14     run as a slot would automatically be switched to "simple" mode. 
     9    One example would be to extend the getCredentials() method and return a list 
     10    of credentials that all actions in this module require. 
    1511     
    1612    Even if you don't need any of the above and this class remains empty, it is 
    1713    strongly recommended you keep it. There shall come the day where you are 
    1814    happy to have it this way ;) 
     15     
     16    It is of course highly recommended that you change the names of any default 
     17    base classes to carry a prefix and have an overall meaningful naming scheme. 
     18    You can enable the usage of the respective custom template files via 
     19    build.properties settings. Also, keep in mind that you can define templates 
     20    for specific modules in case you require this. 
    1921  */ 
    2022} 
  • branches/0.11/samples/app/modules/Default/lib/view/AgaviSampleAppDefaultBaseView.class.php

    r1656 r2370  
    11<?php 
    22 
    3 class AgaviSampleAppDefaultBaseView extends AgaviView 
     3class AgaviSampleAppDefaultBaseView extends AgaviSampleAppBaseView 
    44{ 
    55  /* 
    6     This is the base view all your application's views should extend. 
    7     This way, you can easily inject new functionality into all of your views. 
     6    This is the base view all your module's views should extend. This way, 
     7    you can easily inject new functionality into all of this module's views. 
    88     
    9     One example would be to extend the initialize() method and assign commonly 
    10     used objects such as the request as protected class members. 
     9    One example would be to extend a setupHtml() method and assign attributes 
     10    that many templates in this module use. 
    1111     
    1212    Even if you don't need any of the above and this class remains empty, it is 
     
    1414    happy to have it this way ;) 
    1515     
    16     This default implementation throws an exception if execute() is called, 
    17     which means that no execute*() method specific to the current output type 
    18     was declared in your view, and no such method exists in this class either. 
     16    It is of course highly recommended that you change the names of any default 
     17    base classes to carry a prefix and have an overall meaningful naming scheme. 
     18    You can enable the usage of the respective custom template files via 
     19    build.properties settings. Also, keep in mind that you can define templates 
     20    for specific modules in case you require this. 
    1921  */ 
    20    
    21   public final function execute(AgaviRequestDataHolder $rd) 
    22   { 
    23     throw new AgaviViewException(sprintf( 
    24       'The View "%1$s" does not implement an "execute%3$s()" method to serve '. 
    25       'the Output Type "%2$s", and the base View "%4$s" does not implement an '. 
    26       '"execute%3$s()" method to handle this situation.', 
    27       get_class($this), 
    28       $this->container->getOutputType()->getName(), 
    29       ucfirst(strtolower($this->container->getOutputType()->getName())), 
    30       get_class() 
    31     )); 
    32   } 
    33    
    34   public function executeHtml(AgaviRequestDataHolder $rd) 
    35   { 
    36     throw new AgaviViewException(sprintf( 
    37       'The View "%1$s" does not implement an "execute%3$s()" method to serve '. 
    38       'the Output Type "%2$s". It is recommended that you change the code of '. 
    39       'the method "execute%3$s()" in the base View "%4$s" that is throwing '. 
    40       'this exception to deal with this situation in a more appropriate '. 
    41       'way, for example by forwarding to the default 404 error action, or by '. 
    42       'showing some other meaningful error message to the user which explains '. 
    43       'that the operation was unsuccessful beacuse the desired Output Type is '. 
    44       'not implemented.', 
    45       get_class($this), 
    46       $this->container->getOutputType()->getName(), 
    47       ucfirst(strtolower($this->container->getOutputType()->getName())), 
    48       get_class() 
    49     )); 
    50   } 
    51    
    52   public function executeXhtml(AgaviRequestDataHolder $rd) 
    53   { 
    54     if(method_exists($this, 'executeHtml')) { 
    55       return $this->executeHtml($rd); 
    56     } else { 
    57       return $this->execute($rd); 
    58     } 
    59   } 
    60    
    61   public function setupHtml(AgaviRequestDataHolder $rd, $layoutName = null) 
    62   { 
    63     $this->loadLayout($layoutName); 
    64      
    65     // also set a default title just to avoid warnings 
    66     $this->setAttribute('title', ''); 
    67   } 
    6822} 
    6923 
  • branches/0.11/samples/app/modules/Default/models/AgaviSampleAppPriceFinderModel.class.php

    r1096 r2370  
    11<?php 
    22 
    3 class AgaviSampleAppPriceFinderModel extends AgaviModel implements AgaviISingletonModel 
     3class AgaviSampleAppPriceFinderModel extends AgaviSampleAppDefaultBaseModel implements AgaviISingletonModel 
    44{ 
    55  public function getPriceByProductName($productName) 
  • branches/0.11/samples/app/modules/Default/views/Error404SuccessView.class.php

    r2258 r2370  
    1919  public function executeHtml(AgaviRequestDataHolder $rd) 
    2020  { 
    21     parent::setupHtml($rd); 
     21    $this->setupHtml($rd); 
    2222 
    2323    // set the title 
  • branches/0.11/samples/app/modules/Default/views/IndexSuccessView.class.php

    r2258 r2370  
    1919  public function executeHtml(AgaviRequestDataHolder $rd) 
    2020  { 
    21     parent::setupHtml($rd); 
     21    $this->setupHtml($rd); 
    2222 
    2323    // set the title 
  • branches/0.11/samples/app/modules/Default/views/LoginErrorView.class.php

    r2258 r2370  
    1818  public function executeHtml(AgaviRequestDataHolder $rd) 
    1919  { 
    20     parent::setupHtml($rd); 
     20    $this->setupHtml($rd); 
    2121     
    2222    // set the title 
  • branches/0.11/samples/app/modules/Default/views/LoginInputView.class.php

    r2258 r2370  
    1818  public function executeHtml(AgaviRequestDataHolder $rd) 
    1919  { 
    20     parent::setupHtml($rd); 
     20    $this->setupHtml($rd); 
    2121     
    2222    // set the title 
  • branches/0.11/samples/app/modules/Default/views/LoginSuccessView.class.php

    r2258 r2370  
    3333    } 
    3434 
    35     parent::setupHtml($rd); 
     35    $this->setupHtml($rd); 
    3636 
    3737    // set the title 
  • branches/0.11/samples/app/modules/Default/views/LogoutSuccessView.class.php

    r2258 r2370  
    1919  public function executeHtml(AgaviRequestDataHolder $rd) 
    2020  { 
    21     parent::setupHtml($rd); 
     21    $this->setupHtml($rd); 
    2222 
    2323    // set the title 
  • branches/0.11/samples/app/modules/Default/views/MenuSuccessView.class.php

    r2258 r2370  
    1919  public function executeHtml(AgaviRequestDataHolder $rd) 
    2020  { 
    21     parent::setupHtml($rd, 'slot'); 
     21    // will automatically load "slot" layout for us 
     22    $this->setupHtml($rd); 
    2223 
    2324    // set the title 
  • branches/0.11/samples/app/modules/Default/views/ModuleDisabledSuccessView.class.php

    r2258 r2370  
    1818  public function executeHtml(AgaviRequestDataHolder $rd) 
    1919  { 
    20     parent::setupHtml($rd); 
     20    $this->setupHtml($rd); 
    2121 
    2222    // set the title 
  • branches/0.11/samples/app/modules/Default/views/SearchEngineSpamSuccessView.class.php

    r1894 r2370  
    1010  public function executeHtml(AgaviRequestDataHolder $rd) 
    1111  { 
    12     parent::setupHtml($rd); 
     12    $this->setupHtml($rd); 
    1313 
    1414    // set the title 
  • branches/0.11/samples/app/modules/Default/views/Secure1SuccessView.class.php

    r1655 r2370  
    66  public function executeHtml(AgaviRequestDataHolder $rd) 
    77  { 
    8     parent::setupHtml($rd); 
     8    $this->setupHtml($rd); 
    99 
    1010    // set the title 
  • branches/0.11/samples/app/modules/Default/views/Secure2SuccessView.class.php

    r1655 r2370  
    55  public function executeHtml(AgaviRequestDataHolder $rd) 
    66  { 
    7     parent::setupHtml($rd); 
     7    $this->setupHtml($rd); 
    88 
    99    // set the title 
  • branches/0.11/samples/app/modules/Default/views/SecureSuccessView.class.php

    r2258 r2370  
    1818  public function executeHtml(AgaviRequestDataHolder $rd) 
    1919  { 
    20     parent::setupHtml($rd); 
     20    $this->setupHtml($rd); 
    2121 
    2222    // set the title 
  • branches/0.11/samples/app/modules/Default/views/UnavailableSuccessView.class.php

    r2258 r2370  
    1818  public function executeHtml(AgaviRequestDataHolder $rd) 
    1919  { 
    20     parent::setupHtml($rd); 
     20    $this->setupHtml($rd); 
    2121 
    2222    // set the title 
  • branches/0.11/samples/app/modules/Disabled/actions/IndexAction.class.php

    r1590 r2370  
    11<?php 
    22 
    3 class Disabled_IndexAction extends AgaviAction 
     3class Disabled_IndexAction extends AgaviSampleAppDisabledBaseAction 
    44{ 
    55  /** 
  • branches/0.11/samples/app/modules/Disabled/config/module.xml

    r1910 r2370  
    22<configurations> 
    33  <configuration> 
    4     <enabled>Off</enabled> 
    5     <title>Disabled Agavi Module</title> 
    6     <version></version> 
     4    <enabled>On</enabled> 
     5    <title>Dsiabled Agavi Sample App Module</title> 
     6    <version>1.0</version> 
    77    <name>Disabled</name> 
    88    <authors> 
    9       <author></author> 
     9      <author>David Zülke</author> 
    1010    </authors> 
    11     <homepage></homepage> 
     11    <homepage>http://www.agavi.org</homepage> 
    1212    <update_url></update_url> 
    13     <description></description> 
     13    <description>An example module that is disabled for demonstration purposes</description> 
    1414  </configuration> 
    1515</configurations> 
  • branches/0.11/samples/app/modules/Disabled/views/IndexSuccessView.class.php

    r1667 r2370  
    11<?php 
    22 
    3 class Disabled_IndexSuccessView extends AgaviView 
     3class Disabled_IndexSuccessView extends AgaviSampleAppDisabledBaseView 
    44{ 
     5  public function executeHtml(AgaviRequestDataHolder $rd) 
     6  { 
     7    $this->setupHtml($rd); 
    58 
    6   /** 
    7    * Execute any presentation logic and set template attributes. 
    8    * 
    9    */ 
    10   public function execute(AgaviRequestDataHolder $rd) 
    11   { 
    12     $this->loadLayout(); 
    13  
    14     // set the content type 
    15     $t