Merge pull request #11 from timar/master
add rtf and txt as supported file formats
This commit is contained in:
commit
f590ad9208
@ -4,7 +4,7 @@ var documentsSettings = {
|
|||||||
save : function() {
|
save : function() {
|
||||||
$('#wopi_apply').attr('disabled', true);
|
$('#wopi_apply').attr('disabled', true);
|
||||||
var data = {
|
var data = {
|
||||||
wopi_url : $('#wopi_url').val()
|
wopi_url : $('#wopi_url').val().replace(/\/$/, '')
|
||||||
};
|
};
|
||||||
|
|
||||||
OC.msg.startAction('#documents-admin-msg', t('richdocuments', 'Saving...'));
|
OC.msg.startAction('#documents-admin-msg', t('richdocuments', 'Saving...'));
|
||||||
|
@ -12,6 +12,9 @@ var odfViewer = {
|
|||||||
'application/vnd.wordperfect',
|
'application/vnd.wordperfect',
|
||||||
'application/msonenote',
|
'application/msonenote',
|
||||||
'application/msword',
|
'application/msword',
|
||||||
|
'application/rtf',
|
||||||
|
'text/rtf',
|
||||||
|
'text/plain',
|
||||||
'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
|
'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
|
||||||
'application/vnd.openxmlformats-officedocument.wordprocessingml.template',
|
'application/vnd.openxmlformats-officedocument.wordprocessingml.template',
|
||||||
'application/vnd.ms-word.document.macroEnabled.12',
|
'application/vnd.ms-word.document.macroEnabled.12',
|
||||||
|
@ -233,12 +233,13 @@ class DocumentController extends Controller {
|
|||||||
if ($content && $view->file_put_contents($path, $content)) {
|
if ($content && $view->file_put_contents($path, $content)) {
|
||||||
$info = $view->getFileInfo($path);
|
$info = $view->getFileInfo($path);
|
||||||
$ret = $this->wopiParser->getUrlSrc($mimetype);
|
$ret = $this->wopiParser->getUrlSrc($mimetype);
|
||||||
|
$lolang = strtolower(str_replace('_', '-', $this->settings->getUserValue($this->uid, 'core', 'lang', 'en')));
|
||||||
$response = array(
|
$response = array(
|
||||||
'status' => 'success',
|
'status' => 'success',
|
||||||
'fileid' => $info['fileid'] . '_' . $this->settings->getSystemValue('instanceid'),
|
'fileid' => $info['fileid'] . '_' . $this->settings->getSystemValue('instanceid'),
|
||||||
'urlsrc' => $ret['urlsrc'],
|
'urlsrc' => $ret['urlsrc'],
|
||||||
'action' => $ret['action'],
|
'action' => $ret['action'],
|
||||||
'lolang' => $this->settings->getUserValue($this->uid, 'core', 'lang', 'en'),
|
'lolang' => $lolang,
|
||||||
'data' => \OCA\Files\Helper::formatFileInfo($info)
|
'data' => \OCA\Files\Helper::formatFileInfo($info)
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
|
@ -80,7 +80,7 @@ abstract class Db {
|
|||||||
$data = $result->fetchAll();
|
$data = $result->fetchAll();
|
||||||
if (!is_array($data) || !count($data)){
|
if (!is_array($data) || !count($data)){
|
||||||
$this->data = array();
|
$this->data = array();
|
||||||
} elseif (count($data)!=1) {
|
} elseif (count($data) !== 1) {
|
||||||
throw new Exception('Duplicate ' . $value . ' for the filed ' . $field);
|
throw new Exception('Duplicate ' . $value . ' for the filed ' . $field);
|
||||||
} else {
|
} else {
|
||||||
$this->data = $data[0];
|
$this->data = $data[0];
|
||||||
|
@ -61,7 +61,7 @@ class Wopi extends \OCA\Richdocuments\Db{
|
|||||||
$wopi = new Wopi();
|
$wopi = new Wopi();
|
||||||
$row = $wopi->loadBy('token', $token)->getData();
|
$row = $wopi->loadBy('token', $token)->getData();
|
||||||
\OC::$server->getLogger()->debug('Loaded WOPI Token record: {row}.', [ 'row' => $row ]);
|
\OC::$server->getLogger()->debug('Loaded WOPI Token record: {row}.', [ 'row' => $row ]);
|
||||||
if (count($row) == 0)
|
if (count($row) === 0)
|
||||||
{
|
{
|
||||||
// Invalid token.
|
// Invalid token.
|
||||||
http_response_code(401);
|
http_response_code(401);
|
||||||
@ -75,7 +75,7 @@ class Wopi extends \OCA\Richdocuments\Db{
|
|||||||
//$wopi->deleteBy('id', $row['id']);
|
//$wopi->deleteBy('id', $row['id']);
|
||||||
//return false;
|
//return false;
|
||||||
}
|
}
|
||||||
if ($row['fileid'] != $fileId || $row['version'] != $version){
|
if ($row['fileid'] !== $fileId || $row['version'] !== $version){
|
||||||
// File unknown / user unauthorized (for the requested file).
|
// File unknown / user unauthorized (for the requested file).
|
||||||
http_response_code(404);
|
http_response_code(404);
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user