Server Side JavaScript with ASP
code
/* *
*ClassNavigator
*@authorKimSoft
*@versionbuild2006-07-0917:46
*@copyright2006KimSoftAllRightsReserved.
*/
function Navigator(boardId) {
this ._boardId = boardId;
this ._db = $singleton( function () { return new DB();} )();
this ._nodes = [];
}
/* *
*@paramboardIdasboardid
*@exceptionthrowitwhereexcutedbquery
*/
Navigator.prototype.getNodes = function (boardId) {
var sql = " selectid,parentId,textfromboardwhereid=? " ;
var parentId,text;
try {
var rst = 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 ;
delete this ._db;
return this ._nodes.reverse().join(seperator || " -> " );
} ;
// Response.Write(newNavigator(145).toString());//fortest