Skip to content

Commit

Permalink
Added flag for downloading a single PDF file
Browse files Browse the repository at this point in the history
Otherwise it will open in an iframe in the browser
  • Loading branch information
gamma committed Apr 16, 2014
1 parent 6792d0c commit 82618ac
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion inc/filewriter.php
Expand Up @@ -208,7 +208,7 @@ public function getOnlyFileInZip(&$data = null) {
}

$data['mime'] = 'application/pdf';
$data['download'] = 0;
$data['download'] = $this->functions->settings->download ? 1 : 0;

// Extract single file.
$folder = dirname($data['file']);
Expand Down
6 changes: 5 additions & 1 deletion inc/functions.php
Expand Up @@ -35,6 +35,10 @@ public function downloadURL()
$params['debug'] = $this->debug->debugLevel();
}

if ( $this->settings->download == 1 ) {
$params['download'] = 1;
}

return ml($this->settings->origZipFile, $params, true, '&');
}

Expand Down Expand Up @@ -296,7 +300,7 @@ public function getSpecialExportFileName($FILE, $PATTERN=null) {

// Set Pattern Global for other stuff
if ( empty($this->settings->pattern) ) {
$this->settings->pattern = $PATTERN;
$this->settings['pattern'] = $PATTERN;
} else {
$PATTERN = $this->settings->pattern;
}
Expand Down
7 changes: 7 additions & 0 deletions script.js
Expand Up @@ -139,6 +139,8 @@
var clone = frame.clone().css({
border: 'none'
}).show();

frame.remove();

var viewer = new $.popupviewer();
viewer.showViewer();
Expand All @@ -155,6 +157,11 @@
if ( typeof iframeProps.timeout == 'function' ) {
window.setTimeout(iframeProps.timeout, 2000);
}

$(window).unload(function(){
// last resort or the frame might reload
frame.remove();
});
};

_.addSite = function(site) {
Expand Down

0 comments on commit 82618ac

Please sign in to comment.