Skip to content

Commit

Permalink
Item10044: read attachment using Foswiki::Func::readAttachment()
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.foswiki.org/trunk/PhyloWidgetPlugin@10126 0b4bb1d4-4e5a-0410-9cc4-b2b747904278
  • Loading branch information
TemiVarghese authored and TemiVarghese committed Dec 1, 2010
1 parent 6e10d92 commit 5bf2a5d
Showing 1 changed file with 19 additions and 9 deletions.
28 changes: 19 additions & 9 deletions lib/Foswiki/Plugins/PhyloWidgetPlugin.pm
Original file line number Diff line number Diff line change
Expand Up @@ -179,23 +179,30 @@ sub initPlugin {
return 1;
}
sub LISTNEXUSTREES{
my($session, $params, $topic, $web, $topicObject) = @_;
my($session, $params, $Atopic, $Aweb, $topicObject) = @_;
my @format = ();
my $url = getAttachUrl('',$params->{'_DEFAULT'},$params->{'attachment'});
my $web;
my $topic;
my $attachment = $params->{'attachment'};
my $content;

($web,$topic) = Foswiki::Func::normalizeWebTopicName('',$params->{'_DEFAULT'});
$content = Foswiki::Func::readAttachment($web,$topic,$attachment);
# my $url = Foswiki::Func::getUrlHost()."$pubUrlPath/$topic/$attachment";
# my $url = Foswiki::Func::getUrlHost()."$pubUrlPath//$web/$topic/$attachment";
my $ua = LWP::UserAgent->new();
my $response = $ua->get("$url");
# my $ua = LWP::UserAgent->new();
# my $response = $ua->get("$url");
my $nexus = Bio::NEXUS->new();
# my $separator = $params->{separator};

# use Data::Dumper;
# return "<h1>Phylowidget! :)</h1><pre>" . Dumper($requestObject->param()) . '</pre>';
# return $url;
# my $str='';
if ($response->is_success)
if ($content)
{
$nexus->read({format => 'string','param' => $response->content}); # or whatever\
$nexus->read({format => 'string','param' => $content}); # or whatever\
my @trees = @{$nexus->get_block("trees")->get_trees()};
my $treeNumber = $#trees;
# $str = "$treeNumber :: ";
Expand Down Expand Up @@ -252,16 +259,19 @@ sub getNHXfromNEX{
my $url = getAttachUrl($web,$topic,$attachment);
# my $url = Foswiki::Func::getUrlHost()."$pubUrlPath/$topic/$attachment";
# my $url = Foswiki::Func::getUrlHost()."$pubUrlPath//$web/$topic/$attachment";
my $ua = LWP::UserAgent->new();
my $response = $ua->get("$url");
# my $ua = LWP::UserAgent->new();
# my $response = $ua->get("$url");
my $nexus = Bio::NEXUS->new();
my $atree ;
my $content;

$content = Foswiki::Func::readAttachment($web,$topic,$attachment);
# use Data::Dumper;
# return "<h1>Phylowidget! :)</h1><pre>" . Dumper($requestObject->param()) . '</pre>';
# return $url;
if ($response->is_success)
if ($content)
{
$nexus->read({format => 'string','param' => $response->content}); # or whatever
$nexus->read({format => 'string','param' => $content}); # or whatever
# return @{$nexus->get_block("trees")->get_trees()}[$tree]->as_string();
# try{
eval { $atree = @{$nexus->get_block("trees")->get_trees()}[$tree]->as_string();} or croak return "ERROR: Index out of range.";
Expand Down

0 comments on commit 5bf2a5d

Please sign in to comment.