forked from extern/egroupware
add href implementation analog to image
This commit is contained in:
parent
ec013651a3
commit
269398be1d
@ -19,10 +19,10 @@
|
||||
|
||||
/**
|
||||
* Class which implements the "progress" XET-Tag
|
||||
*
|
||||
*
|
||||
* @augments et2_valueWidget
|
||||
*/
|
||||
var et2_progress = et2_valueWidget.extend([et2_IDetachedDOM],
|
||||
*/
|
||||
var et2_progress = et2_valueWidget.extend([et2_IDetachedDOM],
|
||||
{
|
||||
attributes: {
|
||||
"href": {
|
||||
@ -53,10 +53,10 @@ var et2_progress = et2_valueWidget.extend([et2_IDetachedDOM],
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
*
|
||||
* @memberOf et2_progress
|
||||
*/
|
||||
init: function()
|
||||
init: function()
|
||||
{
|
||||
this._super.apply(this, arguments);
|
||||
|
||||
@ -66,7 +66,7 @@ var et2_progress = et2_valueWidget.extend([et2_IDetachedDOM],
|
||||
this.progress.style.width = "0";
|
||||
outer.appendChild(this.progress);
|
||||
|
||||
if (this.options.href)
|
||||
if (this.options.href)
|
||||
{
|
||||
outer.className += ' et2_clickable';
|
||||
}
|
||||
@ -76,7 +76,7 @@ var et2_progress = et2_valueWidget.extend([et2_IDetachedDOM],
|
||||
}
|
||||
this.setDOMNode(outer); // set's this.node = outer
|
||||
},
|
||||
|
||||
|
||||
click: function()
|
||||
{
|
||||
this._super.apply(this, arguments);
|
||||
@ -88,36 +88,60 @@ var et2_progress = et2_valueWidget.extend([et2_IDetachedDOM],
|
||||
},
|
||||
|
||||
// setting the value as width of the progress-bar
|
||||
set_value: function(_value)
|
||||
set_value: function(_value)
|
||||
{
|
||||
_value = parseInt(_value)+"%"; // make sure we have percent attached
|
||||
this.progress.style.width = _value;
|
||||
if (!this.options.label) this.set_label(_value);
|
||||
},
|
||||
|
||||
|
||||
// set's label as title of this.node
|
||||
set_label: function(_value)
|
||||
set_label: function(_value)
|
||||
{
|
||||
this.node.title = _value;
|
||||
},
|
||||
|
||||
// set's class of this.node; preserve baseclasses et2_progress and if this.options.href is set et2_clickable
|
||||
set_class: function(_value)
|
||||
set_class: function(_value)
|
||||
{
|
||||
var baseClass = "et2_progress"
|
||||
if (this.options.href)
|
||||
var baseClass = "et2_progress";
|
||||
if (this.options.href)
|
||||
{
|
||||
baseClass += ' et2_clickable';
|
||||
}
|
||||
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"]);
|
||||
|
Loading…
Reference in New Issue
Block a user