commit
216b31c917
2
Makefile
2
Makefile
@ -1,4 +1,4 @@
|
|||||||
VERSION=1.0.4
|
VERSION=1.0.5
|
||||||
|
|
||||||
.PHONY: dist
|
.PHONY: dist
|
||||||
dist: owncloud-ccs.spec
|
dist: owncloud-ccs.spec
|
||||||
|
@ -29,21 +29,21 @@ use OCA\Richdocuments\Genesis;
|
|||||||
use \OC\Files\View;
|
use \OC\Files\View;
|
||||||
|
|
||||||
class DocumentController extends Controller{
|
class DocumentController extends Controller{
|
||||||
|
|
||||||
private $uid;
|
private $uid;
|
||||||
private $l10n;
|
private $l10n;
|
||||||
private $settings;
|
private $settings;
|
||||||
|
|
||||||
const ODT_TEMPLATE_PATH = '/assets/odttemplate.odt';
|
const ODT_TEMPLATE_PATH = '/assets/odttemplate.odt';
|
||||||
const CLOUDSUITE_TMP_PATH = '/documents-tmp/';
|
const CLOUDSUITE_TMP_PATH = '/documents-tmp/';
|
||||||
|
|
||||||
public function __construct($appName, IRequest $request, IConfig $settings, IL10N $l10n, $uid){
|
public function __construct($appName, IRequest $request, IConfig $settings, IL10N $l10n, $uid){
|
||||||
parent::__construct($appName, $request);
|
parent::__construct($appName, $request);
|
||||||
$this->uid = $uid;
|
$this->uid = $uid;
|
||||||
$this->l10n = $l10n;
|
$this->l10n = $l10n;
|
||||||
$this->settings = $settings;
|
$this->settings = $settings;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @NoAdminRequired
|
* @NoAdminRequired
|
||||||
* @NoCSRFRequired
|
* @NoCSRFRequired
|
||||||
@ -72,7 +72,7 @@ class DocumentController extends Controller{
|
|||||||
|
|
||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @NoAdminRequired
|
* @NoAdminRequired
|
||||||
*/
|
*/
|
||||||
@ -100,17 +100,17 @@ class DocumentController extends Controller{
|
|||||||
}
|
}
|
||||||
|
|
||||||
$path = Helper::getNewFileName($view, $dir . '/' . $basename);
|
$path = Helper::getNewFileName($view, $dir . '/' . $basename);
|
||||||
|
|
||||||
$content = '';
|
$content = '';
|
||||||
if (class_exists('\OC\Files\Type\TemplateManager')){
|
if (class_exists('\OC\Files\Type\TemplateManager')){
|
||||||
$manager = \OC_Helper::getFileTemplateManager();
|
$manager = \OC_Helper::getFileTemplateManager();
|
||||||
$content = $manager->getTemplate($mimetype);
|
$content = $manager->getTemplate($mimetype);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$content){
|
if (!$content){
|
||||||
$content = file_get_contents(dirname(__DIR__) . self::ODT_TEMPLATE_PATH);
|
$content = file_get_contents(dirname(__DIR__) . self::ODT_TEMPLATE_PATH);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($content && $view->file_put_contents($path, $content)){
|
if ($content && $view->file_put_contents($path, $content)){
|
||||||
$info = $view->getFileInfo($path);
|
$info = $view->getFileInfo($path);
|
||||||
$response = array(
|
$response = array(
|
||||||
@ -143,13 +143,15 @@ class DocumentController extends Controller{
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
$content = $view->file_get_contents($path);
|
|
||||||
|
|
||||||
// copy; the first user gets a predictable filename so that cloudsuite
|
|
||||||
// uses the tile cache, others get tempnam
|
|
||||||
$filename = dirname(__DIR__) . self::CLOUDSUITE_TMP_PATH . 'ccs-' . $fileId;
|
$filename = dirname(__DIR__) . self::CLOUDSUITE_TMP_PATH . 'ccs-' . $fileId;
|
||||||
if (file_exists($filename))
|
if (file_exists($filename)) {
|
||||||
$filename = tempnam(dirname(__DIR__) . self::CLOUDSUITE_TMP_PATH, 'ccs-' . $fileId . '-');
|
return array(
|
||||||
|
'status' => 'success', 'filename' => $filename,
|
||||||
|
'basename' => basename($filename)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
$content = $view->file_get_contents($path);
|
||||||
|
|
||||||
file_put_contents($filename, $content);
|
file_put_contents($filename, $content);
|
||||||
|
|
||||||
@ -222,11 +224,11 @@ class DocumentController extends Controller{
|
|||||||
public function serve($esId){
|
public function serve($esId){
|
||||||
$session = new Db\Session();
|
$session = new Db\Session();
|
||||||
$session->load($esId);
|
$session->load($esId);
|
||||||
|
|
||||||
$filename = $session->getGenesisUrl() ? $session->getGenesisUrl() : '';
|
$filename = $session->getGenesisUrl() ? $session->getGenesisUrl() : '';
|
||||||
return new DownloadResponse($this->request, $session->getOwner(), $filename);
|
return new DownloadResponse($this->request, $session->getOwner(), $filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @NoAdminRequired
|
* @NoAdminRequired
|
||||||
*/
|
*/
|
||||||
@ -236,7 +238,7 @@ class DocumentController extends Controller{
|
|||||||
$response->setStatus(Http::STATUS_BAD_REQUEST);
|
$response->setStatus(Http::STATUS_BAD_REQUEST);
|
||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
|
|
||||||
$fullPath = '/files' . $path;
|
$fullPath = '/files' . $path;
|
||||||
$fileInfo = \OC\Files\Filesystem::getFileInfo($path);
|
$fileInfo = \OC\Files\Filesystem::getFileInfo($path);
|
||||||
if ($fileInfo){
|
if ($fileInfo){
|
||||||
@ -248,7 +250,7 @@ class DocumentController extends Controller{
|
|||||||
}
|
}
|
||||||
return new DownloadResponse($this->request, $this->uid, $fullPath);
|
return new DownloadResponse($this->request, $this->uid, $fullPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @NoAdminRequired
|
* @NoAdminRequired
|
||||||
@ -295,13 +297,13 @@ class DocumentController extends Controller{
|
|||||||
usort($documents, function($a, $b){
|
usort($documents, function($a, $b){
|
||||||
return @$b['mtime']-@$a['mtime'];
|
return @$b['mtime']-@$a['mtime'];
|
||||||
});
|
});
|
||||||
|
|
||||||
$session = new Db\Session();
|
$session = new Db\Session();
|
||||||
$sessions = $session->getCollectionBy('file_id', $fileIds);
|
$sessions = $session->getCollectionBy('file_id', $fileIds);
|
||||||
|
|
||||||
$members = array();
|
$members = array();
|
||||||
$member = new Db\Member();
|
$member = new Db\Member();
|
||||||
foreach ($sessions as $session) {
|
foreach ($sessions as $session) {
|
||||||
$members[$session['es_id']] = $member->getActiveCollection($session['es_id']);
|
$members[$session['es_id']] = $member->getActiveCollection($session['es_id']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -182,7 +182,7 @@ var documentsMain = {
|
|||||||
var viewer = window.location.protocol + '//' + window.location.host + '/cloudsuite/cloudsuite.html?' +
|
var viewer = window.location.protocol + '//' + window.location.host + '/cloudsuite/cloudsuite.html?' +
|
||||||
'file_path=' + documentsMain.url +
|
'file_path=' + documentsMain.url +
|
||||||
'&host=' + 'ws://' + window.location.hostname + ':9980' +
|
'&host=' + 'ws://' + window.location.hostname + ':9980' +
|
||||||
'&edit=' + 'false' +
|
'&permission=' + 'view' +
|
||||||
'×tamp=' + '';
|
'×tamp=' + '';
|
||||||
|
|
||||||
var frame = '<iframe id="loleafletframe" allowfullscreen style="width:100%;height:100%;position:absolute;" src="' + viewer + '" sandbox="allow-scripts allow-same-origin allow-popups allow-modals"/>';
|
var frame = '<iframe id="loleafletframe" allowfullscreen style="width:100%;height:100%;position:absolute;" src="' + viewer + '" sandbox="allow-scripts allow-same-origin allow-popups allow-modals"/>';
|
||||||
|
@ -92,7 +92,7 @@ var odfViewer = {
|
|||||||
var viewer = window.location.protocol + '//' + window.location.host + '/cloudsuite/cloudsuite.html?' +
|
var viewer = window.location.protocol + '//' + window.location.host + '/cloudsuite/cloudsuite.html?' +
|
||||||
'file_path=' + context.dir + '/' + filename +
|
'file_path=' + context.dir + '/' + filename +
|
||||||
'&host=' + 'ws://' + window.location.hostname + ':9980' +
|
'&host=' + 'ws://' + window.location.hostname + ':9980' +
|
||||||
'&edit=' + 'false' +
|
'&permission=' + 'view' +
|
||||||
'×tamp=' + '';
|
'×tamp=' + '';
|
||||||
|
|
||||||
var frame = '<iframe id="loleafletframe" style="width:100%;height:100%;display:block;position:fixed;top:46px;" src="' + viewer + '" sandbox="allow-scripts allow-same-origin allow-popups"/>';
|
var frame = '<iframe id="loleafletframe" style="width:100%;height:100%;display:block;position:fixed;top:46px;" src="' + viewer + '" sandbox="allow-scripts allow-same-origin allow-popups"/>';
|
||||||
|
Loading…
x
Reference in New Issue
Block a user