cvs: pear /PEAR_Frontend_Web/Frontend CLI.php Web.php /PEAR_Frontend_Web/Frontend/Web error.gif error.tpl.html userDialog.tpl.html
| From: | Christian Dickmann | Date: | Mon, 27 May 2002 15:20:29 +0000 |
| Subject: | cvs: pear /PEAR_Frontend_Web/Frontend CLI.php Web.php /PEAR_Frontend_Web/Frontend/Web error.gif error.tpl.html userDialog.tpl.html | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-4153@lists.php.net to get a copy of this message | ||
dickmann Mon May 27 11:20:29 2002 EDT
Added files:
/pear/PEAR_Frontend_Web/Frontend CLI.php
/pear/PEAR_Frontend_Web/Frontend/Web error.gif error.tpl.html
Modified files:
/pear/PEAR_Frontend_Web/Frontend Web.php
/pear/PEAR_Frontend_Web/Frontend/Web userDialog.tpl.html
Log:
change UI API
Index: pear/PEAR_Frontend_Web/Frontend/Web.php diff -u pear/PEAR_Frontend_Web/Frontend/Web.php:1.1 pear/PEAR_Frontend_Web/Frontend/Web.php:1.2 --- pear/PEAR_Frontend_Web/Frontend/Web.php:1.1 Mon May 27 07:50:36 2002 +++ pear/PEAR_Frontend_Web/Frontend/Web.php Mon May 27 11:20:29 2002 @@ -16,7 +16,7 @@ | Author: Christian Dickmann <dickmann@php.net> | +----------------------------------------------------------------------+ - $id$ + $Id: Web.php,v 1.2 2002/05/27 15:20:29 dickmann Exp $ */ require_once "PEAR.php"; @@ -35,7 +35,8 @@ var $lp = ''; // line prefix var $tpl; var $table; - + var $data = array(); + var $params = array(); // }}} @@ -66,7 +67,22 @@ function displayError($eobj) { - return $this->displayLine($eobj->getMessage()); + $msg = $eobj->getMessage(); + $msg = nl2br($msg); + + $tpl = new IntegratedTemplate(dirname(__FILE__)."/Web"); + $tpl->loadTemplateFile("error.tpl.html"); + $tpl->setVariable("InstallerURL", $_SERVER["PHP_SELF"]); + $tpl->setVariable("ImgPEAR", $_SERVER["PHP_SELF"].'?img=pear'); + $tpl->setVariable("ImgError", $_SERVER["PHP_SELF"].'?img=error'); + + $tpl->setVariable("Error", $msg); + if (isset($_GET['command'])) + $tpl->setVariable("param", '?command='.$_GET['command']); + + $tpl->show(); + exit; + return true; } // }}} @@ -129,8 +145,8 @@ { $tpl->setCurrentBlock("Row"); $tpl->setVariable("ImgPackage", $_SERVER["PHP_SELF"].'?img=package'); - $compare = version_compare($row[1], $row[4]); - if (!$row[4]) { + $compare = version_compare($row[1], $row[2]); + if (!$row[2]) { $inst = sprintf('<a href="%s?install=%s"><img src="%s?img=install" border="0"></a>', $_SERVER["PHP_SELF"], $row[0], $_SERVER["PHP_SELF"]); $del = ''; @@ -148,7 +164,7 @@ $_SERVER["PHP_SELF"], $row[0], $row[0], $_SERVER["PHP_SELF"]); $tpl->setVariable("Version", $row[1]); - $tpl->setVariable("Installed", $row[4]); + $tpl->setVariable("Installed", $row[2]); $tpl->setVariable("Install", $inst); $tpl->setVariable("Delete", $del); $tpl->setVariable("Info", $info); @@ -171,7 +187,24 @@ { case 'list-all': return $this->outputListAll($data); + case 'install': + case 'uninstall': + return true; + case 'login': + if ($_SERVER["REQUEST_METHOD"] == "POST") + break; + else + $this->data[$command] = $data; + return true; + case 'logout': + case 'package': + echo $data; + break; + default: + echo $data; }; + + return true; } function userDialog($command, $prompts, $types = array(), $defaults = array()) @@ -190,6 +223,7 @@ $tpl->setVariable("ImgPEAR", $_SERVER["PHP_SELF"].'?img=pear'); $tpl->setVariable("InstallerURL", $_SERVER["PHP_SELF"]); $tpl->setVariable("Command", $command); + $tpl->setVariable("Headline", nl2br($this->data[$command])); if (is_array($prompts)) { Index: pear/PEAR_Frontend_Web/Frontend/Web/userDialog.tpl.html diff -u pear/PEAR_Frontend_Web/Frontend/Web/userDialog.tpl.html:1.1 pear/PEAR_Frontend_Web/Frontend/Web/userDialog.tpl.html:1.2 --- pear/PEAR_Frontend_Web/Frontend/Web/userDialog.tpl.html:1.1 Mon May 27 07:49:35 2002 +++ pear/PEAR_Frontend_Web/Frontend/Web/userDialog.tpl.html Mon May 27 11:20:29 2002 @@ -1,4 +1,5 @@ <!-- INCLUDE header.inc.tpl.html --> + {Headline} <form action="{InstallerURL}?command={Command}" method="post"> <TABLE border="0"> <!-- BEGIN InputField --> Index: pear/PEAR_Frontend_Web/Frontend/CLI.php +++ pear/PEAR_Frontend_Web/Frontend/CLI.php <?php /* +----------------------------------------------------------------------+ | PHP Version 4 | +----------------------------------------------------------------------+ | Copyright (c) 1997-2002 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 2.02 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | | available at through the world-wide-web at | | http://www.php.net/license/2_02.txt. | | If you did not receive a copy of the PHP license and are unable to | | obtain it through the world-wide-web, please send a note to | | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Author: Stig Sæther Bakken <ssb@fast.no> | +----------------------------------------------------------------------+ $Id: CLI.php,v 1.1 2002/05/27 15:20:29 dickmann Exp $ */ require_once "PEAR.php"; class PEAR_Frontend_CLI extends PEAR { // {{{ properties /** * What type of user interface this frontend is for. * @var string * @access public */ var $type = 'CLI'; var $lp = ''; // line prefix var $omode = 'plain'; var $params = array(); var $term = array( 'bold' => '', 'normal' => '', ); // }}} // {{{ constructor function PEAR_Frontend_CLI() { parent::PEAR(); $term = getenv('TERM'); //(cox) $_ENV is empty for me in 4.1.1 if ($term) { // XXX can use ncurses extension here, if available if (preg_match('/^(xterm|vt220|linux)/', $term)) { $this->term['bold'] = sprintf("%c%c%c%c", 27, 91, 49, 109); $this->term['normal']=sprintf("%c%c%c", 27, 91, 109); } elseif (preg_match('/^vt100/', $term)) { $this->term['bold'] = sprintf("%c%c%c%c%c%c", 27, 91, 49, 109, 0, 0); $this->term['normal']=sprintf("%c%c%c%c%c", 27, 91, 109, 0, 0); } } elseif (OS_WINDOWS) { // XXX add ANSI codes here } } // }}} // {{{ displayLine(text) function displayLine($text) { print "$this->lp$text\n"; } function display($text) { print $text; } // }}} // {{{ displayError(eobj) function displayError($eobj) { return $this->displayLine($eobj->getMessage()); } // }}} // {{{ displayFatalError(eobj) function displayFatalError($eobj) { $this->displayError($eobj); exit(1); } // }}} // {{{ displayHeading(title) function displayHeading($title) { print $this->lp.$this->bold($title)."\n"; print $this->lp.str_repeat("=", strlen($title))."\n"; } // }}} // {{{ userDialog(prompt, [type], [default]) function userDialog($prompt, $type = 'text', $default = '') { if ($type == 'password') { system('stty -echo'); } print "$this->lp$prompt "; if ($default) { print "[$default] "; } print ": "; $fp = fopen("php://stdin", "r"); $line = fgets($fp, 2048); fclose($fp); if ($type == 'password') { system('stty echo'); print "\n"; } if ($default && trim($line) == "") { return $default; } return $line; } // }}} // {{{ userConfirm(prompt, [default]) function userConfirm($prompt, $default = 'yes') { static $positives = array('y', 'yes', 'on', '1'); static $negatives = array('n', 'no', 'off', '0'); print "$this->lp$prompt [$default] : "; $fp = fopen("php://stdin", "r"); $line = fgets($fp, 2048); fclose($fp); $answer = strtolower(trim($line)); if (empty($answer)) { $answer = $default; } if (in_array($answer, $positives)) { return true; } if (in_array($answer, $negatives)) { return false; } if (in_array($default, $positives)) { return true; } return false; } // }}} // {{{ startTable([params]) function startTable($params = array()) { $this->omode = 'table'; $params['table_data'] = array(); $params['widest'] = array(); // indexed by column $params['highest'] = array(); // indexed by row $params['ncols'] = 0; $this->params = $params; } // }}} // {{{ tableRow(columns, [rowparams], [colparams]) function tableRow($columns, $rowparams = array(), $colparams = array()) { $highest = 1; for ($i = 0; $i < sizeof($columns); $i++) { $col = &$columns[$i]; if (isset($colparams[$i]) && !empty($colparams[$i]['wrap'])) { $col = wordwrap($col, $colparams[$i]['wrap'], "\n", 1); } if (strpos($col, "\n") !== false) { $multiline = explode("\n", $col); $w = 0; foreach ($multiline as $n => $line) { if (strlen($line) > $w) { $w = strlen($line); } } $lines = sizeof($lines); } else { $w = strlen($col); } if ($w > @$this->params['widest'][$i]) { $this->params['widest'][$i] = $w; } $tmp = count_chars($columns[$i], 1); // handle unix, mac and windows formats $lines = (isset($tmp[10]) ? $tmp[10] : @$tmp[13]) + 1; if ($lines > $highest) { $highest = $lines; } } if (sizeof($columns) > $this->params['ncols']) { $this->params['ncols'] = sizeof($columns); } $new_row = array( 'data' => $columns, 'height' => $highest, 'rowparams' => $rowparams, 'colparams' => $colparams, ); $this->params['table_data'][] = $new_row; } // }}} // {{{ endTable() function endTable() { $this->omode = ''; extract($this->params); if (!empty($caption)) { $this->displayHeading($caption); } if (count($table_data) == 0) { return; } if (!isset($width)) { $width = $widest; } else { for ($i = 0; $i < $ncols; $i++) { if (!isset($width[$i])) { $width[$i] = $widest[$i]; } } } if (empty($border)) { $cellstart = ''; $cellend = ' '; $rowend = ''; $padrowend = false; $borderline = ''; } else { $cellstart = '| '; $cellend = ' '; $rowend = '|'; $padrowend = true; $borderline = '+'; foreach ($width as $w) { $borderline .= str_repeat('-', $w + strlen($cellstart) + strlen($cellend) - 1); $borderline .= '+'; } } if ($borderline) { $this->displayLine($borderline); } for ($i = 0; $i < sizeof($table_data); $i++) { extract($table_data[$i]); $rowlines = array(); if ($height > 1) { for ($c = 0; $c < sizeof($data); $c++) { $rowlines[$c] = preg_split('/(\r?\n|\r)/', $data[$c]); if (sizeof($rowlines[$c]) < $height) { $rowlines[$c] = array_pad($rowlines[$c], $height, ''); } } } else { for ($c = 0; $c < sizeof($data); $c++) { $rowlines[$c] = array($data[$c]); } } for ($r = 0; $r < $height; $r++) { $rowtext = ''; for ($c = 0; $c < sizeof($data); $c++) { if (isset($colparams[$c])) { $attribs = array_merge($rowparams, $colparams); } else { $attribs = $rowparams; } $w = isset($width[$c]) ? $width[$c] : 0; //$cell = $data[$c]; $cell = $rowlines[$c][$r]; $l = strlen($cell); if ($l > $w) { $cell = substr($cell, 0, $w); } if (isset($attribs['bold'])) { $cell = $this->bold($cell); } if ($l < $w) { // not using str_pad here because we may // add bold escape characters to $cell $cell .= str_repeat(' ', $w - $l); } $rowtext .= $cellstart . $cell . $cellend; } $rowtext .= $rowend; $this->displayLine($rowtext); } } if ($borderline) { $this->displayLine($borderline); } } function outputData($data, $command) { switch ($command) { case 'list-all': $this->startTable($data); if (isset($data['headline']) && is_array($data['headline'])) $this->tableRow($data['headline'], array('bold' => true), array(1 => array('wrap' => 55))); foreach($data['data'] as $category) { foreach($category as $pkg) { unset($pkg[3]); $this->tableRow($pkg, null, array(1 => array('wrap' => 55))); } }; $this->endTable(); break; default: if (is_array($data)) { $this->startTable($data); if (isset($data['headline']) && is_array($data['headline'])) $this->tableRow($data['headline'], array('bold' => true), array(1 => array('wrap' => 55))); foreach($data['data'] as $row) $this->tableRow($row); $this->endTable(); } else { $this->displayLine($data); }; }; } // }}} // {{{ bold($text) function bold($text) { if (empty($this->term['bold'])) { return strtoupper($text); } return $this->term['bold'] . $text . $this->term['normal']; } // }}} } ?> Index: pear/PEAR_Frontend_Web/Frontend/Web/error.tpl.html +++ pear/PEAR_Frontend_Web/Frontend/Web/error.tpl.html <!-- INCLUDE header.inc.tpl.html --> <TABLE border="0"> <TR> <TD width="20"> </TD> <TD> <img src="{ImgError}" border="0"> <b>Error</b><br><br> {Error} <br> <a href="{InstallerURL}{param}">Back</a> </TD> </TR> </TABLE> </BODY> </HTML>
Index: pear/PEAR_Frontend_Web/Frontend/Web.php diff -u pear/PEAR_Frontend_Web/Frontend/Web.php:1.1 pear/PEAR_Frontend_Web/Frontend/Web.php:1.2 --- pear/PEAR_Frontend_Web/Frontend/Web.php:1.1 Mon May 27 07:50:36 2002 +++ pear/PEAR_Frontend_Web/Frontend/Web.php Mon May 27 11:20:29 2002 @@ -16,7 +16,7 @@ | Author: Christian Dickmann <dickmann@php.net> | +----------------------------------------------------------------------+ - $id$ + $Id: Web.php,v 1.2 2002/05/27 15:20:29 dickmann Exp $ */ require_once "PEAR.php"; @@ -35,7 +35,8 @@ var $lp = ''; // line prefix var $tpl; var $table; - + var $data = array(); + var $params = array(); // }}} @@ -66,7 +67,22 @@ function displayError($eobj) { - return $this->displayLine($eobj->getMessage()); + $msg = $eobj->getMessage(); + $msg = nl2br($msg); + + $tpl = new IntegratedTemplate(dirname(__FILE__)."/Web"); + $tpl->loadTemplateFile("error.tpl.html"); + $tpl->setVariable("InstallerURL", $_SERVER["PHP_SELF"]); + $tpl->setVariable("ImgPEAR", $_SERVER["PHP_SELF"].'?img=pear'); + $tpl->setVariable("ImgError", $_SERVER["PHP_SELF"].'?img=error'); + + $tpl->setVariable("Error", $msg); + if (isset($_GET['command'])) + $tpl->setVariable("param", '?command='.$_GET['command']); + + $tpl->show(); + exit; + return true; } // }}} @@ -129,8 +145,8 @@ { $tpl->setCurrentBlock("Row"); $tpl->setVariable("ImgPackage", $_SERVER["PHP_SELF"].'?img=package'); - $compare = version_compare($row[1], $row[4]); - if (!$row[4]) { + $compare = version_compare($row[1], $row[2]); + if (!$row[2]) { $inst = sprintf('<a href="%s?install=%s"><img src="%s?img=install" border="0"></a>', $_SERVER["PHP_SELF"], $row[0], $_SERVER["PHP_SELF"]); $del = ''; @@ -148,7 +164,7 @@ $_SERVER["PHP_SELF"], $row[0], $row[0], $_SERVER["PHP_SELF"]); $tpl->setVariable("Version", $row[1]); - $tpl->setVariable("Installed", $row[4]); + $tpl->setVariable("Installed", $row[2]); $tpl->setVariable("Install", $inst); $tpl->setVariable("Delete", $del); $tpl->setVariable("Info", $info); @@ -171,7 +187,24 @@ { case 'list-all': return $this->outputListAll($data); + case 'install': + case 'uninstall': + return true; + case 'login': + if ($_SERVER["REQUEST_METHOD"] == "POST") + break; + else + $this->data[$command] = $data; + return true; + case 'logout': + case 'package': + echo $data; + break; + default: + echo $data; }; + + return true; } function userDialog($command, $prompts, $types = array(), $defaults = array()) @@ -190,6 +223,7 @@ $tpl->setVariable("ImgPEAR", $_SERVER["PHP_SELF"].'?img=pear'); $tpl->setVariable("InstallerURL", $_SERVER["PHP_SELF"]); $tpl->setVariable("Command", $command); + $tpl->setVariable("Headline", nl2br($this->data[$command])); if (is_array($prompts)) { Index: pear/PEAR_Frontend_Web/Frontend/Web/userDialog.tpl.html diff -u pear/PEAR_Frontend_Web/Frontend/Web/userDialog.tpl.html:1.1 pear/PEAR_Frontend_Web/Frontend/Web/userDialog.tpl.html:1.2 --- pear/PEAR_Frontend_Web/Frontend/Web/userDialog.tpl.html:1.1 Mon May 27 07:49:35 2002 +++ pear/PEAR_Frontend_Web/Frontend/Web/userDialog.tpl.html Mon May 27 11:20:29 2002 @@ -1,4 +1,5 @@ <!-- INCLUDE header.inc.tpl.html --> + {Headline} <form action="{InstallerURL}?command={Command}" method="post"> <TABLE border="0"> <!-- BEGIN InputField --> Index: pear/PEAR_Frontend_Web/Frontend/CLI.php +++ pear/PEAR_Frontend_Web/Frontend/CLI.php <?php /* +----------------------------------------------------------------------+ | PHP Version 4 | +----------------------------------------------------------------------+ | Copyright (c) 1997-2002 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 2.02 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | | available at through the world-wide-web at | | http://www.php.net/license/2_02.txt. | | If you did not receive a copy of the PHP license and are unable to | | obtain it through the world-wide-web, please send a note to | | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Author: Stig Sæther Bakken <ssb@fast.no> | +----------------------------------------------------------------------+ $Id: CLI.php,v 1.1 2002/05/27 15:20:29 dickmann Exp $ */ require_once "PEAR.php"; class PEAR_Frontend_CLI extends PEAR { // {{{ properties /** * What type of user interface this frontend is for. * @var string * @access public */ var $type = 'CLI'; var $lp = ''; // line prefix var $omode = 'plain'; var $params = array(); var $term = array( 'bold' => '', 'normal' => '', ); // }}} // {{{ constructor function PEAR_Frontend_CLI() { parent::PEAR(); $term = getenv('TERM'); //(cox) $_ENV is empty for me in 4.1.1 if ($term) { // XXX can use ncurses extension here, if available if (preg_match('/^(xterm|vt220|linux)/', $term)) { $this->term['bold'] = sprintf("%c%c%c%c", 27, 91, 49, 109); $this->term['normal']=sprintf("%c%c%c", 27, 91, 109); } elseif (preg_match('/^vt100/', $term)) { $this->term['bold'] = sprintf("%c%c%c%c%c%c", 27, 91, 49, 109, 0, 0); $this->term['normal']=sprintf("%c%c%c%c%c", 27, 91, 109, 0, 0); } } elseif (OS_WINDOWS) { // XXX add ANSI codes here } } // }}} // {{{ displayLine(text) function displayLine($text) { print "$this->lp$text\n"; } function display($text) { print $text; } // }}} // {{{ displayError(eobj) function displayError($eobj) { return $this->displayLine($eobj->getMessage()); } // }}} // {{{ displayFatalError(eobj) function displayFatalError($eobj) { $this->displayError($eobj); exit(1); } // }}} // {{{ displayHeading(title) function displayHeading($title) { print $this->lp.$this->bold($title)."\n"; print $this->lp.str_repeat("=", strlen($title))."\n"; } // }}} // {{{ userDialog(prompt, [type], [default]) function userDialog($prompt, $type = 'text', $default = '') { if ($type == 'password') { system('stty -echo'); } print "$this->lp$prompt "; if ($default) { print "[$default] "; } print ": "; $fp = fopen("php://stdin", "r"); $line = fgets($fp, 2048); fclose($fp); if ($type == 'password') { system('stty echo'); print "\n"; } if ($default && trim($line) == "") { return $default; } return $line; } // }}} // {{{ userConfirm(prompt, [default]) function userConfirm($prompt, $default = 'yes') { static $positives = array('y', 'yes', 'on', '1'); static $negatives = array('n', 'no', 'off', '0'); print "$this->lp$prompt [$default] : "; $fp = fopen("php://stdin", "r"); $line = fgets($fp, 2048); fclose($fp); $answer = strtolower(trim($line)); if (empty($answer)) { $answer = $default; } if (in_array($answer, $positives)) { return true; } if (in_array($answer, $negatives)) { return false; } if (in_array($default, $positives)) { return true; } return false; } // }}} // {{{ startTable([params]) function startTable($params = array()) { $this->omode = 'table'; $params['table_data'] = array(); $params['widest'] = array(); // indexed by column $params['highest'] = array(); // indexed by row $params['ncols'] = 0; $this->params = $params; } // }}} // {{{ tableRow(columns, [rowparams], [colparams]) function tableRow($columns, $rowparams = array(), $colparams = array()) { $highest = 1; for ($i = 0; $i < sizeof($columns); $i++) { $col = &$columns[$i]; if (isset($colparams[$i]) && !empty($colparams[$i]['wrap'])) { $col = wordwrap($col, $colparams[$i]['wrap'], "\n", 1); } if (strpos($col, "\n") !== false) { $multiline = explode("\n", $col); $w = 0; foreach ($multiline as $n => $line) { if (strlen($line) > $w) { $w = strlen($line); } } $lines = sizeof($lines); } else { $w = strlen($col); } if ($w > @$this->params['widest'][$i]) { $this->params['widest'][$i] = $w; } $tmp = count_chars($columns[$i], 1); // handle unix, mac and windows formats $lines = (isset($tmp[10]) ? $tmp[10] : @$tmp[13]) + 1; if ($lines > $highest) { $highest = $lines; } } if (sizeof($columns) > $this->params['ncols']) { $this->params['ncols'] = sizeof($columns); } $new_row = array( 'data' => $columns, 'height' => $highest, 'rowparams' => $rowparams, 'colparams' => $colparams, ); $this->params['table_data'][] = $new_row; } // }}} // {{{ endTable() function endTable() { $this->omode = ''; extract($this->params); if (!empty($caption)) { $this->displayHeading($caption); } if (count($table_data) == 0) { return; } if (!isset($width)) { $width = $widest; } else { for ($i = 0; $i < $ncols; $i++) { if (!isset($width[$i])) { $width[$i] = $widest[$i]; } } } if (empty($border)) { $cellstart = ''; $cellend = ' '; $rowend = ''; $padrowend = false; $borderline = ''; } else { $cellstart = '| '; $cellend = ' '; $rowend = '|'; $padrowend = true; $borderline = '+'; foreach ($width as $w) { $borderline .= str_repeat('-', $w + strlen($cellstart) + strlen($cellend) - 1); $borderline .= '+'; } } if ($borderline) { $this->displayLine($borderline); } for ($i = 0; $i < sizeof($table_data); $i++) { extract($table_data[$i]); $rowlines = array(); if ($height > 1) { for ($c = 0; $c < sizeof($data); $c++) { $rowlines[$c] = preg_split('/(\r?\n|\r)/', $data[$c]); if (sizeof($rowlines[$c]) < $height) { $rowlines[$c] = array_pad($rowlines[$c], $height, ''); } } } else { for ($c = 0; $c < sizeof($data); $c++) { $rowlines[$c] = array($data[$c]); } } for ($r = 0; $r < $height; $r++) { $rowtext = ''; for ($c = 0; $c < sizeof($data); $c++) { if (isset($colparams[$c])) { $attribs = array_merge($rowparams, $colparams); } else { $attribs = $rowparams; } $w = isset($width[$c]) ? $width[$c] : 0; //$cell = $data[$c]; $cell = $rowlines[$c][$r]; $l = strlen($cell); if ($l > $w) { $cell = substr($cell, 0, $w); } if (isset($attribs['bold'])) { $cell = $this->bold($cell); } if ($l < $w) { // not using str_pad here because we may // add bold escape characters to $cell $cell .= str_repeat(' ', $w - $l); } $rowtext .= $cellstart . $cell . $cellend; } $rowtext .= $rowend; $this->displayLine($rowtext); } } if ($borderline) { $this->displayLine($borderline); } } function outputData($data, $command) { switch ($command) { case 'list-all': $this->startTable($data); if (isset($data['headline']) && is_array($data['headline'])) $this->tableRow($data['headline'], array('bold' => true), array(1 => array('wrap' => 55))); foreach($data['data'] as $category) { foreach($category as $pkg) { unset($pkg[3]); $this->tableRow($pkg, null, array(1 => array('wrap' => 55))); } }; $this->endTable(); break; default: if (is_array($data)) { $this->startTable($data); if (isset($data['headline']) && is_array($data['headline'])) $this->tableRow($data['headline'], array('bold' => true), array(1 => array('wrap' => 55))); foreach($data['data'] as $row) $this->tableRow($row); $this->endTable(); } else { $this->displayLine($data); }; }; } // }}} // {{{ bold($text) function bold($text) { if (empty($this->term['bold'])) { return strtoupper($text); } return $this->term['bold'] . $text . $this->term['normal']; } // }}} } ?> Index: pear/PEAR_Frontend_Web/Frontend/Web/error.tpl.html +++ pear/PEAR_Frontend_Web/Frontend/Web/error.tpl.html <!-- INCLUDE header.inc.tpl.html --> <TABLE border="0"> <TR> <TD width="20"> </TD> <TD> <img src="{ImgError}" border="0"> <b>Error</b><br><br> {Error} <br> <a href="{InstallerURL}{param}">Back</a> </TD> </TR> </TABLE> </BODY> </HTML>