version 1.449, 2007/08/03 23:29:54
|
version 1.451, 2007/08/17 21:24:21
|
Line 1350 SIMPLECONTENT
|
Line 1350 SIMPLECONTENT
|
|
|
|
|
sub inserteditinfo { |
sub inserteditinfo { |
my ($result,$filecontents,$filetype)=@_; |
my ($filecontents,$filetype)=@_; |
$filecontents = &HTML::Entities::encode($filecontents,'<>&"'); |
$filecontents = &HTML::Entities::encode($filecontents,'<>&"'); |
# my $editheader='<a href="#editsection">Edit below</a><hr />'; |
# my $editheader='<a href="#editsection">Edit below</a><hr />'; |
my $xml_help = ''; |
my $xml_help = ''; |
my $initialize=''; |
my $initialize=''; |
|
my $add_to_onload; |
if ($filetype eq 'html') { |
if ($filetype eq 'html') { |
my $addbuttons=&Apache::lonhtmlcommon::htmlareaaddbuttons(); |
my $addbuttons=&Apache::lonhtmlcommon::htmlareaaddbuttons(); |
$initialize=&Apache::lonhtmlcommon::spellheader(); |
$initialize=&Apache::lonhtmlcommon::spellheader(); |
Line 1370 $addbuttons
|
Line 1371 $addbuttons
|
var editor=new HTMLArea("filecont",config); |
var editor=new HTMLArea("filecont",config); |
editor.registerPlugin(FullPage); |
editor.registerPlugin(FullPage); |
editor.generate(); |
editor.generate(); |
|
setTimeout( |
|
function () { |
|
HTMLArea._addEvents(editor._doc, |
|
["keypress","mousedown"], unClean); |
|
},300); |
} |
} |
</script> |
</script> |
FULLPAGE |
FULLPAGE |
Line 1382 $addbuttons
|
Line 1388 $addbuttons
|
</script> |
</script> |
FULLPAGE |
FULLPAGE |
} |
} |
$result=~s/\<body([^\>]*)\>/\<body onload="initDocument()" $1\>/i; |
$add_to_onload = 'initDocument();'; |
$xml_help=&Apache::loncommon::helpLatexCheatsheet(); |
$xml_help=&Apache::loncommon::helpLatexCheatsheet(); |
} |
} |
my $cleanbut = ''; |
my $cleanbut = ''; |
Line 1401 $cleanbut
|
Line 1407 $cleanbut
|
<input type="submit" name="viewmode" accesskey="v" value="$lt{'vi'}" /> |
<input type="submit" name="viewmode" accesskey="v" value="$lt{'vi'}" /> |
BUTTONS |
BUTTONS |
$buttons.=&Apache::lonhtmlcommon::spelllink('xmledit','filecont'); |
$buttons.=&Apache::lonhtmlcommon::spelllink('xmledit','filecont'); |
|
my $textarea_events = &Apache::edit::element_change_detection(); |
|
my $form_events = &Apache::edit::form_change_detection(); |
my $editfooter=(<<ENDFOOTER); |
my $editfooter=(<<ENDFOOTER); |
$initialize |
$initialize |
<hr /> |
<hr /> |
<a name="editsection" /> |
<a name="editsection" /> |
<form method="post" name="xmledit"> |
<form $form_events method="post" name="xmledit"> |
$xml_help |
$xml_help |
<input type="hidden" name="editmode" value="$lt{'ed'}" /> |
<input type="hidden" name="editmode" value="$lt{'ed'}" /> |
$buttons<br /> |
$buttons<br /> |
<textarea style="width:100%" cols="80" rows="44" name="filecont" id="filecont">$filecontents</textarea> |
<textarea $textarea_events style="width:100%" cols="80" rows="44" name="filecont" id="filecont">$filecontents</textarea> |
<br />$buttons |
<br />$buttons |
<br /> |
<br /> |
</form> |
</form> |
$titledisplay |
$titledisplay |
</body> |
</body> |
ENDFOOTER |
ENDFOOTER |
# $result=~s/(\<body[^\>]*\>)/$1$editheader/is; |
return ($editfooter,$add_to_onload);; |
$result=~s/(\<\/body\>)/$editfooter/is; |
|
return $result; |
|
} |
} |
|
|
sub get_target { |
sub get_target { |
Line 1528 ENDNOTFOUND
|
Line 1534 ENDNOTFOUND
|
# |
# |
unless ($env{'request.state'} eq 'published') { |
unless ($env{'request.state'} eq 'published') { |
if ($env{'form.editmode'} && (!($env{'form.viewmode'})) && (!($env{'form.discardview'}))) |
if ($env{'form.editmode'} && (!($env{'form.viewmode'})) && (!($env{'form.discardview'}))) |
{ |
{ |
|
my ($edit_info, $add_to_onload)= |
|
&inserteditinfo($filecontents,$filetype); |
|
|
my $displayfile=$request->uri; |
my $displayfile=$request->uri; |
$displayfile=~s/^\/[^\/]*//; |
$displayfile=~s/^\/[^\/]*//; |
my %options = (); |
my %options = |
|
('add_entries' => |
|
{'onload' => $add_to_onload, }); |
if ($env{'environment.remote'} ne 'off') { |
if ($env{'environment.remote'} ne 'off') { |
$options{'bgcolor'} = '#FFFFFF'; |
$options{'bgcolor'} = '#FFFFFF'; |
|
$options{'only_body'} = 1; |
} |
} |
my $start_page = &Apache::loncommon::start_page(undef,undef, |
my $js = &Apache::edit::js_change_detection(); |
|
my $start_page = &Apache::loncommon::start_page(undef,$js, |
\%options); |
\%options); |
$result=$start_page. |
$result=$start_page. |
&Apache::lonxml::message_location().'<h3>'. |
&Apache::lonxml::message_location().'<h3>'. |
$displayfile. |
$displayfile. |
'</h3>'.&Apache::loncommon::end_page(); |
'</h3>'. |
$result=&inserteditinfo($result,$filecontents,$filetype); |
$edit_info. |
|
&Apache::loncommon::end_page(); |
} |
} |
} |
} |
if ($filetype eq 'html') { &writeallows($request->uri); } |
if ($filetype eq 'html') { &writeallows($request->uri); } |
|
|
|
|
&Apache::lonxml::add_messages(\$result); |
&Apache::lonxml::add_messages(\$result); |
$request->print($result); |
$request->print($result); |