added pdf,visio,svg,wordperfect mimetypes

This commit is contained in:
Mihai Varga 2015-11-04 10:10:14 +02:00
parent 8d2a2e1f1f
commit 43bce2d00d

View File

@ -8,14 +8,19 @@ var odfViewer = {
'application/vnd.oasis.opendocument.text', 'application/vnd.oasis.opendocument.text',
'application/vnd.oasis.opendocument.spreadsheet', 'application/vnd.oasis.opendocument.spreadsheet',
'application/vnd.oasis.opendocument.graphics', 'application/vnd.oasis.opendocument.graphics',
'application/vnd.oasis.opendocument.presentation' 'application/vnd.oasis.opendocument.presentation',
'application/vnd.lotus-wordpro',
'image/svg+xml',
'application/pdf',
'application/vnd.visio',
'application/vnd.wordperfect',
], ],
register : function(response){ register : function(response){
var i, var i,
mimeRead, mimeRead,
mimeUpdate; mimeUpdate;
if (response && response.mimes){ if (response && response.mimes){
jQuery.each(response.mimes, function(i, mime){ jQuery.each(response.mimes, function(i, mime){
odfViewer.supportedMimesRead.push(mime); odfViewer.supportedMimesRead.push(mime);
@ -30,17 +35,17 @@ var odfViewer = {
for (i = 0; i < odfViewer.supportedMimesUpdate.length; ++i) { for (i = 0; i < odfViewer.supportedMimesUpdate.length; ++i) {
mimeUpdate = odfViewer.supportedMimesUpdate[i]; mimeUpdate = odfViewer.supportedMimesUpdate[i];
OCA.Files.fileActions.register( OCA.Files.fileActions.register(
mimeUpdate, mimeUpdate,
'Edit', 'Edit',
OC.PERMISSION_UPDATE, OC.PERMISSION_UPDATE,
OC.imagePath('core', 'actions/rename'), OC.imagePath('core', 'actions/rename'),
odfViewer.onEdit, odfViewer.onEdit,
t('documents', 'Edit') t('documents', 'Edit')
); );
OCA.Files.fileActions.setDefault(mimeUpdate, 'Edit'); OCA.Files.fileActions.setDefault(mimeUpdate, 'Edit');
} }
}, },
dispatch : function(filename){ dispatch : function(filename){
if (odfViewer.supportedMimesUpdate.indexOf(OCA.Files.fileActions.getCurrentMimeType()) !== -1 if (odfViewer.supportedMimesUpdate.indexOf(OCA.Files.fileActions.getCurrentMimeType()) !== -1
&& OCA.Files.fileActions.getCurrentPermissions() & OC.PERMISSION_UPDATE && OCA.Files.fileActions.getCurrentPermissions() & OC.PERMISSION_UPDATE
@ -50,12 +55,12 @@ var odfViewer = {
odfViewer.onView(filename); odfViewer.onView(filename);
} }
}, },
onEdit : function(fileName, context){ onEdit : function(fileName, context){
var fileId = context.$file.attr('data-id'); var fileId = context.$file.attr('data-id');
window.location = OC.generateUrl('apps/documents/index#{file_id}', {file_id: fileId}); window.location = OC.generateUrl('apps/documents/index#{file_id}', {file_id: fileId});
}, },
onView: function(filename, context) { onView: function(filename, context) {
var attachTo = odfViewer.isDocuments ? '#documents-content' : '#controls'; var attachTo = odfViewer.isDocuments ? '#documents-content' : '#controls';
@ -81,7 +86,7 @@ var odfViewer = {
}); });
*/ */
}, },
onClose: function() { onClose: function() {
FileList.setViewerMode(false); FileList.setViewerMode(false);
$('#loleafletframe').remove(); $('#loleafletframe').remove();
@ -89,7 +94,7 @@ var odfViewer = {
}; };
$(document).ready(function() { $(document).ready(function() {
if ( typeof OCA !== 'undefined' if ( typeof OCA !== 'undefined'
&& typeof OCA.Files !== 'undefined' && typeof OCA.Files !== 'undefined'
&& typeof OCA.Files.fileActions !== 'undefined' && typeof OCA.Files.fileActions !== 'undefined'
) { ) {