Index: .cvsignore
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/wysiwyg/Attic/.cvsignore,v
retrieving revision 1.1.2.1
diff -u -p -r1.1.2.1 .cvsignore
--- .cvsignore 30 May 2008 02:49:54 -0000 1.1.2.1
+++ .cvsignore 14 Jul 2008 23:57:12 -0000
@@ -1 +1,2 @@
-tinymce
\ No newline at end of file
+tinymce
+fckeditor
\ No newline at end of file
Index: wysiwyg_editor.admin.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/wysiwyg/wysiwyg_editor.admin.inc,v
retrieving revision 1.1.2.11
diff -u -p -r1.1.2.11 wysiwyg_editor.admin.inc
--- wysiwyg_editor.admin.inc 29 Jun 2008 22:24:31 -0000 1.1.2.11
+++ wysiwyg_editor.admin.inc 15 Jul 2008 00:35:14 -0000
@@ -55,6 +55,7 @@ function wysiwyg_editor_profile_form($ed
$edit += array(
'name' => NULL,
'rids' => NULL,
+ 'editor' => 'tinymce',
'settings' => array(
'default' => TRUE,
'user_choose' => FALSE,
@@ -117,6 +118,14 @@ function wysiwyg_editor_profile_form($ed
'#required' => TRUE,
);
+ $form['basic']['editor'] = array(
+ '#type' => 'select',
+ '#title' => t('Editor'),
+ '#default_value' => $edit->settings['editor'],
+ '#options' => array('tinymce' => 'TinyMCE', 'fckeditor' => 'FCKeditor'),
+ '#description' => t('Choose an editor to use for this profile.'),
+ );
+
$form['basic']['default'] = array(
'#type' => 'select',
'#title' => t('Default state'),
@@ -486,9 +495,13 @@ function wysiwyg_editor_profile_overview
$profiles = wysiwyg_editor_profile_load();
if ($profiles) {
$roles = user_roles(FALSE, 'access wysiwyg editor');
- $header = array(t('Profile'), t('Roles'), t('Operations'));
+ $header = array(t('Profile'), t('Editor'), t('Roles'), t('Operations'));
foreach ($profiles as $p) {
- $rows[] = array(array('data' => $p->name, 'valign' => 'top'), array('data' => implode("
\n", $p->rids)), array('data' => l(t('Edit'), 'admin/settings/wysiwyg/profile/edit/'. urlencode($p->name)) .' '. l(t('Delete'), 'admin/settings/wysiwyg/profile/delete/'. urlencode($p->name)), 'valign' => 'top'));
+ $rows[] = array(
+ array('data' => $p->name, 'valign' => 'top'),
+ array('data' => $p->settings['editor'], 'valign' => 'top'),
+ array('data' => implode("
\n", $p->rids)),
+ array('data' => l(t('Edit'), 'admin/settings/wysiwyg/profile/edit/'. urlencode($p->name)) .' '. l(t('Delete'), 'admin/settings/wysiwyg/profile/delete/'. urlencode($p->name)), 'valign' => 'top'));
}
$output .= theme('table', $header, $rows);
}
Index: wysiwyg_editor.js
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/wysiwyg/wysiwyg_editor.js,v
retrieving revision 1.1.2.6
diff -u -p -r1.1.2.6 wysiwyg_editor.js
--- wysiwyg_editor.js 8 Jul 2008 02:54:34 -0000 1.1.2.6
+++ wysiwyg_editor.js 15 Jul 2008 03:08:02 -0000
@@ -7,20 +7,30 @@
* calling tinyMCE.init() after the page is loaded breaks in IE 6.
*/
Drupal.wysiwygEditorInit = function () {
- // If JS compression is enabled, TinyMCE is unable to find its own base path
- // and exec mode, hence we need to define it manually.
- tinyMCE.baseURL = Drupal.settings.wysiwygEditor.editorBasePath;
- tinyMCE.srcMode = (Drupal.settings.wysiwygEditor.execMode == 'src' ? '_src' : '');
- tinyMCE.gzipMode = (Drupal.settings.wysiwygEditor.execMode == 'gzip');
-
- for (var theme in Drupal.settings.wysiwygEditor.configs) {
- // Clone so we are not passing by reference. Otherwise the
- // settings will get overwritten.
- var config = Drupal.wysiwygEditorCloneObject(Drupal.settings.wysiwygEditor.configs[theme]);
- tinyMCE.init(config);
- }
- for (var plugin in Drupal.settings.wysiwygEditor.plugins) {
- tinyMCE.loadPlugin(plugin, Drupal.settings.wysiwygEditor.plugins[plugin]);
+ for (var editor in Drupal.settings.wysiwygEditor.configs) {
+ switch (editor) {
+ case 'fckeditor':
+ break;
+
+ case 'tinymce':
+ default:
+ // If JS compression is enabled, TinyMCE is unable to find its own base path
+ // and exec mode, hence we need to define it manually.
+ tinyMCE.baseURL = Drupal.settings.wysiwygEditor.editorBasePath;
+ tinyMCE.srcMode = (Drupal.settings.wysiwygEditor.execMode == 'src' ? '_src' : '');
+ tinyMCE.gzipMode = (Drupal.settings.wysiwygEditor.execMode == 'gzip');
+
+ for (var theme in Drupal.settings.wysiwygEditor.configs[editor]) {
+ // Clone so we are not passing by reference. Otherwise the
+ // settings will get overwritten.
+ var config = Drupal.wysiwygEditorCloneObject(Drupal.settings.wysiwygEditor.configs[editor][theme]);
+ tinyMCE.init(config);
+ }
+ for (var plugin in Drupal.settings.wysiwygEditor.plugins) {
+ tinyMCE.loadPlugin(plugin, Drupal.settings.wysiwygEditor.plugins[plugin]);
+ }
+ break;
+ }
}
}
@@ -30,49 +40,119 @@ Drupal.wysiwygEditorInit = function () {
* This function can be called to process AJAX-loaded content.
*/
Drupal.wysiwygEditorAttach = function () {
- for (var theme in Drupal.settings.wysiwygEditor.configs) {
- var config = Drupal.wysiwygEditorCloneObject(Drupal.settings.wysiwygEditor.configs[theme]);
- // Set configuration options for this theme.
- for (var setting in config) {
- tinyMCE.settings[setting] = config[setting];
+ for (var editor in Drupal.settings.wysiwygEditor.configs) {
+ switch (editor) {
+ case 'fckeditor':
+ for (var theme in Drupal.settings.wysiwygEditor.configs[editor]) {
+ var config = Drupal.wysiwygEditorCloneObject(Drupal.settings.wysiwygEditor.configs[editor][theme]);
+ $('textarea.wysiwyg-' + theme + ':not(.wysiwyg-processed)').each(function () {
+ // Show toggle link if set.
+ if (Drupal.settings.wysiwygEditor.showToggle) {
+ Drupal.wysiwygEditorAttachToggleLink(this, editor, theme);
+ }
+ // Attach Wysiwyg Editor control if default is on.
+ if (Drupal.settings.wysiwygEditor.status) {
+ // @todo Convert string into variable name w/o overwriting string?
+ // workaround: build object via editors[this.id] = new ...
+ var oFCK_1 = new FCKeditor(this.id);
+ oFCK_1.BasePath = Drupal.settings.wysiwygEditor.editorBasePath +'/';
+ //oFCK_1.Config['CustomConfigurationsPath'] = Drupal.settings.wysiwygEditor.editorBasePath + '/../../fckeditor/fckeditor.config.js';
+ //oFCK_1.ToolbarSet = "DrupalFull";
+ oFCK_1.Config['TextareaID'] = this.id;
+ oFCK_1.Config['SkinPath'] = oFCK_1.BasePath + 'editor/skins/default/';
+ oFCK_1.Config['DefaultLanguage'] = "en";
+ oFCK_1.Config['AutoDetectLanguage'] = true;
+ oFCK_1.Height = "420";
+ oFCK_1.Config['ToolbarStartExpanded'] = true;
+ oFCK_1.Width = "100%";
+ oFCK_1.Config['EnterMode'] = 'p';
+ oFCK_1.Config['ShiftEnterMode'] = "br";
+ oFCK_1.Config['FontFormats'] = config.theme_advanced_blockformats.replace(/,/g,';');
+ oFCK_1.Config['FormatSource'] = config.apply_source_formatting;
+ oFCK_1.Config['FormatOutput'] = true;
+ oFCK_1.Config['LinkBrowser'] = false;
+ oFCK_1.Config['ImageBrowser'] = false;
+ oFCK_1.Config['FlashBrowser'] = false;
+ oFCK_1.Config['LinkUpload'] = false;
+ oFCK_1.Config['ImageUpload'] = false;
+ oFCK_1.Config['FlashUpload'] = false;
+ oFCK_1.Config['EditorAreaCSS'] = config.content_css;
+ oFCK_1.ReplaceTextarea();
+ }
+ $(this).addClass('wysiwyg-processed');
+ });
+ }
+ break;
+
+ case 'tinymce':
+ default:
+ for (var theme in Drupal.settings.wysiwygEditor.configs[editor]) {
+ var config = Drupal.wysiwygEditorCloneObject(Drupal.settings.wysiwygEditor.configs[editor][theme]);
+ // Set configuration options for this theme.
+ for (var setting in config) {
+ tinyMCE.settings[setting] = config[setting];
+ }
+ $('textarea.wysiwyg-' + theme + ':not(.wysiwyg-processed)').each(function () {
+ // Show toggle link if set.
+ if (Drupal.settings.wysiwygEditor.showToggle) {
+ Drupal.wysiwygEditorAttachToggleLink(this, editor, theme);
+ }
+ // Attach Wysiwyg Editor control if default is on.
+ if (Drupal.settings.wysiwygEditor.status) {
+ tinyMCE.execCommand('mceAddControl', true, this.id);
+ }
+ $(this).addClass('wysiwyg-processed');
+ });
+ }
+ break;
}
- $('textarea.wysiwyg-' + theme + ':not(.wysiwyg-processed)').each(function () {
- // Show toggle link if set.
- if (Drupal.settings.wysiwygEditor.showToggle) {
- Drupal.wysiwygEditorAttachToggleLink(this, theme);
- }
- // Attach Wysiwyg Editor control if default is on.
- if (Drupal.settings.wysiwygEditor.status) {
- tinyMCE.execCommand('mceAddControl', true, this.id);
- }
- $(this).addClass('wysiwyg-processed');
- });
}
}
/**
* Toggle the Wysiwyg Editor control and related link text for a textarea.
*/
-Drupal.wysiwygEditorToggle = function (id, theme) {
- if (tinyMCE.getEditorId(id) == null) {
- var config = Drupal.wysiwygEditorCloneObject(Drupal.settings.wysiwygEditor.configs[theme]);
- // Set configuration options for this theme.
- for (var setting in config) {
- tinyMCE.settings[setting] = config[setting];
- }
- tinyMCE.addMCEControl($('#' + id).get(0), id);
- $('#wysiwyg4' + id).html(Drupal.settings.wysiwygEditor.disable).blur();
- }
- else {
- tinyMCE.removeMCEControl(tinyMCE.getEditorId(id));
- $('#wysiwyg4' + id).html(Drupal.settings.wysiwygEditor.enable).blur();
+Drupal.wysiwygEditorToggle = function (id, editor, theme) {
+ switch (editor) {
+ case 'fckeditor':
+ // @todo Convert string into variable name w/o overwriting string?
+ var instance = FCKeditorAPI.GetInstance(id);
+ if ($('#edit-body').css('display') != 'none' || instance == null) {
+ instance.SetHTML($('#' + id).hide().val());
+ $('#' + id + '___Frame').show();
+ $('#wysiwyg4' + id).html(Drupal.settings.wysiwygEditor.disable).blur();
+ }
+ else {
+ $('#' + id).val(instance.GetXHTML()).show();
+ $('#' + id + '___Frame').hide();
+ $('#wysiwyg4' + id).html(Drupal.settings.wysiwygEditor.enable).blur();
+ }
+ break;
+
+ case 'tinymce':
+ default:
+ // @todo Duplicate code identified; this cries for Drupal.wysiwygEditorAdd().
+ if (tinyMCE.getEditorId(id) == null) {
+ var config = Drupal.wysiwygEditorCloneObject(Drupal.settings.wysiwygEditor.configs[editor][theme]);
+ // Set configuration options for this theme.
+ for (var setting in config) {
+ tinyMCE.settings[setting] = config[setting];
+ }
+ tinyMCE.addMCEControl($('#' + id).get(0), id);
+ $('#wysiwyg4' + id).html(Drupal.settings.wysiwygEditor.disable).blur();
+ }
+ else {
+ tinyMCE.removeMCEControl(tinyMCE.getEditorId(id));
+ $('#wysiwyg4' + id).html(Drupal.settings.wysiwygEditor.enable).blur();
+ }
+ break;
}
}
/**
* Append toggle link to textarea.
*/
-Drupal.wysiwygEditorAttachToggleLink = function (elt, theme) {
+Drupal.wysiwygEditorAttachToggleLink = function (elt, editor, theme) {
if (typeof(document.execCommand) == 'undefined') {
$(elt).after('