<public:component>
<public:attach event="oncontentready" onevent="Init()" />
<public:attach event="onclick" onevent="Click()" />
<public:attach event="onmousedown" onevent="MouseDown()" />
<public:attach event="onmouseover" onevent="MouseOver()" />
<public:attach event="onmouseout" onevent="MouseOut()" />
<public:attach event="onmouseup" onevent="MouseUp()" />
<public:attach event="onselectstart" onevent="SelectStart()" />
<public:method name="movenext" />
<public:method name="moveprevious" />
<public:method name="Sync" />
<script language="JScript">
//-----------------------------------------------
// Copyright ?2001 Microsoft Corporation
//
// Author(s): Grant Harris
// Bryn Waibel
//
//-----------------------------------------------
var objLI_Current = null;
var strRootPath = "";
var oConfig = null;
var strXSLSrc = "dptree/deeptree.xsl"; // part of deeptree, probably should be hard-coded into htc
objXSLDoc = new ActiveXObject("Microsoft.XMLDOM");
objXSLDoc.async = false;
objXSLDoc.load( strXSLSrc );
var m_iMaxCalls = 1024;
var m_aoCalls = new Array();
var m_iLastCall = 0;
var m_iMasterIdx = null;
var m_bSyncFailed = false;
var m_sTempNodeStart = "<div class='clsItem' type='leaf'><span class='clsSpace' type='img'><span class='clsLeaf'>.</span></span><span class='clsLabel' type='label'><span class='clsUnavailable'>";
var m_sTempNodeEnd = "</span></span></div>";
var m_sUnavailableText = "未知错误,无法加载";
var m_sLoadingText = "正在加载,请稍候 ...";
function GetQueryValue(sorStr,panStr)
{
var vStr="";
if (sorStr==null || sorStr=="" || panStr==null || panStr=="") return vStr;
sorStr = sorStr.toLowerCase();
panStr += "=";
var itmp=sorStr.indexOf(panStr);
if (itmp<0){return vStr;}
sorStr = sorStr.substr(itmp + panStr.length);
itmp=sorStr.indexOf("&");
if (itmp<0)
{
return sorStr;
}
else
{
sorStr=sorStr.substr(0,itmp);
return sorStr;
}
}
var csdnstyle = GetQueryValue(top.document.location.search,'csdnstyle');
//-----------------------------------------------
// GetXML(strXMLSrc, strXSLsrc)
//-----------------------------------------------
function GetXML( strXMLSrc , oEl , oElClass , oSync )
{
var aryXMLNodes;
var i = 0;
var strRetVal = "";
var iCall = fnAllocCall();
var objXMLDoc = new ActiveXObject("Microsoft.XMLDOM");
objXMLDoc.async = true;
m_aoCalls[iCall] = new CallObject( objXMLDoc , oEl , oElClass , oSync );
objXMLDoc.onreadystatechange = Function( "fnLoadComplete( " + iCall + " );" );
objXMLDoc.load( strXMLSrc );
return iCall;
}
//-------------------------------------------------------------------------------------------------
// EVENT HANDLERS
//-------------------------------------------------------------------------------------------------
//-----------------------------------------------
// Init()
//-----------------------------------------------
function Init()
{
var strHTML;
var objLI;
// Set up global tree accessors.
// TODO:: check that these have not been overridden by
// another consuming application.
// TODO:: encapsulate global accessors in other functionality
// as well (dtbar,searchtab,contentbar should set themselves,
// rather than doing it here)
/* window.top.deeptree = element;
window.top.dtbar = top.frames.fraLeftFrame.frames.fraDTBar;
window.top.contentbar = top.frames.fraRightFrame.frames.fraContentBar;
window.top.content = top.frames.fraRightFrame.frames.fraContent;
window.top.searchtab = top.frames.fraLeftFrame.frames.fraSearchTab;
window.top.leftframe = top.frames.fraLeftFrame;
window.top.rightframe = top.frames.fraRightFrame;
window.top.mainframeset = top.document.all.fstMain;
*/
window.top.deeptree = element;
window.top.dtbar = null;
window.top.contentbar = null;
window.top.content = top.frames.clientFrame;
window.top.leftframe = top.frames.listFrame;
window.top.rightFrame = top.frames.clientFrame;
window.top.mainframeset = top.document.all.frmset;
oConfig = new Config
element.type = "container";
m_iMasterIdx = GetXML( oConfig.sTopXmlSrc , element , "deeptree" );
//alert(m_iMasterIdx);
window.document.body.attachEvent("onkeydown",KeyDown);
//alert(window.top.deeptree);
}
//-----------------------------------------------
// Click()
//-----------------------------------------------
function Click()
{
var objUnknown;
var objLI;
objUnknown = window.event.srcElement;
window.event.cancelBubble = true;
window.event.returnValue = false;
window.document.body.focus();
//alert(objUnknown.tagName.toUpperCase());
if( objUnknown.tagName.toUpperCase() == "A" )
{
//alert("44");
objLI = objUnknown.parentElement.parentElement;
SelectNode(objLI, false, false);
/* do not open child list
* modified by chenglong
*/
//ToggleNode(objLI);
}
else if( null != objUnknown.parentElement && objUnknown.parentElement.type == "img" )
{
//alert("33");
objLI = objUnknown.parentElement.parentElement;
if ( objLI.type == "leaf" )
{
SelectNode( objLI, false, false );
}
else
{
ToggleNode(objLI);
}
}
else if( objUnknown.type == "img" )
{
//alert("22");
objLI = objUnknown.parentElement;
if ( objLI.type == "leaf" )
{
SelectNode( objLI, false, false );
}
else
{
ToggleNode(objLI);
}
}
else if( objUnknown.type == "label" )
{
//alert("11");
objLI = objUnknown.parentElement;
SelectNode(objLI, false, false );
ToggleNode(objLI);
}
else
{
//alert("55");
SelectNode(objLI_Current, true, false);
}
return false;
}
//-----------------------------------------------
// KeyDown()
//-----------------------------------------------
function KeyDown()
{
var blnRetVal = false
var objLI;
if (window.event.ctrlKey == false && window.event.altKey == false)
{
window.event.cancelBubble = true;
window.event.returnValue = false;
switch (window.event.keyCode)
{
case 9 : // tab key
if (window.event.shiftKey == true)
{
MovePrevious();
}
else
{
MoveNext();
}
break;
case 13 : // enter key
objLI = window.event.srcElement.parentElement;
LoadNodeContent(objLI);
break;
case 37 : // left key
MoveLeft()
break;
case 38 : // up key
MoveUp()
break;
case 39 : // right key
MoveRight()
break;
case 40 : // down key
MoveDown()
break;
case 188 : // "<" key
MovePrevious();
break;
case 190 : // ">" key
MoveNext();
break;
default :
window.event.cancelBubble = false;
window.event.returnValue = true;
blnRetVal = true;
break;
}
}
else
{
window.event.cancelBubble = false;
window.event.returnValue = true;
blnRetVal = true;
}
return blnRetVal;
}
//-----------------------------------------------
// MouseDown()
//-----------------------------------------------
function MouseDown()
{
var objUnknown;
objUnknown = window.event.srcElement;
if (objUnknown.tagName.toUpperCase() == "A")
{
objUnknown = objUnknown.parentElement;
}
if (objUnknown.type == "label")
{
objUnknown.className = 'clsMouseDown';
}
return true;
}
//-----------------------------------------------
// MouseOut()
//-----------------------------------------------
function MouseOut()
{
var objUnknown;
var obj