[LON-CAPA-cvs] cvs: loncom /xml lonxml.pm
albertel
lon-capa-cvs-allow@mail.lon-capa.org
Sat, 18 Aug 2007 00:08:37 -0000
albertel Fri Aug 17 20:08:37 2007 EDT
Modified files:
/loncom/xml lonxml.pm
Log:
- apply to auto-resizing changes to the edit of html pages in CSTR too
Index: loncom/xml/lonxml.pm
diff -u loncom/xml/lonxml.pm:1.451 loncom/xml/lonxml.pm:1.452
--- loncom/xml/lonxml.pm:1.451 Fri Aug 17 17:24:21 2007
+++ loncom/xml/lonxml.pm Fri Aug 17 20:08:36 2007
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# XML Parser Module
#
-# $Id: lonxml.pm,v 1.451 2007/08/17 21:24:21 albertel Exp $
+# $Id: lonxml.pm,v 1.452 2007/08/18 00:08:36 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -1355,12 +1355,14 @@
# my $editheader='<a href="#editsection">Edit below</a><hr />';
my $xml_help = '';
my $initialize='';
- my $add_to_onload;
+ my $textarea_id = 'filecont';
+ my ($add_to_onload, $add_to_onresize);
if ($filetype eq 'html') {
my $addbuttons=&Apache::lonhtmlcommon::htmlareaaddbuttons();
$initialize=&Apache::lonhtmlcommon::spellheader();
if (!&Apache::lonhtmlcommon::htmlareablocked() &&
&Apache::lonhtmlcommon::htmlareabrowser()) {
+ $textarea_id .= '_htmlarea';
$initialize.=(<<FULLPAGE);
<script type="text/javascript">
$addbuttons
@@ -1375,6 +1377,8 @@
function () {
HTMLArea._addEvents(editor._doc,
["keypress","mousedown"], unClean);
+ editor._iframe.id = '$textarea_id';
+ resize_textarea('$textarea_id','LC_aftertextarea');";
},300);
}
</script>
@@ -1384,13 +1388,16 @@
<script type="text/javascript">
$addbuttons
function initDocument() {
+ resize_textarea('$textarea_id','LC_aftertextarea');";
}
</script>
FULLPAGE
}
$add_to_onload = 'initDocument();';
+ $add_to_onresize = "resize_textarea('$textarea_id','LC_aftertextarea');";
$xml_help=&Apache::loncommon::helpLatexCheatsheet();
}
+
my $cleanbut = '';
my $titledisplay=&display_title();
@@ -1418,13 +1425,15 @@
<input type="hidden" name="editmode" value="$lt{'ed'}" />
$buttons<br />
<textarea $textarea_events style="width:100%" cols="80" rows="44" name="filecont" id="filecont">$filecontents</textarea>
+<div id="LC_aftertextarea">
<br />$buttons
<br />
-</form>
$titledisplay
+</div>
+</form>
</body>
ENDFOOTER
- return ($editfooter,$add_to_onload);;
+ return ($editfooter,$add_to_onload,$add_to_onresize);;
}
sub get_target {
@@ -1535,19 +1544,23 @@
unless ($env{'request.state'} eq 'published') {
if ($env{'form.editmode'} && (!($env{'form.viewmode'})) && (!($env{'form.discardview'})))
{
- my ($edit_info, $add_to_onload)=
+ my ($edit_info, $add_to_onload, $add_to_onresize)=
&inserteditinfo($filecontents,$filetype);
my $displayfile=$request->uri;
$displayfile=~s/^\/[^\/]*//;
my %options =
('add_entries' =>
- {'onload' => $add_to_onload, });
+ {'onresize' => $add_to_onresize,
+ 'onload' => $add_to_onload, });
+
if ($env{'environment.remote'} ne 'off') {
$options{'bgcolor'} = '#FFFFFF';
$options{'only_body'} = 1;
}
- my $js = &Apache::edit::js_change_detection();
+ my $js =
+ &Apache::edit::js_change_detection().
+ &Apache::loncommon::resize_textarea_js();
my $start_page = &Apache::loncommon::start_page(undef,$js,
\%options);
$result=$start_page.