Do not bind click handler on media mime type to be opened in expose view if there is no download_url(e.g. attachments of mail integration have no download_url befre they get saved)

This commit is contained in:
Hadi Nategh 2015-04-21 12:20:53 +00:00
parent 49dbf5a7f8
commit acd5971c96
2 changed files with 10 additions and 5 deletions

View File

@ -1745,10 +1745,15 @@ var et2_link_list = et2_link_string.extend(
var self = this;
for(var i = 0; i < columns.length; i++) {
$j(document.createElement("td"))
var $td = $j(document.createElement("td"))
.appendTo(row)
.addClass(columns[i])
.click( function(){
.text(_link_data[columns[i]] ? _link_data[columns[i]]+"" : "");
//Bind the click handler if there is download_url
if (_link_data && typeof _link_data.download_url != 'undefined')
{
$td.click( function(){
// Check if the link entry is mime with media type, in order to open it in expose view
if (typeof _link_data.type != 'undefined' && _link_data.type.match(self.mime_regexp,'ig'))
{
@ -1759,8 +1764,8 @@ var et2_link_list = et2_link_string.extend(
{
self.egw().open(_link_data, "", "view",null,_link_data.target ? _link_data.target : _link_data.app,_link_data.app);
}
})
.text(_link_data[columns[i]] ? _link_data[columns[i]]+"" : "");
});
}
}
if (typeof _link_data.title == 'undefined')

View File

@ -387,7 +387,7 @@ function expose (widget)
var self=this;
// If the media type is not supported do not bind the click handler
if (!_value || typeof _value.mime != 'string' || !_value.mime.match(mime_regex,'ig'))
if (!_value || typeof _value.mime != 'string' || !_value.mime.match(mime_regex,'ig') || typeof _value.download_url == 'undefined')
{
return;
}