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-22 20:54:10
|
Revision: 67 http://svn.sourceforge.net/pieforms/?rev=67&view=rev Author: oracleshinoda Date: 2006-11-22 12:54:03 -0800 (Wed, 22 Nov 2006) Log Message: ----------- Allow elements to have an 'ignore' parameter - if set, the element will not be output. Useful for keeping form definitions as one big array, instead of if statements and ['foo'] =... madness everywhere. Also copied a couple of checks to fieldset elements Modified Paths: -------------- pieforms-php5/trunk/src/pieform.php Modified: pieforms-php5/trunk/src/pieform.php =================================================================== --- pieforms-php5/trunk/src/pieform.php 2006-11-22 00:40:42 UTC (rev 66) +++ pieforms-php5/trunk/src/pieform.php 2006-11-22 20:54:03 UTC (rev 67) @@ -402,12 +402,16 @@ // Set some attributes for all elements $autofocusadded = false; foreach ($this->elements as $name => &$element) { + if (!empty($element['ignore'])) { + unset($this->elements[$name]); + continue; + } // The name can be in the element itself. This is compatibility for the perl version if (isset($element['name'])) { $name = $element['name']; } if (count($element) == 0) { - throw new PieformException('An element in form "' . $this->name . '" has no data'); + throw new PieformException('An element in form "' . $this->name . '" has no data (' . $name . ')'); } if (!isset($element['type'])) { $element['type'] = 'markup'; @@ -428,6 +432,17 @@ } if ($element['type'] == 'fieldset') { foreach ($element['elements'] as $subname => &$subelement) { + if (!empty($subelement['ignore'])) { + unset($element['elements'][$subname]); + continue; + } + // The name can be in the element itself. This is compatibility for the perl version + if (isset($subelement['name'])) { + $subname = $subelement['name']; + } + if (count($subelement) == 0) { + throw new PieformException('An element in form "' . $this->name . '" has no data (' . $subname . ')'); + } if (!isset($subelement['type'])) { $subelement['type'] = 'markup'; if (!isset($subelement['value'])) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ora...@us...> - 2006-11-22 00:40:59
|
Revision: 66 http://svn.sourceforge.net/pieforms/?rev=66&view=rev Author: oracleshinoda Date: 2006-11-21 16:40:42 -0800 (Tue, 21 Nov 2006) Log Message: ----------- Added a regex rule, for validating against a generic regex Added Paths: ----------- pieforms-php5/trunk/src/pieform/rules/regex.php Added: pieforms-php5/trunk/src/pieform/rules/regex.php =================================================================== --- pieforms-php5/trunk/src/pieform/rules/regex.php (rev 0) +++ pieforms-php5/trunk/src/pieform/rules/regex.php 2006-11-22 00:40:42 UTC (rev 66) @@ -0,0 +1,43 @@ +<?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 rule + * @author Nigel McNie <ni...@ca...> + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL + * @copyright (C) 2006 Catalyst IT Ltd http://catalyst.net.nz + * + */ + +/** + * Returns whether the given field matches the specified regex. + * + * @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 string $regex The regular expression to use for the check + * @return string The error message, if there is something wrong with + * the value. + */ +function pieform_rule_regex(Pieform $form, $value, $element, $regex) { + if (!preg_match($regex, $value)) { + return $form->i18n('regex'); + } +} + +?> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ora...@us...> - 2006-11-22 00:39:23
|
Revision: 65 http://svn.sourceforge.net/pieforms/?rev=65&view=rev Author: oracleshinoda Date: 2006-11-21 16:39:23 -0800 (Tue, 21 Nov 2006) Log Message: ----------- Return value after validating the js callback. Added i18n for the regex rule Modified Paths: -------------- pieforms-php5/trunk/src/pieform.php Modified: pieforms-php5/trunk/src/pieform.php =================================================================== --- pieforms-php5/trunk/src/pieform.php 2006-11-21 22:43:47 UTC (rev 64) +++ pieforms-php5/trunk/src/pieform.php 2006-11-22 00:39:23 UTC (rev 65) @@ -238,7 +238,8 @@ 'maxlength' => 'This field must be at most %d characters long', 'minlength' => 'This field must be at least %d characters long', 'integer' => 'The field must be an integer', - 'validateoptions' => 'The option "%s" is invalid' + 'validateoptions' => 'The option "%s" is invalid', + 'regex' => 'This field is not in valid form' ) ); @@ -1161,6 +1162,7 @@ if (!preg_match('/^[a-zA-Z][a-zA-Z0-9_]*$/', $name)) { throw new PieformException("'$name' is not a valid javascript callback name"); } + return $name; } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |