* @package HTML_Progress */ require_once 'HTML/Progress.php'; require_once 'HTML/Page.php'; require_once 'HTML/CSS.php'; require_once 'HTML/QuickForm/Controller.php'; // Load some default action handlers require_once 'HTML/QuickForm/Action/Submit.php'; require_once 'HTML/QuickForm/Action/Jump.php'; require_once 'HTML/QuickForm/Action/Display.php'; require_once 'HTML/QuickForm/Action/Direct.php'; /** * Progress main properties */ class Property1 extends HTML_QuickForm_Page { function buildForm() { $this->_formBuilt = true; $tabs[] =& $this->createElement('submit', $this->getButtonName('page1'), 'Progress', array('class' => 'flat', 'disabled' => 'disabled')); $tabs[] =& $this->createElement('submit', $this->getButtonName('page2'), 'Cell', array('class' => 'flat')); $tabs[] =& $this->createElement('submit', $this->getButtonName('page3'), 'Border', array('class' => 'flat')); $tabs[] =& $this->createElement('submit', $this->getButtonName('page4'), 'String', array('class' => 'flat')); $tabs[] =& $this->createElement('submit', $this->getButtonName('page5'), 'Ready', array('class' => 'flat')); $this->addGroup($tabs, 'tabs', null, ' ', false); $this->addElement('header', null, ' '); $models = array( '' => '', 'ancestor.ini' => 'Ancestor', 'bluesand.ini' => 'BlueSand', 'redsandback.ini' => 'RedSandBack', 'bullit.ini' => 'Bullit', 'smallest.ini' => 'Smallest', 'bgimages.ini' => 'BgImages' ); $this->addElement('select', 'model', 'pre-set UI models:', $models); $this->addElement('text', 'progressclass', 'CSS class:', array('size' => 32)); $shape[] =& $this->createElement('radio', null, null, 'Horizontal', '1'); $shape[] =& $this->createElement('radio', null, null, 'Vertical', '2'); $this->addGroup($shape, 'shape', 'Progress shape:'); $way[] =& $this->createElement('radio', null, null, 'Natural', 'natural'); $way[] =& $this->createElement('radio', null, null, 'Reverse', 'reverse'); $this->addGroup($way, 'way', 'Progress way:'); $autosize[] =& $this->createElement('radio', null, null, 'Yes', true); $autosize[] =& $this->createElement('radio', null, null, 'No', false); $this->addGroup($autosize, 'autosize', 'Progress best size:'); $progresssize['width'] =& $this->createElement('text', 'width', null, array('size' => 4)); $progresssize['height'] =& $this->createElement('text', 'height', null, array('size' => 4)); $progresssize['bgcolor'] =& $this->createElement('text', 'bgcolor', null, array('size' => 7)); $this->addGroup($progresssize, 'progresssize', 'Size and color (width, height, bgcolor):', ', '); $this->addElement('submit', $this->getButtonName('next'), 'Next >>'); } } /** * Cell properties */ class Property2 extends HTML_QuickForm_Page { function buildForm() { $this->_formBuilt = true; $tabs[] =& $this->createElement('submit', $this->getButtonName('page1'), 'Progress', array('class' => 'flat')); $tabs[] =& $this->createElement('submit', $this->getButtonName('page2'), 'Cell', array('class' => 'flat', 'disabled' => 'disabled')); $tabs[] =& $this->createElement('submit', $this->getButtonName('page3'), 'Border', array('class' => 'flat')); $tabs[] =& $this->createElement('submit', $this->getButtonName('page4'), 'String', array('class' => 'flat')); $tabs[] =& $this->createElement('submit', $this->getButtonName('page5'), 'Ready', array('class' => 'flat')); $this->addGroup($tabs, 'tabs', null, ' ', false); $this->addElement('header', null, ' '); $this->addElement('text', 'cellid', 'Id mask:', array('size' => 32)); $this->addElement('text', 'cellclass', 'CSS class:', array('size' => 32)); $cellvalue['min'] =& $this->createElement('text', 'min', null, array('size' => 4)); $cellvalue['max'] =& $this->createElement('text', 'max', null, array('size' => 4)); $cellvalue['inc'] =& $this->createElement('text', 'inc', null, array('size' => 4)); $this->addGroup($cellvalue, 'cellvalue', 'Value (minimum, maximum, increment):', ', '); $cellsize['width'] =& $this->createElement('text', 'width', null, array('size' => 4)); $cellsize['height'] =& $this->createElement('text', 'height', null, array('size' => 4)); $cellsize['spacing'] =& $this->createElement('text', 'spacing', null, array('size' => 2)); $cellsize['count'] =& $this->createElement('text', 'count', null, array('size' => 2)); $this->addGroup($cellsize, 'cellsize', 'Size (width, height, spacing, count):', ', '); $cellcolor['active'] =& $this->createElement('text', 'active', null, array('size' => 7)); $cellcolor['inactive'] =& $this->createElement('text', 'inactive', null, array('size' => 7)); $this->addGroup($cellcolor, 'cellcolor', 'Color (active, inactive):', ', '); $cellfont['family'] =& $this->createElement('text', 'family', null, array('size' => 32)); $cellfont['size'] =& $this->createElement('text', 'size', null, array('size' => 2)); $cellfont['color'] =& $this->createElement('text', 'color', null, array('size' => 7)); $this->addGroup($cellfont, 'cellfont', 'Font (family, size, color):', ', '); $prevnext[] =& $this->createElement('submit', $this->getButtonName('back'), '<< Back'); $prevnext[] =& $this->createElement('submit', $this->getButtonName('next'), 'Next >>'); $this->addGroup($prevnext, null, '', ' ', false); } } /** * Progress border properties */ class Property3 extends HTML_QuickForm_Page { function buildForm() { $this->_formBuilt = true; $tabs[] =& $this->createElement('submit', $this->getButtonName('page1'), 'Progress', array('class' => 'flat')); $tabs[] =& $this->createElement('submit', $this->getButtonName('page2'), 'Cell', array('class' => 'flat')); $tabs[] =& $this->createElement('submit', $this->getButtonName('page3'), 'Border', array('class' => 'flat', 'disabled' => 'disabled')); $tabs[] =& $this->createElement('submit', $this->getButtonName('page4'), 'String', array('class' => 'flat')); $tabs[] =& $this->createElement('submit', $this->getButtonName('page5'), 'Ready', array('class' => 'flat')); $this->addGroup($tabs, 'tabs', null, ' ', false); $this->addElement('header', null, ' '); $borderpainted[] =& $this->createElement('radio', null, null, 'Yes', true); $borderpainted[] =& $this->createElement('radio', null, null, 'No', false); $this->addGroup($borderpainted, 'borderpainted', 'Display a border around the progress bar:'); $this->addElement('text', 'borderclass', 'CSS class:', array('size' => 32)); $borderstyle['style'] =& $this->createElement('select', 'style', null, array('solid'=>'Solid', 'dashed'=>'Dashed', 'dotted'=>'Dotted', 'inset'=>'Inset', 'outset'=>'Outset')); $borderstyle['width'] =& $this->createElement('text', 'width', null, array('size' => 2)); $borderstyle['color'] =& $this->createElement('text', 'color', null, array('size' => 7)); $this->addGroup($borderstyle, 'borderstyle', '(style, width, color):', ', '); $prevnext[] =& $this->createElement('submit', $this->getButtonName('back'), '<< Back'); $prevnext[] =& $this->createElement('submit', $this->getButtonName('next'), 'Next >>'); $this->addGroup($prevnext, null, '', ' ', false); } } /** * String properties */ class Property4 extends HTML_QuickForm_Page { function buildForm() { $this->_formBuilt = true; $tabs[] =& $this->createElement('submit', $this->getButtonName('page1'), 'Progress', array('class' => 'flat')); $tabs[] =& $this->createElement('submit', $this->getButtonName('page2'), 'Cell', array('class' => 'flat')); $tabs[] =& $this->createElement('submit', $this->getButtonName('page3'), 'Border', array('class' => 'flat')); $tabs[] =& $this->createElement('submit', $this->getButtonName('page4'), 'String', array('class' => 'flat', 'disabled' => 'disabled')); $tabs[] =& $this->createElement('submit', $this->getButtonName('page5'), 'Ready', array('class' => 'flat')); $this->addGroup($tabs, 'tabs', null, ' ', false); $this->addElement('header', null, ' '); $stringpainted[] =& $this->createElement('radio', null, null, 'Yes', true); $stringpainted[] =& $this->createElement('radio', null, null, 'No', false); $this->addGroup($stringpainted, 'stringpainted', 'Render a custom string:'); $this->addElement('text', 'stringid', 'Id:', array('size' => 32)); $stringsize['width'] =& $this->createElement('text', 'width', null, array('size' => 4)); $stringsize['height'] =& $this->createElement('text', 'height', null, array('size' => 4)); $stringsize['bgcolor'] =& $this->createElement('text', 'bgcolor', null, array('size' => 7)); $this->addGroup($stringsize, 'stringsize', 'Size and color (width, height, bgcolor):', ', '); $stringvalign[] =& $this->createElement('radio', null, null, 'Left', 'left'); $stringvalign[] =& $this->createElement('radio', null, null, 'Right', 'right'); $stringvalign[] =& $this->createElement('radio', null, null, 'Top', 'top'); $stringvalign[] =& $this->createElement('radio', null, null, 'Bottom', 'bottom'); $this->addGroup($stringvalign, 'stringvalign', 'Vertical alignment:'); $stringalign[] =& $this->createElement('radio', null, null, 'Left', 'left'); $stringalign[] =& $this->createElement('radio', null, null, 'Right', 'right'); $stringalign[] =& $this->createElement('radio', null, null, 'Center', 'center'); $this->addGroup($stringalign, 'stringalign', 'Horizontal alignment:'); $stringfont['family'] =& $this->createElement('text', 'family', null, array('size' => 40)); $stringfont['size'] =& $this->createElement('text', 'size', null, array('size' => 2)); $stringfont['color'] =& $this->createElement('text', 'color', null, array('size' => 7)); $this->addGroup($stringfont, 'stringfont', 'Font (family, size, color):', ', '); $this->addElement('textarea', 'strings', 'percent, string thrown:', array('rows' => 10, 'cols' => 50)); $prevnext[] =& $this->createElement('submit', $this->getButtonName('back'), '<< Back'); $prevnext[] =& $this->createElement('submit', $this->getButtonName('next'), 'Next >>'); $this->addGroup($prevnext, null, '', ' ', false); } } /** * Output page options */ class Ready extends HTML_QuickForm_Page { function buildForm() { $this->_formBuilt = true; $tabs[] =& $this->createElement('submit', $this->getButtonName('page1'), 'Progress', array('class' => 'flat')); $tabs[] =& $this->createElement('submit', $this->getButtonName('page2'), 'Cell', array('class' => 'flat')); $tabs[] =& $this->createElement('submit', $this->getButtonName('page3'), 'Border', array('class' => 'flat')); $tabs[] =& $this->createElement('submit', $this->getButtonName('page4'), 'String', array('class' => 'flat')); $tabs[] =& $this->createElement('submit', $this->getButtonName('page5'), 'Ready', array('class' => 'flat', 'disabled' => 'disabled')); $this->addGroup($tabs, 'tabs', null, ' ', false); $this->addElement('header', null, 'Output page styles'); $outputcolor['bg'] =& $this->createElement('text', 'bg', null, array('size' => 7)); $outputcolor['fg'] =& $this->createElement('text', 'fg', null, array('size' => 7)); $outputcolor['link'] =& $this->createElement('text', 'link', null, array('size' => 7)); $this->addGroup($outputcolor, 'outputcolor', 'Color (background, foreground, link):', ', '); $this->addElement('text', 'outputcss', 'StyleSheet:', array('size' => 32)); $render[] =& $this->createElement('radio', null, null, 'dump', 'dump'); $render[] =& $this->createElement('radio', null, null, 'live', 'demo'); $this->addGroup($render, 'render', 'Render:'); $prevnext[] =& $this->createElement('submit', $this->getButtonName('back'), '<< Back'); $prevnext[] =& $this->createElement('submit', $this->getButtonName('submit'), 'Apply'); $this->addGroup($prevnext, null, '', ' ', false); } } /** * Class for form rendering */ class ActionDisplay extends HTML_QuickForm_Action_Display { function _renderForm(&$page) { $renderer =& $page->defaultRenderer(); $p = new HTML_Page(array( 'lineend' => OS_WINDOWS ? 'win' : 'unix', 'doctype' => "XHTML 1.0 Strict", 'language' => 'en', 'cache' => 'false' )); $p->disableXmlProlog(); $p->setTitle("PEAR::HTML_Progress - ProgressMaker"); $p->setMetaData("author", "Laurent Laville"); $renderer->setFormTemplate('
'); ob_start(); print_r($bar->toArray()); if (function_exists('ob_get_clean')) { $structure = ob_get_clean(); // use for PHP 4.3+ } else { $structure = ob_get_contents(); // use for PHP 4.2+ ob_end_clean(); } $p->addBodyContent($structure); ob_get_contents(); $p->addBodyContent(''); } else { $p->addStyleSheet($progress['outputcss']); $p->addStyleDeclaration( $bar->getStyle() . $css->toString() ); $p->addScriptDeclaration( $ui->getScript() ); $p->addBodyContent('
Laurent Laville, November 2003
'); $p->addBodyContent('<< Replay
'); $p->addBodyContent( $bar->toHtml() ); $p->addBodyContent('