<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
        <!--
            
                OpenZoom Viewer for Photoshop
                    Powered by OpenZoom <http://openzoom.org/>
                        Developed by Daniel Gasienica <daniel@gasienica.ch>
                        
                        -->
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <script type="text/javascript" src="swfobject.js"></script>
    <script type="text/javascript">
      swfobject.registerObject( "viewer", "9.0.0" );
      </script>
        <style type="text/css">
          html, body { background-color: #fff; height: 100%; overflow: hidden; margin: 0; padding: 0; }
          body { font-family: verdana, Arial, sans-serif; font-size: 10px; color: red; }
      p {font-size: 10px;}
          #container { width: 100%; height: 97%; text-align: center; }
          </style>
    </head>
  <body>

<?php

$pub_date 
$_GET['pub_date'];
$page $_GET['page'];

if (
$pub_date == "") {
$pub_date "1929-01-11";
}


$dir "/var/www/mus-jp2/" $pub_date "/";
//print "Folder: " . $dir . "<br>";

if (file_exists($dir)) {    
       
// echo "The directory {$dir} exists";    
    
} else {    
       
// echo "The directory {$dirname} doesn't exist";
    
exit;    
    }    


    if (
$handle opendir($dir)) 
{
    
//read each file
    
while ($file readdir($handle)) {
        
//only get files of a particular type       
        
if(mime_content_type($dir $file) == 'image/jp2')
        {        
            
//eliminate additional directories
            
if ($file != "." && $file != "..")
            {                
                
//store filename in array
                
$option[] = $file
            }            
        }
    }
    
//close directory
    
closedir($handle);

if (empty(
$option)) {
   
// echo '  -----   NO jp2 files found, sorry :)';
    
exit;
} else
{
$total_pages count($option);
//print "  -----  ". $total_pages . " files found!";
}

?>

<script  type="text/javascript">
<!--
 function getSelect(s) {
  return s.options[s.selectedIndex].value }
-->
</script>

<?


//print "file location var: " . $file_location;
if ($page == ""){
    
$page $option[0];


$file_location "/var/www/mus-jp2/" $pub_date "/" $page;
?>
<div
style="width:100%; 
margin-top: -10px;
margin-bottom: -10px;
font-family: verdana, arial;
font-size:12px;
text-align:center;
color: #fff;
padding-top: 0px;
padding-bottom: 0px;
background: #000;">

<?
//print "<p>Current page: ". $page . "&nbsp;&nbsp;";
//print_r($option);

foreach($option as $key=>$val){
// echo $key . " - " . $val . "<br>";
 
if ($option[$key] == $page) {

    echo 
"<p>Displaying page " . ($key 1) . "&nbsp;&nbsp;";
}

}

$url="http://drc.lib.muohio.edu/iip/openzoom/mustudent.php?pub_date=" $pub_date "&page=";
//print $url;
    //create combo box
//print "Files: ";
    
$cbo '<select name="pages" size=1 OnChange="location=getSelect(this)"><option value "#">Select another page';
    
//create option for each file
    
    
$i=1;
    foreach(
$option as $key=>$val)
    {
        
$cbo .='<option value="'.$url.$val.'">Page '.$i++.'</option>';
    }
    
//close combo box
    
$cbo .= '</select>'
    
//output combo box (might want to put this in a form tag on your final page)

    
echo $cbo;
?>
</div>
<? 
}
?>

<div id="container">
      <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="100%" height="100%" id="viewer" name="viewer">
    <param name="movie" value="OpenZoomViewer.swf" />
    <param name="scale" value="noscale" />
    <param name="bgcolor" value="#FFFFFF" />
    <param name="allowfullscreen" value="true" />
    <param name="allowscriptaccess" value="always" />
    <param name="flashvars" value="source=/cgi-bin/iipsrv.fcgi?zoomify=<? echo $file_location?>/ImageProperties.xml" />
    <!--[if !IE]>-->
    <object type="application/x-shockwave-flash" data="OpenZoomViewer.swf" width="100%" height="100%" name="viewer">
      <param name="scale" value="noscale" />
      <param name="bgcolor" value="#FFFFFF" />
      <param name="allowfullscreen" value="true" />
      <param name="allowscriptaccess" value="always" />
      <param name="flashvars" value="source=/cgi-bin/iipsrv.fcgi?zoomify=<? echo $file_location?>/ImageProperties.xml" />
      <!--<![endif]-->
      <a href="http://www.adobe.com/go/getflashplayer">
        <img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" border="0" />
        </a>
      <!--[if !IE]>-->
      </object>
    <!--<![endif]-->
    </object>
      </div>
    </body>
</html>