Commit d260e32194ecf83b1cd07baf6771cef2636cf4c7

Authored by Megan Watson
1 parent c446a64b

Moved css into a css file, added link to instant view.

PT: 1434184

Committed by: Megan Watson
plugins/thumbnails/templates/thumbnail_viewlet.smarty
1   -{literal}
2   -<style>
3   -.thumb-shadow {
4   - float:left;
5   - background: url(plugins/thumbnails/templates/shadowAlpha.png) no-repeat bottom right !important;
6   - background: url(plugins/thumbnails/templates/shadow.gif) no-repeat bottom right;
7   - margin: 10px 0 0 10px !important;
8   - margin: 10px 0 0 5px;
9   - }
10 1  
11   -.thumb-shadow img {
12   - display: block;
13   - position: relative;
14   - background-color: #fff;
15   - border: 1px solid #a9a9a9;
16   - margin: -6px 6px 6px -6px;
17   - padding: 4px;
18   - }
19   -</style>
20   -{/literal}
21 2 <div class="thumb-shadow">
22 3 <div>
23 4 {if $url}
24 5 <a href='{$url}' target='_blank'>
25 6 {/if}
26   - <img src="{$thumbnail}"/>
  7 + <img src="{$thumbnail}" {if $height}height="{$height}"{/if} />
27 8 {if $url}
28 9 </a>
29 10 {/if}
... ...
plugins/thumbnails/thumbnails.php
... ... @@ -235,10 +235,14 @@ class ThumbnailViewlet extends KTDocumentViewlet {
235 235 return '';
236 236 }
237 237  
  238 + // Get the CSS to render the thumbnail
  239 + global $main;
  240 + $main->requireCSSResource('plugins/thumbnails/resources/thumbnails.css');
  241 +
238 242 return $this->renderThumbnail($documentId);
239 243 }
240 244  
241   - public function renderThumbnail($documentId) {
  245 + public function renderThumbnail($documentId, $height = null) {
242 246 // Set up the template
243 247 $oKTTemplating =& KTTemplating::getSingleton();
244 248 $oTemplate =& $oKTTemplating->loadTemplate('thumbnail_viewlet');
... ... @@ -284,10 +288,16 @@ class ThumbnailViewlet extends KTDocumentViewlet {
284 288 $thumbnailUrl = str_replace('\\', '/', $thumbnailUrl);
285 289 $thumbnailUrl = str_replace(KT_DIR, $sHostPath, $thumbnailUrl);
286 290  
287   - $oTemplate->setData(array(
  291 + $templateData = array(
288 292 'thumbnail' => $thumbnailUrl,
289 293 'url' => $url
290   - ));
  294 + );
  295 +
  296 + if(is_numeric($height)){
  297 + $templateData['height'] = $height;
  298 + }
  299 +
  300 + $oTemplate->setData($templateData);
291 301 return $oTemplate->render();
292 302 }
293 303  
... ... @@ -317,11 +327,8 @@ class ThumbnailColumn extends AdvancedColumn {
317 327 }
318 328  
319 329 function renderHeader($sReturnURL) {
320   - global $main;
321   -
322   - $path = dirname(__FILE__);
323   -
324 330 // Get the CSS to render the thumbnail
  331 + global $main;
325 332 $main->requireCSSResource('plugins/thumbnails/resources/thumbnails.css');
326 333 return '&nbsp;';
327 334 }
... ... @@ -360,6 +367,11 @@ class ThumbnailColumn extends AdvancedColumn {
360 367 return $tag;
361 368 }
362 369  
  370 + // hook into thumbnail plugin to get display for thumbnail
  371 + $thumbnailer = new ThumbnailViewlet();
  372 + $thumbnailer->setDocument($oDoc);
  373 + $thumbnailDisplay = $thumbnailer->renderThumbnail($docid, $height);
  374 + /*
363 375 $sHostPath = KTUtil::kt_url();
364 376 $plugin_path = KTPluginUtil::getPluginPath('thumbnails.generator.processor.plugin');
365 377 $thumbnailUrl = $plugin_path . 'thumbnail_view.php?documentId='.$docid;
... ... @@ -370,8 +382,9 @@ class ThumbnailColumn extends AdvancedColumn {
370 382 <div class="thumb-shadow">
371 383 <img src="'.$thumbnailUrl.'" height='.$height.' />
372 384 </div>';
  385 + */
373 386  
374   - return $sInfo;
  387 + return $thumbnailDisplay;
375 388 }
376 389 return '';
377 390 }
... ...