Index: api.css
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/api/api.css,v
retrieving revision 1.5.2.1
diff -u -p -r1.5.2.1 api.css
--- api.css	3 Sep 2007 23:56:55 -0000	1.5.2.1
+++ api.css	26 Feb 2008 16:01:03 -0000
@@ -45,3 +45,43 @@
 #api-search-form #edit-search {
   width: 95%;
 }
+
+/* Style function names and tooltips */
+a.api-function-name {
+  position: relative;
+}
+a.api-function-name span.api-tooltip {
+  height: 1%;
+  display: none;
+  position: absolute;
+  top: 20px;
+  left: 20px;
+  width: 400px;
+  z-index: 1000; 
+}
+a.api-function-name span.api-tooltip span.inner {
+  float: left;
+  padding: 5px 10px;
+  font-size: 11px;
+  font-style: normal;
+  color: #333;
+  background-color: #ffe;
+  border: 2px solid #ccc;
+}
+a.api-function-name span.api-tooltip hr {
+  clear: left;
+  display: none;
+  visibility: hidden;
+}
+a.api-function-name span.api-tooltip p {
+  margin: 2px 0;
+}
+a.api-function-name:hover {
+  white-space: normal;
+  text-decoration: none;
+  z-index: 1000; 
+}
+a.api-function-name:hover span.api-tooltip {
+  display: block;
+  z-index: 200; 
+}
Index: api.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/api/api.module,v
retrieving revision 1.48.2.21
diff -u -p -r1.48.2.21 api.module
--- api.module	26 Jan 2008 03:34:44 -0000	1.48.2.21
+++ api.module	26 Feb 2008 16:01:05 -0000
@@ -584,7 +584,7 @@ function api_search_listing($branch_name
       break;
 
     default:
-      $result = pager_query("SELECT * FROM {api_documentation} WHERE branch_name = '%s' AND object_name LIKE '%%%s%%'". tablesort_sql(_api_listing_headers()), 50, 0, NULL, $branch_name, $search_text);
+      $result = pager_query("SELECT d.*, f.signature, f.parameters FROM {api_documentation} d INNER JOIN {api_function} f ON d.did = f.did WHERE branch_name = '%s' AND object_name LIKE '%%%s%%'". tablesort_sql(_api_listing_headers()), 50, 0, NULL, $branch_name, $search_text);
       return api_render_listing($result);
   }
 }
@@ -619,7 +619,9 @@ function api_page_branch($branch_name) {
  * Menu callback; displays an object listing.
  */
 function api_page_listing($branch_name, $object_type) {
-  $result = pager_query("SELECT * FROM {api_documentation} WHERE branch_name = '%s' AND object_type = '%s'". tablesort_sql(_api_listing_headers()), 50, 0, NULL, $branch_name, $object_type);
+  drupal_add_css(drupal_get_path('module', 'api') .'/api.css');
+
+  $result = pager_query("SELECT d.*, f.signature, f.parameters FROM {api_documentation} d INNER JOIN {api_function} f ON d.did = f.did WHERE branch_name = '%s' AND object_type = '%s'". tablesort_sql(_api_listing_headers()), 50, 0, NULL, $branch_name, $object_type);
   return api_render_listing($result);
 }
 
@@ -631,6 +633,18 @@ function _api_listing_headers() {
   return $headers;
 }
 
+function _api_function_name($object) {
+  if (variable_get('api_function_tooltip', FALSE) && $object->parameters != '') {
+    $tooltip = '<span class="api-tooltip"><span class="inner"><strong>Definition</strong><p>'. $object->signature .'</p>';
+    $tooltip .='<strong>Parameters:</strong><p>'. $object->parameters .'</p></span><hr /></span>';
+    $row = l($object->title . $tooltip, 'api/function/'. $object->object_name .'/'. $object->branch_name, array('class' => 'api-function-name'), NULL, NULL, FALSE, TRUE);
+  }
+  else {
+    $row = l($object->title, 'api/function/'. $object->object_name .'/'. $object->branch_name);
+  }
+  return $row;
+}
+
 /**
  * Render a table with an overview of documentation objects.
  */
@@ -640,7 +654,7 @@ function api_render_listing($result) {
   $rows = array();
   while ($object = db_fetch_object($result)) {
     $row = array();
-    $row[] = l($object->title, 'api/'. $object->object_type .'/'. $object->object_name .'/'. $object->branch_name);
+    $row[] = _api_function_name($object); 
     $row[] = l(str_replace('/', '/ ', $object->file_name), 'api/file/'. $object->file_name .'/'. $object->branch_name);
     $row[] = api_link_documentation($object->summary, $object->branch_name);
     $rows[] = $row;
@@ -742,10 +756,10 @@ function api_page_function_references($b
 
     $headers = array(array('data' => t('Name'), 'field' => 'd.title'), array('data' => t('Location'), 'field' => 'd.file_name'), t('Description'));
     $rows = array();
-    $result = db_query("SELECT d.object_name, d.title, d.summary, d.file_name FROM {api_reference_storage} r INNER JOIN {api_documentation} d ON r.from_did = d.did AND d.object_type = 'function' WHERE r.to_did = %d". tablesort_sql($headers), $function->did);
+    $result = db_query("SELECT d.object_name, d.title, d.summary, d.file_name, f.signature, f.parameters  FROM {api_reference_storage} r INNER JOIN {api_documentation} d ON r.from_did = d.did AND d.object_type = 'function' INNER JOIN {api_function} f ON d.did = f.did WHERE r.to_did = %d". tablesort_sql($headers), $function->did);
     while ($reference = db_fetch_object($result)) {
       $rows[] = array(
-        l($reference->title, 'api/function/'. $reference->object_name .'/'. $branch_name),
+        _api_function_name($reference),
         l($reference->file_name, 'api/file/'. $reference->file_name .'/'. $branch_name),
         api_link_documentation($reference->summary, $branch_name));
     }
@@ -756,10 +770,10 @@ function api_page_function_references($b
 
     $headers = array(array('data' => t('Name'), 'field' => 'd.title'), array('data' => t('Location'), 'field' => 'd.file_name'), t('Description'));
     $rows = array();
-    $result = db_query("SELECT d.object_name, d.title, d.summary, d.file_name FROM {api_reference_storage} r INNER JOIN {api_documentation} d ON r.to_did = d.did AND d.object_type = 'function' WHERE r.from_did = %d". tablesort_sql($headers), $function->did);
+    $result = db_query("SELECT d.object_name, d.title, d.summary, d.file_name, f.signature, f.parameters FROM {api_reference_storage} r INNER JOIN {api_documentation} d ON r.to_did = d.did AND d.object_type = 'function' INNER JOIN {api_function} f ON d.did = f.did WHERE r.from_did = %d". tablesort_sql($headers), $function->did);
     while ($reference = db_fetch_object($result)) {
       $rows[] = array(
-        l($reference->title, 'api/function/'. $reference->object_name .'/'. $branch_name),
+        _api_function_name($reference),
         l($reference->file_name, 'api/file/'. $reference->file_name .'/'. $branch_name),
         api_link_documentation($reference->summary, $branch_name));
     }
@@ -919,10 +933,10 @@ function api_page_file($branch_name, $ob
 
     $headers = array(array('data' => t('Name'), 'field' => 'title'), t('Description'));
     $rows = array();
-    $result = db_query("SELECT title, object_name, summary FROM {api_documentation} WHERE file_name = '%s' AND branch_name = '%s' AND object_type = 'function'". tablesort_sql($headers), $object_name, $branch_name);
+    $result = db_query("SELECT d.title, d.object_name, d.summary, f.signature, f.parameters FROM {api_documentation} d INNER JOIN {api_function} f ON d.did = f.did WHERE file_name = '%s' AND branch_name = '%s' AND object_type = 'function'". tablesort_sql($headers), $object_name, $branch_name);
     while ($object = db_fetch_object($result)) {
       $rows[] = array(
-        l($object->title, 'api/function/'. $object->object_name .'/'. $branch_name),
+        _api_function_name($object),
         api_link_documentation($object->summary, $branch_name));
     }
     if (count($rows) > 0) {
@@ -997,10 +1011,10 @@ function api_page_group($branch_name, $o
 
     $headers = array(array('data' => t('Name'), 'field' => 'd.title'), array('data' => t('Location'), 'field' => 'd.file_name'), t('Description'));
     $rows = array();
-    $result = db_query("SELECT d.object_name, d.title, d.summary, d.file_name FROM {api_reference_storage} r INNER JOIN {api_documentation} d ON r.from_did = d.did AND d.object_type = 'function' WHERE r.to_did = %d". tablesort_sql($headers), $group->did);
+    $result = db_query("SELECT d.object_name, d.title, d.summary, d.file_name, f.signature, f.parameters FROM {api_reference_storage} r INNER JOIN {api_documentation} d ON r.from_did = d.did AND d.object_type = 'function' INNER JOIN {api_function} f ON d.did = f.did WHERE r.to_did = %d". tablesort_sql($headers), $group->did);
     while ($object = db_fetch_object($result)) {
       $rows[] = array(
-        l($object->title, 'api/function/'. $object->object_name .'/'. $branch_name),
+        _api_function_name($object),
         l($object->file_name, 'api/file/'. $object->file_name .'/'. $branch_name),
         api_link_documentation($object->summary, $branch_name));
     }
@@ -1117,6 +1131,12 @@ function api_page_admin_form() {
     '#options' => $options,
     '#description' => t('Default is 10. It is not recommended to increase this, except temporarily if a large amount of files are to be indexed (ie, a new branch has been added).'),
   );
+  $form['api_function_tooltip'] = array(
+    '#type' => 'checkbox',
+    '#title' => t('Show function tooltip.'),
+    '#default_value' => variable_get('api_function_tooltip', FALSE),
+    '#description' => t('Enables the tooltip with function signature and parameters information.'),
+  );
 
   $form['submit'] = array(
     '#type' => 'submit',
@@ -1165,6 +1185,9 @@ function api_page_admin_form_submit($for
   // Save the variable for max files per cron.
   variable_set('api_files_per_cron', $form_values['api_files_per_cron']);
 
+  // Save the variable for function tooltip.
+  variable_set('api_function_tooltip', $form_values['api_function_tooltip']);
+
   // We may have menu changes, so clear the menu cache for all users.
   cache_clear_all('*', 'cache_menu', TRUE);
 
