Skip to content
Browse files

Merge pull request #11 from mdekrijger/master

Added a way to delete nodes
  • Loading branch information...
2 parents f5582be + 919feb1 commit 81a35e54af0fab89a1228a0c30303f596b1ececa @chregu chregu committed Feb 23, 2012
View
8 conf/commandmap.php 100755 → 100644
@@ -52,8 +52,14 @@
'method' => 'addnode',
'view' => array('class' => 'txt')));
+
+ $m->route('__json__/removenode/')
+ ->config(array(
+ 'command' => 'crbrowser',
+ 'method' => 'removenode',
+ 'view' => array('class' => 'txt')));
-
+
$m->route('__json__/delcache/')
->config(array(
'command' => 'crbrowser',
View
0 conf/config.d/00-default.yml 100755 → 100644
File mode changed.
View
1 install_vendors.sh
@@ -13,4 +13,5 @@ cd $DIR
git clone git://github.com/jackalope/jackalope.git jackalope
cd jackalope
+git checkout 0265558e77f1adb6ef1dd950d46b50ed5869859b
git submodule update --init --recursive
View
8 localinc/api/command/crbrowser.php 100755 → 100644
@@ -246,6 +246,14 @@ function addnode() {
$this->data = json_encode(true);
}
+
+ function removenode() {
+ $sess = $this->getSession();
+ $node = $this->getNode();
+ $node->remove();
+ $sess->save();
+ $this->data = json_encode(true);
+ }
function setproperty() {
$sess = $this->getSession();
View
34 www/static/js/crbrowser.js 100755 → 100644
@@ -1,13 +1,14 @@
YAHOO.namespace("cr");
-
YAHOO.cr.tree = function(){
+ var currentNode;
+
var buildTree = function(){
//create a new tree:
tree = new YAHOO.widget.TreeView("treeDiv1");
-
+
//turn dynamic loading on for entire tree:
tree.setDynamicLoad(loadNodeData, true);
@@ -31,6 +32,7 @@ YAHOO.cr.tree = function(){
tree.subscribe("labelClick", function(node){
loadNodeProperties(node);
+ YAHOO.cr.tree.currentNode = node;
});
//render tree with these toplevel nodes; all descendants of these nodes
@@ -57,6 +59,7 @@ YAHOO.cr.tree = function(){
}
+
var loadNodeData = function(node, fnLoadComplete){
@@ -133,13 +136,15 @@ YAHOO.cr.tree = function(){
return {
init: function(){
buildTree();
- }
+ },
+ currentNode: currentNode
}
}();
+
YAHOO.cr.propTable = function(){
var myColumnDefs = null;
@@ -393,9 +398,9 @@ YAHOO.cr.versionsTable = function(){
};
YAHOO.util.Connect.asyncRequest('GET', sUrl, callback1);
-
-
+
}
+
}
@@ -444,6 +449,11 @@ YAHOO.cr.topmenu = function(){
fn: YAHOO.cr.dialogNewNode.show
}
}],[, {
+ text: "Remove Node",
+ onclick: {
+ fn: removenode
+ }
+ }],[, {
text: "Delete Cache",
onclick: {
fn: deletecache
@@ -485,6 +495,20 @@ YAHOO.cr.topmenu = function(){
}
YAHOO.util.Connect.asyncRequest('GET', sUrl, callback1);
};
+ var removenode = function() {
+ var sUrl = '__json__/removenode/?fullpath=' + YAHOO.cr.propTable.currentPath;
+ var callback1 = {
+ success: null,
+ failure: null,
+ }
+ YAHOO.util.Connect.asyncRequest('GET', sUrl, callback1);
+ //YAHOO.cr.tree.init();
+ //var arr = YAHOO.cr.propTable.currentPath.split('/');
+ //arr.pop()
+ //var parent = arr.join('/');
+ //YAHOO.util.Connect.asyncRequest('GET', '__json__/tree/?fullpath=' + parent, callback1);
+ YAHOO.widget.TreeView.getTree('treeDiv1').removeNode(YAHOO.cr.tree.currentNode, true);
+ };
return {
init: function(){
initMenu();

0 comments on commit 81a35e5

Please sign in to comment.
Something went wrong with that request. Please try again.