From a128033160dd0f5c9b4e94958eecabeb3a178b80 Mon Sep 17 00:00:00 2001
From: Regis Houssin <regis@dolibarr.fr>
Date: Mon, 31 Jan 2011 18:05:41 +0000
Subject: [PATCH] Test CKEditor

---
 htdocs/lib/doleditor.class.php | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/htdocs/lib/doleditor.class.php b/htdocs/lib/doleditor.class.php
index 3b795acb1df..589d1e720d0 100644
--- a/htdocs/lib/doleditor.class.php
+++ b/htdocs/lib/doleditor.class.php
@@ -42,6 +42,7 @@ class DolEditor
 	var $htmlname;
 	var $rows;
 	var $cols;
+	var $height;
 
 
     /**
@@ -106,10 +107,12 @@ class DolEditor
     	}
         if ($this->tool == 'textarea')
         {
-    	    $this->content = $content;
+    	    $this->content	= $content;
     	    $this->htmlname = $htmlname;
-            $this->rows=max(ROWS_3,$rows);
-            $this->cols=max(40,$cols);
+            $this->rows		= max(ROWS_3,$rows);
+            $this->cols		= max(40,$cols);
+            $this->height	= $height;
+            $this->width	= 600;
     	}
     }
 
@@ -132,10 +135,17 @@ class DolEditor
         {
             $found=1;
             $cssclass='flat';
-            if ($conf->global->MAIN_USE_CKEDITOR) $cssclass='ckeditor';
+            //if ($conf->global->MAIN_USE_CKEDITOR) $cssclass='ckeditor';
             print '<textarea id="'.$this->htmlname.'" name="'.$this->htmlname.'" rows="'.$this->rows.'" cols="'.$this->cols.'" class="'.$cssclass.'">';
             print $this->content;
             print '</textarea>';
+            
+            if ($conf->global->MAIN_USE_CKEDITOR)
+            {
+            	print '<script type="text/javascript">';
+            	print 'CKEDITOR.replace(\''.$this->htmlname.'\', { toolbar: \'Basic\', width: '.$this->width.', height: '.$this->height.', toolbarStartupExpanded: false });';
+            	print '</script>';
+            }
         }
 
         if (empty($found))
-- 
GitLab