/home/coolpkct/www/websites/cake3.cool.rocks/admin/plugins/library/libraryimagesscreen.inc.php
<?php
/**
* Part of Showkase web site management package
*
* @package Showkase
* @author Jack Hardie {@link http://www.jhardie.com}
* @copyright Copyright (c) 2012, SimpleViewer Inc.
*/
defined('SK_ACCESS')||die('<h1>403: Forbidden</h1>');
require_once 'classes'.DIRECTORY_SEPARATOR.'screen.php';
require_once 'classes'.DIRECTORY_SEPARATOR.'helpers.php';
/**
* Images screen
*
* @package Showkase
*/
class LibraryImagesScreen extends Screen
{
/**
* @var string overrides some of html in parent
*/
protected $customHeadHtml = '
<script src="scripts/formchange.js"></script>
<script src="scripts/jquery/jquery-ui-min.js"></script>
<script src="scripts/jimages.js"></script>
';
/**
* constructs ImagesScreen class
* @param string contains text for html <title></title> tags
* @param string html id for body tag
*/
function __construct($page)
{
parent::__construct('Showkase – library', 'images', 'library images');
$this->pageType = 'library';
$this->page = $page;
$bb = new LibraryButtonbar();
$this->subNavHtml = $bb->getHtml();
}
/**
* get html for images screen
* Note that some class names are significant for manager.js
*
* @access public
* @return string html
* @param string gallery reference number
* @param array image data
*/
function getContentHtml($context)
{
if ($context['imageCount'] == 0)
{
return '
<div class="subhead">
<div class="hgroup">
<h2><a href="#" class="popper" data-original-title="Image Library" data-content="You can store images here and use them later within your web pages. Galleries have their own image stores." >Image Library</a></h2>
</div>
<ul class="buttons">
<li><button type="button" onclick="window.location=\'index.php\';" class="btn btn-danger">Cancel</button></li>
</ul>
</div>
<p class="info"><p class="info">You have no images stored here</p>';
}
$gallery = $this->page->gallery;
$imageObjects = $gallery->getImageObjects();
$galleryRef = $gallery->getGalleryRef();
$host = Helpers::getHost();
$html = <<<EOD
<form class="changecheck" action="index.php?cmd=imagelib" method="post">
<div class="subhead">
<div class="hgroup">
<h2><a href="#" class="popper" title="Image Library" data-content="You can store images here and use them later within your web pages. Galleries have their own image stores." >Image Library</a></h2>
</div>
<ul class="buttons">
<li><button type="button" onclick="window.location='index.php';" class="btn btn-danger">Cancel</button></li>
<li>
<input type="hidden" name="token" value="{$context['token']}" >
<input type="hidden" name="imagessubmitted" value="true" />
<button type="submit" class="btn formbutton btn-success" >Delete</button></li>
</ul>
</div>
<table class="imagelist" id="imagelisttable">
<thead>
<tr>
<th class="ilfilename" colspan="2">Image</th><th>Delete</th><th class="ilcaption">http://{$host}</th>
</tr>
</thead>
<tbody>
EOD;
$i = 0;
foreach ($imageObjects as $key => $imageObject)
{
$relativeUrl = $gallery->getUrlRelSvm($imageObject->getImagePathRelGallery());
$absUrl = $imageObject->getImagePathRelGallery();
$fileName = $imageObject->getImageFileName();
$thumbName = Helpers::changeFileExtension($fileName, 'jpg', array('jpeg', 'JPG', 'JPEG'));
$src = file_exists($gallery->getThumbDirPathRelSvm().$thumbName) ?
htmlspecialchars($gallery->getThumbDirUrlRelSvm().$thumbName, ENT_QUOTES, 'UTF-8') :
rtrim(IMAGE_SRC, '\\/').'/nothumb.gif';
$fileName = htmlspecialchars($fileName, ENT_QUOTES, 'UTF-8');
$imageSize = $imageObject->getImageSizeArray();
if ($imageSize === false) $sizeString = '';
else $sizeString = $imageSize[0].' x '.$imageSize[1];
$chkBoxId = 'cap'.$i;
$html .= '<tr>
<td class="ilthumbnail"><a href="'.$relativeUrl.'" target="preview"><img src="'.$src.'" width="'.THUMB_DISPLAY_SIZE.'" height="'.THUMB_DISPLAY_SIZE.'" alt="" /></a></td>
<td class="ilfilename">
<div class="truncate">'.$fileName.'</div>
<div class="imagesize">'.$sizeString.'</div>
</td>
<td class="ilselectdelete"><input type="checkbox" name="del['.$i.']" id="dbox'.$i.'" class="selectdelete" /></td>
<td class="ilcaption">'.htmlspecialchars($gallery->getRootUrl().$absUrl, ENT_QUOTES, 'UTF-8').'</td>
</tr>';
$i++;
}
$html .= '
</tbody>
</table>
<table id="captioncontrols" class="imagelist" >
<tr class="firstrow">
<td class="ilthumbnail"> </td>
<td class="ilfilename" >Select all</td>
<td class="ilselectalldelete"><input type="checkbox" name="selectalldelete" id="selectalldelete" /></td>
<td class="ilcaption"> </td>
</tr>
</table>
</form>
';
return $html;
}
}