--- loncom/xml/londefdef.pm	2009/05/15 18:06:20	1.405
+++ loncom/xml/londefdef.pm	2010/02/01 12:03:19	1.415
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Tags Default Definition Module 
 #
-# $Id: londefdef.pm,v 1.405 2009/05/15 18:06:20 bisitz Exp $
+# $Id: londefdef.pm,v 1.415 2010/02/01 12:03:19 foxr Exp $
 # 
 #
 # Copyright Michigan State University Board of Trustees
@@ -538,6 +538,23 @@ sub start_body {
 	
 	my $extra_head = &generate_css_links();
 
+    # Breadcrumbs
+    &Apache::lonhtmlcommon::clear_breadcrumbs();
+    if ($env{'request.state'} eq 'construct') {
+        &Apache::lonhtmlcommon::add_breadcrumb({
+            'text'  => 'Construction Space',
+            'href'  => &Apache::loncommon::authorspace(),
+        });
+        &Apache::lonhtmlcommon::add_breadcrumb({
+            'text'  => 'HTML Editor',
+            'href'  => '',
+        });
+        # breadcrumbs (and tools) will be created 
+        # in start_page->bodytag->innerregister
+    } else {
+        # FIXME Where are we?
+    }
+
 	$currentstring = 
 	    &Apache::loncommon::start_page($Apache::londefdef::title,
 					   $Apache::londefdef::head
@@ -546,14 +563,26 @@ sub start_body {
 #					    'no_title'       => 1,
 					    'force_register' => 1});
 
-	if ($env{'request.state'} ne 'published') {
-	    $currentstring.=&Apache::lonmenu::constspaceform();
-	    $currentstring.=&Apache::londefdef::edit_controls();
-	}
-	$currentstring.=&Apache::lonxml::message_location();
+        my $header = '';
+        if ($env{'request.state'} ne 'published' &&
+            $env{'request.state'} ne 'construct') {
+            $header=&Apache::lonmenu::constspaceform();
+        }
+        if ($env{'request.state'} ne 'published') {
+            $header.=&Apache::londefdef::edit_controls();
+        }
+        if ($env{'request.state'} eq 'construct') {
+            $currentstring.=&Apache::loncommon::head_subbox(
+                                &Apache::loncommon::CSTR_pageheader()
+                               .$header);
+        } elsif ($env{'request.state'} eq 'edit') {
+            $currentstring.=&Apache::loncommon::head_subbox($header);
+        }
+        $currentstring.=&Apache::lonxml::message_location();
     } elsif ($target eq 'tex') {
-	$currentstring = '';   #  '\begin{document}' is in header.
-    } 
+        $currentstring = '';   #  '\begin{document}' is in header.
+    }
+
     return $currentstring;
 }
 
@@ -570,9 +599,14 @@ sub edit_controls {
 </div>';
     }
     $result .= '
-<div class="LC_edit_problem_header_edit_row"><input type="submit" name="editmode" accesskey="e" value="'.&mt('Edit').'" /></div></div>
+<div><input type="submit" name="editmode" accesskey="e" value="'.&mt('Edit').'" />';
+    if (($env{'request.course.id'}) && ($env{'form.forceedit'})) {
+        $result .= ('&nbsp;' x 3).'<input type="button" value="'.&mt('Course View').'" onclick="javascript:location.href=currentURL" />';
+    }
+    $result .= '</div>
+</div>
 </form>
-<br />';
+';
     return $result;
 }
 
@@ -4717,7 +4751,7 @@ sub align_latex_image {
     #    Even though we set a default alignment value, the user
     #    could have given us an illegal value.  In that case we
     #    just use the default alignment of bottom..
-    $currentstring = "\n% figurewrapping \n";
+    $currentstring = '';
     if      ($align eq "top")    {
 	$currentstring .= '\raisebox{-'.$height.'mm}{'.$image;
 	$closure = '}';
@@ -4760,8 +4794,6 @@ sub align_latex_image {
 	$currentstring .= "{$image";
 	$closure       = '}';
     }
-    $currentstring .= "\n% end wrappage\n";
-    $closure        = "\n% Begin closure\n".$closure."\n% End closure\n";
     return ($currentstring, $closure);
 }
 
@@ -4781,8 +4813,7 @@ sub is_inside_of {
 #
 #   This sub provides the typical LaTeX prefix matter for tex output:
 #
-sub latex_header
-{
+sub latex_header {
     my ($mode) = @_;
     my $currentstring = '';