Index: linktocontent.info
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/linktocontent/linktocontent.info,v
retrieving revision 1.5
diff -u -p -r1.5 linktocontent.info
--- linktocontent.info	12 Jan 2009 13:00:39 -0000	1.5
+++ linktocontent.info	12 Jan 2009 13:06:11 -0000
@@ -2,4 +2,5 @@
 name = Linktocontent
 description = Provides a small API for TinyMCE plugins to work with Drupal data and functionality.
 package = User interface
-dependencies = wysiwyg
+dependencies[] = wysiwyg
+core = 6.x
Index: linktocontent.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/linktocontent/linktocontent.module,v
retrieving revision 1.14
diff -u -p -r1.14 linktocontent.module
--- linktocontent.module	12 Jan 2009 13:00:39 -0000	1.14
+++ linktocontent.module	12 Jan 2009 13:08:52 -0000
@@ -12,8 +12,8 @@ include_once(LTC_PATH .'/linktocontent.t
  * @param $section the page which is requesting help
  * @return the help text
  */
-function linktocontent_help($section) {
-  switch ($section) {
+function linktocontent_help($path, $arg) {
+  switch ($path) {
     case 'admin/help#linktocontent' :
       $output = t('<p>Linktocontent allows TinyMCE plugins to work with drupal data.</p>');
       return $output;
@@ -28,32 +28,37 @@ function linktocontent_perm() {
 }
 
 /**
+ * Implementation of hook_theme().
+ */
+function linktocontent_theme() {
+  return array(
+    'linktocontent_settings_page' => array(
+      'arguments' => array('form' => NULL),
+      'file' => 'linktocontent.theme',
+    ),
+  );
+}
+
+/**
  * Implementation of hook_menu()
  *
  * @ingroup linktocontent_core
  */
-function linktocontent_menu($may_cache) {
-  $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' => 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'),
-    );
-  }
+function linktocontent_menu() {
+  $items['admin/settings/linktocontent'] = array(
+    'title' => 'Link to content',
+    'description' => 'Configure relevant settings for linktocontent.',
+    'page callback' => 'drupal_get_form',
+    'page arguments' => array('linktocontent_settings_page'),
+    'access arguments' => array('administer linktocontent'),
+  );
+  // Path for HTTPRequests (called from tinymce-plugins)
+  $items['linktocontent'] = array(
+    'title' => 'linktocontent',
+    'page callback' => 'linktocontent_get_data',
+    'type' => MENU_CALLBACK,
+    'access arguments' => array('access linktocontent'),
+  );
   return $items;
 }
 
@@ -141,13 +146,13 @@ function linktocontent_settings_page() {
 /**
  * Submit callback; handles form submission.
  */
-function linktocontent_settings_page_submit($form_id, $form_values) {
+function linktocontent_settings_page_submit($form, &$form_state) {
   $enabled = variable_get('linktocontent_enabled_plugins', array());
   $weights = variable_get('linktocontent_plugin_weight', array());
 
-  foreach ($form_values['status'] as $key => $choice) {
+  foreach ($form_state['values']['status'] as $key => $choice) {
     $enabled[$key] = $choice;
-    $weights[$key] = $form_values[$key];
+    $weights[$key] = $form_state['values'][$key];
   }
 
   variable_set('linktocontent_enabled_plugins', $enabled);
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.4
diff -u -p -r1.4 linktocontent_menu.info
--- contrib/linktocontent_menu/linktocontent_menu.info	12 Jan 2009 13:00:39 -0000	1.4
+++ contrib/linktocontent_menu/linktocontent_menu.info	12 Jan 2009 13:09:03 -0000
@@ -1,5 +1,6 @@
 ; $Id: linktocontent_menu.info,v 1.4 2009/01/12 13:00:39 sun Exp $
 name = Linktocontent Menu
 description = Add links to menu items via a TinyMCE plugin.
-dependencies = linktocontent
+dependencies[] = linktocontent
 package = User interface
+core = 6.x
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.4
diff -u -p -r1.4 linktocontent_menu.module
--- contrib/linktocontent_menu/linktocontent_menu.module	12 Jan 2009 13:00:39 -0000	1.4
+++ contrib/linktocontent_menu/linktocontent_menu.module	12 Jan 2009 13:10:55 -0000
@@ -1,7 +1,17 @@
 <?php
 // $Id: linktocontent_menu.module,v 1.4 2009/01/12 13:00:39 sun Exp $
 
-include(drupal_get_path('module', 'linktocontent_menu') .'/linktocontent_menu.theme');
+/**
+ * Implementation of hook_theme().
+ */
+function linktocontent_menu_theme() {
+  return array(
+    'linktocontent_menu_settings_page' => array(
+      'arguments' => array('form' => NULL),
+      'file' => 'linktocontent_menu.theme',
+    ),
+  );
+}
 
 /**
  * Implementation of hook_wysiwyg_plugin().
@@ -25,30 +35,68 @@ function linktocontent_menu_wysiwyg_plug
 /**
  * Implementation of hook_menu().
  */
-function linktocontent_menu_menu($may_cache) {
-  $items = array();
-  if ($may_cache) {
-    $items[] = array(
-    'path' => 'admin/settings/linktocontent/linktocontent_menu',
+function linktocontent_menu_menu() {
+  $items['admin/settings/linktocontent/linktocontent_menu'] = array(
     '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' => 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,
-    );
-  }
+    'description' => 'Configure settings for '. linktocontent_menu_get_title() .'.',
+    'page callback' => 'drupal_get_form',
+    'page arguments' => array('linktocontent_menu_settings_page'),
+    'access arguments' => array('administer linktocontent'),
+    'type' => MENU_CALLBACK,
+  );
+  $items['linktocontent/menu'] = array(
+    'title' => 'Link to menu',
+    'page callback' => 'linktocontent_menu_plugin_page',
+    'access arguments' => array('access linktocontent'),
+    'type' => MENU_CALLBACK,
+  );
   return $items;
 }
 
 /**
+ * Converts a D6 tree to D5 menu_get_menu tree.
+ *
+ * @return Array with all menus and menu items
+ */
+function linktocontent_menu_get_menu($tree = array(), $menu = array()) {
+  $below = FALSE;
+  $enabled_root_menus = array();
+  $root_menus = linktocontent_menu_root();
+
+  foreach($tree as $data) {
+	  $item = $data['link'];
+    $mlid = $item['mlid'];
+    if(is_array($data['below'])) {
+      foreach($data['below'] as $child){
+        $item['children'][] = $child['link']['mlid'];
+        $below[] = $child;
+      }
+    }	
+    $item['path'] = drupal_get_path_alias($item['link_path']);
+		$menu['items'][$mlid] = $item;
+		
+		if(!$menu['items'][0]){
+			$enabled_root_menus[$item['menu_name']]['children'][] = $mlid;
+			$enabled_root_menus[$item['menu_name']]['title']      = $root_menus[$item['menu_name']]['title'];
+			$enabled_root_menus[$item['menu_name']]['path']       = '';
+		}
+  }
+
+	$i=1;
+	foreach($enabled_root_menus as $key=>$root){ // Create id`s for menus
+		$menu['items']['0'.$i] = $root;
+		$menu['items']['0'.$i]['mlid'] = '0'.strval($i); 
+		$menu['items'][0]['children'][$key] = '0'.strval($i);
+		$i++;
+	}
+
+ if($below) // recursive
+    return linktocontent_menu_get_menu($below, $menu);
+
+	return $menu;
+}
+
+/**
  * Menu callback; Prints the settings page under admin/settings/linktocontent
  *
  * @ingroup linktocontent_menu_callback
@@ -56,10 +104,11 @@ function linktocontent_menu_menu($may_ca
 function linktocontent_menu_settings_page() {
   $options = array();
   $status = variable_get('linktocontent_menu_menus', array());
-  $root_menus = menu_get_root_menus();
-  foreach ($root_menus as $key => $menu) {
-    $options[$key] = '';
-    $form['name'][$key] = array('#value' => $menu);
+  $root_menus = linktocontent_menu_root();
+
+  foreach ($root_menus as $menu) {
+    $options[$menu['menu_name']] = '';
+    $form['name'][$menu['menu_name']] = array('#value' => $menu['title']);
   }
 
   $form['status'] = array(
@@ -74,12 +123,27 @@ function linktocontent_menu_settings_pag
 }
 
 /**
+ * Get the root menus.
+ *
+ * @return Array with root menus
+ */
+function linktocontent_menu_root() {
+  $root_menus = array();
+  $result = db_query("SELECT * FROM {menu_custom} ORDER BY menu_name");
+  while ($name = db_fetch_array($result)) {
+    $root_menus[$name['menu_name']] = $name;
+  }
+  return $root_menus;
+}
+
+/**
  * Submit callback; handles form submission.
  */
-function linktocontent_menu_settings_page_submit($form_id, $form_values) {
-  $status = variable_get('linktocontent_menu_menus', array());
-  foreach ($form_values['status'] as $key => $choice) {
-    $status[$key] = $choice;
+function linktocontent_menu_settings_page_submit($form, &$form_state) {
+  foreach ($form_state['values']['status'] as $key => $choice) {
+    if ($choice!='0') {
+      $status[$key] = $choice;
+    }
   }
   variable_set('linktocontent_menu_menus', $status);
   drupal_set_message(t('The configuration has been saved.'));
@@ -147,24 +211,22 @@ function linktocontent_menu_get_data($ar
 }
 
 function _linktocontent_menu_get_menus($mid = 0) {
-  $menu = menu_get_menu();
+  $enabled_root_menus = variable_get('linktocontent_menu_menus', array());
   $result = array();
-  if (!isset($menu['items'][$mid])) {
+  // If there are no menus selected return empty array.
+  if (count($enabled_root_menus) == 0) {
     return $result;
   }
-  $items = $menu['items'][$mid]['children'];
-  $enabled_root_menus = variable_get('linktocontent_menu_menus', array());
-  // if there are no menus selected return empty array
-  if (count($enabled_root_menus) == 0) {
+  $tree = array();
+  foreach($enabled_root_menus as $menu_name){
+    $tree = array_merge($tree, menu_tree_all_data($menu_name));
+  }
+  $menu = linktocontent_menu_get_menu($tree); // convert to D5 tree
+  if (!isset($menu['items'][$mid])) {
     return $result;
   }
+  $items = $menu['items'][$mid]['children'];
   foreach ($items as $item) {
-    if (!(MENU_VISIBLE_IN_TREE & $menu['items'][$item]['type'])) {
-      continue;
-    }
-    if (($mid == 0) && !in_array($item, $enabled_root_menus)) {
-      continue;
-    }
     $obj = new StdClass;
     $obj->root = ($mid == 0);
     $obj->mid = $item;
Index: contrib/linktocontent_menu/linktocontent_menu.theme
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/linktocontent/contrib/linktocontent_menu/linktocontent_menu.theme,v
retrieving revision 1.3
diff -u -p -r1.3 linktocontent_menu.theme
--- contrib/linktocontent_menu/linktocontent_menu.theme	8 Oct 2007 15:18:09 -0000	1.3
+++ contrib/linktocontent_menu/linktocontent_menu.theme	12 Jan 2009 13:05:09 -0000
@@ -16,7 +16,7 @@ function theme_linktocontent_menu_settin
 
   $rows = array();
 
-  foreach (menu_get_root_menus() as $key => $menu) {
+  foreach (linktocontent_menu_root() as $key => $menu) {
     $row = array();
     $row[] = array('data' => drupal_render($form['status'][$key]), 'align' => 'left');
     $row[] = drupal_render($form['name'][$key]);
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.5
diff -u -p -r1.5 linktocontent_node.info
--- contrib/linktocontent_node/linktocontent_node.info	12 Jan 2009 13:00:39 -0000	1.5
+++ contrib/linktocontent_node/linktocontent_node.info	12 Jan 2009 13:11:10 -0000
@@ -1,5 +1,7 @@
 ; $Id: linktocontent_node.info,v 1.5 2009/01/12 13:00:39 sun Exp $
 name = Linktocontent Node
 description = Add links to nodes via a TinyMCE plugin.
-dependencies = linktocontent taxonomy
+dependencies[] = linktocontent
+dependencies[] = taxonomy
 package = User interface
+core = 6.x
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.4
diff -u -p -r1.4 linktocontent_node.module
--- contrib/linktocontent_node/linktocontent_node.module	12 Jan 2009 13:00:39 -0000	1.4
+++ contrib/linktocontent_node/linktocontent_node.module	12 Jan 2009 13:13:45 -0000
@@ -1,7 +1,17 @@
 <?php
 // $Id: linktocontent_node.module,v 1.4 2009/01/12 13:00:39 sun Exp $
 
-include(drupal_get_path('module', 'linktocontent_node') .'/linktocontent_node.theme');
+/**
+ * Implementation of hook_theme().
+ */
+function linktocontent_node_theme() {
+  return array(
+    'linktocontent_node_settings_page' => array(
+      'arguments' => array('form' => NULL),
+      'file' => 'linktocontent_node.theme',
+    ),
+  );
+}
 
 /**
  * Implementation of hook_wysiwyg_plugin().
@@ -25,26 +35,21 @@ function linktocontent_node_wysiwyg_plug
 /**
  * Implementation of hook_menu().
  */
-function linktocontent_node_menu($may_cache) {
-  $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,
-    );
-  }
+function linktocontent_node_menu() {
+  $items['admin/settings/linktocontent/linktocontent_node'] = array(
+    'title' => linktocontent_node_get_title(),
+    'description' => 'Configure relevant settings for '. linktocontent_node_get_title() .'.',
+    'page callback' => 'drupal_get_form',
+    'page arguments' => array('linktocontent_node_settings_page'),
+    'access arguments' => array('administer linktocontent'),
+    'type' => MENU_CALLBACK,
+  );
+  $items['linktocontent/node'] = array(
+    'title' => 'Link to node',
+    'page callback' => 'linktocontent_node_plugin_page',
+    'access arguments' => array('access linktocontent'),
+    'type' => MENU_CALLBACK,
+  );
   return $items;
 }
 
@@ -81,9 +86,9 @@ function linktocontent_node_settings_pag
 /**
  * Submit callback; handles form submission.
  */
-function linktocontent_node_settings_page_submit($form_id, $form_values) {
+function linktocontent_node_settings_page_submit($form, &$form_state) {
   $types = variable_get('linktocontent_node_content_types', array());
-  foreach ($form_values['status'] as $key => $choice) {
+  foreach ($form_state['values']['status'] as $key => $choice) {
     $types[$key] = $choice;
   }
   variable_set('linktocontent_node_content_types', $types);
