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	1 Nov 2008 15:46:55 -0000
@@ -2,4 +2,5 @@
 name = "Linktocontent"
 description = "Provides a small 'API' for TinyMCE plugins to work with drupal data and functionality."
 package = Content
-dependencies = tinymce
+dependencies[] = tinymce
+core = 6.x
Index: linktocontent.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/linktocontent/linktocontent.module,v
retrieving revision 1.12
diff -u -p -r1.12 linktocontent.module
--- linktocontent.module	8 Oct 2007 15:18:09 -0000	1.12
+++ linktocontent.module	1 Nov 2008 15:47:20 -0000
@@ -1,10 +1,7 @@
 <?php
 // $Id: linktocontent.module,v 1.12 2007/10/08 15:18:09 stborchert Exp $
 
-define('LTC_PATH', drupal_get_path('module', 'linktocontent'));
-
-include_once(LTC_PATH .'/linktocontent.theme');
-include_once(LTC_PATH .'/linktocontent_util.inc');
+include_once drupal_get_path('module', 'linktocontent') .'/linktocontent_util.inc';
 
 /**
  * Displays the help text for this module.
@@ -13,8 +10,8 @@ include_once(LTC_PATH .'/linktocontent_u
  * @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;
@@ -32,31 +29,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) {
-  $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',
-      'title' => t('Link to content'),
-      'description' => t('Configure relevant settings for linktocontent.'),
-      'callback' => 'drupal_get_form',
-      'callback arguments' => array('linktocontent_settings_page'),
-      'access' => $access);
-
-//  }
-
+function linktocontent_menu() {
+  $items = array();
+  $items['linktocontent'] = array(
+    'title' => 'linktocontent',
+    'page callback' => 'linktocontent_get_data',
+    'type' => MENU_CALLBACK,
+    'access arguments' => array('access tinymce')
+  );
+  $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')
+  );
   return $items;
 }
 
@@ -139,13 +142,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.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	1 Nov 2008 15:45:05 -0000
@@ -1,5 +1,6 @@
 ; $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"
-dependencies = linktocontent
+dependencies[] = linktocontent
 package = Content
+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.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	1 Nov 2008 15:46:04 -0000
@@ -1,26 +1,81 @@
 <?php
 // $Id: linktocontent_menu.module,v 1.3 2007/10/08 15:18:09 stborchert 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_menu()
  *
  * @ingroup linktocontent_menu_core
  */
-function linktocontent_menu_menu($may_cache) {
-  $access = user_access('administer linktocontent');
-  $items[] = array('path' => 'admin/settings/linktocontent/linktocontent_menu',
+function linktocontent_menu_menu() {
+  $items = array();
+  $items['admin/settings/linktocontent/linktocontent_menu'] = array(
+    // @todo
     '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);
+    '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,
+  );
   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
@@ -28,10 +83,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(
@@ -46,12 +102,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.'));
@@ -133,24 +204,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	1 Nov 2008 15:46:12 -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.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	1 Nov 2008 15:46:20 -0000
@@ -1,5 +1,7 @@
 ; $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"
-dependencies = linktocontent taxonomy
+dependencies[] = linktocontent
+dependencies[] = taxonomy
 package = Content
+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.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	1 Nov 2008 15:51:39 -0000
@@ -1,22 +1,33 @@
 <?php
 // $Id: linktocontent_node.module,v 1.3 2007/10/08 15:18:09 stborchert 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_menu()
  *
  * @ingroup linktocontent_node_core
  */
-function linktocontent_node_menu($may_cache) {
-  $access = user_access('administer linktocontent');
-  $items[] = array('path' => 'admin/settings/linktocontent/linktocontent_node',
+function linktocontent_node_menu() {
+  $items['admin/settings/linktocontent/linktocontent_node'] = array(
+    // @todo
     '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);
+    '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,
+  );
   return $items;
 }
 
@@ -53,9 +64,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);
