mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-06-28 13:51:44 +02:00
implemented link attributes for image-widget and added them to xulio, some docu for describtion
This commit is contained in:
parent
e7af7de431
commit
ea03c4032b
@ -91,7 +91,12 @@ class xul_io
|
|||||||
),
|
),
|
||||||
'image' => array(
|
'image' => array(
|
||||||
'.name' => 'image',
|
'.name' => 'image',
|
||||||
'name' => 'src'
|
'name' => 'src',
|
||||||
|
'size' => 'href,extra_link_target,imagemap,extra_link_popup,id',
|
||||||
|
),
|
||||||
|
'progres' => array(
|
||||||
|
'.name' => 'progress',
|
||||||
|
'size' => 'href,extra_link_target,,extra_link_popup',
|
||||||
),
|
),
|
||||||
'tab' => array(
|
'tab' => array(
|
||||||
'.name' => 'tabbox,tabs,tabpanels'
|
'.name' => 'tabbox,tabs,tabpanels'
|
||||||
|
@ -65,7 +65,7 @@ var et2_description = et2_baseWidget.extend([et2_IDetachedDOM], {
|
|||||||
"extra_link_popup": {
|
"extra_link_popup": {
|
||||||
"name": "Popup",
|
"name": "Popup",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"description": "???"
|
"description": "widthxheight, if popup should be used, eg. 640x480"
|
||||||
},
|
},
|
||||||
"extra_link_title": {
|
"extra_link_title": {
|
||||||
"name": "Link Title",
|
"name": "Link Title",
|
||||||
|
@ -29,27 +29,41 @@ var et2_image = et2_baseWidget.extend(et2_IDetachedDOM, {
|
|||||||
"type": "string",
|
"type": "string",
|
||||||
"description": "Displayed image"
|
"description": "Displayed image"
|
||||||
},
|
},
|
||||||
"link": {
|
"href": {
|
||||||
|
"name": "Link Target",
|
||||||
|
"type": "string",
|
||||||
|
"description": "Link URL, empty if you don't wan't to display a link."
|
||||||
},
|
},
|
||||||
"link_target":{
|
"extra_link_target": {
|
||||||
|
"name": "Link target",
|
||||||
|
"type": "string",
|
||||||
|
"default": "_self",
|
||||||
|
"description": "Link target descriptor"
|
||||||
|
},
|
||||||
|
"extra_link_popup": {
|
||||||
|
"name": "Popup",
|
||||||
|
"type": "string",
|
||||||
|
"description": "widthxheight, if popup should be used, eg. 640x480"
|
||||||
},
|
},
|
||||||
"imagemap":{
|
"imagemap":{
|
||||||
},
|
},
|
||||||
"link_size":{
|
"label": {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
legacyOptions: ["href", "link_target", "imagemap", "extra_link_popup", "id"],
|
||||||
legacyOptions: ["link", "link_target", "imagemap", "link_size"],
|
|
||||||
|
|
||||||
init: function() {
|
init: function() {
|
||||||
this._super.apply(this, arguments);
|
this._super.apply(this, arguments);
|
||||||
|
|
||||||
// Create the image or a/image tag
|
// Create the image or a/image tag
|
||||||
var node = this.image = $j(document.createElement("img"));
|
var node = this.image = $j(document.createElement("img"));
|
||||||
if(this.options.link)
|
if (this.options.label)
|
||||||
{
|
{
|
||||||
this._node = $j(document.createElement("a"));
|
this.image.attr("alt", this.options.label).attr("title", this.options.label);
|
||||||
this.image.appendTo(node);
|
}
|
||||||
|
if (this.options.href)
|
||||||
|
{
|
||||||
|
this.image.addClass('et2_clickable');
|
||||||
}
|
}
|
||||||
if(this.options["class"])
|
if(this.options["class"])
|
||||||
{
|
{
|
||||||
@ -57,6 +71,14 @@ var et2_image = et2_baseWidget.extend(et2_IDetachedDOM, {
|
|||||||
}
|
}
|
||||||
this.setDOMNode(node[0]);
|
this.setDOMNode(node[0]);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
click: function()
|
||||||
|
{
|
||||||
|
if(this.options.href)
|
||||||
|
{
|
||||||
|
egw.call_link(this.options.href, this.options.extra_link_target, this.options.extra_link_popup);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
transformAttributes: function(_attrs) {
|
transformAttributes: function(_attrs) {
|
||||||
this._super.apply(arguments);
|
this._super.apply(arguments);
|
||||||
@ -76,8 +98,7 @@ var et2_image = et2_baseWidget.extend(et2_IDetachedDOM, {
|
|||||||
if(_value == this.options.label) return;
|
if(_value == this.options.label) return;
|
||||||
this.options.label = _value;
|
this.options.label = _value;
|
||||||
// label is NOT the alt attribute in eTemplate, but the title/tooltip
|
// label is NOT the alt attribute in eTemplate, but the title/tooltip
|
||||||
this.image.attr("alt", _value);
|
this.image.attr("alt", _value).attr("title", _value);
|
||||||
this.set_statustext(_value);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
setValue: function(_value) {
|
setValue: function(_value) {
|
||||||
@ -85,8 +106,6 @@ var et2_image = et2_baseWidget.extend(et2_IDetachedDOM, {
|
|||||||
this.set_src(_value);
|
this.set_src(_value);
|
||||||
},
|
},
|
||||||
|
|
||||||
percentagePreg: /^[0-9]+%$/,
|
|
||||||
|
|
||||||
set_src: function(_value) {
|
set_src: function(_value) {
|
||||||
if(!this.isInTree())
|
if(!this.isInTree())
|
||||||
{
|
{
|
||||||
@ -101,6 +120,11 @@ var et2_image = et2_baseWidget.extend(et2_IDetachedDOM, {
|
|||||||
{
|
{
|
||||||
this.image.attr("src", src).show();
|
this.image.attr("src", src).show();
|
||||||
}
|
}
|
||||||
|
// allow url's too
|
||||||
|
else if (_value[0] == '/' || _value.substr(0,4) == 'http')
|
||||||
|
{
|
||||||
|
this.image.attr('src', _value).show();
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this.image.css("display","none");
|
this.image.css("display","none");
|
||||||
|
@ -31,5 +31,8 @@
|
|||||||
<option value="5">Test 5</option>
|
<option value="5">Test 5</option>
|
||||||
<option value="6" statustext="This is the sixth option">Test 6</option>
|
<option value="6" statustext="This is the sixth option">Test 6</option>
|
||||||
</listbox>
|
</listbox>
|
||||||
|
<progress label="Completition" id="progress" value="50%" />
|
||||||
|
<image label="Image" src="/egroupware/phpgwapi/templates/default/images/logo.png" href="http://www.egroupware.org/" extra_link_target="_blank" />
|
||||||
|
<description value="www.egroupware.org" href="http://www.egroupware.org/" extra_link_target="_blank" />
|
||||||
</vbox>
|
</vbox>
|
||||||
</overlay>
|
</overlay>
|
||||||
|
@ -454,4 +454,6 @@ label input, label span, label div, label select, label textarea {
|
|||||||
background-image: url(gfx/down.png);
|
background-image: url(gfx/down.png);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.et2_clickable {
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
@ -500,6 +500,46 @@ else
|
|||||||
{
|
{
|
||||||
return typeof _name == 'undefined' || typeof this.userData.apps[_app] == 'undefined' ?
|
return typeof _name == 'undefined' || typeof this.userData.apps[_app] == 'undefined' ?
|
||||||
this.userData.apps[_app] : this.userData.apps[_app][_name];
|
this.userData.apps[_app] : this.userData.apps[_app][_name];
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Call a link, which can be either a menuaction, a EGroupware relative url or a full url
|
||||||
|
*
|
||||||
|
* @param string _link menuaction, EGroupware relative url or a full url (incl. "mailto:" or "javascript:")
|
||||||
|
* @param string _target optional target
|
||||||
|
* @param string _popup widthxheight, if a popup should be used
|
||||||
|
*/
|
||||||
|
call_link: function(_link, _target, _popup)
|
||||||
|
{
|
||||||
|
var url = _link;
|
||||||
|
if (url.indexOf('javascript:') == 0)
|
||||||
|
{
|
||||||
|
eval(url.substr(11));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// link is not necessary an url, it can also be a menuaction!
|
||||||
|
if (url.indexOf('/') == -1 &&
|
||||||
|
url.split('.').length >= 3 &&
|
||||||
|
url.indexOf('mailto:') == -1 ||
|
||||||
|
url.indexOf('://') == -1)
|
||||||
|
{
|
||||||
|
url = "/index.php?menuaction="+url;
|
||||||
|
}
|
||||||
|
if (url[0] == '/') // link relative to eGW
|
||||||
|
{
|
||||||
|
url = egw.webserverUrl + url;
|
||||||
|
}
|
||||||
|
if (_popup)
|
||||||
|
{
|
||||||
|
var w_h = _popup.split('x');
|
||||||
|
if (w_h[1] == 'egw_getWindowOuterHeight()') w_h[1] = egw_getWindowOuterHeight();
|
||||||
|
egw_openWindowCentered2(url, _target, w_h[0], w_h[1]);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
window.open(url, _target);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user