Updated to work with KH 3.1
This commit is contained in:
@@ -11,22 +11,20 @@
|
||||
* @license http://dev.osbill.net/license.html
|
||||
*/
|
||||
class Controller_lnApp_Tree extends Controller_Default {
|
||||
// Our tree data
|
||||
protected $treedata;
|
||||
/**
|
||||
* @var string page media route as per [Route]
|
||||
*/
|
||||
protected static $mediaroute = 'default/media';
|
||||
protected static $jsmediaroute = 'default/media';
|
||||
|
||||
public function after() {
|
||||
parent::after();
|
||||
|
||||
$this->request->headers['Content-Type'] = 'application/json';
|
||||
$this->request->response = sprintf('[%s]',json_encode($this->treedata));
|
||||
$this->response->headers('Content-Type','application/json');
|
||||
$this->response->body(sprintf('[%s]',json_encode($this->output)));
|
||||
}
|
||||
|
||||
public static function js() {
|
||||
$mediapath = Route::get(static::$mediaroute);
|
||||
$mediapath = Route::get(static::$jsmediaroute);
|
||||
|
||||
return '
|
||||
<div id="tree" class=""></div>
|
||||
@@ -85,28 +83,18 @@ $(function () {
|
||||
*
|
||||
* @param id
|
||||
*/
|
||||
public function action_json($id=null) {
|
||||
if (! Auth::instance()->logged_in()) {
|
||||
$this->treedata = array('attr'=>array('id'=>'a_login'),
|
||||
public function action_json($id=null,array $data=array()) {
|
||||
if ($this->_auth_required() AND ! Auth::instance()->logged_in()) {
|
||||
$this->output = array('attr'=>array('id'=>'a_login'),
|
||||
'data'=>array('title'=>_('Please Login').'...','attr'=>array('id'=>'N_login','href'=>URL::site('/login'))));
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$this->treedata = array();
|
||||
$data = array();
|
||||
|
||||
// @todo Our menu options
|
||||
array_push($data,array(
|
||||
'id'=>'node',
|
||||
'name'=>'Node Info',
|
||||
'state'=>'none',
|
||||
'attr_id'=>'1',
|
||||
'attr_href'=>URL::Site('/node'),
|
||||
));
|
||||
$this->output = array();
|
||||
|
||||
foreach ($data as $branch) {
|
||||
array_push($this->treedata,array(
|
||||
array_push($this->output,array(
|
||||
'attr'=>array('id'=>sprintf('B_%s',$branch['id'])),
|
||||
'state'=>$branch['state'],
|
||||
'data'=>array('title'=>$branch['name']),
|
||||
|
Reference in New Issue
Block a user