Author: Jonathan.Wage
Date: 2010-03-29 15:14:01 +0200 (Mon, 29 Mar 2010)
New Revision: 28870

Added:
   plugins/sfSympalPlugin/trunk/lib/util/sfSympalContext.php
Removed:
   plugins/sfSympalPlugin/trunk/lib/sfSympalContext.php
   plugins/sfSympalPlugin/trunk/lib/validator/sfValidatorSympalArray.class.php
   plugins/sfSympalPlugin/trunk/lib/widget/sfWidgetFormSympalArray.class.php
Modified:
   plugins/sfSympalPlugin/trunk/config/app.yml
   plugins/sfSympalPlugin/trunk/i18n/messages.es.xml
   plugins/sfSympalPlugin/trunk/lib/config/sfSympalConfig.class.php
   
plugins/sfSympalPlugin/trunk/lib/events/sfSympalComponentMethodNotFoundListener.class.php
   
plugins/sfSympalPlugin/trunk/lib/events/sfSympalContextLoadFactoriesListener.class.php
   
plugins/sfSympalPlugin/trunk/lib/events/sfSympalControllerChangeActionListener.class.php
   
plugins/sfSympalPlugin/trunk/lib/events/sfSympalFormFilterValuesListener.class.php
   
plugins/sfSympalPlugin/trunk/lib/events/sfSympalFormMethodNotFoundListener.class.php
   
plugins/sfSympalPlugin/trunk/lib/events/sfSympalFormPostConfigureListener.class.php
   
plugins/sfSympalPlugin/trunk/lib/events/sfSympalTemplateFilterParametersListener.class.php
   
plugins/sfSympalPlugin/trunk/lib/form/doctrine/PluginsfSympalContentTypeForm.class.php
   
plugins/sfSympalPlugin/trunk/lib/form/formatter/sfSympalWidgetFormSchemaFormatterTable.class.php
   plugins/sfSympalPlugin/trunk/lib/form/sfSympalForm.class.php
   
plugins/sfSympalPlugin/trunk/lib/model/doctrine/PluginsfSympalContent.class.php
   
plugins/sfSympalPlugin/trunk/lib/plugins/sfSympalAdminPlugin/config/sfSympalAdminPluginConfiguration.class.php
   
plugins/sfSympalPlugin/trunk/lib/plugins/sfSympalRenderingPlugin/lib/theme/sfSympalTheme.class.php
   
plugins/sfSympalPlugin/trunk/lib/plugins/sfSympalRenderingPlugin/lib/theme/sfSympalThemeConfiguration.class.php
   
plugins/sfSympalPlugin/trunk/lib/plugins/sfSympalUpgradePlugin/i18n/messages.es.xml
   plugins/sfSympalPlugin/trunk/lib/user/sfSympalUser.class.php
   plugins/sfSympalPlugin/trunk/lib/util/sfSympalExtendClass.class.php
Log:
[sfSympalPlugin] Synchronizing git repository to Symfony Plugins SVN

Modified: plugins/sfSympalPlugin/trunk/config/app.yml
===================================================================
--- plugins/sfSympalPlugin/trunk/config/app.yml 2010-03-29 12:51:49 UTC (rev 
28869)
+++ plugins/sfSympalPlugin/trunk/config/app.yml 2010-03-29 13:14:01 UTC (rev 
28870)
@@ -259,12 +259,10 @@
     # Enable and disable the check for upgrades via the web when on the Sympal 
dashboard
     check_for_upgrades_on_dashboard: false
 
-    # Whether or not to enable all modules found in your project
-    enable_all_modules: true
+    enable_all_modules: true     # Whether or not to enable all modules found 
in your project
+    disabled_modules:   []       # Array of modules to disable (these will be 
disabled even if enable_all_modules is true)
+    enabled_modules:    []       # If enable_all_modules is false, these 
modules will be enabled
 
-    # Array of modules to disable
-    disabled_modules: []
-
     # Callback to retrieve the cache driver used for storing various Sympal 
cache entries
     get_cache_driver_callback: [sfSympalCache, getCacheDriver]
 

Modified: plugins/sfSympalPlugin/trunk/i18n/messages.es.xml
===================================================================
--- plugins/sfSympalPlugin/trunk/i18n/messages.es.xml   2010-03-29 12:51:49 UTC 
(rev 28869)
+++ plugins/sfSympalPlugin/trunk/i18n/messages.es.xml   2010-03-29 13:14:01 UTC 
(rev 28870)
@@ -10,7 +10,7 @@
       </trans-unit>
       <trans-unit>
         <source>Redirects</source>
-        <target>Redirectos</target>
+        <target>Redirecciones</target>
       </trans-unit>
     </body>
   </file>

Modified: plugins/sfSympalPlugin/trunk/lib/config/sfSympalConfig.class.php
===================================================================
--- plugins/sfSympalPlugin/trunk/lib/config/sfSympalConfig.class.php    
2010-03-29 12:51:49 UTC (rev 28869)
+++ plugins/sfSympalPlugin/trunk/lib/config/sfSympalConfig.class.php    
2010-03-29 13:14:01 UTC (rev 28870)
@@ -34,7 +34,9 @@
     )
     {
       return 
isset(self::$config['app_sympal_config_orm_cache']['queries'][$key]['lifetime'])
 ? self::$config['app_sympal_config_orm_cache']['queries'][$key]['lifetime'] : 
self::$config['app_sympal_config_orm_cache']['lifetime'];
-    } else {
+    }
+    else
+    {
       return false;
     }
   }
@@ -63,7 +65,9 @@
     if ($name === null)
     {
       return isset(self::$config['app_sympal_config_'.$group]) ? 
self::$config['app_sympal_config_'.$group] : $default;
-    } else {
+    }
+    else
+    {
       return isset(self::$config['app_sympal_config_'.$group][$name]) ? 
self::$config['app_sympal_config_'.$group][$name] : $default;
     }
   }
@@ -78,10 +82,12 @@
    */
   public static function set($group, $name, $value = null)
   {
-    if (is_null($value))
+    if ($value === null)
     {
       self::$config['app_sympal_config_'.$group] = $name;
-    } else {
+    }
+    else
+    {
       self::$config['app_sympal_config_'.$group][$name] = $value;
     }
   }
@@ -105,8 +111,11 @@
       {
         $name = get_class($name);
       }
+
       return isset(self::$config['app_sympal_config_i18n']) && 
self::$config['app_sympal_config_i18n'] && 
isset(self::$config['app_sympal_config_internationalized_models'][$name]);
-    } else {
+    }
+    else
+    {
       return isset(self::$config['app_sympal_config_i18n']) && 
self::$config['app_sympal_config_i18n'];
     }
   }
@@ -140,6 +149,7 @@
   public static function getAdminGeneratorTheme()
   {
     $theme = sfSympalConfig::get('themes', sfSympalConfig::get('admin_theme'));
+
     return isset($theme['admin_generator_theme']) ? 
$theme['admin_generator_theme'] : 
sfSympalConfig::get('default_admin_generator_theme', null, 'sympal_admin');
   }
 
@@ -151,6 +161,7 @@
   public static function getAdminGeneratorClass()
   {
     $theme = sfSympalConfig::get('themes', sfSympalConfig::get('admin_theme'));
+
     return isset($theme['admin_generator_class']) ? 
$theme['admin_generator_class'] : 
sfSympalConfig::get('default_admin_generator_class', null, 
'sfSympalDoctrineGenerator');
   }
 
@@ -165,17 +176,22 @@
    */
   public static function writeSetting($group, $name, $value = null, 
$application = false)
   {
-    if (is_null($value))
+    // make sure we know our original values so we can call set later
+    $originalName = $name;
+    $originalValue = $value;
+
+    if ($value === null)
     {
       $value = $name;
-      $name = $group;
-      $group = null;
+      $name = null;
     }
 
     if ($application)
     {
       $path = sfConfig::get('sf_app_dir').'/config/app.yml';
-    } else {
+    }
+    else
+    {
       $path = sfConfig::get('sf_config_dir').'/app.yml';
     }
 
@@ -185,15 +201,16 @@
     }
     $array = (array) sfYaml::load(file_get_contents($path));
 
-    if (is_null($group))
+    if ($name === null)
     {
-      $array['all']['sympal_config'][$name] = $value;
-    } else {
+      $array['all']['sympal_config'][$group] = $value;
+    }
+    else
+    {
       $array['all']['sympal_config'][$group][$name] = $value;
     }
 
-    self::set($group, $name, $value);
-
+    sfSympalConfig::set($group, $originalName, $originalValue);
     file_put_contents($path, sfYaml::dump($array, 4));
   }
 }
\ No newline at end of file

Modified: 
plugins/sfSympalPlugin/trunk/lib/events/sfSympalComponentMethodNotFoundListener.class.php
===================================================================
--- 
plugins/sfSympalPlugin/trunk/lib/events/sfSympalComponentMethodNotFoundListener.class.php
   2010-03-29 12:51:49 UTC (rev 28869)
+++ 
plugins/sfSympalPlugin/trunk/lib/events/sfSympalComponentMethodNotFoundListener.class.php
   2010-03-29 13:14:01 UTC (rev 28870)
@@ -1,5 +1,14 @@
 <?php
 
+/**
+ * Effectively extends sfComponents to use sfSympalActions
+ * 
+ * @package     sfSympalPlugin
+ * @subpackage  events
+ * @author      Jonathan H. Wage <[email protected]>
+ * @since       2010-03-27
+ * @version     svn:$Id$ $Author$
+ */
 class sfSympalComponentMethodNotFoundListener extends sfSympalListener
 {
   public function getEventName()

Modified: 
plugins/sfSympalPlugin/trunk/lib/events/sfSympalContextLoadFactoriesListener.class.php
===================================================================
--- 
plugins/sfSympalPlugin/trunk/lib/events/sfSympalContextLoadFactoriesListener.class.php
      2010-03-29 12:51:49 UTC (rev 28869)
+++ 
plugins/sfSympalPlugin/trunk/lib/events/sfSympalContextLoadFactoriesListener.class.php
      2010-03-29 13:14:01 UTC (rev 28870)
@@ -26,8 +26,7 @@
   /**
    * The callback on the context.load_factories event.
    * 
-   * The subject is sfContext and the invoker (in normal cases) will
-   * be sfSympalConfiguration
+   * The subject is sfContext and the invoker is sfSympalConfiguration
    */
   public function run(sfEvent $event)
   {
@@ -44,29 +43,11 @@
     $this->_checkInstalled();
 
     $this->_invoker->initializeTheme();
+    
+    $this->_loadHelpers();
 
-    $helpers = array(
-      'Sympal',
-      'SympalContentSlot',
-      'SympalMenu',
-      'SympalPager',
-      'I18N',
-      'Asset',
-      'Url',
-      'Partial'
-    );
-
-    if ($this->_invoker->isAdminModule())
-    {
-      sfConfig::set('sf_login_module', 'sympal_admin');
-      $helpers[] = 'Admin';
-    }
-
-    $this->_invoker->getProjectConfiguration()->loadHelpers($helpers);
-
     $this->_dispatcher->notify(new sfEvent($this, 'sympal.load'));
 
-    new sfSympalContextLoadFactoriesListener($this->_dispatcher, 
$this->_invoker);
     new sfSympalComponentMethodNotFoundListener($this->_dispatcher, 
$this->_invoker);
     new sfSympalControllerChangeActionListener($this->_dispatcher, 
$this->_invoker);
     new sfSympalTemplateFilterParametersListener($this->_dispatcher, 
$this->_invoker);
@@ -82,36 +63,63 @@
    * loaded here for the first time, and this allows a hook into its
    * table definition.
    */
-  protected _initiateUserTable()
+  protected function _initiateUserTable()
   {
     $record = 
Doctrine_Core::getTable(sfSympalConfig::get('user_model'))->getRecordInstance();
     $this->_dispatcher->notify(new sfEvent($record, 
'sympal.user.set_table_definition', array('object' => $record)));
   }
 
   /**
-   * Handle the enabling of modules. Either enables all modules or only the 
configured modules.
+   * Loads default helpers needed by sympal
+   */
+  protected function _loadHelpers()
+  {
+    $helpers = array(
+      'Sympal',
+      'SympalContentSlot',
+      'SympalMenu',
+      'SympalPager',
+      'I18N',
+      'Asset',
+      'Url',
+      'Partial'
+    );
+
+    if ($this->_invoker->isAdminModule())
+    {
+      sfConfig::set('sf_login_module', 'sympal_admin');
+      $helpers[] = 'Admin';
+    }
+
+    $this->_invoker->getProjectConfiguration()->loadHelpers($helpers);
+  }
+
+  /**
+   * Handle the enabling of modules.
+   * 
+   * Either enables all modules or only modules defined by enabled_modules.
+   * In either case, the modules in disabled_modules are disabled
    *
    * @return void
    */
   private function _enableModules()
   {
-    if (sfSympalConfig::get('enable_all_modules', null, true))
+    $modules = sfConfig::get('sf_enabled_modules', array());
+    if (sfSympalConfig::get('enable_all_modules'))
     {
-      $modules = sfConfig::get('sf_enabled_modules', array());
-      if (sfSympalConfig::get('enable_all_modules'))
-      {
-        $modules = array_merge($modules, 
$this->_invoker->getCache()->getModules());
-      } else {
-        $modules = array_merge($modules, 
sfSympalConfig::get('enabled_modules', null, array()));
-      }
+      $modules = array_merge($modules, 
$this->_invoker->getCache()->getModules());
+    }
+    else
+    {
+      $modules = array_merge($modules, sfSympalConfig::get('enabled_modules', 
null, array()));
+    }
 
-      if ($disabledModules = sfSympalConfig::get('disabled_modules', null, 
array()))
-      {
-        $modules = array_diff($modules, $disabledModules);
-      }
+    if ($disabledModules = sfSympalConfig::get('disabled_modules', null, 
array()))
+    {
+      $modules = array_diff($modules, $disabledModules);
+    }
 
-      sfConfig::set('sf_enabled_modules', $modules);
-    }
+    sfConfig::set('sf_enabled_modules', $modules);
   }
 
   /**
@@ -124,7 +132,7 @@
   {
     $request = $this->_symfonyContext->getRequest();
 
-    // Prepare the symfony application is it has not been prepared yet
+    // Prepare the symfony application if it has not been prepared yet
     if (!$this->_symfonyContext->getUser() instanceof sfSympalUser)
     {
       chdir(sfConfig::get('sf_root_dir'));
@@ -134,19 +142,28 @@
       $this->_symfonyContext->getController()->redirect('@homepage');
     }
 
-    // Redirect to install module if...
-    //  not in test environment
-    //  sympal has not been installed
-    //  module is not already sympal_install
-    if (sfConfig::get('sf_environment') != 'test' && 
!sfSympalConfig::get('installed') && $request->getParameter('module') != 
'sympal_install')
+    /*
+     * Redirect to install module if...
+     *   * not in test environment
+     *   * sympal has not been installed
+     *   * module is not already sympal_install
+     */
+    if (sfConfig::get('sf_environment') != 'test'
+        && !sfSympalConfig::get('installed')
+        && $request->getParameter('module') != 'sympal_install')
     {
       $this->_symfonyContext->getController()->redirect('@sympal_install');
     }
 
-    // Redirect to homepage if no site record exists so we can prompt the user 
to create
-    // a site record for this application
-    // This check is only ran in dev mode
-    if (sfConfig::get('sf_environment') == 'dev' && 
!$this->_sympalContext->getSite() && 
$this->_symfonyContext->getRequest()->getPathInfo() != '/')
+    /*
+     * Redirect to homepage if no site record exists so we can prompt the
+     * user to create a site record for this application.
+     * 
+     * This check is only ran in dev mode
+     */
+    if (sfConfig::get('sf_environment') == 'dev'
+        && !$this->_sympalContext->getSite()
+        && $this->_symfonyContext->getRequest()->getPathInfo() != '/')
     {
       $this->_symfonyContext->getController()->redirect('@homepage');
     }

Modified: 
plugins/sfSympalPlugin/trunk/lib/events/sfSympalControllerChangeActionListener.class.php
===================================================================
--- 
plugins/sfSympalPlugin/trunk/lib/events/sfSympalControllerChangeActionListener.class.php
    2010-03-29 12:51:49 UTC (rev 28869)
+++ 
plugins/sfSympalPlugin/trunk/lib/events/sfSympalControllerChangeActionListener.class.php
    2010-03-29 13:14:01 UTC (rev 28870)
@@ -1,5 +1,14 @@
 <?php
 
+/**
+ * Listener class for controller.change_action
+ * 
+ * @package     sfSympalPlugin
+ * @subpackage  events
+ * @author      Jonathan H. Wage <[email protected]>
+ * @since       2010-03-27
+ * @version     svn:$Id$ $Author$
+ */
 class sfSympalControllerChangeActionListener extends sfSympalListener
 {
   private

Modified: 
plugins/sfSympalPlugin/trunk/lib/events/sfSympalFormFilterValuesListener.class.php
===================================================================
--- 
plugins/sfSympalPlugin/trunk/lib/events/sfSympalFormFilterValuesListener.class.php
  2010-03-29 12:51:49 UTC (rev 28869)
+++ 
plugins/sfSympalPlugin/trunk/lib/events/sfSympalFormFilterValuesListener.class.php
  2010-03-29 13:14:01 UTC (rev 28870)
@@ -1,5 +1,16 @@
 <?php
 
+/**
+ * Listener for the form.filter_values event
+ * 
+ * Ensures that the recaptcha values are set correctly
+ * 
+ * @package     sfSympalPlugin
+ * @subpackage  events
+ * @author      Jonathan H. Wage <[email protected]>
+ * @since       2010-03-27
+ * @version     svn:$Id$ $Author$
+ */
 class sfSympalFormFilterValuesListener extends sfSympalListener
 {
   public function getEventName()

Modified: 
plugins/sfSympalPlugin/trunk/lib/events/sfSympalFormMethodNotFoundListener.class.php
===================================================================
--- 
plugins/sfSympalPlugin/trunk/lib/events/sfSympalFormMethodNotFoundListener.class.php
        2010-03-29 12:51:49 UTC (rev 28869)
+++ 
plugins/sfSympalPlugin/trunk/lib/events/sfSympalFormMethodNotFoundListener.class.php
        2010-03-29 13:14:01 UTC (rev 28870)
@@ -1,5 +1,13 @@
 <?php
-
+/**
+ * Effectively extends sfForm to sfSympalForm
+ * 
+ * @package     sfSympalPlugin
+ * @subpackage  events
+ * @author      Jonathan H. Wage <[email protected]>
+ * @since       2010-03-27
+ * @version     svn:$Id$ $Author$
+ */
 class sfSympalFormMethodNotFoundListener extends sfSympalListener
 {
   public function getEventName()
@@ -10,6 +18,7 @@
   public function run(sfEvent $event)
   {
     $sympalForm = new sfSympalForm();
+
     return $sympalForm->extend($event);
   }
 }
\ No newline at end of file

Modified: 
plugins/sfSympalPlugin/trunk/lib/events/sfSympalFormPostConfigureListener.class.php
===================================================================
--- 
plugins/sfSympalPlugin/trunk/lib/events/sfSympalFormPostConfigureListener.class.php
 2010-03-29 12:51:49 UTC (rev 28869)
+++ 
plugins/sfSympalPlugin/trunk/lib/events/sfSympalFormPostConfigureListener.class.php
 2010-03-29 13:14:01 UTC (rev 28870)
@@ -1,5 +1,13 @@
 <?php
-
+/**
+ * Listener on form.post_configure
+ * 
+ * @package     sfSympalPlugin
+ * @subpackage  events
+ * @author      Jonathan H. Wage <[email protected]>
+ * @since       2010-03-27
+ * @version     svn:$Id$ $Author$
+ */
 class sfSympalFormPostConfigureListener extends sfSympalListener
 {
   public function getEventName()

Modified: 
plugins/sfSympalPlugin/trunk/lib/events/sfSympalTemplateFilterParametersListener.class.php
===================================================================
--- 
plugins/sfSympalPlugin/trunk/lib/events/sfSympalTemplateFilterParametersListener.class.php
  2010-03-29 12:51:49 UTC (rev 28869)
+++ 
plugins/sfSympalPlugin/trunk/lib/events/sfSympalTemplateFilterParametersListener.class.php
  2010-03-29 13:14:01 UTC (rev 28870)
@@ -1,5 +1,17 @@
 <?php
 
+/**
+ * Listens to template.filter_parameters to add the following variables to the 
view:
+ *   * sf_sympal_context
+ *   * sf_sympal_content
+ *   * sf_sympal_menu_item
+ * 
+ * @package     
+ * @subpackage  
+ * @author      Jonathan H. Wage <[email protected]>
+ * @since       2010-03-27
+ * @version     svn:$Id$ $Author$
+ */
 class sfSympalTemplateFilterParametersListener extends sfSympalListener
 {
   public function getEventName()
@@ -7,6 +19,11 @@
     return 'template.filter_parameters';
   }
 
+  /**
+   * @TODO How does this compare with the variables passed to the view
+   * via sfSympalContentRenderer. This seems more all-encompassing, but
+   * still possibly redundant.
+   */
   public function run(sfEvent $event, $parameters)
   {
     if (!$sympalContext = $this->_invoker->getSympalContext())
@@ -14,14 +31,17 @@
       return $parameters;
     }
     $parameters['sf_sympal_context'] = $sympalContext;
+
     if ($content = $sympalContext->getCurrentContent())
     {
       $parameters['sf_sympal_content'] = $content;
     }
+
     if ($menuItem = $sympalContext->getCurrentMenuItem())
     {
       $parameters['sf_sympal_menu_item'] = $menuItem;
     }
+
     return $parameters;
   }
 }
\ No newline at end of file

Modified: 
plugins/sfSympalPlugin/trunk/lib/form/doctrine/PluginsfSympalContentTypeForm.class.php
===================================================================
--- 
plugins/sfSympalPlugin/trunk/lib/form/doctrine/PluginsfSympalContentTypeForm.class.php
      2010-03-29 12:51:49 UTC (rev 28869)
+++ 
plugins/sfSympalPlugin/trunk/lib/form/doctrine/PluginsfSympalContentTypeForm.class.php
      2010-03-29 13:14:01 UTC (rev 28870)
@@ -12,8 +12,8 @@
   public function setup()
   {
     parent::setup();
-
-    $plugins = 
$this->getSympalContext()->getSympalConfiguration()->getContentTypePlugins();
+    
+    $plugins = 
sfSympalContext::getInstance()->getSympalConfiguration()->getContentTypePlugins();
     $plugins = array_combine($plugins, $plugins);
     $plugins = array_merge(array('' => ''), $plugins);
 

Modified: 
plugins/sfSympalPlugin/trunk/lib/form/formatter/sfSympalWidgetFormSchemaFormatterTable.class.php
===================================================================
--- 
plugins/sfSympalPlugin/trunk/lib/form/formatter/sfSympalWidgetFormSchemaFormatterTable.class.php
    2010-03-29 12:51:49 UTC (rev 28869)
+++ 
plugins/sfSympalPlugin/trunk/lib/form/formatter/sfSympalWidgetFormSchemaFormatterTable.class.php
    2010-03-29 13:14:01 UTC (rev 28870)
@@ -1,5 +1,15 @@
 <?php
 
+/**
+ * Sympal extension of the table form formatter to add a "required" class
+ * to the label of required fields
+ * 
+ * @package     sfSympalPlugin
+ * @subpackage  widget
+ * @author      Jonathan H. Wage <[email protected]>
+ * @since       2010-03-27
+ * @version     svn:$Id$ $Author$
+ */
 class sfSympalWidgetFormSchemaFormatterTable extends 
sfWidgetFormSchemaFormatterTable
 {
   protected

Modified: plugins/sfSympalPlugin/trunk/lib/form/sfSympalForm.class.php
===================================================================
--- plugins/sfSympalPlugin/trunk/lib/form/sfSympalForm.class.php        
2010-03-29 12:51:49 UTC (rev 28869)
+++ plugins/sfSympalPlugin/trunk/lib/form/sfSympalForm.class.php        
2010-03-29 13:14:01 UTC (rev 28870)
@@ -1,12 +1,16 @@
 <?php
 
+/**
+ * Effectively acts as an extension of sfForm
+ * 
+ * @package     sfSympalPlugin
+ * @subpackage  form
+ * @author      Jonathan H. Wage <[email protected]>
+ * @since       2010-03-27
+ * @version     svn:$Id$ $Author$
+ */
 class sfSympalForm extends sfSympalExtendClass
 {
-  public function getSympalContext($site = null)
-  {
-    return sfSympalContext::getInstance($site);
-  }
-
   public function getRequiredFields(sfValidatorSchema $validatorSchema = null, 
$format = null)
   {
     if ($validatorSchema === null)

Modified: 
plugins/sfSympalPlugin/trunk/lib/model/doctrine/PluginsfSympalContent.class.php
===================================================================
--- 
plugins/sfSympalPlugin/trunk/lib/model/doctrine/PluginsfSympalContent.class.php 
    2010-03-29 12:51:49 UTC (rev 28869)
+++ 
plugins/sfSympalPlugin/trunk/lib/model/doctrine/PluginsfSympalContent.class.php 
    2010-03-29 13:14:01 UTC (rev 28870)
@@ -555,13 +555,22 @@
     return $this->getContentRouteObject()->getEvaluatedRoutePath();
   }
 
+  /**
+   * Used by plugin install to attempt to set some "title" value to the
+   * default string. This is like the opposite of __toString()
+   * 
+   * @param string $value The value to set to the "title" field
+   */
   public function trySettingTitleProperty($value)
   {
     foreach (array('title', 'name', 'subject', 'header') as $name)
     {
-      try {
+      try
+      {
         $this->$name = $value;
-      } catch (Exception $e) {}
+      } catch (Exception $e)
+      {
+      }
     }
   }
 

Modified: 
plugins/sfSympalPlugin/trunk/lib/plugins/sfSympalAdminPlugin/config/sfSympalAdminPluginConfiguration.class.php
===================================================================
--- 
plugins/sfSympalPlugin/trunk/lib/plugins/sfSympalAdminPlugin/config/sfSympalAdminPluginConfiguration.class.php
      2010-03-29 12:51:49 UTC (rev 28869)
+++ 
plugins/sfSympalPlugin/trunk/lib/plugins/sfSympalAdminPlugin/config/sfSympalAdminPluginConfiguration.class.php
      2010-03-29 13:14:01 UTC (rev 28870)
@@ -1,5 +1,16 @@
 <?php
 
+/**
+ * Plugin configuration for the admin plugin
+ * 
+ * Hooks up to several events related to editors and menus
+ * 
+ * @package     sfSympalAdminPlugin
+ * @subpackage  config
+ * @author      Jonathan H. Wage <[email protected]>
+ * @since       2010-03-27
+ * @version     svn:$Id$ $Author$
+ */
 class sfSympalAdminPluginConfiguration extends sfPluginConfiguration
 {
   public function initialize()

Modified: 
plugins/sfSympalPlugin/trunk/lib/plugins/sfSympalRenderingPlugin/lib/theme/sfSympalTheme.class.php
===================================================================
--- 
plugins/sfSympalPlugin/trunk/lib/plugins/sfSympalRenderingPlugin/lib/theme/sfSympalTheme.class.php
  2010-03-29 12:51:49 UTC (rev 28869)
+++ 
plugins/sfSympalPlugin/trunk/lib/plugins/sfSympalRenderingPlugin/lib/theme/sfSympalTheme.class.php
  2010-03-29 13:14:01 UTC (rev 28870)
@@ -1,9 +1,29 @@
 <?php
 
+/**
+ * Represents a theme
+ * 
+ * @package     sfSympalRenderingPlugin
+ * @subpackage  theme
+ * @author      Jonathan H. Wage <[email protected]>
+ * @since       2010-03-27
+ * @version     svn:$Id$ $Author$
+ */
 class sfSympalTheme
 {
+  /**
+   * Whether or not this theme has been loaded 
+   * @see load()
+   * 
+   * @var boolean
+   */
   protected
-    $_isLoaded = false,
+    $_isLoaded = false;
+  
+  /**
+   * Dependencies needed by this class
+   */
+  protected
     $_sympalContext,
     $_configuration,
     $_request,
@@ -42,6 +62,9 @@
     return $this->_configuration->getJavascripts();
   }
 
+  /**
+   * Loads a theme - effectively making it active
+   */
   public function load()
   {
     // Change the layout
@@ -94,8 +117,17 @@
     }
   }
 
+  /**
+   * Unloads this theme by removing its stylesheets and javascripts
+   */
   public function unload()
   {
+    // if we're not loaded, no need to unload
+    if (!$this->_isLoaded)
+    {
+      return;
+    }
+    
     // Set the loaded flag to false
     $this->_isLoaded = false;
 
@@ -122,6 +154,9 @@
     }
   }
 
+  /**
+   * Changes the current layout to the layout of this theme
+   */
   public function changeLayout()
   {
     $info = pathinfo($this->_configuration->getLayoutPath());

Modified: 
plugins/sfSympalPlugin/trunk/lib/plugins/sfSympalRenderingPlugin/lib/theme/sfSympalThemeConfiguration.class.php
===================================================================
--- 
plugins/sfSympalPlugin/trunk/lib/plugins/sfSympalRenderingPlugin/lib/theme/sfSympalThemeConfiguration.class.php
     2010-03-29 12:51:49 UTC (rev 28869)
+++ 
plugins/sfSympalPlugin/trunk/lib/plugins/sfSympalRenderingPlugin/lib/theme/sfSympalThemeConfiguration.class.php
     2010-03-29 13:14:01 UTC (rev 28870)
@@ -1,7 +1,7 @@
 <?php
 
 /**
- * This class represents a "theme".
+ * This class represents the configuration for a "theme".
  * 
  * This wraps the configuration of a theme so it can be easily accessed.
  * 
@@ -97,17 +97,29 @@
     return $path;
   }
 
+  /**
+   * If no stylesheets are defined, this returns some default css to
+   * load automatically.
+   * 
+   * The css will be THEME_NAME.css, and can live in a variety of dirs
+   * 
+   * @TODO Consider removing this idea or part of it - this feels magical.
+   */
   protected function _findStylesheetPath()
   {
     $name = $this->getName();
     if (strpos($this->getLayoutPath(), 'sfSympalPlugin/templates') !== false)
     {
       return '/sfSympalPlugin/css/' . $name . '.css';
-    } else {
+    }
+    else
+    {
       if (is_readable(sfConfig::get('sf_web_dir').'/css/'.$name.'.css'))
       {
         return $name;
-      } else {
+      }
+      else
+      {
         $configuration = sfContext::getInstance()->getConfiguration();
         $pluginPaths = $configuration->getAllPluginPaths();
 

Modified: 
plugins/sfSympalPlugin/trunk/lib/plugins/sfSympalUpgradePlugin/i18n/messages.es.xml
===================================================================
--- 
plugins/sfSympalPlugin/trunk/lib/plugins/sfSympalUpgradePlugin/i18n/messages.es.xml
 2010-03-29 12:51:49 UTC (rev 28869)
+++ 
plugins/sfSympalPlugin/trunk/lib/plugins/sfSympalUpgradePlugin/i18n/messages.es.xml
 2010-03-29 13:14:01 UTC (rev 28870)
@@ -6,7 +6,7 @@
     <body>
       <trans-unit>
         <source>Your Sympal installation is already up to date at %s!</source>
-        <target>Tu instalación ya está a la versión corriente (%s)!</target>
+        <target>¡Tu instalación de Sympal ya está actualizada (%s)!</target>
       </trans-unit>
     </body>
   </file>

Deleted: plugins/sfSympalPlugin/trunk/lib/sfSympalContext.php
===================================================================
--- plugins/sfSympalPlugin/trunk/lib/sfSympalContext.php        2010-03-29 
12:51:49 UTC (rev 28869)
+++ plugins/sfSympalPlugin/trunk/lib/sfSympalContext.php        2010-03-29 
13:14:01 UTC (rev 28870)
@@ -1,330 +0,0 @@
-<?php
-
-class sfSympalContext
-{
-  protected static
-    $_instances = array(),
-    $_current;
-
-  protected
-    $_site,
-    $_siteSlug,
-    $_sympalConfiguration,
-    $_symfonyContext,
-    $_currentMenuItem,
-    $_currentContent,
-    $_currentSite,
-    $_previousTheme,
-    $_theme,
-    $_themeObjects = array();
-
-  public function __construct(sfSympalConfiguration $sympalConfiguration, 
sfContext $symfonyContext)
-  {
-    $this->_siteSlug = $symfonyContext->getConfiguration()->getApplication();
-    $this->_sympalConfiguration = $sympalConfiguration;
-    $this->_symfonyContext = $symfonyContext;
-  }
-
-  /**
-   * Get the current sfSympalMenuItem instance for this sympal context
-   *
-   * @return sfSympalMenuItem
-   */
-  public function getCurrentMenuItem()
-  {
-    if (!$this->_currentMenuItem)
-    {
-      $this->_currentMenuItem = 
sfSympalMenuSiteManager::getInstance()->findCurrentMenuItem();
-    }
-
-    return $this->_currentMenuItem;
-  }
-
-  /**
-   * Set the current sfSympalMenuItem instance for this sympal context
-   *
-   * @param sfSympalMenuItem $menuItem
-   * @return void
-   */
-  public function setCurrentMenuItem(sfSympalMenuItem $menuItem)
-  {
-    $this->_currentMenuItem = $menuItem;
-  }
-
-  /**
-   * Get the current sfSympalContent instance for this sympal context
-   *
-   * @return sfSympalContent $content
-   */
-  public function getCurrentContent()
-  {
-    return $this->_currentContent;
-  }
-
-  /**
-   * Set the current sfSympalContent instance for this sympal context
-   *
-   * @param sfSympalContent $content 
-   * @return void
-   */
-  public function setCurrentContent(sfSympalContent $content)
-  {
-    $this->_currentContent = $content;
-    if (!$this->_site)
-    {
-      $this->_site = $content->getSite();
-    }
-    if ($menuItem = $content->getMenuItem())
-    {
-      $this->_currentMenuItem = $menuItem;
-    }
-  }
-
-  /**
-   * Set the current sfSympalSite instance for this sympal context
-   *
-   * @param sfSympalSite $site 
-   * @return void
-   */
-  public function setSite(sfSympalSite $site)
-  {
-    $this->_site = $site;
-  }
-
-  /**
-   * Get the current sfSympalSite instance for this sympal context
-   *
-   * @return sfSympalSite $site
-   */
-  public function getSite()
-  {
-    if (!$this->_site)
-    {
-      $this->_site =  Doctrine_Core::getTable('sfSympalSite')
-        ->createQuery('s')
-        ->where('s.slug = ?', $this->_siteSlug)
-        ->enableSympalResultCache('sympal_context_get_site')
-        ->fetchOne();
-    }
-    return $this->_site;
-  }
-
-  /**
-   * Shortcut to check if we should load the frontend editor
-   *
-   * @return boolean
-   */
-  public function shouldLoadFrontendEditor()
-  {
-    return 
$this->_symfonyContext->getConfiguration()->getPluginConfiguration('sfSympalEditorPlugin')->shouldLoadEditor();
-  }
-
-  /**
-   * Get the current site slug
-   *
-   * @return string $siteSlug
-   */
-  public function getSiteSlug()
-  {
-    return $this->_siteSlug;
-  }
-
-  /**
-   * Get the current theme
-   *
-   * @return string $theme
-   */
-  public function getTheme()
-  {
-    return $this->_theme;
-  }
-
-  /**
-   * Get the theme object for the current theme or a given theme name
-   *
-   * @param string $name 
-   * @return sfSympalTheme $theme
-   */
-  public function getThemeObject($name = null)
-  {
-    $theme = $name ? $name : $this->_theme;
-    if (!isset($this->_themeObjects[$theme]))
-    {
-      $configurationArray = sfSympalConfig::get('themes', $theme);
-      $configurationArray['name'] = $theme;
-
-      $configurationClass = isset($configurationArray['config_class']) ? 
$configurationArray['class'] : 'sfSympalThemeConfiguration';
-      $themeClass = isset($configurationArray['theme_class']) ? 
$configurationArray['theme_class'] : 'sfSympalTheme';
-      $configuration = new $configurationClass($configurationArray);
-      $this->_themeObjects[$theme] = new $themeClass($this, $configuration);
-    }
-    return isset($this->_themeObjects[$theme]) ? $this->_themeObjects[$theme] 
: false;
-  }
-
-  /**
-   * Get array of all instantiated theme objects
-   *
-   * @return array $themeObjects
-   */
-  public function getThemeObjects()
-  {
-    return $this->_themeObjects;
-  }
-
-  /**
-   * Shortcut to check if we are inside an admin module
-   *
-   * @return boolean
-   */
-  public function isAdminModule()
-  {
-    return $this->_sympalConfiguration->isAdminModule();
-  }
-
-  /**
-   * Get the previous theme object that was loaded
-   *
-   * @return sfSympalTheme $theme
-   */
-  public function getPreviousTheme()
-  {
-    return $this->getThemeObject($this->_previousTheme);
-  }
-
-  /**
-   * Unload the previous theme object that was loaded
-   *
-   * @return void
-   */
-  public function unloadPreviousTheme()
-  {
-    if ($previousTheme = $this->getPreviousTheme())
-    {
-      $previousTheme->unload();
-    }
-  }
-
-  /**
-   * Set the current theme name
-   *
-   * @param string $theme 
-   * @return void
-   */
-  public function setTheme($theme)
-  {
-    $this->_theme = $theme;
-  }
-
-  /**
-   * Load a given theme or the current configured theme in ->_theme
-   *
-   * @param string $name Optional theme name to load
-   * @return void
-   */
-  public function loadTheme($name = null)
-  {
-    $this->_previousTheme = $this->_theme;
-    $theme = $name ? $name : $this->_theme;
-    $this->setTheme($theme);
-    if ($theme = $this->getThemeObject($theme))
-    {
-      $theme->load();
-    }
-  }
-
-  /**
-   * Get the current sfSympalConfiguration instance
-   *
-   * @return sfSympalConfiguration $sympalConfiguration
-   */
-  public function getSympalConfiguration()
-  {
-    return $this->_sympalConfiguration;
-  }
-
-  /**
-   * Get the current sfContext instance
-   *
-   * @return sfContext $symfonyContext
-   */
-  public function getSymfonyContext()
-  {
-    return $this->_symfonyContext;
-  }
-
-  /**
-   * Get a sfSympalContentRenderer instance for a given sfSympalContent 
instance
-   *
-   * @param sfSympalContent $content The sfSympalContent instance
-   * @param string $format Optional format to render
-   * @return sfSympalContentRenderer $renderer
-   */
-  public function getContentRenderer(sfSympalContent $content, $format = null)
-  {
-    return new sfSympalContentRenderer($this, $content, $format);
-  }
-
-  /**
-   * Get a sfSympalContentActionLoader instance for a given sfActions instance
-   *
-   * @param sfActions $actions 
-   * @return sfSympalContentActionLoader $loader
-   */
-  public function getSympalContentActionLoader(sfActions $actions)
-  {
-    return new sfSympalContentActionLoader($actions);
-  }
-
-  /**
-   * Get a sfSympalContext instance
-   *
-   * @param string $site Optional site/app name to get
-   * @return sfSympalContext $sympalContext
-   */
-  public static function getInstance($site = null)
-  {
-    if (is_null($site))
-    {
-      if (!self::$_current)
-      {
-        throw new InvalidArgumentException('Could not find a current sympal 
context instance');
-      }
-      return self::$_current;
-    }
-
-    if (!isset(self::$_instances[$site]))
-    {
-      throw new sfException($site.' instance does not exist.');
-    }
-    return self::$_instances[$site];
-  }
-
-  /**
-   * Check if we have a sfSympalContext yet
-   *
-   * @param string $site Optional site/app name to check for
-   * @return boolean
-   */
-  public static function hasInstance($site = null)
-  {
-    return is_null($site) ? !empty(self::$_instances) : 
isset(self::$_instances[$site]);
-  }
-
-  /**
-   * Create a new sfSympalContext instance for a given sfContext and 
sfSympalConfiguration instance
-   *
-   * @param sfContext $symfonyContext 
-   * @param sfSympalConfiguration $sympalConfiguration 
-   * @return sfSympalContext $sympalContext
-   */
-  public static function createInstance(sfContext $symfonyContext, 
sfSympalConfiguration $sympalConfiguration)
-  {
-    $site = $symfonyContext->getConfiguration()->getApplication();
-
-    $instance = new self($sympalConfiguration, $symfonyContext);
-    self::$_instances[$site] = $instance;
-    self::$_current = $instance;
-
-    return self::$_instances[$site];
-  }
-}
\ No newline at end of file

Modified: plugins/sfSympalPlugin/trunk/lib/user/sfSympalUser.class.php
===================================================================
--- plugins/sfSympalPlugin/trunk/lib/user/sfSympalUser.class.php        
2010-03-29 12:51:49 UTC (rev 28869)
+++ plugins/sfSympalPlugin/trunk/lib/user/sfSympalUser.class.php        
2010-03-29 13:14:01 UTC (rev 28870)
@@ -66,10 +66,11 @@
    */
   public function isEditMode($forceCheckAgain = false)
   {
-    if (is_null($this->_isEditMode) || $forceCheckAgain === true)
+    if ($this->_isEditMode === null || $forceCheckAgain === true)
     {
       $this->doIsEditModeCheck();
     }
+
     return $this->_isEditMode;
   }
 

Added: plugins/sfSympalPlugin/trunk/lib/util/sfSympalContext.php
===================================================================
--- plugins/sfSympalPlugin/trunk/lib/util/sfSympalContext.php                   
        (rev 0)
+++ plugins/sfSympalPlugin/trunk/lib/util/sfSympalContext.php   2010-03-29 
13:14:01 UTC (rev 28870)
@@ -0,0 +1,362 @@
+<?php
+
+/**
+ * Context class for a Sympal instance
+ * 
+ * There is one Sympal instance for "site" (i.e. application)
+ * 
+ * This manages things such as
+ *   * The current sfSympalSite object
+ *   * The current menu item
+ *   * The current theme
+ * 
+ * @package     sfSympalPlugin
+ * @subpackage  util
+ * @author      Ryan Weaver <[email protected]>
+ * @since       2010-03-27
+ * @version     svn:$Id$ $Author$
+ */
+class sfSympalContext
+{
+  protected static
+    $_instances = array(),
+    $_current;
+
+  protected
+    $_site,
+    $_siteSlug;
+  
+  protected
+    $_sympalConfiguration,
+    $_symfonyContext;
+  
+  protected
+    $_currentMenuItem,
+    $_currentContent;
+  
+  protected
+    $_previousTheme,
+    $_theme,
+    $_themeObjects = array();
+
+  public function __construct(sfSympalConfiguration $sympalConfiguration, 
sfContext $symfonyContext)
+  {
+    $this->_siteSlug = $symfonyContext->getConfiguration()->getApplication();
+    $this->_sympalConfiguration = $sympalConfiguration;
+    $this->_symfonyContext = $symfonyContext;
+  }
+
+  /**
+   * Get the current sfSympalMenuItem instance for this sympal context
+   *
+   * @return sfSympalMenuItem
+   */
+  public function getCurrentMenuItem()
+  {
+    if (!$this->_currentMenuItem)
+    {
+      $this->_currentMenuItem = 
sfSympalMenuSiteManager::getInstance()->findCurrentMenuItem();
+    }
+
+    return $this->_currentMenuItem;
+  }
+
+  /**
+   * Set the current sfSympalMenuItem instance for this sympal context
+   *
+   * @param sfSympalMenuItem $menuItem
+   * @return void
+   */
+  public function setCurrentMenuItem(sfSympalMenuItem $menuItem)
+  {
+    $this->_currentMenuItem = $menuItem;
+  }
+
+  /**
+   * Get the current sfSympalContent instance for this sympal context
+   *
+   * @return sfSympalContent $content
+   */
+  public function getCurrentContent()
+  {
+    return $this->_currentContent;
+  }
+
+  /**
+   * Set the current sfSympalContent instance for this sympal context
+   *
+   * @param sfSympalContent $content 
+   * @return void
+   */
+  public function setCurrentContent(sfSympalContent $content)
+  {
+    $this->_currentContent = $content;
+    if (!$this->_site)
+    {
+      $this->_site = $content->getSite();
+    }
+    if ($menuItem = $content->getMenuItem())
+    {
+      $this->_currentMenuItem = $menuItem;
+    }
+  }
+
+  /**
+   * Set the current sfSympalSite instance for this sympal context
+   *
+   * @param sfSympalSite $site 
+   * @return void
+   */
+  public function setSite(sfSympalSite $site)
+  {
+    $this->_site = $site;
+  }
+
+  /**
+   * Get the current sfSympalSite instance for this sympal context
+   *
+   * @return sfSympalSite $site
+   */
+  public function getSite()
+  {
+    if (!$this->_site)
+    {
+      $this->_site =  Doctrine_Core::getTable('sfSympalSite')
+        ->createQuery('s')
+        ->where('s.slug = ?', $this->_siteSlug)
+        ->enableSympalResultCache('sympal_context_get_site')
+        ->fetchOne();
+    }
+
+    return $this->_site;
+  }
+
+  /**
+   * Shortcut to check if we should load the frontend editor
+   *
+   * @return boolean
+   */
+  public function shouldLoadFrontendEditor()
+  {
+    return 
$this->_symfonyContext->getConfiguration()->getPluginConfiguration('sfSympalEditorPlugin')->shouldLoadEditor();
+  }
+
+  /**
+   * Get the current site slug
+   *
+   * @return string $siteSlug
+   */
+  public function getSiteSlug()
+  {
+    return $this->_siteSlug;
+  }
+
+  /**
+   * Get the current theme
+   *
+   * @return string $theme
+   */
+  public function getTheme()
+  {
+    return $this->_theme;
+  }
+
+  /**
+   * Get the theme object for the current theme or a given theme name
+   *
+   * @param string $name 
+   * @return sfSympalTheme $theme
+   */
+  public function getThemeObject($name = null)
+  {
+    $theme = $name ? $name : $this->_theme;
+    if (!isset($this->_themeObjects[$theme]))
+    {
+      $configurationArray = sfSympalConfig::get('themes', $theme);
+      if (!$configurationArray)
+      {
+        throw new sfException(sprintf('Cannot load them "%s" - no 
configuration found'));
+      }
+      $configurationArray['name'] = $theme;
+
+      $configurationClass = isset($configurationArray['config_class']) ? 
$configurationArray['class'] : 'sfSympalThemeConfiguration';
+      $themeClass = isset($configurationArray['theme_class']) ? 
$configurationArray['theme_class'] : 'sfSympalTheme';
+      $configuration = new $configurationClass($configurationArray);
+      $this->_themeObjects[$theme] = new $themeClass($this, $configuration);
+    }
+
+    return isset($this->_themeObjects[$theme]) ? $this->_themeObjects[$theme] 
: false;
+  }
+
+  /**
+   * Get array of all instantiated theme objects
+   *
+   * @return array $themeObjects
+   */
+  public function getThemeObjects()
+  {
+    return $this->_themeObjects;
+  }
+
+  /**
+   * Shortcut to check if we are inside an admin module
+   *
+   * @return boolean
+   */
+  public function isAdminModule()
+  {
+    return $this->_sympalConfiguration->isAdminModule();
+  }
+
+  /**
+   * Get the previous theme object that was loaded
+   *
+   * @return sfSympalTheme $theme
+   */
+  public function getPreviousTheme()
+  {
+    return $this->getThemeObject($this->_previousTheme);
+  }
+
+  /**
+   * Unload the previous theme object that was loaded
+   *
+   * @return void
+   */
+  public function unloadPreviousTheme()
+  {
+    if ($previousTheme = $this->getPreviousTheme())
+    {
+      $previousTheme->unload();
+    }
+  }
+
+  /**
+   * Set the current theme name
+   *
+   * @param string $theme 
+   * @return void
+   */
+  public function setTheme($theme)
+  {
+    $this->_theme = $theme;
+    if ($theme != $this->_theme)
+    {
+      $this->_previousTheme = $this->_theme;
+      $this->_theme = $theme;
+    }
+  }
+
+  /**
+   * Load a given theme or the current configured theme in ->_theme
+   *
+   * @param string $name Optional theme name to load
+   * @return void
+   */
+  public function loadTheme($name = null)
+  {
+    $theme = $name ? $name : $this->_theme;
+    $this->setTheme($theme);
+
+    if ($themeObj = $this->getThemeObject($theme))
+    {
+      $themeObj->load();
+    }
+  }
+
+  /**
+   * Get the current sfSympalConfiguration instance
+   *
+   * @return sfSympalConfiguration $sympalConfiguration
+   */
+  public function getSympalConfiguration()
+  {
+    return $this->_sympalConfiguration;
+  }
+
+  /**
+   * Get the current sfContext instance
+   *
+   * @return sfContext $symfonyContext
+   */
+  public function getSymfonyContext()
+  {
+    return $this->_symfonyContext;
+  }
+
+  /**
+   * Get a sfSympalContentRenderer instance for a given sfSympalContent 
instance
+   *
+   * @param sfSympalContent $content The sfSympalContent instance
+   * @param string $format Optional format to render
+   * @return sfSympalContentRenderer $renderer
+   */
+  public function getContentRenderer(sfSympalContent $content, $format = null)
+  {
+    return new sfSympalContentRenderer($this, $content, $format);
+  }
+
+  /**
+   * Get a sfSympalContentActionLoader instance for a given sfActions instance
+   *
+   * @param sfActions $actions 
+   * @return sfSympalContentActionLoader $loader
+   */
+  public function getSympalContentActionLoader(sfActions $actions)
+  {
+    return new sfSympalContentActionLoader($actions);
+  }
+
+  /**
+   * Get a sfSympalContext instance
+   *
+   * @param string $site Optional site/app name to get
+   * @return sfSympalContext $sympalContext
+   */
+  public static function getInstance($site = null)
+  {
+    if (is_null($site))
+    {
+      if (!self::$_current)
+      {
+        throw new InvalidArgumentException('Could not find a current sympal 
context instance');
+      }
+      return self::$_current;
+    }
+
+    if (!isset(self::$_instances[$site]))
+    {
+      throw new sfException($site.' instance does not exist.');
+    }
+    return self::$_instances[$site];
+  }
+
+  /**
+   * Check if we have a sfSympalContext yet
+   *
+   * @param string $site Optional site/app name to check for
+   * @return boolean
+   */
+  public static function hasInstance($site = null)
+  {
+    return is_null($site) ? !empty(self::$_instances) : 
isset(self::$_instances[$site]);
+  }
+
+  /**
+   * Create a new sfSympalContext instance for a given sfContext and 
sfSympalConfiguration instance
+   *
+   * @param sfContext $symfonyContext 
+   * @param sfSympalConfiguration $sympalConfiguration 
+   * @return sfSympalContext $sympalContext
+   */
+  public static function createInstance(sfContext $symfonyContext, 
sfSympalConfiguration $sympalConfiguration)
+  {
+    $site = $symfonyContext->getConfiguration()->getApplication();
+
+    $instance = new self($sympalConfiguration, $symfonyContext);
+    self::$_instances[$site] = $instance;
+    self::$_current = $instance;
+
+    return self::$_instances[$site];
+  }
+}
\ No newline at end of file

Modified: plugins/sfSympalPlugin/trunk/lib/util/sfSympalExtendClass.class.php
===================================================================
--- plugins/sfSympalPlugin/trunk/lib/util/sfSympalExtendClass.class.php 
2010-03-29 12:51:49 UTC (rev 28869)
+++ plugins/sfSympalPlugin/trunk/lib/util/sfSympalExtendClass.class.php 
2010-03-29 13:14:01 UTC (rev 28870)
@@ -10,12 +10,71 @@
 {
   protected $_subject;
 
+  /**
+   * Listener method for method_not_found events
+   * 
+   * @example
+   * $extendedUser = new myExtendedUser(); // extends sfExtendClass
+   * $dispatcher->connect('user.method_not_found', array($extendedUser, 
'extend'));
+   */
+  public function extend(sfEvent $event)
+  {
+    $this->_subject = $event->getSubject();
+    $method = $event['method'];
+    $arguments = $event['arguments'];
+
+    if (method_exists($this, $method))
+    {
+      $result = call_user_func_array(array($this, $method), $arguments);
+
+      $event->setReturnValue($result);
+
+      return true;
+    }
+    else
+    {
+      return false;
+    }
+  }
+
+  /**
+   * Can be used inside a magic __call method to allow for a class to be 
extended
+   * 
+   * This method will throw a class_name.method_not_found event,
+   * where class_name is the "tableized" class name.
+   * 
+   * @example
+   * public function __call($method, $arguments)
+   * {
+   *   return sfSympalExtendClass::extendEvent($this, $method, $arguments);
+   * }
+   * 
+   * @param mixed $subject Instance of the class being extended
+   * @param string $method The current method being called
+   * @param array $arguments The arguments being passed to the above methid
+   */
+  public static function extendEvent($subject, $method, $arguments)
+  {
+    $name = sfInflector::tableize(get_class($subject));
+    $event = 
ProjectConfiguration::getActive()->getEventDispatcher()->notifyUntil(new 
sfEvent($subject, $name.'.method_not_found', array('method' => $method, 
'arguments' => $arguments)));
+    if (!$event->isProcessed())
+    {
+      throw new sfException(sprintf('Call to undefined method %s::%s.', 
get_class($subject), $method));
+    }
+
+    return $event->getReturnValue();
+  }
+
   public function offsetExists($name)
   {
-    try {
+    try
+    {
       $this->__get($name);
+
       return true;
-    } catch (sfException $e) {
+    }
+    catch (sfException $e)
+    {
       return false;
     }
   }
@@ -50,37 +109,10 @@
     $this->_subject->$name = $value;
   }
 
-  public static function extendEvent($subject, $method, $arguments)
-  {
-    $name = sfInflector::tableize(get_class($subject));
-    $event = 
ProjectConfiguration::getActive()->getEventDispatcher()->notifyUntil(new 
sfEvent($subject, 'sympal.'.$name.'.method_not_found', array('method' => 
$method, 'arguments' => $arguments)));
-    if (!$event->isProcessed())
-    {
-      throw new Doctrine_Record_UnknownPropertyException(sprintf('Call to 
undefined method %s::%s.', get_class($subject), $method));
-    }
-
-    return $event->getReturnValue();
-  }
-
-  public function extend(sfEvent $event)
-  {
-    $this->_subject = $event->getSubject();
-    $method = $event['method'];
-    $arguments = $event['arguments'];
-
-    if (method_exists($this, $method))
-    {
-      $result = call_user_func_array(array($this, $method), $arguments);
-
-      $event->setProcessed(true);
-      $event->setReturnValue($result);
-
-      return true;
-    } else {
-      return false;
-    }
-  }
-
+  /**
+   * Allows methods to be called directly onto this object and have them
+   * be passed back to the original subject
+   */
   public function __call($method, $arguments)
   {
     return call_user_func_array(array($this->_subject, $method), $arguments);

Deleted: 
plugins/sfSympalPlugin/trunk/lib/validator/sfValidatorSympalArray.class.php
===================================================================
--- plugins/sfSympalPlugin/trunk/lib/validator/sfValidatorSympalArray.class.php 
2010-03-29 12:51:49 UTC (rev 28869)
+++ plugins/sfSympalPlugin/trunk/lib/validator/sfValidatorSympalArray.class.php 
2010-03-29 13:14:01 UTC (rev 28870)
@@ -1,9 +0,0 @@
-<?php
-
-class sfValidatorSympalArray extends sfValidatorBase
-{
-  public function doClean($value)
-  {
-    return sfYaml::load($value);
-  }
-}
\ No newline at end of file

Deleted: 
plugins/sfSympalPlugin/trunk/lib/widget/sfWidgetFormSympalArray.class.php
===================================================================
--- plugins/sfSympalPlugin/trunk/lib/widget/sfWidgetFormSympalArray.class.php   
2010-03-29 12:51:49 UTC (rev 28869)
+++ plugins/sfSympalPlugin/trunk/lib/widget/sfWidgetFormSympalArray.class.php   
2010-03-29 13:14:01 UTC (rev 28870)
@@ -1,16 +0,0 @@
-<?php
-
-class sfWidgetFormSympalArray extends sfWidgetFormTextarea
-{
-  public function configure($options = array(), $attributes = array())
-  {
-    parent::configure($options, $attributes);
-    $this->setAttribute('style', 'width: 800px; height: 300px;');
-  }
-
-  public function render($name, $value = null, $attributes = array(), $errors 
= array())
-  {
-    $value = sfYaml::dump($value, 5);
-    return parent::render($name, $value, $attributes, $errors);
-  }
-}
\ No newline at end of file

-- 
You received this message because you are subscribed to the Google Groups 
"symfony SVN" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/symfony-svn?hl=en.

Reply via email to