[LON-CAPA-cvs] cvs: loncom /interface loncommon.pm

matthew lon-capa-cvs@mail.lon-capa.org
Tue, 09 Nov 2004 19:51:44 -0000


matthew		Tue Nov  9 14:51:44 2004 EDT

  Modified files:              
    /loncom/interface	loncommon.pm 
  Log:
  DrawBarGraph: If the final parameter to the subroutine is a hash reference
  the key/value pairs are passed directly to the graphing routine.
  
  
Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.227 loncom/interface/loncommon.pm:1.228
--- loncom/interface/loncommon.pm:1.227	Mon Nov  8 17:50:37 2004
+++ loncom/interface/loncommon.pm	Tue Nov  9 14:51:43 2004
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # a pile of common routines
 #
-# $Id: loncommon.pm,v 1.227 2004/11/08 22:50:37 albertel Exp $
+# $Id: loncommon.pm,v 1.228 2004/11/09 19:51:43 matthew Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -3291,6 +3291,10 @@
                   '#66ccff', '#ff9999', '#cccc33', '#660000', '#33cc66',
                   ]; 
     }
+    my $extra_settings = {};
+    if (ref($Values[-1]) eq 'HASH') {
+        $extra_settings = pop(@Values);
+    }
     #
     my $identifier = &get_cgi_id();
     my $id = 'cgi.'.$identifier;        
@@ -3366,6 +3370,11 @@
     $ValuesHash{$id.'.bar_width'} = $bar_width;
     $ValuesHash{$id.'.labels'} = join(',',@Labels);
     #
+    # Deal with other parameters
+    while (my ($key,$value) = each(%$extra_settings)) {
+        $ValuesHash{$id.'.'.$key} = $value;
+    }
+    #
     &Apache::lonnet::appenv(%ValuesHash);
     return '<img src="/cgi-bin/graph.png?'.$identifier.'" border="1" />';
 }