int position = Integer.parseInt(index);
// notify parent controller about the move
MoveTreeNodeEvent moveEvent = new MoveTreeNodeEvent(node, oldParent, newParent, position);
fireEvent(ureq, moveEvent);
// prepare response as javascript string
StringMediaResource smr = new StringMediaResource();
// content type javascript forces menu tree to eval result
smr.setContentType(CONTENT_TYPE_JAVASCRIPT);
smr.setEncoding(ENCODING_UTF_8);
if (moveEvent.isResultSuccess()) {
// send ok back
smr.setData("b_amt_status=true;");
} else {
// send failure and some messages for the user
smr.setData("b_amt_status_title=\"" + moveEvent.getResultFailureTitle() + "\", b_amt_status_msg=\""
+ moveEvent.getResultFailureMessage() + "\"; b_amt_status=false;");
}
ureq.getDispatchResult().setResultingMediaResource(smr);
} else if (event.getCommand().equals(CMD_CLICK)) {