From: shizuki Date: Wed, 11 Oct 2006 13:44:31 +0000 (+0000) Subject: bug-fix and add conf. options X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=853f6644dd9c2154809dd606d7f436ccf2b608e3;p=nucleus-jp%2Fnucleus-plugins.git bug-fix and add conf. options git-svn-id: https://svn.sourceforge.jp/svnroot/nucleus-jp/plugin@443 1ca29b6e-896d-4ea0-84a5-967f57386b96 --- diff --git a/trunk/NP_Dtree/NP_Dtree.php b/trunk/NP_Dtree/NP_Dtree.php index db46435..c45f602 100644 --- a/trunk/NP_Dtree/NP_Dtree.php +++ b/trunk/NP_Dtree/NP_Dtree.php @@ -1,9 +1,12 @@ createOption('folderLinks', _DTREE_DIR_LINK, 'yesno', 'yes'); + $this->createOption('useSelection', _DTREE_SELECTION, 'yesno', 'no'); + $this->createOption('useCookies', _DTREE_COOKIE, 'yesno', 'no'); + $this->createOption('useLines', _DTREE_LINE, 'yesno', 'yes'); + $this->createOption('useIcons', _DTREE_ICON, 'yesno', 'yes'); + $this->createOption('useStatusText', _DTREE_ST_TEXT, 'yesno', 'no'); + $this->createOption('closeSameLevel', _DTREE_CL_SLEVEL, 'yesno', 'no'); + $this->createOption('inOrder', _DTREE_IN_ORDER, 'yesno', 'no'); + } + + function init() + { + global $admin; + $language = ereg_replace( '[\\|/]', '', getLanguageName()); + if (file_exists($this->getDirectory().'language/'.$language.'.php')) { + include_once($this->getDirectory().'language/'.$language.'.php'); + }else { + include_once($this->getDirectory().'language/english.php'); + } + } + function doSkinVar($skinType, $itemid=0) { global $blogid, $catid, $subcatid; @@ -81,8 +107,8 @@ class NP_Dtree extends NucleusPlugin echo ''; - echo 'open all' . - ' | close all'; + echo '' . _DTREE_OPENALL . '' . + ' | ' . _DTREE_CLOSEALL . ''; } diff --git a/trunk/NP_Dtree/dtree/dtree.php b/trunk/NP_Dtree/dtree/dtree.php index 6266a5a..5a29915 100644 --- a/trunk/NP_Dtree/dtree/dtree.php +++ b/trunk/NP_Dtree/dtree/dtree.php @@ -1,320 +1 @@ -/*--------------------------------------------------| | dTree 2.05 | www.destroydrop.com/javascript/tree/ | |---------------------------------------------------| | Copyright (c) 2002-2003 Geir Landr$B!&(B | | | | This script can be used freely as long as all | | copyright messages are intact. | | | | Updated: 17.04.2003 | |--------------------------------------------------*/ - plug =& $oPluginAdmin->plugin; $imgpath = $this->plug->getAdminURL(); -// $imgpath = 'nucleus/plugins/dtree/'; - -?> -// Node object -var imgpath = ""; - -function Node(id, pid, name, url, title, target, icon, iconOpen, open) { - this.id = id; - this.pid = pid; - this.name = name; - this.url = url; - this.title = title; - this.target = target; - this.icon = icon; - this.iconOpen = iconOpen; - this._io = open || false; - this._is = false; - this._ls = false; - this._hc = false; - this._ai = 0; - this._p; -}; - -// Tree object -function dTree(objName) { - this.config = { target : null, folderLinks : true, useSelection : false, useCookies : false, useLines : true, useIcons : true, useStatusText : false, closeSameLevel : false, inOrder : false } - this.icon = { - root : imgpath + 'img/base.gif', folder : imgpath + 'img/folder.gif', folderOpen : imgpath + 'img/folderopen.gif', // node : imgpath + 'img/page.gif', node : imgpath + 'img/folder.gif', empty : imgpath + 'img/empty.gif', line : imgpath + 'img/line.gif', join : imgpath + 'img/join.gif', joinBottom : imgpath + 'img/joinbottom.gif', plus : imgpath + 'img/plus.gif', plusBottom : imgpath + 'img/plusbottom.gif', minus : imgpath + 'img/minus.gif', minusBottom : imgpath + 'img/minusbottom.gif', nlPlus : imgpath + 'img/nolines_plus.gif', nlMinus : imgpath + 'img/nolines_minus.gif' - }; - this.obj = objName; - this.aNodes = []; - this.aIndent = []; - this.root = new Node(-1); - this.selectedNode = null; - this.selectedFound = false; - this.completed = false; -}; - -// Adds a new node to the node array -dTree.prototype.add = function(id, pid, name, url, title, target, icon, iconOpen, open) { - this.aNodes[this.aNodes.length] = new Node(id, pid, name, url, title, target, icon, iconOpen, open); -}; - -// Open/close all nodes -dTree.prototype.openAll = function() { - this.oAll(true); -}; -dTree.prototype.closeAll = function() { - this.oAll(false); -}; - -// Outputs the tree to the page -dTree.prototype.toString = function() { - var str = '
\n'; - if (document.getElementById) { - if (this.config.useCookies) this.selectedNode = this.getSelected(); - str += this.addNode(this.root); - } else str += 'Browser not supported.'; - str += '
'; - if (!this.selectedFound) this.selectedNode = null; - this.completed = true; - return str; -}; - -// Creates the tree structure -dTree.prototype.addNode = function(pNode) { - var str = ''; - var n=0; - if (this.config.inOrder) n = pNode._ai; - for (n; n'; - } - if (node.url) { - str += ''; - str += node.name; - if (node.url || ((!this.config.folderLinks || !node.url) && node._hc)) str += ''; - str += ''; - if (node._hc) { - str += '
'; - str += this.addNode(node); - str += '
'; - } - this.aIndent.pop(); - return str; -}; - -// Adds the empty and line icons -dTree.prototype.indent = function(node, nodeId) { - var str = ''; - if (this.root.id != node.pid) { - for (var n=0; n'; - (node._ls) ? this.aIndent.push(0) : this.aIndent.push(1); - if (node._hc) { - str += ''; - } else str += ''; - } - return str; -}; - -// Checks if a node has any children and if it is the last sibling -dTree.prototype.setCS = function(node) { - var lastId; - for (var n=0; nplug =& $oPluginAdmin->plugin; $imgpath = $this->plug->getAdminURL(); // $imgpath = 'nucleus/plugins/dtree/'; ?> // Node object var imgpath = ""; function Node(id, pid, name, url, title, target, icon, iconOpen, open) { this.id = id; this.pid = pid; this.name = name; this.url = url; this.title = title; this.target = target; this.icon = icon; this.iconOpen = iconOpen; this._io = open || false; this._is = false; this._ls = false; this._hc = false; this._ai = 0; this._p; }; // Tree object function dTree(objName) { this.config = { target : null, plug->getOption('folderLinks') == 'yes') { echo 'folderLinks : true,'; } else { echo 'folderLinks : false,'; } if ($this->plug->getOption('useSelection') == 'yes') { echo 'useSelection : true,'; } else { echo 'useSelection : false,'; } if ($this->plug->getOption('useCookies') == 'yes') { echo 'useCookies : true,'; } else { echo 'useCookies : false,'; } if ($this->plug->getOption('useLines') == 'yes') { echo 'useLines : true,'; } else { echo 'useLines : false,'; } if ($this->plug->getOption('useIcons') == 'yes') { echo 'useIcons : true,'; } else { echo 'useIcons : false,'; } if ($this->plug->getOption('useStatusText') == 'yes') { echo 'useStatusText : true,'; } else { echo 'useStatusText : false,'; } if ($this->plug->getOption('closeSameLevel') == 'yes') { echo 'closeSameLevel : true,'; } else { echo 'closeSameLevel : false,'; } if ($this->plug->getOption('inOrder') == 'yes') { echo 'inOrder : true,'; } else { echo 'inOrder : false,'; } ?> // folderLinks : true, // useSelection : false, // useCookies : false, // useLines : false, // useIcons : false, // useStatusText : true, // closeSameLevel : true, // inOrder : false } this.icon = { root : imgpath + 'img/base.gif', folder : imgpath + 'img/folder.gif', folderOpen : imgpath + 'img/folderopen.gif', // node : imgpath + 'img/page.gif', node : imgpath + 'img/folder.gif', empty : imgpath + 'img/empty.gif', line : imgpath + 'img/line.gif', join : imgpath + 'img/join.gif', joinBottom : imgpath + 'img/joinbottom.gif', plus : imgpath + 'img/plus.gif', plusBottom : imgpath + 'img/plusbottom.gif', minus : imgpath + 'img/minus.gif', minusBottom : imgpath + 'img/minusbottom.gif', nlPlus : imgpath + 'img/nolines_plus.gif', nlMinus : imgpath + 'img/nolines_minus.gif' }; this.obj = objName; this.aNodes = []; this.aIndent = []; this.root = new Node(-1); this.selectedNode = null; this.selectedFound = false; this.completed = false; }; // Adds a new node to the node array dTree.prototype.add = function(id, pid, name, url, title, target, icon, iconOpen, open) { this.aNodes[this.aNodes.length] = new Node(id, pid, name, url, title, target, icon, iconOpen, open); }; // Open/close all nodes dTree.prototype.openAll = function() { this.oAll(true); }; dTree.prototype.closeAll = function() { this.oAll(false); }; // Outputs the tree to the page dTree.prototype.toString = function() { var str = '
\n'; if (document.getElementById) { if (this.config.useCookies) this.selectedNode = this.getSelected(); str += this.addNode(this.root); } else str += 'Browser not supported.'; str += '
'; if (!this.selectedFound) this.selectedNode = null; this.completed = true; return str; }; // Creates the tree structure dTree.prototype.addNode = function(pNode) { var str = ''; var n=0; if (this.config.inOrder) n = pNode._ai; for (n; n'; } if (node.url) { str += ''; str += node.name; if (node.url || ((!this.config.folderLinks || !node.url) && node._hc)) str += ''; str += ''; if (node._hc) { str += '
'; str += this.addNode(node); str += '
'; } this.aIndent.pop(); return str; }; // Adds the empty and line icons dTree.prototype.indent = function(node, nodeId) { var str = ''; if (this.root.id != node.pid) { for (var n=0; n'; (node._ls) ? this.aIndent.push(0) : this.aIndent.push(1); if (node._hc) { str += ''; } else str += ''; } return str; }; // Checks if a node has any children and if it is the last sibling dTree.prototype.setCS = function(node) { var lastId; for (var n=0; n$catid)); $url = createCategoryLink($catid); // $url = createBlogidLink($blogid, array("$CategoryKey"=>$catid)); - echo $objectId . ".add(" . $n . ",0,'" . htmlspecialchars($o->cname) . "','" . htmlspecialchars($url) . "');\n"; + echo $objectId . ".add(" . $n . ",0,'" . htmlspecialchars($o->cname) . "','" . htmlspecialchars($url) . "','" . htmlspecialchars($o->cdesc) . "');\n"; $catFilter[] = $catid; $n++; } @@ -106,8 +107,9 @@ global $CONF; // $url = createBlogidLink($blogid, array('catid'=>$u->catid, 'subcatid'=>$scatid)); $url = createCategoryLink($u->catid, array($subrequest => $scatid)); // $url = createBlogidLink($blogid, array("$CategoryKey"=>$u->catid, 'subcatid'=>$scatid)); + $scat_desc = $b->getCategoryDesc($catid); $pnode = (!empty($parent_id)) ? $nodeArray['subcat'][$parent_id] : $nodeArray['cat'][$cat_id]; - echo $objectId . ".add(" . $nodeArray['subcat'][$scatid] . "," . $pnode . ",'" . htmlspecialchars($u->sname) . "','" . $url . "');\n"; + echo $objectId . ".add(" . $nodeArray['subcat'][$scatid] . "," . $pnode . ",'" . htmlspecialchars($u->sname) . "','" . htmlspecialchars($url) . "','" . htmlspecialchars($u->sdesc) . "');\n"; } echo "document.write(" . $objectId . ");\n"; diff --git a/trunk/NP_Dtree/dtree/language/english.php b/trunk/NP_Dtree/dtree/language/english.php new file mode 100644 index 0000000..d5e2eef --- /dev/null +++ b/trunk/NP_Dtree/dtree/language/english.php @@ -0,0 +1,13 @@ + \ No newline at end of file diff --git a/trunk/NP_Dtree/dtree/language/japanese-euc.php b/trunk/NP_Dtree/dtree/language/japanese-euc.php new file mode 100644 index 0000000..148cfee --- /dev/null +++ b/trunk/NP_Dtree/dtree/language/japanese-euc.php @@ -0,0 +1,13 @@ +¥¹¥­¥ó¡¢¤Þ¤¿¤Ï¥Æ¥ó¥×¥ì¡¼¥È¤Ë[<%Dtree()%>]¤Èµ­½Ò'); + define('_DTREE_DIR_LINK', '¥Õ¥©¥ë¥À¡¼¤Î¥ê¥ó¥¯¤òÍ­¸ú¤Ë¤·¤Þ¤¹¤«¡©'); + define('_DTREE_SELECTION', 'ÁªÂòÃæ¤Î¥«¥Æ¥´¥ê¡¦¥µ¥Ö¥«¥Æ¥´¥ê¤ò¥Ï¥¤¥é¥¤¥È¤·¤Þ¤¹¤«¡©'); + define('_DTREE_COOKIE', '¥¯¥Ã¥­¡¼¤ò»ÈÍѤ·¤Æ¥Ä¥ê¡¼¤Î¾õÂÖ¤òÊݸ¤·¤Þ¤¹¤«¡©'); + define('_DTREE_LINE', '¥Ä¥ê¡¼¤Î¥é¥¤¥ó¤òɽ¼¨¤·¤Þ¤¹¤«¡©'); + define('_DTREE_ICON', '¥¢¥¤¥³¥ó¤ò»ÈÍѤ·¤Þ¤¹¤«¡©'); + define('_DTREE_ST_TEXT', 'URL¤ÎÂå¤ï¤ê¤Ë¥«¥Æ¥´¥ê¡¦¥µ¥Ö¥«¥Æ¥´¥ê̾¤ò¥¹¥Æ¡¼¥¿¥¹¥Ð¡¼¤Ëɽ¼¨¤·¤Þ¤¹¤«¡©'); + define('_DTREE_CL_SLEVEL', 'Æó¤Ä°Ê¾å¤Î»Þ¤òƱ»þ¤ËŸ³«¤·¤Ê¤¤¤è¤¦¤Ë¤·¤Þ¤¹¤«¡©(Ž¢Á´¤Æ³«¤¯Ž£Ž¢Á´¤ÆÊĤ¸¤ëŽ£¤Ï¤³¤ÎÀßÄê¤Ë±Æ¶Á¤µ¤ì¤Þ¤»¤ó)'); + define('_DTREE_IN_ORDER', 'If parent nodes are always added before children, setting this to true speeds up the tree.'); + define('_DTREE_OPENALL', 'Á´¤Æ³«¤¯'); + define('_DTREE_CLOSEALL', 'Á´¤ÆÊĤ¸¤ë'); +?> \ No newline at end of file diff --git a/trunk/NP_Dtree/dtree/language/japanese-utf8.php b/trunk/NP_Dtree/dtree/language/japanese-utf8.php new file mode 100644 index 0000000..f2e484e --- /dev/null +++ b/trunk/NP_Dtree/dtree/language/japanese-utf8.php @@ -0,0 +1,13 @@ +スキン、またはテンプレートに[<%Dtree()%>]と記述'); + define('_DTREE_DIR_LINK', 'フォルダーのリンクを有効にしますか?'); + define('_DTREE_SELECTION', '選択中のカテゴリ・サブカテゴリをハイライトしますか?'); + define('_DTREE_COOKIE', 'クッキーを使用してツリーの状態を保存しますか?'); + define('_DTREE_LINE', 'ツリーのラインを表示しますか?'); + define('_DTREE_ICON', 'アイコンを使用しますか?'); + define('_DTREE_ST_TEXT', 'URLの代わりにカテゴリ・サブカテゴリ名をステータスバーに表示しますか?'); + define('_DTREE_CL_SLEVEL', '二つ以上の枝を同時に展開しないようにしますか?(「全て開く」「全て閉じる」はこの設定に影響されません)'); + define('_DTREE_IN_ORDER', 'If parent nodes are always added before children, setting this to true speeds up the tree.'); + define('_DTREE_OPENALL', '全て開く'); + define('_DTREE_CLOSEALL', '全て閉じる'); +?> \ No newline at end of file