summaryrefslogtreecommitdiff
path: root/framework
diff options
context:
space:
mode:
Diffstat (limited to 'framework')
-rw-r--r--framework/Util/TDataFieldAccessor.php15
-rwxr-xr-xframework/Web/UI/ActiveControls/TActiveFileUpload.php2
-rw-r--r--framework/Web/UI/WebControls/TBaseValidator.php3
3 files changed, 15 insertions, 5 deletions
diff --git a/framework/Util/TDataFieldAccessor.php b/framework/Util/TDataFieldAccessor.php
index b96cf0c9..24fcbd36 100644
--- a/framework/Util/TDataFieldAccessor.php
+++ b/framework/Util/TDataFieldAccessor.php
@@ -35,7 +35,9 @@ class TDataFieldAccessor
/**
* Evaluates the data value at the specified field.
* - If the data is an array, then the field is treated as an array index
- * and the corresponding element value is returned;
+ * and the corresponding element value is returned; the field name can also include
+ * dots to access subarrays. For example a field named 'MyField.MySubField' will
+ * first try to access $data['MyField.MySubField'], then try $data['MyField']['MySubField'].
* - If the data is a TMap or TList object, then the field is treated as a key
* into the map or list, and the corresponding value is returned.
* - If the data is an object, the field is treated as a property or sub-property
@@ -53,7 +55,15 @@ class TDataFieldAccessor
try
{
if(is_array($data) || ($data instanceof ArrayAccess))
- return $data[$field];
+ {
+ if(isset($data[$field]))
+ return $data[$field];
+
+ $tmp = $data;
+ foreach (explode(".", $field) as $f)
+ $tmp = $tmp[$f];
+ return $tmp;
+ }
else if(is_object($data))
{
if(strpos($field,'.')===false) // simple field
@@ -79,4 +89,3 @@ class TDataFieldAccessor
throw new TInvalidDataValueException('datafieldaccessor_data_invalid',$field);
}
}
-
diff --git a/framework/Web/UI/ActiveControls/TActiveFileUpload.php b/framework/Web/UI/ActiveControls/TActiveFileUpload.php
index ca924026..6c6d4bd1 100755
--- a/framework/Web/UI/ActiveControls/TActiveFileUpload.php
+++ b/framework/Web/UI/ActiveControls/TActiveFileUpload.php
@@ -276,7 +276,7 @@ EOS;
// tricky workaround to intercept "uploaded file too big" error: real uploads happens in onFileUpload instead
$this->_errorCode = UPLOAD_ERR_FORM_SIZE;
$localName = str_replace('\\', '/', tempnam(Prado::getPathOfNamespace($this->getTempPath()),''));
- $filename = addslashes($this->getFileName());
+ $fileName = addslashes($this->getFileName());
$params = new TActiveFileUploadCallbackParams;
$params->localName = $localName;
diff --git a/framework/Web/UI/WebControls/TBaseValidator.php b/framework/Web/UI/WebControls/TBaseValidator.php
index db1bba32..08c677b1 100644
--- a/framework/Web/UI/WebControls/TBaseValidator.php
+++ b/framework/Web/UI/WebControls/TBaseValidator.php
@@ -507,7 +507,6 @@ abstract class TBaseValidator extends TLabel implements IValidator
*/
public function validate()
{
- $this->setIsValid(true);
$this->onValidate();
if($this->getVisible(true) && $this->getEnabled(true))
{
@@ -536,6 +535,8 @@ abstract class TBaseValidator extends TLabel implements IValidator
$this->setIsValid(true);
$this->onValidationSuccess();
}
+ } else {
+ $this->setIsValid(true);
}
return $this->getIsValid();
}