• R/O
  • HTTP
  • SSH
  • HTTPS

nucleus-plugins: Commit

Nucleus CMS日本語版用プラグインのうち、日本語版開発者がサポートしているもの


Commit MetaInfo

Revision1675390e66ca5687954e80d990c9527baa81c8ba (tree)
Time2009-02-03 09:08:25
Authorshizuki <shizuki@1ca2...>
Commitershizuki

Log Message

git-svn-id: https://svn.sourceforge.jp/svnroot/nucleus-jp/plugin@785 1ca29b6e-896d-4ea0-84a5-967f57386b96

Change Summary

Incremental Difference

--- /dev/null
+++ b/NP_Dtree/trunk/dtree/dtree.php
@@ -0,0 +1,722 @@
1+/*--------------------------------------------------|
2+| dTree 2.05 | www.destroydrop.com/javascript/tree/ |
3+|---------------------------------------------------|
4+| Copyright (c) 2002-2003 Geir Landr・ |
5+| |
6+| This script can be used freely as long as all |
7+| copyright messages are intact. |
8+| |
9+| Updated: 17.04.2003 |
10+|--------------------------------------------------*/
11+
12+
13+<?php
14+ $strRel = '../../../';
15+ include($strRel . 'config.php');
16+ include($DIR_LIBS . 'PLUGINADMIN.php');
17+ $oPluginAdmin = new PluginAdmin('Dtree');
18+ $plug =& $oPluginAdmin->plugin;
19+ $imgpath = $plug->getAdminURL();
20+// $imgpath = 'nucleus/plugins/dtree/';
21+
22+ if ($plug->getOption('folderLinks') == 'yes') {
23+ $folderLinks = 'true,';
24+ } else {
25+ $folderLinks = 'false,';
26+ }
27+ if ($plug->getOption('useSelection') == 'yes') {
28+ $useSelection = 'true,';
29+ } else {
30+ $useSelection = 'false,';
31+ }
32+ if ($plug->getOption('useCookies') == 'yes') {
33+ $useCookies = 'true,';
34+ } else {
35+ $useCookies = 'false,';
36+ }
37+ if ($plug->getOption('useLines') == 'yes') {
38+ $useLines = 'true,';
39+ } else {
40+ $useLines = 'false,';
41+ }
42+ if ($plug->getOption('useIcons') == 'yes') {
43+ $useIcons = 'true,';
44+ } else {
45+ $useIcons = 'false,';
46+ }
47+ if ($plug->getOption('useStatusText') == 'yes') {
48+ $useStatusText = 'true,';
49+ } else {
50+ $useStatusText = 'false,';
51+ }
52+ if ($plug->getOption('closeSameLevel') == 'yes') {
53+ $closeSameLevel = 'true,';
54+ } else {
55+ $closeSameLevel = 'false,';
56+ }
57+ if ($plug->getOption('inOrder') == 'yes') {
58+ $inOrder = 'true';
59+ } else {
60+ $inOrder = 'false';
61+ }
62+
63+?>
64+// Node object
65+
66+var imgpath = "<?php echo $imgpath;?>";
67+
68+function Node(id, pid, name, url, title, target, icon, iconOpen, open) {
69+
70+ this.id = id;
71+
72+ this.pid = pid;
73+
74+ this.name = name;
75+
76+ this.url = url;
77+
78+ this.title = title;
79+
80+ this.target = target;
81+
82+ this.icon = icon;
83+
84+ this.iconOpen = iconOpen;
85+
86+ this._io = open || false;
87+
88+ this._is = false;
89+
90+ this._ls = false;
91+
92+ this._hc = false;
93+
94+ this._ai = 0;
95+
96+ this._p;
97+
98+};
99+
100+// Tree object
101+
102+function dTree(objName) {
103+
104+ this.config = {
105+ target : null,
106+
107+ folderLinks : <?php echo $folderLinks ?>
108+ useSelection : <?php echo $useSelection ?>
109+ useCookies : <?php echo $useCookies ?>
110+ useLines : <?php echo $useLines ?>
111+ useIcons : <?php echo $useIcons ?>
112+ useStatusText : <?php echo $useStatusText ?>
113+ closeSameLevel : <?php echo $closeSameLevel ?>
114+ inOrder : <?php echo $inOrder ?>
115+
116+// folderLinks : true,
117+// useSelection : false,
118+// useCookies : false,
119+// useLines : false,
120+// useIcons : false,
121+// useStatusText : true,
122+// closeSameLevel : true,
123+// inOrder : false
124+ }
125+
126+ this.icon = {
127+
128+ root : imgpath + 'img/base.gif',
129+ folder : imgpath + 'img/folder.gif',
130+ folderOpen : imgpath + 'img/folderopen.gif',
131+// node : imgpath + 'img/page.gif',
132+ node : imgpath + 'img/folder.gif',
133+ empty : imgpath + 'img/empty.gif',
134+ line : imgpath + 'img/line.gif',
135+ join : imgpath + 'img/join.gif',
136+ joinBottom : imgpath + 'img/joinbottom.gif',
137+ plus : imgpath + 'img/plus.gif',
138+ plusBottom : imgpath + 'img/plusbottom.gif',
139+ minus : imgpath + 'img/minus.gif',
140+ minusBottom : imgpath + 'img/minusbottom.gif',
141+ nlPlus : imgpath + 'img/nolines_plus.gif',
142+ nlMinus : imgpath + 'img/nolines_minus.gif'
143+
144+ };
145+
146+ this.obj = objName;
147+
148+ this.aNodes = [];
149+
150+ this.aIndent = [];
151+
152+ this.root = new Node(-1);
153+
154+ this.selectedNode = null;
155+
156+ this.selectedFound = false;
157+
158+ this.completed = false;
159+
160+};
161+
162+
163+
164+// Adds a new node to the node array
165+
166+dTree.prototype.add = function(id, pid, name, url, title, target, icon, iconOpen, open) {
167+
168+ this.aNodes[this.aNodes.length] = new Node(id, pid, name, url, title, target, icon, iconOpen, open);
169+
170+};
171+
172+
173+
174+// Open/close all nodes
175+
176+dTree.prototype.openAll = function() {
177+
178+ this.oAll(true);
179+
180+};
181+
182+dTree.prototype.closeAll = function() {
183+
184+ this.oAll(false);
185+
186+};
187+
188+
189+
190+// Outputs the tree to the page
191+
192+dTree.prototype.toString = function() {
193+
194+ var str = '<div class="dtree">\n';
195+
196+ if (document.getElementById) {
197+
198+ if (this.config.useCookies) this.selectedNode = this.getSelected();
199+
200+ str += this.addNode(this.root);
201+
202+ } else str += 'Browser not supported.';
203+
204+ str += '</div>';
205+
206+ if (!this.selectedFound) this.selectedNode = null;
207+
208+ this.completed = true;
209+
210+ return str;
211+
212+};
213+
214+
215+
216+// Creates the tree structure
217+
218+dTree.prototype.addNode = function(pNode) {
219+
220+ var str = '';
221+
222+ var n=0;
223+
224+ if (this.config.inOrder) n = pNode._ai;
225+
226+ for (n; n<this.aNodes.length; n++) {
227+
228+ if (this.aNodes[n].pid == pNode.id) {
229+
230+ var cn = this.aNodes[n];
231+
232+ cn._p = pNode;
233+
234+ cn._ai = n;
235+
236+ this.setCS(cn);
237+
238+ if (!cn.target && this.config.target) cn.target = this.config.target;
239+
240+ if (cn._hc && !cn._io && this.config.useCookies) cn._io = this.isOpen(cn.id);
241+
242+ if (!this.config.folderLinks && cn._hc) cn.url = null;
243+
244+ if (this.config.useSelection && cn.id == this.selectedNode && !this.selectedFound) {
245+
246+ cn._is = true;
247+
248+ this.selectedNode = n;
249+
250+ this.selectedFound = true;
251+
252+ }
253+
254+ str += this.node(cn, n);
255+
256+ if (cn._ls) break;
257+
258+ }
259+
260+ }
261+
262+ return str;
263+
264+};
265+
266+
267+
268+// Creates the node icon, url and text
269+
270+dTree.prototype.node = function(node, nodeId) {
271+
272+ var str = '<div class="dTreeNode">' + this.indent(node, nodeId);
273+
274+ if (this.config.useIcons) {
275+
276+ if (!node.icon) node.icon = (this.root.id == node.pid) ? this.icon.root : ((node._hc) ? this.icon.folder : this.icon.node);
277+
278+ if (!node.iconOpen) node.iconOpen = (node._hc) ? this.icon.folderOpen : this.icon.node;
279+
280+ if (this.root.id == node.pid) {
281+
282+ node.icon = this.icon.root;
283+
284+ node.iconOpen = this.icon.root;
285+
286+ }
287+
288+ str += '\n<img id="i' + this.obj + nodeId + '" src="' + ((node._io) ? node.iconOpen : node.icon) + '" alt="" />\n';
289+
290+ }
291+
292+ if (node.url) {
293+
294+ str += '<a id="s' + this.obj + nodeId + '" class="' + ((this.config.useSelection) ? ((node._is ? 'nodeSel' : 'node')) : 'node') + '" href="' + node.url + '"';
295+
296+ if (node.title) str += ' title="' + node.title + '"';
297+
298+ if (node.target) str += ' target="' + node.target + '"';
299+
300+ if (this.config.useStatusText) str += ' onmouseover="window.status=\'' + node.name + '\';return true;" onmouseout="window.status=\'\';return true;" ';
301+
302+ if (this.config.useSelection && ((node._hc && this.config.folderLinks) || !node._hc))
303+
304+ str += ' onclick="javascript: ' + this.obj + '.s(' + nodeId + ');"';
305+
306+ str += '>\n';
307+
308+ }
309+
310+ else if ((!this.config.folderLinks || !node.url) && node._hc && node.pid != this.root.id)
311+
312+ str += '<a href="javascript: ' + this.obj + '.o(' + nodeId + ');" class="node">';
313+
314+ str += node.name;
315+
316+ if (node.url || ((!this.config.folderLinks || !node.url) && node._hc)) str += '</a>\n';
317+
318+ str += '</div>\n';
319+
320+ if (node._hc) {
321+
322+ str += '<div id="d' + this.obj + nodeId + '" class="clip" style="display:' + ((this.root.id == node.pid || node._io) ? 'block' : 'none') + ';">\n';
323+
324+ str += this.addNode(node);
325+
326+ str += '</div>\n';
327+
328+ }
329+
330+ this.aIndent.pop();
331+
332+ return str;
333+
334+};
335+
336+
337+
338+// Adds the empty and line icons
339+
340+dTree.prototype.indent = function(node, nodeId) {
341+
342+ var str = '';
343+
344+ if (this.root.id != node.pid) {
345+
346+ for (var n=0; n<this.aIndent.length; n++)
347+
348+ str += '\n<img src="' + ( (this.aIndent[n] == 1 && this.config.useLines) ? this.icon.line : this.icon.empty ) + '" alt="" />';
349+
350+ (node._ls) ? this.aIndent.push(0) : this.aIndent.push(1);
351+
352+ if (node._hc) {
353+
354+ str += '<a href="javascript: ' + this.obj + '.o(' + nodeId + ');"><img id="j' + this.obj + nodeId + '" src="';
355+
356+ if (!this.config.useLines) str += (node._io) ? this.icon.nlMinus : this.icon.nlPlus;
357+
358+ else str += ( (node._io) ? ((node._ls && this.config.useLines) ? this.icon.minusBottom : this.icon.minus) : ((node._ls && this.config.useLines) ? this.icon.plusBottom : this.icon.plus ) );
359+
360+ str += '" alt="" /></a>\n';
361+
362+ } else str += '<img src="' + ( (this.config.useLines) ? ((node._ls) ? this.icon.joinBottom : this.icon.join ) : this.icon.empty) + '" alt="" />\n';
363+
364+ }
365+
366+ return str;
367+
368+};
369+
370+
371+
372+// Checks if a node has any children and if it is the last sibling
373+
374+dTree.prototype.setCS = function(node) {
375+
376+ var lastId;
377+
378+ for (var n=0; n<this.aNodes.length; n++) {
379+
380+ if (this.aNodes[n].pid == node.id) node._hc = true;
381+
382+ if (this.aNodes[n].pid == node.pid) lastId = this.aNodes[n].id;
383+
384+ }
385+
386+ if (lastId==node.id) node._ls = true;
387+
388+};
389+
390+
391+
392+// Returns the selected node
393+
394+dTree.prototype.getSelected = function() {
395+
396+ var sn = this.getCookie('cs' + this.obj);
397+
398+ return (sn) ? sn : null;
399+
400+};
401+
402+
403+
404+// Highlights the selected node
405+
406+dTree.prototype.s = function(id) {
407+
408+ if (!this.config.useSelection) return;
409+
410+ var cn = this.aNodes[id];
411+
412+ if (cn._hc && !this.config.folderLinks) return;
413+
414+ if (this.selectedNode != id) {
415+
416+ if (this.selectedNode || this.selectedNode==0) {
417+
418+ eOld = document.getElementById("s" + this.obj + this.selectedNode);
419+
420+ eOld.className = "node";
421+
422+ }
423+
424+ eNew = document.getElementById("s" + this.obj + id);
425+
426+ eNew.className = "nodeSel";
427+
428+ this.selectedNode = id;
429+
430+ if (this.config.useCookies) this.setCookie('cs' + this.obj, cn.id);
431+
432+ }
433+
434+};
435+
436+
437+
438+// Toggle Open or close
439+
440+dTree.prototype.o = function(id) {
441+
442+ var cn = this.aNodes[id];
443+
444+ this.nodeStatus(!cn._io, id, cn._ls);
445+
446+ cn._io = !cn._io;
447+
448+ if (this.config.closeSameLevel) this.closeLevel(cn);
449+
450+ if (this.config.useCookies) this.updateCookie();
451+
452+};
453+
454+
455+
456+// Open or close all nodes
457+
458+dTree.prototype.oAll = function(status) {
459+
460+ for (var n=0; n<this.aNodes.length; n++) {
461+
462+ if (this.aNodes[n]._hc && this.aNodes[n].pid != this.root.id) {
463+
464+ this.nodeStatus(status, n, this.aNodes[n]._ls)
465+
466+ this.aNodes[n]._io = status;
467+
468+ }
469+
470+ }
471+
472+ if (this.config.useCookies) this.updateCookie();
473+
474+};
475+
476+
477+
478+// Opens the tree to a specific node
479+
480+dTree.prototype.openTo = function(nId, bSelect, bFirst) {
481+
482+ if (!bFirst) {
483+
484+ for (var n=0; n<this.aNodes.length; n++) {
485+
486+ if (this.aNodes[n].id == nId) {
487+
488+ nId=n;
489+
490+ break;
491+
492+ }
493+
494+ }
495+
496+ }
497+
498+ var cn=this.aNodes[nId];
499+
500+ if (cn.pid==this.root.id || !cn._p) return;
501+
502+ cn._io = true;
503+
504+ cn._is = bSelect;
505+
506+ if (this.completed && cn._hc) this.nodeStatus(true, cn._ai, cn._ls);
507+
508+ if (this.completed && bSelect) this.s(cn._ai);
509+
510+ else if (bSelect) this._sn=cn._ai;
511+
512+ this.openTo(cn._p._ai, false, true);
513+
514+};
515+
516+
517+
518+// Closes all nodes on the same level as certain node
519+
520+dTree.prototype.closeLevel = function(node) {
521+
522+ for (var n=0; n<this.aNodes.length; n++) {
523+
524+ if (this.aNodes[n].pid == node.pid && this.aNodes[n].id != node.id && this.aNodes[n]._hc) {
525+
526+ this.nodeStatus(false, n, this.aNodes[n]._ls);
527+
528+ this.aNodes[n]._io = false;
529+
530+ this.closeAllChildren(this.aNodes[n]);
531+
532+ }
533+
534+ }
535+
536+}
537+
538+
539+
540+// Closes all children of a node
541+
542+dTree.prototype.closeAllChildren = function(node) {
543+
544+ for (var n=0; n<this.aNodes.length; n++) {
545+
546+ if (this.aNodes[n].pid == node.id && this.aNodes[n]._hc) {
547+
548+ if (this.aNodes[n]._io) this.nodeStatus(false, n, this.aNodes[n]._ls);
549+
550+ this.aNodes[n]._io = false;
551+
552+ this.closeAllChildren(this.aNodes[n]);
553+
554+ }
555+
556+ }
557+
558+}
559+
560+
561+
562+// Change the status of a node(open or closed)
563+
564+dTree.prototype.nodeStatus = function(status, id, bottom) {
565+
566+ eDiv = document.getElementById('d' + this.obj + id);
567+
568+ eJoin = document.getElementById('j' + this.obj + id);
569+
570+ if (this.config.useIcons) {
571+
572+ eIcon = document.getElementById('i' + this.obj + id);
573+
574+ eIcon.src = (status) ? this.aNodes[id].iconOpen : this.aNodes[id].icon;
575+
576+ }
577+
578+ eJoin.src = (this.config.useLines)?
579+
580+ ((status)?((bottom)?this.icon.minusBottom:this.icon.minus):((bottom)?this.icon.plusBottom:this.icon.plus)):
581+
582+ ((status)?this.icon.nlMinus:this.icon.nlPlus);
583+
584+ eDiv.style.display = (status) ? 'block': 'none';
585+
586+};
587+
588+
589+
590+
591+
592+// [Cookie] Clears a cookie
593+
594+dTree.prototype.clearCookie = function() {
595+
596+ var now = new Date();
597+
598+ var yesterday = new Date(now.getTime() - 1000 * 60 * 60 * 24);
599+
600+ this.setCookie('co'+this.obj, 'cookieValue', yesterday);
601+
602+ this.setCookie('cs'+this.obj, 'cookieValue', yesterday);
603+
604+};
605+
606+
607+
608+// [Cookie] Sets value in a cookie
609+
610+dTree.prototype.setCookie = function(cookieName, cookieValue, expires, path, domain, secure) {
611+
612+ document.cookie =
613+
614+ escape(cookieName) + '=' + escape(cookieValue)
615+
616+ + (expires ? '; expires=' + expires.toGMTString() : '')
617+
618+ + (path ? '; path=' + path : '')
619+
620+ + (domain ? '; domain=' + domain : '')
621+
622+ + (secure ? '; secure' : '');
623+
624+};
625+
626+
627+
628+// [Cookie] Gets a value from a cookie
629+
630+dTree.prototype.getCookie = function(cookieName) {
631+
632+ var cookieValue = '';
633+
634+ var posName = document.cookie.indexOf(escape(cookieName) + '=');
635+
636+ if (posName != -1) {
637+
638+ var posValue = posName + (escape(cookieName) + '=').length;
639+
640+ var endPos = document.cookie.indexOf(';', posValue);
641+
642+ if (endPos != -1) cookieValue = unescape(document.cookie.substring(posValue, endPos));
643+
644+ else cookieValue = unescape(document.cookie.substring(posValue));
645+
646+ }
647+
648+ return (cookieValue);
649+
650+};
651+
652+
653+
654+// [Cookie] Returns ids of open nodes as a string
655+
656+dTree.prototype.updateCookie = function() {
657+
658+ var str = '';
659+
660+ for (var n=0; n<this.aNodes.length; n++) {
661+
662+ if (this.aNodes[n]._io && this.aNodes[n].pid != this.root.id) {
663+
664+ if (str) str += '.';
665+
666+ str += this.aNodes[n].id;
667+
668+ }
669+
670+ }
671+
672+ this.setCookie('co' + this.obj, str);
673+
674+};
675+
676+
677+
678+// [Cookie] Checks if a node id is in a cookie
679+
680+dTree.prototype.isOpen = function(id) {
681+
682+ var aOpen = this.getCookie('co' + this.obj).split('.');
683+
684+ for (var n=0; n<aOpen.length; n++)
685+
686+ if (aOpen[n] == id) return true;
687+
688+ return false;
689+
690+};
691+
692+
693+
694+// If Push and pop is not implemented by the browser
695+
696+if (!Array.prototype.push) {
697+
698+ Array.prototype.push = function array_push() {
699+
700+ for(var i=0;i<arguments.length;i++)
701+
702+ this[this.length]=arguments[i];
703+
704+ return this.length;
705+
706+ }
707+
708+};
709+
710+if (!Array.prototype.pop) {
711+
712+ Array.prototype.pop = function array_pop() {
713+
714+ lastElement = this[this.length-1];
715+
716+ this.length = Math.max(this.length-1,0);
717+
718+ return lastElement;
719+
720+ }
721+
722+};
\ No newline at end of file
--- /dev/null
+++ b/NP_Dtree/trunk/dtree/dtreedata.php
@@ -0,0 +1,224 @@
1+<?php
2+global $CONF, $manager;
3+ $strRel = '../../../';
4+ include($strRel . 'config.php');
5+
6+ $usePathInfo = ($CONF['URLMode'] == 'pathinfo');
7+
8+// $objectId = requestVar('o');
9+ $objectId = 'tree' . preg_replace('|[^0-9a-f]|i', '', substr(requestVar('o'), 4));
10+ $blogid = intRequestVar('bid');
11+ if (empty($blogid)) {
12+ $blogid = intval($CONF['DefaultBlog']);
13+ }
14+ $blogname = getBlogNameFromID($blogid);
15+
16+ $b =& $manager->getBlog($blogid);
17+ $blogurl = $b->getURL();
18+ if (!$blogurl) {
19+ if($blog) {
20+ $b_tmp =& $manager->getBlog($blogid);
21+ $blogurl = $b_tmp->getURL();
22+ }
23+ if (!$blogurl) {
24+ $blogurl = $CONF['IndexURL'];
25+ if (!$usePathInfo) {
26+ if ($data['type'] == 'pageparser') {
27+ $blogurl .= 'index.php';
28+ } else {
29+ $blogurl = $CONF['Self'];
30+ }
31+ }
32+ }
33+ }
34+
35+ if ($usePathInfo) {
36+ if (substr($blogurl, -1) == '/') {
37+ $blogurl = substr($blogurl, 0, -1);
38+ }
39+ }
40+
41+ $CONF['BlogURL'] = $blogurl;
42+ $CONF['ItemURL'] = $blogurl;
43+ $CONF['CategoryURL'] = $blogurl;
44+ $CONF['ArchiveURL'] = $blogurl;
45+ $CONF['ArchiveListURL'] = $blogurl;
46+ $CONF['SearchURL'] = $blogurl;
47+
48+ $printData = $objectId . "=new dTree('" . $objectId . "');\n"
49+ . $objectId . ".add(0,-1,'"
50+ . htmlspecialchars($blogname, ENT_QUOTES, _CHARSET)
51+ . "');\n";
52+ echo $printData;
53+ unset($printData);
54+
55+ $resq = 'SELECT * FROM %s WHERE cblog = %d';
56+ $res = sql_query(sprintf($resq, sql_table('category'), $blogid));
57+ $n = 1;
58+ while ($o = mysql_fetch_object($res)) {
59+ $catid = intval($o->catid);
60+ $nodeArray['cat'][$catid] = $n;
61+ $url = createCategoryLink($catid);
62+ $printData = $objectId
63+ . ".add"
64+ . "("
65+ . $n . ","
66+ . "0,"
67+ . "'" . htmlspecialchars($o->cname, ENT_QUOTES, _CHARSET) . "',"
68+// . "'" . htmlspecialchars($url, ENT_QUOTES, _CHARSET) . "',"
69+ . "'" . $url . "',"
70+ . "'" . htmlspecialchars($o->cdesc, ENT_QUOTES, _CHARSET). "'"
71+ . ");\n";
72+ echo $printData;
73+ $catFilter[] = $catid;
74+ $n++;
75+ unset($printData);
76+ }
77+
78+ if (!$manager->pluginInstalled('NP_MultipleCategories')) {
79+ echo 'document.write(' . $objectId . ');';
80+ if ($itemid = intRequestVar('id')) {
81+ $que = 'SELECT icat as result FROM %s WHERE inumber = %d';
82+ $catid = quickQuery(sprintf($que, sql_table('item'), $itemid));
83+ $catid = intval($catid);
84+ $nodeId = 's' . $objectId . $nodeArray['cat'][$catid];
85+ $printData = "document.getElementById('"
86+ . htmlspecialchars($nodeId, ENT_QUOTES, _CHARSET)
87+ . "').className = 'selectedNode';";
88+ echo $printData;
89+ unset($printData);
90+ }
91+ return;
92+ }
93+
94+/* if ($catFilter[1]) {
95+ $catFilter = implode(', ', $catFilter);
96+ $catFilter = ' IN (' . $catFilter . ')';
97+ } else {
98+ $catFilter = ' = ' . $catFilter;
99+ } //original*/
100+
101+ if (count($catFilter) == 1) {
102+ $catFilter = ' = ' . $catFilter[0];
103+ } elseif (count($catFilter) > 1) {
104+ $catFilter = implode(', ', $catFilter);
105+ $catFilter = ' IN (' . $catFilter . ')';
106+ } else {
107+ $catFilter = '';
108+ } // test
109+
110+ $scatTable = sql_table('plug_multiple_categories_sub');
111+ $mcategories =& $manager->getPlugin('NP_MultipleCategories');
112+ if (method_exists($mcategories, 'getRequestName')) {
113+ $subrequest = $mcategories->getRequestName();
114+ } else {
115+ $subrequest = 'subcatid';
116+ }
117+// $query = 'SELECT * FROM %s WHERE catid%s';
118+ $query = 'SELECT * FROM %s WHERE catid%s ORDER BY parentid, catid, ordid';
119+ $query = sprintf($query, $scatTable, $catFilter);
120+ $res = sql_query($query);
121+ while ($o = mysql_fetch_object($res)) {
122+ $scatid = intval($o->scatid);
123+ $nodeArray['subcat'][$scatid] = $n;
124+ $n++;
125+// }
126+
127+// $query = 'SELECT * FROM %s WHERE catid%s';
128+// $query = sprintf($query, $scatTable, $catFilter);
129+// $res = sql_query($query);
130+// while ($u = mysql_fetch_object($res)) {
131+//$u = $o;
132+// $scatid = intval($o->scatid);
133+ $parent_id = intval($o->parentid);
134+ $cat_id = intval($o->catid);
135+ $linkParam = array(
136+ $subrequest => $scatid
137+ );
138+ $url = createCategoryLink($cat_id, $linkParam);
139+
140+ if (!empty($parent_id)) {
141+ $pnode = intval($nodeArray['subcat'][$parent_id]);
142+ } else {
143+ $pnode = intval($nodeArray['cat'][$cat_id]);
144+ }
145+ $printData = $objectId
146+ . ".add"
147+ . "("
148+ . intval($nodeArray['subcat'][$scatid]) . ","
149+ . $pnode . ","
150+ . "'" . htmlspecialchars($o->sname, ENT_QUOTES, _CHARSET) . "',"
151+// . "'" . htmlspecialchars($url, ENT_QUOTES, _CHARSET) . "',"
152+ . "'" . $url . "',"
153+ . "'" . htmlspecialchars($o->sdesc, ENT_QUOTES, _CHARSET) . "'"
154+ . ");\n";
155+ echo $printData;
156+ unset($printData);
157+ }
158+
159+ echo "document.write(" . $objectId . ");\n";
160+
161+ if ($sid = intRequestVar('sid')) {
162+ $nodeId = 's' . $objectId . intval($nodeArray['subcat'][$sid]);
163+ $printData = "document.getElementById('" . $nodeId . "')"
164+ . ".className='urlselected';\n"
165+ . $objectId
166+ . ".openTo(" . intval($nodeArray['subcat'][$sid]) . ",true);\n";
167+ echo $printData;
168+ unset($printData);
169+ } elseif ($cid = intRequestVar('cid')) {
170+ $nodeId = 's' . $objectId . intval($nodeArray['cat'][$cid]);
171+ $printData = "document.getElementById('" . $nodeId . "')."
172+ . "className='urlselected';\n"
173+ . $objectId
174+ . ".openTo(" . intval($nodeArray['cat'][$cid]) . ",true);\n";
175+ }
176+
177+ if ($itemid = intRequestVar('id')) {
178+ $que = 'SELECT icat as result FROM %s WHERE inumber = %d';
179+ $catid = quickQuery($que, sql_table('item'), $itemid);
180+ $catid = intval($catid);
181+ $nodeId = 's' . $objectId . intval($nodeArray['cat'][$catid]);
182+ $printData = "document.getElementById('" . $nodeId . "')"
183+ . ".className='selectedNode';\n";
184+ echo $printData;
185+ unset($printData);
186+
187+ //multi catid
188+ $que = 'SELECT categories as result FROM %s WHERE item_id = %d';
189+ $que = sprintf($que, sql_table('plug_multiple_categories'), $itemid);
190+ $catids = quickQuery($que);
191+ if ($catids) {
192+ $catids = explode(',', $catids);
193+ $cCount = count($catids);
194+ for ($i=0; $i < $cCount; $i++) {
195+ $catidTemp = intval($catids[$i]);
196+ if ($catidTemp != $catid) {
197+ $nodeId = 's' . $objectId . intval($nodeArray['cat'][$catidTemp]);
198+ $prntData = "document.getElementById('" . $nodeId . "')"
199+ . ".className='selectedCatNode';\n";
200+ echo $printData;
201+ unset($printData);
202+ }
203+ }
204+ }
205+
206+ //(multi) subcatid
207+ $que = 'SELECT subcategories as result FROM %s WHERE item_id = %d';
208+ $que = sprintf($que, sql_table('plug_multiple_categories'), $itemid);
209+ $scatids = quickQuery($que);
210+ if ($scatids) {
211+ $scatids = explode(',', $scatids);
212+ $scatCnt = count($scatids);
213+ for ($i=0; $i < $scatCnt; $i++) {
214+ $scatid = intval($scatids[$i]);
215+ $nodeId = 's' . $objectId . intval($nodeArray['subcat'][$scatid]);
216+ $printData = "document.getElementById('" . $nodeId . "')"
217+ . ".className='selectedScatNode';\n"
218+ . $objectId
219+ . ".openTo(" . intval($nodeArray['subcat'][$scatid]) . ",true);\n";
220+ echo $printData;
221+ unset($printData);
222+ }
223+ }
224+ }
--- /dev/null
+++ b/NP_Dtree/trunk/dtree/dtreedata.php.org
@@ -0,0 +1,57 @@
1+ d = new dTree('d');
2+
3+<?php
4+ $strRel = '../../../';
5+ include($strRel . 'config.php');
6+
7+ $blogid = requestVar('bid');
8+ $blogname = getBlogNameFromID($blogid);
9+ echo "d.add(0,-1,'".$blogname."');\n";
10+
11+ $res = sql_query("SELECT * FROM ".sql_table('category')." WHERE cblog= ".$blogid);
12+ $n = 1;
13+ while($o = mysql_fetch_object($res)){
14+ $catid = $o->catid;
15+ $nodeArray[cat][$catid] = $n;
16+ $url = createBlogidLink($blogid, array('catid'=>$catid));
17+ echo "d.add(".$n.",0,'".$o->cname."','".$url."');\n";
18+ $catFilter[] = $catid;
19+ $n++;
20+ }
21+
22+ global $manager;
23+ if (!$manager->pluginInstalled('NP_MultipleCategories')){
24+ echo 'document.write(d);';
25+ return;
26+ }
27+
28+ if($catFilter[1]){
29+ $catFilter = @join(',',$catFilter);
30+ $catFilter = ' IN ('.$catFilter.')';
31+ }else{
32+ $catFilter = '='.$catFilter;
33+ }
34+
35+ $query = "SELECT * FROM ".sql_table('plug_multiple_categories_sub')." WHERE catid".$catFilter;
36+ $res = sql_query($query);
37+ while($o = mysql_fetch_object($res)){
38+ $scatid = $o->scatid;
39+ $nodeArray[subcat][$scatid] = $n;
40+ $n++;
41+ }
42+ $query = "SELECT * FROM ".sql_table('plug_multiple_categories_sub')." WHERE catid".$catFilter;
43+ $res = sql_query($query);
44+ while($u = mysql_fetch_object($res)){
45+ $scatid = $u->scatid;
46+ $url = createBlogidLink($blogid, array('catid'=>$u->catid, 'subcatid'=>$scatid));
47+ $pnode = ($u->parentid)? $nodeArray[subcat][$u->parentid]: $nodeArray[cat][$u->catid];
48+ echo "d.add(".$nodeArray[subcat][$u->scatid].",".$pnode.",'".$u->sname."','".$url."');\n";
49+ }
50+
51+?>
52+
53+ document.write(d);
54+ d.openTo(7, true);
55+ document.getElementById('sd7').className = 'selectedNode';
56+ d.openTo(15, true);
57+ document.getElementById('sd15').className = 'selectedNode';
Binary files /dev/null and b/NP_Dtree/trunk/dtree/img/base.gif differ
Binary files /dev/null and b/NP_Dtree/trunk/dtree/img/cd.gif differ
Binary files /dev/null and b/NP_Dtree/trunk/dtree/img/empty.gif differ
Binary files /dev/null and b/NP_Dtree/trunk/dtree/img/folder.gif differ
Binary files /dev/null and b/NP_Dtree/trunk/dtree/img/folderopen.gif differ
Binary files /dev/null and b/NP_Dtree/trunk/dtree/img/globe.gif differ
Binary files /dev/null and b/NP_Dtree/trunk/dtree/img/imgfolder.gif differ
Binary files /dev/null and b/NP_Dtree/trunk/dtree/img/join.gif differ
Binary files /dev/null and b/NP_Dtree/trunk/dtree/img/joinbottom.gif differ
Binary files /dev/null and b/NP_Dtree/trunk/dtree/img/line.gif differ
Binary files /dev/null and b/NP_Dtree/trunk/dtree/img/minus.gif differ
Binary files /dev/null and b/NP_Dtree/trunk/dtree/img/minusbottom.gif differ
Binary files /dev/null and b/NP_Dtree/trunk/dtree/img/musicfolder.gif differ
Binary files /dev/null and b/NP_Dtree/trunk/dtree/img/nolines_minus.gif differ
Binary files /dev/null and b/NP_Dtree/trunk/dtree/img/nolines_plus.gif differ
Binary files /dev/null and b/NP_Dtree/trunk/dtree/img/page.gif differ
Binary files /dev/null and b/NP_Dtree/trunk/dtree/img/plus.gif differ
Binary files /dev/null and b/NP_Dtree/trunk/dtree/img/plusbottom.gif differ
Binary files /dev/null and b/NP_Dtree/trunk/dtree/img/question.gif differ
Binary files /dev/null and b/NP_Dtree/trunk/dtree/img/trash.gif differ
--- /dev/null
+++ b/NP_Dtree/trunk/dtree/language/english.php
@@ -0,0 +1,13 @@
1+<?php
2+ define('_DTREE_DESCRIPTION', 'Show Navigation Tree. Usage: &lt;%Dtree()%&gt;');
3+ define('_DTREE_DIR_LINK', 'Should folders be links.');
4+ define('_DTREE_SELECTION', 'Nodes can be selected(highlighted).');
5+ define('_DTREE_COOKIE', 'The tree uses cookies to rember it\'s state.');
6+ define('_DTREE_LINE', 'Tree is drawn with lines.');
7+ define('_DTREE_ICON', 'Tree is drawn with icons.');
8+ define('_DTREE_ST_TEXT', 'Displays node names in the statusbar instead of the url.');
9+ define('_DTREE_CL_SLEVEL', 'Only one node within a parent can be expanded at the same time. [Open All] and [Close All] functions do not work when this is enabled.');
10+ define('_DTREE_IN_ORDER', 'If parent nodes are always added before children, setting this to true speeds up the tree.');
11+ define('_DTREE_OPENALL', 'Open All');
12+ define('_DTREE_CLOSEALL', 'Close All');
13+?>
\ No newline at end of file
--- /dev/null
+++ b/NP_Dtree/trunk/dtree/language/japanese-euc.php
@@ -0,0 +1,13 @@
1+<?php
2+ define('_DTREE_DESCRIPTION', 'ツリー表示のカテゴリ・サブカテゴリメニュー<br />スキン、またはテンプレートに[&lt;%Dtree()%&gt;]と記述');
3+ define('_DTREE_DIR_LINK', 'フォルダーのリンクを有効にしますか?');
4+ define('_DTREE_SELECTION', '選択中のカテゴリ・サブカテゴリをハイライトしますか?');
5+ define('_DTREE_COOKIE', 'クッキーを使用してツリーの状態を保存しますか?');
6+ define('_DTREE_LINE', 'ツリーのラインを表示しますか?');
7+ define('_DTREE_ICON', 'アイコンを使用しますか?');
8+ define('_DTREE_ST_TEXT', 'URLの代わりにカテゴリ・サブカテゴリ名をステータスバーに表示しますか?');
9+ define('_DTREE_CL_SLEVEL', '二つ以上の枝を同時に展開しないようにしますか?(「全て開く」「全て閉じる」はこの設定に影響されません)');
10+ define('_DTREE_IN_ORDER', 'If parent nodes are always added before children, setting this to true speeds up the tree.');
11+ define('_DTREE_OPENALL', '全て開く');
12+ define('_DTREE_CLOSEALL', '全て閉じる');
13+?>
\ No newline at end of file
--- /dev/null
+++ b/NP_Dtree/trunk/dtree/language/japanese-utf8.php
@@ -0,0 +1,13 @@
1+<?php
2+ define('_DTREE_DESCRIPTION', 'ツリー表示のカテゴリ・サブカテゴリメニュー<br />スキン、またはテンプレートに[&lt;%Dtree()%&gt;]と記述');
3+ define('_DTREE_DIR_LINK', 'フォルダーのリンクを有効にしますか?');
4+ define('_DTREE_SELECTION', '選択中のカテゴリ・サブカテゴリをハイライトしますか?');
5+ define('_DTREE_COOKIE', 'クッキーを使用してツリーの状態を保存しますか?');
6+ define('_DTREE_LINE', 'ツリーのラインを表示しますか?');
7+ define('_DTREE_ICON', 'アイコンを使用しますか?');
8+ define('_DTREE_ST_TEXT', 'URLの代わりにカテゴリ・サブカテゴリ名をステータスバーに表示しますか?');
9+ define('_DTREE_CL_SLEVEL', '二つ以上の枝を同時に展開しないようにしますか?(「全て開く」「全て閉じる」はこの設定に影響されません)');
10+ define('_DTREE_IN_ORDER', 'If parent nodes are always added before children, setting this to true speeds up the tree.');
11+ define('_DTREE_OPENALL', '全て開く');
12+ define('_DTREE_CLOSEALL', '全て閉じる');
13+?>
\ No newline at end of file
Show on old repository browser