diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js index b3c95a2ef1dc..e5b55bff5f10 100644 --- a/apps/files/js/filelist.js +++ b/apps/files/js/filelist.js @@ -1911,7 +1911,15 @@ }, function(result) { if (result.status === 'success') { - self.add(result.data, {animate: true, scrollTo: true}); + var tr = self.add(result.data, {animate: true, scrollTo: true}); + if(OCA.WOPIViewer) { + var mime = result.data.mimetype; + if (mime === 'application/vnd.ms-excel' || + mime === 'application/msword' || + mime === 'application/vnd.ms-powerpoint') { + $(tr).find('span.innernametext').click(); + } + } deferred.resolve(result.status, result.data); } else { if (result.data && result.data.message) { diff --git a/apps/files/js/newfilemenu.js b/apps/files/js/newfilemenu.js index 17a2b423b2c1..d546a78286c5 100644 --- a/apps/files/js/newfilemenu.js +++ b/apps/files/js/newfilemenu.js @@ -255,22 +255,49 @@ } else { + var items = [{ + id: 'file', + displayName: t('files', 'Text file'), + templateName: t('files', 'New text file.txt'), + iconClass: 'icon-filetype-text', + fileType: 'file' + }, { + id: 'folder', + displayName: t('files', 'Folder'), + templateName: t('files', 'New folder'), + iconClass: 'icon-folder', + fileType: 'folder' + }]; + + if(OCA.WOPIViewer) { + items.push( + { + id: 'file', + displayName: t('files', 'Word'), + templateName: t('files', 'New document.docx'), + iconClass: 'icon-filetype-x-office-document', + fileType: 'file' + }, { + id: 'file', + displayName: t('files', 'Excel'), + templateName: t('files', 'New spreadsheet.xlsx'), + iconClass: 'icon-filetype-x-office-spreadsheet', + fileType: 'file' + }, { + id: 'file', + displayName: t('files', 'PowerPoint'), + templateName: t('files', 'New presentation.pptx'), + iconClass: 'icon-filetype-x-office-presentation', + fileType: 'file' + + } + ); + } + this.$el.html(this.template({ uploadMaxHumanFileSize: 'TODO', uploadLabel: t('files', 'Upload'), - items: [{ - id: 'file', - displayName: t('files', 'Text file'), - templateName: t('files', 'New text file.txt'), - iconClass: 'icon-filetype-text', - fileType: 'file' - }, { - id: 'folder', - displayName: t('files', 'Folder'), - templateName: t('files', 'New folder'), - iconClass: 'icon-folder', - fileType: 'folder' - }] + items: items })); } diff --git a/lib/private/files/objectstore/eosutil.php b/lib/private/files/objectstore/eosutil.php index 98da18e2f94c..deb41dacd94c 100644 --- a/lib/private/files/objectstore/eosutil.php +++ b/lib/private/files/objectstore/eosutil.php @@ -675,8 +675,8 @@ public static function getMimeType($path, $type){ 'pptx' => 'application/vnd.ms-powerpoint', // open office, open with office 365 - 'odt' => 'application/msword', - 'ods' => 'application/vnd.ms-excel', + //'odt' => 'application/msword', + //'ods' => 'application/vnd.ms-excel', ); $val = explode('.', $path); diff --git a/lib/private/response.php b/lib/private/response.php index 0264002b6918..229b1b19bb88 100644 --- a/lib/private/response.php +++ b/lib/private/response.php @@ -244,11 +244,11 @@ public static function addSecurityHeaders() { * @see \OCP\AppFramework\Http\Response::getHeaders */ $policy = 'default-src \'self\'; ' - . 'script-src \'self\' oos.cern.ch cdnjs.cloudflare.com cdn.mathjax.org \'unsafe-eval\' \'unsafe-inline\'; ' + . 'script-src \'self\' oos.web.cern.ch cdnjs.cloudflare.com cdn.mathjax.org \'unsafe-eval\' \'unsafe-inline\'; ' . 'style-src \'self\' \'unsafe-inline\'; ' . 'frame-src *; ' . 'img-src * data: blob:; ' - . 'font-src \'self\' oos.cern.ch cdn.mathjax.org data: blob:; ' + . 'font-src \'self\' oos.web.cern.ch cdn.mathjax.org data: blob:; ' . 'media-src *; ' . 'connect-src *'; header('Content-Security-Policy:' . $policy); diff --git a/lib/public/appframework/http/contentsecuritypolicy.php b/lib/public/appframework/http/contentsecuritypolicy.php index 6792b05278b8..30ae6dce592b 100644 --- a/lib/public/appframework/http/contentsecuritypolicy.php +++ b/lib/public/appframework/http/contentsecuritypolicy.php @@ -50,7 +50,7 @@ class ContentSecurityPolicy { /** @var array Domains from which scripts can get loaded */ private $allowedScriptDomains = [ '\'self\'', - 'oos.cern.ch', + 'oos.web.cern.ch', 'cdnjs.cloudflare.com', 'cdn.mathjax.org', ]; @@ -82,13 +82,13 @@ class ContentSecurityPolicy { private $allowedObjectDomains = []; /** @var array Domains from which iframes can be loaded */ private $allowedFrameDomains = [ - 'oos.cern.ch', + 'oos.web.cern.ch', ]; /** @var array Domains from which fonts can be loaded */ private $allowedFontDomains = [ '\'self\'', 'cdn.mathjax.org', - 'oos.cern.ch', + 'oos.web.cern.ch', ]; /** @var array Domains from which web-workers and nested browsing content can load elements */ private $allowedChildSrcDomains = [];