cvs: pear /HTML_Progress/examples/indeterminate half_basic.html half_basic.php half_monitor.html half_monitor.php

From: Date: Mon, 25 Jul 2005 11:33:26 +0000
Subject: cvs: pear /HTML_Progress/examples/indeterminate half_basic.html half_basic.php half_monitor.html half_monitor.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-33295@lists.php.net to get a copy of this message
farell Mon Jul 25 07:33:26 2005 EDT Modified files: /pear/HTML_Progress/examples/indeterminate half_basic.html half_basic.php half_monitor.html half_monitor.php Log: Prepare examples to be removed from main package and moved into the optional package

http://cvs.php.net/diff.php/pear/HTML_Progress/examples/indeterminate/half_basic.html?r1=1.2&r2=1.3&ty=u Index: pear/HTML_Progress/examples/indeterminate/half_basic.html diff -u pear/HTML_Progress/examples/indeterminate/half_basic.html:1.2 pear/HTML_Progress/examples/indeterminate/half_basic.html:1.3 --- pear/HTML_Progress/examples/indeterminate/half_basic.html:1.2 Tue Aug 10 14:12:29 2004 +++ pear/HTML_Progress/examples/indeterminate/half_basic.html Mon Jul 25 07:33:24 2005 @@ -18,7 +18,7 @@ <h1><span class="chapter">Half Indeterminate </span></h1> -<p align="right">$Date: 2004/08/10 18:12:29 $</p> +<p align="right">$Date: 2005/07/25 11:33:24 $</p> <div class="toc">&nbsp;Table of contents </div> <ul> @@ -32,20 +32,20 @@ <a name="intro"> <h2><img src="../images/info.gif"/> Introduction</h2> - + <p>This example requires : <ul> -<li>PEAR::HTML_Progress 1.2.0RC3 or better (see source at line 12).</li> +<li>PEAR::HTML_Progress 1.2.2 or better (see source at line 12).</li> </ul> </p> <hr/> -<p><b>This example will run a basic ProgressBar in indeterminate mode (without monitor) +<p><b>This example will run a basic ProgressBar in indeterminate mode (without monitor) until it reached a limit-level (elapse time > 12 seconds).</b></p> - + <p>Actions to wait are allowed by user callback myProgressHandler defined on lines 20 to 41.</p> -<p>This callback is attached on progress bar at line 61. If you forget to do that, default +<p>This callback is attached on progress bar at line 61. If you forget to do that, default will be to wait, done by HTML_Progress::sleep() method.</p> <p>[<a href="#top">Top</a>]</p> @@ -90,7 +90,7 @@ <p><img src="../screenshots/indeterminate_half_basic.png"/></p> <p>[<a href="#top">Top</a>]</p> - + <a name="source"> <h2><img src="../images/source.gif"/>&nbsp;PHP source syntax highlight</h2> @@ -106,4 +106,4 @@ <p>[<a href="#top">Top</a>]</p> </body> -</html> +</html> \ No newline at end of file http://cvs.php.net/diff.php/pear/HTML_Progress/examples/indeterminate/half_basic.php?r1=1.1&r2=1.2&ty=u Index: pear/HTML_Progress/examples/indeterminate/half_basic.php diff -u pear/HTML_Progress/examples/indeterminate/half_basic.php:1.1 pear/HTML_Progress/examples/indeterminate/half_basic.php:1.2 --- pear/HTML_Progress/examples/indeterminate/half_basic.php:1.1 Sun Jun 27 09:36:44 2004 +++ pear/HTML_Progress/examples/indeterminate/half_basic.php Mon Jul 25 07:33:24 2005 @@ -1,12 +1,12 @@ -<?php -@include '../include_path.php'; +<?php /** * Horizontal ProgressBar in indeterminate mode * without using the Progress_Monitor V2 solution. - * - * @version $Id: half_basic.php,v 1.1 2004/06/27 13:36:44 farell Exp $ + * + * @version $Id: half_basic.php,v 1.2 2005/07/25 11:33:24 farell Exp $ * @author Laurent Laville <pear@laurent-laville.org> * @package HTML_Progress + * @subpackage Examples */ require_once 'HTML/Progress.php'; @@ -16,16 +16,16 @@ * Parameters * 1. current value of the progress bar * 2. the progress bar (object) itself - */ + */ function myProgressHandler($progressValue, &$bar) { static $c; - - if (!isset($c)) { + + if (!isset($c)) { $c = time(); } - // wait a bit ... + // wait a bit ... $bar->sleep(); /* rules to determine when switch back from indeterminate to determinate mode */ @@ -43,14 +43,14 @@ $progress = new HTML_Progress(); $ui = & $progress->getUI(); $ui->setProgressAttributes(array( - 'background-color' => '#e0e0e0' -)); + 'background-color' => '#e0e0e0' +)); $ui->setStringAttributes(array( - 'color' => '#996', - 'background-color' => '#CCCC99' -)); + 'color' => '#996', + 'background-color' => '#CCCC99' +)); $ui->setCellAttributes(array( - 'active-color' => '#996' + 'active-color' => '#996' )); $progress->setAnimSpeed(200); @@ -66,13 +66,13 @@ <style type="text/css"> <!-- body { - background-color: #CCCC99; - color: #996; - font-family: Verdana, Arial; + background-color: #CCCC99; + color: #996; + font-family: Verdana, Arial; } a:visited, a:active, a:link { - color: yellow; + color: yellow; } <?php echo $progress->getStyle(); ?> @@ -85,15 +85,11 @@ </script> </head> <body> -<h1><?php echo basename(__FILE__); ?></h1> - -<?php -echo $progress->toHtml(); +<?php +echo $progress->toHtml(); $progress->run(); ?> -<p>&lt;&lt; <a href="../index.html">Back examples TOC</a></p> - </body> </html> \ No newline at end of file http://cvs.php.net/diff.php/pear/HTML_Progress/examples/indeterminate/half_monitor.html?r1=1.2&r2=1.3&ty=u Index: pear/HTML_Progress/examples/indeterminate/half_monitor.html diff -u pear/HTML_Progress/examples/indeterminate/half_monitor.html:1.2 pear/HTML_Progress/examples/indeterminate/half_monitor.html:1.3 --- pear/HTML_Progress/examples/indeterminate/half_monitor.html:1.2 Tue Aug 10 14:12:29 2004 +++ pear/HTML_Progress/examples/indeterminate/half_monitor.html Mon Jul 25 07:33:24 2005 @@ -18,7 +18,7 @@ <h1><span class="chapter">Half Indeterminate and Monitor</span></h1> -<p align="right">$Date: 2004/08/10 18:12:29 $</p> +<p align="right">$Date: 2005/07/25 11:33:24 $</p> <div class="toc">&nbsp;Table of contents </div> <ul> @@ -32,22 +32,22 @@ <a name="intro"> <h2><img src="../images/info.gif"/> Introduction</h2> - + <p>This example requires : <ul> -<li>PEAR::HTML_Progress 1.2.0RC1 or better (see source at line 12).</li> +<li>PEAR::HTML_Progress 1.2.2 or better (see source at line 12).</li> </ul> </p> <hr/> -<p><b>This example will run a basic ProgressBar in indeterminate mode (with monitor) +<p><b>This example will run a basic ProgressBar in indeterminate mode (with monitor) then switch back to determinate mode when reached a limit-level (internal value > 240).</b></p> - + <p>Actions to switch back to determinate mode are allowed by user callback myProgressHandler defined on lines 14 to 38.</p> -<p>This callback is attached on progress bar at line 46 and monitor renders are defined -on lines 102 to 114 (following QF rendering rules).</p> +<p>This callback is attached on progress bar at line 66 and monitor renders are defined +on lines 102 to 113 (following QF rendering rules).</p> <p>[<a href="#top">Top</a>]</p> @@ -91,7 +91,7 @@ <p><img src="../screenshots/indeterminate.png"/></p> <p>[<a href="#top">Top</a>]</p> - + <a name="source"> <h2><img src="../images/source.gif"/>&nbsp;PHP source syntax highlight</h2> @@ -107,4 +107,4 @@ <p>[<a href="#top">Top</a>]</p> </body> -</html> +</html> \ No newline at end of file http://cvs.php.net/diff.php/pear/HTML_Progress/examples/indeterminate/half_monitor.php?r1=1.2&r2=1.3&ty=u Index: pear/HTML_Progress/examples/indeterminate/half_monitor.php diff -u pear/HTML_Progress/examples/indeterminate/half_monitor.php:1.2 pear/HTML_Progress/examples/indeterminate/half_monitor.php:1.3 --- pear/HTML_Progress/examples/indeterminate/half_monitor.php:1.2 Thu Jul 8 13:32:06 2004 +++ pear/HTML_Progress/examples/indeterminate/half_monitor.php Mon Jul 25 07:33:24 2005 @@ -1,27 +1,27 @@ -<?php -@include '../include_path.php'; +<?php /** * Horizontal ProgressBar in indeterminate mode * using the Progress_Monitor V2 solution (with QF renderer). - * - * @version $Id: half_monitor.php,v 1.2 2004/07/08 17:32:06 farell Exp $ + * + * @version $Id: half_monitor.php,v 1.3 2005/07/25 11:33:24 farell Exp $ * @author Laurent Laville <pear@laurent-laville.org> * @package HTML_Progress + * @subpackage Examples */ require_once 'HTML/Progress/monitor.php'; -function myProgressHandler($progressValue, &$obj) +function myProgressHandler($progressValue, &$bar) { + global $monitor; static $c; - - if (!isset($c)) { + + if (!isset($c)) { $c = 0; } $c += 16; - $obj->setCaption("completed $c out of 400"); + $monitor->setCaption("completed $c out of 400"); - $bar =& $obj->getProgressElement(); $bar->sleep(); /* rules to determine when switch back from indeterminate to determinate mode */ if ($c >= 240 && $bar->isIndeterminate()) { @@ -38,26 +38,23 @@ } } -$monitor = new HTML_Progress_Monitor('frmMonitor', - array( 'button' => array('style' => 'width:80px;'), +$monitor = new HTML_Progress_Monitor('frmMonitor', + array( 'button' => array('style' => 'width:80px;'), 'title' => 'Progress ...' ) ); -// your custom user process goes here ! -$monitor->setProgressHandler('myProgressHandler'); - // Attach a progress bar custom model $progress = new HTML_Progress(); $ui = & $progress->getUI(); $ui->setProgressAttributes(array( - 'background-color' => '#e0e0e0' -)); + 'background-color' => '#e0e0e0' +)); $ui->setStringAttributes(array( - 'color' => '#996', - 'background-color' => '#CCCC99' -)); + 'color' => '#996', + 'background-color' => '#CCCC99' +)); $ui->setCellAttributes(array( - 'active-color' => '#996' + 'active-color' => '#996' )); $progress->setAnimSpeed(100); @@ -65,6 +62,9 @@ $progress->setStringPainted(true); // get space for the string $progress->setString(""); // but don't paint it $progress->setIndeterminate(true); // Progress start in indeterminate mode +// your custom user process goes here ! +$progress->setProgressHandler('myProgressHandler'); + $monitor->setProgressElement($progress); ?> <html> @@ -73,18 +73,18 @@ <style type="text/css"> <!-- .progressStatus { - color:#000000; - font-size:10px; + color:#000000; + font-size:10px; } body { - background-color: #444444; - color: #EEEEEE; - font-family: Verdana, Arial; + background-color: #444444; + color: #EEEEEE; + font-family: Verdana, Arial; } a:visited, a:active, a:link { - color: yellow; + color: yellow; } <?php echo $monitor->getStyle(); ?> @@ -97,31 +97,27 @@ </script> </head> <body> -<h1><?php echo basename(__FILE__); ?></h1> -<?php +<?php $renderer =& HTML_QuickForm::defaultRenderer(); $renderer->setFormTemplate(' - <table width="450" border="0" cellpadding="3" cellspacing="2" bgcolor="#CCCC99"> - <form{attributes}>{content} - </form> - </table> +<form{attributes}> + <table width="450" border="0" cellpadding="3" cellspacing="2" bgcolor="#CCCC99"> + {content} + </table> +</form> '); $renderer->setHeaderTemplate(' - <tr> - <td style="white-space:nowrap;background:#996;color:#ffc;" align="left" colspan="2"><b>{header}</b></td> - </tr> + <tr> + <td style="white-space:nowrap;background:#996;color:#ffc;" align="left" colspan="2"><b>{header}</b></td> + </tr> '); $monitor->accept($renderer); // Display progress monitor dialog box echo $renderer->toHtml(); - - -$monitor->run(); +$monitor->run(); ?> -<p>&lt;&lt; <a href="../index.html">Back examples TOC</a></p> - </body> </html> \ No newline at end of file
« previous php.pear.cvs (#33295) next »