From 85f3079b47eb32a91ed46c53cf80d67756bdb10d Mon Sep 17 00:00:00 2001 From: Henry Castro Date: Sat, 5 Mar 2016 18:57:23 -0400 Subject: [PATCH] Post WOPI url iframe --- controller/documentcontroller.php | 4 +-- js/documents.js | 52 ++++++++++++++----------------- templates/documents.php | 2 +- 3 files changed, 26 insertions(+), 32 deletions(-) diff --git a/controller/documentcontroller.php b/controller/documentcontroller.php index 23743a64..80ee5219 100644 --- a/controller/documentcontroller.php +++ b/controller/documentcontroller.php @@ -62,8 +62,8 @@ class DocumentController extends Controller{ ]); $policy = new ContentSecurityPolicy(); -+ $policy->addAllowedScriptDomain('\'self\' http://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js http://cdnjs.cloudflare.com/ajax/libs/jquery-mousewheel/3.1.12/jquery.mousewheel.min.js \'unsafe-eval\' ' . $this->settings->getAppValue('documents', 'wopi_url', $_SERVER['SERVER_NAME'])); -+ $policy->addAllowedFrameDomain('\'self\' http://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js http://cdnjs.cloudflare.com/ajax/libs/jquery-mousewheel/3.1.12/jquery.mousewheel.min.js \'unsafe-eval\' ' . $this->settings->getAppValue('documents', 'wopi_url', $_SERVER['SERVER_NAME'])); ++ $policy->addAllowedScriptDomain('\'self\' http://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js http://cdnjs.cloudflare.com/ajax/libs/jquery-mousewheel/3.1.12/jquery.mousewheel.min.js \'unsafe-eval\' ' . $this->settings->getAppValue('richdocuments', 'wopi_url')); ++ $policy->addAllowedFrameDomain('\'self\' http://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js http://cdnjs.cloudflare.com/ajax/libs/jquery-mousewheel/3.1.12/jquery.mousewheel.min.js \'unsafe-eval\' ' . $this->settings->getAppValue('richdocuments', 'wopi_url')); $policy->addAllowedConnectDomain('ws://' . $_SERVER['SERVER_NAME'] . ':9980'); $policy->addAllowedImageDomain('*'); $policy->allowInlineScript(true); diff --git a/js/documents.js b/js/documents.js index 95f0ca7c..5b8d16eb 100644 --- a/js/documents.js +++ b/js/documents.js @@ -179,22 +179,28 @@ var documentsMain = { $(document.body).prepend(documentsMain.UI.container); $('title').text(title + ' - ' + documentsMain.UI.mainTitle); - var viewer = window.location.protocol + '//' + window.location.host + '/loleaflet/dist/loleaflet.html?' + - 'file_path=' + documentsMain.url + - '&host=' + 'ws://' + window.location.hostname + ':9980' + - '&permission=' + 'view' + - '×tamp=' + ''; - var frame = '