1<?php 2// $Header: /cvsroot/html2ps/box.input.password.php,v 1.6 2006/10/06 20:10:52 Konstantin Exp $ 3 4class PasswordInputBox extends TextInputBox { 5 function &create(&$root, &$pipeline) { 6 // Text to be displayed 7 if ($root->has_attribute('value')) { 8 $text = str_repeat("*",strlen($root->get_attribute("value"))); 9 } else { 10 $text = ""; 11 }; 12 13 /** 14 * Input field name 15 */ 16 $name = $root->get_attribute('name'); 17 18 $box =& new PasswordInputBox($text, $root->get_attribute("value"), $name); 19 $box->readCSS($pipeline->get_current_css_state()); 20 21 $ibox = InlineBox::create_from_text(" ", WHITESPACE_PRE, $pipeline); 22 for ($i=0, $size = count($ibox->content); $i<$size; $i++) { 23 $box->add_child($ibox->content[$i]); 24 }; 25 26 return $box; 27 } 28 29 function show(&$driver) { 30 // Now set the baseline of a button box to align it vertically when flowing isude the 31 // text line 32 $this->default_baseline = $this->content[0]->baseline + $this->get_extra_top(); 33 $this->baseline = $this->content[0]->baseline + $this->get_extra_top(); 34 35 /** 36 * If we're rendering the interactive form, the field content should not be rendered 37 */ 38 global $g_config; 39 if ($g_config['renderforms']) { 40 /** 41 * Render background/borders only 42 */ 43 $status = GenericFormattedBox::show($driver); 44 45 /** 46 * @todo encoding name? 47 * @todo font name? 48 * @todo check if font is embedded for PDFLIB 49 */ 50 $driver->field_password($this->get_left_padding(), 51 $this->get_top_padding(), 52 $this->get_width() + $this->get_padding_left() + $this->get_padding_right(), 53 $this->get_height() + $this->get_padding_top() + $this->get_padding_bottom(), 54 $this->_value, 55 $this->_field_name); 56 } else { 57 /** 58 * Render everything, including content 59 */ 60 $status = GenericContainerBox::show($driver); 61 } 62 63 return $status; 64 } 65} 66?>