--- loncom/interface/lonhtmlcommon.pm	2008/08/21 10:48:37	1.178
+++ loncom/interface/lonhtmlcommon.pm	2008/12/01 16:33:32	1.187
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # a pile of common html routines
 #
-# $Id: lonhtmlcommon.pm,v 1.178 2008/08/21 10:48:37 bisitz Exp $
+# $Id: lonhtmlcommon.pm,v 1.187 2008/12/01 16:33:32 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
 }
 
+
 ##############################################
 ##############################################
 
@@ -1310,6 +1312,8 @@ returns: nothing
         my $faq = '';
         my $bug = '';
 	my $help='';
+	# Crumb Symbol
+	my $crumbsymbol = ' &#x25b6; ';
         # The last breadcrumb does not have a link, so handle it separately.
         my $last = pop(@Crumbs);
         #
@@ -1333,7 +1337,7 @@ returns: nothing
                 });
         }
         my $links .= 
-            join('-&gt;',
+            join($crumbsymbol,
                  map {
                      $faq = $_->{'faq'} if (exists($_->{'faq'}));
                      $bug = $_->{'bug'} if (exists($_->{'bug'}));
@@ -1352,7 +1356,7 @@ returns: nothing
                      $result;
                      } @Crumbs
                  );
-        $links .= '-&gt;' if ($links ne '');
+        $links .= $crumbsymbol if ($links ne '');
 	if ($last->{'no_mt'}) {
 	    $links .= '<b>'.$last->{'text'}.'</b>';
 	} else {
@@ -1481,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';
@@ -1697,6 +1708,7 @@ sub email_default_row {
 
 sub submit_row {
     my ($title,$cmd,$submit_text,$css_class) = @_;
+    $submit_text = &mt($submit_text);
     my $output = &row_title($title,$css_class,'LC_pick_box_submit');
     $output .= qq|
              <br />
@@ -1727,6 +1739,25 @@ sub course_custom_roles {
 
 ##############################################
 ##############################################
+
+# topic_bar
+#
+# Generates a div containing a numbered (static image) followed by a title
+# with a background color defined in the corresponding CSS: LC_topic_bar
+#
+sub topic_bar {
+    my ($imgnum,$title) = @_;
+    return '
+<div class="LC_topic_bar">
+    <img alt="'.&mt('Step [_1]',$imgnum).
+              '"src="/res/adm/pages/bl_step'.$imgnum.'.gif" />&nbsp;
+    <span>'.$title.'</span>
+</div>
+';
+}
+
+##############################################
+##############################################
                                                                              
 # echo_form_input
 #
@@ -1974,6 +2005,74 @@ 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',
+#			icon        =>  'icon filename',
+#			alttext	    =>	'alt text for the icon',
+#			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.
+# TODO:
+# check for empty values
+# --------------------------
+
+sub generate_menu {
+    my @menu = @_;
+    my $menu_html = qq|<div class="columnSection">|;
+
+    foreach my $category (@menu) { #FIXME: insert appropriate classnames for styles when they're finished.
+	$menu_html .='<div class="ContentBox">
+			<h3 class="">'.$category->{'categorytitle'}.'</h3>
+			<ul class="ListStyleNormal">';
+	foreach my $item ( @{ $category->{items} } ) {
+	    next unless $item->{'permission'};
+	    $menu_html .= qq|<li class=""><a href="$item->{'url'}" title="$item->{'linktitle'}">|;
+            if($item->{'icon'}){
+                $menu_html .= qq|<img class ="noBorder" src="/res/adm/pages/$item->{'icon'}" alt="|;
+		if($item->{'alttext'}){
+		    $menu_html .= qq|$item->{'alttext'}"/></a>|;
+		} else { #use linktext as alt text for the icon
+		    $menu_html .= qq|$item->{'linktext'}"/></a>|;
+                } 
+            }
+	    $menu_html .= qq|<a href="$item->{'url'}" title="$item->{'linktitle'}">|;
+            $menu_html .= &mt($item->{'linktext'}).'</a>';
+	    if (exists($item->{'help'})) {
+		$menu_html .= &Apache::loncommon::help_open_topic($item->{'help'});
+	    }
+	    $menu_html .= '</li>';
+	}
+	$menu_html .= '</div>';
+    }
+    $menu_html .= qq|</div>|;
+    return $menu_html;
+}
 
 
 1;