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', 'id'=>'ID',
'name'=>'Name', 'name'=>'Name',
'notes'=>'Notes', 'notes'=>'Notes',
'status(TRUE)'=>'Active', 'status'=>'Active',
'external(TRUE)'=>'External', 'external'=>'External',
)) ))
->prepend(array( ->prepend(array(
'id'=>array('url'=>URL::link('admin','module/edit/')), 'id'=>array('url'=>URL::link('admin','module/edit/')),

View File

@ -28,7 +28,7 @@ class Controller_Reseller_Account extends Controller_Account {
->jssort('customer') ->jssort('customer')
->columns(array( ->columns(array(
'id'=>'ID', 'id'=>'ID',
'status(TRUE)'=>'Active', 'status'=>'Active',
'accnum()'=>'Num', 'accnum()'=>'Num',
'name(TRUE)'=>'Account', 'name(TRUE)'=>'Account',
'email'=>'Email', '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', 'date_payment'=>'Pay Date',
'account->accnum()'=>'Num', 'account->accnum()'=>'Num',
'account->name()'=>'Account', 'account->name()'=>'Account',
'account->status(TRUE)'=>'Active', 'account->status'=>'Active',
'total(TRUE)'=>'Total', 'total(TRUE)'=>'Total',
'balance(TRUE)'=>'Balance', 'balance(TRUE)'=>'Balance',
)) ))

View File

@ -36,7 +36,7 @@ class Model_Account extends Model_Auth_UserDefault {
array('Config::date',array(':value')), array('Config::date',array(':value')),
), ),
'status'=>array( '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 * @copyright (c) 2009-2013 Open Source Billing
* @license http://dev.osbill.net/license.html * @license http://dev.osbill.net/license.html
*/ */
class Model_Group extends Model_Auth_RoleDefault { class Model_Group extends Model_Auth_Role {
// Relationships // Relationships
protected $_has_many = array( protected $_has_many = array(
'account'=>array('through'=>'account_group'), 'account'=>array('through'=>'account_group'),
@ -20,7 +20,7 @@ class Model_Group extends Model_Auth_RoleDefault {
protected $_display_filters = array( protected $_display_filters = array(
'status'=>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( protected $_display_filters = array(
'external'=>array( 'external'=>array(
array('StaticList_YesNo::get',array(':value')), array('StaticList_YesNo::get',array(':value',TRUE)),
), ),
'name'=>array( 'name'=>array(
array('strtoupper',array(':value')), array('strtoupper',array(':value')),
), ),
'status'=>array( '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 * 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); 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. * 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); $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 * Function help to find records that are active
*/ */
@ -218,10 +215,6 @@ abstract class ORM extends Kohana_ORM {
return $x; return $x;
} }
public function status($render=FALSE) {
return $this->label_bool('status',$render);
}
public function where_active() { public function where_active() {
return $this->_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) if (! $value)
$value = 0; $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> <tr>
<td><?php echo HTML::anchor(URL::link('admin','group/edit/'.$go->id,TRUE),$go->display('name')); ?></td> <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->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> <td><?php echo Form::checkbox('groups[]',$go->id,$o->has('group',$go)); ?></td>
</tr> </tr>
<?php endforeach ?> <?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>

View File

@ -53,7 +53,7 @@ class Controller_Admin_Adsl extends Controller_Adsl {
'service'=>'Service Login', 'service'=>'Service Login',
'plan->service->id'=>'Service', 'plan->service->id'=>'Service',
'plan->service_number'=>'Service', 'plan->service_number'=>'Service',
'plan->service->status(TRUE)'=>'Active', 'plan->service->status'=>'Active',
'up_peak'=>'Up Peak', 'up_peak'=>'Up Peak',
'down_peak'=>'Down Peak', 'down_peak'=>'Down Peak',
'up_offpeak'=>'Up OffPeak', 'up_offpeak'=>'Up OffPeak',

View File

@ -36,7 +36,7 @@ class Model_Charge extends ORM_OSB {
array('Config::date',array(':value')), array('Config::date',array(':value')),
), ),
'processed'=>array( 'processed'=>array(
array('StaticList_YesNo::get',array(':value')), array('StaticList_YesNo::get',array(':value',TRUE)),
), ),
'sweep_type'=>array( 'sweep_type'=>array(
array('StaticList_SweepType::get',array(':value')), array('StaticList_SweepType::get',array(':value')),
@ -59,10 +59,6 @@ class Model_Charge extends ORM_OSB {
} }
} }
public function processed($render=FALSE) {
return $this->label_bool('processed',$render);
}
public function total($format=FALSE) { public function total($format=FALSE) {
$result = $this->quantity * $this->amount; $result = $this->quantity * $this->amount;

View File

@ -81,7 +81,7 @@ class Controller_Reseller_Export extends Controller_Export {
'id'=>'ID', 'id'=>'ID',
'account->name(TRUE)'=>'Account', 'account->name(TRUE)'=>'Account',
'date_orig'=>'Date', 'date_orig'=>'Date',
'status(TRUE)'=>'Active', 'status'=>'Active',
'total(TRUE)'=>'Total', 'total(TRUE)'=>'Total',
'exported'=>'Exported', 'exported'=>'Exported',
),$emo->display ? $emo->display : array())) ),$emo->display ? $emo->display : array()))

View File

@ -125,6 +125,9 @@ class Model_Invoice extends ORM_OSB implements Cartable {
* Returns the array of Email Template Objects * Returns the array of Email Template Objects
*/ */
public function reminders($key=NULL,$format=FALSE) { public function reminders($key=NULL,$format=FALSE) {
if (is_null($key) AND ! $this->reminders)
return array();
$prefix = 'task_invoice_'; $prefix = 'task_invoice_';
if (is_null($key)) { if (is_null($key)) {

View File

@ -167,7 +167,7 @@ $(document).ready(function() {
array( array(
'id'=>array('label'=>'ID','url'=>URL::link('admin','product/view/')), 'id'=>array('label'=>'ID','url'=>URL::link('admin','product/view/')),
'title()'=>array('label'=>'Details'), 'title()'=>array('label'=>'Details'),
'status(TRUE)'=>array('label'=>'Active'), 'status'=>array('label'=>'Active'),
'prod_plugin_file'=>array('label'=>'Plugin Name'), 'prod_plugin_file'=>array('label'=>'Plugin Name'),
'prod_plugin_data'=>array('label'=>'Plugin Data'), 'prod_plugin_data'=>array('label'=>'Plugin Data'),
'price_type'=>array('label'=>'Price Type'), 'price_type'=>array('label'=>'Price Type'),
@ -199,7 +199,7 @@ $(document).ready(function() {
'account->accnum()'=>array(), 'account->accnum()'=>array(),
'account->name()'=>array('label'=>'Account'), 'account->name()'=>array('label'=>'Account'),
'name()'=>array('label'=>'Details'), 'name()'=>array('label'=>'Details'),
'status(TRUE)'=>array('label'=>'Active'), 'status'=>array('label'=>'Active'),
'price(TRUE,TRUE)'=>array('label'=>'Price','align'=>'right'), 'price(TRUE,TRUE)'=>array('label'=>'Price','align'=>'right'),
), ),
array( array(

View File

@ -32,7 +32,7 @@ class Controller_Reseller_Service extends Controller_Service {
'service_name()'=>'Service', 'service_name()'=>'Service',
'recur_schedule'=>'Billing', 'recur_schedule'=>'Billing',
'price(TRUE,TRUE)'=>'Price', 'price(TRUE,TRUE)'=>'Price',
'status(TRUE)'=>'Active', 'status'=>'Active',
'account->accnum()'=>'Cust ID', 'account->accnum()'=>'Cust ID',
'account->name()'=>'Customer', 'account->name()'=>'Customer',
)) ))

View File

@ -48,7 +48,7 @@ class Controller_User_Service extends Controller_Service {
'service_name()'=>'Service', 'service_name()'=>'Service',
'recur_schedule'=>'Billing', 'recur_schedule'=>'Billing',
'price(TRUE,TRUE)'=>'Price', 'price(TRUE,TRUE)'=>'Price',
'status(TRUE)'=>'Active', 'status'=>'Active',
)) ))
->prepend(array( ->prepend(array(
'id'=>array('url'=>URL::link('user','service/view/')), 'id'=>array('url'=>URL::link('user','service/view/')),

View File

@ -39,11 +39,14 @@ class Model_Service extends ORM_OSB {
'date_next_invoice'=>array( 'date_next_invoice'=>array(
array('Config::date',array(':value')), array('Config::date',array(':value')),
), ),
'price_override'=>array(
array('Currency::display',array(':value')),
),
'recur_schedule'=>array( 'recur_schedule'=>array(
array('StaticList_RecurSchedule::get',array(':value')), array('StaticList_RecurSchedule::get',array(':value')),
), ),
'status'=>array( 'status'=>array(
array('StaticList_YesNo::get',array(':value')), array('StaticList_YesNo::get',array(':value',TRUE)),
), ),
); );
@ -226,12 +229,15 @@ class Model_Service extends ORM_OSB {
/** /**
* Return the service charge * Return the service charge
*/ */
public function price($tax=FALSE,$format=FALSE) { public function price($tax=FALSE,$format=FALSE,$original=FALSE) {
$x = $this->product->keyget('price_group',$this->recur_schedule); $x = $this->product->keyget('price_group',$this->recur_schedule);
// @todo This index shouldnt be hard coded. // @todo This index shouldnt be hard coded.
$p = ! is_null($this->price) ? $this->price : $x[$this->price_group]['price_base']; $p = ! is_null($this->price) ? $this->price : $x[$this->price_group]['price_base'];
if (! $original AND ! is_null($this->price_override))
$p = $this->price_override;
if ($tax) if ($tax)
$p = Tax::add($p); $p = Tax::add($p);

View File

@ -8,13 +8,13 @@
<dd><?php printf('%s (%s)',$o->account->name(),$o->account->accnum()); ?></dd> <dd><?php printf('%s (%s)',$o->account->name(),$o->account->accnum()); ?></dd>
<dt>Service Active</dt> <dt>Service Active</dt>
<dd><?php echo $o->label_bool('status',TRUE); ?></dd> <dd><?php echo $o->display('status'); ?></dd>
<dt>Billing Period</dt> <dt>Billing Period</dt>
<dd><?php echo $o->display('recur_schedule');?></dd> <dd><?php echo $o->display('recur_schedule');?></dd>
<dt>Cost</dt> <dt>Cost</dt>
<dd><?php echo $o->price(TRUE,TRUE); if ($o->pending_change()) echo ' *'; ?></dd> <dd><?php echo (! is_null($o->price_override) ? sprintf('<strike>%s</strike> ',$o->price(TRUE,TRUE,TRUE)) : ''). $o->price(TRUE,TRUE); if ($o->pending_change()) echo ' *'; ?></dd>
<?php if (is_null($o->price) OR ($o->price<=$o->product->price($o->price_group,$o->recur_schedule,'price_base'))) : ?> <?php if (is_null($o->price) OR ($o->price<=$o->product->price($o->price_group,$o->recur_schedule,'price_base'))) : ?>
<dt>Service</dt> <dt>Service</dt>
@ -28,7 +28,7 @@
<dd><?php echo $o->paid_to(TRUE); ?></dd> <dd><?php echo $o->paid_to(TRUE); ?></dd>
<dt>Date Next Invoice</dt> <dt>Date Next Invoice</dt>
<dd><?php echo $o->display('date_next_invoice'); ?></dd> <dd><?php printf($o->suspend_billing ? '<strike>%s</strike>' : '%s',$o->display('date_next_invoice')); ?></dd>
<dt>Current Invoices Due</dt> <dt>Current Invoices Due</dt>
<dd><?php echo $o->due(TRUE); ?></dd> <dd><?php echo $o->due(TRUE); ?></dd>

View File

@ -1,109 +0,0 @@
<?php defined('SYSPATH') or die('No direct access allowed.');
/**
* This class provides Admin SSL functions
*
* @package SSL
* @category Controllers/Admin
* @author Deon George
* @copyright (c) 2009-2013 Open Source Billing
* @license http://dev.osbill.net/license.html
*/
class Controller_Admin_SSL extends Controller_TemplateDefault_Admin {
protected $secure_actions = array(
'add'=>TRUE,
'list'=>TRUE,
'view'=>TRUE,
);
public function action_list() {
Block::add(array(
'title'=>_('SSL CA Certificates'),
'body'=>Table::display(
ORM::factory('SSL_CA')->find_all(),
25,
array(
'id'=>array('label'=>'ID','url'=>URL::link('admin','ssl/view/')),
'sign_cert'=>array('label'=>'Cert'),
'issuer()'=>array('label'=>'Issuer'),
'valid_to(TRUE)'=>array('label'=>'Expires'),
),
array(
'page'=>TRUE,
'type'=>'select',
'form'=>URL::link('admin','ssl/view'),
)),
));
}
private function add_view($id=NULL,$output='') {
$so = ORM::factory('SSL_CA',$id);
if ($_POST) {
if ($so->values($_POST)->changed()) {
try {
$so->save();
SystemMessage::add(array(
'title'=>'SSL Certificate Saved',
'type'=>'info',
'body'=>'SSL Certificate successfully recorded.',
));
} catch (ORM_Validation_Exception $e) {
$errors = $e->errors('models');
SystemMessage::add(array(
'title'=>'SSL Certificate NOT saved',
'type'=>'error',
'body'=>join("\n",array_values($errors)),
));
$so->reload();
}
}
}
$output .= Form::open();
$output .= View::factory('ssl/admin/add_view')
->set('o',$so);
$output .= Form::submit('submit','submit',array('class'=>'form_button'));
$output .= Form::close();
return $output;
}
public function action_add() {
Block::add(array(
'title'=>_('Add SSL CA Certificate'),
'body'=>$this->add_view(),
));
}
public function action_view() {
list($id,$output) = Table::page(__METHOD__);
Block::add(array(
'title'=>sprintf('%s: %s (%s)',_('View SSL CA Certificate'),$id,ORM::factory('SSL_CA',$id)->display('sign_cert')),
'body'=>$this->add_view($id,$output),
));
Block::add(array(
'title'=>_('Services using this Certificate'),
'body'=>Table::display(
ORM::factory('SSL_CA',$id)->list_issued(),
25,
array(
'id'=>array('label'=>'ID','url'=>URL::link('admin','service/view/')),
'plugin()->dn()'=>array('label'=>'Cert'),
'plugin()->valid_to(TRUE)'=>array('label'=>'Expires'),
),
array(
'page'=>TRUE,
'type'=>'select',
'form'=>URL::link('admin','service/view'),
)),
));
}
}
?>

View File

@ -0,0 +1,162 @@
<?php defined('SYSPATH') or die('No direct access allowed.');
/**
* This class provides Reseller SSL functions
*
* @package SSL
* @category Controllers/Reseller
* @author Deon George
* @copyright (c) 2009-2013 Open Source Billing
* @license http://dev.osbill.net/license.html
*/
class Controller_Reseller_SSL extends Controller_SSL {
protected $secure_actions = array(
'add'=>TRUE,
'edit'=>TRUE,
'list'=>TRUE,
'renew'=>TRUE,
'listchildca'=>TRUE,
'listchildcrt'=>TRUE,
);
public function action_list() {
Block::factory()
->title('SSL CA Certificates')
->title_icon('icon-th-list')
->body(Table::factory()
->jssort('ca')
->data(ORM::factory('SSL_CA')->where_authorised($this->ao)->find_all())
->columns(array(
'id'=>'ID',
'sign_cert'=>'Cert',
'valid_to(TRUE)'=>'Expires',
'validParent(TRUE)'=>'Valid',
'childca(TRUE)'=>'cCA',
'childcrt(TRUE)'=>'Crts',
'issuer()'=>'Issuer',
))
->prepend(array(
'id'=>array('url'=>URL::link('reseller','ssl/edit/')),
'childca(TRUE)'=>array('url_resolve'=>URL::link('reseller','ssl/listchildca/%id%')),
'childcrt(TRUE)'=>array('url_resolve'=>URL::link('reseller','ssl/listchildcrt/%id%')),
))
);
}
public function action_listchildca() {
list($id,$output) = Table::page(__METHOD__);
$sco = ORM::factory('SSL_CA',$id);
if ($sco->childca())
Block::factory()
->title(sprintf('SSL CA Certificates for CA: %s',$sco->dn()))
->title_icon('icon-th-list')
->body(Table::factory()
->jssort('ca')
->data($sco->where_authorised($this->ao)->list_childca())
->columns(array(
'id'=>'ID',
'sign_cert'=>'Cert',
'ski()'=>'Identifier',
'valid_to(TRUE)'=>'Expires',
'validParent(TRUE)'=>'Valid',
'childca()'=>'cCA',
'childcrt()'=>'Crts',
))
->prepend(array(
'id'=>array('url'=>URL::link('reseller','ssl/edit/')),
'childca()'=>array('url_resolve'=>URL::link('reseller','ssl/listchildca/%id%')),
'childcrt()'=>array('url_resolve'=>URL::link('reseller','ssl/listchildcrt/%id%')),
))
);
if ($sco->childcrt())
$this->action_listchildcrt();
}
public function action_listchildcrt() {
list($id,$output) = Table::page(__METHOD__);
$sco = ORM::factory('SSL_CA',$id);
Block::factory()
->title(sprintf('SSL Certificates for CA: %s',$sco->dn()))
->title_icon('icon-th-list')
->body(Table::factory()
->jssort('crt')
->data($sco->where_authorised($this->ao)->list_childcrt())
->columns(array(
'id'=>'ID',
'plugin()->dn()'=>'Cert',
'plugin()->valid_to(TRUE)'=>'Expires',
))
->prepend(array(
'id'=>array('url'=>URL::link('user','service/view/')),
))
);
}
public function action_add() {
Block::factory()
->type('form-horizontal')
->title('Add/View SSL CA')
->title_icon('icon-wrench')
->body($this->add_edit());
}
public function action_edit() {
list($id,$output) = Table::page(__METHOD__);
Block::factory()
->type('form-horizontal')
->title(sprintf('%s: %s',_('Add/View SSL CA'),$id))
->title_icon('icon-wrench')
->body($this->add_edit($id,$output));
}
public function action_renew() {
$so = ORM::factory('Service',Request::current()->param('id'));
if (! $so->loaded() OR ! Auth::instance()->authorised($so->account)) {
SystemMessage::factory()
->title('SSL Certificate not updated')
->type('error')
->body('Either the Service doesnt exist, or you are not authorised to see it');
HTTP::redirect('welcome');
}
$so->plugin()->renew();
HTTP::redirect(URL::link('user','service/view/'.$so->id));
}
private function add_edit($id=NULL,$output='') {
$sco = ORM::factory('SSL_CA',$id);
if ($_POST) {
// Entry updated
if ($sco->values($_POST)->check()) {
try {
$sco->save();
SystemMessage::factory()
->title('Record updated')
->type('success')
->body(_('Your Charge record has been recorded/updated.'));
} catch (ORM_Validation_Exception $e) {
$errors = $e->errors('models');
SystemMessage::factory()
->title('Record NOT updated')
->type('error')
->body(join('<br/>',array_values($errors)));
$sco->reload();
}
}
}
return View::factory('ssl/reseller/add_edit')
->set('o',$sco);
}
}
?>

View File

@ -13,7 +13,11 @@ class Model_SSL_CA extends ORM_OSB {
protected $_updated_column = FALSE; protected $_updated_column = FALSE;
// Relationships // Relationships
protected $_belongs_to = array(
'parent'=>array('model'=>'ssl_ca','foreign_key'=>'parent_ssl_ca_id'),
);
protected $_has_many = array( protected $_has_many = array(
'children'=>array('model'=>'ssl_ca','far_key'=>'id','foreign_key'=>'parent_ssl_ca_id'),
'service'=>array('through'=>'service__ssl'), 'service'=>array('through'=>'service__ssl'),
); );
@ -23,6 +27,14 @@ class Model_SSL_CA extends ORM_OSB {
), ),
); );
public function filters() {
return array(
'parent_ssl_ca_id'=>array(
array(array($this,'filter_getParent')),
)
);
}
public function rules() { public function rules() {
return array( return array(
'sign_cert'=>array( 'sign_cert'=>array(
@ -30,19 +42,11 @@ class Model_SSL_CA extends ORM_OSB {
array(array($this,'isCA')), array(array($this,'isCA')),
), ),
'parent_ssl_ca_id'=>array( 'parent_ssl_ca_id'=>array(
array(array($this,'Rule_ParentExists')), array(array($this,'rule_parentExist')),
), ),
); );
} }
public function filters() {
return array(
'parent_ssl_ca_id'=>array(
array(array($this,'Filter_GetParent')),
)
);
}
private $_so = NULL; private $_so = NULL;
/** /**
@ -51,10 +55,13 @@ class Model_SSL_CA extends ORM_OSB {
public function __call($name,$args) { public function __call($name,$args) {
$m = 'get_'.$name; $m = 'get_'.$name;
if (is_null($this->_so))
return NULL;
if (method_exists($this->_so,$m)) if (method_exists($this->_so,$m))
return $this->_so->{$m}($args); return $this->_so->{$m}($args);
else else
throw new Kohana_Exception('Unknown method :method',array(':method'=>$name)); throw new Kohana_Exception('Unknown method :method for :class',array(':method'=>$m,':class'=>get_class($this->_so)));
} }
// We want to inject the SSL object into this Model // We want to inject the SSL object into this Model
@ -67,6 +74,42 @@ class Model_SSL_CA extends ORM_OSB {
return $this; return $this;
} }
/**
* List the child CA certs
*/
public function childca($children=FALSE) {
$result = 0;
if ($children)
foreach ($this->list_childca() as $cao)
$result += $cao->childca($children);
return $result+$this->list_childca()->count();
}
public function childcrt($children=FALSE) {
$result = 0;
if ($children)
foreach ($this->list_childca() as $cao)
$result += $cao->childcrt($children);
return $result+$this->list_childcrt()->count();
}
/**
* Make sure we have our parent in the DB too
*/
public function validParent($format=FALSE) {
$result = NULL;
// If we are a root cert, we are valid
if (is_null($this->parent_ssl_ca_id) AND $this->isRoot())
return StaticList_YesNo::get(TRUE,$format);
return StaticList_YesNo::get($this->aki_keyid() == $this->parent->ski(),$format);
}
// If we change the SSL certificate, we need to reload our SSL object // If we change the SSL certificate, we need to reload our SSL object
public function values(array $values, array $expected = NULL) { public function values(array $values, array $expected = NULL) {
parent::values($values,$expected); parent::values($values,$expected);
@ -77,20 +120,23 @@ class Model_SSL_CA extends ORM_OSB {
return $this; return $this;
} }
// @todo This could require some optimisation, by storing the keyid in the database and then getting the DB just to return that parent public function filter_getParent() {
public function Filter_GetParent() {
foreach (ORM::factory($this->_object_name)->find_all() as $sco) foreach (ORM::factory($this->_object_name)->find_all() as $sco)
if ($sco->aki_keyid() == $this->aki_keyid()) if ($sco->aki_keyid() == $this->aki_keyid())
return $sco->id; return $sco->id;
} }
public function Rule_ParentExists() { public function list_childca() {
// Our parent_ssl_ca_id should have been populated by Filter_GetParent(). return $this->children->find_all();
return $this->parent_ssl_ca_id OR $this->isRoot();
} }
public function list_issued() { public function list_childcrt() {
return $this->service->find_all(); return $this->service->where_active()->find_all();
}
public function rule_parentExist() {
// Our parent_ssl_ca_id should have been populated by filter_GetParent().
return $this->parent_ssl_ca_id OR $this->isRoot();
} }
} }
?> ?>

View File

@ -18,7 +18,7 @@ class Model_Service_Plugin_Ssl extends Model_Service_Plugin {
'service'=>array(), 'service'=>array(),
); );
protected $_has_one = array( protected $_has_one = array(
'SSL_CA'=>array('far_key'=>'ssl_ca_id','foreign_key'=>'id'), 'ca'=>array('model'=>'SSL_CA','far_key'=>'ssl_ca_id','foreign_key'=>'id'),
); );
protected $_display_filters = array( protected $_display_filters = array(
@ -31,9 +31,23 @@ class Model_Service_Plugin_Ssl extends Model_Service_Plugin {
); );
// Required abstract functions // Required abstract functions
public function username_value() {} // Not used public function expire($format=FALSE) {
return $this->_so->get_valid_to($format);
}
public function name() {
return ($this->cert AND $this->ca->loaded()) ? sprintf('%s:%s',$this->ca->subject(),$this->display('cert')) : $this->display('csr');
}
public function password_value() {} // Not used public function password_value() {} // Not used
public function service_view() {
return View::factory('service/user/plugin/ssl/view')
->set('o',$this);
}
public function username_value() {} // Not used
private $_so = NULL; private $_so = NULL;
/** /**
@ -58,6 +72,10 @@ class Model_Service_Plugin_Ssl extends Model_Service_Plugin {
return $this; return $this;
} }
public function validCA() {
return $this->ca->validParent();
}
// If we change the SSL certificate, we need to reload our SSL object // If we change the SSL certificate, we need to reload our SSL object
public function values(array $values, array $expected = NULL) { public function values(array $values, array $expected = NULL) {
parent::values($values,$expected); parent::values($values,$expected);
@ -68,19 +86,6 @@ class Model_Service_Plugin_Ssl extends Model_Service_Plugin {
return $this; return $this;
} }
public function expire($format=FALSE) {
return $this->_so->get_valid_to($format);
}
public function name() {
return ($this->cert AND $this->SSL_CA->loaded()) ? sprintf('%s:%s',$this->SSL_CA->subject(),$this->display('cert')) : $this->display('csr');
}
public function service_view() {
return View::factory('service/user/plugin/ssl/view')
->set('o',$this);
}
/** /**
* Get specific service details for use in other modules * Get specific service details for use in other modules
* For Example: Invoice * For Example: Invoice
@ -103,7 +108,7 @@ class Model_Service_Plugin_Ssl extends Model_Service_Plugin {
public function admin_update() { public function admin_update() {
return View::factory('service/admin/plugin/ssl/update') return View::factory('service/admin/plugin/ssl/update')
->set('mediapath',Route::get('default/media')) ->set('mediapath',Route::get('default/media'))
->set('so',$this); ->set('o',$this);
} }
public function download_button() { public function download_button() {
@ -134,17 +139,21 @@ class Model_Service_Plugin_Ssl extends Model_Service_Plugin {
return $result; return $result;
} }
public function renew() { /**
$d = SSL::instance($this->cert); * Renew an SSL Certificate
*/
public function renew($force=FALSE) {
$sslo = SSL::instance($this->cert);
$ssl_conf = Kohana::$config->load('ssl'); $ssl_conf = Kohana::$config->load('ssl');
// @todo change this so an admin can force this.
$force = TRUE;
// If our certificate is not old enough skip // If our certificate is not old enough skip
if ($d->get_valid_to() > time()+$ssl_conf['min_renew_days']*86400 AND ! $force) if ($sslo->get_valid_to() > time()+$ssl_conf['min_renew_days']*86400 AND ! $force)
return FALSE; return FALSE;
$res = openssl_csr_sign($this->csr,$this->SSL_CA->sign_cert,$this->SSL_CA->sign_pk,$this->service->product->plugin()->days,array( $today = mktime(0,0,0,date('n'),date('j'),date('Y'));
$days = (int)(($this->service->invoiced_to()-$today)/86400);
$res = openssl_csr_sign($this->csr,$this->ca->sign_cert,$this->ca->sign_pk,$days,array(
'config'=>$ssl_conf['config'], 'config'=>$ssl_conf['config'],
'x509_extensions'=>$this->service->product->plugin()->extensions, 'x509_extensions'=>$this->service->product->plugin()->extensions,
'digest_alg'=>'sha1', 'digest_alg'=>'sha1',
@ -155,11 +164,12 @@ class Model_Service_Plugin_Ssl extends Model_Service_Plugin {
$this->save(); $this->save();
return TRUE; return TRUE;
} else { } else {
print_r(array( print_r(array(
'csr'=>$this->csr, 'csr'=>$this->csr,
'ca'=>$this->SSL_CA->sign_cert, 'ca'=>$this->ca->sign_cert,
'capk'=>$this->SSL_CA->sign_pk, 'capk'=>$this->ca->sign_pk,
'days'=>$this->service->product->plugin()->days, 'days'=>$this->service->product->plugin()->days,
'ssl'=>$ssl_conf, 'ssl'=>$ssl_conf,
'x509e'=>$this->service->product->plugin()->extensions 'x509e'=>$this->service->product->plugin()->extensions

View File

@ -12,14 +12,14 @@
class Task_SSL_Renew extends Minion_Task { class Task_SSL_Renew extends Minion_Task {
protected $_options = array( protected $_options = array(
'id'=>NULL, 'id'=>NULL,
'force'=>FALSE,
); );
/** /**
* Renew a certificate * Renew a certificate
*/ */
protected function _execute(array $params) { protected function _execute(array $params) {
// @todo, Change this to be a SSL id, maybe list all the certs expiring ORM::factory('Service',$params['id'])->plugin()->renew($params['force']);
ORM::factory('Service',$params['id'])->plugin()->renew();
} }
} }
?> ?>

View File

@ -3,9 +3,6 @@
<div class="dl-horizontal"> <div class="dl-horizontal">
<dt>Validatity Days</dt>
<dd><?php echo $po->display('days'); ?></dd>
<dt>Type</dt> <dt>Type</dt>
<dd><?php echo $po->display('extensions'); ?></dd> <dd><?php echo $po->display('extensions'); ?></dd>

View File

@ -3,14 +3,26 @@
<div class="dl-horizontal"> <div class="dl-horizontal">
<dt>Subject</dt> <dt>DN</dt>
<dd><?php echo $o->dn(); ?></dd> <dd><?php echo $o->dn(); ?></dd>
<dt>Issuer</dt> <dt>Serial Number</dt>
<dd><?php echo $o->issuerdn(); ?></dd> <dd><?php echo $o->serial(); ?></dd>
<dt>CA</dt> <dt>Subject Key Id</dt>
<dd><?php echo $o->SSL_CA->loaded() ? $o->SSL_CA->subject() : $o->issuer(); ?></dd> <dd><?php echo $o->ski(); ?></dd>
<dt>Issuer</dt>
<dd>
<?php if ($o->validCA() AND $o->authorised($o->ca)) : ?>
<?php echo HTML::anchor(URL::link('reseller','ssl/edit/').$o->ca->id,$o->issuer()); ?>
<?php else : ?>
<?php echo $o->issuer(); ?>
<?php endif ?>
</dd>
<dt>Issuer Serial</dt>
<dd><?php printf('%s (%s)',$o->aki_keyid(), $o->aki_serial()); ?></dd>
<dt>Valid From</dt> <dt>Valid From</dt>
<dd><?php echo $o->valid_from(TRUE); ?></dd> <dd><?php echo $o->valid_from(TRUE); ?></dd>
@ -18,15 +30,12 @@
<dt>Valid To</dt> <dt>Valid To</dt>
<dd><?php echo $o->valid_to(TRUE); ?></dd> <dd><?php echo $o->valid_to(TRUE); ?></dd>
<dt>Serial Number</dt> <dt>Hash</dt>
<dd><?php echo $o->serial(); ?></dd> <dd><?php echo $o->hash(); ?></dd>
<dt>Version</dt> <dt>Version</dt>
<dd><?php echo $o->version(); ?></dd> <dd><?php echo $o->version(); ?></dd>
<dt>Hash</dt>
<dd><?php echo $o->hash(); ?></dd>
<dt>Algorithm</dt> <dt>Algorithm</dt>
<dd><?php echo $o->algorithm(); ?></dd> <dd><?php echo $o->algorithm(); ?></dd>
@ -37,5 +46,12 @@
<legend>Certificate</legend> <legend>Certificate</legend>
<pre><?php echo $o->cert; ?></pre> <pre><?php echo $o->cert; ?></pre>
<?php echo $o->download_button(); ?> <?php
echo $o->download_button();
if ($ao=Auth::instance()->get_user() AND ($ao->isAdmin() OR $ao->isReseller()) AND $o->service->status AND ($o->valid_to()-(Kohana::$config->load('ssl.min_renew_days')*86400) <= time()) AND $o->service->paid_to() > time()) :
echo Form::open(URL::link('reseller','ssl/renew/'.$o->service->id));
echo Form::button('submit','Renew',array('class'=>'btn btn-primary'));
endif
?>
</fieldset> </fieldset>

View File

@ -1,55 +0,0 @@
<!-- $o = ORM::factory('SSL_CA'); -->
<table border="0">
<tr>
<td>DN</td>
<td class="data"><?php echo $o->dn(); ?></td>
</tr>
<tr>
<td>Subject</td>
<td class="data"><?php printf('%s (%s)',$o->subject(),$o->serial()); ?></td>
</tr>
<tr>
<td>Subject Key ID</td>
<td class="data"><?php echo $o->ski(); ?></td>
</tr>
<tr>
<td>Issuer</td>
<td class="data"><?php printf('%s (%s)',$o->issuer(),$o->aki_serial()); ?></td>
</tr>
<tr>
<td>Issuer Key ID</td>
<td class="data"><?php echo $o->aki_keyid(); ?></td>
</tr>
<tr>
<td>CA</td>
<td class="data"><?php echo StaticList_YesNo::get($o->isCA()); ?></td>
</tr>
<tr>
<td>Valid From</td>
<td class="data"><?php echo $o->valid_from(TRUE); ?></td>
</tr>
<tr>
<td>Valid To</td>
<td class="data"><?php echo $o->valid_to(TRUE); ?></td>
</tr>
<tr>
<td>Hash</td>
<td class="data"><?php echo $o->hash(); ?></td>
</tr>
<tr>
<td>Version</td>
<td class="data"><?php echo $o->version(); ?></td>
</tr>
<tr>
<td>Key Algorithm</td>
<td class="data"><?php echo $o->algorithm(); ?></td>
</tr>
<tr>
<td style="width: 40%;">Private Key</td>
<td style="width: 60%;"><?php echo FORM::textarea('sign_pk',$o->sign_pk,array('cols'=>64,'rows'=>13)); ?></td>
</tr>
<tr>
<td>Certificate</td>
<td><?php echo FORM::textarea('sign_cert',$o->sign_cert,array('cols'=>64,'rows'=>13)); ?></td>
</tr>
<table>

View File

@ -0,0 +1,58 @@
<div class="row">
<div class="span9">
<div class="dl-horizontal">
<dt>Subject</dt>
<dd><?php echo $o->subject(); ?></dd>
<dt>DN</dt>
<dd><?php echo $o->dn(); ?></dd>
<dt>Serial</dt>
<dd><?php echo $o->serial(); ?></dd>
<dt>Subject Key Id</dt>
<dd><?php echo $o->ski(); ?></dd>
<?php if (! $o->isRoot()) : ?>
<dt>Issuer</dt>
<dd>
<?php if ($o->validParent()) : ?>
<?php echo HTML::anchor(URL::link('reseller','ssl/edit/').$o->parent_ssl_ca_id,$o->issuer()); ?>
<?php else : ?>
<?php echo $o->issuer(); ?>
<?php endif ?>
</dd>
<dt>Issuer Serial</dt>
<dd><?php printf('%s (%s)',$o->aki_keyid(), $o->aki_serial()); ?></dd>
<dt>Issuer Valid</dt>
<dd><?php echo $o->validParent(TRUE); ?></dd>
<?php endif ?>
<dt>Valid From</dt>
<dd><?php echo $o->valid_from(TRUE); ?></dd>
<dt>Valid To</dt>
<dd><?php echo $o->valid_to(TRUE); ?></dd>
<dt>Hash</dt>
<dd><?php echo $o->hash(); ?></dd>
<dt>Version</dt>
<dd><?php echo $o->version(); ?></dd>
<dt>Key Algorithm<dt>
<dd><?php echo $o->algorithm(); ?></dd>
</div> <!-- /dl-horizontal -->
<br/>
<?php echo Form::textarea('sign_pk',$o->sign_pk,array('class'=>'span6','label'=>'Private Key','placeholder'=>'Private Key','nowysihtml'=>TRUE,'style'=>'font-family: monospace;','rows'=>Form::textarea_rows($o->sign_pk))); ?>
<?php echo Form::textarea('sign_cert',$o->sign_cert,array('class'=>'span6','label'=>'Public Certificate','placeholder'=>'Public Certificate','nowysihtml'=>TRUE,'style'=>'font-family: monospace;','rows'=>Form::textarea_rows($o->sign_cert))); ?>
<?php echo Form::button('submit','Submit',array('class'=>'btn btn-primary')); ?>
</div> <!-- /span -->
</div> <!-- /row -->