Dieser Commit ist enthalten in:
Ursprung
2b21070b1a
Commit
f7a7c71f86
1583 geänderte Dateien mit 454759 neuen und 0 gelöschten Zeilen
39
library/ZendX/JQuery/Form/Decorator/AccordionContainer.php
Normale Datei
39
library/ZendX/JQuery/Form/Decorator/AccordionContainer.php
Normale Datei
|
|
@ -0,0 +1,39 @@
|
|||
<?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 ZendX
|
||||
* @package ZendX_JQuery
|
||||
* @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$
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see ZendX_JQuery_Form_Decorator_UiWidgetContainer
|
||||
*/
|
||||
require_once "UiWidgetContainer.php";
|
||||
|
||||
/**
|
||||
* Form Decorator for jQuery Accordion View Helper
|
||||
*
|
||||
* @package ZendX_JQuery
|
||||
* @subpackage Form
|
||||
* @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 ZendX_JQuery_Form_Decorator_AccordionContainer extends ZendX_JQuery_Form_Decorator_UiWidgetContainer
|
||||
{
|
||||
protected $_helper = "accordionContainer";
|
||||
}
|
||||
39
library/ZendX/JQuery/Form/Decorator/AccordionPane.php
Normale Datei
39
library/ZendX/JQuery/Form/Decorator/AccordionPane.php
Normale Datei
|
|
@ -0,0 +1,39 @@
|
|||
<?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 ZendX
|
||||
* @package ZendX_JQuery
|
||||
* @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$
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see ZendX_JQuery_Form_Decorator_UiWidgetContainer
|
||||
*/
|
||||
require_once "UiWidgetPane.php";
|
||||
|
||||
/**
|
||||
* Form Decorator for jQuery Accordion Pane View Helper
|
||||
*
|
||||
* @package ZendX_JQuery
|
||||
* @subpackage Form
|
||||
* @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 ZendX_JQuery_Form_Decorator_AccordionPane extends ZendX_JQuery_Form_Decorator_UiWidgetPane
|
||||
{
|
||||
protected $_helper = "accordionPane";
|
||||
}
|
||||
67
library/ZendX/JQuery/Form/Decorator/DialogContainer.php
Normale Datei
67
library/ZendX/JQuery/Form/Decorator/DialogContainer.php
Normale Datei
|
|
@ -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 ZendX
|
||||
* @package ZendX_JQuery
|
||||
* @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$
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see ZendX_JQuery_Form_Decorator_UiWidgetContainer
|
||||
*/
|
||||
require_once "UiWidgetContainer.php";
|
||||
|
||||
/**
|
||||
* Form Decorator for jQuery Dialog View Helper
|
||||
*
|
||||
* @package ZendX_JQuery
|
||||
* @subpackage Form
|
||||
* @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 ZendX_JQuery_Form_Decorator_DialogContainer extends ZendX_JQuery_Form_Decorator_UiWidgetContainer
|
||||
{
|
||||
protected $_helper = "dialogContainer";
|
||||
|
||||
/**
|
||||
* Render an jQuery UI Widget element using its associated view helper
|
||||
*
|
||||
* Determine view helper from 'helper' option, or, if none set, from
|
||||
* the element type. Then call as
|
||||
* helper($element->getName(), $element->getValue(), $element->getAttribs())
|
||||
*
|
||||
* @param string $content
|
||||
* @return string
|
||||
* @throws Zend_Form_Decorator_Exception if element or view are not registered
|
||||
*/
|
||||
public function render($content)
|
||||
{
|
||||
$element = $this->getElement();
|
||||
$view = $element->getView();
|
||||
if (null === $view) {
|
||||
return $content;
|
||||
}
|
||||
|
||||
$jQueryParams = $this->getJQueryParams();
|
||||
$attribs = $this->getOptions();
|
||||
|
||||
$helper = $this->getHelper();
|
||||
$id = $element->getId() . '-container';
|
||||
|
||||
return $view->$helper($id, $content, $jQueryParams, $attribs);
|
||||
}
|
||||
}
|
||||
39
library/ZendX/JQuery/Form/Decorator/TabContainer.php
Normale Datei
39
library/ZendX/JQuery/Form/Decorator/TabContainer.php
Normale Datei
|
|
@ -0,0 +1,39 @@
|
|||
<?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 ZendX
|
||||
* @package ZendX_JQuery
|
||||
* @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$
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see ZendX_JQuery_Form_Decorator_UiWidgetContainer
|
||||
*/
|
||||
require_once "UiWidgetContainer.php";
|
||||
|
||||
/**
|
||||
* Form Decorator for jQuery Tabs View Helper
|
||||
*
|
||||
* @package ZendX_JQuery
|
||||
* @subpackage Form
|
||||
* @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 ZendX_JQuery_Form_Decorator_TabContainer extends ZendX_JQuery_Form_Decorator_UiWidgetContainer
|
||||
{
|
||||
protected $_helper = "tabContainer";
|
||||
}
|
||||
39
library/ZendX/JQuery/Form/Decorator/TabPane.php
Normale Datei
39
library/ZendX/JQuery/Form/Decorator/TabPane.php
Normale Datei
|
|
@ -0,0 +1,39 @@
|
|||
<?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 ZendX
|
||||
* @package ZendX_JQuery
|
||||
* @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$
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see ZendX_JQuery_Form_Decorator_UiWidgetContainer
|
||||
*/
|
||||
require_once "UiWidgetPane.php";
|
||||
|
||||
/**
|
||||
* Form Decorator for jQuery Tab Pane View Helper
|
||||
*
|
||||
* @package ZendX_JQuery
|
||||
* @subpackage Form
|
||||
* @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 ZendX_JQuery_Form_Decorator_TabPane extends ZendX_JQuery_Form_Decorator_UiWidgetPane
|
||||
{
|
||||
protected $_helper = "tabPane";
|
||||
}
|
||||
138
library/ZendX/JQuery/Form/Decorator/UiWidgetContainer.php
Normale Datei
138
library/ZendX/JQuery/Form/Decorator/UiWidgetContainer.php
Normale Datei
|
|
@ -0,0 +1,138 @@
|
|||
<?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 ZendX
|
||||
* @package ZendX_JQuery
|
||||
* @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$
|
||||
*/
|
||||
|
||||
require_once "Zend/Form/Decorator/Abstract.php";
|
||||
|
||||
/**
|
||||
* Abstract Form Decorator for all jQuery UI Widget Containers
|
||||
*
|
||||
* @package ZendX_JQuery
|
||||
* @subpackage Form
|
||||
* @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 ZendX_JQuery_Form_Decorator_UiWidgetContainer extends Zend_Form_Decorator_Abstract
|
||||
{
|
||||
/**
|
||||
* View helper
|
||||
* @var string
|
||||
*/
|
||||
protected $_helper;
|
||||
|
||||
/**
|
||||
* Element attributes
|
||||
* @var array
|
||||
*/
|
||||
protected $_attribs;
|
||||
|
||||
/**
|
||||
* jQuery option parameters
|
||||
* @var array
|
||||
*/
|
||||
protected $_jQueryParams;
|
||||
|
||||
/**
|
||||
* Get view helper for rendering container
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getHelper()
|
||||
{
|
||||
if (null === $this->_helper) {
|
||||
require_once 'Zend/Form/Decorator/Exception.php';
|
||||
throw new Zend_Form_Decorator_Exception('No view helper specified fo DijitContainer decorator');
|
||||
}
|
||||
return $this->_helper;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get element attributes
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getAttribs()
|
||||
{
|
||||
if (null === $this->_attribs) {
|
||||
$attribs = $this->getElement()->getAttribs();
|
||||
if (array_key_exists('jQueryParams', $attribs)) {
|
||||
$this->getJQueryParams();
|
||||
unset($attribs['jQueryParams']);
|
||||
}
|
||||
$this->_attribs = $attribs;
|
||||
}
|
||||
return $this->_attribs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get jQuery option parameters
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getJQueryParams()
|
||||
{
|
||||
if (null === $this->_jQueryParams) {
|
||||
$this->_jQueryParams = array();
|
||||
if($attribs = $this->getElement()->getAttribs()) {
|
||||
if (array_key_exists('jQueryParams', $attribs)) {
|
||||
$this->_jQueryParams = $attribs['jQueryParams'];
|
||||
}
|
||||
}
|
||||
|
||||
if($options = $this->getOptions()) {
|
||||
if (array_key_exists('jQueryParams', $options)) {
|
||||
$this->_jQueryParams = array_merge($this->_jQueryParams, $options['jQueryParams']);
|
||||
$this->removeOption('jQueryParams');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $this->_jQueryParams;
|
||||
}
|
||||
|
||||
/**
|
||||
* Render an jQuery UI Widget element using its associated view helper
|
||||
*
|
||||
* Determine view helper from 'helper' option, or, if none set, from
|
||||
* the element type. Then call as
|
||||
* helper($element->getName(), $element->getValue(), $element->getAttribs())
|
||||
*
|
||||
* @param string $content
|
||||
* @return string
|
||||
* @throws Zend_Form_Decorator_Exception if element or view are not registered
|
||||
*/
|
||||
public function render($content)
|
||||
{
|
||||
$element = $this->getElement();
|
||||
$view = $element->getView();
|
||||
if (null === $view) {
|
||||
return $content;
|
||||
}
|
||||
|
||||
$jQueryParams = $this->getJQueryParams();
|
||||
$attribs = $this->getOptions();
|
||||
|
||||
$helper = $this->getHelper();
|
||||
$id = $element->getId() . '-container';
|
||||
|
||||
return $view->$helper($id, $jQueryParams, $attribs);
|
||||
}
|
||||
}
|
||||
178
library/ZendX/JQuery/Form/Decorator/UiWidgetElement.php
Normale Datei
178
library/ZendX/JQuery/Form/Decorator/UiWidgetElement.php
Normale Datei
|
|
@ -0,0 +1,178 @@
|
|||
<?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 ZendX
|
||||
* @package ZendX_JQuery
|
||||
* @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$
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Form_Decorator_ViewHelper
|
||||
*/
|
||||
require_once "Zend/Form/Decorator/ViewHelper.php";
|
||||
|
||||
/**
|
||||
* @see ZendX_JQuery_Form_Decorator_UiWidgetElementMarker
|
||||
*/
|
||||
require_once "ZendX/JQuery/Form/Decorator/UiWidgetElementMarker.php";
|
||||
|
||||
/**
|
||||
* Abstract Form Decorator for all jQuery UI Form Elements
|
||||
*
|
||||
* @package ZendX_JQuery
|
||||
* @subpackage Form
|
||||
* @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 ZendX_JQuery_Form_Decorator_UiWidgetElement
|
||||
extends Zend_Form_Decorator_ViewHelper
|
||||
implements ZendX_JQuery_Form_Decorator_UiWidgetElementMarker
|
||||
{
|
||||
/**
|
||||
* Element attributes
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $_attribs;
|
||||
|
||||
/**
|
||||
* jQuery UI View Helper
|
||||
*
|
||||
* @var ZendX_JQuery_View_Helper_UiWidget
|
||||
*/
|
||||
public $helper;
|
||||
|
||||
/**
|
||||
* jQuery related attributes/options
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $_jQueryParams = array();
|
||||
|
||||
/**
|
||||
* Get element attributes
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getElementAttribs()
|
||||
{
|
||||
if (null === $this->_attribs) {
|
||||
if($this->_attribs = parent::getElementAttribs()) {
|
||||
if (array_key_exists('jQueryParams', $this->_attribs)) {
|
||||
$this->setJQueryParams($this->_attribs['jQueryParams']);
|
||||
unset($this->_attribs['jQueryParams']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $this->_attribs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a single jQuery option parameter
|
||||
*
|
||||
* @param string $key
|
||||
* @param mixed $value
|
||||
* @return ZendX_JQuery_Form_Decorator_UiWidgetElement
|
||||
*/
|
||||
public function setJQueryParam($key, $value)
|
||||
{
|
||||
$this->_jQueryParams[(string) $key] = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set jQuery option parameters
|
||||
*
|
||||
* @param array $params
|
||||
* @return ZendX_JQuery_Form_Decorator_UiWidgetElement
|
||||
*/
|
||||
public function setJQueryParams(array $params)
|
||||
{
|
||||
$this->_jQueryParams = array_merge($this->_jQueryParams, $params);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve a single jQuery option parameter
|
||||
*
|
||||
* @param string $key
|
||||
* @return mixed|null
|
||||
*/
|
||||
public function getJQueryParam($key)
|
||||
{
|
||||
$this->getElementAttribs();
|
||||
$key = (string) $key;
|
||||
if (array_key_exists($key, $this->_jQueryParams)) {
|
||||
return $this->_jQueryParams[$key];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get jQuery option parameters
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getJQueryParams()
|
||||
{
|
||||
$this->getElementAttribs();
|
||||
return $this->_jQueryParams;
|
||||
}
|
||||
|
||||
/**
|
||||
* Render an jQuery UI Widget element using its associated view helper
|
||||
*
|
||||
* @param string $content
|
||||
* @return string
|
||||
* @throws Zend_Form_Decorator_Exception if element or view are not registered
|
||||
*/
|
||||
public function render($content)
|
||||
{
|
||||
$element = $this->getElement();
|
||||
$view = $element->getView();
|
||||
if (null === $view) {
|
||||
require_once 'Zend/Form/Decorator/Exception.php';
|
||||
throw new Zend_Form_Decorator_Exception('UiWidgetElement decorator cannot render without a registered view object');
|
||||
}
|
||||
|
||||
if(method_exists($element, 'getJQueryParams')) {
|
||||
$this->setJQueryParams($element->getJQueryParams());
|
||||
}
|
||||
$jQueryParams = $this->getJQueryParams();
|
||||
|
||||
$helper = $this->getHelper();
|
||||
$separator = $this->getSeparator();
|
||||
$value = $this->getValue($element);
|
||||
$attribs = $this->getElementAttribs();
|
||||
$name = $element->getFullyQualifiedName();
|
||||
|
||||
$id = $element->getId();
|
||||
$attribs['id'] = $id;
|
||||
|
||||
$elementContent = $view->$helper($name, $value, $jQueryParams, $attribs);
|
||||
switch ($this->getPlacement()) {
|
||||
case self::APPEND:
|
||||
return $content . $separator . $elementContent;
|
||||
case self::PREPEND:
|
||||
return $elementContent . $separator . $content;
|
||||
default:
|
||||
return $elementContent;
|
||||
}
|
||||
}
|
||||
}
|
||||
31
library/ZendX/JQuery/Form/Decorator/UiWidgetElementMarker.php
Normale Datei
31
library/ZendX/JQuery/Form/Decorator/UiWidgetElementMarker.php
Normale Datei
|
|
@ -0,0 +1,31 @@
|
|||
<?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 ZendX
|
||||
* @package ZendX_JQuery
|
||||
* @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$
|
||||
*/
|
||||
|
||||
/**
|
||||
* Marking UiWidgetElement rendering decorator.
|
||||
*
|
||||
* Marker Interface to make sure that programmer using ZendX_JQuery is not
|
||||
* switching ZendX_JQuery_Form_Decorator_UiWidgetElement with Zend_Form_Decorator_ViewHelper
|
||||
* without noticing that this is not possible.
|
||||
*/
|
||||
interface ZendX_JQuery_Form_Decorator_UiWidgetElementMarker {
|
||||
}
|
||||
157
library/ZendX/JQuery/Form/Decorator/UiWidgetPane.php
Normale Datei
157
library/ZendX/JQuery/Form/Decorator/UiWidgetPane.php
Normale Datei
|
|
@ -0,0 +1,157 @@
|
|||
<?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 ZendX
|
||||
* @package ZendX_JQuery
|
||||
* @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$
|
||||
*/
|
||||
|
||||
require_once "Zend/Form/Decorator/Abstract.php";
|
||||
|
||||
/**
|
||||
* Abstract Form Decorator for all jQuery UI Pane View Helpers
|
||||
*
|
||||
* @package ZendX_JQuery
|
||||
* @subpackage Form
|
||||
* @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 ZendX_JQuery_Form_Decorator_UiWidgetPane extends Zend_Form_Decorator_Abstract
|
||||
{
|
||||
/**
|
||||
* View helper
|
||||
* @var string
|
||||
*/
|
||||
protected $_helper;
|
||||
|
||||
/**
|
||||
* Element attributes
|
||||
* @var array
|
||||
*/
|
||||
protected $_attribs;
|
||||
|
||||
/**
|
||||
* jQuery option parameters
|
||||
* @var array
|
||||
*/
|
||||
protected $_jQueryParams;
|
||||
|
||||
/**
|
||||
* Container title
|
||||
* @var string
|
||||
*/
|
||||
protected $_title;
|
||||
|
||||
/**
|
||||
* Get view helper for rendering container
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getHelper()
|
||||
{
|
||||
if (null === $this->_helper) {
|
||||
require_once 'Zend/Form/Decorator/Exception.php';
|
||||
throw new Zend_Form_Decorator_Exception('No view helper specified fo UiWidgetContainer decorator');
|
||||
}
|
||||
return $this->_helper;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get element attributes
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getAttribs()
|
||||
{
|
||||
if (null === $this->_attribs) {
|
||||
$attribs = $this->getElement()->getAttribs();
|
||||
if (array_key_exists('jQueryParams', $attribs)) {
|
||||
$this->getJQueryParams();
|
||||
unset($attribs['jQueryParams']);
|
||||
}
|
||||
$this->_attribs = $attribs;
|
||||
}
|
||||
return $this->_attribs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get jQuery option parameters
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getJQueryParams()
|
||||
{
|
||||
if (null === $this->_jQueryParams) {
|
||||
$attribs = $this->getElement()->getAttribs();
|
||||
$this->_jQueryParams = array();
|
||||
if (array_key_exists('jQueryParams', $attribs)) {
|
||||
$this->_jQueryParams = $attribs['jQueryParams'];
|
||||
}
|
||||
|
||||
$options = $this->getOptions();
|
||||
if (array_key_exists('jQueryParams', $options)) {
|
||||
$this->_jQueryParams = array_merge($this->_jQueryParams, $options['jQueryParams']);
|
||||
$this->removeOption('jQueryParams');
|
||||
}
|
||||
}
|
||||
|
||||
// Ensure we have a title param
|
||||
if (!array_key_exists('title', $this->_jQueryParams)) {
|
||||
require_once "Zend/Form/Decorator/Exception.php";
|
||||
throw new Zend_Form_Decorator_Exception("UiWidgetPane Decorators have to have a jQueryParam 'title' to render. This title can been set via setJQueryParam('title') on the parent element.");
|
||||
}
|
||||
|
||||
return $this->_jQueryParams;
|
||||
}
|
||||
|
||||
/**
|
||||
* Render an jQuery UI Widget Pane using its associated view helper
|
||||
*
|
||||
* @throws Zend_Form_Decorator_Exception
|
||||
* @param string $content
|
||||
* @return string
|
||||
* @throws Zend_Form_Decorator_Exception if element or view are not registered
|
||||
*/
|
||||
public function render($content)
|
||||
{
|
||||
$element = $this->getElement();
|
||||
$view = $element->getView();
|
||||
if (null === $view) {
|
||||
return $content;
|
||||
}
|
||||
|
||||
$jQueryParams = $this->getJQueryParams();
|
||||
$attribs = array_merge($this->getAttribs(), $this->getOptions());
|
||||
|
||||
if(isset($jQueryParams['title']) && !empty($jQueryParams['title'])) {
|
||||
if (null !== ($translator = $element->getTranslator())) {
|
||||
$jQueryParams['title'] = $translator->translate($jQueryParams['title']);
|
||||
}
|
||||
}
|
||||
|
||||
if(isset($jQueryParams['containerId'])) {
|
||||
$id = $jQueryParams['containerId']."-container";
|
||||
} else {
|
||||
require_once "Zend/Form/Decorator/Exception.php";
|
||||
throw new Zend_Form_Decorator_Exception("UiWidgetPane Decorators have to have a jQueryParam 'containerId', to point at their parent container. This containerId has been set via setAttrib('id') on the parent element.");
|
||||
}
|
||||
|
||||
$helper = $this->getHelper();
|
||||
|
||||
return $view->$helper($id, $content, $jQueryParams, $attribs);
|
||||
}
|
||||
}
|
||||
39
library/ZendX/JQuery/Form/Element/AutoComplete.php
Normale Datei
39
library/ZendX/JQuery/Form/Element/AutoComplete.php
Normale Datei
|
|
@ -0,0 +1,39 @@
|
|||
<?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 ZendX
|
||||
* @package ZendX_JQuery
|
||||
* @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$
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see ZendX_JQuery_Form_Element_UiWidget
|
||||
*/
|
||||
require_once "UiWidget.php";
|
||||
|
||||
/**
|
||||
* Form Element for jQuery Autocomplete View Helper
|
||||
*
|
||||
* @package ZendX_JQuery
|
||||
* @subpackage Form
|
||||
* @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 ZendX_JQuery_Form_Element_AutoComplete extends ZendX_JQuery_Form_Element_UiWidget
|
||||
{
|
||||
public $helper = "autoComplete";
|
||||
}
|
||||
39
library/ZendX/JQuery/Form/Element/ColorPicker.php
Normale Datei
39
library/ZendX/JQuery/Form/Element/ColorPicker.php
Normale Datei
|
|
@ -0,0 +1,39 @@
|
|||
<?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 ZendX
|
||||
* @package ZendX_JQuery
|
||||
* @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$
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see ZendX_JQuery_Form_Element_UiWidget
|
||||
*/
|
||||
require_once "UiWidget.php";
|
||||
|
||||
/**
|
||||
* Form Element for jQuery ColorPicker View Helper
|
||||
*
|
||||
* @package ZendX_JQuery
|
||||
* @subpackage Form
|
||||
* @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 ZendX_JQuery_Form_Element_ColorPicker extends ZendX_JQuery_Form_Element_UiWidget
|
||||
{
|
||||
public $helper = "colorPicker";
|
||||
}
|
||||
39
library/ZendX/JQuery/Form/Element/DatePicker.php
Normale Datei
39
library/ZendX/JQuery/Form/Element/DatePicker.php
Normale Datei
|
|
@ -0,0 +1,39 @@
|
|||
<?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 ZendX
|
||||
* @package ZendX_JQuery
|
||||
* @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$
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see ZendX_JQuery_Form_Element_UiWidget
|
||||
*/
|
||||
require_once "UiWidget.php";
|
||||
|
||||
/**
|
||||
* Form Element for jQuery DatePicker View Helper
|
||||
*
|
||||
* @package ZendX_JQuery
|
||||
* @subpackage Form
|
||||
* @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 ZendX_JQuery_Form_Element_DatePicker extends ZendX_JQuery_Form_Element_UiWidget
|
||||
{
|
||||
public $helper = "datePicker";
|
||||
}
|
||||
39
library/ZendX/JQuery/Form/Element/Slider.php
Normale Datei
39
library/ZendX/JQuery/Form/Element/Slider.php
Normale Datei
|
|
@ -0,0 +1,39 @@
|
|||
<?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 ZendX
|
||||
* @package ZendX_JQuery
|
||||
* @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$
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see ZendX_JQuery_Form_Element_UiWidget
|
||||
*/
|
||||
require_once "UiWidget.php";
|
||||
|
||||
/**
|
||||
* Form Element for jQuery Slider View Helper
|
||||
*
|
||||
* @package ZendX_JQuery
|
||||
* @subpackage Form
|
||||
* @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 ZendX_JQuery_Form_Element_Slider extends ZendX_JQuery_Form_Element_UiWidget
|
||||
{
|
||||
public $helper = "slider";
|
||||
}
|
||||
39
library/ZendX/JQuery/Form/Element/Spinner.php
Normale Datei
39
library/ZendX/JQuery/Form/Element/Spinner.php
Normale Datei
|
|
@ -0,0 +1,39 @@
|
|||
<?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 ZendX
|
||||
* @package ZendX_JQuery
|
||||
* @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$
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see ZendX_JQuery_Form_Element_UiWidget
|
||||
*/
|
||||
require_once "UiWidget.php";
|
||||
|
||||
/**
|
||||
* Form Element for jQuery Spinner View Helper
|
||||
*
|
||||
* @package ZendX_JQuery
|
||||
* @subpackage Form
|
||||
* @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 ZendX_JQuery_Form_Element_Spinner extends ZendX_JQuery_Form_Element_UiWidget
|
||||
{
|
||||
public $helper = "spinner";
|
||||
}
|
||||
180
library/ZendX/JQuery/Form/Element/UiWidget.php
Normale Datei
180
library/ZendX/JQuery/Form/Element/UiWidget.php
Normale Datei
|
|
@ -0,0 +1,180 @@
|
|||
<?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 ZendX
|
||||
* @package ZendX_JQuery
|
||||
* @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$
|
||||
*/
|
||||
|
||||
require_once "Zend/Form/Element.php";
|
||||
|
||||
/**
|
||||
* Base Form Element for jQuery View Helpers
|
||||
*
|
||||
* @package ZendX_JQuery
|
||||
* @subpackage Form
|
||||
* @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 ZendX_JQuery_Form_Element_UiWidget extends Zend_Form_Element
|
||||
{
|
||||
/**
|
||||
* jQuery related parameters of this form element.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $jQueryParams = array();
|
||||
|
||||
/**
|
||||
* Just here to prevent errors.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $options = array();
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param mixed $spec
|
||||
* @param mixed $options
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($spec, $options = null)
|
||||
{
|
||||
$this->addPrefixPath('ZendX_JQuery_Form_Decorator', 'ZendX/JQuery/Form/Decorator', 'decorator');
|
||||
parent::__construct($spec, $options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get jQuery related parameter of this form element
|
||||
*
|
||||
* @param string $key
|
||||
* @return string
|
||||
*/
|
||||
public function getJQueryParam($key)
|
||||
{
|
||||
$key = (string) $key;
|
||||
return $this->jQueryParams[$key];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all currently known jQuery related parameters of this element
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getJQueryParams()
|
||||
{
|
||||
return $this->jQueryParams;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a jQuery related parameter of this form element.
|
||||
*
|
||||
* @param string $key
|
||||
* @param string $value
|
||||
* @return ZendX_JQuery_Form_Element_UiWidget
|
||||
*/
|
||||
public function setJQueryParam($key, $value)
|
||||
{
|
||||
$key = (string) $key;
|
||||
$this->jQueryParams[$key] = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set an array of jQuery related options for this element (merging with old options).
|
||||
*
|
||||
* @param Array $params
|
||||
* @return ZendX_JQuery_Form_Element_UiWidget
|
||||
*/
|
||||
public function setJQueryParams($params)
|
||||
{
|
||||
$this->jQueryParams = array_merge($this->jQueryParams, $params);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Load default decorators
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function loadDefaultDecorators()
|
||||
{
|
||||
if ($this->loadDefaultDecoratorsIsDisabled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$decorators = $this->getDecorators();
|
||||
if (empty($decorators)) {
|
||||
$this->addDecorator('UiWidgetElement')
|
||||
->addDecorator('Errors')
|
||||
->addDecorator('Description', array('tag' => 'p', 'class' => 'description'))
|
||||
->addDecorator('HtmlTag', array('tag' => 'dd'))
|
||||
->addDecorator('Label', array('tag' => 'dt'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the view object
|
||||
*
|
||||
* Ensures that the view object has the jQuery view helper path set.
|
||||
*
|
||||
* @param Zend_View_Interface $view
|
||||
* @return ZendX_JQuery_Form_Element_UiWidget
|
||||
*/
|
||||
public function setView(Zend_View_Interface $view = null)
|
||||
{
|
||||
if (null !== $view) {
|
||||
if (false === $view->getPluginLoader('helper')->getPaths('ZendX_JQuery_View_Helper')) {
|
||||
$view->addHelperPath('ZendX/JQuery/View/Helper', 'ZendX_JQuery_View_Helper');
|
||||
}
|
||||
}
|
||||
return parent::setView($view);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve all decorators
|
||||
*
|
||||
* @throws ZendX_JQuery_Form_Exception
|
||||
* @return array
|
||||
*/
|
||||
public function getDecorators()
|
||||
{
|
||||
$decorators = parent::getDecorators();
|
||||
if(count($decorators) > 0) {
|
||||
// Only check this if there are decorators present, otherwise it could
|
||||
// be that the decorators have not been initialized yet.
|
||||
$foundUiWidgetElementMarker = false;
|
||||
foreach($decorators AS $decorator) {
|
||||
if($decorator instanceof ZendX_JQuery_Form_Decorator_UiWidgetElementMarker) {
|
||||
$foundUiWidgetElementMarker = true;
|
||||
}
|
||||
}
|
||||
if($foundUiWidgetElementMarker === false) {
|
||||
require_once "ZendX/JQuery/Form/Exception.php";
|
||||
throw new ZendX_JQuery_Form_Exception(
|
||||
"Cannot render jQuery form element without at least one decorator ".
|
||||
"implementing the 'ZendX_JQuery_Form_Decorator_UiWidgetElementMarker' interface. ".
|
||||
"Default decorator for this marker interface is the 'ZendX_JQuery_Form_Decorator_UiWidgetElement'. ".
|
||||
"Hint: The ViewHelper decorator does not render jQuery elements correctly."
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return $decorators;
|
||||
}
|
||||
}
|
||||
11
library/ZendX/JQuery/Form/Exception.php
Normale Datei
11
library/ZendX/JQuery/Form/Exception.php
Normale Datei
|
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @see ZendX_JQuery_Exception
|
||||
*/
|
||||
require_once "ZendX/JQuery/Exception.php";
|
||||
|
||||
class ZendX_JQuery_Form_Exception extends ZendX_JQuery_Exception
|
||||
{
|
||||
|
||||
}
|
||||
Laden …
Tabelle hinzufügen
Einen Link hinzufügen
In neuem Issue referenzieren