version 1.471, 2008/02/15 12:59:50
|
version 1.475, 2008/03/21 18:36:48
|
Line 379 sub xmlparse {
|
Line 379 sub xmlparse {
|
} |
} |
&init_state(); |
&init_state(); |
if ($env{'form.return_only_error_and_warning_counts'}) { |
if ($env{'form.return_only_error_and_warning_counts'}) { |
|
if ($env{'request.filename'}=~/\.(html|htm|xml)$/i) { |
|
my $error=&verify_html($content_file_string); |
|
if ($error) { $errorcount++; } |
|
} |
return "$errorcount:$warningcount"; |
return "$errorcount:$warningcount"; |
} |
} |
return $finaloutput; |
return $finaloutput; |
Line 1117 sub init_counter {
|
Line 1121 sub init_counter {
|
} |
} |
|
|
sub store_counter { |
sub store_counter { |
&Apache::lonnet::appenv(('form.counter' => $Apache::lonxml::counter)); |
&Apache::lonnet::appenv({'form.counter' => $Apache::lonxml::counter}); |
$Apache::lonxml::counter_changed=0; |
$Apache::lonxml::counter_changed=0; |
return ''; |
return ''; |
} |
} |
Line 1138 sub store_counter {
|
Line 1142 sub store_counter {
|
|
|
sub restore_problem_counter { |
sub restore_problem_counter { |
if (defined($state)) { |
if (defined($state)) { |
&Apache::lonnet::appenv(('form.counter' => $state)); |
&Apache::lonnet::appenv({'form.counter' => $state}); |
} |
} |
} |
} |
sub get_problem_counter { |
sub get_problem_counter { |
Line 1375 sub writeallows {
|
Line 1379 sub writeallows {
|
&Apache::lonnet::hreflocation($thisdir,&unescape($_))}=$thisurl; |
&Apache::lonnet::hreflocation($thisdir,&unescape($_))}=$thisurl; |
} |
} |
@extlinks=(); |
@extlinks=(); |
&Apache::lonnet::appenv(%httpref); |
&Apache::lonnet::appenv(\%httpref); |
} |
} |
|
|
sub register_ssi { |
sub register_ssi { |
Line 1475 SIMPLECONTENT
|
Line 1479 SIMPLECONTENT
|
return $filecontents; |
return $filecontents; |
} |
} |
|
|
|
sub verify_html { |
|
my ($filecontents)=@_; |
|
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 ''; |
|
} |
|
|
sub inserteditinfo { |
sub inserteditinfo { |
my ($filecontents, $filetype, $filename)=@_; |
my ($filecontents, $filetype, $filename)=@_; |
$filecontents = &HTML::Entities::encode($filecontents,'<>&"'); |
$filecontents = &HTML::Entities::encode($filecontents,'<>&"'); |
# my $editheader='<a href="#editsection">Edit below</a><hr />'; |
|
my $xml_help = ''; |
my $xml_help = ''; |
my $initialize=''; |
my $initialize=''; |
my $textarea_id = 'filecont'; |
my $textarea_id = 'filecont'; |
Line 1538 FULLPAGE
|
Line 1557 FULLPAGE
|
my $spelllink .=&Apache::lonhtmlcommon::spelllink('xmledit','filecont'); |
my $spelllink .=&Apache::lonhtmlcommon::spelllink('xmledit','filecont'); |
my $textarea_events = &Apache::edit::element_change_detection(); |
my $textarea_events = &Apache::edit::element_change_detection(); |
my $form_events = &Apache::edit::form_change_detection(); |
my $form_events = &Apache::edit::form_change_detection(); |
|
my $htmlerror=&verify_html($filecontents); |
|
if ($htmlerror) { |
|
$htmlerror='<span class="LC_error">'.$htmlerror.'</span>'; |
|
} |
my $editfooter=(<<ENDFOOTER); |
my $editfooter=(<<ENDFOOTER); |
$initialize |
$initialize |
<a name="editsection" /> |
<a name="editsection" /> |
Line 1552 $initialize
|
Line 1575 $initialize
|
<div class="LC_edit_problem_discards"> |
<div class="LC_edit_problem_discards"> |
<input type="submit" name="discardview" accesskey="d" value="$lt{'dv'}" /> |
<input type="submit" name="discardview" accesskey="d" value="$lt{'dv'}" /> |
<input type="submit" name="Undo" accesskey="u" value="$lt{'un'}" /> |
<input type="submit" name="Undo" accesskey="u" value="$lt{'un'}" /> |
$spelllink |
$spelllink $htmlerror |
</div> |
</div> |
<div class="LC_edit_problem_saves"> |
<div class="LC_edit_problem_saves"> |
<input type="submit" name="savethisfile" accesskey="s" value="$lt{'st'}" /> |
<input type="submit" name="savethisfile" accesskey="s" value="$lt{'st'}" /> |
Line 1629 sub handler {
|
Line 1652 sub handler {
|
if ($env{'form.savethisfile'} || $env{'form.viewmode'} || $env{'form.Undo'}) { |
if ($env{'form.savethisfile'} || $env{'form.viewmode'} || $env{'form.Undo'}) { |
my $html_file=&Apache::lonnet::getfile($file); |
my $html_file=&Apache::lonnet::getfile($file); |
my $error = &Apache::lonhomework::handle_save_or_undo($request, \$html_file, \$env{'form.filecont'}); |
my $error = &Apache::lonhomework::handle_save_or_undo($request, \$html_file, \$env{'form.filecont'}); |
|
if ($env{'form.savethisfile'}) { |
|
$env{'form.editmode'}='Edit'; #force edit mode |
|
} |
} |
} |
} |
} |
my %mystyle; |
my %mystyle; |