Work on Email and other major consistency work

This commit is contained in:
Deon George
2013-11-22 15:36:50 +11:00
parent 89deb9c97b
commit c18d5a3881
55 changed files with 550 additions and 575 deletions

View File

@@ -9,7 +9,7 @@
* @copyright (c) 2009-2013 Open Source Billing
* @license http://dev.osbill.net/license.html
*/
class Controller_User_Email extends Controller_TemplateDefault_User {
class Controller_User_Email extends Controller_Email {
protected $secure_actions = array(
'list'=>TRUE,
'view'=>TRUE,
@@ -19,22 +19,24 @@ class Controller_User_Email extends Controller_TemplateDefault_User {
* Show a list of emails
*/
public function action_list() {
Block::add(array(
'title'=>sprintf('%s: %s - %s',_('Email For'),$this->ao->accnum(),$this->ao->name(TRUE)),
'body'=>Table::display(
$this->ao->email_log->find_all(),
25,
array(
'id'=>array('label'=>'ID','url'=>URL::link('user','email/view/')),
'date_orig'=>array('label'=>'Date'),
'translate_resolve("subject")'=>array('label'=>'Subject'),
),
array(
'page'=>TRUE,
'type'=>'select',
'form'=>URL::link('user','email/view'),
)),
));
Block::factory()
->title(sprintf(_('System Emails Sent for %s: %s'),$this->ao->accnum(),$this->ao->name(TRUE)))
->title_icon('icon-th')
->body(Table::factory()
->page_items(25)
->data($this->ao->email_log->find_all())
->columns(array(
'id'=>'ID',
'date_orig'=>'Date',
'resolve("subject")'=>'Subject',
))
->prepend(array(
'id'=>array('url'=>URL::link('user','email/view/')),
))
->postproc(array(
'resolve("subject")'=>array('trim'=>60),
))
);
}
public function action_view() {
@@ -42,18 +44,16 @@ class Controller_User_Email extends Controller_TemplateDefault_User {
$elo = ORM::factory('Email_Log',$id);
if (! $elo->loaded() OR ! Auth::instance()->authorised($elo->account)) {
$this->template->content = 'Unauthorised or doesnt exist?';
return FALSE;
}
if (! $elo->loaded() OR ! Auth::instance()->authorised($elo->account))
throw HTTP_Exception::factory(403,'Service either doesnt exist, or you are not authorised to see it');
$output .= View::factory($this->viewpath())
$output .= View::factory('email/user/view')
->set('elo',$elo);
Block::add(array(
'title'=>sprintf('%s: %s',_('Email'),$elo->translate_resolve('subject')),
'body'=>$output,
));
Block::factory()
->title(sprintf('%s: %s',$elo->id,$elo->resolve('subject')))
->title_icon('icon-list-alt')
->body($output);
}
}
?>