--- loncom/interface/loncommon.pm 2003/10/15 21:12:24 1.129
+++ loncom/interface/loncommon.pm 2003/10/24 13:35:37 1.134
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# a pile of common routines
#
-# $Id: loncommon.pm,v 1.129 2003/10/15 21:12:24 matthew Exp $
+# $Id: loncommon.pm,v 1.134 2003/10/24 13:35:37 matthew Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -2663,7 +2663,7 @@ $uname, optional the username of the use
sub check_if_partid_hidden {
my ($id,$symb,$udom,$uname) = @_;
- my $hiddenparts=&Apache::lonnet::EXT('resource.0.parameter_hiddenparts',
+ my $hiddenparts=&Apache::lonnet::EXT('resource.0.hiddenparts',
$symb,$udom,$uname);
my @hiddenlist=split(/,/,$hiddenparts);
foreach my $checkid (@hiddenlist) {
@@ -2677,17 +2677,23 @@ sub check_if_partid_hidden {
=pod
-=item DrawGraph
+=item DrawBarGraph
-Returns a link to cgi-bin/graph
=cut
############################################################
############################################################
-sub DrawGraph {
+sub DrawBarGraph {
my ($Title,$xlabel,$ylabel,$Max,$colors,@Values)=@_;
#
+ if (! defined($colors)) {
+ $colors = ['#33ff00',
+ '#0033cc', '#990000', '#aaaa66', '#663399', '#ff9933',
+ '#66ccff', '#ff9999', '#cccc33', '#660000', '#33cc66',
+ ];
+ }
+ #
my $identifier = time.'_'.int(rand(1000));
if (! @Values || ref($Values[0]) ne 'ARRAY') {
return '';
@@ -2697,7 +2703,8 @@ sub DrawGraph {
my $NumSets=1;
foreach my $array (@Values) {
next if (! ref($array));
- $ValuesHash{$identifier.'.data.'.$NumSets++} = join(',',@$array);
+ $ValuesHash{'cgi.'.$identifier.'.data.'.$NumSets++} =
+ join(',',@$array);
}
#
$Title = '' if (! defined($Title));
@@ -2713,15 +2720,15 @@ sub DrawGraph {
$Max = int($Max);
}
#
- &Apache::lonnet::appenv($identifier.'.title' => $Title,
- $identifier.'.xlabel' => $xlabel,
- $identifier.'.ylabel' => $ylabel,
- $identifier.'.Max' => $Max,
- $identifier.'.NumBars' => $NumBars,
- $identifier.'.NumSets' => $NumSets,
- $identifier.'.Colors' => join(',',@{$colors}),
+ &Apache::lonnet::appenv('cgi.'.$identifier.'.title' => $Title,
+ 'cgi.'.$identifier.'.xlabel' => $xlabel,
+ 'cgi.'.$identifier.'.ylabel' => $ylabel,
+ 'cgi.'.$identifier.'.Max' => $Max,
+ 'cgi.'.$identifier.'.NumBars' => $NumBars,
+ 'cgi.'.$identifier.'.NumSets' => $NumSets,
+ 'cgi.'.$identifier.'.Colors' => join(',',@{$colors}),
%ValuesHash);
- return '
';
+ return '
';
}
############################################################