[LON-CAPA-cvs] cvs: loncom /interface lonhtmlcommon.pm lonparmset.pm
raeburn
raeburn@source.lon-capa.org
Fri, 06 Nov 2009 18:32:43 -0000
raeburn Fri Nov 6 18:32:43 2009 EDT
Modified files:
/loncom/interface lonparmset.pm lonhtmlcommon.pm
Log:
lonhtmlcommon.pm
&topic_bar()
- Revert to two args to retain functionality in exiting calls to this routine.
- Only include img tag in output if first arg is an integer in range 1 to 9.
lonparmset.pm
- Coding style
- calls to subs: no space between routine name and parens containg args.
- Pass null as first arg in call to &lonhtmlcommon::topic_bar() where number (image) not wanted.
Index: loncom/interface/lonparmset.pm
diff -u loncom/interface/lonparmset.pm:1.478 loncom/interface/lonparmset.pm:1.479
--- loncom/interface/lonparmset.pm:1.478 Fri Nov 6 10:14:12 2009
+++ loncom/interface/lonparmset.pm Fri Nov 6 18:32:42 2009
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Handler to set parameters for assessments
#
-# $Id: lonparmset.pm,v 1.478 2009/11/06 10:14:12 amueller Exp $
+# $Id: lonparmset.pm,v 1.479 2009/11/06 18:32:42 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -2197,7 +2197,7 @@
# Display Unit 1 "General Parameters"
if (!$pssymb) {
- $r->print(&Apache::lonhtmlcommon::topic_bar (1,&mt('Resource Specification')));
+ $r->print(&Apache::lonhtmlcommon::topic_bar(1,&mt('Resource Specification')));
$r->print(<<COURSECONTENTSCRIPT);
<script type="text/javascript">
// <![CDATA[
@@ -2228,9 +2228,9 @@
$r->print(&Apache::lonhtmlcommon::end_pick_box());
$r->print('</div>');
#Display Unit 2 "Select Parameter"
- $r->print(&Apache::lonhtmlcommon::topic_bar (2,&mt('Parameter Specification')));
+ $r->print(&Apache::lonhtmlcommon::topic_bar(2,&mt('Parameter Specification')));
&displaymenu($r,\%allparms,\%allparts,\@pscat,\@psprt,\%keyorder);
- $r->print(&Apache::lonhtmlcommon::topic_bar (3,&mt('User Specification (optional)')));
+ $r->print(&Apache::lonhtmlcommon::topic_bar(3,&mt('User Specification (optional)')));
} else {
# parameter screen for a single resource.
my ($map,$id,$resource)=&Apache::lonnet::decode_symb($pssymb);
@@ -2239,7 +2239,7 @@
'<input type="hidden" value="'.$pssymb.'" name="symb" />'.
'<br /><label><b>'.&mt('Show all parts').': <input type="checkbox" name="psprt" value="all"'.
($env{'form.psprt'}?' checked="checked"':'').' /></b></label><br />');
- $r->print(&Apache::lonhtmlcommon::topic_bar (3,&mt('User Specification (optional)'),'no_number'));
+ $r->print(&Apache::lonhtmlcommon::topic_bar('',&mt('User Specification (optional)')));
}
$r->print(&Apache::lonhtmlcommon::start_pick_box());
&usermenu($r,$uname,$id,$udom,$csec,$cgroup,$parmlev,\@usersgroups);
Index: loncom/interface/lonhtmlcommon.pm
diff -u loncom/interface/lonhtmlcommon.pm:1.239 loncom/interface/lonhtmlcommon.pm:1.240
--- loncom/interface/lonhtmlcommon.pm:1.239 Fri Nov 6 10:14:12 2009
+++ loncom/interface/lonhtmlcommon.pm Fri Nov 6 18:32:42 2009
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# a pile of common html routines
#
-# $Id: lonhtmlcommon.pm,v 1.239 2009/11/06 10:14:12 amueller Exp $
+# $Id: lonhtmlcommon.pm,v 1.240 2009/11/06 18:32:42 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -1815,25 +1815,22 @@
# topic_bar
#
-# Generates a div containing a numbered (static image) followed by a title
-# with a background color defined in the corresponding CSS: LC_topic_bar
-#
+# Generates a div containing an (optional) numbered (static) image followed by a
+# title with a background color defined in the corresponding CSS: LC_topic_bar
+# Inputs:
+# 1. number to display (corresponding static image should exist).
+# img tag will be included if arg is an integer in the range 1 to 9.
+# 2. title text to display.
+# Outputs - a scalar containing html mark-up for the div.
+
sub topic_bar {
- my ($imgnum,$title, $show_number) = @_;
- my $output = undef;
- if (!$show_number) {
- $output = '<div class="LC_topic_bar">'
- .'<img src="/res/adm/pages/bl_step'.$imgnum.'.gif"'
- .' alt="'.&mt('Step [_1]',$imgnum).'" />'
- .' '.$title
- .'</div>';
- } else {
- $output = '<div class="LC_topic_bar">'
- .$title
- .'</div>';
+ my ($imgnum,$title) = @_;
+ my $imgtag;
+ if ($imgnum =~ /^[1-9]$/) {
+ $imgtag = '<img src="/res/adm/pages/bl_step'.$imgnum.'.gif"'.
+ ' alt="'.&mt('Step [_1]',$imgnum).'" /> ';
}
-
- return $output;
+ return '<div class="LC_topic_bar">'.$imgtag.$title.'</div>';
}
##############################################