Author: Jonathan.Wage
Date: 2010-02-11 17:52:22 +0100 (Thu, 11 Feb 2010)
New Revision: 27905
Modified:
plugins/sfSympalPlugin/trunk/config/app.yml
plugins/sfSympalPlugin/trunk/lib/sfSympalConfiguration.class.php
plugins/sfSympalPlugin/trunk/modules/sympal_default/lib/Basesympal_defaultActions.class.php
Log:
[1.4][sfSympalPlugin][1.0] Added online/offline functionality
Modified: plugins/sfSympalPlugin/trunk/config/app.yml
===================================================================
--- plugins/sfSympalPlugin/trunk/config/app.yml 2010-02-11 16:18:53 UTC (rev
27904)
+++ plugins/sfSympalPlugin/trunk/config/app.yml 2010-02-11 16:52:22 UTC (rev
27905)
@@ -5,6 +5,12 @@
all:
sympal_config:
+ # Configure whether or not the Sympal system is online
+ offline:
+ enabled: false
+ module: sympal_default
+ action: offline
+
# Configure what to do when you access some content that is not published
yet
unpublished_content:
forward_to: [sympal_default, unpublished_content]
Modified: plugins/sfSympalPlugin/trunk/lib/sfSympalConfiguration.class.php
===================================================================
--- plugins/sfSympalPlugin/trunk/lib/sfSympalConfiguration.class.php
2010-02-11 16:18:53 UTC (rev 27904)
+++ plugins/sfSympalPlugin/trunk/lib/sfSympalConfiguration.class.php
2010-02-11 16:52:22 UTC (rev 27905)
@@ -66,7 +66,7 @@
{
$this->_dispatcher->connect('context.load_factories', array($this,
'bootstrap'));
$this->_dispatcher->connect('component.method_not_found', array(new
sfSympalActions(), 'extend'));
- $this->_dispatcher->connect('controller.change_action', array($this,
'initializeTheme'));
+ $this->_dispatcher->connect('controller.change_action', array($this,
'listenToControllerChangeAction'));
$this->_dispatcher->connect('template.filter_parameters', array($this,
'filterTemplateParameters'));
$this->_dispatcher->connect('form.method_not_found', array(new
sfSympalForm(), 'extend'));
$this->_dispatcher->connect('form.post_configure', array('sfSympalForm',
'listenToFormPostConfigure'));
@@ -123,6 +123,12 @@
}
}
+ public function listenToControllerChangeAction(sfEvent $event)
+ {
+ $this->initializeTheme();
+ $this->_checkOnline();
+ }
+
/**
* Listen to clear cache task event so we can clear the web cache folder
*
@@ -157,9 +163,8 @@
$this->_sympalContext =
sfSympalContext::createInstance($this->_symfonyContext, $this);
$this->_enableModules();
+ $this->_checkInstalled();
- $this->_checkSympalInstall();
-
$this->initializeTheme();
$this->_projectConfiguration->loadHelpers(array(
@@ -546,7 +551,7 @@
*
* @return void
*/
- private function _checkSympalInstall()
+ private function _checkInstalled()
{
$sfContext = sfContext::getInstance();
$request = $sfContext->getRequest();
@@ -580,6 +585,25 @@
}
/**
+ * Check if Sympal is not online and act accordingly
+ *
+ * @return void
+ */
+ private function _checkOnline()
+ {
+ static $onlineChecked;
+ if (sfSympalConfig::get('offline', 'enabled', false) && !$onlineChecked)
+ {
+ $onlineChecked = true;
+ $this->_symfonyContext->getController()->forward(
+ sfSympalConfig::get('offline', 'module'),
+ sfSympalConfig::get('offline', 'action')
+ );
+ throw new sfStopException();
+ }
+ }
+
+ /**
* Initialize some sfConfig values for Sympal
*
* @return void
Modified:
plugins/sfSympalPlugin/trunk/modules/sympal_default/lib/Basesympal_defaultActions.class.php
===================================================================
---
plugins/sfSympalPlugin/trunk/modules/sympal_default/lib/Basesympal_defaultActions.class.php
2010-02-11 16:18:53 UTC (rev 27904)
+++
plugins/sfSympalPlugin/trunk/modules/sympal_default/lib/Basesympal_defaultActions.class.php
2010-02-11 16:52:22 UTC (rev 27905)
@@ -4,9 +4,12 @@
{
public function executeUnpublished_content(sfWebRequest $request)
{
-
}
+ public function executeOffline(sfWebRequest $request)
+ {
+ }
+
public function executeSitemap(sfWebRequest $request)
{
$this->setLayout(false);
--
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.