Changeset 5743

Show
Ignore:
Timestamp:
04/09/08 13:06:41 (8 months ago)
Author:
kinoshita
Message:

4316

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • spinelz/trunk/compress/javascripts/spinelz/spinelz_for_rubricks.js

    r5706 r5743  
    47374737TreeView.iconId="treeview_icon"; 
    47384738TreeView.prototype={initialize:function(_1){ 
    4739 this.options=Object.extend({dirSymbol:"dir",fileSymbol:"file",cssPrefix:"custom_",open:true,callBackFunctions:false,dirSelect:true,fileSelect:true,noSelectedInsert:true,iconIdPrefix:TreeView.iconId,move:false,unselected:Prototype.emptyFunction,enableUnselected:true,sortOptions:{},openDir:Prototype.emptyFunction,closeDir:Prototype.emptyFunction,emptyImg:false,initialSelected:null,build:true},arguments[1]||{}); 
     4739this.options=Object.extend({dirSymbol:"dir",fileSymbol:"file",cssPrefix:"custom_",open:true,closeIds:[],callBackFunctions:false,dirSelect:true,fileSelect:true,noSelectedInsert:true,iconIdPrefix:TreeView.iconId,move:false,unselected:Prototype.emptyFunction,enableUnselected:true,sortOptions:{},openDir:Prototype.emptyFunction,closeDir:Prototype.emptyFunction,emptyImg:false,initialSelected:null,build:true},arguments[1]||{}); 
    47404740this.element=$(_1); 
    47414741this.customCss=CssUtil.appendPrefix(this.options.cssPrefix,TreeView.className); 
     
    48694869}.bind(this)).join(" "); 
    48704870var _1e=_1b.id||this.getBaseId(); 
    4871 var _1f=this.getState(_1b); 
    4872 var _20=this.options.iconIdPrefix.appendSuffix(_1e); 
    4873 var _21=_20.appendSuffix("stateImg"); 
    4874 var _22=_20.appendSuffix("dirBodyText"); 
    4875 var _23=[this.classNames.joinClassNames("dirIcon"),_1c,this.classNames.joinClassNames("handle")]; 
    4876 var _24=(this.options.open)?"":" style='display: none;'"; 
    4877 this.dirIds.push({state:_21,icon:_20,bodyText:_22}); 
    4878 var _25="<li id='"+_1e+"' class='"+this.classNames.joinClassNames("dir")+"'>"+"<div class='"+this.classNames.joinClassNames("dirBody")+"'>"+"<div id='"+_21+"' class='"+this.classNames.joinClassNames(_1f)+"'></div>"+"<div id='"+_20+"' class='"+_23.join(" ")+"'></div>"+"<span id='"+_22+"'class='"+this.classNames.joinClassNames("dirBodyText")+"'>"+this.getDirectoryText(_1b)+"</span>"+"</div>"+"<ul"+_24+" class='"+this.classNames.joinClassNames("dirContainer")+"'>"+this.buildSubContent(_1b)+"</ul>"+"</li>"; 
    4879 return _25; 
    4880 },buildSubContent:function(_26){ 
    4881 var ul=$A(_26.childNodes).detect(function(_28){ 
    4882 return Element.hasTagName(_28,"ul"); 
     4871var _1f=this.options.closeIds.include(_1e); 
     4872var _20=this.getState(_1b,_1f); 
     4873var _21=this.options.iconIdPrefix.appendSuffix(_1e); 
     4874var _22=_21.appendSuffix("stateImg"); 
     4875var _23=_21.appendSuffix("dirBodyText"); 
     4876var _24=[this.classNames.joinClassNames("dirIcon"),_1c,this.classNames.joinClassNames("handle")]; 
     4877var _25=(this.options.open&&!_1f)?"":" style='display: none;'"; 
     4878this.dirIds.push({state:_22,icon:_21,bodyText:_23}); 
     4879var _26="<li id='"+_1e+"' class='"+this.classNames.joinClassNames("dir")+"'>"+"<div class='"+this.classNames.joinClassNames("dirBody")+"'>"+"<div id='"+_22+"' class='"+this.classNames.joinClassNames(_20)+"'></div>"+"<div id='"+_21+"' class='"+_24.join(" ")+"'></div>"+"<span id='"+_23+"'class='"+this.classNames.joinClassNames("dirBodyText")+"'>"+this.getDirectoryText(_1b)+"</span>"+"</div>"+"<ul"+_25+" class='"+this.classNames.joinClassNames("dirContainer")+"'>"+this.buildSubContent(_1b)+"</ul>"+"</li>"; 
     4880return _26; 
     4881},buildSubContent:function(_27){ 
     4882var ul=$A(_27.childNodes).detect(function(_29){ 
     4883return Element.hasTagName(_29,"ul"); 
    48834884}); 
    48844885if(ul){ 
    4885 return $A(ul.childNodes).inject("",function(_29,_2a){ 
    4886 return _29+this.build(_2a); 
     4886return $A(ul.childNodes).inject("",function(_2a,_2b){ 
     4887return _2a+this.build(_2b); 
    48874888}.bind(this)); 
    48884889}else{ 
    48894890return ""; 
    48904891} 
    4891 },getState:function(_2b){ 
    4892 if(!this.hasChildNodes(_2b)&&!this.options.emptyImg){ 
     4892},getState:function(_2c,_2d){ 
     4893if(!this.hasChildNodes(_2c)&&!this.options.emptyImg){ 
    48934894return "state_empty"; 
    48944895}else{ 
    4895 if(this.options.open){ 
     4896if(this.options.open&&!_2d){ 
    48964897return "state_open"; 
    48974898}else{ 
     
    48994900} 
    49004901} 
    4901 },hasChildNodes:function(_2c){ 
    4902 var ul=$A(_2c.childNodes).detect(function(_2e){ 
    4903 return Element.hasTagName(_2e,"ul"); 
     4902},getClosedIds:function(){ 
     4903var _2e=$A($(this.element).getElementsByTagName("li")); 
     4904return _2e.select(function(_2f){ 
     4905return this.isClosed(_2f); 
     4906}.bind(this)); 
     4907},hasChildNodes:function(_30){ 
     4908var ul=$A(_30.childNodes).detect(function(_32){ 
     4909return Element.hasTagName(_32,"ul"); 
    49044910}); 
    49054911return ul&&(ul.childNodes.length!=0); 
    4906 },buildFile:function(_2f){ 
    4907 var _30=new Element.ClassNames(_2f).select(function(_31){ 
    4908 return _31!=this.options.fileSymbol; 
     4912},buildFile:function(_33){ 
     4913var _34=new Element.ClassNames(_33).select(function(_35){ 
     4914return _35!=this.options.fileSymbol; 
    49094915}.bind(this)).join(" "); 
    4910 var _32=_2f.id||this.getBaseId(); 
    4911 var _33=this.options.iconIdPrefix.appendSuffix(_32); 
    4912 var _34=[this.classNames.joinClassNames("fileIcon"),_30,this.classNames.joinClassNames("handle")]; 
    4913 var _35=_32.appendSuffix("fileBodyText"); 
    4914 this.fileIds.push({icon:_33,bodyText:_35}); 
    4915 var _36=Element.attributeHTML(_2f,"onclick"); 
    4916 var _37="<li id='"+_32+"' class='"+this.classNames.joinClassNames("file")+"' "+_36+">"+"<div class='"+this.classNames.joinClassNames("fileBody")+"'>"+"<div id='"+_33+"' class='"+_34.join(" ")+"'></div>"+"<span id='"+_35+"'class='"+this.classNames.joinClassNames("fileBodyText")+"'>"+_2f.innerHTML+"</span>"+"</div>"+"</li>"; 
    4917 return _37
     4916var _36=_33.id||this.getBaseId(); 
     4917var _37=this.options.iconIdPrefix.appendSuffix(_36); 
     4918var _38=[this.classNames.joinClassNames("fileIcon"),_34,this.classNames.joinClassNames("handle")]; 
     4919var _39=_36.appendSuffix("fileBodyText"); 
     4920this.fileIds.push({icon:_37,bodyText:_39}); 
     4921var _3a=Element.attributeHTML(_33,"onclick"); 
     4922var _3b="<li id='"+_36+"' class='"+this.classNames.joinClassNames("file")+"' "+_3a+">"+"<div class='"+this.classNames.joinClassNames("fileBody")+"'>"+"<div id='"+_37+"' class='"+_38.join(" ")+"'></div>"+"<span id='"+_39+"'class='"+this.classNames.joinClassNames("fileBodyText")+"'>"+_33.innerHTML+"</span>"+"</div>"+"</li>"; 
     4923return _3b
    49184924},getBaseId:function(){ 
    49194925return this.element.id.appendSuffix(++this.idCount); 
     
    49244930} 
    49254931},observeDirEvent:function(){ 
    4926 this.dirIds.each(function(_38){ 
    4927 Event.observe(_38.state,"click",this.toggle.bindAsEventListener(this)); 
     4932this.dirIds.each(function(_3c){ 
     4933Event.observe(_3c.state,"click",this.toggle.bindAsEventListener(this)); 
    49284934if(this.options.dirSelect){ 
    4929 Event.observe(_38.icon,"click",this.selectDirItem.bindAsEventListener(this)); 
    4930 Event.observe(_38.bodyText,"click",this.selectDirItem.bindAsEventListener(this)); 
     4935Event.observe(_3c.icon,"click",this.selectDirItem.bindAsEventListener(this)); 
     4936Event.observe(_3c.bodyText,"click",this.selectDirItem.bindAsEventListener(this)); 
    49314937} 
    49324938}.bind(this)); 
    49334939},observeFileEvent:function(){ 
    4934 this.fileIds.each(function(_39){ 
    4935 Event.observe(_39.icon,"click",this.selectFileItem.bindAsEventListener(this)); 
    4936 Event.observe(_39.bodyText,"click",this.selectFileItem.bindAsEventListener(this)); 
     4940this.fileIds.each(function(_3d){ 
     4941Event.observe(_3d.icon,"click",this.selectFileItem.bindAsEventListener(this)); 
     4942Event.observe(_3d.bodyText,"click",this.selectFileItem.bindAsEventListener(this)); 
    49374943}.bind(this)); 
    49384944},convertJSON:function(){ 
    49394945return JSON.stringify(this.parse()); 
    4940 },getChildBody:function(_3a){ 
    4941 var _3b=[TreeView.className.fileBody,TreeView.className.dirBody]; 
    4942 return Element.getFirstElementByClassNames(_3a,_3b); 
    4943 },getChildBodyText:function(_3c){ 
    4944 var _3d=[TreeView.className.fileBodyText,TreeView.className.fileBodyTextActive,TreeView.className.dirBodyText,TreeView.className.dirBodyTextActive]; 
    4945 return Element.getFirstElementByClassNames(_3c,_3d); 
    4946 },getChildBodyTextNode:function(_3e){ 
    4947 var _3f=this.getChildBody(_3e); 
    4948 var _40=this.getChildBodyText(_3f); 
    4949 return this.searchTextNode(_40); 
    4950 },getChildDir:function(_41){ 
    4951 return document.getElementsByClassName(TreeView.className.dir,_41); 
    4952 },getChildDirBody:function(_42){ 
    4953 return document.getElementsByClassName(TreeView.className.dirBody,_42)[0]; 
    4954 },getChildDirContainer:function(_43){ 
    4955 return document.getElementsByClassName(TreeView.className.dirContainer,_43)[0]; 
    4956 },getChildStateImg:function(_44){ 
    4957 var _45=this.getChildDirBody(_44); 
    4958 var _46=[TreeView.className.state_close,TreeView.className.state_open,TreeView.className.state_empty]; 
    4959 return Element.getFirstElementByClassNames(_45,_46); 
    4960 },getChildren:function(_47,_48,_49){ 
    4961 var _4a
    4962 var _4b=new Array(); 
    4963 if(_47){ 
    4964 _4a=$(_47).getElementsByTagName("ul")[0]; 
    4965 }else{ 
    4966 _4a=this.element; 
    4967 } 
    4968 $A(Element.getTagNodes(_4a)).each(function(_4c){ 
    4969 if(!_48&&Element.hasClassName(_4c,TreeView.className.dir)){ 
    4970 _4b.push(_4c); 
    4971 } 
    4972 if(!_49&&Element.hasClassName(_4c,TreeView.className.file)){ 
    4973 _4b.push(_4c); 
    4974 } 
    4975 }); 
    4976 return _4b
    4977 },getDirectoryContents:function(_4d){ 
    4978 return $A(_4d.childNodes).findAll(function(_4e){ 
    4979 if((_4e.nodeType!=1)){ 
     4946},getChildBody:function(_3e){ 
     4947var _3f=[TreeView.className.fileBody,TreeView.className.dirBody]; 
     4948return Element.getFirstElementByClassNames(_3e,_3f); 
     4949},getChildBodyText:function(_40){ 
     4950var _41=[TreeView.className.fileBodyText,TreeView.className.fileBodyTextActive,TreeView.className.dirBodyText,TreeView.className.dirBodyTextActive]; 
     4951return Element.getFirstElementByClassNames(_40,_41); 
     4952},getChildBodyTextNode:function(_42){ 
     4953var _43=this.getChildBody(_42); 
     4954var _44=this.getChildBodyText(_43); 
     4955return this.searchTextNode(_44); 
     4956},getChildDir:function(_45){ 
     4957return document.getElementsByClassName(TreeView.className.dir,_45); 
     4958},getChildDirBody:function(_46){ 
     4959return document.getElementsByClassName(TreeView.className.dirBody,_46)[0]; 
     4960},getChildDirContainer:function(_47){ 
     4961return document.getElementsByClassName(TreeView.className.dirContainer,_47)[0]; 
     4962},getChildStateImg:function(_48){ 
     4963var _49=this.getChildDirBody(_48); 
     4964var _4a=[TreeView.className.state_close,TreeView.className.state_open,TreeView.className.state_empty]; 
     4965return Element.getFirstElementByClassNames(_49,_4a); 
     4966},getChildren:function(_4b,_4c,_4d){ 
     4967var _4e
     4968var _4f=new Array(); 
     4969if(_4b){ 
     4970_4e=$(_4b).getElementsByTagName("ul")[0]; 
     4971}else{ 
     4972_4e=this.element; 
     4973} 
     4974$A(Element.getTagNodes(_4e)).each(function(_50){ 
     4975if(!_4c&&Element.hasClassName(_50,TreeView.className.dir)){ 
     4976_4f.push(_50); 
     4977} 
     4978if(!_4d&&Element.hasClassName(_50,TreeView.className.file)){ 
     4979_4f.push(_50); 
     4980} 
     4981}); 
     4982return _4f
     4983},getDirectoryContents:function(_51){ 
     4984return $A(_51.childNodes).findAll(function(_52){ 
     4985if((_52.nodeType!=1)){ 
    49804986return false; 
    49814987} 
    4982 if(_4e.tagName.toLowerCase()=="li"){ 
     4988if(_52.tagName.toLowerCase()=="li"){ 
    49834989return true; 
    49844990} 
    49854991return false; 
    49864992}); 
    4987 },getDirectoryText:function(_4f){ 
    4988 return $A(_4f.childNodes).inject("",function(_50,_51){ 
    4989 if(Element.isTextNode(_51)){ 
    4990 _50+=_51.nodeValue; 
    4991 }else{ 
    4992 if(_51.tagName.toLowerCase()!="ul"){ 
    4993 _50+=Element.outerHTML(_51); 
    4994 } 
    4995 } 
    4996 return _50
     4993},getDirectoryText:function(_53){ 
     4994return $A(_53.childNodes).inject("",function(_54,_55){ 
     4995if(Element.isTextNode(_55)){ 
     4996_54+=_55.nodeValue; 
     4997}else{ 
     4998if(_55.tagName.toLowerCase()!="ul"){ 
     4999_54+=Element.outerHTML(_55); 
     5000} 
     5001} 
     5002return _54
    49975003}); 
    49985004},getHierarchyNumber:function(){ 
     
    50005006return; 
    50015007} 
    5002 var _52=this.selected; 
     5008var _56=this.selected; 
    50035009var i=0; 
    50045010while(true){ 
    5005 if(this.element==_52){ 
     5011if(this.element==_56){ 
    50065012return i; 
    50075013}else{ 
    5008 _52=this.getParentDir(_52,true); 
    5009 if(!_52){ 
     5014_56=this.getParentDir(_56,true); 
     5015if(!_56){ 
    50105016return; 
    50115017} 
     
    50165022var arr=[]; 
    50175023if(this.selected){ 
    5018 var _55=this.selected; 
    5019 arr.push(_55); 
    5020 while(_55){ 
    5021 _55=this.getParentDir(_55,false); 
    5022 if(_55){ 
    5023 arr.push(_55); 
     5024var _59=this.selected; 
     5025arr.push(_59); 
     5026while(_59){ 
     5027_59=this.getParentDir(_59,false); 
     5028if(_59){ 
     5029arr.push(_59); 
    50245030} 
    50255031} 
    50265032} 
    50275033return arr.reverse(); 
    5028 },getParentDir:function(_56,top){ 
    5029 var _58=Element.getParentByClassName(TreeView.className.dir,_56); 
    5030 if(!_58&&top){ 
    5031 _58=Element.getParentByClassName(TreeView.className.top,_56); 
    5032 } 
    5033 return _58
    5034 },hasContents:function(_59){ 
    5035 if(_59){ 
    5036 if(!Element.hasClassName(_59,TreeView.className.dirContainer)&&!Element.hasClassName(_59,TreeView.className.top)){ 
     5034},getParentDir:function(_5a,top){ 
     5035var _5c=Element.getParentByClassName(TreeView.className.dir,_5a); 
     5036if(!_5c&&top){ 
     5037_5c=Element.getParentByClassName(TreeView.className.top,_5a); 
     5038} 
     5039return _5c
     5040},hasContents:function(_5d){ 
     5041if(_5d){ 
     5042if(!Element.hasClassName(_5d,TreeView.className.dirContainer)&&!Element.hasClassName(_5d,TreeView.className.top)){ 
    50375043return false; 
    50385044} 
    5039 var _5a=_59.childNodes; 
    5040 for(var i=0;i<_5a.length;i++){ 
    5041 if(_5a[i].nodeType==1){ 
    5042 if(Element.hasClassName(_5a[i],TreeView.className.dir)||Element.hasClassName(_5a[i],TreeView.className.file)){ 
     5045var _5e=_5d.childNodes; 
     5046for(var i=0;i<_5e.length;i++){ 
     5047if(_5e[i].nodeType==1){ 
     5048if(Element.hasClassName(_5e[i],TreeView.className.dir)||Element.hasClassName(_5e[i],TreeView.className.file)){ 
    50435049return true; 
    50445050} 
     
    50475053} 
    50485054return false; 
    5049 },parse:function(_5c){ 
    5050 if(!_5c){ 
    5051 _5c=this.element; 
    5052 } 
    5053 var _5d=[]; 
    5054 var _5e=this.getDirectoryContents(_5c); 
    5055 for(var i=0;i<_5e.length;i++){ 
    5056 var _60=_5e[i]; 
    5057 var _61=this.getChildBody(_60); 
    5058 var _62=this.getChildBodyText(_61); 
    5059 var _63={}; 
    5060 _63.id=_60.id; 
    5061 _63.name=Element.collectTextNodes(_62).replace(/\n/,""); 
    5062 if(Element.hasClassName(_60,TreeView.className.dir)){ 
    5063 _63.type=this.options.dirSymbol; 
    5064 _63.contents=this.parse(this.getChildDirContainer(_60)); 
    5065 }else{ 
    5066 _63.type=this.options.fileSymbol; 
    5067 } 
    5068 _5d.push(_63); 
    5069 } 
    5070 return _5d
    5071 },refreshStateImg:function(_64){ 
    5072 if(!Element.hasClassName(_64,TreeView.className.dir)){ 
    5073 return; 
    5074 } 
    5075 var _65=this.getChildDirContainer(_64); 
    5076 var img=this.getChildStateImg(_64); 
    5077 if(!this.hasContents(_65)&&!this.options.emptyImg){ 
     5055},parse:function(_60){ 
     5056if(!_60){ 
     5057_60=this.element; 
     5058} 
     5059var _61=[]; 
     5060var _62=this.getDirectoryContents(_60); 
     5061for(var i=0;i<_62.length;i++){ 
     5062var _64=_62[i]; 
     5063var _65=this.getChildBody(_64); 
     5064var _66=this.getChildBodyText(_65); 
     5065var _67={}; 
     5066_67.id=_64.id; 
     5067_67.name=Element.collectTextNodes(_66).replace(/\n/,""); 
     5068if(Element.hasClassName(_64,TreeView.className.dir)){ 
     5069_67.type=this.options.dirSymbol; 
     5070_67.contents=this.parse(this.getChildDirContainer(_64)); 
     5071}else{ 
     5072_67.type=this.options.fileSymbol; 
     5073} 
     5074_61.push(_67); 
     5075} 
     5076return _61
     5077},refreshStateImg:function(_68){ 
     5078if(!Element.hasClassName(_68,TreeView.className.dir)){ 
     5079return; 
     5080} 
     5081var _69=this.getChildDirContainer(_68); 
     5082var img=this.getChildStateImg(_68); 
     5083if(!this.hasContents(_69)&&!this.options.emptyImg){ 
    50785084this.classNames.refreshClassNames(img,"state_empty"); 
    50795085}else{ 
    5080 if(Element.visible(_65)){ 
     5086if(Element.visible(_69)){ 
    50815087this.classNames.refreshClassNames(img,"state_open"); 
    50825088}else{ 
     
    50845090} 
    50855091} 
    5086 },removeById:function(_67){ 
    5087 _67=$(_67); 
    5088 if(_67){ 
    5089 var _68=_67.parentNode.parentNode; 
    5090 Element.remove(_67); 
    5091 this.refreshStateImg(_68); 
    5092 } 
    5093 },removeByPath:function(_69){ 
    5094 var _6a=_69.split("/").findAll(function(elm){ 
     5092},removeById:function(_6b){ 
     5093_6b=$(_6b); 
     5094if(_6b){ 
     5095var _6c=_6b.parentNode.parentNode; 
     5096Element.remove(_6b); 
     5097this.refreshStateImg(_6c); 
     5098} 
     5099},removeByPath:function(_6d){ 
     5100var _6e=_6d.split("/").findAll(function(elm){ 
    50955101return (elm!=""); 
    50965102}); 
    5097 var _6c=_6a.pop(); 
    5098 var _6d=this.search(_6a.join("/")); 
    5099 var _6e=this.getDirectoryContents(_6d)[_6c]; 
    5100 if(_6e){ 
    5101 this.removeById(_6e); 
     5103var _70=_6e.pop(); 
     5104var _71=this.search(_6e.join("/")); 
     5105var _72=this.getDirectoryContents(_71)[_70]; 
     5106if(_72){ 
     5107this.removeById(_72); 
    51025108} 
    51035109},removeBySelected:function(){ 
     
    51075113this.removeById(this.selected); 
    51085114this.selected=false; 
    5109 },renameById:function(_6f,_70){ 
    5110 _70=$(_70); 
    5111 if(!Element.hasClassName(_70,TreeView.className.dir)&&!Element.hasClassName(_70,TreeView.className.file)){ 
    5112 return; 
    5113 } 
    5114 var _71=this.getChildBodyTextNode(_70); 
    5115 _71.nodeValue=_6f
    5116 },renameByPath:function(_72,_73){ 
    5117 var _74=_73.split("/").findAll(function(elm){ 
     5115},renameById:function(_73,_74){ 
     5116_74=$(_74); 
     5117if(!Element.hasClassName(_74,TreeView.className.dir)&&!Element.hasClassName(_74,TreeView.className.file)){ 
     5118return; 
     5119} 
     5120var _75=this.getChildBodyTextNode(_74); 
     5121_75.nodeValue=_73
     5122},renameByPath:function(_76,_77){ 
     5123var _78=_77.split("/").findAll(function(elm){ 
    51185124return (elm!=""); 
    51195125}); 
    5120 var _76=_74.pop(); 
    5121 var _77=this.search(_74.join("/")); 
    5122 var _78=this.getDirectoryContents(_77)[_76]; 
    5123 if(_78){ 
    5124 this.renameById(_72,_78); 
    5125 } 
    5126 },renameBySelected:function(_79){ 
     5126var _7a=_78.pop(); 
     5127var _7b=this.search(_78.join("/")); 
     5128var _7c=this.getDirectoryContents(_7b)[_7a]; 
     5129if(_7c){ 
     5130this.renameById(_76,_7c); 
     5131} 
     5132},renameBySelected:function(_7d){ 
    51275133if(!this.selected){ 
    51285134return; 
    51295135} 
    5130 this.renameById(_79,this.selected); 
    5131 },search:function(_7a){ 
    5132 var _7b=_7a.split("/").findAll(function(elm){ 
     5136this.renameById(_7d,this.selected); 
     5137},search:function(_7e){ 
     5138var _7f=_7e.split("/").findAll(function(elm){ 
    51335139return (elm!=""); 
    51345140}); 
    5135 var _7d=this.element; 
    5136 for(var i=0;i<_7b.length;i++){ 
    5137 var num=_7b[i]; 
    5138 var _80=this.getDirectoryContents(_7d); 
    5139 if(_80[num]&&Element.hasClassName(_80[num],TreeView.className.dir)){ 
    5140 _7d=this.getChildDirContainer(_80[num]); 
     5141var _81=this.element; 
     5142for(var i=0;i<_7f.length;i++){ 
     5143var num=_7f[i]; 
     5144var _84=this.getDirectoryContents(_81); 
     5145if(_84[num]&&Element.hasClassName(_84[num],TreeView.className.dir)){ 
     5146_81=this.getChildDirContainer(_84[num]); 
    51415147}else{ 
    51425148return false; 
    51435149} 
    51445150} 
    5145 return _7d
    5146 },searchTextNode:function(_81){ 
    5147 var _82=null; 
    5148 var _83=_81.childNodes; 
    5149 for(var i=0;i<_83.length;i++){ 
    5150 if(_83[i].nodeType==3){ 
    5151 _82=_83[i]; 
     5151return _81
     5152},searchTextNode:function(_85){ 
     5153var _86=null; 
     5154var _87=_85.childNodes; 
     5155for(var i=0;i<_87.length;i++){ 
     5156if(_87[i].nodeType==3){ 
     5157_86=_87[i]; 
    51525158break; 
    51535159}else{ 
    5154 if(_83[i].nodeType==1){ 
    5155 var tmp=this.searchTextNode(_83[i]); 
     5160if(_87[i].nodeType==1){ 
     5161var tmp=this.searchTextNode(_87[i]); 
    51565162if(tmp){ 
    5157 _82=tmp; 
     5163_86=tmp; 
    51585164break; 
    51595165} 
     
    51615167} 
    51625168} 
    5163 return _82
    5164 },selectDirItem:function(_86){ 
    5165 var _87=Element.getParentByClassName(TreeView.className.dirBody,Event.element(_86)); 
    5166 this.selectItem(_87); 
    5167 },selectEffect:function(_88,_89){ 
    5168 _89=Object.extend({enableUnselected:true},(_89||{})); 
    5169 _88=$(_88); 
    5170 if(_88){ 
    5171 var _8a=$A(_88.childNodes).detect(function(_8b){ 
    5172 return Element.isElementNode(_8b); 
    5173 }); 
    5174 if(this.selectItemUnselect(_8a,false)){ 
    5175 if(_89.enableUnselected){ 
    5176 return; 
    5177 } 
    5178 } 
    5179 this.selectItemSelect(_8a,false); 
    5180 } 
    5181 },selectFileItem:function(_8c){ 
    5182 var _8d=Element.getParentByClassName(TreeView.className.fileBody,Event.element(_8c)); 
    5183 this.selectItem(_8d); 
    5184 },selectItem:function(_8e){ 
    5185 if(this.selectItemUnselect(_8e,true)){ 
    5186 return; 
    5187 } 
    5188 this.selectItemSelect(_8e,true); 
    5189 },selectItemSelect:function(_8f,_90){ 
    5190 this.selected=_8f.parentNode; 
    5191 var _91=this.getChildBodyText(_8f); 
    5192 if(Element.hasClassName(_91,TreeView.className.dirBodyText)){ 
    5193 this.classNames.refreshClassNames(_91,"dirBodyTextActive"); 
     5169return _86
     5170},selectDirItem:function(_8a){ 
     5171var _8b=Element.getParentByClassName(TreeView.className.dirBody,Event.element(_8a)); 
     5172this.selectItem(_8b); 
     5173},selectEffect:function(_8c,_8d){ 
     5174_8d=Object.extend({enableUnselected:true},(_8d||{})); 
     5175_8c=$(_8c); 
     5176if(_8c){ 
     5177var _8e=$A(_8c.childNodes).detect(function(_8f){ 
     5178return Element.isElementNode(_8f); 
     5179}); 
     5180if(this.selectItemUnselect(_8e,false)){ 
     5181if(_8d.enableUnselected){ 
     5182return; 
     5183} 
     5184} 
     5185this.selectItemSelect(_8e,false); 
     5186} 
     5187},selectFileItem:function(_90){ 
     5188var _91=Element.getParentByClassName(TreeView.className.fileBody,Event.element(_90)); 
     5189this.selectItem(_91); 
     5190},selectItem:function(_92){ 
     5191if(this.selectItemUnselect(_92,true)){ 
     5192return; 
     5193} 
     5194this.selectItemSelect(_92,true); 
     5195},selectItemSelect:function(_93,_94){ 
     5196this.selected=_93.parentNode; 
     5197var _95=this.getChildBodyText(_93); 
     5198if(Element.hasClassName(_95,TreeView.className.dirBodyText)){ 
     5199this.classNames.refreshClassNames(_95,"dirBodyTextActive"); 
    51945200this.defaultCss="dirBodyText"; 
    51955201}else{ 
    5196 if(Element.hasClassName(_91,TreeView.className.fileBodyText)){ 
    5197 this.classNames.refreshClassNames(_91,"fileBodyTextActive"); 
     5202if(Element.hasClassName(_95,TreeView.className.fileBodyText)){ 
     5203this.classNames.refreshClassNames(_95,"fileBodyTextActive"); 
    51985204this.defaultCss="fileBodyText"; 
    51995205} 
    52005206} 
    5201 if(_90){ 
     5207if(_94){ 
    52025208if(this.options.callBackFunctions){ 
    52035209for(var i=0;i<this.options.callBackFunctions.length;i++){ 
    5204 this.options.callBackFunctions[i](_8f.parentNode); 
    5205 } 
    5206 } 
    5207 } 
    5208 },selectItemUnselect:function(_93,_94){ 
     5210this.options.callBackFunctions[i](_93.parentNode); 
     5211} 
     5212} 
     5213} 
     5214},selectItemUnselect:function(_97,_98){ 
    52095215if(this.selected){ 
    5210 var _95=this.getChildBody(this.selected); 
    5211 var _96=this.getChildBodyText(_95); 
    5212 this.classNames.refreshClassNames(_96,this.defaultCss); 
    5213 if(this.selected==_93.parentNode&&this.options.enableUnselected){ 
     5216var _99=this.getChildBody(this.selected); 
     5217var _9a=this.getChildBodyText(_99); 
     5218this.classNames.refreshClassNames(_9a,this.defaultCss); 
     5219if(this.selected==_97.parentNode&&this.options.enableUnselected){ 
    52145220this.selected=false; 
    52155221this.defaultCss=false; 
    5216 if(_94){ 
     5222if(_98){ 
    52175223this.options.unselected(); 
    52185224} 
     
    52225228return false; 
    52235229},setSortable:function(){ 
    5224 var _97=Object.extend({dropOnEmpty:true,tree:true,hoverclass:"treeview_dirContainerHover",scroll:window,ghosting:true},this.options.sortOptions); 
    5225 Sortable.create(this.element,_97); 
    5226 },toggle:function(_98){ 
    5227 Event.stop(_98); 
    5228 var src=Event.element(_98); 
     5230var _9b=Object.extend({dropOnEmpty:true,tree:true,hoverclass:"treeview_dirContainerHover",scroll:window,ghosting:true},this.options.sortOptions); 
     5231Sortable.create(this.element,_9b); 
     5232},isDirectory:function(_9c){ 
     5233return Element.hasClassName(_9c,TreeView.className.dir); 
     5234},isClosed:function(_9d){ 
     5235return this.isDirectory(_9d)&&!this.getChildDirContainer(_9d).visible(); 
     5236},toggle:function(_9e){ 
     5237Event.stop(_9e); 
     5238var src=Event.element(_9e); 
    52295239this._toggle(this.getParentDir(src),Element.toggle); 
    5230 },_toggle:function(_9a,_9b){ 
    5231 _9a=$(_9a); 
    5232 if(_9a&&!Element.hasClassName(_9a,TreeView.className.dir)){ 
    5233 return; 
    5234 } 
    5235 var _9c=this.getChildDirContainer(_9a); 
    5236 if(!this.hasContents(_9c)&&!this.options.emptyImg){ 
    5237 return; 
    5238 } 
    5239 _9b(_9c); 
    5240 this.refreshStateImg(_9a); 
    5241 if(!this.hasContents(_9c)&&!this.options.emptyImg){ 
    5242 this.options.openDir(_9a,_9c); 
    5243 }else{ 
    5244 if(Element.visible(_9c)){ 
    5245 this.options.openDir(_9a,_9c); 
    5246 }else{ 
    5247 this.options.closeDir(_9a,_9c); 
     5240},_toggle:function(_a0,_a1){ 
     5241_a0=$(_a0); 
     5242if(_a0&&!Element.hasClassName(_a0,TreeView.className.dir)){ 
     5243return; 
     5244} 
     5245var _a2=this.getChildDirContainer(_a0); 
     5246if(!this.hasContents(_a2)&&!this.options.emptyImg){ 
     5247return; 
     5248} 
     5249_a1(_a2); 
     5250this.refreshStateImg(_a0); 
     5251if(!this.hasContents(_a2)&&!this.options.emptyImg){ 
     5252this.options.openDir(_a0,_a2); 
     5253}else{ 
     5254if(Element.visible(_a2)){ 
     5255this.options.openDir(_a0,_a2); 
     5256}else{ 
     5257this.options.closeDir(_a0,_a2); 
    52485258} 
    52495259} 
  • spinelz/trunk/compress/javascripts/spinelz/treeview.js

    r5520 r5743  
    33TreeView.iconId="treeview_icon"; 
    44TreeView.prototype={initialize:function(_1){ 
    5 this.options=Object.extend({dirSymbol:"dir",fileSymbol:"file",cssPrefix:"custom_",open:true,callBackFunctions:false,dirSelect:true,fileSelect:true,noSelectedInsert:true,iconIdPrefix:TreeView.iconId,move:false,unselected:Prototype.emptyFunction,enableUnselected:true,sortOptions:{},openDir:Prototype.emptyFunction,closeDir:Prototype.emptyFunction,emptyImg:false,initialSelected:null,build:true},arguments[1]||{}); 
     5this.options=Object.extend({dirSymbol:"dir",fileSymbol:"file",cssPrefix:"custom_",open:true,closeIds:[],callBackFunctions:false,dirSelect:true,fileSelect:true,noSelectedInsert:true,iconIdPrefix:TreeView.iconId,move:false,unselected:Prototype.emptyFunction,enableUnselected:true,sortOptions:{},openDir:Prototype.emptyFunction,closeDir:Prototype.emptyFunction,emptyImg:false,initialSelected:null,build:true},arguments[1]||{}); 
    66this.element=$(_1); 
    77this.customCss=CssUtil.appendPrefix(this.options.cssPrefix,TreeView.className); 
     
    135135}.bind(this)).join(" "); 
    136136var _1e=_1b.id||this.getBaseId(); 
    137 var _1f=this.getState(_1b); 
    138 var _20=this.options.iconIdPrefix.appendSuffix(_1e); 
    139 var _21=_20.appendSuffix("stateImg"); 
    140 var _22=_20.appendSuffix("dirBodyText"); 
    141 var _23=[this.classNames.joinClassNames("dirIcon"),_1c,this.classNames.joinClassNames("handle")]; 
    142 var _24=(this.options.open)?"":" style='display: none;'"; 
    143 this.dirIds.push({state:_21,icon:_20,bodyText:_22}); 
    144 var _25="<li id='"+_1e+"' class='"+this.classNames.joinClassNames("dir")+"'>"+"<div class='"+this.classNames.joinClassNames("dirBody")+"'>"+"<div id='"+_21+"' class='"+this.classNames.joinClassNames(_1f)+"'></div>"+"<div id='"+_20+"' class='"+_23.join(" ")+"'></div>"+"<span id='"+_22+"'class='"+this.classNames.joinClassNames("dirBodyText")+"'>"+this.getDirectoryText(_1b)+"</span>"+"</div>"+"<ul"+_24+" class='"+this.classNames.joinClassNames("dirContainer")+"'>"+this.buildSubContent(_1b)+"</ul>"+"</li>"; 
    145 return _25; 
    146 },buildSubContent:function(_26){ 
    147 var ul=$A(_26.childNodes).detect(function(_28){ 
    148 return Element.hasTagName(_28,"ul"); 
     137var _1f=this.options.closeIds.include(_1e); 
     138var _20=this.getState(_1b,_1f); 
     139var _21=this.options.iconIdPrefix.appendSuffix(_1e); 
     140var _22=_21.appendSuffix("stateImg"); 
     141var _23=_21.appendSuffix("dirBodyText"); 
     142var _24=[this.classNames.joinClassNames("dirIcon"),_1c,this.classNames.joinClassNames("handle")]; 
     143var _25=(this.options.open&&!_1f)?"":" style='display: none;'"; 
     144this.dirIds.push({state:_22,icon:_21,bodyText:_23}); 
     145var _26="<li id='"+_1e+"' class='"+this.classNames.joinClassNames("dir")+"'>"+"<div class='"+this.classNames.joinClassNames("dirBody")+"'>"+"<div id='"+_22+"' class='"+this.classNames.joinClassNames(_20)+"'></div>"+"<div id='"+_21+"' class='"+_24.join(" ")+"'></div>"+"<span id='"+_23+"'class='"+this.classNames.joinClassNames("dirBodyText")+"'>"+this.getDirectoryText(_1b)+"</span>"+"</div>"+"<ul"+_25+" class='"+this.classNames.joinClassNames("dirContainer")+"'>"+this.buildSubContent(_1b)+"</ul>"+"</li>"; 
     146return _26; 
     147},buildSubContent:function(_27){ 
     148var ul=$A(_27.childNodes).detect(function(_29){ 
     149return Element.hasTagName(_29,"ul"); 
    149150}); 
    150151if(ul){ 
    151 return $A(ul.childNodes).inject("",function(_29,_2a){ 
    152 return _29+this.build(_2a); 
     152return $A(ul.childNodes).inject("",function(_2a,_2b){ 
     153return _2a+this.build(_2b); 
    153154}.bind(this)); 
    154155}else{ 
    155156return ""; 
    156157} 
    157 },getState:function(_2b){ 
    158 if(!this.hasChildNodes(_2b)&&!this.options.emptyImg){ 
     158},getState:function(_2c,_2d){ 
     159if(!this.hasChildNodes(_2c)&&!this.options.emptyImg){ 
    159160return "state_empty"; 
    160161}else{ 
    161 if(this.options.open){ 
     162if(this.options.open&&!_2d){ 
    162163return "state_open"; 
    163164}else{ 
     
    165166} 
    166167} 
    167 },hasChildNodes:function(_2c){ 
    168 var ul=$A(_2c.childNodes).detect(function(_2e){ 
    169 return Element.hasTagName(_2e,"ul"); 
     168},getClosedIds:function(){ 
     169var _2e=$A($(this.element).getElementsByTagName("li")); 
     170return _2e.select(function(_2f){ 
     171return this.isClosed(_2f); 
     172}.bind(this)); 
     173},hasChildNodes:function(_30){ 
     174var ul=$A(_30.childNodes).detect(function(_32){ 
     175return Element.hasTagName(_32,"ul"); 
    170176}); 
    171177return ul&&(ul.childNodes.length!=0); 
    172 },buildFile:function(_2f){ 
    173 var _30=new Element.ClassNames(_2f).select(function(_31){ 
    174 return _31!=this.options.fileSymbol; 
     178},buildFile:function(_33){ 
     179var _34=new Element.ClassNames(_33).select(function(_35){ 
     180return _35!=this.options.fileSymbol; 
    175181}.bind(this)).join(" "); 
    176 var _32=_2f.id||this.getBaseId(); 
    177 var _33=this.options.iconIdPrefix.appendSuffix(_32); 
    178 var _34=[this.classNames.joinClassNames("fileIcon"),_30,this.classNames.joinClassNames("handle")]; 
    179 var _35=_32.appendSuffix("fileBodyText"); 
    180 this.fileIds.push({icon:_33,bodyText:_35}); 
    181 var _36=Element.attributeHTML(_2f,"onclick"); 
    182 var _37="<li id='"+_32+"' class='"+this.classNames.joinClassNames("file")+"' "+_36+">"+"<div class='"+this.classNames.joinClassNames("fileBody")+"'>"+"<div id='"+_33+"' class='"+_34.join(" ")+"'></div>"+"<span id='"+_35+"'class='"+this.classNames.joinClassNames("fileBodyText")+"'>"+_2f.innerHTML+"</span>"+"</div>"+"</li>"; 
    183 return _37
     182var _36=_33.id||this.getBaseId(); 
     183var _37=this.options.iconIdPrefix.appendSuffix(_36); 
     184var _38=[this.classNames.joinClassNames("fileIcon"),_34,this.classNames.joinClassNames("handle")]; 
     185var _39=_36.appendSuffix("fileBodyText"); 
     186this.fileIds.push({icon:_37,bodyText:_39}); 
     187var _3a=Element.attributeHTML(_33,"onclick"); 
     188var _3b="<li id='"+_36+"' class='"+this.classNames.joinClassNames("file")+"' "+_3a+">"+"<div class='"+this.classNames.joinClassNames("fileBody")+"'>"+"<div id='"+_37+"' class='"+_38.join(" ")+"'></div>"+"<span id='"+_39+"'class='"+this.classNames.joinClassNames("fileBodyText")+"'>"+_33.innerHTML+"</span>"+"</div>"+"</li>"; 
     189return _3b
    184190},getBaseId:function(){ 
    185191return this.element.id.appendSuffix(++this.idCount); 
     
    190196} 
    191197},observeDirEvent:function(){ 
    192 this.dirIds.each(function(_38){ 
    193 Event.observe(_38.state,"click",this.toggle.bindAsEventListener(this)); 
     198this.dirIds.each(function(_3c){ 
     199Event.observe(_3c.state,"click",this.toggle.bindAsEventListener(this)); 
    194200if(this.options.dirSelect){ 
    195 Event.observe(_38.icon,"click",this.selectDirItem.bindAsEventListener(this)); 
    196 Event.observe(_38.bodyText,"click",this.selectDirItem.bindAsEventListener(this)); 
     201Event.observe(_3c.icon,"click",this.selectDirItem.bindAsEventListener(this)); 
     202Event.observe(_3c.bodyText,"click",this.selectDirItem.bindAsEventListener(this)); 
    197203} 
    198204}.bind(this)); 
    199205},observeFileEvent:function(){ 
    200 this.fileIds.each(function(_39){ 
    201 Event.observe(_39.icon,"click",this.selectFileItem.bindAsEventListener(this)); 
    202 Event.observe(_39.bodyText,"click",this.selectFileItem.bindAsEventListener(this)); 
     206this.fileIds.each(function(_3d){ 
     207Event.observe(_3d.icon,"click",this.selectFileItem.bindAsEventListener(this)); 
     208Event.observe(_3d.bodyText,"click",this.selectFileItem.bindAsEventListener(this)); 
    203209}.bind(this)); 
    204210},convertJSON:function(){ 
    205211return JSON.stringify(this.parse()); 
    206 },getChildBody:function(_3a){ 
    207 var _3b=[TreeView.className.fileBody,TreeView.className.dirBody]; 
    208 return Element.getFirstElementByClassNames(_3a,_3b); 
    209 },getChildBodyText:function(_3c){ 
    210 var _3d=[TreeView.className.fileBodyText,TreeView.className.fileBodyTextActive,TreeView.className.dirBodyText,TreeView.className.dirBodyTextActive]; 
    211 return Element.getFirstElementByClassNames(_3c,_3d); 
    212 },getChildBodyTextNode:function(_3e){ 
    213 var _3f=this.getChildBody(_3e); 
    214 var _40=this.getChildBodyText(_3f); 
    215 return this.searchTextNode(_40); 
    216 },getChildDir:function(_41){ 
    217 return document.getElementsByClassName(TreeView.className.dir,_41); 
    218 },getChildDirBody:function(_42){ 
    219 return document.getElementsByClassName(TreeView.className.dirBody,_42)[0]; 
    220 },getChildDirContainer:function(_43){ 
    221 return document.getElementsByClassName(TreeView.className.dirContainer,_43)[0]; 
    222 },getChildStateImg:function(_44){ 
    223 var _45=this.getChildDirBody(_44); 
    224 var _46=[TreeView.className.state_close,TreeView.className.state_open,TreeView.className.state_empty]; 
    225 return Element.getFirstElementByClassNames(_45,_46); 
    226 },getChildren:function(_47,_48,_49){ 
    227 var _4a
    228 var _4b=new Array(); 
    229 if(_47){ 
    230 _4a=$(_47).getElementsByTagName("ul")[0]; 
    231 }else{ 
    232 _4a=this.element; 
    233 } 
    234 $A(Element.getTagNodes(_4a)).each(function(_4c){ 
    235 if(!_48&&Element.hasClassName(_4c,TreeView.className.dir)){ 
    236 _4b.push(_4c); 
    237 } 
    238 if(!_49&&Element.hasClassName(_4c,TreeView.className.file)){ 
    239 _4b.push(_4c); 
    240 } 
    241 }); 
    242 return _4b
    243 },getDirectoryContents:function(_4d){ 
    244 return $A(_4d.childNodes).findAll(function(_4e){ 
    245 if((_4e.nodeType!=1)){ 
     212},getChildBody:function(_3e){ 
     213var _3f=[TreeView.className.fileBody,TreeView.className.dirBody]; 
     214return Element.getFirstElementByClassNames(_3e,_3f); 
     215},getChildBodyText:function(_40){ 
     216var _41=[TreeView.className.fileBodyText,TreeView.className.fileBodyTextActive,TreeView.className.dirBodyText,TreeView.className.dirBodyTextActive]; 
     217return Element.getFirstElementByClassNames(_40,_41); 
     218},getChildBodyTextNode:function(_42){ 
     219var _43=this.getChildBody(_42); 
     220var _44=this.getChildBodyText(_43); 
     221return this.searchTextNode(_44); 
     222},getChildDir:function(_45){ 
     223return document.getElementsByClassName(TreeView.className.dir,_45); 
     224},getChildDirBody:function(_46){ 
     225return document.getElementsByClassName(TreeView.className.dirBody,_46)[0]; 
     226},getChildDirContainer:function(_47){ 
     227return document.getElementsByClassName(TreeView.className.dirContainer,_47)[0]; 
     228},getChildStateImg:function(_48){ 
     229var _49=this.getChildDirBody(_48); 
     230var _4a=[TreeView.className.state_close,TreeView.className.state_open,TreeView.className.state_empty]; 
     231return Element.getFirstElementByClassNames(_49,_4a); 
     232},getChildren:function(_4b,_4c,_4d){ 
     233var _4e
     234var _4f=new Array(); 
     235if(_4b){ 
     236_4e=$(_4b).getElementsByTagName("ul")[0]; 
     237}else{ 
     238_4e=this.element; 
     239} 
     240$A(Element.getTagNodes(_4e)).each(function(_50){ 
     241if(!_4c&&Element.hasClassName(_50,TreeView.className.dir)){ 
     242_4f.push(_50); 
     243} 
     244if(!_4d&&Element.hasClassName(_50,TreeView.className.file)){ 
     245_4f.push(_50); 
     246} 
     247}); 
     248return _4f
     249},getDirectoryContents:function(_51){ 
     250return $A(_51.childNodes).findAll(function(_52){ 
     251if((_52.nodeType!=1)){ 
    246252return false; 
    247253} 
    248 if(_4e.tagName.toLowerCase()=="li"){ 
     254if(_52.tagName.toLowerCase()=="li"){ 
    249255return true; 
    250256} 
    251257return false; 
    252258}); 
    253 },getDirectoryText:function(_4f){ 
    254 return $A(_4f.childNodes).inject("",function(_50,_51){ 
    255 if(Element.isTextNode(_51)){ 
    256 _50+=_51.nodeValue; 
    257 }else{ 
    258 if(_51.tagName.toLowerCase()!="ul"){ 
    259 _50+=Element.outerHTML(_51); 
    260 } 
    261 } 
    262 return _50
     259},getDirectoryText:function(_53){ 
     260return $A(_53.childNodes).inject("",function(_54,_55){ 
     261if(Element.isTextNode(_55)){ 
     262_54+=_55.nodeValue; 
     263}else{ 
     264if(_55.tagName.toLowerCase()!="ul"){ 
     265_54+=Element.outerHTML(_55); 
     266} 
     267} 
     268return _54
    263269}); 
    264270},getHierarchyNumber:function(){ 
     
    266272return; 
    267273} 
    268 var _52=this.selected; 
     274var _56=this.selected; 
    269275var i=0; 
    270276while(true){ 
    271 if(this.element==_52){ 
     277if(this.element==_56){ 
    272278return i; 
    273279}else{ 
    274 _52=this.getParentDir(_52,true); 
    275 if(!_52){ 
     280_56=this.getParentDir(_56,true); 
     281if(!_56){ 
    276282return; 
    277283} 
     
    282288var arr=[]; 
    283289if(this.selected){ 
    284 var _55=this.selected; 
    285 arr.push(_55); 
    286 while(_55){ 
    287 _55=this.getParentDir(_55,false); 
    288 if(_55){ 
    289 arr.push(_55); 
     290var _59=this.selected; 
     291arr.push(_59); 
     292while(_59){ 
     293_59=this.getParentDir(_59,false); 
     294if(_59){ 
     295arr.push(_59); 
    290296} 
    291297} 
    292298} 
    293299return arr.reverse(); 
    294 },getParentDir:function(_56,top){ 
    295 var _58=Element.getParentByClassName(TreeView.className.dir,_56); 
    296 if(!_58&&top){ 
    297 _58=Element.getParentByClassName(TreeView.className.top,_56); 
    298 } 
    299 return _58
    300 },hasContents:function(_59){ 
    301 if(_59){ 
    302 if(!Element.hasClassName(_59,TreeView.className.dirContainer)&&!Element.hasClassName(_59,TreeView.className.top)){ 
     300},getParentDir:function(_5a,top){ 
     301var _5c=Element.getParentByClassName(TreeView.className.dir,_5a); 
     302if(!_5c&&top){ 
     303_5c=Element.getParentByClassName(TreeView.className.top,_5a); 
     304} 
     305return _5c
     306},hasContents:function(_5d){ 
     307if(_5d){ 
     308if(!Element.hasClassName(_5d,TreeView.className.dirContainer)&&!Element.hasClassName(_5d,TreeView.className.top)){ 
    303309return false; 
    304310} 
    305 var _5a=_59.childNodes; 
    306 for(var i=0;i<_5a.length;i++){ 
    307 if(_5a[i].nodeType==1){ 
    308 if(Element.hasClassName(_5a[i],TreeView.className.dir)||Element.hasClassName(_5a[i],TreeView.className.file)){ 
     311var _5e=_5d.childNodes; 
     312for(var i=0;i<_5e.length;i++){ 
     313if(_5e[i].nodeType==1){ 
     314if(Element.hasClassName(_5e[i],TreeView.className.dir)||Element.hasClassName(_5e[i],TreeView.className.file)){ 
    309315return true; 
    310316} 
     
    313319} 
    314320return false; 
    315 },parse:function(_5c){ 
    316 if(!_5c){ 
    317 _5c=this.element; 
    318 } 
    319 var _5d=[]; 
    320 var _5e=this.getDirectoryContents(_5c); 
    321 for(var i=0;i<_5e.length;i++){ 
    322 var _60=_5e[i]; 
    323 var _61=this.getChildBody(_60); 
    324 var _62=this.getChildBodyText(_61); 
    325 var _63={}; 
    326 _63.id=_60.id; 
    327 _63.name=Element.collectTextNodes(_62).replace(/\n/,""); 
    328 if(Element.hasClassName(_60,TreeView.className.dir)){ 
    329 _63.type=this.options.dirSymbol; 
    330 _63.contents=this.parse(this.getChildDirContainer(_60)); 
    331 }else{ 
    332 _63.type=this.options.fileSymbol; 
    333 } 
    334 _5d.push(_63); 
    335 } 
    336 return _5d
    337 },refreshStateImg:function(_64){ 
    338 if(!Element.hasClassName(_64,TreeView.className.dir)){ 
    339 return; 
    340 } 
    341 var _65=this.getChildDirContainer(_64); 
    342 var img=this.getChildStateImg(_64); 
    343 if(!this.hasContents(_65)&&!this.options.emptyImg){ 
     321},parse:function(_60){ 
     322if(!_60){ 
     323_60=this.element; 
     324} 
     325var _61=[]; 
     326var _62=this.getDirectoryContents(_60); 
     327for(var i=0;i<_62.length;i++){ 
     328var _64=_62[i]; 
     329var _65=this.getChildBody(_64); 
     330var _66=this.getChildBodyText(_65); 
     331var _67={}; 
     332_67.id=_64.id; 
     333_67.name=Element.collectTextNodes(_66).replace(/\n/,""); 
     334if(Element.hasClassName(_64,TreeView.className.dir)){ 
     335_67.type=this.options.dirSymbol; 
     336_67.contents=this.parse(this.getChildDirContainer(_64)); 
     337}else{ 
     338_67.type=this.options.fileSymbol; 
     339} 
     340_61.push(_67); 
     341} 
     342return _61
     343},refreshStateImg:function(_68){ 
     344if(!Element.hasClassName(_68,TreeView.className.dir)){ 
     345return; 
     346} 
     347var _69=this.getChildDirContainer(_68); 
     348var img=this.getChildStateImg(_68); 
     349if(!this.hasContents(_69)&&!this.options.emptyImg){ 
    344350this.classNames.refreshClassNames(img,"state_empty"); 
    345351}else{ 
    346 if(Element.visible(_65)){ 
     352if(Element.visible(_69)){ 
    347353this.classNames.refreshClassNames(img,"state_open"); 
    348354}else{ 
     
    350356} 
    351357} 
    352 },removeById:function(_67){ 
    353 _67=$(_67); 
    354 if(_67){ 
    355 var _68=_67.parentNode.parentNode; 
    356 Element.remove(_67); 
    357 this.refreshStateImg(_68); 
    358 } 
    359 },removeByPath:function(_69){ 
    360 var _6a=_69.split("/").findAll(function(elm){ 
     358},removeById:function(_6b){ 
     359_6b=$(_6b); 
     360if(_6b){ 
     361var _6c=_6b.parentNode.parentNode; 
     362Element.remove(_6b); 
     363this.refreshStateImg(_6c); 
     364} 
     365},removeByPath:function(_6d){ 
     366var _6e=_6d.split("/").findAll(function(elm){ 
    361367return (elm!=""); 
    362368}); 
    363 var _6c=_6a.pop(); 
    364 var _6d=this.search(_6a.join("/")); 
    365 var _6e=this.getDirectoryContents(_6d)[_6c]; 
    366 if(_6e){ 
    367 this.removeById(_6e); 
     369var _70=_6e.pop(); 
     370var _71=this.search(_6e.join("/")); 
     371var _72=this.getDirectoryContents(_71)[_70]; 
     372if(_72){ 
     373this.removeById(_72); 
    368374} 
    369375},removeBySelected:function(){ 
     
    373379this.removeById(this.selected); 
    374380this.selected=false; 
    375 },renameById:function(_6f,_70){ 
    376 _70=$(_70); 
    377 if(!Element.hasClassName(_70,TreeView.className.dir)&&!Element.hasClassName(_70,TreeView.className.file)){ 
    378 return; 
    379 } 
    380 var _71=this.getChildBodyTextNode(_70); 
    381 _71.nodeValue=_6f
    382 },renameByPath:function(_72,_73){ 
    383 var _74=_73.split("/").findAll(function(elm){ 
     381},renameById:function(_73,_74){ 
     382_74=$(_74); 
     383if(!Element.hasClassName(_74,TreeView.className.dir)&&!Element.hasClassName(_74,TreeView.className.file)){ 
     384return; 
     385} 
     386var _75=this.getChildBodyTextNode(_74); 
     387_75.nodeValue=_73
     388},renameByPath:function(_76,_77){ 
     389var _78=_77.split("/").findAll(function(elm){ 
    384390return (elm!=""); 
    385391}); 
    386 var _76=_74.pop(); 
    387 var _77=this.search(_74.join("/")); 
    388 var _78=this.getDirectoryContents(_77)[_76]; 
    389 if(_78){ 
    390 this.renameById(_72,_78); 
    391 } 
    392 },renameBySelected:function(_79){ 
     392var _7a=_78.pop(); 
     393var _7b=this.search(_78.join("/")); 
     394var _7c=this.getDirectoryContents(_7b)[_7a]; 
     395if(_7c){ 
     396this.renameById(_76,_7c); 
     397} 
     398},renameBySelected:function(_7d){ 
    393399if(!this.selected){ 
    394400return; 
    395401} 
    396 this.renameById(_79,this.selected); 
    397 },search:function(_7a){ 
    398 var _7b=_7a.split("/").findAll(function(elm){ 
     402this.renameById(_7d,this.selected); 
     403},search:function(_7e){ 
     404var _7f=_7e.split("/").findAll(function(elm){ 
    399405return (elm!=""); 
    400406}); 
    401 var _7d=this.element; 
    402 for(var i=0;i<_7b.length;i++){ 
    403 var num=_7b[i]; 
    404 var _80=this.getDirectoryContents(_7d); 
    405 if(_80[num]&&Element.hasClassName(_80[num],TreeView.className.dir)){ 
    406 _7d=this.getChildDirContainer(_80[num]); 
     407var _81=this.element; 
     408for(var i=0;i<_7f.length;i++){ 
     409var num=_7f[i]; 
     410var _84=this.getDirectoryContents(_81); 
     411if(_84[num]&&Element.hasClassName(_84[num],TreeView.className.dir)){ 
     412_81=this.getChildDirContainer(_84[num]); 
    407413}else{ 
    408414return false; 
    409415} 
    410416} 
    411 return _7d
    412 },searchTextNode:function(_81){ 
    413 var _82=null; 
    414 var _83=_81.childNodes; 
    415 for(var i=0;i<_83.length;i++){ 
    416