mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-22 07:53:39 +01:00
fixed set_(ro_)image to set the according option and update current image, new method set_readonly updating readonly attribute and current image
This commit is contained in:
parent
027bcc53d1
commit
34dd94dc76
@ -91,16 +91,35 @@ var et2_button = et2_baseWidget.extend([et2_IInput, et2_IDetachedDOM], {
|
||||
set_accesskey: function(key) {
|
||||
jQuery(this.node).attr("accesskey", key);
|
||||
},
|
||||
set_ro_image: function(_image) {
|
||||
if(this.options.readonly)
|
||||
{
|
||||
this.set_image(_image);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Set image and update current image
|
||||
*
|
||||
* @param _image
|
||||
*/
|
||||
set_image: function(_image) {
|
||||
this.options.image = _image;
|
||||
this.update_image();
|
||||
},
|
||||
/**
|
||||
* Set readonly image and update current image
|
||||
*
|
||||
* @param _image
|
||||
*/
|
||||
set_ro_image: function(_image) {
|
||||
this.options.ro_image = _image;
|
||||
this.update_image();
|
||||
},
|
||||
/**
|
||||
* Set current image (dont update options.image)
|
||||
*
|
||||
* @param _image
|
||||
*/
|
||||
update_image: function(_image) {
|
||||
if(!this.isInTree() || this.image == null) return;
|
||||
|
||||
if (typeof _image == 'undefined')
|
||||
_image = this.options.readonly ? this.options.ro_image : this.options.image;
|
||||
|
||||
// Silently blank for percentages instead of warning about missing image - use a progress widget
|
||||
if(_image.match(/[0-9]+\%/))
|
||||
{
|
||||
@ -108,10 +127,8 @@ var et2_button = et2_baseWidget.extend([et2_IInput, et2_IDetachedDOM], {
|
||||
//this.egw().debug("warn", "Use a progress widget instead of percentage images", this);
|
||||
}
|
||||
|
||||
this.options.image = _image;
|
||||
|
||||
var found_image = false;
|
||||
if(this.options.image != "")
|
||||
if(_image != "")
|
||||
{
|
||||
var src = this.egw().image(_image);
|
||||
if(src)
|
||||
@ -132,6 +149,24 @@ var et2_button = et2_baseWidget.extend([et2_IInput, et2_IDetachedDOM], {
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Set options.readonly and update image
|
||||
*
|
||||
* @param boolean _ro
|
||||
*/
|
||||
set_readonly: function(_ro)
|
||||
{
|
||||
if (_ro != this.options.readonly)
|
||||
{
|
||||
this.options.readonly = _ro;
|
||||
|
||||
if (this.image)
|
||||
{
|
||||
this.update_image();
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
getDOMNode: function() {
|
||||
return this.btn ? this.btn[0] : (this.image ? this.image[0] : null);
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user