cvs: pear /PEAR_PackageFileManager_Frontend_Web/Frontend Web.php
| From: | Laurent Laville | Date: | Sat, 19 Aug 2006 10:07:12 +0000 |
| Subject: | cvs: pear /PEAR_PackageFileManager_Frontend_Web/Frontend Web.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-41726@lists.php.net to get a copy of this message | ||
farell Sat Aug 19 10:07:12 2006 UTC
Modified files:
/pear/PEAR_PackageFileManager_Frontend_Web/Frontend Web.php
Log:
- no more need to use PEAR_PACKAGEFILEMANAGER_FRONTEND_DATADIR constant (was removed)
see new architecture that use external stylesheet in Default.php driver
- add new method addAction()
http://cvs.php.net/viewvc.cgi/pear/PEAR_PackageFileManager_Frontend_Web/Frontend/Web.php?r1=1.10&r2=1.11&diff_format=u
Index: pear/PEAR_PackageFileManager_Frontend_Web/Frontend/Web.php
diff -u pear/PEAR_PackageFileManager_Frontend_Web/Frontend/Web.php:1.10
pear/PEAR_PackageFileManager_Frontend_Web/Frontend/Web.php:1.11
--- pear/PEAR_PackageFileManager_Frontend_Web/Frontend/Web.php:1.10 Sat Jul 22 13:56:05 2006
+++ pear/PEAR_PackageFileManager_Frontend_Web/Frontend/Web.php Sat Aug 19 10:07:11 2006
@@ -15,16 +15,10 @@
* @author Laurent Laville <pear@laurent-laville.org>
* @copyright 2005-2006 Laurent Laville
* @license http://www.php.net/license/3_01.txt PHP License 3.01
- * @version CVS: $Id: Web.php,v 1.10 2006/07/22 13:56:05 farell Exp $
+ * @version CVS: $Id: Web.php,v 1.11 2006/08/19 10:07:11 farell Exp $
* @since File available since Release 0.1.0
*/
-if (!defined('PEAR_PACKAGEFILEMANAGER_FRONTEND_DATADIR')) {
- define('PEAR_PACKAGEFILEMANAGER_FRONTEND_DATADIR',
- '@data_dir@' . DIRECTORY_SEPARATOR .
- '@package_name@' . DIRECTORY_SEPARATOR);
-}
-
require_once 'HTML/QuickForm/Controller.php';
require_once 'HTML/QuickForm/Action/Submit.php';
require_once 'HTML/QuickForm/Action/Jump.php';
@@ -33,7 +27,7 @@
require_once 'PEAR/PackageFileManager/Frontend/Web/pages.php';
if (version_compare(phpversion(), '5.0.0', '<')) {
- require_once 'PHP/Compat.php';
+ include_once 'PHP/Compat.php';
PHP_Compat::loadFunction('array_combine');
}
@@ -234,7 +228,7 @@
}
// adds common action on each page
- $this->_qfc->addAction($pageName, new HTML_QuickForm_Action_Direct());
+ $this->addAction($pageName, new HTML_QuickForm_Action_Direct());
}
/**
@@ -255,7 +249,7 @@
include_once 'PEAR/PackageFileManager/Frontend/Web/Default.php';
$ActionDisplay = 'ActionDisplay';
}
- $this->_qfc->addAction('display', new $ActionDisplay() );
+ $this->addAction('display', new $ActionDisplay() );
// adds basic actions (abort, commit, reset)
$ActionProcess = $this->_actions['process'];
@@ -263,9 +257,9 @@
include_once 'PEAR/PackageFileManager/Frontend/Web/Process.php';
$ActionProcess = 'ActionProcess';
}
- $this->_qfc->addAction('abort', new $ActionProcess() );
- $this->_qfc->addAction('commit', new $ActionProcess() );
- $this->_qfc->addAction('reset', new $ActionProcess() );
+ $this->addAction('abort', new $ActionProcess() );
+ $this->addAction('commit', new $ActionProcess() );
+ $this->addAction('reset', new $ActionProcess() );
// adds dump class action (if necessary)
$ActionDump = $this->_actions['dump'];
@@ -274,11 +268,26 @@
include_once 'PEAR/PackageFileManager/Frontend/Web/Dump.php';
$ActionDump = 'ActionDump';
}
- $this->_qfc->addAction('dump', new $ActionDump() );
+ $this->addAction('dump', new $ActionDump() );
}
}
/**
+ * Registers a handler for a specific action.
+ *
+ * @param string $actionName name of the action
+ * @param object $action the handler for the action
+ * @return void
+ * @access public
+ * @since 0.6.0
+ */
+ function addAction($actionName, &$action)
+ {
+ $this->_actions[$actionName] = get_class($action);
+ $this->_qfc->addAction($actionName, $action);
+ }
+
+ /**
* Applies all defaults
*
* @access public