[LON-CAPA-cvs] cvs: loncom /xml lonxml.pm

bisitz bisitz@source.lon-capa.org
Thu, 28 May 2009 11:31:04 -0000


bisitz		Thu May 28 11:31:04 2009 EDT

  Modified files:              
    /loncom/xml	lonxml.pm 
  Log:
  Changes related to modification of LON-CAPA screen header.
  start_page calls:
  - Added breadcrumbs
  - Added head_subbox and included CSTR standard header
  
  "File not found" error message:
      - Added error style
      - Optimized &mt usage
  
  - Replaced some tabs by blanks for higher script editor compatibility
  
  
Index: loncom/xml/lonxml.pm
diff -u loncom/xml/lonxml.pm:1.494 loncom/xml/lonxml.pm:1.495
--- loncom/xml/lonxml.pm:1.494	Fri Apr 17 01:00:20 2009
+++ loncom/xml/lonxml.pm	Thu May 28 11:31:03 2009
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # XML Parser Module 
 #
-# $Id: lonxml.pm,v 1.494 2009/04/17 01:00:20 www Exp $
+# $Id: lonxml.pm,v 1.495 2009/05/28 11:31:03 bisitz Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1735,10 +1735,13 @@
     if ($filecontents eq -1) {
 	my $start_page=&Apache::loncommon::start_page('File Error');
 	my $end_page=&Apache::loncommon::end_page();
-	my $fnf=&mt('File not found');
+        my $errormsg='<p class="LC_error">'
+                    .&mt('File not found: [_1]'
+                        ,'<span class="LC_filename">'.$file.'</span>')
+                    .'</p>';
 	$result=(<<ENDNOTFOUND);
 $start_page
-<b>$fnf: $file</b>
+$errormsg
 $end_page
 ENDNOTFOUND
         $filecontents='';
@@ -1777,11 +1780,14 @@
 	    &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
 						    ['rawmode']);
 	    if ($env{'form.rawmode'}) { $result = $filecontents; }
-	    if ($filetype ne 'html') {
+            if ($filetype ne 'html') {
                 my $nochgview = 1; 
-		my $controls =
-		    ($env{'request.state'} eq 'construct') ? &Apache::londefdef::edit_controls($nochgview)
-		                                           : '';
+                my $controls = '';
+                    if ($env{'request.state'} eq 'construct') {
+                        $controls = &Apache::loncommon::head_subbox(
+                                        &Apache::loncommon::CSTR_pageheader()
+                                       .&Apache::londefdef::edit_controls($nochgview));
+                    }
                 if ($filetype ne 'sty') {
                     $result =~ s/</&lt;/g;
                     $result =~ s/>/&gt;/g;
@@ -1790,17 +1796,27 @@
                               '</pre></b></td></tr></table>';
                 }
                 if ($env{'environment.remote'} eq 'off') {
-                    my %options = ('bgcolor' => '#FFFFFF');
-		    $result = 
-		        &Apache::loncommon::start_page(undef,undef,\%options).
-		        $controls.
-		        $result.
-		        &Apache::loncommon::end_page();
+                    my $brcrum;
+                    if ($env{'request.state'} eq 'construct') {
+                        $brcrum = [{'href' => '', # FIXME Add link to /priv/[user]
+                                    'text' => 'Construction Space'},
+                                   {'href' => '',
+                                    'text' => 'Editor'}];
+                    } else {
+                        $brcrum = ''; # FIXME: Where are we?
+                    }
+                    my %options = ('bread_crumbs' => $brcrum,
+                                   'bgcolor'      => '#FFFFFF');
+                    $result =
+                        &Apache::loncommon::start_page(undef,undef,\%options)
+                       .$controls
+                       .$result
+                       .&Apache::loncommon::end_page();
                 } else {
                     $result = $controls.$result;
                 }
             }
-	}
+        }
     }
 
 #
@@ -1817,8 +1833,14 @@
 
 	    my %options = 
 		('add_entries' =>
-                   {'onresize' => $add_to_onresize,
-		    'onload'   => $add_to_onload,   });
+                   {'onresize'     => $add_to_onresize,
+                    'onload'       => $add_to_onload,   });
+
+         $options{'bread_crumbs'} = [{
+                        'href' => '', # FIXME Add link to /priv/[user]
+                        'text' => 'Construction Space'},
+                       {'href' => '',
+                        'text' => 'HTML Editor'}];
 
 	    if ($env{'environment.remote'} ne 'off') {
 		$options{'bgcolor'}   = '#FFFFFF';
@@ -1829,10 +1851,12 @@
 		&Apache::loncommon::resize_textarea_js();
 	    my $start_page = &Apache::loncommon::start_page(undef,$js,
 							    \%options);
-	    $result=$start_page.
-		&Apache::lonxml::message_location().
-		$edit_info.
-		&Apache::loncommon::end_page();
+            $result = $start_page
+                     .&Apache::loncommon::head_subbox(
+                          &Apache::loncommon::CSTR_pageheader())
+                     .&Apache::lonxml::message_location()
+                     .$edit_info
+                     .&Apache::loncommon::end_page();
         }
     }
     if ($filetype eq 'html') { &writeallows($request->uri); }