@ -153,6 +153,8 @@ var documentsMain = {
esId : false ,
esId : false ,
ready : false ,
ready : false ,
fileName : null ,
fileName : null ,
baseName : null ,
url : null ,
canShare : false ,
canShare : false ,
toolbar : '<div id="ocToolbar"><div id="ocToolbarInside"></div><span id="toolbar" class="claro"></span></div>' ,
toolbar : '<div id="ocToolbar"><div id="ocToolbarInside"></div><span id="toolbar" class="claro"></span></div>' ,
@ -179,8 +181,8 @@ var documentsMain = {
$ ( 'title' ) . text ( title + ' - ' + documentsMain . UI . mainTitle ) ;
$ ( 'title' ) . text ( title + ' - ' + documentsMain . UI . mainTitle ) ;
var viewer = window . location . protocol + '//' + window . location . host + '/cloudsuite/cloudsuite.html?' +
var viewer = window . location . protocol + '//' + window . location . host + '/cloudsuite/cloudsuite.html?' +
'file_path=' + 'file:///local/home/kendy/Downloads/ODT-test.odt' +
'file_path=' + documentsMain . url +
'&host=' + 'ws:// localhost :9980' +
'&host=' + 'ws:// ' + window . location . hostname + ' :9980' +
'&edit=' + 'false' +
'&edit=' + 'false' +
'×tamp=' + '' ;
'×tamp=' + '' ;
@ -346,15 +348,16 @@ var documentsMain = {
documentsMain . fileId = response . file _id ;
documentsMain . fileId = response . file _id ;
documentsMain . fileName = response . title ;
documentsMain . fileName = response . title ;
documentsMain . UI . showEditor ( documentsMain . fileName || response . title ) ;
documentsMain . esId = response . es _id ;
documentsMain . memberId = response . member _id ;
documentsMain . loadDocument ( ) ;
if ( documentsMain . isGuest ) {
if ( documentsMain . isGuest ) {
$ ( '#odf-close' ) . text ( t ( 'documents' , 'Save' ) ) ;
$ ( '#odf-close' ) . text ( t ( 'documents' , 'Save' ) ) ;
$ ( '#odf-close' ) . removeClass ( 'icon-view-close' ) ;
$ ( '#odf-close' ) . removeClass ( 'icon-view-close' ) ;
}
}
//var serverFactory = new ServerFactory();
//var serverFactory = new ServerFactory();
documentsMain . esId = response . es _id ;
documentsMain . memberId = response . member _id ;
/ *
/ *
// TODO: set webodf translation system, by passing a proper function translate(!string):!string in "runtime.setTranslator(translate);"
// TODO: set webodf translation system, by passing a proper function translate(!string):!string in "runtime.setTranslator(translate);"
documentsMain . webodfServerInstance = serverFactory . createServer ( {
documentsMain . webodfServerInstance = serverFactory . createServer ( {
@ -518,6 +521,28 @@ var documentsMain = {
input . selectRange ( 0 , name . length ) ;
input . selectRange ( 0 , name . length ) ;
} ,
} ,
loadDocument : function ( ) {
var url = OC . generateUrl ( 'apps/documents/ajax/documents/load/{es_id}' , { es _id : documentsMain . esId } ) ;
$ . post (
url ,
{ } ,
function ( result ) {
if ( result && result . status === 'error' ) {
if ( result . message ) {
documentsMain . IU . notify ( result . message ) ;
}
documentsMain . onEditorShutdown ( t ( 'documents' , 'Failed to load this document. Please check if it can be opened with an external odt editor. This might also mean it has been unshared or deleted recently.' ) ) ;
return ;
}
documentsMain . url = 'file://' + result . filename ;
documentsMain . baseName = result . basename ;
documentsMain . UI . showEditor ( documentsMain . fileName ) ;
}
) ;
} ,
renameDocument : function ( name ) {
renameDocument : function ( name ) {
var url = OC . generateUrl ( 'apps/documents/ajax/documents/rename/{file_id}' , { file _id : documentsMain . fileId } ) ;
var url = OC . generateUrl ( 'apps/documents/ajax/documents/rename/{file_id}' , { file _id : documentsMain . fileId } ) ;
$ . post (
$ . post (