Subversion Repositories Applications.papyrus

Compare Revisions

Ignore whitespace Rev 320 → Rev 443

/trunk/api/pear/HTML/QuickForm/Renderer/Array.php
19,7 → 19,7
// | Thomas Schulz <ths@4bconsult.de> |
// +----------------------------------------------------------------------+
//
// $Id: Array.php,v 1.1 2005-03-30 08:50:33 jpm Exp $
// $Id: Array.php,v 1.2 2005-09-20 17:01:22 ddelon Exp $
 
require_once 'HTML/QuickForm/Renderer.php';
 
/trunk/api/pear/HTML/QuickForm/Renderer/ArraySmarty.php
18,7 → 18,7
// | Thomas Schulz <ths@4bconsult.de> |
// +----------------------------------------------------------------------+
//
// $Id: ArraySmarty.php,v 1.1 2005-03-30 08:50:33 jpm Exp $
// $Id: ArraySmarty.php,v 1.2 2005-09-20 17:01:22 ddelon Exp $
 
require_once 'HTML/QuickForm/Renderer/Array.php';
 
171,10 → 171,10
// we don't need the elements, see the array structure
unset($ret['elements']);
}
if (!empty($this->_required)){
if (($required || $error) && !empty($this->_required)){
$this->_renderRequired($ret['label'], $ret['html'], $required, $error);
}
if (!empty($this->_error)) {
if ($error && !empty($this->_error)) {
$this->_renderError($ret['label'], $ret['html'], $error);
$ret['error'] = $error;
}
/trunk/api/pear/HTML/QuickForm/Renderer/ObjectFlexy.php
16,12 → 16,13
// | Author: Ron McClain <ron@humaniq.com> |
// +----------------------------------------------------------------------+
//
// $Id: ObjectFlexy.php,v 1.1 2005-03-30 08:50:33 jpm Exp $
// $Id: ObjectFlexy.php,v 1.2 2005-09-20 17:01:22 ddelon Exp $
 
require_once("HTML/QuickForm/Renderer/Object.php");
 
/**
* @abstract Long Description
* QuickForm renderer for Flexy template engine, static version.
*
* A static renderer for HTML_Quickform. Makes a QuickFormFlexyObject
* from the form content suitable for use with a Flexy template
*
36,13 → 37,13
* $view->form = $renderer->toObject();
* $template->compile("mytemplate.html");
*
* @see QuickFormFlexyObject
*
* Based on the code for HTML_QuickForm_Renderer_ArraySmarty
*
* @public
* @see QuickFormFlexyObject
* @access public
*/
class HTML_QuickForm_Renderer_ObjectFlexy extends HTML_QuickForm_Renderer_Object {
class HTML_QuickForm_Renderer_ObjectFlexy extends HTML_QuickForm_Renderer_Object
{
/**
* HTML_Template_Flexy instance
* @var object $_flexy
59,7 → 60,7
* The current element index inside a group
* @var integer $_groupElementIdx
*/
var $_groupElementIdx = 0;
var $_groupElementIdx = 0;
 
/**
* Name of template file for form html
115,14 → 116,14
* Creates an object representing an element containing
* the key for storing this
*
* @private
* @access private
* @param element object An HTML_QuickForm_element object
* @param required bool Whether an element is required
* @param error string Error associated with the element
* @return object
*/
function _elementToObject(&$element, $required, $error)
{
function _elementToObject(&$element, $required, $error)
{
$ret = parent::_elementToObject($element, $required, $error);
if($ret->type == 'group') {
$ret->html = $element->toHtml();
174,7 → 175,7
* Stores an object representation of an element in the
* QuickformFormObject instance
*
* @private
* @access private
* @param elObj object Object representation of an element
* @return void
*/
202,7 → 203,7
* {end:}
* {html:h}
*
* @public
* @access public
* @param template string Filename of template
* @return void
*/
222,7 → 223,7
* {end:}
* {label:h}
*
* @public
* @access public
* @param template string Filename of template
* @return void
*/
242,172 → 243,19
$this->_flexy->compile($this->_html);
$ret->html = $this->_flexy->bufferedOutputObject($ret);
}
 
} // end class HTML_QuickForm_Renderer_ObjectFlexy
 
/**
* @abstract Long Description
* This class represents the object passed to outputObject()
*
* Eg.
* {form.outputJavaScript():h}
* {form.outputHeader():h}
* <table>
* <tr>
* <td>{form.name.label:h}</td><td>{form.name.html:h}</td>
* </tr>
* </table>
* </form>
*
* @public
* Adds nothing to QuickformForm, left for backwards compatibility
*/
class QuickformFlexyForm {
/**
* Whether the form has been frozen
* @var boolean $frozen
*/
var $frozen;
/**
* Javascript for client-side validation
* @var string $javascript
*/
var $javascript;
class QuickformFlexyForm extends QuickformForm
{
}
 
/**
* Attributes for form tag
* @var string $attributes
*/
var $attributes;
 
/**
* Note about required elements
* @var string $requirednote
*/
var $requirednote;
 
/**
* Collected html of all hidden variables
* @var string $hidden
*/
var $hidden;
 
/**
* Set if there were validation errors.
* StdClass object with element names for keys and their
* error messages as values
* @var object $errors
*/
var $errors;
 
/**
* Array of QuickformElementObject elements. If there are headers in the form
* this will be empty and the elements will be in the
* separate sections
* @var array $elements
*/
var $elements;
 
/**
* Array of sections contained in the document
* @var array $sections
*/
var $sections;
 
/**
* Output &lt;form&gt; header
* {form.outputHeader():h}
* @return string &lt;form attributes&gt;
*/
function outputHeader()
{
$hdr = "<form " . $this->attributes . ">\n";
return $hdr;
}
 
/**
* Output form javascript
* {form.outputJavaScript():h}
* @return string Javascript
*/
function outputJavaScript()
{
return $this->javascript;
}
} // end class QuickformFlexyForm
 
/**
* Convenience class describing a form element.
* The properties defined here will be available from
* your flexy templates by referencing
* {form.zip.label:h}, {form.zip.html:h}, etc.
* Adds nothing to QuickformElement, left for backwards compatibility
*/
class QuickformFlexyElement {
/**
* Element name
* @var string $name
*/
var $name;
 
/**
* Element value
* @var mixed $value
*/
var $value;
 
/**
* Type of element
* @var string $type
*/
var $type;
 
/**
* Whether the element is frozen
* @var boolean $frozen
*/
var $frozen;
 
/**
* Label for the element
* @var string $label
*/
var $label;
 
/**
* Whether element is required
* @var boolean $required
*/
var $required;
 
/**
* Error associated with the element
* @var string $error
*/
var $error;
 
/**
* Some information about element style
* @var string $style
*/
var $style;
 
/**
* HTML for the element
* @var string $html
*/
var $html;
 
/**
* If element is a group, the group separator
* @var mixed $separator
*/
var $separator;
 
/**
* If element is a group, an array of subelements
* @var array $elements
*/
var $elements;
} // end class QuickformFlexyElement
?>
class QuickformFlexyElement extends QuickformElement
{
}
?>
/trunk/api/pear/HTML/QuickForm/Renderer/ITDynamic.php
16,7 → 16,7
// | Author: Alexey Borzov <borz_off@cs.msu.su> |
// +----------------------------------------------------------------------+
//
// $Id: ITDynamic.php,v 1.1 2005-03-30 08:50:33 jpm Exp $
// $Id: ITDynamic.php,v 1.2 2005-09-20 17:01:22 ddelon Exp $
 
require_once 'HTML/QuickForm/Renderer.php';
 
/trunk/api/pear/HTML/QuickForm/Renderer/QuickHtml.php
16,7 → 16,7
// | Authors: Jason Rust <jrust@rustyparts.com> |
// +----------------------------------------------------------------------+
//
// $Id: QuickHtml.php,v 1.1 2005-03-30 08:50:33 jpm Exp $
// $Id: QuickHtml.php,v 1.2 2005-09-20 17:01:22 ddelon Exp $
 
require_once('HTML/QuickForm/Renderer/Default.php');
 
/trunk/api/pear/HTML/QuickForm/Renderer/Default.php
18,7 → 18,7
// | Bertrand Mansion <bmansion@mamasam.com> |
// +----------------------------------------------------------------------+
//
// $Id: Default.php,v 1.1 2005-03-30 08:50:33 jpm Exp $
// $Id: Default.php,v 1.2 2005-09-20 17:01:22 ddelon Exp $
 
require_once('HTML/QuickForm/Renderer.php');
 
154,7 → 154,9
*/
function toHtml()
{
return $this->_html;
// _hiddenHtml is cleared in finishForm(), so this only matters when
// finishForm() was not called (e.g. group::toHtml(), bug #3511)
return $this->_hiddenHtml . $this->_html;
} // end func toHtml
/**
191,6 → 193,7
} else {
$this->_html .= $this->_hiddenHtml;
}
$this->_hiddenHtml = '';
$this->_html = str_replace('{content}', $this->_html, $html);
// add a validation script
if ('' != ($script = $form->getValidationScript())) {
/trunk/api/pear/HTML/QuickForm/Renderer/ITStatic.php
16,7 → 16,7
// | Author: Bertrand Mansion <bmansion@mamasam.com> |
// +----------------------------------------------------------------------+
//
// $Id: ITStatic.php,v 1.1 2005-03-30 08:50:33 jpm Exp $
// $Id: ITStatic.php,v 1.2 2005-09-20 17:01:22 ddelon Exp $
 
require_once('HTML/QuickForm/Renderer.php');
 
/trunk/api/pear/HTML/QuickForm/Renderer/Object.php
16,7 → 16,7
// | Author: Ron McClain <ron@humaniq.com> |
// +----------------------------------------------------------------------+
//
// $Id: Object.php,v 1.1 2005-03-30 08:50:33 jpm Exp $
// $Id: Object.php,v 1.2 2005-09-20 17:01:22 ddelon Exp $
 
require_once('HTML/QuickForm/Renderer.php');
 
25,9 → 25,10
*
* Based on HTML_Quickform_Renderer_Array code
*
* @public
* @access public
*/
class HTML_QuickForm_Renderer_Object extends HTML_QuickForm_Renderer {
class HTML_QuickForm_Renderer_Object extends HTML_QuickForm_Renderer
{
/**
* The object being generated
* @var object $_obj
75,7 → 76,7
* Constructor
*
* @param collecthidden bool true: collect all hidden elements
* @public
* @access public
*/
function HTML_QuickForm_Renderer_Object($collecthidden = false)
{
86,7 → 87,7
 
/**
* Return the rendered Object
* @public
* @access public
*/
function toObject()
{
94,11 → 95,12
}
 
/**
* Set the class of the form elements. Defaults to StdClass.
* Set the class of the form elements. Defaults to QuickformElement.
* @param type string Name of element class
* @public
* @access public
*/
function setElementType($type) {
function setElementType($type)
{
$this->_elementType = $type;
}
 
125,6 → 127,7
$this->_obj->sections[$this->_sectionCount] = $hobj;
$this->_currentSection = $this->_sectionCount++;
}
 
function renderElement(&$element, $required, $error)
{
$elObj = $this->_elementToObject($element, $required, $error);
135,7 → 138,8
$this->_storeObject($elObj);
} // end func renderElement
 
function renderHidden(&$element) {
function renderHidden(&$element)
{
if($this->_collectHidden) {
$this->_obj->hidden .= $element->toHtml() . "\n";
} else {
148,7 → 152,7
$this->_currentGroup = $this->_elementToObject($group, $required, $error);
if(!empty($error)) {
$name = $this->_currentGroup->name;
$this->_view->errors->$name = $error;
$this->_obj->errors->$name = $error;
}
} // end func startGroup
 
161,7 → 165,7
/**
* Creates an object representing an element
*
* @private
* @access private
* @param element object An HTML_QuickForm_element object
* @param required bool Whether an element is required
* @param error string Error associated with the element
205,7 → 209,7
/**
* Stores an object representation of an element in the form array
*
* @private
* @access private
* @param elObj object Object representation of an element
* @return void
*/
235,8 → 239,7
 
 
/**
* @abstract Long Description
* This class represents the object passed to outputObject()
* Convenience class for the form object passed to outputObject()
*
* Eg.
* {form.outputJavaScript():h}
247,79 → 250,80
* </tr>
* </table>
* </form>
*
* @public
*/
class QuickformForm {
/**
* Whether the form has been frozen
* @var boolean $frozen
*/
var $frozen;
/**
* Javascript for client-side validation
* @var string $javascript
*/
var $javascript;
class QuickformForm
{
/**
* Whether the form has been frozen
* @var boolean $frozen
*/
var $frozen;
 
/**
* Attributes for form tag
* @var string $attributes
*/
var $attributes;
/**
* Javascript for client-side validation
* @var string $javascript
*/
var $javascript;
 
/**
* Note about required elements
* @var string $requirednote
*/
var $requirednote;
/**
* Attributes for form tag
* @var string $attributes
*/
var $attributes;
 
/**
* Collected html of all hidden variables
* @var string $hidden
*/
var $hidden;
/**
* Note about required elements
* @var string $requirednote
*/
var $requirednote;
 
/**
* Set if there were validation errors.
* StdClass object with element names for keys and their
* error messages as values
* @var object $errors
*/
var $errors;
/**
* Collected html of all hidden variables
* @var string $hidden
*/
var $hidden;
 
/**
* Array of QuickformElementObject elements. If there are headers in the form
* this will be empty and the elements will be in the
* separate sections
* @var array $elements
*/
var $elements;
/**
* Set if there were validation errors.
* StdClass object with element names for keys and their
* error messages as values
* @var object $errors
*/
var $errors;
 
/**
* Array of sections contained in the document
* @var array $sections
*/
var $sections;
/**
* Array of QuickformElementObject elements. If there are headers in the form
* this will be empty and the elements will be in the
* separate sections
* @var array $elements
*/
var $elements;
 
/**
* Output &lt;form&gt; header
* {form.outputHeader():h}
* @return string &lt;form attributes&gt;
*/
function outputHeader() {
$hdr = "<form " . $this->attributes . ">\n";
return $hdr;
}
/**
* Output form javascript
* {form.outputJavaScript():h}
* @return string Javascript
*/
function outputJavaScript() {
/**
* Array of sections contained in the document
* @var array $sections
*/
var $sections;
 
/**
* Output &lt;form&gt; header
* {form.outputHeader():h}
* @return string &lt;form attributes&gt;
*/
function outputHeader()
{
return "<form " . $this->attributes . ">\n";
}
 
/**
* Output form javascript
* {form.outputJavaScript():h}
* @return string Javascript
*/
function outputJavaScript()
{
return $this->javascript;
}
}
} // end class QuickformForm
 
 
329,8 → 333,8
* your flexy templates by referencing
* {form.zip.label:h}, {form.zip.html:h}, etc.
*/
class QuickformElement {
class QuickformElement
{
/**
* Element name
* @var string $name
399,40 → 403,30
 
function isType($type)
{
if($this->type == $type) {
return true;
} else {
return false;
}
return ($this->type == $type);
}
 
function notFrozen()
{
if(!$this->frozen) {
return true;
} else {
return false;
}
return !$this->frozen;
}
 
function isButton()
{
if($this->type == "submit" || $this->type == "reset") {
return true;
} else {
return false;
}
return ($this->type == "submit" || $this->type == "reset");
}
 
 
/**
* XXX: why does it use Flexy when all other stuff here does not depend on it?
*/
function outputStyle()
{
$filename = "styles/".$this->style.".html";
ob_start();
HTML_Template_Flexy::staticQuickTemplate($filename, $this);
HTML_Template_Flexy::staticQuickTemplate('styles/' . $this->style . '.html', $this);
$ret = ob_get_contents();
ob_end_clean();
return $ret;
}
 
} // end class QuickformElement
?>
?>