cloudsuite: prepare to rework view.js
This commit is contained in:
parent
da92304323
commit
3809e2ee43
@ -56,49 +56,7 @@ var odfViewer = {
|
||||
window.location = OC.linkTo('documents', 'index.php') + '#' + fileId;
|
||||
},
|
||||
|
||||
onView: function(filename) {
|
||||
var fileloc,
|
||||
attachTo = odfViewer.isDocuments ? '#documents-content' : '#controls',
|
||||
attachToolbarTo = odfViewer.isDocuments ? '#content-wrapper' : '#controls';
|
||||
|
||||
if (odfViewer.isDocuments){
|
||||
//Documents view
|
||||
fileloc = filename;
|
||||
} else {
|
||||
//Public page, files app, etc
|
||||
var dirName = $('#dir').val()!='/' ? $('#dir').val() + '/' : '/';
|
||||
fileloc = OC.filePath('documents', 'ajax', 'download.php') + '?path='
|
||||
+ encodeURIComponent(dirName) + encodeURIComponent(filename)
|
||||
+ '&requesttoken=' + encodeURIComponent(oc_requesttoken);
|
||||
OC.addStyle('documents', '3rdparty/webodf/wodotexteditor');
|
||||
}
|
||||
|
||||
OC.addStyle('documents', 'viewer/odfviewer');
|
||||
|
||||
OC.addScript('documents', '3rdparty/webodf/webodf-debug', function() {
|
||||
FileList.setViewerMode(true);
|
||||
|
||||
// odf action toolbar
|
||||
var odfToolbarHtml =
|
||||
'<div id="odf-toolbar">' +
|
||||
'<button id="odf_close">' + t('documents', 'Close') +
|
||||
'</button></div>';
|
||||
if (odfViewer.isDocuments){
|
||||
$(attachToolbarTo).prepend(odfToolbarHtml);
|
||||
$('#odf-toolbar').css({position:'fixed'});
|
||||
} else {
|
||||
$(attachToolbarTo).append(odfToolbarHtml);
|
||||
}
|
||||
|
||||
var canvashtml = '<div id="odf-canvas"></div>';
|
||||
$(attachTo).after(canvashtml);
|
||||
// in case we are on the public sharing page we shall display the odf into the preview tag
|
||||
$('#preview').html(canvashtml);
|
||||
|
||||
var odfelement = document.getElementById("odf-canvas");
|
||||
var odfcanvas = new odf.OdfCanvas(odfelement);
|
||||
odfcanvas.load(fileloc);
|
||||
});
|
||||
onView: function(filename, context) {
|
||||
},
|
||||
|
||||
onClose: function() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user