<?php /* ___________________________________________________________________________ ProgressClass v1.0 - (c) 2002 Boris Wylutzki/www.edv-internet.de ___________________________________________________________________________ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. If you need a license for including this script in non-free software please contact the author under www.edv-internet.de. ___________________________________________________________________________ */ class ProgressClass { var $_label='Bitte warten ...'; var $_percent=0; var $_left='center'; var $_top='center-65'; var $_width=350; var $_button=''; var $_button_url=''; var $_button_target=''; var $_drawn=false; var $_key=''; var $_barcolor='#0000CC'; function ProgressClass() { $this->_key=uniqid('P'); } function setButton($label,$url,$target='_self') { $this->_button=$label; $this->_button_url=$url; $this->_button_target=$target; } function setWidth($width) { $this->_width=$width; } function setPosition($left=NULL,$top=NULL) { if (isset($top)) $this->_top=$top; if (isset($left)) $this->_left=$left; } function setLabel($label) { if ($label!=$this->_label) { if ($this->_drawn) { $l=$this->_jss_single(htmlentities($label)); echo "<script type=\"text/javascript\">\n<!--\n{$this->_key}_setLabel('$l');\n// -->\n</script>"; flush(); } $this->_label=$label; } } function setBarColor($color) { if ($color!=$this->_barcolor) { if ($this->_drawn) { echo "<script type=\"text/javascript\">\n<!--\n{$this->_key}_setBarColor('$color');\n// -->\n</script>"; flush(); } $this->_barcolor=$color; } } function setPercent($percent) { if ($percent!=$this->_percent) { if ($this->_drawn) { echo "<script type=\"text/javascript\">\n<!--\n{$this->_key}_setPercent($percent);\n// -->\n</script>"; flush(); } $this->_percent=$percent; } } function setPerX($some,$all) { $this->setPercent(round($some*100/$all)); } function make($show=true) { if ($this->_wrong_browser()) return false; require(dirname(__FILE__).'/js.inc.php'); $this->_drawn=TRUE; return true; } function hide() { if ($this->_drawn) { echo "<script type=\"text/javascript\">\n<!--\n{$this->_key}_hideProgress();\n// -->\n</script>"; flush(); } } function show() { if ($this->_drawn) { echo "<script type=\"text/javascript\">\n<!--\n{$this->_key}_showProgress();\n// -->\n</script>"; flush(); } } function _jss_single($html) { $html=str_replace("\\","\\\\",$html); $html=str_replace("\n",'',$html); $html=str_replace("\r",'',$html); $html=str_replace("'",'\\\'',$html); return $html; } function _wrong_browser() { //$browser=get_browser() OR die("<b>ProgressClass:</b> No browscap.ini installed - see www.php.net for help. A browscap.ini file is included in the ProgressClass package."); // return (($browser->browser=='Netscape' && $browser->majorver<6) || // ($browser->browser=='IE' && $browser->majorver<5) || // (!$browser->javascript)); } } ?>