import v1.1.0_beta1 | 2009-08-21
This commit is contained in:
@ -38,7 +38,7 @@ require_once 'Zend/Form/Decorator/ViewHelper.php';
|
||||
* @subpackage Form_Decorator
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: DijitElement.php 12374 2008-11-07 17:49:43Z matthew $
|
||||
* @version $Id: DijitElement.php 12687 2008-11-18 14:13:40Z mcleod@spaceweb.nl $
|
||||
*/
|
||||
class Zend_Dojo_Form_Decorator_DijitElement extends Zend_Form_Decorator_ViewHelper
|
||||
{
|
||||
@ -157,10 +157,6 @@ class Zend_Dojo_Form_Decorator_DijitElement extends Zend_Form_Decorator_ViewHelp
|
||||
}
|
||||
|
||||
$options = null;
|
||||
if (method_exists($element, 'getMultiOptions')) {
|
||||
$options = $element->getMultiOptions();
|
||||
}
|
||||
|
||||
$helper = $this->getHelper();
|
||||
$separator = $this->getSeparator();
|
||||
$value = $this->getValue($element);
|
||||
@ -181,7 +177,11 @@ class Zend_Dojo_Form_Decorator_DijitElement extends Zend_Form_Decorator_ViewHelp
|
||||
} while ($view->dojo()->hasDijit($id));
|
||||
}
|
||||
$attribs['id'] = $id;
|
||||
|
||||
|
||||
if (array_key_exists('options', $attribs)) {
|
||||
$options = $attribs['options'];
|
||||
}
|
||||
|
||||
$elementContent = $view->$helper($name, $value, $dijitParams, $attribs, $options);
|
||||
switch ($this->getPlacement()) {
|
||||
case self::APPEND:
|
||||
|
@ -30,7 +30,7 @@ require_once 'Zend/Form/Element.php';
|
||||
* @subpackage Form_Element
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Dijit.php 10076 2008-07-13 12:58:08Z matthew $
|
||||
* @version $Id: Dijit.php 13260 2008-12-15 14:30:35Z matthew $
|
||||
*/
|
||||
abstract class Zend_Dojo_Form_Element_Dijit extends Zend_Form_Element
|
||||
{
|
||||
@ -163,6 +163,7 @@ abstract class Zend_Dojo_Form_Element_Dijit extends Zend_Form_Element
|
||||
if (empty($decorators)) {
|
||||
$this->addDecorator('DijitElement')
|
||||
->addDecorator('Errors')
|
||||
->addDecorator('Description', array('tag' => 'p', 'class' => 'description'))
|
||||
->addDecorator('HtmlTag', array('tag' => 'dd'))
|
||||
->addDecorator('Label', array('tag' => 'dt'));
|
||||
}
|
||||
|
43
libs/Zend/Dojo/Form/Element/SimpleTextarea.php
Normal file
43
libs/Zend/Dojo/Form/Element/SimpleTextarea.php
Normal file
@ -0,0 +1,43 @@
|
||||
<?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 Form_Element
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
/** Zend_Dojo_Form_Element_Dijit */
|
||||
require_once 'Zend/Dojo/Form/Element/Dijit.php';
|
||||
|
||||
/**
|
||||
* dijit.form.SimpleTextArea
|
||||
*
|
||||
* @uses Zend_Dojo_Form_Element_Dijit
|
||||
* @category Zend
|
||||
* @package Zend_Dojo
|
||||
* @subpackage Form_Element
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: $
|
||||
*/
|
||||
class Zend_Dojo_Form_Element_SimpleTextarea extends Zend_Dojo_Form_Element_Dijit
|
||||
{
|
||||
/**
|
||||
* Use SimpleTextarea dijit view helper
|
||||
* @var string
|
||||
*/
|
||||
public $helper = 'SimpleTextarea';
|
||||
}
|
@ -1,6 +1,34 @@
|
||||
<?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-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Exception.php 13982 2009-02-05 11:54:55Z matthew $
|
||||
*/
|
||||
|
||||
require_once 'Zend/Dojo/Exception.php';
|
||||
|
||||
/**
|
||||
* @category Zend
|
||||
* @package Zend_Dojo
|
||||
* @subpackage View
|
||||
* @copyright Copyright (c) 2005-2008 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
|
||||
{
|
||||
}
|
||||
|
@ -17,7 +17,7 @@
|
||||
* @subpackage View
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: ComboBox.php 11014 2008-08-24 21:15:31Z matthew $
|
||||
* @version $Id: ComboBox.php 16135 2009-06-18 18:15:40Z matthew $
|
||||
*/
|
||||
|
||||
/** Zend_Dojo_View_Helper_Dijit */
|
||||
@ -70,8 +70,11 @@ class Zend_Dojo_View_Helper_ComboBox extends Zend_Dojo_View_Helper_Dijit
|
||||
}
|
||||
if (array_key_exists('store', $params) && is_array($params['store'])) {
|
||||
// using dojo.data datastore
|
||||
if (false !== ($store = $this->_renderStore($params['store']))) {
|
||||
if (false !== ($store = $this->_renderStore($params['store'], $id))) {
|
||||
$params['store'] = $params['store']['store'];
|
||||
if ($this->_useProgrammatic()) {
|
||||
unset($params['store']);
|
||||
}
|
||||
if (is_string($store)) {
|
||||
$html .= $store;
|
||||
}
|
||||
@ -90,12 +93,15 @@ class Zend_Dojo_View_Helper_ComboBox extends Zend_Dojo_View_Helper_Dijit
|
||||
$storeParams['params'] = $params['storeParams'];
|
||||
unset($params['storeParams']);
|
||||
}
|
||||
if (false !== ($store = $this->_renderStore($storeParams))) {
|
||||
if (false !== ($store = $this->_renderStore($storeParams, $id))) {
|
||||
if (is_string($store)) {
|
||||
$html .= $store;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($this->_useProgrammatic()) {
|
||||
unset($params['store']);
|
||||
}
|
||||
$html .= $this->_createFormElement($id, $value, $params, $attribs);
|
||||
return $html;
|
||||
}
|
||||
@ -113,7 +119,7 @@ class Zend_Dojo_View_Helper_ComboBox extends Zend_Dojo_View_Helper_Dijit
|
||||
* @param array $params
|
||||
* @return string|false
|
||||
*/
|
||||
protected function _renderStore(array $params)
|
||||
protected function _renderStore(array $params, $id)
|
||||
{
|
||||
if (!array_key_exists('store', $params) || !array_key_exists('type', $params)) {
|
||||
return false;
|
||||
@ -134,14 +140,15 @@ class Zend_Dojo_View_Helper_ComboBox extends Zend_Dojo_View_Helper_Dijit
|
||||
|
||||
if ($this->_useProgrammatic()) {
|
||||
if (!$this->_useProgrammaticNoScript()) {
|
||||
$this->dojo->addJavascript('var ' . $storeParams['jsId'] . ';');
|
||||
require_once 'Zend/Json.php';
|
||||
$js = "function() {\n"
|
||||
. ' ' . $storeParams['jsId'] . ' = '
|
||||
$js = 'var ' . $storeParams['jsId'] . ' = '
|
||||
. 'new ' . $storeParams['dojoType'] . '('
|
||||
. Zend_Json::encode($extraParams)
|
||||
. ");\n}";
|
||||
$this->dojo->addOnLoad($js);
|
||||
. Zend_Json::encode($extraParams)
|
||||
. ");\n"
|
||||
. 'dijit.byId("' . $id . '").attr("store", '
|
||||
. $storeParams['jsId'] . ');';
|
||||
$js = "function() {\n$js\n}";
|
||||
$this->dojo->prependOnLoad($js);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
107
libs/Zend/Dojo/View/Helper/CustomDijit.php
Normal file
107
libs/Zend/Dojo/View/Helper/CustomDijit.php
Normal file
@ -0,0 +1,107 @@
|
||||
<?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-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
/** 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-2008 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;
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
@ -16,7 +16,7 @@
|
||||
* @package Zend_Dojo
|
||||
* @subpackage View
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @version $Id: Container.php 11991 2008-10-16 15:12:15Z matthew $
|
||||
* @version $Id: Container.php 14165 2009-02-25 17:56:01Z matthew $
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
@ -576,6 +576,20 @@ class Zend_Dojo_View_Helper_Dojo_Container
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepend an onLoad event to the list of onLoad actions
|
||||
*
|
||||
* @param string $callback Lambda
|
||||
* @return Zend_Dojo_View_Helper_Dojo_Container
|
||||
*/
|
||||
public function prependOnLoad($callback)
|
||||
{
|
||||
if (!in_array($callback, $this->_onLoadActions, true)) {
|
||||
array_unshift($this->_onLoadActions, $callback);
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve all registered onLoad actions
|
||||
*
|
||||
@ -776,7 +790,7 @@ function() {
|
||||
}
|
||||
EOJ;
|
||||
$this->requireModule('dojo.parser');
|
||||
$this->addOnLoad($js);
|
||||
$this->prependOnLoad($js);
|
||||
$this->addJavascript('var zendDijits = ' . $this->dijitsToJson() . ';');
|
||||
$this->_dijitLoaderRegistered = true;
|
||||
}
|
||||
|
@ -30,7 +30,8 @@ require_once 'Zend/Dojo/View/Helper/Dijit.php';
|
||||
* @package Zend_Dojo
|
||||
* @subpackage View
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @license New BSD {@link http://framework.zend.com/license/new-bsd}
|
||||
* @version $Id: $
|
||||
*/
|
||||
class Zend_Dojo_View_Helper_SimpleTextarea extends Zend_Dojo_View_Helper_Dijit
|
||||
{
|
||||
|
@ -17,7 +17,7 @@
|
||||
* @subpackage View
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Slider.php 12387 2008-11-07 21:03:34Z matthew $
|
||||
* @version $Id: Slider.php 13657 2009-01-15 23:36:35Z matthew $
|
||||
*/
|
||||
|
||||
/** Zend_Dojo_View_Helper_Dijit */
|
||||
@ -216,7 +216,19 @@ abstract class Zend_Dojo_View_Helper_Slider extends Zend_Dojo_View_Helper_Dijit
|
||||
|
||||
$labelList = $this->_prepareLabelsList($id, $labelsParams, $labelsAttribs, $labels);
|
||||
|
||||
return $this->_createLayoutContainer($id, $labelList, $containerParams, $containerAttribs, $dijit);
|
||||
$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;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -17,7 +17,7 @@
|
||||
* @subpackage View
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: SubmitButton.php 10621 2008-08-04 00:05:33Z matthew $
|
||||
* @version $Id: SubmitButton.php 12691 2008-11-18 20:16:06Z matthew $
|
||||
*/
|
||||
|
||||
/** Zend_Dojo_View_Helper_Button */
|
||||
@ -53,6 +53,15 @@ class Zend_Dojo_View_Helper_SubmitButton extends Zend_Dojo_View_Helper_Button
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user