Skip to content

Commit

Permalink
put the generated faceted_browsing.html in the output data directory …
Browse files Browse the repository at this point in the history
…next to faceted_browsing.json, rather than in the jbrowse root
  • Loading branch information
rbuels committed Jan 11, 2012
1 parent 33b3799 commit 8c7ce12
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 22 deletions.
10 changes: 6 additions & 4 deletions bin/setup-faceted-browsing.pl
@@ -1,10 +1,11 @@
#!/usr/bin/env perl

use strict;
use warnings;

use Cwd 'realpath';
use FindBin qw($Bin);
use lib "$Bin/../lib";
use File::Spec;

use Getopt::Long;
use JsonGenerator;
Expand Down Expand Up @@ -99,10 +100,11 @@
}
}

my $template = HTML::Template->new(filename => 'faceted_browsing.tmpl');
my $template = HTML::Template->new(filename => "$Bin/../faceted_browsing.tmpl");

$template->param( BROWSING_FACETES => \@facetes, JSON_PATH => "$outdir/faceted_browsing.json" );
my $rel_basedir = File::Spec->abs2rel( realpath("$Bin/.."), $outdir );
$template->param( BROWSING_FACETES => \@facetes, REL_BASEDIR => "$rel_basedir/" );

open(my $out_file, ">faceted_browsing.html");
open(my $out_file, ">", "$outdir/faceted_browsing.html");
print $out_file $template->output;

12 changes: 6 additions & 6 deletions faceted_browsing.tmpl
Expand Up @@ -6,16 +6,16 @@

<head>
<title>JBrowse</title>
<link rel="stylesheet" type="text/css" href="genome.css"></link>
<link rel="stylesheet" type="text/css" href="faceted.css"></link>
<link rel="stylesheet" type="text/css" href="<TMPL_VAR NAME=REL_BASEDIR>genome.css"></link>
<link rel="stylesheet" type="text/css" href="<TMPL_VAR NAME=REL_BASEDIR>faceted.css"></link>
<style type="text/css">
html, body { height: 100%; width: 100%; padding: 0; border: 0; }
</style>
<link href="<TMPL_VAR NAME=JSON_PATH>" type="application/json" rel="exhibit/data"/>
<link rel='stylesheet' href='http://www.simile-widgets.org/styles/common.css' type='text/css' />
<link href="faceted_browsing.json" type="application/json" rel="exhibit/data"/>
<link rel="stylesheet" href="http://www.simile-widgets.org/styles/common.css" type="text/css" />
<script src="http://api.simile-widgets.org/exhibit/2.2.0/exhibit-api.js" type="text/javascript"></script>
<script src="prototype.js" type="text/javascript"></script>
<script src="js/Faceted.js" type="text/javascript"></script>
<script src="<TMPL_VAR NAME=REL_BASEDIR>prototype.js" type="text/javascript"></script>
<script src="<TMPL_VAR NAME=REL_BASEDIR>js/Faceted.js" type="text/javascript"></script>
</head>

<body>
Expand Down
14 changes: 6 additions & 8 deletions js/Browser.js
Expand Up @@ -54,12 +54,10 @@ var Browser = function(params) {
var refSeqs = params.refSeqs;
var trackData = params.trackData;
this.deferredFunctions = [];
this.dataRoot = params.dataRoot;
var dataRoot;
if ("dataRoot" in params)
dataRoot = params.dataRoot;
else
dataRoot = "";
var dataRoot = params.dataRoot || "";
//no trailing slashes on dataRoot
dataRoot.replace(/\/+$/,"");
this.dataRoot = dataRoot;

this.names = new LazyTrie(dataRoot + "/names/lazy-",
dataRoot + "/names/root.json");
Expand Down Expand Up @@ -856,7 +854,7 @@ Browser.prototype.createTrackList = function(parent, params) {

// faceted browisng page runs from an iframe
facetedIframe = document.createElement("iframe");
facetedIframe.src = "faceted_browsing.html";
facetedIframe.src = dataRoot + "/faceted_browsing.html";
facetedIframe.setAttribute("name","browsing_window");
facetedIframe.setAttribute("frameborder","0");
facetedIframe.height = "100%";
Expand Down Expand Up @@ -1197,7 +1195,7 @@ Browser.prototype.createTrackList = function(parent, params) {
{
changeCallback: changeCallback,
trackPadding: brwsr.view.trackPadding,
baseUrl: brwsr.dataRoot,
baseUrl: brwsr.dataRoot + "/",
charWidth: brwsr.view.charWidth,
seqHeight: brwsr.view.seqHeight
});
Expand Down
8 changes: 4 additions & 4 deletions test_harness.html
Expand Up @@ -57,12 +57,12 @@

// load the proper refSeqs and trackInfo based on the data path passed as a query arg
var dataRoot = queryParams.data || 'data';
if( ! dataRoot.match(/\/$/) ) dataRoot = dataRoot + '/';
dataRoot.replace(/\/+$/,""); //trim off any trailing slashes

var conf_url = queryParams.conf || 'conf.js';
dojo.forEach( [ dataRoot + 'refSeqs.js',
dataRoot + 'trackInfo.js',
dataRoot + 'overviewTrackInfo.js',
dojo.forEach( [ dataRoot + '/refSeqs.js',
dataRoot + '/trackInfo.js',
dataRoot + '/overviewTrackInfo.js',
conf_url
],
function(file) {
Expand Down

0 comments on commit 8c7ce12

Please sign in to comment.