1
function hidePDFviewer() {
2
$('#content table').show();
5
$('#pdframe, #pdfbar').remove();
6
if ($('#isPublic').val()){
7
$('#preview').css({height: null});
11
function showPDFviewer(dir,filename){
12
if(!showPDFviewer.shown){
15
$('#content table').hide();
16
$("#controls").hide();
17
var oldcontent = $("#content").html();
18
var viewer = OC.linkTo('files_pdfviewer', 'viewer.php')+'?dir='+encodeURIComponent(dir).replace(/%2F/g, '/')+'&file='+encodeURIComponent(filename.replace('&', '%26'));
19
$iframe = $('<iframe id="pdframe" style="width:100%;height:100%;display:block;" src="'+viewer+'" /><div id="pdfbar"><a id="close" title="Close">X</a></div>');
20
if ($('#isPublic').val()){
21
// force the preview to adjust its height
22
$('#preview').append($iframe).css({height: '100%'});
25
$('#content').append($iframe);
27
$("#pageWidthOption").attr("selected","selected");
28
$('#pdfbar').css({position:'absolute',top:'5px',right:'5px'});
29
// if a filelist is present, the PDF viewer can be closed to go back there
30
if ($('#fileList').length){
31
$('#close').css({display:'block',padding:'0 5px',color:'#BBBBBB','font-weight':'900',height:'18px',background:'transparent'}).click(function(){
36
$('#close').css({display:'none'});
41
showPDFviewer.oldCode='';
42
showPDFviewer.lastTitle='';
44
$(document).ready(function(){
45
// doesn't work in IE or public link mode
46
if(!$.browser.msie && !$('#isPublic').val()){
47
if ($('#filesApp').val() && typeof FileActions!=='undefined'){
48
FileActions.register('application/pdf','Edit', OC.PERMISSION_READ, '',function(filename){
49
showPDFviewer($('#dir').val(),filename);
51
FileActions.setDefault('application/pdf','Edit');