![]() |
|
Welcome to the Computer Webmaster Gaming Console Graphics Forum forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact contact us. |
| |||||||
| Pear Pear programming, this is a very complex subject as with using pear with php can be a difficult task for some, so lets talk pear. |
![]() |
| | LinkBack | Thread Tools | Display Modes |
| | #1 | ||
| tias Sat May 19 15:36:40 2007 UTC Modified files: /pear/PEAR_Frontend_Web pearfrontendweb.php /pear/PEAR_Frontend_Web/Frontend Web.php /pear/PEAR_Frontend_Web/Frontend/Web Docviewer.php /pear/PEAR_Frontend_Web/data style.css Log: Docviewer final: view docs of installed packages http://cvs.php.net/viewvc.cgi/pear/P...&diff_format=u Index: pear/PEAR_Frontend_Web/pearfrontendweb.php diff -u pear/PEAR_Frontend_Web/pearfrontendweb.php:1.56 pear/PEAR_Frontend_Web/pearfrontendweb.php:1.57 --- pear/PEAR_Frontend_Web/pearfrontendweb.php:1.56 Sat May 19 14:50:54 2007 +++ pear/PEAR_Frontend_Web/pearfrontendweb.php Sat May 19 15:36:39 2007 @@ -29,7 +29,7 @@ * @author Tias Guns <tias@ulyssis.org> * @copyright 1997-2007 The PHP Group * @license http://www.php.net/license/2_02.txt PHP License 2.02 - * @version CVS: $Id: pearfrontendweb.php,v 1.56 2007/05/19 14:50:54 tias Exp $ + * @version CVS: $Id: pearfrontendweb.php,v 1.57 2007/05/19 15:36:39 tias Exp $ * @link http://pear.php.net/package/PEAR_Frontend_Web * @since File available since Release 0.1 */ @@ -308,6 +308,19 @@ $docview = new PEAR_Frontend_Web_Docviewer($ui); $docview->outputListDocs($pkg['package'], $pkg['channel']); break; + case 'doc-show': + if (!isset($_GET['pkg']) || !isset($_GET['file'])) { + PEAR::raiseError('The webfrontend-command list-docs needs one \'pkg\' and one \'file\' argument.'); + break; + } + + require_once('PEAR/Frontend/Web/Docviewer.php'); + $reg = $config->getRegistry(); + $pkg = $reg->parsePackageName($_GET['pkg']); + + $docview = new PEAR_Frontend_Web_Docviewer($ui); + $docview->outputDocShow($pkg['package'], $pkg['channel'], $_GET['file']); + break; case 'list-all': // XXX Not used anymore, 'list-categories' is used instead //if (isset($_GET["mode"])) http://cvs.php.net/viewvc.cgi/pear/P...&diff_format=u Index: pear/PEAR_Frontend_Web/Frontend/Web.php diff -u pear/PEAR_Frontend_Web/Frontend/Web.php:1.72 pear/PEAR_Frontend_Web/Frontend/Web.php:1.73 --- pear/PEAR_Frontend_Web/Frontend/Web.php:1.72 Wed May 16 13:45:53 2007 +++ pear/PEAR_Frontend_Web/Frontend/Web.php Sat May 19 15:36:39 2007 @@ -23,7 +23,7 @@ * @author Tias Guns <tias@ulyssis.org> * @copyright 1997-2007 The PHP Group * @license http://www.php.net/license/2_02.txt PHP License 2.02 - * @version CVS: $Id: Web.php,v 1.72 2007/05/16 13:45:53 tias Exp $ + * @version CVS: $Id: Web.php,v 1.73 2007/05/19 15:36:39 tias Exp $ * @link http://pear.php.net/package/PEAR_Frontend_Web * @since File available since Release 0.1 */ @@ -50,7 +50,7 @@ * @author Tias Guns <tias@ulyssis.org> * @copyright 1997-2007 The PHP Group * @license http://www.php.net/license/2_02.txt PHP License 2.02 - * @version CVS: $Id: Web.php,v 1.72 2007/05/16 13:45:53 tias Exp $ + * @version CVS: $Id: Web.php,v 1.73 2007/05/19 15:36:39 tias Exp $ * @link http://pear.php.net/package/PEAR_Frontend_Web * @since File available since Release 0.1 */ @@ -421,7 +421,11 @@ $tpl->setVariable('Caption', $data['caption']); $tpl->show(); - print $this->_getListDocsDiv($data['channel'].'/'.$data['package'], $data['data']); + if (is_array($data['data'])) { + print $this->_getListDocsDiv($data['channel'].'/'.$data['package'], $data['data']); + } else { + print $data['data']; + } return true; } @@ -447,6 +451,25 @@ return $out; } + // }}} + // {{{ _outputDocShow() + + /** + * Output a documentation file of a packagename + * + * @param array $data array containing all documentation files of a packages + * + * @return boolean true (yep. i am an optimist) + */ + function _outputDocShow($data) + { + $tpl = $this->_initTemplate('caption.tpl.html'); + $tpl->setVariable('Caption', $data['caption']); + $tpl->show(); + + print '<div id="docshow">'.nl2br(htmlentities($data['data'])).'</div>'; + return true; + } // }}} // {{{ _outputListPackages() @@ -1238,6 +1261,8 @@ return true; case 'list-docs': return $this->_outputListDocs($data); + case 'doc-show': + return $this->_outputDocShow($data); case 'list-all': return $this->_outputListAll($data); case 'list-packages': http://cvs.php.net/viewvc.cgi/pear/P...&diff_format=u Index: pear/PEAR_Frontend_Web/Frontend/Web/Docviewer.php diff -u pear/PEAR_Frontend_Web/Frontend/Web/Docviewer.php:1.1 pear/PEAR_Frontend_Web/Frontend/Web/Docviewer.php:1.2 --- pear/PEAR_Frontend_Web/Frontend/Web/Docviewer.php:1.1 Sun May 13 21:38:28 2007 +++ pear/PEAR_Frontend_Web/Frontend/Web/Docviewer.php Sat May 19 15:36:40 2007 @@ -5,7 +5,7 @@ * @author Tias Guns <tias@ulyssis.org> * @copyright 1997-2007 The PHP Group * @license http://www.php.net/license/2_02.txt PHP License 2.02 - * @version CVS: $Id: Docviewer.php,v 1.1 2007/05/13 21:38:28 tias Exp $ + * @version CVS: $Id: Docviewer.php,v 1.2 2007/05/19 15:36:40 tias Exp $ * @link http://pear.php.net/package/PEAR_Frontend_Web * @since File available since Release 0.6.2 */ @@ -22,7 +22,7 @@ * @author Tias Guns <tias@ulyssis.org> * @copyright 1997-2007 The PHP Group * @license http://www.php.net/license/2_02.txt PHP License 2.02 - * @version CVS: $Id: Docviewer.php,v 1.1 2007/05/13 21:38:28 tias Exp $ + * @version CVS: $Id: Docviewer.php,v 1.2 2007/05/19 15:36:40 tias Exp $ * @link http://pear.php.net/package/PEAR_Frontend_Web * @since File available since Release 0.6.2 */ @@ -103,7 +103,7 @@ $files = $this->getDocFiles($package_name, $channel); if (count($files) == 0) { - $data = '(no documentation available)'; + $data['data'] = '(no documentation available)'; } else { foreach ($files as $name => $location) { $data['data'][$name] = $location; @@ -114,6 +114,38 @@ return true; } + /** + * Output in HTML the documentation file of given package + * + * @param string $package package name + * @param string $channel + * @param string $file + * @return true (uses the User Interface object) + */ + function outputDocShow($package_name, $channel, $file) + { + $this->outputListDocs($package_name, $channel); + + $command = 'doc-show'; + $data = array( + 'caption' => $channel.'/'.$package_name.' :: '.$file.':', + 'border' => true, + 'channel' => $channel, + 'package' => $package_name, + ); + + $files = $this->getDocFiles($package_name, $channel); + if (!isset($files[$file])) { + $data['data'] = 'File '.$file.' is not part of the documentation of this package.'; + } else { + $data['data'] = file_get_contents($files[$file]); + //$data['data'] = $file; + } + $this->ui->outputData($data, $command); + + return true; + } + } ?> http://cvs.php.net/viewvc.cgi/pear/P...&diff_format=u Index: pear/PEAR_Frontend_Web/data/style.css diff -u pear/PEAR_Frontend_Web/data/style.css:1.1 pear/PEAR_Frontend_Web/data/style.css:1.2 --- pear/PEAR_Frontend_Web/data/style.css:1.1 Wed May 16 13:14:38 2007 +++ pear/PEAR_Frontend_Web/data/style.css Sat May 19 15:36:40 2007 @@ -211,3 +211,8 @@ table.DHTML_Category_Expand { cursor: hand; } + +#docshow { + padding: 0.5em 0.5em 0.5em 0.5em; + border-style: double; +} | |||
|
| Featured Websites | ||||
|
![]() |
| Tags: cvs, docviewerphp, pear, pearfrontendwebphp, pear_frontend_web, stylecss, webphp |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| cvs: pear /PEAR_Frontend_Web package.xml pearfrontendweb.php pearweb.php /PEAR_Frontend_Web/docs example.php index.php.txt | Pear | 0 | 05-20-2007 7:42 PM | |
| cvs: pear /PEAR_Frontend_Web/Frontend/Web/data package.js style.css /PEAR_Frontend_Web/Frontend/Web/data/images category.jpg config.gif download.gif error.gif info.gif infoplus.gif install.gif install_fail.gif install_ok.gif install_wait.gif login.g | Pear | 0 | 05-20-2007 7:42 PM | |
| cvs: pear /PEAR_Frontend_Web package.xml /PEAR_Frontend_Web/Frontend Web.php | Pear | 0 | 05-20-2007 7:42 PM | |
| cvs: pear /PEAR_Frontend_Web package.xml pearweb.php /PEAR_Frontend_Web/Frontend Web.php /PEAR_Frontend_Web/docs example.php index.php.txt | Pear | 0 | 05-20-2007 7:42 PM | |
| cvs: pear(1) /PEAR_Frontend_Web/Frontend Web_Command_Forward_Compatible.php /PEAR_Frontend_Web/Frontend/Web Command_Forward_Compatible.php | Pear | 0 | 05-20-2007 7:42 PM | |
| Featured Websites | ||||
|