Add comment in generated BookReader main html showing how to use JSLocate for stable...
authorMichael Ang <mang@archive.org>
Mon, 25 Oct 2010 19:48:18 +0000 (19:48 +0000)
committerMichael Ang <mang@archive.org>
Mon, 25 Oct 2010 19:48:18 +0000 (19:48 +0000)
BookReaderIA/inc/BookReader.inc

index 7f7b647..f7e1b2e 100644 (file)
@@ -107,6 +107,7 @@ class BookReader
     }
     
     $metaURL = BookReader::jsMetadataURL($server, $identifier, $mainDir, $subPrefix);
+    $locateURL = BookReader::jsLocateURL($identifier, $subPrefix);
     
 ?>
 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
@@ -149,8 +150,11 @@ class BookReader
   brConfig["mode"] = 2;
 <? } ?>
 </script>
-<!-- The script included below is dynamically generated JavaScript that includes the book metadata and page image access functions -->
+<!-- The script included below is dynamically generated JavaScript that includes the book metadata and page image access functions.
+     The ia{number}.us.archive.org server referenced below can and does change, so this URL should NOT be used for permanent access.  -->
 <script type="text/javascript" src="<? echo($metaURL); ?>"></script>
+<!-- This URL will find the item and redirect to the correct server.  Remove the line above and use the URL below for stable access. -->
+<!-- <script type="text/javascript" src="<? echo($locateURL); ?>"></script> -->
 
 <? if ($uiMode == 'full') { ?>
 <div id="BookReaderSearch" style="width:190px; right:0px; top:10px; bottom:2em;">
@@ -241,6 +245,17 @@ class BookReader
     return $url;
   }
   
+  // This returns a URL that finds the item then returns a redirect to BookReaderJSIA.php
+  // on the item's server.
+  public static function jsLocateURL($identifier, $subPrefix = '')
+  {
+    $locateURL = 'http://www.archive.org/bookreader/BookReaderJSLocate.php?id=' . $identifier;
+    if ($subPrefix) {
+        $locateURL .= '&subPrefix=' . $subPrefix;
+    }
+    return $locateURL;
+  }
+  
   // Return the URL for the requested /download/$path, or null
   public static function getURL($path, $item) {
     // $path should look like {itemId}/{operator}/{filename}