Compare commits
13 Commits
master
...
1.1.26-nc1
Author | SHA1 | Date | |
---|---|---|---|
|
ff1ee24c46 | ||
|
ff7aa2d5e8 | ||
|
472a22ef21 | ||
|
c21c029fa4 | ||
|
7e4c59e360 | ||
|
ad61db1158 | ||
|
6b629b2c67 | ||
|
f790f640b1 | ||
|
674a6cb384 | ||
|
df0c7cce94 | ||
|
1cc5e43106 | ||
|
f74b0b3018 | ||
|
bf72f5b01d |
11
CHANGELOG.md
11
CHANGELOG.md
@ -1,3 +1,12 @@
|
||||
**1.1.25.1**
|
||||
- Bug: Fix height for revision history viewer
|
||||
- Bug: Set the correct language tag expected by JS
|
||||
- Bug: Replace trailing slash of WOPI URL
|
||||
- Bug: Try opening readonly documents too
|
||||
- Bug: Fix revision history
|
||||
- Feature: Add rtf and txt as supported file formats
|
||||
- Feature: Support for multitenancy installations of LibreOffice Online
|
||||
|
||||
**1.1.24**
|
||||
- Bug: Fix undefined PHP notices
|
||||
- Security: Properly check for password on password protected shares
|
||||
- Security: Properly check for password on password protected shares
|
||||
|
@ -5,7 +5,7 @@
|
||||
<description>Collabora Online allows you to to work with all kinds of office documents directly in your browser. This application requires Collabora Cloudsuite to be installed on one of your servers, please read the documentation to learn more about that.</description>
|
||||
<summary>Edit office documents directly in your browser.</summary>
|
||||
<licence>AGPL</licence>
|
||||
<version>1.1.24</version>
|
||||
<version>1.1.26-nc11</version>
|
||||
<author>Collabora Productivity based on work of Frank Karlitschek, Victor Dubiniuk</author>
|
||||
<bugs>https://github.com/nextcloud/richdocuments/issues</bugs>
|
||||
<repository type="git">https://github.com/nextcloud/richdocuments.git</repository>
|
||||
|
@ -133,7 +133,7 @@
|
||||
width: 100%;
|
||||
z-index: 600;
|
||||
background-color: #ddd !important;
|
||||
top: 45px;
|
||||
top: 0px;
|
||||
bottom: 0;
|
||||
}
|
||||
|
||||
@ -149,7 +149,7 @@
|
||||
z-index: 600;
|
||||
background-color: #efefef !important;
|
||||
right: 0;
|
||||
top: 45px;
|
||||
top: 0px;
|
||||
bottom: 0;
|
||||
box-sizing: border-box;
|
||||
overflow-x: hidden;
|
||||
|
@ -4,7 +4,7 @@ var documentsSettings = {
|
||||
save : function() {
|
||||
$('#wopi_apply').attr('disabled', true);
|
||||
var data = {
|
||||
wopi_url : $('#wopi_url').val()
|
||||
wopi_url : $('#wopi_url').val().replace(/\/$/, '')
|
||||
};
|
||||
|
||||
OC.msg.startAction('#documents-admin-msg', t('richdocuments', 'Saving...'));
|
||||
|
@ -119,7 +119,7 @@ var documentsMain = {
|
||||
}
|
||||
|
||||
// WOPISrc - URL that loolwsd will access (ie. pointing to ownCloud)
|
||||
var wopiurl = window.location.protocol + '//' + window.location.host + OC.generateUrl('apps/richdocuments/wopi/files/{file_id}', {file_id: fileId});
|
||||
var wopiurl = window.location.protocol + '//' + window.location.host + OC.generateUrl('apps/richdocuments/wopi/files/{file_id}_{instanceId}', {file_id: fileId, instanceId: instanceId});
|
||||
var wopisrc = encodeURIComponent(wopiurl);
|
||||
|
||||
// urlsrc - the URL from discovery xml that we access for the particular
|
||||
@ -129,7 +129,7 @@ var documentsMain = {
|
||||
var urlsrc = documentsMain.urlsrc +
|
||||
"WOPISrc=" + wopisrc +
|
||||
"&title=" + encodeURIComponent(title) +
|
||||
"&lang=" + OC.getLocale() +
|
||||
"&lang=" + OC.getLocale().replace('_', '-') + // loleaflet expects a BCP47 language tag syntax
|
||||
"&permission=readonly";
|
||||
|
||||
// access_token - must be passed via a form post
|
||||
@ -320,7 +320,7 @@ var documentsMain = {
|
||||
var urlsrc = documentsMain.urlsrc +
|
||||
"WOPISrc=" + wopisrc +
|
||||
"&title=" + encodeURIComponent(title) +
|
||||
"&lang=" + OC.getLocale() +
|
||||
"&lang=" + OC.getLocale().replace('_', '-') + // loleaflet expects a BCP47 language tag syntax
|
||||
"&closebutton=1" +
|
||||
"&revisionhistory=1";
|
||||
if (!documentsMain.canEdit || action === "view") {
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* globals FileList, OCA.Files.fileActions, oc_debug */
|
||||
var odfViewer = {
|
||||
isDocuments : false,
|
||||
supportedMimesReadWrite: [
|
||||
supportedMimes: [
|
||||
'application/vnd.oasis.opendocument.text',
|
||||
'application/vnd.oasis.opendocument.spreadsheet',
|
||||
'application/vnd.oasis.opendocument.graphics',
|
||||
@ -12,6 +12,9 @@ var odfViewer = {
|
||||
'application/vnd.wordperfect',
|
||||
'application/msonenote',
|
||||
'application/msword',
|
||||
'application/rtf',
|
||||
'text/rtf',
|
||||
'text/plain',
|
||||
'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
|
||||
'application/vnd.openxmlformats-officedocument.wordprocessingml.template',
|
||||
'application/vnd.ms-word.document.macroEnabled.12',
|
||||
@ -35,34 +38,19 @@ var odfViewer = {
|
||||
|
||||
register : function() {
|
||||
var i,
|
||||
mimeReadOnly,
|
||||
mimeReadWrite;
|
||||
mime;
|
||||
|
||||
for (i = 0; i < odfViewer.supportedMimesReadWrite.length; ++i) {
|
||||
mimeReadOnly = odfViewer.supportedMimesReadWrite[i];
|
||||
OCA.Files.fileActions.register(mimeReadOnly, 'View', OC.PERMISSION_READ, '', odfViewer.onEdit);
|
||||
OCA.Files.fileActions.setDefault(mimeReadOnly, 'View');
|
||||
}
|
||||
for (i = 0; i < odfViewer.supportedMimesReadWrite.length; ++i) {
|
||||
mimeReadWrite = odfViewer.supportedMimesReadWrite[i];
|
||||
for (i = 0; i < odfViewer.supportedMimes.length; ++i) {
|
||||
mime = odfViewer.supportedMimes[i];
|
||||
OCA.Files.fileActions.register(
|
||||
mimeReadWrite,
|
||||
mime,
|
||||
'Edit',
|
||||
OC.PERMISSION_UPDATE,
|
||||
OC.PERMISSION_UPDATE | OC.PERMISSION_READ,
|
||||
OC.imagePath('core', 'actions/rename'),
|
||||
odfViewer.onEdit,
|
||||
t('richdocuments', 'Edit')
|
||||
);
|
||||
OCA.Files.fileActions.register(
|
||||
mimeReadWrite,
|
||||
'View',
|
||||
OC.PERMISSION_READ,
|
||||
OC.imagePath('core', 'actions/rename'),
|
||||
odfViewer.onEdit,
|
||||
t('richdocuments', 'View')
|
||||
);
|
||||
OCA.Files.fileActions.setDefault(mimeReadWrite, 'View');
|
||||
OCA.Files.fileActions.setDefault(mimeReadWrite, 'Edit');
|
||||
OCA.Files.fileActions.setDefault(mime, 'Edit');
|
||||
}
|
||||
},
|
||||
|
||||
@ -227,7 +215,7 @@ $(document).ready(function() {
|
||||
// FIXME: Hack for single public file view since it is not attached to the fileslist
|
||||
$(document).ready(function(){
|
||||
// FIXME: FIlter compatible mime types
|
||||
if ($('#isPublic').val() && odfViewer.supportedMimesReadWrite.indexOf($('#mimetype').val()) !== -1) {
|
||||
if ($('#isPublic').val() && odfViewer.supportedMimes.indexOf($('#mimetype').val()) !== -1) {
|
||||
odfViewer.onEdit($('#filename').val());
|
||||
}
|
||||
});
|
||||
@ -244,4 +232,4 @@ $(document).ready(function() {
|
||||
$('#content').removeClass('loading');
|
||||
}
|
||||
}, false);
|
||||
});
|
||||
});
|
||||
|
@ -104,10 +104,11 @@ class DocumentController extends Controller {
|
||||
$params = [
|
||||
'permissions' => $item->getPermissions(),
|
||||
'title' => $item->getName(),
|
||||
'fileId' => $item->getId(),
|
||||
'fileId' => $item->getId() . '_' . $this->settings->getSystemValue('instanceid'),
|
||||
'token' => $token,
|
||||
'urlsrc' => $urlSrc,
|
||||
'path' => '/',
|
||||
'path' => $folder->getRelativePath($item->getPath()),
|
||||
'instanceId' => $this->settings->getSystemValue('instanceid'),
|
||||
];
|
||||
|
||||
$response = new TemplateResponse('richdocuments', 'documents', $params, 'empty');
|
||||
@ -153,10 +154,11 @@ class DocumentController extends Controller {
|
||||
$params = [
|
||||
'permissions' => $share->getPermissions(),
|
||||
'title' => $item->getName(),
|
||||
'fileId' => $item->getId(),
|
||||
'fileId' => $item->getId() . '_' . $this->settings->getSystemValue('instanceid'),
|
||||
'token' => $token,
|
||||
'urlsrc' => $urlSrc,
|
||||
'path' => '/',
|
||||
'instanceId' => $this->settings->getSystemValue('instanceid'),
|
||||
];
|
||||
|
||||
$response = new TemplateResponse('richdocuments', 'documents', $params, 'empty');
|
||||
@ -231,12 +233,13 @@ class DocumentController extends Controller {
|
||||
if ($content && $view->file_put_contents($path, $content)) {
|
||||
$info = $view->getFileInfo($path);
|
||||
$ret = $this->wopiParser->getUrlSrc($mimetype);
|
||||
$lolang = strtolower(str_replace('_', '-', $this->settings->getUserValue($this->uid, 'core', 'lang', 'en')));
|
||||
$response = array(
|
||||
'status' => 'success',
|
||||
'fileid' => $info['fileid'],
|
||||
'fileid' => $info['fileid'] . '_' . $this->settings->getSystemValue('instanceid'),
|
||||
'urlsrc' => $ret['urlsrc'],
|
||||
'action' => $ret['action'],
|
||||
'lolang' => $this->settings->getUserValue($this->uid, 'core', 'lang', 'en'),
|
||||
'lolang' => $lolang,
|
||||
'data' => \OCA\Files\Helper::formatFileInfo($info)
|
||||
);
|
||||
} else {
|
||||
|
@ -35,32 +35,42 @@ use OCP\AppFramework\Http\StreamResponse;
|
||||
class WopiController extends Controller {
|
||||
/** @var IRootFolder */
|
||||
private $rootFolder;
|
||||
/** @var string */
|
||||
private $userId;
|
||||
/** @var IUserManager */
|
||||
private $userManager;
|
||||
/** @var Parser */
|
||||
private $wopiParser;
|
||||
|
||||
/**
|
||||
* @param string $appName
|
||||
* @param IRequest $request
|
||||
* @param IRootFolder $rootFolder
|
||||
* @param string $UserId
|
||||
* @param IUserManager $userManager
|
||||
* @param Parser $wopiParser
|
||||
*/
|
||||
public function __construct($appName,
|
||||
$UserId,
|
||||
IRequest $request,
|
||||
IRootFolder $rootFolder,
|
||||
IUserManager $userManager,
|
||||
Parser $wopiParser) {
|
||||
IRootFolder $rootFolder) {
|
||||
parent::__construct($appName, $request);
|
||||
$this->rootFolder = $rootFolder;
|
||||
$this->userId = $UserId;
|
||||
$this->userManager = $userManager;
|
||||
$this->wopiParser = $wopiParser;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $fileId
|
||||
* @return array
|
||||
* @throws \Exception
|
||||
*/
|
||||
private function parseFileId($fileId) {
|
||||
$arr = explode('_', $fileId, 2);
|
||||
if (count($arr) === 2) {
|
||||
list($fileId, $instanceId) = $arr;
|
||||
$version = '0';
|
||||
} else if (count($arr) === 3) {
|
||||
list($fileId, $instanceId, $version) = $arr;
|
||||
} else {
|
||||
throw new \Exception('$fileId has not the expected format');
|
||||
}
|
||||
|
||||
return [
|
||||
$fileId,
|
||||
$instanceId,
|
||||
$version,
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -76,11 +86,7 @@ class WopiController extends Controller {
|
||||
public function checkFileInfo($fileId) {
|
||||
$token = $this->request->getParam('access_token');
|
||||
|
||||
$arr = explode('_', $fileId, 2);
|
||||
$version = '0';
|
||||
if (count($arr) === 2) {
|
||||
list($fileId, $version) = $arr;
|
||||
}
|
||||
list($fileId, , $version) = $this->parseFileId($fileId);
|
||||
|
||||
$row = new Wopi();
|
||||
$row->loadBy('token', $token);
|
||||
@ -130,11 +136,7 @@ class WopiController extends Controller {
|
||||
*/
|
||||
public function getFile($fileId,
|
||||
$access_token) {
|
||||
$arr = explode('_', $fileId, 2);
|
||||
$version = '0';
|
||||
if (count($arr) === 2) {
|
||||
list($fileId, $version) = $arr;
|
||||
}
|
||||
list($fileId, , $version) = $this->parseFileId($fileId);
|
||||
|
||||
$row = new Wopi();
|
||||
$row->loadBy('token', $access_token);
|
||||
@ -165,12 +167,9 @@ class WopiController extends Controller {
|
||||
* @param string $access_token
|
||||
* @return JSONResponse
|
||||
*/
|
||||
public function putFile($fileId, $access_token) {
|
||||
$arr = explode('_', $fileId, 2);
|
||||
$version = '0';
|
||||
if (count($arr) === 2) {
|
||||
list($fileId, $version) = $arr;
|
||||
}
|
||||
public function putFile($fileId,
|
||||
$access_token) {
|
||||
list($fileId, , $version) = $this->parseFileId($fileId);
|
||||
|
||||
$row = new Wopi();
|
||||
$row->loadBy('token', $access_token);
|
||||
@ -185,6 +184,9 @@ class WopiController extends Controller {
|
||||
$userFolder = $this->rootFolder->getUserFolder($res['owner']);
|
||||
$file = $userFolder->getById($fileId)[0];
|
||||
$content = fopen('php://input', 'rb');
|
||||
// Setup the FS which is needed to emit hooks (versioning).
|
||||
\OC_Util::tearDownFS();
|
||||
\OC_Util::setupFS($res['owner']);
|
||||
$file->putContent($content);
|
||||
return new JSONResponse();
|
||||
} catch (\Exception $e) {
|
||||
|
@ -5,6 +5,7 @@
|
||||
var richdocuments_token = '<?php p($_['token']) ?>';
|
||||
var richdocuments_urlsrc = '<?php p($_['urlsrc']) ?>';
|
||||
var richdocuments_path = '<?php p($_['path']) ?>';
|
||||
var instanceId = '<?php p($_['instanceId']) ?>';
|
||||
</script>
|
||||
|
||||
<?php
|
||||
|
Loading…
x
Reference in New Issue
Block a user