cloudsuite: Fix starting of editing directly from the Files view.

This commit is contained in:
Jan Holesovsky 2015-10-30 16:51:44 +01:00
parent fbe7b6908c
commit 302317ca47
4 changed files with 10 additions and 19 deletions

View File

@ -33,7 +33,7 @@ $application->registerRoutes($this, [
['name' => 'document#listAll', 'url' => 'ajax/documents/list', 'verb' => 'GET'], ['name' => 'document#listAll', 'url' => 'ajax/documents/list', 'verb' => 'GET'],
['name' => 'document#download', 'url' => 'ajax/download.php', 'verb' => 'GET'], ['name' => 'document#download', 'url' => 'ajax/download.php', 'verb' => 'GET'],
//documents - for CloudSuite access //documents - for CloudSuite access
['name' => 'document#localLoad', 'url' => 'ajax/documents/load/{esId}', 'verb' => 'POST'], ['name' => 'document#localLoad', 'url' => 'load/{fileId}', 'verb' => 'POST'],
//settings //settings
['name' => 'settings#savePersonal', 'url' => 'ajax/personal.php', 'verb' => 'POST'], ['name' => 'settings#savePersonal', 'url' => 'ajax/personal.php', 'verb' => 'POST'],
['name' => 'settings#setUnstable', 'url' => 'ajax/config/unstable', 'verb' => 'POST'], ['name' => 'settings#setUnstable', 'url' => 'ajax/config/unstable', 'verb' => 'POST'],

View File

@ -115,23 +115,11 @@ class DocumentController extends Controller{
* Copy the file to a temporary location that is shared between the * Copy the file to a temporary location that is shared between the
* cloudsuite server part and owncloud. * cloudsuite server part and owncloud.
*/ */
public function localLoad($esId){ public function localLoad($fileId){
$session = new Db\Session(); $view = \OC\Files\Filesystem::getView();
$session->load($esId); $path = $view->getPath($fileId);
$member = new Db\Member(); if (!$view->is_file($path)) {
$member->load($this->uid);
try {
if ($member->getIsGuest()){
$file = File::getByShareToken($member->getToken());
} else {
$file = new File($session->getFileId());
}
$view = $file->getOwnerView(true);
$path = $file->getPath(true);
} catch (\Exception $e){
return array( return array(
'status' => 'error', 'status' => 'error',
'message' => (string) $this->l10n->t('Unable to copy document for CloudSuite access.') 'message' => (string) $this->l10n->t('Unable to copy document for CloudSuite access.')

View File

@ -277,8 +277,11 @@ var documentsMain = {
} }
documentsMain.show(); documentsMain.show();
if (fileId){ if (fileId){
documentsMain.overlay.documentOverlay('show'); documentsMain.overlay.documentOverlay('show');
documentsMain.prepareSession();
documentsMain.joinSession(fileId);
} }
documentsMain.ready = true; documentsMain.ready = true;
@ -508,7 +511,7 @@ var documentsMain = {
}, },
loadDocument: function() { loadDocument: function() {
var url = OC.generateUrl('apps/documents/ajax/documents/load/{es_id}', {es_id: documentsMain.esId}); var url = OC.generateUrl('apps/documents/load/{file_id}', {file_id: documentsMain.fileId});
$.post( $.post(
url, url,
{}, {},

View File

@ -53,7 +53,7 @@ var odfViewer = {
onEdit : function(fileName, context){ onEdit : function(fileName, context){
var fileId = context.$file.attr('data-id'); var fileId = context.$file.attr('data-id');
window.location = OC.linkTo('documents', 'index.php') + '#' + fileId; window.location = OC.generateUrl('apps/documents/index#{file_id}', {file_id: fileId});
}, },
onView: function(filename, context) { onView: function(filename, context) {