Beispiel #1
0
 function Prepare()
 {
     global $oVDaemonStatus;
     if ($this->ClientValidate()) {
         $sName = VDEscape($this->oNode->aAttrs['name']);
         $this->oNode->aAttrs['onsubmit'] = "return VDValidateForm('{$sName}');";
     }
     foreach ($this->aLabels as $nIdx => $mTmp) {
         $this->aLabels[$nIdx]->Prepare($this);
     }
     foreach ($this->aSummaries as $nIdx => $mTmp) {
         $this->aSummaries[$nIdx]->Prepare($this);
     }
     foreach ($this->oNode->aSubNodes as $nIdx => $mTmp) {
         $oSubNode =& $this->oNode->aSubNodes[$nIdx];
         if (is_object($oSubNode) && in_array($oSubNode->sName, array('vlvalidator', 'vlgroup'))) {
             unset($this->oNode->aSubNodes[$nIdx]);
         }
     }
     foreach ($this->aControls as $sName => $mTmp) {
         $this->aControls[$sName]->Prepare();
     }
     if ($oVDaemonStatus && $this->oNode->aAttrs['name'] == $oVDaemonStatus->sForm && !$oVDaemonStatus->bValid && (!isset($this->oNode->aAttrs['populate']) || strtolower($this->oNode->aAttrs['populate']) != 'false')) {
         foreach ($this->aControls as $sName => $mTmp) {
             $this->aControls[$sName]->Populate();
         }
     }
     $oRuntime =& new CVDValRuntime();
     $oRuntime->Fill($this);
     $this->oNode->aSubNodes[] = "\n";
     $sValue = serialize($oRuntime);
     if (!$sValue) {
         VDErrorMessage(VD_E_SERIALIZE);
         exit;
     }
     $this->oNode->aSubNodes[] =& new XmlNode('input', array('type' => 'hidden', 'name' => 'VDaemonValidators', 'value' => $sValue));
     $this->oNode->aSubNodes[] = "\n";
     unset($this->oNode->aAttrs['clientvalidate']);
     unset($this->oNode->aAttrs['runat']);
     unset($this->oNode->aAttrs['populate']);
 }
Beispiel #2
0
 function Prepare()
 {
     global $oVDaemonStatus;
     foreach ($this->aLabels as $nIdx => $mTmp) {
         $this->aLabels[$nIdx]->Prepare($this);
     }
     foreach ($this->aSummaries as $nIdx => $mTmp) {
         $this->aSummaries[$nIdx]->Prepare($this);
     }
     foreach ($this->aControls as $sName => $mTmp) {
         $this->aControls[$sName]->Prepare();
     }
     $sPopulate = isset($this->oNode->aAttrs['populate']) ? strtolower($this->oNode->aAttrs['populate']) : 'true';
     if ($sPopulate != 'false') {
         $sForm = $sPopulate == 'always' ? $this->sName : '';
         $bPopulate = $sPopulate == 'always' && isset($_SESSION['VDaemonData']['POST'][$sForm]);
         if ($oVDaemonStatus && $this->sName == $oVDaemonStatus->sForm && !$oVDaemonStatus->bValid) {
             $bPopulate = true;
             $sForm = '';
         }
         if ($bPopulate) {
             foreach ($this->aControls as $sName => $mTmp) {
                 $this->aControls[$sName]->Populate($sForm);
             }
         }
     }
     $oRuntime =& new CVDValRuntime();
     $oRuntime->Fill($this);
     $this->oNode->aSubNodes[] = "\n";
     $sValue = serialize($oRuntime);
     $sValue = VDSecurityEncode($sValue);
     if (!$sValue) {
         echo VDErrorMessage(VD_E_SERIALIZE);
         exit;
     }
     $oSubNode =& $this->oNode->AddSubNode('div', array('style' => 'display:none'));
     $oSubNode->AddSubNode('input', array('type' => 'hidden', 'name' => 'VDaemonValidators', 'value' => $sValue));
     $this->oNode->aSubNodes[] = "\n";
     unset($this->oNode->aAttrs['clientvalidate']);
     unset($this->oNode->aAttrs['runat']);
     unset($this->oNode->aAttrs['populate']);
     unset($this->oNode->aAttrs['disablebuttons']);
     unset($this->oNode->aAttrs['validationmode']);
 }