--- loncom/xml/lonxml.pm 2010/10/01 14:21:55 1.494.4.5 +++ loncom/xml/lonxml.pm 2009/05/28 11:31:03 1.495 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # XML Parser Module # -# $Id: lonxml.pm,v 1.494.4.5 2010/10/01 14:21:55 raeburn Exp $ +# $Id: lonxml.pm,v 1.495 2009/05/28 11:31:03 bisitz Exp $ # # Copyright Michigan State University Board of Trustees # @@ -243,7 +243,7 @@ sub tokeninputfield { document.tokeninput.barcode.value=''; } -
+ +onChange="updatetoken()"/>* +onChange="this.value=this.value.toUpperCase()" />
DocID Checkin
@@ -251,7 +251,7 @@ sub tokeninputfield {
Scan in Barcode
or Type in DocID @@ -260,7 +260,7 @@ onchange="updatetoken()"/>
@@ -757,8 +757,6 @@ sub init_safespace { '&maxima_cas_formula_fix'); $safehole->wrap(\&Apache::lonr::r_eval,$safeeval,'&r_eval'); - $safehole->wrap(\&Apache::lonr::Rentry,$safeeval,'&Rentry'); - $safehole->wrap(\&Apache::lonr::Rarray,$safeeval,'&Rarray'); $safehole->wrap(\&Apache::lonr::r_check,$safeeval,'&r_check'); $safehole->wrap(\&Apache::lonr::r_cas_formula_fix,$safeeval, '&r_cas_formula_fix'); @@ -1043,7 +1041,7 @@ sub get_id { my ($parstack,$safeeval)=@_; my $id= &Apache::lonxml::get_param('id',$parstack,$safeeval); if ($env{'request.state'} eq 'construct' && $id =~ /([._]|[^\w\d\s[:punct:]])/) { - &error(&mt("ID [_1] contains invalid characters, IDs are only allowed to contain letters, numbers, spaces and -",''.$id.'')); + &error(&mt("ID "[_1]" contains invalid characters, IDs are only allowed to contain letters, numbers, spaces and -",''.$id.'')); } if ($id =~ /^\s*$/) { $id = $Apache::lonxml::curdepth; } return $id; @@ -1523,25 +1521,17 @@ SIMPLECONTENT sub verify_html { my ($filecontents)=@_; - my ($is_html,$is_xml); - if ($filecontents =~/(?:\<|\<\;)\?xml[^\<]*\?(?:\>|\>\;)/is) { - $is_xml = 1; - } elsif ($filecontents =~/(?:\<|\<\;)html(?:\s+[^\<]+|\s*)(?:\>|\>\;)/is) { - $is_html = 1; - } - unless ($is_xml || $is_html) { - return &mt('File does not have [_1] or [_2] starting tag','<html>','<?xml ?>'); - } - if ($is_html) { - if ($filecontents!~/(?:\<|\<\;)\/html(?:\>|\>\;)/is) { - return &mt('File does not have [_1] ending tag','<html>'); - } - if ($filecontents!~/(?:\<|\<\;)(?:body|frameset)[^\<]*(?:\>|\>\;)/is) { - return &mt('File does not have [_1] or [_2] starting tag','<body>','<frameset>'); - } - if ($filecontents!~/(?:\<|\<\;)\/(?:body|frameset)[^\<]*(?:\>|\>\;)/is) { - return &mt('File does not have [_1] or [_2] ending tag','<body>','<frameset>'); - } + if ($filecontents!~/(?:\<|\<\;)(?:html|xml)[^\<]*(?:\>|\>\;)/is) { + return &mt('File does not have [_1] or [_2] starting tag','<html>','<xml>'); + } + if ($filecontents!~/(?:\<|\<\;)\/(?:html|xml)(?:\>|\>\;)/is) { + return &mt('File does not have [_1] or [_2] ending tag','<html>','<xml>'); + } + if ($filecontents!~/(?:\<|\<\;)(?:body|frameset)[^\<]*(?:\>|\>\;)/is) { + return &mt('File does not have [_1] or [_2] starting tag','<body>','<frameset>'); + } + if ($filecontents!~/(?:\<|\<\;)\/(?:body|frameset)[^\<]*(?:\>|\>\;)/is) { + return &mt('File does not have [_1] or [_2] ending tag','<body>','<frameset>'); } return ''; } @@ -1554,30 +1544,20 @@ sub renderingoptions { = &Apache::loncommon::plainlanguagedescription($_); } } - my $output; - unless ($env{'form.forceedit'}) { - $output .= - ''. - &mt('Language:').' '. - &Apache::loncommon::select_form( - $env{'form.languages'}, - 'languages', - &Apache::lonlocal::texthash(%langchoices)). - ''; - } - $output .= - ' '. + return + ''. + &mt('Language:').' '. + &Apache::loncommon::select_form($env{'form.languages'},'languages', + %langchoices).' + + '. &mt('Math Rendering:').' '. - &Apache::loncommon::select_form( - $env{'form.texengine'}, - 'texengine', - &Apache::lonlocal::texthash - ('' => '', - 'tth' => 'tth (TeX to HTML)', - 'jsMath' => 'jsMath', - 'mimetex' => 'mimetex (Convert to Images)')). - ''; - return $output; + &Apache::loncommon::select_form($env{'form.texengine'},'texengine', + ('' => '', + 'tth' => 'tth (TeX to HTML)', + 'jsMath' => 'jsMath', + 'mimetex' => 'mimetex (Convert to Images)')).' + '; } sub inserteditinfo { @@ -1724,21 +1704,6 @@ sub handler { $request->set_last_modified(&Apache::lonnet::metadata($request->uri, 'lastrevisiondate')); } - # Embedded Flash movies (e.g., from Camtasia) served from https will not display in IE - # if XML config file has expired from cache. - if ($ENV{'SERVER_PORT'} == 443) { - if ($request->uri =~ /\.xml$/) { - my ($httpbrowser,$clientbrowser) = - &Apache::loncommon::decode_user_agent($request); - if ($clientbrowser =~ /^explorer$/i) { - delete $request->headers_out->{'Cache-control'}; - delete $request->headers_out->{'Pragma'}; - my $expiration = time + 60; - my $date=strftime("%a, %d %b %Y %H:%M:%S GMT",gmtime($expiration)); - $request->headers_out->set("Expires" => $date); - } - } - } $request->send_http_header; return OK if $request->header_only; @@ -1770,10 +1735,13 @@ sub handler { 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='

' + .&mt('File not found: [_1]' + ,''.$file.'') + .'

'; $result=(<$fnf: $file +$errormsg $end_page ENDNOTFOUND $filecontents=''; @@ -1812,11 +1780,14 @@ ENDNOTFOUND &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//>/g; @@ -1825,17 +1796,27 @@ ENDNOTFOUND ''; } 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; } } - } + } } # @@ -1852,8 +1833,14 @@ ENDNOTFOUND 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'; @@ -1864,10 +1851,12 @@ ENDNOTFOUND &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); }