From: Michael M Slusarz Date: Wed, 12 Nov 2008 18:49:05 +0000 (-0700) Subject: Update mspowerpoint Viewer. X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=d1939b95facc87e385a743f08cea2c9e0c1ad2b5;p=horde.git Update mspowerpoint Viewer. --- diff --git a/framework/Mime/lib/Horde/Mime/Viewer/mspowerpoint.php b/framework/Mime/lib/Horde/Mime/Viewer/mspowerpoint.php index 2d19fe018..8a623089a 100644 --- a/framework/Mime/lib/Horde/Mime/Viewer/mspowerpoint.php +++ b/framework/Mime/lib/Horde/Mime/Viewer/mspowerpoint.php @@ -14,42 +14,44 @@ class Horde_Mime_Viewer_mspowerpoint extends Horde_Mime_Viewer_Driver { /** - * Render out the current data using ppthtml. + * Can this driver render various views? * - * @param array $params Any parameters the 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 contents. + * @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']['mspowerpoint']['location'])) { - return '
' . sprintf(_("The program used to view this data type (%s) was not found on the system."), $GLOBALS['mime_drivers']['horde']['mspowerpoint']['location']) . '
'; + /* Check to make sure the viewer program exists. */ + if (!isset($this->_conf['location']) || + !file_exists($this->_conf['location'])) { + return array(); } $data = ''; $tmp_ppt = Horde::getTempFile('horde_mspowerpoint'); - $fh = fopen($tmp_ppt, 'w'); - fwrite($fh, $this->mime_part->getContents()); - fclose($fh); + file_put_contents($tmp_ppt, $this->_mimepart->getContents()); - $fh = popen($GLOBALS['mime_drivers']['horde']['mspowerpoint']['location'] . " $tmp_ppt 2>&1", 'r'); + $fh = popen($this->_conf['location'] . " $tmp_ppt 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() + ); } }