Skip to content

Commit

Permalink
Merge pull request #11 from mdekrijger/master
Browse files Browse the repository at this point in the history
Added a way to delete nodes
  • Loading branch information
chregu committed Feb 23, 2012
2 parents f5582be + 919feb1 commit 81a35e5
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 6 deletions.
8 changes: 7 additions & 1 deletion conf/commandmap.php
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
Empty file modified conf/config.d/00-default.yml
100755 → 100644
Empty file.
1 change: 1 addition & 0 deletions install_vendors.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
8 changes: 8 additions & 0 deletions localinc/api/command/crbrowser.php
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
34 changes: 29 additions & 5 deletions www/static/js/crbrowser.js
100755 → 100644
Original file line number Diff line number Diff line change
@@ -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);

Expand All @@ -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
Expand All @@ -57,6 +59,7 @@ YAHOO.cr.tree = function(){


}


var loadNodeData = function(node, fnLoadComplete){

Expand Down Expand Up @@ -133,13 +136,15 @@ YAHOO.cr.tree = function(){
return {
init: function(){
buildTree();
}
},
currentNode: currentNode
}



}();


YAHOO.cr.propTable = function(){

var myColumnDefs = null;
Expand Down Expand Up @@ -393,9 +398,9 @@ YAHOO.cr.versionsTable = function(){
};

YAHOO.util.Connect.asyncRequest('GET', sUrl, callback1);



}

}


Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit 81a35e5

Please sign in to comment.