From 9b9313026f5e159ef634cda2b695c1dbf9220e72 Mon Sep 17 00:00:00 2001 From: Hadi Nategh Date: Tue, 21 Apr 2015 12:20:12 +0000 Subject: [PATCH] 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) --- etemplate/js/et2_widget_link.js | 13 +++++++++---- etemplate/js/expose.js | 2 +- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/etemplate/js/et2_widget_link.js b/etemplate/js/et2_widget_link.js index b2107f6ebf..37b5745da1 100644 --- a/etemplate/js/et2_widget_link.js +++ b/etemplate/js/et2_widget_link.js @@ -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') diff --git a/etemplate/js/expose.js b/etemplate/js/expose.js index 5c94f4bbc4..a46cd53066 100644 --- a/etemplate/js/expose.js +++ b/etemplate/js/expose.js @@ -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; }