[FIX] pass file extension where newer viewerjs versions expect it

fixes #67
This commit is contained in:
Holger Brunn 2015-11-17 21:08:20 +01:00
parent e414291af6
commit 5b02ff9aa8
2 changed files with 7 additions and 2 deletions

View File

@ -27,10 +27,11 @@ openerp.attachment_preview = function(instance)
attachment_title)
{
var url = (window.location.origin || '') +
'/attachment_preview/static/lib/ViewerJS/index.html#' +
'/attachment_preview/static/lib/ViewerJS/index.html' +
'&type=' + encodeURIComponent(attachment_extension) +
'#' +
attachment_url.replace(window.location.origin, '') +
'&title=' + encodeURIComponent(attachment_title) +
'&ext=.' + encodeURIComponent(attachment_extension);
window.open(url);
};
openerp.attachment_preview.can_preview = function(extension)

View File

@ -24,6 +24,10 @@
var original_Viewer = Viewer;
Viewer = function(plugin, parameters)
{
if(!plugin)
{
alert('Unsupported file type');
}
var matches = (/&title=([^&]+)&/).exec(window.location.hash);
if(matches && matches.length > 1)
{