From 6df177dc4bf36ba87092b21ad6020e7a9a67198d Mon Sep 17 00:00:00 2001 From: rajbot Date: Tue, 8 Feb 2011 23:50:40 +0000 Subject: [PATCH] use brConfig isAdmin flag to trigger QA mode. --- BookReaderIA/datanode/BookReaderJSIA.php | 18 +++++++----------- BookReaderIA/inc/BookReader.inc | 5 ++++- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/BookReaderIA/datanode/BookReaderJSIA.php b/BookReaderIA/datanode/BookReaderJSIA.php index 006ad93..816f871 100644 --- a/BookReaderIA/datanode/BookReaderJSIA.php +++ b/BookReaderIA/datanode/BookReaderJSIA.php @@ -573,6 +573,12 @@ if (typeof(brConfig) != 'undefined') { } else if (brConfig['mode'] == 2) { br.mode = 2; } + + if (typeof(brConfig["isAdmin"]) != 'undefined') { + br.isAdmin = brConfig["isAdmin"]; + } else { + br.isAdmin = false; + } } // brConfig @@ -635,16 +641,6 @@ OLAuth.prototype.setPopupMsg = function(msg, resolution) { this.popup.innerHTML = ['

', msg, '

', resolution, '

'].join('\n'); } -OLAuth.prototype.isAdmin = function() { - var isAdmin = false; - - $.ajax({url:'/bookreader/BookReaderAdmin.php?id='+br.bookId, - success:function(data){isAdmin=data.isAdmin;}, - async:false - }); - return isAdmin; -} - OLAuth.prototype.showError = function(msg, resolution) { $(this.popup).css({ backgroundColor: "#fff", @@ -656,7 +652,7 @@ OLAuth.prototype.showError = function(msg, resolution) { OLAuth.prototype.initCallback = function(obj) { if (false == obj.success) { - if (this.isAdmin()) { + if (br.isAdmin) { ret = confirm("We couldn't authenticate your loan with Open Library, but since you are an administrator or uploader of this book, you can access this book for QA purposes. Would you like to QA this book?"); if (!ret) { this.showError(obj.msg, obj.resolution) diff --git a/BookReaderIA/inc/BookReader.inc b/BookReaderIA/inc/BookReader.inc index 2044bf0..9f3eefc 100644 --- a/BookReaderIA/inc/BookReader.inc +++ b/BookReaderIA/inc/BookReader.inc @@ -88,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', $protected = false) + $coverLeaf=null, $titleStart='Internet Archive', $uiMode='full', $protected = false, $isAdmin=false) { // Set title to default if not set if (!$title) { @@ -190,6 +190,9 @@ class BookReader brConfig["mode"] = 2; +