Index: INSTALL.txt
===================================================================
RCS file: INSTALL.txt
diff -N INSTALL.txt
--- INSTALL.txt	8 Oct 2007 15:18:09 -0000	1.4
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,52 +0,0 @@
-// $Id: INSTALL.txt,v 1.4 2007/10/08 15:18:09 stborchert Exp $
-
-Requirements
-------------
-
-This module and its plugins require at least version 5.0 of Drupal and
-tinymce.module installed and enabled.
-linktocontent_node.module requires additionally taxonomy.module.
-linktocontent_category requires category.module installed.
-
-Installation
-------------
-
-1. Copy the folder named 'linktocontent' and its contents to the modules directory
-   of your Drupal installation (for example 'sites/all/modules/'.
-
-2. Copy the contents of the tinymce_plugins folder to the tinyMCE plugin
-   folder (for example sites/all/modules/tinymce/tinymce/jscripts/tiny_mce/plugins)
-
-3. Go to 'admin/build/modules' and enable linktocontent. There are three plugins
-   (for example Linktocontent_Node). You can enable any or all of these. 
-   The Description column describes dependencies. 
-   For example, to enable Linktocontent_Category you must enable Linktocontent_Node. 
-
-4. Go to 'admin/settings/tinymce' and edit the profile you want to enable the
-   new plugins (for example "linktonode") for.
-   In section "buttons and plugins" check linktonode and save the profile.
-
-   NOTE: If you would like to do a multi-site installation, the file plugin_reg.php is 
-   not writable or the plugin-buttons do not appear in the tinymce Buttons and Plugins section, 
-   you have to manually include the following lines into tinymce/plugin_reg.php:
-   <code>
-   // linktocontent.module: linktonode
-   if (is_dir(drupal_get_path('module', 'tinymce') . '/tinymce/jscripts/tiny_mce/plugins/linktonode/')) {
-     $plugins['linktonode'] = array();
-     $plugins['linktonode']['theme_advanced_buttons3'] = array('linktonode');
-   }
-   </code>
-
-   Insert the text near the end of the file before the last two lines:
-   <code>
-     return $plugins;
-   }
-   </code>
-
-   The preceding example is for "linktonode".
-   The text to be inserted for other contrib modules (e.g. linktomenu) looks similar. 
-   Please check tinymce_plugins/{modulename}/INSTALL.txt for further instructions.  
-
-5. Go to 'admin/settings/linktocontent' and enable every sub-module you would like to use.
-   After enabling a module check its settings page for more specific settings (for example 
-   which node types to display or which menus to use).
Index: README.txt
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/linktocontent/README.txt,v
retrieving revision 1.4
diff -u -p -r1.4 README.txt
--- README.txt	8 Oct 2007 15:18:09 -0000	1.4
+++ README.txt	11 Jan 2009 21:02:13 -0000
@@ -1,9 +1,7 @@
 // $Id: README.txt,v 1.4 2007/10/08 15:18:09 stborchert Exp $
 
-Readme
-------
-
-The linktocontent module allows you to extend the tinyMCE editor by several plugins.
+The linktocontent module allows you to extend the TinyMCE editor (via Wysiwyg
+API) with several plugins.
 
 Plugins:
  - linktocontent_node.module: 
@@ -13,6 +11,37 @@ Plugins:
  - linktocontent_category.module:
    Extends linktocontent_node.module to use it if category.module is enabled.
 
+
+Requirements
+------------
+
+This module and its plugins require Wysiwyg API installed and enabled.
+
+Link to Node requires additionally Taxonomy module.
+
+Link to Category requires Category module.
+
+
+Installation
+------------
+
+1. Copy the folder named 'linktocontent' and its contents to the modules directory
+   of your Drupal installation (for example 'sites/all/modules/'.
+
+2. Go to 'admin/build/modules' and enable linktocontent. There are three plugins
+   (for example Linktocontent_Node). You can enable any or all of these. 
+   The Description column describes dependencies. 
+   For example, to enable Linktocontent_Category you must enable Linktocontent_Node. 
+
+3. Go to 'admin/settings/wysiwyg' and edit the profile you want to enable the
+   new plugins (for example "linktonode") for.
+   In section "buttons and plugins" check linktonode and save the profile.
+
+4. Go to 'admin/settings/linktocontent' and enable every sub-module you would like to use.
+   After enabling a module check its settings page for more specific settings (for example 
+   which node types to display or which menus to use).
+
+
 Support
 -------
 
@@ -21,4 +50,4 @@ http://drupal.org/project/linktocontent
 Author
 ------
 
-Stefan Borchert http://drupal.org/user/36942/contact
\ No newline at end of file
+Stefan Borchert http://drupal.org/user/36942/contact
Index: linktocontent.info
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/linktocontent/linktocontent.info,v
retrieving revision 1.4
diff -u -p -r1.4 linktocontent.info
--- linktocontent.info	8 Oct 2007 15:18:09 -0000	1.4
+++ linktocontent.info	11 Jan 2009 16:42:03 -0000
@@ -1,5 +1,5 @@
 ; $Id: linktocontent.info,v 1.4 2007/10/08 15:18:09 stborchert Exp $
-name = "Linktocontent"
-description = "Provides a small 'API' for TinyMCE plugins to work with drupal data and functionality."
-package = Content
-dependencies = tinymce
+name = Linktocontent
+description = Provides a small API for TinyMCE plugins to work with Drupal data and functionality.
+package = User interface
+dependencies = wysiwyg
Index: linktocontent.install
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/linktocontent/linktocontent.install,v
retrieving revision 1.2.2.1
diff -u -p -r1.2.2.1 linktocontent.install
--- linktocontent.install	3 Nov 2008 23:51:01 -0000	1.2.2.1
+++ linktocontent.install	11 Jan 2009 17:07:02 -0000
@@ -4,5 +4,4 @@
 function linktocontent_uninstall() {
   variable_del('linktocontent_enabled_plugins');
   variable_del('linktocontent_plugin_weight');
-  variable_del('linktocontent_registered_plugins');
 }
Index: linktocontent.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/linktocontent/linktocontent.module,v
retrieving revision 1.12.2.2
diff -u -p -r1.12.2.2 linktocontent.module
--- linktocontent.module	11 Jan 2009 16:26:00 -0000	1.12.2.2
+++ linktocontent.module	11 Jan 2009 20:55:11 -0000
@@ -4,7 +4,6 @@
 define('LTC_PATH', drupal_get_path('module', 'linktocontent'));
 
 include_once(LTC_PATH .'/linktocontent.theme');
-include_once(LTC_PATH .'/linktocontent_util.inc');
 
 /**
  * Displays the help text for this module.
@@ -23,12 +22,9 @@ function linktocontent_help($section) {
 
 /**
  * Implementation of hook_perm()
- *
- * @ingroup linktcontent_core
  */
 function linktocontent_perm() {
-  $access = array('administer linktocontent');
-  return $access;
+  return array('administer linktocontent', 'access linktocontent');
 }
 
 /**
@@ -37,42 +33,56 @@ function linktocontent_perm() {
  * @ingroup linktocontent_core
  */
 function linktocontent_menu($may_cache) {
-  $access = user_access('administer linktocontent');
-//  if ($may_cache) {
-    // path for HTTPRequests (called from tinymce-plugins)
-    $items[] = array('path' => 'linktocontent',
-      'title' => t('linktocontent'),
-      'callback' => 'linktocontent_get_data',
-      'type' => MENU_CALLBACK,
-      'access' => true); // user_access('access tinymce'));
-//  }
-//  else {
-
-    $items[] = array('path' => 'admin/settings/linktocontent',
+  $items = array();
+  if ($may_cache) {
+    $items[] = array(
+      'path' => 'admin/settings/linktocontent',
       'title' => t('Link to content'),
       'description' => t('Configure relevant settings for linktocontent.'),
       'callback' => 'drupal_get_form',
       'callback arguments' => array('linktocontent_settings_page'),
-      'access' => $access);
-
-//  }
-
+      'access' => user_access('administer linktocontent'),
+    );
+  }
+  else {
+    // Path for HTTPRequests (called from tinymce-plugins)
+    $items[] = array(
+      'path' => 'linktocontent',
+      'title' => t('linktocontent'),
+      'callback' => 'linktocontent_get_data',
+      'type' => MENU_CALLBACK,
+      'access' => user_access('access linktocontent'),
+    );
+  }
   return $items;
 }
 
 /**
- * Retrieve all plugins registered for this function
+ * Retrieve all plugins registered for this function.
  *
- * @ingroup linktocontent_core
- * @param $function Name of the function to find plugins for.
- * @return All plugins registered to this function.
- **/
+ * @param $function
+ *   Name of the function to find plugins for.
+ * @return
+ *   All plugins registered for this function.
+ *
+ * @todo This badly needs to be rewritten.  I have no idea why this (fake)
+ *   registry needs to be that deeply nested, and why we need it at all.
+ */
 function _linktocontent_get_registered_plugins($function = 'global') {
-  $registered = variable_get('linktocontent_registered_plugins', array());
-  if ($registered[$function]) {
-    return $registered[$function];
-  }
-  return array();
+  $plugins = array(
+    'global' => array(
+      'linktocontent_node' => 'linktocontent_node',
+      'linktocontent_menu' => 'linktocontent_menu',
+    ),
+    'linktocontent_node' => array(
+      'linktocontent_node' => 'linktocontent_node',
+      'linktocontent_category' => 'linktocontent_category',
+    ),
+    'linktocontent_menu' => array(
+      'linktocontent_menu' => 'linktocontent_menu',
+    ),
+  );
+  return (isset($plugins[$function]) ? $plugins[$function] : array());
 }
 
 /**
@@ -104,23 +114,8 @@ function linktocontent_settings_page() {
 
   $options = array();
   $status = array();
-  foreach (_linktocontent_get_registered_plugins() as $plugin_name) {
+  foreach ($plugins as $plugin_name) {
     $plugin = _linktocontent_plugin_info($plugin_name);
-    // Check if plugin-module is still enabled on [admin/build/modules]. 
-    if (!module_exists($plugin_name)) {
-      // Module has been deactivated but not uninstalled yet.
-      continue;
-    }
-    
-    if (module_invoke($plugin_name, 'check_files') == FALSE) {
-      drupal_set_message(t('There seems to be an error with the installation of @module.
-        Please check you copied all files from <em>linktocontent/tinymce_plugins/@plugin</em>
-        to the TinyMCE plugin directory.', array('@module' => $plugin_name,
-          '@plugin' => $plugin->info['plugin'])),
-        'error');
-      // Don't show plugin until this error is resolved.
-      continue;
-    }
     $weight = (isset($weights[$plugin_name]) ? $weights[$plugin_name] : 0);
 
     $form['name'][$plugin_name] = array('#value' => $plugin->info['title']);
@@ -161,7 +156,8 @@ function linktocontent_settings_page_sub
 }
 
 function linktocontent_get_data() {
-  $plugins = linktocontent_validate_args();
+  $args = $_REQUEST;
+  $plugins = linktocontent_validate_args($args);
   if (!is_array($plugins)) {
     print drupal_to_js(array('message' => $plugins));
   }
@@ -176,32 +172,27 @@ function linktocontent_get_data() {
   }
   // Retrieve the data.
   $data = array();
-  $args = $_POST;
   foreach ($plugins as $plugin_name => $weight) {
     $data = module_invoke($plugin_name, 'get_data', $args, $data);
   }
 
   print drupal_to_js($data);
-  return;
+  exit;
 }
 
-function linktocontent_validate_args() {
-  $args = $_POST;
-
+function linktocontent_validate_args($args) {
   // Use all plugins.
   $plugins = _linktocontent_get_registered_plugins();
   if (!$plugins[$args['ltc-type']]) {
-    return t('!type isn\'t a valid type name for !ltc',
-      array('!type' => check_plain($args['ltc-type']),
-        '!ltc' => t('Link to content')));
+    return t('@type is not a valid type name for !ltc', array('@type' => $args['ltc-type'], '!ltc' => t('Link to content')));
   }
 
   // Use plugins registered to this type.
-  $plugins = _linktocontent_get_registered_plugins(check_plain($args['ltc-type']));
+  $plugins = _linktocontent_get_registered_plugins($args['ltc-type']);
   foreach ($plugins as $plugin_name) {
     $return = module_invoke($plugin_name, 'validate_args', $args);
     // In case of invalid data return the error message.
-    if ($return !== true) {
+    if ($return !== TRUE && $return !== NULL) {
       return $return;
     }
   }
Index: linktocontent_util.inc
===================================================================
RCS file: linktocontent_util.inc
diff -N linktocontent_util.inc
--- linktocontent_util.inc	8 Oct 2007 15:18:09 -0000	1.3
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,163 +0,0 @@
-<?php
-// $Id: linktocontent_util.inc,v 1.3 2007/10/08 15:18:09 stborchert Exp $
-
-/**
- * Register a plugin for a special function.
- *
- * @ingroup linktocontent_utility
- * @param $plugin the name of the plugin to register
- * @param $function The function to register to.
- **/
-function linktocontent_register($plugin, $function = 'global') {
-  if (!$function) {
-    $function = 'global';
-  }
-  $registered = variable_get('linktocontent_registered_plugins', array());
-  if (!$registered[$function][$plugin]) {
-    $registered[$function][$plugin] = $plugin;
-    variable_set('linktocontent_registered_plugins', $registered);
-  }
-}
-
-/**
- * Unregister a plugin for a special function.
- *
- * @ingroup linktocontent_utility
- * @param $plugin the name of the plugin to unregister
- * @param $function The function to remove registration for.
- **/
-function linktocontent_unregister($plugin, $function = 'global') {
-  if (!$function) {
-    $function = 'global';
-  }
-  $registered = variable_get('linktocontent_registered_plugins', array());
-  if ($function === 'global') {
-    // remove all registered functions of this plugin
-    foreach ($registered as $func => $val) {
-      unset($registered[$func][$plugin]);
-    }
-  }
-  else {
-    unset($registered[$function][$plugin]);
-  }
-  variable_set('linktocontent_registered_plugins', $registered);
-}
-
-/**
- * Install a plugin.
- *
- * @ingroup linktocontent_utility
- * @param $plugin The name of the plugin to install.
- **/
-function _linktocontent_autoinstall($plugin) {
-  $plugin_reg = drupal_get_path('module', 'tinymce') .'/plugin_reg.php';
-  // check if plugin_reg.php exists
-  if (!file_exists($plugin_reg)) {
-    drupal_set_message(t('The file %file could not be found. Please make sure !tinymce is installed correct.',
-      array('%file' => $file, '!tinymce' => t('TinyMCE'))), 'error');
-    return false;
-  }
-
-  // are we allowed to change plugin_reg.php?
-  if (!@is_writable($plugin_reg)) {
-    // try to set write-permission
-    if (!@chmod($plugin_reg, 0766)) {
-      drupal_set_message(t('The file %file is not writable. Please read INSTALL.txt (section "How to install manually") for instructions, how to install the module manually.',
-        array('%file' => $file)), 'error');
-      return false;
-    }
-  }
-  
-  // the text to insert in plugin_reg.php
-  $insert = '
-// linktocontent.module: '. $plugin .'
-if (is_dir(drupal_get_path(\'module\', \'tinymce\') . \'/tinymce/jscripts/tiny_mce/plugins/'. $plugin .'/\')) {
-  $plugins[\''. $plugin .'\'] = array();
-  $plugins[\''. $plugin .'\'][\'theme_advanced_buttons3\'] = array(\''. $plugin .'\');
-}
-
-';
-  // content of plugin_reg.php
-  $content = file_get_contents($plugin_reg, FALSE);
-  if (!$content || (strpos($content, 'function _tinymce_plugins()') === FALSE)) {
-    drupal_set_message(t('Could not open %file or %file isn\'t correct. Please make sure !tinymce is installed correct.',
-      array('%file' => 'plugin_reg.php', '!tinymce' => t('TinyMCE'))), 'error');
-    return false;
-  }
-
-  // check whether plugin already exists in plugin_reg.php
-  if (strpos($content, '// linktocontent.module: '. $plugin) !== FALSE) {
-    drupal_set_message(t('The plugin %plugin has been already installed with this installation of !tinymce.<br />If you try to do a multi-site installation read INSTALL.txt section "multi-site installation" for further instructions.',
-      array('%plugin' => $plugin, '!tinymce' => t('TinyMCE'))), 'error');
-    return false;
-  }
-
-  $insert_pos = strpos($content, 'return $plugins;');
-  if ($insert_pos !== FALSE) {
-    $content = substr($content, 0, $insert_pos - 1) . $insert . substr($content, $insert_pos);
-    if (_linktocontent_install_write($plugin_reg, $content) === false) {
-      return false;
-    }
-  }
-}
-
-/**
- * Uninstall a plugin.
- *
- * @ingroup linktocontent_utility
- * @param $plugin The name of the plugin to uninstall.
- **/
-function _linktocontent_autouninstall($plugin) {
-  $plugin_reg = drupal_get_path('module', 'tinymce') .'/plugin_reg.php';
-  // check if plugin_reg.php exists
-  if (!file_exists($plugin_reg)) {
-    drupal_set_message(t('The file %file could not be found. Please make sure !tinymce is installed correct.',
-      array('%file' => $file, '!tinymce' => t('TinyMCE'))), 'error');
-    return false;
-  }
-
-
-  $insert = '
-// linktocontent.module: '. $plugin .'
-if (is_dir(drupal_get_path(\'module\', \'tinymce\') . \'/tinymce/jscripts/tiny_mce/plugins/'. $plugin .'/\')) {
-  $plugins[\''. $plugin .'\'] = array();
-  $plugins[\''. $plugin .'\'][\'theme_advanced_buttons3\'] = array(\''. $plugin .'\');
-}
-
-';
-  $content = file_get_contents($plugin_reg, FALSE);
-  if (!$content || (strpos($content, 'function _tinymce_plugins()') === FALSE)) {
-    drupal_set_message(t('Could not open %file or %file isn\'t correct. Please make sure !tinymce is installed correct.',
-      array('%file' => 'plugin_reg.php', '!tinymce' => t('TinyMCE'))), 'error');
-    return false;
-  }
-
-  // check whether plugin exists in plugin_reg.php
-  $pos = strpos($content, $insert);
-  if ($pos !== FALSE) {
-    $return_pos = strpos($content, 'return $plugins;');
-    if ($return_pos !== FALSE) {
-      $content = substr($content, 0, $pos + 1) . substr($content, $return_pos);
-      _linktocontent_install_write($plugin_reg, $content);
-    }
-  }
-}
-
-/**
- * Write content to file.
- *
- * @ingroup linktocontent_utility
- * @param $file Path of the file to write to.
- * @param $content The content to be written.
- **/
-function _linktocontent_install_write($file, $content) {
-  if (!$handle = fopen($file, 'wb+')) {
-    drupal_set_message(t('Could not open %file for writing.', array('%file' => $file)), 'error');
-    return false;
-  }
-  if (!fwrite($handle, $content)) {
-    drupal_set_message(t('Could not write to %file.', array('%file' => $file)), 'error');
-    return false;
-  }
-  fclose($handle);
-}
Index: contrib/linktocontent_category/linktocontent_category.info
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/linktocontent/contrib/linktocontent_category/linktocontent_category.info,v
retrieving revision 1.3
diff -u -p -r1.3 linktocontent_category.info
--- contrib/linktocontent_category/linktocontent_category.info	8 Oct 2007 15:18:09 -0000	1.3
+++ contrib/linktocontent_category/linktocontent_category.info	11 Jan 2009 16:42:42 -0000
@@ -1,5 +1,5 @@
 ; $Id: linktocontent_category.info,v 1.3 2007/10/08 15:18:09 stborchert Exp $
-name = "Linktocontent Category"
-description = "Enhances linktocontent_node.module to use it with category.module."
+name = Linktocontent Category
+description = Enhances Linktocontent Node to use it with Category.
 dependencies = linktocontent_node category
-package = Content
+package = User interface
Index: contrib/linktocontent_category/linktocontent_category.install
===================================================================
RCS file: contrib/linktocontent_category/linktocontent_category.install
diff -N contrib/linktocontent_category/linktocontent_category.install
--- contrib/linktocontent_category/linktocontent_category.install	3 Nov 2008 23:51:01 -0000	1.3.2.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,15 +0,0 @@
-<?php
-// $Id: linktocontent_category.install,v 1.3.2.1 2008/11/03 23:51:01 sun Exp $
-
-include_once(drupal_get_path('module', 'linktocontent') .'/linktocontent_util.inc');
-
-function linktocontent_category_install() {
-  linktocontent_register('linktocontent_category');
-  // Register for 'linktocontent_node' because we want to modify its data.
-  linktocontent_register('linktocontent_category', 'linktocontent_node');
-}
-
-function linktocontent_category_uninstall() {
-  // unregister all registered functions
-  linktocontent_unregister('linktocontent_category');
-}
Index: contrib/linktocontent_category/linktocontent_category.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/linktocontent/contrib/linktocontent_category/linktocontent_category.module,v
retrieving revision 1.3
diff -u -p -r1.3 linktocontent_category.module
--- contrib/linktocontent_category/linktocontent_category.module	8 Oct 2007 15:18:09 -0000	1.3
+++ contrib/linktocontent_category/linktocontent_category.module	11 Jan 2009 17:08:19 -0000
@@ -106,17 +106,6 @@ function linktocontent_category_validate
 }
 
 /**
- * Return true because there aren't any files to check
- * (linktocontent_node.module does this for us).
- *
- * @ingroup linktoconent_category_core
- * @return
- **/
-function linktocontent_category_check_files() {
-  return true;
-}
-
-/**
  * Get the data depending on the given arguments.
  *
  * @ingroup linktocontent_category_core
Index: contrib/linktocontent_menu/linktocontent_menu.info
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/linktocontent/contrib/linktocontent_menu/linktocontent_menu.info,v
retrieving revision 1.3
diff -u -p -r1.3 linktocontent_menu.info
--- contrib/linktocontent_menu/linktocontent_menu.info	8 Oct 2007 15:18:09 -0000	1.3
+++ contrib/linktocontent_menu/linktocontent_menu.info	11 Jan 2009 16:42:54 -0000
@@ -1,5 +1,5 @@
 ; $Id: linktocontent_menu.info,v 1.3 2007/10/08 15:18:09 stborchert Exp $
-name = "Linktocontent Menu"
-description = "Add links to menu items via a TinyMCE plugin"
+name = Linktocontent Menu
+description = Add links to menu items via a TinyMCE plugin.
 dependencies = linktocontent
-package = Content
+package = User interface
Index: contrib/linktocontent_menu/linktocontent_menu.install
===================================================================
RCS file: contrib/linktocontent_menu/linktocontent_menu.install
diff -N contrib/linktocontent_menu/linktocontent_menu.install
--- contrib/linktocontent_menu/linktocontent_menu.install	3 Nov 2008 23:51:01 -0000	1.3.2.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,15 +0,0 @@
-<?php
-// $Id: linktocontent_menu.install,v 1.3.2.1 2008/11/03 23:51:01 sun Exp $
-
-include_once(drupal_get_path('module', 'linktocontent') .'/linktocontent_util.inc');
-
-function linktocontent_menu_install() {
-  linktocontent_register('linktocontent_menu');
-  linktocontent_register('linktocontent_menu', 'linktocontent_menu');
-}
-
-function linktocontent_menu_uninstall() {
-  // unregister all registered functions
-  linktocontent_unregister('linktocontent_menu');
-  _linktocontent_autouninstall('linktomenu');
-}
Index: contrib/linktocontent_menu/linktocontent_menu.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/linktocontent/contrib/linktocontent_menu/linktocontent_menu.module,v
retrieving revision 1.3
diff -u -p -r1.3 linktocontent_menu.module
--- contrib/linktocontent_menu/linktocontent_menu.module	8 Oct 2007 15:18:09 -0000	1.3
+++ contrib/linktocontent_menu/linktocontent_menu.module	11 Jan 2009 20:52:18 -0000
@@ -4,19 +4,47 @@
 include(drupal_get_path('module', 'linktocontent_menu') .'/linktocontent_menu.theme');
 
 /**
- * Implementation of hook_menu()
- *
- * @ingroup linktocontent_menu_core
+ * Implementation of hook_wysiwyg_plugin().
+ */
+function linktocontent_menu_wysiwyg_plugin($editor, $version) {
+  switch ($editor) {
+    case 'tinymce':
+      if ($version > 3) {
+        return array(
+          'linktomenu' => array(
+            'path' => drupal_get_path('module', 'linktocontent') .'/tinymce_plugins/linktomenu/editor_plugin.js',
+            'buttons' => array('linktomenu' => t('Link to menu')),
+            'url' => 'http://drupal.org/project/linktocontent',
+          ),
+        );
+      }
+      break;
+  }
+}
+
+/**
+ * Implementation of hook_menu().
  */
 function linktocontent_menu_menu($may_cache) {
-  $access = user_access('administer linktocontent');
-  $items[] = array('path' => 'admin/settings/linktocontent/linktocontent_menu',
+  $items = array();
+  if ($may_cache) {
+    $items[] = array(
+    'path' => 'admin/settings/linktocontent/linktocontent_menu',
     'title' => linktocontent_menu_get_title(),
     'description' => t('Configure settings for '. linktocontent_menu_get_title() .'.'),
     'callback' => 'drupal_get_form',
     'callback arguments' => array('linktocontent_menu_settings_page'),
-    'access' => $access,
-    'type' => MENU_CALLBACK);
+      'access' => user_access('administer linktocontent'),
+      'type' => MENU_CALLBACK,
+    );
+    $items[] = array(
+      'path' => 'linktocontent/menu',
+      'title' => t('Link to menu'),
+      'callback' => 'linktocontent_menu_plugin_page',
+      'access' => user_access('access linktocontent'),
+      'type' => MENU_CALLBACK,
+    );
+  }
   return $items;
 }
 
@@ -98,27 +126,13 @@ function linktocontent_menu_get_descript
  * @return boolean Whether the arguments are valid or not.
  **/
 function linktocontent_menu_validate_args($args) {
-  if (!isset($args['ltc-menu-id']) || !is_numeric(check_plain($args['ltc-menu-id']))) {
+  if (!isset($args['ltc-menu-id']) || !is_numeric($args['ltc-menu-id'])) {
     return t('No valid menu id given.');
   }
   return true;
 }
 
 /**
- * Looks for popup.php in the tinymce plugin directory to check
- * for a correct installation of the plugin.
- *
- * @ingroup linktoconent_menu_core
- * @return FALSE if the file isn't there; otherwise TRUE
- **/
-function linktocontent_menu_check_files() {
-  $file = 'popup.php';
-  $plugin_path = '/tinymce/jscripts/tiny_mce/plugins/linktomenu/';
-  $dir = drupal_get_path('module', 'tinymce');
-  return file_exists($dir . $plugin_path . $file);
-}
-
-/**
  * Get the data depending on the given arguments.
  *
  * @ingroup linktocontent_menu_core
@@ -161,3 +175,81 @@ function _linktocontent_menu_get_menus($
   }
   return $result;
 }
+
+/**
+ * Output contents for the TinyMCE editor plugin page.
+ */
+function linktocontent_menu_plugin_page() {
+  drupal_add_js(wysiwyg_get_path('tinymce') .'/jscripts/tiny_mce/tiny_mce_popup.js');
+  drupal_add_js(wysiwyg_get_path('tinymce') .'/jscripts/tiny_mce/utils/mctabs.js');
+  drupal_add_js(wysiwyg_get_path('tinymce') .'/jscripts/tiny_mce/utils/form_utils.js');
+  drupal_add_js(drupal_get_path('module', 'linktocontent') .'/tinymce_plugins/linktomenu/jscripts/functions.js');
+  drupal_add_css(drupal_get_path('module', 'linktocontent') .'/tinymce_plugins/linktomenu/css/linktocontent.css');
+  $loading_image = drupal_get_path('module', 'linktocontent') .'/tinymce_plugins/linktomenu/images/loading.gif';
+
+  $output = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n";
+  $output .= '<html xmlns="http://www.w3.org/1999/xhtml">';
+  $output .= '<head>';
+  $output .= ' <title>'. (drupal_get_title() ? strip_tags(drupal_get_title()) : variable_get('site_name', 'Drupal')) .'</title>';
+  $output .= drupal_get_html_head();
+  $output .= drupal_get_css();
+  $output .= drupal_get_js();
+
+  $output .= ' <base target="_self" />';
+  $output .= ' </head>';
+  $output .= ' <body onload="init();" style="display: none;">';
+
+  $output .= <<<EOL
+<div id="mcBodyWrapper">
+ <!-- insert tabs -->
+ <div class="tabs">
+  <ul>
+   <li id="browse_tab" class="current"><span><a href="javascript:mcTabs.displayTab('browse_tab', 'browse_panel');" onmousedown="return false;">{#linktomenu.browse_tab}</a></span></li>
+  </ul>
+ </div>
+ <!-- insert panels -->
+ <div class="panel_wrap">
+  <div id="browse_panel" class="panel current">
+   <form id="form_browse" action="#" onsubmit="return false;">
+    <label>{#linktomenu.browse_title}</label>
+   </form>
+  </div>
+ </div>
+ <form action="#" onsubmit="return false;" name="elemlist">
+  <!-- node list -->
+  <div class="panel_wrap" id="list">
+   <div class="nodes">
+    <label>{#linktomenu.label_documents}</label>
+    <div id="nodelist" class="scrollable accessible">
+     <table cellspacing="0" summary="item list">
+      <thead>
+       <tr>
+        <th>{#linktomenu.thead_title}</th>
+       </tr>
+      </thead>
+      <tbody>
+      </tbody>
+     </table>
+    </div>
+   </div>
+  </div>
+  <!-- form buttons -->
+  <div class="mceActionPanel">
+   <div style="float: left">
+    <input type="button" id="insert" name="insert" value="{#insert}" onclick="insertAction();" />
+   </div>
+   <div style="float: right">
+    <input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
+   </div>
+  </div>
+ </form>
+ <div id="linktocontent-status-image"><img alt="loading" border="0" src="{$loading_image}" />{#linktomenu.loading}</div>
+</div>
+EOL;
+
+  $output .= '</body></html>';
+
+  echo $output;
+  exit;
+}
+
Index: contrib/linktocontent_node/linktocontent_node.info
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/linktocontent/contrib/linktocontent_node/linktocontent_node.info,v
retrieving revision 1.4
diff -u -p -r1.4 linktocontent_node.info
--- contrib/linktocontent_node/linktocontent_node.info	8 Oct 2007 15:18:09 -0000	1.4
+++ contrib/linktocontent_node/linktocontent_node.info	11 Jan 2009 16:43:04 -0000
@@ -1,5 +1,5 @@
 ; $Id: linktocontent_node.info,v 1.4 2007/10/08 15:18:09 stborchert Exp $
-name = "Linktocontent Node"
-description = "Add links to nodes via a TinyMCE plugin"
+name = Linktocontent Node
+description = Add links to nodes via a TinyMCE plugin.
 dependencies = linktocontent taxonomy
-package = Content
+package = User interface
Index: contrib/linktocontent_node/linktocontent_node.install
===================================================================
RCS file: contrib/linktocontent_node/linktocontent_node.install
diff -N contrib/linktocontent_node/linktocontent_node.install
--- contrib/linktocontent_node/linktocontent_node.install	3 Nov 2008 23:51:02 -0000	1.3.2.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,15 +0,0 @@
-<?php
-// $Id: linktocontent_node.install,v 1.3.2.1 2008/11/03 23:51:02 sun Exp $
-
-include_once(drupal_get_path('module', 'linktocontent') .'/linktocontent_util.inc');
-
-function linktocontent_node_install() {
-  linktocontent_register('linktocontent_node');
-  linktocontent_register('linktocontent_node', 'linktocontent_node');
-}
-
-function linktocontent_node_uninstall() {
-  // unregister all registered functions
-  linktocontent_unregister('linktocontent_node');
-  _linktocontent_autouninstall('linktonode');
-}
Index: contrib/linktocontent_node/linktocontent_node.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/linktocontent/contrib/linktocontent_node/linktocontent_node.module,v
retrieving revision 1.3
diff -u -p -r1.3 linktocontent_node.module
--- contrib/linktocontent_node/linktocontent_node.module	8 Oct 2007 15:18:09 -0000	1.3
+++ contrib/linktocontent_node/linktocontent_node.module	11 Jan 2009 20:37:53 -0000
@@ -4,19 +4,47 @@
 include(drupal_get_path('module', 'linktocontent_node') .'/linktocontent_node.theme');
 
 /**
- * Implementation of hook_menu()
- *
- * @ingroup linktocontent_node_core
+ * Implementation of hook_wysiwyg_plugin().
+ */
+function linktocontent_node_wysiwyg_plugin($editor, $version) {
+  switch ($editor) {
+    case 'tinymce':
+      if ($version > 3) {
+        return array(
+          'linktonode' => array(
+            'path' => drupal_get_path('module', 'linktocontent') .'/tinymce_plugins/linktonode/editor_plugin.js',
+            'buttons' => array('linktonode' => t('Link to node')),
+            'url' => 'http://drupal.org/project/linktocontent',
+          ),
+        );
+      }
+      break;
+  }
+}
+
+/**
+ * Implementation of hook_menu().
  */
 function linktocontent_node_menu($may_cache) {
-  $access = user_access('administer linktocontent');
-  $items[] = array('path' => 'admin/settings/linktocontent/linktocontent_node',
-    'title' => linktocontent_node_get_title(),
-    'description' => t('Configure relevant settings for '. linktocontent_node_get_title() .'.'),
-    'callback' => 'drupal_get_form',
-    'callback arguments' => array('linktocontent_node_settings_page'),
-    'access' => $access,
-    'type' => MENU_CALLBACK);
+  $items = array();
+  if ($may_cache) {
+    $items[] = array(
+      'path' => 'admin/settings/linktocontent/linktocontent_node',
+      'title' => linktocontent_node_get_title(),
+      'description' => t('Configure relevant settings for '. linktocontent_node_get_title() .'.'),
+      'callback' => 'drupal_get_form',
+      'callback arguments' => array('linktocontent_node_settings_page'),
+      'access' => user_access('administer linktocontent'),
+      'type' => MENU_CALLBACK,
+    );
+    $items[] = array(
+      'path' => 'linktocontent/node',
+      'title' => t('Link to node'),
+      'callback' => 'linktocontent_node_plugin_page',
+      'access' => user_access('access linktocontent'),
+      'type' => MENU_CALLBACK,
+    );
+  }
   return $items;
 }
 
@@ -110,20 +138,6 @@ function linktocontent_node_validate_arg
 }
 
 /**
- * Looks for popup.php in the tinymce plugin directory to check
- * for a correct installation of the plugin.
- *
- * @ingroup linktoconent_node_core
- * @return FALSE if the file isn't there; otherwise TRUE
- **/
-function linktocontent_node_check_files() {
-  $file = 'popup.php';
-  $plugin_path = '/tinymce/jscripts/tiny_mce/plugins/linktonode/';
-  $dir = drupal_get_path('module', 'tinymce');
-  return file_exists($dir . $plugin_path . $file);
-}
-
-/**
  * Get the data depending on the given arguments.
  *
  * @ingroup linktocontent_node_core
@@ -131,9 +145,7 @@ function linktocontent_node_check_files(
  **/
 function linktocontent_node_get_data($args, $data = array()) {
   $vid = check_plain($args['ltc-vocab-id']);
-  $tid = ((isset($args['ltc-term-id']) && is_numeric(check_plain($args['ltc-term-id'])))
-    ? check_plain($args['ltc-term-id'])
-    : 0);
+  $tid = (isset($args['ltc-term-id']) && is_numeric($args['ltc-term-id']) ? check_plain($args['ltc-term-id']) : 0);
 
   $data['categories'] = _linktocontent_node_get_categories($vid, $tid);
   $data['nodes'] = _linktocontent_node_get_nodes($vid, $tid);
@@ -263,3 +275,83 @@ function _filter_terms($terms, $filter =
   }
   return $result;
 }
+
+/**
+ * Output contents for the TinyMCE editor plugin page.
+ */
+function linktocontent_node_plugin_page() {
+  drupal_add_js(wysiwyg_get_path('tinymce') .'/jscripts/tiny_mce/tiny_mce_popup.js');
+  drupal_add_js(wysiwyg_get_path('tinymce') .'/jscripts/tiny_mce/utils/mctabs.js');
+  drupal_add_js(wysiwyg_get_path('tinymce') .'/jscripts/tiny_mce/utils/form_utils.js');
+  drupal_add_js(drupal_get_path('module', 'linktocontent') .'/tinymce_plugins/linktonode/jscripts/functions.js');
+  drupal_add_css(drupal_get_path('module', 'linktocontent') .'/tinymce_plugins/linktonode/css/linktocontent.css');
+  $loading_image = drupal_get_path('module', 'linktocontent') .'/tinymce_plugins/linktonode/images/loading.gif';
+
+  $output = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n";
+  $output .= '<html xmlns="http://www.w3.org/1999/xhtml">';
+  $output .= '<head>';
+  $output .= ' <title>'. (drupal_get_title() ? strip_tags(drupal_get_title()) : variable_get('site_name', 'Drupal')) .'</title>';
+  $output .= drupal_get_html_head();
+  $output .= drupal_get_css();
+  $output .= drupal_get_js();
+
+  $output .= ' <base target="_self" />';
+  $output .= ' </head>';
+  $output .= ' <body onload="init();" style="display: none;">';
+
+  $output .= <<<EOL
+<div id="mcBodyWrapper">
+ <!-- insert tabs -->
+ <div class="tabs">
+  <ul>
+   <li id="browse_tab" class="current"><span><a href="javascript:mcTabs.displayTab('browse_tab', 'browse_panel');" onmousedown="return false;">{#linktonode.browse_tab}</a></span></li>
+  </ul>
+ </div>
+ <!-- insert panels -->
+ <div class="panel_wrap">
+  <div id="browse_panel" class="panel current">
+   <form id="form_browse" action="#" onsubmit="return false;">
+    <label>{#linktonode.browse_title}</label>
+   </form>
+  </div>
+ </div>
+ <form action="#" onsubmit="return false;" name="elemlist">
+  <!-- node list -->
+  <div class="panel_wrap" id="list">
+   <div class="nodes">
+    <label>{#linktonode.label_documents}</label>
+    <div id="nodelist" class="scrollable accessible">
+     <table cellspacing="0" summary="nodelist">
+      <thead>
+       <tr>
+        <th>{#linktonode.thead_title}</th>
+        <th>{#linktonode.thead_date}</th>
+        <th>{#linktonode.thead_author}</th>
+       </tr>
+      </thead>
+      <tbody>
+      </tbody>
+     </table>
+    </div>
+   </div>
+  </div>
+  <!-- form buttons -->
+  <div class="mceActionPanel">
+   <div style="float: left">
+    <input type="button" id="insert" name="insert" value="{#insert}" onclick="insertAction();" />
+   </div>
+   <div style="float: right">
+    <input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
+   </div>
+  </div>
+ </form>
+ <div id="linktocontent-status-image"><img alt="loading" border="0" src="{$loading_image}" />{#linktonode.loading}</div>
+</div>
+EOL;
+
+  $output .= '</body></html>';
+
+  echo $output;
+  exit;
+}
+
Index: tinymce_plugins/linktomenu/INSTALL.txt
===================================================================
RCS file: tinymce_plugins/linktomenu/INSTALL.txt
diff -N tinymce_plugins/linktomenu/INSTALL.txt
--- tinymce_plugins/linktomenu/INSTALL.txt	8 Oct 2007 15:20:16 -0000	1.2
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,10 +0,0 @@
-If you install linktocontent and linktocontent_menu on a multi-site installation 
-of drupal or the file plugin_reg.php (in your tinymce directory) isn't writable 
-for any reason, you have to copy the following line into plugin_reg.php right 
-before the last lines (starting with <code>return $plugins;</code>). 
-
-// linktocontent.module: linktomenu
-if (is_dir(drupal_get_path('module', 'tinymce') . '/tinymce/jscripts/tiny_mce/plugins/linktomenu/')) {
-  $plugins['linktomenu'] = array();
-  $plugins['linktomenu']['theme_advanced_buttons3'] = array('linktomenu');
-}
Index: tinymce_plugins/linktomenu/editor_plugin.js
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/linktocontent/tinymce_plugins/linktomenu/editor_plugin.js,v
retrieving revision 1.2
diff -u -p -r1.2 editor_plugin.js
--- tinymce_plugins/linktomenu/editor_plugin.js	8 Oct 2007 15:20:16 -0000	1.2
+++ tinymce_plugins/linktomenu/editor_plugin.js	11 Jan 2009 20:43:54 -0000
@@ -1 +1,38 @@
-tinyMCE.importPluginLanguagePack('linktomenu','en,de,fr');var TinyMCE_LinkToMenuPlugin={getInfo:function(){return{longname:'Link to menu'}},getControlHTML:function(cn){switch(cn){case"linktomenu":return tinyMCE.getButtonHTML(cn,'lang_linktomenu_image_desc','{$pluginurl}/images/linktomenu.gif','mceLinktomenu')}return""},execCommand:function(editor_id,element,command,user_interface,value){switch(command){case"mceLinktomenu":var anySelection=false;var inst=tinyMCE.getInstanceById(editor_id);var focusElm=inst.getFocusElement();var selectedText=inst.selection.getSelectedText();var template=new Array();template['file']='../../plugins/linktomenu/popup.php';template['width']=400;template['height']=295;template['width']+=tinyMCE.getLang('lang_linktomenu_delta_width',0);template['height']+=tinyMCE.getLang('lang_linktomenu_delta_height',0);tinyMCE.openWindow(template,{editor_id:editor_id,inline:"no",resizable:"no"});return true}return false},handleNodeChange:function(editor_id,node,undo_index,undo_levels,visual_aid,any_selection){if(node==null){return}do{if(node.nodeName=="A"&&tinyMCE.getAttrib(node,'href')!=""){tinyMCE.switchClass(editor_id+'_linktomenu','mceButtonSelected');return true}}while((node=node.parentNode));if(any_selection){tinyMCE.switchClass(editor_id+'_linktomenu','mceButtonNormal');return true}return true}};tinyMCE.addPlugin("linktomenu",TinyMCE_LinkToMenuPlugin);
\ No newline at end of file
+// $Id: editor_plugin_src.js,v 1.2 2007/10/08 15:20:16 stborchert Exp $
+
+(function() {
+  /* Import plugin specific language pack */
+  tinymce.PluginManager.requireLangPack('linktomenu', 'en,de,fr');
+
+  tinymce.create('tinymce.plugins.LinkToMenuPlugin', {
+    getInfo : function() {
+      return {
+        longname : 'Link to menu'
+      }
+    },
+
+    init : function(ed, url) {
+      ed.addCommand('mceLinktomenu', function() {
+        ed.windowManager.open({
+          file : Drupal.settings.basePath + 'index.php?q=linktocontent/menu',
+          width : 400 + parseInt(ed.getLang('linktomenu.delta_width', 0)),
+          height : 295 + parseInt(ed.getLang('linktomenu.delta_height', 0))
+        }, {
+          plugin_url : url // Plugin absolute URL
+        });
+      });
+
+      ed.addButton('linktomenu', {
+        title : 'linktomenu.image_desc',
+        cmd : 'mceLinktomenu',
+        image : url + '/images/linktomenu.gif'
+      });
+
+      ed.onNodeChange.add(function(ed, cm, n, co) {
+        cm.setDisabled('linktomenu', co && n.nodeName != 'A');
+        cm.setActive('linktomenu', n.nodeName == 'A' && !n.name);
+      });
+    }
+  });
+  tinymce.PluginManager.add("linktomenu", tinymce.plugins.LinkToMenuPlugin);
+})();
Index: tinymce_plugins/linktomenu/editor_plugin_src.js
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/linktocontent/tinymce_plugins/linktomenu/editor_plugin_src.js,v
retrieving revision 1.2
diff -u -p -r1.2 editor_plugin_src.js
--- tinymce_plugins/linktomenu/editor_plugin_src.js	8 Oct 2007 15:20:16 -0000	1.2
+++ tinymce_plugins/linktomenu/editor_plugin_src.js	11 Jan 2009 20:44:27 -0000
@@ -1,72 +1,38 @@
-/**
-* $Id: editor_plugin_src.js,v 1.2 2007/10/08 15:20:16 stborchert Exp $
-*/
+// $Id: editor_plugin_src.js,v 1.2 2007/10/08 15:20:16 stborchert Exp $
 
-/* Import plugin specific language pack */
-tinyMCE.importPluginLanguagePack('linktomenu', 'en,de,fr');
-var TinyMCE_LinkToMenuPlugin = {
-  getInfo : function() {
-    return {
-      longname : 'Link to menu'
-    }
-  },
-
-  getControlHTML : function(cn) {
-    switch (cn) {
-      case "linktomenu":
-        return tinyMCE.getButtonHTML(cn,
-          'lang_linktomenu_image_desc',
-          '{$pluginurl}/images/linktomenu.gif',
-          'mceLinktomenu');
-    }
-    return "";
-  },
-
-  execCommand : function(editor_id, element, command, user_interface, value) {
-    switch (command) {
-      case "mceLinktomenu":
-        var anySelection = false;
-        var inst = tinyMCE.getInstanceById(editor_id);
-        var focusElm = inst.getFocusElement();
-        var selectedText = inst.selection.getSelectedText();
-
-        var template = new Array();
-
-        template['file']   = '../../plugins/linktomenu/popup.php';
-        template['width']  = 400;
-        template['height'] = 295;
-
-        // Language specific width and height addons
-        template['width']  += tinyMCE.getLang('lang_linktomenu_delta_width', 0);
-        template['height'] += tinyMCE.getLang('lang_linktomenu_delta_height', 0);
-
-        tinyMCE.openWindow(template, {editor_id: editor_id, inline: "no", resizable: "no"});
-
-        return true;
-    } // switch
-    return false;
-  },
-
-  handleNodeChange : function(editor_id, node, undo_index, undo_levels, visual_aid, any_selection) {
-    if (node == null) {
-      return;
-    }
-
-    do {
-      if (node.nodeName == "A" && tinyMCE.getAttrib(node, 'href') != "") {
-        tinyMCE.switchClass(editor_id + '_linktomenu', 'mceButtonSelected');
-        return true;
+(function() {
+  /* Import plugin specific language pack */
+  tinymce.PluginManager.requireLangPack('linktomenu', 'en,de,fr');
+
+  tinymce.create('tinymce.plugins.LinkToMenuPlugin', {
+    getInfo : function() {
+      return {
+        longname : 'Link to menu'
       }
-    } while ((node = node.parentNode));
+    },
 
-    if (any_selection) {
-      tinyMCE.switchClass(editor_id + '_linktomenu', 'mceButtonNormal');
-      return true;
+    init : function(ed, url) {
+      ed.addCommand('mceLinktomenu', function() {
+        ed.windowManager.open({
+          file : Drupal.settings.basePath + 'index.php?q=linktocontent/menu',
+          width : 400 + parseInt(ed.getLang('linktomenu.delta_width', 0)),
+          height : 295 + parseInt(ed.getLang('linktomenu.delta_height', 0))
+        }, {
+          plugin_url : url // Plugin absolute URL
+        });
+      });
+
+      ed.addButton('linktomenu', {
+        title : 'linktomenu.image_desc',
+        cmd : 'mceLinktomenu',
+        image : url + '/images/linktomenu.gif'
+      });
+
+      ed.onNodeChange.add(function(ed, cm, n, co) {
+        cm.setDisabled('linktomenu', co && n.nodeName != 'A');
+        cm.setActive('linktomenu', n.nodeName == 'A' && !n.name);
+      });
     }
-
-    return true;
-  }
-
-};
-// Adds the plugin class to the list of available TinyMCE plugins
-tinyMCE.addPlugin("linktomenu", TinyMCE_LinkToMenuPlugin);
\ No newline at end of file
+  });
+  tinymce.PluginManager.add("linktomenu", tinymce.plugins.LinkToMenuPlugin);
+})();
Index: tinymce_plugins/linktomenu/popup.php
===================================================================
RCS file: tinymce_plugins/linktomenu/popup.php
diff -N tinymce_plugins/linktomenu/popup.php
--- tinymce_plugins/linktomenu/popup.php	8 Oct 2007 15:20:16 -0000	1.2
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,93 +0,0 @@
-<?php
-// $Id: popup.php,v 1.2 2007/10/08 15:20:16 stborchert Exp $
-
-header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
-header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
-header('Cache-Control: no-store, no-cache, must-revalidate');
-header('Cache-Control: post-check=0, pre-check=0', false);
-header('Pragma: no-cache');
-?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
-  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html lang="de" xml:lang="de" xmlns="http://www.w3.org/1999/xhtml">
- <head>
-  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
-  <title>{$lang_linktomenu_title}</title>
-  <script type="text/javascript" src="../../tiny_mce_popup.js"></script>
-  <script type="text/javascript" src="../../utils/mctabs.js"></script>
-  <script type="text/javascript" src="../../utils/form_utils.js"></script>
-  <script type="text/javascript">
-   function appendScripts() {
-     var jquery = document.createElement("script");
-     var functions = document.createElement("script");
-     var url = tinyMCE.baseURL.substring(0, tinyMCE.baseURL.indexOf('modules/'));
-     if (url.indexOf('sites/') > -1) {
-       url = url.substring(0, url.indexOf('sites/'));
-     }
-     jquery.type = functions.type = "text/javascript";
-     jquery.src = url + "misc/jquery.js";
-     functions.src = "jscripts/functions.js";
-     document.getElementsByTagName("head")[0].appendChild(jquery);
-     document.getElementsByTagName("head")[0].appendChild(functions);
-   }
-   appendScripts();
-  </script>
-  <link rel="stylesheet" href="css/linktocontent.css" type="text/css" />
-  <style type="text/css">
-   th { border-bottom: 1px solid #999; }
-   td { text-align: left; padding: .05em .5em .05em 0; white-space: nowrap; }
-
-   tr { cursor: pointer; }
-   tr.head { cursor: auto; }
-   td.nid { display: none; }
-  </style>
-  <base target="_self" />
- </head>
- <body onload="tinyMCEPopup.executeOnLoad('init();');" style="display: none;">
-  <div id="mcBodyWrapper">
-   <!-- insert tabs -->
-   <div class="tabs">
-    <ul>
-     <li id="browse_tab" class="current"><span><a href="javascript:mcTabs.displayTab('browse_tab','browse_panel');" onmousedown="return false;">{$lang_linktomenu_browse_tab}</a></span></li>
-    </ul>
-   </div>
-   <!-- insert panels -->
-   <div class="panel_wrap">
-    <div id="browse_panel" class="panel current">
-     <form id="form_browse" action="#" onsubmit="return false;">
-      <label>{$lang_linktomenu_browse_title}</label>
-     </form>
-    </div>
-   </div>
-   <form action="#" onsubmit="return false;" name="elemlist">
-    <!-- node list -->
-    <div class="panel_wrap" id="list">
-     <div class="nodes">
-      <label>{$lang_linktomenu_label_documents}</label>
-      <div id="nodelist" class="scrollable accessible">
-       <table cellspacing="0" summary="item list">
-        <thead>
-         <tr>
-          <th>{$lang_linktomenu_thead_title}</th>
-         </tr>
-        </thead>
-        <tbody>
-        </tbody>
-       </table>
-      </div>
-     </div>
-    </div>
-    <!-- form buttons -->
-    <div class="mceActionPanel">
-     <div style="float: left">
-      <input type="button" id="insert" name="insert" value="{$lang_insert}" onclick="insertAction();" />
-     </div>
-     <div style="float: right">
-      <input type="button" id="cancel" name="cancel" value="{$lang_cancel}" onclick="tinyMCEPopup.close();" />
-     </div>
-    </div>
-   </form>
-   <div id="statusImg" style="display: block; position: absolute; left: 125px; background: #ffffff; border: 1px solid #dadfe9; font-size: 14px; color: #333333; width: auto; padding-right: .5em; line-height: 42px; vertical-align: middle;"><img alt="loading" border="0" style="margin: 5px 10px; float: left;" src="images/loading.gif" />{$lang_linktomenu_loading}</div>
-  </div>
- </body>
-</html>
Index: tinymce_plugins/linktomenu/css/linktocontent.css
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/linktocontent/tinymce_plugins/linktomenu/css/linktocontent.css,v
retrieving revision 1.2
diff -u -p -r1.2 linktocontent.css
--- tinymce_plugins/linktomenu/css/linktocontent.css	5 Jul 2007 19:54:57 -0000	1.2
+++ tinymce_plugins/linktomenu/css/linktocontent.css	11 Jan 2009 20:42:48 -0000
@@ -22,11 +22,35 @@ label { font-weight: bold; margin-bottom
 
 .panel_wrap .nodes { margin: 0 .5em; padding: 0; }
 
-#nodelist
-{
+#nodelist {
 	padding: 0;
 	height: 15em;
   width: 96%;
   overflow: auto;
   border: none;
 }
+
+th { border-bottom: 1px solid #999; }
+td { text-align: left; padding: .05em .5em .05em 0; white-space: nowrap; }
+
+tr { cursor: pointer; }
+tr.head { cursor: auto; }
+td.nid { display: none; }
+
+#linktocontent-status-image {
+  display: block;
+  position: absolute;
+  left: 125px;
+  background: #fff;
+  border: 1px solid #dadfe9;
+  font-size: 14px;
+  color: #333333;
+  width: auto;
+  padding-right: .5em;
+  line-height: 42px;
+  vertical-align: middle;
+}
+#linktocontent-status-image img {
+  margin: 5px 10px;
+  float: left;
+}
Index: tinymce_plugins/linktomenu/jscripts/functions.js
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/linktocontent/tinymce_plugins/linktomenu/jscripts/functions.js,v
retrieving revision 1.3
diff -u -p -r1.3 functions.js
--- tinymce_plugins/linktomenu/jscripts/functions.js	8 Oct 2007 15:18:09 -0000	1.3
+++ tinymce_plugins/linktomenu/jscripts/functions.js	11 Jan 2009 20:48:14 -0000
@@ -1,10 +1,5 @@
 // $Id: functions.js,v 1.3 2007/10/08 15:18:09 stborchert Exp $
 
-function preinit() {
-	// Initialize
-	tinyMCE.setWindowArg('mce_windowresize', false);
-}
-
 function init() {
   window.focus();
   loadCategories(null);
@@ -33,14 +28,14 @@ function loadCategories(obj) {
   }
   params = 'ltc-type=linktocontent_menu&ltc-menu-id=' + mid;
 
-  $('#statusImg').css({top: top + 'px'}).show();
+  $('#linktocontent-status-image').css({top: top + 'px'}).show();
 
   $.ajax({
     type: "POST",
     url: _getBaseHref() + 'index.php?q=linktocontent',
     data: params,
     error: function(xml, msg, exc) {
-      $('#statusImg').hide();
+      $('#linktocontent-status-image').hide();
       alert('Error: ' + msg + '\n' + xml.responseText);
     },
     success: function(data){
@@ -58,7 +53,7 @@ function loadCategories(obj) {
         alert('Error on retrieving data from module.\n' + e.name + '\n' + e.message);
       } 
       finally {
-        $('#statusImg').hide();
+        $('#linktocontent-status-image').hide();
       }
     }});
 }
@@ -67,36 +62,35 @@ function insertAction() {
   if (selectedNode == null) {
     return;
   }
-	var inst = tinyMCE.getInstanceById(tinyMCE.getWindowArg('editor_id'));
-	var elm = inst.getFocusElement();
+  var inst = tinyMCEPopup.editor;
+  var elm = inst.selection.getNode();
 
-	elm = tinyMCE.getParentElement(elm, "a");
+  elm = inst.dom.getParent(elm, "A");
 
-	tinyMCEPopup.execCommand("mceBeginUndoLevel");
+  tinyMCEPopup.execCommand("mceBeginUndoLevel");
 
-	// Create new anchor elements
-	var path = selectedNode.cells[0].firstChild.nodeValue;
-	if (elm == null) {
-		var insertText = selectedNode.cells[1].firstChild.nodeValue;
-    if (inst.selection.getSelectedText().length == 0) {
+  // Create new anchor elements
+  if (elm == null) {
+    var nid = selectedNode.cells[0].firstChild.nodeValue;
+    var insertText = selectedNode.cells[1].firstChild.nodeValue;
+    if (inst.selection.getNode().length == 0) {
       tinyMCEPopup.execCommand("mceInsertContent", false,
-        '<a href="' + path + '">' + insertText + '</a>');
-		}
+        '<a href="' + nid + '">' + insertText + '</a>');
+    }
     else {
-   	  tinyMCEPopup.execCommand("mceInsertContent", false,
-        '<a href="' + path + '">' + inst.selection.getSelectedHTML() + '</a>');
+       tinyMCEPopup.execCommand("mceInsertContent", false,
+        '<a href="' + nid + '">' + inst.selection.getContent() + '</a>');
     } // end (getSelectedText == 0)
-	}
+  }
   else {
-    elm.setAttribute("mce_href", path);
-  	// Refresh in old MSIE
-  	if (tinyMCE.isMSIE5)
-  		elm.outerHTML = elm.outerHTML;
-	}
-
-	tinyMCE._setEventsEnabled(inst.getBody(), false);
-	tinyMCEPopup.execCommand("mceEndUndoLevel");
-	tinyMCEPopup.close();
+    elm.setAttribute("mce_href", selectedNode.cells[0].firstChild.nodeValue);
+    // Refresh in old MSIE
+    if (tinyMCE.isMSIE5)
+      elm.outerHTML = elm.outerHTML;
+  }
+
+  tinyMCEPopup.execCommand("mceEndUndoLevel");
+  tinyMCEPopup.close();
 }
 
 function loadScript(url) {
@@ -159,7 +153,7 @@ function _createDropdown(obj){
     var img = $('<img />');
     $(img).attr('id', elemname.substring(0, elemname.lastIndexOf('_') + 1) + level + '_img');
     $(img).attr('alt', '');
-    $(img).attr('src', 'images/descendant.gif');
+    $(img).attr('src', tinyMCEPopup.getWindowArg('plugin_url') + '/images/descendant.gif');
     // extra margin for IE
     $(img).css({margin: '0px 2px', border: 0});
     $(img).css({marginLeft: String((parseInt(level) - 1) * 14) + 'px', marginRight: '2px'});
@@ -180,7 +174,7 @@ function _createDropdown(obj){
 function _fillDropdown(obj, results){
   if (results.menus != false) {
     var select = _createDropdown(obj);
-    $(select).addOption(-1, tinyMCELang['lang_linktomenu_choose_category']);
+    $(select).addOption(-1, tinyMCEPopup.getLang('linktomenu.choose_category'));
     for (key in results.menus) {
       if (results.menus[key].hasChildren) {
         $(select).addOption(results.menus[key].mid, results.menus[key].title);
@@ -290,88 +284,88 @@ $('.accessible').keypress(function(e) {
 // options
 $.fn.addOption = function()
 {
-	if(arguments.length == 0)
+  if(arguments.length == 0)
     return this;
-	// select option when added? default is false
-	var selectOption = false;
-	// multiple items
-	var multiple = false;
-	if(typeof arguments[0] == "object")
-	{
-		multiple = true;
-		var items = arguments[0];
-	}
-	if(arguments.length >= 2)
-	{
-		if(typeof arguments[1] == "boolean")
+  // select option when added? default is false
+  var selectOption = false;
+  // multiple items
+  var multiple = false;
+  if(typeof arguments[0] == "object")
+  {
+    multiple = true;
+    var items = arguments[0];
+  }
+  if(arguments.length >= 2)
+  {
+    if(typeof arguments[1] == "boolean")
       selectOption = arguments[1];
-		else if(typeof arguments[2] == "boolean")
+    else if(typeof arguments[2] == "boolean")
       selectOption = arguments[2];
     if(!multiple)
-		{
-			var value = arguments[0];
-			var text = arguments[1];
-		}
-	}
-	this.each(
-		function()
-		{
-			if(this.nodeName.toLowerCase() != "select")
+    {
+      var value = arguments[0];
+      var text = arguments[1];
+    }
+  }
+  this.each(
+    function()
+    {
+      if(this.nodeName.toLowerCase() != "select")
         return;
-			if(multiple)
-			{
-				for(v in items)
-				{
-					$(this).addOption(v, items[v], selectOption);
-				}
-			}
-			else
-			{
-				var option = document.createElement("option");
-				option.value = value;
-				option.text = text;
-				this.options.add(option);
-			}
-			if(selectOption)
-			{
-				this.options[this.options.length-1].selected = true;
-			}
-		}
-	)
-	return this;
+      if(multiple)
+      {
+        for(v in items)
+        {
+          $(this).addOption(v, items[v], selectOption);
+        }
+      }
+      else
+      {
+        var option = document.createElement("option");
+        option.value = value;
+        option.text = text;
+        this.options.add(option);
+      }
+      if(selectOption)
+      {
+        this.options[this.options.length-1].selected = true;
+      }
+    }
+  )
+  return this;
 }
 
 $.fn.removeOption = function()
 {
-	if(arguments.length == 0)
+  if(arguments.length == 0)
     return this;
-	if(typeof arguments[0] == "string")
+  if(typeof arguments[0] == "string")
     var value = arguments[0];
-	else if(typeof arguments[0] == "number")
+  else if(typeof arguments[0] == "number")
     var index = arguments[0];
-	else
+  else
     return this;
-	this.each(
-		function()
-		{
-			if(this.nodeName.toLowerCase() != "select")
+  this.each(
+    function()
+    {
+      if(this.nodeName.toLowerCase() != "select")
         return;
-			if(value)
-			{
-				var optionsLength = this.options.length;
-				for(var i=optionsLength-1; i>=0; i--)
-				{
-					if(this.options[i].value == value)
-					{
-						this.options[i] = null;
-					}
-				}
-			}
-			else
-			{
-				this.remove(index);
-			}
-		}
-	)
-	return this;
+      if(value)
+      {
+        var optionsLength = this.options.length;
+        for(var i=optionsLength-1; i>=0; i--)
+        {
+          if(this.options[i].value == value)
+          {
+            this.options[i] = null;
+          }
+        }
+      }
+      else
+      {
+        this.remove(index);
+      }
+    }
+  )
+  return this;
 }
Index: tinymce_plugins/linktomenu/langs/de.js
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/linktocontent/tinymce_plugins/linktomenu/langs/de.js,v
retrieving revision 1.3
diff -u -p -r1.3 de.js
--- tinymce_plugins/linktomenu/langs/de.js	8 Oct 2007 15:18:09 -0000	1.3
+++ tinymce_plugins/linktomenu/langs/de.js	11 Jan 2009 16:29:38 -0000
@@ -1,7 +1,7 @@
 // $Id: de.js,v 1.3 2007/10/08 15:18:09 stborchert Exp $
 // German lang variables
 
-tinyMCE.addToLang('linktomenu', {
+tinyMCE.addI18n('de.linktomenu', {
     title : 'Verweis zu Men&uuml;punkt',
     loading : 'Daten laden...',
     insert_title : 'Verweis zu Men&uuml;punkt einf&uuml;gen',
Index: tinymce_plugins/linktomenu/langs/en.js
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/linktocontent/tinymce_plugins/linktomenu/langs/en.js,v
retrieving revision 1.3
diff -u -p -r1.3 en.js
--- tinymce_plugins/linktomenu/langs/en.js	8 Oct 2007 15:18:09 -0000	1.3
+++ tinymce_plugins/linktomenu/langs/en.js	11 Jan 2009 16:29:38 -0000
@@ -1,7 +1,7 @@
 // $Id: en.js,v 1.3 2007/10/08 15:18:09 stborchert Exp $
 // English lang variables
 
-tinyMCE.addToLang('linktomenu',
+tinyMCE.addI18n('en.linktomenu',
 {
     title : 'link to menu item',
     loading : 'loading...',
Index: tinymce_plugins/linktomenu/langs/fr.js
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/linktocontent/tinymce_plugins/linktomenu/langs/fr.js,v
retrieving revision 1.3.2.1
diff -u -p -r1.3.2.1 fr.js
--- tinymce_plugins/linktomenu/langs/fr.js	29 Aug 2008 02:12:15 -0000	1.3.2.1
+++ tinymce_plugins/linktomenu/langs/fr.js	11 Jan 2009 16:29:38 -0000
@@ -1,7 +1,7 @@
 // $Id: fr.js,v 1.3.2.1 2008/08/29 02:12:15 sun Exp $
 // French lang variables
 
-tinyMCE.addToLang('linktomenu',
+tinyMCE.addI18n('fr.linktomenu',
 {
     title : 'lien vers noeud',
     loading : 'chargement...',
Index: tinymce_plugins/linktomenu/langs/he.js
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/linktocontent/tinymce_plugins/linktomenu/langs/he.js,v
retrieving revision 1.3
diff -u -p -r1.3 he.js
--- tinymce_plugins/linktomenu/langs/he.js	8 Oct 2007 15:18:09 -0000	1.3
+++ tinymce_plugins/linktomenu/langs/he.js	11 Jan 2009 16:29:38 -0000
@@ -1,7 +1,7 @@
 // $Id: he.js,v 1.3 2007/10/08 15:18:09 stborchert Exp $
 // Hebrew lang variables
 
-tinyMCE.addToLang('linktomenu',
+tinyMCE.addI18n('he.linktomenu',
 {
     title : '????? ??????',
     loading : '????...',
Index: tinymce_plugins/linktomenu/langs/nl.js
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/linktocontent/tinymce_plugins/linktomenu/langs/nl.js,v
retrieving revision 1.2
diff -u -p -r1.2 nl.js
--- tinymce_plugins/linktomenu/langs/nl.js	8 Oct 2007 15:20:16 -0000	1.2
+++ tinymce_plugins/linktomenu/langs/nl.js	11 Jan 2009 16:29:38 -0000
@@ -1,6 +1,6 @@
 // Dutch lang variables
 
-tinyMCE.addToLang('linktomenu',
+tinyMCE.addI18n('nl.linktomenu',
 {
     title : 'Link naar menu item',
     loading : 'Laden...',
Index: tinymce_plugins/linktonode/INSTALL.txt
===================================================================
RCS file: tinymce_plugins/linktonode/INSTALL.txt
diff -N tinymce_plugins/linktonode/INSTALL.txt
--- tinymce_plugins/linktonode/INSTALL.txt	8 Oct 2007 15:20:16 -0000	1.2
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,10 +0,0 @@
-If you install linktocontent and linktocontent_node on a multi-site installation 
-of drupal or the file plugin_reg.php (in your tinymce directory) isn't writable 
-for any reason, you have to copy the following line into plugin_reg.php right 
-before the last lines (starting with <code>return $plugins;</code>). 
-
-// linktocontent.module: linktonode
-if (is_dir(drupal_get_path('module', 'tinymce') . '/tinymce/jscripts/tiny_mce/plugins/linktonode/')) {
-  $plugins['linktonode'] = array();
-  $plugins['linktonode']['theme_advanced_buttons3'] = array('linktonode');
-}
Index: tinymce_plugins/linktonode/editor_plugin.js
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/linktocontent/tinymce_plugins/linktonode/editor_plugin.js,v
retrieving revision 1.3
diff -u -p -r1.3 editor_plugin.js
--- tinymce_plugins/linktonode/editor_plugin.js	8 Oct 2007 15:18:09 -0000	1.3
+++ tinymce_plugins/linktonode/editor_plugin.js	11 Jan 2009 18:00:26 -0000
@@ -1 +1,38 @@
-tinyMCE.importPluginLanguagePack('linktonode','en,de,fr');var TinyMCE_LinkToNodePlugin={getInfo:function(){return{longname:'Link to node'}},getControlHTML:function(cn){switch(cn){case"linktonode":return tinyMCE.getButtonHTML(cn,'lang_linktonode_image_desc','{$pluginurl}/images/linktonode.gif','mceLinktonode')}return""},execCommand:function(editor_id,element,command,user_interface,value){switch(command){case"mceLinktonode":var anySelection=false;var inst=tinyMCE.getInstanceById(editor_id);var focusElm=inst.getFocusElement();var selectedText=inst.selection.getSelectedText();var template=new Array();template['file']='../../plugins/linktonode/popup.php';template['width']=400;template['height']=295;template['width']+=tinyMCE.getLang('lang_linktonode_delta_width',0);template['height']+=tinyMCE.getLang('lang_linktonode_delta_height',0);tinyMCE.openWindow(template,{editor_id:editor_id,inline:"no",resizable:"no"});return true}return false},handleNodeChange:function(editor_id,node,undo_index,undo_levels,visual_aid,any_selection){if(node==null){return}do{if(node.nodeName=="A"&&tinyMCE.getAttrib(node,'href')!=""){tinyMCE.switchClass(editor_id+'_linktonode','mceButtonSelected');return true}}while((node=node.parentNode));if(any_selection){tinyMCE.switchClass(editor_id+'_linktonode','mceButtonNormal');return true}return true}};tinyMCE.addPlugin("linktonode",TinyMCE_LinkToNodePlugin);
\ No newline at end of file
+// $Id: editor_plugin_src.js,v 1.2 2007/10/08 15:20:16 stborchert Exp $
+
+(function() {
+  /* Import plugin specific language pack */
+  tinymce.PluginManager.requireLangPack('linktonode', 'en,de,fr');
+
+  tinymce.create('tinymce.plugins.LinkToNodePlugin', {
+    getInfo : function() {
+      return {
+        longname : 'Link to node'
+      }
+    },
+
+    init : function(ed, url) {
+      ed.addCommand('mceLinktonode', function() {
+        ed.windowManager.open({
+          file : Drupal.settings.basePath + 'index.php?q=linktocontent/node',
+          width : 400 + parseInt(ed.getLang('linktonode.delta_width', 0)),
+          height : 295 + parseInt(ed.getLang('linktonode.delta_height', 0))
+        }, {
+          plugin_url : url // Plugin absolute URL
+        });
+      });
+        
+      ed.addButton('linktonode', {
+        title : 'linktonode.image_desc',
+        cmd : 'mceLinktonode',
+        image : url + '/images/linktonode.gif'
+      });
+
+      ed.onNodeChange.add(function(ed, cm, n, co) {
+        cm.setDisabled('linktonode', co && n.nodeName != 'A');
+        cm.setActive('linktonode', n.nodeName == 'A' && !n.name);
+      });
+    }
+  });
+  tinymce.PluginManager.add("linktonode", tinymce.plugins.LinkToNodePlugin);
+})();
Index: tinymce_plugins/linktonode/editor_plugin_src.js
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/linktocontent/tinymce_plugins/linktonode/editor_plugin_src.js,v
retrieving revision 1.2
diff -u -p -r1.2 editor_plugin_src.js
--- tinymce_plugins/linktonode/editor_plugin_src.js	8 Oct 2007 15:20:16 -0000	1.2
+++ tinymce_plugins/linktonode/editor_plugin_src.js	11 Jan 2009 20:43:12 -0000
@@ -1,72 +1,38 @@
-/**
-* $Id: editor_plugin_src.js,v 1.2 2007/10/08 15:20:16 stborchert Exp $
-*/
+// $Id: editor_plugin_src.js,v 1.2 2007/10/08 15:20:16 stborchert Exp $
 
-/* Import plugin specific language pack */
-tinyMCE.importPluginLanguagePack('linktonode', 'en,de,fr');
-var TinyMCE_LinkToNodePlugin = {
-  getInfo : function() {
-    return {
-      longname : 'Link to node'
-    }
-  },
-
-  getControlHTML : function(cn) {
-    switch (cn) {
-      case "linktonode":
-        return tinyMCE.getButtonHTML(cn,
-          'lang_linktonode_image_desc',
-          '{$pluginurl}/images/linktonode.gif',
-          'mceLinktonode');
-    }
-    return "";
-  },
-
-  execCommand : function(editor_id, element, command, user_interface, value) {
-    switch (command) {
-      case "mceLinktonode":
-        var anySelection = false;
-        var inst = tinyMCE.getInstanceById(editor_id);
-        var focusElm = inst.getFocusElement();
-        var selectedText = inst.selection.getSelectedText();
-
-        var template = new Array();
-
-        template['file']   = '../../plugins/linktonode/popup.php';
-        template['width']  = 400;
-        template['height'] = 295;
-
-        // Language specific width and height addons
-        template['width']  += tinyMCE.getLang('lang_linktonode_delta_width', 0);
-        template['height'] += tinyMCE.getLang('lang_linktonode_delta_height', 0);
-
-        tinyMCE.openWindow(template, {editor_id: editor_id, inline: "no", resizable: "no"});
-
-        return true;
-    } // switch
-    return false;
-  },
-
-  handleNodeChange : function(editor_id, node, undo_index, undo_levels, visual_aid, any_selection) {
-    if (node == null) {
-      return;
-    }
-
-    do {
-      if (node.nodeName == "A" && tinyMCE.getAttrib(node, 'href') != "") {
-        tinyMCE.switchClass(editor_id + '_linktonode', 'mceButtonSelected');
-        return true;
+(function() {
+  /* Import plugin specific language pack */
+  tinymce.PluginManager.requireLangPack('linktonode', 'en,de,fr');
+
+  tinymce.create('tinymce.plugins.LinkToNodePlugin', {
+    getInfo : function() {
+      return {
+        longname : 'Link to node'
       }
-    } while ((node = node.parentNode));
+    },
 
-    if (any_selection) {
-      tinyMCE.switchClass(editor_id + '_linktonode', 'mceButtonNormal');
-      return true;
+    init : function(ed, url) {
+      ed.addCommand('mceLinktonode', function() {
+        ed.windowManager.open({
+          file : Drupal.settings.basePath + 'index.php?q=linktocontent/node',
+          width : 400 + parseInt(ed.getLang('linktonode.delta_width', 0)),
+          height : 295 + parseInt(ed.getLang('linktonode.delta_height', 0))
+        }, {
+          plugin_url : url // Plugin absolute URL
+        });
+      });
+        
+      ed.addButton('linktonode', {
+        title : 'linktonode.image_desc',
+        cmd : 'mceLinktonode',
+        image : url + '/images/linktonode.gif'
+      });
+
+      ed.onNodeChange.add(function(ed, cm, n, co) {
+        cm.setDisabled('linktonode', co && n.nodeName != 'A');
+        cm.setActive('linktonode', n.nodeName == 'A' && !n.name);
+      });
     }
-
-    return true;
-  }
-
-};
-// Adds the plugin class to the list of available TinyMCE plugins
-tinyMCE.addPlugin("linktonode", TinyMCE_LinkToNodePlugin);
+  });
+  tinymce.PluginManager.add("linktonode", tinymce.plugins.LinkToNodePlugin);
+})();
Index: tinymce_plugins/linktonode/popup.php
===================================================================
RCS file: tinymce_plugins/linktonode/popup.php
diff -N tinymce_plugins/linktonode/popup.php
--- tinymce_plugins/linktonode/popup.php	8 Oct 2007 15:18:09 -0000	1.7
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,95 +0,0 @@
-<?php
-// $Id: popup.php,v 1.7 2007/10/08 15:18:09 stborchert Exp $
-
-header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
-header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
-header('Cache-Control: no-store, no-cache, must-revalidate');
-header('Cache-Control: post-check=0, pre-check=0', false);
-header('Pragma: no-cache');
-?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
-  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html lang="de" xml:lang="de" xmlns="http://www.w3.org/1999/xhtml">
- <head>
-  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
-  <title>{$lang_linktonode_title}</title>
-  <script type="text/javascript" src="../../tiny_mce_popup.js"></script>
-  <script type="text/javascript" src="../../utils/mctabs.js"></script>
-  <script type="text/javascript" src="../../utils/form_utils.js"></script>
-  <script type="text/javascript">
-   function appendScripts() {
-     var jquery = document.createElement("script");
-     var functions = document.createElement("script");
-     var url = tinyMCE.baseURL.substring(0, tinyMCE.baseURL.indexOf('modules/'));
-     if (url.indexOf('sites/') > -1) {
-       url = url.substring(0, url.indexOf('sites/'));
-     }
-     jquery.type = functions.type = "text/javascript";
-     jquery.src = url + "misc/jquery.js";
-     functions.src = "jscripts/functions.js";
-     document.getElementsByTagName("head")[0].appendChild(jquery);
-     document.getElementsByTagName("head")[0].appendChild(functions);
-   }
-   appendScripts();
-  </script>
-  <link rel="stylesheet" href="css/linktocontent.css" type="text/css" />
-  <style type="text/css">
-   th { border-bottom: 1px solid #999; }
-   td { text-align: left; padding: .05em .5em .05em 0; white-space: nowrap; }
-
-   tr { cursor: pointer; }
-   tr.head { cursor: auto; }
-   td.nid { display: none; }
-  </style>
-  <base target="_self" />
- </head>
- <body onload="tinyMCEPopup.executeOnLoad('init();');" style="display: none;">
-  <div id="mcBodyWrapper">
-   <!-- insert tabs -->
-   <div class="tabs">
-    <ul>
-     <li id="browse_tab" class="current"><span><a href="javascript:mcTabs.displayTab('browse_tab','browse_panel');" onmousedown="return false;">{$lang_linktonode_browse_tab}</a></span></li>
-    </ul>
-   </div>
-   <!-- insert panels -->
-   <div class="panel_wrap">
-    <div id="browse_panel" class="panel current">
-     <form id="form_browse" action="#" onsubmit="return false;">
-      <label>{$lang_linktonode_browse_title}</label>
-     </form>
-    </div>
-   </div>
-   <form action="#" onsubmit="return false;" name="elemlist">
-    <!-- node list -->
-    <div class="panel_wrap" id="list">
-     <div class="nodes">
-      <label>{$lang_linktonode_label_documents}</label>
-      <div id="nodelist" class="scrollable accessible">
-       <table cellspacing="0" summary="nodelist">
-        <thead>
-         <tr>
-          <th>{$lang_linktonode_thead_title}</th>
-          <th>{$lang_linktonode_thead_date}</th>
-          <th>{$lang_linktonode_thead_author}</th>
-         </tr>
-        </thead>
-        <tbody>
-        </tbody>
-       </table>
-      </div>
-     </div>
-    </div>
-    <!-- form buttons -->
-    <div class="mceActionPanel">
-     <div style="float: left">
-      <input type="button" id="insert" name="insert" value="{$lang_insert}" onclick="insertAction();" />
-     </div>
-     <div style="float: right">
-      <input type="button" id="cancel" name="cancel" value="{$lang_cancel}" onclick="tinyMCEPopup.close();" />
-     </div>
-    </div>
-   </form>
-   <div id="statusImg" style="display: block; position: absolute; left: 125px; background: #ffffff; border: 1px solid #dadfe9; font-size: 14px; color: #333333; width: auto; padding-right: .5em; line-height: 42px; vertical-align: middle;"><img alt="loading" border="0" style="margin: 5px 10px; float: left;" src="images/loading.gif" />{$lang_linktonode_loading}</div>
-  </div>
- </body>
-</html>
Index: tinymce_plugins/linktonode/css/linktocontent.css
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/linktocontent/tinymce_plugins/linktonode/css/linktocontent.css,v
retrieving revision 1.2
diff -u -p -r1.2 linktocontent.css
--- tinymce_plugins/linktonode/css/linktocontent.css	1 Sep 2006 18:53:31 -0000	1.2
+++ tinymce_plugins/linktonode/css/linktocontent.css	11 Jan 2009 18:25:58 -0000
@@ -22,11 +22,35 @@ label { font-weight: bold; margin-bottom
 
 .panel_wrap .nodes { margin: 0 .5em; padding: 0; }
 
-#nodelist
-{
+#nodelist {
 	padding: 0;
 	height: 15em;
   width: 96%;
   overflow: auto;
   border: none;
 }
+
+th { border-bottom: 1px solid #999; }
+td { text-align: left; padding: .05em .5em .05em 0; white-space: nowrap; }
+
+tr { cursor: pointer; }
+tr.head { cursor: auto; }
+td.nid { display: none; }
+
+#linktocontent-status-image {
+  display: block;
+  position: absolute;
+  left: 125px;
+  background: #fff;
+  border: 1px solid #dadfe9;
+  font-size: 14px;
+  color: #333333;
+  width: auto;
+  padding-right: .5em;
+  line-height: 42px;
+  vertical-align: middle;
+}
+#linktocontent-status-image img {
+  margin: 5px 10px;
+  float: left;
+}
Index: tinymce_plugins/linktonode/jscripts/functions.js
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/linktocontent/tinymce_plugins/linktonode/jscripts/functions.js,v
retrieving revision 1.12
diff -u -p -r1.12 functions.js
--- tinymce_plugins/linktonode/jscripts/functions.js	8 Oct 2007 15:18:10 -0000	1.12
+++ tinymce_plugins/linktonode/jscripts/functions.js	11 Jan 2009 19:39:36 -0000
@@ -1,10 +1,5 @@
 // $Id: functions.js,v 1.12 2007/10/08 15:18:10 stborchert Exp $
 
-function preinit() {
-  // Initialize
-  tinyMCE.setWindowArg('mce_windowresize', false);
-}
-
 function init() {
   window.focus();
   loadCategories(null);
@@ -39,14 +34,14 @@ function loadCategories(obj) {
   }
   params = 'ltc-type=linktocontent_node&ltc-vocab-id=' + vid + params;
 
-  $('#statusImg').css({top: top + 'px'}).show();
+  $('#linktocontent-status-image').css({top: top + 'px'}).show();
 
   $.ajax({
     type: "POST",
     url: _getBaseHref() + 'index.php?q=linktocontent',
     data: params,
     error: function(xml, msg, exc) {
-      $('#statusImg').hide();
+      $('#linktocontent-status-image').hide();
       alert('Error: ' + msg + '\n' + xml.responseText);
     },
     success: function(data){
@@ -64,7 +59,7 @@ function loadCategories(obj) {
         alert('Error on retrieving data from module.\n' + e.name + '\n' + e.message);
       } 
       finally {
-        $('#statusImg').hide();
+        $('#linktocontent-status-image').hide();
       }
     }});
 }
@@ -73,10 +68,10 @@ function insertAction() {
   if (selectedNode == null) {
     return;
   }
-  var inst = tinyMCE.getInstanceById(tinyMCE.getWindowArg('editor_id'));
-  var elm = inst.getFocusElement();
+  var inst = tinyMCEPopup.editor;
+  var elm = inst.selection.getNode();
 
-  elm = tinyMCE.getParentElement(elm, "a");
+  elm = inst.dom.getParent(elm, "A");
 
   tinyMCEPopup.execCommand("mceBeginUndoLevel");
 
@@ -84,13 +79,13 @@ function insertAction() {
   if (elm == null) {
     var nid = selectedNode.cells[0].firstChild.nodeValue;
     var insertText = selectedNode.cells[1].firstChild.nodeValue;
-    if (inst.selection.getSelectedText().length == 0) {
+    if (inst.selection.getNode().length == 0) {
       tinyMCEPopup.execCommand("mceInsertContent", false,
         '<a href="' + nid + '">' + insertText + '</a>');
     }
     else {
        tinyMCEPopup.execCommand("mceInsertContent", false,
-        '<a href="' + nid + '">' + inst.selection.getSelectedHTML() + '</a>');
+        '<a href="' + nid + '">' + inst.selection.getContent() + '</a>');
     } // end (getSelectedText == 0)
   }
   else {
@@ -100,7 +95,6 @@ function insertAction() {
       elm.outerHTML = elm.outerHTML;
   }
 
-  tinyMCE._setEventsEnabled(inst.getBody(), false);
   tinyMCEPopup.execCommand("mceEndUndoLevel");
   tinyMCEPopup.close();
 }
@@ -165,7 +159,7 @@ function _createDropdown(obj){
     var img = $('<img />');
     $(img).attr('id', elemname.substring(0, elemname.lastIndexOf('_') + 1) + level + '_img');
     $(img).attr('alt', '');
-    $(img).attr('src', 'images/descendant.gif');
+    $(img).attr('src', tinyMCEPopup.getWindowArg('plugin_url') + '/images/descendant.gif');
     // extra margin for IE
     $(img).css({margin: '0px 2px', border: 0});
     $(img).css({marginLeft: String((parseInt(level) - 1) * 14) + 'px', marginRight: '2px'});
@@ -186,7 +180,7 @@ function _createDropdown(obj){
 function _fillDropdown(obj, results){
   if (results.categories != false) {
     var select = _createDropdown(obj);
-    $(select).addOption(-1, tinyMCELang['lang_linktonode_choose_category']);
+    $(select).addOption(-1, tinyMCEPopup.getLang('linktonode.choose_category'));
     for (key in results.categories)
       $(select).addOption(results.categories[key].tid, results.categories[key].title);
     return true;
Index: tinymce_plugins/linktonode/langs/de.js
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/linktocontent/tinymce_plugins/linktonode/langs/de.js,v
retrieving revision 1.5
diff -u -p -r1.5 de.js
--- tinymce_plugins/linktonode/langs/de.js	8 Oct 2007 15:18:10 -0000	1.5
+++ tinymce_plugins/linktonode/langs/de.js	11 Jan 2009 16:29:38 -0000
@@ -1,7 +1,7 @@
 // $Id: de.js,v 1.5 2007/10/08 15:18:10 stborchert Exp $
 // German lang variables
 
-tinyMCE.addToLang('linktonode', {
+tinyMCE.addI18n('de.linktonode', {
     title : 'Verweis zu Dokument',
     loading : 'Daten laden...',
     insert_title : 'Verweis zu Dokument einf&uuml;gen',
Index: tinymce_plugins/linktonode/langs/el.js
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/linktocontent/tinymce_plugins/linktonode/langs/el.js,v
retrieving revision 1.3
diff -u -p -r1.3 el.js
--- tinymce_plugins/linktonode/langs/el.js	8 Oct 2007 15:18:10 -0000	1.3
+++ tinymce_plugins/linktonode/langs/el.js	11 Jan 2009 16:29:38 -0000
@@ -2,7 +2,7 @@
 // Greek lang variables
 // thanks to <a href="http://drupal.org/user/112813">dcoun</a>
 
-tinyMCE.addToLang('linktonode',
+tinyMCE.addI18n('el.linktonode',
 {
     title : '&#931;&#973;&#957;&#948;&#949;&#963;&#951; &#963;&#949; &#963;&#949;&#955;&#943;&#948;&#945;',
     loading : '&#913;&#957;&#945;&#956;&#959;&#957;&#942;...',
Index: tinymce_plugins/linktonode/langs/en.js
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/linktocontent/tinymce_plugins/linktonode/langs/en.js,v
retrieving revision 1.5
diff -u -p -r1.5 en.js
--- tinymce_plugins/linktonode/langs/en.js	8 Oct 2007 15:18:10 -0000	1.5
+++ tinymce_plugins/linktonode/langs/en.js	11 Jan 2009 16:29:38 -0000
@@ -1,7 +1,7 @@
 // $Id: en.js,v 1.5 2007/10/08 15:18:10 stborchert Exp $
 // English lang variables
 
-tinyMCE.addToLang('linktonode',
+tinyMCE.addI18n('en.linktonode',
 {
     title : 'link to node',
     loading : 'loading...',
Index: tinymce_plugins/linktonode/langs/he.js
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/linktocontent/tinymce_plugins/linktonode/langs/he.js,v
retrieving revision 1.3
diff -u -p -r1.3 he.js
--- tinymce_plugins/linktonode/langs/he.js	8 Oct 2007 15:18:10 -0000	1.3
+++ tinymce_plugins/linktonode/langs/he.js	11 Jan 2009 16:29:38 -0000
@@ -1,7 +1,7 @@
 // $Id: he.js,v 1.3 2007/10/08 15:18:10 stborchert Exp $
 // Hebrew lang variables
 
-tinyMCE.addToLang('linktonode',
+tinyMCE.addI18n('he.linktonode',
 {
     title : '????? ??? ????',
     loading : '????...',
Index: tinymce_plugins/linktonode/langs/nl.js
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/linktocontent/tinymce_plugins/linktonode/langs/nl.js,v
retrieving revision 1.2
diff -u -p -r1.2 nl.js
--- tinymce_plugins/linktonode/langs/nl.js	8 Oct 2007 15:20:16 -0000	1.2
+++ tinymce_plugins/linktonode/langs/nl.js	11 Jan 2009 16:29:38 -0000
@@ -1,6 +1,6 @@
 // Dutch lang variables
 
-tinyMCE.addToLang('linktonode',
+tinyMCE.addI18n('nl.linktonode',
 {
     title : 'Link naar node',
     loading : 'Laden...',
