|
|
|
@ -96,59 +96,64 @@ var odfViewer = {
|
|
|
|
|
onClose: function() {
|
|
|
|
|
FileList.setViewerMode(false);
|
|
|
|
|
$('#loleafletframe').remove();
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
$(document).ready(function() {
|
|
|
|
|
if ( typeof OCA !== 'undefined'
|
|
|
|
|
&& typeof OCA.Files !== 'undefined'
|
|
|
|
|
&& typeof OCA.Files.fileActions !== 'undefined'
|
|
|
|
|
) {
|
|
|
|
|
$.get(
|
|
|
|
|
OC.filePath('richdocuments', 'ajax', 'mimes.php'),
|
|
|
|
|
{},
|
|
|
|
|
odfViewer.register
|
|
|
|
|
);
|
|
|
|
|
registerFilesMenu: function(response) {
|
|
|
|
|
var ooxml = response.doc_format === 'ooxml';
|
|
|
|
|
|
|
|
|
|
var docExt, spreadsheetExt, presentationExt;
|
|
|
|
|
var docMime, spreadsheetMime, presentationMime;
|
|
|
|
|
if (ooxml) {
|
|
|
|
|
docExt = 'docx';
|
|
|
|
|
spreadsheetExt = 'xlsx';
|
|
|
|
|
presentationExt = 'pptx';
|
|
|
|
|
docMime = 'application/vnd.openxmlformats-officedocument.wordprocessingml.document';
|
|
|
|
|
spreadsheetMime = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet';
|
|
|
|
|
presentationMime = 'application/vnd.openxmlformats-officedocument.presentationml.presentation';
|
|
|
|
|
} else {
|
|
|
|
|
docExt = 'odt';
|
|
|
|
|
spreadsheetExt = 'ods';
|
|
|
|
|
presentationExt = 'odp';
|
|
|
|
|
docMime = 'application/vnd.oasis.opendocument.text';
|
|
|
|
|
spreadsheetMime = 'application/vnd.oasis.opendocument.spreadsheet';
|
|
|
|
|
presentationMime = 'application/vnd.oasis.opendocument.presentation';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$('#odf_close').live('click', odfViewer.onClose);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
(function(OCA){
|
|
|
|
|
OCA.FilesLOMenu = {
|
|
|
|
|
attach: function(newFileMenu) {
|
|
|
|
|
var self = this;
|
|
|
|
|
|
|
|
|
|
newFileMenu.addMenuEntry({
|
|
|
|
|
id: 'add-odt',
|
|
|
|
|
id: 'add-' + docExt,
|
|
|
|
|
displayName: t('richdocuments', 'Document'),
|
|
|
|
|
templateName: 'New Document.odt',
|
|
|
|
|
templateName: 'New Document.' + docExt,
|
|
|
|
|
iconClass: 'icon-filetype-document',
|
|
|
|
|
fileType: 'x-office-document',
|
|
|
|
|
actionHandler: function(filename) {
|
|
|
|
|
self._createDocument('application/vnd.oasis.opendocument.text', filename);
|
|
|
|
|
self._createDocument(docMime, filename);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
newFileMenu.addMenuEntry({
|
|
|
|
|
id: 'add-ods',
|
|
|
|
|
id: 'add-' + spreadsheetExt,
|
|
|
|
|
displayName: t('richdocuments', 'Spreadsheet'),
|
|
|
|
|
templateName: 'New Spreadsheet.ods',
|
|
|
|
|
templateName: 'New Spreadsheet.' + spreadsheetExt,
|
|
|
|
|
iconClass: 'icon-filetype-spreadsheet',
|
|
|
|
|
fileType: 'x-office-spreadsheet',
|
|
|
|
|
actionHandler: function(filename) {
|
|
|
|
|
self._createDocument('application/vnd.oasis.opendocument.spreadsheet', filename);
|
|
|
|
|
self._createDocument(spreadsheetMime, filename);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
newFileMenu.addMenuEntry({
|
|
|
|
|
id: 'add-odp',
|
|
|
|
|
id: 'add-' + presentationExt,
|
|
|
|
|
displayName: t('richdocuments', 'Presentation'),
|
|
|
|
|
templateName: 'New Presentation.odp',
|
|
|
|
|
templateName: 'New Presentation.' + presentationExt,
|
|
|
|
|
iconClass: 'icon-filetype-presentation',
|
|
|
|
|
fileType: 'x-office-presentation',
|
|
|
|
|
actionHandler: function(filename) {
|
|
|
|
|
self._createDocument('application/vnd.oasis.opendocument.presentation', filename);
|
|
|
|
|
self._createDocument(presentationMime, filename);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
@ -173,3 +178,26 @@ $(document).ready(function() {
|
|
|
|
|
})(OCA);
|
|
|
|
|
|
|
|
|
|
OC.Plugins.register('OCA.Files.NewFileMenu', OCA.FilesLOMenu);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
$(document).ready(function() {
|
|
|
|
|
if ( typeof OCA !== 'undefined'
|
|
|
|
|
&& typeof OCA.Files !== 'undefined'
|
|
|
|
|
&& typeof OCA.Files.fileActions !== 'undefined'
|
|
|
|
|
) {
|
|
|
|
|
$.get(
|
|
|
|
|
OC.filePath('richdocuments', 'ajax', 'mimes.php'),
|
|
|
|
|
{},
|
|
|
|
|
odfViewer.register
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
$.get(
|
|
|
|
|
OC.filePath('richdocuments', 'ajax', 'settings.php'),
|
|
|
|
|
{},
|
|
|
|
|
odfViewer.registerFilesMenu
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$('#odf_close').live('click', odfViewer.onClose);
|
|
|
|
|
});
|
|
|
|
|