From: Michael M Slusarz Date: Wed, 12 Nov 2008 01:52:11 +0000 (-0700) Subject: Update msexcel Viewer. X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=ebbe14762ce6c189a474809ac9aae81b1ece0c6e;p=horde.git Update msexcel Viewer. --- diff --git a/framework/Mime/lib/Horde/Mime/Viewer/msexcel.php b/framework/Mime/lib/Horde/Mime/Viewer/msexcel.php index fc79250ea..ad1f29fa5 100644 --- a/framework/Mime/lib/Horde/Mime/Viewer/msexcel.php +++ b/framework/Mime/lib/Horde/Mime/Viewer/msexcel.php @@ -14,42 +14,46 @@ class Horde_Mime_Viewer_msexcel extends Horde_Mime_Viewer_Driver { /** - * Render out the currently data using xlhtml. + * Can this driver render various views? * - * @param array $params Any params this Viewer may need. + * @var boolean + */ + protected $_capability = array( + 'embedded' => false, + 'full' => true, + 'info' => false, + 'inline' => false + ); + + /** + * Return the full rendered version of the Horde_Mime_Part object. * - * @return string The rendered data. + * @return array See Horde_Mime_Viewer_Driver::render(). */ - public function render($params = array()) + protected function _render() { - /* Check to make sure the program actually exists. */ - if (!file_exists($GLOBALS['mime_drivers']['horde']['msexcel']['location'])) { - return '
' . sprintf(_("The program used to view this data type (%s) was not found on the system."), $GLOBALS['mime_drivers']['horde']['msexcel']['location']) . '
'; + /* Check to make sure the viewer program exists. */ + if (!isset($this->_conf['location']) || + !file_exists($this->_conf['location'])) { + return array(); } $data = ''; $tmp_xls = Horde::getTempFile('horde_msexcel'); $fh = fopen($tmp_xls, 'w'); - fwrite($fh, $this->mime_part->getContents()); + fwrite($fh, $this->_mimepart->getContents()); fclose($fh); - $fh = popen($GLOBALS['mime_drivers']['horde']['msexcel']['location'] . " -nh $tmp_xls 2>&1", 'r'); + $fh = popen($this->_conf['location'] . " -nh $tmp_xls 2>&1", 'r'); while (($rc = fgets($fh, 8192))) { $data .= $rc; } pclose($fh); - return $data; - } - - /** - * Return the MIME content type of the rendered content. - * - * @return string The content type of the output. - */ - public function getType() - { - return 'text/html; charset=' . NLS::getCharset(); + return array( + 'data' => $data, + 'type' => 'text/html; charset=' . NLS::getCharset() + ); } }