mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-06-03 08:45:58 +02:00
add nice link overlay icon to vfsMime widget (for symlinks)
This commit is contained in:
parent
a14ede7587
commit
cd024eef1b
@ -557,7 +557,7 @@ class etemplate_new extends etemplate_widget_template
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// default etemplate class has to be defined by either extending etemplate_new or etemplate_old
|
// default etemplate class has to be defined by either extending etemplate_new or etemplate_old
|
||||||
class etemplate extends etemplate_old {};
|
class etemplate extends etemplate_new {};
|
||||||
|
|
||||||
// Try to discover all widgets, as names don't always match tags (eg: listbox is in menupopup)
|
// Try to discover all widgets, as names don't always match tags (eg: listbox is in menupopup)
|
||||||
$files = scandir(EGW_INCLUDE_ROOT . '/etemplate/inc');
|
$files = scandir(EGW_INCLUDE_ROOT . '/etemplate/inc');
|
||||||
|
@ -61,6 +61,7 @@
|
|||||||
* 'row_modified' => // I key into row content for modification date or state of a row, to not query it again
|
* 'row_modified' => // I key into row content for modification date or state of a row, to not query it again
|
||||||
* 'parent_id' => // I key into row content of children linking them to their parent
|
* 'parent_id' => // I key into row content of children linking them to their parent
|
||||||
* 'is_parent' => // I key into row content to mark a row to have children
|
* 'is_parent' => // I key into row content to mark a row to have children
|
||||||
|
* 'is_parent_value'=> // I if set value of is_parent, otherwise is_parent is evaluated as boolean
|
||||||
* 'dataStorePrefix' => // I Optional prefix for client side cache to prevent collisions in applications that have more than one data set, such as ProjectManager / Project elements. Defaults to appname if not set.
|
* 'dataStorePrefix' => // I Optional prefix for client side cache to prevent collisions in applications that have more than one data set, such as ProjectManager / Project elements. Defaults to appname if not set.
|
||||||
* 'actions' => // I array with actions, see nextmatch_widget::egw_actions
|
* 'actions' => // I array with actions, see nextmatch_widget::egw_actions
|
||||||
* 'action_links' => // I array with enabled actions or ones which should be checked if they are enabled
|
* 'action_links' => // I array with enabled actions or ones which should be checked if they are enabled
|
||||||
@ -283,7 +284,7 @@ class etemplate_widget_nextmatch extends etemplate_widget
|
|||||||
$row_id = isset($value['row_id']) ? $value['row_id'] : 'id';
|
$row_id = isset($value['row_id']) ? $value['row_id'] : 'id';
|
||||||
$row_modified = $value['row_modified'];
|
$row_modified = $value['row_modified'];
|
||||||
$is_parent = $value['is_parent'];
|
$is_parent = $value['is_parent'];
|
||||||
|
$is_parent_value = $value['is_parent_value'];
|
||||||
|
|
||||||
foreach($rows as $n => $row)
|
foreach($rows as $n => $row)
|
||||||
{
|
{
|
||||||
@ -302,8 +303,9 @@ class etemplate_widget_nextmatch extends etemplate_widget
|
|||||||
{
|
{
|
||||||
if ($parent_id) // if app supports parent_id / hierarchy, set parent_id and is_parent
|
if ($parent_id) // if app supports parent_id / hierarchy, set parent_id and is_parent
|
||||||
{
|
{
|
||||||
$row['is_parent'] = $row[$is_parent];
|
$row['is_parent'] = isset($is_parent_value) ?
|
||||||
$row['parent_id'] = $row[$parent_id];
|
$row[$is_parent] == $is_parent_value : (boolean)$row[$is_parent];
|
||||||
|
$row['parent_id'] = $row[$parent_id]; // seems NOT used on client!
|
||||||
}
|
}
|
||||||
$result['data'][$id] = $row;
|
$result['data'][$id] = $row;
|
||||||
}
|
}
|
||||||
|
@ -213,8 +213,18 @@ var et2_vfsName_ro = et2_textbox_ro.extend(
|
|||||||
et2_register_widget(et2_vfsName_ro, ["vfs-name_ro"]);
|
et2_register_widget(et2_vfsName_ro, ["vfs-name_ro"]);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* vfs-mime
|
* vfs-mime: icon for mimetype of file, or thumbnail
|
||||||
* Icon for mimetype of file, or thumbnail
|
* incl. optional link overlay icon, if file is a symlink
|
||||||
|
*
|
||||||
|
* Creates following structure
|
||||||
|
* <span class="iconOverlayContainer">
|
||||||
|
* <img class="et2_vfs vfsMimeIcon" src="..."/>
|
||||||
|
* <span class="overlayContainer">
|
||||||
|
* <img class="overlay" src="etemplate/templates/default/images/link.png"/>
|
||||||
|
* </span>
|
||||||
|
* </span>
|
||||||
|
*
|
||||||
|
* span.overlayContainer is optional and only generated for symlinks
|
||||||
*
|
*
|
||||||
* @augments et2_valueWidget
|
* @augments et2_valueWidget
|
||||||
*/
|
*/
|
||||||
@ -241,9 +251,11 @@ var et2_vfsMime = et2_valueWidget.extend([et2_IDetachedDOM],
|
|||||||
*/
|
*/
|
||||||
init: function() {
|
init: function() {
|
||||||
this._super.apply(this, arguments);
|
this._super.apply(this, arguments);
|
||||||
|
this.iconOverlayContainer = jQuery(document.createElement('span')).addClass('iconOverlayContainer');
|
||||||
this.image = jQuery(document.createElement("img"));
|
this.image = jQuery(document.createElement("img"));
|
||||||
this.image.addClass("et2_vfs vfsMimeIcon");
|
this.image.addClass("et2_vfs vfsMimeIcon");
|
||||||
this.setDOMNode(this.image[0]);
|
this.iconOverlayContainer.append(this.image);
|
||||||
|
this.setDOMNode(this.iconOverlayContainer[0]);
|
||||||
},
|
},
|
||||||
set_value: function(_value) {
|
set_value: function(_value) {
|
||||||
if (typeof _value !== 'object')
|
if (typeof _value !== 'object')
|
||||||
@ -265,6 +277,23 @@ var et2_vfsMime = et2_valueWidget.extend([et2_IDetachedDOM],
|
|||||||
}
|
}
|
||||||
this.image.attr("src", src);
|
this.image.attr("src", src);
|
||||||
}
|
}
|
||||||
|
// add/remove link icon, if file is (not) a symlink
|
||||||
|
if ((_value.mode & et2_vfsMode.prototype.types.l) == et2_vfsMode.prototype.types.l)
|
||||||
|
{
|
||||||
|
if (typeof this.overlayContainer == 'undefined')
|
||||||
|
{
|
||||||
|
|
||||||
|
this.overlayContainer = jQuery(document.createElement('span')).addClass('overlayContainer');
|
||||||
|
this.overlayContainer.append(jQuery(document.createElement('img'))
|
||||||
|
.addClass('overlay').attr('src', this.egw().image('link', 'etemplate')));
|
||||||
|
this.iconOverlayContainer.append(this.overlayContainer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (typeof this.overlayContainer != 'undefined')
|
||||||
|
{
|
||||||
|
this.overlayContainer.remove();
|
||||||
|
delete this.overlayContainer;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* Implementation of "et2_IDetachedDOM" for fast viewing in gridview
|
* Implementation of "et2_IDetachedDOM" for fast viewing in gridview
|
||||||
@ -274,11 +303,13 @@ var et2_vfsMime = et2_valueWidget.extend([et2_IDetachedDOM],
|
|||||||
_attrs.push("value", "class");
|
_attrs.push("value", "class");
|
||||||
},
|
},
|
||||||
getDetachedNodes: function() {
|
getDetachedNodes: function() {
|
||||||
return [this.image[0]];
|
return [this.iconOverlayContainer[0]];
|
||||||
},
|
},
|
||||||
|
|
||||||
setDetachedAttributes: function(_nodes, _values) {
|
setDetachedAttributes: function(_nodes, _values) {
|
||||||
this.image = jQuery(_nodes[0]);
|
this.iconOverlayContainer = jQuery(_nodes[0]);
|
||||||
|
this.image = jQuery(_nodes[0].children[0]);
|
||||||
|
this.overlayContainer = _nodes[0].children[1];
|
||||||
if(typeof _values['class'] != "undefined") {
|
if(typeof _values['class'] != "undefined") {
|
||||||
this.image.addClass(_values['class']);
|
this.image.addClass(_values['class']);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user