00001 <?PHP 00017 include_once("Password.php"); 00018 00027 class InputPassword extends Password 00028 { 00029 00034 public $m_MaskChar='*'; 00035 00040 public $m_MaskLength=6; 00041 00046 protected $m_Value_Real; 00047 00054 public function readMetaData(&$xmlArr) 00055 { 00056 parent::readMetaData($xmlArr); 00057 $this->m_cssClass = isset($xmlArr["ATTRIBUTES"]["CSSCLASS"]) ? $xmlArr["ATTRIBUTES"]["CSSCLASS"] : "input_text"; 00058 $this->m_cssErrorClass = isset($xmlArr["ATTRIBUTES"]["CSSERRORCLASS"]) ? $xmlArr["ATTRIBUTES"]["CSSERRORCLASS"] : $this->m_cssClass."_error"; 00059 $this->m_cssFocusClass = isset($xmlArr["ATTRIBUTES"]["CSSFOCUSCLASS"]) ? $xmlArr["ATTRIBUTES"]["CSSFOCUSCLASS"] : $this->m_cssClass."_focus"; 00060 00061 $this->m_MaskChar = isset($xmlArr["ATTRIBUTES"]["MASKCHAR"]) ? $xmlArr["ATTRIBUTES"]["MASKCHAR"] : $this->m_MaskChar; 00062 $this->m_MaskLength = isset($xmlArr["ATTRIBUTES"]["MASKLENGTH"]) ? $xmlArr["ATTRIBUTES"]["MASKLENGTH"] : $this->m_MaskLength; 00063 $this->m_PasswordMask = str_repeat($this->m_MaskChar, $this->m_MaskLength); 00064 } 00065 00071 public function render() 00072 { 00073 $value = $this->m_Value; 00074 00075 $this->m_Value_Real = $this->m_Value; 00076 $value = $this->m_PasswordMask; 00077 00078 00079 $disabledStr = ($this->getEnabled() == "N") ? "DISABLED=\"true\"" : ""; 00080 $style = $this->getStyle(); 00081 00082 $func = $this->getEnabled() == 'N' ? "" : $this->getFunction(); 00083 $formobj = $this->GetFormObj(); 00084 if($formobj->m_Errors[$this->m_Name]){ 00085 $func .= "onchange=\"this.className='$this->m_cssClass'\""; 00086 }else{ 00087 $func .= "onfocus=\"this.className='$this->m_cssFocusClass'\" onblur=\"this.className='$this->m_cssClass'\""; 00088 } 00089 $sHTML = "<INPUT TYPE=\"PASSWORD\" NAME='$this->m_Name' ID=\"" . $this->m_Name ."\" VALUE='$value' $disabledStr $this->m_HTMLAttr $style $func />"; 00090 if($this->m_Hint){ 00091 $sHTML.="<script> 00092 \$j('#" . $this->m_Name . "').tbHinter({ 00093 text: '".$this->m_Hint."', 00094 }); 00095 </script>"; 00096 } 00097 return $sHTML; 00098 00099 } 00100 00106 public function getValue() 00107 { 00108 if($this->m_Value==null){ 00109 $this->m_Value = BizSystem::clientProxy()->getFormInputs($this->m_Name); 00110 } 00111 if($this->m_Value==$this->m_PasswordMask) 00112 { 00113 00114 $rawDataArr = $this->getFormObj()->fetchData(); 00115 $this->m_Value_Real = $rawDataArr[$this->m_FieldName]; 00116 $this->m_Value = $rawDataArr[$this->m_FieldName]; 00117 return $this->m_Value_Real; 00118 } 00119 else 00120 { 00121 return $this->m_Value; 00122 } 00123 } 00124 00131 public function setValue($value) 00132 { 00133 if($value==$this->m_PasswordMask) 00134 { 00135 $this->m_Value = $this->m_Value_Real; 00136 } 00137 else 00138 { 00139 $this->m_Value = $value; 00140 } 00141 } 00142 00143 00144 } 00145 00146 ?>