Commit 5ff58a8651863e978035b6cb2cc9ba3fe3243e2b
1 parent
0dd3c5bc
display of thumbnail in Document View page
Story ID:1087378. Document Thumbnail Committed by: Paul Barrett Reviewed by: Jarrett Jordaan
Showing
2 changed files
with
27 additions
and
4 deletions
templates/ktcore/document/view.smarty
| @@ -35,9 +35,20 @@ these tasks, use the Request Assistance action.{/i18n} | @@ -35,9 +35,20 @@ these tasks, use the Request Assistance action.{/i18n} | ||
| 35 | </div> | 35 | </div> |
| 36 | {/if} | 36 | {/if} |
| 37 | 37 | ||
| 38 | -{foreach item=oFieldset from=$fieldsets} | ||
| 39 | -{$oFieldset->render($document_data)} | ||
| 40 | -{/foreach} | 38 | +{if $thumbnail eq ''} |
| 39 | + <div> | ||
| 40 | + {foreach item=oFieldset from=$fieldsets} | ||
| 41 | + {$oFieldset->render($document_data)} | ||
| 42 | + {/foreach} | ||
| 43 | + </div> | ||
| 44 | +{else} | ||
| 45 | + <div style="float:left;width:85%;"> | ||
| 46 | + {foreach item=oFieldset from=$fieldsets} | ||
| 47 | + {$oFieldset->render($document_data)} | ||
| 48 | + {/foreach} | ||
| 49 | + </div> | ||
| 50 | + <div style="padding-top:45px;">{$thumbnail}</div> | ||
| 51 | +{/if} | ||
| 41 | 52 | ||
| 42 | {if !empty($viewlet_data)} | 53 | {if !empty($viewlet_data)} |
| 43 | 54 |
view.php
| @@ -210,7 +210,6 @@ class ViewDocumentDispatcher extends KTStandardDispatcher { | @@ -210,7 +210,6 @@ class ViewDocumentDispatcher extends KTStandardDispatcher { | ||
| 210 | array_push($fieldsets, new $displayClass($oFieldset)); | 210 | array_push($fieldsets, new $displayClass($oFieldset)); |
| 211 | } | 211 | } |
| 212 | 212 | ||
| 213 | - | ||
| 214 | $checkout_user = 'Unknown user'; | 213 | $checkout_user = 'Unknown user'; |
| 215 | if ($oDocument->getIsCheckedOut() == 1) { | 214 | if ($oDocument->getIsCheckedOut() == 1) { |
| 216 | $oCOU = User::get($oDocument->getCheckedOutUserId()); | 215 | $oCOU = User::get($oDocument->getCheckedOutUserId()); |
| @@ -249,6 +248,18 @@ class ViewDocumentDispatcher extends KTStandardDispatcher { | @@ -249,6 +248,18 @@ class ViewDocumentDispatcher extends KTStandardDispatcher { | ||
| 249 | $content_class = 'view withviewlets'; | 248 | $content_class = 'view withviewlets'; |
| 250 | } | 249 | } |
| 251 | $this->oPage->setContentClass($content_class); | 250 | $this->oPage->setContentClass($content_class); |
| 251 | + | ||
| 252 | + // check for a thumbnail | ||
| 253 | + $thumbnail = ''; | ||
| 254 | + if (KTPluginUtil::pluginIsActive('thumbnails.generator.processor.plugin')) { | ||
| 255 | + // hook into thumbnail plugin to get display for thumbnail | ||
| 256 | + include_once(KT_DIR . '/plugins/thumbnails/thumbnails.php'); | ||
| 257 | + $thumbnailer = new ThumbnailViewlet(); | ||
| 258 | + $thumbnailDisplay = $thumbnailer->display_viewlet($document_id); | ||
| 259 | + if ($thumbnailDisplay != '') { | ||
| 260 | + $thumbnail = $thumbnailDisplay; | ||
| 261 | + } | ||
| 262 | + } | ||
| 252 | 263 | ||
| 253 | $oTemplating =& KTTemplating::getSingleton(); | 264 | $oTemplating =& KTTemplating::getSingleton(); |
| 254 | $oTemplate = $oTemplating->loadTemplate('ktcore/document/view'); | 265 | $oTemplate = $oTemplating->loadTemplate('ktcore/document/view'); |
| @@ -263,6 +274,7 @@ class ViewDocumentDispatcher extends KTStandardDispatcher { | @@ -263,6 +274,7 @@ class ViewDocumentDispatcher extends KTStandardDispatcher { | ||
| 263 | 'document_data' => $document_data, | 274 | 'document_data' => $document_data, |
| 264 | 'fieldsets' => $fieldsets, | 275 | 'fieldsets' => $fieldsets, |
| 265 | 'viewlet_data' => $viewlet_data, | 276 | 'viewlet_data' => $viewlet_data, |
| 277 | + 'thumbnail' => $thumbnail, | ||
| 266 | ); | 278 | ); |
| 267 | //return '<pre>' . print_r($aTemplateData, true) . '</pre>'; | 279 | //return '<pre>' . print_r($aTemplateData, true) . '</pre>'; |
| 268 | return $oTemplate->render($aTemplateData); | 280 | return $oTemplate->render($aTemplateData); |