Skip to content
This repository was archived by the owner on Sep 10, 2021. It is now read-only.

Commit fc58fc9

Browse files
author
Charles Ma
committed
ENH: fixed bug #162
Added image viewer and fixed pdf download
1 parent eb11429 commit fc58fc9

File tree

13 files changed

+150
-59
lines changed

13 files changed

+150
-59
lines changed

core/views/download/onebitstream.phtml

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,13 @@ $modified = gmdate('D, d M Y H:i:s').' GMT';
2525
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
2626
header("Last-Modified: $modified");
2727

28+
// if pdf set the content-type acordingly
29+
if(!isset($contentType)&&pathinfo($this->name, PATHINFO_EXTENSION) == "pdf")
30+
{
31+
$contentType = 'application/pdf';
32+
$enableContentDisposition = false;
33+
}
34+
2835
if(!isset($contentType))
2936
{
3037
$contentType = 'application/octet-stream';
@@ -36,13 +43,8 @@ if(!isset($contentType)&&strlen($this->name)>4 && substr($this->name,strlen($thi
3643
$contentType = 'application/isp';
3744
}
3845

39-
// if pdf set the content-type acordingly
40-
if(!isset($contentType)&&pathinfo($this->name, PATHINFO_EXTENSION) == "pdf")
41-
{
42-
$contentType = 'application/pdf';
43-
$enableContentDisposition = false;
44-
}
45-
46+
47+
4648
$agent = env('HTTP_USER_AGENT');
4749
if (preg_match('%Opera(/| )([0-9].[0-9]{1,2})%', $agent) || preg_match('/MSIE ([0-9].[0-9]{1,2})/', $agent))
4850
{

modules/visualize/controllers/ImageController.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ class Visualize_ImageController extends Visualize_AppController
1717
public function indexAction()
1818
{
1919
$this->disableLayout();
20-
$this->disableView();
2120
$itemid = $this->_getParam('itemId');
2221
$item = $this->Item->load($itemid);
2322

@@ -33,8 +32,10 @@ public function indexAction()
3332
throw new Zend_Exception('Error');
3433
}
3534
$this->bistream = $bitstreams[0];
35+
36+
$this->view->imageUrl = $this->view->webroot."/download?items=".$item->getKey();
37+
3638

37-
echo "<img src='".$this->view->webroot."/download?items=".$item->getKey()."'/>";
3839
}
3940
} // end class
4041
?>

modules/visualize/controllers/PdfController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public function indexAction()
3434
}
3535
$this->bistream = $bitstreams[0];
3636
echo "<html>";
37-
echo "<object height='600' width='800' type='application/pdf' data='".$this->view->webroot."/download?items=".$item->getKey()."'> <param name='src' value='".$this->view->webroot."/download?items=".$item->getKey()."'/></object>";
37+
echo "<object height='750' width='750' type='application/pdf' data='".$this->view->webroot."/download?items=".$item->getKey()."'> <param name='src' value='".$this->view->webroot."/download?items=".$item->getKey()."'/></object>";
3838

3939
echo "</html>";
4040
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
$(document).ready(function(){
2+
$("#viewer").iviewer(
3+
{
4+
src: $('div#urlImage').html(),
5+
update_on_resize: false
6+
});
7+
});
95 Bytes
Loading
90 Bytes
Loading
69 Bytes
Loading
98 Bytes
Loading
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
.iviewer_common {
2+
position:absolute;
3+
bottom:10px;
4+
border: 1px solid #000;
5+
height: 28px;
6+
z-index: 5000;
7+
}
8+
9+
.iviewer_cursor {
10+
cursor: -moz-grab;
11+
}
12+
13+
.iviewer_drag_cursor {
14+
cursor: -moz-grabbing;
15+
}
16+
17+
.iviewer_button {
18+
width: 28px;
19+
cursor: pointer;
20+
background-position: center center;
21+
background-repeat: no-repeat;
22+
}
23+
24+
.iviewer_zoom_in {
25+
left: 20px;
26+
background: url(img/iviewer.zoom_in.gif);
27+
}
28+
29+
.iviewer_zoom_out {
30+
left: 55px;
31+
background: url(img/iviewer.zoom_out.gif);
32+
}
33+
34+
.iviewer_zoom_zero {
35+
left: 90px;
36+
background: url(img/iviewer.zoom_zero.gif);
37+
}
38+
39+
.iviewer_zoom_fit {
40+
left: 125px;
41+
background: url(img/iviewer.zoom_fit.gif);
42+
}
43+
44+
.iviewer_zoom_status {
45+
left: 160px;
46+
font: 1em/28px Sans;
47+
color: #000;
48+
background-color: #fff;
49+
text-align: center;
50+
width: 60px;
51+
}

modules/visualize/public/js/jquery/iviewer/jquery.iviewer.min.js

Lines changed: 28 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)