From 47e4923ee817782015abd18357091ac55376db25 Mon Sep 17 00:00:00 2001 From: Michael M Slusarz Date: Tue, 11 Nov 2008 01:58:59 -0700 Subject: [PATCH] Allow user-defined params to Viewer. Also, a better algorithm to determine whether we can view a part in a popup window. --- imp/lib/Contents.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/imp/lib/Contents.php b/imp/lib/Contents.php index 97ec21b6e..7cbdde89c 100644 --- a/imp/lib/Contents.php +++ b/imp/lib/Contents.php @@ -283,6 +283,7 @@ class IMP_Contents * @param string $mode Either 'full', 'inline', or 'info'. * @param array $options Additional options: *
+     * 'params' - (array) Additional params to set.
      * 'type' - (string) Use this MIME type instead of the MIME type
      *          identified in the MIME part.
      * 
@@ -290,6 +291,7 @@ class IMP_Contents * @return array An array of information: *
      * 'data' - (string) The rendered data.
+     * 'ids' - (array) TODO
      * 'name' - (string) The name of the part.
      * 'status' - (array) An array of status information to be displayed to
      *            the user.  Consists of arrays with the following keys:
@@ -305,6 +307,9 @@ class IMP_Contents
         $viewer = Horde_Mime_Viewer::factory(empty($options['type']) ? $mime_part->getType() : $options['type']);
         $viewer->setMIMEPart($mime_part);
         $viewer->setParams(array('contents' => &$this));
+        if (!empty($options['params'])) {
+            $viewer->setParams($options['params']);
+        }
 
         $ret = $viewer->render($mode);
         $ret['name'] = $mime_part->getName(true);
@@ -506,7 +511,7 @@ class IMP_Contents
             }
 
             if ($mask & self::SUMMARY_DESCRIP_LINK) {
-                $part['description'] = $is_atc
+                $part['description'] = (!$viewer || $viewer->canRender('full'))
                     ? $this->linkViewJS($mime_part, 'view_attach', htmlspecialchars($description), array('jstext' => sprintf(_("View %s [%s]"), $description, $mime_type), 'params' => $param_array))
                     : htmlspecialchars($description);
             } elseif ($mask & self::SUMMARY_DESCRIP_NOLINK) {
-- 
2.11.0