[LON-CAPA-cvs] cvs: loncom /interface loncommon.pm /xml scripttag.pm
www
www at source.lon-capa.org
Mon Dec 19 13:18:32 EST 2011
www Mon Dec 19 18:18:32 2011 EDT
Modified files:
/loncom/interface loncommon.pm
/loncom/xml scripttag.pm
Log:
Cleaner division of togglebox tag, so togglebox can be used in other contexts
Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.1038 loncom/interface/loncommon.pm:1.1039
--- loncom/interface/loncommon.pm:1.1038 Mon Dec 19 18:00:23 2011
+++ loncom/interface/loncommon.pm Mon Dec 19 18:18:28 2011
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# a pile of common routines
#
-# $Id: loncommon.pm,v 1.1038 2011/12/19 18:00:23 www Exp $
+# $Id: loncommon.pm,v 1.1039 2011/12/19 18:18:28 www Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -7078,6 +7078,25 @@
ENDTOGGLE
}
+sub start_togglebox {
+ my ($id,$heading,$headerbg,$hidetext,$showtext)=@_;
+ unless ($heading) { $heading=''; } else { $heading.=' '; }
+ unless ($showtext) { $showtext=&mt('show'); }
+ unless ($hidetext) { $hidetext=&mt('hide'); }
+ unless ($headerbg) { $headerbg='#FFFFFF'; }
+ return &start_data_table().
+ &start_data_table_header_row().
+ '<td bgcolor="'.$headerbg.'">'.$heading.
+ '[<a id="'.$id.'link" href="javascript:LCtoggleDisplay(\''.$id.'\',\''.$hidetext.'\',\''.
+ $showtext.'\')">'.$showtext.'</a>]</td>'.
+ &end_data_table_header_row().
+ '<tr id="'.$id.'" style="display:none""><td>';
+}
+
+sub end_togglebox {
+ return '</td></tr>'.&end_data_table();
+}
+
sub modal_adhoc_window {
my ($funcname,$width,$height,$content,$linktext)=@_;
my $innerwidth=$width-20;
Index: loncom/xml/scripttag.pm
diff -u loncom/xml/scripttag.pm:1.161 loncom/xml/scripttag.pm:1.162
--- loncom/xml/scripttag.pm:1.161 Mon Dec 19 18:00:27 2011
+++ loncom/xml/scripttag.pm Mon Dec 19 18:18:32 2011
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# <script> definiton
#
-# $Id: scripttag.pm,v 1.161 2011/12/19 18:00:27 www Exp $
+# $Id: scripttag.pm,v 1.162 2011/12/19 18:18:32 www Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -335,17 +335,9 @@
my $heading=&Apache::lonxml::get_param('heading',$parstack,$safeeval);
unless ($heading) { $heading=''; } else { $heading.=' '; }
my $showtext=&Apache::lonxml::get_param('showtext',$parstack,$safeeval);
- unless ($showtext) { $showtext=&mt('show'); }
my $hidetext=&Apache::lonxml::get_param('hidetext',$parstack,$safeeval);
- unless ($hidetext) { $hidetext=&mt('hide'); }
my $headerbg=&Apache::lonxml::get_param('headerbg',$parstack,$safeeval);
- unless ($headerbg) { $headerbg='#FFFFFF'; }
- $result=&Apache::loncommon::start_data_table().
- &Apache::loncommon::start_data_table_header_row().'<td bgcolor="'.$headerbg.'">'.$heading.
- '[<a id="'.$id.'link" href="javascript:LCtoggleDisplay(\''.$id.'\',\''.$hidetext.'\',\''.
- $showtext.'\')">'.$showtext.'</a>]</td>'.
- &Apache::loncommon::end_data_table_header_row().
- '<tr id="'.$id.'" style="display:none""><td>';
+ $result=&Apache::loncommon::start_togglebox($id,$heading,$headerbg,$hidetext,$showtext);
} elsif ($target eq 'tex') {
my $heading=&Apache::lonxml::get_param('heading',$parstack,$safeeval);
unless ($heading) { $heading=''; } else { $heading.=' '; }
@@ -371,7 +363,7 @@
my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;
my $result;
if ($target eq 'web' || $target eq 'webgrade') {
- $result='</td></tr>'.&Apache::loncommon::end_data_table();
+ $result=&Apache::loncommon::end_togglebox();
} elsif ($target eq 'tex') {
$result = "}\n\n";
} else {
More information about the LON-CAPA-cvs
mailing list