# HG changeset patch # User df # Date 1232894437 0 # Node ID ccd5e74fa58e7609ee58e5cf3af2f374b1773ef0 # Parent e30154411e6334987d4f140f91e9ec9c582b2833 Untested xml import of prices from evecentral. solution is a dead end, as the rammsrdi.com dont support dom xlm. diff -r e30154411e63 -r ccd5e74fa58e reproctool.cgi --- a/reproctool.cgi Sun Jan 25 12:31:34 2009 +0000 +++ b/reproctool.cgi Sun Jan 25 14:40:37 2009 +0000 @@ -5,6 +5,7 @@ use CGI; use DBI; +use XML::DOM; # Settings my $img_http_path = '/itemimgs'; @@ -14,19 +15,71 @@ -pragma => 'no-cache', -expires => '-365d'); +# Generate the first page, where eve-central mineral prices are prefilled. +# TODO: depending on the traffic, cache these eve-central prices. +my $str_items; +if (! ($str_items = $cgi->param('items')) ) +{ + my $min; + my $eveCentralURL = 'http://eve-central.com/api/evemon'; + my $xmlParser = XML::DOM::Parser->new(); + my $xmlDoc = $xmlParser->parsefile($eveCentralURL); + + # What evenutally will be printed. + my $inputPage = < + + +
+ + + +END + # Lists the name of the minerals. + foreach $min ($xmlDoc->getElementsByTagName('mineral')) + { + $inputPage .= sprintf( " \n", + $min->getElementsByTagName('name')->item(0)->getFirstChild->getNodeValue ); + } + +$inputPage .= < + +END + foreach $min ($xmlDoc->getElementsByTagName('mineral')) + { + $inputPage .= sprintf( " \n", + $min->getElementsByTagName('name')->item(0)->getFirstChild->getNodeValue, + $min->getElementsByTagName('price')->item(0)->getFirstChild->getNodeValue ); + } + + $inputPage .= < +
%s
+ +
+ + + +END + + print $inputPage; + exit 0; +} + # Inputs -my $str_items = $cgi->param('items') or die('Items missing'); my $cols = $cgi->param('cols') || 4; -# Load mineral prices -my $trit = $cgi->param('trit') || die('No trit price'); -my $pyer = $cgi->param('pyer') || die('No pyer price'); -my $mexa = $cgi->param('mexa') || die('No mexa price'); -my $isog = $cgi->param('isog') || die('No isog price'); -my $nocx = $cgi->param('nocx') || die('No nocx price'); -my $zydr = $cgi->param('zydr') || die('No zydr price'); -my $mega = $cgi->param('mega') || die('No mega price'); -my $morp = $cgi->param('morp') || die('No morp price'); +# Load mineral prices (names are generated above, but i feel +# it's safe to assume they wont change that often). +my $trit = $cgi->param('Tritanium') || die('No trit price'); +my $pyer = $cgi->param('Pyerite') || die('No pyer price'); +my $mexa = $cgi->param('Mexallon') || die('No mexa price'); +my $isog = $cgi->param('Isogen') || die('No isog price'); +my $nocx = $cgi->param('Nocxium') || die('No nocx price'); +my $zydr = $cgi->param('Zydrine') || die('No zydr price'); +my $mega = $cgi->param('Megacyte') || die('No mega price'); +my $morp = $cgi->param('Morphite') || die('No morp price'); our @dbparams; require './dbparams.cgi';