diff --git a/README.md b/README.md
index 74e601d..e2cc100 100755
--- a/README.md
+++ b/README.md
@@ -1 +1,8 @@
-# wopiviewer
\ No newline at end of file
+# wopiviewer
+
+Don't forget to to set the following in config.php
+ 'wopi.secret'
+ 'wopi.baseurl'
+ 'wopi.oos'
+ 'wopi.cabundle'
+
diff --git a/appinfo/app.php b/appinfo/app.php
index fb7f9c8..99bdf38 100755
--- a/appinfo/app.php
+++ b/appinfo/app.php
@@ -9,40 +9,11 @@
* @copyright Hugo Gonzalez Labrador (CERN) 2017
*/
-namespace OCA\WopiViewer\AppInfo;
-
-use OCP\AppFramework\App;
-
-require_once __DIR__ . '/autoload.php';
-
-$app = new App('wopiviewer');
-$container = $app->getContainer();
+if (\OCP\Util::getVersion()[0] >= 10) {
+ $policy = new OCP\AppFramework\Http\EmptyContentSecurityPolicy();
+ $policy->addAllowedFrameDomain(\OC::$server->getConfig()->getSystemValue('wopi.oos','self'));
+ \OC::$server->getContentSecurityPolicyManager()->addDefaultPolicy($policy);
+}
\OCP\Util::addScript('wopiviewer', 'script');
\OCP\Util::addStyle('wopiviewer', 'style');
-
-/*
-$container->query('OCP\INavigationManager')->add(function () use ($container) {
- $urlGenerator = $container->query('OCP\IURLGenerator');
- $l10n = $container->query('OCP\IL10N');
- return [
- // the string under which your app will be referenced in owncloud
- 'id' => 'wopiviewer',
-
- // sorting weight for the navigation. The higher the number, the higher
- // will it be listed in the navigation
- 'order' => 10,
-
- // the route that will be shown on startup
- 'href' => $urlGenerator->linkToRoute('wopiviewer.page.index'),
-
- // the icon that will be shown in the navigation
- // this file needs to exist in img/
- 'icon' => $urlGenerator->imagePath('wopiviewer', 'app.svg'),
-
- // the title of your application. This will be used in the
- // navigation or on the settings page of your app
- 'name' => $l10n->t('Wopi Viewer'),
- ];
-});
-*/
\ No newline at end of file
diff --git a/appinfo/info.xml b/appinfo/info.xml
index c027850..8c5eb6a 100755
--- a/appinfo/info.xml
+++ b/appinfo/info.xml
@@ -9,6 +9,6 @@
The Office application is in beta
'; $("header div#header").append(closeButton); @@ -167,22 +170,104 @@ sendOpen(filename, data, excelEditor); } }, + onViewOnenote: function (filename, data) { + // if file size is 0 we ask office online + // to create an empty docx file + var filesize = parseInt(data.$file.attr("data-size")); + if(filesize === 0) { + sendOpen(filename, data, onenoteNew); + } else { + sendOpen(filename, data, onenoteViewer); + } + }, + onEditOnenote: function (filename, data) { + // if file size is 0 we ask office online + // to create an empty docx file + var filesize = parseInt(data.$file.attr("data-size")); + if(filesize === 0) { + sendOpen(filename, data, onenoteNew); + } else { + sendOpen(filename, data, onenoteEditor); + } + }, }; $(document).ready(function () { if (OCA && OCA.Files) { OCA.Files.fileActions.register('application/msword', 'Edit in Office Online', OC.PERMISSION_UPDATE, OC.imagePath('core', 'actions/play'), wopiViewer.onEditWord); + OCA.Files.fileActions.register('application/vnd.ms-word.document.macroEnabled.12', 'Edit in Office Online', OC.PERMISSION_UPDATE, OC.imagePath('core', 'actions/play'), wopiViewer.onEditWord); + OCA.Files.fileActions.register('application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'Edit in Office Online', OC.PERMISSION_UPDATE, OC.imagePath('core', 'actions/play'), wopiViewer.onEditWord); + OCA.Files.fileActions.register('application/vnd.openxmlformats-officedocument.wordprocessingml.template', 'Edit in Office Online', OC.PERMISSION_UPDATE, OC.imagePath('core', 'actions/play'), wopiViewer.onEditWord); + //OCA.Files.fileActions.register('application/vnd.oasis.opendocument.text', 'Edit in Office Online', OC.PERMISSION_UPDATE, OC.imagePath('core', 'actions/play'), wopiViewer.onEditWord); OCA.Files.fileActions.register('application/vnd.ms-powerpoint', 'Edit in Office Online', OC.PERMISSION_UPDATE, OC.imagePath('core', 'actions/play'), wopiViewer.onEditPowerpoint); + OCA.Files.fileActions.register('application/vnd.ms-powerpoint.addin.macroEnabled.12', 'Edit in Office Online', OC.PERMISSION_UPDATE, OC.imagePath('core', 'actions/play'), wopiViewer.onEditPowerpoint); + OCA.Files.fileActions.register('application/vnd.ms-powerpoint.presentation.macroEnabled.12', 'Edit in Office Online', OC.PERMISSION_UPDATE, OC.imagePath('core', 'actions/play'), wopiViewer.onEditPowerpoint); + OCA.Files.fileActions.register('application/vnd.ms-powerpoint.slideshow.macroEnabled.12', 'Edit in Office Online', OC.PERMISSION_UPDATE, OC.imagePath('core', 'actions/play'), wopiViewer.onEditPowerpoint); + OCA.Files.fileActions.register('application/vnd.ms-powerpoint.template.macroEnabled.12', 'Edit in Office Online', OC.PERMISSION_UPDATE, OC.imagePath('core', 'actions/play'), wopiViewer.onEditPowerpoint); + OCA.Files.fileActions.register('application/vnd.openxmlformats-officedocument.presentationml.presentation', 'Edit in Office Online', OC.PERMISSION_UPDATE, OC.imagePath('core', 'actions/play'), wopiViewer.onEditPowerpoint); + OCA.Files.fileActions.register('application/vnd.openxmlformats-officedocument.presentationml.template', 'Edit in Office Online', OC.PERMISSION_UPDATE, OC.imagePath('core', 'actions/play'), wopiViewer.onEditPowerpoint); + OCA.Files.fileActions.register('application/vnd.openxmlformats-officedocument.presentationml.slideshow', 'Edit in Office Online', OC.PERMISSION_UPDATE, OC.imagePath('core', 'actions/play'), wopiViewer.onEditPowerpoint); + //OCA.Files.fileActions.register('application/vnd.oasis.opendocument.presentation', 'Edit in Office Online', OC.PERMISSION_UPDATE, OC.imagePath('core', 'actions/play'), wopiViewer.onEditPowerpoint); OCA.Files.fileActions.register('application/vnd.ms-excel', 'Edit in Office Online', OC.PERMISSION_UPDATE, OC.imagePath('core', 'actions/play'), wopiViewer.onEditExcel); + OCA.Files.fileActions.register('application/vnd.ms-excel.addin.macroEnabled.12', 'Edit in Office Online', OC.PERMISSION_UPDATE, OC.imagePath('core', 'actions/play'), wopiViewer.onEditExcel); + OCA.Files.fileActions.register('application/vnd.ms-excel.sheet.binary.macroEnabled.12', 'Edit in Office Online', OC.PERMISSION_UPDATE, OC.imagePath('core', 'actions/play'), wopiViewer.onEditExcel); + OCA.Files.fileActions.register('application/vnd.ms-excel.sheet.macroEnabled.12', 'Edit in Office Online', OC.PERMISSION_UPDATE, OC.imagePath('core', 'actions/play'), wopiViewer.onEditExcel); + OCA.Files.fileActions.register('application/vnd.ms-excel.template.macroEnabled.12', 'Edit in Office Online', OC.PERMISSION_UPDATE, OC.imagePath('core', 'actions/play'), wopiViewer.onEditExcel); + OCA.Files.fileActions.register('application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'Edit in Office Online', OC.PERMISSION_UPDATE, OC.imagePath('core', 'actions/play'), wopiViewer.onEditExcel); + OCA.Files.fileActions.register('application/vnd.openxmlformats-officedocument.spreadsheetml.template', 'Edit in Office Online', OC.PERMISSION_UPDATE, OC.imagePath('core', 'actions/play'), wopiViewer.onEditExcel); + //OCA.Files.fileActions.register('application/vnd.oasis.opendocument.spreadsheet', 'Edit in Office Online', OC.PERMISSION_UPDATE, OC.imagePath('core', 'actions/play'), wopiViewer.onEditExcel); + //OCA.Files.fileActions.register('application/msonenote', 'Edit in Office Online', OC.PERMISSION_UPDATE, OC.imagePath('core', 'actions/play'), wopiViewer.onEditOnenote); + OCA.Files.fileActions.register('application/msword', 'Default View', OC.PERMISSION_READ, OC.imagePath('core', 'actions/play'), wopiViewer.onViewWord); + OCA.Files.fileActions.register('application/vnd.ms-word.document.macroEnabled.12', 'Default View', OC.PERMISSION_READ, OC.imagePath('core', 'actions/play'), wopiViewer.onViewWord); + OCA.Files.fileActions.register('application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'Default View', OC.PERMISSION_READ, OC.imagePath('core', 'actions/play'), wopiViewer.onViewWord); + OCA.Files.fileActions.register('application/vnd.openxmlformats-officedocument.wordprocessingml.template', 'Default View', OC.PERMISSION_READ, OC.imagePath('core', 'actions/play'), wopiViewer.onViewWord); + //OCA.Files.fileActions.register('application/vnd.oasis.opendocument.text', 'Default View', OC.PERMISSION_READ, OC.imagePath('core', 'actions/play'), wopiViewer.onViewWord); OCA.Files.fileActions.register('application/vnd.ms-powerpoint', 'Default View', OC.PERMISSION_READ, OC.imagePath('core', 'actions/play'), wopiViewer.onViewPowerpoint); + OCA.Files.fileActions.register('application/vnd.ms-powerpoint.addin.macroEnabled.12', 'Default View', OC.PERMISSION_READ, OC.imagePath('core', 'actions/play'), wopiViewer.onViewPowerpoint); + OCA.Files.fileActions.register('application/vnd.ms-powerpoint.presentation.macroEnabled.12', 'Default View', OC.PERMISSION_READ, OC.imagePath('core', 'actions/play'), wopiViewer.onViewPowerpoint); + OCA.Files.fileActions.register('application/vnd.ms-powerpoint.slideshow.macroEnabled.12', 'Default View', OC.PERMISSION_READ, OC.imagePath('core', 'actions/play'), wopiViewer.onViewPowerpoint); + OCA.Files.fileActions.register('application/vnd.ms-powerpoint.template.macroEnabled.12', 'Default View', OC.PERMISSION_READ, OC.imagePath('core', 'actions/play'), wopiViewer.onViewPowerpoint); + OCA.Files.fileActions.register('application/vnd.openxmlformats-officedocument.presentationml.presentation', 'Default View', OC.PERMISSION_READ, OC.imagePath('core', 'actions/play'), wopiViewer.onViewPowerpoint); + OCA.Files.fileActions.register('application/vnd.openxmlformats-officedocument.presentationml.template', 'Default View', OC.PERMISSION_READ, OC.imagePath('core', 'actions/play'), wopiViewer.onViewPowerpoint); + OCA.Files.fileActions.register('application/vnd.openxmlformats-officedocument.presentationml.slideshow', 'Default View', OC.PERMISSION_READ, OC.imagePath('core', 'actions/play'), wopiViewer.onViewPowerpoint); + //OCA.Files.fileActions.register('application/vnd.oasis.opendocument.presentation', 'Default View', OC.PERMISSION_READ, OC.imagePath('core', 'actions/play'), wopiViewer.onViewPowerpoint); OCA.Files.fileActions.register('application/vnd.ms-excel', 'Default View', OC.PERMISSION_READ, OC.imagePath('core', 'actions/play'), wopiViewer.onViewExcel); + OCA.Files.fileActions.register('application/vnd.ms-excel.addin.macroEnabled.12', 'Default View', OC.PERMISSION_READ, OC.imagePath('core', 'actions/play'), wopiViewer.onViewExcel); + OCA.Files.fileActions.register('application/vnd.ms-excel.sheet.binary.macroEnabled.12', 'Default View', OC.PERMISSION_READ, OC.imagePath('core', 'actions/play'), wopiViewer.onViewExcel); + OCA.Files.fileActions.register('application/vnd.ms-excel.sheet.macroEnabled.12', 'Default View', OC.PERMISSION_READ, OC.imagePath('core', 'actions/play'), wopiViewer.onViewExcel); + OCA.Files.fileActions.register('application/vnd.ms-excel.template.macroEnabled.12', 'Default View', OC.PERMISSION_READ, OC.imagePath('core', 'actions/play'), wopiViewer.onViewExcel); + OCA.Files.fileActions.register('application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'Default View', OC.PERMISSION_READ, OC.imagePath('core', 'actions/play'), wopiViewer.onViewExcel); + OCA.Files.fileActions.register('application/vnd.openxmlformats-officedocument.spreadsheetml.template', 'Default View', OC.PERMISSION_READ, OC.imagePath('core', 'actions/play'), wopiViewer.onViewExcel); + //OCA.Files.fileActions.register('application/vnd.oasis.opendocument.spreadsheet', 'Default View', OC.PERMISSION_READ, OC.imagePath('core', 'actions/play'), wopiViewer.onViewExcel); + //OCA.Files.fileActions.register('application/msonenote', 'Default View', OC.PERMISSION_READ, OC.imagePath('core', 'actions/play'), wopiViewer.onViewOnenote); + OCA.Files.fileActions.setDefault('application/msword', 'Default View'); + OCA.Files.fileActions.setDefault('application/vnd.ms-word.document.macroEnabled.12', 'Default View'); + OCA.Files.fileActions.setDefault('application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'Default View'); + OCA.Files.fileActions.setDefault('application/vnd.openxmlformats-officedocument.wordprocessingml.template', 'Default View'); + //OCA.Files.fileActions.setDefault('application/vnd.oasis.opendocument.text', 'Default View'); OCA.Files.fileActions.setDefault('application/vnd.ms-powerpoint', 'Default View'); + OCA.Files.fileActions.setDefault('application/vnd.ms-powerpoint.addin.macroEnabled.12', 'Default View'); + OCA.Files.fileActions.setDefault('application/vnd.ms-powerpoint.presentation.macroEnabled.12', 'Default View'); + OCA.Files.fileActions.setDefault('application/vnd.ms-powerpoint.slideshow.macroEnabled.12', 'Default View'); + OCA.Files.fileActions.setDefault('application/vnd.ms-powerpoint.template.macroEnabled.12', 'Default View'); + OCA.Files.fileActions.setDefault('application/vnd.openxmlformats-officedocument.presentationml.presentation', 'Default View'); + OCA.Files.fileActions.setDefault('application/vnd.openxmlformats-officedocument.presentationml.template', 'Default View'); + OCA.Files.fileActions.setDefault('application/vnd.openxmlformats-officedocument.presentationml.slideshow', 'Default View'); + //OCA.Files.fileActions.setDefault('application/vnd.oasis.opendocument.presentation', 'Default View'); OCA.Files.fileActions.setDefault('application/vnd.ms-excel', 'Default View'); + OCA.Files.fileActions.setDefault('application/vnd.ms-excel.addin.macroEnabled.12', 'Default View'); + OCA.Files.fileActions.setDefault('application/vnd.ms-excel.sheet.binary.macroEnabled.12', 'Default View'); + OCA.Files.fileActions.setDefault('application/vnd.ms-excel.sheet.macroEnabled.12', 'Default View'); + OCA.Files.fileActions.setDefault('application/vnd.ms-excel.template.macroEnabled.12', 'Default View'); + OCA.Files.fileActions.setDefault('application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'Default View'); + OCA.Files.fileActions.setDefault('application/vnd.openxmlformats-officedocument.spreadsheetml.template', 'Default View'); + //OCA.Files.fileActions.setDefault('application/vnd.oasis.opendocument.spreadsheet', 'Default View'); + //OCA.Files.fileActions.setDefault('application/msonenote', 'Default View'); } }); diff --git a/templates/main.php b/templates/main.php deleted file mode 100755 index 26e4087..0000000 --- a/templates/main.php +++ /dev/null @@ -1,17 +0,0 @@ - - -Hello World
- - - - - - -Ajax response: \ No newline at end of file diff --git a/templates/part.navigation.php b/templates/part.navigation.php deleted file mode 100755 index b28b6a8..0000000 --- a/templates/part.navigation.php +++ /dev/null @@ -1,10 +0,0 @@ -