CC-2166: Packaging Improvements. Moved the Zend app into airtime_mvc. It is now installed to /var/www/airtime. Storage is now set to /srv/airtime/stor. Utils are now installed to /usr/lib/airtime/utils/. Added install/airtime-dircheck.php as a simple test to see if everything is install/uninstalled correctly.

This commit is contained in:
Paul Baranowski 2011-04-14 18:55:04 -04:00
parent 514777e8d2
commit b11cbd8159
4546 changed files with 138 additions and 51 deletions

View file

@ -0,0 +1,37 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Dojo
* @subpackage View
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Exception.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @see Zend_Dojo_Exception
*/
require_once 'Zend/Dojo/Exception.php';
/**
* @category Zend
* @package Zend_Dojo
* @subpackage View
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Dojo_View_Exception extends Zend_Dojo_Exception
{
}

View file

@ -0,0 +1,66 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Dojo
* @subpackage View
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: AccordionContainer.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/** Zend_Dojo_View_Helper_DijitContainer */
require_once 'Zend/Dojo/View/Helper/DijitContainer.php';
/**
* Dojo AccordionContainer dijit
*
* @uses Zend_Dojo_View_Helper_DijitContainer
* @package Zend_Dojo
* @subpackage View
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Dojo_View_Helper_AccordionContainer extends Zend_Dojo_View_Helper_DijitContainer
{
/**
* Dijit being used
* @var string
*/
protected $_dijit = 'dijit.layout.AccordionContainer';
/**
* Dojo module to use
* @var string
*/
protected $_module = 'dijit.layout.AccordionContainer';
/**
* dijit.layout.AccordionContainer
*
* @param string $id
* @param string $content
* @param array $params Parameters to use for dijit creation
* @param array $attribs HTML attributes
* @return string
*/
public function accordionContainer($id = null, $content = '', array $params = array(), array $attribs = array())
{
if (0 === func_num_args()) {
return $this;
}
return $this->_createLayoutContainer($id, $content, $params, $attribs);
}
}

View file

@ -0,0 +1,66 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Dojo
* @subpackage View
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: AccordionPane.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/** Zend_Dojo_View_Helper_DijitContainer */
require_once 'Zend/Dojo/View/Helper/DijitContainer.php';
/**
* Dojo AccordionPane dijit
*
* @uses Zend_Dojo_View_Helper_DijitContainer
* @package Zend_Dojo
* @subpackage View
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Dojo_View_Helper_AccordionPane extends Zend_Dojo_View_Helper_DijitContainer
{
/**
* Dijit being used
* @var string
*/
protected $_dijit = 'dijit.layout.AccordionPane';
/**
* Module being used
* @var string
*/
protected $_module = 'dijit.layout.AccordionContainer';
/**
* dijit.layout.AccordionPane
*
* @param int $id
* @param string $content
* @param array $params Parameters to use for dijit creation
* @param array $attribs HTML attributes
* @return string
*/
public function accordionPane($id = null, $content = '', array $params = array(), array $attribs = array())
{
if (0 === func_num_args()) {
return $this;
}
return $this->_createLayoutContainer($id, $content, $params, $attribs);
}
}

View file

@ -0,0 +1,79 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Dojo
* @subpackage View
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: BorderContainer.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/** Zend_Dojo_View_Helper_DijitContainer */
require_once 'Zend/Dojo/View/Helper/DijitContainer.php';
/**
* Dojo BorderContainer dijit
*
* @uses Zend_Dojo_View_Helper_DijitContainer
* @package Zend_Dojo
* @subpackage View
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Dojo_View_Helper_BorderContainer extends Zend_Dojo_View_Helper_DijitContainer
{
/**
* Dijit being used
* @var string
*/
protected $_dijit = 'dijit.layout.BorderContainer';
/**
* Dojo module to use
* @var string
*/
protected $_module = 'dijit.layout.BorderContainer';
/**
* Ensure style is only registered once
* @var bool
*/
protected $_styleIsRegistered = false;
/**
* dijit.layout.BorderContainer
*
* @param string $id
* @param string $content
* @param array $params Parameters to use for dijit creation
* @param array $attribs HTML attributes
* @return string
*/
public function borderContainer($id = null, $content = '', array $params = array(), array $attribs = array())
{
if (0 === func_num_args()) {
return $this;
}
// this will ensure that the border container is viewable:
if (!$this->_styleIsRegistered) {
$this->view->headStyle()->appendStyle('html, body { height: 100%; width: 100%; margin: 0; padding: 0; }');
$this->_styleIsRegistered = true;
}
// and now we create it:
return $this->_createLayoutContainer($id, $content, $params, $attribs);
}
}

View file

@ -0,0 +1,68 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Dojo
* @subpackage View
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Button.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/** Zend_Dojo_View_Helper_Dijit */
require_once 'Zend/Dojo/View/Helper/Dijit.php';
/**
* Dojo Button dijit
*
* @uses Zend_Dojo_View_Helper_Dijit
* @package Zend_Dojo
* @subpackage View
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Dojo_View_Helper_Button extends Zend_Dojo_View_Helper_Dijit
{
/**
* Dijit being used
* @var string
*/
protected $_dijit = 'dijit.form.Button';
/**
* Dojo module to use
* @var string
*/
protected $_module = 'dijit.form.Button';
/**
* dijit.form.Button
*
* @param string $id
* @param string $value
* @param array $params Parameters to use for dijit creation
* @param array $attribs HTML attributes
* @return string
*/
public function button($id, $value = null, array $params = array(), array $attribs = array())
{
$attribs['name'] = $id;
if (!array_key_exists('id', $attribs)) {
$attribs['id'] = $id;
}
$attribs = $this->_prepareDijit($attribs, $params, 'element');
return $this->view->formButton($id, $value, $attribs);
}
}

View file

@ -0,0 +1,100 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Dojo
* @subpackage View
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: CheckBox.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/** Zend_Dojo_View_Helper_Dijit */
require_once 'Zend/Dojo/View/Helper/Dijit.php';
/**
* Dojo CheckBox dijit
*
* @uses Zend_Dojo_View_Helper_Dijit
* @package Zend_Dojo
* @subpackage View
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Dojo_View_Helper_CheckBox extends Zend_Dojo_View_Helper_Dijit
{
/**
* Dijit being used
* @var string
*/
protected $_dijit = 'dijit.form.CheckBox';
/**
* Element type
* @var string
*/
protected $_elementType = 'checkbox';
/**
* Dojo module to use
* @var string
*/
protected $_module = 'dijit.form.CheckBox';
/**
* dijit.form.CheckBox
*
* @param int $id
* @param string $content
* @param array $params Parameters to use for dijit creation
* @param array $attribs HTML attributes
* @param array $checkedOptions Should contain either two items, or the keys checkedValue and uncheckedValue
* @return string
*/
public function checkBox($id, $value = null, array $params = array(), array $attribs = array(), array $checkedOptions = null)
{
// Prepare the checkbox options
require_once 'Zend/View/Helper/FormCheckbox.php';
$checked = false;
if (isset($attribs['checked']) && $attribs['checked']) {
$checked = true;
} elseif (isset($attribs['checked'])) {
$checked = false;
}
$checkboxInfo = Zend_View_Helper_FormCheckbox::determineCheckboxInfo($value, $checked, $checkedOptions);
$attribs['checked'] = $checkboxInfo['checked'];
if (!array_key_exists('id', $attribs)) {
$attribs['id'] = $id;
}
$attribs = $this->_prepareDijit($attribs, $params, 'element');
// strip options so they don't show up in markup
if (array_key_exists('options', $attribs)) {
unset($attribs['options']);
}
// and now we create it:
$html = '';
if (!strstr($id, '[]')) {
// hidden element for unchecked value
$html .= $this->_renderHiddenElement($id, $checkboxInfo['uncheckedValue']);
}
// and final element
$html .= $this->_createFormElement($id, $checkboxInfo['checkedValue'], $params, $attribs);
return $html;
}
}

View file

@ -0,0 +1,151 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Dojo
* @subpackage View
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: ComboBox.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/** Zend_Dojo_View_Helper_Dijit */
require_once 'Zend/Dojo/View/Helper/Dijit.php';
/**
* Dojo ComboBox dijit
*
* @uses Zend_Dojo_View_Helper_Dijit
* @package Zend_Dojo
* @subpackage View
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Dojo_View_Helper_ComboBox extends Zend_Dojo_View_Helper_Dijit
{
/**
* Dijit being used
* @var string
*/
protected $_dijit = 'dijit.form.ComboBox';
/**
* HTML element type
* @var string
*/
protected $_elementType = 'text';
/**
* Dojo module to use
* @var string
*/
protected $_module = 'dijit.form.ComboBox';
/**
* dijit.form.ComboBox
*
* @param int $id
* @param mixed $value
* @param array $params Parameters to use for dijit creation
* @param array $attribs HTML attributes
* @param array|null $options Select options
* @return string
*/
public function comboBox($id, $value = null, array $params = array(), array $attribs = array(), array $options = null)
{
$html = '';
if (!array_key_exists('id', $attribs)) {
$attribs['id'] = $id;
}
if (array_key_exists('store', $params) && is_array($params['store'])) {
// using dojo.data datastore
if (false !== ($store = $this->_renderStore($params['store'], $id))) {
$params['store'] = $params['store']['store'];
if (is_string($store)) {
$html .= $store;
}
$html .= $this->_createFormElement($id, $value, $params, $attribs);
return $html;
}
unset($params['store']);
} elseif (array_key_exists('store', $params)) {
if (array_key_exists('storeType', $params)) {
$storeParams = array(
'store' => $params['store'],
'type' => $params['storeType'],
);
unset($params['storeType']);
if (array_key_exists('storeParams', $params)) {
$storeParams['params'] = $params['storeParams'];
unset($params['storeParams']);
}
if (false !== ($store = $this->_renderStore($storeParams, $id))) {
if (is_string($store)) {
$html .= $store;
}
}
}
$html .= $this->_createFormElement($id, $value, $params, $attribs);
return $html;
}
// do as normal select
$attribs = $this->_prepareDijit($attribs, $params, 'element');
return $this->view->formSelect($id, $value, $attribs, $options);
}
/**
* Render data store element
*
* Renders to dojo view helper
*
* @param array $params
* @return string|false
*/
protected function _renderStore(array $params, $id)
{
if (!array_key_exists('store', $params) || !array_key_exists('type', $params)) {
return false;
}
$this->dojo->requireModule($params['type']);
$extraParams = array();
$storeParams = array(
'dojoType' => $params['type'],
'jsId' => $params['store'],
);
if (array_key_exists('params', $params)) {
$storeParams = array_merge($storeParams, $params['params']);
$extraParams = $params['params'];
}
if ($this->_useProgrammatic()) {
if (!$this->_useProgrammaticNoScript()) {
require_once 'Zend/Json.php';
$this->dojo->addJavascript('var ' . $storeParams['jsId'] . ";\n");
$js = $storeParams['jsId'] . ' = '
. 'new ' . $storeParams['dojoType'] . '('
. Zend_Json::encode($extraParams)
. ");\n";
$js = "function() {\n$js\n}";
$this->dojo->_addZendLoad($js);
}
return true;
}
return '<div' . $this->_htmlAttribs($storeParams) . '></div>';
}
}

View file

@ -0,0 +1,66 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Dojo
* @subpackage View
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: ContentPane.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/** Zend_Dojo_View_Helper_DijitContainer */
require_once 'Zend/Dojo/View/Helper/DijitContainer.php';
/**
* Dojo ContentPane dijit
*
* @uses Zend_Dojo_View_Helper_DijitContainer
* @package Zend_Dojo
* @subpackage View
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Dojo_View_Helper_ContentPane extends Zend_Dojo_View_Helper_DijitContainer
{
/**
* Dijit being used
* @var string
*/
protected $_dijit = 'dijit.layout.ContentPane';
/**
* Module being used
* @var string
*/
protected $_module = 'dijit.layout.ContentPane';
/**
* dijit.layout.ContentPane
*
* @param string $id
* @param string $content
* @param array $params Parameters to use for dijit creation
* @param array $attribs HTML attributes
* @return string
*/
public function contentPane($id = null, $content = '', array $params = array(), array $attribs = array())
{
if (0 === func_num_args()) {
return $this;
}
return $this->_createLayoutContainer($id, $content, $params, $attribs);
}
}

View file

@ -0,0 +1,68 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Dojo
* @subpackage View
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: CurrencyTextBox.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/** Zend_Dojo_View_Helper_Dijit */
require_once 'Zend/Dojo/View/Helper/Dijit.php';
/**
* Dojo CurrencyTextBox dijit
*
* @uses Zend_Dojo_View_Helper_Dijit
* @package Zend_Dojo
* @subpackage View
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Dojo_View_Helper_CurrencyTextBox extends Zend_Dojo_View_Helper_Dijit
{
/**
* Dijit being used
* @var string
*/
protected $_dijit = 'dijit.form.CurrencyTextBox';
/**
* HTML element type
* @var string
*/
protected $_elementType = 'text';
/**
* Dojo module to use
* @var string
*/
protected $_module = 'dijit.form.CurrencyTextBox';
/**
* dijit.form.CurrencyTextBox
*
* @param int $id
* @param mixed $value
* @param array $params Parameters to use for dijit creation
* @param array $attribs HTML attributes
* @return string
*/
public function currencyTextBox($id, $value = null, array $params = array(), array $attribs = array())
{
return $this->_createFormElement($id, $value, $params, $attribs);
}
}

View file

@ -0,0 +1,112 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Dojo
* @subpackage View
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: CustomDijit.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/** Zend_Dojo_View_Helper_DijitContainer */
require_once 'Zend/Dojo/View/Helper/DijitContainer.php';
/**
* Arbitrary dijit support
*
* @uses Zend_Dojo_View_Helper_DijitContainer
* @package Zend_Dojo
* @subpackage View
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Dojo_View_Helper_CustomDijit extends Zend_Dojo_View_Helper_DijitContainer
{
/**
* Default dojoType; set the value when extending
* @var string
*/
protected $_defaultDojoType;
/**
* Render a custom dijit
*
* Requires that either the {@link $_defaultDojotype} property is set, or
* that you pass a value to the "dojoType" key of the $params argument.
*
* @param string $id
* @param string $value
* @param array $params
* @param array $attribs
* @return string|Zend_Dojo_View_Helper_CustomDijit
*/
public function customDijit($id = null, $value = null, array $params = array(), array $attribs = array())
{
if (null === $id) {
return $this;
}
if (!array_key_exists('dojoType', $params)
&& (null === $this->_defaultDojoType)
) {
require_once 'Zend/Dojo/View/Exception.php';
throw new Zend_Dojo_View_Exception('No dojoType specified; cannot create dijit');
} elseif (array_key_exists('dojoType', $params)) {
$this->_dijit = $params['dojoType'];
$this->_module = $params['dojoType'];
unset($params['dojoType']);
} else {
$this->_dijit = $this->_defaultDojoType;
$this->_module = $this->_defaultDojoType;
}
if (array_key_exists('rootNode', $params)) {
$this->setRootNode($params['rootNode']);
unset($params['rootNode']);
}
return $this->_createLayoutContainer($id, $value, $params, $attribs);
}
/**
* Begin capturing content.
*
* Requires that either the {@link $_defaultDojotype} property is set, or
* that you pass a value to the "dojoType" key of the $params argument.
*
* @param string $id
* @param array $params
* @param array $attribs
* @return void
*/
public function captureStart($id, array $params = array(), array $attribs = array())
{
if (!array_key_exists('dojoType', $params)
&& (null === $this->_defaultDojoType)
) {
require_once 'Zend/Dojo/View/Exception.php';
throw new Zend_Dojo_View_Exception('No dojoType specified; cannot create dijit');
} elseif (array_key_exists('dojoType', $params)) {
$this->_dijit = $params['dojoType'];
$this->_module = $params['dojoType'];
unset($params['dojoType']);
} else {
$this->_dijit = $this->_defaultDojoType;
$this->_module = $this->_defaultDojoType;
}
return parent::captureStart($id, $params, $attribs);
}
}

View file

@ -0,0 +1,68 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Dojo
* @subpackage View
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: DateTextBox.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/** Zend_Dojo_View_Helper_Dijit */
require_once 'Zend/Dojo/View/Helper/Dijit.php';
/**
* Dojo DateTextBox dijit
*
* @uses Zend_Dojo_View_Helper_Dijit
* @package Zend_Dojo
* @subpackage View
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Dojo_View_Helper_DateTextBox extends Zend_Dojo_View_Helper_Dijit
{
/**
* Dijit being used
* @var string
*/
protected $_dijit = 'dijit.form.DateTextBox';
/**
* HTML element type
* @var string
*/
protected $_elementType = 'text';
/**
* Dojo module to use
* @var string
*/
protected $_module = 'dijit.form.DateTextBox';
/**
* dijit.form.DateTextBox
*
* @param int $id
* @param mixed $value
* @param array $params Parameters to use for dijit creation
* @param array $attribs HTML attributes
* @return string
*/
public function dateTextBox($id, $value = null, array $params = array(), array $attribs = array())
{
return $this->_createFormElement($id, $value, $params, $attribs);
}
}

View file

@ -0,0 +1,344 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Dojo
* @subpackage View
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Dijit.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/** Zend_View_Helper_HtmlElement */
require_once 'Zend/View/Helper/HtmlElement.php';
/**
* Dojo dijit base class
*
* @uses Zend_View_Helper_Abstract
* @package Zend_Dojo
* @subpackage View
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
abstract class Zend_Dojo_View_Helper_Dijit extends Zend_View_Helper_HtmlElement
{
/**
* @var Zend_Dojo_View_Helper_Dojo_Container
*/
public $dojo;
/**
* Dijit being used
* @var string
*/
protected $_dijit;
/**
* Element type
* @var string
*/
protected $_elementType;
/**
* Parameters that should be JSON encoded
* @var array
*/
protected $_jsonParams = array('constraints');
/**
* Dojo module to use
* @var string
*/
protected $_module;
/**
* Root node element type for layout elements
* @var string
*/
protected $_rootNode = 'div';
/**
* Set view
*
* Set view and enable dojo
*
* @param Zend_View_Interface $view
* @return Zend_Dojo_View_Helper_Dijit
*/
public function setView(Zend_View_Interface $view)
{
parent::setView($view);
$this->dojo = $this->view->dojo();
$this->dojo->enable();
return $this;
}
/**
* Get root node type
*
* @return string
*/
public function getRootNode()
{
return $this->_rootNode;
}
/**
* Set root node type
*
* @param string $value
* @return Zend_Dojo_View_Helper_Dijit
*/
public function setRootNode($value)
{
$this->_rootNode = $value;
return $this;
}
/**
* Whether or not to use declarative dijit creation
*
* @return bool
*/
protected function _useDeclarative()
{
return Zend_Dojo_View_Helper_Dojo::useDeclarative();
}
/**
* Whether or not to use programmatic dijit creation
*
* @return bool
*/
protected function _useProgrammatic()
{
return Zend_Dojo_View_Helper_Dojo::useProgrammatic();
}
/**
* Whether or not to use programmatic dijit creation w/o script creation
*
* @return bool
*/
protected function _useProgrammaticNoScript()
{
return Zend_Dojo_View_Helper_Dojo::useProgrammaticNoScript();
}
/**
* Create a layout container
*
* @param int $id
* @param string $content
* @param array $params
* @param array $attribs
* @param string|null $dijit
* @return string
*/
protected function _createLayoutContainer($id, $content, array $params, array $attribs, $dijit = null)
{
$attribs['id'] = $id;
$attribs = $this->_prepareDijit($attribs, $params, 'layout', $dijit);
$nodeType = $this->getRootNode();
$html = '<' . $nodeType . $this->_htmlAttribs($attribs) . '>'
. $content
. "</$nodeType>\n";
return $html;
}
/**
* Create HTML representation of a dijit form element
*
* @param string $id
* @param string $value
* @param array $params
* @param array $attribs
* @param string|null $dijit
* @return string
*/
public function _createFormElement($id, $value, array $params, array $attribs, $dijit = null)
{
if (!array_key_exists('id', $attribs)) {
$attribs['id'] = $id;
}
$attribs['name'] = $id;
$attribs['value'] = (string) $value;
$attribs['type'] = $this->_elementType;
$attribs = $this->_prepareDijit($attribs, $params, 'element', $dijit);
$html = '<input'
. $this->_htmlAttribs($attribs)
. $this->getClosingBracket();
return $html;
}
/**
* Merge attributes and parameters
*
* Also sets up requires
*
* @param array $attribs
* @param array $params
* @param string $type
* @param string $dijit Dijit type to use (otherwise, pull from $_dijit)
* @return array
*/
protected function _prepareDijit(array $attribs, array $params, $type, $dijit = null)
{
$this->dojo->requireModule($this->_module);
switch ($type) {
case 'layout':
$stripParams = array('id');
break;
case 'element':
$stripParams = array('id', 'name', 'value', 'type');
foreach (array('checked', 'disabled', 'readonly') as $attrib) {
if (array_key_exists($attrib, $attribs)) {
if ($attribs[$attrib]) {
$attribs[$attrib] = $attrib;
} else {
unset($attribs[$attrib]);
}
}
}
break;
case 'textarea':
$stripParams = array('id', 'name', 'type', 'degrade');
break;
default:
}
foreach ($stripParams as $param) {
if (array_key_exists($param, $params)) {
unset($params[$param]);
}
}
// Normalize constraints, if present
foreach ($this->_jsonParams as $param) {
if (array_key_exists($param, $params)) {
require_once 'Zend/Json.php';
if (is_array($params[$param])) {
$values = array();
foreach ($params[$param] as $key => $value) {
if (!is_scalar($value)) {
continue;
}
$values[$key] = $value;
}
} elseif (is_string($params[$param])) {
$values = (array) $params[$param];
} else {
$values = array();
}
$values = Zend_Json::encode($values);
if ($this->_useDeclarative()) {
$values = str_replace('"', "'", $values);
}
$params[$param] = $values;
}
}
$dijit = (null === $dijit) ? $this->_dijit : $dijit;
if ($this->_useDeclarative()) {
$attribs = array_merge($attribs, $params);
if (isset($attribs['required'])) {
$attribs['required'] = ($attribs['required']) ? 'true' : 'false';
}
$attribs['dojoType'] = $dijit;
} elseif (!$this->_useProgrammaticNoScript()) {
$this->_createDijit($dijit, $attribs['id'], $params);
}
return $attribs;
}
/**
* Create a dijit programmatically
*
* @param string $dijit
* @param string $id
* @param array $params
* @return void
*/
protected function _createDijit($dijit, $id, array $params)
{
$params['dojoType'] = $dijit;
array_walk_recursive($params, array($this, '_castBoolToString'));
$this->dojo->setDijit($id, $params);
}
/**
* Cast a boolean to a string value
*
* @param mixed $item
* @param string $key
* @return void
*/
protected function _castBoolToString(&$item, $key)
{
if (!is_bool($item)) {
return;
}
$item = ($item) ? "true" : "false";
}
/**
* Render a hidden element to hold a value
*
* @param string $id
* @param string|int|float $value
* @return string
*/
protected function _renderHiddenElement($id, $value)
{
$hiddenAttribs = array(
'name' => $id,
'value' => (string) $value,
'type' => 'hidden',
);
return '<input' . $this->_htmlAttribs($hiddenAttribs) . $this->getClosingBracket();
}
/**
* Create JS function for retrieving parent form
*
* @return void
*/
protected function _createGetParentFormFunction()
{
$function =<<<EOJ
if (zend == undefined) {
var zend = {};
}
zend.findParentForm = function(elementNode) {
while (elementNode.nodeName.toLowerCase() != 'form') {
elementNode = elementNode.parentNode;
}
return elementNode;
};
EOJ;
$this->dojo->addJavascript($function);
}
}

View file

@ -0,0 +1,92 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Dojo
* @subpackage View
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: DijitContainer.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/** Zend_Dojo_View_Helper_Dijit */
require_once 'Zend/Dojo/View/Helper/Dijit.php';
/**
* Dijit layout container base class
*
* @uses Zend_Dojo_View_Helper_Dijit
* @package Zend_Dojo
* @subpackage View
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
abstract class Zend_Dojo_View_Helper_DijitContainer extends Zend_Dojo_View_Helper_Dijit
{
/**
* Capture locks
* @var array
*/
protected $_captureLock = array();
/**
* Metadata information to use with captured content
* @var array
*/
protected $_captureInfo = array();
/**
* Begin capturing content for layout container
*
* @param string $id
* @param array $params
* @param array $attribs
* @return void
*/
public function captureStart($id, array $params = array(), array $attribs = array())
{
if (array_key_exists($id, $this->_captureLock)) {
require_once 'Zend/Dojo/View/Exception.php';
throw new Zend_Dojo_View_Exception(sprintf('Lock already exists for id "%s"', $id));
}
$this->_captureLock[$id] = true;
$this->_captureInfo[$id] = array(
'params' => $params,
'attribs' => $attribs,
);
ob_start();
return;
}
/**
* Finish capturing content for layout container
*
* @param string $id
* @return string
*/
public function captureEnd($id)
{
if (!array_key_exists($id, $this->_captureLock)) {
require_once 'Zend/Dojo/View/Exception.php';
throw new Zend_Dojo_View_Exception(sprintf('No capture lock exists for id "%s"; nothing to capture', $id));
}
$content = ob_get_clean();
extract($this->_captureInfo[$id]);
unset($this->_captureLock[$id], $this->_captureInfo[$id]);
return $this->_createLayoutContainer($id, $content, $params, $attribs);
}
}

View file

@ -0,0 +1,176 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Dojo
* @subpackage View
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @version $Id: Dojo.php 20096 2010-01-06 02:05:09Z bkarwin $
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
/** Zend_Registry */
require_once 'Zend/Registry.php';
/**
* Zend_Dojo_View_Helper_Dojo: Dojo View Helper
*
* Allows specifying stylesheets, path to dojo, module paths, and onLoad
* events.
*
* @package Zend_Dojo
* @subpackage View
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Dojo_View_Helper_Dojo
{
/**#@+
* Programmatic dijit creation style constants
*/
const PROGRAMMATIC_SCRIPT = 1;
const PROGRAMMATIC_NOSCRIPT = -1;
/**#@-*/
/**
* @var Zend_View_Interface
*/
public $view;
/**
* @var Zend_Dojo_View_Helper_Dojo_Container
*/
protected $_container;
/**
* @var bool Whether or not dijits should be declared programmatically
*/
protected static $_useProgrammatic = true;
/**
* Initialize helper
*
* Retrieve container from registry or create new container and store in
* registry.
*
* @return void
*/
public function __construct()
{
$registry = Zend_Registry::getInstance();
if (!isset($registry[__CLASS__])) {
require_once 'Zend/Dojo/View/Helper/Dojo/Container.php';
$container = new Zend_Dojo_View_Helper_Dojo_Container();
$registry[__CLASS__] = $container;
}
$this->_container = $registry[__CLASS__];
}
/**
* Set view object
*
* @param Zend_Dojo_View_Interface $view
* @return void
*/
public function setView(Zend_View_Interface $view)
{
$this->view = $view;
$this->_container->setView($view);
}
/**
* Return dojo container
*
* @return Zend_Dojo_View_Helper_Dojo_Container
*/
public function dojo()
{
return $this->_container;
}
/**
* Proxy to container methods
*
* @param string $method
* @param array $args
* @return mixed
* @throws Zend_Dojo_View_Exception For invalid method calls
*/
public function __call($method, $args)
{
if (!method_exists($this->_container, $method)) {
require_once 'Zend/Dojo/View/Exception.php';
throw new Zend_Dojo_View_Exception(sprintf('Invalid method "%s" called on dojo view helper', $method));
}
return call_user_func_array(array($this->_container, $method), $args);
}
/**
* Set whether or not dijits should be created declaratively
*
* @return void
*/
public static function setUseDeclarative()
{
self::$_useProgrammatic = false;
}
/**
* Set whether or not dijits should be created programmatically
*
* Optionally, specifiy whether or not dijit helpers should generate the
* programmatic dojo.
*
* @param int $style
* @return void
*/
public static function setUseProgrammatic($style = self::PROGRAMMATIC_SCRIPT)
{
if (!in_array($style, array(self::PROGRAMMATIC_SCRIPT, self::PROGRAMMATIC_NOSCRIPT))) {
$style = self::PROGRAMMATIC_SCRIPT;
}
self::$_useProgrammatic = $style;
}
/**
* Should dijits be created declaratively?
*
* @return bool
*/
public static function useDeclarative()
{
return (false === self::$_useProgrammatic);
}
/**
* Should dijits be created programmatically?
*
* @return bool
*/
public static function useProgrammatic()
{
return (false !== self::$_useProgrammatic);
}
/**
* Should dijits be created programmatically but without scripts?
*
* @return bool
*/
public static function useProgrammaticNoScript()
{
return (self::PROGRAMMATIC_NOSCRIPT === self::$_useProgrammatic);
}
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,187 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Dojo
* @subpackage View
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Editor.php 20116 2010-01-07 14:18:34Z matthew $
*/
/** Zend_Dojo_View_Helper_Dijit */
require_once 'Zend/Dojo/View/Helper/Dijit.php';
/** Zend_Json */
require_once 'Zend/Json.php';
/**
* Dojo Editor dijit
*
* @uses Zend_Dojo_View_Helper_Textarea
* @package Zend_Dojo
* @subpackage View
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Dojo_View_Helper_Editor extends Zend_Dojo_View_Helper_Dijit
{
/**
* @param string Dijit type
*/
protected $_dijit = 'dijit.Editor';
/**
* @var string Dijit module to load
*/
protected $_module = 'dijit.Editor';
/**
* @var array Maps non-core plugin to module basename
*/
protected $_pluginsModules = array(
'createLink' => 'LinkDialog',
'insertImage' => 'LinkDialog',
'fontName' => 'FontChoice',
'fontSize' => 'FontChoice',
'formatBlock' => 'FontChoice',
'foreColor' => 'TextColor',
'hiliteColor' => 'TextColor'
);
/**
* JSON-encoded parameters
* @var array
*/
protected $_jsonParams = array('captureEvents', 'events', 'plugins');
/**
* dijit.Editor
*
* @param string $id
* @param string $value
* @param array $params
* @param array $attribs
* @return string
*/
public function editor($id, $value = null, $params = array(), $attribs = array())
{
if (isset($params['plugins'])) {
foreach ($this->_getRequiredModules($params['plugins']) as $module) {
$this->dojo->requireModule($module);
}
}
// Previous versions allowed specifying "degrade" to allow using a
// textarea instead of a div -- but this is insecure. Removing the
// parameter if set to prevent its injection in the dijit.
if (isset($params['degrade'])) {
unset($params['degrade']);
}
$hiddenName = $id;
if (array_key_exists('id', $attribs)) {
$hiddenId = $attribs['id'];
} else {
$hiddenId = $hiddenName;
}
$hiddenId = $this->_normalizeId($hiddenId);
$textareaName = $this->_normalizeEditorName($hiddenName);
$textareaId = $hiddenId . '-Editor';
$hiddenAttribs = array(
'id' => $hiddenId,
'name' => $hiddenName,
'value' => $value,
'type' => 'hidden',
);
$attribs['id'] = $textareaId;
$this->_createGetParentFormFunction();
$this->_createEditorOnSubmit($hiddenId, $textareaId);
$attribs = $this->_prepareDijit($attribs, $params, 'textarea');
$html = '<input' . $this->_htmlAttribs($hiddenAttribs) . $this->getClosingBracket();
$html .= '<div' . $this->_htmlAttribs($attribs) . '>'
. $value
. "</div>\n";
// Embed a textarea in a <noscript> tag to allow for graceful
// degradation
$html .= '<noscript>'
. $this->view->formTextarea($hiddenId, $value, $attribs)
. '</noscript>';
return $html;
}
/**
* Generates the list of required modules to include, if any is needed.
*
* @param array $plugins plugins to include
* @return array
*/
protected function _getRequiredModules(array $plugins)
{
$modules = array();
foreach ($plugins as $commandName) {
if (isset($this->_pluginsModules[$commandName])) {
$pluginName = $this->_pluginsModules[$commandName];
$modules[] = 'dijit._editor.plugins.' . $pluginName;
}
}
return array_unique($modules);
}
/**
* Normalize editor element name
*
* @param string $name
* @return string
*/
protected function _normalizeEditorName($name)
{
if ('[]' == substr($name, -2)) {
$name = substr($name, 0, strlen($name) - 2);
$name .= '[Editor][]';
} else {
$name .= '[Editor]';
}
return $name;
}
/**
* Create onSubmit binding for element
*
* @param string $hiddenId
* @param string $editorId
* @return void
*/
protected function _createEditorOnSubmit($hiddenId, $editorId)
{
$this->dojo->onLoadCaptureStart();
echo <<<EOJ
function() {
var form = zend.findParentForm(dojo.byId('$hiddenId'));
dojo.connect(form, 'submit', function(e) {
dojo.byId('$hiddenId').value = dijit.byId('$editorId').getValue(false);
});
}
EOJ;
$this->dojo->onLoadCaptureEnd();
}
}

View file

@ -0,0 +1,63 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Dojo
* @subpackage View
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: FilteringSelect.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/** Zend_Dojo_View_Helper_ComboBox */
require_once 'Zend/Dojo/View/Helper/ComboBox.php';
/**
* Dojo FilteringSelect dijit
*
* @uses Zend_Dojo_View_Helper_ComboBox
* @package Zend_Dojo
* @subpackage View
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Dojo_View_Helper_FilteringSelect extends Zend_Dojo_View_Helper_ComboBox
{
/**
* Dijit being used
* @var string
*/
protected $_dijit = 'dijit.form.FilteringSelect';
/**
* Dojo module to use
* @var string
*/
protected $_module = 'dijit.form.FilteringSelect';
/**
* dijit.form.FilteringSelect
*
* @param int $id
* @param mixed $value
* @param array $params Parameters to use for dijit creation
* @param array $attribs HTML attributes
* @param array|null $options Select options
* @return string
*/
public function filteringSelect($id, $value = null, array $params = array(), array $attribs = array(), array $options = null)
{
return $this->comboBox($id, $value, $params, $attribs, $options);
}
}

View file

@ -0,0 +1,96 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Dojo
* @subpackage View
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Form.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/** Zend_Dojo_View_Helper_Dijit */
require_once 'Zend/Dojo/View/Helper/Dijit.php';
/**
* Dojo Form dijit
*
* @uses Zend_Dojo_View_Helper_Dijit
* @package Zend_Dojo
* @subpackage View
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Dojo_View_Helper_Form extends Zend_Dojo_View_Helper_Dijit
{
/**
* Dijit being used
* @var string
*/
protected $_dijit = 'dijit.form.Form';
/**
* Module being used
* @var string
*/
protected $_module = 'dijit.form.Form';
/**
* @var Zend_View_Helper_Form
*/
protected $_helper;
/**
* dijit.form.Form
*
* @param string $id
* @param null|array $attribs HTML attributes
* @param false|string $content
* @return string
*/
public function form($id, $attribs = null, $content = false)
{
if (!is_array($attribs)) {
$attribs = (array) $attribs;
}
if (array_key_exists('id', $attribs)) {
$attribs['name'] = $id;
} else {
$attribs['id'] = $id;
}
if (false === $content) {
$content = '';
}
$attribs = $this->_prepareDijit($attribs, array(), 'layout');
return $this->getFormHelper()->form($id, $attribs, $content);
}
/**
* Get standard form helper
*
* @return Zend_View_Helper_Form
*/
public function getFormHelper()
{
if (null === $this->_helper) {
require_once 'Zend/View/Helper/Form.php';
$this->_helper = new Zend_View_Helper_Form;
$this->_helper->setView($this->view);
}
return $this->_helper;
}
}

View file

@ -0,0 +1,62 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Dojo
* @subpackage View
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: HorizontalSlider.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/** Zend_Dojo_View_Helper_Slider */
require_once 'Zend/Dojo/View/Helper/Slider.php';
/**
* Dojo HorizontalSlider dijit
*
* @uses Zend_Dojo_View_Helper_Slider
* @package Zend_Dojo
* @subpackage View
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Dojo_View_Helper_HorizontalSlider extends Zend_Dojo_View_Helper_Slider
{
/**
* Dijit being used
* @var string
*/
protected $_dijit = 'dijit.form.HorizontalSlider';
/**
* Slider type
* @var string
*/
protected $_sliderType = 'Horizontal';
/**
* dijit.form.HorizontalSlider
*
* @param int $id
* @param mixed $value
* @param array $params Parameters to use for dijit creation
* @param array $attribs HTML attributes
* @return string
*/
public function horizontalSlider($id, $value = null, array $params = array(), array $attribs = array())
{
return $this->prepareSlider($id, $value, $params, $attribs);
}
}

View file

@ -0,0 +1,90 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Dojo
* @subpackage View
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: NumberSpinner.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/** Zend_Dojo_View_Helper_Dijit */
require_once 'Zend/Dojo/View/Helper/Dijit.php';
/**
* Dojo NumberSpinner dijit
*
* @uses Zend_Dojo_View_Helper_Dijit
* @package Zend_Dojo
* @subpackage View
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Dojo_View_Helper_NumberSpinner extends Zend_Dojo_View_Helper_Dijit
{
/**
* Dijit being used
* @var string
*/
protected $_dijit = 'dijit.form.NumberSpinner';
/**
* HTML element type
* @var string
*/
protected $_elementType = 'text';
/**
* Dojo module to use
* @var string
*/
protected $_module = 'dijit.form.NumberSpinner';
/**
* dijit.form.NumberSpinner
*
* @param int $id
* @param mixed $value
* @param array $params Parameters to use for dijit creation
* @param array $attribs HTML attributes
* @return string
*/
public function numberSpinner($id, $value = null, array $params = array(), array $attribs = array())
{
// Get constraints and serialize to JSON if necessary
if (array_key_exists('constraints', $params)) {
if (!is_array($params['constraints'])) {
unset($params['constraints']);
}
} else {
$constraints = array();
if (array_key_exists('min', $params)) {
$constraints['min'] = $params['min'];
unset($params['min']);
}
if (array_key_exists('max', $params)) {
$constraints['max'] = $params['max'];
unset($params['max']);
}
if (array_key_exists('places', $params)) {
$constraints['places'] = $params['places'];
unset($params['places']);
}
$params['constraints'] = $constraints;
}
return $this->_createFormElement($id, $value, $params, $attribs);
}
}

View file

@ -0,0 +1,68 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Dojo
* @subpackage View
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: NumberTextBox.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/** Zend_Dojo_View_Helper_Dijit */
require_once 'Zend/Dojo/View/Helper/Dijit.php';
/**
* Dojo NumberTextBox dijit
*
* @uses Zend_Dojo_View_Helper_Dijit
* @package Zend_Dojo
* @subpackage View
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Dojo_View_Helper_NumberTextBox extends Zend_Dojo_View_Helper_Dijit
{
/**
* Dijit being used
* @var string
*/
protected $_dijit = 'dijit.form.NumberTextBox';
/**
* HTML element type
* @var string
*/
protected $_elementType = 'text';
/**
* Dojo module to use
* @var string
*/
protected $_module = 'dijit.form.NumberTextBox';
/**
* dijit.form.NumberTextBox
*
* @param int $id
* @param mixed $value
* @param array $params Parameters to use for dijit creation
* @param array $attribs HTML attributes
* @return string
*/
public function numberTextBox($id, $value = null, array $params = array(), array $attribs = array())
{
return $this->_createFormElement($id, $value, $params, $attribs);
}
}

View file

@ -0,0 +1,56 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Dojo
* @subpackage View
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: PasswordTextBox.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/** Zend_Dojo_View_Helper_ValidationTextBox */
require_once 'Zend/Dojo/View/Helper/ValidationTextBox.php';
/**
* Dojo ValidationTextBox dijit tied to password input
*
* @uses Zend_Dojo_View_Helper_Dijit
* @package Zend_Dojo
* @subpackage View
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Dojo_View_Helper_PasswordTextBox extends Zend_Dojo_View_Helper_ValidationTextBox
{
/**
* HTML element type
* @var string
*/
protected $_elementType = 'password';
/**
* dijit.form.ValidationTextBox tied to password input
*
* @param string $id
* @param mixed $value
* @param array $params Parameters to use for dijit creation
* @param array $attribs HTML attributes
* @return string
*/
public function passwordTextBox($id, $value = null, array $params = array(), array $attribs = array())
{
return $this->_createFormElement($id, $value, $params, $attribs);
}
}

View file

@ -0,0 +1,89 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Dojo
* @subpackage View
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: RadioButton.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/** Zend_Dojo_View_Helper_Dijit */
require_once 'Zend/Dojo/View/Helper/Dijit.php';
/**
* Dojo RadioButton dijit
*
* @uses Zend_Dojo_View_Helper_Dijit
* @package Zend_Dojo
* @subpackage View
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Dojo_View_Helper_RadioButton extends Zend_Dojo_View_Helper_Dijit
{
/**
* Dijit being used
* @var string
*/
protected $_dijit = 'dijit.form.RadioButton';
/**
* Dojo module to use
* @var string
*/
protected $_module = 'dijit.form.CheckBox';
/**
* dijit.form.RadioButton
*
* @param string $id
* @param string $value
* @param array $params Parameters to use for dijit creation
* @param array $attribs HTML attributes
* @param array $options Array of radio options
* @param string $listsep String with which to separate options
* @return string
*/
public function radioButton(
$id,
$value = null,
array $params = array(),
array $attribs = array(),
array $options = null,
$listsep = "<br />\n"
) {
$attribs['name'] = $id;
if (!array_key_exists('id', $attribs)) {
$attribs['id'] = $id;
}
$attribs = $this->_prepareDijit($attribs, $params, 'element');
if (is_array($options) && $this->_useProgrammatic() && !$this->_useProgrammaticNoScript()) {
$baseId = $id;
if (array_key_exists('id', $attribs)) {
$baseId = $attribs['id'];
}
require_once 'Zend/Filter/Alnum.php';
$filter = new Zend_Filter_Alnum();
foreach (array_keys($options) as $key) {
$optId = $baseId . '-' . $filter->filter($key);
$this->_createDijit($this->_dijit, $optId, array());
}
}
return $this->view->formRadio($id, $value, $attribs, $options, $listsep);
}
}

View file

@ -0,0 +1,78 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Dojo
* @subpackage View
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: SimpleTextarea.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/** Zend_Dojo_View_Helper_Dijit */
require_once 'Zend/Dojo/View/Helper/Dijit.php';
/**
* dijit.form.SimpleTextarea view helper
*
* @uses Zend_Dojo_View_Helper_Dijit
* @package Zend_Dojo
* @subpackage View
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: SimpleTextarea.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
class Zend_Dojo_View_Helper_SimpleTextarea extends Zend_Dojo_View_Helper_Dijit
{
/**
* @var string Dijit type
*/
protected $_dijit = 'dijit.form.SimpleTextarea';
/**
* @var string HTML element type
*/
protected $_elementType = 'textarea';
/**
* @var string Dojo module
*/
protected $_module = 'dijit.form.SimpleTextarea';
/**
* dijit.form.SimpleTextarea
*
* @param string $id
* @param string $value
* @param array $params Parameters to use for dijit creation
* @param array $attribs HTML attributes
* @return string
*/
public function simpleTextarea($id, $value = null, array $params = array(), array $attribs = array())
{
if (!array_key_exists('id', $attribs)) {
$attribs['id'] = $id;
}
$attribs['name'] = $id;
$attribs['type'] = $this->_elementType;
$attribs = $this->_prepareDijit($attribs, $params, 'textarea');
$html = '<textarea' . $this->_htmlAttribs($attribs) . '>'
. $this->view->escape($value)
. "</textarea>\n";
return $html;
}
}

View file

@ -0,0 +1,251 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Dojo
* @subpackage View
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Slider.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/** Zend_Dojo_View_Helper_Dijit */
require_once 'Zend/Dojo/View/Helper/Dijit.php';
/**
* Abstract class for Dojo Slider dijits
*
* @uses Zend_Dojo_View_Helper_Dijit
* @package Zend_Dojo
* @subpackage View
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
abstract class Zend_Dojo_View_Helper_Slider extends Zend_Dojo_View_Helper_Dijit
{
/**
* Dojo module to use
* @var string
*/
protected $_module = 'dijit.form.Slider';
/**
* Required slider parameters
* @var array
*/
protected $_requiredParams = array('minimum', 'maximum', 'discreteValues');
/**
* Slider type -- vertical or horizontal
* @var string
*/
protected $_sliderType;
/**
* dijit.form.Slider
*
* @param int $id
* @param mixed $value
* @param array $params Parameters to use for dijit creation
* @param array $attribs HTML attributes
* @return string
*/
public function prepareSlider($id, $value = null, array $params = array(), array $attribs = array())
{
$this->_sliderType = strtolower($this->_sliderType);
// Prepare two items: a hidden element to store the value, and the slider
$hidden = $this->_renderHiddenElement($id, $value);
$hidden = preg_replace('/(name=")([^"]*)"/', 'id="$2" $1$2"', $hidden);
foreach ($this->_requiredParams as $param) {
if (!array_key_exists($param, $params)) {
require_once 'Zend/Dojo/View/Exception.php';
throw new Zend_Dojo_View_Exception('prepareSlider() requires minimally the "minimum", "maximum", and "discreteValues" parameters');
}
}
$content = '';
$params['value'] = $value;
if (!array_key_exists('onChange', $attribs)) {
$attribs['onChange'] = "dojo.byId('" . $id . "').value = arguments[0];";
}
$id = str_replace('][', '-', $id);
$id = str_replace(array('[', ']'), '-', $id);
$id = rtrim($id, '-');
$id .= '-slider';
switch ($this->_sliderType) {
case 'horizontal':
if (array_key_exists('topDecoration', $params)) {
$content .= $this->_prepareDecoration('topDecoration', $id, $params['topDecoration']);
unset($params['topDecoration']);
}
if (array_key_exists('bottomDecoration', $params)) {
$content .= $this->_prepareDecoration('bottomDecoration', $id, $params['bottomDecoration']);
unset($params['bottomDecoration']);
}
if (array_key_exists('leftDecoration', $params)) {
unset($params['leftDecoration']);
}
if (array_key_exists('rightDecoration', $params)) {
unset($params['rightDecoration']);
}
break;
case 'vertical':
if (array_key_exists('leftDecoration', $params)) {
$content .= $this->_prepareDecoration('leftDecoration', $id, $params['leftDecoration']);
unset($params['leftDecoration']);
}
if (array_key_exists('rightDecoration', $params)) {
$content .= $this->_prepareDecoration('rightDecoration', $id, $params['rightDecoration']);
unset($params['rightDecoration']);
}
if (array_key_exists('topDecoration', $params)) {
unset($params['topDecoration']);
}
if (array_key_exists('bottomDecoration', $params)) {
unset($params['bottomDecoration']);
}
break;
default:
require_once 'Zend/Dojo/View/Exception.php';
throw new Zend_Dojo_View_Exception('Invalid slider type; slider must be horizontal or vertical');
}
return $hidden . $this->_createLayoutContainer($id, $content, $params, $attribs);
}
/**
* Prepare slider decoration
*
* @param string $position
* @param string $id
* @param array $decInfo
* @return string
*/
protected function _prepareDecoration($position, $id, $decInfo)
{
if (!in_array($position, array('topDecoration', 'bottomDecoration', 'leftDecoration', 'rightDecoration'))) {
return '';
}
if (!is_array($decInfo)
|| !array_key_exists('labels', $decInfo)
|| !is_array($decInfo['labels'])
) {
return '';
}
$id .= '-' . $position;
if (!array_key_exists('dijit', $decInfo)) {
$dijit = 'dijit.form.' . ucfirst($this->_sliderType) . 'Rule';
} else {
$dijit = $decInfo['dijit'];
if ('dijit.form.' != substr($dijit, 0, 10)) {
$dijit = 'dijit.form.' . $dijit;
}
}
$params = array();
$attribs = array();
$labels = $decInfo['labels'];
if (array_key_exists('params', $decInfo)) {
$params = $decInfo['params'];
}
if (array_key_exists('attribs', $decInfo)) {
$attribs = $decInfo['attribs'];
}
$containerParams = null;
if (array_key_exists('container', $params)) {
$containerParams = $params['container'];
unset($params['container']);
}
if (array_key_exists('labels', $params)) {
$labelsParams = $params['labels'];
unset($params['labels']);
} else {
$labelsParams = $params;
}
if (null === $containerParams) {
$containerParams = $params;
}
$containerAttribs = null;
if (array_key_exists('container', $attribs)) {
$containerAttribs = $attribs['container'];
unset($attribs['container']);
}
if (array_key_exists('labels', $attribs)) {
$labelsAttribs = $attribs['labels'];
unset($attribs['labels']);
} else {
$labelsAttribs = $attribs;
}
if (null === $containerAttribs) {
$containerAttribs = $attribs;
}
$containerParams['container'] = $position;
$labelsParams['container'] = $position;
$labelList = $this->_prepareLabelsList($id, $labelsParams, $labelsAttribs, $labels);
$dijit = 'dijit.form.' . ucfirst($this->_sliderType) . 'Rule';
$containerAttribs['id'] = $id;
$containerAttribs = $this->_prepareDijit($containerAttribs, $containerParams, 'layout', $dijit);
$containerHtml = '<div' . $this->_htmlAttribs($containerAttribs) . "></div>\n";
switch ($position) {
case 'topDecoration':
case 'leftDecoration':
return $labelList . $containerHtml;
case 'bottomDecoration':
case 'rightDecoration':
return $containerHtml . $labelList;
}
}
/**
* Prepare slider label list
*
* @param string $id
* @param array $params
* @param array $attribs
* @param array $labels
* @return string
*/
protected function _prepareLabelsList($id, array $params, array $attribs, array $labels)
{
$attribs['id'] = $id . '-labels';
$dijit = 'dijit.form.' . ucfirst($this->_sliderType) . 'RuleLabels';
$attribs = $this->_prepareDijit($attribs, $params, 'layout', $dijit);
return $this->view->htmlList($labels, true, $attribs);
}
}

View file

@ -0,0 +1,66 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Dojo
* @subpackage View
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: SplitContainer.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/** Zend_Dojo_View_Helper_DijitContainer */
require_once 'Zend/Dojo/View/Helper/DijitContainer.php';
/**
* Dojo SplitContainer dijit
*
* @uses Zend_Dojo_View_Helper_DijitContainer
* @package Zend_Dojo
* @subpackage View
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Dojo_View_Helper_SplitContainer extends Zend_Dojo_View_Helper_DijitContainer
{
/**
* Dijit being used
* @var string
*/
protected $_dijit = 'dijit.layout.SplitContainer';
/**
* Dojo module to use
* @var string
*/
protected $_module = 'dijit.layout.SplitContainer';
/**
* dijit.layout.SplitContainer
*
* @param string $id
* @param string $content
* @param array $params Parameters to use for dijit creation
* @param array $attribs HTML attributes
* @return string
*/
public function splitContainer($id = null, $content = '', array $params = array(), array $attribs = array())
{
if (0 === func_num_args()) {
return $this;
}
return $this->_createLayoutContainer($id, $content, $params, $attribs);
}
}

View file

@ -0,0 +1,66 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Dojo
* @subpackage View
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: StackContainer.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/** Zend_Dojo_View_Helper_DijitContainer */
require_once 'Zend/Dojo/View/Helper/DijitContainer.php';
/**
* Dojo StackContainer dijit
*
* @uses Zend_Dojo_View_Helper_DijitContainer
* @package Zend_Dojo
* @subpackage View
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Dojo_View_Helper_StackContainer extends Zend_Dojo_View_Helper_DijitContainer
{
/**
* Dijit being used
* @var string
*/
protected $_dijit = 'dijit.layout.StackContainer';
/**
* Dojo module to use
* @var string
*/
protected $_module = 'dijit.layout.StackContainer';
/**
* dijit.layout.StackContainer
*
* @param string $id
* @param string $content
* @param array $params Parameters to use for dijit creation
* @param array $attribs HTML attributes
* @return string
*/
public function stackContainer($id = null, $content = '', array $params = array(), array $attribs = array())
{
if (0 === func_num_args()) {
return $this;
}
return $this->_createLayoutContainer($id, $content, $params, $attribs);
}
}

View file

@ -0,0 +1,67 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Dojo
* @subpackage View
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: SubmitButton.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/** Zend_Dojo_View_Helper_Button */
require_once 'Zend/Dojo/View/Helper/Button.php';
/**
* Dojo Button dijit tied to submit input
*
* @uses Zend_Dojo_View_Helper_Button
* @package Zend_Dojo
* @subpackage View
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Dojo_View_Helper_SubmitButton extends Zend_Dojo_View_Helper_Button
{
/**
* @var string Submit input
*/
protected $_elementType = 'submit';
/**
* dijit.form.Button tied to submit input
*
* @param string $id
* @param string $value
* @param array $params Parameters to use for dijit creation
* @param array $attribs HTML attributes
* @return string
*/
public function submitButton($id, $value = null, array $params = array(), array $attribs = array())
{
if (!array_key_exists('label', $params)) {
$params['label'] = $value;
}
if (empty($params['label']) && !empty($params['content'])) {
$params['label'] = $params['content'];
$value = $params['content'];
}
if (empty($params['label']) && !empty($attribs['content'])) {
$params['label'] = $attribs['content'];
$value = $attribs['content'];
unset($attribs['content']);
}
return $this->_createFormElement($id, $value, $params, $attribs);
}
}

View file

@ -0,0 +1,66 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Dojo
* @subpackage View
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: TabContainer.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/** Zend_Dojo_View_Helper_DijitContainer */
require_once 'Zend/Dojo/View/Helper/DijitContainer.php';
/**
* Dojo TabContainer dijit
*
* @uses Zend_Dojo_View_Helper_DijitContainer
* @package Zend_Dojo
* @subpackage View
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Dojo_View_Helper_TabContainer extends Zend_Dojo_View_Helper_DijitContainer
{
/**
* Dijit being used
* @var string
*/
protected $_dijit = 'dijit.layout.TabContainer';
/**
* Dojo module to use
* @var string
*/
protected $_module = 'dijit.layout.TabContainer';
/**
* dijit.layout.TabContainer
*
* @param string $id
* @param string $content
* @param array $params Parameters to use for dijit creation
* @param array $attribs HTML attributes
* @return string
*/
public function tabContainer($id = null, $content = '', array $params = array(), array $attribs = array())
{
if (0 === func_num_args()) {
return $this;
}
return $this->_createLayoutContainer($id, $content, $params, $attribs);
}
}

View file

@ -0,0 +1,68 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Dojo
* @subpackage View
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: TextBox.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/** Zend_Dojo_View_Helper_Dijit */
require_once 'Zend/Dojo/View/Helper/Dijit.php';
/**
* Dojo TextBox dijit
*
* @uses Zend_Dojo_View_Helper_Dijit
* @package Zend_Dojo
* @subpackage View
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Dojo_View_Helper_TextBox extends Zend_Dojo_View_Helper_Dijit
{
/**
* Dijit being used
* @var string
*/
protected $_dijit = 'dijit.form.TextBox';
/**
* HTML element type
* @var string
*/
protected $_elementType = 'text';
/**
* Dojo module to use
* @var string
*/
protected $_module = 'dijit.form.TextBox';
/**
* dijit.form.TextBox
*
* @param int $id
* @param mixed $value
* @param array $params Parameters to use for dijit creation
* @param array $attribs HTML attributes
* @return string
*/
public function textBox($id, $value = null, array $params = array(), array $attribs = array())
{
return $this->_createFormElement($id, $value, $params, $attribs);
}
}

View file

@ -0,0 +1,80 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Dojo
* @subpackage View
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Textarea.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/** Zend_Dojo_View_Helper_Dijit */
require_once 'Zend/Dojo/View/Helper/Dijit.php';
/**
* Dojo Textarea dijit
*
* @uses Zend_Dojo_View_Helper_Dijit
* @package Zend_Dojo
* @subpackage View
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Dojo_View_Helper_Textarea extends Zend_Dojo_View_Helper_Dijit
{
/**
* Dijit being used
* @var string
*/
protected $_dijit = 'dijit.form.Textarea';
/**
* HTML element type
* @var string
*/
protected $_elementType = 'text';
/**
* Dojo module to use
* @var string
*/
protected $_module = 'dijit.form.Textarea';
/**
* dijit.form.Textarea
*
* @param int $id
* @param mixed $value
* @param array $params Parameters to use for dijit creation
* @param array $attribs HTML attributes
* @return string
*/
public function textarea($id, $value = null, array $params = array(), array $attribs = array())
{
if (!array_key_exists('id', $attribs)) {
$attribs['id'] = $id;
}
$attribs['name'] = $id;
$attribs['type'] = $this->_elementType;
$attribs = $this->_prepareDijit($attribs, $params, 'textarea');
$html = '<textarea' . $this->_htmlAttribs($attribs) . '>'
. $value
. "</textarea>\n";
return $html;
}
}

View file

@ -0,0 +1,68 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Dojo
* @subpackage View
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: TimeTextBox.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/** Zend_Dojo_View_Helper_Dijit */
require_once 'Zend/Dojo/View/Helper/Dijit.php';
/**
* Dojo TimeTextBox dijit
*
* @uses Zend_Dojo_View_Helper_Dijit
* @package Zend_Dojo
* @subpackage View
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Dojo_View_Helper_TimeTextBox extends Zend_Dojo_View_Helper_Dijit
{
/**
* Dijit being used
* @var string
*/
protected $_dijit = 'dijit.form.TimeTextBox';
/**
* HTML element type
* @var string
*/
protected $_elementType = 'text';
/**
* Dojo module to use
* @var string
*/
protected $_module = 'dijit.form.TimeTextBox';
/**
* dijit.form.TimeTextBox
*
* @param int $id
* @param mixed $value
* @param array $params Parameters to use for dijit creation
* @param array $attribs HTML attributes
* @return string
*/
public function timeTextBox($id, $value = null, array $params = array(), array $attribs = array())
{
return $this->_createFormElement($id, $value, $params, $attribs);
}
}

View file

@ -0,0 +1,68 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Dojo
* @subpackage View
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: ValidationTextBox.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/** Zend_Dojo_View_Helper_Dijit */
require_once 'Zend/Dojo/View/Helper/Dijit.php';
/**
* Dojo ValidationTextBox dijit
*
* @uses Zend_Dojo_View_Helper_Dijit
* @package Zend_Dojo
* @subpackage View
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Dojo_View_Helper_ValidationTextBox extends Zend_Dojo_View_Helper_Dijit
{
/**
* Dijit being used
* @var string
*/
protected $_dijit = 'dijit.form.ValidationTextBox';
/**
* HTML element type
* @var string
*/
protected $_elementType = 'text';
/**
* Dojo module to use
* @var string
*/
protected $_module = 'dijit.form.ValidationTextBox';
/**
* dijit.form.ValidationTextBox
*
* @param int $id
* @param mixed $value
* @param array $params Parameters to use for dijit creation
* @param array $attribs HTML attributes
* @return string
*/
public function validationTextBox($id, $value = null, array $params = array(), array $attribs = array())
{
return $this->_createFormElement($id, $value, $params, $attribs);
}
}

View file

@ -0,0 +1,62 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Dojo
* @subpackage View
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: VerticalSlider.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/** Zend_Dojo_View_Helper_Slider */
require_once 'Zend/Dojo/View/Helper/Slider.php';
/**
* Dojo VerticalSlider dijit
*
* @uses Zend_Dojo_View_Helper_Slider
* @package Zend_Dojo
* @subpackage View
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Dojo_View_Helper_VerticalSlider extends Zend_Dojo_View_Helper_Slider
{
/**
* Dijit being used
* @var string
*/
protected $_dijit = 'dijit.form.VerticalSlider';
/**
* Slider type
* @var string
*/
protected $_sliderType = 'Vertical';
/**
* dijit.form.VerticalSlider
*
* @param int $id
* @param mixed $value
* @param array $params Parameters to use for dijit creation
* @param array $attribs HTML attributes
* @return string
*/
public function verticalSlider($id, $value = null, array $params = array(), array $attribs = array())
{
return $this->prepareSlider($id, $value, $params, $attribs);
}
}