<?php defined('SYSPATH') or die('No direct script access.');

class Controller_Admin_Welcome extends Controller_TemplateDefault {
	public function action_index() {
		Block::add(array(
			'title'=>'Welcome to lnApp (admin)',
			'subtitle'=>'Using lnApp',
			'body'=>'Sample lnApp application',
			'footer'=>'lnApp makes building websites easy! '.time(),
		));

		$this->template->control = sprintf('%s -&gt; %s -&gt; %s -&gt; %s',
			HTML::anchor(URL::site(),_('Home')),
			HTML::anchor($this->request->uri(),'Body',array('id'=>'ajxbody')),
			HTML::anchor($this->request->uri(),'Left',array('id'=>'ajxleft')),
			HTML::anchor($this->request->uri(),'Right',array('id'=>'ajxright'))
		);

		$this->template->content = Block::factory();

		// @todo Change this to Script::add();
		$js = '';
		$js .= '<script type="text/javascript">
$(document).ready(function() {
	$("#ajxbody").click(function() {alert("hello - body!"); $("#ajBODY").load("/"); return false;});
	$("#ajxleft").click(function() {alert("hello - left!"); $("#ajLEFT").load("/welcome/left"); return false;});
	$("#ajxright").click(function() {alert("hello - right!"); $("#ajRIGHT").load("/welcome/right"); return false});
	$("#ajRIGHT").ajaxSend(function() {$(this).text("Triggered ajaxSend handler.");});
});
</script>';
		$this->template->content .= $js;
	}
} // End Welcome
