-
Notifications
You must be signed in to change notification settings - Fork 2
/
mainpage.php
150 lines (124 loc) · 5.77 KB
/
mainpage.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Islandora Reader</title>
<link rel="stylesheet" type="text/css" href="css/BookReader.css"/>
<!-- Custom CSS overrides -->
<link rel="stylesheet" type="text/css" href="css/BookReaderDemo.css"/>
<script type="text/javascript" src="js/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="js/jquery-ui-1.8.5.custom.min.js"></script>
<script type="text/javascript" src="js/dragscrollable.js"></script>
<script type="text/javascript" src="js/jquery.colorbox-min.js"></script>
<script type="text/javascript" src="js/jquery.ui.ipad.js"></script>
<script type="text/javascript" src="js/jquery.bt.min.js"></script>
<script type="text/javascript" src="js/BookReader.js"></script>
<script type="text/javascript" src="js/islandora_loader.js"></script>
</head>
<body style="background-color: #939598;">
<div id="BookReader" style="left:10px; right:10px; top:10px; bottom:2em;">Loading Bookreader, please wait...</div>
<script type="text/javascript">
//
// This file shows the minimum you need to provide to BookReader to display a book
//
// Copyright(c)2008-2009 Internet Archive. Software license AGPL version 3.
// Create the BookReader object
br = new BookReader();
br.structMap = new Array();
br.djatoka_prefix = islandora_params.DJATOKA_PREFIX;
br.islandora_prefix = islandora_params.ISLANDORA_PREFIX;
br.fedora_prefix = islandora_params.FEDORA_PREFIX;
br.width = parseInt(islandora_params.page_width);
br.height = parseInt(islandora_params.page_height);
br.structMap = islandora_params.book_pids;
br.compression = islandora_params.COMPRESSION;
br.getPageWidth = function(index) {
return br.width;
}
// Return the height of a given page. Here we assume all images are 1200 pixels high
br.getPageHeight = function(index) {
return br.height;
}
// We load the images from fedora
// using a different URL structure
br.getPageURI = function(index, reduce, rotate) {
// reduce and rotate are ignored in this simple implementation, but we
// could e.g. look at reduce and load images from a different directory
// or pass the information to an image server
var leafStr = br.structMap[index+1];//get the pid of the object from the struct map islandora specific
// var url = br.djatoka_prefix + br.islandora_prefix + leafStr + '/JP2/&svc_id=info:lanl-repo/svc/getRegion&svc_val_fmt=info:ofi/fmt:kev:mtx:jpeg2000&svc.format=image/png&svc.level=' + br.compression + '&svc.rotate=0';
var url = br.djatoka_prefix + br.fedora_prefix + '/objects/' + leafStr + '/datastreams/JP2/content&svc_id=info:lanl-repo/svc/getRegion&svc_val_fmt=info:ofi/fmt:kev:mtx:jpeg2000&svc.format=image/png&svc.level=' + br.compression + '&svc.rotate=0';
return url;
}
br.getModsURI = function(index) {
var leafStr = br.structMap[index+1];//get the pid of the object from the struct map islandora specific
return br.islandora_prefix + leafStr + "/MODS";
}
br.getPid = function (index) {
var leafStr = br.structMap[index+1];//get the pid of the object from the struct map islandora specific
return leafStr;
}
// Return which side, left or right, that a given page should be displayed on
br.getPageSide = function(index) {
$vals = ["R", "L"];
return $vals[index & 0x1];
}
// This function returns the left and right indices for the user-visible
// spread that contains the given index. The return values may be
// null if there is no facing page or the index is invalid.
br.getSpreadIndices = function(pindex) {
var spreadIndices = [null, null];
if ('rl' == this.pageProgression) {
// Right to Left
if (this.getPageSide(pindex) == 'R') {
spreadIndices[1] = pindex;
spreadIndices[0] = pindex + 1;
} else {
// Given index was LHS
spreadIndices[0] = pindex;
spreadIndices[1] = pindex - 1;
}
} else {
// Left to right
if (this.getPageSide(pindex) == 'L') {
spreadIndices[0] = pindex;
spreadIndices[1] = pindex + 1;
} else {
// Given index was RHS
spreadIndices[1] = pindex;
spreadIndices[0] = pindex - 1;
}
}
return spreadIndices;
}
// For a given "accessible page index" return the page number in the book.
//
// For example, index 5 might correspond to "Page 1" if there is front matter such
// as a title page and table of contents.
// for now we just show the image number
br.getPageNum = function(index) {
return index+1;
}
// Total number of leafs
br.numLeafs = islandora_params.page_count;
// Book title and the URL used for the book title link
br.bookTitle = islandora_params.label;
if (br.bookTitle.length > 100){
br.bookTitle = br.bookTitle.substring(0,97)+'...';
}
// book url should be created dynamically
br.bookUrl = br.islandora_prefix + PID;
br.bookPid = PID;
// Override the path used to find UI images
br.imagesBaseURL = '../images/';
br.getEmbedCode = function(frameWidth, frameHeight, viewParams) {
return "Embed code not supported in bookreader demo.";
}
// Let's go!
br.init();
// read-aloud and search need backend compenents and are not supported in the demo
$('#BRtoolbar').find('.read').hide();
$('#textSrch').hide();
$('#btnSrch').hide();
</script>
</body>
</html>