pieforms-commit Mailing List for Pieforms
Status: Alpha
Brought to you by:
oracleshinoda
You can subscribe to this list here.
2006 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(73) |
Dec
(83) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2007 |
Jan
(16) |
Feb
(19) |
Mar
(12) |
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
(14) |
Sep
(2) |
Oct
(1) |
Nov
(2) |
Dec
(45) |
2008 |
Jan
(20) |
Feb
(3) |
Mar
(2) |
Apr
|
May
|
Jun
|
Jul
(3) |
Aug
|
Sep
|
Oct
(1) |
Nov
(1) |
Dec
(1) |
2009 |
Jan
(2) |
Feb
(2) |
Mar
|
Apr
(2) |
May
(1) |
Jun
(5) |
Jul
(1) |
Aug
(2) |
Sep
(1) |
Oct
|
Nov
(7) |
Dec
|
2010 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
S | M | T | W | T | F | S |
---|---|---|---|---|---|---|
|
|
|
1
|
2
|
3
|
4
|
5
|
6
|
7
|
8
|
9
|
10
|
11
|
12
|
13
|
14
|
15
|
16
|
17
(1) |
18
(30) |
19
(11) |
20
(13) |
21
(9) |
22
(3) |
23
(2) |
24
|
25
(1) |
26
|
27
|
28
(2) |
29
(1) |
30
|
|
|
From: <ora...@us...> - 2006-11-18 13:04:34
|
Revision: 31 http://svn.sourceforge.net/pieforms/?rev=31&view=rev Author: oracleshinoda Date: 2006-11-18 05:04:32 -0800 (Sat, 18 Nov 2006) Log Message: ----------- * If the form method is 'get' and a file upload element is in the form, notify the user * Make sure the is_submitted() method is declared public * Added a method for displaying information, which allows a callback function to override its behaviour Modified Paths: -------------- pieforms/src/pieform.php Modified: pieforms/src/pieform.php =================================================================== --- pieforms/src/pieform.php 2006-11-18 12:52:08 UTC (rev 30) +++ pieforms/src/pieform.php 2006-11-18 13:04:32 UTC (rev 31) @@ -378,6 +378,10 @@ } if ($element['type'] == 'file') { $this->fileupload = true; + if ($this->method == 'get') { + $this->method = 'post'; + self::info("Your form '$this->name' had the method 'get' and also a file element - it has been converted to 'post'"); + } } if ($element['type'] == 'fieldset') { foreach ($element['elements'] as $subname => &$subelement) { @@ -393,6 +397,10 @@ } if ($subelement['type'] == 'file') { $this->fileupload = true; + if ($this->method == 'get') { + $this->method = 'post'; + self::info("Your form '$this->name' had the method 'get' and also a file element - it has been converted to 'post'"); + } } if (!$autofocusadded && $this->autofocus === true) { $subelement['autofocus'] = true; @@ -561,7 +569,7 @@ * * @return bool */ - function is_submitted() { + public function is_submitted() { return $this->submitted; } @@ -1073,6 +1081,19 @@ } /** + * Hook for giving information back to the developer + */ + public static function info($message) { + $function = 'pieform_info'; + if (function_exists($function)) { + $function($message); + } + else { + trigger_error($message, E_USER_NOTICE); + } + } + + /** * Returns elements with errors on them * * @return array An array of elements with errors on them, the empty array This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ora...@us...> - 2006-11-18 12:52:12
|
Revision: 30 http://svn.sourceforge.net/pieforms/?rev=30&view=rev Author: oracleshinoda Date: 2006-11-18 04:52:08 -0800 (Sat, 18 Nov 2006) Log Message: ----------- Properly fix detection of invalid options, for standard selects, multiselects and radios Modified Paths: -------------- pieforms/src/pieform/rules/validateoptions.php Modified: pieforms/src/pieform/rules/validateoptions.php =================================================================== --- pieforms/src/pieform/rules/validateoptions.php 2006-11-18 12:39:26 UTC (rev 29) +++ pieforms/src/pieform/rules/validateoptions.php 2006-11-18 12:52:08 UTC (rev 30) @@ -37,12 +37,10 @@ function pieform_rule_validateoptions(Pieform $form, $field, $element) { // Get the value into an array as a key if it's a scalar, since // the actual check involves array keys - if (!is_array($field)) { - $field = array($field => ''); - } + $field = (array) $field; $allowedvalues = array_keys($element['options']); - foreach (array_keys($field) as $key) { + foreach ($field as $key) { if (!in_array($key, $allowedvalues)) { return sprintf($form->i18n('validateoptions'), $key); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ora...@us...> - 2006-11-18 12:39:35
|
Revision: 29 http://svn.sourceforge.net/pieforms/?rev=29&view=rev Author: oracleshinoda Date: 2006-11-18 04:39:26 -0800 (Sat, 18 Nov 2006) Log Message: ----------- Fixed the validateoptions rule Modified Paths: -------------- pieforms/src/pieform/rules/validateoptions.php Modified: pieforms/src/pieform/rules/validateoptions.php =================================================================== --- pieforms/src/pieform/rules/validateoptions.php 2006-11-18 12:33:21 UTC (rev 28) +++ pieforms/src/pieform/rules/validateoptions.php 2006-11-18 12:39:26 UTC (rev 29) @@ -1,6 +1,6 @@ <?php /** - * This program is part of Mahara + * This program is part of Pieforms * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,27 +16,25 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * - * @package mahara - * @subpackage form-rule + * @package pieform + * @subpackage rule * @author Nigel McNie <ni...@ca...> * @license http://www.gnu.org/copyleft/gpl.html GNU GPL - * @copyright (C) 2006,2007 Catalyst IT Ltd http://catalyst.net.nz + * @copyright (C) 2006 Catalyst IT Ltd http://catalyst.net.nz * */ -defined('INTERNAL') || die(); - /** * Makes sure that the submitted value is specified in the 'options' index of * the element. This prevents malicious people from doing things like * submitting values that aren't in a select box. * - * @param Form $form The form the rule is being applied to - * @param string $field The field to check - * @param string $element The element being checked - * @return string The error message, if the value is invalid. + * @param Pieform $form The form the rule is being applied to + * @param string $field The field to check + * @param string $element The element being checked + * @return string The error message, if the value is invalid. */ -function form_rule_validateoptions(Form $form, $field, $element) { +function pieform_rule_validateoptions(Pieform $form, $field, $element) { // Get the value into an array as a key if it's a scalar, since // the actual check involves array keys if (!is_array($field)) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ora...@us...> - 2006-11-18 12:33:28
|
Revision: 28 http://svn.sourceforge.net/pieforms/?rev=28&view=rev Author: oracleshinoda Date: 2006-11-18 04:33:21 -0800 (Sat, 18 Nov 2006) Log Message: ----------- Fixed the required rule Modified Paths: -------------- pieforms/src/pieform/rules/required.php Modified: pieforms/src/pieform/rules/required.php =================================================================== --- pieforms/src/pieform/rules/required.php 2006-11-18 12:30:17 UTC (rev 27) +++ pieforms/src/pieform/rules/required.php 2006-11-18 12:33:21 UTC (rev 28) @@ -1,6 +1,6 @@ <?php /** - * This program is part of Mahara + * This program is part of Pieforms * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,26 +16,23 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * - * @package mahara - * @subpackage form-rule + * @package pieform + * @subpackage rule * @author Nigel McNie <ni...@ca...> * @license http://www.gnu.org/copyleft/gpl.html GNU GPL - * @copyright (C) 2006,2007 Catalyst IT Ltd http://catalyst.net.nz + * @copyright (C) 2006 Catalyst IT Ltd http://catalyst.net.nz * */ -defined('INTERNAL') || die(); - /** * Checks whether the field has been specified. * - * @param Form $form The form the rule is being applied to - * @param string $field The field to check - * @param array $element The element to check - * @return string The error message, if the value is invalid. + * @param Pieform $form The form the rule is being applied to + * @param string $field The field to check + * @param array $element The element to check + * @return string The error message, if the value is invalid. */ -function form_rule_required(Form $form, $value, $element) { - // The array test is for using the "required" rule on file elements +function pieform_rule_required(Pieform $form, $value, $element) { $function = 'form_is_empty_' . $element['type']; if (function_exists($function)) { if ($function($value, $element)) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ora...@us...> - 2006-11-18 12:30:21
|
Revision: 27 http://svn.sourceforge.net/pieforms/?rev=27&view=rev Author: oracleshinoda Date: 2006-11-18 04:30:17 -0800 (Sat, 18 Nov 2006) Log Message: ----------- Fixed the minlength rule Modified Paths: -------------- pieforms/src/pieform/rules/minlength.php Modified: pieforms/src/pieform/rules/minlength.php =================================================================== --- pieforms/src/pieform/rules/minlength.php 2006-11-18 12:26:16 UTC (rev 26) +++ pieforms/src/pieform/rules/minlength.php 2006-11-18 12:30:17 UTC (rev 27) @@ -1,6 +1,6 @@ <?php /** - * This program is part of Mahara + * This program is part of Pieforms * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,26 +16,24 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * - * @package mahara - * @subpackage form-rule + * @package pieform + * @subpackage rule * @author Nigel McNie <ni...@ca...> * @license http://www.gnu.org/copyleft/gpl.html GNU GPL - * @copyright (C) 2006,2007 Catalyst IT Ltd http://catalyst.net.nz + * @copyright (C) 2006 Catalyst IT Ltd http://catalyst.net.nz * */ -defined('INTERNAL') || die(); - /** * Checks whether the given value is shorter than the allowed length. * - * @param Form $form The form the rule is being applied to - * @param string $value The value to check - * @param array $element The element to check - * @param int $minlength The length to check for - * @return string The error message, if the value is invalid. + * @param PieForm $form The form the rule is being applied to + * @param string $value The value to check + * @param array $element The element to check + * @param int $minlength The length to check for + * @return string The error message, if the value is invalid. */ -function form_rule_minlength(Form $form, $value, $element, $minlength) { +function pieform_rule_minlength(Pieform $form, $value, $element, $minlength) { if (strlen($value) < $minlength) { return sprintf($form->i18n('minlength'), $minlength); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ora...@us...> - 2006-11-18 12:26:18
|
Revision: 26 http://svn.sourceforge.net/pieforms/?rev=26&view=rev Author: oracleshinoda Date: 2006-11-18 04:26:16 -0800 (Sat, 18 Nov 2006) Log Message: ----------- Fixed the maxlength rule Modified Paths: -------------- pieforms/src/pieform/rules/maxlength.php Modified: pieforms/src/pieform/rules/maxlength.php =================================================================== --- pieforms/src/pieform/rules/maxlength.php 2006-11-18 12:21:55 UTC (rev 25) +++ pieforms/src/pieform/rules/maxlength.php 2006-11-18 12:26:16 UTC (rev 26) @@ -1,6 +1,6 @@ <?php /** - * This program is part of Mahara + * This program is part of Pieforms * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,26 +16,24 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * - * @package mahara - * @subpackage form-rule + * @package pieform + * @subpackage rule * @author Nigel McNie <ni...@ca...> * @license http://www.gnu.org/copyleft/gpl.html GNU GPL - * @copyright (C) 2006,2007 Catalyst IT Ltd http://catalyst.net.nz + * @copyright (C) 2006 Catalyst IT Ltd http://catalyst.net.nz * */ -defined('INTERNAL') || die(); - /** * Checks whether the given value is longer than the allowed length. * - * @param Form $form The form the rule is being applied to - * @param string $value The value to check - * @param array $element The element to check - * @param int $maxlength The length to check for - * @return string The error message, if the value is invalid. + * @param Pieform $form The form the rule is being applied to + * @param string $value The value to check + * @param array $element The element to check + * @param int $maxlength The length to check for + * @return string The error message, if the value is invalid. */ -function form_rule_maxlength(Form $form, $value, $element, $maxlength) { +function pieform_rule_maxlength(Pieform $form, $value, $element, $maxlength) { if (strlen($value) > $maxlength) { return sprintf($form->i18n('maxlength'), $maxlength); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ora...@us...> - 2006-11-18 12:21:57
|
Revision: 25 http://svn.sourceforge.net/pieforms/?rev=25&view=rev Author: oracleshinoda Date: 2006-11-18 04:21:55 -0800 (Sat, 18 Nov 2006) Log Message: ----------- Multicolumntable renderer: * Fixed headers * Re-ordered some functions (so the phpdoc is for the right function) * Added some todo items * One feature request (1598823) and one bug (1598825) as a result of cleaning up the file Modified Paths: -------------- pieforms/src/pieform/renderers/multicolumntable.php Modified: pieforms/src/pieform/renderers/multicolumntable.php =================================================================== --- pieforms/src/pieform/renderers/multicolumntable.php 2006-11-18 12:00:03 UTC (rev 24) +++ pieforms/src/pieform/renderers/multicolumntable.php 2006-11-18 12:21:55 UTC (rev 25) @@ -1,6 +1,6 @@ <?php /** - * This program is part of Mahara + * This program is part of Pieforms * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,18 +16,23 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * - * @package mahara - * @subpackage form-renderer + * @package pieform + * @subpackage renderer * @author Penny Leach <pe...@ca...> * @license http://www.gnu.org/copyleft/gpl.html GNU GPL - * @copyright (C) 2006,2007 Catalyst IT Ltd http://catalyst.net.nz + * @copyright (C) 2006 Catalyst IT Ltd http://catalyst.net.nz * */ -defined('INTERNAL') || die(); +// @todo this renderer needs to take into account potentially being called more +// than once in the same PHP script (clobbering of the $formrenderermct variable). +// Also, not sure what 'static $var' does in global scope... +require_once(dirname(__FILE__) . '/table.php'); +static $formrenderermct; /** - * Renders form elements inside a <table>. + * Renders form elements inside a <table>. If elements have the same title, + * they will be rendered in the same table row, allowing a grid layout. * * @param string $builtelement The element, already built * @param array $rawelement The element in raw form, for looking up @@ -35,25 +40,21 @@ * @return string The element rendered inside an appropriate * container. */ - -require_once(dirname(__FILE__) . '/table.php'); -static $formrenderermct; - -function form_renderer_multicolumntable_messages_js($id, $submitid) { - return form_renderer_table_messages_js($id, $submitid); -} - -function form_renderer_multicolumntable($builtelement, $rawelement) { +function pieform_renderer_multicolumntable($builtelement, $rawelement) { global $formrenderermct; $formrenderermct->add_element($builtelement, $rawelement); } -function form_renderer_multicolumntable_header() { +function pieform_renderer_multicolumntable_messages_js($id, $submitid) { + return pieform_renderer_table_messages_js($id, $submitid); +} + +function pieform_renderer_multicolumntable_header() { global $formrenderermct; $formrenderermct = new FormRendererMultiColumnTable(); } -function form_renderer_multicolumntable_footer() { +function pieform_renderer_multicolumntable_footer() { global $formrenderermct; return $formrenderermct->build(); } @@ -82,25 +83,34 @@ $result .= ' class="' . $data['settings']['class'] . '"'; } $result .= ">\n\t\t"; + $result .= '<th>'; if (isset($data['settings']['title'])) { - $result .= hsc($data['settings']['title']); + $result .= Pieform::hsc($data['settings']['title']); } $result .= "</th>\n\t"; + foreach ($data['builtelements'] as $k => $builtelement) { $rawelement = $data['rawelements'][$k]; - $result .= "\t<td id=\"" . $rawelement['name'] . '_container"'; + $result .= "\t<td"; + if (isset($rawelement['name'])) { + $result .= " id=\"" . $rawelement['name'] . '_container"'; + } if ($rawelement['class']) { $result .= ' class="' . $rawelement['class'] . '"'; } $result .= '>'; + $result .= $builtelement; + // Contextual help if (!empty($rawelement['help'])) { $result .= ' <span class="help"><a href="#" title="' - . hsc($rawelement['help']) . '">?</a></span>'; + . Pieform::hsc($rawelement['help']) . '">?</a></span>'; } $result .= "</td>\n\t"; + + // @todo description... } $result .= "</tr>\n"; } @@ -110,4 +120,4 @@ } -?> \ No newline at end of file +?> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ora...@us...> - 2006-11-18 12:00:09
|
Revision: 24 http://svn.sourceforge.net/pieforms/?rev=24&view=rev Author: oracleshinoda Date: 2006-11-18 04:00:03 -0800 (Sat, 18 Nov 2006) Log Message: ----------- Cleaned up header and fixed implementation of email rule Modified Paths: -------------- pieforms/src/pieform/rules/email.php Modified: pieforms/src/pieform/rules/email.php =================================================================== --- pieforms/src/pieform/rules/email.php 2006-11-18 11:53:53 UTC (rev 23) +++ pieforms/src/pieform/rules/email.php 2006-11-18 12:00:03 UTC (rev 24) @@ -1,6 +1,6 @@ <?php /** - * This program is part of Mahara + * This program is part of Pieforms * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,28 +16,26 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * - * @package mahara - * @subpackage form-rule + * @package pieform + * @subpackage rule * @author Nigel McNie <ni...@ca...> * @license http://www.gnu.org/copyleft/gpl.html GNU GPL - * @copyright (C) 2006,2007 Catalyst IT Ltd http://catalyst.net.nz + * @copyright (C) 2006 Catalyst IT Ltd http://catalyst.net.nz * */ -defined('INTERNAL') || die(); - /** * Returns whether the given field is a valid e-mail address. * * Currently, the check is [anything]@[anything]. Someone is welcome to write * something better, this was made just for testing. * - * @param Form $form The form the rule is being applied to - * @param string $value The e-mail address to check - * @return string The error message, if there is something wrong with - * the address. + * @param Pieform $form The form the rule is being applied to + * @param string $value The e-mail address to check + * @return string The error message, if there is something wrong with + * the address. */ -function form_rule_email(Form $form, $value) { +function form_rule_email(Pieform $form, $value) { if (!preg_match('/^(.*)@(.*)\.(.*)$/', $value)) { return $form->i18n('email'); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ora...@us...> - 2006-11-18 11:53:55
|
Revision: 23 http://svn.sourceforge.net/pieforms/?rev=23&view=rev Author: oracleshinoda Date: 2006-11-18 03:53:53 -0800 (Sat, 18 Nov 2006) Log Message: ----------- * Updated the <div> renderer to match the <table> renderer much more closely. * Updated the header comment to be correct * Added javascript for adding/removing errors and messages. Totally untested (there's no js in SVN to test with) * Fixed hsc() -> Pieform::hsc() Modified Paths: -------------- pieforms/src/pieform/renderers/div.php Modified: pieforms/src/pieform/renderers/div.php =================================================================== --- pieforms/src/pieform/renderers/div.php 2006-11-18 11:51:58 UTC (rev 22) +++ pieforms/src/pieform/renderers/div.php 2006-11-18 11:53:53 UTC (rev 23) @@ -1,6 +1,6 @@ <?php /** - * This program is part of Mahara + * This program is part of Pieforms * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,18 +16,16 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * - * @package mahara - * @subpackage form-renderer + * @package pieform + * @subpackage renderer * @author Nigel McNie <ni...@ca...> * @license http://www.gnu.org/copyleft/gpl.html GNU GPL - * @copyright (C) 2006,2007 Catalyst IT Ltd http://catalyst.net.nz + * @copyright (C) 2006 Catalyst IT Ltd http://catalyst.net.nz * */ -defined('INTERNAL') || die(); - /** - * Default renderer - renders form elements inside <div>s. + * Renders form elements inside <div>s. * * @param string $builtelement The element, already built * @param array $rawelement The element in raw form, for looking up @@ -35,37 +33,84 @@ * @return string The element rendered inside an appropriate * container. */ -function form_renderer_div($builtelement, $rawelement) { +function pieform_renderer_div($builtelement, $rawelement) { // Set the class of the enclosing <div> to match that of the element $result = '<div'; + if (isset($rawelement['name'])) { + $result .= ' id="' . $rawelement['name'] . '_container"'; + } if ($rawelement['class']) { $result .= ' class="' . $rawelement['class'] . '"'; } $result .= '>'; - if (isset($rawelement['title']) && $rawelement['type'] != 'fieldset') { - $result .= '<label for="' . $rawelement['id'] . '">' . hsc($rawelement['title']) . '</label>'; + if (isset($rawelement['title']) && $rawelement['title'] !== '' && $rawelement['type'] != 'fieldset') { + if (!empty($rawelement['nolabel'])) { + // Don't bother with a label for the element + $result .= Pieform::hsc($rawelement['title']); + } + else { + $result .= '<label for="' . $rawelement['id'] . '">' . Pieform::hsc($rawelement['title']) . '</label>'; + } } $result .= $builtelement; // Contextual help if (!empty($rawelement['help'])) { - $result .= ' <span class="help"><a href="#" title="' . hsc($rawelement['help']) . '">?</a></span>'; + $result .= ' <span class="help"><a href="#" title="' . Pieform::hsc($rawelement['help']) . '">?</a></span>'; } // Description - optional description of the element, or other note that should be visible // on the form itself (without the user having to hover over contextual help if (!empty($rawelement['description'])) { - $result .= '<div class="description"> ' . hsc($rawelement['description']) . "</div>"; + $result .= '<div class="description"> ' . Pieform::hsc($rawelement['description']) . "</div>"; } if (!empty($rawelement['error'])) { - $result .= '<div class="errmsg">' . hsc($rawelement['error']) . '</div>'; + $result .= '<div class="errmsg">' . Pieform::hsc($rawelement['error']) . '</div>'; } $result .= "</div>\n"; return $result; } +function pieform_renderer_table_messages_js($id, $submitid) { + $result = <<<EOF +// Given a message and form element name, should set an error on the element +function {$id}_set_error(message, element) { + {$id}_remove_error(element); + element += '_container'; + // @todo set error class on input elements... + $(element).parentNode.insertBefore(DIV({'id': '{$id}_error_' + element, 'class': 'errmsg'}, message), $(element).nextSibling); +} +// Given a form element name, should remove an error associated with it +function {$id}_remove_error(element) { + element += '_container'; + var elem = $('{$id}_error_' + element); + if (elem) { + removeElement(elem); + } +} +function {$id}_message(message, type) { + var elem = $('{$id}_message'); + var msg = DIV({'id': '{$id}_message', 'class': type}, message); + if (elem) { + swapDOM(elem, msg); + } + else { + appendChildNodes($('{$submitid}_container').parentNode, msg); + } +} +function {$id}_remove_message() { + var elem = $('{$id}_message'); + if (elem) { + removeElement(elem); + } +} + +EOF; + return $result; +} + ?> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ora...@us...> - 2006-11-18 11:52:03
|
Revision: 22 http://svn.sourceforge.net/pieforms/?rev=22&view=rev Author: oracleshinoda Date: 2006-11-18 03:51:58 -0800 (Sat, 18 Nov 2006) Log Message: ----------- Do not make labels for elements if they have specified it but it is empty. This causes feature request 1598819. Fixed a typo in a comment Modified Paths: -------------- pieforms/src/pieform/renderers/table.php Modified: pieforms/src/pieform/renderers/table.php =================================================================== --- pieforms/src/pieform/renderers/table.php 2006-11-18 11:28:22 UTC (rev 21) +++ pieforms/src/pieform/renderers/table.php 2006-11-18 11:51:58 UTC (rev 22) @@ -60,9 +60,9 @@ $result .= ">\n\t\t"; $result .= '<th>'; - if (isset($rawelement['title'])) { + if (isset($rawelement['title']) && $rawelement['title'] !== '') { if (!empty($rawelement['nolabel'])) { - // Don't bother with a lable for the element + // Don't bother with a label for the element $result .= Pieform::hsc($rawelement['title']); } else { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ora...@us...> - 2006-11-18 11:28:24
|
Revision: 21 http://svn.sourceforge.net/pieforms/?rev=21&view=rev Author: oracleshinoda Date: 2006-11-18 03:28:22 -0800 (Sat, 18 Nov 2006) Log Message: ----------- Did some cosmetic fixing of the WYSIWYG element. It doesn't actually render a wysiwyg at the moment though (no javascript in SVN), and should be renamed to 'tinymce', but at least the fallback behaviour works Modified Paths: -------------- pieforms/src/pieform/elements/wysiwyg.php Modified: pieforms/src/pieform/elements/wysiwyg.php =================================================================== --- pieforms/src/pieform/elements/wysiwyg.php 2006-11-18 11:24:34 UTC (rev 20) +++ pieforms/src/pieform/elements/wysiwyg.php 2006-11-18 11:28:22 UTC (rev 21) @@ -24,8 +24,6 @@ * */ - - /** * Renders a textarea, but with extra javascript to turn it into a wysigyw * textarea. @@ -37,7 +35,7 @@ * @param Pieform $form The form to render the element for * @return string The HTML for the element */ -function pieform_render_wysiwyg($element, $form) { +function pieform_render_wysiwyg($element, Pieform $form) { $rows = $cols = $style = ''; if (isset($element['height'])) { $style .= 'height:' . $element['height'] . ';'; @@ -65,7 +63,7 @@ . (($rows) ? ' rows="' . $rows . '"' : '') . (($cols) ? ' cols="' . $cols . '"' : '') . Pieform::element_attributes($element, array('maxlength', 'size')) - . '>' . hsc($form->get_value($element)) . '</textarea>'; + . '>' . Pieform::hsc($form->get_value($element)) . '</textarea>'; } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ora...@us...> - 2006-11-18 11:24:42
|
Revision: 20 http://svn.sourceforge.net/pieforms/?rev=20&view=rev Author: oracleshinoda Date: 2006-11-18 03:24:34 -0800 (Sat, 18 Nov 2006) Log Message: ----------- Removed the custom userlist element. It's too much dependent on the Mahara project. Removed Paths: ------------- pieforms/src/pieform/elements/userlist.php Deleted: pieforms/src/pieform/elements/userlist.php =================================================================== --- pieforms/src/pieform/elements/userlist.php 2006-11-18 11:20:10 UTC (rev 19) +++ pieforms/src/pieform/elements/userlist.php 2006-11-18 11:24:34 UTC (rev 20) @@ -1,106 +0,0 @@ -<?php -/** - * This program is part of Pieforms - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - * - * @package pieform - * @subpackage element - * @author Martyn Smith <ma...@ca...> - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL - * @copyright (C) 2006 Catalyst IT Ltd http://catalyst.net.nz - * - */ - - - -/** - * Provides a basic text field input. - * - * @todo this is just lies ... - * @param array $element The element to render - * @param Pieform $form The form to render the element for - * @return string The HTML for the element - */ -function pieform_render_userlist($element, Pieform $form) { - $smarty = smarty(); - - $smarty->left_delimiter = '{{'; - $smarty->right_delimiter = '}}'; - - $value = $form->get_value($element); - - if (!is_array($value) && isset($element['defaultvalue']) && is_array($element['defaultvalue'])) { - $value = $element['defaultvalue']; - } - - if (is_array($value) && count($value)) { - $members = get_records_select('usr','id IN (' . join(',',$value) . ')', null, '', 'id,firstname,lastname,preferredname'); - - foreach($members as &$member) { - $member = display_name($member); - } - - $smarty->assign('options',$members); - $smarty->assign('value', join(',',$value)); - } - - $smarty->assign('name', $element['name']); - if (!empty($element['filter'])) { - $smarty->assign('filter', true); - } - - return $smarty->fetch('form/userlist.tpl'); -} - -function pieform_get_value_userlist($element, Pieform $form) { - $name = $element['name']; - - $global = ($form->get_method() == 'get') ? $_GET : $_POST; - - if (isset($global[$name])) { - $value = $global[$name]; - - if ($value == '') { - return array(); - } - - if (preg_match('/^(\d+(,\d+)*)$/',$value)) { - return array_map('intval', explode(',', $value)); - } - - throw new PieformException("Invalid value for userlist form element '$name' = '$value'"); - } - - return null; -} - -function pieform_is_empty_userlist($value, $element) { - if (is_array($value) && count($value)) { - return false; - } - - return true; -} - -function pieform_render_userlist_set_attributes($element) { - // By default, use the filter select box - if (!isset($element['filter'])) { - $element['filter'] = true; - } - return $element; -} - -?> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ora...@us...> - 2006-11-18 11:20:12
|
Revision: 19 http://svn.sourceforge.net/pieforms/?rev=19&view=rev Author: oracleshinoda Date: 2006-11-18 03:20:10 -0800 (Sat, 18 Nov 2006) Log Message: ----------- Fixed the 'textarea' element: hsc() replaced with Pieform::hsc() Modified Paths: -------------- pieforms/src/pieform/elements/textarea.php Modified: pieforms/src/pieform/elements/textarea.php =================================================================== --- pieforms/src/pieform/elements/textarea.php 2006-11-18 11:17:37 UTC (rev 18) +++ pieforms/src/pieform/elements/textarea.php 2006-11-18 11:20:10 UTC (rev 19) @@ -24,16 +24,14 @@ * */ - - /** * Renders a basic HTML <textarea> element. * - * @param array $element The element to render + * @param array $element The element to render * @param Pieform $form The form to render the element for - * @return string The HTML for the element + * @return string The HTML for the element */ -function pieform_render_textarea($element, $form) { +function pieform_render_textarea($element, Pieform $form) { $rows = $cols = $style = ''; if (isset($element['height'])) { $style .= 'height:' . $element['height'] . ';'; @@ -61,7 +59,7 @@ . (($rows) ? ' rows="' . $rows . '"' : '') . (($cols) ? ' cols="' . $cols . '"' : '') . Pieform::element_attributes($element, array('maxlength', 'size')) - . '>' . hsc($form->get_value($element)) . '</textarea>'; + . '>' . Pieform::hsc($form->get_value($element)) . '</textarea>'; } ?> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ora...@us...> - 2006-11-18 11:17:40
|
Revision: 18 http://svn.sourceforge.net/pieforms/?rev=18&view=rev Author: oracleshinoda Date: 2006-11-18 03:17:37 -0800 (Sat, 18 Nov 2006) Log Message: ----------- Fixed whitespace in 'text' element comment Modified Paths: -------------- pieforms/src/pieform/elements/text.php Modified: pieforms/src/pieform/elements/text.php =================================================================== --- pieforms/src/pieform/elements/text.php 2006-11-18 11:15:24 UTC (rev 17) +++ pieforms/src/pieform/elements/text.php 2006-11-18 11:17:37 UTC (rev 18) @@ -27,9 +27,9 @@ /** * Provides a basic text field input. * - * @param array $element The element to render + * @param array $element The element to render * @param Pieform $form The form to render the element for - * @return string The HTML for the element + * @return string The HTML for the element */ function pieform_render_text($element, $form) { return '<input type="text"' This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ora...@us...> - 2006-11-18 11:15:24
|
Revision: 17 http://svn.sourceforge.net/pieforms/?rev=17&view=rev Author: oracleshinoda Date: 2006-11-18 03:15:24 -0800 (Sat, 18 Nov 2006) Log Message: ----------- Fixed the 'submitcancel' element: missed converting a call to form_render_cancel Modified Paths: -------------- pieforms/src/pieform/elements/submitcancel.php Modified: pieforms/src/pieform/elements/submitcancel.php =================================================================== --- pieforms/src/pieform/elements/submitcancel.php 2006-11-18 11:11:48 UTC (rev 16) +++ pieforms/src/pieform/elements/submitcancel.php 2006-11-18 11:15:24 UTC (rev 17) @@ -24,14 +24,12 @@ * */ - - /** * Renders a submit and cancel button * - * @param array $element The element to render + * @param array $element The element to render * @param Pieform $form The form to render the element for - * @return string The HTML for the element + * @return string The HTML for the element */ function pieform_render_submitcancel($element, Pieform $form) { require_once('submit.php'); @@ -40,7 +38,7 @@ $submitelement['value'] = $element['value'][0]; $cancelelement = $element; $cancelelement['value'] = $element['value'][1]; - return pieform_render_submit($submitelement, $form) . ' ' . form_render_cancel($cancelelement, $form); + return pieform_render_submit($submitelement, $form) . ' ' . pieform_render_cancel($cancelelement, $form); } function pieform_render_submitcancel_set_attributes($element) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ora...@us...> - 2006-11-18 11:11:48
|
Revision: 16 http://svn.sourceforge.net/pieforms/?rev=16&view=rev Author: oracleshinoda Date: 2006-11-18 03:11:48 -0800 (Sat, 18 Nov 2006) Log Message: ----------- Fixed the 'select' element: hsc() replaced with Pieform::hsc() Modified Paths: -------------- pieforms/src/pieform/elements/select.php Modified: pieforms/src/pieform/elements/select.php =================================================================== --- pieforms/src/pieform/elements/select.php 2006-11-18 11:08:02 UTC (rev 15) +++ pieforms/src/pieform/elements/select.php 2006-11-18 11:11:48 UTC (rev 16) @@ -24,14 +24,12 @@ * */ - - /** * Renders a dropdown list, including support for multiple choices. * - * @param array $element The element to render + * @param array $element The element to render * @param Pieform $form The form to render the element for - * @return string The HTML for the element + * @return string The HTML for the element */ function pieform_render_select($element, Pieform $form) { if (!empty($element['multiple'])) { @@ -78,7 +76,7 @@ else { $selected = ''; } - $result .= "\t<option value=\"" . hsc($key) . "\"$selected>" . hsc($value) . "</option>\n"; + $result .= "\t<option value=\"" . Pieform::hsc($key) . "\"$selected>" . Pieform::hsc($value) . "</option>\n"; } $result .= '</select>'; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ora...@us...> - 2006-11-18 11:08:02
|
Revision: 15 http://svn.sourceforge.net/pieforms/?rev=15&view=rev Author: oracleshinoda Date: 2006-11-18 03:08:02 -0800 (Sat, 18 Nov 2006) Log Message: ----------- Fixed the 'radio' element: hsc() replaced with Pieform::hsc() Modified Paths: -------------- pieforms/src/pieform/elements/radio.php Modified: pieforms/src/pieform/elements/radio.php =================================================================== --- pieforms/src/pieform/elements/radio.php 2006-11-18 11:04:43 UTC (rev 14) +++ pieforms/src/pieform/elements/radio.php 2006-11-18 11:08:02 UTC (rev 15) @@ -24,14 +24,12 @@ * */ - - /** * Renders a set of radio buttons for a form * - * @param array $element The element to render + * @param array $element The element to render * @param Pieform $form The form to render the element for - * @return string The HTML for the element + * @return string The HTML for the element */ function pieform_render_radio($element, Pieform $form) { if (!isset($element['options']) || !is_array($element['options']) || count($element['options']) < 1) { @@ -52,9 +50,9 @@ $element['id'] = $uid; $result .= '<input type="radio"' . Pieform::element_attributes($element) - . ' value="' . hsc($value) . '"' + . ' value="' . Pieform::hsc($value) . '"' . (($form_value == $value) ? ' checked="checked"' : '') - . "> <label for=\"$uid\">" . hsc($text) . "</label>$separator"; + . "> <label for=\"$uid\">" . Pieform::hsc($text) . "</label>$separator"; } $result = substr($result, 0, -strlen($separator)); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ora...@us...> - 2006-11-18 11:04:43
|
Revision: 14 http://svn.sourceforge.net/pieforms/?rev=14&view=rev Author: oracleshinoda Date: 2006-11-18 03:04:43 -0800 (Sat, 18 Nov 2006) Log Message: ----------- Prevent HTML elements from having a label Modified Paths: -------------- pieforms/src/pieform/elements/html.php Modified: pieforms/src/pieform/elements/html.php =================================================================== --- pieforms/src/pieform/elements/html.php 2006-11-18 11:02:17 UTC (rev 13) +++ pieforms/src/pieform/elements/html.php 2006-11-18 11:04:43 UTC (rev 14) @@ -36,4 +36,9 @@ return $element['value']; } +function pieform_render_html_set_attributes($element) { + $element['nolabel'] = true; + return $element; +} + ?> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ora...@us...> - 2006-11-18 11:02:17
|
Revision: 13 http://svn.sourceforge.net/pieforms/?rev=13&view=rev Author: oracleshinoda Date: 2006-11-18 03:02:17 -0800 (Sat, 18 Nov 2006) Log Message: ----------- Fixed the 'password' element: hsc() replaced with Pieform::hsc() Modified Paths: -------------- pieforms/src/pieform/elements/password.php Modified: pieforms/src/pieform/elements/password.php =================================================================== --- pieforms/src/pieform/elements/password.php 2006-11-18 10:59:20 UTC (rev 12) +++ pieforms/src/pieform/elements/password.php 2006-11-18 11:02:17 UTC (rev 13) @@ -24,19 +24,17 @@ * */ - - /** * Renders a password field * - * @param array $element The element to render + * @param array $element The element to render * @param Pieform $form The form to render the element for - * @return string The HTML for the element + * @return string The HTML for the element */ -function pieform_render_password($element, $form) { +function pieform_render_password($element, Pieform $form) { return '<input type="password"' . Pieform::element_attributes($element) - . ' value="' . hsc($form->get_value($element)) . '">'; + . ' value="' . Pieform::hsc($form->get_value($element)) . '">'; } function pieform_get_value_password($element, Pieform $form) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ora...@us...> - 2006-11-18 10:59:20
|
Revision: 12 http://svn.sourceforge.net/pieforms/?rev=12&view=rev Author: oracleshinoda Date: 2006-11-18 02:59:20 -0800 (Sat, 18 Nov 2006) Log Message: ----------- Cleaned up the 'html' element Modified Paths: -------------- pieforms/src/pieform/elements/html.php Modified: pieforms/src/pieform/elements/html.php =================================================================== --- pieforms/src/pieform/elements/html.php 2006-11-18 10:54:46 UTC (rev 11) +++ pieforms/src/pieform/elements/html.php 2006-11-18 10:59:20 UTC (rev 12) @@ -24,17 +24,15 @@ * */ - - /** * Provides a way to pass in html that gets rendered * by the render (as opposed to the markup element) * - * @param array $element The element to render + * @param array $element The element to render * @param Pieform $form The form to render the element for - * @return string The HTML for the element + * @return string The HTML for the element */ -function pieform_render_html($element, $form) { +function pieform_render_html($element, Pieform $form) { return $element['value']; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ora...@us...> - 2006-11-18 10:54:46
|
Revision: 11 http://svn.sourceforge.net/pieforms/?rev=11&view=rev Author: oracleshinoda Date: 2006-11-18 02:54:46 -0800 (Sat, 18 Nov 2006) Log Message: ----------- Cleaned up the 'file' element Modified Paths: -------------- pieforms/src/pieform/elements/file.php Modified: pieforms/src/pieform/elements/file.php =================================================================== --- pieforms/src/pieform/elements/file.php 2006-11-18 10:51:35 UTC (rev 10) +++ pieforms/src/pieform/elements/file.php 2006-11-18 10:54:46 UTC (rev 11) @@ -24,14 +24,12 @@ * */ - - /** * Renders a basic HTML <input type="file"> element. * - * @param array $element The element to render + * @param array $element The element to render * @param Pieform $form The form to render the element for - * @return string The HTML for the element + * @return string The HTML for the element */ function pieform_render_file($element, Pieform $form) { return '<input type="file"' This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ora...@us...> - 2006-11-18 10:51:35
|
Revision: 10 http://svn.sourceforge.net/pieforms/?rev=10&view=rev Author: oracleshinoda Date: 2006-11-18 02:51:35 -0800 (Sat, 18 Nov 2006) Log Message: ----------- Fixed the 'fieldset' element Modified Paths: -------------- pieforms/src/pieform/elements/fieldset.php Modified: pieforms/src/pieform/elements/fieldset.php =================================================================== --- pieforms/src/pieform/elements/fieldset.php 2006-11-18 10:48:07 UTC (rev 9) +++ pieforms/src/pieform/elements/fieldset.php 2006-11-18 10:51:35 UTC (rev 10) @@ -35,7 +35,7 @@ function pieform_render_fieldset($element, Pieform $form) { $result = "\n<fieldset>\n"; if (isset($element['legend'])) { - $result .= '<legend>' . hsc($element['legend']) . "</legend>\n"; + $result .= '<legend>' . Pieform::hsc($element['legend']) . "</legend>\n"; } foreach ($element['elements'] as $subname => $subelement) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ora...@us...> - 2006-11-18 10:48:07
|
Revision: 9 http://svn.sourceforge.net/pieforms/?rev=9&view=rev Author: oracleshinoda Date: 2006-11-18 02:48:07 -0800 (Sat, 18 Nov 2006) Log Message: ----------- Fixed the 'expiry' element Modified Paths: -------------- pieforms/src/pieform/elements/expiry.php Modified: pieforms/src/pieform/elements/expiry.php =================================================================== --- pieforms/src/pieform/elements/expiry.php 2006-11-18 10:35:50 UTC (rev 8) +++ pieforms/src/pieform/elements/expiry.php 2006-11-18 10:48:07 UTC (rev 9) @@ -77,7 +77,7 @@ $uselect = '<select ' . ($form->get_ajaxpost() ? 'onchange="' . $name . '_change()" ' : ''); $uselect .= 'name="' . $name . '_units" id="' . $name . '_units"' . ">\n"; foreach ($allunits as $u) { - $uselect .= "\t<option value=\"$u\"" . (($values['units'] == $u) ? ' selected="selected"' : '') . '>' . get_string($u) . "</option>\n"; + $uselect .= "\t<option value=\"$u\"" . (($values['units'] == $u) ? ' selected="selected"' : '') . '>' . $form->i18n($u) . "</option>\n"; } $uselect .= "</select>\n"; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ora...@us...> - 2006-11-18 10:35:56
|
Revision: 8 http://svn.sourceforge.net/pieforms/?rev=8&view=rev Author: oracleshinoda Date: 2006-11-18 02:35:50 -0800 (Sat, 18 Nov 2006) Log Message: ----------- Fixed the date element Modified Paths: -------------- pieforms/src/pieform/elements/date.php Modified: pieforms/src/pieform/elements/date.php =================================================================== --- pieforms/src/pieform/elements/date.php 2006-11-18 10:32:14 UTC (rev 7) +++ pieforms/src/pieform/elements/date.php 2006-11-18 10:35:50 UTC (rev 8) @@ -41,21 +41,21 @@ } // Year - $value = form_render_select_get_value('year', $element['minyear'], $element['maxyear'], $element, $form); + $value = pieform_render_select_get_value('year', $element['minyear'], $element['maxyear'], $element, $form); $year = '<select name="' . $name . "_year\">\n"; for ($i = $element['minyear']; $i <= $element['maxyear']; $i++) { $year .= "\t<option value=\"$i\"" . (($value == $i) ? ' selected="selected"' : '') . ">$i</option>\n"; } $year .= "</select>\n"; - $value = form_render_select_get_value('month', 1, 12, $element, $form); + $value = pieform_render_select_get_value('month', 1, 12, $element, $form); $month = '<select name="' . $name . "_month\">\n"; for ($i = 1; $i <= 12; $i++) { $month .= "\t<option value=\"$i\"" . (($value == $i) ? ' selected="selected"' : '') . '>' . date('M', strtotime("2000-$i-01")) . "</option>\n"; } $month .= "</select>\n"; - $value = form_render_select_get_value('day', 1, 31, $element, $form); + $value = pieform_render_select_get_value('day', 1, 31, $element, $form); $day = '<select name="' . $name . "_day\">\n"; for ($i = 1; $i <= 31; $i++) { $day .= "\t<option value=\"$i\"" . (($value == $i) ? ' selected="selected"' : '') . ">$i</option>\n"; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ora...@us...> - 2006-11-18 10:32:14
|
Revision: 7 http://svn.sourceforge.net/pieforms/?rev=7&view=rev Author: oracleshinoda Date: 2006-11-18 02:32:14 -0800 (Sat, 18 Nov 2006) Log Message: ----------- Added todo about 'value' and 'checked' for checkboxes, behaviour seems arbitrary at best Modified Paths: -------------- pieforms/src/pieform/elements/checkbox.php Modified: pieforms/src/pieform/elements/checkbox.php =================================================================== --- pieforms/src/pieform/elements/checkbox.php 2006-11-18 10:26:49 UTC (rev 6) +++ pieforms/src/pieform/elements/checkbox.php 2006-11-18 10:32:14 UTC (rev 7) @@ -33,6 +33,8 @@ */ function pieform_render_checkbox($element, Pieform $form) { $checked = false; + // @todo use of 'value' and 'checked' here is ambiguous, need to write + // test cases and pick just one of them if (!empty($element['value'])) { $checked = true; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |