--- sidebar.module	2003-11-14 01:25:41.000000000 +0100
+++ sidebar-aam.module	2004-07-04 09:07:08.000000000 +0200
@@ -1,9 +1,11 @@
 <?php
 
-// $Id: sidebar.module,v 1.21 2003/11/13 22:25:59 dries Exp $
+// $Id: sidebar.module,v 1.18.2.2 2004/07/01 20:56:12 killes Exp $
 //
 // sidebar.module: adds Mozilla sidebar panels to drupal
 // Copyright (C) 2001 Mark Cornick, gnudist@gnudist.org
+// drupal 4.4.1 hack
+// Copyright (C) 2004 Andre Mueller, aam@ugpl.de
 // 
 // This program is free software; you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
@@ -41,48 +43,64 @@
   global $base_url;
 
   $result = db_query_range("SELECT nid, type FROM {node} WHERE promote = '1' AND status = '1' ORDER BY created DESC", 0, variable_get("sidebar_items", "5"));
-  print "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\n";
-  print " \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n";
-  print "<html>\n<head>\n";
-  print "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\" />\n";
-  print "<meta http-equiv=\"pragma\" content=\"no-cache\" />\n";
-  print "<title>".variable_get("site_name", "drupal")."</title>\n";
-  print "<style type=\"text/css\">\n";
-  print "BODY { margin: 10px; font-size: 12pt; font-family: Verdana, Helvetica; }\n";
-  print "SMALL { font-size: 10pt; }\n";
-  print "</style>\n";
-  print "<base target=\"_content\" />\n";
-  print "</head>\n<body ";
-// These are no standard settings.
+  $output = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\n";
+  $output .= " \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n";
+  $output .= "<html>\n<head>\n";
+  $output .= "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\" />\n";
+  $output .= "<meta http-equiv=\"pragma\" content=\"no-cache\" />\n";
+  $output .= "<title>".variable_get("site_name", "drupal")."</title>\n";
+  $output .= "<style type=\"text/css\">\n";
+  $output .= "body { margin: 10px; font-size: 11pt; font-family: Verdana, Helvetica; }\n";
+  $output .= "small { font-weight:normal; font-size: 9pt; color:#000000; }\n";
+  $output .= "a { text-decoration: none; }\n";
+  $output .= "a:hover { text-decoration: underline; }\n";
+  $output .= "ul { list-style-type:circle; margin-left: 0.0em; padding-left: 0.5em; }\n";
+  $output .= "li { font-weight:bold; margin-left:0.5em; padding-left: 0.0em; font-size: 10pt; }\n";
+  $output .= "</style>\n";
+  $output .= drupal_get_html_head();
+  $output .= "<base target=\"_content\" />\n";
+  $output .= "</head>\n<body color=\"#666\" bgcolor=\"#fff\" link=\"#038\" alink=\"#149\" vlink=\"#027\">";
+// These are no standard settings. :: $theme->foreground seems to be not supported...
 //  print "text=\"".$theme->foreground."\" ";
 //  print "bgcolor=\"".$theme->background."\" ";
-  print "alink=\"".$theme->foreground."\" ";
-  print "link=\"".$theme->foreground."\" ";
-  print "vlink=\"".$theme->foreground."\">\n";
-  print "<p><b>". t("The latest from %site", array("%site" => "<a href=\"". $base_url ."\">". variable_get("site_name", "drupal") ."</a>")) .":</b></p>\n";
-  print "<p><small>". t("Last updated: %date", array("%date" => date("F j, Y, g:i a T")));
-  print " (<a href=\"javascript:location.reload()\" target=\"_self\">". t("refresh") ."</a>)</small></p>\n<dl>\n";
+//  print "alink=\"".$theme->foreground."\" ";
+//  print "link=\"".$theme->foreground."\" ";
+//  print "vlink=\"".$theme->foreground."\">\n";
+  $output .= "<p><b>". t("The latest from %site", array("%site" => "<a href=\"". $base_url ."\">". variable_get("site_name", "drupal") ."</a>")) .":</b></p>\n";
+  $output .= "<p><small>". t("Last updated: %date", array("%date" => date("F j, Y, g:i a T")));
+  $output .= " (<a href=\"javascript:location.reload()\" target=\"_self\">". t("refresh") ."</a>)</small></p>\n<ul>\n";
   while ($node = db_fetch_object($result)) {
     $item = node_load(array("nid" => $node->nid, "type" => $node->type));
-    print "<dt>". l($item->title, "node/view/$item->nid", array("title" => t("Read this article."))) ."\n";
+    $output .= "<li>". l($item->title, "node/view/$item->nid", array("title" => t("Read this article."))) ."\n";
     $all = comment_num_all($item->nid);
     $new = comment_num_new($item->nid);
-    print " (". l(format_plural($all, "1 comment", "%count comments") . ($new ? ", $new ". t("new") : ""), "node/view/$item->nid#comment", array("title" => t("View this posting and all of its comments."))) .")";
-    print "</dt>\n";
+    $output .= "<br /><small>(". l(format_plural($all, "1 comment", "%count comments") . ($new ? ", $new ". t("new") : ""), "node/view/$item->nid#comment", array("title" => t("View this posting and all of its comments."))) .")</small>";
+    $output .= "</li>\n";
     if (variable_get("sidebar_teasers", "1") == "1") {
-      print "<dd><small>" . check_output($item->teaser) . "</small></dd>\n";
+      $output .= "<dd><small>" . check_output($item->teaser) . "</small></dd>\n";
     }
   }
-  print "</dl>\n</body>\n</html>\n";
+  $output .= "</ul>\n</body>\n</html>\n";
+  print $output;
 }
 
 function sidebar_link($type) {
-  if ($type == "page" && (eregi("Mozilla/5.0 \(", $_SERVER['HTTP_USER_AGENT']) || eregi("Opera", $_SERVER['HTTP_USER_AGENT']))) {
-    $links[] = l(t("mozilla sidebar"), "sidebar");
+// New as described in "converting 4.3 modules to 4.4" tutorial
+  if ($type == "system") {
+    $links[] = menu("sidebar", t("sidebar"), "sidebar_page", 0, MENU_HIDE);
+  } 
+
+  if ($type == "page"
+     && (eregi("Mozilla/5.0 \(", $_SERVER['HTTP_USER_AGENT'])
+     || eregi("Opera", $_SERVER['HTTP_USER_AGENT']))) {
+//    $links[] = l(t("mozilla sidebar"), "sidebar");
+    $links[] = menu("sidebar", t("sidebar"), "sidebar");
   }
 
   if ($type == "admin" && user_access("administer sidebar")) {
-    $links[] = l(t("mozilla sidebar"), "admin/sidebar");
+//    $links[] = l(t("mozilla sidebar"), "admin/sidebar");
+    $links[] = menu("sidebar", t("sidebar"), "admin/sidebar");
+    $links[] = menu("sidebar", t("sidebar_help"), "admin/sidebar/help");
   }
   return $links ? $links : array();
 }
@@ -121,7 +139,8 @@
   global $theme, $base_url;
 
   if (eregi("Mozilla/5.0", $_SERVER['HTTP_USER_AGENT'])) {
-    $output = "<script language=\"javascript\" type=\"text/javascript\">\n";
+    $output = "<h1 class=\"title\">Mozilla/Opera Sidebar</h1>";
+    $output .= "<script language=\"javascript\" type=\"text/javascript\">\n";
     $output .= "function addPanel()\n";
     $output .= "{\n";
     $output .= "  if ((typeof window.sidebar == \"object\") && (typeof window.sidebar.addPanel == \"function\"))\n";
@@ -144,11 +163,13 @@
     $output .= "<p>". l(t("Add it!"), "sidebar/panel", array("title" => variable_get("site_name", "drupal"), "rel" => "sidebar")) ."</p>\n";
   }
   else {
-    $output = "<p>". t("Sorry, your browser does not support this feature. The sidebar is supported by <a href=\"http://www.netscape.com/\">Netscape</a> version 6.1 or greater, <a href=\"http://www.opera.com\">Opera</a> version 5.0 and greater and by <a href=\"http://www.mozilla.org/\">Mozilla</a> version 0.9.4 or greater.") ."</p>\n";
+    $output = "<h3>".$_SERVER['HTTP_USER_AGENT']."</h3><p>".t("Sorry, your browser does not support this feature. The sidebar is supported by <a href=\"http://www.netscape.com/\">Netscape</a> version 6.1 or greater, <a href=\"http://www.opera.com\">Opera</a> version 5.0 and greater and by <a href=\"http://www.mozilla.org/\">Mozilla</a> version 0.9.4 or greater.")."</p>\n";
   }
-  print theme("header");
-  print theme("box", t("Mozilla Sidebar"), $output);
-  print theme("footer");
+//  theme("header"); The theme("header") and theme("footer") functions are not available anymore. 
+//  theme("box", t("Mozilla Sidebar"), $output);
+//  print theme("box", t("Mozilla Sidebar"), $output);
+  print theme("page", t("Mozilla Sidebar"), $output);
+//  theme("footer"); The theme("header") and theme("footer") functions are not available anymore. 
 }
 
 function sidebar_page() {
