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

pull/1/head
Jan Holesovsky 9 years ago
parent fbe7b6908c
commit 302317ca47

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

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

@ -277,8 +277,11 @@ var documentsMain = {
}
documentsMain.show();
if (fileId){
documentsMain.overlay.documentOverlay('show');
documentsMain.prepareSession();
documentsMain.joinSession(fileId);
}
documentsMain.ready = true;
@ -508,7 +511,7 @@ var documentsMain = {
},
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(
url,
{},

@ -53,7 +53,7 @@ var odfViewer = {
onEdit : function(fileName, context){
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) {

Loading…
Cancel
Save