Commit 0bbb8d79 authored by Sebastien Carrere's avatar Sebastien Carrere

Modification de Venn.pl pour utiliser un template comme on l'a fait avec les barplots

parent 6ad0bdd0
......@@ -24,61 +24,56 @@
=cut
sub CreateJsonVenn {
sub CreateJsonVenn
{
my ( $rh_sets, $out_dir, $jquery_lib, $jvenn_lib ) = @_;
my ($rh_sets, $outdir, $jquery_lib, $jvenn_lib) = @_;
my %h_param = (
'series' => [],
'displayStat' => 'true'
);
my %h_param = (
'series' => [],
'displayStat' => 'true'
);
foreach my $name ( keys %{$rh_sets} ) {
my $rh_serie = {};
$rh_serie->{"name"} = $name;
foreach my $name (keys %{$rh_sets})
{
my $rh_serie = {};
$rh_serie->{"name"} = $name;
my $ra_set = $rh_sets->{$name};
$rh_serie->{"data"} = $ra_set;
my $ra_set = $rh_sets->{$name};
$rh_serie->{"data"} = $ra_set;
push( @{ $h_param{'series'} }, $rh_serie );
push(@{$h_param{'series'}}, $rh_serie);
}
my $json = to_json( \%h_param );
if ( !-d $out_dir ) {
make_path($out_dir);
}
}
# creates the js file
my $js_file = "$out_dir/series.js";
my $json = to_json(\%h_param);
my $fh_output = &GetStreamOut($js_file);
if (!-d $outdir)
{
make_path($outdir);
}
print $fh_output
"\$(document).ready(function(){\$('#jvenn-container').jvenn(" . $json
. ");});";
# creates the js file
my $js_file = "$outdir/series.js";
my $fh_output = &GetStreamOut($js_file);
print $fh_output "\$(document).ready(function(){\$('#jvenn-container').jvenn(" . $json . ");});";
$fh_output->close();
$fh_output->close();
# creates the html file
my $html_file = "$out_dir/venn.html";
$fh_output = &GetStreamOut($html_file);
print $fh_output "<html>\n";
print $fh_output "<head>\n";
print $fh_output " <script src=\"" . $jquery_lib . "\"></script>\n";
print $fh_output " <script src=\"" . $jvenn_lib . "\"></script>\n";
print $fh_output " <script src=\"series.js\"></script>\n";
print $fh_output "</head>\n";
print $fh_output "<body>\n";
print $fh_output "<div id=\"jvenn-container\"></div><br /><br />\n";
print $fh_output "</body>\n";
print $fh_output "</html>\n";
$fh_output->close();
my $o_pp = New ParamParser("$FindBin::RealBin/../../site/cfg/site.cfg");
my $root_url = $o_pp->Get('portal_web_server') . '/' . $o_pp->Get('portal_http_root');
my $fh_html_template = &GetStreamIn("$FindBin::RealBin/../../web/templates/venn/index.html");
my $fh_html_out = &GetStreamOut("$outdir/venn.html");
while (my $line = <$fh_html_template>)
{
$line =~ s/%ROOT_URL%/$root_url/g;
print $fh_html_out $line;
}
$fh_html_out->close;
$fh_html_template->close;
return;
}
1;
......@@ -3,14 +3,10 @@
<link rel="stylesheet" type="text/css"
href="%ROOT_URL%/web/js/ext/extjs/resources/css/ext-all.css">
<link rel="stylesheet" type="text/css"
href="%ROOT_URL%/web/resources/css/banner.css">
<link rel="stylesheet" type="text/css"
href="%ROOT_URL%/web/resources/css/custom.css">
<link rel="stylesheet" type="text/css"
href="%ROOT_URL%/web/resources/icons/icons.css">
<link rel="stylesheet" type="text/css" href="%ROOT_URL%/web/js/ext/extjs/resources/css/ext-all.css">
<link rel="stylesheet" type="text/css" href="%ROOT_URL%/web/resources/css/banner.css">
<link rel="stylesheet" type="text/css" href="%ROOT_URL%/web/resources/css/custom.css">
<link rel="stylesheet" type="text/css" href="%ROOT_URL%/web/resources/icons/icons.css">
<script type="text/javascript" src="%ROOT_URL%/web/js/ext/extjs/ext-all.js"></script>
<script type="text/javascript" src="data.js"></script>
......
<html>
<head>
<link rel="stylesheet" type="text/css" href="%ROOT_URL%/web/js/ext/jquery-min.js">
<link rel="stylesheet" type="text/css" href="%ROOT_URL%/web/js/ext/jvenn-min.js">
<script type="text/javascript" src="series.js"></script>
</head>
<body>
<div id="jvenn-container"></div>
<br />
<br />
</body>
</html>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment