From 4aa53ab46a0551698a85932bdb03aeba0502ce50 Mon Sep 17 00:00:00 2001
From: Patrick Seeger <pseeger@ccwn.org>
Date: Wed, 27 Jun 2012 09:34:03 +0200
Subject: CMS ins Adminmenu

---
 protected/config/maincfg.php                       |  8 ++++++-
 .../modules/cms/controllers/DefaultController.php  | 19 +++++++++++++++
 .../cms/controllers/SitecontentController.php      | 27 +++++++++++-----------
 protected/views/layouts/main.php                   |  4 ++++
 4 files changed, 44 insertions(+), 14 deletions(-)

diff --git a/protected/config/maincfg.php b/protected/config/maincfg.php
index 124cd3c..b85c2ea 100644
--- a/protected/config/maincfg.php
+++ b/protected/config/maincfg.php
@@ -20,7 +20,9 @@ return array(
 		'application.components.*',
 		'application.extensions.egmap.*',
 		'application.modules.auditTrail.models.AuditTrail',
-        'application.extensions.yii-mail.YiiMailMessage'
+        'application.extensions.yii-mail.YiiMailMessage',
+		'application.modules.cms.models.*',
+		'application.extensions.extckeditor.*',
 	),
 
 	'modules'=>array(
@@ -36,6 +38,10 @@ return array(
 				'userIdColumn' => 'id', // the column name of the primary key for the user
 				'userNameColumn' => 'username', // the column name of the primary key for the user
 		),
+		'cms' => array(
+					'languages' => array('de','en'), // place all valid languages here
+					'layout' => '//layouts/column2',
+			),
 	),
 
 	// application components
diff --git a/protected/modules/cms/controllers/DefaultController.php b/protected/modules/cms/controllers/DefaultController.php
index b76d17b..e98d8cc 100644
--- a/protected/modules/cms/controllers/DefaultController.php
+++ b/protected/modules/cms/controllers/DefaultController.php
@@ -2,6 +2,19 @@
 
 class DefaultController extends Controller
 {
+	public function accessRules()
+	{
+		return array(
+				array('deny',
+						'actions'=>array('*'),
+						'users'=>array('*'),
+				),
+				array('allow',
+						'actions'=>array('*'),
+						'roles'=>array('admin'),
+				)
+		);
+	}
 	public function beforeAction($action)
 	{
 		$this->layout = Yii::app()->controller->module->layout;
@@ -16,5 +29,11 @@ class DefaultController extends Controller
 	{
 		$this->render('admin');	
 	}
+	public function filters()
+	{
+		return array(
+				'accessControl', // perform access control for CRUD operations
+		);
+	}
 
 }
diff --git a/protected/modules/cms/controllers/SitecontentController.php b/protected/modules/cms/controllers/SitecontentController.php
index 72dde78..448d6a6 100644
--- a/protected/modules/cms/controllers/SitecontentController.php
+++ b/protected/modules/cms/controllers/SitecontentController.php
@@ -11,18 +11,17 @@ class SitecontentController extends Controller
 		$this->layout = Yii::app()->controller->module->layout;
 		return true;
 	}
-	public function accessRules()
-	{
-		return array(
-				array('deny',
-						'actions'=>array('*'),
-						'users'=>array('*'),
-				),
-				array('allow',
-						'actions'=>array('*'),
-						'roles'=>array('admin'),
-				)
-		);
+	public function accessRules()
+	{
+		return array(
+			array('allow', // allow admin user to perform 'admin' and 'delete' actions
+				'actions'=>array('admin','index','create','view','update','delete'),
+				'users'=>array('admin'),
+			),
+			array('deny',  // deny all users
+				'users'=>array('*'),
+			),
+		);
 	}
 	public function actionSearch() 
 	{
@@ -46,7 +45,9 @@ class SitecontentController extends Controller
 
 	public function filters()
 	{
-		return array('accessControl');
+		return array(
+			'accessControl', // perform access control for CRUD operations
+		);
 	}
 
 	public function actionView()
diff --git a/protected/views/layouts/main.php b/protected/views/layouts/main.php
index 63ae0d0..e4f4cf1 100644
--- a/protected/views/layouts/main.php
+++ b/protected/views/layouts/main.php
@@ -65,6 +65,10 @@
 			    array("label"=>"Audit", "url"=>array("/auditTrail/admin"),
 						"visible"=>!Yii::app()->user->isGuest && Yii::app()->user->isAdmin,
 		                "active"=>$this->id == "admin"),
+					// Admin
+				array("label"=>"CMS", "url"=>array("/cms/sitecontent/admin"),
+						"visible"=>!Yii::app()->user->isGuest && Yii::app()->user->isAdmin,
+						"active"=>$this->id == "cms/sitecontent"),
 				// Admin
 			    array("label"=>"Benutzer", "url"=>array("/user/admin"),
 						"visible"=>!Yii::app()->user->isGuest && Yii::app()->user->isAdmin,
-- 
cgit v1.0-28-g1787

