diff --git a/etemplate/inc/class.etemplate.inc.php b/etemplate/inc/class.etemplate.inc.php index e07860c515..489df9d51e 100644 --- a/etemplate/inc/class.etemplate.inc.php +++ b/etemplate/inc/class.etemplate.inc.php @@ -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 -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) $files = scandir(EGW_INCLUDE_ROOT . '/etemplate/inc'); diff --git a/etemplate/inc/class.etemplate_widget_nextmatch.inc.php b/etemplate/inc/class.etemplate_widget_nextmatch.inc.php index 1b3e058e92..fab0402a52 100644 --- a/etemplate/inc/class.etemplate_widget_nextmatch.inc.php +++ b/etemplate/inc/class.etemplate_widget_nextmatch.inc.php @@ -61,6 +61,7 @@ * '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 * '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. * '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 @@ -283,7 +284,7 @@ class etemplate_widget_nextmatch extends etemplate_widget $row_id = isset($value['row_id']) ? $value['row_id'] : 'id'; $row_modified = $value['row_modified']; $is_parent = $value['is_parent']; - + $is_parent_value = $value['is_parent_value']; 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 { - $row['is_parent'] = $row[$is_parent]; - $row['parent_id'] = $row[$parent_id]; + $row['is_parent'] = isset($is_parent_value) ? + $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; } @@ -830,7 +832,7 @@ class etemplate_widget_nextmatch extends etemplate_widget $validated[$form_name] = $value; } - + /** * Include favorites when generating the page server-side * @@ -886,7 +888,7 @@ class etemplate_widget_nextmatch extends etemplate_widget $html .= ''; return $html; } - + /** * Create or delete a favorite for multiple users * @@ -1052,13 +1054,13 @@ class etemplate_widget_nextmatch_customfilter extends etemplate_widget_transform self::$transformation['type'] = $this->attrs['type']; } $form_name = self::form_name($cname, $this->id, $expand); - + // Don't need simple onchanges, it's ajax if($this->attrs['onchange'] == 1) { $this->setElementAttribute($form_name, 'onchange', false); } - + $this->setElementAttribute($form_name, 'options', trim($this->attrs['widget_options']) != '' ? $this->attrs['widget_options'] : ''); parent::beforeSendToClient($cname); diff --git a/etemplate/js/et2_widget_vfs.js b/etemplate/js/et2_widget_vfs.js index 15ffecd4c0..dac43429af 100644 --- a/etemplate/js/et2_widget_vfs.js +++ b/etemplate/js/et2_widget_vfs.js @@ -213,8 +213,18 @@ var et2_vfsName_ro = et2_textbox_ro.extend( et2_register_widget(et2_vfsName_ro, ["vfs-name_ro"]); /** - * vfs-mime - * Icon for mimetype of file, or thumbnail + * vfs-mime: icon for mimetype of file, or thumbnail + * incl. optional link overlay icon, if file is a symlink + * + * Creates following structure + * + * + * + * + * + * + * + * span.overlayContainer is optional and only generated for symlinks * * @augments et2_valueWidget */ @@ -241,9 +251,11 @@ var et2_vfsMime = et2_valueWidget.extend([et2_IDetachedDOM], */ init: function() { this._super.apply(this, arguments); + this.iconOverlayContainer = jQuery(document.createElement('span')).addClass('iconOverlayContainer'); this.image = jQuery(document.createElement("img")); 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) { if (typeof _value !== 'object') @@ -265,6 +277,23 @@ var et2_vfsMime = et2_valueWidget.extend([et2_IDetachedDOM], } 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 @@ -274,11 +303,13 @@ var et2_vfsMime = et2_valueWidget.extend([et2_IDetachedDOM], _attrs.push("value", "class"); }, getDetachedNodes: function() { - return [this.image[0]]; + return [this.iconOverlayContainer[0]]; }, 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") { this.image.addClass(_values['class']); }