# R49691 - /trunk/etemplate/js/et2\_widget\_link.js

**URL:** <http://discourse.egroupware.org/t/r49691-trunk-etemplate-js-et2-widget-link-js/63046>\
**Category:** eGW-svn\
**Created:** [December 3, 2014, 10:14pm UTC](http://discourse.egroupware.org/t/r49691-trunk-etemplate-js-et2-widget-link-js/63046 "2014-12-03T22:14:03Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![nathangray](http://discourse.egroupware.org/letter_avatar_proxy/v4/letter/n/77aa72/32.png) [@nathangray](http://discourse.egroupware.org/u/nathangray)\
**Post date:** [December 3, 2014, 10:14pm UTC](http://discourse.egroupware.org/t/r49691-trunk-etemplate-js-et2-widget-link-js/63046/1 "2014-12-03T22:14:03Z")

</div>

Author: nathangray  
New Revision: 49691

URL: [http://svn.stylite.de/viewvc/egroupware?rev=49691&view=rev](http://svn.stylite.de/viewvc/egroupware?rev=49691&view=rev)  
Log:  
Avoid invalid characters in DOM IDs.  
Fixes missing comments, occasional errors in link comments.

Modified:  
trunk/etemplate/js/et2\_widget\_link.js

# Modified: trunk/etemplate/js/et2\_widget\_link.js URL: [http://svn.stylite.de/viewvc/egroupware/trunk/etemplate/js/et2\_widget\_link.js?rev=49691&r1=49690&r2=49691&view=diff](http://svn.stylite.de/viewvc/egroupware/trunk/etemplate/js/et2_widget_link.js?rev=49691&r1=49690&r2=49691&view=diff)

— trunk/etemplate/js/et2\_widget\_link.js (original)  
+++ trunk/etemplate/js/et2\_widget\_link.js Wed Dec 3 23:14:03 2014  
@@ -1457,13 +1457,13 @@  
var self = this;  
this.context = new egwMenu();  
this.context.addItem(“comment”, this.egw().lang(“Comment”), “”, function() {

- 

```
  	var link_id = self.context.data.link_id;

```

- 

```
  	var link_id = typeof self.context.data.link_id == 'number' ? self.context.data.link_id : self.context.data.link_id.replace(/[:\.]/g,'_');

  	et2_dialog.show_prompt(
  		function(button, comment) {
  			if(button != et2_dialog.OK_BUTTON) return;
  			var remark = jQuery('#link_'+(self.context.data.dom_id ? self.context.data.dom_id : link_id), self.list).children('.remark');

```

- 

```
  			if(isNaN(self.context.data.id))

```

- 

```
  			if(isNaN(self.context.data.id) || isNaN(self.context.data.link_id == 'undefined'))
  			{
  				remark.text(comment);
  				// Look for a link-to with the same ID, refresh it

```

@@ -1481,7 +1481,7 @@  
var value = \_widget != null ? \_widget.getValue() : false;  
if(\_widget && value && value.to\_id)  
{

- 

```
  						value.to_id[link_id].remark = comment;

```

- 

```
  						value.to_id[self.context.data.link_id].remark = comment;
  					}
  				}
  				return;

```

@@ -1523,6 +1523,16 @@  
}  
});  
this.context.addItem("-", “-”);

- 

```
  this.context.addItem("save", this.egw().lang("Save as"), this.egw().image('save'), function(menu_item) {

```

- 

```
  	var link_data = self.context.data;

```

- 

```
  	// Download file

```

- 

```
  	if(link_data.download_url)

```

- 

```
  	{

```

- 

```
  		window.location = self.egw().link(link_data.download_url,"download");

```

- 

```
  		return;

```

- 

```
  	}

```

- 

```
  	self.egw().open(link_data, "", "view",'download',link_data.target ? link_data.target : link_data.app,link_data.app);

```

- 

```
  });
  this.context.addItem("zip", this.egw().lang("Save as Zip"), this.egw().image('save_zip'), function(menu_item) {
  	// Highlight files for nice UI indicating what will be in the zip.
  	// Files have negative IDs.

```

@@ -1618,7 +1628,7 @@

```
_add_link: function(_link_data) {
	var row = $j(document.createElement("tr"))

```

- 

```
  	.attr("id", "link_"+(_link_data.dom_id ? _link_data.dom_id : _link_data.link_id))

```

- 

```
  	.attr("id", "link_"+(_link_data.dom_id ? _link_data.dom_id : (typeof _link_data.link_id == "number" ? _link_data.link_id : _link_data.link_id.replace(/[:\.]/g,'_'))))
  	.attr("draggable", _link_data.app == 'file' ? "true" : "")
  	.appendTo(this.list);
  if(!_link_data.link_id)

```

@@ -1709,6 +1719,7 @@  
self.context.getItem(“comment”).set\_enabled(typeof \_link\_data.link\_id != ‘undefined’);  
// File info only available for existing files  
self.context.getItem(“file\_info”).set\_enabled(typeof \_link\_data.id != ‘object’ && \_link\_data.app == ‘file’);

- 

```
  	self.context.getItem("save").set_enabled(typeof _link_data.id != 'object' && _link_data.app == 'file');
  	// Zip download only offered if there are at least 2 files
  	self.context.getItem("zip").set_enabled($j('[id^="link_-"]',this.list).length >= 2);

```

* * *

Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server  
from Actuate! Instantly Supercharge Your Business Reports and Dashboards  
with Interactivity, Sharing, Native Excel Exports, App Integration & more  
Get technology previously reserved for billion-dollar corporations, FREE  
[http://pubads.g.doubleclick.net/gampad/clk?id=164703151&iu=/4140/ostg.clktrk](http://pubads.g.doubleclick.net/gampad/clk?id=164703151&iu=/4140/ostg.clktrk)

* * *

eGroupWare-cvs mailing list  
[eGroupWare-cvs@lists.sourceforge.net](mailto:eGroupWare-cvs@lists.sourceforge.net)  
[https://lists.sourceforge.net/lists/listinfo/egroupware-cvs](https://lists.sourceforge.net/lists/listinfo/egroupware-cvs)
