3 class NP_TreeMenu extends NucleusPlugin {
5 function getName() { return 'JavaScript Tree Menu'; }
6 function getAuthor() { return 'nakahara21'; }
7 function getURL() { return 'http://nakahara21.com/'; }
8 function getVersion() { return '0.5'; }
9 function getDescription() { return 'JavaScript DHTML navigation'; }
11 function supportsFeature($what) {
13 { case 'SqlTablePrefix':
22 function unInstall() {
26 function doSkinVar($skinType){
27 global $CONF, $manager;
28 $fileName = $CONF['ActionURL'].'?action=plugin&name=TreeMenu&type=f';
30 <script language="JavaScript" src="<?php echo $this->getAdminURL(); ?>ua.js"></script>
31 <script language="JavaScript" src="<?php echo $this->getAdminURL(); ?>ftiens4.js"></script>
32 <script language="JavaScript" src="<?php echo $fileName; ?>"></script>
34 <a style="display:none;" href="http://www.treemenu.net/" target=_blank>Menu</a>
36 <span class=TreeviewSpanArea>
37 <script>initializeDocument()</script>
38 <a style="font-size:7pt;text-decoration:none;color:silver" href="http://www.treemenu.net/" target=_blank>* By treemenu.net</a>
41 A tree for site navigation will open here if you enable JavaScript in your browser.
50 function doAction($type) {
52 global $manager, $CONF;
53 $aurl = $this->getAdminURL();
57 // You can find instructions for this file at http://www.treeview.net
59 //Environment variables are usually set at the top of this file.
67 ICONPATH = '{$aurl}icons/'
70 HIGHLIGHT_BG = 'silver'
72 GLOBALTARGET = "S" // variable only applicable for addChildren uses
74 foldersTree = gFld("Home", "{$CONF['IndexURL']}")
80 // You can find instructions for this file at http://www.treeview.net
82 //Environment variables are usually set at the top of this file.
89 ICONPATH = '{$aurl}icons/'
91 foldersTree = gFld("Home", "{$CONF['IndexURL']}")
95 $query = 'SELECT bnumber as blogid, bname as blogname, burl as blogurl, bshortname, bdesc as blogdesc';
96 $query .= ' FROM '.sql_table('blog').' b';
97 $query .= ' ORDER BY bnumber';
99 $res = sql_query($query);
101 while ($o = mysql_fetch_object($res)) {
102 $this->bid = $o->blogid;
103 $burl = createBlogidLink($o->blogid);
104 echo 'blog'.$bn.' = insFld(foldersTree, gFld("'.$o->blogname.'", "'.$burl.'"))'."\n";
105 $cquery = 'SELECT c.catid as catid, c.cname as catname, c.cdesc as catdesc'
106 .' FROM '.sql_table('category').' as c'
107 .' WHERE c.cblog='.$o->blogid
108 .' ORDER BY c.catid';
109 $cres = sql_query($cquery);
111 while ($co = mysql_fetch_object($cres)) {
112 $curl = createBlogidLink($this->bid, array('catid'=>$co->catid));
113 echo 'cat'.$cn.' = insFld(blog'.$bn.', gFld("'.$co->catname.'", "'.$curl.'"))'."\n";
114 if ($manager->pluginInstalled('NP_MultipleCategories')) {
115 $sres = sql_query("SELECT scatid as subcatid, sname as subname, sdesc as subdesc FROM ".sql_table('plug_multiple_categories_sub')." WHERE catid=".$co->catid." AND parentid=0");
116 if (mysql_num_rows($sres) > 0) {
118 while ($so = mysql_fetch_object($sres)) {
119 $surl = createBlogidLink($this->bid, array('catid'=>$co->catid, 'subcatid'=>$so->subcatid));
120 $nodeName = 'scat'.$sn;
121 echo $nodeName.' = insFld(cat'.$cn.', gFld("'.$so->subname.'", "'.$surl.'"))'."\n";
123 echo $this->scanChild($nodeName, $so->subcatid, $co->catid);
138 aux1 = insFld(foldersTree, gFld("Expand for example with pics and flags", "javascript:undefined"))
139 aux2 = insFld(aux1, gFld("United States", "demoFrameless.html?pic=%22beenthere_unitedstates%2Egif%22"))
140 insDoc(aux2, gLnk("S", "Boston", "demoFrameless.html?pic=%22beenthere_boston%2Ejpg%22"))
141 insDoc(aux2, gLnk("S", "Tiny pic of New York City", "demoFrameless.html?pic=%22beenthere_newyork%2Ejpg%22"))
142 insDoc(aux2, gLnk("S", "Washington", "demoFrameless.html?pic=%22beenthere_washington%2Ejpg%22"))
143 aux2 = insFld(aux1, gFld("php", "http://nakahara21.com/000/index.php?catid=2"))
144 insDoc(aux2, gLnk("S", "London", "demoFrameless.html?pic=%22beenthere_london%2Ejpg%22"))
145 insDoc(aux2, gLnk("S", "Lisbon", "demoFrameless.html?pic=%22beenthere_lisbon%2Ejpg%22"))
146 aux1 = insFld(foldersTree, gFld("Types of node", "javascript:undefined"))
147 aux2 = insFld(aux1, gFld("Expandable with link", "demoFrameless.html?pic=%22beenthere_europe%2Egif%22"))
148 insDoc(aux2, gLnk("S", "London", "demoFrameless.html?pic=%22beenthere_london%2Ejpg%22"))
149 aux2 = insFld(aux1, gFld("Expandable without link", "javascript:undefined"))
150 insDoc(aux2, gLnk("S", "NYC", "demoFrameless.html?pic=%22beenthere_newyork%2Ejpg%22"))
151 insDoc(aux1, gLnk("B", "Opens in new window", "http://www.treeview.net/treemenu/demopics/beenthere_pisa.jpg"))
161 function scanChild($nodeName, $sid=0, $catid){
162 $sres = sql_query("SELECT scatid as subcatid, sname as subname, sdesc as subdesc FROM ".sql_table('plug_multiple_categories_sub')." WHERE parentid=".$sid);
163 if (mysql_num_rows($sres) > 0) {
165 while ($so = mysql_fetch_object($sres)) {
166 // $surl = createCategoryLink($catid, array('subcatid'=>$so->subcatid));
167 $surl = createBlogidLink($this->bid, array('catid'=>$catid, 'subcatid'=>$so->subcatid));
169 $snode = 'sscat'.$this->did;
170 $out .= $snode.' = insFld('.$nodeName.', gFld("'.$so->subname.'", "'.$surl.'"))'."\n";
171 $out .= $this->scanChild($snode, $so->subcatid, $catid);