Commit d7716632e9f8ee45852b142f6e6aa2be2769863d

Authored by Brad Shuttleworth
1 parent 360c473c

minor improvements in the validation API.


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@5988 c91229c3-7414-0410-bfa2-8a42b809f60b
lib/validation/basevalidator.inc.php
... ... @@ -14,9 +14,15 @@ class KTValidator {
14 14 var $aOptions;
15 15  
16 16 function configure($aOptions) {
17   - $this->sInputVariable = KTUtil::arrayGet($aOptions, 'test');
  17 + $this->sInputVariable = KTUtil::arrayGet($aOptions, 'name', KTUtil::arrayGet($aOptions, 'test'));
  18 + if (empty($this->sInputVariable)) { return PEAR::raiseError(_kt("You must specify a variable name")); }
18 19 $this->sBasename = KTUtil::arrayGet($aOptions, 'basename', $this->sInputVariable);
19 20 $this->sOutputVariable = KTUtil::arrayGet($aOptions, 'output');
  21 + if (empty($this->sOutputVariable)) {
  22 + if (!KTUtil::arrayGet($aOptions, 'no_output', false)) {
  23 + $this->sOutputVariable = $this->sInputVariable;
  24 + }
  25 + }
20 26 $this->bProduceOutput = !empty($this->sOutputVariable);
21 27 $this->bRequired = KTUtil::arrayGet($aOptions, 'required', false , false);
22 28  
... ... @@ -33,4 +39,4 @@ class KTValidator {
33 39 }
34 40 }
35 41  
36   -?>
37 42 \ No newline at end of file
  43 +?>
... ...