Skip to content

Commit

Permalink
Code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
asmecher committed Feb 12, 2015
1 parent 3e02377 commit e8be412
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
8 changes: 8 additions & 0 deletions PdfJsViewerPlugin.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@
import('lib.pkp.classes.plugins.GenericPlugin');

class PdfJsViewerPlugin extends GenericPlugin {
/**
* Register the plugin.
* @param $category string Plugin category
* @param $path string Plugin path
* @return boolean true for success
*/
function register($category, $path) {
if (parent::register($category, $path)) {
if ($this->getEnabled()) {
Expand Down Expand Up @@ -57,6 +63,7 @@ function _includeCallback($hookName, $args) {
case 'article/pdfViewer.tpl':
$templatePath = $this->getTemplatePath();
$templateMgr->assign('pluginTemplatePath', $templatePath);
$templateMgr->assign('pluginUrl', Request::getBaseUrl() . DIRECTORY_SEPARATOR . $this->getPluginPath());
$params['smarty_include_tpl_file'] = $templatePath . 'articleGalley.tpl';
break;
}
Expand All @@ -78,6 +85,7 @@ function _displayCallback($hookName, $args) {
case 'issue/issueGalley.tpl':
$templatePath = $this->getTemplatePath();
$templateMgr->assign('pluginTemplatePath', $templatePath);
$templateMgr->assign('pluginUrl', Request::getBaseUrl() . DIRECTORY_SEPARATOR . $this->getPluginPath());
$template = $templatePath . 'issueGalley.tpl';
break;
}
Expand Down
8 changes: 4 additions & 4 deletions templates/pdfViewer.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
*}

{*
<script type="text/javascript" src="{$baseUrl}/plugins/generic/pdfJsViewer/pdf.js/build/pdf.js"></script>
<script type="text/javascript" src="{$pluginUrl}/pdf.js/build/pdf.js"></script>
<script type="text/javascript">
{literal}
$(document).ready(function() {
PDFJS.workerSrc='{/literal}{$baseUrl}/plugins/generic/pdfJsViewer/pdf.js/build/pdf.worker.js{literal}';
PDFJS.workerSrc='{/literal}{$pluginUrl}/pdf.js/build/pdf.worker.js{literal}';
PDFJS.getDocument({/literal}'{$pdfUrl|escape:"javascript"}'{literal}).then(function(pdf) {
// Using promise to fetch the page
pdf.getPage(1).then(function(page) {
Expand All @@ -33,8 +33,8 @@
});
{/literal}
</script>
<script type="text/javascript" src="{$baseUrl}/plugins/generic/pdfJsViewer/pdf.js/web/viewer.js"></script> *}
<script type="text/javascript" src="{$pluginUrl}/pdf.js/web/viewer.js"></script> *}

<div id="pdfCanvasContainer">
<iframe src="{$baseUrl}/plugins/generic/pdfJsViewer/pdf.js/web/viewer.html?file={$pdfUrl|escape:"url"}" width="100%" height="100%" style="min-height: 500px;" allowfullscreen webkitallowfullscreen></iframe>
<iframe src="{$pluginUrl}/pdf.js/web/viewer.html?file={$pdfUrl|escape:"url"}" width="100%" height="100%" style="min-height: 500px;" allowfullscreen webkitallowfullscreen></iframe>
</div>

0 comments on commit e8be412

Please sign in to comment.