diff --git a/templates/ktcore/document/view.smarty b/templates/ktcore/document/view.smarty
index 120e687..bb79e1b 100644
--- a/templates/ktcore/document/view.smarty
+++ b/templates/ktcore/document/view.smarty
@@ -35,9 +35,20 @@ these tasks, use the Request Assistance action.{/i18n}
{/if}
-{foreach item=oFieldset from=$fieldsets}
-{$oFieldset->render($document_data)}
-{/foreach}
+{if $thumbnail eq ''}
+
+ {foreach item=oFieldset from=$fieldsets}
+ {$oFieldset->render($document_data)}
+ {/foreach}
+
+{else}
+
+ {foreach item=oFieldset from=$fieldsets}
+ {$oFieldset->render($document_data)}
+ {/foreach}
+
+ {$thumbnail}
+{/if}
{if !empty($viewlet_data)}
diff --git a/view.php b/view.php
index 89e0573..2c1031c 100644
--- a/view.php
+++ b/view.php
@@ -210,7 +210,6 @@ class ViewDocumentDispatcher extends KTStandardDispatcher {
array_push($fieldsets, new $displayClass($oFieldset));
}
-
$checkout_user = 'Unknown user';
if ($oDocument->getIsCheckedOut() == 1) {
$oCOU = User::get($oDocument->getCheckedOutUserId());
@@ -249,6 +248,18 @@ class ViewDocumentDispatcher extends KTStandardDispatcher {
$content_class = 'view withviewlets';
}
$this->oPage->setContentClass($content_class);
+
+ // check for a thumbnail
+ $thumbnail = '';
+ if (KTPluginUtil::pluginIsActive('thumbnails.generator.processor.plugin')) {
+ // hook into thumbnail plugin to get display for thumbnail
+ include_once(KT_DIR . '/plugins/thumbnails/thumbnails.php');
+ $thumbnailer = new ThumbnailViewlet();
+ $thumbnailDisplay = $thumbnailer->display_viewlet($document_id);
+ if ($thumbnailDisplay != '') {
+ $thumbnail = $thumbnailDisplay;
+ }
+ }
$oTemplating =& KTTemplating::getSingleton();
$oTemplate = $oTemplating->loadTemplate('ktcore/document/view');
@@ -263,6 +274,7 @@ class ViewDocumentDispatcher extends KTStandardDispatcher {
'document_data' => $document_data,
'fieldsets' => $fieldsets,
'viewlet_data' => $viewlet_data,
+ 'thumbnail' => $thumbnail,
);
//return '' . print_r($aTemplateData, true) . '
';
return $oTemplate->render($aTemplateData);