add href implementation analog to image

This commit is contained in:
Ralf Becker 2014-02-03 09:54:45 +00:00
parent ec013651a3
commit 269398be1d

View File

@ -104,7 +104,7 @@ var et2_progress = et2_valueWidget.extend([et2_IDetachedDOM],
// set's class of this.node; preserve baseclasses et2_progress and if this.options.href is set et2_clickable
set_class: function(_value)
{
var baseClass = "et2_progress"
var baseClass = "et2_progress";
if (this.options.href)
{
baseClass += ' et2_clickable';
@ -112,12 +112,36 @@ var et2_progress = et2_valueWidget.extend([et2_IDetachedDOM],
this.node.setAttribute('class', baseClass + ' ' + _value);
},
set_href: function (_value)
{
if (!this.isInTree())
{
return false;
}
this.options.href = _value;
jQuery(this.node).wrapAll('<a href="'+_value+'"></a>"');
var href = this.options.href;
var popup = this.options.extra_link_popup;
var target = this.options.extra_link_target;
jQuery(this.node).parent().click(function(e)
{
egw.open_link(href,target,popup);
e.preventDefault();
return false;
});
return true;
},
/**
* Implementation of "et2_IDetachedDOM" for fast viewing in gridview
*
* * @param {array} _attrs array to add further attributes to
*/
getDetachedAttributes: function(_attrs) {
_attrs.push("value", "label", "onclick");
_attrs.push("value", "label", "href");
},
getDetachedNodes: function() {
@ -142,6 +166,11 @@ var et2_progress = et2_valueWidget.extend([et2_IDetachedDOM],
{
this.set_value(_values["label"]);
}
if(_values["href"])
{
jQuery(this.node).addClass('et2_clickable');
this.set_href(_values["href"]);
}
}
});
et2_register_widget(et2_progress, ["progress"]);