From b2aabac6f9e2d79b2a6f9418b84ce8d415329dfd Mon Sep 17 00:00:00 2001 From: Nathan Gray Date: Thu, 20 Feb 2014 17:41:33 +0000 Subject: [PATCH] - Fix VFS widget names when name is not part of path - Fix VFS link titles for app entries --- etemplate/js/et2_widget_vfs.js | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/etemplate/js/et2_widget_vfs.js b/etemplate/js/et2_widget_vfs.js index 0d0926d6a7..82ab309836 100644 --- a/etemplate/js/et2_widget_vfs.js +++ b/etemplate/js/et2_widget_vfs.js @@ -65,14 +65,23 @@ var et2_vfs = et2_valueWidget.extend([et2_IDetachedDOM], this.span.empty().text(_value); return; } + this.span.empty(); this.value = _value; var path = _value.path ? _value.path : '/'; // calculate path as parent of name, which can contain slashes // eg. _value.path=/home/ralf/sub/file, _value.name=sub/file --> path=/home/ralf // --> generate clickable fields for sub/ + file - path = path.substr(0, _value.path.length-_value.name.length-1); - var path_offset = path.split('/').length; - var path_parts = _value.path.split('/'); + if(_value.path.indexOf(_value.name) >= 0) + { + path = path.substr(0, _value.path.length-_value.name.length-1); + var path_offset = path.split('/').length; + var path_parts = _value.path.split('/'); + } + else + { + var path_offset = 0; + var path_parts = [_value.name]; + } var text; for(var i = path_offset; i < path_parts.length; i++) @@ -100,7 +109,13 @@ var et2_vfs = et2_valueWidget.extend([et2_IDetachedDOM], case 4: if(!isNaN(text)) { - text = this.egw().link_title(path_parts[2],path_parts[3]); + var link_title = this.egw().link_title(path_parts[2],path_parts[3], + function(title) { + if(!title || this.value.name == title) return; + $j('li',this.span).last().text(title); + }, this + ); + if(link_title && typeof link_title !== 'undefined') text = link_title; } break; }