Author: rhari
Date: Thu May 3 08:45:12 2007
New Revision: 401
URL: http://svn.gna.org/viewcvs/phplinker?rev=401&view=rev
Log:
#193
Expand selected category in url_edit
Modified:
trunk/smarty/default/templates/admin/category.tpl
trunk/smarty/default/templates/admin/url_edit.tpl
trunk/www/admin/url_edit.php
trunk/www/js/drag-drop-folder-tree.js
Modified: trunk/smarty/default/templates/admin/category.tpl
URL:
http://svn.gna.org/viewcvs/phplinker/trunk/smarty/default/templates/admin/category.tpl?rev=401&r1=400&r2=401&view=diff
==============================================================================
--- trunk/smarty/default/templates/admin/category.tpl (original)
+++ trunk/smarty/default/templates/admin/category.tpl Thu May 3 08:45:12 2007
@@ -295,11 +295,12 @@
treeObj2.initTree();
treeObj2.expandAll();
-
treeObj = new JSDragDropTree();
treeObj.setTreeId('dhtmlgoodies_tree2');
+ treeObj.setMaximumDepth(1000);
treeObj.setMessageMaximumDepthReached('Maximum depth reached'); // If
you want to show a message when maximum depth is reached, i.e. on drop.
treeObj.initTree();
+ treeObj.expandThis('root');
// treeObj.expandAll();
</script>
{/literal}
Modified: trunk/smarty/default/templates/admin/url_edit.tpl
URL:
http://svn.gna.org/viewcvs/phplinker/trunk/smarty/default/templates/admin/url_edit.tpl?rev=401&r1=400&r2=401&view=diff
==============================================================================
--- trunk/smarty/default/templates/admin/url_edit.tpl (original)
+++ trunk/smarty/default/templates/admin/url_edit.tpl Thu May 3 08:45:12 2007
@@ -115,6 +115,10 @@
treeObj2.setMaximumDepth(1);
treeObj2.setMessageMaximumDepthReached('Maximum depth reached'); // If
you want to show a message when maximum depth is reached, i.e. on drop.
treeObj2.initTree();
-// treeObj2.expandAll();
</script>
-{/literal}
+{/literal}
+{section name=i_expand loop=$categstoexpand}
+<script>
+treeObj2.expandThis('{$categstoexpand[i_expand]}');
+</script>
+{/section}
Modified: trunk/www/admin/url_edit.php
URL:
http://svn.gna.org/viewcvs/phplinker/trunk/www/admin/url_edit.php?rev=401&r1=400&r2=401&view=diff
==============================================================================
--- trunk/www/admin/url_edit.php (original)
+++ trunk/www/admin/url_edit.php Thu May 3 08:45:12 2007
@@ -1,4 +1,25 @@
<?php
+
+function searchIndinCategs($id, $tree_categs){
+ for ($i=0;$i<sizeof($tree_categs);$i++){
+ if ($tree_categs[$i]['id'] == $id)
+ return $i;
+ }
+ return -1;
+}
+
+function addthistocategstoexpand($i, $tree_categs, $categstoexpand){
+ $idcateg = ($tree_categs[$i]['id_parent'] ==
0)?'root':'categ_'.$tree_categs[$i]['id_parent'];
+ if (!in_array($idcateg, $categstoexpand)){
+ $categstoexpand[] = $idcateg;
+ }
+
+ $tmpIndice = searchIndinCategs($tree_categs[$i]['id_parent'], $tree_categs);
+ if ($tmpIndice != -1)
+ addthistocategstoexpand($tmpIndice, $tree_categs, &$categstoexpand);
+
+// return $categstoexpand;
+}
$group="admin";
$title="Url edit";
@@ -83,9 +104,16 @@
$categ_ul_li .="<ul>";
// echo "<pre>";
// print_r($categstochecked);
+$categstoexpand = array();
+$categstoexpand[] = "root";
for ($i=0;$i<sizeof($tree_categs);$i++){
- if (isset($categstochecked) && in_array($tree_categs[$i]['id'],
$categstochecked))
+ if (isset($categstochecked) && in_array($tree_categs[$i]['id'],
$categstochecked)){
+ addthistocategstoexpand($i, $tree_categs, &$categstoexpand);
$checked = 'checked';
+// echo "<pre>";
+// print_r($categstoexpand);
+// echo "<br>******************************<br>";
+ }
else
$checked = '';
@@ -137,6 +165,11 @@
$categ_ul_li .= "</li></ul>";
?>
<?
+// echo "<pre>";
+// print_r($categstoexpand);
+?>
+<?
+linker_tpl("categstoexpand", $categstoexpand);
linker_tpl("categ_ul_li", $categ_ul_li);
linker_tpl("id" , $id);
linker_tpl("url" , $url);
Modified: trunk/www/js/drag-drop-folder-tree.js
URL:
http://svn.gna.org/viewcvs/phplinker/trunk/www/js/drag-drop-folder-tree.js?rev=401&r1=400&r2=401&view=diff
==============================================================================
--- trunk/www/js/drag-drop-folder-tree.js (original)
+++ trunk/www/js/drag-drop-folder-tree.js Thu May 3 08:45:12 2007
@@ -316,6 +316,16 @@
if(subItems.length>0 &&
subItems[0].style.display!='block'){
JSTreeObj.showHideNode(false,menuItems[no].id);
}
+ }
+ }
+ ,
+ expandThis : function(id)
+ {
+// var menuItems =
document.getElementById(this.idOfTree).getElementsByTagName('LI');
+ var menuItems = document.getElementById(id);
+ var subItems = menuItems.getElementsByTagName('UL');
+ if(subItems.length>0 &&
subItems[0].style.display!='block'){
+ JSTreeObj.showHideNode(false,menuItems.id);
}
}
,
_______________________________________________
PHPLinker-commits mailing list
[email protected]
https://mail.gna.org/listinfo/phplinker-commits