Index: inc/admin/lib.dc.page.php
===================================================================
--- inc/admin/lib.dc.page.php	(revision 270)
+++ inc/admin/lib.dc.page.php	(revision 326)
@@ -4,5 +4,5 @@
 # This file is part of Dotclear 2.
 #
-# Copyright (c) 2003-2011 Olivier Meunier & Association Dotclear
+# Copyright (c) 2003-2010 Olivier Meunier & Association Dotclear
 # Licensed under the GPL version 2.0 license.
 # See LICENSE file or
@@ -101,10 +101,4 @@
 		if (l10n::getTextDirection($GLOBALS['_lang']) == 'rtl') {
 			echo '  <style type="text/css">'."\n".'  @import "style/default-rtl.css";'."\n"."  </style>\n";
-		}
-
-		$core->auth->user_prefs->addWorkspace('interface');
-		$user_ui_hide_std_favicon = $core->auth->user_prefs->interface->hide_std_favicon;
-		if (!$user_ui_hide_std_favicon) {
-			echo '<link rel="icon" type="image/png" href="images/favicon.png" />';
 		}
 		
@@ -555,80 +549,148 @@
 	public static function jsToolBar()
 	{
+		$tb = new dcToolBar($GLOBALS['core']);
+		
+		// Add xhtml toolbar
+		$tb->addFormatter('xhtml');
+		$tb->addSettings('xhtml',array(
+			'mode' => 'textareas',
+			'relative_urls' => 'false',
+			'theme' => 'advanced',
+			'theme_advanced_toolbar_location' => 'top',
+			'theme_advanced_toolbar_align' => 'left',
+			'theme_advanced_statusbar_location' => 'bottom',
+			'theme_advanced_resizing' => 'true',
+			'theme_advanced_resize_horizontal' => 'false',
+			'theme_advanced_blockformats' => 'p,pre,h1,h2,h3,h4',
+			'convert_newlines_to_brs' => 'true',
+			'paste_auto_cleanup_on_paste' => 'true',
+			'formats' => '{underline: {inline: "ins"},strikethrough: {inline: "del"},inlinecode: {inline: "code"},quote: {inline: "q"}}'
+		));
+		$tb->addPlugins('xhtml',array(
+			'fullscreen' => true,
+			'paste' => true,
+			'searchreplace' => true,
+			'dcControls' => true,
+			'dcTags' => false
+		));
+		$tb->addButtons('xhtml',array(
+			1 => array(
+				'justifyleft',
+				'justifycenter',
+				'justifyright',
+				'separator',
+				'bold',
+				'italic',
+				'underline',
+				'strikethrough',
+				'inlinecode',
+				'quote',
+				'sub',
+				'sup',
+				'separator',
+				'blockquote',
+				'bullist',
+				'numlist',
+				'outdent',
+				'indent',
+				'separator',
+				'undo',
+				'redo',
+				'separator',
+				'fullscreen',
+				'separator',
+				'code'
+			),
+			2 => array(
+				'formatselect',
+				'removeformat',
+				'cleanup',
+				'seperator',
+				'cut',
+				'copy',
+				'paste',
+				'pastetext',
+				'pasteword',
+				'search',
+				'replace'
+			),
+			3 => array(
+				'link',
+				'postlink',
+				'medialink',
+				'separator',
+				'unlink',
+				'separator',
+				'hr',
+				'charmap',
+				'visualchars'
+			)
+		));
+		
+		// Add wiki toolbar
+		$tb->addFormatter('wiki');
+		$tb->addSettings('wiki',array(
+			'mode' => 'none',
+			'relative_urls' => 'false',
+			'theme' => 'advanced',
+			'theme_advanced_toolbar_location' => 'top',
+			'theme_advanced_toolbar_align' => 'left',
+			'theme_advanced_statusbar_location' => 'bottom',
+			'theme_advanced_resizing' => 'true',
+			'theme_advanced_resize_horizontal' => 'false',
+			'theme_advanced_path'  => 'false',
+			'theme_advanced_blockformats' => 'p,pre,h1,h2,h3,h4',
+			'entity_encoding' => 'raw',
+			'remove_linebreaks' => 'false',
+			'inline_styles' => 'false',
+			'convert_fonts_to_spans' => 'false',
+			'paste_auto_cleanup_on_paste' => 'true',
+			'force_br_newlines' => 'true',
+			'force_p_newlines' => 'false',
+			'forced_root_block' => '',
+			'formats' => '{underline: {inline: "ins"},strikethrough: {inline: "del"},inlinecode: {inline: "code"},quote: {inline: "q"}}'
+		));
+		$tb->addPlugins('wiki',array(
+			'fullscreen' => true,
+			'paste' => true,
+			'searchreplace' => true,
+			'dcControls' => true,
+			'dcTags' => false
+		));
+		$tb->addButtons('wiki',array(
+			1 => array(
+				'formatselect',
+				'bold',
+				'italic',
+				'underline',
+				'strikethrough',
+				'quote',
+				'inlinecode',
+				'separator',
+				'blockquote',
+				'bullist',
+				'numlist',
+				'separator',
+				'link',
+				'unlink',
+				'separator',
+				'search',
+				'replace',
+				'separator',
+				'undo',
+				'redo',
+				'separator',
+				'fullscreen',
+				'separator',
+				'code'
+			)
+		));
+		
 		$res =
-		'<link rel="stylesheet" type="text/css" href="style/jsToolBar/jsToolBar.css" />'.
-		'<script type="text/javascript" src="js/jsToolBar/jsToolBar.js"></script>';
-		
-		if (isset($GLOBALS['core']->auth) && $GLOBALS['core']->auth->getOption('enable_wysiwyg')) {
-			$res .= '<script type="text/javascript" src="js/jsToolBar/jsToolBar.wysiwyg.js"></script>';
-		}
-		
-		$res .=
-		'<script type="text/javascript" src="js/jsToolBar/jsToolBar.dotclear.js"></script>'.
+		'<script type="text/javascript" src="js/tiny_mce/tiny_mce.js"></script>'.
+		'<script type="text/javascript" src="js/dcToolBar.js"></script>'.
 		'<script type="text/javascript">'."\n".
 		"//<![CDATA[\n".
-		"jsToolBar.prototype.dialog_url = 'popup.php'; ".
-		"jsToolBar.prototype.iframe_css = '".
-			'body{'.
-				'font: 12px "DejaVu Sans","Lucida Grande","Lucida Sans Unicode",Arial,sans-serif;'.
-				'color : #000;'.
-				'background: #f9f9f9;'.
-				'margin: 0;'.
-				'padding : 2px;'.
-				'border: none;'.
-				(l10n::getTextDirection($GLOBALS['_lang']) == 'rtl' ? 'direction:rtl;' : '').
-			'}'.
-			'pre, code, kbd, samp {'.
-				'font-family:"Courier New",Courier,monospace;'.
-				'font-size : 1.1em;'.
-			'}'.
-			'code {'.
-				'color : #666;'.
-				'font-weight : bold;'.
-			'}'.
-			'body > p:first-child {'.
-				'margin-top: 0;'.
-			'}'.
-		"'; ".
-		"jsToolBar.prototype.base_url = '".html::escapeJS($GLOBALS['core']->blog->host)."'; ".
-		"jsToolBar.prototype.switcher_visual_title = '".html::escapeJS(__('visual'))."'; ".
-		"jsToolBar.prototype.switcher_source_title = '".html::escapeJS(__('source'))."'; ".
-		"jsToolBar.prototype.legend_msg = '".
-		html::escapeJS(__('You can use the following shortcuts to format your text.'))."'; ".
-		"jsToolBar.prototype.elements.blocks.options.none = '".html::escapeJS(__('-- none --'))."'; ".
-		"jsToolBar.prototype.elements.blocks.options.nonebis = '".html::escapeJS(__('-- block format --'))."'; ".
-		"jsToolBar.prototype.elements.blocks.options.p = '".html::escapeJS(__('Paragraph'))."'; ".
-		"jsToolBar.prototype.elements.blocks.options.h1 = '".html::escapeJS(__('Level 1 header'))."'; ".
-		"jsToolBar.prototype.elements.blocks.options.h2 = '".html::escapeJS(__('Level 2 header'))."'; ".
-		"jsToolBar.prototype.elements.blocks.options.h3 = '".html::escapeJS(__('Level 3 header'))."'; ".
-		"jsToolBar.prototype.elements.blocks.options.h4 = '".html::escapeJS(__('Level 4 header'))."'; ".
-		"jsToolBar.prototype.elements.blocks.options.h5 = '".html::escapeJS(__('Level 5 header'))."'; ".
-		"jsToolBar.prototype.elements.blocks.options.h6 = '".html::escapeJS(__('Level 6 header'))."'; ".
-		"jsToolBar.prototype.elements.strong.title = '".html::escapeJS(__('Strong emphasis'))."'; ".
-		"jsToolBar.prototype.elements.em.title = '".html::escapeJS(__('Emphasis'))."'; ".
-		"jsToolBar.prototype.elements.ins.title = '".html::escapeJS(__('Inserted'))."'; ".
-		"jsToolBar.prototype.elements.del.title = '".html::escapeJS(__('Deleted'))."'; ".
-		"jsToolBar.prototype.elements.quote.title = '".html::escapeJS(__('Inline quote'))."'; ".
-		"jsToolBar.prototype.elements.code.title = '".html::escapeJS(__('Code'))."'; ".
-		"jsToolBar.prototype.elements.br.title = '".html::escapeJS(__('Line break'))."'; ".
-		"jsToolBar.prototype.elements.blockquote.title = '".html::escapeJS(__('Blockquote'))."'; ".
-		"jsToolBar.prototype.elements.pre.title = '".html::escapeJS(__('Preformated text'))."'; ".
-		"jsToolBar.prototype.elements.ul.title = '".html::escapeJS(__('Unordered list'))."'; ".
-		"jsToolBar.prototype.elements.ol.title = '".html::escapeJS(__('Ordered list'))."'; ".
-		
-		"jsToolBar.prototype.elements.link.title = '".html::escapeJS(__('Link'))."'; ".
-		"jsToolBar.prototype.elements.link.href_prompt = '".html::escapeJS(__('URL?'))."'; ".
-		"jsToolBar.prototype.elements.link.hreflang_prompt = '".html::escapeJS(__('Language?'))."'; ".
-		
-		"jsToolBar.prototype.elements.img.title = '".html::escapeJS(__('External image'))."'; ".
-		"jsToolBar.prototype.elements.img.src_prompt = '".html::escapeJS(__('URL?'))."'; ".
-		
-		"jsToolBar.prototype.elements.img_select.title = '".html::escapeJS(__('Media chooser'))."'; ".
-		"jsToolBar.prototype.elements.post_link.title = '".html::escapeJS(__('Link to an entry'))."'; ";
-		
-		if (!$GLOBALS['core']->auth->check('media,media_admin',$GLOBALS['core']->blog->id)) {
-			$res .= "jsToolBar.prototype.elements.img_select.disabled = true;\n";
-		}
-		
-		$res .=
+		$tb->getJS().
 		"\n//]]>\n".
 		"</script>\n";
