Index: fckeditor.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/wysiwyg/editors/fckeditor.inc,v
retrieving revision 1.8
diff -u -r1.8 fckeditor.inc
--- fckeditor.inc	24 Jan 2009 23:32:02 -0000	1.8
+++ fckeditor.inc	28 Jan 2009 09:08:08 -0000
@@ -76,14 +76,10 @@
 function wysiwyg_fckeditor_settings($editor, $config, $theme) {
   $settings = array(
     'EditorPath' => base_path() . $editor['library path'] .'/',
+    'CustomConfigurationsPath' => wysiwyg_get_path('editors/js/fckeditor.config.js', TRUE),
     'SkinPath' => base_path() . $editor['library path'] .'/editor/skins/default/',
     'Width' => '100%',
     'Height' => 420,
-    'DefaultLanguage' => 'en',
-    'AutoDetectLanguage' => TRUE,
-    'ToolbarStartExpanded' => TRUE,
-    'EnterMode' => 'p',
-    'ShiftEnterMode' => 'br',
     'LinkBrowser' => FALSE,
     'LinkUpload' => FALSE,
     'ImageBrowser' => FALSE,
@@ -113,6 +109,36 @@
     }
   }
 
+  $plugins = wysiwyg_get_plugins($editor['name']);
+  
+  if (empty($config['buttons'])) {
+    $config['buttons']['default'] = $plugins['default']['buttons'];
+  }
+  
+  // Use our custom toolbar set (for FCKinstance).
+  $settings['ToolbarSet'] = 'Wysiwyg';
+  // Populate our custom toolbar set for fckeditor.config.js.
+  $settings['buttons'] = array();
+  foreach ($config['buttons'] as $plugin => $buttons) {
+    foreach ($buttons as $button => $enabled) {
+      // Iterate separately over buttons and extensions properties.
+      foreach (array('buttons', 'extensions') as $type) {
+        // Skip unavailable plugins.
+        if (!isset($plugins[$plugin][$type][$button])) {
+          continue;
+        }
+        // Add buttons.
+        if ($type == 'buttons') {
+          $settings['buttons'][] = $button;
+        }
+      }
+    }
+  }
+  // For now, all buttons are placed into one row.
+  if (!empty($settings['buttons'])) {
+    $settings['buttons'] = array($settings['buttons']);
+  }
+
   return $settings;
 }
 
@@ -137,6 +163,28 @@
  */
 function wysiwyg_fckeditor_plugins($editor) {
   return array(
+    'default' => array(
+      'buttons' => array(
+        'Source' => t('Source code'), 'Templates' => t('Templates'),
+        'Cut' => t('Cut'), 'Copy' => t('Copy'), 'Paste' => t('Paste'),
+        'PasteText' => t('Paste text'), 'PasteWord' => t('Paste from Word'),
+        'SpellCheck' => t('Check spelling'), 'Undo' => t('Undo'), 'Redo' => t('Redo'),
+        'Find' => t('Search'), 'Replace' => t('Replace'), 'SelectAll' => t('Select all'), 'RemoveFormat' => t('Remove format'),
+        'Bold' => t('Bold'), 'Italic' => t('Italic'), 'Underline' => t('Underline'),
+        'StrikeThrough' => t('Strike through'), 'Superscript' => t('Superscript'), 'Subscript' => t('Subscript'),
+        'OrderedList' => t('Numbered list'), 'UnorderedList' => t('Bulleted list'),
+        'Outdent' => t('Decrease indent'), 'Indent' => t('Increase indent'),
+        'Blockquote' => t('Blockquote'), 'CreateDiv' => t('Create DIV container'),
+        'JustifyLeft' => t('Left justify'), 'JustifyCenter' => t('Center justify'), 'JustifyRight' => t('Right justify'), 'JustifyFull' => t('Justify'),
+        'Link' => t('Link'), 'Unlink' => t('Unlink'), 'Anchor' => t('Anchor'),
+        'Image' => t('Image'), 'Flash' => t('Flash'), 'Table' => t('Table'),
+        'Rule' => t('Horizontal line'), 'Smiley' => t('Smiley'), 'SpecialChar' => t('Character map'),
+        'Style' => t('Font style'), 'FontFormat' => t('HTML block format'), 'FontName' => t('Font'), 'FontSize' => t('Font size'),
+        'TextColor' => t('Text color'), 'BGColor' => t('Background color'),
+        'FitWindow' => t('Fit window'), 'ShowBlocks' => t('Show blocks'), 'About' => t('About'),
+      ),
+      'internal' => TRUE,
+    ),
   );
 }
 
Index: js/fckeditor-2.6.js
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/wysiwyg/editors/js/fckeditor-2.6.js,v
retrieving revision 1.10
diff -u -r1.10 fckeditor-2.6.js
--- js/fckeditor-2.6.js	24 Jan 2009 23:32:03 -0000	1.10
+++ js/fckeditor-2.6.js	28 Jan 2009 05:40:50 -0000
@@ -5,8 +5,16 @@
  */
 Drupal.wysiwyg.editor.attach.fckeditor = function(context, params, settings) {
   var FCKinstance = new FCKeditor(params.field, settings['Width'], settings['Height']);
-  // Configure editor settings for this input format.
+  // Apply editor instance settings.
   FCKinstance.BasePath = settings.EditorPath;
+  // Apply 'Wysiwyg' toolbar, if defined.
+  if (settings.buttons) {
+    FCKinstance.ToolbarSet = settings.ToolbarSet;
+  }
+
+  // Apply input format configuration.
+  FCKinstance.Config.format = params.format;
+  delete settings.buttons;
   for (var setting in settings) {
     FCKinstance.Config[setting] = settings[setting];
   }
@@ -27,9 +35,13 @@
       delete FCKeditorAPI.__Instances[params.field];
     }
   }
-//  else {
-//    tinyMCE.triggerSave();
-//    tinyMCE.remove();
-//  }
+  else {
+    for (instance in FCKeditorAPI.__Instances) {
+      $('#' + instance).val(editor.GetXHTML()).show();
+      $('#' + instance + '___Config').remove();
+      $('#' + instance + '___Frame').remove();
+      delete FCKeditorAPI.__Instances[instance];
+    }
+  }
 };
 
--- js/fckeditor.config.js
+++ js/fckeditor.config.js
@@ -0,0 +1,17 @@
+// $Id$
+
+/**
+ * Apply custom Wysiwyg API toolbar for input format.
+ *
+ * For whatever reason, our custom 'format' property is not available in
+ * FCKConfig.format, but in FCKConfig.PageConfig.format instead.
+ */
+(function()
+{
+  var buttons = window.parent.Drupal.settings.wysiwyg.configs.fckeditor[FCKConfig.PageConfig.format].buttons[0];
+  FCKConfig.ToolbarSets['Wysiwyg'] = [];
+  for (var i=0; i<buttons.length; i++) {
+    FCKConfig.ToolbarSets['Wysiwyg'].push([buttons[i]])
+  }
+  FCKTools.AppendStyleSheet(document, '#xToolbar .TB_Start{display:none}');
+})();


