Theme work with focusbusiness and baseadmin

Improvements to NAVBAR, updates to StaticList methods, other minor items
Enable product category rendering and other minor improvements
Added ADSL-large category price plan
This commit is contained in:
Deon George
2013-04-26 11:42:09 +10:00
parent eeb8d61237
commit 04ebda2aaa
114 changed files with 1732 additions and 6797 deletions

View File

@@ -11,23 +11,25 @@
*/
class Controller_Account extends Controller_TemplateDefault {
public function action_group() {
// List all available groups for this user.
$output = '';
$cg = $this->ao->group->find_all();
foreach ($cg as $go) {
foreach ($this->ao->groups() as $go)
$output .= sprintf('Group %s: %s<br/>',$go->id,$go->display('name'));
foreach ($go->list_childgrps(TRUE) as $cgo)
$output .= sprintf('- %s: %s (%s)<br/>',$cgo->id,$cgo->display('name'),$cgo->parent_id);
Block::factory()
->title('Group Structure')
->body($output);
$output .= sprintf('END Group %s<br/><br/>',$go->id);
}
// List all available methods for this user.
$output = '';
Block::add(array(
'title'=>'Group Structure',
'body'=>$output,
));
foreach ($this->ao->methods() as $mmo)
$output .= sprintf('Module: %s, Method %s: %s<br/>',$mmo->module->name,$mmo->name,$mmo->url());
Block::factory()
->title('Available Methods')
->body($output);
}
}
?>

View File

@@ -87,6 +87,8 @@ class Controller_Login extends lnApp_Controller_Login {
'style'=>array('css/login.css'=>'screen'),
));
}
$this->template->shownavbar = FALSE;
}
}
?>

View File

@@ -16,36 +16,11 @@ class Controller_TemplateDefault extends lnApp_Controller_TemplateDefault {
protected $ao;
public function __construct(Request $request, Response $response) {
if (Config::theme())
$this->template = Config::theme().'/page';
$this->template = Config::theme().'/page';
return parent::__construct($request,$response);
}
protected function _headimages() {
// This is where we should be able to change our country
// @todo To implement
$co = Config::country();
HeadImages::add(array(
'img'=>sprintf('img/country/%s.png',strtolower($co->two_code)),
'attrs'=>array('onclick'=>"target='_blank';",'title'=>$co->display('name'))
));
return HeadImages::factory();
}
protected function _left() {
if ($this->template->left)
return $this->template->left;
elseif (Auth::instance()->logged_in(NULL,get_class($this).'|'.__METHOD__))
return Controller_Tree::js();
}
protected function _right() {
return ($this->template->right) ? $this->template->right : '';
}
public function before() {
// If our action doesnt exist, no point processing any further.
if (! method_exists($this,'action_'.Request::current()->action()))

View File

@@ -1,131 +0,0 @@
<?php defined('SYSPATH') or die('No direct access allowed.');
/**
* This class extends renders OSB menu tree.
*
* @package OSB
* @category Controllers
* @author Deon George
* @copyright (c) 2009-2013 Open Source Billing
* @license http://dev.osbill.net/license.html
*/
class Controller_Tree extends lnApp_Controller_Tree {
protected $auth_required = TRUE;
/**
* Draw the Tree Menu
*
* The incoming ID is either a Branch B_x or a Node N_x
* Where X is actually the module.
*
* @param array $data Tree data passed in by inherited methods
*/
public function action_json(array $data=array()) {
// Get the user details
$id = (is_null($this->request->param('id')) AND isset($_REQUEST['id'])) ? substr($_REQUEST['id'],2) : $this->request->param('id');
$user = Auth::instance()->get_user();
if ($user) {
if (! $id) {
$modules = array();
foreach ($user->groups() as $go)
foreach ($go->list_parentgrps(TRUE) as $cgo)
foreach ($cgo->module_method->find_all() as $mmo)
if ($mmo->menu_display AND empty($modules[$mmo->module_id]))
$modules[$mmo->module_id] = $mmo->module;
Sort::MAsort($modules,'name');
foreach ($modules as $id => $mo)
if (! $mo->parent_id)
array_push($data,array('id'=>$id,'name'=>$mo->name,'state'=>'closed'));
} else {
$idx = NULL;
if (preg_match('/_/',$id))
list($id,$idx) = explode('_',$id,2);
$mo = ORM::factory('Module',$id);
$methods = array();
if ($mo->loaded()) {
foreach ($mo->module_method->find_all() as $mmo)
if ($mmo->menu_display)
foreach ($mmo->group->find_all() as $gmo)
if ($user->has_any('group',$gmo->list_childgrps(TRUE)))
$methods[$mmo->id] = $mmo;
Sort::MASort($modules,'name');
$subdata = array();
foreach ($methods as $id => $mmo) {
if (preg_match('/_/',$mmo->name)) {
list($mode,$action) = explode('_',$mmo->name);
$url = URL::link($mode,$mmo->module->name.'/'.$action,TRUE);
} else {
$url = URL::site($mmo->module->name.'/'.$mmo->name);
}
// We can split our menus into sub menus using the _ char.
if (preg_match('/_/',$mmo->name)) {
list($sub,$name) = explode('_',$mmo->name,2);
$subdata[$sub][$name]['name'] = preg_replace('/^(.*: )/','',$mmo->notes);
$subdata[$sub][$name]['id'] = sprintf('%s_%s',$mmo->module_id,$id);
$subdata[$sub][$name]['href'] = (empty($details['page']) ? $url : $details['page']);
} else {
// We dont want to show these items again, if we can through on a submenu
if (! $idx)
array_push($data,array(
'id'=>sprintf('%s_%s',$mmo->module_id,$id),
'name'=>$mmo->name,
'state'=>'none',
'attr_id'=>sprintf('%s_%s',$mmo->module->name,$id),
'attr_href'=>(empty($details['page']) ? $url : $details['page'])
));
}
}
// If our sub menus only have 1 branch, then we'll display it as normal.
if (count($subdata) == 1) {
$sk = array_keys($subdata);
$idx = array_shift($sk);
}
if ($idx)
foreach ($subdata[$idx] as $k=>$v) {
array_push($data,array(
'id'=>$v['id'],
'name'=>$v['name'],
'state'=>'none',
'attr_id'=>$v['id'],
'attr_href'=>$v['href']
));
}
else
foreach ($subdata as $t=>$x)
array_push($data,array('id'=>$mmo->module_id.'_'.$t,'name'=>$t,'state'=>'closed'));
}
}
}
$this->output = array();
foreach ($data as $branch) {
array_push($this->output,array(
'attr'=>array('id'=>sprintf('B_%s',$branch['id'])),
'state'=>$branch['state'],
'data'=>array('title'=>$branch['name']),
'attr'=>array('id'=>sprintf('N_%s',$branch['id']),'href'=>empty($branch['attr_href']) ? URL::site(sprintf('%s/menu',$branch['name'])) : $branch['attr_href']),
)
);
}
return parent::action_json($data);
}
}
?>

View File

@@ -25,34 +25,34 @@ class Controller_User_Account extends Controller_Account {
// Run validation and save
if ($this->ao->changed())
if ($this->ao->check()) {
SystemMessage::add(array(
'title'=>_('Record updated'),
'type'=>'info',
'body'=>_('Your account record has been updated.')
));
SystemMessage::factory()
->title('Record updated')
->type('success')
->body(_('Your account record has been updated.'));
$this->ao->save();
} else {
$output = '';
// @todo Need to check that this still works with the new bootstrap theming
foreach ($this->ao->validation()->errors('forms/login') as $field => $error)
$output .= sprintf('<li><b>%s</b> %s</li>',$field,$error);
if ($output)
$output = sprintf('<ul>%s</ul>',$output);
SystemMessage::add(array(
'title'=>_('Record NOT updated'),
'type'=>'error',
'body'=>_('Your updates didnt pass validation.').'<br/>'.$output,
));
SystemMessage::factory()
->title(_('Record NOT updated'))
->type('error')
->body(_('Your updates didnt pass validation.').'<br/>'.$output);
}
Block::add(array(
'title'=>sprintf('%s: %s - %s',_('Account Edit'),$this->ao->accnum(),$this->ao->name(TRUE)),
'body'=>View::factory($this->viewpath())
->set('record',$this->ao),
));
Block::factory()
->title(sprintf('Account: %s',$this->ao->accnum()))
->title_icon('icon-wrench')
->type('form-horizontal')
->body(View::factory('account/user/edit')->set('o',$this->ao));
}
public function action_resetpassword() {
@@ -66,11 +66,10 @@ class Controller_User_Account extends Controller_Account {
// Run validation and save
if ($this->ao->changed())
if ($this->ao->check()) {
SystemMessage::add(array(
'title'=>_('Record updated'),
'type'=>'info',
'body'=>_('Your account record has been updated.')
));
SystemMessage::factory()
->title('Record updated')
->type('success')
->body(_('Your account record has been updated.'));
$this->ao->save();
@@ -80,25 +79,27 @@ class Controller_User_Account extends Controller_Account {
HTTP::redirect('login');
} else {
// @todo Need to check that this still works with the new bootstrap theming
$output = '';
foreach ($this->ao->validation()->errors('forms/login') as $field => $error)
$output .= sprintf('<li><b>%s</b> %s</li>',$field,$error);
if ($output)
$output = sprintf('<ul>%s</ul>',$output);
SystemMessage::add(array(
'title'=>_('Record NOT updated'),
'type'=>'error',
'body'=>_('Your updates didnt pass validation.').'<br/>'.$output,
));
SystemMessage::factory()
->title(_('Record NOT updated'))
->type('error')
->body(_('Your updates didnt pass validation.').'<br/>'.$output);
}
Block::add(array(
'title'=>_('Password Reset'),
'body'=>View::factory($this->viewpath())
->set('record',$this->ao),
));
// @todo To add JS password validation (minimum length and both values equal)
Block::factory()
->title(sprintf('Password Reset: %s',$this->ao->accnum()))
->title_icon('icon-cog')
->type('form-horizontal')
->body(View::factory('account/user/resetpassword')->set('o',$this->ao));
}
}
?>

View File

@@ -16,8 +16,14 @@ class Controller_Welcome extends Controller_TemplateDefault {
if (! Kohana::$config->load('config')->appname)
HTTP::redirect('guide/app');
// @todo This should be in the DB or something.
HTTP::redirect('product/categorys');
$output = '';
$output = View::factory('pages/welcome');
Style::factory()
->type('file')
->data('media/css/pages/welcome.css');
$this->template->content = $output;
}
public function action_breadcrumb() {