Apache velocity template with ztree -


both of velocity , ztree new technology me. read velocity , ztree. my problem how show output ztree. please advice me..

here code...

    <html>     <head>         #[[             <meta http-equiv="content-type" content="text/html; charset=utf-8">             <link rel="stylesheet" href="tree/demo.css" type="text/css">             <link rel="stylesheet" href="tree/ztreestyle.css" type="text/css">             <script type="text/javascript" src="tree/js/jquery-1.4.4.min.js"></script>             <script type="text/javascript" src="tree/js/jquery.ztree.core-3.5.js"></script>             <script type="text/javascript">         </script> <script type="text/javascript">             function toggle(t) {             if(document.getelementbyid("div"+t).style.display == "none") {                 document.getelementbyid("div"+t).style.display = "block";                 document.getelementbyid("imgminus"+t).style.display = "block";                 document.getelementbyid("imgplus"+t).style.display = "none";             } else {                 document.getelementbyid("div"+t).style.display = "none";                 document.getelementbyid("imgminus"+t).style.display = "none";                 document.getelementbyid("imgplus"+t).style.display = "block";             }         }          </script>         <script type="text/javascript">         <!--         var setting = {             data: {                 simpledata: {                     enable: true                 }             }         };          var znodes =[             { id:1, pid:0, name:"pnode 1", open:true},             { id:11, pid:1, name:"pnode 11"},             { id:111, pid:11, name:"leaf node 111"},             { id:112, pid:11, name:"leaf node 112"},             { id:113, pid:11, name:"leaf node 113"},             { id:114, pid:11, name:"leaf node 114"},             { id:12, pid:1, name:"pnode 12"},             { id:121, pid:12, name:"leaf node 121"},         ];          $(document).ready(function(){             $.fn.ztree.init($("#treedemo"), setting, znodes);         });         //-->     </script>         ]]#      </head>     <body>           <div class="content_wrap">             <div>                 <ul id="treedemo" class="ztree"></ul>             </div>         </div>         #set( $countid = 0 )         #createsvnindexhtml($logentrylist)     </body> </html>  #macro(createsvnindexhtml $logentrylist)      #foreach ($child in $logentrylist)         #set( $countid = $countid + 1 )                 #if( $child.childnodes.size() > 0 )                     <li>                 #else                     <li>                 #end                 <table>                 <tr>                     <td>                         #if( $child.childnodes.size() > 0 )                              <img id="imgminus$countid" onclick="toggle('$countid')" src="#if($path)$path\tree\img\minus.gif#{else}.\config\img\minus.gif#end" />                             <img id="imgplus$countid" style="display:none;" onclick="toggle('$countid')" src="#if($path)$path\tree\img\plus.gif#{else}.\config\img\plus.gif#end" />                         #end                         #set( $filename = "log/$child.filename")                      </td>                     <td>                         <a href="$filename">$child.name</a>                     </td>                 </tr>             </table>             #if( $child.childnodes.size() > 0 )                 <ul id="div$countid" class="ztree">                     #createsvnindexhtml($child.childnodes)                 </ul>             #end             </li>         #end     #end 

*note:*i got tree view code(not include ztree script copy ztree example)

finally got answer.here code.

    <html>     <head>         #[[             <meta http-equiv="content-type" content="text/html; charset=utf-8">             <link rel="stylesheet" href="tree/demo.css" type="text/css">             <link rel="stylesheet" href="tree/ztreestyle.css" type="text/css">             <script type="text/javascript" src="tree/js/jquery-1.4.4.min.js"></script>             <script type="text/javascript" src="tree/js/jquery.ztree.core-3.5.js"></script>         ]]#         <script type="text/javascript">             var setting = {                 data: {                     simpledata: {                         enable:true,                         idkey: "id",                         pidkey: "pid",                         rootpid: ""                     }                 },                 callback: {                     beforeclick: function(treeid, treenode) {                         window.open(treenode.file, "_blank", 'toolbar=0,location=0,menubar=0');                         return true;                     }                 }             };              var znodes =[                 #createsvnindexhtml($logentrylist)             ];              $(document).ready(function(){                 $.fn.ztree.init($("#treedemo"), setting, znodes);             });          </script>            </head>     <body>               <center><h1>z tree</h1></center>                 <div>             <ul id="treedemo" class="ztree"></ul>         </div>     </body> </html>  #macro(createsvnindexhtml $logentrylist)     #foreach ($child in $logentrylist)         #if( !$child.parentnode )             {id:$child.id, pid:0, name:"$child.name", file:"log/$child.filename"},         #else             {id:$child.id, pid:$child.parentnode.id, name:"$child.name", file:"log/$child.filename"},         #end         #if( $child.childnodes.size() > 0 )             #createsvnindexhtml($child.childnodes)         #end             #end #end 

Comments

Popular posts from this blog

how to proxy from https to http with lighttpd -

android - Automated my builds -

python - Flask migration error -