diff --git a/amber/afi/js/AFI-OPAC.deploy.js b/amber/afi/js/AFI-OPAC.deploy.js
index d8b8070f8e1a69b23899442417dfb4e631d4616d..04d1de7330e60e65e4e30c46e144e6da57e6296c 100644
--- a/amber/afi/js/AFI-OPAC.deploy.js
+++ b/amber/afi/js/AFI-OPAC.deploy.js
@@ -149,7 +149,7 @@ smalltalk.method({
 selector: unescape('initialize'),
 fn: function (){
 var self=this;
-smalltalk.send(smalltalk.send((smalltalk.AFIIDETools || AFIIDETools), "_default", []), "_addButton_action_", ["Editeur CSS", (function(){return smalltalk.send(self, "_open", []);})]);
+smalltalk.send(smalltalk.send((smalltalk.AFIIDETools || AFIIDETools), "_default", []), "_addButton_action_", ["Editeur CSS", (function(){smalltalk.send(smalltalk.send(smalltalk.send((smalltalk.TabManager || TabManager), "_current", []), "_tabs", []), "_do_", [(function(aTab){return smalltalk.send(smalltalk.send((smalltalk.TabManager || TabManager), "_current", []), "_removeTab_", [aTab]);})]);return smalltalk.send(smalltalk.send(self, "_current", []), "_open", []);})]);
 return self;}
 }),
 smalltalk.AFICssEditor.klass);
diff --git a/amber/afi/js/AFI-OPAC.js b/amber/afi/js/AFI-OPAC.js
index 174b5895d4f2419b7b1f461b5606b4109ac7b9a1..06c3dd1e4e486b959a88917fcd281204dae9da1d 100644
--- a/amber/afi/js/AFI-OPAC.js
+++ b/amber/afi/js/AFI-OPAC.js
@@ -210,12 +210,12 @@ selector: unescape('initialize'),
 category: 'not yet classified',
 fn: function (){
 var self=this;
-smalltalk.send(smalltalk.send((smalltalk.AFIIDETools || AFIIDETools), "_default", []), "_addButton_action_", ["Editeur CSS", (function(){return smalltalk.send(self, "_open", []);})]);
+smalltalk.send(smalltalk.send((smalltalk.AFIIDETools || AFIIDETools), "_default", []), "_addButton_action_", ["Editeur CSS", (function(){smalltalk.send(smalltalk.send(smalltalk.send((smalltalk.TabManager || TabManager), "_current", []), "_tabs", []), "_do_", [(function(aTab){return smalltalk.send(smalltalk.send((smalltalk.TabManager || TabManager), "_current", []), "_removeTab_", [aTab]);})]);return smalltalk.send(smalltalk.send(self, "_current", []), "_open", []);})]);
 return self;},
 args: [],
-source: unescape('initialize%0A%09AFIIDETools%20default%20addButton%3A%20%27Editeur%20CSS%27%20action%3A%20%5Bself%20open%5D'),
-messageSends: ["addButton:action:", "default", "open"],
-referencedClasses: ["AFIIDETools"]
+source: unescape('initialize%0A%09AFIIDETools%20default%20addButton%3A%20%27Editeur%20CSS%27%20action%3A%20%5B%0A%09%09%09TabManager%20current%20tabs%20do%3A%20%5B%3AaTab%7C%20TabManager%20current%20removeTab%3A%20aTab%5D.%0A%09%09%09self%20current%20open%5D.'),
+messageSends: ["addButton:action:", "default", "do:", "tabs", "current", "removeTab:", "open"],
+referencedClasses: ["AFIIDETools", "TabManager"]
 }),
 smalltalk.AFICssEditor.klass);
 
diff --git a/amber/afi/st/AFI-OPAC.st b/amber/afi/st/AFI-OPAC.st
index 3db64453bf28c0e6a797f79754a0228c0d828e56..766807857db357370eda762a608178d91f15a1a4 100644
--- a/amber/afi/st/AFI-OPAC.st
+++ b/amber/afi/st/AFI-OPAC.st
@@ -92,7 +92,9 @@ current
 !
 
 initialize
-	AFIIDETools default addButton: 'Editeur CSS' action: [self open]
+	AFIIDETools default addButton: 'Editeur CSS' action: [
+			TabManager current tabs do: [:aTab| TabManager current removeTab: aTab].
+			self current open].
 !
 
 open
diff --git a/application/modules/admin/controllers/IndexController.php b/application/modules/admin/controllers/IndexController.php
index abfafbd728d9cdb0bdcb6f8e21c99de414086a8e..cea7d6611fa5c9009f95f1641bd7acbcc7e8c769 100644
--- a/application/modules/admin/controllers/IndexController.php
+++ b/application/modules/admin/controllers/IndexController.php
@@ -174,7 +174,8 @@ class Admin_IndexController extends Zend_Controller_Action {
 			'ARTE_VOD_KEY'              => 'Clé ARTE VOD',
 			'ARTE_VOD_SSO_KEY'          => 'Clé ARTE VOD Single Sign-On',
 			'BABELTHEQUE_JS'            => 'URL du javascript Babelthèque à insérer dans l\'OPAC',
-			'MULTIMEDIA_KEY'            => 'Clé AFI-multimédia'
+			'MULTIMEDIA_KEY'            => 'Clé AFI-multimédia',
+			'CSS_EDITOR'                => 'Activation de l\'editeur CSS. 0 = inactif, 1 = actif'
 		);
 
 		if (!array_key_exists($name, $help)) {
diff --git a/application/modules/opac/views/scripts/head.phtml b/application/modules/opac/views/scripts/head.phtml
index 0f37b587061d60bb2d80764fe3039c8f9e6b7151..bdb6ce64881ac48a13e52c0ebb0dfe840b032657 100644
--- a/application/modules/opac/views/scripts/head.phtml
+++ b/application/modules/opac/views/scripts/head.phtml
@@ -39,7 +39,7 @@ if ($this->header_css)
 if ($this->header_js)
 	$head_scripts->addJQueryReady('$.getScript("'.$this->header_js.'")');
 
-if (Class_Users::isCurrentUserAdmin())
+if (Class_Users::isCurrentUserAdmin() && Class_AdminVar::isCssEditorEnabled())
 	$head_scripts
 		->addAmberPackage('AFI-OPAC')
 		->loadAmber(true);
diff --git a/library/Class/AdminVar.php b/library/Class/AdminVar.php
index f9be9d10bbbf1077d581a7adce37c4e4bdbf390c..ba72f3f24c9cb6df84c205335c5d4d31f8dd3f57 100644
--- a/library/Class/AdminVar.php
+++ b/library/Class/AdminVar.php
@@ -61,7 +61,8 @@ class Class_AdminVar extends Storm_Model_Abstract {
 		'ARTE_VOD_KEY',
 		'ARTE_VOD_SSO_KEY',
 		'BABELTHEQUE_JS',
-		'MULTIMEDIA_KEY'
+		'MULTIMEDIA_KEY',
+		'CSS_EDITOR'
 	);
 
 
@@ -224,6 +225,12 @@ class Class_AdminVar extends Storm_Model_Abstract {
 	}
 
 
+	/** @return bool */
+	public static function isCssEditorEnabled() {
+		return self::isModuleEnabled('CSS_EDITOR');
+	}
+
+
 	/**
 	 * @return bool
 	 */
diff --git a/library/Class/Profil.php b/library/Class/Profil.php
index 3264488ea4f14e011439f7b580788567b207fb4b..73b2f531837db62dfb8fe113b257b58f2a57b2ab 100644
--- a/library/Class/Profil.php
+++ b/library/Class/Profil.php
@@ -1284,12 +1284,12 @@ class Class_Profil extends Storm_Model_Abstract {
 
 
 	public function writeHeaderCss($data) {
-		$header_css_path = $this->hasHeaderCss() 
-			? USERFILESPATH.str_replace(USERFILESURL, '/', $this->getHeaderCss())
-			: USERFILESPATH.'/css/profil_'.$this->getId().'.css';
+		$header_css = $this->hasHeaderCss() 
+			? str_replace(USERFILESURL, '', $this->getHeaderCss())
+			: 'css/profil_'.$this->getId().'.css';
 			
 
-		$this->getFileWriter()->putContents($header_css_path, $data);
-		return $this;
+		$this->getFileWriter()->putContents(USERFILESPATH.'/'.$header_css, $data);		
+		return $this->setHeaderCss(USERFILESURL.$header_css);
 	}
 }
\ No newline at end of file
diff --git a/tests/application/modules/admin/controllers/ProfilControllerControllerCssUploadTest.php b/tests/application/modules/admin/controllers/ProfilControllerControllerCssUploadTest.php
index 833398838424599654910e41e371494bcff89b6b..c0955595ccd6b52d9ee611419c6bfd5399f6d594 100644
--- a/tests/application/modules/admin/controllers/ProfilControllerControllerCssUploadTest.php
+++ b/tests/application/modules/admin/controllers/ProfilControllerControllerCssUploadTest.php
@@ -87,6 +87,15 @@ class ProfilControllerCssUploadTest extends Admin_AbstractControllerTestCase {
 	public function profilShouldBeSaved($profil_loader) {
 		$this->assertTrue($profil_loader->methodHasBeenCalled('save'));		
 	}
+
+
+	/**
+	 * @depends uploadShoulPutContentInANewCssFileWhenProfilHasNoCss
+	 * @test 
+	 */
+	public function profilCssShouldBeProfil5Css($profil_loader) {
+		$this->assertEquals(BASE_URL.'/userfiles/css/profil_5.css', $profil_loader->find(5)->getHeaderCss());		
+	}
 }
 
 ?>
\ No newline at end of file
diff --git a/tests/application/modules/opac/controllers/IndexControllerTest.php b/tests/application/modules/opac/controllers/IndexControllerTest.php
index aeeed387418874a6693f94e197034a66d9ba6622..b010717daf3e03a309dc16ea16a07c103413a6f5 100644
--- a/tests/application/modules/opac/controllers/IndexControllerTest.php
+++ b/tests/application/modules/opac/controllers/IndexControllerTest.php
@@ -18,12 +18,48 @@
  * along with AFI-OPAC 2.0; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA 
  */
-class IndexControllerTest extends AbstractControllerTestCase {
+class IndexControllerAsInviteTest extends AbstractControllerTestCase {
+	protected function _loginHook($account) {
+		$account->ROLE_LEVEL = ZendAfi_Acl_AdminControllerRoles::INVITE;
+	}
+
 	/** @test */
 	public function withOnlyParamQShouldRedirectToRecherche() {
 		$this->dispatch('index/index?q=test');
 		$this->assertRedirectTo('/recherche?q=test');
 	}
+
+
+	/** @test */
+	public function cssEditorShouldNotBeLoadedEvenIfEnabled() {
+		Class_AdminVar::newInstanceWithID('CSS_EDITOR')->setValeur(1);
+		$this->dispatch('/');
+		$this->assertNotXPathContentContains('//script', 'AFI-OPAC.js');
+	}
+
+}
+
+
+
+class IndexControllerCssEditorAsAdminTest extends AbstractControllerTestCase {
+	protected function _loginHook($account) {
+		$account->ROLE_LEVEL = ZendAfi_Acl_AdminControllerRoles::ADMIN_PORTAIL;
+	}
+
+	/** @test */
+	public function withCssEditorEnabledShouldLoadIt() {
+		Class_AdminVar::newInstanceWithID('CSS_EDITOR')->setValeur(1);
+		$this->dispatch('/');
+		$this->assertXPathContentContains('//script', 'AFI-OPAC.js');
+	}
+
+
+	/** @test */
+	public function withCssEditorDisabledShouldNotLoadIt() {
+		Class_AdminVar::newInstanceWithID('CSS_EDITOR')->setValeur(0);
+		$this->dispatch('/');
+		$this->assertNotXPathContentContains('//script', 'AFI-OPAC.js');
+	}
 }
 
 ?>