00001 <?php
00002 if (!isset($_REQUEST['pvid']) || !isset($_REQUEST['pcount']) || !isset($_REQUEST['basepath'])){print("Unable to load photos. Please report this error at <u>www.shodor.org/contact/</u>");exit();}
00003 $pvid = $_REQUEST['pvid'];
00004 $pcount = $_REQUEST['pcount'];
00005 $basepath = $_REQUEST['basepath'];
00006 ?>
00007 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
00008 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
00009 <html>
00010 <head>
00011 <meta http-equiv="Content-type" content="text/html; charset=utf-8">
00012 <title>Thumbnails</title>
00013 <style type="text/css" media="screen">
00014 img{
00015 display:inline;
00016 position:absolute;
00017 top:0px;
00018 }
00019 .clickable{ border:2px solid white; }
00020 .clickable:hover { border:2px solid gray; }
00021 .clickable:active { border:2px solid red; }
00022 .photoviewMessage {
00023 text-align: center;
00024 font-family: sans-serif;
00025 }
00026 </style>
00027 <script type="text/javascript" charset="utf-8">
00028 var images = new Array();
00029 var ci = 0;
00030 var pvid = <?php print($pvid); ?>;
00031 var scrollSpeed = 10;
00032 var curScrollSpeed = 0;
00033 var scrolling = false; var offset = 0; var dest = 0;
00034 var displayFrame = 0;
00035
00036 var photoPaths = parent.photoPaths[pvid];
00037 var downloadPaths = parent.downloadPaths[pvid];
00038 var thumbPaths = parent.thumbPaths[pvid];
00039 var photoWidths = parent.photoWidths[pvid];
00040 var photoHeights = parent.photoHeights[pvid];
00041 var photoCaptions = parent.photoCaptions[pvid];
00042
00043
00044
00045 function selectPhoto(i)
00046 {
00047 preUpdate();
00048
00049 dest = destFromIndex(i);
00050 offset = parent.frames['photoview' + pvid + '_thumbnails'].pageXOffset;
00051 if (offset == null) { offset = destFromIndex(ci); if(Math.abs(offset-dest) > 400){ offset = dest; } }
00052
00053 ci = i;
00054
00055 scrolling=true;
00056 scrollSmoothTo(i);
00057
00058 postUpdate();
00059
00060 }
00061 function next()
00062 {
00063 if (ci < photoPaths.length - 1){
00064 selectPhoto(ci+1);
00065 }
00066 }
00067 function prev()
00068 {
00069 if (ci > 0){
00070 selectPhoto(ci-1);
00071 }
00072 }
00081 function destFromIndex(i){ return 80*i - 250; }
00089 function preUpdate(){ document.getElementById('thumb' + ci).style.border="2px solid white"; }
00097 function postUpdate(){
00098
00099
00100 var vf_old = parent.document.getElementById('photoview' + pvid + '_viewframe');
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111 document.getElementById('thumb' + ci).style.border="2px solid red";
00112
00113 vf_old.style.visibility = "hidden";
00114 vf_old.src = '/ui/default/images/tiny_space.gif';
00115
00116 displayFrame = (displayFrame + 1) % 2;
00117
00118
00119 var vf = parent.document.getElementById('photoview' + pvid + '_viewframe');
00120
00121
00122
00123
00124 var img = parent.document.getElementById('photoview' + pvid + '_image');
00125 var ratio = photoWidths[ci] / photoHeights[ci];
00126 var ratio2 = 3/2;
00127
00128
00129
00130 if (ratio > ratio2){
00131 img.style.width='600px';
00132 var newheight = (600 / ratio);
00133 img.style.height= newheight + 'px';
00134 var diffheight = ((400 - newheight) / 2);
00135 img.style.top = diffheight + 'px';
00136 img.style.left = 0 + 'px';
00137 }else{
00138 img.style.height='400px';
00139 img.style.width = (400 * ratio) + 'px';
00140 var diffwidth = (600 - (400 * ratio)) / 2;
00141 img.style.top = 0 + 'px';
00142 img.style.left = diffwidth + 'px';
00143 }
00144
00145
00146
00147 img.src='<?php print($basepath); ?>' + photoPaths[ci];
00148
00149
00150 vf.style.visibility = "visible";
00151
00152
00153 parent.document.getElementById('photoview' + pvid + '_caption').innerHTML = photoCaptions[ci];
00154 parent.document.getElementById('photoview' + pvid + '_download').href = '<?php print($basepath); ?>' + downloadPaths[ci];
00155
00156
00157 if(ci >= photoPaths.length -1){ parent.document.getElementById('photoview' + pvid + '_bigright').style.visibility='hidden';} else { parent.document.getElementById('photoview' + pvid + '_bigright').style.visibility='visible'; }
00158 if(ci <= 0){ parent.document.getElementById('photoview' + pvid + '_bigleft').style.visibility='hidden';} else { parent.document.getElementById('photoview' + pvid + '_bigleft').style.visibility='visible'; }
00159
00160
00161 }
00162 function scrollSmoothTo(i)
00163 {
00164 if (!scrolling) return;
00165 var iframe = parent.frames['photoview' + pvid + '_thumbnails'];
00166
00167 curScrollSpeed = Math.round(Math.abs((offset-dest)/5));
00168
00169 if(Math.abs(offset-dest) <= scrollSpeed){ iframe.scrollTo(dest, 0); scrolling=false; return; }
00170 if (offset < dest){
00171 offset += curScrollSpeed;
00172 iframe.scrollTo(offset, 0);
00173 setTimeout('scrollSmoothTo(' + i + ')', 50);
00174 }
00175 if (offset > dest){
00176 offset -= curScrollSpeed;
00177 iframe.scrollTo(offset, 0);
00178 setTimeout('scrollSmoothTo(' + i + ')', 50);
00179 }
00180 }
00181 function loadThumbs()
00182 {
00183 for(var i=0;i<photoPaths.length;i++)
00184 {
00185 if (thumbPaths[i] == ''){
00186 document.getElementById('thumb' + i).src='<?php print($basepath); ?>/thumbnails_temp/' + photoPaths[i];
00187 } else {
00188 document.getElementById('thumb' + i).src= thumbPaths[i];
00189 }
00190 }
00191 }
00192
00200 function preload() {
00201 for (var i=0;i<photoPaths.length;i++) {
00202 var image = new Image();
00203 image.src = photoPaths[i];
00204 }
00205 }
00206 </script>
00207 </head>
00208 <body onload="javascript:loadThumbs();selectPhoto(0);">
00209 <?php
00210 for ($i=0; $i<$pcount; $i++)
00211 {
00212
00213 $offset = ($i * 80) . "px";
00214 print(<<<END_PRINT
00215 <img id="thumb$i" style="left:$offset"; src="/ui/default/images/tiny_space.gif" class="clickable" alt="thumbnail" border="0" width="75" height="56" onclick="javascript:selectPhoto($i);" />
00216
00217 END_PRINT
00218 );
00219 }
00220 if ($pcount == 0) {
00221 print('<div class="photoviewMessage">This collection of photos is not currently available.</a>');
00222 }
00223 ?>
00224 </body>
00225 </html>