Status updates, SSL updates

This commit is contained in:
Deon George
2013-11-08 22:02:32 +11:00
parent 28ea1ac613
commit 2d9d7f383c
31 changed files with 688 additions and 299 deletions

View File

@@ -183,8 +183,8 @@ class Controller_Admin_Module extends Controller_Module {
'id'=>'ID',
'name'=>'Name',
'notes'=>'Notes',
'status(TRUE)'=>'Active',
'external(TRUE)'=>'External',
'status'=>'Active',
'external'=>'External',
))
->prepend(array(
'id'=>array('url'=>URL::link('admin','module/edit/')),

View File

@@ -28,7 +28,7 @@ class Controller_Reseller_Account extends Controller_Account {
->jssort('customer')
->columns(array(
'id'=>'ID',
'status(TRUE)'=>'Active',
'status'=>'Active',
'accnum()'=>'Num',
'name(TRUE)'=>'Account',
'email'=>'Email',

View File

@@ -0,0 +1,43 @@
<?php defined('SYSPATH') or die('No direct access allowed.');
/**
* This class provides Reseller Summary Stats
*
* @package OSB
* @category Controllers/Reseller
* @author Deon George
* @copyright (c) 2009-2013 Open Source Billing
* @license http://dev.osbill.net/license.html
*/
class Controller_Reseller_Summary extends Controller_Account {
protected $secure_actions = array(
'index'=>TRUE,
);
/**
*/
public function action_index() {
$result = array();
// ADSL
$svs = ORM::factory('Service')->where_authorised()->list_active();
foreach ($svs as $so) {
if (! isset($result[$so->product->prod_plugin_file][$so->product->supplier()])) {
$result[$so->product->prod_plugin_file][$so->product->supplier()]['count'] = 0;
$result[$so->product->prod_plugin_file][$so->product->supplier()]['cost'] = 0;
$result[$so->product->prod_plugin_file][$so->product->supplier()]['revenue'] = 0;
}
$result[$so->product->prod_plugin_file][$so->product->supplier()]['count']++;
$result[$so->product->prod_plugin_file][$so->product->supplier()]['cost'] += $so->product->cost(TRUE);
$result[$so->product->prod_plugin_file][$so->product->supplier()]['revenue'] += $so->revenue(TRUE);
}
Block::factory()
->title('Revenue / Cost Analysis')
->title_icon('icon-info-sign')
->span(6)
->body(View::factory('summary/reseller/index')->set('o',$result));
}
}
?>

View File

@@ -94,7 +94,7 @@ class Controller_Reseller_Welcome extends Controller_Welcome {
'date_payment'=>'Pay Date',
'account->accnum()'=>'Num',
'account->name()'=>'Account',
'account->status(TRUE)'=>'Active',
'account->status'=>'Active',
'total(TRUE)'=>'Total',
'balance(TRUE)'=>'Balance',
))

View File

@@ -36,7 +36,7 @@ class Model_Account extends Model_Auth_UserDefault {
array('Config::date',array(':value')),
),
'status'=>array(
array('StaticList_YesNo::get',array(':value')),
array('StaticList_YesNo::get',array(':value',TRUE)),
),
);

View File

@@ -1,27 +0,0 @@
<?php defined('SYSPATH') or die('No direct access allowed.');
/**
*
* @package OSB
* @category Models
* @author Deon George
* @copyright (c) 2009-2013 Open Source Billing
* @license http://dev.osbill.net/license.html
*/
class Model_Auth_RoleDefault extends Model_Auth_Role {
/**
* Show a bootstrap label button for a field with a boolean value
*/
public function label_bool($column,$render=FALSE) {
if (! isset($this->_table_columns[$column]))
return NULL;
if (! $render)
return $this->display($column);
return View::factory(Config::theme().'/label/bool')
->set('label',$this->$column ? 'label-success' : '')
->set('column',$this->display($column));
}
}
?>

View File

@@ -8,7 +8,7 @@
* @copyright (c) 2009-2013 Open Source Billing
* @license http://dev.osbill.net/license.html
*/
class Model_Group extends Model_Auth_RoleDefault {
class Model_Group extends Model_Auth_Role {
// Relationships
protected $_has_many = array(
'account'=>array('through'=>'account_group'),
@@ -20,7 +20,7 @@ class Model_Group extends Model_Auth_RoleDefault {
protected $_display_filters = array(
'status'=>array(
array('StaticList_YesNo::get',array(':value')),
array('StaticList_YesNo::get',array(':value',TRUE)),
),
);

View File

@@ -26,20 +26,16 @@ class Model_Module extends ORM_OSB {
protected $_display_filters = array(
'external'=>array(
array('StaticList_YesNo::get',array(':value')),
array('StaticList_YesNo::get',array(':value',TRUE)),
),
'name'=>array(
array('strtoupper',array(':value')),
),
'status'=>array(
array('StaticList_YesNo::get',array(':value')),
array('StaticList_YesNo::get',array(':value',TRUE)),
),
);
public function external($render=FALSE) {
return $this->label_bool('external',$render);
}
/**
* Return an instance of this Module's Model
*

View File

@@ -65,6 +65,18 @@ abstract class ORM extends Kohana_ORM {
return $this->where('status','=',TRUE);
}
/**
* Determine if the account is authoised by the user
*/
public function authorised(Model $o=NULL,Model_Account $ao=NULL,$aid='account_id') {
if (is_null($o))
$o = $this;
if (is_null($ao))
$ao = Auth::instance()->get_user();
return in_array($o->{$aid},$ao->RTM->customers($ao->RTM));
}
/**
* Overrides Kohana cache so that it can be globally disabled.
*/
@@ -137,21 +149,6 @@ abstract class ORM extends Kohana_ORM {
$this->_display_filters = Arr::merge($this->_display_filters,$filters);
}
/**
* Show a bootstrap label button for a field with a boolean value
*/
public function label_bool($column,$render=FALSE) {
if (! isset($this->_table_columns[$column]))
return NULL;
if (! $render)
return $this->display($column);
return View::factory(Config::theme().'/label/bool')
->set('label',$this->$column ? 'label-success' : '')
->set('column',$this->display($column));
}
/**
* Function help to find records that are active
*/
@@ -218,10 +215,6 @@ abstract class ORM extends Kohana_ORM {
return $x;
}
public function status($render=FALSE) {
return $this->label_bool('status',$render);
}
public function where_active() {
return $this->_where_active();
}

View File

@@ -17,11 +17,13 @@ class StaticList_YesNo extends StaticList {
);
}
public static function get($value) {
public static function get($value,$format=FALSE) {
if (! $value)
$value = 0;
return static::factory()->_get($value);
return $format ? View::factory(Config::theme().'/label/bool')
->set('label',$value ? 'label-success' : '')
->set('column',static::factory()->_get($value)) : $value;
}
}
?>

View File

@@ -0,0 +1,142 @@
@import url('api.css');
html { background: #FFFFFF; font-size: 70%; }
body { margin: 0; }
ol ol, ol ul, ul ul, ul ol { margin-bottom: 0; }
a img { border: 0; }
h1 small,
h2 small,
h3 small,
h4 small { font-weight: normal; font-size: 0.7em; }
h5 small,
h6 small { font-weight: normal; font-size: 0.8em; }
dl dd { margin-left: 0; }
code {
color:#6BAA3D;
font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;
}
pre {
background:#fff;
border-radius:10px;
padding:1.5em;
font-size:0.9em;
margin-top:1.5em;
margin-bottom:1.5em;
overflow:auto;
}
.highlighted div.line {
font-size:1em;
line-height:1.3 !important;
}
table {
background:#eee;
border-left: 1px solid #CCC;
border-top: 1px solid #CCC;
margin-bottom:1.5em;
width: 100%;
}
table td, table th {
padding:0.4em 0.8em;
line-height:1.4286;
border-right: 1px solid #CCC;
border-bottom: 1px solid #CCC;
}
table th {
background: #ddd;
}
table tr:nth-child(even) {
background: #fff;
}
.caps { text-transform: uppercase; font-size: 0.8em; font-weight: normal; }
.status { text-transform: lowercase; font-variant: small-caps; font-weight: bold; color: #911; }
.container .colborder { border-color: #d3d8bc; }
.note {
padding: 1.5em;
padding-left: 5em;
background: #e8efcf url('../img/lightbulb_48.png') no-repeat 1em center;
border-radius: 0.6em;
overflow: auto;
}
h1 a.permalink,
h2 a.permalink,
h3 a.permalink,
h4 a.permalink,
h5 a.permalink,
h6 a.permalink {
font-size: 0.6em;
line-height: 100%;
vertical-align: middle;
margin-left: 1em;
padding: 0;
font-weight: normal;
display: none;
position: inherit;
}
h1:hover a.permalink,
h2:hover a.permalink,
h3:hover a.permalink,
h4:hover a.permalink,
h5:hover a.permalink,
h6:hover a.permalink {
display: inline;
}
#kodoc-header,
#kodoc-content,
#kodoc-footer { float: left; clear: both; width: 100%; }
#kodoc-header { padding: 20px 0 2em; background: #FAFAFC; }
#kodoc-logo { display: block; float: left; }
#kodoc-menu { float: right; margin-top: 12px; background: #050505; -moz-border-radius: 5px; -webkit-border-radius: 5px; }
#kodoc-menu ul { float: left; margin: 0; padding: 0 0.5em 0 0; }
#kodoc-menu li { display: block; float: left; margin: 0; padding: 0; }
#kodoc-menu li.first { padding-left: 0.5em; }
#kodoc-menu li a { display: block; height: 32px; line-height: 32px; padding: 0 0.8em; border-right: solid 1px #050505; border-left: solid 1px #050505; letter-spacing: 0.05em; text-decoration: none; text-transform: uppercase; color: #FCFCFE; font-size: 90%; }
#kodoc-menu li.first a { border-left: 0; }
#kodoc-menu li.last a { border-right: 0; }
#kodoc-menu li a:hover { background: #353535; color: #FCFCFE; text-shadow: #FFFFFF 0 0 1px; }
#kodoc-content { background: #FCFCFE; }
#kodoc-content .wrapper { min-height: 390px; padding: 1em 0; }
#kodoc-content div.page-toc { float: right; margin: 1em; margin-top: 0; padding: 1em; background: #fff; border: solid 0.1em #e8efcf; border-radius: 0.6em; }
#kodoc-content p.intro { padding: 1em 20px; padding-left: 20px; margin: 0 -20px; font-size: 1.2em; }
#kodoc-content a { color: #004352; }
#kodoc-content a:hover { color: #00758f; }
#kodoc-content a:active { text-decoration: none; }
#kodoc-breadcrumb { margin: 0 0 1em; padding: 0 0 0.5em; list-style: none; border-bottom: solid 1px #e8efcf; }
#kodoc-breadcrumb li { display: inline-block; margin: 0; padding: 0 0.4em 0 0; text-transform: uppercase; font-size: 11px; }
#kodoc-breadcrumb li:before { content: '»'; padding-right: 0.4em; }
#kodoc-breadcrumb li a { color: #999; text-decoration: none; }
#kodoc-topics { }
#kodoc-topics ul,
#kodoc-topics ol { list-style-type:none; margin: 0; padding: 0;}
#kodoc-topics ul li,
#kodoc-topics ol li { margin:0; padding: 0; margin-left: 1em; }
#kodoc-topics ul li a.current,
#kodoc-topics ol li a.current { font-weight: bold; }
#kodoc-topics span,
#kodoc-topics a { display: block; padding: 0; margin: 0; }
#kodoc-topics span { cursor: pointer; }
#kodoc-topics span.toggle { display: block; float: left; width: 1em; padding-right: 0.4em; margin-left: -1.4em; text-align: center; }
#kodoc-topics li span { cursor:pointer; }
#kodoc-footer { padding: 1em 0; background: #FAFAFC; color: #050505; text-shadow: #FFFFFF 0.1em 0.1em 1px; font-size: 0.9em; }
#kodoc-footer a { color: #809397; }
#kodoc-footer div.last { text-align: right; }

View File

@@ -28,7 +28,7 @@
<tr>
<td><?php echo HTML::anchor(URL::link('admin','group/edit/'.$go->id,TRUE),$go->display('name')); ?></td>
<td><?php echo $go->display('notes'); ?></td>
<td><?php echo $go->label_bool('status',TRUE); ?></td>
<td><?php echo $go->display('status'); ?></td>
<td><?php echo Form::checkbox('groups[]',$go->id,$o->has('group',$go)); ?></td>
</tr>
<?php endforeach ?>

View File

@@ -0,0 +1,110 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $l = substr(I18n::$lang, 0, 2) ?>" lang="<?php echo $l ?>">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title><?php echo $title ?> | Kohana <?php echo __('User Guide'); ?></title>
<?php foreach ($styles as $style => $media) echo HTML::style($style, array('media' => $media), NULL, TRUE), "\n" ?>
<?php foreach ($scripts as $script) echo HTML::script($script, NULL, NULL, TRUE), "\n" ?>
<!--[if lt IE 9]>
<script src="http://ie7-js.googlecode.com/svn/version/2.1(beta4)/IE9.js"></script>
<![endif]-->
</head>
<body>
<div id="kodoc-header">
<div class="container">
<a href="http://phpTSMadmin.sf.net/" id="kodoc-logo">
<img src="<?php echo Route::url('docs/media', array('file' => 'img/logo-small.png')) ?>" />
</a>
<div id="kodoc-menu">
<ul>
<li class="guide first">
<a href="<?php echo Route::url('docs/guide') ?>"><?php echo __('User Guide') ?></a>
</li>
<?php if (Kohana::$config->load('userguide.api_browser')): ?>
<li class="api">
<a href="<?php echo Route::url('docs/api') ?>"><?php echo __('API Browser') ?></a>
</li>
<?php endif ?>
</ul>
</div>
</div>
</div>
<div id="kodoc-content">
<div class="wrapper">
<div class="container">
<div class="span-22 prefix-1 suffix-1">
<ul id="kodoc-breadcrumb">
<?php foreach ($breadcrumb as $link => $title): ?>
<?php if (is_string($link)): ?>
<li><?php echo HTML::anchor($link, $title, NULL, NULL, TRUE) ?></li>
<?php else: ?>
<li class="last"><?php echo $title ?></li>
<?php endif ?>
<?php endforeach ?>
</ul>
</div>
<div class="span-6 prefix-1">
<div id="kodoc-topics">
<?php echo $menu ?>
</div>
</div>
<div id="kodoc-body" class="span-16 suffix-1 last">
<?php echo $content ?>
<?php if ($show_comments): ?>
<div id="disqus_thread" class="clear"></div>
<script type="text/javascript">
var disqus_identifier = '<?php echo HTML::chars(Request::current()->uri()) ?>';
(function() {
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
dsq.src = 'http://kohana.disqus.com/embed.js';
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
})();
</script>
<noscript><?php echo __('Please enable JavaScript to view the :anchor_open comments powered by Disqus.:anchor_close', array(':anchor_open' => '<a href="http://disqus.com/?ref_noscript=kohana">', ':anchor_close' => '</a>')); ?></noscript>
<a href="http://disqus.com" class="dsq-brlink">Documentation comments powered by <span class="logo-disqus">Disqus</span></a>
<?php endif ?>
</div>
</div>
</div>
</div>
<div id="kodoc-footer">
<div class="container">
<div class="span-12">
<?php if (isset($copyright)): ?>
<p><?php echo $copyright ?></p>
<?php else: ?>
&nbsp;
<?php endif ?>
</div>
<div class="span-12 last right">
<p>Powered by <?php echo HTML::anchor('http://kohanaframework.org/', 'Kohana') ?> v<?php echo Kohana::VERSION ?></p>
</div>
</div>
</div>
<?php if (Kohana::$environment === Kohana::PRODUCTION): ?>
<script type="text/javascript">
//<![CDATA[
(function() {
var links = document.getElementsByTagName('a');
var query = '?';
for(var i = 0; i < links.length; i++) {
if(links[i].href.indexOf('#disqus_thread') >= 0) {
query += 'url' + i + '=' + encodeURIComponent(links[i].href) + '&';
}
}
document.write('<script charset="utf-8" type="text/javascript" src="http://disqus.com/forums/kohana/get_num_replies.js' + query + '"></' + 'script>');
})();
//]]>
</script>
<?php endif ?>
</body>
</html>