From a893527d774eafeb2e4053aea09c4e3df2649f2a Mon Sep 17 00:00:00 2001 From: Deon George Date: Wed, 21 Dec 2011 12:39:21 +1100 Subject: [PATCH] Consistency updates for use of viewpath() --- .../controller/lnapp/templatedefault.php | 23 ++++++ .../classes/controller/user/account.php | 4 +- application/classes/lnapp/table.php | 24 ++++--- application/classes/model/account.php | 4 +- application/classes/ormosb.php | 15 ---- .../resetpassword.php} | 0 .../body.php} | 0 .../foot.php} | 0 .../head.php} | 0 .../summary.php} | 0 .../summary_exception.php} | 0 .../classes/controller/admin/charge.php | 2 +- .../email/classes/controller/admin/email.php | 16 +++-- .../email/classes/controller/user/email.php | 14 +--- .../{template/add.php => templateadd.php} | 0 .../add.php => templateadd/translate.php} | 0 .../{template/edit.php => templateedit.php} | 0 .../edit.php => templateedit/translate.php} | 0 .../list_body.php => templatelist/body.php} | 0 .../list_foot.php => templatelist/foot.php} | 0 .../list_head.php => templatelist/head.php} | 0 .../classes/controller/admin/export.php | 2 +- .../views/export/admin/{map => }/add.php | 0 .../classes/controller/user/invoice.php | 14 +--- modules/invoice/classes/model/invoice.php | 2 +- .../classes/controller/admin/payment.php | 72 ++++++++++--------- .../payment/admin/{add.php => add_view.php} | 0 .../list_body.php => autoitemlist/body.php} | 0 .../list_foot.php => autoitemlist/foot.php} | 0 .../list_head.php => autoitemlist/head.php} | 0 .../product/classes/controller/product.php | 4 +- .../classes/controller/product/category.php | 4 ++ modules/product/views/product/view.php | 2 +- .../classes/controller/admin/service.php | 10 +-- .../classes/controller/user/service.php | 15 +--- modules/ssl/classes/controller/admin/ssl.php | 11 +-- .../classes/controller/user/statement.php | 6 +- .../user/{show_body.php => show/body.php} | 0 .../user/{show_foot.php => show/foot.php} | 0 .../user/{show_head.php => show/head.php} | 0 .../classes/controller/staticpage.php | 2 +- .../controller/staticpage/category.php | 4 ++ 42 files changed, 125 insertions(+), 125 deletions(-) rename application/views/account/{password_reset.php => user/resetpassword.php} (100%) rename modules/adsl/views/service/admin/{list/adslbilling_body.php => listadslbilling/body.php} (100%) rename modules/adsl/views/service/admin/{list/adslbilling_foot.php => listadslbilling/foot.php} (100%) rename modules/adsl/views/service/admin/{list/adslbilling_head.php => listadslbilling/head.php} (100%) rename modules/adsl/views/service/admin/{list/adslbilling_summary.php => listadslbilling/summary.php} (100%) rename modules/adsl/views/service/admin/{list/adslbilling_summary_exception.php => listadslbilling/summary_exception.php} (100%) rename modules/email/views/email/admin/{template/add.php => templateadd.php} (100%) rename modules/email/views/email/admin/{template/translate/add.php => templateadd/translate.php} (100%) rename modules/email/views/email/admin/{template/edit.php => templateedit.php} (100%) rename modules/email/views/email/admin/{template/translate/edit.php => templateedit/translate.php} (100%) rename modules/email/views/email/admin/{template/list_body.php => templatelist/body.php} (100%) rename modules/email/views/email/admin/{template/list_foot.php => templatelist/foot.php} (100%) rename modules/email/views/email/admin/{template/list_head.php => templatelist/head.php} (100%) rename modules/export/views/export/admin/{map => }/add.php (100%) rename modules/payment/views/payment/admin/{add.php => add_view.php} (100%) rename modules/payment/views/payment/admin/{item/list_body.php => autoitemlist/body.php} (100%) rename modules/payment/views/payment/admin/{item/list_foot.php => autoitemlist/foot.php} (100%) rename modules/payment/views/payment/admin/{item/list_head.php => autoitemlist/head.php} (100%) rename modules/statement/views/statement/user/{show_body.php => show/body.php} (100%) rename modules/statement/views/statement/user/{show_foot.php => show/foot.php} (100%) rename modules/statement/views/statement/user/{show_head.php => show/head.php} (100%) diff --git a/application/classes/controller/lnapp/templatedefault.php b/application/classes/controller/lnapp/templatedefault.php index ea127494..b6b58116 100644 --- a/application/classes/controller/lnapp/templatedefault.php +++ b/application/classes/controller/lnapp/templatedefault.php @@ -262,6 +262,29 @@ abstract class Controller_lnApp_TemplateDefault extends Controller_Template { return sprintf('© %s',Config::SiteName()); } + /** + * Generate a view path to help View::factory() calls + * + * The purpose of this method is to ensure that we have a consistant + * layout for our view files, including those that are needed by + * plugins + * + * @param string Plugin Name (optional) + */ + public function viewpath($plugin='') { + $request = Request::current(); + + $path = ''; + $path .= $request->controller(); + if ($request->directory()) + $path .= ($path ? '/' : '').$request->directory(); + if ($plugin) + $path .= ($path ? '/' : '').$plugin; + $path .= ($path ? '/' : '').$request->action();; + + return $path; + } + /** * This action will render all the media related files for a page * @return void diff --git a/application/classes/controller/user/account.php b/application/classes/controller/user/account.php index 5b18ffbb..b10538f5 100644 --- a/application/classes/controller/user/account.php +++ b/application/classes/controller/user/account.php @@ -57,7 +57,7 @@ class Controller_User_Account extends Controller_TemplateDefault_User { Block::add(array( 'title'=>_('Password Reset'), - 'body'=>View::factory('account/password_reset') + 'body'=>View::factory($this->viewpath()) ->set('record',$this->ao), )); } @@ -97,7 +97,7 @@ class Controller_User_Account extends Controller_TemplateDefault_User { Block::add(array( 'title'=>sprintf('%s: %s - %s',_('Account Edit'),$this->ao->accnum(),$this->ao->name(TRUE)), - 'body'=>View::factory('account/user/edit') + 'body'=>View::factory($this->viewpath()) ->set('record',$this->ao), )); } diff --git a/application/classes/lnapp/table.php b/application/classes/lnapp/table.php index ca485ad3..d2fdf4d3 100644 --- a/application/classes/lnapp/table.php +++ b/application/classes/lnapp/table.php @@ -253,17 +253,25 @@ $(document).ready(function() { } public static function page($key) { - if ($ids = Session::instance()->get('page_table_view'.$key)) { - $pag = new Pagination(array( - 'total_items'=>count($ids), - 'items_per_page'=>1, - )); + // We have preference for parameters passed to the action. + if (is_null($id = Request::current()->param('id'))) { - return array($ids[$pag->current_first_item()-1],(string)$pag); + if (isset($_POST['id']) AND is_array($_POST['id'])) + Table::post($key,'id'); + + if ($ids = Session::instance()->get('page_table_view'.$key)) { + $pag = new Pagination(array( + 'total_items'=>count($ids), + 'items_per_page'=>1, + )); + + return array($ids[$pag->current_first_item()-1],(string)$pag); + } + + } // If we get here, then there is no previous data to retrieve. - } else - return array(NULL,''); + return array($id,''); } } ?> diff --git a/application/classes/model/account.php b/application/classes/model/account.php index 576e93e4..1b5e4565 100644 --- a/application/classes/model/account.php +++ b/application/classes/model/account.php @@ -53,11 +53,11 @@ class Model_Account extends Model_Auth_UserDefault { } public function currency($name) { - return StaticListModule::form($name,'currency',$this->currency_id,'id','name',array()); + return StaticList_Module::form($name,'currency',$this->currency_id,'id','name',array('status'=>'=:1'),FALSE,array('class'=>'form_button')); } public function country($name) { - return StaticListModule::form($name,'country',$this->country_id,'id','name',array()); + return StaticList_Module::form($name,'country',$this->country_id,'id','name',array('active'=>'=:1'),FALSE,array('class'=>'form_button')); } public function language($name) { diff --git a/application/classes/ormosb.php b/application/classes/ormosb.php index c4407d37..89a80542 100644 --- a/application/classes/ormosb.php +++ b/application/classes/ormosb.php @@ -104,21 +104,6 @@ abstract class ORMOSB extends ORM { $model->$field = serialize($value); } - /** - * Generate a view path to help View::factory() calls - * - * The purpose of this method is to ensure that we have a consistant - * layout for our view files, including those that are needed by - * plugins - * - * @param string Plugin Name (optional) - */ - public function viewpath($plugin='') { - $request = Request::current(); - - return $plugin ? sprintf('%s/%s/%s/%s',$request->controller(),$request->directory(),$plugin,$request->action()) : sprintf('%s/%s/%s',$request->controller(),$request->directory(),$request->action()); - } - public function changed() { return $this->_changed; } diff --git a/application/views/account/password_reset.php b/application/views/account/user/resetpassword.php similarity index 100% rename from application/views/account/password_reset.php rename to application/views/account/user/resetpassword.php diff --git a/modules/adsl/views/service/admin/list/adslbilling_body.php b/modules/adsl/views/service/admin/listadslbilling/body.php similarity index 100% rename from modules/adsl/views/service/admin/list/adslbilling_body.php rename to modules/adsl/views/service/admin/listadslbilling/body.php diff --git a/modules/adsl/views/service/admin/list/adslbilling_foot.php b/modules/adsl/views/service/admin/listadslbilling/foot.php similarity index 100% rename from modules/adsl/views/service/admin/list/adslbilling_foot.php rename to modules/adsl/views/service/admin/listadslbilling/foot.php diff --git a/modules/adsl/views/service/admin/list/adslbilling_head.php b/modules/adsl/views/service/admin/listadslbilling/head.php similarity index 100% rename from modules/adsl/views/service/admin/list/adslbilling_head.php rename to modules/adsl/views/service/admin/listadslbilling/head.php diff --git a/modules/adsl/views/service/admin/list/adslbilling_summary.php b/modules/adsl/views/service/admin/listadslbilling/summary.php similarity index 100% rename from modules/adsl/views/service/admin/list/adslbilling_summary.php rename to modules/adsl/views/service/admin/listadslbilling/summary.php diff --git a/modules/adsl/views/service/admin/list/adslbilling_summary_exception.php b/modules/adsl/views/service/admin/listadslbilling/summary_exception.php similarity index 100% rename from modules/adsl/views/service/admin/list/adslbilling_summary_exception.php rename to modules/adsl/views/service/admin/listadslbilling/summary_exception.php diff --git a/modules/charge/classes/controller/admin/charge.php b/modules/charge/classes/controller/admin/charge.php index 1f0ffac9..81c93c45 100644 --- a/modules/charge/classes/controller/admin/charge.php +++ b/modules/charge/classes/controller/admin/charge.php @@ -69,7 +69,7 @@ class Controller_Admin_Charge extends Controller_TemplateDefault_Admin { } $output .= Form::open(); - $output .= View::factory('charge/admin/add'); + $output .= View::factory($this->viewpath()); $output .= Form::submit('submit','submit'); $output .= Form::close(); diff --git a/modules/email/classes/controller/admin/email.php b/modules/email/classes/controller/admin/email.php index 62862e2c..42e8c9ad 100644 --- a/modules/email/classes/controller/admin/email.php +++ b/modules/email/classes/controller/admin/email.php @@ -50,12 +50,13 @@ class Controller_Admin_Email extends Controller_TemplateDefault_Admin { $eto = ORM::factory('email_template'); $output = ''; - $output .= View::factory('email/admin/template/list_head'); + // @todo Change this to use Table:: + $output .= View::factory($this->viewpath().'/head'); foreach ($eto->find_all() as $et) { - $output .= View::factory('email/admin/template/list_body') + $output .= View::factory($this->viewpath().'/body') ->set('template',$et); } - $output .= View::factory('email/admin/template/list_foot'); + $output .= View::factory($this->viewpath().'/foot'); Block::add(array( 'title'=>_('Available Email Templates'), @@ -85,8 +86,8 @@ class Controller_Admin_Email extends Controller_TemplateDefault_Admin { } $output .= Form::open(); - $output .= View::factory('email/admin/template/add'); - $output .= View::factory('email/admin/template/translate/add'); + $output .= View::factory($this->viewpath()); + $output .= View::factory($this->viewpath().'/translate'); $output .= '
'.Form::submit('submit',_('Add'),array('class'=>'form_button')).'
'; $output .= Form::close(); @@ -99,6 +100,7 @@ class Controller_Admin_Email extends Controller_TemplateDefault_Admin { /** * Edit Template Definition + * @todo Change this into an add_view function like payment() */ public function action_templateedit($id) { $eto = ORM::factory('email_template',$id); @@ -122,11 +124,11 @@ class Controller_Admin_Email extends Controller_TemplateDefault_Admin { $output .= Form::open(); - $output .= View::factory('email/admin/template/edit') + $output .= View::factory($this->viewpath()) ->set('template',$eto); foreach ($eto->email_template_translate->find_all() as $to) { - $output .= View::factory('email/admin/template/translate/edit') + $output .= View::factory($this->viewpath().'/translate') ->set('translate',$to); SystemMessage::add(array( diff --git a/modules/email/classes/controller/user/email.php b/modules/email/classes/controller/user/email.php index a03a937e..6a646e24 100644 --- a/modules/email/classes/controller/user/email.php +++ b/modules/email/classes/controller/user/email.php @@ -39,17 +39,7 @@ class Controller_User_Email extends Controller_TemplateDefault_User { } public function action_view() { - $output = ''; - - if (! $id = $this->request->param('id')) { - if (isset($_POST['id']) AND is_array($_POST['id'])) - Table::post('email_view','id'); - - list($id,$output) = Table::page('email_view'); - - } else { - $id = $this->request->param('id'); - } + list($id,$output) = Table::page(__METHOD__); $elo = ORM::factory('email_log',$id); @@ -58,7 +48,7 @@ class Controller_User_Email extends Controller_TemplateDefault_User { return FALSE; } - $output .= View::factory('email/user/view') + $output .= View::factory($this->viewpath()) ->set('elo',$elo); Block::add(array( diff --git a/modules/email/views/email/admin/template/add.php b/modules/email/views/email/admin/templateadd.php similarity index 100% rename from modules/email/views/email/admin/template/add.php rename to modules/email/views/email/admin/templateadd.php diff --git a/modules/email/views/email/admin/template/translate/add.php b/modules/email/views/email/admin/templateadd/translate.php similarity index 100% rename from modules/email/views/email/admin/template/translate/add.php rename to modules/email/views/email/admin/templateadd/translate.php diff --git a/modules/email/views/email/admin/template/edit.php b/modules/email/views/email/admin/templateedit.php similarity index 100% rename from modules/email/views/email/admin/template/edit.php rename to modules/email/views/email/admin/templateedit.php diff --git a/modules/email/views/email/admin/template/translate/edit.php b/modules/email/views/email/admin/templateedit/translate.php similarity index 100% rename from modules/email/views/email/admin/template/translate/edit.php rename to modules/email/views/email/admin/templateedit/translate.php diff --git a/modules/email/views/email/admin/template/list_body.php b/modules/email/views/email/admin/templatelist/body.php similarity index 100% rename from modules/email/views/email/admin/template/list_body.php rename to modules/email/views/email/admin/templatelist/body.php diff --git a/modules/email/views/email/admin/template/list_foot.php b/modules/email/views/email/admin/templatelist/foot.php similarity index 100% rename from modules/email/views/email/admin/template/list_foot.php rename to modules/email/views/email/admin/templatelist/foot.php diff --git a/modules/email/views/email/admin/template/list_head.php b/modules/email/views/email/admin/templatelist/head.php similarity index 100% rename from modules/email/views/email/admin/template/list_head.php rename to modules/email/views/email/admin/templatelist/head.php diff --git a/modules/export/classes/controller/admin/export.php b/modules/export/classes/controller/admin/export.php index 8237ff0f..2d0e50e8 100644 --- a/modules/export/classes/controller/admin/export.php +++ b/modules/export/classes/controller/admin/export.php @@ -39,7 +39,7 @@ class Controller_Admin_Export extends Controller_TemplateDefault_Admin { } $output .= Form::open(); - $output .= View::factory('export/admin/map/add') + $output .= View::factory($this->viewpath()) ->set('eo',$eo); $output .= '
'.Form::submit('submit',_('Add'),array('class'=>'form_button')).'
'; diff --git a/modules/export/views/export/admin/map/add.php b/modules/export/views/export/admin/add.php similarity index 100% rename from modules/export/views/export/admin/map/add.php rename to modules/export/views/export/admin/add.php diff --git a/modules/invoice/classes/controller/user/invoice.php b/modules/invoice/classes/controller/user/invoice.php index bf6d84bc..1c00a717 100644 --- a/modules/invoice/classes/controller/user/invoice.php +++ b/modules/invoice/classes/controller/user/invoice.php @@ -47,17 +47,7 @@ class Controller_User_Invoice extends Controller_TemplateDefault_User { * View an Invoice */ public function action_view() { - $output = ''; - - if (! $id = $this->request->param('id')) { - if (isset($_POST['id']) AND is_array($_POST['id'])) - Table::post('invoice_view','id'); - - list($id,$output) = Table::page('invoice_view'); - - } else { - $id = $this->request->param('id'); - } + list($id,$output) = Table::page(__METHOD__); $io = ORM::factory('invoice',$id); @@ -66,7 +56,7 @@ class Controller_User_Invoice extends Controller_TemplateDefault_User { return FALSE; } - $output .= View::factory('invoice/user/view') + $output .= View::factory($this->viewpath()) ->set('mediapath',Route::get('default/media')) ->set('io',$io); diff --git a/modules/invoice/classes/model/invoice.php b/modules/invoice/classes/model/invoice.php index eba515e0..655cfb9f 100644 --- a/modules/invoice/classes/model/invoice.php +++ b/modules/invoice/classes/model/invoice.php @@ -515,7 +515,7 @@ class Model_Invoice extends ORMOSB { $css .= 'tr.even { background-color: #F6F6F8; }'; $css .= ''; - $output = View::factory('invoice/user/email') + $output = View::factory($this->viwepath()) ->set('mediapath',Route::get('default/media')) ->set('io',$this); diff --git a/modules/payment/classes/controller/admin/payment.php b/modules/payment/classes/controller/admin/payment.php index af4164d1..4ee85374 100644 --- a/modules/payment/classes/controller/admin/payment.php +++ b/modules/payment/classes/controller/admin/payment.php @@ -14,6 +14,7 @@ class Controller_Admin_Payment extends Controller_TemplateDefault_Admin { protected $secure_actions = array( 'add'=>TRUE, 'list'=>TRUE, + 'view'=>TRUE, 'autocomplete'=>FALSE, 'autoitemlist'=>FALSE, ); @@ -40,24 +41,24 @@ class Controller_Admin_Payment extends Controller_TemplateDefault_Admin { if (! Request::current()->is_ajax() OR ! isset($_REQUEST['key']) OR ! trim($_REQUEST['key'])) die(); - $output = View::factory('payment/admin/item/list_head'); + $output = View::factory($this->viewpath().'/head'); $this->auto_render = FALSE; $i = 0; if (isset($_REQUEST['pid'])) foreach (ORM::factory('payment_item')->where('payment_id','=',$_REQUEST['pid'])->find_all() as $pio) - $output .= View::factory('payment/admin/item/list_body') + $output .= View::factory($this->viewpath().'/body') ->set('trc',$i++%2 ? 'odd' : 'even') ->set('pio',$pio) ->set('io',$pio->invoice); foreach (ORM::factory('account',$_REQUEST['key'])->invoices_due() as $io) - $output .= View::factory('payment/admin/item/list_body') + $output .= View::factory($this->viewpath().'/body') ->set('trc',$i++%2 ? 'odd' : 'even') ->set('io',$io); // @todo Need the JS to add up the payment allocation before submission - $output .= View::factory('payment/admin/item/list_foot') + $output .= View::factory($this->viewpath().'/foot') ->set('trc',$i++%2 ? 'odd' : 'even'); $this->response->body($output); @@ -73,7 +74,7 @@ class Controller_Admin_Payment extends Controller_TemplateDefault_Admin { ORM::factory('payment')->find_all(), 25, array( - 'id'=>array('label'=>'ID','url'=>'admin/payment/add/'), + 'id'=>array('label'=>'ID','url'=>'admin/payment/view/'), 'date_payment'=>array('label'=>'Date'), 'account->accnum()'=>array('class'=>'right'), 'account->name()'=>array('label'=>'Account'), @@ -85,24 +86,12 @@ class Controller_Admin_Payment extends Controller_TemplateDefault_Admin { array( 'page'=>TRUE, 'type'=>'select', - 'form'=>'admin/payment/add', + 'form'=>'admin/payment/view', )), )); } - public function action_add() { - $output = ''; - - if (! $id = $this->request->param('id')) { - if (isset($_POST['id']) AND is_array($_POST['id'])) - Table::post('payment_view','id'); - - list($id,$output) = Table::page('payment_view'); - - } else { - $id = $this->request->param('id'); - } - + private function add_view($id=NULL,$output='') { $po = ORM::factory('payment',$id); if ($_POST) { @@ -122,13 +111,13 @@ class Controller_Admin_Payment extends Controller_TemplateDefault_Admin { SystemMessage::add(array( 'title'=>'Payment Recorded', 'type'=>'info', - 'body'=>'Payment successfully recorded.', + 'body'=>'Payment successfully recorded.', )); } } $output .= Form::open(); - $output .= View::factory('payment/admin/add') + $output .= View::factory('payment/admin/add_view') ->set('po',$po);; $output .= Form::submit('submit','submit',array('class'=>'form_button')); $output .= Form::close(); @@ -167,21 +156,21 @@ class Controller_Admin_Payment extends Controller_TemplateDefault_Admin { source: "'.URL::site('admin/payment/autocomplete').'", minLength: 2, change: function(event,ui) { - // Send the request and update sub category dropdown - $.ajax({ - type: "GET", - data: "key="+$(this).val(), - dataType: "html", - cache: false, - url: "'.URL::site('admin/payment/autoitemlist').'", - timeout: 2000, - error: function(x) { - alert("Failed to submit"); - }, + // Send the request and update sub category dropdown + $.ajax({ + type: "GET", + data: "key="+$(this).val(), + dataType: "html", + cache: false, + url: "'.URL::site('admin/payment/autoitemlist').'", + timeout: 2000, + error: function(x) { + alert("Failed to submit"); + }, success: function(data) { $("div[id=items]").replaceWith(data); - } - }); + } + }); } }); });' @@ -195,9 +184,22 @@ class Controller_Admin_Payment extends Controller_TemplateDefault_Admin { )); } + return $output; + } + + public function action_add() { Block::add(array( 'title'=>_('Add Payments Received'), - 'body'=>$output, + 'body'=>$this->add_view(), + )); + } + + public function action_view() { + list($id,$output) = Table::page(__METHOD__); + + Block::add(array( + 'title'=>sprintf('%s: %s',_('View Payments Received'),$id), + 'body'=>$this->add_view($id,$output), )); } } diff --git a/modules/payment/views/payment/admin/add.php b/modules/payment/views/payment/admin/add_view.php similarity index 100% rename from modules/payment/views/payment/admin/add.php rename to modules/payment/views/payment/admin/add_view.php diff --git a/modules/payment/views/payment/admin/item/list_body.php b/modules/payment/views/payment/admin/autoitemlist/body.php similarity index 100% rename from modules/payment/views/payment/admin/item/list_body.php rename to modules/payment/views/payment/admin/autoitemlist/body.php diff --git a/modules/payment/views/payment/admin/item/list_foot.php b/modules/payment/views/payment/admin/autoitemlist/foot.php similarity index 100% rename from modules/payment/views/payment/admin/item/list_foot.php rename to modules/payment/views/payment/admin/autoitemlist/foot.php diff --git a/modules/payment/views/payment/admin/item/list_head.php b/modules/payment/views/payment/admin/autoitemlist/head.php similarity index 100% rename from modules/payment/views/payment/admin/item/list_head.php rename to modules/payment/views/payment/admin/autoitemlist/head.php diff --git a/modules/product/classes/controller/product.php b/modules/product/classes/controller/product.php index 87ffb7ae..314d62ba 100644 --- a/modules/product/classes/controller/product.php +++ b/modules/product/classes/controller/product.php @@ -26,7 +26,7 @@ class Controller_Product extends Controller_TemplateDefault { Block::add(array( 'title'=>sprintf('%s: %s',_('Category'),$cat->name), - 'body'=>View::factory('product/category/view') + 'body'=>View::factory($this->viewpath().'/view') ->set('results',$this->_get_category($cat->id)) ->set('cat',$cat->id), )); @@ -63,7 +63,7 @@ class Controller_Product extends Controller_TemplateDefault { Block::add(array( 'title'=>$po->product_translate->find()->description_short, - 'body'=>View::factory('product/view') + 'body'=>View::factory($this->viewpath()) ->set('record',$po), )); } diff --git a/modules/product/classes/controller/product/category.php b/modules/product/classes/controller/product/category.php index 1615733a..10e87631 100644 --- a/modules/product/classes/controller/product/category.php +++ b/modules/product/classes/controller/product/category.php @@ -15,6 +15,10 @@ class Controller_Product_Category extends Controller_TemplateDefault { * By default show a menu of available categories */ public function action_index() { + Request::current()->redirect('product_category/list'); + } + + public function action_list() { Block::add(array( 'title'=>_('Product Categories'), 'body'=>View::factory('product/category/list') diff --git a/modules/product/views/product/view.php b/modules/product/views/product/view.php index 4d3e5f24..9835c1e8 100644 --- a/modules/product/views/product/view.php +++ b/modules/product/views/product/view.php @@ -62,7 +62,7 @@ echo Form::open('cart/add'); - '=:1'));?> + '=:1'),FALSE,array('class'=>'form_button'));?> Price Type diff --git a/modules/service/classes/controller/admin/service.php b/modules/service/classes/controller/admin/service.php index bdd66417..e5d4aaab 100644 --- a/modules/service/classes/controller/admin/service.php +++ b/modules/service/classes/controller/admin/service.php @@ -360,7 +360,7 @@ class Controller_Admin_Service extends Controller_TemplateDefault_Admin { $i = $j = 0; $total = 0; $summary = ''; - $output = View::factory('service/admin/list/adslbilling_head'); + $output = View::factory($this->viewpath().'/head'); $output .= ''; foreach ($aso->services(TRUE) as $so) { $po = $so->plugin()->product(); @@ -377,7 +377,7 @@ class Controller_Admin_Service extends Controller_TemplateDefault_Admin { // Record the the exception if the cost is not expected if (round($po->adsl_supplier_plan->base_cost+$po->adsl_supplier_plan->tax(),2) != $uploaded['amount']) { - $summary .= View::factory('service/admin/list/adslbilling_summary') + $summary .= View::factory($this->viewpath().'/summary') ->set('service',$so) ->set('plan',$po) ->set('planoverride',$so->plugin()->provided_adsl_plan_id ? TRUE : FALSE) @@ -398,7 +398,7 @@ class Controller_Admin_Service extends Controller_TemplateDefault_Admin { $total += $uploaded['amount']; - $output .= View::factory('service/admin/list/adslbilling_body') + $output .= View::factory($this->viewpath().'/body') ->set('service',$so) ->set('plan',$po) ->set('planoverride',$so->plugin()->provided_adsl_plan_id ? TRUE : FALSE) @@ -409,7 +409,7 @@ class Controller_Admin_Service extends Controller_TemplateDefault_Admin { ->set('i',$i++%2); } - $output .= View::factory('service/admin/list/adslbilling_foot') + $output .= View::factory($this->viewpath().'/foot') ->set('total',$total); $output .= '
'; @@ -417,7 +417,7 @@ class Controller_Admin_Service extends Controller_TemplateDefault_Admin { // Summary Report of remaining CSV items. if (! empty($csv)) foreach ($csv as $service => $item) { - $summary .= View::factory('service/admin/list/adslbilling_summary_exception') + $summary .= View::factory($this->viewpath().'/summary_exception') ->set('service',$service) ->set('item',$item) ->set('i',$j++%2); diff --git a/modules/service/classes/controller/user/service.php b/modules/service/classes/controller/user/service.php index 94911777..7e33ac75 100644 --- a/modules/service/classes/controller/user/service.php +++ b/modules/service/classes/controller/user/service.php @@ -41,18 +41,7 @@ class Controller_User_Service extends Controller_TemplateDefault_User { } public function action_view() { - $output = ''; - - // Check if we are a table view - if (! $id = $this->request->param('id')) { - if (isset($_POST['id']) AND is_array($_POST['id'])) - Table::post('service_view','id'); - - list($id,$output) = Table::page('service_view'); - - } else { - $id = $this->request->param('id'); - } + list($id,$output) = Table::page(__METHOD__); $so = ORM::factory('service',$id); @@ -61,7 +50,7 @@ class Controller_User_Service extends Controller_TemplateDefault_User { return FALSE; } - $output .= View::factory('service/user/view') + $output .= View::factory($this->viewpath()) ->set('so',$so); Block::add(array( diff --git a/modules/ssl/classes/controller/admin/ssl.php b/modules/ssl/classes/controller/admin/ssl.php index d8dcea0b..1b2c8387 100644 --- a/modules/ssl/classes/controller/admin/ssl.php +++ b/modules/ssl/classes/controller/admin/ssl.php @@ -37,7 +37,8 @@ class Controller_Admin_SSL extends Controller_TemplateDefault_Admin { } public function action_update() { - $id = $this->request->param('id'); + list($id,$output) = Table::page(__METHOD__); + $so = ORM::factory('ssl_ca',$id); if (! $so->loaded()) @@ -48,11 +49,13 @@ class Controller_Admin_SSL extends Controller_TemplateDefault_Admin { throw new Kohana_Exception('Failed to save updates to plugin data for record :record',array(':record'=>$so->id())); } + $output .= View::factory($this->viewpath()) + ->set('so',$so) + ->set('mediapath',Route::get('default/media')); + Block::add(array( 'title'=>sprintf('%s %s:%s',_('Update SSL Service'),$so->id,$so->display('sign_cert')), - 'body'=>View::factory('ssl/admin/update') - ->set('so',$so) - ->set('mediapath',Route::get('default/media')) + 'body'=>$output, )); } } diff --git a/modules/statement/classes/controller/user/statement.php b/modules/statement/classes/controller/user/statement.php index 5cab6a64..61a7a95a 100644 --- a/modules/statement/classes/controller/user/statement.php +++ b/modules/statement/classes/controller/user/statement.php @@ -59,7 +59,7 @@ class Controller_User_Statement extends Controller_TemplateDefault_User { )); $output = (string)$pag; - $output .= View::factory('statement/user/show_head'); + $output .= View::factory($this->viewpath().'/head'); $i = 0; foreach ($ta as $k => $v) { @@ -68,12 +68,12 @@ class Controller_User_Statement extends Controller_TemplateDefault_User { elseif ($i > $pag->current_last_item()) break; - $output .= View::factory('statement/user/show_body') + $output .= View::factory($this->viewpath().'/body') ->set('o',$v) ->set('trc',$i%2 ? 'odd' : 'even'); } - $output .= View::factory('statement/user/show_foot'); + $output .= View::factory($this->viewpath().'/foot'); Block::add(array( 'title'=>sprintf('%s: %s - %s',_('Transactions For'),$this->ao->accnum(),$this->ao->name(TRUE)), diff --git a/modules/statement/views/statement/user/show_body.php b/modules/statement/views/statement/user/show/body.php similarity index 100% rename from modules/statement/views/statement/user/show_body.php rename to modules/statement/views/statement/user/show/body.php diff --git a/modules/statement/views/statement/user/show_foot.php b/modules/statement/views/statement/user/show/foot.php similarity index 100% rename from modules/statement/views/statement/user/show_foot.php rename to modules/statement/views/statement/user/show/foot.php diff --git a/modules/statement/views/statement/user/show_head.php b/modules/statement/views/statement/user/show/head.php similarity index 100% rename from modules/statement/views/statement/user/show_head.php rename to modules/statement/views/statement/user/show/head.php diff --git a/modules/static_page/classes/controller/staticpage.php b/modules/static_page/classes/controller/staticpage.php index 332e75ff..b8a69696 100644 --- a/modules/static_page/classes/controller/staticpage.php +++ b/modules/static_page/classes/controller/staticpage.php @@ -25,7 +25,7 @@ class Controller_StaticPage extends Controller_TemplateDefault { Block::add(array( 'title'=>$sp->staticpage_translate->find()->title, - 'body'=>View::factory('staticpage/view') + 'body'=>View::factory($this->viewpath()) ->set('record',$sp), )); } diff --git a/modules/static_page/classes/controller/staticpage/category.php b/modules/static_page/classes/controller/staticpage/category.php index c57f46de..a14c313b 100644 --- a/modules/static_page/classes/controller/staticpage/category.php +++ b/modules/static_page/classes/controller/staticpage/category.php @@ -15,6 +15,10 @@ class Controller_StaticPage_Category extends Controller_TemplateDefault { * By default show a menu of available categories */ public function action_index() { + Request::current()->redirect('staticpage_category/list'); + } + + public function action_list() { Block::add(array( 'title'=>_('Site Index Categories'), 'body'=>View::factory('staticpage/category/list')