Tree
Access
{{reader}}
Favourite Pages
{{pageEntry.pageName}}
Signed in as {{currentUser}} {{avatar}}
Sign Out
Sign In as Different User
{{currentUserExtraOptions}}
OpenForum
Javascript
Tree
//OpenForum/Javascript/Tree/get.sjs
var action = transaction.getParameter("action"); if(action===null) { transaction.setResult(transaction.SHOW_PAGE); return; } try{ action = ""+action; if(action==="getPageTree") { var targetPage = ""+transaction.getParameter("pageName"); if(targetPage.charAt(0)!='/') { targetPage = "/"+targetPage; } var matcher = transaction.getParameter("match"); if(matcher!=null) matcher = "" + matcher; var pageOffset = transaction.getParameter("pageOffset"); if(pageOffset==null) { pageOffset = 0; } else { pageOffset = parseInt(""+pageOffset,10); } var fileOffset = transaction.getParameter("fileOffset"); if(fileOffset==null) { fileOffset = 0; } else { fileOffset = parseInt(""+fileOffset,10); } var treeData = null; var tree = js.getObject("/OpenForum/Javascript/Tree","Tree.sjs"); treeData = JSON.stringify( tree.createFileTree(targetPage,matcher,fileOffset,pageOffset) ); transaction.sendJSON( treeData ); } else if(action==="getSubPages") { var targetPage = ""+transaction.getParameter("pageName"); if(targetPage.charAt(0)!='/') { targetPage = "/"+targetPage; } var pages = js.getObject("/OpenForum/Javascript/Tree","Pages.sjs"); var list = pages.getSubPages(targetPage); transaction.sendJSON( JSON.stringify(list) ); } }catch(e) { transaction.sendJSON( JSON.stringify({result: "error",message: "Error:"+e+" on line "+e.lineNumber})); }
An error has occurred.
{{OpenForum.errorMessage}}
See technical details
×
Error details.
{{OpenForum.error}}
×
{{OpenForum.alert.title}}
{{OpenForum.alert.message}}
×