Themeing work based on bootstrap

This commit is contained in:
Deon George
2013-04-25 10:22:36 +10:00
parent b310cdb125
commit 74a9c291e4
184 changed files with 37653 additions and 8903 deletions

View File

@@ -10,10 +10,6 @@
* @license http://dev.leenooks.net/license.html
*/
abstract class lnApp_Controller_TemplateDefault extends Controller_Template {
/**
* @var string page template
*/
public $template = 'theme/bootstrap/default';
/**
* @var object meta object information as per [meta]
*/
@@ -56,7 +52,7 @@ abstract class lnApp_Controller_TemplateDefault extends Controller_Template {
return (($this->auth_required !== FALSE && Auth::instance()->logged_in(NULL,get_class($this).'|'.__METHOD__) === FALSE) ||
(is_array($this->secure_actions) && array_key_exists($this->request->action(),$this->secure_actions) &&
Auth::instance()->logged_in($this->secure_actions[$this->request->action()],get_class($this).'|'.__METHOD__) === FALSE));
! Auth::instance()->logged_in($this->secure_actions[$this->request->action()],get_class($this).'|'.__METHOD__)));
}
/**
@@ -106,6 +102,9 @@ abstract class lnApp_Controller_TemplateDefault extends Controller_Template {
}
}
if (! $this->auto_render)
return;
// For AJAX calls, we dont need to render the complete page.
if ($this->request->is_ajax()) {
$this->auto_render = FALSE;
@@ -116,20 +115,8 @@ abstract class lnApp_Controller_TemplateDefault extends Controller_Template {
$this->meta = new Meta;
View::bind_global('meta',$this->meta);
// Add our logo
/*
Style::add(array(
'type'=>'stdin',
'data'=>'h1 span{background:url('.Config::logo_uri().') no-repeat;}',
));
*/
// Our default script(s)
/*
foreach (array('file'=>array_reverse(array(
'js/jquery-1.6.4.min.js',
'js/jquery.jstree-1.0rc3.js',
'js/jquery.cookie.js',
))) as $type => $datas) {
foreach ($datas as $data) {
@@ -139,54 +126,41 @@ abstract class lnApp_Controller_TemplateDefault extends Controller_Template {
),TRUE);
}
}
*/
// Initialise our content
$this->template->left = '';
$this->template->shownavbar = TRUE;
$this->template->content = '';
$this->template->right = '';
$this->template->footer = '';
}
public function after() {
if (! is_string($this->template) AND empty($this->template->content))
$this->template->content = Block::factory();
if ($this->auto_render) {
$this->template->navbar = $this->template->shownavbar ? View::factory('pages/navbar') : '';
if (empty($this->template->content))
$this->template->content = Block::factory()->render_all();
// Adjust our breadcrumb
if (isset(URL::$method_directory[strtolower($this->request->directory())]))
BreadCrumb::name(URL::$method_directory[strtolower($this->request->directory())],$this->request->directory());
// Application Title
if (class_exists('Model_Module') AND $mo=ORM::factory('Module',array('name'=>Request::current()->controller())) AND $mo->loaded())
$this->meta->title = sprintf('%s: %s',Kohana::$config->load('config')->appname,$mo->display('name'));
else
$this->meta->title = Config::sitename();
$this->template->title = '';
// Language
$this->meta->language = Config::language();
$this->meta->title = Kohana::$config->load('config')->appname;
// Description
$this->meta->description = sprintf('%s::%s',$this->request->controller(),$this->request->action());
// Link images on the header line
$this->template->headimages = $this->_headimages();
// System Messages line
$this->template->sysmsg = $this->_sysmsg();
// Left Item
$this->template->left = '';
// Right Item
$this->template->right = '';
// Footer
$this->template->footer = $this->_footer();
// In case we have some scripting/styling, we need to get that out too
} elseif ($this->request->is_ajax() AND $this->response->body()) {
$this->response->bodyadd(Script::factory()->render_all());
$this->response->bodyadd(Style::factory()->render_all());
// For any ajax rendered actions, we'll need to capture the content and put it in the response
// @todo Do we come here for ajax?
} elseif ($this->request->is_ajax() && isset($this->template->content) && ! $this->response->body()) {
// @todo move this formatting to a view?
if ($s = $this->_sysmsg() AND (string)$s)
$this->response->body(sprintf('<table class="sysmsg"><tr><td>%s</td></tr></table>',$s));
// In case there any style sheets for this render.
$this->response->bodyadd(Style::factory());
@@ -204,7 +178,8 @@ abstract class lnApp_Controller_TemplateDefault extends Controller_Template {
parent::after();
// Generate and check the ETag for this file
$this->check_cache(sha1($this->response->body()));
if (Kohana::$environment < Kohana::TESTING OR Kohana::$config->load('debug')->etag)
$this->check_cache(sha1($this->response->body()));
}
/**
@@ -214,24 +189,6 @@ abstract class lnApp_Controller_TemplateDefault extends Controller_Template {
$this->template->content = _('Please choose from the menu on the left - you may need to expand the items by pressing on the plus.');
}
protected function _headimages() {
HeadImages::add(array(
'url'=>'http://dev.leenooks.net',
'img'=>'img/forum-big.png',
'attrs'=>array('onclick'=>"target='_blank';",'title'=>'Link')
));
return HeadImages::factory();
}
protected function _sysmsg() {
return SystemMessage::factory();
}
public function _footer() {
return sprintf('&copy; %s',Config::sitename());
}
/**
* Generate a view path to help View::factory() calls
*
@@ -240,6 +197,7 @@ abstract class lnApp_Controller_TemplateDefault extends Controller_Template {
* plugins
*
* @param string Plugin Name (optional)
* @deprecated
*/
public function viewpath($plugin='') {
$request = Request::current();