cloudsuite: Cleanup when the document is closed.
This commit is contained in:
parent
6b3585dcc6
commit
91e49449f3
@ -35,6 +35,7 @@ $application->registerRoutes($this, [
|
||||
//documents - for CloudSuite access
|
||||
['name' => 'document#localLoad', 'url' => 'load/{fileId}', 'verb' => 'POST'],
|
||||
['name' => 'document#localSave', 'url' => 'save/{fileId}', 'verb' => 'POST'],
|
||||
['name' => 'document#localClose', 'url' => 'close/{fileId}', 'verb' => 'POST'],
|
||||
//settings
|
||||
['name' => 'settings#savePersonal', 'url' => 'ajax/personal.php', 'verb' => 'POST'],
|
||||
['name' => 'settings#setUnstable', 'url' => 'ajax/config/unstable', 'verb' => 'POST'],
|
||||
|
@ -186,6 +186,24 @@ class DocumentController extends Controller{
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @NoAdminRequired
|
||||
* @PublicPage
|
||||
* Remove the temporary local copy of the document.
|
||||
*/
|
||||
public function localClose($fileId){
|
||||
// get really just the basename for the case somebody tries to trick us
|
||||
$basename = basename($this->request->post['basename']);
|
||||
|
||||
$filename = dirname(__DIR__) . self::CLOUDSUITE_TMP_PATH . $basename;
|
||||
|
||||
unlink($filename);
|
||||
|
||||
return array(
|
||||
'status' => 'success'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @NoAdminRequired
|
||||
* @PublicPage
|
||||
|
@ -527,6 +527,14 @@ var documentsMain = {
|
||||
);
|
||||
},
|
||||
|
||||
closeDocument: function() {
|
||||
var url = OC.generateUrl('apps/documents/close/{file_id}', {file_id: documentsMain.fileId});
|
||||
$.post(
|
||||
url,
|
||||
{ basename : documentsMain.baseName }
|
||||
);
|
||||
},
|
||||
|
||||
renameDocument: function(name) {
|
||||
var url = OC.generateUrl('apps/documents/ajax/documents/rename/{file_id}', {file_id: documentsMain.fileId});
|
||||
$.post(
|
||||
@ -576,6 +584,7 @@ var documentsMain = {
|
||||
|
||||
$('footer,nav').show();
|
||||
documentsMain.UI.hideEditor();
|
||||
documentsMain.closeDocument();
|
||||
$('#ocToolbar').remove();
|
||||
documentsMain.show();
|
||||
},
|
||||
|
Loading…
x
Reference in New Issue
Block a user