import v1.1.0_beta1 | 2009-08-21

This commit is contained in:
2019-07-17 22:16:19 +02:00
parent 2c1152f0d3
commit 8dee6b1a10
2306 changed files with 251360 additions and 23428 deletions

View File

@ -46,7 +46,7 @@ require_once 'Zend/Form/Decorator/Abstract.php';
* @subpackage 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: Callback.php 8064 2008-02-16 10:58:39Z thomas $
* @version $Id: Callback.php 15916 2009-06-06 14:47:55Z matthew $
*/
class Zend_Form_Decorator_Callback extends Zend_Form_Decorator_Abstract
{
@ -59,24 +59,16 @@ class Zend_Form_Decorator_Callback extends Zend_Form_Decorator_Abstract
/**
* Set callback
*
* @param string|array $callback
* @param callback $callback
* @return Zend_Form_Decorator_Callback
* @throws Zend_Form_Exception
*/
public function setCallback($callback)
{
if (!is_string($callback) && !is_array($callback)) {
if (!is_callable($callback)) {
require_once 'Zend/Form/Exception.php';
throw new Zend_Form_Exception('Invalid callback provided to callback decorator');
}
if (is_array($callback)) {
if (2 !== count($callback)) {
require_once 'Zend/Form/Exception.php';
throw new Zend_Form_Exception('Invalid method callback provided to callback decorator');
}
}
$this->_callback = $callback;
return $this;
}

View File

@ -54,6 +54,11 @@ class Zend_Form_Decorator_Captcha_Word extends Zend_Form_Decorator_Abstract
$hiddenName = $name . '[id]';
$textName = $name . '[input]';
$label = $element->getDecorator("Label");
if($label) {
$label->setOption("id", "$name-input");
}
$placement = $this->getPlacement();
$separator = $this->getSeparator();

View File

@ -25,15 +25,15 @@ require_once 'Zend/Form/Decorator/Abstract.php';
/**
* Zend_Form_Decorator_DtDdWrapper
*
* Creates an empty <dt> item, and wraps the content in a <dd>. Used as a
* Creates an empty <dt> item, and wraps the content in a <dd>. Used as a
* default decorator for subforms and display groups.
*
*
* @category Zend
* @package Zend_Form
* @subpackage 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: DtDdWrapper.php 9309 2008-04-25 16:06:59Z matthew $
* @version $Id: DtDdWrapper.php 13615 2009-01-13 19:52:10Z norm2782 $
*/
class Zend_Form_Decorator_DtDdWrapper extends Zend_Form_Decorator_Abstract
{
@ -44,17 +44,20 @@ class Zend_Form_Decorator_DtDdWrapper extends Zend_Form_Decorator_Abstract
protected $_placement = null;
/**
* Render
* Render
*
* Renders as the following:
* <dt></dt>
* <dd>$content</dd>
*
* @param string $content
*
* @param string $content
* @return string
*/
public function render($content)
{
return '<dt>&nbsp;</dt><dd>' . $content . '</dd>';
$elementName = $this->getElement()->getName();
return '<dt id="' . $elementName . '-label">&nbsp;</dt>' .
'<dd id="' . $elementName . '-element">' . $content . '</dd>';
}
}

View File

@ -22,11 +22,17 @@
/** Zend_Form_Decorator_Abstract */
require_once 'Zend/Form/Decorator/Abstract.php';
/** Zend_Form_Decorator_Marker_File_Interface */
require_once 'Zend/Form/Decorator/Marker/File/Interface.php';
/** Zend_File_Transfer_Adapter_Http */
require_once 'Zend/File/Transfer/Adapter/Http.php';
/**
* Zend_Form_Decorator_File
*
* Fixes the rendering for all subform and multi file elements
*
*
* @category Zend
* @package Zend_Form
* @subpackage Decorator
@ -34,7 +40,9 @@ require_once 'Zend/Form/Decorator/Abstract.php';
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: $
*/
class Zend_Form_Decorator_File extends Zend_Form_Decorator_Abstract
class Zend_Form_Decorator_File
extends Zend_Form_Decorator_Abstract
implements Zend_Form_Decorator_Marker_File_Interface
{
/**
* Attributes that should not be passed to helper
@ -50,7 +58,7 @@ class Zend_Form_Decorator_File extends Zend_Form_Decorator_Abstract
/**
* Get attributes to pass to file helper
*
*
* @return array
*/
public function getAttribs()
@ -72,8 +80,8 @@ class Zend_Form_Decorator_File extends Zend_Form_Decorator_Abstract
/**
* Render a form file
*
* @param string $content
*
* @param string $content
* @return string
*/
public function render($content)
@ -103,6 +111,12 @@ class Zend_Form_Decorator_File extends Zend_Form_Decorator_Abstract
$markup[] = $view->formHidden('MAX_FILE_SIZE', $size);
}
if (Zend_File_Transfer_Adapter_Http::isApcAvailable()) {
$markup[] = $view->formHidden('APC_UPLOAD_PROGRESS', uniqid(), array('id' => 'progress_key'));
} else if (Zend_File_Transfer_Adapter_Http::isUploadProgressAvailable()) {
$markup[] = $view->formHidden('UPLOAD_IDENTIFIER', uniqid(), array('id' => 'progress_key'));
}
if ($element->isArray()) {
$name .= "[]";
$count = $element->getMultiFile();

View File

@ -31,13 +31,13 @@ require_once 'Zend/Form/Decorator/Abstract.php';
* - separator: Separator to use between elements
*
* Any other options passed will be used as HTML attributes of the form tag.
*
*
* @category Zend
* @package Zend_Form
* @subpackage 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: FormElements.php 12347 2008-11-06 21:45:56Z matthew $
* @version $Id: FormElements.php 13988 2009-02-05 20:55:38Z thomas $
*/
class Zend_Form_Decorator_FormElements extends Zend_Form_Decorator_Abstract
{
@ -64,7 +64,7 @@ class Zend_Form_Decorator_FormElements extends Zend_Form_Decorator_Abstract
/**
* Render form elements
*
* @param string $content
* @param string $content
* @return string
*/
public function render($content)
@ -97,7 +97,21 @@ class Zend_Form_Decorator_FormElements extends Zend_Form_Decorator_Abstract
$element->setBelongsTo($belongsTo);
}
}
$items[] = $item->render();
if (($item instanceof Zend_Form_Element_File)
|| (($item instanceof Zend_Form)
&& (Zend_Form::ENCTYPE_MULTIPART == $item->getEnctype()))
|| (($item instanceof Zend_Form_DisplayGroup)
&& (Zend_Form::ENCTYPE_MULTIPART == $item->getAttrib('enctype')))
) {
if ($form instanceof Zend_Form) {
$form->setEnctype(Zend_Form::ENCTYPE_MULTIPART);
} elseif ($form instanceof Zend_Form_DisplayGroup) {
$form->setAttrib('enctype', Zend_Form::ENCTYPE_MULTIPART);
}
}
}
$elementContent = implode($separator, $items);

View File

@ -35,13 +35,13 @@ require_once 'Zend/Form/Decorator/Abstract.php';
* - req(uired)Suffix: a suffix to the label to use when the element is required
*
* Any other options passed will be used as HTML attributes of the label tag.
*
*
* @category Zend
* @package Zend_Form
* @subpackage 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: Label.php 12383 2008-11-07 19:38:55Z matthew $
* @version $Id: Label.php 13615 2009-01-13 19:52:10Z norm2782 $
*/
class Zend_Form_Decorator_Label extends Zend_Form_Decorator_Abstract
{
@ -59,8 +59,8 @@ class Zend_Form_Decorator_Label extends Zend_Form_Decorator_Abstract
/**
* Set element ID
*
* @param string $id
*
* @param string $id
* @return Zend_Form_Decorator_Label
*/
public function setId($id)
@ -72,9 +72,9 @@ class Zend_Form_Decorator_Label extends Zend_Form_Decorator_Abstract
/**
* Retrieve element ID (used in 'for' attribute)
*
* If none set in decorator, looks first for element 'id' attribute, and
* If none set in decorator, looks first for element 'id' attribute, and
* defaults to element name.
*
*
* @return string
*/
public function getId()
@ -92,8 +92,8 @@ class Zend_Form_Decorator_Label extends Zend_Form_Decorator_Abstract
/**
* Set HTML tag with which to surround label
*
* @param string $tag
*
* @param string $tag
* @return Zend_Form_Decorator_Label
*/
public function setTag($tag)
@ -108,7 +108,7 @@ class Zend_Form_Decorator_Label extends Zend_Form_Decorator_Abstract
/**
* Get HTML tag, if any, with which to surround label
*
*
* @return void
*/
public function getTag()
@ -128,9 +128,9 @@ class Zend_Form_Decorator_Label extends Zend_Form_Decorator_Abstract
/**
* Get class with which to define label
*
* Appends either 'optional' or 'required' to class, depending on whether
* Appends either 'optional' or 'required' to class, depending on whether
* or not the element is required.
*
*
* @return string
*/
public function getClass()
@ -155,8 +155,8 @@ class Zend_Form_Decorator_Label extends Zend_Form_Decorator_Abstract
/**
* Load an optional/required suffix/prefix key
*
* @param string $key
*
* @param string $key
* @return void
*/
protected function _loadOptReqKey($key)
@ -183,9 +183,9 @@ class Zend_Form_Decorator_Label extends Zend_Form_Decorator_Abstract
* - setOpt(ional)Suffix()
* - setReq(uired)Prefix()
* - setReq(uired)Suffix()
*
* @param string $method
* @param array $args
*
* @param string $method
* @param array $args
* @return mixed
* @throws Zend_Form_Exception for unsupported methods
*/
@ -238,7 +238,7 @@ class Zend_Form_Decorator_Label extends Zend_Form_Decorator_Abstract
/**
* Get label to render
*
*
* @return void
*/
public function getLabel()
@ -278,8 +278,8 @@ class Zend_Form_Decorator_Label extends Zend_Form_Decorator_Abstract
/**
* Render a label
*
* @param string $content
*
* @param string $content
* @return string
*/
public function render($content)
@ -305,7 +305,7 @@ class Zend_Form_Decorator_Label extends Zend_Form_Decorator_Abstract
if (!empty($label)) {
$options['class'] = $class;
$label = $view->formLabel($element->getFullyQualifiedName(), trim($label), $options);
$label = $view->formLabel($element->getFullyQualifiedName(), trim($label), $options);
} else {
$label = '&nbsp;';
}
@ -313,7 +313,9 @@ class Zend_Form_Decorator_Label extends Zend_Form_Decorator_Abstract
if (null !== $tag) {
require_once 'Zend/Form/Decorator/HtmlTag.php';
$decorator = new Zend_Form_Decorator_HtmlTag();
$decorator->setOptions(array('tag' => $tag));
$decorator->setOptions(array('tag' => $tag,
'id' => $this->getElement()->getName() . '-label'));
$label = $decorator->render($label);
}

View File

@ -0,0 +1,33 @@
<?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_Form
* @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_Form_Decorator_Marker_File_Interface
*
* @category Zend
* @package Zend_Form
* @subpackage 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: Interface.php 8064 2008-02-16 10:58:39Z thomas $
*/
interface Zend_Form_Decorator_Marker_File_Interface
{
}

View File

@ -0,0 +1,58 @@
<?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_Form
* @subpackage 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
*/
/** Zend_Form_Decorator_Abstract */
require_once 'Zend/Form/Decorator/Abstract.php';
/**
* Zend_Form_Decorator_Tooltip
*
* Will translate the title attribute, if available
*
* @category Zend
* @package Zend_Form
* @subpackage Decorator
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Tooltip.php$
*/
class Zend_Form_Decorator_Tooltip extends Zend_Form_Decorator_Abstract
{
/**
* Translates the title attribute if it is available, if the translator is available
* and if the translator is not disable on the element being rendered.
*
* @param string $content
* @return string
*/
public function render($content)
{
if (null !== ($title = $this->getElement()->getAttrib('title'))) {
if (null !== ($translator = $this->getElement()->getTranslator())) {
$title = $translator->translate($title);
}
}
$this->getElement()->setAttrib('title', $title);
return $content;
}
}

View File

@ -39,7 +39,7 @@ require_once 'Zend/Form/Decorator/Abstract.php';
* @subpackage 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: ViewHelper.php 12374 2008-11-07 17:49:43Z matthew $
* @version $Id: ViewHelper.php 15671 2009-05-21 22:48:04Z matthew $
*/
class Zend_Form_Decorator_ViewHelper extends Zend_Form_Decorator_Abstract
{
@ -238,6 +238,11 @@ class Zend_Form_Decorator_ViewHelper extends Zend_Form_Decorator_Abstract
$id = $element->getId();
$attribs['id'] = $id;
$helperObject = $view->getHelper($helper);
if (method_exists($helperObject, 'setTranslator')) {
$helperObject->setTranslator($element->getTranslator());
}
$elementContent = $view->$helper($name, $value, $attribs, $element->options);
switch ($this->getPlacement()) {
case self::APPEND: