예제 #1
0
 /**
  * Returns a block of XHTML-valid code that contains markup for this specific
  * component. 
  * @param string $fieldName The field name to use when outputting form data or
  * similar parameters/information.
  * @access public
  * @return string
  */
 function getMarkup($fieldName)
 {
     $name = RequestContext::name($fieldName);
     $m = "<input type='text' \n\t\t\t\tname='{$name}' \n\t\t\t\tid='{$fieldName}' \n\t\t\t\tsize='" . $this->_size . "' maxlength='" . $this->_maxlength . "'" . (!$this->isEnabled() ? " readonly='readonly'" : "");
     if ($this->_value != null && $this->_value != $this->_startingDisplay) {
         $m .= " value='" . htmlspecialchars($this->_value, ENT_QUOTES) . "'";
     } else {
         if ($this->_startingDisplay) {
             $v = htmlspecialchars($this->_startingDisplay, ENT_QUOTES);
             $m .= "\n\t\t\t\tvalue='{$v}' style='color: #888' ";
             $m .= "\n\t\t\t\tonfocus='if (this.value == \"{$v}\") { this.value=\"\";  this.style.color=\"#000\";}'";
             $m .= "\n\t\t\t\tonblur='if (this.value == \"\") { this.value=\"{$v}\"; this.style.color=\"#888\";}'";
         }
     }
     if ($this->_style) {
         $m .= "\n\t\t\t\tstyle=\"" . str_replace("\"", "\\\"", $this->_style) . "\"";
     }
     if ($this->_onchange) {
         $m .= "\n\t\t\t\tonchange=\"" . str_replace("\"", "\\\"", $this->_onchange) . "\"";
     }
     $m .= " />";
     $errText = $this->getErrorText();
     $errRule = $this->getErrorRule();
     $errStyle = $this->getErrorStyle();
     if ($errText && $errRule) {
         $m .= "\n\t\t<span id='" . $fieldName . "_error' style=\"padding-left: 10px; {$errStyle}\">&laquo; {$errText}</span>";
         $m .= Wizard::getValidationJavascript($fieldName, $errRule, $fieldName . "_error", $this->_showError);
         $this->_showError = false;
     }
     return $m;
 }
예제 #2
0
 /**
  * Returns a block of XHTML-valid code that contains markup for this specific
  * component. 
  * @param string $fieldName The field name to use when outputting form data or
  * similar parameters/information.
  * @access public
  * @return string
  */
 function getMarkup($fieldName)
 {
     $name = RequestContext::name($fieldName);
     $m = "\n\t\t\t<textarea rows='" . $this->_rows . "' cols='" . $this->_cols . "'";
     if (isset($this->_wrapStyle) && is_string($this->_wrapStyle)) {
         $m .= " wrap='" . $this->_wrapStyle . "'";
     }
     $m .= "\n\t\t\t\tname='{$name}'";
     $m .= "\n\t\t\t\tid='{$name}'";
     $m .= !$this->isEnabled() ? " readonly='readonly'" : "";
     if ($this->_style) {
         $m .= "\n\t\t\t\tstyle=\"" . str_replace("\"", "\\\"", $this->_style) . "\"";
     }
     if ($this->_onchange) {
         $m .= "\n\t\t\t\tonchange=\"" . str_replace("\"", "\\\"", $this->_onchange) . "\"";
     }
     if ($this->_value != null && $this->_value != $this->_startingDisplay) {
         $m .= ">" . htmlspecialchars($this->_value);
     } else {
         if ($this->_startingDisplay) {
             $v = htmlspecialchars($this->_startingDisplay, ENT_QUOTES);
             $m .= "\n\t\t\t\tonfocus='if (this.value == \"{$v}\") { this.value=\"\";   this.style.color=\"#000\";}'";
             $m .= "\n\t\t\t\tonblur='if (this.value == \"\") { this.value=\"{$v}\";  this.style.color=\"#888\";}'";
             $m .= " style='color: #888'>" . $v;
         } else {
             $m .= ">" . htmlspecialchars($this->_value);
         }
     }
     $m .= "</textarea>";
     $errText = $this->getErrorText();
     $errRule = $this->getErrorRule();
     $errStyle = $this->getErrorStyle();
     if ($errText && $errRule) {
         $m .= "<span id='" . $fieldName . "_error' style=\"padding-left: 10px; {$errStyle}\">&laquo; {$errText}</span>";
         $m .= Wizard::getValidationJavascript($fieldName, $errRule, $fieldName . "_error", $this->_showError);
         $this->_showError = false;
     }
     return $m;
 }
예제 #3
0
 /**
  * Returns a block of XHTML-valid code that contains markup for this specific
  * component. 
  * @param string $fieldName The field name to use when outputting form data or
  * similar parameters/information.
  * @access public
  * @return string
  */
 function getMarkup($fieldName)
 {
     ob_start();
     for ($i = 1; $i <= 2; $i++) {
         $name = RequestContext::name($fieldName . "_" . $i);
         $valProp = '_value' . $i;
         $value = $this->{$valProp};
         if ($i > 1) {
             print "\n\t\t<br/>";
         }
         print "<input type='password' \n\t\t\t\tname='{$name}' \n\t\t\t\tid='{$fieldName}' \n\t\t\t\tsize='" . $this->_size . "' maxlength='" . $this->_maxlength . "'" . (!$this->isEnabled() ? " readonly='readonly'" : "");
         if ($value != null) {
             print " value='" . htmlspecialchars($value, ENT_QUOTES) . "'";
         }
         if ($this->_style) {
             print "\n\t\t\t\tstyle=\"" . str_replace("\"", "\\\"", $this->_style) . "\"";
         }
         if ($this->_onchange) {
             print "\n\t\t\t\tonchange=\"" . str_replace("\"", "\\\"", $this->_onchange) . "\"";
         }
         print " />";
     }
     $errText = $this->getErrorText();
     $errRule = $this->getErrorRule();
     $errStyle = $this->getErrorStyle();
     if ($errRule && $errText) {
         print "\n\t\t<span id='" . $fieldName . "_error' style=\"padding-left: 10px; {$errStyle}\">&laquo; {$errText}</span>";
         print Wizard::getValidationJavascript($fieldName, $errRule, $fieldName . "_error", $this->_showError);
         $this->_showError = false;
     }
     if ($this->_showEqualityError == true) {
         $errText = dgettext("polyphony", "Passwords must match.");
         print "\n\t\t<span id='" . $fieldName . "_error' style=\"padding-left: 10px; {$errStyle}\">&laquo; {$errText}</span>";
         $this->_showEqualityError = false;
     }
     return ob_get_clean();
 }