cvs: pear /HTML_Progress2 Progress2.php
| From: | Laurent Laville | Date: | Tue, 20 Sep 2005 15:01:48 +0000 |
| Subject: | cvs: pear /HTML_Progress2 Progress2.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-34872@lists.php.net to get a copy of this message | ||
farell Tue Sep 20 11:01:48 2005 EDT
Modified files:
/pear/HTML_Progress2 Progress2.php
Log:
remove auto-size attribute on progress meter, but gave alternative
and new support with background-image, background-repeat, background-position attributes
http://cvs.php.net/diff.php/pear/HTML_Progress2/Progress2.php?r1=1.14&r2=1.15&ty=u
Index: pear/HTML_Progress2/Progress2.php
diff -u pear/HTML_Progress2/Progress2.php:1.14 pear/HTML_Progress2/Progress2.php:1.15
--- pear/HTML_Progress2/Progress2.php:1.14 Wed Sep 14 05:16:39 2005
+++ pear/HTML_Progress2/Progress2.php Tue Sep 20 11:01:42 2005
@@ -15,7 +15,7 @@
* @author Laurent Laville <pear@laurent-laville.org>
* @copyright 1997-2005 The PHP Group
* @license http://www.php.net/license/3_0.txt
PHP License 3.0
- * @version CVS: $Id: Progress2.php,v 1.14 2005/09/14 09:16:39 farell Exp $
+ * @version CVS: $Id: Progress2.php,v 1.15 2005/09/20 15:01:42 farell Exp $
* @link http://pear.php.net/package/HTML_Progress2
* @since File available since Release 2.0.0RC1
*/
@@ -348,8 +348,10 @@
*
* <code>
* $progress = array(
- * 'background-color' => '#FFFFFF', # bar background color
- * 'auto-size' => true, # compute best progress size
+ * 'background-color' => '#FFFFFF', # bar background color
+ * 'background-image' => 'none', # bar background image
+ * 'background-repeat' => 'no-repeat', # bar background image
repeat option
+ * 'background-position' => 'top left', # bar background image start
position
* 'width' => 0, # bar width
* 'height' => 0, # bar height
* 'left' => 10, # position from left
@@ -422,6 +424,9 @@
* 'font-size' => 8, # font size
* 'color' => '#000000', # foreground color
* 'background-color' => '#FFFFFF', # background color
+ * 'background-image' => 'none', # cell background image
+ * 'background-repeat' => 'no-repeat', # cell background image
repeat option
+ * 'background-position' => 'top left', # cell background image
start position
* 'width' => 15, # cell width
* 'height' => 20, # cell height
* 'spacing' => 2 # cell spacing
@@ -596,7 +601,9 @@
$this->frame = array('show' => false);
$this->_progress = array(
'background-color' => '#FFFFFF',
- 'auto-size' => true,
+ 'background-image' => 'none',
+ 'background-repeat' => 'no-repeat',
+ 'background-position' => 'top left',
'width' => 0,
'height' => 0,
'left' => 10,
@@ -618,6 +625,9 @@
'font-size' => 8,
'color' => '#000000',
'background-color' => '#FFFFFF',
+ 'background-image' => 'none',
+ 'background-repeat' => 'no-repeat',
+ 'background-position' => 'top left',
'width' => 15,
'height' => 20,
'spacing' => 2
@@ -1388,7 +1398,10 @@
* <li>font-family = Courier, Verdana
* <li>font-size = lowest value from cell width, cell height, and font size
* <li>color = #000000
- * <li>background-color = #FFFFFF (added for progress circle shape on release 1.2.0)
+ * <li>background-color = #FFFFFF
+ * <li>background-image = none
+ * <li>background-repeat = no-repeat
+ * <li>background-position = top left
* <li>Horizontal Bar :
* <ul>
* <li>width = 15
@@ -2036,8 +2049,10 @@
*
* Background attributes are color and size, with default values:
* <ul>
- * <li>background-color = #FFFFFF
- * <li>auto-size = true
+ * <li>background-color = #FFFFFF
+ * <li>background-image = none
+ * <li>background-repeat = no-repeat
+ * <li>background-position = top left
* <li>Horizontal Bar :
* <ul>
* <li>width = (cell_count * (cell_width + cell_spacing)) + cell_spacing
@@ -2389,6 +2404,11 @@
$styles .= $tab . 'border-style: '. $borderAttr['style']
.';'. PHP_EOL;
$styles .= $tab . 'border-color: '. $borderAttr['color']
.';'. PHP_EOL;
}
+ if ($progressAttr['background-image'] !== 'none') {
+ $styles .= $tab . 'background-image: url('.
$progressAttr['background-image'] .');'. PHP_EOL;
+ $styles .= $tab . 'background-repeat: '.
$progressAttr['background-repeat'] .';'. PHP_EOL;
+ $styles .= $tab . 'background-position: '.
$progressAttr['background-position'] .';'. PHP_EOL;
+ }
if ($this->cellCount > 0) {
$styles .= $tab . 'background-color: '.
$progressAttr['background-color'] .';'. PHP_EOL;
@@ -2442,12 +2462,16 @@
$styles .= '}'. PHP_EOL . PHP_EOL;
$styles .= $cellClsA . ' {' . PHP_EOL;
- if ($this->orientation !== HTML_PROGRESS2_CIRCLE) {
+ if ($cellAttr['background-image'] == 'none') {
$styles .= $tab . 'background-color: '. $cellAttr['active-color']
.';'. PHP_EOL;
- }
- if (isset($cellAttr['background-image'])) {
+ } else {
$styles .= $tab . 'background-image: url("'.
$cellAttr['background-image'] .'");'. PHP_EOL;
- $styles .= $tab . 'background-repeat: no-repeat;'. PHP_EOL;
+ if ($this->orientation == HTML_PROGRESS2_CIRCLE) {
+ $styles .= $tab . 'background-repeat: no-repeat;'. PHP_EOL;
+ } else {
+ $styles .= $tab . 'background-repeat: '.
$cellAttr['background-repeat'] .';'. PHP_EOL;
+ $styles .= $tab . 'background-position: '.
$cellAttr['background-position'] .';'. PHP_EOL;
+ }
}
$styles .= $tab . 'visibility: hidden;'. PHP_EOL;
$styles .= '}'. PHP_EOL . PHP_EOL;
@@ -3439,10 +3463,6 @@
*/
function _updateProgressSize()
{
- if (!$this->_progress['auto-size']) {
- return;
- }
-
$cell_width = $this->cell['width'];
$cell_height = $this->cell['height'];
$cell_spacing = $this->cell['spacing'];