Apache-Wyrd
view release on metacpan or search on metacpan
Apache::DBL now relies on DBI's connect_cached connection rather
than doing its own caching
Fixed a bug in Apache::Wyrd::Interfaces::Setter where interpolated
variables were not being sorted in some _set_xxxx functions
Fixed a bug in Apache::Wyrd::Interfaces::Setter where defined undef-
equivalent but defined values were being interpreted as undefined
Apache::Wyrd::Site::GDButton now accepts a template base-image gif
or png
Apache::Wyrd::Services::Auth now allows an authentication session
to go ahead directly when the connection is on a secure port, with
some limits on passed variables
Apache::Wyrd::Services::Auth now passes through POST requests on
"DECLINED". This allows it to be used with non-wyrd applications
Documentation changes
Wyrd/Chart.pm view on Meta::CPAN
use Data::Dumper;
=pod
=head1 NAME
Apache::Wyrd::Chart - Embed Dynamically-redrawn charts in HTML
=head1 SYNOPSIS
<BASENAME::Chart img="chart.png" type="bars" height="200" width="300">
<BASENAME::Query>
select month, price
from monthly_prices
order by month
</BASENAME::Query>
</BASENAME::Chart>
=head1 DESCRIPTION
Chart-graphic Wyrd wrapping the C<GD::Graph> Module. Creates a graphic file
Wyrd/Chart.pm view on Meta::CPAN
=over
=item height, width, vspace, border, hspace
In pixels, as per IMG tag
=item src
Required - Where (document-root-relative) the graphic is to appear.
Currently must end with .png.
=back
=item GD::Graph-style attributes
See GD::Graph documentation for more details. Files are always
document-root-relative. Colors may be in GD::Graph name format or in in
HTML "#XXXXXX" format. Edge-positions are in the GD::Graph standard of UL
for Upper-Left, LL for Lower-Left, etc. 1 is the usual value for "yes" in
boolean attributes. Lists are in a whitespace-separated or comma-separated
Wyrd/Chart.pm view on Meta::CPAN
eval {$gd->trueColor(0)};
my $file = $self->{'_graphic_file'};
my $format = $self->{'_file_format'};
local $| = 1;
open OUT, "> $file" || $self->_raise_exception("Could not write file $file: $!");
binmode(OUT);
eval {
if ($format eq 'gif') {
print OUT $gd->gif();
} else {
print OUT $gd->png();
}
$self->_error($graph->error) if ($graph->error);
};
close OUT;
select OUT;
if ($@) {
$self->_error($@);
}
}
Wyrd/Chart.pm view on Meta::CPAN
$self->_raise_exception('Chart Wyrds require Query Wyrds')
unless ($self->{'sh'});
my $file = $self->{'src'};
my $root = $self->dbl->req->document_root;
if ($file) {
$file = "$root$file";
} else {
$self->_raise_exception("Chart Wyrds require a src attribute");
}
$self->_file_problems($file);
my ($format) = $file =~ /\.(png|gif)$/i;
unless ($format) {
$self->_raise_exception('Only PNG or GIF file format is supported');
}
$self->{'_graphic_file'} = $file;
$self->{'_file_format'} = lc($format);
my $datafile = $file;
$datafile =~ s/\.$format/\.tdf/;
$self->_file_problems($datafile);
$self->{'_data_file'} = $datafile;
my $data = $self->_get_data;
Wyrd/Site/GDButton.pm view on Meta::CPAN
=head2 HTML ATTRIBUTES
=over
=item src
File attribute. Must be absolute, relative, or root-dir-relative. Will
seek through those options to find a writeable location and set the HTML
attribute of the same to reflect the location of the output file. This file
must end in either .png or .gif. The format of the output file will be
determined by this file extension.
=item template
What file to use as a base image for this button. It is located in the same way
the src file is. The file can be a GIF or PNG file (it will need to have the
right file extension of .gif or .png, case insensitive). The template file is
copied to memory and then written to the file area indicated by the src
attribute.
=item width, height
(required w/o template) in pixels.
=item bgcolor, color
(required w/o template) background and foreground color, in six-digit hex form
Wyrd/Site/GDButton.pm view on Meta::CPAN
GD::Image->trueColor(1);
my $changed = ($self->widgetindex->update_entry($self) or not(-f $self->{'outfile'}));
if ($changed) {
my $antialias = 1;
$antialias = -1 if ($self->_flags->noantialias);
#prep the background and allocate the foreground
my ($image, $base_image) = ();
my $template = $self->{'template'};
if ($template) {
my $type = $self->{'template'} =~ /\.(png|gif)/i;
unless ($type) {
$self->_raise_exception('template base image must be PNG or GIF.');
}
if (lc($type) eq 'gif') {
$base_image = GD::Image->newFromGif($template);
} else {
$base_image = GD::Image->newFromPng($template);
}
my $width = $self->{'width'} = $base_image->width;
my $width = $self->{'height'} = $base_image->height;
Wyrd/Site/GDButton.pm view on Meta::CPAN
#Then render the actual text using the calculated start point.
my @bounds = $image->stringFT($antialias * $fg, $self->{'font'}, $self->{'size'} * 5, 0, $x, $y, $self->{'text'}, {resolution => "72,72", kerning => 1});
#Shrink it down to 1/5 the rendered size.
my $final = GD::Image->new($self->{'width'}, $self->{'height'});
$final->copyResampled($image, 0, 0, 0, 0, $self->{'width'}, $self->{'height'}, $self->{'width'} * 5, $self->{'height'} * 5);
open FILE, "> " . $self->{'outfile'};
binmode FILE;
print FILE ($self->{'outfile'}=~/gif$/) ? $final->gif : $final->png;
close FILE;
}
#attempt to preserve any normal IMG or INPUT attributes
my @attrs = qw(name id action method alt src align onmouseover onmouseout onclick border height width ismap longdesc usemap class style);
my %attrs = map {$_ => $self->{$_}} @attrs;
$attrs{'src'} = Apache::Util::escape_uri($attrs{'src'});
if ($self->{'type'} eq 'input') {
$self->_data(q(<input type="image") . $self->_attribute_template(@attrs) . q(>));
} else {#consider anything else as an image tag.
( run in 2.190 seconds using v1.01-cache-2.11-cpan-df04353d9ac )