[Bps-public-commit] r11271 - WebChart/lib

sunnavy at bestpractical.com sunnavy at bestpractical.com
Sun Mar 30 10:38:58 EDT 2008


Author: sunnavy
Date: Sun Mar 30 10:38:58 2008
New Revision: 11271

Modified:
   WebChart/lib/WebChart.pm

Log:
we have nearly complete config dir stuff now

Modified: WebChart/lib/WebChart.pm
==============================================================================
--- WebChart/lib/WebChart.pm	(original)
+++ WebChart/lib/WebChart.pm	Sun Mar 30 10:38:58 2008
@@ -10,7 +10,9 @@
 use base qw/Class::Accessor::Fast/;
 
 __PACKAGE__->mk_accessors(
-    qw/renderer img_dir web_img_dir css_class width height/);
+    qw/renderer img_dir web_img_dir xml_dir web_xml_dir web_js_dir
+      web_flash_dir web_css_dir css_class width height/
+);
 
 =head2 new
 
@@ -54,16 +56,27 @@
     $renderer->require or die "can't require $renderer: $!";
     $self->renderer( $renderer->new );
 
-    my $img_dir = $args{img_dir};
-
-    unless ($img_dir) {
-        require File::Spec;
-        $img_dir = File::Spec->tmpdir();
+    for (qw/img_dir xml_dir/) {
+        my $dir = $args{$_};
+        unless ($dir) {
+            require File::Spec;
+            $dir = File::Spec->tmpdir();
+        }
+        $self->$_($dir);
     }
 
-    $self->img_dir($img_dir);
+    my %web_default_dir = (
+        img   => '/charts',
+        css   => '/css',
+        js    => '/js',
+        flash => '/flash',
+        xml   => '/xml',
+    );
 
-    $self->web_img_dir( $args{web_img_dir} || '/charts' );
+    for ( keys %web_default_dir ) {
+        my $name = 'web_' . $_ . '_dir';
+        $self->$name( $args{$name} || $web_default_dir{$_} );
+    }
 
     $self->css_class( $args{css_class} );
     $self->width( $args{width}   || 400 );
@@ -91,8 +104,9 @@
     return $self->renderer->render(
         (
             map { $_ => $self->$_ } (
-                qw/img_dir web_img_dir css_class width
-                  height/
+                qw/img_dir css_class width height xml_dir
+                  web_img_dir web_js_dir web_flash_dir
+                  web_xml_dir web_css_dir/
             )
         ),
         @_,



More information about the Bps-public-commit mailing list