[LON-CAPA-cvs] cvs: loncom(version_2_11_X) /interface lontemplate.pm
raeburn
raeburn at source.lon-capa.org
Fri May 10 19:48:12 EDT 2013
raeburn Fri May 10 23:48:12 2013 EDT
Modified files: (Branch: version_2_11_X)
/loncom/interface lontemplate.pm
Log:
- For 2.11
- Backport 1.47, 1.48, 1.49, 1.50.
Index: loncom/interface/lontemplate.pm
diff -u loncom/interface/lontemplate.pm:1.45.6.3 loncom/interface/lontemplate.pm:1.45.6.4
--- loncom/interface/lontemplate.pm:1.45.6.3 Tue Dec 18 15:53:07 2012
+++ loncom/interface/lontemplate.pm Fri May 10 23:48:12 2013
@@ -1,7 +1,7 @@
# The LearningOnline Network
# "Template" Functions to generate html output
#
-# $Id: lontemplate.pm,v 1.45.6.3 2012/12/18 15:53:07 raeburn Exp $
+# $Id: lontemplate.pm,v 1.45.6.4 2013/05/10 23:48:12 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -114,8 +114,12 @@
}
sub print_start_template {
- my ($r,$topic,$boxclass) = @_;
- $r->print('<div class="'.$boxclass.'">');
+ my ($r,$topic,$boxclass,$id,$display) = @_;
+ my $idattrib;
+ if ($id ne '') {
+ $idattrib = ' id="'.$id.'"';
+ }
+ $r->print('<div class="'.$boxclass.'"'.$idattrib.$display.'>');
$r->print('<h4 class="LC_hcell">'.$topic.'</h4>');
}
@@ -145,16 +149,27 @@
}
sub print_template_fields {
- my ($r, $data_ref, $fields_ref, $target, $allowed, $default_rich_text, $custom_handlers_ref, $group) = @_;
+ my ($r, $data_ref, $fields_ref, $target, $allowed, $default_rich_text, $custom_handlers_ref, $group,
+ $displayref,$noshowref) = @_;
my @html_ids = ();
my %data = %{$data_ref};
my %fields = %{$fields_ref};
my %custom_handlers = %{$custom_handlers_ref};
-
+ my (%displays,%noshow);
+ if (ref($displayref) eq 'HASH') {
+ %displays = %{$displayref};
+ }
+ if (ref($noshowref) eq 'HASH') {
+ %noshow = %{$noshowref};
+ }
foreach my $field (sort(keys(%fields))) {
my $message = $data{$field} if (($data{$field}=~/\w/) || ($allowed));
+ my $display = $displays{$field};
+ unless ($allowed) {
+ next if ($noshow{$field});
+ }
if ((%custom_handlers) && ($custom_handlers{$field})) {
- $custom_handlers{$field}->($r, $field, $message, $group, $data_ref, $fields_ref, $target, $allowed);
+ $custom_handlers{$field}->($r, $field, $message, $group, $data_ref, $fields_ref, $target, $allowed, $display);
} else {
if (($data{$field}=~/\w/) || ($allowed)) {
if (!&Apache::lonfeedback::contains_block_html($message)) {
@@ -169,7 +184,7 @@
$message=&Apache::lontexconvert::msgtexconverted($message);
if ($target ne 'tex') {
#output of syllabusfields will be generated here.
- &Apache::lontemplate::print_start_template($r,$fields{$field},'LC_Box');
+ &Apache::lontemplate::print_start_template($r,$fields{$field},'LC_Box','box_'.$field,$display);
$r->print($message);
if ($allowed) {
$r->print("<br /><div>");
More information about the LON-CAPA-cvs
mailing list