/home/coolpkct/www/websites/cake3.cool.rocks/admin/plugins/juicebox/juiceboximagesscreen.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';
require_once 'classes'.DIRECTORY_SEPARATOR.'imagescreenhelper.php';
 
 /**
  * Images screen
  *
  * @package Showkase
  */
  class JuiceboxImagesScreen 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
    */
    public function __construct(JuiceboxPage $page)
    {
      parent::__construct('Showkase &ndash; images', 'images', 'pages images juicebox');
      $this->page = $page;
      $this->helper = new ImageScreenHelper($page);
      $bb = new JuiceboxButtonbar();
      $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 array context
    */
    public function getContentHtml($context)
    {
      if(!$this->page->isSupportedPageType()) return $this->helper->getUnsupportedPageHtml();
      if ($context['imageCount'] == 0) return $this->helper->getNoImagesHtml($context);
      $galleryRef = $this->page->gallery->getGalleryRef();
      $headerHtml = $this->helper->getHeaderHtml($context);
      $optionsHtml = $this->helper->getSortOptions();
      $thumbIndex = $this->page->gallery->getIndexThumb();
      $html = <<<EOD
      <form class="changecheck" action="index.php?cmd=images" method="post" >
        {$headerHtml}
      <div class="sortorder">
        <select name="sortOrder">
          {$optionsHtml}
        </select>
      </div>
      <table class="imagelist" id="imagelisttable">
        <thead>
        <tr>
          <th class="ilthumbnail">Image</th>
          <th class="ilfilename"></th>
          <th class="ilselectdelete">Delete</th>
          <th class="ilselectindex"><span class="tipper" title="Show in gallery index page">Index<img alt="tooltip icon" src="img/comment.png"></span></th>
          <th class="illinktarget"><span class="tipper" title="Open link in new window/tab">_blank<img alt="tooltip icon" src="img/comment.png"></span></th>
          <th class="ilcaption"><span class="title">Title</span> / <span class="caption">Caption</span> / <span class="url">Link URL</span></th>
          <th class="ilselect">Select</th></tr>
        </thead>
        <tbody id="sortable">
EOD;
      $i = 0;
      foreach ($this->helper->getImageData() as $key => $image)
      {
        $indexSelected = $image['fileName'] == $thumbIndex
            ? 'checked'
            : '';
        $targetSelected = $image['linkTarget'] == '_blank'
            ? 'checked'
            : '';
        $html .= '<tr id="image_'.$i.'">
          <td class="ilthumbnail">
            <a href="'.$image['url'].'" target="preview"><img src="'.$image['src'].'" width="'.THUMB_DISPLAY_SIZE.'" alt="" ></a>
          </td>
          <td class="ilfilename">
            <div class="truncate">'.$image['fileName'].'</div>
            <div class="imagesize">'.$image['sizeString'].'</div>
          </td>
          <td class="ilselectdelete">
            <input type="checkbox" name="del['.$i.']" id="dbox'.$i.'" class="selectdelete" >
          </td>
          <td class="ilselectindex">
            <input type="radio" name="index" value="'.$image['fileName'].'" '.$indexSelected.'>
          </td>
          <td class="illinktarget">
            <input type="hidden" name="target['.$i.']" value="_self">
            <input type="checkbox" name="target['.$i.']" class="selecttarget" value="_blank" '.$targetSelected.'>
          </td>
          <td class="ilcaption">
            <input name="tit['.$i.']" type="text" class="title" value="'.$image['title'].'" id="tit'.$i.'" placeholder="title">
            <input name="cap['.$i.']" type ="text" class="caption" value="'.$image['caption'].'" id="cap'.$i.'" placeholder="caption">
            <input name="url['.$i.']" type="text" class="url" value="'.$image['linkUrl'].'" id="url'.$i.'" placeholder="http://www.example.com/">
          </td>
          <td class="ilselect">
            <input type="checkbox" name="checkedtitles['.$i.']" id="titbox'.$i.'" class="selecttitle" >
            <input type="checkbox" name="checkedBoxes['.$i.']" id="cbox'.$i.'" class="selectcaption" >
            <input type="checkbox" name="checkedUrls['.$i.']" id="urlbox'.$i.'" class="selecturl" >
          </td>
        </tr>';
        $i++;
      }
      $html .= '
      </tbody>
      </table>
      <table id="captioncontrols" class="imagelist" >
        <tr class="firstrow">
          <td class="ilthumbnail">&nbsp;</td>
          <td class="ilfilename" >Select all</td>
          <td class="ilselectdelete"><input type="checkbox" name="selectalldelete" id="selectalldelete" ></td>
          <td class="ilselectindex">&nbsp;</td>
          <td class="illinktarget"><input type="checkbox" name="selectalltarget" id="selectalltarget" checked></td>
          <td class="ilcaption"><span class="title">Select all titles</span></td>
          <td class="ilselect"><input type="checkbox" name="selectalltitles" id="selectalltitles" ></td>
        </tr>
        <tr>
          <td class="ilthumbnail">&nbsp;</td>
          <td class="ilfilename" >&nbsp;</td>
          <td class="ilselectalldelete">&nbsp;</td>
          <td class="ilselectindex">&nbsp;</td>
          <td class="illinktarget">&nbsp;</td>
          <td class="ilcaption">Select all captions</td>
          <td class="ilselect"><input type="checkbox" name="selectall" id="selectall" ></td>
        </tr>
        <tr>
          <td class="ilthumbnail">&nbsp;</td>
          <td class="ilfilename" >&nbsp;</td>
          <td class="ilselectalldelete">&nbsp;</td>
          <td class="ilselectindex">&nbsp;</td>
          <td class="illinktarget">&nbsp;</td>
          <td class="ilcaption"><span class="sv2url">Select all urls</span></td>
          <td class="ilselect"><input type="checkbox" name="selectallurls" id="selectallurls" ></td>
        </tr>
        <tr>
          <td class="ilthumbnail">&nbsp;</td>
          <td class="ilfilename" >&nbsp;</td>
          <td class="ilselectalldelete">&nbsp;</td>
          <td class="ilselectindex">&nbsp;</td>
          <td class="illinktarget">&nbsp;</td>
          <td class="ilcaption">Set selected to:</td>
          <td class="ilselect">&nbsp;</td>
        </tr>
        <tr class="lastrow">
          <td class="ilthumbnail">&nbsp;</td>
          <td class="ilfilename" >&nbsp;</td>
          <td class="ilselectalldelete">&nbsp;</td>
          <td class="ilselectindex">&nbsp;</td>
          <td class="illinktarget">&nbsp;</td>
          <td class="ilcaption"><input id="copytext" name="copyText" type="text" class="newcaption" value="" ></td>
          <td class="ilselect" style="padding: 0"><input style="width: 40px; " class="btn formbutton" id="copy" type="button" value="Set" name="copy" ></td>
        </tr>
      </table>
  </form>';
      return $html;
    }
}