cvs: pear /HTML_Template_Flexy/Flexy/Token Tag.php
| From: | Alan Knowles | Date: | Thu, 20 Feb 2003 16:08:03 +0000 |
| Subject: | cvs: pear /HTML_Template_Flexy/Flexy/Token Tag.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-8975@lists.php.net to get a copy of this message | ||
alan_k Thu Feb 20 11:08:03 2003 EDT
Modified files:
/pear/HTML_Template_Flexy/Flexy/Token Tag.php
Log:
fix textarea and change error handling method to have a matching error object to the form object
for flexyform generation
Index: pear/HTML_Template_Flexy/Flexy/Token/Tag.php
diff -u pear/HTML_Template_Flexy/Flexy/Token/Tag.php:1.16
pear/HTML_Template_Flexy/Flexy/Token/Tag.php:1.17
--- pear/HTML_Template_Flexy/Flexy/Token/Tag.php:1.16 Fri Feb 14 11:17:48 2003
+++ pear/HTML_Template_Flexy/Flexy/Token/Tag.php Thu Feb 20 11:08:02 2003
@@ -16,7 +16,7 @@
// | Authors: Alan Knowles <alan@akbkhome> |
// +----------------------------------------------------------------------+
//
-// $Id: Tag.php,v 1.16 2003/02/14 16:17:48 alan_k Exp $
+// $Id: Tag.php,v 1.17 2003/02/20 16:08:02 alan_k Exp $
/**
* A standard HTML Tag = eg. Table/Body etc.
@@ -274,15 +274,15 @@
$this->postfix = array( $this->factory("Text","<B><font
color=red>Invalid name used for flexy tag :$name: </font></b>",$this->line));
return;
}
-
+ // this will be replaced with a configurable error object - eg
FLEXYERROROBJECT="abcd"
+
+ $errorname = $this->toVar("flexyError." .
$this->getAttribute('NAME'));
- $thisvar = str_replace(']','',$name);
- $thisvar = str_replace('[','.',$thisvar);
$posterror = array(
- $this->factory("PHP", "<?php if
(isset(\$this->errors['".urlencode($thisvar)."'])) { ".
- "echo htmlspecialchars(\$this->errors['".urlencode($thisvar).
"']); } ?>",$this->line));
+ $this->factory("PHP", "<?php if (isset({$errorname})) { ".
+ "echo htmlspecialchars({$errorname}); } ?>",$this->line));
switch ($type) {
@@ -351,18 +351,24 @@
if ($_HTML_TEMPLATE_FLEXY_TOKEN['activeForm']) {
$name = $_HTML_TEMPLATE_FLEXY_TOKEN['activeForm'] .'.'.$name;
}
-
- $thisvar = str_replace(']','',$name);
- $thisvar = str_replace('[','.',$thisvar);
+
+ if
(!preg_match('/^[_A-Z][A-Z0-9_]*(\[[0-9]+\]|\[[A-Z0-9_]+\])?(\.[_A-Z][A-Z0-9_]*(\[[0-9]+\]|\[[A-Z0-9_]+\])?)*$/i',$name))
{
+ $this->postfix = array( $this->factory("Text","<B><font
color=red>Invalid name used for flexy tag :$name: </font></b>",$this->line));
+ return;
+ }
+
+ // this will be replaced with a configurable error object - eg
FLEXYERROROBJECT="abcd"
+
+ $errorname = $this->toVar("flexyError." .
$this->getAttribute('NAME'));
+
+
$posterror = array(
- $this->factory("PHP", "<?php if
(isset(\$this->errors['".urlencode($thisvar)."'])) { ".
- "echo htmlspecialchars(\$this->errors['".urlencode($thisvar).
"']); } ?>",$this->line));
+ $this->factory("PHP", "<?php if (isset({$errorname})) { ".
+ "echo htmlspecialchars({$errorname}); } ?>",$this->line));
- $this->postfix = array(
- $this->factory("Var",$thisvar ,$this->line)
- );
+ $this->postfix = array( $this->factory("Var",$name ,$this->line) );
$this->close->postfix = $posterror;
$this->children = array();
return;