From 63a513b7eea5417cc089f1d5e2865e5208d4b551 Mon Sep 17 00:00:00 2001 From: dogmatic Date: Tue, 19 Jan 2010 01:00:25 +0200 Subject: [PATCH] module management now pretty much sorted out, time to do the module loader --- .../controllers/modules_controller.php | 8 +++- infinitas/management/models/module.php | 6 +-- .../management/views/modules/admin_add.ctp | 6 +-- .../management/views/modules/admin_edit.ctp | 46 +++++++++++++------ .../management/views/modules/admin_index.ctp | 10 ++-- 5 files changed, 49 insertions(+), 27 deletions(-) diff --git a/infinitas/management/controllers/modules_controller.php b/infinitas/management/controllers/modules_controller.php index 83a665114..41817a851 100644 --- a/infinitas/management/controllers/modules_controller.php +++ b/infinitas/management/controllers/modules_controller.php @@ -26,8 +26,7 @@ function admin_add() { $positions = $this->Module->Position->find('list'); $groups = $this->Module->Group->find('list'); - - $routes = ClassRegistry::init('Core.Route')->find('list'); + $routes = array(0 => __('All Pages', true)) + $this->Module->Route->find('list'); $this->set(compact('positions', 'groups', 'routes')); } @@ -49,6 +48,11 @@ function admin_edit($id = null) { if ($id && empty($this->data)) { $this->data = $this->Module->read(null, $id); } + + $positions = $this->Module->Position->find('list'); + $groups = $this->Module->Group->find('list'); + $routes = array(0 => __('All Pages', true)) + $this->Module->Route->find('list'); + $this->set(compact('positions', 'groups', 'routes')); } } ?> \ No newline at end of file diff --git a/infinitas/management/models/module.php b/infinitas/management/models/module.php index 68fb5f866..c3be92b3d 100644 --- a/infinitas/management/models/module.php +++ b/infinitas/management/models/module.php @@ -28,9 +28,9 @@ class Module extends ManagementAppModel{ ); var $hasAndBelongsToMany = array( - 'ModulesRoute' => array( - 'className' => 'Core.ModulesRoute', - 'joinTable' => 'modules_routes', + 'Route' => array( + 'className' => 'Core.Route', + 'joinTable' => 'core_modules_routes', 'foreignKey' => 'module_id', 'associationForeignKey' => 'route_id', 'unique' => true diff --git a/infinitas/management/views/modules/admin_add.ctp b/infinitas/management/views/modules/admin_add.ctp index 3c51925c9..aa1740332 100644 --- a/infinitas/management/views/modules/admin_add.ctp +++ b/infinitas/management/views/modules/admin_add.ctp @@ -1,8 +1,8 @@
Form->input('ModulesRoute.Route', array('multiple' => true)); + echo $this->Form->input('Route', array('selected' => 0)); ?>
 
diff --git a/infinitas/management/views/modules/admin_edit.ctp b/infinitas/management/views/modules/admin_edit.ctp index c5de9add5..153fa292c 100644 --- a/infinitas/management/views/modules/admin_edit.ctp +++ b/infinitas/management/views/modules/admin_edit.ctp @@ -1,8 +1,8 @@ Core->adminOtherHead( $this ); - echo $this->Form->create( 'Theme' ); - echo $this->Form->input( 'id' ); - echo $this->Form->input( 'name' ); - echo $this->Form->input( 'author' ); - echo $this->Form->input( 'url' ); - echo $this->Form->input( 'update_url' ); - echo $this->Form->input( 'licence' ); - echo $this->Form->input( 'active' ); - echo $this->Form->input( 'core' ); - echo $this->Core->wysiwyg( 'Theme.description' ); - echo $this->Form->end( 'Save Theme' ); - ?> \ No newline at end of file + echo $this->Form->create( 'Module' ); + ?> +
+ Form->input( 'id' ); + echo $this->Form->input( 'name' ); + echo $this->Form->input( 'module' ); + echo $this->Form->input( 'position_id' ); + echo $this->Form->input( 'group_id' ); + echo $this->Form->input( 'active' ); + echo $this->Form->input( 'show_heading' ); + echo $this->Form->input( 'core' ); + echo $this->Form->input( 'author' ); + echo $this->Form->input( 'url' ); + echo $this->Form->input( 'update_url' ); + echo $this->Form->input( 'licence' ); + + echo $this->Form->input( 'content', array('class' => 'title') ); + echo $this->Form->input( 'config', array('class' => 'title') ); + ?> +
+
+ Form->input('Route'); + ?> +
+
 
+ Form->end( 'Save Module' ); +?> \ No newline at end of file diff --git a/infinitas/management/views/modules/admin_index.ctp b/infinitas/management/views/modules/admin_index.ctp index 43cb8dca9..19e48b5da 100644 --- a/infinitas/management/views/modules/admin_index.ctp +++ b/infinitas/management/views/modules/admin_index.ctp @@ -42,9 +42,9 @@ 'style' => 'width:25px;' ), $this->Paginator->sort( 'name' ), + $this->Paginator->sort( 'Position', 'Position.Name' ), $this->Paginator->sort( 'author' ), - $this->Paginator->sort( 'licence' ), - $this->Paginator->sort( 'Position', 'Position.Name' ) => array( + $this->Paginator->sort( 'licence' ) => array( 'style' => 'width:75px;' ), $this->Paginator->sort( 'Group', 'Group.Name' ) => array( @@ -98,13 +98,13 @@ Status->locked($module['Module']['locked']); ?>  - Core->ordering($module['Module']['order']); ?>  + Core->ordering($module['Module']['ordering']); ?>  - Status->status( $theme['Theme']['core'] ); ?>  + Status->status($module['Module']['core']); ?>  - Status->status( $theme['Theme']['active'] ); ?>  + Status->status($module['Module']['active']); ?>