Server Side JavaScript with ASP
code


/**//**
*ClassNavigator
*@authorKimSoft
*@versionbuild2006-07-0917:46
*@copyright2006KimSoftAllRightsReserved.
*/
functionNavigator(boardId)...{
this._boardId=boardId;
this._db=$singleton(function()...{returnnewDB();})();
this._nodes=[];
}
/**//**
*@paramboardIdasboardid
*@exceptionthrowitwhereexcutedbquery
*/
Navigator.prototype.getNodes=function(boardId)...{
varsql="selectid,parentId,textfromboardwhereid=?";
varparentId,text;
try...{
varrst=this._db.query(sql,boardId);
if(!rst.eof)...{
parentId=parseInt(rst.fields("parentId").value);
this._nodes[this._nodes.length]=$empty(rst.fields("text").value);
//this._nodes[this._nodes.length]=$empty(rst.fields("text").value).link("post.asp?act=list&boardId="+boardId);
this.getNodes(parentId);
}
rst.close();
rst=null;
}
catch(e)...{
if($debug.flag==true)...{
throw(e);
}
this._nodes=[];
}
};
/**//**
*@seperatordefaultas"->"
*@returnstring
*/
Navigator.prototype.toString=function(seperator)...{
this.getNodes(this._boardId);
this._db=null;
deletethis._db;
returnthis._nodes.reverse().join(seperator||"->");
};
//Response.Write(newNavigator(145).toString());//fortest


1579

被折叠的 条评论
为什么被折叠?



