--- loncom/interface/lonhtmlcommon.pm	2008/09/05 22:12:47	1.180
+++ loncom/interface/lonhtmlcommon.pm	2008/11/11 20:12:17	1.183
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # a pile of common html routines
 #
-# $Id: lonhtmlcommon.pm,v 1.180 2008/09/05 22:12:47 riegler Exp $
+# $Id: lonhtmlcommon.pm,v 1.183 2008/11/11 20:12:17 droeschl Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -102,18 +102,20 @@ can be used to paste LaTeX into a textar
 =cut
 
 sub dragmath_js {
+    my ($popup) = @_;
     return <<ENDDRAGMATHJS;
                 <script type="text/javascript">
                   function mathedit(textarea, doc) {
                      targetEntry = textarea;
                      targetDoc   = doc;
-                     newwin  = window.open("/adm/dragmath/applet/EditMathPopup.html","","width=565,height=500,resizable");
+                     newwin  = window.open("/adm/dragmath/applet/$popup.html","","width=565,height=500,resizable");
                   }
                 </script>
 
 ENDDRAGMATHJS
 }
 
+
 ##############################################
 ##############################################
 
@@ -1483,6 +1485,13 @@ END
     return $output;
 }
 
+sub row_headline {
+    my $output = <<"END";
+           <tr><td colspan="2">
+END
+    return $output;
+}
+
 sub row_title {
     my ($title,$css_title_class,$css_value_class) = @_;
     $css_title_class ||= 'LC_pick_box_title';
@@ -1995,6 +2004,59 @@ END
     return $scripttag;
 }
 
+##############################################
+##############################################
+
+# generate_menu
+#
+# Generates html markup for a menu. 
+#
+# Inputs:
+# An array of following structure:
+#   ({	categorytitle => 'Categorytitle',
+#	items => [
+#		    {	linktext    =>	'Text to be displayed',
+#			url	    =>	'URL the link is pointing to, i.e. /adm/site?action=dosomething',
+#			permission  =>	'Contains permissions as returned from lonnet::allowed(),
+#					 must evaluate to true in order to activate the link',
+#			help	    =>	'Name of the corresponding helpfile',
+#			linktitle   =>	'Description of the link (used for title tag)'
+#		    },
+#		    ...
+#		]
+#   }, 
+#   ...
+#   )
+#
+# Outputs: A scalar containing the html markup for the menu.
+
+# ---- Remove when done ----
+# This routine is part of the redesign of LON-CAPA and it's 
+# subject to change during this project.
+# Don't rely on its current functionality as it might be 
+# changed or removed.
+# --------------------------
+
+sub generate_menu {
+    my @menu = @_;
+    my $menu_html = '';
+
+    foreach my $category (@menu) { #FIXME: insert appropriate classnames for styles when they're finished.
+	$menu_html .='<div class=""><h3 class="">'.$category->{'categorytitle'}.'</h3><ul class="">';
+	foreach my $item (@{ $category->{items} }) {
+	    next if (! $item->{'permission'});
+	    $menu_html .= '<li class="">'.
+			    qq{<a href="$item->{'url'}" title="$item->{'linktitle'}">}.
+			    &mt($item->{'linktext'}).'</a>';
+	    if (exists($item->{'help'})) {
+		$menu_html .= &Apache::loncommon::help_open_topic($item->{'help'});
+	    }
+	    $menu_html .= '</li>';
+	}
+	$menu_html .= '</div>';
+    }
+    return $menu_html;
+}
 
 
 1;