egroupware/phpgwapi/js/dhtmlxtree/samples/treeEx12.html
Ralf Becker b495b33d0a commit for Lars:
1) ajax proposal: proof of concept using xajax in felamimail to work without page reloads
2) also implemented IMAP ACL for cyrus and php5 (still needs some work)
2005-07-20 08:07:47 +00:00

96 lines
3.2 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>DHTML Tree samples. dhtmlXTree - Add / Delete items</title>
</head>
<style>
body {font-size:12px}
.{font-family:arial;font-size:12px}
h1 {cursor:hand;font-size:16px;margin-left:10px;line-height:10px}
xmp {color:green;font-size:12px;margin:0px;font-family:courier;background-color:#e6e6fa;padding:2px}
</style>
<body>
<h1>Add / Delete items</h1>
<link rel="STYLESHEET" type="text/css" href="../css/dhtmlXTree.css">
<script src="../js/dhtmlXCommon.js"></script>
<script src="../js/dhtmlXTree.js"></script>
<script>
function fixImage(id){
switch(tree.getLevel(id)){
case 1:
tree.setItemImage2(id,'books_close.gif','tombs.gif','tombs.gif');
break;
case 2:
tree.setItemImage2(id,'book.gif','books_open.gif','books_close.gif');
break;
case 3:
tree.setItemImage2(id,'book.gif','books_open.gif','book.gif');
break;
default:
tree.setItemImage2(id,'book_titel.gif','book_titel.gif','book_titel.gif');
break;
}
}
</script>
<table>
<tr>
<td valign="top">
<div id="treeboxbox_tree" style="width:250; height:218;background-color:#f5f5f5;border :1px solid Silver;; overflow:auto;"></div>
</td>
<td rowspan="2" style="padding-left:25" valign="top">
<a href="javascript:void(0);" onclick="var d=new Date(); tree.insertNewItem(tree.getSelectedItemId(),d.valueOf(),document.getElementById('ed1').value,0,0,0,0,'SELECT'); fixImage(d.valueOf());">Insert new child item</a> Item label <input type="text" value="New item" id="ed1"><br><br>
<a href="javascript:void(0);" onclick="var d=new Date(); tree.insertNewNext(tree.getSelectedItemId(),d.valueOf(),document.getElementById('ed2').value,0,0,0,0,'SELECT'); fixImage(d.valueOf());">Insert new item next</a> Item label <input type="text" value="New item" id="ed2"><br><br>
<a href="javascript:void(0);" onclick="tree.deleteItem(tree.getSelectedItemId(),true);">Delete item</a><br><br>
</td>
</tr>
<tr>
<td>&nbsp;</td>
</tr>
</table>
<hr>
<XMP>
<div id="treeboxbox_tree" style="width:200;height:200"></div>
<script>
tree=new dhtmlXTreeObject("treeboxbox_tree","100%","100%",0);
tree.setImagePath("../imgs/");
tree.loadXML("tree.xml")
tree.insertNewItem(0,100,"New Node 1",0,0,0,0,"SELECT");
tree.insertNewNext(2,101,"New Node 2",0,0,0,0,"");
tree.deleteItem("2");
</script>
</XMP>
<li>0s passed to the function for arguments 4-7 (function to call on select, images) mean use default values for them</li>
<li>Last argument is a comma delimited string of following possible value (upper case only):</li>
<li type="circle">SELECT - move selection to this node after inserting</li>
<li type="circle">CALL - call function on select</li>
<li type="circle">TOP - add node to the top position </li>
<li type="circle">CHILD - node has children</li>
<li type="circle">CHECKED - checkbox is checked (if exists)</li>
<script>
tree=new dhtmlXTreeObject("treeboxbox_tree","100%","100%",0);
tree.setImagePath("../imgs/");
tree.loadXML("tree3.xml");
/*
tree.insertNewItem(1,100,"New Node 1",0,0,0,0,"SELECT");
tree.insertNewNext(2,101,"New Node 2",0,0,0,0,"");
tree.deleteItem("2");*/
</script>
<br><br>
</body>
</html>