Subversion Repositories Applications.papyrus

Compare Revisions

Ignore whitespace Rev 442 → Rev 443

/trunk/api/pear/HTML/QuickForm/advcheckbox.php
17,7 → 17,7
// | Bertrand Mansion <bmansion@mamasam.com> |
// +----------------------------------------------------------------------+
//
// $Id: advcheckbox.php,v 1.1 2005-03-30 08:50:33 jpm Exp $
// $Id: advcheckbox.php,v 1.2 2005-09-20 17:01:22 ddelon Exp $
 
require_once('HTML/QuickForm/checkbox.php');
 
197,8 → 197,12
'name' => $this->getPrivateName($oldName),
'onclick' => $this->getOnclickJs($oldName) . ' ' . $oldJs
));
$html = parent::toHtml() . '<input type="hidden" name="' . $oldName .
'" value="' . $this->getValue() . '" />';
$html = parent::toHtml() . '<input' .
$this->_getAttrString(array(
'type' => 'hidden',
'name' => $oldName,
'value' => $this->getValue()
)) . ' />';
// revert the name and JS, in case this method will be called once more
$this->updateAttributes(array(
'name' => $oldName,
/trunk/api/pear/HTML/QuickForm/Rule/Compare.php
16,7 → 16,7
// | Author: Alexey Borzov <avb@php.net> |
// +----------------------------------------------------------------------+
//
// $Id: Compare.php,v 1.1 2005-03-30 08:50:33 jpm Exp $
// $Id: Compare.php,v 1.2 2005-09-20 17:01:22 ddelon Exp $
 
require_once 'HTML/QuickForm/Rule.php';
 
28,7 → 28,7
*
* @access public
* @package HTML_QuickForm
* @version $Revision: 1.1 $
* @version $Revision: 1.2 $
*/
class HTML_QuickForm_Rule_Compare extends HTML_QuickForm_Rule
{
/trunk/api/pear/HTML/QuickForm/Rule/Email.php
16,7 → 16,7
// | Authors: Bertrand Mansion <bmansion@mamasam.com> |
// +----------------------------------------------------------------------+
//
// $Id: Email.php,v 1.1 2005-03-30 08:50:33 jpm Exp $
// $Id: Email.php,v 1.2 2005-09-20 17:01:22 ddelon Exp $
 
require_once('HTML/QuickForm/Rule.php');
 
/trunk/api/pear/HTML/QuickForm/Rule/Regex.php
16,7 → 16,7
// | Authors: Bertrand Mansion <bmansion@mamasam.com> |
// +----------------------------------------------------------------------+
//
// $Id: Regex.php,v 1.1 2005-03-30 08:50:33 jpm Exp $
// $Id: Regex.php,v 1.2 2005-09-20 17:01:22 ddelon Exp $
 
require_once('HTML/QuickForm/Rule.php');
 
/trunk/api/pear/HTML/QuickForm/Rule/Callback.php
16,7 → 16,7
// | Authors: Bertrand Mansion <bmansion@mamasam.com> |
// +----------------------------------------------------------------------+
//
// $Id: Callback.php,v 1.1 2005-03-30 08:50:33 jpm Exp $
// $Id: Callback.php,v 1.2 2005-09-20 17:01:22 ddelon Exp $
 
require_once('HTML/QuickForm/Rule.php');
 
/trunk/api/pear/HTML/QuickForm/Rule/Range.php
16,7 → 16,7
// | Authors: Bertrand Mansion <bmansion@mamasam.com> |
// +----------------------------------------------------------------------+
//
// $Id: Range.php,v 1.1 2005-03-30 08:50:33 jpm Exp $
// $Id: Range.php,v 1.2 2005-09-20 17:01:22 ddelon Exp $
 
require_once('HTML/QuickForm/Rule.php');
 
/trunk/api/pear/HTML/QuickForm/Rule/Required.php
16,7 → 16,7
// | Authors: Bertrand Mansion <bmansion@mamasam.com> |
// +----------------------------------------------------------------------+
//
// $Id: Required.php,v 1.1 2005-03-30 08:50:33 jpm Exp $
// $Id: Required.php,v 1.2 2005-09-20 17:01:22 ddelon Exp $
 
require_once('HTML/QuickForm/Rule.php');
 
36,7 → 36,7
*/
function validate($value, $options = null)
{
if ($value == '') {
if ((string)$value == '') {
return false;
}
return true;
/trunk/api/pear/HTML/QuickForm/image.php
17,7 → 17,7
// | Bertrand Mansion <bmansion@mamasam.com> |
// +----------------------------------------------------------------------+
//
// $Id: image.php,v 1.1 2005-03-30 08:50:33 jpm Exp $
// $Id: image.php,v 1.2 2005-09-20 17:01:22 ddelon Exp $
require_once("HTML/QuickForm/input.php");
 
/**
/trunk/api/pear/HTML/QuickForm/reset.php
17,7 → 17,7
// | Bertrand Mansion <bmansion@mamasam.com> |
// +----------------------------------------------------------------------+
//
// $Id: reset.php,v 1.1 2005-03-30 08:50:33 jpm Exp $
// $Id: reset.php,v 1.2 2005-09-20 17:01:22 ddelon Exp $
 
require_once("HTML/QuickForm/input.php");
 
/trunk/api/pear/HTML/QuickForm/text.php
17,7 → 17,7
// | Bertrand Mansion <bmansion@mamasam.com> |
// +----------------------------------------------------------------------+
//
// $Id: text.php,v 1.1 2005-03-30 08:50:33 jpm Exp $
// $Id: text.php,v 1.2 2005-09-20 17:01:22 ddelon Exp $
 
require_once("HTML/QuickForm/input.php");
 
/trunk/api/pear/HTML/QuickForm/checkbox.php
17,7 → 17,7
// | Bertrand Mansion <bmansion@mamasam.com> |
// +----------------------------------------------------------------------+
//
// $Id: checkbox.php,v 1.1 2005-03-30 08:50:33 jpm Exp $
// $Id: checkbox.php,v 1.2 2005-09-20 17:01:22 ddelon Exp $
 
require_once("HTML/QuickForm/input.php");
 
229,7 → 229,7
if (null === $value) {
// if no boxes were checked, then there is no value in the array
// yet we don't want to display default value in this case
if (isset($caller->_submitValues) && 0 < count($caller->_submitValues)) {
if ($caller->isSubmitted()) {
$value = $this->_findValue($caller->_submitValues);
} else {
$value = $this->_findValue($caller->_defaultValues);
/trunk/api/pear/HTML/QuickForm/static.php
17,7 → 17,7
// | Bertrand Mansion <bmansion@mamasam.com> |
// +----------------------------------------------------------------------+
//
// $Id: static.php,v 1.1 2005-03-30 08:50:33 jpm Exp $
// $Id: static.php,v 1.2 2005-09-20 17:01:22 ddelon Exp $
 
require_once("HTML/QuickForm/element.php");
 
/trunk/api/pear/HTML/QuickForm/hierselect.php
15,9 → 15,10
// +----------------------------------------------------------------------+
// | Authors: Herim Vasquez <vasquezh@iro.umontreal.ca> |
// | Bertrand Mansion <bmansion@mamasam.com> |
// | Alexey Borzov <avb@php.net>
// +----------------------------------------------------------------------+
//
// $Id: hierselect.php,v 1.1 2005-03-30 08:50:33 jpm Exp $
// $Id: hierselect.php,v 1.2 2005-09-20 17:01:22 ddelon Exp $
 
require_once('HTML/QuickForm/group.php');
require_once('HTML/QuickForm/select.php');
97,11 → 98,6
* @access private
*/
var $_js = '';
/**
* The javascript array name
*/
var $_jsArrayName = '';
 
// }}}
// {{{ constructor
159,7 → 155,6
}
$this->_setOptions();
$this->_setJS();
} // end func setMainOptions
 
// }}}
213,7 → 208,6
}
$this->_setOptions();
$this->_setJS();
} // end func setSecOptions
// }}}
229,16 → 223,14
{
$toLoad = '';
foreach (array_keys($this->_elements) AS $key) {
if (eval("return isset(\$this->_options[{$key}]{$toLoad});") ) {
$array = eval("return \$this->_options[{$key}]{$toLoad};");
if (is_array($array)) {
$select =& $this->_elements[$key];
$select->_options = array();
$select->loadArray($array);
$array = eval("return isset(\$this->_options[{$key}]{$toLoad})? \$this->_options[{$key}]{$toLoad}: null;");
if (is_array($array)) {
$select =& $this->_elements[$key];
$select->_options = array();
$select->loadArray($array);
 
$value = is_array($v = $select->getValue()) ? $v[0] : key($array);
$toLoad .= '[\''.$value.'\']';
}
$value = is_array($v = $select->getValue()) ? $v[0] : key($array);
$toLoad .= '[\'' . str_replace(array('\\', '\''), array('\\\\', '\\\''), $value) . '\']';
}
}
} // end func _setOptions
279,132 → 271,177
} // end func _createElements
 
// }}}
// {{{ _setJS()
/**
* Set the JavaScript for each select element (excluding de main one).
*
* @access private
* @return void
*/
function _setJS()
{
$this->_js = $js = '';
$this->_jsArrayName = 'hs_' . $this->getName();
for ($i = 1; $i < $this->_nbElements; $i++) {
$this->_setJSArray($this->_jsArrayName, $this->_options[$i], $js);
}
} // end func _setJS
// }}}
// {{{ _setJSArray()
/**
* Recursively builds the JavaScript array defining the options that a select
* element can have.
*
* @param string $grpName Group Name attribute
* @param array $options Select element options
* @param string $js JavaScript definition is build using this variable
* @param string $optValue The value for the current JavaScript option
*
* @access private
* @return void
*/
function _setJSArray($grpName, $options, &$js, $optValue = '')
{
if (is_array($options)) {
$js = '';
// For a hierselect containing 3 elements:
// if option 1 has been selected for the 1st element
// and option 3 has been selected for the 2nd element,
// then the javascript array containing the values to load
// on the 3rd element will have the following name: grpName_1_3
$name = ($optValue === '') ? $grpName : $grpName.'_'.$optValue;
foreach($options AS $k => $v) {
$this->_setJSArray($name, $v, $js, $k);
}
// if $js !== '' add it to the JavaScript
$this->_js .= ($js !== '') ? $name." = {\n".$js."\n}\n" : '';
$js = '';
} else {
// $js empty means that we are adding the first element to the JavaScript.
if ($js != '') {
$js .= ",\n";
}
$js .= '"'.$optValue.'":"'.$options.'"';
}
}
 
// }}}
// {{{ toHtml()
 
/**
* Returns Html for the group
*
* @access public
* @return string
*/
function toHtml()
{
if ($this->_flagFrozen) {
$this->_js = '';
} else {
// set the onchange attribute for each element
$keys = array_keys($this->_elements);
$nbElements = count($keys);
$nbElementsUsingFnc = $nbElements - 1; // last element doesn't need it
for ($i = 0; $i < $nbElementsUsingFnc; $i++) {
$this->_js = '';
if (!$this->_flagFrozen) {
// set the onchange attribute for each element except last
$keys = array_keys($this->_elements);
$onChange = array();
for ($i = 0; $i < count($keys) - 1; $i++) {
$select =& $this->_elements[$keys[$i]];
$onChange[$i] = $select->getAttribute('onchange');
$select->updateAttributes(
array('onChange' => 'swapOptions(this, \''.$this->getName().'\', '.$keys[$i].', '.$nbElements.', \''.$this->_jsArrayName.'\');')
array('onchange' => '_hs_swapOptions(this.form, \'' . $this->_escapeString($this->getName()) . '\', ' . $keys[$i] . ');' . $onChange[$i])
);
}
// create the js function to call
if (!defined('HTML_QUICKFORM_HIERSELECT_EXISTS')) {
$this->_js .= "function swapOptions(frm, grpName, eleIndex, nbElements, arName)\n"
."{\n"
." var n = \"\";\n"
." var ctl;\n\n"
." for (var i = 0; i < nbElements; i++) {\n"
." ctl = frm.form[grpName+'['+i+']'];\n"
." if (!ctl) {\n"
." ctl = frm.form[grpName+'['+i+'][]'];\n"
." }\n"
." if (i <= eleIndex) {\n"
." n += \"_\"+ctl.value;\n"
." } else {\n"
." ctl.length = 0;\n"
." }\n"
." }\n\n"
." var t = eval(\"typeof(\"+arName + n +\")\");\n"
." if (t != 'undefined') {\n"
." var the_array = eval(arName+n);\n"
." var j = 0;\n"
." n = eleIndex + 1;\n"
." ctl = frm.form[grpName+'['+ n +']'];\n"
." if (!ctl) {\n"
." ctl = frm.form[grpName+'['+ n +'][]'];\n"
." }\n"
." for (var i in the_array) {\n"
." opt = new Option(the_array[i], i, false, false);\n"
." ctl.options[j++] = opt;\n"
." }\n"
." }\n"
." if (eleIndex+1 < nbElements) {\n"
." swapOptions(frm, grpName, eleIndex+1, nbElements, arName);\n"
." }\n"
."}\n";
$this->_js .= <<<JAVASCRIPT
function _hs_findOptions(ary, keys)
{
var key = keys.shift();
if (!key in ary) {
return {};
} else if (0 == keys.length) {
return ary[key];
} else {
return _hs_findOptions(ary[key], keys);
}
}
 
function _hs_findSelect(form, groupName, selectIndex)
{
if (groupName+'['+ selectIndex +']' in form) {
return form[groupName+'['+ selectIndex +']'];
} else {
return form[groupName+'['+ selectIndex +'][]'];
}
}
 
function _hs_replaceOptions(ctl, optionList)
{
var j = 0;
ctl.options.length = 0;
for (i in optionList) {
ctl.options[j++] = new Option(optionList[i], i, false, false);
}
}
 
function _hs_setValue(ctl, value)
{
var testValue = {};
if (value instanceof Array) {
for (var i = 0; i < value.length; i++) {
testValue[value[i]] = true;
}
} else {
testValue[value] = true;
}
for (var i = 0; i < ctl.options.length; i++) {
if (ctl.options[i].value in testValue) {
ctl.options[i].selected = true;
}
}
}
 
function _hs_swapOptions(form, groupName, selectIndex)
{
var hsValue = [];
for (var i = 0; i <= selectIndex; i++) {
hsValue[i] = _hs_findSelect(form, groupName, i).value;
}
 
_hs_replaceOptions(_hs_findSelect(form, groupName, selectIndex + 1),
_hs_findOptions(_hs_options[groupName][selectIndex], hsValue));
if (selectIndex + 1 < _hs_options[groupName].length) {
_hs_swapOptions(form, groupName, selectIndex + 1);
}
}
 
function _hs_onReset(form, groupNames)
{
for (var i = 0; i < groupNames.length; i++) {
try {
for (var j = 0; j <= _hs_options[groupNames[i]].length; j++) {
_hs_setValue(_hs_findSelect(form, groupNames[i], j), _hs_defaults[groupNames[i]][j]);
if (j < _hs_options[groupNames[i]].length) {
_hs_replaceOptions(_hs_findSelect(form, groupNames[i], j + 1),
_hs_findOptions(_hs_options[groupNames[i]][j], _hs_defaults[groupNames[i]].slice(0, j + 1)));
}
}
} catch (e) {
if (!(e instanceof TypeError)) {
throw e;
}
}
}
}
 
function _hs_setupOnReset(form, groupNames)
{
setTimeout(function() { _hs_onReset(form, groupNames); }, 25);
}
 
function _hs_onReload()
{
var ctl;
for (var i = 0; i < document.forms.length; i++) {
for (var j in _hs_defaults) {
if (ctl = _hs_findSelect(document.forms[i], j, 0)) {
for (var k = 0; k < _hs_defaults[j].length; k++) {
_hs_setValue(_hs_findSelect(document.forms[i], j, k), _hs_defaults[j][k]);
}
}
}
}
 
if (_hs_prevOnload) {
_hs_prevOnload();
}
}
 
var _hs_prevOnload = null;
if (window.onload) {
_hs_prevOnload = window.onload;
}
window.onload = _hs_onReload;
 
var _hs_options = {};
var _hs_defaults = {};
 
JAVASCRIPT;
define('HTML_QUICKFORM_HIERSELECT_EXISTS', true);
}
// option lists
$jsParts = array();
for ($i = 1; $i < $this->_nbElements; $i++) {
$jsParts[] = $this->_convertArrayToJavascript($this->_options[$i]);
}
$this->_js .= "\n_hs_options['" . $this->_escapeString($this->getName()) . "'] = [\n" .
implode(",\n", $jsParts) .
"\n];\n";
// default value; if we don't actually have any values yet just use
// the first option (for single selects) or empty array (for multiple)
$values = array();
foreach (array_keys($this->_elements) as $key) {
if (is_array($v = $this->_elements[$key]->getValue())) {
$values[] = count($v) > 1? $v: $v[0];
} else {
// XXX: accessing the supposedly private _options array
$values[] = $this->_elements[$key]->getMultiple() || empty($this->_elements[$key]->_options[0])?
array():
$this->_elements[$key]->_options[0]['attr']['value'];
}
}
$this->_js .= "_hs_defaults['" . $this->_escapeString($this->getName()) . "'] = " .
$this->_convertArrayToJavascript($values, false) . ";\n";
}
include_once('HTML/QuickForm/Renderer/Default.php');
$renderer =& new HTML_QuickForm_Renderer_Default();
$renderer->setElementTemplate('{element}');
parent::accept($renderer);
return "<script type=\"text/javascript\">\n//<![CDATA[\n" . $this->_js . "//]]>\n</script>" .
 
if (!empty($onChange)) {
$keys = array_keys($this->_elements);
for ($i = 0; $i < count($keys) - 1; $i++) {
$this->_elements[$keys[$i]]->updateAttributes(array('onchange' => $onChange[$i]));
}
}
return (empty($this->_js)? '': "<script type=\"text/javascript\">\n//<![CDATA[\n" . $this->_js . "//]]>\n</script>") .
$renderer->toHtml();
} // end func toHtml
 
411,15 → 448,6
// }}}
// {{{ accept()
 
/**
* Accepts a renderer
*
* @param object An HTML_QuickForm_Renderer object
* @param bool Whether a group is required
* @param string An error message associated with a group
* @access public
* @return void
*/
function accept(&$renderer, $required = false, $error = null)
{
$renderer->renderElement($this, $required, $error);
435,10 → 463,103
// matches the main option
return HTML_QuickForm_element::onQuickFormEvent($event, $arg, $caller);
} else {
return parent::onQuickFormEvent($event, $arg, $caller);
$ret = parent::onQuickFormEvent($event, $arg, $caller);
// add onreset handler to form to properly reset hierselect (see bug #2970)
if ('addElement' == $event) {
$onReset = $caller->getAttribute('onreset');
if (strlen($onReset)) {
if (strpos($onReset, '_hs_setupOnReset')) {
$caller->updateAttributes(array('onreset' => str_replace('_hs_setupOnReset(this, [', "_hs_setupOnReset(this, ['" . $this->_escapeString($this->getName()) . "', ", $onReset)));
} else {
$caller->updateAttributes(array('onreset' => "var temp = function() { {$onReset} } ; if (!temp()) { return false; } ; if (typeof _hs_setupOnReset != 'undefined') { return _hs_setupOnReset(this, ['" . $this->_escapeString($this->getName()) . "']); } "));
}
} else {
$caller->updateAttributes(array('onreset' => "if (typeof _hs_setupOnReset != 'undefined') { return _hs_setupOnReset(this, ['" . $this->_escapeString($this->getName()) . "']); } "));
}
}
return $ret;
}
} // end func onQuickFormEvent
 
// }}}
// }}}
// {{{ _convertArrayToJavascript()
 
/**
* Converts PHP array to its Javascript analog
*
* @access private
* @param array PHP array to convert
* @param bool Generate Javascript object literal (default, works like PHP's associative array) or array literal
* @return string Javascript representation of the value
*/
function _convertArrayToJavascript($array, $assoc = true)
{
if (!is_array($array)) {
return $this->_convertScalarToJavascript($array);
} else {
$items = array();
foreach ($array as $key => $val) {
$item = $assoc? "'" . $this->_escapeString($key) . "': ": '';
if (is_array($val)) {
$item .= $this->_convertArrayToJavascript($val, $assoc);
} else {
$item .= $this->_convertScalarToJavascript($val);
}
$items[] = $item;
}
}
$js = implode(', ', $items);
return $assoc? '{ ' . $js . ' }': '[' . $js . ']';
}
// }}}
// {{{ _convertScalarToJavascript()
 
/**
* Converts PHP's scalar value to its Javascript analog
*
* @access private
* @param mixed PHP value to convert
* @return string Javascript representation of the value
*/
function _convertScalarToJavascript($val)
{
if (is_bool($val)) {
return $val ? 'true' : 'false';
} elseif (is_int($val) || is_double($val)) {
return $val;
} elseif (is_string($val)) {
return "'" . $this->_escapeString($val) . "'";
} elseif (is_null($val)) {
return 'null';
} else {
// don't bother
return '{}';
}
}
 
// }}}
// {{{ _escapeString()
 
/**
* Quotes the string so that it can be used in Javascript string constants
*
* @access private
* @param string
* @return string
*/
function _escapeString($str)
{
return strtr($str,array(
"\r" => '\r',
"\n" => '\n',
"\t" => '\t',
"'" => "\\'",
'"' => '\"',
'\\' => '\\\\'
));
}
 
// }}}
} // end class HTML_QuickForm_hierselect
?>
/trunk/api/pear/HTML/QuickForm/header.php
16,7 → 16,7
// | Author: Alexey Borzov <borz_off@cs.msu.su> |
// +----------------------------------------------------------------------+
//
// $Id: header.php,v 1.1 2005-03-30 08:50:33 jpm Exp $
// $Id: header.php,v 1.2 2005-09-20 17:01:22 ddelon Exp $
 
require_once 'HTML/QuickForm/static.php';
 
/trunk/api/pear/HTML/QuickForm/element.php
17,7 → 17,7
// | Bertrand Mansion <bmansion@mamasam.com> |
// +----------------------------------------------------------------------+
//
// $Id: element.php,v 1.1 2005-03-30 08:50:33 jpm Exp $
// $Id: element.php,v 1.2 2005-09-20 17:01:22 ddelon Exp $
 
require_once('HTML/Common.php');
 
245,10 → 245,11
return '';
} else {
$id = $this->getAttribute('id');
return '<input type="hidden"' .
(isset($id)? ' id="' . $id . '"': '') .
' name="' . $this->getName() . '"' .
' value="' . htmlspecialchars($this->getValue()) . '" />';
return '<input' . $this->_getAttrString(array(
'type' => 'hidden',
'name' => $this->getName(),
'value' => $this->getValue()
) + (isset($id)? array('id' => $id): array())) . ' />';
}
}
 
/trunk/api/pear/HTML/QuickForm/hidden.php
17,7 → 17,7
// | Bertrand Mansion <bmansion@mamasam.com> |
// +----------------------------------------------------------------------+
//
// $Id: hidden.php,v 1.1 2005-03-30 08:50:33 jpm Exp $
// $Id: hidden.php,v 1.2 2005-09-20 17:01:22 ddelon Exp $
 
require_once("HTML/QuickForm/input.php");
 
/trunk/api/pear/HTML/QuickForm/hiddenselect.php
17,7 → 17,7
// | Bertrand Mansion <bmansion@mamasam.com> |
// +----------------------------------------------------------------------+
//
// $Id: hiddenselect.php,v 1.1 2005-03-30 08:50:33 jpm Exp $
// $Id: hiddenselect.php,v 1.2 2005-09-20 17:01:22 ddelon Exp $
 
require_once('HTML/QuickForm/select.php');
 
79,7 → 79,11
foreach ($this->_values as $key => $val) {
for ($i = 0, $optCount = count($this->_options); $i < $optCount; $i++) {
if ($val == $this->_options[$i]['attr']['value']) {
$strHtml .= $tabs . '<input type="hidden" name="' . $name . '" value="' . $val . '" />' . "\n";
$strHtml .= $tabs . '<input' . $this->_getAttrString(array(
'type' => 'hidden',
'name' => $name,
'value' => $val
)) . " />\n" ;
}
}
}
/trunk/api/pear/HTML/QuickForm/group.php
17,7 → 17,7
// | Bertrand Mansion <bmansion@mamasam.com> |
// +----------------------------------------------------------------------+
//
// $Id: group.php,v 1.1 2005-03-30 08:50:33 jpm Exp $
// $Id: group.php,v 1.2 2005-09-20 17:01:22 ddelon Exp $
 
require_once("HTML/QuickForm/element.php");
 
151,9 → 151,7
*/
function setValue($value)
{
if (empty($this->_elements)) {
$this->_createElements();
}
$this->_createElementsIfNotExist();
foreach (array_keys($this->_elements) as $key) {
if (!$this->_appendName) {
$v = $this->_elements[$key]->_findValue($value);
163,7 → 161,7
 
} else {
$elementName = $this->_elements[$key]->getName();
$index = (!empty($elementName)) ? $elementName : $key;
$index = strlen($elementName) ? $elementName : $key;
if (is_array($value)) {
if (isset($value[$index])) {
$this->_elements[$key]->onQuickFormEvent('setGroupValue', $value[$index], $this);
208,7 → 206,7
if (!is_array($value)) {
$value = is_null($value)? array(): array($value);
}
if ('' == $elementName) {
if ('' === $elementName) {
$value[] = $v;
} else {
$value[$elementName] = $v;
250,6 → 248,7
*/
function &getElements()
{
$this->_createElementsIfNotExist();
return $this->_elements;
} // end func getElements
 
266,9 → 265,7
*/
function getGroupType()
{
if (empty($this->_elements)) {
$this->_createElements();
}
$this->_createElementsIfNotExist();
$prevType = '';
foreach (array_keys($this->_elements) as $key) {
$type = $this->_elements[$key]->getType();
312,9 → 309,7
*/
function getElementName($index)
{
if (empty($this->_elements)) {
$this->_createElements();
}
$this->_createElementsIfNotExist();
$elementName = false;
if (is_int($index) && isset($this->_elements[$index])) {
$elementName = $this->_elements[$index]->getName();
358,9 → 353,7
function getFrozenHtml()
{
$flags = array();
if (empty($this->_elements)) {
$this->_createElements();
}
$this->_createElementsIfNotExist();
foreach (array_keys($this->_elements) as $key) {
if (false === ($flags[$key] = $this->_elements[$key]->isFrozen())) {
$this->_elements[$key]->freeze();
392,15 → 385,13
{
switch ($event) {
case 'updateValue':
if (empty($this->_elements)) {
$this->_createElements();
}
$this->_createElementsIfNotExist();
foreach (array_keys($this->_elements) as $key) {
if ($this->_appendName) {
$elementName = $this->_elements[$key]->getName();
if (is_null($elementName)) {
$this->_elements[$key]->setName($this->getName());
} elseif ('' == $elementName) {
} elseif ('' === $elementName) {
$this->_elements[$key]->setName($this->getName() . '[' . $key . ']');
} else {
$this->_elements[$key]->setName($this->getName() . '[' . $elementName . ']');
433,9 → 424,7
*/
function accept(&$renderer, $required = false, $error = null)
{
if (empty($this->_elements)) {
$this->_createElements();
}
$this->_createElementsIfNotExist();
$renderer->startGroup($this, $required, $error);
$name = $this->getName();
foreach (array_keys($this->_elements) as $key) {
477,7 → 466,7
if ($this->_appendName) {
if (is_null($elementName)) {
$this->_elements[$key]->setName($this->getName());
} elseif ('' == $elementName) {
} elseif ('' === $elementName) {
$this->_elements[$key]->setName($this->getName() . '[' . $key . ']');
} else {
$this->_elements[$key]->setName($this->getName() . '[' . $elementName . ']');
499,7 → 488,7
// just like getValue(), but should work OK every time here
if (is_null($elementName)) {
$value = $v;
} elseif ('' == $elementName) {
} elseif ('' === $elementName) {
$value[] = $v;
} else {
$value[$elementName] = $v;
531,6 → 520,28
}
 
// }}}
// {{{ _createElementsIfNotExist()
 
/**
* A wrapper around _createElements()
*
* This method calls _createElements() if the group's _elements array
* is empty. It also performs some updates, e.g. freezes the created
* elements if the group is already frozen.
*
* @access private
*/
function _createElementsIfNotExist()
{
if (empty($this->_elements)) {
$this->_createElements();
if ($this->_flagFrozen) {
$this->freeze();
}
}
}
 
// }}}
// {{{ freeze()
 
function freeze()
/trunk/api/pear/HTML/QuickForm/radio.php
17,7 → 17,7
// | Bertrand Mansion <bmansion@mamasam.com> |
// +----------------------------------------------------------------------+
//
// $Id: radio.php,v 1.1 2005-03-30 08:50:33 jpm Exp $
// $Id: radio.php,v 1.2 2005-09-20 17:01:22 ddelon Exp $
 
require_once('HTML/QuickForm/input.php');
 
/trunk/api/pear/HTML/QuickForm/input.php
17,7 → 17,7
// | Bertrand Mansion <bmansion@mamasam.com> |
// +----------------------------------------------------------------------+
//
// $Id: input.php,v 1.1 2005-03-30 08:50:33 jpm Exp $
// $Id: input.php,v 1.2 2005-09-20 17:01:22 ddelon Exp $
 
require_once("HTML/QuickForm/element.php");
 
/trunk/api/pear/HTML/QuickForm/RuleRegistry.php
18,7 → 18,7
// | Bertrand Mansion <bmansion@mamasam.com> |
// +----------------------------------------------------------------------+
//
// $Id: RuleRegistry.php,v 1.1 2005-03-30 08:50:33 jpm Exp $
// $Id: RuleRegistry.php,v 1.2 2005-09-20 17:01:22 ddelon Exp $
 
/**
* Registers rule objects and uses them for validation
215,17 → 215,20
$jsIndex = isset($index)? '[' . $index . ']': '';
$tmp_reset = $reset? " var field = frm.elements['$elementName'];\n": '';
if (is_a($element, 'html_quickform_group')) {
$value = " var {$elementName}Elements = '::";
for ($i = 0, $count = count($element->_elements); $i < $count; $i++) {
$value .= $element->getElementName($i) . '::';
$value = " _qfGroups['{$elementName}'] = {";
$elements =& $element->getElements();
for ($i = 0, $count = count($elements); $i < $count; $i++) {
$append = ($elements[$i]->getType() == 'select' && $elements[$i]->getMultiple())? '[]': '';
$value .= "'" . $element->getElementName($i) . $append . "': true" .
($i < $count - 1? ', ': '');
}
$value .=
"';\n" .
"};\n" .
" value{$jsIndex} = new Array();\n" .
" var valueIdx = 0;\n" .
" for (var i = 0; i < frm.elements.length; i++) {\n" .
" var _element = frm.elements[i];\n" .
" if ({$elementName}Elements.indexOf('::' + _element.name + '::') >= 0) {\n" .
" if (_element.name in _qfGroups['{$elementName}']) {\n" .
" switch (_element.type) {\n" .
" case 'checkbox':\n" .
" case 'radio':\n" .
233,11 → 236,23
" value{$jsIndex}[valueIdx++] = _element.value;\n" .
" }\n" .
" break;\n" .
" case 'select':\n" .
" case 'select-one':\n" .
" if (-1 != _element.selectedIndex) {\n" .
" value{$jsIndex}[valueIdx++] = _element.options[_element.selectedIndex].value;\n" .
" }\n" .
" break;\n" .
" case 'select-multiple':\n" .
" var tmpVal = new Array();\n" .
" var tmpIdx = 0;\n" .
" for (var j = 0; j < _element.options.length; j++) {\n" .
" if (_element.options[j].selected) {\n" .
" tmpVal[tmpIdx++] = _element.options[j].value;\n" .
" }\n" .
" }\n" .
" if (tmpIdx > 0) {\n" .
" value{$jsIndex}[valueIdx++] = tmpVal;\n" .
" }\n" .
" break;\n" .
" default:\n" .
" value{$jsIndex}[valueIdx++] = _element.value;\n" .
" }\n" .
247,13 → 262,14
$tmp_reset =
" for (var i = 0; i < frm.elements.length; i++) {\n" .
" var _element = frm.elements[i];\n" .
" if ({$elementName}Elements.indexOf('::' + _element.name + '::') >= 0) {\n" .
" if (_element.name in _qfGroups['{$elementName}']) {\n" .
" switch (_element.type) {\n" .
" case 'checkbox':\n" .
" case 'radio':\n" .
" _element.checked = _element.defaultChecked;\n" .
" break;\n" .
" case 'select':\n" .
" case 'select-one':\n" .
" case 'select-multiple:\n" .
" for (var j = 0; j < _element.options.length; j++) {\n" .
" _element.options[j].selected = _element.options[j].defaultSelected;\n" .
" }\n" .
277,7 → 293,7
" }\n" .
" }\n";
} else {
$value = " value{$jsIndex} = frm.elements['{$elementName}'].options[frm.elements['{$elementName}'].selectedIndex].value;\n";
$value = " value{$jsIndex} = frm.elements['{$elementName}'].selectedIndex == -1? '': frm.elements['{$elementName}'].options[frm.elements['{$elementName}'].selectedIndex].value;\n";
}
if ($reset) {
$tmp_reset .=
286,7 → 302,7
" }\n";
}
 
} elseif ($element->getType() == 'checkbox') {
} elseif ($element->getType() == 'checkbox' && !is_a($element, 'html_quickform_advcheckbox')) {
$value = " if (frm.elements['$elementName'].checked) {\n" .
" value{$jsIndex} = '1';\n" .
" } else {\n" .
/trunk/api/pear/HTML/QuickForm/autocomplete.php
23,7 → 23,7
// | http://www.sitepoint.com/article/1220 |
// +----------------------------------------------------------------------+
//
// $Id: autocomplete.php,v 1.1 2005-03-30 08:50:33 jpm Exp $
// $Id: autocomplete.php,v 1.2 2005-09-20 17:01:22 ddelon Exp $
 
 
require_once("HTML/QuickForm/text.php");
53,6 → 53,14
*/
var $_options = array();
 
/**
* "One-time" javascript (containing functions), see bug #4611
*
* @var string
* @access private
*/
var $_js = '';
 
// }}}
// {{{ constructor
 
114,7 → 122,7
} else {
$js = "<script type=\"text/javascript\">\n//<![CDATA[\n";
if (!defined('HTML_QUICKFORM_AUTOCOMPLETE_EXISTS')) {
$js .= <<<EOS
$this->_js .= <<<EOS
 
/* begin javascript for autocomplete */
function setSelectionRange(input, selectionStart, selectionEnd) {
225,7 → 233,8
'"' => '\"',
'\\' => '\\\\'
);
 
$js .= $this->_js;
$js .= 'var ' . $arrayName . " = new Array();\n";
for ($i = 0; $i < count($this->_options); $i++) {
$js .= $arrayName . '[' . $i . "] = '" . strtr($this->_options[$i], $jsEscape) . "';\n";
/trunk/api/pear/HTML/QuickForm/password.php
17,7 → 17,7
// | Bertrand Mansion <bmansion@mamasam.com> |
// +----------------------------------------------------------------------+
//
// $Id: password.php,v 1.1 2005-03-30 08:50:33 jpm Exp $
// $Id: password.php,v 1.2 2005-09-20 17:01:22 ddelon Exp $
 
require_once("HTML/QuickForm/input.php");
 
/trunk/api/pear/HTML/QuickForm/xbutton.php
16,7 → 16,7
// | Authors: Alexey Borzov <avb@php.net> |
// +----------------------------------------------------------------------+
//
// $Id: xbutton.php,v 1.1 2005-03-30 08:50:33 jpm Exp $
// $Id: xbutton.php,v 1.2 2005-09-20 17:01:22 ddelon Exp $
 
require_once 'HTML/QuickForm/element.php';
 
/trunk/api/pear/HTML/QuickForm/submit.php
17,7 → 17,7
// | Bertrand Mansion <bmansion@mamasam.com> |
// +----------------------------------------------------------------------+
//
// $Id: submit.php,v 1.1 2005-03-30 08:50:33 jpm Exp $
// $Id: submit.php,v 1.2 2005-09-20 17:01:22 ddelon Exp $
 
require_once("HTML/QuickForm/input.php");
 
/trunk/api/pear/HTML/QuickForm/html.php
16,7 → 16,7
// | Author: Alexey Borzov <borz_off@cs.msu.su> |
// +----------------------------------------------------------------------+
//
// $Id: html.php,v 1.1 2005-03-30 08:50:33 jpm Exp $
// $Id: html.php,v 1.2 2005-09-20 17:01:22 ddelon Exp $
 
require_once 'HTML/QuickForm/static.php';
 
/trunk/api/pear/HTML/QuickForm/Renderer.php
16,7 → 16,7
// | Author: Alexey Borzov <borz_off@cs.msu.su> |
// +----------------------------------------------------------------------+
//
// $Id: Renderer.php,v 1.1 2005-03-30 08:50:33 jpm Exp $
// $Id: Renderer.php,v 1.2 2005-09-20 17:01:22 ddelon Exp $
 
/**
* An abstract base class for QuickForm renderers
/trunk/api/pear/HTML/QuickForm/Rule.php
16,7 → 16,7
// | Authors: Bertrand Mansion <bmansion@mamasam.com> |
// +----------------------------------------------------------------------+
//
// $Id: Rule.php,v 1.1 2005-03-30 08:50:33 jpm Exp $
// $Id: Rule.php,v 1.2 2005-09-20 17:01:22 ddelon Exp $
 
class HTML_QuickForm_Rule
{
/trunk/api/pear/HTML/QuickForm/button.php
17,7 → 17,7
// | Bertrand Mansion <bmansion@mamasam.com> |
// +----------------------------------------------------------------------+
//
// $Id: button.php,v 1.1 2005-03-30 08:50:33 jpm Exp $
// $Id: button.php,v 1.2 2005-09-20 17:01:22 ddelon Exp $
 
require_once("HTML/QuickForm/input.php");
 
/trunk/api/pear/HTML/QuickForm/date.php
18,7 → 18,7
// | Bertrand Mansion <bmansion@mamasam.com> |
// +----------------------------------------------------------------------+
//
// $Id: date.php,v 1.1 2005-03-30 08:50:33 jpm Exp $
// $Id: date.php,v 1.2 2005-09-20 17:01:22 ddelon Exp $
 
require_once 'HTML/QuickForm/group.php';
require_once 'HTML/QuickForm/select.php';
111,13 → 111,7
'fr' => array (
'weekdays_short'=> array ('Dim', 'Lun', 'Mar', 'Mer', 'Jeu', 'Ven', 'Sam'),
'weekdays_long' => array ('Dimanche', 'Lundi', 'Mardi', 'Mercredi', 'Jeudi', 'Vendredi', 'Samedi'),
'months_short' => array ('Jan', 'Fev', 'Mar', 'Avr', 'Mai', 'Jun', 'Jul', 'Aou', 'Sep', 'Oct', 'Nov', 'Dec'),
'months_long' => array ('Janvier', 'Fevrier', 'Mars', 'Avril', 'Mai', 'Juin', 'Juillet', 'Aout', 'Septembre', 'Octobre', 'Novembre', 'Decembre')
),
'fr' => array (
'weekdays_short'=> array ('Dim', 'Lun', 'Mar', 'Mer', 'Jeu', 'Ven', 'Sam'),
'weekdays_long' => array ('Dimanche', 'Lundi', 'Mardi', 'Mercredi', 'Jeudi', 'Vendredi', 'Samedi'),
'months_short' => array ('Jan', 'Fev', 'Mar', 'Avr', 'Mai', 'Jun', 'Jul', 'Aou', 'Sep', 'Oct', 'Nov', 'Dec'),
'months_short' => array ('Jan', 'F&#xe9;v', 'Mar', 'Avr', 'Mai', 'Juin', 'Juil', 'Ao&#xfb;t', 'Sep', 'Oct', 'Nov', 'D&#xe9;c'),
'months_long' => array ('Janvier', 'F&#xe9;vrier', 'Mars', 'Avril', 'Mai', 'Juin', 'Juillet', 'Ao&#xfb;t', 'Septembre', 'Octobre', 'Novembre', 'D&#xe9;cembre')
),
'hu' => array (
148,7 → 142,7
'weekdays_short'=> array ('Dom', 'Lun', 'Mar', 'Mi&#xe9;', 'Jue', 'Vie', 'S&#xe1;b'),
'weekdays_long' => array ('Domingo', 'Lunes', 'Martes', 'Mi&#xe9;rcoles', 'Jueves', 'Viernes', 'S&#xe1;bado'),
'months_short' => array ('Ene', 'Feb', 'Mar', 'Abr', 'May', 'Jun', 'Jul', 'Ago', 'Sep', 'Oct', 'Nov', 'Dic'),
'months_long' => array ('Enero', 'Febrero', 'Marzo', 'Abril', 'Mayo', 'Junio', 'Julio', 'Agosto', 'Septimbre', 'Octubre', 'Noviembre', 'Diciembre')
'months_long' => array ('Enero', 'Febrero', 'Marzo', 'Abril', 'Mayo', 'Junio', 'Julio', 'Agosto', 'Septiembre', 'Octubre', 'Noviembre', 'Diciembre')
),
'da' => array (
'weekdays_short'=> array ('S&#xf8;n', 'Man', 'Tir', 'Ons', 'Tor', 'Fre', 'L&#xf8;r'),
221,7 → 215,31
'weekdays_long' => array('&#x41d;&#x435;&#x434;&#x456;&#x43b;&#x44f;', '&#x41f;&#x43e;&#x43d;&#x435;&#x434;&#x456;&#x43b;&#x43e;&#x43a;', '&#x412;&#x456;&#x432;&#x442;&#x43e;&#x440;&#x43e;&#x43a;', '&#x421;&#x435;&#x440;&#x435;&#x434;&#x430;', '&#x427;&#x435;&#x442;&#x432;&#x435;&#x440;', '&#x41f;\'&#x44f;&#x442;&#x43d;&#x438;&#x446;&#x44f;', '&#x421;&#x443;&#x431;&#x43e;&#x442;&#x430;'),
'months_short' => array('&#x421;&#x456;&#x447;', '&#x41b;&#x44e;&#x442;', '&#x411;&#x435;&#x440;', '&#x41a;&#x432;&#x456;', '&#x422;&#x440;&#x430;', '&#x427;&#x435;&#x440;', '&#x41b;&#x438;&#x43f;', '&#x421;&#x435;&#x440;', '&#x412;&#x435;&#x440;', '&#x416;&#x43e;&#x432;', '&#x41b;&#x438;&#x441;', '&#x413;&#x440;&#x443;'),
'months_long' => array('&#x421;&#x456;&#x447;&#x435;&#x43d;&#x44c;', '&#x41b;&#x44e;&#x442;&#x438;&#x439;', '&#x411;&#x435;&#x440;&#x435;&#x437;&#x435;&#x43d;&#x44c;', '&#x41a;&#x432;&#x456;&#x442;&#x435;&#x43d;&#x44c;', '&#x422;&#x440;&#x430;&#x432;&#x435;&#x43d;&#x44c;', '&#x427;&#x435;&#x440;&#x432;&#x435;&#x43d;&#x44c;', '&#x41b;&#x438;&#x43f;&#x435;&#x43d;&#x44c;', '&#x421;&#x435;&#x440;&#x43f;&#x435;&#x43d;&#x44c;', '&#x412;&#x435;&#x440;&#x435;&#x441;&#x435;&#x43d;&#x44c;', '&#x416;&#x43e;&#x432;&#x442;&#x435;&#x43d;&#x44c;', '&#x41b;&#x438;&#x441;&#x442;&#x43e;&#x43f;&#x430;&#x434;', '&#x413;&#x440;&#x443;&#x434;&#x435;&#x43d;&#x44c;')
)
),
'ro' => array (
'weekdays_short'=> array ('Dum', 'Lun', 'Mar', 'Mie', 'Joi', 'Vin', 'Sam'),
'weekdays_long' => array ('Duminica', 'Luni', 'Marti', 'Miercuri', 'Joi', 'Vineri', 'Sambata'),
'months_short' => array ('Ian', 'Feb', 'Mar', 'Apr', 'Mai', 'Iun', 'Iul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'),
'months_long' => array ('Ianuarie', 'Februarie', 'Martie', 'Aprilie', 'Mai', 'Iunie', 'Iulie', 'August', 'Septembrie', 'Octombrie', 'Noiembrie', 'Decembrie')
),
'he' => array (
'weekdays_short'=> array ('&#1512;&#1488;&#1513;&#1493;&#1503;', '&#1513;&#1504;&#1497;', '&#1513;&#1500;&#1497;&#1513;&#1497;', '&#1512;&#1489;&#1497;&#1506;&#1497;', '&#1495;&#1502;&#1497;&#1513;&#1497;', '&#1513;&#1497;&#1513;&#1497;', '&#1513;&#1489;&#1514;'),
'weekdays_long' => array ('&#1497;&#1493;&#1501; &#1512;&#1488;&#1513;&#1493;&#1503;', '&#1497;&#1493;&#1501; &#1513;&#1504;&#1497;', '&#1497;&#1493;&#1501; &#1513;&#1500;&#1497;&#1513;&#1497;', '&#1497;&#1493;&#1501; &#1512;&#1489;&#1497;&#1506;&#1497;', '&#1497;&#1493;&#1501; &#1495;&#1502;&#1497;&#1513;&#1497;', '&#1497;&#1493;&#1501; &#1513;&#1497;&#1513;&#1497;', '&#1513;&#1489;&#1514;'),
'months_short' => array ('&#1497;&#1504;&#1493;&#1488;&#1512;', '&#1508;&#1489;&#1512;&#1493;&#1488;&#1512;', '&#1502;&#1512;&#1509;', '&#1488;&#1508;&#1512;&#1497;&#1500;', '&#1502;&#1488;&#1497;', '&#1497;&#1493;&#1504;&#1497;', '&#1497;&#1493;&#1500;&#1497;', '&#1488;&#1493;&#1490;&#1493;&#1505;&#1496;', '&#1505;&#1508;&#1496;&#1502;&#1489;&#1512;', '&#1488;&#1493;&#1511;&#1496;&#1493;&#1489;&#1512;', '&#1504;&#1493;&#1489;&#1502;&#1489;&#1512;', '&#1491;&#1510;&#1502;&#1489;&#1512;'),
'months_long' => array ('&#1497;&#1504;&#1493;&#1488;&#1512;', '&#1508;&#1489;&#1512;&#1493;&#1488;&#1512;', '&#1502;&#1512;&#1509;', '&#1488;&#1508;&#1512;&#1497;&#1500;', '&#1502;&#1488;&#1497;', '&#1497;&#1493;&#1504;&#1497;', '&#1497;&#1493;&#1500;&#1497;', '&#1488;&#1493;&#1490;&#1493;&#1505;&#1496;', '&#1505;&#1508;&#1496;&#1502;&#1489;&#1512;', '&#1488;&#1493;&#1511;&#1496;&#1493;&#1489;&#1512;', '&#1504;&#1493;&#1489;&#1502;&#1489;&#1512;', '&#1491;&#1510;&#1502;&#1489;&#1512;')
),
'sv' => array (
'weekdays_short'=> array ('S&#xf6;n', 'M&#xe5;n', 'Tis', 'Ons', 'Tor', 'Fre', 'L&#xf6;r'),
'weekdays_long' => array ('S&#xf6;ndag', 'M&#xe5;ndag', 'Tisdag', 'Onsdag', 'Torsdag', 'Fredag', 'L&#xf6;rdag'),
'months_short' => array ('Jan', 'Feb', 'Mar', 'Apr', 'Maj', 'Jun', 'Jul', 'Aug', 'Sep', 'Okt', 'Nov', 'Dec'),
'months_long' => array ('Januari', 'Februari', 'Mars', 'April', 'Maj', 'Juni', 'Juli', 'Augusti', 'September', 'Oktober', 'November', 'December')
),
'pt' => array (
'weekdays_short'=> array ('Dom', 'Seg', 'Ter', 'Qua', 'Qui', 'Sex', 'S&aacute;b'),
'weekdays_long' => array ('Domingo', 'Segunda-feira', 'Ter&ccedil;a-feira', 'Quarta-feira', 'Quinta-feira', 'Sexta-feira', 'S&aacute;bado'),
'months_short' => array ('Jan', 'Fev', 'Mar', 'Abr', 'Mai', 'Jun', 'Jul', 'Ago', 'Set', 'Out', 'Nov', 'Dez'),
'months_long' => array ('Janeiro', 'Fevereiro', 'Mar&ccedil;o', 'Abril', 'Maio', 'Junho', 'Julho', 'Agosto', 'Setembro', 'Outubro', 'Novembro', 'Dezembro')
)
);
 
// }}}
316,6 → 334,10
case 'h':
$options = $this->_createOptionList(1, 12);
break;
case 'g':
$options = $this->_createOptionList(1, 12);
array_walk($options, create_function('&$v,$k', '$v = intval($v);'));
break;
case 'H':
$options = $this->_createOptionList(0, 23);
break;
331,6 → 353,9
case 'A':
$options = array('AM' => 'AM', 'PM' => 'PM');
break;
case 'W':
$options = $this->_createOptionList(1, 53);
break;
case '\\':
$backslash = true;
$loadSelect = false;
348,9 → 373,15
}
$separator = '';
// Should we add an empty option to the top of the select?
if ($this->_options['addEmptyOption']) {
// Preserve the keys
$options = array($this->_options['emptyOptionValue'] => $this->_options['emptyOptionText']) + $options;
if (!is_array($this->_options['addEmptyOption']) && $this->_options['addEmptyOption'] ||
is_array($this->_options['addEmptyOption']) && !empty($this->_options['addEmptyOption'][$sign])) {
 
// Using '+' array operator to preserve the keys
if (is_array($this->_options['emptyOptionText']) && !empty($this->_options['emptyOptionText'][$sign])) {
$options = array($this->_options['emptyOptionValue'] => $this->_options['emptyOptionText'][$sign]) + $options;
} else {
$options = array($this->_options['emptyOptionValue'] => $this->_options['emptyOptionText']) + $options;
}
}
$this->_elements[] =& new HTML_QuickForm_select($sign, null, $options, $this->getAttributes());
}
391,7 → 422,7
$value = strtotime($value);
}
// might be a unix epoch, then we fill all possible values
$arr = explode('-', date('w-d-n-Y-h-H-i-s-a-A', (int)$value));
$arr = explode('-', date('w-d-n-Y-h-H-i-s-a-A-W', (int)$value));
$value = array(
'D' => $arr[0],
'l' => $arr[0],
402,11 → 433,13
'Y' => $arr[3],
'y' => $arr[3],
'h' => $arr[4],
'g' => $arr[4],
'H' => $arr[5],
'i' => $arr[6],
's' => $arr[7],
'a' => $arr[8],
'A' => $arr[9]
'A' => $arr[9],
'W' => $arr[10]
);
}
parent::setValue($value);
419,9 → 452,9
{
include_once('HTML/QuickForm/Renderer/Default.php');
$renderer =& new HTML_QuickForm_Renderer_Default();
$renderer->setElementTemplate($this->_wrap[0] . '{element}' . $this->_wrap[1]);
$renderer->setElementTemplate('{element}');
parent::accept($renderer);
return $renderer->toHtml();
return $this->_wrap[0] . $renderer->toHtml() . $this->_wrap[1];
}
 
// }}}
/trunk/api/pear/HTML/QuickForm/textarea.php
17,7 → 17,7
// | Bertrand Mansion <bmansion@mamasam.com> |
// +----------------------------------------------------------------------+
//
// $Id: textarea.php,v 1.1 2005-03-30 08:50:33 jpm Exp $
// $Id: textarea.php,v 1.2 2005-09-20 17:01:22 ddelon Exp $
 
require_once("HTML/QuickForm/element.php");
 
/trunk/api/pear/HTML/QuickForm/file.php
17,7 → 17,7
// | Bertrand Mansion <bmansion@mamasam.com> |
// +----------------------------------------------------------------------+
//
// $Id: file.php,v 1.1 2005-03-30 08:50:33 jpm Exp $
// $Id: file.php,v 1.2 2005-09-20 17:01:22 ddelon Exp $
 
require_once("HTML/QuickForm/input.php");
 
/trunk/api/pear/HTML/QuickForm/select.php
17,7 → 17,7
// | Bertrand Mansion <bmansion@mamasam.com> |
// +----------------------------------------------------------------------+
//
// $Id: select.php,v 1.1 2005-03-30 08:50:33 jpm Exp $
// $Id: select.php,v 1.2 2005-09-20 17:01:22 ddelon Exp $
 
require_once('HTML/QuickForm/element.php');
 
446,7 → 446,7
case (is_a($options, 'db_result')):
return $this->loadDbResult($options, $param1, $param2, $param3);
break;
case (is_string($options) && !empty($options) || is_subclass_of($options, "db_common")):
case (is_string($options) && !empty($options) ):
return $this->loadQuery($options, $param1, $param2, $param3, $param4);
break;
}
512,7 → 512,7
if (is_array($this->_values)) {
foreach ($this->_values as $key => $val) {
for ($i = 0, $optCount = count($this->_options); $i < $optCount; $i++) {
if ($val == $this->_options[$i]['attr']['value']) {
if ((string)$val == (string)$this->_options[$i]['attr']['value']) {
$value[$key] = $this->_options[$i]['text'];
break;
}
525,13 → 525,16
// Only use id attribute if doing single hidden input
if (1 == count($value)) {
$id = $this->getAttribute('id');
$idAttr = isset($id)? ' id="' . $id . '"': '';
$idAttr = isset($id)? array('id' => $id): array();
} else {
$idAttr = '';
$idAttr = array();
}
foreach ($value as $key => $item) {
$html .= '<input type="hidden"' . $idAttr . ' name="' .
$name . '" value="' . $this->_values[$key] . '" />';
$html .= '<input' . $this->_getAttrString(array(
'type' => 'hidden',
'name' => $name,
'value' => $this->_values[$key]
) + $idAttr) . ' />';
}
}
return $html;
573,5 → 576,29
}
// }}}
// {{{ onQuickFormEvent()
 
function onQuickFormEvent($event, $arg, &$caller)
{
if ('updateValue' == $event) {
$value = $this->_findValue($caller->_constantValues);
if (null === $value) {
$value = $this->_findValue($caller->_submitValues);
// Fix for bug #4465
// XXX: should we push this to element::onQuickFormEvent()?
if (null === $value && !$caller->isSubmitted()) {
$value = $this->_findValue($caller->_defaultValues);
}
}
if (null !== $value) {
$this->setValue($value);
}
return true;
} else {
return parent::onQuickFormEvent($event, $arg, $caller);
}
}
 
// }}}
} //end class HTML_QuickForm_select
?>
/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
?>
?>
/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.php
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/api/pear/DB/msql.php
23,7 → 23,7
* @author Daniel Convissor <danielc@php.net>
* @copyright 1997-2005 The PHP Group
* @license http://www.php.net/license/3_0.txt PHP License 3.0
* @version CVS: $Id: msql.php,v 1.1 2005-03-30 08:50:33 jpm Exp $
* @version CVS: $Id: msql.php,v 1.2 2005-09-20 17:01:22 ddelon Exp $
* @link http://pear.php.net/package/DB
*/
 
47,7 → 47,7
* @author Daniel Convissor <danielc@php.net>
* @copyright 1997-2005 The PHP Group
* @license http://www.php.net/license/3_0.txt PHP License 3.0
* @version Release: 1.7.5
* @version Release: @package_version@
* @link http://pear.php.net/package/DB
* @since Class not functional until Release 1.7.0
*/
/trunk/api/pear/DB/dbase.php
20,7 → 20,7
* @author Daniel Convissor <danielc@php.net>
* @copyright 1997-2005 The PHP Group
* @license http://www.php.net/license/3_0.txt PHP License 3.0
* @version CVS: $Id: dbase.php,v 1.1 2005-03-30 08:50:33 jpm Exp $
* @version CVS: $Id: dbase.php,v 1.2 2005-09-20 17:01:22 ddelon Exp $
* @link http://pear.php.net/package/DB
*/
 
41,7 → 41,7
* @author Daniel Convissor <danielc@php.net>
* @copyright 1997-2005 The PHP Group
* @license http://www.php.net/license/3_0.txt PHP License 3.0
* @version Release: 1.7.5
* @version Release: @package_version@
* @link http://pear.php.net/package/DB
*/
class DB_dbase extends DB_common
/trunk/api/pear/DB/mysqli.php
19,7 → 19,7
* @author Daniel Convissor <danielc@php.net>
* @copyright 1997-2005 The PHP Group
* @license http://www.php.net/license/3_0.txt PHP License 3.0
* @version CVS: $Id: mysqli.php,v 1.1 2005-03-30 08:50:33 jpm Exp $
* @version CVS: $Id: mysqli.php,v 1.2 2005-09-20 17:01:22 ddelon Exp $
* @link http://pear.php.net/package/DB
*/
 
43,7 → 43,7
* @author Daniel Convissor <danielc@php.net>
* @copyright 1997-2005 The PHP Group
* @license http://www.php.net/license/3_0.txt PHP License 3.0
* @version Release: 1.7.5
* @version Release: @package_version@
* @link http://pear.php.net/package/DB
* @since Class functional since Release 1.6.3
*/
/trunk/api/pear/DB/mssql.php
20,7 → 20,7
* @author Daniel Convissor <danielc@php.net>
* @copyright 1997-2005 The PHP Group
* @license http://www.php.net/license/3_0.txt PHP License 3.0
* @version CVS: $Id: mssql.php,v 1.1 2005-03-30 08:50:33 jpm Exp $
* @version CVS: $Id: mssql.php,v 1.2 2005-09-20 17:01:22 ddelon Exp $
* @link http://pear.php.net/package/DB
*/
 
41,7 → 41,7
* @author Daniel Convissor <danielc@php.net>
* @copyright 1997-2005 The PHP Group
* @license http://www.php.net/license/3_0.txt PHP License 3.0
* @version Release: 1.7.5
* @version Release: @package_version@
* @link http://pear.php.net/package/DB
*/
class DB_mssql extends DB_common
/trunk/api/pear/DB/sqlite.php
21,7 → 21,7
* @author Daniel Convissor <danielc@php.net>
* @copyright 1997-2005 The PHP Group
* @license http://www.php.net/license/3_0.txt PHP License 3.0 3.0
* @version CVS: $Id: sqlite.php,v 1.1 2005-03-30 08:50:33 jpm Exp $
* @version CVS: $Id: sqlite.php,v 1.2 2005-09-20 17:01:22 ddelon Exp $
* @link http://pear.php.net/package/DB
*/
 
47,7 → 47,7
* @author Daniel Convissor <danielc@php.net>
* @copyright 1997-2005 The PHP Group
* @license http://www.php.net/license/3_0.txt PHP License 3.0 3.0
* @version Release: 1.7.5
* @version Release: @package_version@
* @link http://pear.php.net/package/DB
*/
class DB_sqlite extends DB_common
/trunk/api/pear/DB/oci8.php
20,7 → 20,7
* @author Daniel Convissor <danielc@php.net>
* @copyright 1997-2005 The PHP Group
* @license http://www.php.net/license/3_0.txt PHP License 3.0
* @version CVS: $Id: oci8.php,v 1.1 2005-03-30 08:50:33 jpm Exp $
* @version CVS: $Id: oci8.php,v 1.2 2005-09-20 17:01:22 ddelon Exp $
* @link http://pear.php.net/package/DB
*/
 
47,7 → 47,7
* @author Daniel Convissor <danielc@php.net>
* @copyright 1997-2005 The PHP Group
* @license http://www.php.net/license/3_0.txt PHP License 3.0
* @version Release: 1.7.5
* @version Release: @package_version@
* @link http://pear.php.net/package/DB
*/
class DB_oci8 extends DB_common
225,10 → 225,18
$connect_function = $persistent ? 'oci_pconnect'
: 'oci_connect';
}
 
// Backwards compatibility with DB < 1.7.0
if (empty($dsn['database']) && !empty($dsn['hostspec'])) {
$db = $dsn['hostspec'];
} else {
$db = $dsn['database'];
}
 
$char = empty($dsn['charset']) ? null : $dsn['charset'];
$this->connection = @$connect_function($dsn['username'],
$dsn['password'],
$dsn['database'],
$db,
$char);
$error = OCIError();
if (!empty($error) && $error['code'] == 12541) {
/trunk/api/pear/DB/ibase.php
23,7 → 23,7
* @author Daniel Convissor <danielc@php.net>
* @copyright 1997-2005 The PHP Group
* @license http://www.php.net/license/3_0.txt PHP License 3.0
* @version CVS: $Id: ibase.php,v 1.1 2005-03-30 08:50:33 jpm Exp $
* @version CVS: $Id: ibase.php,v 1.2 2005-09-20 17:01:22 ddelon Exp $
* @link http://pear.php.net/package/DB
*/
 
49,7 → 49,7
* @author Daniel Convissor <danielc@php.net>
* @copyright 1997-2005 The PHP Group
* @license http://www.php.net/license/3_0.txt PHP License 3.0
* @version Release: 1.7.5
* @version Release: @package_version@
* @link http://pear.php.net/package/DB
* @since Class became stable in Release 1.7.0
*/
/trunk/api/pear/DB/storage.php
18,7 → 18,7
* @author Stig Bakken <stig@php.net>
* @copyright 1997-2005 The PHP Group
* @license http://www.php.net/license/3_0.txt PHP License 3.0
* @version CVS: $Id: storage.php,v 1.1 2005-03-30 08:50:33 jpm Exp $
* @version CVS: $Id: storage.php,v 1.2 2005-09-20 17:01:22 ddelon Exp $
* @link http://pear.php.net/package/DB
*/
 
38,7 → 38,7
* @author Stig Bakken <stig@php.net>
* @copyright 1997-2005 The PHP Group
* @license http://www.php.net/license/3_0.txt PHP License 3.0
* @version Release: 1.7.5
* @version Release: @package_version@
* @link http://pear.php.net/package/DB
*/
class DB_storage extends PEAR
/trunk/api/pear/DB/mysql.php
20,7 → 20,7
* @author Daniel Convissor <danielc@php.net>
* @copyright 1997-2005 The PHP Group
* @license http://www.php.net/license/3_0.txt PHP License 3.0
* @version CVS: $Id: mysql.php,v 1.1 2005-03-30 08:50:33 jpm Exp $
* @version CVS: $Id: mysql.php,v 1.2 2005-09-20 17:01:22 ddelon Exp $
* @link http://pear.php.net/package/DB
*/
 
41,7 → 41,7
* @author Daniel Convissor <danielc@php.net>
* @copyright 1997-2005 The PHP Group
* @license http://www.php.net/license/3_0.txt PHP License 3.0
* @version Release: 1.7.5
* @version Release: @package_version@
* @link http://pear.php.net/package/DB
*/
class DB_mysql extends DB_common
/trunk/api/pear/DB/ifx.php
20,7 → 20,7
* @author Daniel Convissor <danielc@php.net>
* @copyright 1997-2005 The PHP Group
* @license http://www.php.net/license/3_0.txt PHP License 3.0
* @version CVS: $Id: ifx.php,v 1.1 2005-03-30 08:50:33 jpm Exp $
* @version CVS: $Id: ifx.php,v 1.2 2005-09-20 17:01:22 ddelon Exp $
* @link http://pear.php.net/package/DB
*/
 
48,7 → 48,7
* @author Daniel Convissor <danielc@php.net>
* @copyright 1997-2005 The PHP Group
* @license http://www.php.net/license/3_0.txt PHP License 3.0
* @version Release: 1.7.5
* @version Release: @package_version@
* @link http://pear.php.net/package/DB
*/
class DB_ifx extends DB_common
/trunk/api/pear/DB/pgsql.php
21,7 → 21,7
* @author Daniel Convissor <danielc@php.net>
* @copyright 1997-2005 The PHP Group
* @license http://www.php.net/license/3_0.txt PHP License 3.0
* @version CVS: $Id: pgsql.php,v 1.1 2005-03-30 08:50:33 jpm Exp $
* @version CVS: $Id: pgsql.php,v 1.2 2005-09-20 17:01:22 ddelon Exp $
* @link http://pear.php.net/package/DB
*/
 
43,7 → 43,7
* @author Daniel Convissor <danielc@php.net>
* @copyright 1997-2005 The PHP Group
* @license http://www.php.net/license/3_0.txt PHP License 3.0
* @version Release: 1.7.5
* @version Release: @package_version@
* @link http://pear.php.net/package/DB
*/
class DB_pgsql extends DB_common
/trunk/api/pear/DB/sybase.php
21,7 → 21,7
* @author Daniel Convissor <danielc@php.net>
* @copyright 1997-2005 The PHP Group
* @license http://www.php.net/license/3_0.txt PHP License 3.0
* @version CVS: $Id: sybase.php,v 1.1 2005-03-30 08:50:33 jpm Exp $
* @version CVS: $Id: sybase.php,v 1.2 2005-09-20 17:01:22 ddelon Exp $
* @link http://pear.php.net/package/DB
*/
 
46,7 → 46,7
* @author Daniel Convissor <danielc@php.net>
* @copyright 1997-2005 The PHP Group
* @license http://www.php.net/license/3_0.txt PHP License 3.0
* @version Release: 1.7.5
* @version Release: @package_version@
* @link http://pear.php.net/package/DB
*/
class DB_sybase extends DB_common
/trunk/api/pear/DB/fbsql.php
20,7 → 20,7
* @author Daniel Convissor <danielc@php.net>
* @copyright 1997-2005 The PHP Group
* @license http://www.php.net/license/3_0.txt PHP License 3.0
* @version CVS: $Id: fbsql.php,v 1.1 2005-03-30 08:50:33 jpm Exp $
* @version CVS: $Id: fbsql.php,v 1.2 2005-09-20 17:01:22 ddelon Exp $
* @link http://pear.php.net/package/DB
*/
 
41,7 → 41,7
* @author Daniel Convissor <danielc@php.net>
* @copyright 1997-2005 The PHP Group
* @license http://www.php.net/license/3_0.txt PHP License 3.0
* @version Release: 1.7.5
* @version Release: @package_version@
* @link http://pear.php.net/package/DB
* @since Class functional since Release 1.7.0
*/
/trunk/api/pear/DB/odbc.php
20,7 → 20,7
* @author Daniel Convissor <danielc@php.net>
* @copyright 1997-2005 The PHP Group
* @license http://www.php.net/license/3_0.txt PHP License 3.0
* @version CVS: $Id: odbc.php,v 1.1 2005-03-30 08:50:33 jpm Exp $
* @version CVS: $Id: odbc.php,v 1.2 2005-09-20 17:01:22 ddelon Exp $
* @link http://pear.php.net/package/DB
*/
 
44,7 → 44,7
* @author Daniel Convissor <danielc@php.net>
* @copyright 1997-2005 The PHP Group
* @license http://www.php.net/license/3_0.txt PHP License 3.0
* @version Release: 1.7.5
* @version Release: @package_version@
* @link http://pear.php.net/package/DB
*/
class DB_odbc extends DB_common
/trunk/api/pear/DB/common.php
20,7 → 20,7
* @author Daniel Convissor <danielc@php.net>
* @copyright 1997-2005 The PHP Group
* @license http://www.php.net/license/3_0.txt PHP License 3.0
* @version CVS: $Id: common.php,v 1.1 2005-03-30 08:50:33 jpm Exp $
* @version CVS: $Id: common.php,v 1.2 2005-09-20 17:01:22 ddelon Exp $
* @link http://pear.php.net/package/DB
*/
 
42,7 → 42,7
* @author Daniel Convissor <danielc@php.net>
* @copyright 1997-2005 The PHP Group
* @license http://www.php.net/license/3_0.txt PHP License 3.0
* @version Release: 1.7.5
* @version Release: @package_version@
* @link http://pear.php.net/package/DB
*/
class DB_common extends PEAR
479,10 → 479,8
/**
* Sets the fetch mode that should be used by default for query results
*
* @param integer $fetchmode DB_FETCHMODE_ORDERED or DB_FETCHMODE_ASSOC,
* possibly bit-wise OR'ed with
* DB_FETCHMODE_FLIPPED
*
* @param integer $fetchmode DB_FETCHMODE_ORDERED, DB_FETCHMODE_ASSOC
* or DB_FETCHMODE_OBJECT
* @param string $object_class the class name of the object to be returned
* by the fetch methods when the
* DB_FETCHMODE_OBJECT mode is selected.
491,8 → 489,7
* done. There is also the posibility to use
* and extend the 'DB_row' class.
*
* @see DB_FETCHMODE_ORDERED, DB_FETCHMODE_ASSOC, DB_FETCHMODE_FLIPPED,
* DB_FETCHMODE_OBJECT
* @see DB_FETCHMODE_ORDERED, DB_FETCHMODE_ASSOC, DB_FETCHMODE_OBJECT
*/
function setFetchMode($fetchmode, $object_class = 'stdClass')
{
1571,7 → 1568,11
* placeholders in query: meaning 1
* placeholder for non-array parameters or
* 1 placeholder per array element.
* @param int $fetchmode the fetch mode to use
* @param int $fetchmode the fetch mode to use:
* + DB_FETCHMODE_ORDERED
* + DB_FETCHMODE_ASSOC
* + DB_FETCHMODE_ORDERED | DB_FETCHMODE_FLIPPED
* + DB_FETCHMODE_ASSOC | DB_FETCHMODE_FLIPPED
*
* @return array the nested array. A DB_Error object on failure.
*/
/trunk/api/pear/A_LIRE.txt
2,9 → 2,9
==============================
Package Version State
Auth 1.2.3 stable
DB 1.7.5 stable
DB 1.7.6 stable
HTML_Common 1.2.1 stable
HTML_QuickForm 3.2.4pl1 stable
HTML_QuickForm 3.2.5 stable
HTML_Table 1.5 stable
HTTP 1.3.5 stable
Net_FTP 1.3.0 stable
/trunk/api/pear/DB.php
20,7 → 20,7
* @author Daniel Convissor <danielc@php.net>
* @copyright 1997-2005 The PHP Group
* @license http://www.php.net/license/3_0.txt PHP License 3.0
* @version CVS: $Id: DB.php,v 1.1 2005-03-30 08:50:19 jpm Exp $
* @version CVS: $Id: DB.php,v 1.2 2005-09-20 17:01:22 ddelon Exp $
* @link http://pear.php.net/package/DB
*/
 
426,7 → 426,7
* @author Daniel Convissor <danielc@php.net>
* @copyright 1997-2005 The PHP Group
* @license http://www.php.net/license/3_0.txt PHP License 3.0
* @version Release: 1.7.5
* @version Release: @package_version@
* @link http://pear.php.net/package/DB
*/
class DB
572,7 → 572,7
*/
function apiVersion()
{
return '1.7.5';
return '@package_version@';
}
 
// }}}
862,7 → 862,7
* @author Stig Bakken <ssb@php.net>
* @copyright 1997-2005 The PHP Group
* @license http://www.php.net/license/3_0.txt PHP License 3.0
* @version Release: 1.7.5
* @version Release: @package_version@
* @link http://pear.php.net/package/DB
*/
class DB_Error extends PEAR_Error
909,7 → 909,7
* @author Stig Bakken <ssb@php.net>
* @copyright 1997-2005 The PHP Group
* @license http://www.php.net/license/3_0.txt PHP License 3.0
* @version Release: 1.7.5
* @version Release: @package_version@
* @link http://pear.php.net/package/DB
*/
class DB_result
1351,7 → 1351,7
* @author Stig Bakken <ssb@php.net>
* @copyright 1997-2005 The PHP Group
* @license http://www.php.net/license/3_0.txt PHP License 3.0
* @version Release: 1.7.5
* @version Release: @package_version@
* @link http://pear.php.net/package/DB
* @see DB_common::setFetchMode()
*/