X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=BookReaderIA%2Finc%2FBookReader.inc;h=538accdf88596bbbc466a4c41a91712cdc5fc257;hb=de72864be55272a525a68cb6ff7738355d6a45bd;hp=585ee1d0368cf77bf20e87e41452a14d3c82b571;hpb=22e65b2d601696ad0ae34d27367887bd5251a308;p=bookreader.git diff --git a/BookReaderIA/inc/BookReader.inc b/BookReaderIA/inc/BookReader.inc index 585ee1d..538accd 100644 --- a/BookReaderIA/inc/BookReader.inc +++ b/BookReaderIA/inc/BookReader.inc @@ -1,8 +1,24 @@ +/* + * Copyright(c) 2008-2010 Internet Archive. Software license AGPL version 3. + * + * This file is part of BookReader. The full source code can be found at GitHub: + * http://github.com/openlibrary/bookreader + * + * Note: Edits to this file must pass through github. To submit a patch to this + * file please contact mang via http://github.com/mangtronix or mang at archive dot org + * Direct changes to this file may get clobbered when the code is synchronized + * from github. + */ + class BookReader { + + // Operators recognized in BookReader download URLs + public static $downloadOperators = array('page'); + // Returns true if can display the book in item with a given prefix (typically the item identifier) public static function canDisplay($item, $prefix, $checkOldScandata = false) { @@ -51,15 +67,18 @@ class BookReader public static function findPrefix($urlPortion) { if (!preg_match('#[^/&?]+#', $urlPortion, $matches)) { + // URL portion was empty or started with /, &, or ? -- no item identifier return false; } - $prefix = $matches[0]; // identifier + $prefix = $matches[0]; // item identifier // $$$ Currently swallows the rest of the URL. // If we want to support e.g. /stream/itemid/subdir/prefix/page/23 will need to adjust. if (preg_match('#[^/&?]+/([^&?]+)#', $urlPortion, $matches)) { - $prefix = $matches[1]; // sub prefix + // Match is everything after item identifier and slash, up to end or ? or & + // e.g. itemid/{match/these/parts}?foo=bar + $prefix = $matches[1]; // sub prefix -- } return $prefix; @@ -69,7 +88,7 @@ class BookReader // // @param subprefix Optional prefix to display a book inside an item (e.g. if does not match identifier) public static function draw($server, $mainDir, $identifier, $subPrefix, $title, - $coverLeaf=null, $titleStart='Internet Archive', $uiMode='full') + $coverLeaf=null, $titleStart='Internet Archive', $uiMode='full', $protected = false, $isAdmin=false) { // Set title to default if not set if (!$title) { @@ -81,10 +100,11 @@ class BookReader // manually update with Launchpad version number at each checkin so that browsers // do not use old cached version // see https://bugs.launchpad.net/gnubook/+bug/330748 - $version = "r26a"; + $version = "3.0.8"; if (BookReader::getDevHost($server)) { - // on dev host - add time to force reload + // On dev host - add time to force reload + // If debugging on IE, remove this line otherwise breakpoints will be invalid after reload $version .= '_' . time(); } @@ -94,6 +114,11 @@ class BookReader } $metaURL = BookReader::jsMetadataURL($server, $identifier, $mainDir, $subPrefix); + $metaURL .= "&version=" . $version; + $locateURL = BookReader::jsLocateURL($identifier, $subPrefix); + $coverThumb = 'http://www.archive.org/download/' . $identifier . '/'. $subPrefix . '/page/cover_w114.jpg'; + // startup-up-image must be exactly 320x460 + //$startupImage = 'http://www.archive.org/download/' . $identifier . '/'. $subPrefix . '/page/cover_w512.jpg'; ?> @@ -101,20 +126,144 @@ class BookReader
+ +