[Scummvm-cvs-logs] SF.net SVN: scummvm: [27319] web/trunk

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Sun Jun 10 18:26:56 CEST 2007


Revision: 27319
          http://scummvm.svn.sourceforge.net/scummvm/?rev=27319&view=rev
Author:   fingolfin
Date:     2007-06-10 09:26:55 -0700 (Sun, 10 Jun 2007)

Log Message:
-----------
Reworked the screenshot code on the website once again, simplifying the code and enabling descriptive titles on the screenshot viewer window in all situations

Modified Paths:
--------------
    web/trunk/include/scr-categories.php
    web/trunk/index.php
    web/trunk/screenshots.js
    web/trunk/screenshots.php

Modified: web/trunk/include/scr-categories.php
===================================================================
--- web/trunk/include/scr-categories.php	2007-06-10 16:10:41 UTC (rev 27318)
+++ web/trunk/include/scr-categories.php	2007-06-10 16:26:55 UTC (rev 27319)
@@ -18,7 +18,7 @@
 
   foreach ($categories as $cat) {
     html_subhead_start('<a name="cat'.$cat->_catnum.'"></a><a href="?cat1='.
-		       $cat->_catnum .'&cat2=-1&view=-1">'.$cat->_name.'</a>');
+		       $cat->_catnum .'&cat2=-1">'.$cat->_name.'</a>');
 
     echo '<div class="par-scr-content-cat'.$cat->_catnum.'">';
 
@@ -55,7 +55,7 @@
     echo "<table border=0>\n";
     foreach($this->_list as $cat) {
       echo "<tr><td class='cat-bullet'><img src='$file_root/images/".$cat['filename'].
-      	"' alt=\"\"></td><td class='cat-link'><a href=\"?cat1=".$this->_catnum."&cat2=".$cat['catnum']."&view=-1\">".
+      	"' alt=\"\"></td><td class='cat-link'><a href=\"?cat1=".$this->_catnum."&cat2=".$cat['catnum']."\">".
       	$cat['description'].
       	"</a> <font class='cat-count'>(".$scrcatnums[$this->_catnum][$cat['catnum']]." shots)</font></td></tr>\n";
     }

Modified: web/trunk/index.php
===================================================================
--- web/trunk/index.php	2007-06-10 16:10:41 UTC (rev 27318)
+++ web/trunk/index.php	2007-06-10 16:26:55 UTC (rev 27319)
@@ -71,7 +71,7 @@
 <tr><td>
 <!-- We use a height of 483 instead of 480 to workaround something which
   appears to be a bug in Mozilla? -->
-	<a href="javascript:openWin('./screenshots/bigscummvm_'+screenshotIds[curScreenshotId]+'.png','Screenshot Viewer',640,483);"
+	<a href="javascript:openWin(screenshotIds[curScreenshotId]);"
 	onMouseOver="window.status='Click to View Full Size Image';return true;"
 	onMouseOut="window.status='';return true;"><img
 <?php

Modified: web/trunk/screenshots.js
===================================================================
--- web/trunk/screenshots.js	2007-06-10 16:10:41 UTC (rev 27318)
+++ web/trunk/screenshots.js	2007-06-10 16:26:55 UTC (rev 27319)
@@ -1,8 +1,3 @@
-function openWin(fileToOpen,nameOfWindow,width,height) {
-	myWindow = window.open("",nameOfWindow,"menubar=no,scrollbars=no,status=no,width="+width+",height="+height);
-	myWindow.document.open();
-	myWindow.document.write('<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">\n')
-	myWindow.document.write('<html><head><title>'+ nameOfWindow +'</title><link rel="stylesheet" href="style.css" type="text/css"></head>')
-	myWindow.document.write('<body onClick="javascript:self.close();"><img src="'+ fileToOpen +'"></body></html>');
-	myWindow.document.close();
+function openWin(screenshotID) {
+	myWindow = window.open("screenshots.php?screenshotID="+screenshotID,"scummvm_screenshot_viewer","menubar=no,scrollbars=no,status=no,width=640,height=483");
 }

Modified: web/trunk/screenshots.php
===================================================================
--- web/trunk/screenshots.php	2007-06-10 16:10:41 UTC (rev 27318)
+++ web/trunk/screenshots.php	2007-06-10 16:26:55 UTC (rev 27319)
@@ -6,19 +6,8 @@
 require($file_root."/include/"."incl.php");
 require($file_root."/include/"."scr-categories.php");
 
-function display_single_shot($cat1, $cat2, $cat3) {
-}
+$offset = $cat1 = $cat2 = $screenshotID = "";
 
-html_page_header('ScummVM :: Screenshots', array("screenshots.css"));
-
-html_content_begin('Screenshots');
-
-$view = $offset = $cat1 = $cat2 = "";
-
-if (array_key_exists('view', $HTTP_GET_VARS)) {
-  $view = $HTTP_GET_VARS['view'];
-}
-
 if (array_key_exists('offset', $HTTP_GET_VARS)) {
   $offset = $HTTP_GET_VARS['offset'];
 }
@@ -31,9 +20,32 @@
   $cat2 = $HTTP_GET_VARS['cat2'];
 }
 
+if (array_key_exists('screenshotID', $HTTP_GET_VARS)) {
+  $screenshotID = $HTTP_GET_VARS['screenshotID'];
+}
+
+// If a full screenshotID was provided, ignore all other params and display the corresponding page
+if (preg_match("/^(\d+)_(\d+)_(\d+)\$/", $screenshotID)) {
+	$caption = screenshot_caption($screenshotID);
+?>
+	<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
+	<html><head><title>Screenshot: <?=$caption?></title><link rel="stylesheet" href="style.css" type="text/css"></head>
+	<body onClick="javascript:self.close();" style="margin:0px;text-align:center;">
+	<img src="./screenshots/bigscummvm_<?=$screenshotID?>.png">
+	</body>
+	</html>
+<?php
+exit;
+}
+
+
+html_page_header('ScummVM :: Screenshots', array("screenshots.css"));
+
+html_content_begin('Screenshots');
+
 echo '<script src="'.$file_root.'/screenshots.js" type="text/javascript"></script>';
 
-if ($view == "") {
+if ($cat1 == "") {
 ?>
   <div class="par-item">
     <div class="par-head">
@@ -67,7 +79,7 @@
 <tr><td width=17 height=10 colspan=2><img src="<?=$file_root?>/images/rs-top-left.png" alt=""></td><td rowspan=2 width=256 height=192>
 <?php
   $image = $screenshots[$randImg];
-  echo "<a href=\"javascript:openWin('" . screenshot_path($image) ."','Screenshot:" . screenshot_caption($image) ."',640,483);\"\n";
+  echo "<a href=\"javascript:openWin('" . $image ."');\"\n";
   echo "  onMouseOver=\"window.status='Click to View Full Size Image';return true;\"\n";
   echo "  onMouseOut=\"window.status='';return true;\">";
   echo '<img align=right src="'.screenshot_thumb_path($image).'" alt="Random Screenshot"';
@@ -94,10 +106,7 @@
   </div>
 <?php
 }
-if ($view != -1 && $view != "") {
-  display_single_shot($cat1, $cat2, $view);
-}
-if ($view == -1) {
+if ($cat1 != "") {
   // generate list of all shots to show
   $showlist = array();
 
@@ -126,7 +135,7 @@
     // display image
     echo html_frame_td(
 	'<table cellpadding="0" cellspacing="0"><tr><td align="center">'.
-	"<a href=\"javascript:openWin('" . screenshot_path($image) ."','Screenshot: " . screenshot_caption($image) . "',640,483);\">".
+	"<a href=\"javascript:openWin('" . $image ."');\">".
 	'<img src="'.screenshot_thumb_path($image).'" '.
 	'width=256 height=192 alt="Screenshot '.$c.'"></a>'.
 	'</td></tr><tr><td align="center">'.


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list