forked from extern/egroupware
Expose link widget WIP:
- Implement expose view for link-string widget - Adapt link-string widget, and other widgets which are using expose to download_href link
This commit is contained in:
parent
bfad873952
commit
5c944330c5
@ -218,6 +218,7 @@ var et2_description = expose(et2_baseWidget.extend([et2_IDetachedDOM],
|
|||||||
type: this.options.type + "/*",
|
type: this.options.type + "/*",
|
||||||
thumbnail: base_url + _value
|
thumbnail: base_url + _value
|
||||||
}];
|
}];
|
||||||
|
if (_value.match(/\/webdav.php/,'ig')) mediaContent[0]["download_href"] = base_url + _value + '?download';
|
||||||
}
|
}
|
||||||
return mediaContent;
|
return mediaContent;
|
||||||
},
|
},
|
||||||
|
@ -1237,7 +1237,7 @@ et2_register_widget(et2_link, ["link", "link-entry_ro"]);
|
|||||||
*
|
*
|
||||||
* @augments et2_valueWidget
|
* @augments et2_valueWidget
|
||||||
*/
|
*/
|
||||||
var et2_link_string = et2_valueWidget.extend([et2_IDetachedDOM],
|
var et2_link_string = expose(et2_valueWidget.extend([et2_IDetachedDOM],
|
||||||
{
|
{
|
||||||
attributes: {
|
attributes: {
|
||||||
"application": {
|
"application": {
|
||||||
@ -1261,7 +1261,13 @@ var et2_link_string = et2_valueWidget.extend([et2_IDetachedDOM],
|
|||||||
"type": "string",
|
"type": "string",
|
||||||
"default":"",
|
"default":"",
|
||||||
"description": "Sub-type key to list only entries of that type"
|
"description": "Sub-type key to list only entries of that type"
|
||||||
}
|
},
|
||||||
|
"expose_view":{
|
||||||
|
name: "Expose view",
|
||||||
|
type: "boolean",
|
||||||
|
default: true,
|
||||||
|
description: "Clicking on description with href value would popup an expose view, and will show content referenced by href."
|
||||||
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1339,14 +1345,52 @@ var et2_link_string = et2_valueWidget.extend([et2_IDetachedDOM],
|
|||||||
this.egw().jsonq(this.egw().getAppName()+'.etemplate_widget_link.ajax_link_list', [_value], this.set_value, this);
|
this.egw().jsonq(this.egw().getAppName()+'.etemplate_widget_link.ajax_link_list', [_value], this.set_value, this);
|
||||||
return;
|
return;
|
||||||
},
|
},
|
||||||
|
/**
|
||||||
|
* Function to get media content to feed the expose
|
||||||
|
* @param {type} _value
|
||||||
|
* @returns {Array|Array.getMedia.mediaContent}
|
||||||
|
*/
|
||||||
|
getMedia: function (_value)
|
||||||
|
{
|
||||||
|
var base_url = egw.webserverUrl.match(/^\//,'ig')?egw(window).window.location.origin + egw.webserverUrl : egw.webserverUrl;
|
||||||
|
var mediaContent = [];
|
||||||
|
if (_value && typeof _value.type !='undefined' && _value.type.match(/video\/|audio\//,'ig'))
|
||||||
|
{
|
||||||
|
mediaContent = [{
|
||||||
|
title: _value.id,
|
||||||
|
type: _value.type,
|
||||||
|
poster:'', // TODO: Should be changed by correct video thumbnail later
|
||||||
|
href: base_url + egw().mime_open(_value),
|
||||||
|
download_href: base_url + egw().mime_open(_value) + '?download',
|
||||||
|
}];
|
||||||
|
}
|
||||||
|
else if(_value)
|
||||||
|
{
|
||||||
|
mediaContent = [{
|
||||||
|
title: _value.id,
|
||||||
|
href: base_url + egw().mime_open(_value).url,
|
||||||
|
download_href: base_url + egw().mime_open(_value).url + '?download',
|
||||||
|
type: _value.type,
|
||||||
|
}];
|
||||||
|
}
|
||||||
|
if (mediaContent[0].href && mediaContent[0].href.match(/\/webdav.php/,'ig')) mediaContent[0]["download_href"] = mediaContent[0].href + '?download';
|
||||||
|
return mediaContent;
|
||||||
|
},
|
||||||
_add_link: function(_link_data) {
|
_add_link: function(_link_data) {
|
||||||
var self = this;
|
var self = this;
|
||||||
var link = $j(document.createElement("li"))
|
var link = $j(document.createElement("li"))
|
||||||
.appendTo(this.list)
|
.appendTo(this.list)
|
||||||
.addClass("et2_link loading")
|
.addClass("et2_link loading")
|
||||||
.click( function(e){
|
.click( function(e){
|
||||||
self.egw().open(_link_data, "", "view",null,_link_data.app,_link_data.app);
|
if (self.options.expose_view && typeof _link_data.type !='undefined'
|
||||||
|
&& _link_data.type.match(self.mime_regexp,'ig'))
|
||||||
|
{
|
||||||
|
self._init_blueimp_gallery(e, _link_data);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
self.egw().open(_link_data, "", "view",null,_link_data.app,_link_data.app);
|
||||||
|
}
|
||||||
e.stopImmediatePropagation();
|
e.stopImmediatePropagation();
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -1423,7 +1467,7 @@ var et2_link_string = et2_valueWidget.extend([et2_IDetachedDOM],
|
|||||||
this._labelContainer.contents().not(this.list).remove();
|
this._labelContainer.contents().not(this.list).remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
}));
|
||||||
et2_register_widget(et2_link_string, ["link-string"]);
|
et2_register_widget(et2_link_string, ["link-string"]);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -346,6 +346,7 @@ var et2_vfsMime = expose(et2_valueWidget.extend([et2_IDetachedDOM],
|
|||||||
thumbnail: _value.path && _value.mime ? this.egw().mime_icon(_value.mime, _value.path, undefined, _value.mtime) : this.image.attr('src')+ '&thheight=128'
|
thumbnail: _value.path && _value.mime ? this.egw().mime_icon(_value.mime, _value.path, undefined, _value.mtime) : this.image.attr('src')+ '&thheight=128'
|
||||||
}];
|
}];
|
||||||
}
|
}
|
||||||
|
if (mediaContent[0].href && mediaContent[0].href.match(/\/webdav.php/,'ig')) mediaContent[0]["download_href"] = mediaContent[0].href + '?download';
|
||||||
return mediaContent;
|
return mediaContent;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -152,6 +152,10 @@ class egw_link extends solink
|
|||||||
'mime_popup' => '640x480',
|
'mime_popup' => '640x480',
|
||||||
'mime_target' => '_blank',
|
'mime_target' => '_blank',
|
||||||
),
|
),
|
||||||
|
'/^image\\//' => array( // image
|
||||||
|
'mime_popup' => '640x480',
|
||||||
|
'mime_target' => '_blank',
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user