galaxy-commits
Threads by month
- ----- 2026 -----
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- 15302 discussions
23 Jan '15
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/443f25d46082/
Changeset: 443f25d46082
User: guerler
Date: 2015-01-23 20:15:31+00:00
Summary: Upload: Remove spaces
Affected #: 2 files
diff -r 669da7067315a6ce236a2ee753e9af6264279c01 -r 443f25d4608260ee699cf125166d76df003d2ef9 client/galaxy/scripts/mvc/upload/upload-ftp.js
--- a/client/galaxy/scripts/mvc/upload/upload-ftp.js
+++ b/client/galaxy/scripts/mvc/upload/upload-ftp.js
@@ -122,13 +122,13 @@
size : ftp_file.size,
path : ftp_file.path
}]);
-
+
// add new icon class
$icon.addClass(self.options.class_remove);
} else {
// remove
self.app.collection.remove(model_index);
-
+
// add new icon class
$icon.addClass(self.options.class_add);
}
diff -r 669da7067315a6ce236a2ee753e9af6264279c01 -r 443f25d4608260ee699cf125166d76df003d2ef9 static/scripts/mvc/upload/upload-ftp.js
--- a/static/scripts/mvc/upload/upload-ftp.js
+++ b/static/scripts/mvc/upload/upload-ftp.js
@@ -122,13 +122,13 @@
size : ftp_file.size,
path : ftp_file.path
}]);
-
+
// add new icon class
$icon.addClass(self.options.class_remove);
} else {
// remove
self.app.collection.remove(model_index);
-
+
// add new icon class
$icon.addClass(self.options.class_add);
}
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
commit/galaxy-central: jmchilton: Merged in nsoranzo/galaxy-central (pull request #646)
by commits-noreply@bitbucket.org 23 Jan '15
by commits-noreply@bitbucket.org 23 Jan '15
23 Jan '15
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/669da7067315/
Changeset: 669da7067315
User: jmchilton
Date: 2015-01-23 20:12:24+00:00
Summary: Merged in nsoranzo/galaxy-central (pull request #646)
Update rolling_restart.sh to treat .venv dir and GALAXY_CONFIG_FILE env variable as run.sh
Affected #: 2 files
diff -r de9bd9d7d47bfcdf45f3f170be391874b79e738f -r 669da7067315a6ce236a2ee753e9af6264279c01 rolling_restart.sh
--- a/rolling_restart.sh
+++ b/rolling_restart.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
cd `dirname $0`
check_if_not_started(){
@@ -8,7 +8,7 @@
current_pid_in_file=$(cat $2);
# If they're equivalent, then the current pid file agrees with our logs
# and we've succesfully started
- if [[ $latest_pid -eq $current_pid_in_file ]];
+ if [ $latest_pid -eq $current_pid_in_file ];
then
echo 0;
else
@@ -16,17 +16,29 @@
fi
}
+# If there is a .venv/ directory, assume it contains a virtualenv that we
+# should run this instance in.
+if [ -d .venv ];
+then
+ . .venv/bin/activate
+fi
-GALAXY_CONFIG_FILE=config/galaxy.ini
-if [ ! -f $GALAXY_CONFIG_FILE ]; then
- GALAXY_CONFIG_FILE=universe_wsgi.ini
+if [ -z "$GALAXY_CONFIG_FILE" ]; then
+ if [ -f universe_wsgi.ini ]; then
+ GALAXY_CONFIG_FILE=universe_wsgi.ini
+ elif [ -f config/galaxy.ini ]; then
+ GALAXY_CONFIG_FILE=config/galaxy.ini
+ else
+ GALAXY_CONFIG_FILE=config/galaxy.ini.sample
+ fi
+ export GALAXY_CONFIG_FILE
fi
servers=`sed -n 's/^\[server:\(.*\)\]/\1/ p' $GALAXY_CONFIG_FILE | xargs echo`
for server in $servers;
do
# If there's a pid
- if [[ -e $server.pid ]]
+ if [ -e $server.pid ]
then
# Then kill it
echo "Killing $server"
@@ -44,12 +56,11 @@
pid=`cat $server.pid`
result=1
# Wait for the latest pid in the file to be the pid we've grabbed
- while [[ $result -eq 1 ]]
+ while [ $result -eq 1 ]
do
result=$(check_if_not_started $server.log $server.pid)
- echo -n "."
+ printf "."
sleep 1
done
- echo ""
+ echo
done
-
diff -r de9bd9d7d47bfcdf45f3f170be391874b79e738f -r 669da7067315a6ce236a2ee753e9af6264279c01 scripts/build_universe_config.py
--- a/scripts/build_universe_config.py
+++ b/scripts/build_universe_config.py
@@ -6,7 +6,10 @@
def merge():
- "Merges all .ini files in a specified directory into ./universe.ini"
+ """
+ Merges all .ini files in a specified directory into a file (defaults to
+ ./config/galaxy.ini ).
+ """
if len(argv) < 2:
message = "%s: Must specify directory to merge configuration files from." % argv[0]
raise Exception(message)
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
3 new commits in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/0de04e073983/
Changeset: 0de04e073983
User: nsoranzo
Date: 2015-01-23 19:19:15+00:00
Summary: Fix merge() documentation.
Affected #: 1 file
diff -r 9ef517d8e767037e1633f6063c6edb3023f86499 -r 0de04e073983373e30775252efab83714eaa7184 scripts/build_universe_config.py
--- a/scripts/build_universe_config.py
+++ b/scripts/build_universe_config.py
@@ -6,7 +6,10 @@
def merge():
- "Merges all .ini files in a specified directory into ./universe.ini"
+ """
+ Merges all .ini files in a specified directory into a file (defaults to
+ ./config/galaxy.ini ).
+ """
if len(argv) < 2:
message = "%s: Must specify directory to merge configuration files from." % argv[0]
raise Exception(message)
https://bitbucket.org/galaxy/galaxy-central/commits/4f3f92ca8e74/
Changeset: 4f3f92ca8e74
User: nsoranzo
Date: 2015-01-23 19:23:41+00:00
Summary: Update rolling_restart.sh to treat .venv dir and GALAXY_CONFIG_FILE env variable as run.sh . Use POSIX shell syntax.
Affected #: 1 file
diff -r 0de04e073983373e30775252efab83714eaa7184 -r 4f3f92ca8e7488f4f5a90b8d57eddaeb3e1645d6 rolling_restart.sh
--- a/rolling_restart.sh
+++ b/rolling_restart.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
cd `dirname $0`
check_if_not_started(){
@@ -8,7 +8,7 @@
current_pid_in_file=$(cat $2);
# If they're equivalent, then the current pid file agrees with our logs
# and we've succesfully started
- if [[ $latest_pid -eq $current_pid_in_file ]];
+ if [ $latest_pid -eq $current_pid_in_file ];
then
echo 0;
else
@@ -16,17 +16,29 @@
fi
}
+# If there is a .venv/ directory, assume it contains a virtualenv that we
+# should run this instance in.
+if [ -d .venv ];
+then
+ . .venv/bin/activate
+fi
-GALAXY_CONFIG_FILE=config/galaxy.ini
-if [ ! -f $GALAXY_CONFIG_FILE ]; then
- GALAXY_CONFIG_FILE=universe_wsgi.ini
+if [ -z "$GALAXY_CONFIG_FILE" ]; then
+ if [ -f universe_wsgi.ini ]; then
+ GALAXY_CONFIG_FILE=universe_wsgi.ini
+ elif [ -f config/galaxy.ini ]; then
+ GALAXY_CONFIG_FILE=config/galaxy.ini
+ else
+ GALAXY_CONFIG_FILE=config/galaxy.ini.sample
+ fi
+ export GALAXY_CONFIG_FILE
fi
servers=`sed -n 's/^\[server:\(.*\)\]/\1/ p' $GALAXY_CONFIG_FILE | xargs echo`
for server in $servers;
do
# If there's a pid
- if [[ -e $server.pid ]]
+ if [ -e $server.pid ]
then
# Then kill it
echo "Killing $server"
@@ -44,12 +56,11 @@
pid=`cat $server.pid`
result=1
# Wait for the latest pid in the file to be the pid we've grabbed
- while [[ $result -eq 1 ]]
+ while [ $result -eq 1 ]
do
result=$(check_if_not_started $server.log $server.pid)
- echo -n "."
+ printf "."
sleep 1
done
- echo ""
+ echo
done
-
https://bitbucket.org/galaxy/galaxy-central/commits/669da7067315/
Changeset: 669da7067315
User: jmchilton
Date: 2015-01-23 20:12:24+00:00
Summary: Merged in nsoranzo/galaxy-central (pull request #646)
Update rolling_restart.sh to treat .venv dir and GALAXY_CONFIG_FILE env variable as run.sh
Affected #: 2 files
diff -r de9bd9d7d47bfcdf45f3f170be391874b79e738f -r 669da7067315a6ce236a2ee753e9af6264279c01 rolling_restart.sh
--- a/rolling_restart.sh
+++ b/rolling_restart.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
cd `dirname $0`
check_if_not_started(){
@@ -8,7 +8,7 @@
current_pid_in_file=$(cat $2);
# If they're equivalent, then the current pid file agrees with our logs
# and we've succesfully started
- if [[ $latest_pid -eq $current_pid_in_file ]];
+ if [ $latest_pid -eq $current_pid_in_file ];
then
echo 0;
else
@@ -16,17 +16,29 @@
fi
}
+# If there is a .venv/ directory, assume it contains a virtualenv that we
+# should run this instance in.
+if [ -d .venv ];
+then
+ . .venv/bin/activate
+fi
-GALAXY_CONFIG_FILE=config/galaxy.ini
-if [ ! -f $GALAXY_CONFIG_FILE ]; then
- GALAXY_CONFIG_FILE=universe_wsgi.ini
+if [ -z "$GALAXY_CONFIG_FILE" ]; then
+ if [ -f universe_wsgi.ini ]; then
+ GALAXY_CONFIG_FILE=universe_wsgi.ini
+ elif [ -f config/galaxy.ini ]; then
+ GALAXY_CONFIG_FILE=config/galaxy.ini
+ else
+ GALAXY_CONFIG_FILE=config/galaxy.ini.sample
+ fi
+ export GALAXY_CONFIG_FILE
fi
servers=`sed -n 's/^\[server:\(.*\)\]/\1/ p' $GALAXY_CONFIG_FILE | xargs echo`
for server in $servers;
do
# If there's a pid
- if [[ -e $server.pid ]]
+ if [ -e $server.pid ]
then
# Then kill it
echo "Killing $server"
@@ -44,12 +56,11 @@
pid=`cat $server.pid`
result=1
# Wait for the latest pid in the file to be the pid we've grabbed
- while [[ $result -eq 1 ]]
+ while [ $result -eq 1 ]
do
result=$(check_if_not_started $server.log $server.pid)
- echo -n "."
+ printf "."
sleep 1
done
- echo ""
+ echo
done
-
diff -r de9bd9d7d47bfcdf45f3f170be391874b79e738f -r 669da7067315a6ce236a2ee753e9af6264279c01 scripts/build_universe_config.py
--- a/scripts/build_universe_config.py
+++ b/scripts/build_universe_config.py
@@ -6,7 +6,10 @@
def merge():
- "Merges all .ini files in a specified directory into ./universe.ini"
+ """
+ Merges all .ini files in a specified directory into a file (defaults to
+ ./config/galaxy.ini ).
+ """
if len(argv) < 2:
message = "%s: Must specify directory to merge configuration files from." % argv[0]
raise Exception(message)
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
commit/galaxy-central: guerler: Upload: Cleanup ftp popup
by commits-noreply@bitbucket.org 23 Jan '15
by commits-noreply@bitbucket.org 23 Jan '15
23 Jan '15
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/de9bd9d7d47b/
Changeset: de9bd9d7d47b
User: guerler
Date: 2015-01-23 20:11:24+00:00
Summary: Upload: Cleanup ftp popup
Affected #: 3 files
diff -r 892da4d5dcc979919c82d4a57ce897d3e93278ce -r de9bd9d7d47bfcdf45f3f170be391874b79e738f client/galaxy/scripts/mvc/upload/upload-ftp.js
--- a/client/galaxy/scripts/mvc/upload/upload-ftp.js
+++ b/client/galaxy/scripts/mvc/upload/upload-ftp.js
@@ -6,7 +6,8 @@
// options
options: {
class_add : 'upload-icon-button fa fa-square-o',
- class_remove : 'upload-icon-button fa fa-check-square-o'
+ class_remove : 'upload-icon-button fa fa-check-square-o',
+ class_partial : 'upload-icon-button fa fa-minus-square-o'
},
// render
@@ -20,6 +21,9 @@
// set template
this.setElement(this._template());
+ // list of rows
+ this.rows = [];
+
// load extension
Utils.get({
url : galaxy_config.root + 'api/ftp_files',
@@ -35,7 +39,6 @@
// fill table
_fill: function(ftp_files) {
- var self = this;
if (ftp_files && ftp_files.length > 0) {
// add table
this.$el.find('#upload-ftp-content').html($(this._templateTable()));
@@ -43,7 +46,7 @@
// add files to table
var size = 0;
for (key in ftp_files) {
- this.add(ftp_files[key]);
+ this.rows.push(this._add(ftp_files[key]));
size += ftp_files[key].size;
}
@@ -51,37 +54,23 @@
this.$el.find('#upload-ftp-number').html(ftp_files.length + ' files');
this.$el.find('#upload-ftp-disk').html(Utils.bytesToString (size, true));
- var selectAll = this.$el.find('#selectAll');
-
- // call method to determine and set selectAll status on loading
- this._updateSelectAll(selectAll);
-
- // selectAll checkbox has been clicked
- selectAll.on('click', function() {
- var checkboxes=$(this).parents().find('tr.upload-ftp-row>td>div');
- var len = checkboxes.length;
- $this = $(this);
- var allChecked = !($this.hasClass('fa-check-square-o'));
-
- // change state of the sub-checkboxes
- for(i = 0; i < len; i++) {
- if(allChecked) {
- // all checkboxes should be checked
- if(checkboxes.eq(i).hasClass('fa-square-o')) {
- // if they are not checked, check them
- checkboxes.eq(i).trigger('updateUpBox');
- }
- } else {
- // no checkboxes should be checked
- if(checkboxes.eq(i).hasClass('fa-check-square-o')) {
- // if they are checked, uncheck them
- checkboxes.eq(i).trigger('updateUpBox');
- }
+ // add event handler to select/unselect all
+ this.$select_all = $('#upload-selectall');
+ this.$select_all.addClass(this.options.class_add);
+ var self = this;
+ this.$select_all.on('click', function() {
+ var add = self.$select_all.hasClass(self.options.class_add);
+ for (key in ftp_files) {
+ var ftp_file = ftp_files[key];
+ var model_index = self._find(ftp_file);
+ if(!model_index && add || model_index && !add) {
+ self.rows[key].trigger('click');
}
}
+ });
- self._updateSelectAll(selectAll);
- });
+ // refresh
+ self._refresh();
} else {
// add info
this.$el.find('#upload-ftp-content').html($(this._templateInfo()));
@@ -92,7 +81,7 @@
},
// add
- add: function(ftp_file) {
+ _add: function(ftp_file) {
// link this
var self = this;
@@ -116,8 +105,8 @@
// add icon class
$icon.addClass(icon_class);
- // add files to the uploadbox
- $it.on('updateUpBox', function() {
+ // click to add ftp files
+ $it.on('click', function() {
// find model
var model_index = self._find(ftp_file);
@@ -133,67 +122,51 @@
size : ftp_file.size,
path : ftp_file.path
}]);
-
+
// add new icon class
$icon.addClass(self.options.class_remove);
} else {
// remove
self.app.collection.remove(model_index);
-
+
// add new icon class
$icon.addClass(self.options.class_add);
}
+
+ // update select all checkbox
+ self._refresh();
});
- // click to add ftp files
- $it.on('click', function() {
- //trigger my new event
- $icon.trigger('updateUpBox');
-
- // click to add ftp files
- // modify selectAll box based on number of checkboxes checked
- var selectBox=$icon.parents().find('#selectAll');
- // determine and set state of selectAll after sub-checkbox clicked
- self._updateSelectAll(selectBox);
- });
+ // return dom handler
+ return $it;
},
- _updateSelectAll: function(selectBox) {
- // array of all checkboxes
- var checkboxes=selectBox.parents().find('tr.upload-ftp-row>td>div');
- // array of only checked checkboxes
- var checkedCheckboxes=selectBox.parents().find('tr.upload-ftp-row>td>div.fa-check-square-o');
- var lenAll = checkboxes.length;
- var lenChecked = checkedCheckboxes.length;
-
- // determine which state the selectAll checkbox needs to be and setting it
- if(lenChecked > 0 && lenChecked !== lenAll) {
- // indeterminate state
- selectBox.removeClass('fa-square-o fa-check-square-o');
- selectBox.addClass('fa-minus-square-o');
- } else if(lenChecked === lenAll) {
- // checked state
- selectBox.removeClass('fa-square-o fa-minus-square-o');
- selectBox.addClass('fa-check-square-o');
- } else if(lenChecked === 0) {
- // unchecked state
- selectBox.removeClass('fa-check-square-o fa-minus-square-o');
- selectBox.addClass('fa-square-o');
+ // refresh
+ _refresh: function() {
+ var filtered = this.app.collection.where({file_mode : 'ftp'});
+ this.$select_all.removeClass();
+ if (filtered.length == 0) {
+ this.$select_all.addClass(this.options.class_add);
+ } else {
+ if (filtered.length == this.rows.length) {
+ this.$select_all.addClass(this.options.class_remove);
+ } else {
+ this.$select_all.addClass(this.options.class_partial);
+ }
}
},
// get model index
_find: function(ftp_file) {
- // check if exists already
- var filtered = this.app.collection.where({file_path : ftp_file.path});
- var model_index = null;
- for (var key in filtered) {
- var item = filtered[key];
- if (item.get('status') == 'init' && item.get('file_mode') == 'ftp') {
- model_index = item.get('id');
- }
+ var item = this.app.collection.findWhere({
+ file_path : ftp_file.path,
+ status : 'init',
+ file_mode : 'ftp'
+ });
+ if (item) {
+ return item.get('id');
}
- return model_index;
+ return null;
},
// template row
@@ -218,7 +191,7 @@
'<table class="grid" style="float: left;">' +
'<thead>' +
'<tr>' +
- '<th><div id="selectAll" class="upload-icon-button fa fa-square-o" ></th>' +
+ '<th><div id="upload-selectall"></th>' +
'<th>Name</th>' +
'<th>Size</th>' +
'<th>Created</th>' +
@@ -243,7 +216,6 @@
'<div id="upload-ftp-content"></div>' +
'<div>';
}
-
});
});
diff -r 892da4d5dcc979919c82d4a57ce897d3e93278ce -r de9bd9d7d47bfcdf45f3f170be391874b79e738f static/scripts/mvc/upload/upload-ftp.js
--- a/static/scripts/mvc/upload/upload-ftp.js
+++ b/static/scripts/mvc/upload/upload-ftp.js
@@ -6,7 +6,8 @@
// options
options: {
class_add : 'upload-icon-button fa fa-square-o',
- class_remove : 'upload-icon-button fa fa-check-square-o'
+ class_remove : 'upload-icon-button fa fa-check-square-o',
+ class_partial : 'upload-icon-button fa fa-minus-square-o'
},
// render
@@ -20,6 +21,9 @@
// set template
this.setElement(this._template());
+ // list of rows
+ this.rows = [];
+
// load extension
Utils.get({
url : galaxy_config.root + 'api/ftp_files',
@@ -35,7 +39,6 @@
// fill table
_fill: function(ftp_files) {
- var self = this;
if (ftp_files && ftp_files.length > 0) {
// add table
this.$el.find('#upload-ftp-content').html($(this._templateTable()));
@@ -43,7 +46,7 @@
// add files to table
var size = 0;
for (key in ftp_files) {
- this.add(ftp_files[key]);
+ this.rows.push(this._add(ftp_files[key]));
size += ftp_files[key].size;
}
@@ -51,37 +54,23 @@
this.$el.find('#upload-ftp-number').html(ftp_files.length + ' files');
this.$el.find('#upload-ftp-disk').html(Utils.bytesToString (size, true));
- var selectAll = this.$el.find('#selectAll');
-
- // call method to determine and set selectAll status on loading
- this._updateSelectAll(selectAll);
-
- // selectAll checkbox has been clicked
- selectAll.on('click', function() {
- var checkboxes=$(this).parents().find('tr.upload-ftp-row>td>div');
- var len = checkboxes.length;
- $this = $(this);
- var allChecked = !($this.hasClass('fa-check-square-o'));
-
- // change state of the sub-checkboxes
- for(i = 0; i < len; i++) {
- if(allChecked) {
- // all checkboxes should be checked
- if(checkboxes.eq(i).hasClass('fa-square-o')) {
- // if they are not checked, check them
- checkboxes.eq(i).trigger('updateUpBox');
- }
- } else {
- // no checkboxes should be checked
- if(checkboxes.eq(i).hasClass('fa-check-square-o')) {
- // if they are checked, uncheck them
- checkboxes.eq(i).trigger('updateUpBox');
- }
+ // add event handler to select/unselect all
+ this.$select_all = $('#upload-selectall');
+ this.$select_all.addClass(this.options.class_add);
+ var self = this;
+ this.$select_all.on('click', function() {
+ var add = self.$select_all.hasClass(self.options.class_add);
+ for (key in ftp_files) {
+ var ftp_file = ftp_files[key];
+ var model_index = self._find(ftp_file);
+ if(!model_index && add || model_index && !add) {
+ self.rows[key].trigger('click');
}
}
+ });
- self._updateSelectAll(selectAll);
- });
+ // refresh
+ self._refresh();
} else {
// add info
this.$el.find('#upload-ftp-content').html($(this._templateInfo()));
@@ -92,7 +81,7 @@
},
// add
- add: function(ftp_file) {
+ _add: function(ftp_file) {
// link this
var self = this;
@@ -116,8 +105,8 @@
// add icon class
$icon.addClass(icon_class);
- // add files to the uploadbox
- $it.on('updateUpBox', function() {
+ // click to add ftp files
+ $it.on('click', function() {
// find model
var model_index = self._find(ftp_file);
@@ -133,67 +122,51 @@
size : ftp_file.size,
path : ftp_file.path
}]);
-
+
// add new icon class
$icon.addClass(self.options.class_remove);
} else {
// remove
self.app.collection.remove(model_index);
-
+
// add new icon class
$icon.addClass(self.options.class_add);
}
+
+ // update select all checkbox
+ self._refresh();
});
- // click to add ftp files
- $it.on('click', function() {
- //trigger my new event
- $icon.trigger('updateUpBox');
-
- // click to add ftp files
- // modify selectAll box based on number of checkboxes checked
- var selectBox=$icon.parents().find('#selectAll');
- // determine and set state of selectAll after sub-checkbox clicked
- self._updateSelectAll(selectBox);
- });
+ // return dom handler
+ return $it;
},
- _updateSelectAll: function(selectBox) {
- // array of all checkboxes
- var checkboxes=selectBox.parents().find('tr.upload-ftp-row>td>div');
- // array of only checked checkboxes
- var checkedCheckboxes=selectBox.parents().find('tr.upload-ftp-row>td>div.fa-check-square-o');
- var lenAll = checkboxes.length;
- var lenChecked = checkedCheckboxes.length;
-
- // determine which state the selectAll checkbox needs to be and setting it
- if(lenChecked > 0 && lenChecked !== lenAll) {
- // indeterminate state
- selectBox.removeClass('fa-square-o fa-check-square-o');
- selectBox.addClass('fa-minus-square-o');
- } else if(lenChecked === lenAll) {
- // checked state
- selectBox.removeClass('fa-square-o fa-minus-square-o');
- selectBox.addClass('fa-check-square-o');
- } else if(lenChecked === 0) {
- // unchecked state
- selectBox.removeClass('fa-check-square-o fa-minus-square-o');
- selectBox.addClass('fa-square-o');
+ // refresh
+ _refresh: function() {
+ var filtered = this.app.collection.where({file_mode : 'ftp'});
+ this.$select_all.removeClass();
+ if (filtered.length == 0) {
+ this.$select_all.addClass(this.options.class_add);
+ } else {
+ if (filtered.length == this.rows.length) {
+ this.$select_all.addClass(this.options.class_remove);
+ } else {
+ this.$select_all.addClass(this.options.class_partial);
+ }
}
},
// get model index
_find: function(ftp_file) {
- // check if exists already
- var filtered = this.app.collection.where({file_path : ftp_file.path});
- var model_index = null;
- for (var key in filtered) {
- var item = filtered[key];
- if (item.get('status') == 'init' && item.get('file_mode') == 'ftp') {
- model_index = item.get('id');
- }
+ var item = this.app.collection.findWhere({
+ file_path : ftp_file.path,
+ status : 'init',
+ file_mode : 'ftp'
+ });
+ if (item) {
+ return item.get('id');
}
- return model_index;
+ return null;
},
// template row
@@ -218,7 +191,7 @@
'<table class="grid" style="float: left;">' +
'<thead>' +
'<tr>' +
- '<th><div id="selectAll" class="upload-icon-button fa fa-square-o" ></th>' +
+ '<th><div id="upload-selectall"></th>' +
'<th>Name</th>' +
'<th>Size</th>' +
'<th>Created</th>' +
@@ -243,7 +216,6 @@
'<div id="upload-ftp-content"></div>' +
'<div>';
}
-
});
});
diff -r 892da4d5dcc979919c82d4a57ce897d3e93278ce -r de9bd9d7d47bfcdf45f3f170be391874b79e738f static/scripts/packed/mvc/upload/upload-ftp.js
--- a/static/scripts/packed/mvc/upload/upload-ftp.js
+++ b/static/scripts/packed/mvc/upload/upload-ftp.js
@@ -1,1 +1,1 @@
-define(["utils/utils"],function(a){return Backbone.View.extend({options:{class_add:"upload-icon-button fa fa-square-o",class_remove:"upload-icon-button fa fa-check-square-o"},initialize:function(c){this.app=c;var b=this;this.setElement(this._template());a.get({url:galaxy_config.root+"api/ftp_files",success:function(d){b._fill(d)},error:function(){b._fill()}})},events:{mousedown:function(b){b.preventDefault()}},_fill:function(d){var b=this;if(d&&d.length>0){this.$el.find("#upload-ftp-content").html($(this._templateTable()));var c=0;for(key in d){this.add(d[key]);c+=d[key].size}this.$el.find("#upload-ftp-number").html(d.length+" files");this.$el.find("#upload-ftp-disk").html(a.bytesToString(c,true));var e=this.$el.find("#selectAll");this._updateSelectAll(e);e.on("click",function(){var h=$(this).parents().find("tr.upload-ftp-row>td>div");var g=h.length;$this=$(this);var f=!($this.hasClass("fa-check-square-o"));for(i=0;i<g;i++){if(f){if(h.eq(i).hasClass("fa-square-o")){h.eq(i).trigger("updateUpBox")}}else{if(h.eq(i).hasClass("fa-check-square-o")){h.eq(i).trigger("updateUpBox")}}}b._updateSelectAll(e)})}else{this.$el.find("#upload-ftp-content").html($(this._templateInfo()))}this.$el.find("#upload-ftp-wait").hide()},add:function(f){var d=this;var e=$(this._templateRow(f));var b=e.find(".icon");$(this.el).find("tbody").append(e);var c="";if(this._find(f)){c=this.options.class_remove}else{c=this.options.class_add}b.addClass(c);e.on("updateUpBox",function(){var g=d._find(f);b.removeClass();if(!g){d.app.uploadbox.add([{mode:"ftp",name:f.path,size:f.size,path:f.path}]);b.addClass(d.options.class_remove)}else{d.app.collection.remove(g);b.addClass(d.options.class_add)}});e.on("click",function(){b.trigger("updateUpBox");var g=b.parents().find("#selectAll");d._updateSelectAll(g)})},_updateSelectAll:function(e){var d=e.parents().find("tr.upload-ftp-row>td>div");var f=e.parents().find("tr.upload-ftp-row>td>div.fa-check-square-o");var c=d.length;var b=f.length;if(b>0&&b!==c){e.removeClass("fa-square-o fa-check-square-o");e.addClass("fa-minus-square-o")}else{if(b===c){e.removeClass("fa-square-o fa-minus-square-o");e.addClass("fa-check-square-o")}else{if(b===0){e.removeClass("fa-check-square-o fa-minus-square-o");e.addClass("fa-square-o")}}}},_find:function(f){var c=this.app.collection.where({file_path:f.path});var b=null;for(var d in c){var e=c[d];if(e.get("status")=="init"&&e.get("file_mode")=="ftp"){b=e.get("id")}}return b},_templateRow:function(b){return'<tr class="upload-ftp-row" style="cursor: pointer;"><td><div class="icon"/></td><td style="width: 200px"><p style="width: inherit; word-wrap: break-word;">'+b.path+'</p></td><td style="white-space: nowrap;">'+a.bytesToString(b.size)+'</td><td style="white-space: nowrap;">'+b.ctime+"</td></tr>"},_templateTable:function(){return'<span style="whitespace: nowrap; float: left;">Available files: </span><span style="whitespace: nowrap; float: right;"><span class="upload-icon fa fa-file-text-o"/><span id="upload-ftp-number"/> <span class="upload-icon fa fa-hdd-o"/><span id="upload-ftp-disk"/></span><table class="grid" style="float: left;"><thead><tr><th><div id="selectAll" class="upload-icon-button fa fa-square-o" ></th><th>Name</th><th>Size</th><th>Created</th></tr></thead><tbody></tbody></table>'},_templateInfo:function(){return'<div class="upload-ftp-warning warningmessage">Your FTP directory does not contain any files.</div>'},_template:function(){return'<div class="upload-ftp"><div id="upload-ftp-wait" class="upload-ftp-wait fa fa-spinner fa-spin"/><div class="upload-ftp-help">This Galaxy server allows you to upload files via FTP. To upload some files, log in to the FTP server at <strong>'+this.app.options.ftp_upload_site+'</strong> using your Galaxy credentials (email address and password).</div><div id="upload-ftp-content"></div><div>'}})});
\ No newline at end of file
+define(["utils/utils"],function(a){return Backbone.View.extend({options:{class_add:"upload-icon-button fa fa-square-o",class_remove:"upload-icon-button fa fa-check-square-o",class_partial:"upload-icon-button fa fa-minus-square-o"},initialize:function(c){this.app=c;var b=this;this.setElement(this._template());this.rows=[];a.get({url:galaxy_config.root+"api/ftp_files",success:function(d){b._fill(d)},error:function(){b._fill()}})},events:{mousedown:function(b){b.preventDefault()}},_fill:function(d){if(d&&d.length>0){this.$el.find("#upload-ftp-content").html($(this._templateTable()));var c=0;for(key in d){this.rows.push(this._add(d[key]));c+=d[key].size}this.$el.find("#upload-ftp-number").html(d.length+" files");this.$el.find("#upload-ftp-disk").html(a.bytesToString(c,true));this.$select_all=$("#upload-selectall");this.$select_all.addClass(this.options.class_add);var b=this;this.$select_all.on("click",function(){var g=b.$select_all.hasClass(b.options.class_add);for(key in d){var f=d[key];var e=b._find(f);if(!e&&g||e&&!g){b.rows[key].trigger("click")}}});b._refresh()}else{this.$el.find("#upload-ftp-content").html($(this._templateInfo()))}this.$el.find("#upload-ftp-wait").hide()},_add:function(f){var d=this;var e=$(this._templateRow(f));var b=e.find(".icon");$(this.el).find("tbody").append(e);var c="";if(this._find(f)){c=this.options.class_remove}else{c=this.options.class_add}b.addClass(c);e.on("click",function(){var g=d._find(f);b.removeClass();if(!g){d.app.uploadbox.add([{mode:"ftp",name:f.path,size:f.size,path:f.path}]);b.addClass(d.options.class_remove)}else{d.app.collection.remove(g);b.addClass(d.options.class_add)}d._refresh()});return e},_refresh:function(){var b=this.app.collection.where({file_mode:"ftp"});this.$select_all.removeClass();if(b.length==0){this.$select_all.addClass(this.options.class_add)}else{if(b.length==this.rows.length){this.$select_all.addClass(this.options.class_remove)}else{this.$select_all.addClass(this.options.class_partial)}}},_find:function(c){var b=this.app.collection.findWhere({file_path:c.path,status:"init",file_mode:"ftp"});if(b){return b.get("id")}return null},_templateRow:function(b){return'<tr class="upload-ftp-row" style="cursor: pointer;"><td><div class="icon"/></td><td style="width: 200px"><p style="width: inherit; word-wrap: break-word;">'+b.path+'</p></td><td style="white-space: nowrap;">'+a.bytesToString(b.size)+'</td><td style="white-space: nowrap;">'+b.ctime+"</td></tr>"},_templateTable:function(){return'<span style="whitespace: nowrap; float: left;">Available files: </span><span style="whitespace: nowrap; float: right;"><span class="upload-icon fa fa-file-text-o"/><span id="upload-ftp-number"/> <span class="upload-icon fa fa-hdd-o"/><span id="upload-ftp-disk"/></span><table class="grid" style="float: left;"><thead><tr><th><div id="upload-selectall"></th><th>Name</th><th>Size</th><th>Created</th></tr></thead><tbody></tbody></table>'},_templateInfo:function(){return'<div class="upload-ftp-warning warningmessage">Your FTP directory does not contain any files.</div>'},_template:function(){return'<div class="upload-ftp"><div id="upload-ftp-wait" class="upload-ftp-wait fa fa-spinner fa-spin"/><div class="upload-ftp-help">This Galaxy server allows you to upload files via FTP. To upload some files, log in to the FTP server at <strong>'+this.app.options.ftp_upload_site+'</strong> using your Galaxy credentials (email address and password).</div><div id="upload-ftp-content"></div><div>'}})});
\ No newline at end of file
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
commit/galaxy-central: jmchilton: Clarify default reports template cache location.
by commits-noreply@bitbucket.org 23 Jan '15
by commits-noreply@bitbucket.org 23 Jan '15
23 Jan '15
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/892da4d5dcc9/
Changeset: 892da4d5dcc9
User: jmchilton
Date: 2015-01-23 20:08:37+00:00
Summary: Clarify default reports template cache location.
Affected #: 1 file
diff -r e361766bbcfd8976ee05cb8826ed239d0f2028f6 -r 892da4d5dcc979919c82d4a57ce897d3e93278ce config/reports_wsgi.ini.sample
--- a/config/reports_wsgi.ini.sample
+++ b/config/reports_wsgi.ini.sample
@@ -28,7 +28,7 @@
# Mako templates are compiled as needed and cached for reuse, this directory is
# used for the cache
-# template_cache_path = database/compiled_templates
+#template_cache_path = database/compiled_templates/reports
# Session support (beaker)
use_beaker_session = True
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
commit/galaxy-central: jmchilton: Merged in trevorw/galaxy-central-6/trevorw/add-template_cache_path-to-reports_wsgii-1422042129382 (pull request #645)
by commits-noreply@bitbucket.org 23 Jan '15
by commits-noreply@bitbucket.org 23 Jan '15
23 Jan '15
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/e361766bbcfd/
Changeset: e361766bbcfd
User: jmchilton
Date: 2015-01-23 19:51:13+00:00
Summary: Merged in trevorw/galaxy-central-6/trevorw/add-template_cache_path-to-reports_wsgii-1422042129382 (pull request #645)
add template_cache_path to reports_wsgi.ini.sample
Affected #: 1 file
diff -r d8d20b31c15bec018df93653c3f39e5d41e374f6 -r e361766bbcfd8976ee05cb8826ed239d0f2028f6 config/reports_wsgi.ini.sample
--- a/config/reports_wsgi.ini.sample
+++ b/config/reports_wsgi.ini.sample
@@ -26,6 +26,10 @@
# Temporary storage for additional datasets, this should be shared through the cluster
new_file_path = database/tmp
+# Mako templates are compiled as needed and cached for reuse, this directory is
+# used for the cache
+# template_cache_path = database/compiled_templates
+
# Session support (beaker)
use_beaker_session = True
session_type = memory
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
2 new commits in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/f18f905ceaa7/
Changeset: f18f905ceaa7
Branch: trevorw/add-template_cache_path-to-reports_wsgii-1422042129382
User: trevorw
Date: 2015-01-23 19:42:36+00:00
Summary: add template_cache_path to reports_wsgi.ini.sample
Affected #: 1 file
diff -r 9ef517d8e767037e1633f6063c6edb3023f86499 -r f18f905ceaa7586625c7f7d202a1f0f4ceabc8a1 config/reports_wsgi.ini.sample
--- a/config/reports_wsgi.ini.sample
+++ b/config/reports_wsgi.ini.sample
@@ -26,6 +26,10 @@
# Temporary storage for additional datasets, this should be shared through the cluster
new_file_path = database/tmp
+# Mako templates are compiled as needed and cached for reuse, this directory is
+# used for the cache
+# template_cache_path = database/compiled_templates
+
# Session support (beaker)
use_beaker_session = True
session_type = memory
https://bitbucket.org/galaxy/galaxy-central/commits/e361766bbcfd/
Changeset: e361766bbcfd
User: jmchilton
Date: 2015-01-23 19:51:13+00:00
Summary: Merged in trevorw/galaxy-central-6/trevorw/add-template_cache_path-to-reports_wsgii-1422042129382 (pull request #645)
add template_cache_path to reports_wsgi.ini.sample
Affected #: 1 file
diff -r d8d20b31c15bec018df93653c3f39e5d41e374f6 -r e361766bbcfd8976ee05cb8826ed239d0f2028f6 config/reports_wsgi.ini.sample
--- a/config/reports_wsgi.ini.sample
+++ b/config/reports_wsgi.ini.sample
@@ -26,6 +26,10 @@
# Temporary storage for additional datasets, this should be shared through the cluster
new_file_path = database/tmp
+# Mako templates are compiled as needed and cached for reuse, this directory is
+# used for the cache
+# template_cache_path = database/compiled_templates
+
# Session support (beaker)
use_beaker_session = True
session_type = memory
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
2 new commits in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/3232c9fc4d8f/
Changeset: 3232c9fc4d8f
User: dannon
Date: 2015-01-23 19:39:53+00:00
Summary: Cut unused showSettings method from upload's view -- this is in upload-row.
Affected #: 3 files
diff -r 9ef517d8e767037e1633f6063c6edb3023f86499 -r 3232c9fc4d8fbdbed3416ae9745adbb93aafd70f client/galaxy/scripts/mvc/upload/upload-view.js
--- a/client/galaxy/scripts/mvc/upload/upload-view.js
+++ b/client/galaxy/scripts/mvc/upload/upload-view.js
@@ -295,19 +295,6 @@
}
},
- _showSettings : function() {
- // check if popover is visible
- if (!this.settings.visible) {
- // show popover
- this.settings.empty();
- this.settings.append((new UploadSettings(this)).$el);
- this.settings.show();
- } else {
- // hide popover
- this.settings.hide();
- }
- },
-
_templateDescription: function(options) {
if (options.description) {
var tmpl = options.description;
diff -r 9ef517d8e767037e1633f6063c6edb3023f86499 -r 3232c9fc4d8fbdbed3416ae9745adbb93aafd70f static/scripts/mvc/upload/upload-view.js
--- a/static/scripts/mvc/upload/upload-view.js
+++ b/static/scripts/mvc/upload/upload-view.js
@@ -295,19 +295,6 @@
}
},
- _showSettings : function() {
- // check if popover is visible
- if (!this.settings.visible) {
- // show popover
- this.settings.empty();
- this.settings.append((new UploadSettings(this)).$el);
- this.settings.show();
- } else {
- // hide popover
- this.settings.hide();
- }
- },
-
_templateDescription: function(options) {
if (options.description) {
var tmpl = options.description;
diff -r 9ef517d8e767037e1633f6063c6edb3023f86499 -r 3232c9fc4d8fbdbed3416ae9745adbb93aafd70f static/scripts/packed/mvc/upload/upload-view.js
--- a/static/scripts/packed/mvc/upload/upload-view.js
+++ b/static/scripts/packed/mvc/upload/upload-view.js
@@ -1,1 +1,1 @@
-define(["utils/utils","mvc/upload/upload-button","mvc/upload/upload-model","mvc/upload/upload-row","mvc/upload/upload-ftp","mvc/ui/ui-popover","mvc/ui/ui-modal","mvc/ui/ui-select","utils/uploadbox"],function(f,e,c,b,g,d,a,h){return Backbone.View.extend({options:{nginx_upload_path:""},modal:null,ui_button:null,uploadbox:null,current_history:null,select_extension:null,upload_size:0,list_extensions:[],list_genomes:[],auto:{id:"auto",text:"Auto-detect",description:"This system will try to detect the file type automatically. If your file is not detected properly as one of the known formats, it most likely means that it has some format problems (e.g., different number of columns on different rows). You can still coerce the system to set your data to the format you think it should be. You can also upload compressed files, which will automatically be decompressed."},collection:new c.Collection(),ftp:null,counter:{announce:0,success:0,error:0,running:0,reset:function(){this.announce=this.success=this.error=this.running=0}},initialize:function(k){var j=this;if(k){this.options=_.defaults(k,this.options)}this.ui_button=new e.Model({icon:"fa-upload",tooltip:"Download from URL or upload files from disk",label:"Load Data",onclick:function(l){if(l){l.preventDefault();j.show()}},onunload:function(){if(j.counter.running>0){return"Several uploads are still processing."}}});$(".with-upload-button").append((new e.View(this.ui_button)).$el);var j=this;f.get({url:galaxy_config.root+"api/datatypes?extension_only=False",success:function(l){for(key in l){j.list_extensions.push({id:l[key].extension,text:l[key].extension,description:l[key].description,description_url:l[key].description_url})}j.list_extensions.sort(function(n,m){return n.id>m.id?1:n.id<m.id?-1:0});j.list_extensions.push({id:"---",text:"---",description:"",description_url:""});if(!j.options.datatypes_disable_auto){j.list_extensions.unshift(j.auto)}}});f.get({url:galaxy_config.root+"api/genomes",success:function(l){for(key in l){j.list_genomes.push({id:l[key][1],text:l[key][0]})}j.list_genomes.sort(function(n,m){return n.id>m.id?1:n.id<m.id?-1:0})}});this.collection.on("remove",function(l){j._eventRemove(l)});this.collection.on("change:genome",function(m){var l=m.get("genome");j.collection.each(function(n){if(n.get("status")=="init"&&n.get("genome")=="?"){n.set("genome",l)}})})},show:function(){var j=this;if(!Galaxy.currHistoryPanel||!Galaxy.currHistoryPanel.model){window.setTimeout(function(){j.show()},500);return}if(!this.modal){var j=this;this.modal=new a.View({title:"Download data directly from web or upload files from your disk",body:this._template("upload-box","upload-info"),buttons:{"Choose local file":function(){j.uploadbox.select()},"Choose FTP file":function(){j._eventFtp()},"Paste/Fetch data":function(){j._eventCreate()},Start:function(){j._eventStart()},Pause:function(){j._eventStop()},Reset:function(){j._eventReset()},Close:function(){j.modal.hide()},},height:"400",width:"900",closing_events:true});this.setElement("#upload-box");var j=this;this.uploadbox=this.$el.uploadbox({announce:function(l,m,n){j._eventAnnounce(l,m,n)},initialize:function(l,m,n){return j._eventInitialize(l,m,n)},progress:function(l,m,n){j._eventProgress(l,m,n)},success:function(l,m,n){j._eventSuccess(l,m,n)},error:function(l,m,n){j._eventError(l,m,n)},complete:function(){j._eventComplete()}});var k=this.modal.getButton("Choose FTP file");this.ftp=new d.View({title:"FTP files",container:k});this.select_extension=new h.View({css:"extension",onchange:function(){var m=j.select_extension.value();var l=j.collection.models.length;if(!(m==="---")){for(i=0;i<l;i++){j.collection.models[i].attributes.row.select_extension.value(m)}}},data:j.list_extensions,container:j.$el.parents().find("#extension"),value:j.list_extensions[0]});j.$el.parents().find("#extension-info_out").on("click",function(l){j._showExtensionInfo()}).on("mousedown",function(l){l.preventDefault()})}this.modal.show();this._updateUser();this._updateScreen()},_showExtensionInfo:function(){var j=this;var k=$(this.el).parents().find("#extension-info_out");var n=j.select_extension.value();var m=this.select_extension.text();var l=_.findWhere(j.list_extensions,{id:n});if(!this.extension_popup){this.extension_popup=new d.View({placement:"bottom",container:k})}if(!this.extension_popup.visible){this.extension_popup.title(m);this.extension_popup.empty();this.extension_popup.append(this._templateDescription(l));this.extension_popup.show()}else{this.extension_popup.hide()}},_showSettings:function(){if(!this.settings.visible){this.settings.empty();this.settings.append((new UploadSettings(this)).$el);this.settings.show()}else{this.settings.hide()}},_templateDescription:function(k){if(k.description){var j=k.description;if(k.description_url){j+=' (<a href="'+k.description_url+'" target="_blank">read more</a>)'}return j}else{return"There is no description available for this file extension."}},_eventRemove:function(k){var j=k.get("status");if(j=="success"){this.counter.success--}else{if(j=="error"){this.counter.error--}else{this.counter.announce--}}this._updateScreen();this.uploadbox.remove(k.id)},_eventAnnounce:function(j,k,m){this.counter.announce++;this._updateScreen();var l=new b(this,{id:j,file_name:k.name,file_size:k.size,file_mode:k.mode,file_path:k.path});this.collection.add(l.model);$(this.el).find("tbody:first").append(l.$el);l.render()},_eventInitialize:function(o,l,u){var m=this.collection.get(o);m.set("status","running");var q=m.get("file_name");var p=m.get("file_path");var j=m.get("file_mode");var r=m.get("extension");var t=m.get("genome");var s=m.get("url_paste");var n=m.get("space_to_tabs");var k=m.get("to_posix_lines");if(!s&&!(l.size>0)){return null}this.uploadbox.configure({url:this.options.nginx_upload_path});if(j=="local"){this.uploadbox.configure({paramname:"files_0|file_data"})}else{this.uploadbox.configure({paramname:null})}tool_input={};if(j=="new"){tool_input["files_0|url_paste"]=s}if(j=="ftp"){tool_input["files_0|ftp_files"]=p}tool_input.dbkey=t;tool_input.file_type=r;tool_input["files_0|type"]="upload_dataset";tool_input["files_0|space_to_tab"]=n&&"Yes"||null;tool_input["files_0|to_posix_lines"]=k&&"Yes"||null;data={};data.history_id=this.current_history;data.tool_id="upload1";data.inputs=JSON.stringify(tool_input);return data},_eventProgress:function(k,l,j){var m=this.collection.get(k);m.set("percentage",j);this.ui_button.set("percentage",this._upload_percentage(j,l.size))},_eventSuccess:function(k,l,n){var m=this.collection.get(k);m.set("percentage",100);m.set("status","success");var j=m.get("file_size");this.ui_button.set("percentage",this._upload_percentage(100,j));this.upload_completed+=j*100;this.counter.announce--;this.counter.success++;this._updateScreen();Galaxy.currHistoryPanel.refreshContents()},_eventError:function(j,k,m){var l=this.collection.get(j);l.set("percentage",100);l.set("status","error");l.set("info",m);this.ui_button.set("percentage",this._upload_percentage(100,k.size));this.ui_button.set("status","danger");this.upload_completed+=k.size*100;this.counter.announce--;this.counter.error++;this._updateScreen()},_eventComplete:function(){this.collection.each(function(j){if(j.get("status")=="queued"){j.set("status","init")}});this.counter.running=0;this._updateScreen()},_eventFtp:function(){if(!this.ftp.visible){this.ftp.empty();this.ftp.append((new g(this)).$el);this.ftp.show()}else{this.ftp.hide()}},_eventCreate:function(){this.uploadbox.add([{name:"New File",size:0,mode:"new"}])},_eventStart:function(){if(this.counter.announce==0||this.counter.running>0){return}var j=this;this.upload_size=0;this.upload_completed=0;this.collection.each(function(k){if(k.get("status")=="init"){k.set("status","queued");j.upload_size+=k.get("file_size")}});this.ui_button.set("percentage",0);this.ui_button.set("status","success");this.counter.running=this.counter.announce;this._updateScreen();this.uploadbox.start()},_eventStop:function(){if(this.counter.running==0){return}this.ui_button.set("status","info");this.uploadbox.stop();$("#upload-info").html("Queue will pause after completing the current file...")},_eventReset:function(){if(this.counter.running==0){this.collection.reset();this.counter.reset();this._updateScreen();this.uploadbox.reset();this.select_extension.value(this.list_extensions[0]);this.ui_button.set("percentage",0)}},_updateUser:function(){this.current_user=Galaxy.currUser.get("id");this.current_history=null;if(this.current_user){this.current_history=Galaxy.currHistoryPanel.model.get("id")}},_updateScreen:function(){if(this.counter.announce==0){if(this.uploadbox.compatible()){message="You can Drag & Drop files into this box."}else{message="Unfortunately, your browser does not support multiple file uploads or drag&drop.<br>Some supported browsers are: Firefox 4+, Chrome 7+, IE 10+, Opera 12+ or Safari 6+."}}else{if(this.counter.running==0){message="You added "+this.counter.announce+" file(s) to the queue. Add more files or click 'Start' to proceed."}else{message="Please wait..."+this.counter.announce+" out of "+this.counter.running+" remaining."}}$("#upload-info").html(message);if(this.counter.running==0&&this.counter.announce+this.counter.success+this.counter.error>0){this.modal.enableButton("Reset")}else{this.modal.disableButton("Reset")}if(this.counter.running==0&&this.counter.announce>0){this.modal.enableButton("Start")}else{this.modal.disableButton("Start")}if(this.counter.running>0){this.modal.enableButton("Pause")}else{this.modal.disableButton("Pause")}if(this.counter.running==0){this.modal.enableButton("Choose local file");this.modal.enableButton("Choose FTP file");this.modal.enableButton("Paste/Fetch data")}else{this.modal.disableButton("Choose local file");this.modal.disableButton("Choose FTP file");this.modal.disableButton("Paste/Fetch data")}if(this.current_user&&this.options.ftp_upload_dir&&this.options.ftp_upload_site){this.modal.showButton("Choose FTP file")}else{this.modal.hideButton("Choose FTP file")}if(this.counter.announce+this.counter.success+this.counter.error>0){$(this.el).find("#upload-table").show()}else{$(this.el).find("#upload-table").hide()}},_upload_percentage:function(j,k){return(this.upload_completed+(j*k))/this.upload_size},_template:function(k,j){return'<div id="uploadhead" class="uploadhead"><span class="fftext">"Set All" Types:  </span><span id="extension" class="extension"/>  <span id="extension-info_out" class="upload-icon-button fa fa-search"/></div><div id="'+k+'" class="upload-box"><table id="upload-table" class="table table-striped" style="display: none;"><thead><tr><th>Name</th><th>Size</th><th>Type</th><th>Genome</th><th>Settings</th><th>Status</th><th></th></tr></thead><tbody></tbody></table></div><div class="uploadfoot"><h6 id="'+j+'" class="upload-info"></h6></div>'}})});
\ No newline at end of file
+define(["utils/utils","mvc/upload/upload-button","mvc/upload/upload-model","mvc/upload/upload-row","mvc/upload/upload-ftp","mvc/ui/ui-popover","mvc/ui/ui-modal","mvc/ui/ui-select","utils/uploadbox"],function(f,e,c,b,g,d,a,h){return Backbone.View.extend({options:{nginx_upload_path:""},modal:null,ui_button:null,uploadbox:null,current_history:null,select_extension:null,upload_size:0,list_extensions:[],list_genomes:[],auto:{id:"auto",text:"Auto-detect",description:"This system will try to detect the file type automatically. If your file is not detected properly as one of the known formats, it most likely means that it has some format problems (e.g., different number of columns on different rows). You can still coerce the system to set your data to the format you think it should be. You can also upload compressed files, which will automatically be decompressed."},collection:new c.Collection(),ftp:null,counter:{announce:0,success:0,error:0,running:0,reset:function(){this.announce=this.success=this.error=this.running=0}},initialize:function(k){var j=this;if(k){this.options=_.defaults(k,this.options)}this.ui_button=new e.Model({icon:"fa-upload",tooltip:"Download from URL or upload files from disk",label:"Load Data",onclick:function(l){if(l){l.preventDefault();j.show()}},onunload:function(){if(j.counter.running>0){return"Several uploads are still processing."}}});$(".with-upload-button").append((new e.View(this.ui_button)).$el);var j=this;f.get({url:galaxy_config.root+"api/datatypes?extension_only=False",success:function(l){for(key in l){j.list_extensions.push({id:l[key].extension,text:l[key].extension,description:l[key].description,description_url:l[key].description_url})}j.list_extensions.sort(function(n,m){return n.id>m.id?1:n.id<m.id?-1:0});j.list_extensions.push({id:"---",text:"---",description:"",description_url:""});if(!j.options.datatypes_disable_auto){j.list_extensions.unshift(j.auto)}}});f.get({url:galaxy_config.root+"api/genomes",success:function(l){for(key in l){j.list_genomes.push({id:l[key][1],text:l[key][0]})}j.list_genomes.sort(function(n,m){return n.id>m.id?1:n.id<m.id?-1:0})}});this.collection.on("remove",function(l){j._eventRemove(l)});this.collection.on("change:genome",function(m){var l=m.get("genome");j.collection.each(function(n){if(n.get("status")=="init"&&n.get("genome")=="?"){n.set("genome",l)}})})},show:function(){var j=this;if(!Galaxy.currHistoryPanel||!Galaxy.currHistoryPanel.model){window.setTimeout(function(){j.show()},500);return}if(!this.modal){var j=this;this.modal=new a.View({title:"Download data directly from web or upload files from your disk",body:this._template("upload-box","upload-info"),buttons:{"Choose local file":function(){j.uploadbox.select()},"Choose FTP file":function(){j._eventFtp()},"Paste/Fetch data":function(){j._eventCreate()},Start:function(){j._eventStart()},Pause:function(){j._eventStop()},Reset:function(){j._eventReset()},Close:function(){j.modal.hide()},},height:"400",width:"900",closing_events:true});this.setElement("#upload-box");var j=this;this.uploadbox=this.$el.uploadbox({announce:function(l,m,n){j._eventAnnounce(l,m,n)},initialize:function(l,m,n){return j._eventInitialize(l,m,n)},progress:function(l,m,n){j._eventProgress(l,m,n)},success:function(l,m,n){j._eventSuccess(l,m,n)},error:function(l,m,n){j._eventError(l,m,n)},complete:function(){j._eventComplete()}});var k=this.modal.getButton("Choose FTP file");this.ftp=new d.View({title:"FTP files",container:k});this.select_extension=new h.View({css:"extension",onchange:function(){var m=j.select_extension.value();var l=j.collection.models.length;if(!(m==="---")){for(i=0;i<l;i++){j.collection.models[i].attributes.row.select_extension.value(m)}}},data:j.list_extensions,container:j.$el.parents().find("#extension"),value:j.list_extensions[0]});j.$el.parents().find("#extension-info_out").on("click",function(l){j._showExtensionInfo()}).on("mousedown",function(l){l.preventDefault()})}this.modal.show();this._updateUser();this._updateScreen()},_showExtensionInfo:function(){var j=this;var k=$(this.el).parents().find("#extension-info_out");var n=j.select_extension.value();var m=this.select_extension.text();var l=_.findWhere(j.list_extensions,{id:n});if(!this.extension_popup){this.extension_popup=new d.View({placement:"bottom",container:k})}if(!this.extension_popup.visible){this.extension_popup.title(m);this.extension_popup.empty();this.extension_popup.append(this._templateDescription(l));this.extension_popup.show()}else{this.extension_popup.hide()}},_templateDescription:function(k){if(k.description){var j=k.description;if(k.description_url){j+=' (<a href="'+k.description_url+'" target="_blank">read more</a>)'}return j}else{return"There is no description available for this file extension."}},_eventRemove:function(k){var j=k.get("status");if(j=="success"){this.counter.success--}else{if(j=="error"){this.counter.error--}else{this.counter.announce--}}this._updateScreen();this.uploadbox.remove(k.id)},_eventAnnounce:function(j,k,m){this.counter.announce++;this._updateScreen();var l=new b(this,{id:j,file_name:k.name,file_size:k.size,file_mode:k.mode,file_path:k.path});this.collection.add(l.model);$(this.el).find("tbody:first").append(l.$el);l.render()},_eventInitialize:function(o,l,u){var m=this.collection.get(o);m.set("status","running");var q=m.get("file_name");var p=m.get("file_path");var j=m.get("file_mode");var r=m.get("extension");var t=m.get("genome");var s=m.get("url_paste");var n=m.get("space_to_tabs");var k=m.get("to_posix_lines");if(!s&&!(l.size>0)){return null}this.uploadbox.configure({url:this.options.nginx_upload_path});if(j=="local"){this.uploadbox.configure({paramname:"files_0|file_data"})}else{this.uploadbox.configure({paramname:null})}tool_input={};if(j=="new"){tool_input["files_0|url_paste"]=s}if(j=="ftp"){tool_input["files_0|ftp_files"]=p}tool_input.dbkey=t;tool_input.file_type=r;tool_input["files_0|type"]="upload_dataset";tool_input["files_0|space_to_tab"]=n&&"Yes"||null;tool_input["files_0|to_posix_lines"]=k&&"Yes"||null;data={};data.history_id=this.current_history;data.tool_id="upload1";data.inputs=JSON.stringify(tool_input);return data},_eventProgress:function(k,l,j){var m=this.collection.get(k);m.set("percentage",j);this.ui_button.set("percentage",this._upload_percentage(j,l.size))},_eventSuccess:function(k,l,n){var m=this.collection.get(k);m.set("percentage",100);m.set("status","success");var j=m.get("file_size");this.ui_button.set("percentage",this._upload_percentage(100,j));this.upload_completed+=j*100;this.counter.announce--;this.counter.success++;this._updateScreen();Galaxy.currHistoryPanel.refreshContents()},_eventError:function(j,k,m){var l=this.collection.get(j);l.set("percentage",100);l.set("status","error");l.set("info",m);this.ui_button.set("percentage",this._upload_percentage(100,k.size));this.ui_button.set("status","danger");this.upload_completed+=k.size*100;this.counter.announce--;this.counter.error++;this._updateScreen()},_eventComplete:function(){this.collection.each(function(j){if(j.get("status")=="queued"){j.set("status","init")}});this.counter.running=0;this._updateScreen()},_eventFtp:function(){if(!this.ftp.visible){this.ftp.empty();this.ftp.append((new g(this)).$el);this.ftp.show()}else{this.ftp.hide()}},_eventCreate:function(){this.uploadbox.add([{name:"New File",size:0,mode:"new"}])},_eventStart:function(){if(this.counter.announce==0||this.counter.running>0){return}var j=this;this.upload_size=0;this.upload_completed=0;this.collection.each(function(k){if(k.get("status")=="init"){k.set("status","queued");j.upload_size+=k.get("file_size")}});this.ui_button.set("percentage",0);this.ui_button.set("status","success");this.counter.running=this.counter.announce;this._updateScreen();this.uploadbox.start()},_eventStop:function(){if(this.counter.running==0){return}this.ui_button.set("status","info");this.uploadbox.stop();$("#upload-info").html("Queue will pause after completing the current file...")},_eventReset:function(){if(this.counter.running==0){this.collection.reset();this.counter.reset();this._updateScreen();this.uploadbox.reset();this.select_extension.value(this.list_extensions[0]);this.ui_button.set("percentage",0)}},_updateUser:function(){this.current_user=Galaxy.currUser.get("id");this.current_history=null;if(this.current_user){this.current_history=Galaxy.currHistoryPanel.model.get("id")}},_updateScreen:function(){if(this.counter.announce==0){if(this.uploadbox.compatible()){message="You can Drag & Drop files into this box."}else{message="Unfortunately, your browser does not support multiple file uploads or drag&drop.<br>Some supported browsers are: Firefox 4+, Chrome 7+, IE 10+, Opera 12+ or Safari 6+."}}else{if(this.counter.running==0){message="You added "+this.counter.announce+" file(s) to the queue. Add more files or click 'Start' to proceed."}else{message="Please wait..."+this.counter.announce+" out of "+this.counter.running+" remaining."}}$("#upload-info").html(message);if(this.counter.running==0&&this.counter.announce+this.counter.success+this.counter.error>0){this.modal.enableButton("Reset")}else{this.modal.disableButton("Reset")}if(this.counter.running==0&&this.counter.announce>0){this.modal.enableButton("Start")}else{this.modal.disableButton("Start")}if(this.counter.running>0){this.modal.enableButton("Pause")}else{this.modal.disableButton("Pause")}if(this.counter.running==0){this.modal.enableButton("Choose local file");this.modal.enableButton("Choose FTP file");this.modal.enableButton("Paste/Fetch data")}else{this.modal.disableButton("Choose local file");this.modal.disableButton("Choose FTP file");this.modal.disableButton("Paste/Fetch data")}if(this.current_user&&this.options.ftp_upload_dir&&this.options.ftp_upload_site){this.modal.showButton("Choose FTP file")}else{this.modal.hideButton("Choose FTP file")}if(this.counter.announce+this.counter.success+this.counter.error>0){$(this.el).find("#upload-table").show()}else{$(this.el).find("#upload-table").hide()}},_upload_percentage:function(j,k){return(this.upload_completed+(j*k))/this.upload_size},_template:function(k,j){return'<div id="uploadhead" class="uploadhead"><span class="fftext">"Set All" Types:  </span><span id="extension" class="extension"/>  <span id="extension-info_out" class="upload-icon-button fa fa-search"/></div><div id="'+k+'" class="upload-box"><table id="upload-table" class="table table-striped" style="display: none;"><thead><tr><th>Name</th><th>Size</th><th>Type</th><th>Genome</th><th>Settings</th><th>Status</th><th></th></tr></thead><tbody></tbody></table></div><div class="uploadfoot"><h6 id="'+j+'" class="upload-info"></h6></div>'}})});
\ No newline at end of file
https://bitbucket.org/galaxy/galaxy-central/commits/d8d20b31c15b/
Changeset: d8d20b31c15b
User: dannon
Date: 2015-01-23 19:46:08+00:00
Summary: Formatting/cleanup of upload.js's
Affected #: 8 files
diff -r 3232c9fc4d8fbdbed3416ae9745adbb93aafd70f -r d8d20b31c15bec018df93653c3f39e5d41e374f6 client/galaxy/scripts/mvc/upload/upload-button.js
--- a/client/galaxy/scripts/mvc/upload/upload-button.js
+++ b/client/galaxy/scripts/mvc/upload/upload-button.js
@@ -20,24 +20,24 @@
initialize : function(model) {
// link this
var self = this;
-
+
// create model
this.model = model;
-
+
// get options
this.options = this.model.attributes;
-
+
// create new element
this.setElement(this._template(this.options));
-
+
// add event
$(this.el).on('click', this.options.onclick);
-
+
// add tooltip
if (this.options.tooltip) {
$(this.el).tooltip({title: this.options.tooltip, placement: 'bottom'});
}
-
+
// events
this.model.on('change:percentage', function() {
self._percentage(self.model.get('percentage'));
@@ -45,7 +45,7 @@
this.model.on('change:status', function() {
self._status(self.model.get('status'));
});
-
+
// unload event
var self = this;
$(window).on('beforeunload', function() {
@@ -58,7 +58,7 @@
}
});
},
-
+
// set status
_status: function(value) {
var $el = this.$el.find('.progress-bar');
@@ -69,13 +69,13 @@
$el.addClass('progress-bar-' + value);
}
},
-
+
// set percentage
_percentage: function(value) {
var $el = this.$el.find('.progress-bar');
$el.css({ width : value + '%' });
},
-
+
// template
_template: function(options) {
return '<div style="float: right">' +
diff -r 3232c9fc4d8fbdbed3416ae9745adbb93aafd70f -r d8d20b31c15bec018df93653c3f39e5d41e374f6 client/galaxy/scripts/mvc/upload/upload-ftp.js
--- a/client/galaxy/scripts/mvc/upload/upload-ftp.js
+++ b/client/galaxy/scripts/mvc/upload/upload-ftp.js
@@ -8,18 +8,18 @@
class_add : 'upload-icon-button fa fa-square-o',
class_remove : 'upload-icon-button fa fa-check-square-o'
},
-
+
// render
initialize: function(app) {
// link app
this.app = app;
-
+
// link this
var self = this;
-
+
// set template
this.setElement(this._template());
-
+
// load extension
Utils.get({
url : galaxy_config.root + 'api/ftp_files',
@@ -27,26 +27,26 @@
error : function() { self._fill(); }
});
},
-
+
// events
events: {
'mousedown' : function(e) { e.preventDefault(); }
},
-
+
// fill table
_fill: function(ftp_files) {
var self = this;
if (ftp_files && ftp_files.length > 0) {
// add table
this.$el.find('#upload-ftp-content').html($(this._templateTable()));
-
+
// add files to table
var size = 0;
for (key in ftp_files) {
this.add(ftp_files[key]);
size += ftp_files[key].size;
}
-
+
// update stats
this.$el.find('#upload-ftp-number').html(ftp_files.length + ' files');
this.$el.find('#upload-ftp-disk').html(Utils.bytesToString (size, true));
@@ -90,21 +90,21 @@
// hide spinner
this.$el.find('#upload-ftp-wait').hide();
},
-
+
// add
add: function(ftp_file) {
// link this
var self = this;
-
+
// create new item
var $it = $(this._templateRow(ftp_file));
-
+
// identify icon
var $icon = $it.find('.icon');
-
+
// append to table
$(this.el).find('tbody').append($it);
-
+
// find model and set initial 'add' icon class
var icon_class = '';
if (this._find(ftp_file)) {
@@ -115,7 +115,7 @@
// add icon class
$icon.addClass(icon_class);
-
+
// add files to the uploadbox
$it.on('updateUpBox', function() {
// find model
@@ -195,7 +195,7 @@
}
return model_index;
},
-
+
// template row
_templateRow: function(options) {
return '<tr class="upload-ftp-row" style="cursor: pointer;">' +
@@ -205,7 +205,7 @@
'<td style="white-space: nowrap;">' + options.ctime + '</td>' +
'</tr>';
},
-
+
// load table template
_templateTable: function() {
return '<span style="whitespace: nowrap; float: left;">Available files: </span>' +
@@ -227,14 +227,14 @@
'<tbody></tbody>' +
'</table>';
},
-
+
// load table template
_templateInfo: function() {
return '<div class="upload-ftp-warning warningmessage">' +
'Your FTP directory does not contain any files.' +
'</div>';
},
-
+
// load html template
_template: function() {
return '<div class="upload-ftp">' +
@@ -243,7 +243,7 @@
'<div id="upload-ftp-content"></div>' +
'<div>';
}
-
+
});
});
diff -r 3232c9fc4d8fbdbed3416ae9745adbb93aafd70f -r d8d20b31c15bec018df93653c3f39e5d41e374f6 client/galaxy/scripts/mvc/upload/upload-model.js
--- a/client/galaxy/scripts/mvc/upload/upload-model.js
+++ b/client/galaxy/scripts/mvc/upload/upload-model.js
@@ -15,7 +15,6 @@
file_path : '',
percentage : 0,
row : null,
-
// settings
space_to_tabs : false,
to_posix_lines : true
diff -r 3232c9fc4d8fbdbed3416ae9745adbb93aafd70f -r d8d20b31c15bec018df93653c3f39e5d41e374f6 client/galaxy/scripts/mvc/upload/upload-view.js
--- a/client/galaxy/scripts/mvc/upload/upload-view.js
+++ b/client/galaxy/scripts/mvc/upload/upload-view.js
@@ -8,7 +8,7 @@
"mvc/ui/ui-modal",
"mvc/ui/ui-select",
"utils/uploadbox"],
-
+
function( Utils,
UploadButton,
UploadModel,
@@ -25,44 +25,44 @@
options : {
nginx_upload_path : ''
},
-
+
// own modal
modal : null,
-
+
// button
ui_button : null,
-
+
// jquery uploadbox plugin
uploadbox: null,
-
+
// current history
current_history: null,
// extension selector
select_extension : null,
-
+
// current upload size
upload_size: 0,
-
+
// extension types
list_extensions :[],
-
+
// genomes
list_genomes : [],
-
+
// datatype placeholder for auto-detection
auto: {
id : 'auto',
text : 'Auto-detect',
description : 'This system will try to detect the file type automatically. If your file is not detected properly as one of the known formats, it most likely means that it has some format problems (e.g., different number of columns on different rows). You can still coerce the system to set your data to the format you think it should be. You can also upload compressed files, which will automatically be decompressed.'
},
-
+
// collection
collection : new UploadModel.Collection(),
-
+
// ftp file viewer
ftp : null,
-
+
// counter
counter : {
// stats
@@ -70,13 +70,13 @@
success : 0,
error : 0,
running : 0,
-
+
// reset stats
reset : function() {
this.announce = this.success = this.error = this.running = 0;
}
},
-
+
// initialize
initialize : function(options) {
// link this
@@ -86,7 +86,7 @@
if (options) {
this.options = _.defaults(options, this.options);
}
-
+
// create model
this.ui_button = new UploadButton.Model({
icon : 'fa-upload',
@@ -96,7 +96,7 @@
if (e) {
// prevent default
e.preventDefault();
-
+
// show
self.show()
}
@@ -107,10 +107,10 @@
}
}
});
-
+
// define location
$('.with-upload-button').append((new UploadButton.View(this.ui_button)).$el);
-
+
// load extension
var self = this;
Utils.get({
@@ -137,14 +137,14 @@
description : "",
description_url : ""
});
-
+
// add auto field
if (!self.options.datatypes_disable_auto) {
self.list_extensions.unshift(self.auto);
}
}
});
-
+
// load genomes
Utils.get({
url : galaxy_config.root + "api/genomes",
@@ -155,14 +155,14 @@
text : genomes[key][0]
});
}
-
+
// sort
self.list_genomes.sort(function(a, b) {
return a.id > b.id ? 1 : a.id < b.id ? -1 : 0;
});
}
});
-
+
// events
this.collection.on('remove', function(item) {
self._eventRemove(item);
@@ -176,11 +176,11 @@
});
});
},
-
+
//
// event triggered by upload button
//
-
+
// show/hide upload frame
show: function () {
// wait for galaxy history panel
@@ -189,7 +189,7 @@
window.setTimeout(function() { self.show() }, 500)
return;
}
-
+
// create modal
if (!this.modal) {
// make modal
@@ -210,10 +210,10 @@
width : '900',
closing_events : true
});
-
+
// set element
this.setElement('#upload-box');
-
+
// file upload
var self = this;
this.uploadbox = this.$el.uploadbox({
@@ -224,7 +224,7 @@
error : function(index, file, message) { self._eventError(index, file, message) },
complete : function() { self._eventComplete() }
});
-
+
// add ftp file viewer
var button = this.modal.getButton('Choose FTP file');
this.ftp = new Popover.View({
@@ -238,7 +238,7 @@
onchange : function() {
var newExten = self.select_extension.value()
var len = self.collection.models.length;
- // Only trigger changing the rows if the "set all" isn't set to '---'
+ // Only trigger changing the rows if the "set all" isn't set to '---'
// Prevents recursively changing the rows after an individual row has been changed
if(!(newExten === '---')){
for(i = 0; i < len; i++){
@@ -255,13 +255,13 @@
self.$el.parents().find('#extension-info_out').on('click' , function(e) { self._showExtensionInfo(); })
.on('mousedown', function(e) { e.preventDefault(); });
}
-
+
// show modal
this.modal.show();
-
+
// refresh
this._updateUser();
-
+
// setup info
this._updateScreen();
},
@@ -271,7 +271,7 @@
var self = this;
var $el = $(this.el).parents().find('#extension-info_out');
var extension = self.select_extension.value();
-
+
var title = this.select_extension.text();
var description = _.findWhere(self.list_extensions, {'id': extension});
@@ -310,12 +310,12 @@
//
// events triggered by collection
//
-
+
// remove item from upload list
_eventRemove : function(item) {
// update status
var status = item.get('status');
-
+
// reduce counter
if (status == 'success') {
this.counter.success--;
@@ -324,26 +324,26 @@
} else {
this.counter.announce--;
}
-
+
// show on screen info
this._updateScreen();
-
+
// remove from queue
this.uploadbox.remove(item.id);
},
-
+
//
// events triggered by the upload box plugin
//
-
+
// a new file has been dropped/selected through the uploadbox plugin
_eventAnnounce : function(index, file, message) {
// update counter
this.counter.announce++;
-
+
// update screen
this._updateScreen();
-
+
// create view/model
var upload_item = new UploadItem(this, {
id : index,
@@ -352,25 +352,25 @@
file_mode : file.mode,
file_path : file.path
});
-
+
// add to collection
this.collection.add(upload_item.model);
-
+
// add upload item element to table
$(this.el).find('tbody:first').append(upload_item.$el);
-
+
// render
upload_item.render();
},
-
+
// the uploadbox plugin is initializing the upload for this file
_eventInitialize : function(index, file, message) {
// get element
var it = this.collection.get(index);
-
+
// update status
it.set('status', 'running');
-
+
// get configuration
var file_name = it.get('file_name');
var file_path = it.get('file_path');
@@ -380,113 +380,113 @@
var url_paste = it.get('url_paste');
var space_to_tabs = it.get('space_to_tabs');
var to_posix_lines = it.get('to_posix_lines');
-
+
// validate
if (!url_paste && !(file.size > 0))
return null;
-
+
// configure uploadbox
this.uploadbox.configure({url : this.options.nginx_upload_path});
-
+
// local files
if (file_mode == 'local') {
this.uploadbox.configure({paramname : 'files_0|file_data'});
} else {
this.uploadbox.configure({paramname : null});
}
-
+
// configure tool
tool_input = {};
-
+
// new files
if (file_mode == 'new') {
tool_input['files_0|url_paste'] = url_paste;
}
-
+
// files from ftp
if (file_mode == 'ftp') {
tool_input['files_0|ftp_files'] = file_path;
}
-
+
// add common configuration
tool_input['dbkey'] = genome;
tool_input['file_type'] = extension;
tool_input['files_0|type'] = 'upload_dataset';
tool_input['files_0|space_to_tab'] = space_to_tabs && 'Yes' || null;
tool_input['files_0|to_posix_lines'] = to_posix_lines && 'Yes' || null;
-
+
// setup data
data = {};
data['history_id'] = this.current_history;
data['tool_id'] = 'upload1';
data['inputs'] = JSON.stringify(tool_input);
-
+
// return additional data to be send with file
return data;
},
-
+
// progress
_eventProgress : function(index, file, percentage) {
// set progress for row
var it = this.collection.get(index);
it.set('percentage', percentage);
-
+
// update ui button
this.ui_button.set('percentage', this._upload_percentage(percentage, file.size));
},
-
+
// success
_eventSuccess : function(index, file, message) {
// update status
var it = this.collection.get(index);
it.set('percentage', 100);
it.set('status', 'success');
-
+
// file size
var file_size = it.get('file_size');
-
+
// update ui button
this.ui_button.set('percentage', this._upload_percentage(100, file_size));
-
+
// update completed
this.upload_completed += file_size * 100;
-
+
// update counter
this.counter.announce--;
this.counter.success++;
-
+
// update on screen info
this._updateScreen();
-
+
// update galaxy history
Galaxy.currHistoryPanel.refreshContents();
},
-
+
// error
_eventError : function(index, file, message) {
// get element
var it = this.collection.get(index);
-
+
// update status
it.set('percentage', 100);
it.set('status', 'error');
it.set('info', message);
-
+
// update ui button
this.ui_button.set('percentage', this._upload_percentage(100, file.size));
this.ui_button.set('status', 'danger');
-
+
// update completed
this.upload_completed += file.size * 100;
-
+
// update counter
this.counter.announce--;
this.counter.error++;
-
+
// update on screen info
this._updateScreen();
},
-
+
// queue is done
_eventComplete: function() {
// reset queued upload to initial status
@@ -495,16 +495,16 @@
item.set('status', 'init');
}
});
-
+
// update running
this.counter.running = 0;
this._updateScreen();
},
-
+
//
// events triggered by this view
//
-
+
_eventFtp: function() {
// check if popover is visible
if (!this.ftp.visible) {
@@ -533,7 +533,7 @@
if (this.counter.announce == 0 || this.counter.running > 0) {
return;
}
-
+
// reset current size
var self = this;
this.upload_size = 0;
@@ -545,19 +545,19 @@
self.upload_size += item.get('file_size');
}
});
-
+
// reset progress
this.ui_button.set('percentage', 0);
this.ui_button.set('status', 'success');
-
+
// update running
this.counter.running = this.counter.announce;
this._updateScreen();
-
+
// initiate upload procedure in plugin
this.uploadbox.start();
},
-
+
// pause upload process
_eventStop : function() {
// check
@@ -570,35 +570,35 @@
// request pause
this.uploadbox.stop();
-
+
// set html content
$('#upload-info').html('Queue will pause after completing the current file...');
},
-
+
// remove all
_eventReset : function() {
// make sure queue is not running
if (this.counter.running == 0){
// reset collection
this.collection.reset();
-
+
// reset counter
this.counter.reset();
-
+
// show on screen info
this._updateScreen();
-
+
// remove from queue
this.uploadbox.reset();
// reset value for universal type drop-down
this.select_extension.value(this.list_extensions[0]);
-
+
// reset button
this.ui_button.set('percentage', 0);
}
},
-
+
// update uset
_updateUser: function() {
// backup current history
@@ -608,13 +608,13 @@
this.current_history = Galaxy.currHistoryPanel.model.get('id');
}
},
-
+
// set screen
_updateScreen: function () {
/*
update on screen info
*/
-
+
// check default message
if(this.counter.announce == 0){
if (this.uploadbox.compatible())
@@ -627,20 +627,20 @@
else
message = 'Please wait...' + this.counter.announce + ' out of ' + this.counter.running + ' remaining.';
}
-
+
// set html content
$('#upload-info').html(message);
-
+
/*
update button status
*/
-
+
// update reset button
if (this.counter.running == 0 && this.counter.announce + this.counter.success + this.counter.error > 0)
this.modal.enableButton('Reset');
else
this.modal.disableButton('Reset');
-
+
// update upload button
if (this.counter.running == 0 && this.counter.announce > 0)
this.modal.enableButton('Start');
@@ -652,7 +652,7 @@
this.modal.enableButton('Pause');
else
this.modal.disableButton('Pause');
-
+
// select upload button
if (this.counter.running == 0){
this.modal.enableButton('Choose local file');
@@ -663,14 +663,14 @@
this.modal.disableButton('Choose FTP file');
this.modal.disableButton('Paste/Fetch data');
}
-
+
// ftp button
if (this.current_user && this.options.ftp_upload_dir && this.options.ftp_upload_site) {
this.modal.showButton('Choose FTP file');
} else {
this.modal.hideButton('Choose FTP file');
}
-
+
// table visibility
if (this.counter.announce + this.counter.success + this.counter.error > 0) {
$(this.el).find('#upload-table').show();
diff -r 3232c9fc4d8fbdbed3416ae9745adbb93aafd70f -r d8d20b31c15bec018df93653c3f39e5d41e374f6 static/scripts/mvc/upload/upload-button.js
--- a/static/scripts/mvc/upload/upload-button.js
+++ b/static/scripts/mvc/upload/upload-button.js
@@ -20,24 +20,24 @@
initialize : function(model) {
// link this
var self = this;
-
+
// create model
this.model = model;
-
+
// get options
this.options = this.model.attributes;
-
+
// create new element
this.setElement(this._template(this.options));
-
+
// add event
$(this.el).on('click', this.options.onclick);
-
+
// add tooltip
if (this.options.tooltip) {
$(this.el).tooltip({title: this.options.tooltip, placement: 'bottom'});
}
-
+
// events
this.model.on('change:percentage', function() {
self._percentage(self.model.get('percentage'));
@@ -45,7 +45,7 @@
this.model.on('change:status', function() {
self._status(self.model.get('status'));
});
-
+
// unload event
var self = this;
$(window).on('beforeunload', function() {
@@ -58,7 +58,7 @@
}
});
},
-
+
// set status
_status: function(value) {
var $el = this.$el.find('.progress-bar');
@@ -69,13 +69,13 @@
$el.addClass('progress-bar-' + value);
}
},
-
+
// set percentage
_percentage: function(value) {
var $el = this.$el.find('.progress-bar');
$el.css({ width : value + '%' });
},
-
+
// template
_template: function(options) {
return '<div style="float: right">' +
diff -r 3232c9fc4d8fbdbed3416ae9745adbb93aafd70f -r d8d20b31c15bec018df93653c3f39e5d41e374f6 static/scripts/mvc/upload/upload-ftp.js
--- a/static/scripts/mvc/upload/upload-ftp.js
+++ b/static/scripts/mvc/upload/upload-ftp.js
@@ -8,18 +8,18 @@
class_add : 'upload-icon-button fa fa-square-o',
class_remove : 'upload-icon-button fa fa-check-square-o'
},
-
+
// render
initialize: function(app) {
// link app
this.app = app;
-
+
// link this
var self = this;
-
+
// set template
this.setElement(this._template());
-
+
// load extension
Utils.get({
url : galaxy_config.root + 'api/ftp_files',
@@ -27,26 +27,26 @@
error : function() { self._fill(); }
});
},
-
+
// events
events: {
'mousedown' : function(e) { e.preventDefault(); }
},
-
+
// fill table
_fill: function(ftp_files) {
var self = this;
if (ftp_files && ftp_files.length > 0) {
// add table
this.$el.find('#upload-ftp-content').html($(this._templateTable()));
-
+
// add files to table
var size = 0;
for (key in ftp_files) {
this.add(ftp_files[key]);
size += ftp_files[key].size;
}
-
+
// update stats
this.$el.find('#upload-ftp-number').html(ftp_files.length + ' files');
this.$el.find('#upload-ftp-disk').html(Utils.bytesToString (size, true));
@@ -90,21 +90,21 @@
// hide spinner
this.$el.find('#upload-ftp-wait').hide();
},
-
+
// add
add: function(ftp_file) {
// link this
var self = this;
-
+
// create new item
var $it = $(this._templateRow(ftp_file));
-
+
// identify icon
var $icon = $it.find('.icon');
-
+
// append to table
$(this.el).find('tbody').append($it);
-
+
// find model and set initial 'add' icon class
var icon_class = '';
if (this._find(ftp_file)) {
@@ -115,7 +115,7 @@
// add icon class
$icon.addClass(icon_class);
-
+
// add files to the uploadbox
$it.on('updateUpBox', function() {
// find model
@@ -195,7 +195,7 @@
}
return model_index;
},
-
+
// template row
_templateRow: function(options) {
return '<tr class="upload-ftp-row" style="cursor: pointer;">' +
@@ -205,7 +205,7 @@
'<td style="white-space: nowrap;">' + options.ctime + '</td>' +
'</tr>';
},
-
+
// load table template
_templateTable: function() {
return '<span style="whitespace: nowrap; float: left;">Available files: </span>' +
@@ -227,14 +227,14 @@
'<tbody></tbody>' +
'</table>';
},
-
+
// load table template
_templateInfo: function() {
return '<div class="upload-ftp-warning warningmessage">' +
'Your FTP directory does not contain any files.' +
'</div>';
},
-
+
// load html template
_template: function() {
return '<div class="upload-ftp">' +
@@ -243,7 +243,7 @@
'<div id="upload-ftp-content"></div>' +
'<div>';
}
-
+
});
});
diff -r 3232c9fc4d8fbdbed3416ae9745adbb93aafd70f -r d8d20b31c15bec018df93653c3f39e5d41e374f6 static/scripts/mvc/upload/upload-model.js
--- a/static/scripts/mvc/upload/upload-model.js
+++ b/static/scripts/mvc/upload/upload-model.js
@@ -15,7 +15,6 @@
file_path : '',
percentage : 0,
row : null,
-
// settings
space_to_tabs : false,
to_posix_lines : true
diff -r 3232c9fc4d8fbdbed3416ae9745adbb93aafd70f -r d8d20b31c15bec018df93653c3f39e5d41e374f6 static/scripts/mvc/upload/upload-view.js
--- a/static/scripts/mvc/upload/upload-view.js
+++ b/static/scripts/mvc/upload/upload-view.js
@@ -8,7 +8,7 @@
"mvc/ui/ui-modal",
"mvc/ui/ui-select",
"utils/uploadbox"],
-
+
function( Utils,
UploadButton,
UploadModel,
@@ -25,44 +25,44 @@
options : {
nginx_upload_path : ''
},
-
+
// own modal
modal : null,
-
+
// button
ui_button : null,
-
+
// jquery uploadbox plugin
uploadbox: null,
-
+
// current history
current_history: null,
// extension selector
select_extension : null,
-
+
// current upload size
upload_size: 0,
-
+
// extension types
list_extensions :[],
-
+
// genomes
list_genomes : [],
-
+
// datatype placeholder for auto-detection
auto: {
id : 'auto',
text : 'Auto-detect',
description : 'This system will try to detect the file type automatically. If your file is not detected properly as one of the known formats, it most likely means that it has some format problems (e.g., different number of columns on different rows). You can still coerce the system to set your data to the format you think it should be. You can also upload compressed files, which will automatically be decompressed.'
},
-
+
// collection
collection : new UploadModel.Collection(),
-
+
// ftp file viewer
ftp : null,
-
+
// counter
counter : {
// stats
@@ -70,13 +70,13 @@
success : 0,
error : 0,
running : 0,
-
+
// reset stats
reset : function() {
this.announce = this.success = this.error = this.running = 0;
}
},
-
+
// initialize
initialize : function(options) {
// link this
@@ -86,7 +86,7 @@
if (options) {
this.options = _.defaults(options, this.options);
}
-
+
// create model
this.ui_button = new UploadButton.Model({
icon : 'fa-upload',
@@ -96,7 +96,7 @@
if (e) {
// prevent default
e.preventDefault();
-
+
// show
self.show()
}
@@ -107,10 +107,10 @@
}
}
});
-
+
// define location
$('.with-upload-button').append((new UploadButton.View(this.ui_button)).$el);
-
+
// load extension
var self = this;
Utils.get({
@@ -137,14 +137,14 @@
description : "",
description_url : ""
});
-
+
// add auto field
if (!self.options.datatypes_disable_auto) {
self.list_extensions.unshift(self.auto);
}
}
});
-
+
// load genomes
Utils.get({
url : galaxy_config.root + "api/genomes",
@@ -155,14 +155,14 @@
text : genomes[key][0]
});
}
-
+
// sort
self.list_genomes.sort(function(a, b) {
return a.id > b.id ? 1 : a.id < b.id ? -1 : 0;
});
}
});
-
+
// events
this.collection.on('remove', function(item) {
self._eventRemove(item);
@@ -176,11 +176,11 @@
});
});
},
-
+
//
// event triggered by upload button
//
-
+
// show/hide upload frame
show: function () {
// wait for galaxy history panel
@@ -189,7 +189,7 @@
window.setTimeout(function() { self.show() }, 500)
return;
}
-
+
// create modal
if (!this.modal) {
// make modal
@@ -210,10 +210,10 @@
width : '900',
closing_events : true
});
-
+
// set element
this.setElement('#upload-box');
-
+
// file upload
var self = this;
this.uploadbox = this.$el.uploadbox({
@@ -224,7 +224,7 @@
error : function(index, file, message) { self._eventError(index, file, message) },
complete : function() { self._eventComplete() }
});
-
+
// add ftp file viewer
var button = this.modal.getButton('Choose FTP file');
this.ftp = new Popover.View({
@@ -238,7 +238,7 @@
onchange : function() {
var newExten = self.select_extension.value()
var len = self.collection.models.length;
- // Only trigger changing the rows if the "set all" isn't set to '---'
+ // Only trigger changing the rows if the "set all" isn't set to '---'
// Prevents recursively changing the rows after an individual row has been changed
if(!(newExten === '---')){
for(i = 0; i < len; i++){
@@ -255,13 +255,13 @@
self.$el.parents().find('#extension-info_out').on('click' , function(e) { self._showExtensionInfo(); })
.on('mousedown', function(e) { e.preventDefault(); });
}
-
+
// show modal
this.modal.show();
-
+
// refresh
this._updateUser();
-
+
// setup info
this._updateScreen();
},
@@ -271,7 +271,7 @@
var self = this;
var $el = $(this.el).parents().find('#extension-info_out');
var extension = self.select_extension.value();
-
+
var title = this.select_extension.text();
var description = _.findWhere(self.list_extensions, {'id': extension});
@@ -310,12 +310,12 @@
//
// events triggered by collection
//
-
+
// remove item from upload list
_eventRemove : function(item) {
// update status
var status = item.get('status');
-
+
// reduce counter
if (status == 'success') {
this.counter.success--;
@@ -324,26 +324,26 @@
} else {
this.counter.announce--;
}
-
+
// show on screen info
this._updateScreen();
-
+
// remove from queue
this.uploadbox.remove(item.id);
},
-
+
//
// events triggered by the upload box plugin
//
-
+
// a new file has been dropped/selected through the uploadbox plugin
_eventAnnounce : function(index, file, message) {
// update counter
this.counter.announce++;
-
+
// update screen
this._updateScreen();
-
+
// create view/model
var upload_item = new UploadItem(this, {
id : index,
@@ -352,25 +352,25 @@
file_mode : file.mode,
file_path : file.path
});
-
+
// add to collection
this.collection.add(upload_item.model);
-
+
// add upload item element to table
$(this.el).find('tbody:first').append(upload_item.$el);
-
+
// render
upload_item.render();
},
-
+
// the uploadbox plugin is initializing the upload for this file
_eventInitialize : function(index, file, message) {
// get element
var it = this.collection.get(index);
-
+
// update status
it.set('status', 'running');
-
+
// get configuration
var file_name = it.get('file_name');
var file_path = it.get('file_path');
@@ -380,113 +380,113 @@
var url_paste = it.get('url_paste');
var space_to_tabs = it.get('space_to_tabs');
var to_posix_lines = it.get('to_posix_lines');
-
+
// validate
if (!url_paste && !(file.size > 0))
return null;
-
+
// configure uploadbox
this.uploadbox.configure({url : this.options.nginx_upload_path});
-
+
// local files
if (file_mode == 'local') {
this.uploadbox.configure({paramname : 'files_0|file_data'});
} else {
this.uploadbox.configure({paramname : null});
}
-
+
// configure tool
tool_input = {};
-
+
// new files
if (file_mode == 'new') {
tool_input['files_0|url_paste'] = url_paste;
}
-
+
// files from ftp
if (file_mode == 'ftp') {
tool_input['files_0|ftp_files'] = file_path;
}
-
+
// add common configuration
tool_input['dbkey'] = genome;
tool_input['file_type'] = extension;
tool_input['files_0|type'] = 'upload_dataset';
tool_input['files_0|space_to_tab'] = space_to_tabs && 'Yes' || null;
tool_input['files_0|to_posix_lines'] = to_posix_lines && 'Yes' || null;
-
+
// setup data
data = {};
data['history_id'] = this.current_history;
data['tool_id'] = 'upload1';
data['inputs'] = JSON.stringify(tool_input);
-
+
// return additional data to be send with file
return data;
},
-
+
// progress
_eventProgress : function(index, file, percentage) {
// set progress for row
var it = this.collection.get(index);
it.set('percentage', percentage);
-
+
// update ui button
this.ui_button.set('percentage', this._upload_percentage(percentage, file.size));
},
-
+
// success
_eventSuccess : function(index, file, message) {
// update status
var it = this.collection.get(index);
it.set('percentage', 100);
it.set('status', 'success');
-
+
// file size
var file_size = it.get('file_size');
-
+
// update ui button
this.ui_button.set('percentage', this._upload_percentage(100, file_size));
-
+
// update completed
this.upload_completed += file_size * 100;
-
+
// update counter
this.counter.announce--;
this.counter.success++;
-
+
// update on screen info
this._updateScreen();
-
+
// update galaxy history
Galaxy.currHistoryPanel.refreshContents();
},
-
+
// error
_eventError : function(index, file, message) {
// get element
var it = this.collection.get(index);
-
+
// update status
it.set('percentage', 100);
it.set('status', 'error');
it.set('info', message);
-
+
// update ui button
this.ui_button.set('percentage', this._upload_percentage(100, file.size));
this.ui_button.set('status', 'danger');
-
+
// update completed
this.upload_completed += file.size * 100;
-
+
// update counter
this.counter.announce--;
this.counter.error++;
-
+
// update on screen info
this._updateScreen();
},
-
+
// queue is done
_eventComplete: function() {
// reset queued upload to initial status
@@ -495,16 +495,16 @@
item.set('status', 'init');
}
});
-
+
// update running
this.counter.running = 0;
this._updateScreen();
},
-
+
//
// events triggered by this view
//
-
+
_eventFtp: function() {
// check if popover is visible
if (!this.ftp.visible) {
@@ -533,7 +533,7 @@
if (this.counter.announce == 0 || this.counter.running > 0) {
return;
}
-
+
// reset current size
var self = this;
this.upload_size = 0;
@@ -545,19 +545,19 @@
self.upload_size += item.get('file_size');
}
});
-
+
// reset progress
this.ui_button.set('percentage', 0);
this.ui_button.set('status', 'success');
-
+
// update running
this.counter.running = this.counter.announce;
this._updateScreen();
-
+
// initiate upload procedure in plugin
this.uploadbox.start();
},
-
+
// pause upload process
_eventStop : function() {
// check
@@ -570,35 +570,35 @@
// request pause
this.uploadbox.stop();
-
+
// set html content
$('#upload-info').html('Queue will pause after completing the current file...');
},
-
+
// remove all
_eventReset : function() {
// make sure queue is not running
if (this.counter.running == 0){
// reset collection
this.collection.reset();
-
+
// reset counter
this.counter.reset();
-
+
// show on screen info
this._updateScreen();
-
+
// remove from queue
this.uploadbox.reset();
// reset value for universal type drop-down
this.select_extension.value(this.list_extensions[0]);
-
+
// reset button
this.ui_button.set('percentage', 0);
}
},
-
+
// update uset
_updateUser: function() {
// backup current history
@@ -608,13 +608,13 @@
this.current_history = Galaxy.currHistoryPanel.model.get('id');
}
},
-
+
// set screen
_updateScreen: function () {
/*
update on screen info
*/
-
+
// check default message
if(this.counter.announce == 0){
if (this.uploadbox.compatible())
@@ -627,20 +627,20 @@
else
message = 'Please wait...' + this.counter.announce + ' out of ' + this.counter.running + ' remaining.';
}
-
+
// set html content
$('#upload-info').html(message);
-
+
/*
update button status
*/
-
+
// update reset button
if (this.counter.running == 0 && this.counter.announce + this.counter.success + this.counter.error > 0)
this.modal.enableButton('Reset');
else
this.modal.disableButton('Reset');
-
+
// update upload button
if (this.counter.running == 0 && this.counter.announce > 0)
this.modal.enableButton('Start');
@@ -652,7 +652,7 @@
this.modal.enableButton('Pause');
else
this.modal.disableButton('Pause');
-
+
// select upload button
if (this.counter.running == 0){
this.modal.enableButton('Choose local file');
@@ -663,14 +663,14 @@
this.modal.disableButton('Choose FTP file');
this.modal.disableButton('Paste/Fetch data');
}
-
+
// ftp button
if (this.current_user && this.options.ftp_upload_dir && this.options.ftp_upload_site) {
this.modal.showButton('Choose FTP file');
} else {
this.modal.hideButton('Choose FTP file');
}
-
+
// table visibility
if (this.counter.announce + this.counter.success + this.counter.error > 0) {
$(this.el).find('#upload-table').show();
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
commit/galaxy-central: jmchilton: Merged in BjoernGruening/galaxy-central-1/compressed_upload (pull request #630)
by commits-noreply@bitbucket.org 23 Jan '15
by commits-noreply@bitbucket.org 23 Jan '15
23 Jan '15
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/9ef517d8e767/
Changeset: 9ef517d8e767
User: jmchilton
Date: 2015-01-23 19:13:25+00:00
Summary: Merged in BjoernGruening/galaxy-central-1/compressed_upload (pull request #630)
Add CompressedArchive as datatype and do not uncomress it during upload.
Affected #: 3 files
diff -r a6855d0b02d70cd35ae312f48bd704590805ca15 -r 9ef517d8e767037e1633f6063c6edb3023f86499 config/datatypes_conf.xml.sample
--- a/config/datatypes_conf.xml.sample
+++ b/config/datatypes_conf.xml.sample
@@ -141,6 +141,8 @@
<datatype extension="pbm" type="galaxy.datatypes.images:Pbm" mimetype="image/pbm"/><datatype extension="pgm" type="galaxy.datatypes.images:Pgm" mimetype="image/pgm"/><datatype extension="rna_eps" type="galaxy.datatypes.sequence:RNADotPlotMatrix" mimetype="image/eps" display_in_upload="True"/>
+ <datatype extension="searchgui_archive" type="galaxy.datatypes.binary:CompressedArchive" subclass="True" display_in_upload="True"/>
+ <datatype extension="peptideshaker_archive" type="galaxy.datatypes.binary:CompressedArchive" subclass="True" display_in_upload="True"/><datatype extension="eps" type="galaxy.datatypes.images:Eps" mimetype="image/eps"/><datatype extension="rast" type="galaxy.datatypes.images:Rast" mimetype="image/rast"/><datatype extension="laj" type="galaxy.datatypes.images:Laj"/>
diff -r a6855d0b02d70cd35ae312f48bd704590805ca15 -r 9ef517d8e767037e1633f6063c6edb3023f86499 lib/galaxy/datatypes/binary.py
--- a/lib/galaxy/datatypes/binary.py
+++ b/lib/galaxy/datatypes/binary.py
@@ -106,6 +106,30 @@
Binary.register_unsniffable_binary_ext("ab1")
+class CompressedArchive( Binary ):
+ """
+ Class describing an compressed binary file
+ This class can be sublass'ed to implement archive filetypes that will not be unpacked by upload.py.
+ """
+ file_ext = "compressed_archive"
+ compressed = True
+
+ def set_peek( self, dataset, is_multi_byte=False ):
+ if not dataset.dataset.purged:
+ dataset.peek = "Compressed binary file"
+ dataset.blurb = data.nice_size( dataset.get_size() )
+ else:
+ dataset.peek = 'file does not exist'
+ dataset.blurb = 'file purged from disk'
+
+ def display_peek( self, dataset ):
+ try:
+ return dataset.peek
+ except:
+ return "Compressed binary file (%s)" % ( data.nice_size( dataset.get_size() ) )
+
+Binary.register_unsniffable_binary_ext("compressed_archive")
+
class GenericAsn1Binary( Binary ):
"""Class for generic ASN.1 binary format"""
diff -r a6855d0b02d70cd35ae312f48bd704590805ca15 -r 9ef517d8e767037e1633f6063c6edb3023f86499 tools/data_source/upload.py
--- a/tools/data_source/upload.py
+++ b/tools/data_source/upload.py
@@ -120,171 +120,176 @@
data_type = type_info[0]
ext = type_info[1]
if not data_type:
- # See if we have a gzipped file, which, if it passes our restrictions, we'll uncompress
- is_gzipped, is_valid = check_gzip( dataset.path )
- if is_gzipped and not is_valid:
- file_err( 'The gzipped uploaded file contains inappropriate content', dataset, json_file )
- return
- elif is_gzipped and is_valid:
- if link_data_only == 'copy_files':
- # We need to uncompress the temp_name file, but BAM files must remain compressed in the BGZF format
- CHUNK_SIZE = 2**20 # 1Mb
- fd, uncompressed = tempfile.mkstemp( prefix='data_id_%s_upload_gunzip_' % dataset.dataset_id, dir=os.path.dirname( output_path ), text=False )
- gzipped_file = gzip.GzipFile( dataset.path, 'rb' )
- while 1:
- try:
- chunk = gzipped_file.read( CHUNK_SIZE )
- except IOError:
- os.close( fd )
- os.remove( uncompressed )
- file_err( 'Problem decompressing gzipped data', dataset, json_file )
- return
- if not chunk:
- break
- os.write( fd, chunk )
- os.close( fd )
- gzipped_file.close()
- # Replace the gzipped file with the decompressed file if it's safe to do so
- if dataset.type in ( 'server_dir', 'path_paste' ) or not in_place:
- dataset.path = uncompressed
- else:
- shutil.move( uncompressed, dataset.path )
- os.chmod(dataset.path, 0644)
- dataset.name = dataset.name.rstrip( '.gz' )
- data_type = 'gzip'
- if not data_type and bz2 is not None:
- # See if we have a bz2 file, much like gzip
- is_bzipped, is_valid = check_bz2( dataset.path )
- if is_bzipped and not is_valid:
+ root_datatype = registry.get_datatype_by_extension( dataset.file_type )
+ if getattr( root_datatype, 'compressed', False ):
+ data_type = 'compressed archive'
+ ext = dataset.file_type
+ else:
+ # See if we have a gzipped file, which, if it passes our restrictions, we'll uncompress
+ is_gzipped, is_valid = check_gzip( dataset.path )
+ if is_gzipped and not is_valid:
file_err( 'The gzipped uploaded file contains inappropriate content', dataset, json_file )
return
- elif is_bzipped and is_valid:
+ elif is_gzipped and is_valid:
if link_data_only == 'copy_files':
- # We need to uncompress the temp_name file
+ # We need to uncompress the temp_name file, but BAM files must remain compressed in the BGZF format
CHUNK_SIZE = 2**20 # 1Mb
- fd, uncompressed = tempfile.mkstemp( prefix='data_id_%s_upload_bunzip2_' % dataset.dataset_id, dir=os.path.dirname( output_path ), text=False )
- bzipped_file = bz2.BZ2File( dataset.path, 'rb' )
+ fd, uncompressed = tempfile.mkstemp( prefix='data_id_%s_upload_gunzip_' % dataset.dataset_id, dir=os.path.dirname( output_path ), text=False )
+ gzipped_file = gzip.GzipFile( dataset.path, 'rb' )
while 1:
try:
- chunk = bzipped_file.read( CHUNK_SIZE )
+ chunk = gzipped_file.read( CHUNK_SIZE )
except IOError:
os.close( fd )
os.remove( uncompressed )
- file_err( 'Problem decompressing bz2 compressed data', dataset, json_file )
+ file_err( 'Problem decompressing gzipped data', dataset, json_file )
return
if not chunk:
break
os.write( fd, chunk )
os.close( fd )
- bzipped_file.close()
- # Replace the bzipped file with the decompressed file if it's safe to do so
+ gzipped_file.close()
+ # Replace the gzipped file with the decompressed file if it's safe to do so
if dataset.type in ( 'server_dir', 'path_paste' ) or not in_place:
dataset.path = uncompressed
else:
shutil.move( uncompressed, dataset.path )
os.chmod(dataset.path, 0644)
- dataset.name = dataset.name.rstrip( '.bz2' )
- data_type = 'bz2'
- if not data_type:
- # See if we have a zip archive
- is_zipped = check_zip( dataset.path )
- if is_zipped:
- if link_data_only == 'copy_files':
- CHUNK_SIZE = 2**20 # 1Mb
- uncompressed = None
- uncompressed_name = None
- unzipped = False
- z = zipfile.ZipFile( dataset.path )
- for name in z.namelist():
- if name.endswith('/'):
- continue
- if unzipped:
- stdout = 'ZIP file contained more than one file, only the first file was added to Galaxy.'
- break
- fd, uncompressed = tempfile.mkstemp( prefix='data_id_%s_upload_zip_' % dataset.dataset_id, dir=os.path.dirname( output_path ), text=False )
- if sys.version_info[:2] >= ( 2, 6 ):
- zipped_file = z.open( name )
- while 1:
+ dataset.name = dataset.name.rstrip( '.gz' )
+ data_type = 'gzip'
+ if not data_type and bz2 is not None:
+ # See if we have a bz2 file, much like gzip
+ is_bzipped, is_valid = check_bz2( dataset.path )
+ if is_bzipped and not is_valid:
+ file_err( 'The gzipped uploaded file contains inappropriate content', dataset, json_file )
+ return
+ elif is_bzipped and is_valid:
+ if link_data_only == 'copy_files':
+ # We need to uncompress the temp_name file
+ CHUNK_SIZE = 2**20 # 1Mb
+ fd, uncompressed = tempfile.mkstemp( prefix='data_id_%s_upload_bunzip2_' % dataset.dataset_id, dir=os.path.dirname( output_path ), text=False )
+ bzipped_file = bz2.BZ2File( dataset.path, 'rb' )
+ while 1:
+ try:
+ chunk = bzipped_file.read( CHUNK_SIZE )
+ except IOError:
+ os.close( fd )
+ os.remove( uncompressed )
+ file_err( 'Problem decompressing bz2 compressed data', dataset, json_file )
+ return
+ if not chunk:
+ break
+ os.write( fd, chunk )
+ os.close( fd )
+ bzipped_file.close()
+ # Replace the bzipped file with the decompressed file if it's safe to do so
+ if dataset.type in ( 'server_dir', 'path_paste' ) or not in_place:
+ dataset.path = uncompressed
+ else:
+ shutil.move( uncompressed, dataset.path )
+ os.chmod(dataset.path, 0644)
+ dataset.name = dataset.name.rstrip( '.bz2' )
+ data_type = 'bz2'
+ if not data_type:
+ # See if we have a zip archive
+ is_zipped = check_zip( dataset.path )
+ if is_zipped:
+ if link_data_only == 'copy_files':
+ CHUNK_SIZE = 2**20 # 1Mb
+ uncompressed = None
+ uncompressed_name = None
+ unzipped = False
+ z = zipfile.ZipFile( dataset.path )
+ for name in z.namelist():
+ if name.endswith('/'):
+ continue
+ if unzipped:
+ stdout = 'ZIP file contained more than one file, only the first file was added to Galaxy.'
+ break
+ fd, uncompressed = tempfile.mkstemp( prefix='data_id_%s_upload_zip_' % dataset.dataset_id, dir=os.path.dirname( output_path ), text=False )
+ if sys.version_info[:2] >= ( 2, 6 ):
+ zipped_file = z.open( name )
+ while 1:
+ try:
+ chunk = zipped_file.read( CHUNK_SIZE )
+ except IOError:
+ os.close( fd )
+ os.remove( uncompressed )
+ file_err( 'Problem decompressing zipped data', dataset, json_file )
+ return
+ if not chunk:
+ break
+ os.write( fd, chunk )
+ os.close( fd )
+ zipped_file.close()
+ uncompressed_name = name
+ unzipped = True
+ else:
+ # python < 2.5 doesn't have a way to read members in chunks(!)
try:
- chunk = zipped_file.read( CHUNK_SIZE )
+ outfile = open( uncompressed, 'wb' )
+ outfile.write( z.read( name ) )
+ outfile.close()
+ uncompressed_name = name
+ unzipped = True
except IOError:
os.close( fd )
os.remove( uncompressed )
file_err( 'Problem decompressing zipped data', dataset, json_file )
return
- if not chunk:
- break
- os.write( fd, chunk )
- os.close( fd )
- zipped_file.close()
- uncompressed_name = name
- unzipped = True
+ z.close()
+ # Replace the zipped file with the decompressed file if it's safe to do so
+ if uncompressed is not None:
+ if dataset.type in ( 'server_dir', 'path_paste' ) or not in_place:
+ dataset.path = uncompressed
+ else:
+ shutil.move( uncompressed, dataset.path )
+ os.chmod(dataset.path, 0644)
+ dataset.name = uncompressed_name
+ data_type = 'zip'
+ if not data_type:
+ # TODO refactor this logic. check_binary isn't guaranteed to be
+ # correct since it only looks at whether the first 100 chars are
+ # printable or not. If someone specifies a known unsniffable
+ # binary datatype and check_binary fails, the file gets mangled.
+ if check_binary( dataset.path ) or Binary.is_ext_unsniffable(dataset.file_type):
+ # We have a binary dataset, but it is not Bam, Sff or Pdf
+ data_type = 'binary'
+ #binary_ok = False
+ parts = dataset.name.split( "." )
+ if len( parts ) > 1:
+ ext = parts[-1].strip().lower()
+ if not Binary.is_ext_unsniffable(ext):
+ file_err( 'The uploaded binary file contains inappropriate content', dataset, json_file )
+ return
+ elif Binary.is_ext_unsniffable(ext) and dataset.file_type != ext:
+ err_msg = "You must manually set the 'File Format' to '%s' when uploading %s files." % ( ext.capitalize(), ext )
+ file_err( err_msg, dataset, json_file )
+ return
+ if not data_type:
+ # We must have a text file
+ if check_html( dataset.path ):
+ file_err( 'The uploaded file contains inappropriate HTML content', dataset, json_file )
+ return
+ if data_type != 'binary':
+ if link_data_only == 'copy_files':
+ if dataset.type in ( 'server_dir', 'path_paste' ) and data_type not in [ 'gzip', 'bz2', 'zip' ]:
+ in_place = False
+ # Convert universal line endings to Posix line endings, but allow the user to turn it off,
+ # so that is becomes possible to upload gzip, bz2 or zip files with binary data without
+ # corrupting the content of those files.
+ if dataset.to_posix_lines:
+ tmpdir = output_adjacent_tmpdir( output_path )
+ tmp_prefix = 'data_id_%s_convert_' % dataset.dataset_id
+ if dataset.space_to_tab:
+ line_count, converted_path = sniff.convert_newlines_sep2tabs( dataset.path, in_place=in_place, tmp_dir=tmpdir, tmp_prefix=tmp_prefix )
else:
- # python < 2.5 doesn't have a way to read members in chunks(!)
- try:
- outfile = open( uncompressed, 'wb' )
- outfile.write( z.read( name ) )
- outfile.close()
- uncompressed_name = name
- unzipped = True
- except IOError:
- os.close( fd )
- os.remove( uncompressed )
- file_err( 'Problem decompressing zipped data', dataset, json_file )
- return
- z.close()
- # Replace the zipped file with the decompressed file if it's safe to do so
- if uncompressed is not None:
- if dataset.type in ( 'server_dir', 'path_paste' ) or not in_place:
- dataset.path = uncompressed
- else:
- shutil.move( uncompressed, dataset.path )
- os.chmod(dataset.path, 0644)
- dataset.name = uncompressed_name
- data_type = 'zip'
- if not data_type:
- # TODO refactor this logic. check_binary isn't guaranteed to be
- # correct since it only looks at whether the first 100 chars are
- # printable or not. If someone specifies a known unsniffable
- # binary datatype and check_binary fails, the file gets mangled.
- if check_binary( dataset.path ) or Binary.is_ext_unsniffable(dataset.file_type):
- # We have a binary dataset, but it is not Bam, Sff or Pdf
- data_type = 'binary'
- #binary_ok = False
- parts = dataset.name.split( "." )
- if len( parts ) > 1:
- ext = parts[-1].strip().lower()
- if not Binary.is_ext_unsniffable(ext):
- file_err( 'The uploaded binary file contains inappropriate content', dataset, json_file )
- return
- elif Binary.is_ext_unsniffable(ext) and dataset.file_type != ext:
- err_msg = "You must manually set the 'File Format' to '%s' when uploading %s files." % ( ext.capitalize(), ext )
- file_err( err_msg, dataset, json_file )
- return
- if not data_type:
- # We must have a text file
- if check_html( dataset.path ):
- file_err( 'The uploaded file contains inappropriate HTML content', dataset, json_file )
- return
- if data_type != 'binary':
- if link_data_only == 'copy_files':
- if dataset.type in ( 'server_dir', 'path_paste' ) and data_type not in [ 'gzip', 'bz2', 'zip' ]:
- in_place = False
- # Convert universal line endings to Posix line endings, but allow the user to turn it off,
- # so that is becomes possible to upload gzip, bz2 or zip files with binary data without
- # corrupting the content of those files.
- if dataset.to_posix_lines:
- tmpdir = output_adjacent_tmpdir( output_path )
- tmp_prefix = 'data_id_%s_convert_' % dataset.dataset_id
- if dataset.space_to_tab:
- line_count, converted_path = sniff.convert_newlines_sep2tabs( dataset.path, in_place=in_place, tmp_dir=tmpdir, tmp_prefix=tmp_prefix )
- else:
- line_count, converted_path = sniff.convert_newlines( dataset.path, in_place=in_place, tmp_dir=tmpdir, tmp_prefix=tmp_prefix )
- if dataset.file_type == 'auto':
- ext = sniff.guess_ext( dataset.path, registry.sniff_order )
- else:
- ext = dataset.file_type
- data_type = ext
+ line_count, converted_path = sniff.convert_newlines( dataset.path, in_place=in_place, tmp_dir=tmpdir, tmp_prefix=tmp_prefix )
+ if dataset.file_type == 'auto':
+ ext = sniff.guess_ext( dataset.path, registry.sniff_order )
+ else:
+ ext = dataset.file_type
+ data_type = ext
# Save job info for the framework
if ext == 'auto' and dataset.ext:
ext = dataset.ext
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
4 new commits in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/1ecb6aaebaf4/
Changeset: 1ecb6aaebaf4
Branch: compressed_upload
User: BjoernGruening
Date: 2015-01-12 21:36:20+00:00
Summary: Add CompressedArchive as datatype and do not uncomress it during upload.
Affected #: 3 files
diff -r b5c7266dbb69f81864d96247ff11be42246e94de -r 1ecb6aaebaf4247a7c71b77cb9a74f63dc937cff config/datatypes_conf.xml.sample
--- a/config/datatypes_conf.xml.sample
+++ b/config/datatypes_conf.xml.sample
@@ -140,6 +140,8 @@
<datatype extension="rgb" type="galaxy.datatypes.images:Rgb" mimetype="image/rgb"/><datatype extension="pbm" type="galaxy.datatypes.images:Pbm" mimetype="image/pbm"/><datatype extension="pgm" type="galaxy.datatypes.images:Pgm" mimetype="image/pgm"/>
+ <datatype extension="searchgui_archive" type="galaxy.datatypes.binary:CompressedArchive" subclass="True" display_in_upload="True"/>
+ <datatype extension="peptideshaker_archive" type="galaxy.datatypes.binary:CompressedArchive" subclass="True" display_in_upload="True"/><datatype extension="eps" type="galaxy.datatypes.images:Eps" mimetype="image/eps"/><datatype extension="rast" type="galaxy.datatypes.images:Rast" mimetype="image/rast"/><datatype extension="laj" type="galaxy.datatypes.images:Laj"/>
diff -r b5c7266dbb69f81864d96247ff11be42246e94de -r 1ecb6aaebaf4247a7c71b77cb9a74f63dc937cff lib/galaxy/datatypes/binary.py
--- a/lib/galaxy/datatypes/binary.py
+++ b/lib/galaxy/datatypes/binary.py
@@ -106,6 +106,30 @@
Binary.register_unsniffable_binary_ext("ab1")
+class CompressedArchive( Binary ):
+ """
+ Class describing an compressed binary file
+ This class can be sublass'ed to implement archive filetypes that will not be unpacked by upload.py.
+ """
+ file_ext = "compressed_archive"
+ compressed = True
+
+ def set_peek( self, dataset, is_multi_byte=False ):
+ if not dataset.dataset.purged:
+ dataset.peek = "Compressed binary file"
+ dataset.blurb = data.nice_size( dataset.get_size() )
+ else:
+ dataset.peek = 'file does not exist'
+ dataset.blurb = 'file purged from disk'
+
+ def display_peek( self, dataset ):
+ try:
+ return dataset.peek
+ except:
+ return "Compressed binary file (%s)" % ( data.nice_size( dataset.get_size() ) )
+
+Binary.register_unsniffable_binary_ext("compressed_archive")
+
class GenericAsn1Binary( Binary ):
"""Class for generic ASN.1 binary format"""
diff -r b5c7266dbb69f81864d96247ff11be42246e94de -r 1ecb6aaebaf4247a7c71b77cb9a74f63dc937cff tools/data_source/upload.py
--- a/tools/data_source/upload.py
+++ b/tools/data_source/upload.py
@@ -120,171 +120,176 @@
data_type = type_info[0]
ext = type_info[1]
if not data_type:
- # See if we have a gzipped file, which, if it passes our restrictions, we'll uncompress
- is_gzipped, is_valid = check_gzip( dataset.path )
- if is_gzipped and not is_valid:
- file_err( 'The gzipped uploaded file contains inappropriate content', dataset, json_file )
- return
- elif is_gzipped and is_valid:
- if link_data_only == 'copy_files':
- # We need to uncompress the temp_name file, but BAM files must remain compressed in the BGZF format
- CHUNK_SIZE = 2**20 # 1Mb
- fd, uncompressed = tempfile.mkstemp( prefix='data_id_%s_upload_gunzip_' % dataset.dataset_id, dir=os.path.dirname( output_path ), text=False )
- gzipped_file = gzip.GzipFile( dataset.path, 'rb' )
- while 1:
- try:
- chunk = gzipped_file.read( CHUNK_SIZE )
- except IOError:
- os.close( fd )
- os.remove( uncompressed )
- file_err( 'Problem decompressing gzipped data', dataset, json_file )
- return
- if not chunk:
- break
- os.write( fd, chunk )
- os.close( fd )
- gzipped_file.close()
- # Replace the gzipped file with the decompressed file if it's safe to do so
- if dataset.type in ( 'server_dir', 'path_paste' ) or not in_place:
- dataset.path = uncompressed
- else:
- shutil.move( uncompressed, dataset.path )
- os.chmod(dataset.path, 0644)
- dataset.name = dataset.name.rstrip( '.gz' )
- data_type = 'gzip'
- if not data_type and bz2 is not None:
- # See if we have a bz2 file, much like gzip
- is_bzipped, is_valid = check_bz2( dataset.path )
- if is_bzipped and not is_valid:
+ root_datatype = registry.get_datatype_by_extension( dataset.file_type )
+ if getattr( root_datatype, 'compressed', False ):
+ data_type = 'compressed archive'
+ ext = dataset.file_type
+ else:
+ # See if we have a gzipped file, which, if it passes our restrictions, we'll uncompress
+ is_gzipped, is_valid = check_gzip( dataset.path )
+ if is_gzipped and not is_valid:
file_err( 'The gzipped uploaded file contains inappropriate content', dataset, json_file )
return
- elif is_bzipped and is_valid:
+ elif is_gzipped and is_valid:
if link_data_only == 'copy_files':
- # We need to uncompress the temp_name file
+ # We need to uncompress the temp_name file, but BAM files must remain compressed in the BGZF format
CHUNK_SIZE = 2**20 # 1Mb
- fd, uncompressed = tempfile.mkstemp( prefix='data_id_%s_upload_bunzip2_' % dataset.dataset_id, dir=os.path.dirname( output_path ), text=False )
- bzipped_file = bz2.BZ2File( dataset.path, 'rb' )
+ fd, uncompressed = tempfile.mkstemp( prefix='data_id_%s_upload_gunzip_' % dataset.dataset_id, dir=os.path.dirname( output_path ), text=False )
+ gzipped_file = gzip.GzipFile( dataset.path, 'rb' )
while 1:
try:
- chunk = bzipped_file.read( CHUNK_SIZE )
+ chunk = gzipped_file.read( CHUNK_SIZE )
except IOError:
os.close( fd )
os.remove( uncompressed )
- file_err( 'Problem decompressing bz2 compressed data', dataset, json_file )
+ file_err( 'Problem decompressing gzipped data', dataset, json_file )
return
if not chunk:
break
os.write( fd, chunk )
os.close( fd )
- bzipped_file.close()
- # Replace the bzipped file with the decompressed file if it's safe to do so
+ gzipped_file.close()
+ # Replace the gzipped file with the decompressed file if it's safe to do so
if dataset.type in ( 'server_dir', 'path_paste' ) or not in_place:
dataset.path = uncompressed
else:
shutil.move( uncompressed, dataset.path )
os.chmod(dataset.path, 0644)
- dataset.name = dataset.name.rstrip( '.bz2' )
- data_type = 'bz2'
- if not data_type:
- # See if we have a zip archive
- is_zipped = check_zip( dataset.path )
- if is_zipped:
- if link_data_only == 'copy_files':
- CHUNK_SIZE = 2**20 # 1Mb
- uncompressed = None
- uncompressed_name = None
- unzipped = False
- z = zipfile.ZipFile( dataset.path )
- for name in z.namelist():
- if name.endswith('/'):
- continue
- if unzipped:
- stdout = 'ZIP file contained more than one file, only the first file was added to Galaxy.'
- break
- fd, uncompressed = tempfile.mkstemp( prefix='data_id_%s_upload_zip_' % dataset.dataset_id, dir=os.path.dirname( output_path ), text=False )
- if sys.version_info[:2] >= ( 2, 6 ):
- zipped_file = z.open( name )
- while 1:
+ dataset.name = dataset.name.rstrip( '.gz' )
+ data_type = 'gzip'
+ if not data_type and bz2 is not None:
+ # See if we have a bz2 file, much like gzip
+ is_bzipped, is_valid = check_bz2( dataset.path )
+ if is_bzipped and not is_valid:
+ file_err( 'The gzipped uploaded file contains inappropriate content', dataset, json_file )
+ return
+ elif is_bzipped and is_valid:
+ if link_data_only == 'copy_files':
+ # We need to uncompress the temp_name file
+ CHUNK_SIZE = 2**20 # 1Mb
+ fd, uncompressed = tempfile.mkstemp( prefix='data_id_%s_upload_bunzip2_' % dataset.dataset_id, dir=os.path.dirname( output_path ), text=False )
+ bzipped_file = bz2.BZ2File( dataset.path, 'rb' )
+ while 1:
+ try:
+ chunk = bzipped_file.read( CHUNK_SIZE )
+ except IOError:
+ os.close( fd )
+ os.remove( uncompressed )
+ file_err( 'Problem decompressing bz2 compressed data', dataset, json_file )
+ return
+ if not chunk:
+ break
+ os.write( fd, chunk )
+ os.close( fd )
+ bzipped_file.close()
+ # Replace the bzipped file with the decompressed file if it's safe to do so
+ if dataset.type in ( 'server_dir', 'path_paste' ) or not in_place:
+ dataset.path = uncompressed
+ else:
+ shutil.move( uncompressed, dataset.path )
+ os.chmod(dataset.path, 0644)
+ dataset.name = dataset.name.rstrip( '.bz2' )
+ data_type = 'bz2'
+ if not data_type:
+ # See if we have a zip archive
+ is_zipped = check_zip( dataset.path )
+ if is_zipped:
+ if link_data_only == 'copy_files':
+ CHUNK_SIZE = 2**20 # 1Mb
+ uncompressed = None
+ uncompressed_name = None
+ unzipped = False
+ z = zipfile.ZipFile( dataset.path )
+ for name in z.namelist():
+ if name.endswith('/'):
+ continue
+ if unzipped:
+ stdout = 'ZIP file contained more than one file, only the first file was added to Galaxy.'
+ break
+ fd, uncompressed = tempfile.mkstemp( prefix='data_id_%s_upload_zip_' % dataset.dataset_id, dir=os.path.dirname( output_path ), text=False )
+ if sys.version_info[:2] >= ( 2, 6 ):
+ zipped_file = z.open( name )
+ while 1:
+ try:
+ chunk = zipped_file.read( CHUNK_SIZE )
+ except IOError:
+ os.close( fd )
+ os.remove( uncompressed )
+ file_err( 'Problem decompressing zipped data', dataset, json_file )
+ return
+ if not chunk:
+ break
+ os.write( fd, chunk )
+ os.close( fd )
+ zipped_file.close()
+ uncompressed_name = name
+ unzipped = True
+ else:
+ # python < 2.5 doesn't have a way to read members in chunks(!)
try:
- chunk = zipped_file.read( CHUNK_SIZE )
+ outfile = open( uncompressed, 'wb' )
+ outfile.write( z.read( name ) )
+ outfile.close()
+ uncompressed_name = name
+ unzipped = True
except IOError:
os.close( fd )
os.remove( uncompressed )
file_err( 'Problem decompressing zipped data', dataset, json_file )
return
- if not chunk:
- break
- os.write( fd, chunk )
- os.close( fd )
- zipped_file.close()
- uncompressed_name = name
- unzipped = True
+ z.close()
+ # Replace the zipped file with the decompressed file if it's safe to do so
+ if uncompressed is not None:
+ if dataset.type in ( 'server_dir', 'path_paste' ) or not in_place:
+ dataset.path = uncompressed
+ else:
+ shutil.move( uncompressed, dataset.path )
+ os.chmod(dataset.path, 0644)
+ dataset.name = uncompressed_name
+ data_type = 'zip'
+ if not data_type:
+ # TODO refactor this logic. check_binary isn't guaranteed to be
+ # correct since it only looks at whether the first 100 chars are
+ # printable or not. If someone specifies a known unsniffable
+ # binary datatype and check_binary fails, the file gets mangled.
+ if check_binary( dataset.path ) or Binary.is_ext_unsniffable(dataset.file_type):
+ # We have a binary dataset, but it is not Bam, Sff or Pdf
+ data_type = 'binary'
+ #binary_ok = False
+ parts = dataset.name.split( "." )
+ if len( parts ) > 1:
+ ext = parts[-1].strip().lower()
+ if not Binary.is_ext_unsniffable(ext):
+ file_err( 'The uploaded binary file contains inappropriate content', dataset, json_file )
+ return
+ elif Binary.is_ext_unsniffable(ext) and dataset.file_type != ext:
+ err_msg = "You must manually set the 'File Format' to '%s' when uploading %s files." % ( ext.capitalize(), ext )
+ file_err( err_msg, dataset, json_file )
+ return
+ if not data_type:
+ # We must have a text file
+ if check_html( dataset.path ):
+ file_err( 'The uploaded file contains inappropriate HTML content', dataset, json_file )
+ return
+ if data_type != 'binary':
+ if link_data_only == 'copy_files':
+ if dataset.type in ( 'server_dir', 'path_paste' ) and data_type not in [ 'gzip', 'bz2', 'zip' ]:
+ in_place = False
+ # Convert universal line endings to Posix line endings, but allow the user to turn it off,
+ # so that is becomes possible to upload gzip, bz2 or zip files with binary data without
+ # corrupting the content of those files.
+ if dataset.to_posix_lines:
+ tmpdir = output_adjacent_tmpdir( output_path )
+ tmp_prefix = 'data_id_%s_convert_' % dataset.dataset_id
+ if dataset.space_to_tab:
+ line_count, converted_path = sniff.convert_newlines_sep2tabs( dataset.path, in_place=in_place, tmp_dir=tmpdir, tmp_prefix=tmp_prefix )
else:
- # python < 2.5 doesn't have a way to read members in chunks(!)
- try:
- outfile = open( uncompressed, 'wb' )
- outfile.write( z.read( name ) )
- outfile.close()
- uncompressed_name = name
- unzipped = True
- except IOError:
- os.close( fd )
- os.remove( uncompressed )
- file_err( 'Problem decompressing zipped data', dataset, json_file )
- return
- z.close()
- # Replace the zipped file with the decompressed file if it's safe to do so
- if uncompressed is not None:
- if dataset.type in ( 'server_dir', 'path_paste' ) or not in_place:
- dataset.path = uncompressed
- else:
- shutil.move( uncompressed, dataset.path )
- os.chmod(dataset.path, 0644)
- dataset.name = uncompressed_name
- data_type = 'zip'
- if not data_type:
- # TODO refactor this logic. check_binary isn't guaranteed to be
- # correct since it only looks at whether the first 100 chars are
- # printable or not. If someone specifies a known unsniffable
- # binary datatype and check_binary fails, the file gets mangled.
- if check_binary( dataset.path ) or Binary.is_ext_unsniffable(dataset.file_type):
- # We have a binary dataset, but it is not Bam, Sff or Pdf
- data_type = 'binary'
- #binary_ok = False
- parts = dataset.name.split( "." )
- if len( parts ) > 1:
- ext = parts[-1].strip().lower()
- if not Binary.is_ext_unsniffable(ext):
- file_err( 'The uploaded binary file contains inappropriate content', dataset, json_file )
- return
- elif Binary.is_ext_unsniffable(ext) and dataset.file_type != ext:
- err_msg = "You must manually set the 'File Format' to '%s' when uploading %s files." % ( ext.capitalize(), ext )
- file_err( err_msg, dataset, json_file )
- return
- if not data_type:
- # We must have a text file
- if check_html( dataset.path ):
- file_err( 'The uploaded file contains inappropriate HTML content', dataset, json_file )
- return
- if data_type != 'binary':
- if link_data_only == 'copy_files':
- if dataset.type in ( 'server_dir', 'path_paste' ) and data_type not in [ 'gzip', 'bz2', 'zip' ]:
- in_place = False
- # Convert universal line endings to Posix line endings, but allow the user to turn it off,
- # so that is becomes possible to upload gzip, bz2 or zip files with binary data without
- # corrupting the content of those files.
- if dataset.to_posix_lines:
- tmpdir = output_adjacent_tmpdir( output_path )
- tmp_prefix = 'data_id_%s_convert_' % dataset.dataset_id
- if dataset.space_to_tab:
- line_count, converted_path = sniff.convert_newlines_sep2tabs( dataset.path, in_place=in_place, tmp_dir=tmpdir, tmp_prefix=tmp_prefix )
- else:
- line_count, converted_path = sniff.convert_newlines( dataset.path, in_place=in_place, tmp_dir=tmpdir, tmp_prefix=tmp_prefix )
- if dataset.file_type == 'auto':
- ext = sniff.guess_ext( dataset.path, registry.sniff_order )
- else:
- ext = dataset.file_type
- data_type = ext
+ line_count, converted_path = sniff.convert_newlines( dataset.path, in_place=in_place, tmp_dir=tmpdir, tmp_prefix=tmp_prefix )
+ if dataset.file_type == 'auto':
+ ext = sniff.guess_ext( dataset.path, registry.sniff_order )
+ else:
+ ext = dataset.file_type
+ data_type = ext
# Save job info for the framework
if ext == 'auto' and dataset.ext:
ext = dataset.ext
https://bitbucket.org/galaxy/galaxy-central/commits/4a8a610a97e1/
Changeset: 4a8a610a97e1
Branch: compressed_upload
User: BjoernGruening
Date: 2015-01-16 22:30:05+00:00
Summary: merge
Affected #: 110 files
diff -r 1ecb6aaebaf4247a7c71b77cb9a74f63dc937cff -r 4a8a610a97e1762b8ae78280566a23c11676bce9 .hgtags
--- a/.hgtags
+++ b/.hgtags
@@ -8,16 +8,18 @@
5e605ed6069fe4c5ca9875e95e91b2713499e8ca release_2014.02.10
9e53251b0b7e93b9563008a2b112f2e815a04bbc release_2014.04.14
7e257c7b10badb65772b1528cb61d58175a42e47 release_2014.06.02
-7a4d321c0e38fa263ea83d29a35a608c3181fcba latest_2014.06.02
-9661b9d5d5b330483ae3ad2236410e0efaa7c500 latest_2014.04.14
-6b0bd93038a843b1585155f0d63f0eea2459c70b latest_2013.01.13
-3e62060b14b9afc46f8e0ec02e1a4500d77db9e1 latest_2013.02.08
-425009b3ff4d8b67d2812253b221f3c4f4a8d1e3 latest_2013.04.01
-9713d86392ef985ffcdc39ff0c8ddf51a1f9ce47 latest_2013.06.03
-9ed84cd208e07e8985ec917cb025fcbbb09edcfb latest_2013.08.12
-81fbe25bd02edcd53065e8e4476dd1dfb5a72cf2 latest_2013.11.04
-2a756ca2cb1826db7796018e77d12e2dd7b67603 latest_2014.02.10
+9bce3f426863f8ba88062f67c7efc1836e82ee7c latest_2014.06.02
+8f9dcac033694e4cabcf5daae5cca1cfefbe967f latest_2014.04.14
+9c323aad4ffdd65a3deb06a4a36f6b2c5115a60f latest_2013.01.13
+b986c184be88947b5d1d90be7f36cfd2627dd938 latest_2013.02.08
+dec9431d66b837a208e2f060d90afd913c721227 latest_2013.04.01
+19e56e66b0b344c6e2afa4541f6988e4fdb9af29 latest_2013.06.03
+cee903b8b3eee9145627ee89742555dac581791e latest_2013.08.12
+7d5aa19a166cba9039e15f338a1e3fc924c43d3a latest_2013.11.04
+0c000cc2f9c05bf4c1c2bc3a10215014fd64e696 latest_2014.02.10
ca45b78adb4152fc6e7395514d46eba6b7d0b838 release_2014.08.11
-548ab24667d6206780237bd807f7d857a484c461 latest_2014.08.11
+f3fc4602e22b39468d780b955a1a05caf867a7e9 latest_2014.08.11
2092948937ac30ef82f71463a235c66d34987088 release_2014.10.06
-5834b1066462dd219f67c1c3cbd77c78e7cf3a6c latest_2014.10.06
+9bd6f8b5b8153db752f4e61ed62f2b6c01ae4a11 latest_2014.10.06
+2e8dd2949dd3eee0f56f9a3a5ebf1b2baca24aee release_2015.01.13
+2e8dd2949dd3eee0f56f9a3a5ebf1b2baca24aee latest_2015.01.13
diff -r 1ecb6aaebaf4247a7c71b77cb9a74f63dc937cff -r 4a8a610a97e1762b8ae78280566a23c11676bce9 client/galaxy/scripts/galaxy.workflow_editor.canvas.js
--- a/client/galaxy/scripts/galaxy.workflow_editor.canvas.js
+++ b/client/galaxy/scripts/galaxy.workflow_editor.canvas.js
@@ -1089,7 +1089,11 @@
if ( this.active_node != node ) {
this.check_changes_in_active_form();
this.clear_active_node();
- parent.show_form_for_tool( node.form_html + node.tooltip, node );
+ if (parent.__NEWTOOLFORM__) {
+ parent.show_form_for_tool( node.form_html, node );
+ } else {
+ parent.show_form_for_tool( node.form_html + node.tooltip, node );
+ }
node.make_active();
this.active_node = node;
}
@@ -1099,7 +1103,11 @@
if ( this.active_node == node && (!parent.__NEWTOOLFORM__ || force)) {
// Reactive with new form_html
this.check_changes_in_active_form(); //Force changes to be saved even on new connection (previously dumped)
- parent.show_form_for_tool( node.form_html + node.tooltip, node );
+ if (parent.__NEWTOOLFORM__) {
+ parent.show_form_for_tool( node.form_html, node );
+ } else {
+ parent.show_form_for_tool( node.form_html + node.tooltip, node );
+ }
}
},
layout : function () {
@@ -1305,13 +1313,6 @@
return node;
}
-function update_node( data ) {
- var node = workflow.active_node;
- if (node) {
- node.update_field_data(data, true);
- }
-}
-
var ext_to_type = null;
var type_to_type = null;
diff -r 1ecb6aaebaf4247a7c71b77cb9a74f63dc937cff -r 4a8a610a97e1762b8ae78280566a23c11676bce9 client/galaxy/scripts/mvc/tools/tools-form-base.js
--- a/client/galaxy/scripts/mvc/tools/tools-form-base.js
+++ b/client/galaxy/scripts/mvc/tools/tools-form-base.js
@@ -76,6 +76,20 @@
}
},
+ /** Highlights errors
+ */
+ _errors: function(options) {
+ if (options && options.errors) {
+ var error_messages = this.tree.matchResponse(options.errors);
+ for (var input_id in this.element_list) {
+ var input = this.element_list[input_id];
+ if (error_messages[input_id]) {
+ this.highlight(input_id, error_messages[input_id], true);
+ }
+ }
+ }
+ },
+
/** Main tool form build function. This function is called once a new model is available.
*/
_buildForm: function() {
@@ -111,16 +125,11 @@
this.tree.finalize();
// show errors
- if (!this.workflow && options.errors) {
- var error_messages = this.tree.matchResponse(options.errors);
- for (var input_id in error_messages) {
- this.highlight(input_id, error_messages[input_id], true);
- }
- }
+ this._errors(options);
// add refresh listener
this.on('refresh', function() {
- // by using/reseting the deferred ajax queue the number of redundant calls is reduced
+ // by using/resetting the deferred ajax queue the number of redundant calls is reduced
self.deferred.reset();
self.deferred.execute(function(){self._updateModel()});
});
@@ -131,6 +140,9 @@
this.element_list[i].reset();
}
});
+
+ // refresh
+ this.trigger('refresh');
},
/** Renders the UI elements required for the form
@@ -145,7 +157,7 @@
// button for version selection
var requirements_button = new Ui.ButtonIcon({
icon : 'fa-info-circle',
- title : 'Requirements',
+ title : (!this.workflow && 'Requirements') || null,
tooltip : 'Display tool requirements',
onclick : function() {
if (!this.visible) {
@@ -170,7 +182,7 @@
// button for version selection
var versions_button = new Ui.ButtonMenu({
icon : 'fa-cubes',
- title : 'Versions',
+ title : (!this.workflow && 'Versions') || null,
tooltip : 'Select another tool version'
});
if (options.versions && options.versions.length > 1) {
@@ -200,7 +212,7 @@
// button menu
var menu_button = new Ui.ButtonMenu({
icon : 'fa-caret-down',
- title : 'Options',
+ title : (!this.workflow && 'Options') || null,
tooltip : 'View available options'
});
@@ -276,6 +288,11 @@
buttons : this.buttons
});
+ // remove padding
+ if (this.options.workflow) {
+ this.portlet.$content.css('padding', '0px');
+ }
+
// append message
this.portlet.append(this.message.$el, true);
diff -r 1ecb6aaebaf4247a7c71b77cb9a74f63dc937cff -r 4a8a610a97e1762b8ae78280566a23c11676bce9 client/galaxy/scripts/mvc/tools/tools-form-workflow.js
--- a/client/galaxy/scripts/mvc/tools/tools-form-workflow.js
+++ b/client/galaxy/scripts/mvc/tools/tools-form-workflow.js
@@ -7,13 +7,254 @@
// create form view
var View = ToolFormBase.extend({
initialize: function(options) {
+ // link with node representation in workflow module
+ this.node = workflow.active_node;
+
+ if (!this.node) {
+ console.debug('FAILED - tools-form-workflow:initialize() - Node not found in workflow.');
+ return;
+ }
+
+ // initialize parameters
this.workflow = true;
- ToolFormBase.prototype.initialize.call(this, options);
+ this.options = options;
+
+ // declare fields as optional
+ Utils.deepeach(options.inputs, function(item) {
+ if (item.type) {
+ item.optional = (['data', 'data_hidden', 'hidden', 'drill_down']).indexOf(item.type) == -1;
+ }
+ });
+
+ // declare conditional fields as not optional
+ Utils.deepeach(options.inputs, function(item) {
+ if (item.type) {
+ if (item.type == 'conditional') {
+ item.test_param.optional = false;
+ }
+ }
+ });
+
+ // load extension
+ var self = this;
+ Utils.get({
+ url : galaxy_config.root + 'api/datatypes',
+ cache : true,
+ success : function(datatypes) {
+ self.datatypes = datatypes;
+ self._makeSections(options.inputs);
+ ToolFormBase.prototype.initialize.call(self, options);
+ }
+ });
+ },
+
+ /** Builds all sub sections
+ */
+ _makeSections: function(inputs){
+ // for annotation
+ inputs[Utils.uuid()] = {
+ label : 'Edit Step Attributes',
+ type : 'section',
+ expand : this.node.annotation,
+ inputs : [{
+ label : 'Annotation / Notes',
+ name : 'annotation',
+ type : 'text',
+ area : true,
+ help : 'Add an annotation or notes to this step; annotations are available when a workflow is viewed.',
+ value : this.node.annotation
+ }]
+ }
+
+ // for actions
+ this.post_job_actions = this.node.post_job_actions;
+ for (var i in this.node.output_terminals) {
+ inputs[Utils.uuid()] = this._makeSection(i);
+ }
+ },
+
+ /** Builds sub section with step actions/annotation
+ */
+ _makeSection: function(output_id){
+ // format datatypes
+ var extensions = [];
+ for (key in this.datatypes) {
+ extensions.push({
+ 0 : this.datatypes[key],
+ 1 : this.datatypes[key]
+ });
+ }
+
+ // sort extensions
+ extensions.sort(function(a, b) {
+ return a.label > b.label ? 1 : a.label < b.label ? -1 : 0;
+ });
+
+ // add additional options
+ extensions.unshift({
+ 0 : 'Sequences',
+ 1 : 'Sequences'
+ });
+ extensions.unshift({
+ 0 : 'Roadmaps',
+ 1 : 'Roadmaps'
+ });
+ extensions.unshift({
+ 0 : 'Leave unchanged',
+ 1 : 'None'
+ });
+
+ // create custom sub section
+ var input_config = {
+ label : 'Edit Step Action: \'' + output_id + '\'',
+ type : 'section',
+ inputs : [{
+ action : 'RenameDatasetAction',
+ argument : 'newname',
+ label : 'Rename dataset',
+ type : 'text',
+ value : '',
+ ignore : '',
+ help : 'This action will rename the result dataset. Click <a href="https://wiki.galaxyproject.org/Learn/AdvancedWorkflow/Variables">here</a> for more information.'
+ },{
+ action : 'ChangeDatatypeAction',
+ argument : 'newtype',
+ label : 'Change datatype',
+ type : 'select',
+ ignore : 'None',
+ options : extensions,
+ help : 'This action will change the datatype of the output to the indicated value.'
+ },{
+ action : 'TagDatasetAction',
+ argument : 'tags',
+ label : 'Tags',
+ type : 'text',
+ value : '',
+ ignore : '',
+ help : 'This action will set tags for the dataset.'
+ },{
+ label : 'Assign columns',
+ type : 'section',
+ inputs : [{
+ action : 'ColumnSetAction',
+ argument : 'chromCol',
+ label : 'Chrom column',
+ type : 'text',
+ value : '',
+ ignore : ''
+ },{
+ action : 'ColumnSetAction',
+ argument : 'startCol',
+ label : 'Start column',
+ type : 'text',
+ value : '',
+ ignore : ''
+ },{
+ action : 'ColumnSetAction',
+ argument : 'endCol',
+ label : 'End column',
+ type : 'text',
+ value : '',
+ ignore : ''
+ },{
+ action : 'ColumnSetAction',
+ argument : 'strandCol',
+ label : 'Strand column',
+ type : 'text',
+ value : '',
+ ignore : ''
+ },{
+ action : 'ColumnSetAction',
+ argument : 'nameCol',
+ label : 'Name column',
+ type : 'text',
+ value : '',
+ ignore : ''
+ }],
+ help : 'This action will set column assignments in the output dataset. Blank fields are ignored.'
+ },{
+ action : 'EmailAction',
+ label : 'Email notification',
+ type : 'boolean',
+ value : 'false',
+ ignore : 'false',
+ help : 'This action will send an email notifying you when the job is done.',
+ payload : {
+ 'host' : window.location.host
+ }
+ },{
+ action : 'DeleteIntermediatesAction',
+ label : 'Delete non-outputs',
+ type : 'boolean',
+ value : 'false',
+ ignore : 'false',
+ help : 'All non-output steps of this workflow will have datasets deleted if they are no longer being used as job inputs when the job this action is attached to is finished. You *must* be using workflow outputs (the snowflake) in your workflow for this to have any effect.'
+ }]
+ };
+
+ // visit input nodes and enrich by name/value pairs from server data
+ var self = this;
+ function visit (head, head_list) {
+ head_list = head_list || [];
+ head_list.push(head);
+ for (var i in head.inputs) {
+ var input = head.inputs[i];
+ if (input.action) {
+ // construct identifier as expected by backend
+ input.name = 'pja__' + output_id + '__' + input.action;
+ if (input.argument) {
+ input.name += '__' + input.argument;
+ }
+
+ // modify names of payload arguments
+ if (input.payload) {
+ for (var p_id in input.payload) {
+ var p = input.payload[p_id];
+ input.payload[input.name + '__' + p_id] = p;
+ delete p;
+ }
+ }
+
+ // access/verify existence of value
+ var d = self.post_job_actions[input.action + output_id];
+ if (d) {
+ // mark as expanded
+ for (var j in head_list) {
+ head_list[j].expand = true;
+ }
+
+ // update input field value
+ if (input.argument) {
+ input.value = d.action_arguments && d.action_arguments[input.argument] || input.value;
+ } else {
+ input.value = 'true';
+ }
+ }
+ }
+ // continue with sub section
+ if (input.inputs) {
+ visit(input, head_list.slice(0));
+ }
+ }
+ }
+ visit(input_config);
+
+ // return final configuration
+ return input_config;
},
/** Builds a new model through api call and recreates the entire form
*/
_buildModel: function() {
+ Galaxy.modal.show({
+ title : 'Coming soon...',
+ body : 'This feature has not been implemented yet.',
+ buttons : {
+ 'Close' : function() {
+ Galaxy.modal.hide();
+ }
+ }
+ });
},
/** Request a new model for an already created tool form and updates the form inputs
@@ -38,15 +279,19 @@
type : 'GET',
url : model_url,
data : current_state,
- success : function(node) {
- parent.update_node(node);
-
+ success : function(data) {
+ // update node in workflow module
+ self.node.update_field_data(data);
+
+ // highlight errors
+ self._errors(data && data.tool_model);
+
// process completed
self.deferred.done(process_id);
// log success
console.debug('tools-form::_refreshForm() - States refreshed.');
- console.debug(node);
+ console.debug(data);
},
error : function(response) {
// process completed
diff -r 1ecb6aaebaf4247a7c71b77cb9a74f63dc937cff -r 4a8a610a97e1762b8ae78280566a23c11676bce9 client/galaxy/scripts/mvc/tools/tools-input.js
--- a/client/galaxy/scripts/mvc/tools/tools-input.js
+++ b/client/galaxy/scripts/mvc/tools/tools-input.js
@@ -12,6 +12,7 @@
// link field
this.field = options.field;
+ this.defaultvalue = options.defaultvalue;
// set element
this.setElement(this._template(options));
@@ -25,8 +26,13 @@
// add field element
this.$field.prepend(this.field.$el);
- // start with enabled optional fields
+ // decide wether to expand or collapse optional fields
this.field.skip = false;
+ var v = this.field.value && this.field.value();
+ this.field.skip = Boolean(options.optional &&
+ ((this.field.validate && !this.field.validate()) || !v ||
+ (v == this.defaultvalue) || (Number(v) == Number(this.defaultvalue)) ||
+ (JSON.stringify(v) == JSON.stringify(this.defaultvalue))));
// refresh view
this._refresh();
@@ -45,9 +51,11 @@
/** Set error text
*/
error: function(text) {
- this.$error_text.html(text);
- this.$error.fadeIn();
- this.$el.addClass('ui-error');
+ if (!this.field.skip) {
+ this.$error_text.html(text);
+ this.$error.fadeIn();
+ this.$el.addClass('ui-error');
+ }
},
/** Reset this view
@@ -63,11 +71,13 @@
if (!this.field.skip) {
this.$field.fadeIn('fast');
this.$title_optional.html('Disable');
- this.app.trigger('refresh');
} else {
+ this.reset();
this.$field.hide();
this.$title_optional.html('Enable');
+ this.field.value && this.field.value(this.defaultvalue);
}
+ this.app.trigger('refresh');
},
/** Main Template
@@ -82,7 +92,7 @@
// is optional
if (options.optional) {
- tmp += 'Optional: ' + options.label +
+ tmp += options.label +
'<span> [<span class="ui-table-form-title-optional"/>]</span>';
} else {
tmp += options.label;
diff -r 1ecb6aaebaf4247a7c71b77cb9a74f63dc937cff -r 4a8a610a97e1762b8ae78280566a23c11676bce9 client/galaxy/scripts/mvc/tools/tools-section.js
--- a/client/galaxy/scripts/mvc/tools/tools-section.js
+++ b/client/galaxy/scripts/mvc/tools/tools-section.js
@@ -1,8 +1,8 @@
/**
This class creates a tool form section and populates it with input elements. It also handles repeat blocks and conditionals by recursively creating new sub sections. New input elements can be plugged in by adding cases to the switch block defined in the _createField() function.
*/
-define(['utils/utils', 'mvc/ui/ui-table', 'mvc/ui/ui-misc', 'mvc/tools/tools-repeat', 'mvc/tools/tools-select-content', 'mvc/tools/tools-input'],
- function(Utils, Table, Ui, Repeat, SelectContent, InputElement) {
+define(['utils/utils', 'mvc/ui/ui-table', 'mvc/ui/ui-misc', 'mvc/ui/ui-portlet', 'mvc/tools/tools-repeat', 'mvc/tools/tools-select-content', 'mvc/tools/tools-input'],
+ function(Utils, Table, Ui, Portlet, Repeat, SelectContent, InputElement) {
// create form view
var View = Backbone.View.extend({
@@ -36,13 +36,13 @@
// load settings elements into table
for (var i in this.inputs) {
- this._add(this.inputs[i]);
+ this.add(this.inputs[i]);
}
},
/** Add a new input element
*/
- _add: function(input) {
+ add: function(input) {
// link this
var self = this;
@@ -66,6 +66,10 @@
case 'repeat':
this._addRepeat(input_def);
break;
+ // customized section
+ case 'section':
+ this._addSection(input_def);
+ break;
// default single element row
default:
this._addRow(input_def);
@@ -103,8 +107,7 @@
// check if non-hidden elements exist
var nonhidden = false;
for (var j in case_def.inputs) {
- var type = case_def.inputs[j].type;
- if (type && type !== 'hidden') {
+ if (!case_def.inputs[j].hidden) {
nonhidden = true;
break;
}
@@ -229,9 +232,9 @@
// create input field wrapper
var input_element = new InputElement(this.app, {
- label : input_def.title,
- help : input_def.help,
- field : repeat
+ label : input_def.title,
+ help : input_def.help,
+ field : repeat
});
// displays as grouped subsection
@@ -244,6 +247,63 @@
this.table.append(input_def.id);
},
+ /** Add a customized section
+ */
+ _addSection: function(input_def) {
+ // link this
+ var self = this;
+
+ // create sub section
+ var sub_section = new View(self.app, {
+ inputs : input_def.inputs,
+ cls : 'ui-table-plain'
+ });
+
+ // delete button
+ var button_visible = new Ui.ButtonIcon({
+ icon : 'fa-eye-slash',
+ tooltip : 'Show/hide section',
+ cls : 'ui-button-icon-plain'
+ });
+
+ // create portlet for sub section
+ var portlet = new Portlet.View({
+ title : input_def.label,
+ cls : 'ui-portlet-section',
+ operations : {
+ button_visible: button_visible
+ }
+ });
+ portlet.append(sub_section.$el);
+
+ // add event handler visibility button
+ var visible = false;
+ portlet.$content.hide();
+ portlet.$header.css('cursor', 'pointer');
+ portlet.$header.on('click', function() {
+ if (visible) {
+ visible = false;
+ portlet.$content.hide();
+ button_visible.setIcon('fa-eye-slash');
+ } else {
+ visible = true;
+ portlet.$content.fadeIn('fast');
+ button_visible.setIcon('fa-eye');
+ }
+ });
+
+ // show sub section if requested
+ if (input_def.expand) {
+ portlet.$header.trigger('click');
+ }
+
+ // create table row
+ this.table.add(portlet.$el);
+
+ // append row to table
+ this.table.append(input_def.id);
+ },
+
/** Add a single input field element
*/
_addRow: function(input_def) {
@@ -258,10 +318,11 @@
// create input field wrapper
var input_element = new InputElement(this.app, {
- label : input_def.label,
- optional : input_def.optional,
- help : input_def.help,
- field : field
+ label : input_def.label,
+ defaultvalue : input_def.defaultvalue,
+ optional : input_def.optional,
+ help : input_def.help,
+ field : field
});
// add to element list
@@ -273,6 +334,11 @@
// append to table
this.table.append(id);
+ // hide row if neccessary
+ if (input_def.hidden) {
+ this.table.get(id).hide();
+ }
+
// return created field
return field;
},
@@ -316,7 +382,7 @@
field = this._fieldHidden(input_def);
break;
- // hidden field
+ // hidden data field
case 'hidden_data':
field = this._fieldHidden(input_def);
break;
@@ -465,9 +531,9 @@
_fieldText : function(input_def) {
var self = this;
return new Ui.Input({
- id : 'field-' + input_def.id,
- area : input_def.area,
- onchange: function() {
+ id : 'field-' + input_def.id,
+ area : input_def.area,
+ onchange : function() {
self.app.trigger('refresh');
}
});
@@ -476,11 +542,15 @@
/** Slider field
*/
_fieldSlider: function(input_def) {
+ var self = this;
return new Ui.Slider.View({
- id : 'field-' + input_def.id,
- precise : input_def.type == 'float',
- min : input_def.min,
- max : input_def.max
+ id : 'field-' + input_def.id,
+ precise : input_def.type == 'float',
+ min : input_def.min,
+ max : input_def.max,
+ onchange : function() {
+ self.app.trigger('refresh');
+ }
});
},
@@ -488,18 +558,22 @@
*/
_fieldHidden : function(input_def) {
return new Ui.Hidden({
- id : 'field-' + input_def.id,
- info : input_def.info
+ id : 'field-' + input_def.id,
+ info : input_def.info
});
},
/** Boolean field
*/
_fieldBoolean : function(input_def) {
+ var self = this;
return new Ui.RadioButton.View({
- id : 'field-' + input_def.id,
- data : [ { label : 'Yes', value : 'true' },
- { label : 'No', value : 'false' }]
+ id : 'field-' + input_def.id,
+ data : [ { label : 'Yes', value : 'true' },
+ { label : 'No', value : 'false' }],
+ onchange : function() {
+ self.app.trigger('refresh');
+ }
});
}
});
diff -r 1ecb6aaebaf4247a7c71b77cb9a74f63dc937cff -r 4a8a610a97e1762b8ae78280566a23c11676bce9 client/galaxy/scripts/mvc/tools/tools-template.js
--- a/client/galaxy/scripts/mvc/tools/tools-template.js
+++ b/client/galaxy/scripts/mvc/tools/tools-template.js
@@ -4,7 +4,7 @@
// tool form templates
return {
help: function(content) {
- return '<div class="toolHelp">' +
+ return '<div class="toolHelp" style="overflow: auto;">' +
'<div class="toolHelpBody">' +
content +
'</div>' +
diff -r 1ecb6aaebaf4247a7c71b77cb9a74f63dc937cff -r 4a8a610a97e1762b8ae78280566a23c11676bce9 client/galaxy/scripts/mvc/tools/tools-tree.js
--- a/client/galaxy/scripts/mvc/tools/tools-tree.js
+++ b/client/galaxy/scripts/mvc/tools/tools-tree.js
@@ -108,22 +108,37 @@
convert(job_input_id, head[input.id + '-section-' + selectedCase]);
}
break;
+ // handle custom sub sections
+ case 'section':
+ convert('', node);
+ break;
default:
// get field
var field = self.app.field_list[input.id];
-
- // get and patch field value
- var value = field.value();
- if (patch[input.type]) {
- value = patch[input.type](value);
- }
-
- // handle default value
- if (!field.skip) {
- if (field.validate && !field.validate(value)) {
- value = null;
+ if (field && field.value) {
+ // get and patch field value
+ var value = field.value();
+ if (patch[input.type]) {
+ value = patch[input.type](value);
}
- add (job_input_id, input.id, value);
+
+ // handle simple value
+ if (!field.skip ) {
+ if (field.validate && !field.validate()) {
+ value = null;
+ }
+ if (input.ignore === undefined || (value !== null && input.ignore != value)) {
+ // add value to submission
+ add (job_input_id, input.id, value);
+
+ // add payload to submission
+ if (input.payload) {
+ for (var p_id in input.payload) {
+ add (p_id, input.id, input.payload[p_id]);
+ }
+ }
+ }
+ }
}
}
}
diff -r 1ecb6aaebaf4247a7c71b77cb9a74f63dc937cff -r 4a8a610a97e1762b8ae78280566a23c11676bce9 client/galaxy/scripts/mvc/ui/ui-misc.js
--- a/client/galaxy/scripts/mvc/ui/ui-misc.js
+++ b/client/galaxy/scripts/mvc/ui/ui-misc.js
@@ -193,6 +193,12 @@
this.disabled = false;
},
+ // change icon
+ setIcon: function(icon_cls) {
+ this.$('i').removeClass(this.options.icon).addClass(icon_cls);
+ this.options.icon = icon_cls;
+ },
+
// template
_template: function(options) {
// width
diff -r 1ecb6aaebaf4247a7c71b77cb9a74f63dc937cff -r 4a8a610a97e1762b8ae78280566a23c11676bce9 client/galaxy/scripts/mvc/ui/ui-portlet.js
--- a/client/galaxy/scripts/mvc/ui/ui-portlet.js
+++ b/client/galaxy/scripts/mvc/ui/ui-portlet.js
@@ -25,6 +25,7 @@
$content : null,
$buttons : null,
$operations : null,
+ $header : null,
// initialize
initialize : function(options) {
@@ -35,22 +36,16 @@
this.setElement(this._template(this.options));
// link content
- this.$content = this.$el.find('#content');
+ this.$content = this.$el.find('.content');
// link title
- this.$title = this.$el.find('#portlet-title-text');
+ this.$title = this.$el.find('.portlet-title-text');
- // set content format
- var $portlet_content = this.$el.find('#portlet-content');
- if (!this.options.scrollable) {
- if (this.options.title) {
- $portlet_content.addClass('no-scroll');
- } else {
- $portlet_content.addClass('no-scroll-no-title');
- }
- } else {
- $portlet_content.addClass('scroll');
- }
+ // link header
+ this.$header = this.$el.find('.portlet-header');
+
+ // link portlet content (wraps 'content')
+ var $portlet_content = this.$el.find('.portlet-content');
// set content padding
if (this.options.nopadding) {
@@ -59,7 +54,7 @@
}
// append buttons
- this.$buttons = $(this.el).find('#buttons');
+ this.$buttons = $(this.el).find('.buttons');
if (this.options.buttons) {
// link functions
var self = this;
@@ -72,7 +67,7 @@
}
// append operations
- this.$operations = $(this.el).find('#operations');
+ this.$operations = $(this.el).find('.operations');
if (this.options.operations) {
// link functions
var self = this;
@@ -161,27 +156,27 @@
var tmpl = '<div id="' + options.id + '" class="' + options.cls + '">';
if (options.title) {
- tmpl += '<div id="portlet-header" class="portlet-header">' +
- '<div id="operations" style="float: ' + options.operations_flt + ';"></div>' +
+ tmpl += '<div class="portlet-header">' +
+ '<div class="operations" style="float: ' + options.operations_flt + ';"></div>' +
'<div class="portlet-title">';
if (options.icon)
tmpl += '<i class="icon fa ' + options.icon + '"> </i>';
- tmpl += '<span id="portlet-title-text" class="portlet-title-text">' + options.title + '</span>' +
+ tmpl += '<span class="portlet-title-text">' + options.title + '</span>' +
'</div>' +
'</div>';
}
- tmpl += '<div id="portlet-content" class="portlet-content">';
+ tmpl += '<div class="portlet-content">';
if (options.placement == 'top') {
- tmpl += '<div id="buttons" class="buttons"></div>';
+ tmpl += '<div class="buttons"></div>';
}
- tmpl += '<div id="content" class="content"></div>';
+ tmpl += '<div class="content"></div>';
if (options.placement == 'bottom') {
- tmpl += '<div id="buttons" class="buttons"></div>';
+ tmpl += '<div class="buttons"></div>';
}
tmpl += '</div>' +
diff -r 1ecb6aaebaf4247a7c71b77cb9a74f63dc937cff -r 4a8a610a97e1762b8ae78280566a23c11676bce9 client/galaxy/scripts/utils/utils.js
--- a/client/galaxy/scripts/utils/utils.js
+++ b/client/galaxy/scripts/utils/utils.js
@@ -6,6 +6,18 @@
// dependencies
define(["libs/underscore"], function(_) {
+/** Traverse through json
+*/
+function deepeach(dict, callback) {
+ for (var i in dict) {
+ var d = dict[i];
+ if (d && typeof(d) == "object") {
+ callback(d);
+ deepeach(d, callback);
+ }
+ }
+}
+
/**
* Sanitize/escape a string
* @param{String} content - Content to be sanitized
@@ -248,7 +260,8 @@
request: request,
sanitize: sanitize,
textify: textify,
- validate: validate
+ validate: validate,
+ deepeach: deepeach
};
});
diff -r 1ecb6aaebaf4247a7c71b77cb9a74f63dc937cff -r 4a8a610a97e1762b8ae78280566a23c11676bce9 client/galaxy/scripts/viz/trackster.js
--- a/client/galaxy/scripts/viz/trackster.js
+++ b/client/galaxy/scripts/viz/trackster.js
@@ -12,7 +12,6 @@
[
// load js libraries
'utils/utils',
- 'mvc/ui/icon-button',
'libs/jquery/jquery.event.drag',
'libs/jquery/jquery.event.hover',
'libs/jquery/jquery.mousewheel',
@@ -32,9 +31,8 @@
});
// trackster viewer
-define( ["libs/underscore", "base", "viz/trackster/tracks", "viz/visualization"],
- function(_, base, tracks, visualization) {
-
+define( ["libs/underscore", "base", "viz/trackster/tracks", "viz/visualization", "mvc/ui/icon-button" ],
+ function(_, base, tracks, visualization, mod_icon_btn) {
/**
* User interface controls for trackster
*/
diff -r 1ecb6aaebaf4247a7c71b77cb9a74f63dc937cff -r 4a8a610a97e1762b8ae78280566a23c11676bce9 config/datatypes_conf.xml.sample
--- a/config/datatypes_conf.xml.sample
+++ b/config/datatypes_conf.xml.sample
@@ -140,6 +140,7 @@
<datatype extension="rgb" type="galaxy.datatypes.images:Rgb" mimetype="image/rgb"/><datatype extension="pbm" type="galaxy.datatypes.images:Pbm" mimetype="image/pbm"/><datatype extension="pgm" type="galaxy.datatypes.images:Pgm" mimetype="image/pgm"/>
+ <datatype extension="rna_eps" type="galaxy.datatypes.sequence:RNADotPlotMatrix" mimetype="image/eps" display_in_upload="True"/><datatype extension="searchgui_archive" type="galaxy.datatypes.binary:CompressedArchive" subclass="True" display_in_upload="True"/><datatype extension="peptideshaker_archive" type="galaxy.datatypes.binary:CompressedArchive" subclass="True" display_in_upload="True"/><datatype extension="eps" type="galaxy.datatypes.images:Eps" mimetype="image/eps"/>
diff -r 1ecb6aaebaf4247a7c71b77cb9a74f63dc937cff -r 4a8a610a97e1762b8ae78280566a23c11676bce9 config/galaxy.ini.sample
--- a/config/galaxy.ini.sample
+++ b/config/galaxy.ini.sample
@@ -354,10 +354,6 @@
# If no message specified the warning box will not be shown.
#registration_warning_message = Please register only one account - we provide this service free of charge and have limited computational resources. Multi-accounts are tracked and will be subjected to account termination and data deletion.
-# When users opt to reset passwords, new ones are created, this option
-# specifies the length of these passwords.
-#reset_password_length = 15
-
# -- Account activation
diff -r 1ecb6aaebaf4247a7c71b77cb9a74f63dc937cff -r 4a8a610a97e1762b8ae78280566a23c11676bce9 config/plugins/visualizations/charts/static/build-app.js
--- a/config/plugins/visualizations/charts/static/build-app.js
+++ b/config/plugins/visualizations/charts/static/build-app.js
@@ -1,6 +1,6 @@
-// Underscore.js 1.4.4
+// Underscore.js 1.7.0
// http://underscorejs.org
-// (c) 2009-2013 Jeremy Ashkenas, DocumentCloud Inc.
+// (c) 2009-2014 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
// Underscore may be freely distributed under the MIT license.
-define("mvc/ui/ui-modal",[],function(){var e=Backbone.View.extend({elMain:"body",optionsDefault:{title:"ui-modal",body:"",backdrop:!0,height:null,width:null,closing_events:!1,closing_callback:null},buttonList:{},initialize:function(e){e&&this._create(e)},show:function(e){this.initialize(e),this.options.height?(this.$body.css("height",this.options.height),this.$body.css("overflow","hidden")):this.$body.css("max-height",$(window).height()/2),this.options.width&&this.$dialog.css("width",this.options.width),this.visible?this.$el.show():this.$el.fadeIn("fast"),this.visible=!0},hide:function(){this.visible=!1,this.$el.fadeOut("fast"),this.options.closing_callback&&this.options.closing_callback()},enableButton:function(e){var t=this.buttonList[e];this.$buttons.find("#"+t).prop("disabled",!1)},disableButton:function(e){var t=this.buttonList[e];this.$buttons.find("#"+t).prop("disabled",!0)},showButton:function(e){var t=this.buttonList[e];this.$buttons.find("#"+t).show()},hideButton:function(e){var t=this.buttonList[e];this.$buttons.find("#"+t).hide()},getButton:function(e){var t=this.buttonList[e];return this.$buttons.find("#"+t)},scrollTop:function(){return this.$body.scrollTop()},_create:function(e){var t=this;this.options=_.defaults(e,this.optionsDefault),this.options.body=="progress"&&(this.options.body=$('<div class="progress progress-striped active"><div class="progress-bar progress-bar-info" style="width:100%"></div></div>')),this.$el&&(this.$el.remove(),$(document).off("keyup.ui-modal")),this.setElement(this._template(this.options.title)),this.$dialog=this.$el.find(".modal-dialog"),this.$body=this.$el.find(".modal-body"),this.$footer=this.$el.find(".modal-footer"),this.$buttons=this.$el.find(".buttons"),this.$backdrop=this.$el.find(".modal-backdrop"),this.$body.html(this.options.body),this.options.backdrop||this.$backdrop.removeClass("in");if(this.options.buttons){this.buttonList={};var n=0;$.each(this.options.buttons,function(e,r){var i="button-"+n++;t.$buttons.append($('<button id="'+i+'"></button>').text(e).click(r)).append(" "),t.buttonList[e]=i})}else this.$footer.hide();$(this.elMain).append($(this.el)),this.options.closing_events&&($(document).on("keyup.ui-modal",function(e){e.keyCode==27&&t.hide()}),this.$el.find(".modal-backdrop").on("click",function(){t.hide()}))},_template:function(e){return'<div class="ui-modal modal"><div class="modal-backdrop fade in" style="z-index: -1;"></div><div class="modal-dialog"><div class="modal-content"><div class="modal-header"><button type="button" class="close" style="display: none;">×</button><h4 class="title">'+e+"</h4>"+"</div>"+'<div class="modal-body" style="position: static;"></div>'+'<div class="modal-footer">'+'<div class="buttons" style="float: right;"></div>'+"</div>"+"</div"+"</div>"+"</div>"}});return{View:e}}),function(){var e=this,t=e._,n={},r=Array.prototype,i=Object.prototype,s=Function.prototype,o=r.push,u=r.slice,a=r.concat,f=i.toString,l=i.hasOwnProperty,c=r.forEach,h=r.map,p=r.reduce,d=r.reduceRight,v=r.filter,m=r.every,g=r.some,y=r.indexOf,b=r.lastIndexOf,w=Array.isArray,E=Object.keys,S=s.bind,x=function(e){if(e instanceof x)return e;if(!(this instanceof x))return new x(e);this._wrapped=e};typeof exports!="undefined"?(typeof module!="undefined"&&module.exports&&(exports=module.exports=x),exports._=x):e._=x,x.VERSION="1.4.4";var T=x.each=x.forEach=function(e,t,r){if(e==null)return;if(c&&e.forEach===c)e.forEach(t,r);else if(e.length===+e.length){for(var i=0,s=e.length;i<s;i++)if(t.call(r,e[i],i,e)===n)return}else for(var o in e)if(x.has(e,o)&&t.call(r,e[o],o,e)===n)return};x.map=x.collect=function(e,t,n){var r=[];return e==null?r:h&&e.map===h?e.map(t,n):(T(e,function(e,i,s){r.push(t.call(n,e,i,s))}),r)};var N="Reduce of empty array with no initial value";x.reduce=x.foldl=x.inject=function(e,t,n,r){var i=arguments.length>2;e==null&&(e=[]);if(p&&e.reduce===p)return r&&(t=x.bind(t,r)),i?e.reduce(t,n):e.reduce(t);T(e,function(e,s,o){i?n=t.call(r,n,e,s,o):(n=e,i=!0)});if(!i)throw new TypeError(N);return n},x.reduceRight=x.foldr=function(e,t,n,r){var i=arguments.length>2;e==null&&(e=[]);if(d&&e.reduceRight===d)return r&&(t=x.bind(t,r)),i?e.reduceRight(t,n):e.reduceRight(t);var s=e.length;if(s!==+s){var o=x.keys(e);s=o.length}T(e,function(u,a,f){a=o?o[--s]:--s,i?n=t.call(r,n,e[a],a,f):(n=e[a],i=!0)});if(!i)throw new TypeError(N);return n},x.find=x.detect=function(e,t,n){var r;return C(e,function(e,i,s){if(t.call(n,e,i,s))return r=e,!0}),r},x.filter=x.select=function(e,t,n){var r=[];return e==null?r:v&&e.filter===v?e.filter(t,n):(T(e,function(e,i,s){t.call(n,e,i,s)&&r.push(e)}),r)},x.reject=function(e,t,n){return x.filter(e,function(e,r,i){return!t.call(n,e,r,i)},n)},x.every=x.all=function(e,t,r){t||(t=x.identity);var i=!0;return e==null?i:m&&e.every===m?e.every(t,r):(T(e,function(e,s,o){if(!(i=i&&t.call(r,e,s,o)))return n}),!!i)};var C=x.some=x.any=function(e,t,r){t||(t=x.identity);var i=!1;return e==null?i:g&&e.some===g?e.some(t,r):(T(e,function(e,s,o){if(i||(i=t.call(r,e,s,o)))return n}),!!i)};x.contains=x.include=function(e,t){return e==null?!1:y&&e.indexOf===y?e.indexOf(t)!=-1:C(e,function(e){return e===t})},x.invoke=function(e,t){var n=u.call(arguments,2),r=x.isFunction(t);return x.map(e,function(e){return(r?t:e[t]).apply(e,n)})},x.pluck=function(e,t){return x.map(e,function(e){return e[t]})},x.where=function(e,t,n){return x.isEmpty(t)?n?void 0:[]:x[n?"find":"filter"](e,function(e){for(var n in t)if(t[n]!==e[n])return!1;return!0})},x.findWhere=function(e,t){return x.where(e,t,!0)},x.max=function(e,t,n){if(!t&&x.isArray(e)&&e[0]===+e[0]&&e.length<65535)return Math.max.apply(Math,e);if(!t&&x.isEmpty(e))return-Infinity;var r={computed:-Infinity,value:-Infinity};return T(e,function(e,i,s){var o=t?t.call(n,e,i,s):e;o>=r.computed&&(r={value:e,computed:o})}),r.value},x.min=function(e,t,n){if(!t&&x.isArray(e)&&e[0]===+e[0]&&e.length<65535)return Math.min.apply(Math,e);if(!t&&x.isEmpty(e))return Infinity;var r={computed:Infinity,value:Infinity};return T(e,function(e,i,s){var o=t?t.call(n,e,i,s):e;o<r.computed&&(r={value:e,computed:o})}),r.value},x.shuffle=function(e){var t,n=0,r=[];return T(e,function(e){t=x.random(n++),r[n-1]=r[t],r[t]=e}),r};var k=function(e){return x.isFunction(e)?e:function(t){return t[e]}};x.sortBy=function(e,t,n){var r=k(t);return x.pluck(x.map(e,function(e,t,i){return{value:e,index:t,criteria:r.call(n,e,t,i)}}).sort(function(e,t){var n=e.criteria,r=t.criteria;if(n!==r){if(n>r||n===void 0)return 1;if(n<r||r===void 0)return-1}return e.index<t.index?-1:1}),"value")};var L=function(e,t,n,r){var i={},s=k(t==null?x.identity:t);return T(e,function(t,o){var u=s.call(n,t,o,e);r(i,u,t)}),i};x.groupBy=function(e,t,n){return L(e,t,n,function(e,t,n){(x.has(e,t)?e[t]:e[t]=[]).push(n)})},x.countBy=function(e,t,n){return L(e,t,n,function(e,t){x.has(e,t)||(e[t]=0),e[t]++})},x.sortedIndex=function(e,t,n,r){n=n==null?x.identity:k(n);var i=n.call(r,t),s=0,o=e.length;while(s<o){var u=s+o>>>1;n.call(r,e[u])<i?s=u+1:o=u}return s},x.toArray=function(e){return e?x.isArray(e)?u.call(e):e.length===+e.length?x.map(e,x.identity):x.values(e):[]},x.size=function(e){return e==null?0:e.length===+e.length?e.length:x.keys(e).length},x.first=x.head=x.take=function(e,t,n){return e==null?void 0:t!=null&&!n?u.call(e,0,t):e[0]},x.initial=function(e,t,n){return u.call(e,0,e.length-(t==null||n?1:t))},x.last=function(e,t,n){return e==null?void 0:t!=null&&!n?u.call(e,Math.max(e.length-t,0)):e[e.length-1]},x.rest=x.tail=x.drop=function(e,t,n){return u.call(e,t==null||n?1:t)},x.compact=function(e){return x.filter(e,x.identity)};var A=function(e,t,n){return T(e,function(e){x.isArray(e)?t?o.apply(n,e):A(e,t,n):n.push(e)}),n};x.flatten=function(e,t){return A(e,t,[])},x.without=function(e){return x.difference(e,u.call(arguments,1))},x.uniq=x.unique=function(e,t,n,r){x.isFunction(t)&&(r=n,n=t,t=!1);var i=n?x.map(e,n,r):e,s=[],o=[];return T(i,function(n,r){if(t?!r||o[o.length-1]!==n:!x.contains(o,n))o.push(n),s.push(e[r])}),s},x.union=function(){return x.uniq(a.apply(r,arguments))},x.intersection=function(e){var t=u.call(arguments,1);return x.filter(x.uniq(e),function(e){return x.every(t,function(t){return x.indexOf(t,e)>=0})})},x.difference=function(e){var t=a.apply(r,u.call(arguments,1));return x.filter(e,function(e){return!x.contains(t,e)})},x.zip=function(){var e=u.call(arguments),t=x.max(x.pluck(e,"length")),n=new Array(t);for(var r=0;r<t;r++)n[r]=x.pluck(e,""+r);return n},x.unzip=function(e){var t=[];return x.each(e,function(e,n){x.each(e,function(e,r){t.length<=r&&(t[r]=[]),t[r][n]=e})}),t},x.object=function(e,t){if(e==null)return{};var n={};for(var r=0,i=e.length;r<i;r++)t?n[e[r]]=t[r]:n[e[r][0]]=e[r][1];return n},x.indexOf=function(e,t,n){if(e==null)return-1;var r=0,i=e.length;if(n){if(typeof n!="number")return r=x.sortedIndex(e,t),e[r]===t?r:-1;r=n<0?Math.max(0,i+n):n}if(y&&e.indexOf===y)return e.indexOf(t,n);for(;r<i;r++)if(e[r]===t)return r;return-1},x.lastIndexOf=function(e,t,n){if(e==null)return-1;var r=n!=null;if(b&&e.lastIndexOf===b)return r?e.lastIndexOf(t,n):e.lastIndexOf(t);var i=r?n:e.length;while(i--)if(e[i]===t)return i;return-1},x.range=function(e,t,n){arguments.length<=1&&(t=e||0,e=0),n=arguments[2]||1;var r=Math.max(Math.ceil((t-e)/n),0),i=0,s=new Array(r);while(i<r)s[i++]=e,e+=n;return s};var O=function(){};x.bind=function(e,t){var n,r;if(e.bind===S&&S)return S.apply(e,u.call(arguments,1));if(!x.isFunction(e))throw new TypeError;return n=u.call(arguments,2),r=function(){if(this instanceof r){O.prototype=e.prototype;var i=new O;O.prototype=null;var s=e.apply(i,n.concat(u.call(arguments)));return Object(s)===s?s:i}return e.apply(t,n.concat(u.call(arguments)))}},x.partial=function(e){var t=u.call(arguments,1);return function(){return e.apply(this,t.concat(u.call(arguments)))}},x.bindAll=function(e){var t=u.call(arguments,1);if(t.length===0)throw new Error("bindAll must be passed function names");return T(t,function(t){e[t]=x.bind(e[t],e)}),e},x.memoize=function(e,t){var n={};return t||(t=x.identity),function(){var r=t.apply(this,arguments);return x.has(n,r)?n[r]:n[r]=e.apply(this,arguments)}},x.delay=function(e,t){var n=u.call(arguments,2);return setTimeout(function(){return e.apply(null,n)},t)},x.defer=function(e){return x.delay.apply(x,[e,1].concat(u.call(arguments,1)))},x.throttle=function(e,t,n){var r,i,s,o,u=0,a=function(){u=new Date,s=null,o=e.apply(r,i)};return function(){var f=new Date;!u&&n===!1&&(u=f);var l=t-(f-u);return r=this,i=arguments,l<=0?(clearTimeout(s),s=null,u=f,o=e.apply(r,i)):s||(s=setTimeout(a,l)),o}},x.debounce=function(e,t,n){var r,i;return function(){var s=this,o=arguments,u=function(){r=null,n||(i=e.apply(s,o))},a=n&&!r;return clearTimeout(r),r=setTimeout(u,t),a&&(i=e.apply(s,o)),i}},x.once=function(e){var t=!1,n;return function(){return t?n:(t=!0,n=e.apply(this,arguments),e=null,n)}},x.wrap=function(e,t){return function(){var n=[e];return o.apply(n,arguments),t.apply(this,n)}},x.compose=function(){var e=arguments;return function(){var t=arguments;for(var n=e.length-1;n>=0;n--)t=[e[n].apply(this,t)];return t[0]}},x.after=function(e,t){return e<=0?t():function(){if(--e<1)return t.apply(this,arguments)}},x.keys=E||function(e){if(e!==Object(e))throw new TypeError("Invalid object");var t=[];for(var n in e)x.has(e,n)&&t.push(n);return t},x.values=function(e){var t=[];for(var n in e)x.has(e,n)&&t.push(e[n]);return t},x.pairs=function(e){var t=[];for(var n in e)x.has(e,n)&&t.push([n,e[n]]);return t},x.invert=function(e){var t={};for(var n in e)x.has(e,n)&&(t[e[n]]=n);return t},x.functions=x.methods=function(e){var t=[];for(var n in e)x.isFunction(e[n])&&t.push(n);return t.sort()},x.extend=function(e){return T(u.call(arguments,1),function(t){if(t)for(var n in t)e[n]=t[n]}),e},x.pick=function(e){var t={},n=a.apply(r,u.call(arguments,1));return T(n,function(n){n in e&&(t[n]=e[n])}),t},x.omit=function(e){var t={},n=a.apply(r,u.call(arguments,1));for(var i in e)x.contains(n,i)||(t[i]=e[i]);return t},x.defaults=function(e){return T(u.call(arguments,1),function(t){if(t)for(var n in t)e[n]===void 0&&(e[n]=t[n])}),e},x.clone=function(e){return x.isObject(e)?x.isArray(e)?e.slice():x.extend({},e):e},x.tap=function(e,t){return t(e),e};var M=function(e,t,n,r){if(e===t)return e!==0||1/e==1/t;if(e==null||t==null)return e===t;e instanceof x&&(e=e._wrapped),t instanceof x&&(t=t._wrapped);var i=f.call(e);if(i!=f.call(t))return!1;switch(i){case"[object String]":return e==String(t);case"[object Number]":return e!=+e?t!=+t:e==0?1/e==1/t:e==+t;case"[object Date]":case"[object Boolean]":return+e==+t;case"[object RegExp]":return e.source==t.source&&e.global==t.global&&e.multiline==t.multiline&&e.ignoreCase==t.ignoreCase}if(typeof e!="object"||typeof t!="object")return!1;var s=n.length;while(s--)if(n[s]==e)return r[s]==t;n.push(e),r.push(t);var o=0,u=!0;if(i=="[object Array]"){o=e.length,u=o==t.length;if(u)while(o--)if(!(u=M(e[o],t[o],n,r)))break}else{var a=e.constructor,l=t.constructor;if(a!==l&&!(x.isFunction(a)&&a instanceof a&&x.isFunction(l)&&l instanceof l))return!1;for(var c in e)if(x.has(e,c)){o++;if(!(u=x.has(t,c)&&M(e[c],t[c],n,r)))break}if(u){for(c in t)if(x.has(t,c)&&!(o--))break;u=!o}}return n.pop(),r.pop(),u};x.isEqual=function(e,t){return M(e,t,[],[])},x.isEmpty=function(e){if(e==null)return!0;if(x.isArray(e)||x.isString(e))return e.length===0;for(var t in e)if(x.has(e,t))return!1;return!0},x.isElement=function(e){return!!e&&e.nodeType===1},x.isArray=w||function(e){return f.call(e)=="[object Array]"},x.isObject=function(e){return e===Object(e)},T(["Arguments","Function","String","Number","Date","RegExp"],function(e){x["is"+e]=function(t){return f.call(t)=="[object "+e+"]"}}),x.isArguments(arguments)||(x.isArguments=function(e){return!!e&&!!x.has(e,"callee")}),typeof /./!="function"&&(x.isFunction=function(e){return typeof e=="function"}),x.isFinite=function(e){return isFinite(e)&&!isNaN(parseFloat(e))},x.isNaN=function(e){return x.isNumber(e)&&e!=+e},x.isBoolean=function(e){return e===!0||e===!1||f.call(e)=="[object Boolean]"},x.isNull=function(e){return e===null},x.isUndefined=function(e){return e===void 0},x.has=function(e,t){return l.call(e,t)},x.noConflict=function(){return e._=t,this},x.identity=function(e){return e},x.times=function(e,t,n){var r=Array(e);for(var i=0;i<e;i++)r[i]=t.call(n,i);return r},x.random=function(e,t){return t==null&&(t=e,e=0),e+Math.floor(Math.random()*(t-e+1))};var _={escape:{"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"}};_.unescape=x.invert(_.escape);var D={escape:new RegExp("["+x.keys(_.escape).join("")+"]","g"),unescape:new RegExp("("+x.keys(_.unescape).join("|")+")","g")};x.each(["escape","unescape"],function(e){x[e]=function(t){return t==null?"":(""+t).replace(D[e],function(t){return _[e][t]})}}),x.result=function(e,t){if(e==null)return void 0;var n=e[t];return x.isFunction(n)?n.call(e):n},x.mixin=function(e){T(x.functions(e),function(t){var n=x[t]=e[t];x.prototype[t]=function(){var e=[this._wrapped];return o.apply(e,arguments),F.call(this,n.apply(x,e))}})};var P=0;x.uniqueId=function(e){var t=++P+"";return e?e+t:t},x.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var H=/(.)^/,B={"'":"'","\\":"\\","\r":"r","\n":"n"," ":"t","\u2028":"u2028","\u2029":"u2029"},j=/\\|'|\r|\n|\t|\u2028|\u2029/g;x.template=function(e,t,n){var r;n=x.defaults({},n,x.templateSettings);var i=new RegExp([(n.escape||H).source,(n.interpolate||H).source,(n.evaluate||H).source].join("|")+"|$","g"),s=0,o="__p+='";e.replace(i,function(t,n,r,i,u){return o+=e.slice(s,u).replace(j,function(e){return"\\"+B[e]}),n&&(o+="'+\n((__t=("+n+"))==null?'':_.escape(__t))+\n'"),r&&(o+="'+\n((__t=("+r+"))==null?'':__t)+\n'"),i&&(o+="';\n"+i+"\n__p+='"),s=u+t.length,t}),o+="';\n",n.variable||(o="with(obj||{}){\n"+o+"}\n"),o="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+o+"return __p;\n";try{r=new Function(n.variable||"obj","_",o)}catch(u){throw u.source=o,u}if(t)return r(t,x);var a=function(e){return r.call(this,e,x)};return a.source="function("+(n.variable||"obj")+"){\n"+o+"}",a},x.chain=function(e){return x(e).chain()};var F=function(e){return this._chain?x(e).chain():e};x.mixin(x),T(["pop","push","reverse","shift","sort","splice","unshift"],function(e){var t=r[e];x.prototype[e]=function(){var n=this._wrapped;return t.apply(n,arguments),(e=="shift"||e=="splice")&&n.length===0&&delete n[0],F.call(this,n)}}),T(["concat","join","slice"],function(e){var t=r[e];x.prototype[e]=function(){return F.call(this,t.apply(this._wrapped,arguments))}}),x.extend(x.prototype,{chain:function(){return this._chain=!0,this},value:function(){return this._wrapped}})}.call(this),define("libs/underscore",function(e){return function(){var t,n;return t||e._}}(this)),define("utils/utils",["libs/underscore"],function(e){function t(e){return $("<div/>").text(e).html()}function n(e){top.__utils__get__=top.__utils__get__||{},e.cache&&top.__utils__get__[e.url]?(e.success&&e.success(top.__utils__get__[e.url]),console.debug("utils.js::get() - Fetching from cache ["+e.url+"].")):r({url:e.url,data:e.data,success:function(t){top.__utils__get__[e.url]=t,e.success&&e.success(t)},error:function(t){e.error&&e.error(t)}})}function r(e){var t={contentType:"application/json",type:e.type||"GET",data:e.data||{},url:e.url};t.type=="GET"||t.type=="DELETE"?(t.url.indexOf("?")==-1?t.url+="?":t.url+="&",t.url=t.url+$.param(t.data),t.data=null):(t.dataType="json",t.url=t.url,t.data=JSON.stringify(t.data)),$.ajax(t).done(function(t){if(typeof t=="string")try{t=t.replace("Infinity,",'"Infinity",'),t=jQuery.parseJSON(t)}catch(n){console.debug(n)}e.success&&e.success(t)}).fail(function(t){var n=null;try{n=jQuery.parseJSON(t.responseText)}catch(r){n=t.responseText}e.error&&e.error(n,t)})}function i(e,t){var n=$('<div class="'+e+'"></div>');n.appendTo(":eq(0)");var r=n.css(t);return n.remove(),r}function s(e){$('link[href^="'+e+'"]').length||$('<link href="'+galaxy_config.root+e+'" rel="stylesheet">').appendTo("head")}function o(t,n){return t?e.defaults(t,n):n}function u(e,t){var n="";if(e>=1e11)e/=1e11,n="TB";else if(e>=1e8)e/=1e8,n="GB";else if(e>=1e5)e/=1e5,n="MB";else if(e>=100)e/=100,n="KB";else{if(!(e>0))return"<strong>-</strong>";e*=10,n="b"}var r=Math.round(e)/10;return t?r+" "+n:"<strong>"+r+"</strong> "+n}function a(){return"x"+Math.random().toString(36).substring(2,9)}function f(e){var t=$("<p></p>");return t.append(e),t}function l(){var e=new Date,t=(e.getHours()<10?"0":"")+e.getHours(),n=(e.getMinutes()<10?"0":"")+e.getMinutes(),r=e.getDate()+"/"+(e.getMonth()+1)+"/"+e.getFullYear()+", "+t+":"+n;return r}return{cssLoadFile:s,cssGetAttribute:i,get:n,merge:o,bytesToString:u,uuid:a,time:l,wrap:f,request:r,sanitize:t}}),define("mvc/ui/ui-portlet",["utils/utils"],function(e){var t=Backbone.View.extend({visible:!1,optionsDefault:{title:"",icon:"",buttons:null,body:null,scrollable:!0,nopadding:!1,operations:null,placement:"bottom",cls:"ui-portlet",operations_flt:"right"},$title:null,$content:null,$buttons:null,$operations:null,initialize:function(t){this.options=e.merge(t,this.optionsDefault),this.setElement(this._template(this.options)),this.$content=this.$el.find("#content"),this.$title=this.$el.find("#portlet-title-text");var n=this.$el.find("#portlet-content");this.options.scrollable?n.addClass("scroll"):this.options.title?n.addClass("no-scroll"):n.addClass("no-scroll-no-title"),this.options.nopadding&&(n.css("padding","0px"),this.$content.css("padding","0px")),this.$buttons=$(this.el).find("#buttons");if(this.options.buttons){var r=this;$.each(this.options.buttons,function(e,t){t.$el.prop("id",e),r.$buttons.append(t.$el)})}else this.$buttons.remove();this.$operations=$(this.el).find("#operations");if(this.options.operations){var r=this;$.each(this.options.operations,function(e,t){t.$el.prop("id",e),r.$operations.append(t.$el)})}this.options.body&&this.append(this.options.body)},append:function(t,n){n?this.$content.append(t):this.$content.append(e.wrap(t))},content:function(){return this.$content},show:function(){this.$el.fadeIn("fast"),this.visible=!0},hide:function(){this.$el.fadeOut("fast"),this.visible=!1},enableButton:function(e){this.$buttons.find("#"+e).prop("disabled",!1)},disableButton:function(e){this.$buttons.find("#"+e).prop("disabled",!0)},hideOperation:function(e){this.$operations.find("#"+e).hide()},showOperation:function(e){this.$operations.find("#"+e).show()},setOperation:function(e,t){var n=this.$operations.find("#"+e);n.off("click"),n.on("click",t)},title:function(e){var t=this.$title;return e&&t.html(e),t.html()},_template:function(e){var t='<div id="'+e.id+'" class="'+e.cls+'">';return e.title&&(t+='<div id="portlet-header" class="portlet-header"><div id="operations" style="float: '+e.operations_flt+';"></div>'+'<div class="portlet-title">',e.icon&&(t+='<i class="icon fa '+e.icon+'"> </i>'),t+='<span id="portlet-title-text" class="portlet-title-text">'+e.title+"</span>"+"</div>"+"</div>"),t+='<div id="portlet-content" class="portlet-content">',e.placement=="top"&&(t+='<div id="buttons" class="buttons"></div>'),t+='<div id="content" class="content"></div>',e.placement=="bottom"&&(t+='<div id="buttons" class="buttons"></div>'),t+="</div></div>",t}});return{View:t}}),define("mvc/ui/ui-select-default",["utils/utils"],function(e){var t=Backbone.View.extend({optionsDefault:{id:"",cls:"",error_text:"No data available",visible:!0,wait:!1,multiple:!1,searchable:!1},initialize:function(t){this.options=e.merge(t,this.optionsDefault),this.setElement(this._template(this.options)),this.$select=this.$el.find(".select"),this.$icon=this.$el.find(".icon"),this.$button=this.$el.find(".button"),this.options.multiple?(this.$select.prop("multiple",!0),this.$select.addClass("ui-select-multiple"),this.$icon.remove()):this.$el.addClass("ui-select"),this.update(this.options.data),this.options.value!==undefined&&this.value(this.options.value),this.options.visible||this.hide(),this.options.wait?this.wait():this.show();var n=this;this.$select.on("change",function(){n._change()}),this.on("change",function(){n._change()})},value:function(e){return e!==undefined&&(this.$select.val(e),this.$select.select2&&this.$select.select2("val",e)),this.$select.val()},first:function(){var e=this.$select.find("option");return e.length>0?e.val():undefined},validate:function(){var e=this.value();e instanceof Array||(e=[e]);for(var t in e)if([null,"null",undefined].indexOf(e[t])>-1)return!1;return!0},text:function(){return this.$select.find("option:selected").text()},show:function(){this.unwait(),this.$select.show(),this.$el.show()},hide:function(){this.$el.hide()},wait:function(){this.$icon.removeClass(),this.$icon.addClass("fa fa-spinner fa-spin")},unwait:function(){this.$icon.removeClass(),this.$icon.addClass("fa fa-caret-down")},disabled:function(){return this.$select.is(":disabled")},enable:function(){this.$select.prop("disabled",!1)},disable:function(){this.$select.prop("disabled",!0)},add:function(e){this.$select.append(this._templateOption(e)),this._refresh()},del:function(e){this.$select.find("option[value="+e+"]").remove(),this.$select.trigger("change"),this._refresh()},update:function(e){var t=this.$select.val();this.$select.find("option").remove();for(var n in e)this.$select.append(this._templateOption(e[n]));this._refresh(),this.$select.val(t),this.$select.val()||this.$select.val(this.first()),this.options.searchable&&(this.$button.hide(),this.$select.select2("destroy"),this.$select.select2())},setOnChange:function(e){this.options.onchange=e},exists:function(e){return this.$select.find('option[value="'+e+'"]').length>0},_change:function(){this.options.onchange&&this.options.onchange(this.$select.val())},_refresh:function(){this.$select.find("option[value=null]").remove();var e=this.$select.find("option").length;e==0?(this.disable(),this.$select.append(this._templateOption({value:"null",label:this.options.error_text}))):this.enable()},_templateOption:function(e){return'<option value="'+e.value+'">'+e.label+"</option>"},_template:function(e){return'<div id="'+e.id+'">'+'<select id="select" class="select '+e.cls+" "+e.id+'"></select>'+'<div class="button">'+'<i class="icon"/>'+"</div>"+"</div>"}});return{View:t}}),define("mvc/ui/ui-slider",["utils/utils"],function(e){var t=Backbone.View.extend({optionsDefault:{min:null,max:null,step:null,precise:!1,split:1e4},initialize:function(t){var n=this;this.options=e.merge(t,this.optionsDefault),this.setElement(this._template(this.options)),this.useslider=this.options.max!==null&&this.options.min!==null&&this.options.max>this.options.min,this.options.step===null&&(this.options.step=1,this.options.precise&&this.useslider&&(this.options.step=(this.options.max-this.options.min)/this.options.split)),this.useslider?(this.$slider=this.$el.find("#slider"),this.$slider.slider(this.options),this.$slider.on("slide",function(e,t){n.value(t.value)})):this.$el.find(".ui-form-slider-text").css("width","100%"),this.$text=this.$el.find("#text"),this.options.value!==undefined&&this.value(this.options.value),this.$text.on("change",function(){n.value($(this).val())});var r=[];this.$text.on("keyup",function(e){r[e.which]=!1}),this.$text.on("keydown",function(e){var t=e.which;r[t]=!0,t==8||t==9||t==13||t==37||t==39||t>=48&&t<=57||t==190&&$(this).val().indexOf(".")==-1&&n.options.precise||t==189&&$(this).val().indexOf("-")==-1||r[91]||r[17]||event.preventDefault()})},value:function(e){return e!==undefined&&(isNaN(e)&&(e=0),this.options.max!==null&&(e=Math.min(e,this.options.max)),this.options.min!==null&&(e=Math.max(e,this.options.min)),this.options.onchange&&this.options.onchange(e),this.$slider&&this.$slider.slider("value",e),this.$text.val(e)),this.$text.val()},_template:function(e){return'<div id="'+e.id+'" class="ui-form-slider">'+'<input id="text" type="text" class="ui-form-slider-text"/>'+'<div id="slider" class="ui-form-slider-element"/>'+"</div>"}});return{View:t}}),define("mvc/ui/ui-options",["utils/utils"],function(e){var t=Backbone.View.extend({initialize:function(t){this.optionsDefault={visible:!0,data:[],id:e.uuid(),error_text:"No data available.",wait_text:"Please wait..."},this.options=e.merge(t,this.optionsDefault),this.setElement("<div/>"),this.$message=$("<div/>"),this.$options=$(this._template(t)),this.$el.append(this.$message),this.$el.append(this.$options),this.options.visible||this.$el.hide(),this.update(this.options.data),this.options.value!==undefined&&this.value(this.options.value);var n=this;this.on("change",function(){n._change()})},update:function(e){var t=this._getValue();this.$options.empty();if(this._templateOptions)this.$options.append(this._templateOptions(e));else for(var n in e){var r=$(this._templateOption(e[n]));r.addClass("ui-option"),this.$options.append(r)}var i=this;this.$el.find("input").on("change",function(){i.value(i._getValue()),i._change()}),this._refresh(),this.value(t)},value:function(e){if(e!==undefined){e instanceof Array||(e=[e]),this.$el.find("input").prop("checked",!1);for(var t in e)this.$el.find('input[value="'+e[t]+'"]').first().prop("checked",!0)}return this._getValue()},exists:function(e){if(e!==undefined){e instanceof Array||(e=[e]);for(var t in e)if(this.$el.find('input[value="'+e[t]+'"]').length>0)return!0}return!1},first:function(){var e=this.$el.find("input");return e.length>0?e.val():undefined},validate:function(){var e=this.value();e instanceof Array||(e=[e]);for(var t in e)if([null,"null",undefined].indexOf(e[t])>-1)return!1;return!0},wait:function(){this._size()==0&&(this._messageShow(this.options.wait_text,"info"),this.$options.hide())},unwait:function(){this._messageHide(),this._refresh()},_change:function(){this.options.onchange&&this.options.onchange(this._getValue())},_refresh:function(){this._size()==0?(this._messageShow(this.options.error_text,"danger"),this.$options.hide()):(this._messageHide(),this.$options.css("display","inline-block"))},_getValue:function(){var e=this.$el.find(":checked");if(e.length==0)return"null";if(this.options.multiple){var t=[];return e.each(function(){t.push($(this).val())}),t}return e.val()},_size:function(){return this.$el.find(".ui-option").length},_messageShow:function(e,t){this.$message.show(),this.$message.removeClass(),this.$message.addClass("ui-message alert alert-"+t),this.$message.html(e)},_messageHide:function(){this.$message.hide()},_template:function(){return'<div class="ui-options"/>'}}),n={};n.View=t.extend({initialize:function(e){t.prototype.initialize.call(this,e)},_templateOption:function(e){return'<div><input type="radio" name="'+this.options.id+'" value="'+e.value+'"/>'+e.label+"<br>"+"</div>"}});var r={};r.View=t.extend({initialize:function(e){e.multiple=!0,t.prototype.initialize.call(this,e)},_templateOption:function(e){return'<div><input type="checkbox" name="'+this.options.id+'" value="'+e.value+'"/>'+e.label+"<br>"+"</div>"}});var i={};return i.View=t.extend({initialize:function(e){t.prototype.initialize.call(this,e)},value:function(e){return e!==undefined&&(this.$el.find("input").prop("checked",!1),this.$el.find("label").removeClass("active"),this.$el.find('[value="'+e+'"]').prop("checked",!0).closest("label").addClass("active")),this._getValue()},_templateOption:function(e){var t='<label class="btn btn-default">';return e.icon&&(t+='<i class="fa '+e.icon+'"/>'),t+='<input type="radio" name="'+this.options.id+'" value="'+e.value+'">'+e.label+"</label>",t},_template:function(){return'<div class="btn-group ui-radiobutton" data-toggle="buttons"/>'}}),{Base:t,Radio:n,RadioButton:i,Checkbox:r}}),define("mvc/ui/ui-drilldown",["utils/utils","mvc/ui/ui-options"],function(e,t){var n=t.Base.extend({initialize:function(e){this.display=e.display||"checkbox",e.multiple=this.display=="checkbox",t.Base.prototype.initialize.call(this,e)},_templateOption:function(e,t,n){return'<div><input name="'+this.options.id+'" class="ui-option" type="'+this.display+'" value="'+t+'">'+e+"<div/>"},_templateOptions:function(e){function n(e,t){function n(n){n?(t.fadeIn("fast"),e.removeClass("toggle-expand"),e.addClass("toggle"),e.is_expanded=!0):(t.hide(),e.removeClass("toggle"),e.addClass("toggle-expand"),e.is_expanded=!1)}e.on("click",function(){n(!e.is_expanded)})}function r(e,s){for(i in s){var o=s[i],u=o.options.length>0,a=$("<div/>");if(u){var f=$('<span class="ui-drilldown-button form-toggle icon-button toggle-expand" style="position: relative; top: 2px;"/>'),l=$("<div/>");l.append(f),l.append(t._templateOption(o.name,o.value)),a.append(l);var c=$('<div style="display: none; margin-left: 25px;"/>');r(c,o.options),a.append(c),n(f,c)}else a.append(t._templateOption(o.name,o.value));e.append(a)}}var t=this,s=$("<div/>");return r(s,e),s},_template:function(e){return'<div class="ui-options drilldown-container" id="'+e.id+'"/>'}});return{View:n}}),define("mvc/ui/ui-button-menu",["utils/utils"],function(e){return Backbone.View.extend({optionsDefault:{id:"",title:"",floating:"right",icon:null,onclick:null,cls:"ui-button-icon ui-button-menu",tooltip:"",target:"",href:"",onunload:null,visible:!0,tag:""},$menu:null,initialize:function(t){this.options=e.merge(t,this.optionsDefault),this.setElement($(this._template(this.options)));var n=$(this.el).find(".root"),r=this;n.on("click",function(e){$(".tooltip").hide(),e.preventDefault(),r.options.onclick&&r.options.onclick()}),this.options.visible||this.hide(),n.tooltip({title:t.tooltip,placement:"bottom"})},show:function(){$(this.el).show()},hide:function(){$(this.el).hide()},addMenu:function(t){var n={title:"",target:"",href:"",onclick:null,divider:!1,icon:null,cls:"button-menu btn-group"};n=e.merge(t,n),this.$menu||($(this.el).append(this._templateMenu()),this.$menu=$(this.el).find(".menu"));var r=$(this._templateMenuItem(n));r.on("click",function(e){e.preventDefault(),n.onclick&&n.onclick()}),this.$menu.append(r),n.divider&&this.$menu.append($(this._templateDivider()))},_templateMenuItem:function(e){var t='<li><a class="dropdown-item" href="'+e.href+'" target="'+e.target+'">';return e.icon&&(t+='<i class="fa '+e.icon+'"></i>'),t+=" "+e.title+"</a>"+"</li>",t},_templateMenu:function(){return'<ul class="menu dropdown-menu pull-right" role="menu"></ul>'},_templateDivider:function(){return'<li class="divider"></li>'},_template:function(e){var t="",n="";e.title?t="width: auto;":n="margin: 0px;";var r='<div id="'+e.id+'" style="float: '+e.floating+"; "+t+'" class="dropdown '+e.cls+'">'+'<div class="root button dropdown-toggle" data-toggle="dropdown" style="'+n+'">'+'<i class="icon fa '+e.icon+'"/>';return e.title&&(r+=' <span class="title">'+e.title+"</span>"),r+="</div></div>",r}})}),define("mvc/ui/ui-misc",["utils/utils","mvc/ui/ui-select-default","mvc/ui/ui-slider","mvc/ui/ui-options","mvc/ui/ui-drilldown","mvc/ui/ui-button-menu","mvc/ui/ui-modal"],function(e,t,n,r,i,s,o){var u=Backbone.View.extend({optionsDefault:{url:"",cls:""},initialize:function(t){this.options=e.merge(t,this.optionsDefault),this.setElement(this._template(this.options))},_template:function(e){return'<img class="ui-image '+e.cls+'" src="'+e.url+'"/>'}}),a=Backbone.View.extend({optionsDefault:{title:"",cls:""},initialize:function(t){this.options=e.merge(t,this.optionsDefault),this.setElement(this._template(this.options))},title:function(e){this.$el.html(e)},_template:function(e){return'<label class="ui-label '+e.cls+'">'+e.title+"</label>"},value:function(){return options.title}}),f=Backbone.View.extend({optionsDefault:{floating:"right",icon:"",tooltip:"",placement:"bottom",title:"",cls:""},initialize:function(t){this.options=e.merge(t,this.optionsDefault),this.setElement(this._template(this.options)),$(this.el).tooltip({title:t.tooltip,placement:"bottom"})},_template:function(e){return'<div><span class="fa '+e.icon+'" class="ui-icon"/> '+e.title+"</div>"}}),l=Backbone.View.extend({optionsDefault:{id:null,title:"",floating:"right",cls:"ui-button btn btn-default",icon:""},initialize:function(t){this.options=e.merge(t,this.optionsDefault),this.setElement(this._template(this.options)),$(this.el).on("click",function(){$(".tooltip").hide(),t.onclick&&t.onclick()}),$(this.el).tooltip({title:t.tooltip,placement:"bottom"})},_template:function(e){var t='<button id="'+e.id+'" type="submit" style="float: '+e.floating+';" type="button" class="'+e.cls+'">';return e.icon&&(t+='<i class="icon fa '+e.icon+'"></i> '),t+=e.title+"</button>",t}}),c=Backbone.View.extend({optionsDefault:{id:null,title:"",floating:"right",cls:"ui-button-icon",icon:"",tooltip:"",onclick:null},initialize:function(t){this.options=e.merge(t,this.optionsDefault),this.setElement(this._template(this.options)),this.$button=this.$el.find(".button");var n=this;$(this.el).on("click",function(){$(".tooltip").hide(),t.onclick&&!n.disabled&&t.onclick()}),$(this.el).tooltip({title:t.tooltip,placement:"bottom"})},disable:function(){this.$button.addClass("disabled"),this.disabled=!0},enable:function(){this.$button.removeClass("disabled"),this.disabled=!1},_template:function(e){var t="";e.title&&(t="width: auto;");var n='<div id="'+e.id+'" style="float: '+e.floating+"; "+t+'" class="'+e.cls+'">';return e.title?n+='<div class="button"><i class="icon fa '+e.icon+'"/> '+'<span class="title">'+e.title+"</span>"+"</div>":n+='<i class="icon fa '+e.icon+'"/>',n+="</div>",n}}),h=Backbone.View.extend({optionsDefault:{title:"",cls:""},initialize:function(t){this.options=e.merge(t,this.optionsDefault),this.setElement(this._template(this.options)),$(this.el).on("click",t.onclick)},_template:function(e){return'<div><a href="javascript:void(0)" class="ui-anchor '+e.cls+'">'+e.title+"</a></div>"}}),p=Backbone.View.extend({optionsDefault:{message:null,status:"info",persistent:!1},initialize:function(t){this.options=e.merge(t,this.optionsDefault),this.setElement("<div></div>"),this.options.message&&this.update(this.options)},update:function(t){this.options=e.merge(t,this.optionsDefault);if(t.message!=""){this.$el.html(this._template(this.options)),this.$el.find(".alert").append(t.message),this.$el.fadeIn(),this.timeout&&window.clearTimeout(this.timeout);if(!t.persistent){var n=this;this.timeout=window.setTimeout(function(){n.$el.is(":visible")?n.$el.fadeOut():n.$el.hide()},3e3)}}else this.$el.fadeOut()},_template:function(e){return'<div class="ui-message alert alert-'+e.status+'"/>'}}),d=Backbone.View.extend({optionsDefault:{onclick:null,searchword:""},initialize:function(t){this.options=e.merge(t,this.optionsDefault),this.setElement(this._template(this.options));var n=this;this.options.onclick&&this.$el.on("submit",function(e){var t=n.$el.find("#search");n.options.onclick(t.val())})},_template:function(e){return'<div class="ui-search"><form onsubmit="return false;"><input id="search" class="form-control input-sm" type="text" name="search" placeholder="Search..." value="'+e.searchword+'">'+'<button type="submit" class="btn search-btn">'+'<i class="fa fa-search"></i>'+"</button>"+"</form>"+"</div>"}}),v=Backbone.View.extend({optionsDefault:{type:"text",placeholder:"",disabled:!1,visible:!0,cls:"",area:!1},initialize:function(t){this.options=e.merge(t,this.optionsDefault),this.setElement(this._template(this.options)),this.options.value!==undefined&&this.value(this.options.value),this.options.disabled&&this.$el.prop("disabled",!0),this.options.visible||this.$el.hide();var n=this;this.$el.on("input",function(){n.options.onchange&&n.options.onchange(n.$el.val())})},value:function(e){return e!==undefined&&this.$el.val(e),this.$el.val()},_template:function(e){return e.area?'<textarea id="'+e.id+'" class="ui-textarea '+e.cls+'"></textarea>':'<input id="'+e.id+'" type="'+e.type+'" value="'+e.value+'" placeholder="'+e.placeholder+'" class="ui-input '+e.cls+'">'}}),m=Backbone.View.extend({initialize:function(e){this.options=e,this.setElement(this._template(this.options)),this.options.value!==undefined&&this.value(this.options.value)},value:function(e){return e!==undefined&&this.$el.val(e),this.$el.val()},_template:function(e){return'<hidden id="'+e.id+'" value="'+e.value+'"/>'}});return{Anchor:h,Button:l,ButtonIcon:c,ButtonMenu:s,Icon:f,Image:u,Input:v,Label:a,Message:p,Modal:o,RadioButton:r.RadioButton,Checkbox:r.Checkbox,Radio:r.Radio,Searchbox:d,Select:t,Hidden:m,Slider:n,Drilldown:i}}),define("plugin/library/jobs",["utils/utils"],function(e){return Backbone.Model.extend({initialize:function(t,n){this.app=t,this.options=e.merge(n,this.optionsDefault)},request:function(e,t,n,r,i){var s=this;e.state("wait","Requesting job results...");var o=e.get("dataset_id_job");o!=""?s._wait(e,r,i):s._submit(e,t,n,r,i)},cleanup:function(t){var n=this,r=t.get("dataset_id_job");r!=""&&(e.request({type:"PUT",url:config.root+"api/histories/none/contents/"+r,data:{deleted:!0},success:function(){n._refreshHdas()}}),t.set("dataset_id_job",""))},_submit:function(t,n,r,i,s){var o=this,u=t.id,a=t.get("type"),f=t.definition;data={tool_id:"charts",inputs:{input:{id:t.get("dataset_id"),src:"hda"},module:f.execute,columns:r,settings:n}},t.state("wait","Sending job request..."),e.request({type:"POST",url:config.root+"api/tools",data:data,success:function(e){if(!e.outputs||e.outputs.length==0)t.state("failed","Job submission failed. No response."),s&&s();else{o._refreshHdas();var n=e.outputs[0];t.state("wait","Your job has been queued. You may close the browser window. The job will run in the background."),t.set("dataset_id_job",n.id),o.app.storage.save(),o._wait(t,i,s)}},error:function(e){var n="";e&&e.message&&e.message.data&&e.message.data.input&&(n=e.message.data.input+"."),t.state("failed","This visualization requires the 'charts' tool. Please make sure it is installed. "+n),s&&s()}})},_wait:function(t,n,r){var i=this;e.request({type:"GET",url:config.root+"api/datasets/"+t.get("dataset_id_job"),data:{},success:function(e){var s=!1;switch(e.state){case"ok":t.state("wait","Job completed successfully..."),n&&n(e),s=!0;break;case"error":t.state("failed","Job has failed. Please check the history for details."),r&&r(e),s=!0;break;case"running":t.state("wait","Your job is running. You may close the browser window. The job will continue in the background.")}s||setTimeout(function(){i._wait(t,n,r)},i.app.config.get("query_timeout"))}})},_refreshHdas:function(){Galaxy&&Galaxy.currHistoryPanel&&Galaxy.currHistoryPanel.refreshContents()}})}),define("plugin/library/datasets",["utils/utils"],function(e){return Backbone.Collection.extend({list:{},cache:{},initialize:function(t,n){this.app=t,this.options=e.merge(n,this.optionsDefault)},request:function(e){e.groups?this._get_blocks(e):this._get_dataset(e.id,e.success,e.error)},_get_blocks:function(e){function c(i){l._get(i,function(){var s=!1;for(var o in e.groups){destination_group=e.groups[o],source_group=i.groups[o],destination_group.values||(destination_group.values=[]),destination_group.values=destination_group.values.concat(source_group.values);if(source_group.values.length==0){s=!0;break}}if(++f<u&&!s){n&&n(parseInt(f/u*100));var l=i.start+r;i=$.extend(!0,a,{start:l}),c(i)}else t()})}var t=e.success,n=e.progress,r=this.app.config.get("query_limit"),i=e.start||0,s=i+e.query_limit||i+this.app.config.get("query_limit"),o=Math.abs(s-i);if(o<=0){console.debug("FAILED - Datasets::request() - Invalid query range.");return}var u=Math.ceil(o/r)||1,a=$.extend(!0,{},e),f=0,l=this,h=$.extend(!0,a,{start:i});this._get_dataset(e.id,function(){c(h)})},_get_dataset:function(t,n,r){var i=this.list[t];if(i){n(i);return}var s=this;e.request({type:"GET",url:config.root+"api/datasets/"+t,success:function(e){switch(e.state){case"error":r&&r(e);break;default:s.list[t]=e,n(e)}}})},_block_id:function(e,t){return e.id+"_"+e.start+"_"+e.start+this.app.config.get("query_limit")+"_"+t},_get:function(e,t){e.start=e.start||0;var n=[],r={},i=0;for(var s in e.groups){var o=e.groups[s];for(var u in o.columns){var a=o.columns[u].index,f=this._block_id(e,a);if(this.cache[f]||a==="auto"||a==="zero")continue;!r[a]&&a!==undefined&&(r[a]=i,n.push(a),i++)}}if(n.length==0){this._fill_from_cache(e),t(e);return}var l={dataset_id:e.id,start:e.start,columns:n},c=this;this._fetch(l,function(r){for(var i in r){var s=n[i],o=c._block_id(e,s);c.cache[o]=r[i]}c._fill_from_cache(e),t(e)})},_fill_from_cache:function(e){var t=e.start;console.debug("Datasets::_fill_from_cache() - Filling request from cache at "+t+".");var n=0;for(var r in e.groups){var i=e.groups[r];for(var s in i.columns){var o=i.columns[s],u=this._block_id(e,o.index),a=this.cache[u];a&&(n=Math.max(n,a.length))}}n==0&&console.debug("Datasets::_fill_from_cache() - Reached data range limit.");for(var r in e.groups){var i=e.groups[r];i.values=[];for(var f=0;f<n;f++)i.values[f]={x:parseInt(f)+t}}for(var r in e.groups){var i=e.groups[r];for(var s in i.columns){var o=i.columns[s];switch(o.index){case"auto":for(var f=0;f<n;f++){var l=i.values[f];l[s]=parseInt(f)+t}break;case"zero":for(var f=0;f<n;f++){var l=i.values[f];l[s]=0}break;default:var u=this._block_id(e,o.index),a=this.cache[u];for(var f=0;f<n;f++){var l=i.values[f],c=a[f];isNaN(c)&&!o.is_label&&(c=0),l[s]=c}}}}},_fetch:function(t,n){var r=t.start?t.start:0,i=this.app.config.get("query_limit"),s=0;t.columns&&(s=t.columns.length,console.debug("Datasets::_fetch() - Fetching "+s+" column(s) at "+r+".")),s==0&&console.debug("Datasets::_fetch() - No columns requested");var o="";for(var u in t.columns)o+=t.columns[u]+",";o=o.substring(0,o.length-1);var a=this;e.request({type:"GET",url:config.root+"api/datasets/"+t.dataset_id,data:{data_type:"raw_data",provider:"dataset-column",limit:i,offset:r,indeces:o},success:function(e){var t=new Array(s);for(var r=0;r<s;r++)t[r]=[];for(var r in e.data){var i=e.data[r];for(var o in i){var u=i[o];u!==undefined&&u!=2147483647&&t[o].push(u)}}console.debug("Datasets::_fetch() - Fetching complete."),n(t)}})}})}),define("plugin/models/group",[],function(){return Backbone.Model.extend({defaults:{key:"Data label",date:""},reset:function(){this.clear({silent:!0}).set(this.defaults),this.trigger("reset",this)}})}),define("plugin/models/groups",["plugin/models/group"],function(e){return Backbone.Collection.extend({model:e})}),define("plugin/models/chart",["plugin/models/groups"],function(e){return Backbone.Model.extend({defaults:{id:null,title:"",type:"",date:null,state:"",state_info:"",modified:!1,dataset_id:"",dataset_id_job:""},initialize:function(t){this.groups=new e,this.settings=new Backbone.Model},reset:function(){this.clear({silent:!0}).set(this.defaults),this.groups.reset(),this.settings.clear(),this.trigger("reset",this)},copy:function(e){var t=this;t.clear({silent:!0}).set(this.defaults),t.set(e.attributes),t.settings=e.settings.clone(),t.groups.reset(),e.groups.each(function(e){t.groups.add(e.clone())}),t.trigger("change",t)},state:function(e,t){this.set("state",e),this.set("state_info",t),this.trigger("set:state"),console.debug("Chart:state() - "+t+" ("+e+")")}})});var Visualization=Backbone.Model.extend({defaults:{config:{}},urlRoot:function(){var e="/api/visualizations";return window.galaxy_config&&galaxy_config.root?galaxy_config.root+e:e},initialize:function(e){_.isObject(e.config)&&_.isObject(this.defaults.config)&&_.defaults(e.config,this.defaults.config),this._setUpListeners()},_setUpListeners:function(){},set:function(e,t){if(e==="config"){var n=this.get("config");_.isObject(n)&&(t=_.extend(_.clone(n),t))}return Backbone.Model.prototype.set.call(this,e,t),this},toString:function(){var e=this.get("id")||"";return this.get("title")&&(e+=":"+this.get("title")),"Visualization("+e+")"}}),VisualizationCollection=Backbone.Collection.extend({model:Visualization,url:function(){return galaxy_config.root+"api/visualizations"},initialize:function(e,t){t=t||{}},set:function(e,t){var n=this;e=_.map(e,function(e){var t=n.get(e.id);if(!t)return e;var r=t.toJSON();return _.extend(r,e),r}),Backbone.Collection.prototype.set.call(this,e,t)},toString:function(){return["VisualizationCollection(",[this.historyId,this.length].join(),")"].join("")}});define("mvc/visualization/visualization-model",function(){}),define("plugin/library/storage",["utils/utils","plugin/models/chart","plugin/models/group","mvc/visualization/visualization-model"],function(e,t,n){return Backbone.Model.extend({vis:null,initialize:function(e){this.app=e,this.chart=this.app.chart,this.options=this.app.options,this.id=this.options.id,this.vis=new Visualization({type:"charts",config:{dataset_id:this.options.config.dataset_id,chart_dict:{}}}),this.id&&(this.vis.id=this.id);var t=this.options.config.chart_dict;t&&(this.vis.get("config").chart_dict=t)},save:function(){var e=this.app.chart;this.vis.get("config").chart_dict={};var t=e.get("title");t!=""&&this.vis.set("title",t);var n={attributes:e.attributes,settings:e.settings.attributes,groups:[]};e.groups.each(function(e){n.groups.push(e.attributes)}),this.vis.get("config").chart_dict=n;var r=this;this.vis.save().fail(function(e,t,n){console.error(e,t,n)}).then(function(e){e&&e.id&&(r.id=e.id)})},load:function(){var e=this.vis.get("config").chart_dict;if(!e.attributes)return!1;var t=e.attributes.type;if(!t)return console.debug("Storage::load() - Chart type not provided. Invalid format."),!1;var r=this.app.types.get(t);if(!r)return console.debug("Storage::load() - Chart type not supported. Please re-configure the chart. Resetting chart."),!1;console.debug("Storage::load() - Loading chart type "+t+"."),this.chart.definition=r,this.chart.set(e.attributes),this.chart.state("ok","Loading saved visualization..."),this.chart.settings.set(e.settings);for(var i in e.groups)this.chart.groups.add(new n(e.groups[i]));return this.chart.set("modified",!1),!0}})}),define("utils/deferred",["utils/utils"],function(e){return Backbone.Model.extend({queue:[],process:{},counter:0,initialize:function(){this.on("refresh",function(){if(this.queue.length>0&&this.ready()){var e=this.queue[0];this.queue.splice(0,1),e&&e()}})},execute:function(e){this.queue.push(e),this.trigger("refresh")},register:function(){var t=e.uuid();return this.process[t]=!0,this.counter++,console.debug("Deferred:register() - Registering "+t),t},done:function(e){this.process[e]&&(delete this.process[e],this.counter--,console.debug("Deferred:done() - Unregistering "+e),this.trigger("refresh"))},reset:function(){this.queue=[]},ready:function(){return this.counter==0}})}),define("plugin/views/viewport",["mvc/ui/ui-portlet","mvc/ui/ui-misc","utils/utils"],function(e,t,n){return Backbone.View.extend({container_list:[],canvas_list:[],initialize:function(e,t){this.app=e,this.chart=this.app.chart,this.options=n.merge(t,this.optionsDefault),this.setElement($(this._template())),this._fullscreen(this.$el,100),this._createContainer("div");var r=this;this.chart.on("redraw",function(){r._draw(r.chart)}),this.chart.on("set:state",function(){var e=r.$el.find("#info"),t=r.$el.find(".charts-viewport-container"),n=e.find("#icon");n.removeClass(),e.show(),e.find("#text").html(r.chart.get("state_info"));var i=r.chart.get("state");switch(i){case"ok":e.hide(),t.show();break;case"failed":n.addClass("icon fa fa-warning"),t.hide();break;default:n.addClass("icon fa fa-spinner fa-spin"),t.show()}})},show:function(){this.$el.show()},hide:function(){this.$el.hide()},_fullscreen:function(e,t){e.css("height",$(window).height()-t),$(window).resize(function(){e.css("height",$(window).height()-t)})},_createContainer:function(e,t){t=t||1;for(var n in this.container_list)this.container_list[n].remove();this.container_list=[],this.canvas_list=[];for(var n=0;n<t;n++){var r=$(this._templateContainer(e,parseInt(100/t)));this.$el.append(r),this.container_list[n]=r,this.canvas_list[n]=r.find(".charts-viewport-canvas").attr("id")}},_draw:function(e){var t=this,n=this.app.deferred.register(),r=e.get("type");this.chart_definition=e.definition;var i=1;e.settings.get("use_panels")==="true"&&(i=e.groups.length),this._createContainer(this.chart_definition.tag,i),e.state("wait","Please wait...");if(!this.chart_definition.execute||this.chart_definition.execute&&e.get("modified"))this.app.jobs.cleanup(e),e.set("modified",!1);var t=this;require(["plugin/charts/"+this.app.chartPath(r)+"/wrapper"],function(r){if(t.chart_definition.execute)t.app.jobs.request(e,t._defaultSettingsString(e),t._defaultRequestString(e),function(){var i=new r(t.app,{process_id:n,chart:e,request_dictionary:t._defaultRequestDictionary(e),canvas_list:t.canvas_list})},function(){this.app.deferred.done(n)});else var i=new r(t.app,{process_id:n,chart:e,request_dictionary:t._defaultRequestDictionary(e),canvas_list:t.canvas_list})})},_defaultRequestString:function(e){var t="",n=0,r=this;return e.groups.each(function(e){n++;for(var i in r.chart_definition.columns)t+=i+"_"+n+":"+(parseInt(e.get(i))+1)+", "}),t.substring(0,t.length-2)},_defaultSettingsString:function(e){var t="";for(key in e.settings.attributes)t+=key+":"+e.settings.get(key)+", ";return t.substring(0,t.length-2)},_defaultRequestDictionary:function(e){var t={groups:[]};this.chart_definition.execute?t.id=e.get("dataset_id_job"):t.id=e.get("dataset_id");var r=0,i=this;return e.groups.each(function(e){var s={};for(var o in i.chart_definition.columns){var u=i.chart_definition.columns[o];s[o]=n.merge({index:e.get(o)},u)}t.groups.push({key:++r+":"+e.get("key"),columns:s})}),t},_template:function(){return'<div class="charts-viewport"><div id="info" class="info"><span id="icon" class="icon"/><span id="text" class="text" /></div></div>'},_templateContainer:function(e,t){return'<div class="charts-viewport-container" style="width:'+t+'%;">'+'<div id="menu"/>'+"<"+e+' id="'+n.uuid()+'" class="charts-viewport-canvas">'+"</div>"}})}),define("plugin/library/screenshot",["libs/underscore"],function(e){function t(e){e.$el.find("svg").length>0?r(e):n(e)}function n(e){try{var t=e.$el.find(".jqplot-target"),n=t.jqplotToImageStr({});n&&(window.location.href=n.replace("image/png","image/octet-stream"))}catch(r){console.debug("FAILED - Screenshot::_fromCanvas() - "+r),e.error&&e.error("Please reduce your chart to a single panel and try again.")}}function r(e){var t=e.$el,n=e.url,r=e.name,s=new XMLSerializer,o=document.createElement("canvas"),u=$(o),a=t.find("svg").length,f=t.find("svg").first(),l=parseInt(f.css("height")),c=parseInt(f.css("width"));u.attr("width",c*a),u.attr("height",l),(!o.getContext||!o.getContext("2d"))&&alert("Your browser doesn't support this feature, please use a modern browser");var h=o.getContext("2d"),p=0;t.find("svg").each(function(){var e=$(this);e.attr({version:"1.1",xmlns:"http://www.w3.org/2000/svg",width:c,height:l});var t=s.serializeToString(this);h.drawSvg(t,p,0,c,l),p+=c}),window.location.href=i(o,o.getContext("2d"),"white").replace("image/png","image/octet-stream")}function i(e,t,n){var r=e.width,i=e.height,s;if(n){s=t.getImageData(0,0,r,i);var o=t.globalCompositeOperation;t.globalCompositeOperation="destination-over",t.fillStyle=n,t.fillRect(0,0,r,i)}var u=e.toDataURL("image/png");return n&&(t.clearRect(0,0,r,i),t.putImageData(s,0,0),t.globalCompositeOperation=o),u}function s(e){window.location.href="data:none/none;base64,"+btoa(a(e).string)}function o(e){for(var t in document.styleSheets){var n=document.styleSheets[t],r=n.cssRules;if(r)for(var i=0,s=r.length;i<s;i++)try{e.find(r[i].selectorText).each(function(e,t){t.style.cssText+=r[i].style.cssText})}catch(o){}}}function u(e){var t=a(e),n={filename:name||"chart",type:"application/pdf",height:t.height,width:t.width,scale:2,svg:t.string},r=$("body"),i=r.find("#viewport-form");i.length===0&&(i=$("<form>",{id:"viewport-form",method:"post",action:"http://export.highcharts.com/",display:"none"}),r.append(i)),i.empty();for(name in n){var s=$("<input/>",{type:"hidden",name:name,value:n[name]});i.append(s)}try{i.submit()}catch(o){console.log(o)}}function a(e){if(e.$el.find("svg").length==0&&e.error){e.error("No SVG found. This chart type does not support SVG/PDF export.");return}var t=e.$el,n=t.find("svg").length,r=parseInt(t.find("svg").first().css("height")),i=parseInt(t.find("svg").first().css("width")),s=new XMLSerializer,u=$("<svg/>");u.attr({version:"1.1",xmlns:"http://www.w3.org/2000/svg",width:i*n,height:r});var a="",f=0;return t.find("svg").each(function(){var e=$(this).clone();o(e);var t=$('<g transform="translate('+f+', 0)">');t.append(e.find("g").first()),u.append(t),f+=i}),{string:s.serializeToString(u[0]),height:r,width:i}}return{createPNG:t,createSVG:s,createPDF:u}}),define("plugin/views/viewer",["utils/utils","mvc/ui/ui-misc","mvc/ui/ui-portlet","plugin/views/viewport","plugin/library/screenshot"],function(e,t,n,r,i){return Backbone.View.extend({initialize:function(e,s){this.app=e,this.chart=this.app.chart,this.viewport_view=new r(e);var o=this;this.message=new t.Message;var u=new t.ButtonMenu({icon:"fa-camera",title:"Screenshot",tooltip:"Download as PNG, SVG or PDF file"});u.addMenu({id:"button-png",title:"Save as PNG",icon:"fa-file",onclick:function(){o._wait(o.chart,function(){i.createPNG({$el:o.viewport_view.$el,title:o.chart.get("title"),error:function(e){o.message.update({message:e,status:"danger"})}})})}}),u.addMenu({id:"button-svg",title:"Save as SVG",icon:"fa-file-text-o",onclick:function(){o._wait(o.chart,function(){i.createSVG({$el:o.viewport_view.$el,title:o.chart.get("title"),error:function(e){o.message.update({message:e,status:"danger"})}})})}}),u.addMenu({id:"button-png",title:"Save as PDF",icon:"fa-file-o",onclick:function(){o.app.modal.show({title:"Send chart data for PDF creation",body:"Galaxy does not provide integrated PDF export scripts. You may click 'Continue' to create the PDF by using a 3rd party service (https://export.highcharts.com)",buttons:{Cancel:function(){o.app.modal.hide()},Continue:function(){o.app.modal.hide(),o._wait(o.chart,function(){i.createPDF({$el:o.viewport_view.$el,title:o.chart.get("title"),error:function(e){o.message.update({message:e,status:"danger"})}})})}}})}}),this.portlet=new n.View({icon:"fa-bar-chart-o",title:"Viewport",scrollable:!1,operations:{edit_button:new t.ButtonIcon({icon:"fa-edit",tooltip:"Customize this chart",title:"Editor",onclick:function(){o._wait(o.chart,function(){o.app.go("editor")})}}),picture_button_menu:u}}),this.portlet.append(this.message.$el),this.portlet.append(this.viewport_view.$el),this.setElement(this.portlet.$el);var o=this;this.chart.on("change:title",function(){o._refreshTitle()})},show:function(){this.$el.show(),$(window).trigger("resize")},hide:function(){this.$el.hide()},_refreshTitle:function(){var e=this.chart.get("title");this.portlet.title(e)},_wait:function(e,t){this.app.deferred.ready()?t():this.message.update({message:"Your chart is currently being processed. Please wait and try again."})}})}),define("mvc/ui/ui-tabs",["utils/utils"],function(e){var t=Backbone.View.extend({optionsDefault:{title_new:"",operations:null,onnew:null,max:null,onchange:null},initialize:function(t){this.visible=!1,this.$nav=null,this.$content=null,this.first_tab=null,this.current_id=null,this.options=e.merge(t,this.optionsDefault);var n=$(this._template(this.options));this.$nav=n.find(".tab-navigation"),this.$content=n.find(".tab-content"),this.setElement(n),this.list={};var r=this;this.options.operations&&$.each(this.options.operations,function(e,t){t.$el.prop("id",e),r.$nav.find(".operations").append(t.$el)});if(this.options.onnew){var i=$(this._template_tab_new(this.options));this.$nav.append(i),i.tooltip({title:"Add a new tab",placement:"bottom",container:r.$el}),i.on("click",function(e){i.tooltip("hide"),r.options.onnew()})}},size:function(){return _.size(this.list)},current:function(){return this.$el.find(".tab-pane.active").attr("id")},add:function(e){var t=this,n=e.id,r=$(this._template_tab(e)),i=$(this._template_tab_content(e));this.list[n]=e.ondel?!0:!1,this.options.onnew?this.$nav.find("#new-tab").before(r):this.$nav.append(r),i.append(e.$el),this.$content.append(i),this.size()==1&&(r.addClass("active"),i.addClass("active"),this.first_tab=n),this.options.max&&this.size()>=this.options.max&&this.$el.find("#new-tab").hide();if(e.ondel){var s=r.find("#delete");s.tooltip({title:"Delete this tab",placement:"bottom",container:t.$el}),s.on("click",function(){return s.tooltip("destroy"),t.$el.find(".tooltip").remove(),e.ondel(),!1})}r.on("click",function(r){r.preventDefault(),e.onclick?e.onclick():t.show(n)}),this.current_id||(this.current_id=n)},del:function(e){this.$el.find("#tab-"+e).remove(),this.$el.find("#"+e).remove(),this.first_tab==e&&(this.first_tab=null),this.first_tab!=null&&this.show(this.first_tab),this.list[e]&&delete this.list[e],this.size()<this.options.max&&this.$el.find("#new-tab").show()},delRemovable:function(){for(var e in this.list)this.del(e)},show:function(e){this.$el.fadeIn("fast"),this.visible=!0,e&&(this.$el.find("#tab-"+this.current_id).removeClass("active"),this.$el.find("#"+this.current_id).removeClass("active"),this.$el.find("#tab-"+e).addClass("active"),this.$el.find("#"+e).addClass("active"),this.current_id=e),this.options.onchange&&this.options.onchange(e)},hide:function(){this.$el.fadeOut("fast"),this.visible=!1},hideOperation:function(e){this.$nav.find("#"+e).hide()},showOperation:function(e){this.$nav.find("#"+e).show()},setOperation:function(e,t){var n=this.$nav.find("#"+e);n.off("click"),n.on("click",t)},title:function(e,t){var n=this.$el.find("#tab-title-text-"+e);return t&&n.html(t),n.html()},retitle:function(e){var t=0;for(var n in this.list)this.title(n,++t+": "+e)},_template:function(e){return'<div class="ui-tabs tabbable tabs-left"><ul id="tab-navigation" class="tab-navigation nav nav-tabs"><div class="operations" style="float: right; margin-bottom: 4px;"></div></ul><div id="tab-content" class="tab-content"/></div>'},_template_tab_new:function(e){return'<li id="new-tab"><a href="javascript:void(0);"><i class="ui-tabs-add fa fa-plus-circle"/>'+e.title_new+"</a>"+"</li>"},_template_tab:function(e){var t='<li id="tab-'+e.id+'" class="tab-element">'+'<a id="tab-title-link-'+e.id+'" title="" href="#'+e.id+'" data-original-title="">'+'<span id="tab-title-text-'+e.id+'" class="tab-title-text">'+e.title+"</span>";return e.ondel&&(t+='<i id="delete" class="ui-tabs-delete fa fa-minus-circle"/>'),t+="</a></li>",t},_template_tab_content:function(e){return'<div id="'+e.id+'" class="tab-pane"/>'}});return{View:t}}),define("mvc/ui/ui-table",["utils/utils"],function(e){var t=Backbone.View.extend({row:null,row_count:0,optionsDefault:{content:"No content available.",onchange:null,ondblclick:null,onconfirm:null,cls:"ui-table",cls_tr:""},events:{click:"_onclick",dblclick:"_ondblclick"},initialize:function(t){this.options=e.merge(t,this.optionsDefault);var n=$(this._template(this.options));this.$thead=n.find("thead"),this.$tbody=n.find("tbody"),this.$tmessage=n.find("tmessage"),this.setElement(n),this.row=this._row()},addHeader:function(e){var t=$("<th></th>");t.append(e),this.row.append(t)},appendHeader:function(){this.$thead.append(this.row),this.row=$("<tr></tr>")},add:function(e,t,n){var r=$("<td></td>");t&&r.css("width",t),n&&r.css("text-align",n),r.append(e),this.row.append(r)},append:function(e,t){this._commit(e,t,!1)},prepend:function(e,t){this._commit(e,t,!0)},get:function(e){return this.$el.find("#"+e)},del:function(e){var t=this.$tbody.find("#"+e);t.length>0&&(t.remove(),this.row_count--,this._refresh())},delAll:function(){this.$tbody.empty(),this.row_count=0,this._refresh()},value:function(e){this.before=this.$tbody.find(".current").attr("id"),e!==undefined&&(this.$tbody.find("tr").removeClass("current"),e&&this.$tbody.find("#"+e).addClass("current"));var t=this.$tbody.find(".current").attr("id");return t===undefined?null:(t!=this.before&&this.options.onchange&&this.options.onchange(e),t)},size:function(){return this.$tbody.find("tr").length},_commit:function(e,t,n){this.del(e),this.row.attr("id",e),n?this.$tbody.prepend(this.row):this.$tbody.append(this.row),t&&(this.row.hide(),this.row.fadeIn()),this.row=this._row(),this.row_count++,this._refresh()},_row:function(){return $('<tr class="'+this.options.cls_tr+'"></tr>')},_onclick:function(e){var t=this.value(),n=$(e.target).closest("tr").attr("id");n!=""&&n&&t!=n&&(this.options.onconfirm?this.options.onconfirm(n):this.value(n))},_ondblclick:function(e){var t=this.value();t&&this.options.ondblclick&&this.options.ondblclick(t)},_refresh:function(){this.row_count==0?this.$tmessage.show():this.$tmessage.hide()},_template:function(e){return'<div><table class="'+e.cls+'">'+"<thead></thead>"+"<tbody></tbody>"+"</table>"+"<tmessage>"+e.content+"</tmessage>"+"<div>"}});return{View:t}}),define("plugin/views/group",["mvc/ui/ui-table","mvc/ui/ui-misc","utils/utils"],function(e,t,n){return Backbone.View.extend({initialize:function(r,i){this.app=r;var s=this;this.chart=this.app.chart,this.group=i.group,this.group_key=new t.Input({placeholder:"Data label",onchange:function(e){s.group.set("key",e)}}),this.table=new e.View({content:"No data column."});var o=$("<div/>");o.append(n.wrap((new t.Label({title:"Provide a label:"})).$el)),o.append(n.wrap(this.group_key.$el)),o.append(n.wrap((new t.Label({title:"Select columns:"})).$el)),o.append(n.wrap(this.table.$el)),this.setElement(o);var s=this;this.chart.on("change:dataset_id",function(){s._refreshTable()}),this.chart.on("change:type",function(){s._refreshTable()}),this.group.on("change:key",function(){s._refreshGroupKey()}),this.group.on("change",function(){s._refreshGroup()}),this._refreshTable(),this._refreshGroupKey(),this._refreshGroup()},_refreshTable:function(){var e=this.chart.get("dataset_id"),n=this.chart.get("type");if(!e||!n)return;var r=this,i=this.chart.definition;this.table.delAll();var s={};for(var o in i.columns){var u=i.columns[o];if(!u){console.debug("Group::_refreshTable() - Skipping column definition.");continue}var a=new t.Select.View({id:"select_"+o,wait:!0}),f=u.title;u.is_unique&&(f+=" (all data labels)"),this.table.add(f,"25%"),this.table.add(a.$el),this.table.append(o),s[o]=a}this.chart.state("wait","Loading metadata...");var l=this.app.deferred.register(),c={id:e,success:function(e){for(var t in s)r._addRow(t,e,s,i.columns[t]);r.chart.state("ok","Metadata initialized..."),r.app.deferred.done(l)}};this.app.datasets.request(c)},_addRow:function(e,t,n,r){var i=this,s=r.is_label,o=r.is_auto,u=r.is_numeric,a=r.is_unique,f=r.is_zero,l=[],c=n[e];o&&l.push({label:"Column: Row Number",value:"auto"}),f&&l.push({label:"Column: None",value:"zero"});var h=t.metadata_column_types;for(var p in h){var d=!1;h[p]=="int"||h[p]=="float"?d=u:d=s,d&&l.push({label:"Column: "+(parseInt(p)+1)+" ["+h[p]+"]",value:p})}c.update(l),a&&this.chart.groups.first()&&this.group.set(e,this.chart.groups.first().get(e));if(!c.exists(this.group.get(e))){var v=c.first();console.debug('Group()::_addRow() - Switching model value from "'+this.group.get(e)+'" to "'+v+'".'),this.group.set(e,v)}c.value(this.group.get(e)),this.group.off("change:"+e),this.group.on("change:"+e,function(){c.value(i.group.get(e))}),c.setOnChange(function(t){a?i.chart.groups.each(function(n){n.set(e,t)}):i.group.set(e,t),i.chart.set("modified",!0)}),c.show()},_refreshGroup:function(){this.group.set("date",n.time())},_refreshGroupKey:function(){var e=this.group.get("key");e===undefined&&(e=""),this.group_key.value(e)}})}),define("plugin/library/ui-table-form",["mvc/ui/ui-table","mvc/ui/ui-misc","utils/utils"],function(e,t,n){var r=Backbone.View.extend({optionsDefault:{title:"",content:"",mode:""},list:[],initialize:function(r,i){this.app=r,this.options=n.merge(i,this.optionsDefault),this.table_title=new t.Label({title:this.options.title}),this.table=new e.View({content:this.options.content});var s=$('<div class="ui-table-form"/>');this.options.title&&s.append(n.wrap(this.table_title.$el)),s.append(n.wrap(this.table.$el)),this.setElement(s)},title:function(e){this.table_title.title(e)},update:function(e,t){this.table.delAll(),this.list=[];for(var n in e)this._add(e[n].id||n,e[n],t);for(var n in this.list)this.list[n].trigger("change")},_add:function(e,n,r){var i=this,s=null,o=n.type;switch(o){case"text":s=new t.Input({id:"field-"+e,placeholder:n.placeholder,value:r.get(e),onchange:function(t){r.set(e,t)}});break;case"radiobutton":s=new t.RadioButton.View({id:"field-"+e,data:n.data,value:r.get(e),onchange:function(t){r.set(e,t);var s=_.findWhere(n.data,{value:t});if(s&&s.operations){var o=s.operations;for(var u in o.show){var a=o.show[u];i.table.get(a).show()}for(var u in o.hide){var a=o.hide[u];i.table.get(a).hide()}}}});break;case"select":s=new t.Select.View({id:"field-"+e,data:n.data,value:r.get(e),onchange:function(t){r.set(e,t);var s=_.findWhere(n.data,{value:t});if(s&&s.operations){var o=s.operations;for(var u in o.show){var a=o.show[u];i.table.get(a).show()}for(var u in o.hide){var a=o.hide[u];i.table.get(a).hide()}}}});break;case"dataset":s=new t.Select.View({id:"field-"+e,onchange:function(t){r.set(e,t)}}),i.app.datasets.on("all",function(){var t=[];i.app.datasets.each(function(e){e.get("datatype_id")==n.data&&t.push({value:e.get("id"),label:e.get("name")})}),s.update(t),r.get(e)||r.set(e,s.first()),s.value(r.get(e))}),i.app.datasets.trigger("all.datasets");break;case"textarea":s=new t.Textarea({id:"field-"+e,onchange:function(){r.set(e,s.value())}});break;case"separator":s=$("<div/>");break;default:s=new t.Input({id:"field-"+e,placeholder:n.placeholder,type:n.type,onchange:function(){r.set(e,s.value())}})}if(o!="separator"){r.get(e)||r.set(e,n.init),s.value(r.get(e)),this.list[e]=s;var u=$("<div/>");u.append(s.$el),n.info&&u.append('<div class="ui-table-form-info">'+n.info+"</div>"),this.options.style=="bold"?(this.table.add((new t.Label({title:n.title,cls:"form-label"})).$el),this.table.add(u)):(this.table.add('<span class="ui-table-form-title">'+n.title+"</span>","25%"),this.table.add(u))}else this.table.add('<div class="ui-table-form-separator">'+n.title+":<div/>"),this.table.add($("<div/>"));this.table.append(e),n.hide&&this.table.get(e).hide()}});return{View:r}}),define("plugin/views/settings",["mvc/ui/ui-misc","plugin/library/ui-table-form","utils/utils"],function(e,t,n){return Backbone.View.extend({initialize:function(e,n){this.app=e;var r=this;this.chart=this.app.chart,this.form=new t.View(e,{title:"Configuration",content:"This chart type does not provide any options."}),this.setElement(this.form.$el);var r=this;this.chart.on("change",function(){r._refresh()})},_refresh:function(){var e=this.chart.definition;if(!e)return;this.form.title(e.category+" - "+e.title+":"),this.form.update(e.settings,this.chart.settings)}})}),define("plugin/views/types",["utils/utils","mvc/ui/ui-misc"],function(e,t){return Backbone.View.extend({optionsDefault:{onchange:null,ondblclick:null},events:{click:"_onclick",dblclick:"_ondblclick"},initialize:function(n,r){var i=this;this.app=n,this.options=e.merge(r,this.optionsDefault);var s=$('<div class="charts-grid"/>');s.append(e.wrap((new t.Label({title:"How many data points would you like to analyze?"})).$el)),this.library=new t.RadioButton.View({data:[{label:"Few (<500)",value:"small"},{label:"Some (<10k)",value:"medium"},{label:"Many (>10k)",value:"large"}],onchange:function(e){i._filter(e)}}),s.append(e.wrap(this.library.$el)),this.setElement(s),this._render(),this.library.value("small"),this.library.trigger("change")},value:function(e){var t=this.$el.find(".current").attr("id");e!==undefined&&(this.$el.find(".current").removeClass("current"),this.$el.find("#"+e).addClass("current"));var n=this.$el.find(".current").attr("id");return n===undefined?null:(n!=t&&this.options.onchange&&this.options.onchange(e),n)},_filter:function(e){this.$el.find(".header").hide();var t=this.app.types.attributes;for(var n in t){var r=t[n],i=this.$el.find("#"+n),s=this.$el.find("#types-header-"+this.categories_index[r.category]),o=r.keywords||"";o.indexOf(e)>=0?(i.show(),s.show()):i.hide()}},_render:function(){this.categories={},this.categories_index={};var e=0,t=this.app.types.attributes;for(var n in t){var r=t[n],i=r.category;this.categories[i]||(this.categories[i]={},this.categories_index[i]=e++),this.categories[i][n]=r}for(var i in this.categories){var s=$('<div style="clear: both;"/>');s.append(this._template_header({id:"types-header-"+this.categories_index[i],title:i}));for(var n in this.categories[i]){var r=this.categories[i][n],o=r.title+" ("+r.library+")";r.zoomable&&(o='<span class="fa fa-search-plus"/>'+o),s.append(this._template_item({id:n,title:o,url:config.app_root+"charts/"+this.app.chartPath(n)+"/logo.png"}))}this.$el.append(s)}},_onclick:function(e){var t=this.value(),n=$(e.target).closest(".item").attr("id");n!=""&&n&&t!=n&&this.value(n)},_ondblclick:function(e){var t=this.value();t&&this.options.ondblclick&&this.options.ondblclick(t)},_template_header:function(e){return'<div id="'+e.id+'" class="header">'+"• "+e.title+"<div>"},_template_item:function(e){return'<div id="'+e.id+'" class="item">'+'<img class="image" src="'+e.url+'">'+'<div class="title">'+e.title+"</div>"+"<div>"}})}),define("plugin/views/editor",["mvc/ui/ui-tabs","mvc/ui/ui-misc","mvc/ui/ui-portlet","utils/utils","plugin/models/chart","plugin/models/group","plugin/views/group","plugin/views/settings","plugin/views/types"],function(e,t,n,r,i,s,o,u,a){return Backbone.View.extend({initialize:function(i,s){var o=this;this.app=i,this.chart=this.app.chart,this.message=new t.Message,this.portlet=new n.View({icon:"fa-bar-chart-o",title:"Editor",operations:{save:new t.ButtonIcon({icon:"fa-save",tooltip:"Draw Chart",title:"Draw",onclick:function(){o._saveChart()}}),back:new t.ButtonIcon({icon:"fa-caret-left",tooltip:"Return to Viewer",title:"Cancel",onclick:function(){o.app.go("viewer"),o.app.storage.load()}})}}),this.types=new a(i,{onchange:function(e){var t=o.app.types.get(e);t||console.debug("FAILED - Editor::onchange() - Chart type not supported."),o.chart.definition=t,o.chart.settings.clear(),o.chart.set({type:e}),o.chart.set("modified",!0),console.debug("Editor::onchange() - Switched chart type.")},ondblclick:function(e){o._saveChart()}}),this.tabs=new e.View({title_new:"Add Data",onnew:function(){var e=o._addGroupModel();o.tabs.show(e.id)}}),this.title=new t.Input({placeholder:"Chart title",onchange:function(){o.chart.set("title",o.title.value())}});var f=$("<div/>");f.append(r.wrap((new t.Label({title:"Provide a chart title:"})).$el)),f.append(r.wrap(this.title.$el)),f.append(r.wrap(this.types.$el)),this.tabs.add({id:"main",title:"Start",$el:f}),this.settings=new u(this.app),this.tabs.add({id:"settings",title:"Configuration",$el:this.settings.$el}),this.portlet.append(this.message.$el),this.portlet.append(this.tabs.$el),this.setElement(this.portlet.$el),this.tabs.hideOperation("back");var o=this;this.chart.on("change:title",function(e){o._refreshTitle()}),this.chart.on("change:type",function(e){o.types.value(e.get("type"))}),this.chart.on("reset",function(e){o._resetChart()}),this.app.chart.on("redraw",function(e){o.portlet.showOperation("back")}),this.app.chart.groups.on("add",function(e){o._addGroup(e)}),this.app.chart.groups.on("remove",function(e){o._removeGroup(e)}),this.app.chart.groups.on("reset",function(e){o._removeAllGroups()}),this.app.chart.groups.on("change:key",function(e){o._refreshGroupKey()}),this._resetChart()},show:function(){this.$el.show()},hide:function(){this.$el.hide()},_refreshTitle:function(){var e=this.chart.get("title");this.portlet.title(e),this.title.value(e)},_refreshGroupKey:function(){var e=this,t=0;this.chart.groups.each(function(n){var r=n.get("key","");r==""&&(r="Data label"),e.tabs.title(n.id,++t+": "+r)})},_addGroupModel:function(){var e=new s({id:r.uuid()});return this.chart.groups.add(e),e},_addGroup:function(e){var t=this,n=new o(this.app,{group:e});this.tabs.add({id:e.id,$el:n.$el,ondel:function(){t.chart.groups.remove(e.id)}}),this._refreshGroupKey(),this.chart.set("modified",!0)},_removeGroup:function(e){this.tabs.del(e.id),this._refreshGroupKey(),this.chart.set("modified",!0)},_removeAllGroups:function(e){this.tabs.delRemovable()},_resetChart:function(){this.chart.set("id",r.uuid()),this.chart.set("type","nvd3_bar"),this.chart.set("dataset_id",this.app.options.config.dataset_id),this.chart.set("title","New Chart"),this.portlet.hideOperation("back")},_saveChart:function(){this.chart.set({type:this.types.value(),title:this.title.value(),date:r.time()});if(this.chart.groups.length==0){this.message.update({message:"Please select data columns before drawing the chart."});var e=this._addGroupModel();this.tabs.show(e.id);return}var t=this,n=!0,i=this.chart.definition;this.chart.groups.each(function(e){if(!n)return;for(var r in i.columns)if(e.attributes[r]=="null"){t.message.update({status:"danger",message:"This chart type requires column types not found in your tabular file."}),t.tabs.show(e.id),n=!1;return}});if(!n)return;this.app.go("viewer");var t=this;this.app.deferred.execute(function(){t.app.storage.save(),t.chart.trigger("redraw")})}})}),define("plugin/models/config",[],function(){return Backbone.Model.extend({defaults:{query_limit:1e4,query_timeout:100}})}),define("plugin/charts/forms/default",[],function(){return{title:"",category:"",library:"",tag:"",keywords:"",settings:{separator_x:{title:"X axis",type:"separator"},x_axis_label:{title:"Axis label",info:"Provide a label for the axis.",type:"text",init:"X-axis",placeholder:"Axis label"},x_axis_type:{title:"Axis value type",info:"Select the value type of the axis.",type:"select",init:"auto",data:[{label:"-- Do not show values --",value:"hide",operations:{hide:["x_axis_precision"]}},{label:"Auto",value:"auto",operations:{hide:["x_axis_precision"]}},{label:"Float",value:"f",operations:{show:["x_axis_precision"]}},{label:"Exponent",value:"e",operations:{show:["x_axis_precision"]}},{label:"Integer",value:"d",operations:{hide:["x_axis_precision"]}},{label:"Percentage",value:"p",operations:{show:["x_axis_precision"]}},{label:"SI-prefix",value:"s",operations:{hide:["x_axis_precision"]}}]},x_axis_precision:{title:"Axis tick format",info:"Select the tick format for the axis.",type:"select",init:"1",data:[{label:"0.00001",value:"5"},{label:"0.0001",value:"4"},{label:"0.001",value:"3"},{label:"0.01",value:"2"},{label:"0.1",value:"1"},{label:"1",value:"0"}]},separator_y:{title:"Y axis",type:"separator"},y_axis_label:{title:"Axis label",info:"Provide a label for the axis.",type:"text",init:"Y-axis",placeholder:"Axis label"},y_axis_type:{title:"Axis value type",info:"Select the value type of the axis.",type:"select",init:"auto",data:[{label:"-- Do not show values --",value:"hide",operations:{hide:["y_axis_precision"]}},{label:"Auto",value:"auto",operations:{hide:["y_axis_precision"]}},{label:"Float",value:"f",operations:{show:["y_axis_precision"]}},{label:"Exponent",value:"e",operations:{show:["y_axis_precision"]}},{label:"Integer",value:"d",operations:{hide:["y_axis_precision"]}},{label:"Percentage",value:"p",operations:{show:["y_axis_precision"]}},{label:"SI-prefix",value:"s",operations:{hide:["y_axis_precision"]}}]},y_axis_precision:{title:"Axis tick format",info:"Select the tick format for the axis.",type:"select",init:"1",data:[{label:"0.00001",value:"5"},{label:"0.0001",value:"4"},{label:"0.001",value:"3"},{label:"0.01",value:"2"},{label:"0.1",value:"1"},{label:"1",value:"0"}]},separator_legend:{title:"Others",type:"separator"},show_legend:{title:"Show legend",info:"Would you like to add a legend?",type:"radiobutton",init:"true",data:[{label:"Yes",value:"true"},{label:"No",value:"false"}]},use_panels:{title:"Use multi-panels",info:"Would you like to separate your data into individual panels?",type:"radiobutton",init:"false",data:[{label:"Yes",value:"true"},{label:"No",value:"false"}]}}}}),function(){function t(e,t){return(new Date(t,e+1,0)).getDate()}function n(e,t,n){return function(r,i,s){var o=e(r),u=[];o<r&&t(o);if(s>1)while(o<i){var a=new Date(+o);n(a)%s===0&&u.push(a),t(o)}else while(o<i)u.push(new Date(+o)),t(o);return u}}var e=window.nv||{};e.version="1.1.15b",e.dev=!0,window.nv=e,e.tooltip=e.tooltip||{},e.utils=e.utils||{},e.models=e.models||{},e.charts={},e.graphs=[],e.logs={},e.dispatch=d3.dispatch("render_start","render_end"),e.dev&&(e.dispatch.on("render_start",function(t){e.logs.startTime=+(new Date)}),e.dispatch.on("render_end",function(t){e.logs.endTime=+(new Date),e.logs.totalTime=e.logs.endTime-e.logs.startTime,e.log("total",e.logs.totalTime)})),e.log=function(){if(e.dev&&console.log&&console.log.apply)console.log.apply(console,arguments);else if(e.dev&&typeof console.log=="function"&&Function.prototype.bind){var t=Function.prototype.bind.call(console.log,console);t.apply(console,arguments)}return arguments[arguments.length-1]},e.render=function(n){n=n||1,e.render.active=!0,e.dispatch.render_start(),setTimeout(function(){var t,r;for(var i=0;i<n&&(r=e.render.queue[i]);i++)t=r.generate(),typeof r.callback==typeof Function&&r.callback(t),e.graphs.push(t);e.render.queue.splice(0,i),e.render.queue.length?setTimeout(arguments.callee,0):(e.dispatch.render_end(),e.render.active=!1)},0)},e.render.active=!1,e.render.queue=[],e.addGraph=function(t){typeof arguments[0]==typeof Function&&(t={generate:arguments[0],callback:arguments[1]}),e.render.queue.push(t),e.render.active||e.render()},e.identity=function(e){return e},e.strip=function(e){return e.replace(/(\s|&)/g,"")},d3.time.monthEnd=function(e){return new Date(e.getFullYear(),e.getMonth(),0)},d3.time.monthEnds=n(d3.time.monthEnd,function(e){e.setUTCDate(e.getUTCDate()+1),e.setDate(t(e.getMonth()+1,e.getFullYear()))},function(e){return e.getMonth()}),e.interactiveGuideline=function(){function c(o){o.each(function(o){function g(){var e=d3.mouse(this),n=e[0],r=e[1],o=!0,a=!1;l&&(n=d3.event.offsetX,r=d3.event.offsetY,d3.event.target.tagName!=="svg"&&(o=!1),d3.event.target.className.baseVal.match("nv-legend")&&(a=!0)),o&&(n-=i.left,r-=i.top);if(n<0||r<0||n>p||r>d||d3.event.relatedTarget&&d3.event.relatedTarget.ownerSVGElement===undefined||a){if(l&&d3.event.relatedTarget&&d3.event.relatedTarget.ownerSVGElement===undefined&&d3.event.relatedTarget.className.match(t.nvPointerEventsClass))return;u.elementMouseout({mouseX:n,mouseY:r}),c.renderGuideLine(null);return}var f=s.invert(n);u.elementMousemove({mouseX:n,mouseY:r,pointXValue:f}),d3.event.type==="dblclick"&&u.elementDblclick({mouseX:n,mouseY:r,pointXValue:f})}var h=d3.select(this),p=n||960,d=r||400,v=h.selectAll("g.nv-wrap.nv-interactiveLineLayer").data([o]),m=v.enter().append("g").attr("class"," nv-wrap nv-interactiveLineLayer");m.append("g").attr("class","nv-interactiveGuideLine");if(!f)return;f.on("mousemove",g,!0).on("mouseout",g,!0).on("dblclick",g),c.renderGuideLine=function(t){if(!a)return;var n=v.select(".nv-interactiveGuideLine").selectAll("line").data(t!=null?[e.utils.NaNtoZero(t)]:[],String);n.enter().append("line").attr("class","nv-guideline").attr("x1",function(e){return e}).attr("x2",function(e){return e}).attr("y1",d).attr("y2",0),n.exit().remove()}})}var t=e.models.tooltip(),n=null,r=null,i={left:0,top:0},s=d3.scale.linear(),o=d3.scale.linear(),u=d3.dispatch("elementMousemove","elementMouseout","elementDblclick"),a=!0,f=null,l=navigator.userAgent.indexOf("MSIE")!==-1;return c.dispatch=u,c.tooltip=t,c.margin=function(e){return arguments.length?(i.top=typeof e.top!="undefined"?e.top:i.top,i.left=typeof e.left!="undefined"?e.left:i.left,c):i},c.width=function(e){return arguments.length?(n=e,c):n},c.height=function(e){return arguments.length?(r=e,c):r},c.xScale=function(e){return arguments.length?(s=e,c):s},c.showGuideLine=function(e){return arguments.length?(a=e,c):a},c.svgContainer=function(e){return arguments.length?(f=e,c):f},c},e.interactiveBisect=function(e,t,n){if(!e instanceof Array)return null;typeof n!="function"&&(n=function(e,t){return e.x});var r=d3.bisector(n).left,i=d3.max([0,r(e,t)-1]),s=n(e[i],i);typeof s=="undefined"&&(s=i);if(s===t)return i;var o=d3.min([i+1,e.length-1]),u=n(e[o],o);return typeof u=="undefined"&&(u=o),Math.abs(u-t)>=Math.abs(s-t)?i:o},e.nearestValueIndex=function(e,t,n){var r=Infinity,i=null;return e.forEach(function(e,s){var o=Math.abs(t-e);o<=r&&o<n&&(r=o,i=s)}),i},function(){window.nv.tooltip={},window.nv.models.tooltip=function(){function y(){if(a){var e=d3.select(a);e.node().tagName!=="svg"&&(e=e.select("svg"));var t=e.node()?e.attr("viewBox"):null;if(t){t=t.split(" ");var n=parseInt(e.style("width"))/t[2];l.left=l.left*n,l.top=l.top*n}}}function b(e){var t;a?t=d3.select(a):t=d3.select("body");var n=t.select(".nvtooltip");return n.node()===null&&(n=t.append("div").attr("class","nvtooltip "+(u?u:"xy-tooltip")).attr("id",h)),n.node().innerHTML=e,n.style("top",0).style("left",0).style("opacity",0),n.selectAll("div, table, td, tr").classed(p,!0),n.classed(p,!0),n.node()}function w(){if(!c)return;if(!g(n))return;y();var t=l.left,u=o!=null?o:l.top,h=b(m(n));f=h;if(a){var p=a.getElementsByTagName("svg")[0],d=p?p.getBoundingClientRect():a.getBoundingClientRect(),v={left:0,top:0};if(p){var E=p.getBoundingClientRect(),S=a.getBoundingClientRect(),x=E.top;if(x<0){var T=a.getBoundingClientRect();x=Math.abs(x)>T.height?0:x}v.top=Math.abs(x-S.top),v.left=Math.abs(E.left-S.left)}t+=a.offsetLeft+v.left-2*a.scrollLeft,u+=a.offsetTop+v.top-2*a.scrollTop}return s&&s>0&&(u=Math.floor(u/s)*s),e.tooltip.calcTooltipPosition([t,u],r,i,h),w}var t=null,n=null,r="w",i=50,s=25,o=null,u=null,a=null,f=null,l={left:null,top:null},c=!0,h="nvtooltip-"+Math.floor(Math.random()*1e5),p="nv-pointer-events-none",d=function(e,t){return e},v=function(e){return e},m=function(e){if(t!=null)return t;if(e==null)return"";var n=d3.select(document.createElement("table")),r=n.selectAll("thead").data([e]).enter().append("thead");r.append("tr").append("td").attr("colspan",3).append("strong").classed("x-value",!0).html(v(e.value));var i=n.selectAll("tbody").data([e]).enter().append("tbody"),s=i.selectAll("tr").data(function(e){return e.series}).enter().append("tr").classed("highlight",function(e){return e.highlight});s.append("td").classed("legend-color-guide",!0).append("div").style("background-color",function(e){return e.color}),s.append("td").classed("key",!0).html(function(e){return e.key}),s.append("td").classed("value",!0).html(function(e,t){return d(e.value,t)}),s.selectAll("td").each(function(e){if(e.highlight){var t=d3.scale.linear().domain([0,1]).range(["#fff",e.color]),n=.6;d3.select(this).style("border-bottom-color",t(n)).style("border-top-color",t(n))}});var o=n.node().outerHTML;return e.footer!==undefined&&(o+="<div class='footer'>"+e.footer+"</div>"),o},g=function(e){return e&&e.series&&e.series.length>0?!0:!1};return w.nvPointerEventsClass=p,w.content=function(e){return arguments.length?(t=e,w):t},w.tooltipElem=function(){return f},w.contentGenerator=function(e){return arguments.length?(typeof e=="function"&&(m=e),w):m},w.data=function(e){return arguments.length?(n=e,w):n},w.gravity=function(e){return arguments.length?(r=e,w):r},w.distance=function(e){return arguments.length?(i=e,w):i},w.snapDistance=function(e){return arguments.length?(s=e,w):s},w.classes=function(e){return arguments.length?(u=e,w):u},w.chartContainer=function(e){return arguments.length?(a=e,w):a},w.position=function(e){return arguments.length?(l.left=typeof e.left!="undefined"?e.left:l.left,l.top=typeof e.top!="undefined"?e.top:l.top,w):l},w.fixedTop=function(e){return arguments.length?(o=e,w):o},w.enabled=function(e){return arguments.length?(c=e,w):c},w.valueFormatter=function(e){return arguments.length?(typeof e=="function"&&(d=e),w):d},w.headerFormatter=function(e){return arguments.length?(typeof e=="function"&&(v=e),w):v},w.id=function(){return h},w},e.tooltip.show=function(t,n,r,i,s,o){var u=document.createElement("div");u.className="nvtooltip "+(o?o:"xy-tooltip");var a=s;if(!s||s.tagName.match(/g|svg/i))a=document.getElementsByTagName("body")[0];u.style.left=0,u.style.top=0,u.style.opacity=0,u.innerHTML=n,a.appendChild(u),s&&(t[0]=t[0]-s.scrollLeft,t[1]=t[1]-s.scrollTop),e.tooltip.calcTooltipPosition(t,r,i,u)},e.tooltip.findFirstNonSVGParent=function(e){while(e.tagName.match(/^g|svg$/i)!==null)e=e.parentNode;return e},e.tooltip.findTotalOffsetTop=function(e,t){var n=t;do isNaN(e.offsetTop)||(n+=e.offsetTop);while(e=e.offsetParent);return n},e.tooltip.findTotalOffsetLeft=function(e,t){var n=t;do isNaN(e.offsetLeft)||(n+=e.offsetLeft);while(e=e.offsetParent);return n},e.tooltip.calcTooltipPosition=function(t,n,r,i){var s=parseInt(i.offsetHeight),o=parseInt(i.offsetWidth),u=e.utils.windowSize().width,a=e.utils.windowSize().height,f=window.pageYOffset,l=window.pageXOffset,c,h;a=window.innerWidth>=document.body.scrollWidth?a:a-16,u=window.innerHeight>=document.body.scrollHeight?u:u-16,n=n||"s",r=r||20;var p=function(t){return e.tooltip.findTotalOffsetTop(t,h)},d=function(t){return e.tooltip.findTotalOffsetLeft(t,c)};switch(n){case"e":c=t[0]-o-r,h=t[1]-s/2;var v=d(i),m=p(i);v<l&&(c=t[0]+r>l?t[0]+r:l-v+c),m<f&&(h=f-m+h),m+s>f+a&&(h=f+a-m+h-s);break;case"w":c=t[0]+r,h=t[1]-s/2;var v=d(i),m=p(i);v+o>u&&(c=t[0]-o-r),m<f&&(h=f+5),m+s>f+a&&(h=f+a-m+h-s);break;case"n":c=t[0]-o/2-5,h=t[1]+r;var v=d(i),m=p(i);v<l&&(c=l+5),v+o>u&&(c=c-o/2+5),m+s>f+a&&(h=f+a-m+h-s);break;case"s":c=t[0]-o/2,h=t[1]-s-r;var v=d(i),m=p(i);v<l&&(c=l+5),v+o>u&&(c=c-o/2+5),f>m&&(h=f);break;case"none":c=t[0],h=t[1]-r;var v=d(i),m=p(i)}return i.style.left=c+"px",i.style.top=h+"px",i.style.opacity=1,i.style.position="absolute",i},e.tooltip.cleanup=function(){var e=document.getElementsByClassName("nvtooltip"),t=[];while(e.length)t.push(e[0]),e[0].style.transitionDelay="0 !important",e[0].style.opacity=0,e[0].className="nvtooltip-pending-removal";setTimeout(function(){while(t.length){var e=t.pop();e.parentNode.removeChild(e)}},500)}}(),e.utils.windowSize=function(){var e={width:640,height:480};return document.body&&document.body.offsetWidth&&(e.width=document.body.offsetWidth,e.height=document.body.offsetHeight),document.compatMode=="CSS1Compat"&&document.documentElement&&document.documentElement.offsetWidth&&(e.width=document.documentElement.offsetWidth,e.height=document.documentElement.offsetHeight),window.innerWidth&&window.innerHeight&&(e.width=window.innerWidth,e.height=window.innerHeight),e},e.utils.windowResize=function(e){if(e===undefined)return;var t=window.onresize;window.onresize=function(n){typeof t=="function"&&t(n),e(n)}},e.utils.getColor=function(t){return arguments.length?Object.prototype.toString.call(t)==="[object Array]"?function(e,n){return e.color||t[n%t.length]}:t:e.utils.defaultColor()},e.utils.defaultColor=function(){var e=d3.scale.category20().range();return function(t,n){return t.color||e[n%e.length]}},e.utils.customTheme=function(e,t,n){t=t||function(e){return e.key},n=n||d3.scale.category20().range();var r=n.length;return function(i,s){var o=t(i);return r||(r=n.length),typeof e[o]!="undefined"?typeof e[o]=="function"?e[o]():e[o]:n[--r]}},e.utils.pjax=function(t,n){function r(r){d3.html(r,function(r){var i=d3.select(n).node();i.parentNode.replaceChild(d3.select(r).select(n).node(),i),e.utils.pjax(t,n)})}d3.selectAll(t).on("click",function(){history.pushState(this.href,this.textContent,this.href),r(this.href),d3.event.preventDefault()}),d3.select(window).on("popstate",function(){d3.event.state&&r(d3.event.state)})},e.utils.calcApproxTextWidth=function(e){if(typeof e.style=="function"&&typeof e.text=="function"){var t=parseInt(e.style("font-size").replace("px","")),n=e.text().length;return n*t*.5}return 0},e.utils.NaNtoZero=function(e){return typeof e!="number"||isNaN(e)||e===null||e===Infinity?0:e},e.utils.optionsFunc=function(e){return e&&d3.map(e).forEach(function(e,t){typeof this[e]=="function"&&this[e](t)}.bind(this)),this},e.models.axis=function(){function m(e){return e.each(function(e){var i=d3.select(this),m=i.selectAll("g.nv-wrap.nv-axis").data([e]),g=m.enter().append("g").attr("class","nvd3 nv-wrap nv-axis"),y=g.append("g"),b=m.select("g");p!==null?t.ticks(p):(t.orient()=="top"||t.orient()=="bottom")&&t.ticks(Math.abs(s.range()[1]-s.range()[0])/100),b.call(t),v=v||t.scale();var w=t.tickFormat();w==null&&(w=v.tickFormat());var E=b.selectAll("text.nv-axislabel").data([o||null]);E.exit().remove();switch(t.orient()){case"top":E.enter().append("text").attr("class","nv-axislabel");var S=s.range().length==2?s.range()[1]:s.range()[s.range().length-1]+(s.range()[1]-s.range()[0]);E.attr("text-anchor","middle").attr("y",0).attr("x",S/2);if(u){var x=m.selectAll("g.nv-axisMaxMin").data(s.domain());x.enter().append("g").attr("class","nv-axisMaxMin").append("text"),x.exit().remove(),x.attr("transform",function(e,t){return"translate("+s(e)+",0)"}).select("text").attr("dy","-0.5em").attr("y",-t.tickPadding()).attr("text-anchor","middle").text(function(e,t){var n=w(e);return(""+n).match("NaN")?"":n}),x.attr("transform",function(e,t){return"translate("+s.range()[t]+",0)"})}break;case"bottom":var T=36,N=30,C=b.selectAll("g").select("text");if(f%360){C.each(function(e,t){var n=this.getBBox().width;n>N&&(N=n)});var k=Math.abs(Math.sin(f*Math.PI/180)),T=(k?k*N:N)+30;C.attr("transform",function(e,t,n){return"rotate("+f+" 0,0)"}).style("text-anchor",f%360>0?"start":"end")}E.enter().append("text").attr("class","nv-axislabel");var S=s.range().length==2?s.range()[1]:s.range()[s.range().length-1]+(s.range()[1]-s.range()[0]);E.attr("text-anchor","middle").attr("y",T).attr("x",S/2);if(u){var x=m.selectAll("g.nv-axisMaxMin").data([s.domain()[0],s.domain()[s.domain().length-1]]);x.enter().append("g").attr("class","nv-axisMaxMin").append("text"),x.exit().remove(),x.attr("transform",function(e,t){return"translate("+(s(e)+(h?s.rangeBand()/2:0))+",0)"}).select("text").attr("dy",".71em").attr("y",t.tickPadding()).attr("transform",function(e,t,n){return"rotate("+f+" 0,0)"}).style("text-anchor",f?f%360>0?"start":"end":"middle").text(function(e,t){var n=w(e);return(""+n).match("NaN")?"":n}),x.attr("transform",function(e,t){return"translate("+(s(e)+(h?s.rangeBand()/2:0))+",0)"})}c&&C.attr("transform",function(e,t){return"translate(0,"+(t%2==0?"0":"12")+")"});break;case"right":E.enter().append("text").attr("class","nv-axislabel"),E.style("text-anchor",l?"middle":"begin").attr("transform",l?"rotate(90)":"").attr("y",l?-Math.max(n.right,r)+12:-10).attr("x",l?s.range()[0]/2:t.tickPadding());if(u){var x=m.selectAll("g.nv-axisMaxMin").data(s.domain());x.enter().append("g").attr("class","nv-axisMaxMin").append("text").style("opacity",0),x.exit().remove(),x.attr("transform",function(e,t){return"translate(0,"+s(e)+")"}).select("text").attr("dy",".32em").attr("y",0).attr("x",t.tickPadding()).style("text-anchor","start").text(function(e,t){var n=w(e);return(""+n).match("NaN")?"":n}),x.attr("transform",function(e,t){return"translate(0,"+s.range()[t]+")"}).select("text").style("opacity",1)}break;case"left":E.enter().append("text").attr("class","nv-axislabel"),E.style("text-anchor",l?"middle":"end").attr("transform",l?"rotate(-90)":"").attr("y",l?-Math.max(n.left,r)+d:-10).attr("x",l?-s.range()[0]/2:-t.tickPadding());if(u){var x=m.selectAll("g.nv-axisMaxMin").data(s.domain());x.enter().append("g").attr("class","nv-axisMaxMin").append("text").style("opacity",0),x.exit().remove(),x.attr("transform",function(e,t){return"translate(0,"+v(e)+")"}).select("text").attr("dy",".32em").attr("y",0).attr("x",-t.tickPadding()).attr("text-anchor","end").text(function(e,t){var n=w(e);return(""+n).match("NaN")?"":n}),x.attr("transform",function(e,t){return"translate(0,"+s.range()[t]+")"}).select("text").style("opacity",1)}}E.text(function(e){return e}),u&&(t.orient()==="left"||t.orient()==="right")&&(b.selectAll("g").each(function(e,t){d3.select(this).select("text").attr("opacity",1);if(s(e)<s.range()[1]+10||s(e)>s.range()[0]-10)(e>1e-10||e<-1e-10)&&d3.select(this).attr("opacity",0),d3.select(this).select("text").attr("opacity",0)}),s.domain()[0]==s.domain()[1]&&s.domain()[0]==0&&m.selectAll("g.nv-axisMaxMin").style("opacity",function(e,t){return t?0:1}));if(u&&(t.orient()==="top"||t.orient()==="bottom")){var L=[];m.selectAll("g.nv-axisMaxMin").each(function(e,t){try{t?L.push(s(e)-this.getBBox().width-4):L.push(s(e)+this.getBBox().width+4)}catch(n){t?L.push(s(e)-4):L.push(s(e)+4)}}),b.selectAll("g").each(function(e,t){if(s(e)<L[0]||s(e)>L[1])e>1e-10||e<-1e-10?d3.select(this).remove():d3.select(this).select("text").remove()})}a&&b.selectAll(".tick").filter(function(e){return!parseFloat(Math.round(e.__data__*1e5)/1e6)&&e.__data__!==undefined}).classed("zero",!0),v=s.copy()}),m}var t=d3.svg.axis(),n={top:0,right:0,bottom:0,left:0},r=75,i=60,s=d3.scale.linear(),o=null,u=!0,a=!0,f=0,l=!0,c=!1,h=!1,p=null,d=12;t.scale(s).orient("bottom").tickFormat(function(e){return e});var v;return m.axis=t,d3.rebind(m,t,"orient","tickValues","tickSubdivide","tickSize","tickPadding","tickFormat"),d3.rebind(m,s,"domain","range","rangeBand","rangeBands"),m.options=e.utils.optionsFunc.bind(m),m.margin=function(e){return arguments.length?(n.top=typeof e.top!="undefined"?e.top:n.top,n.right=typeof e.right!="undefined"?e.right:n.right,n.bottom=typeof e.bottom!="undefined"?e.bottom:n.bottom,n.left=typeof e.left!="undefined"?e.left:n.left,m):n},m.width=function(e){return arguments.length?(r=e,m):r},m.ticks=function(e){return arguments.length?(p=e,m):p},m.height=function(e){return arguments.length?(i=e,m):i},m.axisLabel=function(e){return arguments.length?(o=e,m):o},m.showMaxMin=function(e){return arguments.length?(u=e,m):u},m.highlightZero=function(e){return arguments.length?(a=e,m):a},m.scale=function(e){return arguments.length?(s=e,t.scale(s),h=typeof s.rangeBands=="function",d3.rebind(m,s,"domain","range","rangeBand","rangeBands"),m):s},m.rotateYLabel=function(e){return arguments.length?(l=e,m):l},m.rotateLabels=function(e){return arguments.length?(f=e,m):f},m.staggerLabels=function(e){return arguments.length?(c=e,m):c},m.axisLabelDistance=function(e){return arguments.length?(d=e,m):d},m},e.models.historicalBar=function(){function w(E){return E.each(function(w){var E=n-t.left-t.right,S=r-t.top-t.bottom,T=d3.select(this);s.domain(d||d3.extent(w[0].values.map(u).concat(f))),c?s.range(m||[E*.5/w[0].values.length,E*(w[0].values.length-.5)/w[0].values.length]):s.range(m||[0,E]),o.domain(v||d3.extent(w[0].values.map(a).concat(l))).range(g||[S,0]),s.domain()[0]===s.domain()[1]&&(s.domain()[0]?s.domain([s.domain()[0]-s.domain()[0]*.01,s.domain()[1]+s.domain()[1]*.01]):s.domain([-1,1])),o.domain()[0]===o.domain()[1]&&(o.domain()[0]?o.domain([o.domain()[0]+o.domain()[0]*.01,o.domain()[1]-o.domain()[1]*.01]):o.domain([-1,1]));var N=T.selectAll("g.nv-wrap.nv-historicalBar-"+i).data([w[0].values]),C=N.enter().append("g").attr("class","nvd3 nv-wrap nv-historicalBar-"+i),k=C.append("defs"),L=C.append("g"),A=N.select("g");L.append("g").attr("class","nv-bars"),N.attr("transform","translate("+t.left+","+t.top+")"),T.on("click",function(e,t){y.chartClick({data:e,index:t,pos:d3.event,id:i})}),k.append("clipPath").attr("id","nv-chart-clip-path-"+i).append("rect"),N.select("#nv-chart-clip-path-"+i+" rect").attr("width",E).attr("height",S),A.attr("clip-path",h?"url(#nv-chart-clip-path-"+i+")":"");var O=N.select(".nv-bars").selectAll(".nv-bar").data(function(e){return e},function(e,t){return u(e,t)});O.exit().remove();var M=O.enter().append("rect").attr("x",0).attr("y",function(t,n){return e.utils.NaNtoZero(o(Math.max(0,a(t,n))))}).attr("height",function(t,n){return e.utils.NaNtoZero(Math.abs(o(a(t,n))-o(0)))}).attr("transform",function(e,t){return"translate("+(s(u(e,t))-E/w[0].values.length*.45)+",0)"}).on("mouseover",function(e,t){if(!b)return;d3.select(this).classed("hover",!0),y.elementMouseover({point:e,series:w[0],pos:[s(u(e,t)),o(a(e,t))],pointIndex:t,seriesIndex:0,e:d3.event})}).on("mouseout",function(e,t){if(!b)return;d3.select(this).classed("hover",!1),y.elementMouseout({point:e,series:w[0],pointIndex:t,seriesIndex:0,e:d3.event})}).on("click",function(e,t){if(!b)return;y.elementClick({value:a(e,t),data:e,index:t,pos:[s(u(e,t)),o(a(e,t))],e:d3.event,id:i}),d3.event.stopPropagation()}).on("dblclick",function(e,t){if(!b)return;y.elementDblClick({value:a(e,t),data:e,index:t,pos:[s(u(e,t)),o(a(e,t))],e:d3.event,id:i}),d3.event.stopPropagation()});O.attr("fill",function(e,t){return p(e,t)}).attr("class",function(e,t,n){return(a(e,t)<0?"nv-bar negative":"nv-bar positive")+" nv-bar-"+n+"-"+t}).attr("transform",function(e,t){return"translate("+(s(u(e,t))-E/w[0].values.length*.45)+",0)"}).attr("width",E/w[0].values.length*.9),O.attr("y",function(t,n){var r=a(t,n)<0?o(0):o(0)-o(a(t,n))<1?o(0)-1:o(a(t,n));return e.utils.NaNtoZero(r)}).attr("height",function(t,n){return e.utils.NaNtoZero(Math.max(Math.abs(o(a(t,n))-o(0)),1))})}),w}var t={top:0,right:0,bottom:0,left:0},n=960,r=500,i=Math.floor(Math.random()*1e4),s=d3.scale.linear(),o=d3.scale.linear(),u=function(e){return e.x},a=function(e){return e.y},f=[],l=[0],c=!1,h=!0,p=e.utils.defaultColor(),d,v,m,g,y=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout"),b=!0;return w.highlightPoint=function(e,t){d3.select(".nv-historicalBar-"+i).select(".nv-bars .nv-bar-0-"+e).classed("hover",t)},w.clearHighlights=function(){d3.select(".nv-historicalBar-"+i).select(".nv-bars .nv-bar.hover").classed("hover",!1)},w.dispatch=y,w.options=e.utils.optionsFunc.bind(w),w.x=function(e){return arguments.length?(u=e,w):u},w.y=function(e){return arguments.length?(a=e,w):a},w.margin=function(e){return arguments.length?(t.top=typeof e.top!="undefined"?e.top:t.top,t.right=typeof e.right!="undefined"?e.right:t.right,t.bottom=typeof e.bottom!="undefined"?e.bottom:t.bottom,t.left=typeof e.left!="undefined"?e.left:t.left,w):t},w.width=function(e){return arguments.length?(n=e,w):n},w.height=function(e){return arguments.length?(r=e,w):r},w.xScale=function(e){return arguments.length?(s=e,w):s},w.yScale=function(e){return arguments.length?(o=e,w):o},w.xDomain=function(e){return arguments.length?(d=e,w):d},w.yDomain=function(e){return arguments.length?(v=e,w):v},w.xRange=function(e){return arguments.length?(m=e,w):m},w.yRange=function(e){return arguments.length?(g=e,w):g},w.forceX=function(e){return arguments.length?(f=e,w):f},w.forceY=function(e){return arguments.length?(l=e,w):l},w.padData=function(e){return arguments.length?(c=e,w):c},w.clipEdge=function(e){return arguments.length?(h=e,w):h},w.color=function(t){return arguments.length?(p=e.utils.getColor(t),w):p},w.id=function(e){return arguments.length?(i=e,w):i},w.interactive=function(e){return arguments.length?(b=!1,w):b},w},e.models.bullet=function(){function m(e){return e.each(function(e,n){var p=c-t.left-t.right,m=h-t.top-t.bottom,g=d3.select(this),y=i.call(this,e,n).slice().sort(d3.descending),b=s.call(this,e,n).slice().sort(d3.descending),w=o.call(this,e,n).slice().sort(d3.descending),E=u.call(this,e,n).slice(),S=a.call(this,e,n).slice(),x=f.call(this,e,n).slice(),T=d3.scale.linear().domain(d3.extent(d3.merge([l,y]))).range(r?[p,0]:[0,p]),N=this.__chart__||d3.scale.linear().domain([0,Infinity]).range(T.range());this.__chart__=T;var C=d3.min(y),k=d3.max(y),L=y[1],A=g.selectAll("g.nv-wrap.nv-bullet").data([e]),O=A.enter().append("g").attr("class","nvd3 nv-wrap nv-bullet"),M=O.append("g"),_=A.select("g");M.append("rect").attr("class","nv-range nv-rangeMax"),M.append("rect").attr("class","nv-range nv-rangeAvg"),M.append("rect").attr("class","nv-range nv-rangeMin"),M.append("rect").attr("class","nv-measure"),M.append("path").attr("class","nv-markerTriangle"),A.attr("transform","translate("+t.left+","+t.top+")");var D=function(e){return Math.abs(N(e)-N(0))},P=function(e){return Math.abs(T(e)-T(0))},H=function(e){return e<0?N(e):N(0)},B=function(e){return e<0?T(e):T(0)};_.select("rect.nv-rangeMax").attr("height",m).attr("width",P(k>0?k:C)).attr("x",B(k>0?k:C)).datum(k>0?k:C),_.select("rect.nv-rangeAvg").attr("height",m).attr("width",P(L)).attr("x",B(L)).datum(L),_.select("rect.nv-rangeMin").attr("height",m).attr("width",P(k)).attr("x",B(k)).attr("width",P(k>0?C:k)).attr("x",B(k>0?C:k)).datum(k>0?C:k),_.select("rect.nv-measure").style("fill",d).attr("height",m/3).attr("y",m/3).attr("width",w<0?T(0)-T(w[0]):T(w[0])-T(0)).attr("x",B(w)).on("mouseover",function(){v.elementMouseover({value:w[0],label:x[0]||"Current",pos:[T(w[0]),m/2]})}).on("mouseout",function(){v.elementMouseout({value:w[0],label:x[0]||"Current"})});var j=m/6;b[0]?_.selectAll("path.nv-markerTriangle").attr("transform",function(e){return"translate("+T(b[0])+","+m/2+")"}).attr("d","M0,"+j+"L"+j+","+ -j+" "+ -j+","+ -j+"Z").on("mouseover",function(){v.elementMouseover({value:b[0],label:S[0]||"Previous",pos:[T(b[0]),m/2]})}).on("mouseout",function(){v.elementMouseout({value:b[0],label:S[0]||"Previous"})}):_.selectAll("path.nv-markerTriangle").remove(),A.selectAll(".nv-range").on("mouseover",function(e,t){var n=E[t]||(t?t==1?"Mean":"Minimum":"Maximum");v.elementMouseover({value:e,label:n,pos:[T(e),m/2]})}).on("mouseout",function(e,t){var n=E[t]||(t?t==1?"Mean":"Minimum":"Maximum");v.elementMouseout({value:e,label:n})})}),m}var t={top:0,right:0,bottom:0,left:0},n="left",r=!1,i=function(e){return e.ranges},s=function(e){return e.markers},o=function(e){return e.measures},u=function(e){return e.rangeLabels?e.rangeLabels:[]},a=function(e){return e.markerLabels?e.markerLabels:[]},f=function(e){return e.measureLabels?e.measureLabels:[]},l=[0],c=380,h=30,p=null,d=e.utils.getColor(["#1f77b4"]),v=d3.dispatch("elementMouseover","elementMouseout");return m.dispatch=v,m.options=e.utils.optionsFunc.bind(m),m.orient=function(e){return arguments.length?(n=e,r=n=="right"||n=="bottom",m):n},m.ranges=function(e){return arguments.length?(i=e,m):i},m.markers=function(e){return arguments.length?(s=e,m):s},m.measures=function(e){return arguments.length?(o=e,m):o},m.forceX=function(e){return arguments.length?(l=e,m):l},m.width=function(e){return arguments.length?(c=e,m):c},m.height=function(e){return arguments.length?(h=e,m):h},m.margin=function(e){return arguments.length?(t.top=typeof e.top!="undefined"?e.top:t.top,t.right=typeof e.right!="undefined"?e.right:t.right,t.bottom=typeof e.bottom!="undefined"?e.bottom:t.bottom,t.left=typeof e.left!="undefined"?e.left:t.left,m):t},m.tickFormat=function(e){return arguments.length?(p=e,m):p},m.color=function(t){return arguments.length?(d=e.utils.getColor(t),m):d},m},e.models.bulletChart=function(){function m(e){return e.each(function(n,h){var g=d3.select(this),y=(a||parseInt(g.style("width"))||960)-i.left-i.right,b=f-i.top-i.bottom,w=this;m.update=function(){m(e)},m.container=this;if(!n||!s.call(this,n,h)){var E=g.selectAll(".nv-noData").data([p]);return E.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),E.attr("x",i.left+y/2).attr("y",18+i.top+b/2).text(function(e){return e}),m}g.selectAll(".nv-noData").remove();var S=s.call(this,n,h).slice().sort(d3.descending),x=o.call(this,n,h).slice().sort(d3.descending),T=u.call(this,n,h).slice().sort(d3.descending),N=g.selectAll("g.nv-wrap.nv-bulletChart").data([n]),C=N.enter().append("g").attr("class","nvd3 nv-wrap nv-bulletChart"),k=C.append("g"),L=N.select("g");k.append("g").attr("class","nv-bulletWrap"),k.append("g").attr("class","nv-titles"),N.attr("transform","translate("+i.left+","+i.top+")");var A=d3.scale.linear().domain([0,Math.max(S[0],x[0],T[0])]).range(r?[y,0]:[0,y]),O=this.__chart__||d3.scale.linear().domain([0,Infinity]).range(A.range());this.__chart__=A;var M=function(e){return Math.abs(O(e)-O(0))},_=function(e){return Math.abs(A(e)-A(0))},D=k.select(".nv-titles").append("g").attr("text-anchor","end").attr("transform","translate(-6,"+(f-i.top-i.bottom)/2+")");D.append("text").attr("class","nv-title").text(function(e){return e.title}),D.append("text").attr("class","nv-subtitle").attr("dy","1em").text(function(e){return e.subtitle}),t.width(y).height(b);var P=L.select(".nv-bulletWrap");d3.transition(P).call(t);var H=l||A.tickFormat(y/100),B=L.selectAll("g.nv-tick").data(A.ticks(y/50),function(e){return this.textContent||H(e)}),j=B.enter().append("g").attr("class","nv-tick").attr("transform",function(e){return"translate("+O(e)+",0)"}).style("opacity",1e-6);j.append("line").attr("y1",b).attr("y2",b*7/6),j.append("text").attr("text-anchor","middle").attr("dy","1em").attr("y",b*7/6).text(H);var F=d3.transition(B).attr("transform",function(e){return"translate("+A(e)+",0)"}).style("opacity",1);F.select("line").attr("y1",b).attr("y2",b*7/6),F.select("text").attr("y",b*7/6),d3.transition(B.exit()).attr("transform",function(e){return"translate("+A(e)+",0)"}).style("opacity",1e-6).remove(),d.on("tooltipShow",function(e){e.key=n.title,c&&v(e,w.parentNode)})}),d3.timer.flush(),m}var t=e.models.bullet(),n="left",r=!1,i={top:5,right:40,bottom:20,left:120},s=function(e){return e.ranges},o=function(e){return e.markers},u=function(e){return e.measures},a=null,f=55,l=null,c=!0,h=function(e,t,n,r,i){return"<h3>"+t+"</h3>"+"<p>"+n+"</p>"},p="No Data Available.",d=d3.dispatch("tooltipShow","tooltipHide"),v=function(t,n){var r=t.pos[0]+(n.offsetLeft||0)+i.left,s=t.pos[1]+(n.offsetTop||0)+i.top,o=h(t.key,t.label,t.value,t,m);e.tooltip.show([r,s],o,t.value<0?"e":"w",null,n)};return t.dispatch.on("elementMouseover.tooltip",function(e){d.tooltipShow(e)}),t.dispatch.on("elementMouseout.tooltip",function(e){d.tooltipHide(e)}),d.on("tooltipHide",function(){c&&e.tooltip.cleanup()}),m.dispatch=d,m.bullet=t,d3.rebind(m,t,"color"),m.options=e.utils.optionsFunc.bind(m),m.orient=function(e){return arguments.length?(n=e,r=n=="right"||n=="bottom",m):n},m.ranges=function(e){return arguments.length?(s=e,m):s},m.markers=function(e){return arguments.length?(o=e,m):o},m.measures=function(e){return arguments.length?(u=e,m):u},m.width=function(e){return arguments.length?(a=e,m):a},m.height=function(e){return arguments.length?(f=e,m):f},m.margin=function(e){return arguments.length?(i.top=typeof e.top!="undefined"?e.top:i.top,i.right=typeof e.right!="undefined"?e.right:i.right,i.bottom=typeof e.bottom!="undefined"?e.bottom:i.bottom,i.left=typeof e.left!="undefined"?e.left:i.left,m):i},m.tickFormat=function(e){return arguments.length?(l=e,m):l},m.tooltips=function(e){return arguments.length?(c=e,m):c},m.tooltipContent=function(e){return arguments.length?(h=e,m):h},m.noData=function(e){return arguments.length?(p=e,m):p},m},e.models.cumulativeLineChart=function(){function D(b){return b.each(function(b){function I(e,t){d3.select(D.container).style("cursor","ew-resize")}function q(e,t){M.x=d3.event.x,M.i=Math.round(O.invert(M.x)),nt()}function R(e,t){d3.select(D.container).style("cursor","auto"),x.index=M.i,k.stateChange(x)}function nt(){tt.data([M]);var e=D.transitionDuration();D.transitionDuration(0),D.update(),D.transitionDuration(e)}var L=d3.select(this).classed("nv-chart-"+S,!0),A=this,H=(f||parseInt(L.style("width"))||960)-u.left-u.right,B=(l||parseInt(L.style("height"))||400)-u.top-u.bottom;D.update=function(){L.call(D)},D.container=this,x.disabled=b.map(function(e){return!!e.disabled});if(!T){var j;T={};for(j in x)x[j]instanceof Array?T[j]=x[j].slice(0):T[j]=x[j]}var F=d3.behavior.drag().on("dragstart",I).on("drag",q).on("dragend",R);if(!b||!b.length||!b.filter(function(e){return e.values.length}).length){var U=L.selectAll(".nv-noData").data([N]);return U.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),U.attr("x",u.left+H/2).attr("y",u.top+B/2).text(function(e){return e}),D}L.selectAll(".nv-noData").remove(),w=t.xScale(),E=t.yScale();if(!y){var z=b.filter(function(e){return!e.disabled}).map(function(e,n){var r=d3.extent(e.values,t.y());return r[0]<-0.95&&(r[0]=-0.95),[(r[0]-r[1])/(1+r[1]),(r[1]-r[0])/(1+r[0])]}),W=[d3.min(z,function(e){return e[0]}),d3.max(z,function(e){return e[1]})];t.yDomain(W)}else t.yDomain(null);O.domain([0,b[0].values.length-1]).range([0,H]).clamp(!0);var b=P(M.i,b),X=g?"none":"all",V=L.selectAll("g.nv-wrap.nv-cumulativeLine").data([b]),$=V.enter().append("g").attr("class","nvd3 nv-wrap nv-cumulativeLine").append("g"),J=V.select("g");$.append("g").attr("class","nv-interactive"),$.append("g").attr("class","nv-x nv-axis").style("pointer-events","none"),$.append("g").attr("class","nv-y nv-axis"),$.append("g").attr("class","nv-background"),$.append("g").attr("class","nv-linesWrap").style("pointer-events",X),$.append("g").attr("class","nv-avgLinesWrap").style("pointer-events","none"),$.append("g").attr("class","nv-legendWrap"),$.append("g").attr("class","nv-controlsWrap"),c&&(i.width(H),J.select(".nv-legendWrap").datum(b).call(i),u.top!=i.height()&&(u.top=i.height(),B=(l||parseInt(L.style("height"))||400)-u.top-u.bottom),J.select(".nv-legendWrap").attr("transform","translate(0,"+ -u.top+")"));if(m){var K=[{key:"Re-scale y-axis",disabled:!y}];s.width(140).color(["#444","#444","#444"]).rightAlign(!1).margin({top:5,right:0,bottom:5,left:20}),J.select(".nv-controlsWrap").datum(K).attr("transform","translate(0,"+ -u.top+")").call(s)}V.attr("transform","translate("+u.left+","+u.top+")"),d&&J.select(".nv-y.nv-axis").attr("transform","translate("+H+",0)");var Q=b.filter(function(e){return e.tempDisabled});V.select(".tempDisabled").remove(),Q.length&&V.append("text").attr("class","tempDisabled").attr("x",H/2).attr("y","-.71em").style("text-anchor","end").text(Q.map(function(e){return e.key}).join(", ")+" values cannot be calculated for this time period."),g&&(o.width(H).height(B).margin({left:u.left,top:u.top}).svgContainer(L).xScale(w),V.select(".nv-interactive").call(o)),$.select(".nv-background").append("rect"),J.select(".nv-background rect").attr("width",H).attr("height",B),t.y(function(e){return e.display.y}).width(H).height(B).color(b.map(function(e,t){return e.color||a(e,t)}).filter(function(e,t){return!b[t].disabled&&!b[t].tempDisabled}));var G=J.select(".nv-linesWrap").datum(b.filter(function(e){return!e.disabled&&!e.tempDisabled}));G.call(t),b.forEach(function(e,t){e.seriesIndex=t});var Y=b.filter(function(e){return!e.disabled&&!!C(e)}),Z=J.select(".nv-avgLinesWrap").selectAll("line").data(Y,function(e){return e.key}),et=function(e){var t=E(C(e));return t<0?0:t>B?B:t};Z.enter().append("line").style("stroke-width",2).style("stroke-dasharray","10,10").style("stroke",function(e,n){return t.color()(e,e.seriesIndex)}).attr("x1",0).attr("x2",H).attr("y1",et).attr("y2",et),Z.style("stroke-opacity",function(e){var t=E(C(e));return t<0||t>B?0:1}).attr("x1",0).attr("x2",H).attr("y1",et).attr("y2",et),Z.exit().remove();var tt=G.selectAll(".nv-indexLine").data([M]);tt.enter().append("rect").attr("class","nv-indexLine").attr("width",3).attr("x",-2).attr("fill","red").attr("fill-opacity",.5).style("pointer-events","all").call(F),tt.attr("transform",function(e){return"translate("+O(e.i)+",0)"}).attr("height",B),h&&(n.scale(w).ticks(Math.min(b[0].values.length,H/70)).tickSize(-B,0),J.select(".nv-x.nv-axis").attr("transform","translate(0,"+E.range()[0]+")"),d3.transition(J.select(".nv-x.nv-axis")).call(n)),p&&(r.scale(E).ticks(B/36).tickSize(-H,0),d3.transition(J.select(".nv-y.nv-axis")).call(r)),J.select(".nv-background rect").on("click",function(){M.x=d3.mouse(this)[0],M.i=Math.round(O.invert(M.x)),x.index=M.i,k.stateChange(x),nt()}),t.dispatch.on("elementClick",function(e){M.i=e.pointIndex,M.x=O(M.i),x.index=M.i,k.stateChange(x),nt()}),s.dispatch.on("legendClick",function(e,t){e.disabled=!e.disabled,y=!e.disabled,x.rescaleY=y,k.stateChange(x),D.update()}),i.dispatch.on("stateChange",function(e){x.disabled=e.disabled,k.stateChange(x),D.update()}),o.dispatch.on("elementMousemove",function(i){t.clearHighlights();var s,f,l,c=[];b.filter(function(e,t){return e.seriesIndex=t,!e.disabled}).forEach(function(n,r){f=e.interactiveBisect(n.values,i.pointXValue,D.x()),t.highlightPoint(r,f,!0);var o=n.values[f];if(typeof o=="undefined")return;typeof s=="undefined"&&(s=o),typeof l=="undefined"&&(l=D.xScale()(D.x()(o,f))),c.push({key:n.key,value:D.y()(o,f),color:a(n,n.seriesIndex)})});if(c.length>2){var h=D.yScale().invert(i.mouseY),p=Math.abs(D.yScale().domain()[0]-D.yScale().domain()[1]),d=.03*p,m=e.nearestValueIndex(c.map(function(e){return e.value}),h,d);m!==null&&(c[m].highlight=!0)}var g=n.tickFormat()(D.x()(s,f),f);o.tooltip.position({left:l+u.left,top:i.mouseY+u.top}).chartContainer(A.parentNode).enabled(v).valueFormatter(function(e,t){return r.tickFormat()(e)}).data({value:g,series:c})(),o.renderGuideLine(l)}),o.dispatch.on("elementMouseout",function(e){k.tooltipHide(),t.clearHighlights()}),k.on("tooltipShow",function(e){v&&_(e,A.parentNode)}),k.on("changeState",function(e){typeof e.disabled!="undefined"&&(b.forEach(function(t,n){t.disabled=e.disabled[n]}),x.disabled=e.disabled),typeof e.index!="undefined"&&(M.i=e.index,M.x=O(M.i),x.index=e.index,tt.data([M])),typeof e.rescaleY!="undefined"&&(y=e.rescaleY),D.update()})}),D}function P(e,n){return n.map(function(n,r){if(!n.values)return n;var i=n.values[e];if(i==null)return n;var s=t.y()(i,e);return s<-0.95&&!A?(n.tempDisabled=!0,n):(n.tempDisabled=!1,n.values=n.values.map(function(e,n){return e.display={y:(t.y()(e,n)-s)/(1+s)},e}),n)})}var t=e.models.line(),n=e.models.axis(),r=e.models.axis(),i=e.models.legend(),s=e.models.legend(),o=e.interactiveGuideline(),u={top:30,right:30,bottom:50,left:60},a=e.utils.defaultColor(),f=null,l=null,c=!0,h=!0,p=!0,d=!1,v=!0,m=!0,g=!1,y=!0,b=function(e,t,n,r,i){return"<h3>"+e+"</h3>"+"<p>"+n+" at "+t+"</p>"},w,E,S=t.id(),x={index:0,rescaleY:y},T=null,N="No Data Available.",C=function(e){return e.average},k=d3.dispatch("tooltipShow","tooltipHide","stateChange","changeState"),L=0,A=!1;n.orient("bottom").tickPadding(7),r.orient(d?"right":"left"),s.updateState(!1);var O=d3.scale.linear(),M={i:0,x:0},_=function(i,s){var o=i.pos[0]+(s.offsetLeft||0),u=i.pos[1]+(s.offsetTop||0),a=n.tickFormat()(t.x()(i.point,i.pointIndex)),f=r.tickFormat()(t.y()(i.point,i.pointIndex)),l=b(i.series.key,a,f,i,D);e.tooltip.show([o,u],l,null,null,s)};return t.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+u.left,e.pos[1]+u.top],k.tooltipShow(e)}),t.dispatch.on("elementMouseout.tooltip",function(e){k.tooltipHide(e)}),k.on("tooltipHide",function(){v&&e.tooltip.cleanup()}),D.dispatch=k,D.lines=t,D.legend=i,D.xAxis=n,D.yAxis=r,D.interactiveLayer=o,d3.rebind(D,t,"defined","isArea","x","y","xScale","yScale","size","xDomain","yDomain","xRange","yRange","forceX","forceY","interactive","clipEdge","clipVoronoi","useVoronoi","id"),D.options=e.utils.optionsFunc.bind(D),D.margin=function(e){return arguments.length?(u.top=typeof e.top!="undefined"?e.top:u.top,u.right=typeof e.right!="undefined"?e.right:u.right,u.bottom=typeof e.bottom!="undefined"?e.bottom:u.bottom,u.left=typeof e.left!="undefined"?e.left:u.left,D):u},D.width=function(e){return arguments.length?(f=e,D):f},D.height=function(e){return arguments.length?(l=e,D):l},D.color=function(t){return arguments.length?(a=e.utils.getColor(t),i.color(a),D):a},D.rescaleY=function(e){return arguments.length?(y=e,D):y},D.showControls=function(e){return arguments.length?(m=e,D):m},D.useInteractiveGuideline=function(e){return arguments.length?(g=e,e===!0&&(D.interactive(!1),D.useVoronoi(!1)),D):g},D.showLegend=function(e){return arguments.length?(c=e,D):c},D.showXAxis=function(e){return arguments.length?(h=e,D):h},D.showYAxis=function(e){return arguments.length?(p=e,D):p},D.rightAlignYAxis=function(e){return arguments.length?(d=e,r.orient(e?"right":"left"),D):d},D.tooltips=function(e){return arguments.length?(v=e,D):v},D.tooltipContent=function(e){return arguments.length?(b=e,D):b},D.state=function(e){return arguments.length?(x=e,D):x},D.defaultState=function(e){return arguments.length?(T=e,D):T},D.noData=function(e){return arguments.length?(N=e,D):N},D.average=function(e){return arguments.length?(C=e,D):C},D.transitionDuration=function(e){return arguments.length?(L=e,D):L},D.noErrorCheck=function(e){return arguments.length?(A=e,D):A},D},e.models.discreteBar=function(){function E(e){return e.each(function(e){var i=n-t.left-t.right,E=r-t.top-t.bottom,S=d3.select(this);e.forEach(function(e,t){e.values.forEach(function(e){e.series=t})});var T=p&&d?[]:e.map(function(e){return e.values.map(function(e,t){return{x:u(e,t),y:a(e,t),y0:e.y0}})});s.domain(p||d3.merge(T).map(function(e){return e.x})).rangeBands(v||[0,i],.1),o.domain(d||d3.extent(d3.merge(T).map(function(e){return e.y}).concat(f))),c?o.range(m||[E-(o.domain()[0]<0?12:0),o.domain()[1]>0?12:0]):o.range(m||[E,0]),b=b||s,w=w||o.copy().range([o(0),o(0)]);var N=S.selectAll("g.nv-wrap.nv-discretebar").data([e]),C=N.enter().append("g").attr("class","nvd3 nv-wrap nv-discretebar"),k=C.append("g"),L=N.select("g");k.append("g").attr("class","nv-groups"),N.attr("transform","translate("+t.left+","+t.top+")");var A=N.select(".nv-groups").selectAll(".nv-group").data(function(e){return e},function(e){return e.key});A.enter().append("g").style("stroke-opacity",1e-6).style("fill-opacity",1e-6),A.exit().style("stroke-opacity",1e-6).style("fill-opacity",1e-6).remove(),A.attr("class",function(e,t){return"nv-group nv-series-"+t}).classed("hover",function(e){return e.hover}),A.style("stroke-opacity",1).style("fill-opacity",.75);var O=A.selectAll("g.nv-bar").data(function(e){return e.values});O.exit().remove();var M=O.enter().append("g").attr("transform",function(e,t,n){return"translate("+(s(u(e,t))+s.rangeBand()*.05)+", "+o(0)+")"}).on("mouseover",function(t,n){d3.select(this).classed("hover",!0),g.elementMouseover({value:a(t,n),point:t,series:e[t.series],pos:[s(u(t,n))+s.rangeBand()*(t.series+.5)/e.length,o(a(t,n))],pointIndex:n,seriesIndex:t.series,e:d3.event})}).on("mouseout",function(t,n){d3.select(this).classed("hover",!1),g.elementMouseout({value:a(t,n),point:t,series:e[t.series],pointIndex:n,seriesIndex:t.series,e:d3.event})}).on("click",function(t,n){g.elementClick({value:a(t,n),point:t,series:e[t.series],pos:[s(u(t,n))+s.rangeBand()*(t.series+.5)/e.length,o(a(t,n))],pointIndex:n,seriesIndex:t.series,e:d3.event}),d3.event.stopPropagation()}).on("dblclick",function(t,n){g.elementDblClick({value:a(t,n),point:t,series:e[t.series],pos:[s(u(t,n))+s.rangeBand()*(t.series+.5)/e.length,o(a(t,n))],pointIndex:n,seriesIndex:t.series,e:d3.event}),d3.event.stopPropagation()});M.append("rect").attr("height",0).attr("width",s.rangeBand()*.9/e.length),c?(M.append("text").attr("text-anchor","middle"),O.select("text").text(function(e,t){return h(a(e,t))}).attr("x",s.rangeBand()*.9/2).attr("y",function(e,t){return a(e,t)<0?o(a(e,t))-o(0)+12:-4})):O.selectAll("text").remove(),O.attr("class",function(e,t){return a(e,t)<0?"nv-bar negative":"nv-bar positive"}).style("fill",function(e,t){return e.color||l(e,t)}).style("stroke",function(e,t){return e.color||l(e,t)}).select("rect").attr("class",y).attr("width",s.rangeBand()*.9/e.length),O.attr("transform",function(e,t){var n=s(u(e,t))+s.rangeBand()*.05,r=a(e,t)<0?o(0):o(0)-o(a(e,t))<1?o(0)-1:o(a(e,t));return"translate("+n+", "+r+")"}).select("rect").attr("height",function(e,t){return Math.max(Math.abs(o(a(e,t))-o(d&&d[0]||0))||1)}),b=s.copy(),w=o.copy()}),E}var t={top:0,right:0,bottom:0,left:0},n=960,r=500,i=Math.floor(Math.random()*1e4),s=d3.scale.ordinal(),o=d3.scale.linear(),u=function(e){return e.x},a=function(e){return e.y},f=[0],l=e.utils.defaultColor(),c=!1,h=d3.format(",.2f"),p,d,v,m,g=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout"),y="discreteBar",b,w;return E.dispatch=g,E.options=e.utils.optionsFunc.bind(E),E.x=function(e){return arguments.length?(u=e,E):u},E.y=function(e){return arguments.length?(a=e,E):a},E.margin=function(e){return arguments.length?(t.top=typeof e.top!="undefined"?e.top:t.top,t.right=typeof e.right!="undefined"?e.right:t.right,t.bottom=typeof e.bottom!="undefined"?e.bottom:t.bottom,t.left=typeof e.left!="undefined"?e.left:t.left,E):t},E.width=function(e){return arguments.length?(n=e,E):n},E.height=function(e){return arguments.length?(r=e,E):r},E.xScale=function(e){return arguments.length?(s=e,E):s},E.yScale=function(e){return arguments.length?(o=e,E):o},E.xDomain=function(e){return arguments.length?(p=e,E):p},E.yDomain=function(e){return arguments.length?(d=e,E):d},E.xRange=function(e){return arguments.length?(v=e,E):v},E.yRange=function(e){return arguments.length?(m=e,E):m},E.forceY=function(e){return arguments.length?(f=e,E):f},E.color=function(t){return arguments.length?(l=e.utils.getColor(t),E):l},E.id=function(e){return arguments.length?(i=e,E):i},E.showValues=function(e){return arguments.length?(c=e,E):c},E.valueFormat=function(e){return arguments.length?(h=e,E):h},E.rectClass=function(e){return arguments.length?(y=e,E):y},E},e.models.discreteBarChart=function(){function w(e){return e.each(function(e){var u=d3.select(this),p=this,y=(s||parseInt(u.style("width"))||960)-i.left-i.right,E=(o||parseInt(u.style("height"))||400)-i.top-i.bottom;w.update=function(){g.beforeUpdate(),u.call(w)},w.container=this;if(!e||!e.length||!e.filter(function(e){return e.values.length}).length){var S=u.selectAll(".nv-noData").data([m]);return S.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),S.attr("x",i.left+y/2).attr("y",i.top+E/2).text(function(e){return e}),w}u.selectAll(".nv-noData").remove(),d=t.xScale(),v=t.yScale().clamp(!0);var T=u.selectAll("g.nv-wrap.nv-discreteBarWithAxes").data([e]),N=T.enter().append("g").attr("class","nvd3 nv-wrap nv-discreteBarWithAxes").append("g"),C=N.append("defs"),k=T.select("g");N.append("g").attr("class","nv-x nv-axis"),N.append("g").attr("class","nv-y nv-axis").append("g").attr("class","nv-zeroLine").append("line"),N.append("g").attr("class","nv-barsWrap"),k.attr("transform","translate("+i.left+","+i.top+")"),l&&k.select(".nv-y.nv-axis").attr("transform","translate("+y+",0)"),t.width(y).height(E);var L=k.select(".nv-barsWrap").datum(e.filter(function(e){return!e.disabled}));L.call(t),C.append("clipPath").attr("id","nv-x-label-clip-"+t.id()).append("rect"),k.select("#nv-x-label-clip-"+t.id()+" rect").attr("width",d.rangeBand()*(c?2:1)).attr("height",16).attr("x",-d.rangeBand()/(c?1:2));if(a){n.scale(d).ticks(y/100).tickSize(-E,0),k.select(".nv-x.nv-axis").attr("transform","translate(0,"+(v.range()[0]+(t.showValues()&&v.domain()[0]<0?16:0))+")"),k.select(".nv-x.nv-axis").call(n);var A=k.select(".nv-x.nv-axis").selectAll("g");c&&A.selectAll("text").attr("transform",function(e,t,n){return"translate(0,"+(n%2==0?"5":"17")+")"})}f&&(r.scale(v).ticks(E/36).tickSize(-y,0),k.select(".nv-y.nv-axis").call(r)),k.select(".nv-zeroLine line").attr("x1",0).attr("x2",y).attr("y1",v(0)).attr("y2",v(0)),g.on("tooltipShow",function(e){h&&b(e,p.parentNode)})}),w}var t=e.models.discreteBar(),n=e.models.axis(),r=e.models.axis(),i={top:15,right:10,bottom:50,left:60},s=null,o=null,u=e.utils.getColor(),a=!0,f=!0,l=!1,c=!1,h=!0,p=function(e,t,n,r,i){return"<h3>"+t+"</h3>"+"<p>"+n+"</p>"},d,v,m="No Data Available.",g=d3.dispatch("tooltipShow","tooltipHide","beforeUpdate"),y=0;n.orient("bottom").highlightZero(!1).showMaxMin(!1).tickFormat(function(e){return e}),r.orient(l?"right":"left").tickFormat(d3.format(",.1f"));var b=function(i,s){var o=i.pos[0]+(s.offsetLeft||0),u=i.pos[1]+(s.offsetTop||0),a=n.tickFormat()(t.x()(i.point,i.pointIndex)),f=r.tickFormat()(t.y()(i.point,i.pointIndex)),l=p(i.series.key,a,f,i,w);e.tooltip.show([o,u],l,i.value<0?"n":"s",null,s)};return t.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+i.left,e.pos[1]+i.top],g.tooltipShow(e)}),t.dispatch.on("elementMouseout.tooltip",function(e){g.tooltipHide(e)}),g.on("tooltipHide",function(){h&&e.tooltip.cleanup()}),w.dispatch=g,w.discretebar=t,w.xAxis=n,w.yAxis=r,d3.rebind(w,t,"x","y","xDomain","yDomain","xRange","yRange","forceX","forceY","id","showValues","valueFormat"),w.options=e.utils.optionsFunc.bind(w),w.margin=function(e){return arguments.length?(i.top=typeof e.top!="undefined"?e.top:i.top,i.right=typeof e.right!="undefined"?e.right:i.right,i.bottom=typeof e.bottom!="undefined"?e.bottom:i.bottom,i.left=typeof e.left!="undefined"?e.left:i.left,w):i},w.width=function(e){return arguments.length?(s=e,w):s},w.height=function(e){return arguments.length?(o=e,w):o},w.color=function(n){return arguments.length?(u=e.utils.getColor(n),t.color(u),w):u},w.showXAxis=function(e){return arguments.length?(a=e,w):a},w.showYAxis=function(e){return arguments.length?(f=e,w):f},w.rightAlignYAxis=function(e){return arguments.length?(l=e,r.orient(e?"right":"left"),w):l},w.staggerLabels=function(e){return arguments.length?(c=e,w):c},w.tooltips=function(e){return arguments.length?(h=e,w):h},w.tooltipContent=function(e){return arguments.length?(p=e,w):p},w.noData=function(e){return arguments.length?(m=e,w):m},w.transitionDuration=function(e){return arguments.length?(y=e,w):y},w},e.models.distribution=function(){function l(e){return e.each(function(e){var a=n-(i==="x"?t.left+t.right:t.top+t.bottom),l=i=="x"?"y":"x",c=d3.select(this);f=f||u;var h=c.selectAll("g.nv-distribution").data([e]),p=h.enter().append("g").attr("class","nvd3 nv-distribution"),d=p.append("g"),v=h.select("g");h.attr("transform","translate("+t.left+","+t.top+")");var m=v.selectAll("g.nv-dist").data(function(e){return e},function(e){return e.key});m.enter().append("g"),m.attr("class",function(e,t){return"nv-dist nv-series-"+t}).style("stroke",function(e,t){return o(e,t)});var g=m.selectAll("line.nv-dist"+i).data(function(e){return e.values});g.enter().append("line").attr(i+"1",function(e,t){return f(s(e,t))}).attr(i+"2",function(e,t){return f(s(e,t))}),m.exit().selectAll("line.nv-dist"+i).attr(i+"1",function(e,t){return u(s(e,t))}).attr(i+"2",function(e,t){return u(s(e,t))}).style("stroke-opacity",0).remove(),g.attr("class",function(e,t){return"nv-dist"+i+" nv-dist"+i+"-"+t}).attr(l+"1",0).attr(l+"2",r),g.attr(i+"1",function(e,t){return u(s(e,t))}).attr(i+"2",function(e,t){return u(s(e,t))}),f=u.copy()}),l}var t={top:0,right:0,bottom:0,left:0},n=400,r=8,i="x",s=function(e){return e[i]},o=e.utils.defaultColor(),u=d3.scale.linear(),a,f;return l.options=e.utils.optionsFunc.bind(l),l.margin=function(e){return arguments.length?(t.top=typeof e.top!="undefined"?e.top:t.top,t.right=typeof e.right!="undefined"?e.right:t.right,t.bottom=typeof e.bottom!="undefined"?e.bottom:t.bottom,t.left=typeof e.left!="undefined"?e.left:t.left,l):t},l.width=function(e){return arguments.length?(n=e,l):n},l.axis=function(e){return arguments.length?(i=e,l):i},l.size=function(e){return arguments.length?(r=e,l):r},l.getData=function(e){return arguments.length?(s=d3.functor(e),l):s},l.scale=function(e){return arguments.length?(u=e,l):u},l.color=function(t){return arguments.length?(o=e.utils.getColor(t),l):o},l},e.models.historicalBarChart=function(){function x(e){return e.each(function(d){var E=d3.select(this),T=this,N=(u||parseInt(E.style("width"))||960)-s.left-s.right,C=(a||parseInt(E.style("height"))||400)-s.top-s.bottom;x.update=function(){E.call(x)},x.container=this,g.disabled=d.map(function(e){return!!e.disabled});if(!y){var k;y={};for(k in g)g[k]instanceof Array?y[k]=g[k].slice(0):y[k]=g[k]}if(!d||!d.length||!d.filter(function(e){return e.values.length}).length){var L=E.selectAll(".nv-noData").data([b]);return L.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),L.attr("x",s.left+N/2).attr("y",s.top+C/2).text(function(e){return e}),x}E.selectAll(".nv-noData").remove(),v=t.xScale(),m=t.yScale();var A=E.selectAll("g.nv-wrap.nv-historicalBarChart").data([d]),O=A.enter().append("g").attr("class","nvd3 nv-wrap nv-historicalBarChart").append("g"),M=A.select("g");O.append("g").attr("class","nv-x nv-axis"),O.append("g").attr("class","nv-y nv-axis"),O.append("g").attr("class","nv-barsWrap"),O.append("g").attr("class","nv-legendWrap"),f&&(i.width(N),M.select(".nv-legendWrap").datum(d).call(i),s.top!=i.height()&&(s.top=i.height(),C=(a||parseInt(E.style("height"))||400)-s.top-s.bottom),A.select(".nv-legendWrap").attr("transform","translate(0,"+ -s.top+")")),A.attr("transform","translate("+s.left+","+s.top+")"),h&&M.select(".nv-y.nv-axis").attr("transform","translate("+N+",0)"),t.width(N).height(C).color(d.map(function(e,t){return e.color||o(e,t)}).filter(function(e,t){return!d[t].disabled}));var _=M.select(".nv-barsWrap").datum(d.filter(function(e){return!e.disabled}));_.call(t),l&&(n.scale(v).tickSize(-C,0),M.select(".nv-x.nv-axis").attr("transform","translate(0,"+m.range()[0]+")"),M.select(".nv-x.nv-axis").call(n)),c&&(r.scale(m).ticks(C/36).tickSize(-N,0),M.select(".nv-y.nv-axis").call(r)),i.dispatch.on("legendClick",function(t,n){t.disabled=!t.disabled,d.filter(function(e){return!e.disabled}).length||d.map(function(e){return e.disabled=!1,A.selectAll(".nv-series").classed("disabled",!1),e}),g.disabled=d.map(function(e){return!!e.disabled}),w.stateChange(g),e.call(x)}),i.dispatch.on("legendDblclick",function(e){d.forEach(function(e){e.disabled=!0}),e.disabled=!1,g.disabled=d.map(function(e){return!!e.disabled}),w.stateChange(g),x.update()}),w.on("tooltipShow",function(e){p&&S(e,T.parentNode)}),w.on("changeState",function(e){typeof e.disabled!="undefined"&&(d.forEach(function(t,n){t.disabled=e.disabled[n]}),g.disabled=e.disabled),x.update()})}),x}var t=e.models.historicalBar(),n=e.models.axis(),r=e.models.axis(),i=e.models.legend(),s={top:30,right:90,bottom:50,left:90},o=e.utils.defaultColor(),u=null,a=null,f=!1,l=!0,c=!0,h=!1,p=!0,d=function(e,t,n,r,i){return"<h3>"+e+"</h3>"+"<p>"+n+" at "+t+"</p>"},v,m,g={},y=null,b="No Data Available.",w=d3.dispatch("tooltipShow","tooltipHide","stateChange","changeState"),E=0;n.orient("bottom").tickPadding(7),r.orient(h?"right":"left");var S=function(i,s){if(s){var o=d3.select(s).select("svg"),u=o.node()?o.attr("viewBox"):null;if(u){u=u.split(" ");var a=parseInt(o.style("width"))/u[2];i.pos[0]=i.pos[0]*a,i.pos[1]=i.pos[1]*a}}var f=i.pos[0]+(s.offsetLeft||0),l=i.pos[1]+(s.offsetTop||0),c=n.tickFormat()(t.x()(i.point,i.pointIndex)),h=r.tickFormat()(t.y()(i.point,i.pointIndex)),p=d(i.series.key,c,h,i,x);e.tooltip.show([f,l],p,null,null,s)};return t.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+s.left,e.pos[1]+s.top],w.tooltipShow(e)}),t.dispatch.on("elementMouseout.tooltip",function(e){w.tooltipHide(e)}),w.on("tooltipHide",function(){p&&e.tooltip.cleanup()}),x.dispatch=w,x.bars=t,x.legend=i,x.xAxis=n,x.yAxis=r,d3.rebind(x,t,"defined","isArea","x","y","size","xScale","yScale","xDomain","yDomain","xRange","yRange","forceX","forceY","interactive","clipEdge","clipVoronoi","id","interpolate","highlightPoint","clearHighlights","interactive"),x.options=e.utils.optionsFunc.bind(x),x.margin=function(e){return arguments.length?(s.top=typeof e.top!="undefined"?e.top:s.top,s.right=typeof e.right!="undefined"?e.right:s.right,s.bottom=typeof e.bottom!="undefined"?e.bottom:s.bottom,s.left=typeof e.left!="undefined"?e.left:s.left,x):s},x.width=function(e){return arguments.length?(u=e,x):u},x.height=function(e){return arguments.length?(a=e,x):a},x.color=function(t){return arguments.length?(o=e.utils.getColor(t),i.color(o),x):o},x.showLegend=function(e){return arguments.length?(f=e,x):f},x.showXAxis=function(e){return arguments.length?(l=e,x):l},x.showYAxis=function(e){return arguments.length?(c=e,x):c},x.rightAlignYAxis=function(e){return arguments.length?(h=e,r.orient(e?"right":"left"),x):h},x.tooltips=function(e){return arguments.length?(p=e,x):p},x.tooltipContent=function(e){return arguments.length?(d=e,x):d},x.state=function(e){return arguments.length?(g=e,x):g},x.defaultState=function(e){return arguments.length?(y=e,x):y},x.noData=function(e){return arguments.length?(b=e,x):b},x.transitionDuration=function(e){return arguments.length?(E=e,x):E},x},e.models.indentedTree=function(){function g(e){return e.each(function(e){function k(e,t,n){d3.event.stopPropagation();if(d3.event.shiftKey&&!n)return d3.event.shiftKey=!1,e.values&&e.values.forEach(function(e){(e.values||e._values)&&k(e,0,!0)}),!0;if(!O(e))return!0;e.values?(e._values=e.values,e.values=null):(e.values=e._values,e._values=null),g.update()}function L(e){return e._values&&e._values.length?h:e.values&&e.values.length?p:""}function A(e){return e._values&&e._values.length}function O(e){var t=e.values||e._values;return t&&t.length}var t=1,n=d3.select(this),i=d3.layout.tree().children(function(e){return e.values}).size([r,f]);g.update=function(){n.call(g)},e[0]||(e[0]={key:a});var s=i.nodes(e[0]),y=d3.select(this).selectAll("div").data([[s]]),b=y.enter().append("div").attr("class","nvd3 nv-wrap nv-indentedtree"),w=b.append("table"),E=y.select("table").attr("width","100%").attr("class",c);if(o){var S=w.append("thead"),x=S.append("tr");l.forEach(function(e){x.append("th").attr("width",e.width?e.width:"10%").style("text-align",e.type=="numeric"?"right":"left").append("span").text(e.label)})}var T=E.selectAll("tbody").data(function(e){return e});T.enter().append("tbody"),t=d3.max(s,function(e){return e.depth}),i.size([r,t*f]);var N=T.selectAll("tr").data(function(e){return e.filter(function(e){return u&&!e.children?u(e):!0})},function(e,t){return e.id||e.id||++m});N.exit().remove(),N.select("img.nv-treeicon").attr("src",L).classed("folded",A);var C=N.enter().append("tr");l.forEach(function(e,t){var n=C.append("td").style("padding-left",function(e){return(t?0:e.depth*f+12+(L(e)?0:16))+"px"},"important").style("text-align",e.type=="numeric"?"right":"left");t==0&&n.append("img").classed("nv-treeicon",!0).classed("nv-folded",A).attr("src",L).style("width","14px").style("height","14px").style("padding","0 1px").style("display",function(e){return L(e)?"inline-block":"none"}).on("click",k),n.each(function(n){!t&&v(n)?d3.select(this).append("a").attr("href",v).attr("class",d3.functor(e.classes)).append("span"):d3.select(this).append("span"),d3.select(this).select("span").attr("class",d3.functor(e.classes)).text(function(t){return e.format?t[e.key]?e.format(t[e.key]):"-":t[e.key]||"-"})}),e.showCount&&(n.append("span").attr("class","nv-childrenCount"),N.selectAll("span.nv-childrenCount").text(function(e){return e.values&&e.values.length||e._values&&e._values.length?"("+(e.values&&e.values.filter(function(e){return u?u(e):!0}).length||e._values&&e._values.filter(function(e){return u?u(e):!0}).length||0)+")":""}))}),N.order().on("click",function(e){d.elementClick({row:this,data:e,pos:[e.x,e.y]})}).on("dblclick",function(e){d.elementDblclick({row:this,data:e,pos:[e.x,e.y]})}).on("mouseover",function(e){d.elementMouseover({row:this,data:e,pos:[e.x,e.y]})}).on("mouseout",function(e){d.elementMouseout({row:this,data:e,pos:[e.x,e.y]})})}),g}var t={top:0,right:0,bottom:0,left:0},n=960,r=500,i=e.utils.defaultColor(),s=Math.floor(Math.random()*1e4),o=!0,u=!1,a="No Data Available.",f=20,l=[{key:"key",label:"Name",type:"text"}],c=null,h="images/grey-plus.png",p="images/grey-minus.png",d=d3.dispatch("elementClick","elementDblclick","elementMouseover","elementMouseout"),v=function(e){return e.url},m=0;return g.options=e.utils.optionsFunc.bind(g),g.margin=function(e){return arguments.length?(t.top=typeof e.top!="undefined"?e.top:t.top,t.right=typeof e.right!="undefined"?e.right:t.right,t.bottom=typeof e.bottom!="undefined"?e.bottom:t.bottom,t.left=typeof e.left!="undefined"?e.left:t.left,g):t},g.width=function(e){return arguments.length?(n=e,g):n},g.height=function(e){return arguments.length?(r=e,g):r},g.color=function(t){return arguments.length?(i=e.utils.getColor(t),scatter.color(i),g):i},g.id=function(e){return arguments.length?(s=e,g):s},g.header=function(e){return arguments.length?(o=e,g):o},g.noData=function(e){return arguments.length?(a=e,g):a},g.filterZero=function(e){return arguments.length?(u=e,g):u},g.columns=function(e){return arguments.length?(l=e,g):l},g.tableClass=function(e){return arguments.length?(c=e,g):c},g.iconOpen=function(e){return arguments.length?(h=e,g):h},g.iconClose=function(e){return arguments.length?(p=e,g):p},g.getUrl=function(e){return arguments.length?(v=e,g):v},g},e.models.legend=function(){function c(h){return h.each(function(c){var h=n-t.left-t.right,p=d3.select(this),d=p.selectAll("g.nv-legend").data([c]),v=d.enter().append("g").attr("class","nvd3 nv-legend").append("g"),m=d.select("g");d.attr("transform","translate("+t.left+","+t.top+")");var g=m.selectAll(".nv-series").data(function(e){return e}),y=g.enter().append("g").attr("class","nv-series").on("mouseover",function(e,t){l.legendMouseover(e,t)}).on("mouseout",function(e,t){l.legendMouseout(e,t)}).on("click",function(e,t){l.legendClick(e,t),a&&(f?(c.forEach(function(e){e.disabled=!0}),e.disabled=!1):(e.disabled=!e.disabled,c.every(function(e){return e.disabled})&&c.forEach(function(e){e.disabled=!1})),l.stateChange({disabled:c.map(function(e){return!!e.disabled})}))}).on("dblclick",function(e,t){l.legendDblclick(e,t),a&&(c.forEach(function(e){e.disabled=!0}),e.disabled=!1,l.stateChange({disabled:c.map(function(e){return!!e.disabled})}))});y.append("circle").style("stroke-width",2).attr("class","nv-legend-symbol").attr("r",5),y.append("text").attr("text-anchor","start").attr("class","nv-legend-text").attr("dy",".32em").attr("dx","8"),g.classed("disabled",function(e){return e.disabled}),g.exit().remove(),g.select("circle").style("fill",function(e,t){return e.color||s(e,t)}).style("stroke",function(e,t){return e.color||s(e,t)}),g.select("text").text(i);if(o){var b=[];g.each(function(t,n){var r=d3.select(this).select("text"),i;try{i=r.getComputedTextLength();if(i<=0)throw Error()}catch(s){i=e.utils.calcApproxTextWidth(r)}b.push(i+28)});var w=0,E=0,S=[];while(E<h&&w<b.length)S[w]=b[w],E+=b[w++];w===0&&(w=1);while(E>h&&w>1){S=[],w--;for(var x=0;x<b.length;x++)b[x]>(S[x%w]||0)&&(S[x%w]=b[x]);E=S.reduce(function(e,t,n,r){return e+t})}var T=[];for(var N=0,C=0;N<w;N++)T[N]=C,C+=S[N];g.attr("transform",function(e,t){return"translate("+T[t%w]+","+(5+Math.floor(t/w)*20)+")"}),u?m.attr("transform","translate("+(n-t.right-E)+","+t.top+")"):m.attr("transform","translate(0,"+t.top+")"),r=t.top+t.bottom+Math.ceil(b.length/w)*20}else{var k=5,L=5,A=0,O;g.attr("transform",function(e,r){var i=d3.select(this).select("text").node().getComputedTextLength()+28;return O=L,n<t.left+t.right+O+i&&(L=O=5,k+=20),L+=i,L>A&&(A=L),"translate("+O+","+k+")"}),m.attr("transform","translate("+(n-t.right-A)+","+t.top+")"),r=t.top+t.bottom+k+15}}),c}var t={top:5,right:0,bottom:5,left:0},n=400,r=20,i=function(e){return e.key},s=e.utils.defaultColor(),o=!0,u=!0,a=!0,f=!1,l=d3.dispatch("legendClick","legendDblclick","legendMouseover","legendMouseout","stateChange");return c.dispatch=l,c.options=e.utils.optionsFunc.bind(c),c.margin=function(e){return arguments.length?(t.top=typeof e.top!="undefined"?e.top:t.top,t.right=typeof e.right!="undefined"?e.right:t.right,t.bottom=typeof e.bottom!="undefined"?e.bottom:t.bottom,t.left=typeof e.left!="undefined"?e.left:t.left,c):t},c.width=function(e){return arguments.length?(n=e,c):n},c.height=function(e){return arguments.length?(r=e,c):r},c.key=function(e){return arguments.length?(i=e,c):i},c.color=function(t){return arguments.length?(s=e.utils.getColor(t),c):s},c.align=function(e){return arguments.length?(o=e,c):o},c.rightAlign=function(e){return arguments.length?(u=e,c):u},c.updateState=function(e){return arguments.length?(a=e,c):a},c.radioButtonMode=function(e){return arguments.length?(f=e,c):f},c},e.models.line=function(){function m(g){return g.each(function(m){var g=r-n.left-n.right,b=i-n.top-n.bottom,w=d3.select(this);c=t.xScale(),h=t.yScale(),d=d||c,v=v||h;var E=w.selectAll("g.nv-wrap.nv-line").data([m]),S=E.enter().append("g").attr("class","nvd3 nv-wrap nv-line"),T=S.append("defs"),N=S.append("g"),C=E.select("g");N.append("g").attr("class","nv-groups"),N.append("g").attr("class","nv-scatterWrap"),E.attr("transform","translate("+n.left+","+n.top+")"),t.width(g).height(b);var k=E.select(".nv-scatterWrap");k.call(t),T.append("clipPath").attr("id","nv-edge-clip-"+t.id()).append("rect"),E.select("#nv-edge-clip-"+t.id()+" rect").attr("width",g).attr("height",b>0?b:0),C.attr("clip-path",l?"url(#nv-edge-clip-"+t.id()+")":""),k.attr("clip-path",l?"url(#nv-edge-clip-"+t.id()+")":"");var L=E.select(".nv-groups").selectAll(".nv-group").data(function(e){return e},function(e){return e.key});L.enter().append("g").style("stroke-opacity",1e-6).style("fill-opacity",1e-6),L.exit().remove(),L.attr("class",function(e,t){return"nv-group nv-series-"+t}).classed("hover",function(e){return e.hover}).style("fill",function(e,t){return s(e,t)}).style("stroke",function(e,t){return s(e,t)}),L.style("stroke-opacity",1).style("fill-opacity",.5);var A=L.selectAll("path.nv-area").data(function(e){return f(e)?[e]:[]});A.enter().append("path").attr("class","nv-area").attr("d",function(t){return d3.svg.area().interpolate(p).defined(a).x(function(t,n){return e.utils.NaNtoZero(d(o(t,n)))}).y0(function(t,n){return e.utils.NaNtoZero(v(u(t,n)))}).y1(function(e,t){return v(h.domain()[0]<=0?h.domain()[1]>=0?0:h.domain()[1]:h.domain()[0])}).apply(this,[t.values])}),L.exit().selectAll("path.nv-area").remove(),A.attr("d",function(t){return d3.svg.area().interpolate(p).defined(a).x(function(t,n){return e.utils.NaNtoZero(c(o(t,n)))}).y0(function(t,n){return e.utils.NaNtoZero(h(u(t,n)))}).y1(function(e,t){return h(h.domain()[0]<=0?h.domain()[1]>=0?0:h.domain()[1]:h.domain()[0])}).apply(this,[t.values])});var O=L.selectAll("path.nv-line").data(function(e){return[e.values]});O.enter().append("path").attr("class","nv-line").attr("d",d3.svg.line().interpolate(p).defined(a).x(function(t,n){return e.utils.NaNtoZero(d(o(t,n)))}).y(function(t,n){return e.utils.NaNtoZero(v(u(t,n)))})),O.attr("d",d3.svg.line().interpolate(p).defined(a).x(function(t,n){return e.utils.NaNtoZero(c(o(t,n)))}).y(function(t,n){return e.utils.NaNtoZero(h(u(t,n)))})),d=c.copy(),v=h.copy()}),m}var t=e.models.scatter(),n={top:0,right:0,bottom:0,left:0},r=960,i=500,s=e.utils.defaultColor(),o=function(e){return e.x},u=function(e){return e.y},a=function(e,t){return!isNaN(u(e,t))&&u(e,t)!==null},f=function(e){return e.area},l=!1,c,h,p="linear";t.size(16).sizeDomain([16,256]);var d,v;return m.dispatch=t.dispatch,m.scatter=t,d3.rebind(m,t,"id","interactive","size","xScale","yScale","zScale","xDomain","yDomain","xRange","yRange","sizeDomain","forceX","forceY","forceSize","clipVoronoi","useVoronoi","clipRadius","padData","highlightPoint","clearHighlights"),m.options=e.utils.optionsFunc.bind(m),m.margin=function(e){return arguments.length?(n.top=typeof e.top!="undefined"?e.top:n.top,n.right=typeof e.right!="undefined"?e.right:n.right,n.bottom=typeof e.bottom!="undefined"?e.bottom:n.bottom,n.left=typeof e.left!="undefined"?e.left:n.left,m):n},m.width=function(e){return arguments.length?(r=e,m):r},m.height=function(e){return arguments.length?(i=e,m):i},m.x=function(e){return arguments.length?(o=e,t.x(e),m):o},m.y=function(e){return arguments.length?(u=e,t.y(e),m):u},m.clipEdge=function(e){return arguments.length?(l=e,m):l},m.color=function(n){return arguments.length?(s=e.utils.getColor(n),t.color(s),m):s},m.interpolate=function(e){return arguments.length?(p=e,m):p},m.defined=function(e){return arguments.length?(a=e,m):a},m.isArea=function(e){return arguments.length?(f=d3.functor(e),m):f},m},e.models.lineChart=function(){function N(m){return m.each(function(m){var x=d3.select(this),C=this,k=(a||parseInt(x.style("width"))||960)-o.left-o.right,L=(f||parseInt(x.style("height"))||400)-o.top-o.bottom;N.update=function(){x.call(N)},N.container=this,b.disabled=m.map(function(e){return!!e.disabled});if(!w){var A;w={};for(A in b)b[A]instanceof Array?w[A]=b[A].slice(0):w[A]=b[A]}if(!m||!m.length||!m.filter(function(e){return e.values.length}).length){var O=x.selectAll(".nv-noData").data([E]);return O.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),O.attr("x",o.left+k/2).attr("y",o.top+L/2).text(function(e){return e}),N}x.selectAll(".nv-noData").remove(),g=t.xScale(),y=t.yScale();var M=x.selectAll("g.nv-wrap.nv-lineChart").data([m]),_=M.enter().append("g").attr("class","nvd3 nv-wrap nv-lineChart").append("g"),D=M.select("g");_.append("rect").style("opacity",0),_.append("g").attr("class","nv-x nv-axis"),_.append("g").attr("class","nv-y nv-axis"),_.append("g").attr("class","nv-linesWrap"),_.append("g").attr("class","nv-legendWrap"),_.append("g").attr("class","nv-interactive"),D.select("rect").attr("width",k).attr("height",L>0?L:0),l&&(i.width(k),D.select(".nv-legendWrap").datum(m).call(i),o.top!=i.height()&&(o.top=i.height(),L=(f||parseInt(x.style("height"))||400)-o.top-o.bottom),M.select(".nv-legendWrap").attr("transform","translate(0,"+ -o.top+")")),M.attr("transform","translate("+o.left+","+o.top+")"),p&&D.select(".nv-y.nv-axis").attr("transform","translate("+k+",0)"),d&&(s.width(k).height(L).margin({left:o.left,top:o.top}).svgContainer(x).xScale(g),M.select(".nv-interactive").call(s)),t.width(k).height(L).color(m.map(function(e,t){return e.color||u(e,t)}).filter(function(e,t){return!m[t].disabled}));var P=D.select(".nv-linesWrap").datum(m.filter(function(e){return!e.disabled}));P.call(t),c&&(n.scale(g).ticks(k/100).tickSize(-L,0),D.select(".nv-x.nv-axis").attr("transform","translate(0,"+y.range()[0]+")"),D.select(".nv-x.nv-axis").call(n)),h&&(r.scale(y).ticks(L/36).tickSize(-k,0),D.select(".nv-y.nv-axis").call(r)),i.dispatch.on("stateChange",function(e){b=e,S.stateChange(b),N.update()}),s.dispatch.on("elementMousemove",function(i){t.clearHighlights();var a,f,l,c=[];m.filter(function(e,t){return e.seriesIndex=t,!e.disabled}).forEach(function(n,r){f=e.interactiveBisect(n.values,i.pointXValue,N.x()),t.highlightPoint(r,f,!0);var s=n.values[f];if(typeof s=="undefined")return;typeof a=="undefined"&&(a=s),typeof l=="undefined"&&(l=N.xScale()(N.x()(s,f))),c.push({key:n.key,value:N.y()(s,f),color:u(n,n.seriesIndex)})});if(c.length>2){var h=N.yScale().invert(i.mouseY),p=Math.abs(N.yScale().domain()[0]-N.yScale().domain()[1]),d=.03*p,g=e.nearestValueIndex(c.map(function(e){return e.value}),h,d);g!==null&&(c[g].highlight=!0)}var y=n.tickFormat()(N.x()(a,f));s.tooltip.position({left:l+o.left,top:i.mouseY+o.top}).chartContainer(C.parentNode).enabled(v).valueFormatter(function(e,t){return r.tickFormat()(e)}).data({value:y,series:c})(),s.renderGuideLine(l)}),s.dispatch.on("elementMouseout",function(e){S.tooltipHide(),t.clearHighlights()}),S.on("tooltipShow",function(e){v&&T(e,C.parentNode)}),S.on("changeState",function(e){typeof e.disabled!="undefined"&&m.length===e.disabled.length&&(m.forEach(function(t,n){t.disabled=e.disabled[n]}),b.disabled=e.disabled),N.update()})}),N}var t=e.models.line(),n=e.models.axis(),r=e.models.axis(),i=e.models.legend(),s=e.interactiveGuideline(),o={top:30,right:20,bottom:50,left:60},u=e.utils.defaultColor(),a=null,f=null,l=!0,c=!0,h=!0,p=!1,d=!1,v=!0,m=function(e,t,n,r,i){return"<h3>"+e+"</h3>"+"<p>"+n+" at "+t+"</p>"},g,y,b={},w=null,E="No Data Available.",S=d3.dispatch("tooltipShow","tooltipHide","stateChange","changeState"),x=0;n.orient("bottom").tickPadding(7),r.orient(p?"right":"left");var T=function(i,s){var o=i.pos[0]+(s.offsetLeft||0),u=i.pos[1]+(s.offsetTop||0),a=n.tickFormat()(t.x()(i.point,i.pointIndex)),f=r.tickFormat()(t.y()(i.point,i.pointIndex)),l=m(i.series.key,a,f,i,N);e.tooltip.show([o,u],l,null,null,s)};return t.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+o.left,e.pos[1]+o.top],S.tooltipShow(e)}),t.dispatch.on("elementMouseout.tooltip",function(e){S.tooltipHide(e)}),S.on("tooltipHide",function(){v&&e.tooltip.cleanup()}),N.dispatch=S,N.lines=t,N.legend=i,N.xAxis=n,N.yAxis=r,N.interactiveLayer=s,d3.rebind(N,t,"defined","isArea","x","y","size","xScale","yScale","xDomain","yDomain","xRange","yRange","forceX","forceY","interactive","clipEdge","clipVoronoi","useVoronoi","id","interpolate"),N.options=e.utils.optionsFunc.bind(N),N.margin=function(e){return arguments.length?(o.top=typeof e.top!="undefined"?e.top:o.top,o.right=typeof e.right!="undefined"?e.right:o.right,o.bottom=typeof e.bottom!="undefined"?e.bottom:o.bottom,o.left=typeof e.left!="undefined"?e.left:o.left,N):o},N.width=function(e){return arguments.length?(a=e,N):a},N.height=function(e){return arguments.length?(f=e,N):f},N.color=function(t){return arguments.length?(u=e.utils.getColor(t),i.color(u),N):u},N.showLegend=function(e){return arguments.length?(l=e,N):l},N.showXAxis=function(e){return arguments.length?(c=e,N):c},N.showYAxis=function(e){return arguments.length?(h=e,N):h},N.rightAlignYAxis=function(e){return arguments.length?(p=e,r.orient(e?"right":"left"),N):p},N.useInteractiveGuideline=function(e){return arguments.length?(d=e,e===!0&&(N.interactive(!1),N.useVoronoi(!1)),N):d},N.tooltips=function(e){return arguments.length?(v=e,N):v},N.tooltipContent=function(e){return arguments.length?(m=e,N):m},N.state=function(e){return arguments.length?(b=e,N):b},N.defaultState=function(e){return arguments.length?(w=e,N):w},N.noData=function(e){return arguments.length?(E=e,N):E},N.transitionDuration=function(e){return arguments.length?(x=e,N):x},N},e.models.linePlusBarChart=function(){function T(e){return e.each(function(e){var l=d3.select(this),c=this,v=(a||parseInt(l.style("width"))||960)-u.left-u.right,N=(f||parseInt(l.style("height"))||400)-u.top-u.bottom;T.update=function(){l.call(T)},b.disabled=e.map(function(e){return!!e.disabled});if(!w){var C;w={};for(C in b)b[C]instanceof Array?w[C]=b[C].slice(0):w[C]=b[C]}if(!e||!e.length||!e.filter(function(e){return e.values.length}).length){var k=l.selectAll(".nv-noData").data([E]);return k.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),k.attr("x",u.left+v/2).attr("y",u.top+N/2).text(function(e){return e}),T}l.selectAll(".nv-noData").remove();var L=e.filter(function(e){return!e.disabled&&e.bar}),A=e.filter(function(e){return!e.bar});m=A.filter(function(e){return!e.disabled}).length&&A.filter(function(e){return!e.disabled})[0].values.length?t.xScale():n.xScale(),g=n.yScale(),y=t.yScale();var O=d3.select(this).selectAll("g.nv-wrap.nv-linePlusBar").data([e]),M=O.enter().append("g").attr("class","nvd3 nv-wrap nv-linePlusBar").append("g"),_=O.select("g");M.append("g").attr("class","nv-x nv-axis"),M.append("g").attr("class","nv-y1 nv-axis"),M.append("g").attr("class","nv-y2 nv-axis"),M.append("g").attr("class","nv-barsWrap"),M.append("g").attr("class","nv-linesWrap"),M.append("g").attr("class","nv-legendWrap"),p&&(o.width(v/2),_.select(".nv-legendWrap").datum(e.map(function(e){return e.originalKey=e.originalKey===undefined?e.key:e.originalKey,e.key=e.originalKey+(e.bar?" (left axis)":" (right axis)"),e})).call(o),u.top!=o.height()&&(u.top=o.height(),N=(f||parseInt(l.style("height"))||400)-u.top-u.bottom),_.select(".nv-legendWrap").attr("transform","translate("+v/2+","+ -u.top+")")),O.attr("transform","translate("+u.left+","+u.top+")"),t.width(v).height(N).color(e.map(function(e,t){return e.color||h(e,t)}).filter(function(t,n){return!e[n].disabled&&!e[n].bar})),n.width(v).height(N).color(e.map(function(e,t){return e.color||h(e,t)}).filter(function(t,n){return!e[n].disabled&&e[n].bar}));var D=_.select(".nv-barsWrap").datum(L.length?L:[{values:[]}]),P=_.select(".nv-linesWrap").datum(A[0]&&!A[0].disabled?A:[{values:[]}]);d3.transition(D).call(n),d3.transition(P).call(t),r.scale(m).ticks(v/100).tickSize(-N,0),_.select(".nv-x.nv-axis").attr("transform","translate(0,"+g.range()[0]+")"),d3.transition(_.select(".nv-x.nv-axis")).call(r),i.scale(g).ticks(N/36).tickSize(-v,0),d3.transition(_.select(".nv-y1.nv-axis")).style("opacity",L.length?1:0).call(i),s.scale(y).ticks(N/36).tickSize(L.length?0:-v,0),_.select(".nv-y2.nv-axis").style("opacity",A.length?1:0).attr("transform","translate("+v+",0)"),d3.transition(_.select(".nv-y2.nv-axis")).call(s),o.dispatch.on("stateChange",function(e){b=e,S.stateChange(b),T.update()}),S.on("tooltipShow",function(e){d&&x(e,c.parentNode)}),S.on("changeState",function(t){typeof t.disabled!="undefined"&&(e.forEach(function(e,n){e.disabled=t.disabled[n]}),b.disabled=t.disabled),T.update()})}),T}var t=e.models.line(),n=e.models.historicalBar(),r=e.models.axis(),i=e.models.axis(),s=e.models.axis(),o=e.models.legend(),u={top:30,right:60,bottom:50,left:60},a=null,f=null,l=function(e){return e.x},c=function(e){return e.y},h=e.utils.defaultColor(),p=!0,d=!0,v=function(e,t,n,r,i){return"<h3>"+e+"</h3>"+"<p>"+n+" at "+t+"</p>"},m,g,y,b={},w=null,E="No Data Available.",S=d3.dispatch("tooltipShow","tooltipHide","stateChange","changeState");n.padData(!0),t.clipEdge(!1).padData(!0),r.orient("bottom").tickPadding(7).highlightZero(!1),i.orient("left"),s.orient("right");var x=function(n,o){var u=n.pos[0]+(o.offsetLeft||0),a=n.pos[1]+(o.offsetTop||0),f=r.tickFormat()(t.x()(n.point,n.pointIndex)),l=(n.series.bar?i:s).tickFormat()(t.y()(n.point,n.pointIndex)),c=v(n.series.key,f,l,n,T);e.tooltip.show([u,a],c,n.value<0?"n":"s",null,o)};return t.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+u.left,e.pos[1]+u.top],S.tooltipShow(e)}),t.dispatch.on("elementMouseout.tooltip",function(e){S.tooltipHide(e)}),n.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+u.left,e.pos[1]+u.top],S.tooltipShow(e)}),n.dispatch.on("elementMouseout.tooltip",function(e){S.tooltipHide(e)}),S.on("tooltipHide",function(){d&&e.tooltip.cleanup()}),T.dispatch=S,T.legend=o,T.lines=t,T.bars=n,T.xAxis=r,T.y1Axis=i,T.y2Axis=s,d3.rebind(T,t,"defined","size","clipVoronoi","interpolate"),T.options=e.utils.optionsFunc.bind(T),T.x=function(e){return arguments.length?(l=e,t.x(e),n.x(e),T):l},T.y=function(e){return arguments.length?(c=e,t.y(e),n.y(e),T):c},T.margin=function(e){return arguments.length?(u.top=typeof e.top!="undefined"?e.top:u.top,u.right=typeof e.right!="undefined"?e.right:u.right,u.bottom=typeof e.bottom!="undefined"?e.bottom:u.bottom,u.left=typeof e.left!="undefined"?e.left:u.left,T):u},T.width=function(e){return arguments.length?(a=e,T):a},T.height=function(e){return arguments.length?(f=e,T):f},T.color=function(t){return arguments.length?(h=e.utils.getColor(t),o.color(h),T):h},T.showLegend=function(e){return arguments.length?(p=e,T):p},T.tooltips=function(e){return arguments.length?(d=e,T):d},T.tooltipContent=function(e){return arguments.length?(v=e,T):v},T.state=function(e){return arguments.length?(b=e,T):b},T.defaultState=function(e){return arguments.length?(w=e,T):w},T.noData=function(e){return arguments.length?(E=e,T):E},T},e.models.lineWithFocusChart=function(){function k(e){return e.each(function(e){function R(e){var t=+(e=="e"),n=t?1:-1,r=O/3;return"M"+.5*n+","+r+"A6,6 0 0 "+t+" "+6.5*n+","+(r+6)+"V"+(2*r-6)+"A6,6 0 0 "+t+" "+.5*n+","+2*r+"Z"+"M"+2.5*n+","+(r+8)+"V"+(2*r-8)+"M"+4.5*n+","+(r+8)+"V"+(2*r-8)}function U(){a.empty()||a.extent(w),F.data([a.empty()?g.domain():w]).each(function(e,t){var n=g(e[0])-v.range()[0],r=v.range()[1]-g(e[1]);d3.select(this).select(".left").attr("width",n<0?0:n),d3.select(this).select(".right").attr("x",g(e[1])).attr("width",r<0?0:r)})}function z(){w=a.empty()?null:a.extent();var n=a.empty()?g.domain():a.extent();if(Math.abs(n[0]-n[1])<=1)return;T.brush({extent:n,brush:a}),U();var s=P.select(".nv-focus .nv-linesWrap").datum(e.filter(function(e){return!e.disabled}).map(function(e,r){return{key:e.key,values:e.values.filter(function(e,r){return t.x()(e,r)>=n[0]&&t.x()(e,r)<=n[1]})}}));s.call(t),P.select(".nv-focus .nv-x.nv-axis").call(r),P.select(".nv-focus .nv-y.nv-axis").call(i)}var S=d3.select(this),N=this,L=(h||parseInt(S.style("width"))||960)-f.left-f.right,A=(p||parseInt(S.style("height"))||400)-f.top-f.bottom-d,O=d-l.top-l.bottom;k.update=function(){S.call(k)},k.container=this;if(!e||!e.length||!e.filter(function(e){return e.values.length}).length){var M=S.selectAll(".nv-noData").data([x]);return M.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),M.attr("x",f.left+L/2).attr("y",f.top+A/2).text(function(e){return e}),k}S.selectAll(".nv-noData").remove(),v=t.xScale(),m=t.yScale(),g=n.xScale(),y=n.yScale();var _=S.selectAll("g.nv-wrap.nv-lineWithFocusChart").data([e]),D=_.enter().append("g").attr("class","nvd3 nv-wrap nv-lineWithFocusChart").append("g"),P=_.select("g");D.append("g").attr("class","nv-legendWrap");var H=D.append("g").attr("class","nv-focus");H.append("g").attr("class","nv-x nv-axis"),H.append("g").attr("class","nv-y nv-axis"),H.append("g").attr("class","nv-linesWrap");var B=D.append("g").attr("class","nv-context");B.append("g").attr("class","nv-x nv-axis"),B.append("g").attr("class","nv-y nv-axis"),B.append("g").attr("class","nv-linesWrap"),B.append("g").attr("class","nv-brushBackground"),B.append("g").attr("class","nv-x nv-brush"),b&&(u.width(L),P.select(".nv-legendWrap").datum(e).call(u),f.top!=u.height()&&(f.top=u.height(),A=(p||parseInt(S.style("height"))||400)-f.top-f.bottom-d),P.select(".nv-legendWrap").attr("transform","translate(0,"+ -f.top+")")),_.attr("transform","translate("+f.left+","+f.top+")"),t.width(L).height(A).color(e.map(function(e,t){return e.color||c(e,t)}).filter(function(t,n){return!e[n].disabled})),n.defined(t.defined()).width(L).height(O).color(e.map(function(e,t){return e.color||c(e,t)}).filter(function(t,n){return!e[n].disabled})),P.select(".nv-context").attr("transform","translate(0,"+(A+f.bottom+l.top)+")");var j=P.select(".nv-context .nv-linesWrap").datum(e.filter(function(e){return!e.disabled}));d3.transition(j).call(n),r.scale(v).ticks(L/100).tickSize(-A,0),i.scale(m).ticks(A/36).tickSize(-L,0),P.select(".nv-focus .nv-x.nv-axis").attr("transform","translate(0,"+A+")"),a.x(g).on("brush",function(){var e=k.transitionDuration();k.transitionDuration(0),z(),k.transitionDuration(e)}),w&&a.extent(w);var F=P.select(".nv-brushBackground").selectAll("g").data([w||a.extent()]),I=F.enter().append("g");I.append("rect").attr("class","left").attr("x",0).attr("y",0).attr("height",O),I.append("rect").attr("class","right").attr("x",0).attr("y",0).attr("height",O);var q=P.select(".nv-x.nv-brush").call(a);q.selectAll("rect").attr("height",O),q.selectAll(".resize").append("path").attr("d",R),z(),s.scale(g).ticks(L/100).tickSize(-O,0),P.select(".nv-context .nv-x.nv-axis").attr("transform","translate(0,"+y.range()[0]+")"),d3.transition(P.select(".nv-context .nv-x.nv-axis")).call(s),o.scale(y).ticks(O/36).tickSize(-L,0),d3.transition(P.select(".nv-context .nv-y.nv-axis")).call(o),P.select(".nv-context .nv-x.nv-axis").attr("transform","translate(0,"+y.range()[0]+")"),u.dispatch.on("stateChange",function(e){k.update()}),T.on("tooltipShow",function(e){E&&C(e,N.parentNode)})}),k}var t=e.models.line(),n=e.models.line(),r=e.models.axis(),i=e.models.axis(),s=e.models.axis(),o=e.models.axis(),u=e.models.legend(),a=d3.svg.brush(),f={top:30,right:30,bottom:30,left:60},l={top:0,right:30,bottom:20,left:60},c=e.utils.defaultColor(),h=null,p=null,d=100,v,m,g,y,b=!0,w=null,E=!0,S=function(e,t,n,r,i){return"<h3>"+e+"</h3>"+"<p>"+n+" at "+t+"</p>"},x="No Data Available.",T=d3.dispatch("tooltipShow","tooltipHide","brush"),N=0;t.clipEdge(!0),n.interactive(!1),r.orient("bottom").tickPadding(5),i.orient("left"),s.orient("bottom").tickPadding(5),o.orient("left");var C=function(n,s){var o=n.pos[0]+(s.offsetLeft||0),u=n.pos[1]+(s.offsetTop||0),a=r.tickFormat()(t.x()(n.point,n.pointIndex)),f=i.tickFormat()(t.y()(n.point,n.pointIndex)),l=S(n.series.key,a,f,n,k);e.tooltip.show([o,u],l,null,null,s)};return t.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+f.left,e.pos[1]+f.top],T.tooltipShow(e)}),t.dispatch.on("elementMouseout.tooltip",function(e){T.tooltipHide(e)}),T.on("tooltipHide",function(){E&&e.tooltip.cleanup()}),k.dispatch=T,k.legend=u,k.lines=t,k.lines2=n,k.xAxis=r,k.yAxis=i,k.x2Axis=s,k.y2Axis=o,d3.rebind(k,t,"defined","isArea","size","xDomain","yDomain","xRange","yRange","forceX","forceY","interactive","clipEdge","clipVoronoi","id"),k.options=e.utils.optionsFunc.bind(k),k.x=function(e){return arguments.length?(t.x(e),n.x(e),k):t.x},k.y=function(e){return arguments.length?(t.y(e),n.y(e),k):t.y},k.margin=function(e){return arguments.length?(f.top=typeof e.top!="undefined"?e.top:f.top,f.right=typeof e.right!="undefined"?e.right:f.right,f.bottom=typeof e.bottom!="undefined"?e.bottom:f.bottom,f.left=typeof e.left!="undefined"?e.left:f.left,k):f},k.margin2=function(e){return arguments.length?(l=e,k):l},k.width=function(e){return arguments.length?(h=e,k):h},k.height=function(e){return arguments.length?(p=e,k):p},k.height2=function(e){return arguments.length?(d=e,k):d},k.color=function(t){return arguments.length?(c=e.utils.getColor(t),u.color(c),k):c},k.showLegend=function(e){return arguments.length?(b=e,k):b},k.tooltips=function(e){return arguments.length?(E=e,k):E},k.tooltipContent=function(e){return arguments.length?(S=e,k):S},k.interpolate=function(e){return arguments.length?(t.interpolate(e),n.interpolate(e),k):t.interpolate()},k.noData=function(e){return arguments.length?(x=e,k):x},k.xTickFormat=function(e){return arguments.length?(r.tickFormat(e),s.tickFormat(e),k):r.tickFormat()},k.yTickFormat=function(e){return arguments.length?(i.tickFormat(e),o.tickFormat(e),k):i.tickFormat()},k.brushExtent=function(e){return arguments.length?(w=e,k):w},k.transitionDuration=function(e){return arguments.length?(N=e,k):N},k},e.models.linePlusBarWithFocusChart=function(){function B(e){return e.each(function(e){function tt(e){var t=+(e=="e"),n=t?1:-1,r=I/3;return"M"+.5*n+","+r+"A6,6 0 0 "+t+" "+6.5*n+","+(r+6)+"V"+(2*r-6)+"A6,6 0 0 "+t+" "+.5*n+","+2*r+"Z"+"M"+2.5*n+","+(r+8)+"V"+(2*r-8)+"M"+4.5*n+","+(r+8)+"V"+(2*r-8)}function nt(){h.empty()||h.extent(x),Y.data([h.empty()?k.domain():x]).each(function(e,t){var n=k(e[0])-k.range()[0],r=k.range()[1]-k(e[1]);d3.select(this).select(".left").attr("width",n<0?0:n),d3.select(this).select(".right").attr("x",k(e[1])).attr("width",r<0?0:r)})}function rt(){x=h.empty()?null:h.extent(),S=h.empty()?k.domain():h.extent(),D.brush({extent:S,brush:h}),nt(),r.width(j).height(F).color(e.map(function(e,t){return e.color||w(e,t)}).filter(function(t,n){return!e[n].disabled&&e[n].bar})),t.width(j).height(F).color(e.map(function(e,t){return e.color||w(e,t)}).filter(function(t,n){return!e[n].disabled&&!e[n].bar}));var n=$.select(".nv-focus .nv-barsWrap").datum(R.length?R.map(function(e,t){return{key:e.key,values:e.values.filter(function(e,t){return r.x()(e,t)>=S[0]&&r.x()(e,t)<=S[1]})}}):[{values:[]}]),i=$.select(".nv-focus .nv-linesWrap").datum(U[0].disabled?[{values:[]}]:U.map(function(e,n){return{key:e.key,values:e.values.filter(function(e,n){return t.x()(e,n)>=S[0]&&t.x()(e,n)<=S[1]})}}));R.length?C=r.xScale():C=t.xScale(),s.scale(C).ticks(j/100).tickSize(-F,0),s.domain([Math.ceil(S[0]),Math.floor(S[1])]),$.select(".nv-x.nv-axis").call(s),n.call(r),i.call(t),$.select(".nv-focus .nv-x.nv-axis").attr("transform","translate(0,"+L.range()[0]+")"),u.scale(L).ticks(F/36).tickSize(-j,0),$.select(".nv-focus .nv-y1.nv-axis").style("opacity",R.length?1:0),a.scale(A).ticks(F/36).tickSize(R.length?0:-j,0),$.select(".nv-focus .nv-y2.nv-axis").style("opacity",U.length?1:0).attr("transform","translate("+C.range()[1]+",0)"),$.select(".nv-focus .nv-y1.nv-axis").call(u),$.select(".nv-focus .nv-y2.nv-axis").call(a)}var N=d3.select(this),P=this,j=(v||parseInt(N.style("width"))||960)-p.left-p.right,F=(m||parseInt(N.style("height"))||400)-p.top-p.bottom-g,I=g-d.top-d.bottom;B.update=function(){N.call(B)},B.container=this;if(!e||!e.length||!e.filter(function(e){return e.values.length}).length){var q=N.selectAll(".nv-noData").data([_]);return q.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),q.attr("x",p.left+j/2).attr("y",p.top+F/2).text(function(e){return e}),B}N.selectAll(".nv-noData").remove();var R=e.filter(function(e){return!e.disabled&&e.bar}),U=e.filter(function(e){return!e.bar});C=r.xScale(),k=o.scale(),L=r.yScale(),A=t.yScale(),O=i.yScale(),M=n.yScale();var z=e.filter(function(e){return!e.disabled&&e.bar}).map(function(e){return e.values.map(function(e,t){return{x:y(e,t),y:b(e,t)}})}),W=e.filter(function(e){return!e.disabled&&!e.bar}).map(function(e){return e.values.map(function(e,t){return{x:y(e,t),y:b(e,t)}})});C.range([0,j]),k.domain(d3.extent(d3.merge(z.concat(W)),function(e){return e.x})).range([0,j]);var X=N.selectAll("g.nv-wrap.nv-linePlusBar").data([e]),V=X.enter().append("g").attr("class","nvd3 nv-wrap nv-linePlusBar").append("g"),$=X.select("g");V.append("g").attr("class","nv-legendWrap");var J=V.append("g").attr("class","nv-focus");J.append("g").attr("class","nv-x nv-axis"),J.append("g").attr("class","nv-y1 nv-axis"),J.append("g").attr("class","nv-y2 nv-axis"),J.append("g").attr("class","nv-barsWrap"),J.append("g").attr("class","nv-linesWrap");var K=V.append("g").attr("class","nv-context");K.append("g").attr("class","nv-x nv-axis"),K.append("g").attr("class","nv-y1 nv-axis"),K.append("g").attr("class","nv-y2 nv-axis"),K.append("g").attr("class","nv-barsWrap"),K.append("g").attr("class","nv-linesWrap"),K.append("g").attr("class","nv-brushBackground"),K.append("g").attr("class","nv-x nv-brush"),E&&(c.width(j/2),$.select(".nv-legendWrap").datum(e.map(function(e){return e.originalKey=e.originalKey===undefined?e.key:e.originalKey,e.key=e.originalKey+(e.bar?" (left axis)":" (right axis)"),e})).call(c),p.top!=c.height()&&(p.top=c.height(),F=(m||parseInt(N.style("height"))||400)-p.top-p.bottom-g),$.select(".nv-legendWrap").attr("transform","translate("+j/2+","+ -p.top+")")),X.attr("transform","translate("+p.left+","+p.top+")"),i.width(j).height(I).color(e.map(function(e,t){return e.color||w(e,t)}).filter(function(t,n){return!e[n].disabled&&e[n].bar})),n.width(j).height(I).color(e.map(function(e,t){return e.color||w(e,t)}).filter(function(t,n){return!e[n].disabled&&!e[n].bar}));var Q=$.select(".nv-context .nv-barsWrap").datum(R.length?R:[{values:[]}]),G=$.select(".nv-context .nv-linesWrap").datum(U[0].disabled?[{values:[]}]:U);$.select(".nv-context").attr("transform","translate(0,"+(F+p.bottom+d.top)+")"),Q.call(i),G.call(n),h.x(k).on("brush",rt),x&&h.extent(x);var Y=$.select(".nv-brushBackground").selectAll("g").data([x||h.extent()]),Z=Y.enter().append("g");Z.append("rect").attr("class","left").attr("x",0).attr("y",0).attr("height",I),Z.append("rect").attr("class","right").attr("x",0).attr("y",0).attr("height",I);var et=$.select(".nv-x.nv-brush").call(h);et.selectAll("rect").attr("height",I),et.selectAll(".resize").append("path").attr("d",tt),o.ticks(j/100).tickSize(-I,0),$.select(".nv-context .nv-x.nv-axis").attr("transform","translate(0,"+O.range()[0]+")"),$.select(".nv-context .nv-x.nv-axis").call(o),f.scale(O).ticks(I/36).tickSize(-j,0),$.select(".nv-context .nv-y1.nv-axis").style("opacity",R.length?1:0).attr("transform","translate(0,"+k.range()[0]+")"),$.select(".nv-context .nv-y1.nv-axis").call(f),l.scale(M).ticks(I/36).tickSize(R.length?0:-j,0),$.select(".nv-context .nv-y2.nv-axis").style("opacity",U.length?1:0).attr("transform","translate("+k.range()[1]+",0)"),$.select(".nv-context .nv-y2.nv-axis").call(l),c.dispatch.on("stateChange",function(e){B.update()}),D.on("tooltipShow",function(e){T&&H(e,P.parentNode)}),rt()}),B}var t=e.models.line(),n=e.models.line(),r=e.models.historicalBar(),i=e.models.historicalBar(),s=e.models.axis(),o=e.models.axis(),u=e.models.axis(),a=e.models.axis(),f=e.models.axis(),l=e.models.axis(),c=e.models.legend(),h=d3.svg.brush(),p={top:30,right:30,bottom:30,left:60},d={top:0,right:30,bottom:20,left:60},v=null,m=null,g=100,y=function(e){return e.x},b=function(e){return e.y},w=e.utils.defaultColor(),E=!0,S,x=null,T=!0,N=function(e,t,n,r,i){return"<h3>"+e+"</h3>"+"<p>"+n+" at "+t+"</p>"},C,k,L,A,O,M,_="No Data Available.",D=d3.dispatch("tooltipShow","tooltipHide","brush"),P=0;t.clipEdge(!0),n.interactive(!1),s.orient("bottom").tickPadding(5),u.orient("left"),a.orient("right"),o.orient("bottom").tickPadding(5),f.orient("left"),l.orient("right");var H=function(n,r){S&&(n.pointIndex+=Math.ceil(S[0]));var i=n.pos[0]+(r.offsetLeft||0),o=n.pos[1]+(r.offsetTop||0),f=s.tickFormat()(t.x()(n.point,n.pointIndex)),l=(n.series.bar?u:a).tickFormat()(t.y()(n.point,n.pointIndex)),c=N(n.series.key,f,l,n,B);e.tooltip.show([i,o],c,n.value<0?"n":"s",null,r)};return t.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+p.left,e.pos[1]+p.top],D.tooltipShow(e)}),t.dispatch.on("elementMouseout.tooltip",function(e){D.tooltipHide(e)}),r.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+p.left,e.pos[1]+p.top],D.tooltipShow(e)}),r.dispatch.on("elementMouseout.tooltip",function(e){D.tooltipHide(e)}),D.on("tooltipHide",function(){T&&e.tooltip.cleanup()}),B.dispatch=D,B.legend=c,B.lines=t,B.lines2=n,B.bars=r,B.bars2=i,B.xAxis=s,B.x2Axis=o,B.y1Axis=u,B.y2Axis=a,B.y3Axis=f,B.y4Axis=l,d3.rebind(B,t,"defined","size","clipVoronoi","interpolate"),B.options=e.utils.optionsFunc.bind(B),B.x=function(e){return arguments.length?(y=e,t.x(e),r.x(e),B):y},B.y=function(e){return arguments.length?(b=e,t.y(e),r.y(e),B):b},B.margin=function(e){return arguments.length?(p.top=typeof e.top!="undefined"?e.top:p.top,p.right=typeof e.right!="undefined"?e.right:p.right,p.bottom=typeof e.bottom!="undefined"?e.bottom:p.bottom,p.left=typeof e.left!="undefined"?e.left:p.left,B):p},B.width=function(e){return arguments.length?(v=e,B):v},B.height=function(e){return arguments.length?(m=e,B):m},B.color=function(t){return arguments.length?(w=e.utils.getColor(t),c.color(w),B):w},B.showLegend=function(e){return arguments.length?(E=e,B):E},B.tooltips=function(e){return arguments.length?(T=e,B):T},B.tooltipContent=function(e){return arguments.length?(N=e,B):N},B.noData=function(e){return arguments.length?(_=e,B):_},B.brushExtent=function(e){return arguments.length?(x=e,B):x},B},e.models.multiBar=function(){function C(e){return e.each(function(e){var g=n-t.left-t.right,C=r-t.top-t.bottom,k=d3.select(this);d&&e.length&&(d=[{values:e[0].values.map(function(e){return{x:e.x,y:0,series:e.series,size:.01}})}]),c&&(e=d3.layout.stack().offset(h).values(function(e){return e.values}).y(a)(!e.length&&d?d:e)),e.forEach(function(e,t){e.values.forEach(function(e){e.series=t})}),c&&e[0].values.map(function(t,n){var r=0,i=0;e.map(function(e){var t=e.values[n];t.size=Math.abs(t.y),t.y<0?(t.y1=i,i-=t.size):(t.y1=t.size+r,r+=t.size)})});var L=y&&b?[]:e.map(function(e){return e.values.map(function(e,t){return{x:u(e,t),y:a(e,t),y0:e.y0,y1:e.y1}})});i.domain(y||d3.merge(L).map(function(e){return e.x})).rangeBands(w||[0,g],S),s.domain(b||d3.extent(d3.merge(L).map(function(e){return c?e.y>0?e.y1:e.y1+e.y:e.y}).concat(f))).range(E||[C,0]),i.domain()[0]===i.domain()[1]&&(i.domain()[0]?i.domain([i.domain()[0]-i.domain()[0]*.01,i.domain()[1]+i.domain()[1]*.01]):i.domain([-1,1])),s.domain()[0]===s.domain()[1]&&(s.domain()[0]?s.domain([s.domain()[0]+s.domain()[0]*.01,s.domain()[1]-s.domain()[1]*.01]):s.domain([-1,1])),T=T||i,N=N||s;var A=k.selectAll("g.nv-wrap.nv-multibar").data([e]),O=A.enter().append("g").attr("class","nvd3 nv-wrap nv-multibar"),M=O.append("defs"),_=O.append("g"),D=A.select("g");_.append("g").attr("class","nv-groups"),A.attr("transform","translate("+t.left+","+t.top+")"),M.append("clipPath").attr("id","nv-edge-clip-"+o).append("rect"),A.select("#nv-edge-clip-"+o+" rect").attr("width",g).attr("height",C),D.attr("clip-path",l?"url(#nv-edge-clip-"+o+")":"");var P=A.select(".nv-groups").selectAll(".nv-group").data(function(e){return e},function(e,t){return t});P.enter().append("g").style("stroke-opacity",1e-6).style("fill-opacity",1e-6),P.exit().selectAll("rect.nv-bar").attr("y",function(e){return c?N(e.y0):N(0)}).attr("height",0).remove(),P.attr("class",function(e,t){return"nv-group nv-series-"+t}).classed("hover",function(e){return e.hover}).style("fill",function(e,t){return p(e,t)}).style("stroke",function(e,t){return p(e,t)}),P.style("stroke-opacity",1).style("fill-opacity",.75);var H=P.selectAll("rect.nv-bar").data(function(t){return d&&!e.length?d.values:t.values});H.exit().remove();var B=H.enter().append("rect").attr("class",function(e,t){return a(e,t)<0?"nv-bar negative":"nv-bar positive"}).attr("x",function(t,n,r){return c?0:r*i.rangeBand()/e.length}).attr("y",function(e){return N(c?e.y0:0)}).attr("height",0).attr("width",i.rangeBand()/(c?1:e.length)).attr("transform",function(e,t){return"translate("+i(u(e,t))+",0)"});H.style("fill",function(e,t,n){return p(e,n,t)}).style("stroke",function(e,t,n){return p(e,n,t)}).on("mouseover",function(t,n){d3.select(this).classed("hover",!0),x.elementMouseover({value:a(t,n),point:t,series:e[t.series],pos:[i(u(t,n))+i.rangeBand()*(c?e.length/2:t.series+.5)/e.length,s(a(t,n)+(c?t.y0:0))],pointIndex:n,seriesIndex:t.series,e:d3.event})}).on("mouseout",function(t,n){d3.select(this).classed("hover",!1),x.elementMouseout({value:a(t,n),point:t,series:e[t.series],pointIndex:n,seriesIndex:t.series,e:d3.event})}).on("click",function(t,n){x.elementClick({value:a(t,n),point:t,series:e[t.series],pos:[i(u(t,n))+i.rangeBand()*(c?e.length/2:t.series+.5)/e.length,s(a(t,n)+(c?t.y0:0))],pointIndex:n,seriesIndex:t.series,e:d3.event}),d3.event.stopPropagation()}).on("dblclick",function(t,n){x.elementDblClick({value:a(t,n),point:t,series:e[t.series],pos:[i(u(t,n))+i.rangeBand()*(c?e.length/2:t.series+.5)/e.length,s(a(t,n)+(c?t.y0:0))],pointIndex:n,seriesIndex:t.series,e:d3.event}),d3.event.stopPropagation()}),H.attr("class",function(e,t){return a(e,t)<0?"nv-bar negative":"nv-bar positive"}).attr("transform",function(e,t){return"translate("+i(u(e,t))+",0)"}),v&&(m||(m=e.map(function(){return!0})),H.style("fill",function(e,t,n){return d3.rgb(v(e,t)).darker(m.map(function(e,t){return t}).filter(function(e,t){return!m[t]})[n]).toString()}).style("stroke",function(e,t,n){return d3.rgb(v(e,t)).darker(m.map(function(e,t){return t}).filter(function(e,t){return!m[t]})[n]).toString()})),c?H.attr("y",function(e,t){return s(c?e.y1:0)}).attr("height",function(e,t){return Math.max(Math.abs(s(e.y+(c?e.y0:0))-s(c?e.y0:0)),1)}).attr("x",function(t,n){return c?0:t.series*i.rangeBand()/e.length}).attr("width",i.rangeBand()/(c?1:e.length)):H.attr("x",function(t,n){return t.series*i.rangeBand()/e.length}).attr("width",i.rangeBand()/e.length).attr("y",function(e,t){return a(e,t)<0?s(0):s(0)-s(a(e,t))<1?s(0)-1:s(a(e,t))||0}).attr("height",function(e,t){return Math.max(Math.abs(s(a(e,t))-s(0)),1)||0}),T=i.copy(),N=s.copy()}),C}var t={top:0,right:0,bottom:0,left:0},n=960,r=500,i=d3.scale.ordinal(),s=d3.scale.linear(),o=Math.floor(Math.random()*1e4),u=function(e){return e.x},a=function(e){return e.y},f=[0],l=!0,c=!1,h="zero",p=e.utils.defaultColor(),d=!1,v=null,m,g=1200,y,b,w,E,S=.1,x=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout"),T,N;return C.dispatch=x,C.options=e.utils.optionsFunc.bind(C),C.x=function(e){return arguments.length?(u=e,C):u},C.y=function(e){return arguments.length?(a=e,C):a},C.margin=function(e){return arguments.length?(t.top=typeof e.top!="undefined"?e.top:t.top,t.right=typeof e.right!="undefined"?e.right:t.right,t.bottom=typeof e.bottom!="undefined"?e.bottom:t.bottom,t.left=typeof e.left!="undefined"?e.left:t.left,C):t},C.width=function(e){return arguments.length?(n=e,C):n},C.height=function(e){return arguments.length?(r=e,C):r},C.xScale=function(e){return arguments.length?(i=e,C):i},C.yScale=function(e){return arguments.length?(s=e,C):s},C.xDomain=function(e){return arguments.length?(y=e,C):y},C.yDomain=function(e){return arguments.length?(b=e,C):b},C.xRange=function(e){return arguments.length?(w=e,C):w},C.yRange=function(e){return arguments.length?(E=e,C):E},C.forceY=function(e){return arguments.length?(f=e,C):f},C.stacked=function(e){return arguments.length?(c=e,C):c},C.stackOffset=function(e){return arguments.length?(h=e,C):h},C.clipEdge=function(e){return arguments.length?(l=e,C):l},C.color=function(t){return arguments.length?(p=e.utils.getColor(t),C):p},C.barColor=function(t){return arguments.length?(v=e.utils.getColor(t),C):v},C.disabled=function(e){return arguments.length?(m=e,C):m},C.id=function(e){return arguments.length?(o=e,C):o},C.hideable=function(e){return arguments.length?(d=e,C):d},C.delay=function(e){return arguments.length?(g=e,C):g},C.groupSpacing=function(e){return arguments.length?(S=e,C):S},C},e.models.multiBarChart=function(){function A(e){return e.each(function(e){var b=d3.select(this),k=this,O=(u||parseInt(b.style("width"))||960)-o.left-o.right,M=(a||parseInt(b.style("height"))||400)-o.top-o.bottom;A.update=function(){b.call(A)},A.container=this,S.disabled=e.map(function(e){return!!e.disabled});if(!x){var _;x={};for(_ in S)S[_]instanceof Array?x[_]=S[_].slice(0):x[_]=S[_]}if(!e||!e.length||!e.filter(function(e){return e.values.length}).length){var D=b.selectAll(".nv-noData").data([T]);return D.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),D.attr("x",o.left+O/2).attr("y",o.top+M/2).text(function(e){return e}),A}b.selectAll(".nv-noData").remove(),w=t.xScale(),E=t.yScale();var P=b.selectAll("g.nv-wrap.nv-multiBarWithLegend").data([e]),H=P.enter().append("g").attr("class","nvd3 nv-wrap nv-multiBarWithLegend").append("g"),B=P.select("g");H.append("g").attr("class","nv-x nv-axis"),H.append("g").attr("class","nv-y nv-axis"),H.append("g").attr("class","nv-barsWrap"),H.append("g").attr("class","nv-legendWrap"),H.append("g").attr("class","nv-controlsWrap"),c&&(i.width(O-C()),t.barColor()&&e.forEach(function(e,t){e.color=d3.rgb("#ccc").darker(t*1.5).toString()}),B.select(".nv-legendWrap").datum(e).call(i),o.top!=i.height()&&(o.top=i.height(),M=(a||parseInt(b.style("height"))||400)-o.top-o.bottom),B.select(".nv-legendWrap").attr("transform","translate("+C()+","+ -o.top+")"));if(l){var j=[{key:"Grouped",disabled:t.stacked()},{key:"Stacked",disabled:!t.stacked()}];s.width(C()).color(["#444","#444","#444"]),B.select(".nv-controlsWrap").datum(j).attr("transform","translate(0,"+ -o.top+")").call(s)}P.attr("transform","translate("+o.left+","+o.top+")"),d&&B.select(".nv-y.nv-axis").attr("transform","translate("+O+",0)"),t.disabled(e.map(function(e){return e.disabled})).width(O).height(M).color(e.map(function(e,t){return e.color||f(e,t)}).filter(function(t,n){return!e[n].disabled}));var F=B.select(".nv-barsWrap").datum(e.filter(function(e){return!e.disabled}));F.call(t);if(h){n.scale(w).ticks(O/100).tickSize(-M,0),B.select(".nv-x.nv-axis").attr("transform","translate(0,"+E.range()[0]+")"),B.select(".nv-x.nv-axis").call(n);var I=B.select(".nv-x.nv-axis > g").selectAll("g");I.selectAll("line, text").style("opacity",1);if(m){var q=function(e,t){return"translate("+e+","+t+")"},R=5,U=17;I.selectAll("text").attr("transform",function(e,t,n){return q(0,n%2==0?R:U)});var z=d3.selectAll(".nv-x.nv-axis .nv-wrap g g text")[0].length;B.selectAll(".nv-x.nv-axis .nv-axisMaxMin text").attr("transform",function(e,t){return q(0,t===0||z%2!==0?U:R)})}v&&I.filter(function(t,n){return n%Math.ceil(e[0].values.length/(O/100))!==0}).selectAll("text, line").style("opacity",0),g&&I.selectAll(".tick text").attr("transform","rotate("+g+" 0,0)").style("text-anchor",g>0?"start":"end"),B.select(".nv-x.nv-axis").selectAll("g.nv-axisMaxMin text").style("opacity",1)}p&&(r.scale(E).ticks(M/36).tickSize(-O,0),B.select(".nv-y.nv-axis").call(r)),i.dispatch.on("stateChange",function(e){S=e,N.stateChange(S),A.update()}),s.dispatch.on("legendClick",function(e,n){if(!e.disabled)return;j=j.map(function(e){return e.disabled=!0,e}),e.disabled=!1;switch(e.key){case"Grouped":t.stacked(!1);break;case"Stacked":t.stacked(!0)}S.stacked=t.stacked(),N.stateChange(S),A.update()}),N.on("tooltipShow",function(e){y&&L(e,k.parentNode)}),N.on("changeState",function(n){typeof n.disabled!="undefined"&&(e.forEach(function(e,t){e.disabled=n.disabled[t]}),S.disabled=n.disabled),typeof n.stacked!="undefined"&&(t.stacked(n.stacked),S.stacked=n.stacked),A.update()})}),A}var t=e.models.multiBar(),n=e.models.axis(),r=e.models.axis(),i=e.models.legend(),s=e.models.legend(),o={top:30,right:20,bottom:50,left:60},u=null,a=null,f=e.utils.defaultColor(),l=!0,c=!0,h=!0,p=!0,d=!1,v=!0,m=!1,g=0,y=!0,b=function(e,t,n,r,i){return"<h3>"+e+"</h3>"+"<p>"+n+" on "+t+"</p>"},w,E,S={stacked:!1},x=null,T="No Data Available.",N=d3.dispatch("tooltipShow","tooltipHide","stateChange","changeState"),C=function(){return l?180:0},k=0;t.stacked(!1),n.orient("bottom").tickPadding(7).highlightZero(!0).showMaxMin(!1).tickFormat(function(e){return e}),r.orient(d?"right":"left").tickFormat(d3.format(",.1f")),s.updateState(!1);var L=function(i,s){var o=i.pos[0]+(s.offsetLeft||0),u=i.pos[1]+(s.offsetTop||0),a=n.tickFormat()(t.x()(i.point,i.pointIndex)),f=r.tickFormat()(t.y()(i.point,i.pointIndex)),l=b(i.series.key,a,f,i,A);e.tooltip.show([o,u],l,i.value<0?"n":"s",null,s)};return t.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+o.left,e.pos[1]+o.top],N.tooltipShow(e)}),t.dispatch.on("elementMouseout.tooltip",function(e){N.tooltipHide(e)}),N.on("tooltipHide",function(){y&&e.tooltip.cleanup()}),A.dispatch=N,A.multibar=t,A.legend=i,A.xAxis=n,A.yAxis=r,d3.rebind(A,t,"x","y","xDomain","yDomain","xRange","yRange","forceX","forceY","clipEdge","id","stacked","stackOffset","delay","barColor","groupSpacing"),A.options=e.utils.optionsFunc.bind(A),A.margin=function(e){return arguments.length?(o.top=typeof e.top!="undefined"?e.top:o.top,o.right=typeof e.right!="undefined"?e.right:o.right,o.bottom=typeof e.bottom!="undefined"?e.bottom:o.bottom,o.left=typeof e.left!="undefined"?e.left:o.left,A):o},A.width=function(e){return arguments.length?(u=e,A):u},A.height=function(e){return arguments.length?(a=e,A):a},A.color=function(t){return arguments.length?(f=e.utils.getColor(t),i.color(f),A):f},A.showControls=function(e){return arguments.length?(l=e,A):l},A.showLegend=function(e){return arguments.length?(c=e,A):c},A.showXAxis=function(e){return arguments.length?(h=e,A):h},A.showYAxis=function(e){return arguments.length?(p=e,A):p},A.rightAlignYAxis=function(e){return arguments.length?(d=e,r.orient(e?"right":"left"),A):d},A.reduceXTicks=function(e){return arguments.length?(v=e,A):v},A.rotateLabels=function(e){return arguments.length?(g=e,A):g},A.staggerLabels=function(e){return arguments.length?(m=e,A):m},A.tooltip=function(e){return arguments.length?(b=e,A):b},A.tooltips=function(e){return arguments.length?(y=e,A):y},A.tooltipContent=function(e){return arguments.length?(b=e,A):b},A.state=function(e){return arguments.length?(S=e,A):S},A.defaultState=function(e){return arguments.length?(x=e,A):x},A.noData=function(e){return arguments.length?(T=e,A):T},A.transitionDuration=function(e){return arguments.length?(k=e,A):k},A},e.models.multiBarHorizontal=function(){function C(e){return e.each(function(e){var i=n-t.left-t.right,y=r-t.top-t.bottom,C=d3.select(this);p&&(e=d3.layout.stack().offset("zero").values(function(e){return e.values}).y(a)(e)),e.forEach(function(e,t){e.values.forEach(function(e){e.series=t})}),p&&e[0].values.map(function(t,n){var r=0,i=0;e.map(function(e){var t=e.values[n];t.size=Math.abs(t.y),t.y<0?(t.y1=i-t.size,i-=t.size):(t.y1=r,r+=t.size)})});var k=b&&w?[]:e.map(function(e){return e.values.map(function(e,t){return{x:u(e,t),y:a(e,t),y0:e.y0,y1:e.y1}})});s.domain(b||d3.merge(k).map(function(e){return e.x})).rangeBands(E||[0,y],.1),o.domain(w||d3.extent(d3.merge(k).map(function(e){return p?e.y>0?e.y1+e.y:e.y1:e.y}).concat(f))),d&&!p?o.range(S||[o.domain()[0]<0?m:0,i-(o.domain()[1]>0?m:0)]):o.range(S||[0,i]),T=T||s,N=N||d3.scale.linear().domain(o.domain()).range([o(0),o(0)]);var L=d3.select(this).selectAll("g.nv-wrap.nv-multibarHorizontal").data([e]),A=L.enter().append("g").attr("class","nvd3 nv-wrap nv-multibarHorizontal"),O=A.append("defs"),M=A.append("g"),_=L.select("g");M.append("g").attr("class","nv-groups"),L.attr("transform","translate("+t.left+","+t.top+")");var D=L.select(".nv-groups").selectAll(".nv-group").data(function(e){return e},function(e,t){return t});D.enter().append("g").style("stroke-opacity",1e-6).style("fill-opacity",1e-6),D.exit().style("stroke-opacity",1e-6).style("fill-opacity",1e-6).remove(),D.attr("class",function(e,t){return"nv-group nv-series-"+t}).classed("hover",function(e){return e.hover}).style("fill",function(e,t){return l(e,t)}).style("stroke",function(e,t){return l(e,t)}),D.style("stroke-opacity",1).style("fill-opacity",.75);var P=D.selectAll("g.nv-bar").data(function(e){return e.values});P.exit().remove();var H=P.enter().append("g").attr("transform",function(t,n,r){return"translate("+N(p?t.y0:0)+","+(p?0:r*s.rangeBand()/e.length+s(u(t,n)))+")"});H.append("rect").attr("width",0).attr("height",s.rangeBand()/(p?1:e.length)),P.on("mouseover",function(t,n){d3.select(this).classed("hover",!0),x.elementMouseover({value:a(t,n),point:t,series:e[t.series],pos:[o(a(t,n)+(p?t.y0:0)),s(u(t,n))+s.rangeBand()*(p?e.length/2:t.series+.5)/e.length],pointIndex:n,seriesIndex:t.series,e:d3.event})}).on("mouseout",function(t,n){d3.select(this).classed("hover",!1),x.elementMouseout({value:a(t,n),point:t,series:e[t.series],pointIndex:n,seriesIndex:t.series,e:d3.event})}).on("click",function(t,n){x.elementClick({value:a(t,n),point:t,series:e[t.series],pos:[s(u(t,n))+s.rangeBand()*(p?e.length/2:t.series+.5)/e.length,o(a(t,n)+(p?t.y0:0))],pointIndex:n,seriesIndex:t.series,e:d3.event}),d3.event.stopPropagation()}).on("dblclick",function(t,n){x.elementDblClick({value:a(t,n),point:t,series:e[t.series],pos:[s(u(t,n))+s.rangeBand()*(p?e.length/2:t.series+.5)/e.length,o(a(t,n)+(p?t.y0:0))],pointIndex:n,seriesIndex:t.series,e:d3.event}),d3.event.stopPropagation()}),H.append("text"),d&&!p?(P.select("text").attr("text-anchor",function(e,t){return a(e,t)<0?"end":"start"}).attr("y",s.rangeBand()/(e.length*2)).attr("dy",".32em").text(function(e,t){return g(a(e,t))}),P.select("text").attr("x",function(e,t){return a(e,t)<0?-4:o(a(e,t))-o(0)+4})):P.selectAll("text").text(""),v&&!p?(H.append("text").classed("nv-bar-label",!0),P.select("text.nv-bar-label").attr("text-anchor",function(e,t){return a(e,t)<0?"start":"end"}).attr("y",s.rangeBand()/(e.length*2)).attr("dy",".32em").text(function(e,t){return u(e,t)}),P.select("text.nv-bar-label").attr("x",function(e,t){return a(e,t)<0?o(0)-o(a(e,t))+4:-4})):P.selectAll("text.nv-bar-label").text(""),P.attr("class",function(e,t){return a(e,t)<0?"nv-bar negative":"nv-bar positive"}),c&&(h||(h=e.map(function(){return!0})),P.style("fill",function(e,t,n){return d3.rgb(c(e,t)).darker(h.map(function(e,t){return t}).filter(function(e,t){return!h[t]})[n]).toString()}).style("stroke",function(e,t,n){return d3.rgb(c(e,t)).darker(h.map(function(e,t){return t}).filter(function(e,t){return!h[t]})[n]).toString()})),p?P.attr("transform",function(e,t){return"translate("+o(e.y1)+","+s(u(e,t))+")"}).select("rect").attr("width",function(e,t){return Math.abs(o(a(e,t)+e.y0)-o(e.y0))}).attr("height",s.rangeBand()):P.attr("transform",function(t,n){return"translate("+(a(t,n)<0?o(a(t,n)):o(0))+","+(t.series*s.rangeBand()/e.length+s(u(t,n)))+")"}).select("rect").attr("height",s.rangeBand()/e.length).attr("width",function(e,t){return Math.max(Math.abs(o(a(e,t))-o(0)),1)}),T=s.copy(),N=o.copy()}),C}var t={top:0,right:0,bottom:0,left:0},n=960,r=500,i=Math.floor(Math.random()*1e4),s=d3.scale.ordinal(),o=d3.scale.linear(),u=function(e){return e.x},a=function(e){return e.y},f=[0],l=e.utils.defaultColor(),c=null,h,p=!1,d=!1,v=!1,m=60,g=d3.format(",.2f"),y=1200,b,w,E,S,x=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout"),T,N;return C.dispatch=x,C.options=e.utils.optionsFunc.bind(C),C.x=function(e){return arguments.length?(u=e,C):u},C.y=function(e){return arguments.length?(a=e,C):a},C.margin=function(e){return arguments.length?(t.top=typeof e.top!="undefined"?e.top:t.top,t.right=typeof e.right!="undefined"?e.right:t.right,t.bottom=typeof e.bottom!="undefined"?e.bottom:t.bottom,t.left=typeof e.left!="undefined"?e.left:t.left,C):t},C.width=function(e){return arguments.length?(n=e,C):n},C.height=function(e){return arguments.length?(r=e,C):r},C.xScale=function(e){return arguments.length?(s=e,C):s},C.yScale=function(e){return arguments.length?(o=e,C):o},C.xDomain=function(e){return arguments.length?(b=e,C):b},C.yDomain=function(e){return arguments.length?(w=e,C):w},C.xRange=function(e){return arguments.length?(E=e,C):E},C.yRange=function(e){return arguments.length?(S=e,C):S},C.forceY=function(e){return arguments.length?(f=e,C):f},C.stacked=function(e){return arguments.length?(p=e,C):p},C.color=function(t){return arguments.length?(l=e.utils.getColor(t),C):l},C.barColor=function(t){return arguments.length?(c=e.utils.getColor(t),C):c},C.disabled=function(e){return arguments.length?(h=e,C):h},C.id=function(e){return arguments.length?(i=e,C):i},C.delay=function(e){return arguments.length?(y=e,C):y},C.showValues=function(e){return arguments.length?(d=e,C):d},C.showBarLabels=function(e){return arguments.length?(v=e,C):v},C.valueFormat=function(e){return arguments.length?(g=e,C):g},C.valuePadding=function(e){return arguments.length?(m=e,C):m},C},e.models.multiBarHorizontalChart=function(){function C(e){return e.each(function(e){var d=d3.select(this),m=this,T=(u||parseInt(d.style("width"))||960)-o.left-o.right,k=(a||parseInt(d.style("height"))||400)-o.top-o.bottom;C.update=function(){d.call(C)},C.container=this,b.disabled=e.map(function(e){return!!e.disabled});if(!w){var L;w={};for(L in b)b[L]instanceof Array?w[L]=b[L].slice(0):w[L]=b[L]}if(!e||!e.length||!e.filter(function(e){return e.values.length}).length){var A=d.selectAll(".nv-noData").data([E]);return A.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),A.attr("x",o.left+T/2).attr("y",o.top+k/2).text(function(e){return e}),C}d.selectAll(".nv-noData").remove(),g=t.xScale(),y=t.yScale();var O=d.selectAll("g.nv-wrap.nv-multiBarHorizontalChart").data([e]),M=O.enter().append("g").attr("class","nvd3 nv-wrap nv-multiBarHorizontalChart").append("g"),_=O.select("g");M.append("g").attr("class","nv-x nv-axis"),M.append("g").attr("class","nv-y nv-axis").append("g").attr("class","nv-zeroLine").append("line"),M.append("g").attr("class","nv-barsWrap"),M.append("g").attr("class","nv-legendWrap"),M.append("g").attr("class","nv-controlsWrap"),c&&(i.width(T-x()),t.barColor()&&e.forEach(function(e,t){e.color=d3.rgb("#ccc").darker(t*1.5).toString()}),_.select(".nv-legendWrap").datum(e).call(i),o.top!=i.height()&&(o.top=i.height(),k=(a||parseInt(d.style("height"))||400)-o.top-o.bottom),_.select(".nv-legendWrap").attr("transform","translate("+x()+","+ -o.top+")"));if(l){var D=[{key:"Grouped",disabled:t.stacked()},{key:"Stacked",disabled:!t.stacked()}];s.width(x()).color(["#444","#444","#444"]),_.select(".nv-controlsWrap").datum(D).attr("transform","translate(0,"+ -o.top+")").call(s)}O.attr("transform","translate("+o.left+","+o.top+")"),t.disabled(e.map(function(e){return e.disabled})).width(T).height(k).color(e.map(function(e,t){return e.color||f(e,t)}).filter(function(t,n){return!e[n].disabled}));var P=_.select(".nv-barsWrap").datum(e.filter(function(e){return!e.disabled}));P.call(t);if(h){n.scale(g).ticks(k/24).tickSize(-T,0),_.select(".nv-x.nv-axis").call(n);var H=_.select(".nv-x.nv-axis").selectAll("g");H.selectAll("line, text")}p&&(r.scale(y).ticks(T/100).tickSize(-k,0),_.select(".nv-y.nv-axis").attr("transform","translate(0,"+k+")"),_.select(".nv-y.nv-axis").call(r)),_.select(".nv-zeroLine line").attr("x1",y(0)).attr("x2",y(0)).attr("y1",0).attr("y2",-k),i.dispatch.on("stateChange",function(e){b=e,S.stateChange(b),C.update()}),s.dispatch.on("legendClick",function(e,n){if(!e.disabled)return;D=D.map(function(e){return e.disabled=!0,e}),e.disabled=!1;switch(e.key){case"Grouped":t.stacked(!1);break;case"Stacked":t.stacked(!0)}b.stacked=t.stacked(),S.stateChange(b),C.update()}),S.on("tooltipShow",function(e){v&&N(e,m.parentNode)}),S.on("changeState",function(n){typeof n.disabled!="undefined"&&(e.forEach(function(e,t){e.disabled=n.disabled[t]}),b.disabled=n.disabled),typeof n.stacked!="undefined"&&(t.stacked(n.stacked),b.stacked=n.stacked),C.update()})}),C}var t=e.models.multiBarHorizontal(),n=e.models.axis(),r=e.models.axis(),i=e.models.legend().height(30),s=e.models.legend().height(30),o={top:30,right:20,bottom:50,left:60},u=null,a=null,f=e.utils.defaultColor(),l=!0,c=!0,h=!0,p=!0,d=!1,v=!0,m=function(e,t,n,r,i){return"<h3>"+e+" - "+t+"</h3>"+"<p>"+n+"</p>"},g,y,b={stacked:d},w=null,E="No Data Available.",S=d3.dispatch("tooltipShow","tooltipHide","stateChange","changeState"),x=function(){return l?180:0},T=0;t.stacked(d),n.orient("left").tickPadding(5).highlightZero(!1).showMaxMin(!1).tickFormat(function(e){return e}),r.orient("bottom").tickFormat(d3.format(",.1f")),s.updateState(!1);var N=function(i,s){var o=i.pos[0]+(s.offsetLeft||0),u=i.pos[1]+(s.offsetTop||0),a=n.tickFormat()(t.x()(i.point,i.pointIndex)),f=r.tickFormat()(t.y()(i.point,i.pointIndex)),l=m(i.series.key,a,f,i,C);e.tooltip.show([o,u],l,i.value<0?"e":"w",null,s)};return t.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+o.left,e.pos[1]+o.top],S.tooltipShow(e)}),t.dispatch.on("elementMouseout.tooltip",function(e){S.tooltipHide(e)}),S.on("tooltipHide",function(){v&&e.tooltip.cleanup()}),C.dispatch=S,C.multibar=t,C.legend=i,C.xAxis=n,C.yAxis=r,d3.rebind(C,t,"x","y","xDomain","yDomain","xRange","yRange","forceX","forceY","clipEdge","id","delay","showValues","showBarLabels","valueFormat","stacked","barColor"),C.options=e.utils.optionsFunc.bind(C),C.margin=function(e){return arguments.length?(o.top=typeof e.top!="undefined"?e.top:o.top,o.right=typeof e.right!="undefined"?e.right:o.right,o.bottom=typeof e.bottom!="undefined"?e.bottom:o.bottom,o.left=typeof e.left!="undefined"?e.left:o.left,C):o},C.width=function(e){return arguments.length?(u=e,C):u},C.height=function(e){return arguments.length?(a=e,C):a},C.color=function(t){return arguments.length?(f=e.utils.getColor(t),i.color(f),C):f},C.showControls=function(e){return arguments.length?(l=e,C):l},C.showLegend=function(e){return arguments.length?(c=e,C):c},C.showXAxis=function(e){return arguments.length?(h=e,C):h},C.showYAxis=function(e){return arguments.length?(p=e,C):p},C.tooltip=function(e){return arguments.length?(m=e,C):m},C.tooltips=function(e){return arguments.length?(v=e,C):v},C.tooltipContent=function(e){return arguments.length?(m=e,C):m},C.state=function(e){return arguments.length?(b=e,C):b},C.defaultState=function(e){return arguments.length?(w=e,C):w},C.noData=function(e){return arguments.length?(E=e,C):E},C.transitionDuration=function(e){return arguments.length?(T=e,C):T},C},e.models.multiChart=function(){function C(e){return e.each(function(e){var u=d3.select(this),f=this;C.update=function(){u.call(C)},C.container=this;var k=(r||parseInt(u.style("width"))||960)-t.left-t.right,L=(i||parseInt(u.style("height"))||400)-t.top-t.bottom,A=e.filter(function(e){return!e.disabled&&e.type=="line"&&e.yAxis==1}),O=e.filter(function(e){return!e.disabled&&e.type=="line"&&e.yAxis==2}),M=e.filter(function(e){return!e.disabled&&e.type=="bar"&&e.yAxis==1}),_=e.filter(function(e){return!e.disabled&&e.type=="bar"&&e.yAxis==2}),D=e.filter(function(e){return!e.disabled&&e.type=="area"&&e.yAxis==1}),P=e.filter(function(e){return!e.disabled&&e.type=="area"&&e.yAxis==2}),H=e.filter(function(e){return!e.disabled&&e.yAxis==1}).map(function(e){return e.values.map(function(e,t){return{x:e.x,y:e.y}})}),B=e.filter(function(e){return!e.disabled&&e.yAxis==2}).map(function(e){return e.values.map(function(e,t){return{x:e.x,y:e.y}})});a.domain(d3.extent(d3.merge(H.concat(B)),function(e){return e.x})).range([0,k]);var j=u.selectAll("g.wrap.multiChart").data([e]),F=j.enter().append("g").attr("class","wrap nvd3 multiChart").append("g");F.append("g").attr("class","x axis"),F.append("g").attr("class","y1 axis"),F.append("g").attr("class","y2 axis"),F.append("g").attr("class","lines1Wrap"),F.append("g").attr("class","lines2Wrap"),F.append("g").attr("class","bars1Wrap"),F.append("g").attr("class","bars2Wrap"),F.append("g").attr("class","stack1Wrap"),F.append("g").attr("class","stack2Wrap"),F.append("g").attr("class","legendWrap");var I=j.select("g");s&&(x.width(k/2),I.select(".legendWrap").datum(e.map(function(e){return e.originalKey=e.originalKey===undefined?e.key:e.originalKey,e.key=e.originalKey+(e.yAxis==1?"":" (right axis)"),e})).call(x),t.top!=x.height()&&(t.top=x.height(),L=(i||parseInt(u.style("height"))||400)-t.top-t.bottom),I.select(".legendWrap").attr("transform","translate("+k/2+","+ -t.top+")")),d.width(k).height(L).interpolate("monotone").color(e.map(function(e,t){return e.color||n[t%n.length]}).filter(function(t,n){return!e[n].disabled&&e[n].yAxis==1&&e[n].type=="line"})),v.width(k).height(L).interpolate("monotone").color(e.map(function(e,t){return e.color||n[t%n.length]}).filter(function(t,n){return!e[n].disabled&&e[n].yAxis==2&&e[n].type=="line"})),m.width(k).height(L).color(e.map(function(e,t){return e.color||n[t%n.length]}).filter(function(t,n){return!e[n].disabled&&e[n].yAxis==1&&e[n].type=="bar"})),g.width(k).height(L).color(e.map(function(e,t){return e.color||n[t%n.length]}).filter(function(t,n){return!e[n].disabled&&e[n].yAxis==2&&e[n].type=="bar"})),y.width(k).height(L).color(e.map(function(e,t){return e.color||n[t%n.length]}).filter(function(t,n){return!e[n].disabled&&e[n].yAxis==1&&e[n].type=="area"})),b.width(k).height(L).color(e.map(function(e,t){return e.color||n[t%n.length]}).filter(function(t,n){return!e[n].disabled&&e[n].yAxis==2&&e[n].type=="area"})),I.attr("transform","translate("+t.left+","+t.top+")");var q=I.select(".lines1Wrap").datum(A),R=I.select(".bars1Wrap").datum(M),U=I.select(".stack1Wrap").datum(D),z=I.select(".lines2Wrap").datum(O),W=I.select(".bars2Wrap").datum(_),X=I.select(".stack2Wrap").datum(P),V=D.length?D.map(function(e){return e.values}).reduce(function(e,t){return e.map(function(e,n){return{x:e.x,y:e.y+t[n].y}})}).concat([{x:0,y:0}]):[],$=P.length?P.map(function(e){return e.values}).reduce(function(e,t){return e.map(function(e,n){return{x:e.x,y:e.y+t[n].y}})}).concat([{x:0,y:0}]):[];h.domain(l||d3.extent(d3.merge(H).concat(V),function(e){return e.y})).range([0,L]),p.domain(c||d3.extent(d3.merge(B).concat($),function(e){return e.y})).range([0,L]),d.yDomain(h.domain()),m.yDomain(h.domain()),y.yDomain(h.domain()),v.yDomain(p.domain()),g.yDomain(p.domain()),b.yDomain(p.domain()),D.length&&d3.transition(U).call(y),P.length&&d3.transition(X).call(b),M.length&&d3.transition(R).call(m),_.length&&d3.transition(W).call(g),A.length&&d3.transition(q).call(d),O.length&&d3.transition(z).call(v),w.ticks(k/100).tickSize(-L,0),I.select(".x.axis").attr("transform","translate(0,"+L+")"),d3.transition(I.select(".x.axis")).call(w),E.ticks(L/36).tickSize(-k,0),d3.transition(I.select(".y1.axis")).call(E),S.ticks(L/36).tickSize(-k,0),d3.transition(I.select(".y2.axis")).call(S),I.select(".y2.axis").style("opacity",B.length?1:0).attr("transform","translate("+a.range()[1]+",0)"),x.dispatch.on("stateChange",function(e){C.update()}),T.on("tooltipShow",function(e){o&&N(e,f.parentNode)})}),C}var t={top:30,right:20,bottom:50,left:60},n=d3.scale.category20().range(),r=null,i=null,s=!0,o=!0,u=function(e,t,n,r,i){return"<h3>"+e+"</h3>"+"<p>"+n+" at "+t+"</p>"},a,f,l,c,a=d3.scale.linear(),h=d3.scale.linear(),p=d3.scale.linear(),d=e.models.line().yScale(h),v=e.models.line().yScale(p),m=e.models.multiBar().stacked(!1).yScale(h),g=e.models.multiBar().stacked(!1).yScale(p),y=e.models.stackedArea().yScale(h),b=e.models.stackedArea().yScale(p),w=e.models.axis().scale(a).orient("bottom").tickPadding(5),E=e.models.axis().scale(h).orient("left"),S=e.models.axis().scale(p).orient("right"),x=e.models.legend().height(30),T=d3.dispatch("tooltipShow","tooltipHide"),N=function(t,n){var r=t.pos[0]+(n.offsetLeft||0),i=t.pos[1]+(n.offsetTop||0),s=w.tickFormat()(d.x()(t.point,t.pointIndex)),o=(t.series.yAxis==2?S:E).tickFormat()(d.y()(t.point,t.pointIndex)),a=u(t.series.key,s,o,t,C);e.tooltip.show([r,i],a,undefined,undefined,n.offsetParent)};return d.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+t.left,e.pos[1]+t.top],T.tooltipShow(e)}),d.dispatch.on("elementMouseout.tooltip",function(e){T.tooltipHide(e)}),v.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+t.left,e.pos[1]+t.top],T.tooltipShow(e)}),v.dispatch.on("elementMouseout.tooltip",function(e){T.tooltipHide(e)}),m.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+t.left,e.pos[1]+t.top],T.tooltipShow(e)}),m.dispatch.on("elementMouseout.tooltip",function(e){T.tooltipHide(e)}),g.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+t.left,e.pos[1]+t.top],T.tooltipShow(e)}),g.dispatch.on("elementMouseout.tooltip",function(e){T.tooltipHide(e)}),y.dispatch.on("tooltipShow",function(e){if(!Math.round(y.y()(e.point)*100))return setTimeout(function(){d3.selectAll(".point.hover").classed("hover",!1)},0),!1;e.pos=[e.pos[0]+t.left,e.pos[1]+t.top],T.tooltipShow(e)}),y.dispatch.on("tooltipHide",function(e){T.tooltipHide(e)}),b.dispatch.on("tooltipShow",function(e){if(!Math.round(b.y()(e.point)*100))return setTimeout(function(){d3.selectAll(".point.hover").classed("hover",!1)},0),!1;e.pos=[e.pos[0]+t.left,e.pos[1]+t.top],T.tooltipShow(e)}),b.dispatch.on("tooltipHide",function(e){T.tooltipHide(e)}),d.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+t.left,e.pos[1]+t.top],T.tooltipShow(e)}),d.dispatch.on("elementMouseout.tooltip",function(e){T.tooltipHide(e)}),v.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+t.left,e.pos[1]+t.top],T.tooltipShow(e)}),v.dispatch.on("elementMouseout.tooltip",function(e){T.tooltipHide(e)}),T.on("tooltipHide",function(){o&&e.tooltip.cleanup()}),C.dispatch=T,C.lines1=d,C.lines2=v,C.bars1=m,C.bars2=g,C.stack1=y,C.stack2=b,C.xAxis=w,C.yAxis1=E,C.yAxis2=S,C.options=e.utils.optionsFunc.bind(C),C.x=function(e){return arguments.length?(getX=e,d.x(e),m.x(e),C):getX},C.y=function(e){return arguments.length?(getY=e,d.y(e),m.y(e),C):getY},C.yDomain1=function(e){return arguments.length?(l=e,C):l},C.yDomain2=function(e){return arguments.length?(c=e,C):c},C.margin=function(e){return arguments.length?(t=e,C):t},C.width=function(e){return arguments.length?(r=e,C):r},C.height=function(e){return arguments.length?(i=e,C):i},C.color=function(e){return arguments.length?(n=e,x.color(e),C):n},C.showLegend=function(e){return arguments.length?(s=e,C):s},C.tooltips=function(e){return arguments.length?(o=e,C):o},C.tooltipContent=function(e){return arguments.length?(u=e,C):u},C},e.models.ohlcBar=function(){function x(e){return e.each(function(e){var g=n-t.left-t.right,x=r-t.top-t.bottom,T=d3.select(this);s.domain(y||d3.extent(e[0].values.map(u).concat(p))),v?s.range(w||[g*.5/e[0].values.length,g*(e[0].values.length-.5)/e[0].values.length]):s.range(w||[0,g]),o.domain(b||[d3.min(e[0].values.map(h).concat(d)),d3.max(e[0].values.map(c).concat(d))]).range(E||[x,0]),s.domain()[0]===s.domain()[1]&&(s.domain()[0]?s.domain([s.domain()[0]-s.domain()[0]*.01,s.domain()[1]+s.domain()[1]*.01]):s.domain([-1,1])),o.domain()[0]===o.domain()[1]&&(o.domain()[0]?o.domain([o.domain()[0]+o.domain()[0]*.01,o.domain()[1]-o.domain()[1]*.01]):o.domain([-1,1]));var N=d3.select(this).selectAll("g.nv-wrap.nv-ohlcBar").data([e[0].values]),C=N.enter().append("g").attr("class","nvd3 nv-wrap nv-ohlcBar"),k=C.append("defs"),L=C.append("g"),A=N.select("g");L.append("g").attr("class","nv-ticks"),N.attr("transform","translate("+t.left+","+t.top+")"),T.on("click",function(e,t){S.chartClick({data:e,index:t,pos:d3.event,id:i})}),k.append("clipPath").attr("id","nv-chart-clip-path-"+i).append("rect"),N.select("#nv-chart-clip-path-"+i+" rect").attr("width",g).attr("height",x),A.attr("clip-path",m?"url(#nv-chart-clip-path-"+i+")":"");var O=N.select(".nv-ticks").selectAll(".nv-tick").data(function(e){return e});O.exit().remove();var M=O.enter().append("path").attr("class",function(e,t,n){return(f(e,t)>l(e,t)?"nv-tick negative":"nv-tick positive")+" nv-tick-"+n+"-"+t}).attr("d",function(t,n){var r=g/e[0].values.length*.9;return"m0,0l0,"+(o(f(t,n))-o(c(t,n)))+"l"+ -r/2+",0l"+r/2+",0l0,"+(o(h(t,n))-o(f(t,n)))+"l0,"+(o(l(t,n))-o(h(t,n)))+"l"+r/2+",0l"+ -r/2+",0z"}).attr("transform",function(e,t){return"translate("+s(u(e,t))+","+o(c(e,t))+")"}).on("mouseover",function(t,n){d3.select(this).classed("hover",!0),S.elementMouseover({point:t,series:e[0],pos:[s(u(t,n)),o(a(t,n))],pointIndex:n,seriesIndex:0,e:d3.event})}).on("mouseout",function(t,n){d3.select(this).classed("hover",!1),S.elementMouseout({point:t,series:e[0],pointIndex:n,seriesIndex:0,e:d3.event})}).on("click",function(e,t){S.elementClick({value:a(e,t),data:e,index:t,pos:[s(u(e,t)),o(a(e,t))],e:d3.event,id:i}),d3.event.stopPropagation()}).on("dblclick",function(e,t){S.elementDblClick({value:a(e,t),data:e,index:t,pos:[s(u(e,t)),o(a(e,t))],e:d3.event,id:i}),d3.event.stopPropagation()});O.attr("class",function(e,t,n){return(f(e,t)>l(e,t)?"nv-tick negative":"nv-tick positive")+" nv-tick-"+n+"-"+t}),d3.transition(O).attr("transform",function(e,t){return"translate("+s(u(e,t))+","+o(c(e,t))+")"}).attr("d",function(t,n){var r=g/e[0].values.length*.9;return"m0,0l0,"+(o(f(t,n))-o(c(t,n)))+"l"+ -r/2+",0l"+r/2+",0l0,"+(o(h(t,n))-o(f(t,n)))+"l0,"+(o(l(t,n))-o(h(t,n)))+"l"+r/2+",0l"+ -r/2+",0z"})}),x}var t={top:0,right:0,bottom:0,left:0},n=960,r=500,i=Math.floor(Math.random()*1e4),s=d3.scale.linear(),o=d3.scale.linear(),u=function(e){return e.x},a=function(e){return e.y},f=function(e){return e.open},l=function(e){return e.close},c=function(e){return e.high},h=function(e){return e.low},p=[],d=[],v=!1,m=!0,g=e.utils.defaultColor(),y,b,w,E,S=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout");return x.dispatch=S,x.options=e.utils.optionsFunc.bind(x),x.x=function(e){return arguments.length?(u=e,x):u},x.y=function(e){return arguments.length?(a=e,x):a},x.open=function(e){return arguments.length?(f=e,x):f},x.close=function(e){return arguments.length?(l=e,x):l},x.high=function(e){return arguments.length?(c=e,x):c},x.low=function(e){return arguments.length?(h=e,x):h},x.margin=function(e){return arguments.length?(t.top=typeof e.top!="undefined"?e.top:t.top,t.right=typeof e.right!="undefined"?e.right:t.right,t.bottom=typeof e.bottom!="undefined"?e.bottom:t.bottom,t.left=typeof e.left!="undefined"?e.left:t.left,x):t},x.width=function(e){return arguments.length?(n=e,x):n},x.height=function(e){return arguments.length?(r=e,x):r},x.xScale=function(e){return arguments.length?(s=e,x):s},x.yScale=function(e){return arguments.length?(o=e,x):o},x.xDomain=function(e){return arguments.length?(y=e,x):y},x.yDomain=function(e){return arguments.length?(b=e,x):b},x.xRange=function(e){return arguments.length?(w=e,x):w},x.yRange=function(e){return arguments.length?(E=e,x):E},x.forceX=function(e){return arguments.length?(p=e,x):p},x.forceY=function(e){return arguments.length?(d=e,x):d},x.padData=function(e){return arguments.length?(v=e,x):v},x.clipEdge=function(e){return arguments.length?(m=e,x):m},x.color=function(t){return arguments.length?(g=e.utils.getColor(t),x):g},x.id=function(e){return arguments.length?(i=e,x):i},x},e.models.pie=function(){function S(e){return e.each(function(e){function q(e){var t=(e.startAngle+e.endAngle)*90/Math.PI-90;return t>90?t-180:t}function R(e){e.endAngle=isNaN(e.endAngle)?0:e.endAngle,e.startAngle=isNaN(e.startAngle)?0:e.startAngle,m||(e.innerRadius=0);var t=d3.interpolate(this._current,e);return this._current=t(0),function(e){return A(t(e))}}function U(e){e.innerRadius=0;var t=d3.interpolate({startAngle:0,endAngle:0},e);return function(e){return A(t(e))}}var o=n-t.left-t.right,f=r-t.top-t.bottom,S=Math.min(o,f)/2,x=S-S/5,T=d3.select(this),N=T.selectAll(".nv-wrap.nv-pie").data(e),C=N.enter().append("g").attr("class","nvd3 nv-wrap nv-pie nv-chart-"+u),k=C.append("g"),L=N.select("g");k.append("g").attr("class","nv-pie"),k.append("g").attr("class","nv-pieLabels"),N.attr("transform","translate("+t.left+","+t.top+")"),L.select(".nv-pie").attr("transform","translate("+o/2+","+f/2+")"),L.select(".nv-pieLabels").attr("transform","translate("+o/2+","+f/2+")"),T.on("click",function(e,t){E.chartClick({data:e,index:t,pos:d3.event,id:u})});var A=d3.svg.arc().outerRadius(x);y&&A.startAngle(y),b&&A.endAngle(b),m&&A.innerRadius(S*w);var O=d3.layout.pie().sort(null).value(function(e){return e.disabled?0:s(e)}),M=N.select(".nv-pie").selectAll(".nv-slice").data(O),_=N.select(".nv-pieLabels").selectAll(".nv-label").data(O);M.exit().remove(),_.exit().remove();var D=M.enter().append("g").attr("class","nv-slice").on("mouseover",function(e,t){d3.select(this).classed("hover",!0),E.elementMouseover({label:i(e.data),value:s(e.data),point:e.data,pointIndex:t,pos:[d3.event.pageX,d3.event.pageY],id:u})}).on("mouseout",function(e,t){d3.select(this).classed("hover",!1),E.elementMouseout({label:i(e.data),value:s(e.data),point:e.data,index:t,id:u})}).on("click",function(e,t){E.elementClick({label:i(e.data),value:s(e.data),point:e.data,index:t,pos:d3.event,id:u}),d3.event.stopPropagation()}).on("dblclick",function(e,t){E.elementDblClick({label:i(e.data),value:s(e.data),point:e.data,index:t,pos:d3.event,id:u}),d3.event.stopPropagation()});M.attr("fill",function(e,t){return a(e,t)}).attr("stroke",function(e,t){return a(e,t)});var P=D.append("path").each(function(e){this._current=e});M.select("path").attr("d",A);if(l){var H=d3.svg.arc().innerRadius(0);c&&(H=A),h&&(H=d3.svg.arc().outerRadius(A.outerRadius())),_.enter().append("g").classed("nv-label",!0).each(function(e,t){var n=d3.select(this);n.attr("transform",function(e){if(g){e.outerRadius=x+10,e.innerRadius=x+15;var t=(e.startAngle+e.endAngle)/2*(180/Math.PI);return(e.startAngle+e.endAngle)/2<Math.PI?t-=90:t+=90,"translate("+H.centroid(e)+") rotate("+t+")"}return e.outerRadius=S+10,e.innerRadius=S+15,"translate("+H.centroid(e)+")"}),n.append("rect").style("stroke","#fff").style("fill","#fff").attr("rx",3).attr("ry",3),n.append("text").style("text-anchor",g?(e.startAngle+e.endAngle)/2<Math.PI?"start":"end":"middle").style("fill","#000")});var B={},j=14,F=140,I=function(e){return Math.floor(e[0]/F)*F+","+Math.floor(e[1]/j)*j};_.attr("transform",function(e){if(g){e.outerRadius=x+10,e.innerRadius=x+15;var t=(e.startAngle+e.endAngle)/2*(180/Math.PI);return(e.startAngle+e.endAngle)/2<Math.PI?t-=90:t+=90,"translate("+H.centroid(e)+") rotate("+t+")"}e.outerRadius=S+10,e.innerRadius=S+15;var n=H.centroid(e),r=I(n);return B[r]&&(n[1]-=j),B[I(n)]=!0,"translate("+n+")"}),_.select(".nv-label text").style("text-anchor",g?(d.startAngle+d.endAngle)/2<Math.PI?"start":"end":"middle").text(function(e,t){var n=(e.endAngle-e.startAngle)/(2*Math.PI),r={key:i(e.data),value:s(e.data),percent:d3.format("%")(n)};return e.value&&n>v?r[p]:""})}}),S}var t={top:0,right:0,bottom:0,left:0},n=500,r=500,i=function(e){return e.x},s=function(e){return e.y},o=function(e){return e.description},u=Math.floor(Math.random()*1e4),a=e.utils.defaultColor(),f=d3.format(",.2f"),l=!0,c=!0,h=!1,p="key",v=.02,m=!1,g=!1,y=!1,b=!1,w=.5,E=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout");return S.dispatch=E,S.options=e.utils.optionsFunc.bind(S),S.margin=function(e){return arguments.length?(t.top=typeof e.top!="undefined"?e.top:t.top,t.right=typeof e.right!="undefined"?e.right:t.right,t.bottom=typeof e.bottom!="undefined"?e.bottom:t.bottom,t.left=typeof e.left!="undefined"?e.left:t.left,S):t},S.width=function(e){return arguments.length?(n=e,S):n},S.height=function(e){return arguments.length?(r=e,S):r},S.values=function(t){return e.log("pie.values() is no longer supported."),S},S.x=function(e){return arguments.length?(i=e,S):i},S.y=function(e){return arguments.length?(s=d3.functor(e),S):s},S.description=function(e){return arguments.length?(o=e,S):o},S.showLabels=function(e){return arguments.length?(l=e,S):l},S.labelSunbeamLayout=function(e){return arguments.length?(g=e,S):g},S.donutLabelsOutside=function(e){return arguments.length?(h=e,S):h},S.pieLabelsOutside=function(e){return arguments.length?(c=e,S):c},S.labelType=function(e){return arguments.length?(p=e,p=p||"key",S):p},S.donut=function(e){return arguments.length?(m=e,S):m},S.donutRatio=function(e){return arguments.length?(w=e,S):w},S.startAngle=function(e){return arguments.length?(y=e,S):y},S.endAngle=function(e){return arguments.length?(b=e,S):b},S.id=function(e){return arguments.length?(u=e,S):u},S.color=function(t){return arguments.length?(a=e.utils.getColor(t),S):a},S.valueFormat=function(e){return arguments.length?(f=e,S):f},S.labelThreshold=function(e){return arguments.length?(v=e,S):v},S},e.models.pieChart=function(){function v(e){return e.each(function(e){var u=d3.select(this),a=this,f=(i||parseInt(u.style("width"))||960)-r.left-r.right,d=(s||parseInt(u.style("height"))||400)-r.top-r.bottom;v.update=function(){u.call(v)},v.container=this,l.disabled=e.map(function(e){return!!e.disabled});if(!c){var m;c={};for(m in l)l[m]instanceof Array?c[m]=l[m].slice(0):c[m]=l[m]}if(!e||!e.length){var g=u.selectAll(".nv-noData").data([h]);return g.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),g.attr("x",r.left+f/2).attr("y",r.top+d/2).text(function(e){return e}),v}u.selectAll(".nv-noData").remove();var y=u.selectAll("g.nv-wrap.nv-pieChart").data([e]),b=y.enter().append("g").attr("class","nvd3 nv-wrap nv-pieChart").append("g"),w=y.select("g");b.append("g").attr("class","nv-pieWrap"),b.append("g").attr("class","nv-legendWrap"),o&&(n.width(f).key(t.x()),y.select(".nv-legendWrap").datum(e).call(n),r.top!=n.height()&&(r.top=n.height(),d=(s||parseInt(u.style("height"))||400)-r.top-r.bottom),y.select(".nv-legendWrap").attr("transform","translate(0,"+ -r.top+")")),y.attr("transform","translate("+r.left+","+r.top+")"),t.width(f).height(d);var E=w.select(".nv-pieWrap").datum([e]);d3.transition(E).call(t),n.dispatch.on("stateChange",function(e){l=e,p.stateChange(l),v.update()}),t.dispatch.on("elementMouseout.tooltip",function(e){p.tooltipHide(e)}),p.on("changeState",function(t){typeof t.disabled!="undefined"&&(e.forEach(function(e,n){e.disabled=t.disabled[n]}),l.disabled=t.disabled),v.update()})}),v}var t=e.models.pie(),n=e.models.legend(),r={top:30,right:20,bottom:20,left:20},i=null,s=null,o=!0,u=e.utils.defaultColor(),a=!0,f=function(e,t,n,r){return"<h3>"+e+"</h3>"+"<p>"+t+"</p>"},l={},c=null,h="No Data Available.",p=d3.dispatch("tooltipShow","tooltipHide","stateChange","changeState"),d=function(n,r){var i=t.description()(n.point)||t.x()(n.point),s=n.pos[0]+(r&&r.offsetLeft||0),o=n.pos[1]+(r&&r.offsetTop||0),u=t.valueFormat()(t.y()(n.point)),a=f(i,u,n,v);e.tooltip.show([s,o],a,n.value<0?"n":"s",null,r)};return t.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+r.left,e.pos[1]+r.top],p.tooltipShow(e)}),p.on("tooltipShow",function(e){a&&d(e)}),p.on("tooltipHide",function(){a&&e.tooltip.cleanup()}),v.legend=n,v.dispatch=p,v.pie=t,d3.rebind(v,t,"valueFormat","values","x","y","description","id","showLabels","donutLabelsOutside","pieLabelsOutside","labelType","donut","donutRatio","labelThreshold"),v.options=e.utils.optionsFunc.bind(v),v.margin=function(e){return arguments.length?(r.top=typeof e.top!="undefined"?e.top:r.top,r.right=typeof e.right!="undefined"?e.right:r.right,r.bottom=typeof e.bottom!="undefined"?e.bottom:r.bottom,r.left=typeof e.left!="undefined"?e.left:r.left,v):r},v.width=function(e){return arguments.length?(i=e,v):i},v.height=function(e){return arguments.length?(s=e,v):s},v.color=function(r){return arguments.length?(u=e.utils.getColor(r),n.color(u),t.color(u),v):u},v.showLegend=function(e){return arguments.length?(o=e,v):o},v.tooltips=function(e){return arguments.length?(a=e,v):a},v.tooltipContent=function(e){return arguments.length?(f=e,v):f},v.state=function(e){return arguments.length?(l=e,v):l},v.defaultState=function(e){return arguments.length?(c=e,v):c},v.noData=function(e){return arguments.length?(h=e,v):h},v},e.models.scatter=function(){function I(q){return q.each(function(I){function Q(){if(!g)return!1;var e,i=d3.merge(I.map(function(e,t){return e.values.map(function(e,n){var r=f(e,n),i=l(e,n);return[o(r),u(i),t,n,e]}).filter(function(e,t){return b(e[4],t)})}));if(D===!0){if(x){var a=X.select("defs").selectAll(".nv-point-clips").data([s]).enter();a.append("clipPath").attr("class","nv-point-clips").attr("id","nv-points-clip-"+s);var c=X.select("#nv-points-clip-"+s).selectAll("circle").data(i);c.enter().append("circle").attr("r",T),c.exit().remove(),c.attr("cx",function(e){return e[0]}).attr("cy",function(e){return e[1]}),X.select(".nv-point-paths").attr("clip-path","url(#nv-points-clip-"+s+")")}i.length&&(i.push([o.range()[0]-20,u.range()[0]-20,null,null]),i.push([o.range()[1]+20,u.range()[1]+20,null,null]),i.push([o.range()[0]-20,u.range()[0]+20,null,null]),i.push([o.range()[1]+20,u.range()[1]-20,null,null]));var h=d3.geom.polygon([[-10,-10],[-10,r+10],[n+10,r+10],[n+10,-10]]),p=1e-6;i=i.sort(function(e,t){return e[0]-t[0]||e[1]-t[1]});for(var d=0;d<i.length-1;)Math.abs(i[d][0]-i[d+1][0])<p&&Math.abs(i[d][1]-i[d+1][1])<p?i.splice(d+1,1):d++;var v=d3.geom.voronoi(i).map(function(e,t){return{data:h.clip(e),series:i[t][2],point:i[t][3]}}),m=X.select(".nv-point-paths").selectAll("path").data(v);m.enter().append("path").attr("class",function(e,t){return"nv-path-"+t}),m.exit().remove(),m.attr("d",function(e){return!e||!e.data||e.data.length===0?"M 0 0":"M"+e.data.join("L")+"Z"});var y=function(e,n){if(F)return 0;var r=I[e.series];if(typeof r=="undefined")return;var i=r.values[e.point];n({point:i,series:r,pos:[o(f(i,e.point))+t.left,u(l(i,e.point))+t.top],seriesIndex:e.series,pointIndex:e.point})};m.on("click",function(e){y(e,_.elementClick)}).on("mouseover",function(e){y(e,_.elementMouseover)}).on("mouseout",function(e,t){y(e,_.elementMouseout)})}else X.select(".nv-groups").selectAll(".nv-group").selectAll(".nv-point").on("click",function(e,n){if(F||!I[e.series])return 0;var r=I[e.series],i=r.values[n];_.elementClick({point:i,series:r,pos:[o(f(i,n))+t.left,u(l(i,n))+t.top],seriesIndex:e.series,pointIndex:n})}).on("mouseover",function(e,n){if(F||!I[e.series])return 0;var r=I[e.series],i=r.values[n];_.elementMouseover({point:i,series:r,pos:[o(f(i,n))+t.left,u(l(i,n))+t.top],seriesIndex:e.series,pointIndex:n})}).on("mouseout",function(e,t){if(F||!I[e.series])return 0;var n=I[e.series],r=n.values[t];_.elementMouseout({point:r,series:n,seriesIndex:e.series,pointIndex:t})});F=!1}var q=n-t.left-t.right,R=r-t.top-t.bottom,U=d3.select(this);I.forEach(function(e,t){e.values.forEach(function(e){e.series=t})});var W=N&&C&&A?[]:d3.merge(I.map(function(e){return e.values.map(function(e,t){return{x:f(e,t),y:l(e,t),size:c(e,t)}})}));o.domain(N||d3.extent(W.map(function(e){return e.x}).concat(d))),w&&I[0]?o.range(k||[(q*E+q)/(2*I[0].values.length),q-q*(1+E)/(2*I[0].values.length)]):o.range(k||[0,q]),u.domain(C||d3.extent(W.map(function(e){return e.y}).concat(v))).range(L||[R,0]),a.domain(A||d3.extent(W.map(function(e){return e.size}).concat(m))).range(O||[16,256]);if(o.domain()[0]===o.domain()[1]||u.domain()[0]===u.domain()[1])M=!0;o.domain()[0]===o.domain()[1]&&(o.domain()[0]?o.domain([o.domain()[0]-o.domain()[0]*.01,o.domain()[1]+o.domain()[1]*.01]):o.domain([-1,1])),u.domain()[0]===u.domain()[1]&&(u.domain()[0]?u.domain([u.domain()[0]-u.domain()[0]*.01,u.domain()[1]+u.domain()[1]*.01]):u.domain([-1,1])),isNaN(o.domain()[0])&&o.domain([-1,1]),isNaN(u.domain()[0])&&u.domain([-1,1]),P=P||o,H=H||u,B=B||a;var X=U.selectAll("g.nv-wrap.nv-scatter").data([I]),V=X.enter().append("g").attr("class","nvd3 nv-wrap nv-scatter nv-chart-"+s+(M?" nv-single-point":"")),$=V.append("defs"),J=V.append("g"),K=X.select("g");J.append("g").attr("class","nv-groups"),J.append("g").attr("class","nv-point-paths"),X.attr("transform","translate("+t.left+","+t.top+")"),$.append("clipPath").attr("id","nv-edge-clip-"+s).append("rect"),X.select("#nv-edge-clip-"+s+" rect").attr("width",q).attr("height",R>0?R:0),K.attr("clip-path",S?"url(#nv-edge-clip-"+s+")":""),F=!0;var G=X.select(".nv-groups").selectAll(".nv-group").data(function(e){return e},function(e){return e.key});G.enter().append("g").style("stroke-opacity",1e-6).style("fill-opacity",1e-6),G.exit().remove(),G.attr("class",function(e,t){return"nv-group nv-series-"+t}).classed("hover",function(e){return e.hover}),G.style("fill",function(e,t){return i(e,t)}).style("stroke",function(e,t){return i(e,t)}).style("stroke-opacity",1).style("fill-opacity",.5);if(p){var Y=G.selectAll("circle.nv-point").data(function(e){return e.values},y);Y.enter().append("circle").style("fill",function(e,t){return e.color}).style("stroke",function(e,t){return e.color}).attr("cx",function(t,n){return e.utils.NaNtoZero(P(f(t,n)))}).attr("cy",function(t,n){return e.utils.NaNtoZero(H(l(t,n)))}).attr("r",function(e,t){return Math.sqrt(a(c(e,t))/Math.PI)}),Y.exit().remove(),G.exit().selectAll("path.nv-point").attr("cx",function(t,n){return e.utils.NaNtoZero(o(f(t,n)))}).attr("cy",function(t,n){return e.utils.NaNtoZero(u(l(t,n)))}).remove(),Y.each(function(e,t){d3.select(this).classed("nv-point",!0).classed("nv-point-"+t,!0).classed("hover",!1)}),Y.attr("cx",function(t,n){return e.utils.NaNtoZero(o(f(t,n)))}).attr("cy",function(t,n){return e.utils.NaNtoZero(u(l(t,n)))}).attr("r",function(e,t){return Math.sqrt(a(c(e,t))/Math.PI)})}else{var Y=G.selectAll("path.nv-point").data(function(e){return e.values});Y.enter().append("path").style("fill",function(e,t){return e.color}).style("stroke",function(e,t){return e.color}).attr("transform",function(e,t){return"translate("+P(f(e,t))+","+H(l(e,t))+")"}).attr("d",d3.svg.symbol().type(h).size(function(e,t){return a(c(e,t))})),Y.exit().remove(),G.exit().selectAll("path.nv-point").attr("transform",function(e,t){return"translate("+o(f(e,t))+","+u(l(e,t))+")"}).remove(),Y.each(function(e,t){d3.select(this).classed("nv-point",!0).classed("nv-point-"+t,!0).classed("hover",!1)}),Y.attr("transform",function(e,t){return"translate("+o(f(e,t))+","+u(l(e,t))+")"}).attr("d",d3.svg.symbol().type(h).size(function(e,t){return a(c(e,t))}))}clearTimeout(j),j=setTimeout(Q,300),P=o.copy(),H=u.copy(),B=a.copy()}),I}var t={top:0,right:0,bottom:0,left:0},n=960,r=500,i=e.utils.defaultColor(),s=Math.floor(Math.random()*1e5),o=d3.scale.linear(),u=d3.scale.linear(),a=d3.scale.linear(),f=function(e){return e.x},l=function(e){return e.y},c=function(e){return e.size||1},h=function(e){return e.shape||"circle"},p=!0,d=[],v=[],m=[],g=!0,y=null,b=function(e){return!e.notActive},w=!1,E=.1,S=!1,x=!0,T=function(){return 25},N=null,C=null,k=null,L=null,A=null,O=null,M=!1,_=d3.dispatch("elementClick","elementMouseover","elementMouseout"),D=!0,P,H,B,j,F=!1;return I.clearHighlights=function(){d3.selectAll(".nv-chart-"+s+" .nv-point.hover").classed("hover",!1)},I.highlightPoint=function(e,t,n){d3.select(".nv-chart-"+s+" .nv-series-"+e+" .nv-point-"+t).classed("hover",n)},_.on("elementMouseover.point",function(e){g&&I.highlightPoint(e.seriesIndex,e.pointIndex,!0)}),_.on("elementMouseout.point",function(e){g&&I.highlightPoint(e.seriesIndex,e.pointIndex,!1)}),I.dispatch=_,I.options=e.utils.optionsFunc.bind(I),I.x=function(e){return arguments.length?(f=d3.functor(e),I):f},I.y=function(e){return arguments.length?(l=d3.functor(e),I):l},I.size=function(e){return arguments.length?(c=d3.functor(e),I):c},I.margin=function(e){return arguments.length?(t.top=typeof e.top!="undefined"?e.top:t.top,t.right=typeof e.right!="undefined"?e.right:t.right,t.bottom=typeof e.bottom!="undefined"?e.bottom:t.bottom,t.left=typeof e.left!="undefined"?e.left:t.left,I):t},I.width=function(e){return arguments.length?(n=e,I):n},I.height=function(e){return arguments.length?(r=e,I):r},I.xScale=function(e){return arguments.length?(o=e,I):o},I.yScale=function(e){return arguments.length?(u=e,I):u},I.zScale=function(e){return arguments.length?(a=e,I):a},I.xDomain=function(e){return arguments.length?(N=e,I):N},I.yDomain=function(e){return arguments.length?(C=e,I):C},I.sizeDomain=function(e){return arguments.length?(A=e,I):A},I.xRange=function(e){return arguments.length?(k=e,I):k},I.yRange=function(e){return arguments.length?(L=e,I):L},I.sizeRange=function(e){return arguments.length?(O=e,I):O},I.forceX=function(e){return arguments.length?(d=e,I):d},I.forceY=function(e){return arguments.length?(v=e,I):v},I.forceSize=function(e){return arguments.length?(m=e,I):m},I.interactive=function(e){return arguments.length?(g=e,I):g},I.pointKey=function(e){return arguments.length?(y=e,I):y},I.pointActive=function(e){return arguments.length?(b=e,I):b},I.padData=function(e){return arguments.length?(w=e,I):w},I.padDataOuter=function(e){return arguments.length?(E=e,I):E},I.clipEdge=function(e){return arguments.length?(S=e,I):S},I.clipVoronoi=function(e){return arguments.length?(x=e,I):x},I.useVoronoi=function(e){return arguments.length?(D=e,D===!1&&(x=!1),I):D},I.clipRadius=function(e){return arguments.length?(T=e,I):T},I.color=function(t){return arguments.length?(i=e.utils.getColor(t),I):i},I.shape=function(e){return arguments.length?(h=e,I):h},I.onlyCircles=function(e){return arguments.length?(p=e,I):p},I.id=function(e){return arguments.length?(s=e,I):s},I.singlePoint=function(e){return arguments.length?(M=e,I):M},I},e.models.scatterChart=function(){function F(e){return e.each(function(e){function J(){if(T)return W.select(".nv-point-paths").style("pointer-events","all"),!1;W.select(".nv-point-paths").style("pointer-events","none");var i=d3.mouse(this);h.distortion(x).focus(i[0]),p.distortion(x).focus(i[1]),W.select(".nv-scatterWrap").call(t),b&&W.select(".nv-x.nv-axis").call(n),w&&W.select(".nv-y.nv-axis").call(r),W.select(".nv-distributionX").datum(e.filter(function(e){return!e.disabled})).call(o),W.select(".nv-distributionY").datum(e.filter(function(e){return!e.disabled})).call(u)}var C=d3.select(this),k=this,L=(f||parseInt(C.style("width"))||960)-a.left-a.right,D=(l||parseInt(C.style("height"))||400)-a.top-a.bottom;F.update=function(){C.call(F)},F.container=this,A.disabled=e.map(function(e){return!!e.disabled});if(!O){var I;O={};for(I in A)A[I]instanceof Array?O[I]=A[I].slice(0):O[I]=A[I]}if(!e||!e.length||!e.filter(function(e){return e.values.length}).length){var q=C.selectAll(".nv-noData").data([_]);return q.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),q.attr("x",a.left+L/2).attr("y",a.top+D/2).text(function(e){return e}),F}C.selectAll(".nv-noData").remove(),P=P||h,H=H||p;var R=C.selectAll("g.nv-wrap.nv-scatterChart").data([e]),U=R.enter().append("g").attr("class","nvd3 nv-wrap nv-scatterChart nv-chart-"+t.id()),z=U.append("g"),W=R.select("g");z.append("rect").attr("class","nvd3 nv-background"),z.append("g").attr("class","nv-x nv-axis"),z.append("g").attr("class","nv-y nv-axis"),z.append("g").attr("class","nv-scatterWrap"),z.append("g").attr("class","nv-distWrap"),z.append("g").attr("class","nv-legendWrap"),z.append("g").attr("class","nv-controlsWrap");if(y){var X=S?L/2:L;i.width(X),R.select(".nv-legendWrap").datum(e).call(i),a.top!=i.height()&&(a.top=i.height(),D=(l||parseInt(C.style("height"))||400)-a.top-a.bottom),R.select(".nv-legendWrap").attr("transform","translate("+(L-X)+","+ -a.top+")")}S&&(s.width(180).color(["#444"]),W.select(".nv-controlsWrap").datum(j).attr("transform","translate(0,"+ -a.top+")").call(s)),R.attr("transform","translate("+a.left+","+a.top+")"),E&&W.select(".nv-y.nv-axis").attr("transform","translate("+L+",0)"),t.width(L).height(D).color(e.map(function(e,t){return e.color||c(e,t)}).filter(function(t,n){return!e[n].disabled})),d!==0&&t.xDomain(null),v!==0&&t.yDomain(null),R.select(".nv-scatterWrap").datum(e.filter(function(e){return!e.disabled})).call(t);if(d!==0){var V=h.domain()[1]-h.domain()[0];t.xDomain([h.domain()[0]-d*V,h.domain()[1]+d*V])}if(v!==0){var $=p.domain()[1]-p.domain()[0];t.yDomain([p.domain()[0]-v*$,p.domain()[1]+v*$])}(v!==0||d!==0)&&R.select(".nv-scatterWrap").datum(e.filter(function(e){return!e.disabled})).call(t),b&&(n.scale(h).ticks(n.ticks()&&n.ticks().length?n.ticks():L/100).tickSize(-D,0),W.select(".nv-x.nv-axis").attr("transform","translate(0,"+p.range()[0]+")").call(n)),w&&(r.scale(p).ticks(r.ticks()&&r.ticks().length?r.ticks():D/36).tickSize(-L,0),W.select(".nv-y.nv-axis").call(r)),m&&(o.getData(t.x()).scale(h).width(L).color(e.map(function(e,t){return e.color||c(e,t)}).filter(function(t,n){return!e[n].disabled})),z.select(".nv-distWrap").append("g").attr("class","nv-distributionX"),W.select(".nv-distributionX").attr("transform","translate(0,"+p.range()[0]+")").datum(e.filter(function(e){return!e.disabled})).call(o)),g&&(u.getData(t.y()).scale(p).width(D).color(e.map(function(e,t){return e.color||c(e,t)}).filter(function(t,n){return!e[n].disabled})),z.select(".nv-distWrap").append("g").attr("class","nv-distributionY"),W.select(".nv-distributionY").attr("transform","translate("+(E?L:-u.size())+",0)").datum(e.filter(function(e){return!e.disabled})).call(u)),d3.fisheye&&(W.select(".nv-background").attr("width",L).attr("height",D),W.select(".nv-background").on("mousemove",J),W.select(".nv-background").on("click",function(){T=!T}),t.dispatch.on("elementClick.freezeFisheye",function(){T=!T})),s.dispatch.on("legendClick",function(e,i){e.disabled=!e.disabled,x=e.disabled?0:2.5,W.select(".nv-background").style("pointer-events",e.disabled?"none":"all"),W.select(".nv-point-paths").style("pointer-events",e.disabled?"all":"none"),e.disabled?(h.distortion(x).focus(0),p.distortion(x).focus(0),W.select(".nv-scatterWrap").call(t),W.select(".nv-x.nv-axis").call(n),W.select(".nv-y.nv-axis").call(r)):T=!1,F.update()}),i.dispatch.on("stateChange",function(e){A.disabled=e.disabled,M.stateChange(A),F.update()}),t.dispatch.on("elementMouseover.tooltip",function(e){d3.select(".nv-chart-"+t.id()+" .nv-series-"+e.seriesIndex+" .nv-distx-"+e.pointIndex).attr("y1",function(t,n){return e.pos[1]-D}),d3.select(".nv-chart-"+t.id()+" .nv-series-"+e.seriesIndex+" .nv-disty-"+e.pointIndex).attr("x2",e.pos[0]+o.size()),e.pos=[e.pos[0]+a.left,e.pos[1]+a.top],M.tooltipShow(e)}),M.on("tooltipShow",function(e){N&&B(e,k.parentNode)}),M.on("changeState",function(t){typeof t.disabled!="undefined"&&(e.forEach(function(e,n){e.disabled=t.disabled[n]}),A.disabled=t.disabled),F.update()}),P=h.copy(),H=p.copy()}),F}var t=e.models.scatter(),n=e.models.axis(),r=e.models.axis(),i=e.models.legend(),s=e.models.legend(),o=e.models.distribution(),u=e.models.distribution(),a={top:30,right:20,bottom:50,left:75},f=null,l=null,c=e.utils.defaultColor(),h=d3.fisheye?d3.fisheye.scale(d3.scale.linear).distortion(0):t.xScale(),p=d3.fisheye?d3.fisheye.scale(d3.scale.linear).distortion(0):t.yScale(),d=0,v=0,m=!1,g=!1,y=!0,b=!0,w=!0,E=!1,S=!!d3.fisheye,x=0,T=!1,N=!0,C=function(e,t,n){return"<strong>"+t+"</strong>"},k=function(e,t,n){return"<strong>"+n+"</strong>"},L=null,A={},O=null,M=d3.dispatch("tooltipShow","tooltipHide","stateChange","changeState"),_="No Data Available.",D=0;t.xScale(h).yScale(p),n.orient("bottom").tickPadding(10),r.orient(E?"right":"left").tickPadding(10),o.axis("x"),u.axis("y"),s.updateState(!1);var P,H,B=function(i,s){var o=i.pos[0]+(s.offsetLeft||0),u=i.pos[1]+(s.offsetTop||0),f=i.pos[0]+(s.offsetLeft||0),l=p.range()[0]+a.top+(s.offsetTop||0),c=h.range()[0]+a.left+(s.offsetLeft||0),d=i.pos[1]+(s.offsetTop||0),v=n.tickFormat()(t.x()(i.point,i.pointIndex)),m=r.tickFormat()(t.y()(i.point,i.pointIndex));C!=null&&e.tooltip.show([f,l],C(i.series.key,v,m,i,F),"n",1,s,"x-nvtooltip"),k!=null&&e.tooltip.show([c,d],k(i.series.key,v,m,i,F),"e",1,s,"y-nvtooltip"),L!=null&&e.tooltip.show([o,u],L(i.series.key,v,m,i,F),i.value<0?"n":"s",null,s)},j=[{key:"Magnify",disabled:!0}];return t.dispatch.on("elementMouseout.tooltip",function(e){M.tooltipHide(e),d3.select(".nv-chart-"+t.id()+" .nv-series-"+e.seriesIndex+" .nv-distx-"+e.pointIndex).attr("y1",0),d3.select(".nv-chart-"+t.id()+" .nv-series-"+e.seriesIndex+" .nv-disty-"+e.pointIndex).attr("x2",u.size())}),M.on("tooltipHide",function(){N&&e.tooltip.cleanup()}),F.dispatch=M,F.scatter=t,F.legend=i,F.controls=s,F.xAxis=n,F.yAxis=r,F.distX=o,F.distY=u,d3.rebind(F,t,"id","interactive","pointActive","x","y","shape","size","xScale","yScale","zScale","xDomain","yDomain","xRange","yRange","sizeDomain","sizeRange","forceX","forceY","forceSize","clipVoronoi","clipRadius","useVoronoi"),F.options=e.utils.optionsFunc.bind(F),F.margin=function(e){return arguments.length?(a.top=typeof e.top!="undefined"?e.top:a.top,a.right=typeof e.right!="undefined"?e.right:a.right,a.bottom=typeof e.bottom!="undefined"?e.bottom:a.bottom,a.left=typeof e.left!="undefined"?e.left:a.left,F):a},F.width=function(e){return arguments.length?(f=e,F):f},F.height=function(e){return arguments.length?(l=e,F):l},F.color=function(t){return arguments.length?(c=e.utils.getColor(t),i.color(c),o.color(c),u.color(c),F):c},F.showDistX=function(e){return arguments.length?(m=e,F):m},F.showDistY=function(e){return arguments.length?(g=e,F):g},F.showControls=function(e){return arguments.length?(S=e,F):S},F.showLegend=function(e){return arguments.length?(y=e,F):y},F.showXAxis=function(e){return arguments.length?(b=e,F):b},F.showYAxis=function(e){return arguments.length?(w=e,F):w},F.rightAlignYAxis=function(e){return arguments.length?(E=e,r.orient(e?"right":"left"),F):E},F.fisheye=function(e){return arguments.length?(x=e,F):x},F.xPadding=function(e){return arguments.length?(d=e,F):d},F.yPadding=function(e){return arguments.length?(v=e,F):v},F.tooltips=function(e){return arguments.length?(N=e,F):N},F.tooltipContent=function(e){return arguments.length?(L=e,F):L},F.tooltipXContent=function(e){return arguments.length?(C=e,F):C},F.tooltipYContent=function(e){return arguments.length?(k=e,F):k},F.state=function(e){return arguments.length?(A=e,F):A},F.defaultState=function(e){return arguments.length?(O=e,F):O},F.noData=function(e){return arguments.length?(_=e,F):_},F.transitionDuration=function(e){return arguments.length?(D=e,F):D},F},e.models.scatterPlusLineChart=function(){function B(e){return e.each(function(e){function V(){if(S)return U.select(".nv-point-paths").style("pointer-events","all"),!1;U.select(".nv-point-paths").style("pointer-events","none");var i=d3.mouse(this);h.distortion(E).focus(i[0]),p.distortion(E).focus(i[1]),U.select(".nv-scatterWrap").datum(e.filter(function(e){return!e.disabled})).call(t),g&&U.select(".nv-x.nv-axis").call(n),y&&U.select(".nv-y.nv-axis").call(r),U.select(".nv-distributionX").datum(e.filter(function(e){return!e.disabled})).call(o),U.select(".nv-distributionY").datum(e.filter(function(e){return!e.disabled})).call(u)}var T=d3.select(this),N=this,C=(f||parseInt(T.style("width"))||960)-a.left-a.right,M=(l||parseInt(T.style("height"))||400)-a.top-a.bottom;B.update=function(){T.call(B)},B.container=this,k.disabled=e.map(function(e){return!!e.disabled});if(!L){var j;L={};for(j in k)k[j]instanceof Array?L[j]=k[j].slice(0):L[j]=k[j]}if(!e||!e.length||!e.filter(function(e){return e.values.length}).length){var F=T.selectAll(".nv-noData").data([O]);return F.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),F.attr("x",a.left+C/2).attr("y",a.top+M/2).text(function(e){return e}),B}T.selectAll(".nv-noData").remove(),h=t.xScale(),p=t.yScale(),_=_||h,D=D||p;var I=T.selectAll("g.nv-wrap.nv-scatterChart").data([e]),q=I.enter().append("g").attr("class","nvd3 nv-wrap nv-scatterChart nv-chart-"+t.id()),R=q.append("g"),U=I.select("g");R.append("rect").attr("class","nvd3 nv-background").style("pointer-events","none"),R.append("g").attr("class","nv-x nv-axis"),R.append("g").attr("class","nv-y nv-axis"),R.append("g").attr("class","nv-scatterWrap"),R.append("g").attr("class","nv-regressionLinesWrap"),R.append("g").attr("class","nv-distWrap"),R.append("g").attr("class","nv-legendWrap"),R.append("g").attr("class","nv-controlsWrap"),I.attr("transform","translate("+a.left+","+a.top+")"),b&&U.select(".nv-y.nv-axis").attr("transform","translate("+C+",0)"),m&&(i.width(C/2),I.select(".nv-legendWrap").datum(e).call(i),a.top!=i.height()&&(a.top=i.height(),M=(l||parseInt(T.style("height"))||400)-a.top-a.bottom),I.select(".nv-legendWrap").attr("transform","translate("+C/2+","+ -a.top+")")),w&&(s.width(180).color(["#444"]),U.select(".nv-controlsWrap").datum(H).attr("transform","translate(0,"+ -a.top+")").call(s)),t.width(C).height(M).color(e.map(function(e,t){return e.color||c(e,t)}).filter(function(t,n){return!e[n].disabled})),I.select(".nv-scatterWrap").datum(e.filter(function(e){return!e.disabled})).call(t),I.select(".nv-regressionLinesWrap").attr("clip-path","url(#nv-edge-clip-"+t.id()+")");var z=I.select(".nv-regressionLinesWrap").selectAll(".nv-regLines").data(function(e){return e});z.enter().append("g").attr("class","nv-regLines");var W=z.selectAll(".nv-regLine").data(function(e){return[e]}),X=W.enter().append("line").attr("class","nv-regLine").style("stroke-opacity",0);W.attr("x1",h.range()[0]).attr("x2",h.range()[1]).attr("y1",function(e,t){return p(h.domain()[0]*e.slope+e.intercept)}).attr("y2",function(e,t){return p(h.domain()[1]*e.slope+e.intercept)}).style("stroke",function(e,t,n){return c(e,n)}).style("stroke-opacity",function(e,t){return e.disabled||typeof e.slope=="undefined"||typeof e.intercept=="undefined"?0:1}),g&&(n.scale(h).ticks(n.ticks()?n.ticks():C/100).tickSize(-M,0),U.select(".nv-x.nv-axis").attr("transform","translate(0,"+p.range()[0]+")").call(n)),y&&(r.scale(p).ticks(r.ticks()?r.ticks():M/36).tickSize(-C,0),U.select(".nv-y.nv-axis").call(r)),d&&(o.getData(t.x()).scale(h).width(C).color(e.map(function(e,t){return e.color||c(e,t)}).filter(function(t,n){return!e[n].disabled})),R.select(".nv-distWrap").append("g").attr("class","nv-distributionX"),U.select(".nv-distributionX").attr("transform","translate(0,"+p.range()[0]+")").datum(e.filter(function(e){return!e.disabled})).call(o)),v&&(u.getData(t.y()).scale(p).width(M).color(e.map(function(e,t){return e.color||c(e,t)}).filter(function(t,n){return!e[n].disabled})),R.select(".nv-distWrap").append("g").attr("class","nv-distributionY"),U.select(".nv-distributionY").attr("transform","translate("+(b?C:-u.size())+",0)").datum(e.filter(function(e){return!e.disabled})).call(u)),d3.fisheye&&(U.select(".nv-background").attr("width",C).attr("height",M),U.select(".nv-background").on("mousemove",V),U.select(".nv-background").on("click",function(){S=!S}),t.dispatch.on("elementClick.freezeFisheye",function(){S=!S})),s.dispatch.on("legendClick",function(e,i){e.disabled=!e.disabled,E=e.disabled?0:2.5,U.select(".nv-background").style("pointer-events",e.disabled?"none":"all"),U.select(".nv-point-paths").style("pointer-events",e.disabled?"all":"none"),e.disabled?(h.distortion(E).focus(0),p.distortion(E).focus(0),U.select(".nv-scatterWrap").call(t),U.select(".nv-x.nv-axis").call(n),U.select(".nv-y.nv-axis").call(r)):S=!1,B.update()}),i.dispatch.on("stateChange",function(e){k=e,A.stateChange(k),B.update()}),t.dispatch.on("elementMouseover.tooltip",function(e){d3.select(".nv-chart-"+t.id()+" .nv-series-"+e.seriesIndex+" .nv-distx-"+e.pointIndex).attr("y1",e.pos[1]-M),d3.select(".nv-chart-"+t.id()+" .nv-series-"+e.seriesIndex+" .nv-disty-"+e.pointIndex).attr("x2",e.pos[0]+o.size()),e.pos=[e.pos[0]+a.left,e.pos[1]+a.top],A.tooltipShow(e)}),A.on("tooltipShow",function(e){x&&P(e,N.parentNode)}),A.on("changeState",function(t){typeof t.disabled!="undefined"&&(e.forEach(function(e,n){e.disabled=t.disabled[n]}),k.disabled=t.disabled),B.update()}),_=h.copy(),D=p.copy()}),B}var t=e.models.scatter(),n=e.models.axis(),r=e.models.axis(),i=e.models.legend(),s=e.models.legend(),o=e.models.distribution(),u=e.models.distribution(),a={top:30,right:20,bottom:50,left:75},f=null,l=null,c=e.utils.defaultColor(),h=d3.fisheye?d3.fisheye.scale(d3.scale.linear).distortion(0):t.xScale(),p=d3.fisheye?d3.fisheye.scale(d3.scale.linear).distortion(0):t.yScale(),d=!1,v=!1,m=!0,g=!0,y=!0,b=!1,w=!!d3.fisheye,E=0,S=!1,x=!0,T=function(e,t,n){return"<strong>"+t+"</strong>"},N=function(e,t,n){return"<strong>"+n+"</strong>"},C=function(e,t,n,r){return"<h3>"+e+"</h3>"+"<p>"+r+"</p>"},k={},L=null,A=d3.dispatch("tooltipShow","tooltipHide","stateChange","changeState"),O="No Data Available.",M=0;t.xScale(h).yScale(p),n.orient("bottom").tickPadding(10),r.orient(b?"right":"left").tickPadding(10),o.axis("x"),u.axis("y"),s.updateState(!1);var _,D,P=function(i,s){var o=i.pos[0]+(s.offsetLeft||0),u=i.pos[1]+(s.offsetTop||0),f=i.pos[0]+(s.offsetLeft||0),l=p.range()[0]+a.top+(s.offsetTop||0),c=h.range()[0]+a.left+(s.offsetLeft||0),d=i.pos[1]+(s.offsetTop||0),v=n.tickFormat()(t.x()(i.point,i.pointIndex)),m=r.tickFormat()(t.y()(i.point,i.pointIndex));T!=null&&e.tooltip.show([f,l],T(i.series.key,v,m,i,B),"n",1,s,"x-nvtooltip"),N!=null&&e.tooltip.show([c,d],N(i.series.key,v,m,i,B),"e",1,s,"y-nvtooltip"),C!=null&&e.tooltip.show([o,u],C(i.series.key,v,m,i.point.tooltip,i,B),i.value<0?"n":"s",null,s)},H=[{key:"Magnify",disabled:!0}];return t.dispatch.on("elementMouseout.tooltip",function(e){A.tooltipHide(e),d3.select(".nv-chart-"+t.id()+" .nv-series-"+e.seriesIndex+" .nv-distx-"+e.pointIndex).attr("y1",0),d3.select(".nv-chart-"+t.id()+" .nv-series-"+e.seriesIndex+" .nv-disty-"+e.pointIndex).attr("x2",u.size())}),A.on("tooltipHide",function(){x&&e.tooltip.cleanup()}),B.dispatch=A,B.scatter=t,B.legend=i,B.controls=s,B.xAxis=n,B.yAxis=r,B.distX=o,B.distY=u,d3.rebind(B,t,"id","interactive","pointActive","x","y","shape","size","xScale","yScale","zScale","xDomain","yDomain","xRange","yRange","sizeDomain","sizeRange","forceX","forceY","forceSize","clipVoronoi","clipRadius","useVoronoi"),B.options=e.utils.optionsFunc.bind(B),B.margin=function(e){return arguments.length?(a.top=typeof e.top!="undefined"?e.top:a.top,a.right=typeof e.right!="undefined"?e.right:a.right,a.bottom=typeof e.bottom!="undefined"?e.bottom:a.bottom,a.left=typeof e.left!="undefined"?e.left:a.left,B):a},B.width=function(e){return arguments.length?(f=e,B):f},B.height=function(e){return arguments.length?(l=e,B):l},B.color=function(t){return arguments.length?(c=e.utils.getColor(t),i.color(c),o.color(c),u.color(c),B):c},B.showDistX=function(e){return arguments.length?(d=e,B):d},B.showDistY=function(e){return arguments.length?(v=e,B):v},B.showControls=function(e){return arguments.length?(w=e,B):w},B.showLegend=function(e){return arguments.length?(m=e,B):m},B.showXAxis=function(e){return arguments.length?(g=e,B):g},B.showYAxis=function(e){return arguments.length?(y=e,B):y},B.rightAlignYAxis=function(e){return arguments.length?(b=e,r.orient(e?"right":"left"),B):b},B.fisheye=function(e){return arguments.length?(E=e,B):E},B.tooltips=function(e){return arguments.length?(x=e,B):x},B.tooltipContent=function(e){return arguments.length?(C=e,B):C},B.tooltipXContent=function(e){return arguments.length?(T=e,B):T},B.tooltipYContent=function(e){return arguments.length?(N=e,B):N},B.state=function(e){return arguments.length?(k=e,B):k},B.defaultState=function(e){return arguments.length?(L=e,B):L},B.noData=function(e){return arguments.length?(O=e,B):O},B.transitionDuration=function(e){return arguments.length?(M=e,B):M},B},e.models.sparkline=function(){function d(e){return e.each(function(e){var i=n-t.left-t.right,d=r-t.top-t.bottom,v=d3.select(this);s.domain(l||d3.extent(e,u)).range(h||[0,i]),o.domain(c||d3.extent(e,a)).range(p||[d,0]);var m=v.selectAll("g.nv-wrap.nv-sparkline").data([e]),g=m.enter().append("g").attr("class","nvd3 nv-wrap nv-sparkline"),b=g.append("g"),w=m.select("g");m.attr("transform","translate("+t.left+","+t.top+")");var E=m.selectAll("path").data(function(e){return[e]});E.enter().append("path"),E.exit().remove(),E.style("stroke",function(e,t){return e.color||f(e,t)}).attr("d",d3.svg.line().x(function(e,t){return s(u(e,t))}).y(function(e,t){return o(a(e,t))}));var S=m.selectAll("circle.nv-point").data(function(e){function n(t){if(t!=-1){var n=e[t];return n.pointIndex=t,n}return null}var t=e.map(function(e,t){return a(e,t)}),r=n(t.lastIndexOf(o.domain()[1])),i=n(t.indexOf(o.domain()[0])),s=n(t.length-1);return[i,r,s].filter(function(e){return e!=null})});S.enter().append("circle"),S.exit().remove(),S.attr("cx",function(e,t){return s(u(e,e.pointIndex))}).attr("cy",function(e,t){return o(a(e,e.pointIndex))}).attr("r",2).attr("class",function(e,t){return u(e,e.pointIndex)==s.domain()[1]?"nv-point nv-currentValue":a(e,e.pointIndex)==o.domain()[0]?"nv-point nv-minValue":"nv-point nv-maxValue"})}),d}var t={top:2,right:0,bottom:2,left:0},n=400,r=32,i=!0,s=d3.scale.linear(),o=d3.scale.linear(),u=function(e){return e.x},a=function(e){return e.y},f=e.utils.getColor(["#000"]),l,c,h,p;return d.options=e.utils.optionsFunc.bind(d),d.margin=function(e){return arguments.length?(t.top=typeof e.top!="undefined"?e.top:t.top,t.right=typeof e.right!="undefined"?e.right:t.right,t.bottom=typeof e.bottom!="undefined"?e.bottom:t.bottom,t.left=typeof e.left!="undefined"?e.left:t.left,d):t},d.width=function(e){return arguments.length?(n=e,d):n},d.height=function(e){return arguments.length?(r=e,d):r},d.x=function(e){return arguments.length?(u=d3.functor(e),d):u},d.y=function(e){return arguments.length?(a=d3.functor(e),d):a},d.xScale=function(e){return arguments.length?(s=e,d):s},d.yScale=function(e){return arguments.length?(o=e,d):o},d.xDomain=function(e){return arguments.length?(l=e,d):l},d.yDomain=function(e){return arguments.length?(c=e,d):c},d.xRange=function(e){return arguments.length?(h=e,d):h},d.yRange=function(e){return arguments.length?(p=e,d):p},d.animate=function(e){return arguments.length?(i=e,d):i},d.color=function(t){return arguments.length?(f=e.utils.getColor(t),d):f},d},e.models.sparklinePlus=function(){function v(e){return e.each(function(c){function O(){if(a)return;var e=C.selectAll(".nv-hoverValue").data(u),r=e.enter().append("g").attr("class","nv-hoverValue").style("stroke-opacity",0).style("fill-opacity",0);e.exit().style("stroke-opacity",0).style("fill-opacity",0).remove(),e.attr("transform",function(e){return"translate("+s(t.x()(c[e],e))+",0)"}).style("stroke-opacity",1).style("fill-opacity",1);if(!u.length)return;r.append("line").attr("x1",0).attr("y1",-n.top).attr("x2",0).attr("y2",b),r.append("text").attr("class","nv-xValue").attr("x",-6).attr("y",-n.top).attr("text-anchor","end").attr("dy",".9em"),C.select(".nv-hoverValue .nv-xValue").text(f(t.x()(c[u[0]],u[0]))),r.append("text").attr("class","nv-yValue").attr("x",6).attr("y",-n.top).attr("text-anchor","start").attr("dy",".9em"),C.select(".nv-hoverValue .nv-yValue").text(l(t.y()(c[u[0]],u[0])))}function M(){function r(e,n){var r=Math.abs(t.x()(e[0],0)-n),i=0;for(var s=0;s<e.length;s++)Math.abs(t.x()(e[s],s)-n)<r&&(r=Math.abs(t.x()(e[s],s)-n),i=s);return i}if(a)return;var e=d3.mouse(this)[0]-n.left;u=[r(c,Math.round(s.invert(e)))],O()}var m=d3.select(this),g=(r||parseInt(m.style("width"))||960)-n.left-n.right,b=(i||parseInt(m.style("height"))||400)-n.top-n.bottom;v.update=function(){v(e)},v.container=this;if(!c||!c.length){var w=m.selectAll(".nv-noData").data([d]);return w.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),w.attr("x",n.left+g/2).attr("y",n.top+b/2).text(function(e){return e}),v}m.selectAll(".nv-noData").remove();var E=t.y()(c[c.length-1],c.length-1);s=t.xScale(),o=t.yScale();var S=m.selectAll("g.nv-wrap.nv-sparklineplus").data([c]),T=S.enter().append("g").attr("class","nvd3 nv-wrap nv-sparklineplus"),N=T.append("g"),C=S.select("g");N.append("g").attr("class","nv-sparklineWrap"),N.append("g").attr("class","nv-valueWrap"),N.append("g").attr("class","nv-hoverArea"),S.attr("transform","translate("+n.left+","+n.top+")");var k=C.select(".nv-sparklineWrap");t.width(g).height(b),k.call(t);var L=C.select(".nv-valueWrap"),A=L.selectAll(".nv-currentValue").data([E]);A.enter().append("text").attr("class","nv-currentValue").attr("dx",p?-8:8).attr("dy",".9em").style("text-anchor",p?"end":"start"),A.attr("x",g+(p?n.right:0)).attr("y",h?function(e){return o(e)}:0).style("fill",t.color()(c[c.length-1],c.length-1)).text(l(E)),N.select(".nv-hoverArea").append("rect").on("mousemove",M).on("click",function(){a=!a}).on("mouseout",function(){u=[],O()}),C.select(".nv-hoverArea rect").attr("transform",function(e){return"translate("+ -n.left+","+ -n.top+")"}).attr("width",g+n.left+n.right).attr("height",b+n.top)}),v}var t=e.models.sparkline(),n={top:15,right:100,bottom:10,left:50},r=null,i=null,s,o,u=[],a=!1,f=d3.format(",r"),l=d3.format(",.2f"),c=!0,h=!0,p=!1,d="No Data Available.";return v.sparkline=t,d3.rebind(v,t,"x","y","xScale","yScale","color"),v.options=e.utils.optionsFunc.bind(v),v.margin=function(e){return arguments.length?(n.top=typeof e.top!="undefined"?e.top:n.top,n.right=typeof e.right!="undefined"?e.right:n.right,n.bottom=typeof e.bottom!="undefined"?e.bottom:n.bottom,n.left=typeof e.left!="undefined"?e.left:n.left,v):n},v.width=function(e){return arguments.length?(r=e,v):r},v.height=function(e){return arguments.length?(i=e,v):i},v.xTickFormat=function(e){return arguments.length?(f=e,v):f},v.yTickFormat=function(e){return arguments.length?(l=e,v):l},v.showValue=function(e){return arguments.length?(c=e,v):c},v.alignValue=function(e){return arguments.length?(h=e,v):h},v.rightAlignValue=function(e){return arguments.length?(p=e,v):p},v.noData=function(e){return arguments.length?(d=e,v):d},v},e.models.stackedArea=function(){function g(e){return e.each(function(e){var a=n-t.left-t.right,b=r-t.top-t.bottom,w=d3.select(this);p=v.xScale(),d=v.yScale();var E=e;e.forEach(function(e,t){e.seriesIndex=t,e.values=e.values.map(function(e,n){return e.index=n,e.seriesIndex=t,e})});var S=e.filter(function(e){return!e.disabled});e=d3.layout.stack().order(l).offset(f).values(function(e){return e.values}).x(o).y(u).out(function(e,t,n){var r=u(e)===0?0:n;e.display={y:r,y0:t}})(S);var T=w.selectAll("g.nv-wrap.nv-stackedarea").data([e]),N=T.enter().append("g").attr("class","nvd3 nv-wrap nv-stackedarea"),C=N.append("defs"),k=N.append("g"),L=T.select("g");k.append("g").attr("class","nv-areaWrap"),k.append("g").attr("class","nv-scatterWrap"),T.attr("transform","translate("+t.left+","+t.top+")"),v.width(a).height(b).x(o).y(function(e){return e.display.y+e.display.y0}).forceY([0]).color(e.map(function(e,t){return e.color||i(e,e.seriesIndex)}));var A=L.select(".nv-scatterWrap").datum(e);A.call(v),C.append("clipPath").attr("id","nv-edge-clip-"+s).append("rect"),T.select("#nv-edge-clip-"+s+" rect").attr("width",a).attr("height",b),L.attr("clip-path",h?"url(#nv-edge-clip-"+s+")":"");var O=d3.svg.area().x(function(e,t){return p(o(e,t))}).y0(function(e){return d(e.display.y0)}).y1(function(e){return d(e.display.y+e.display.y0)}).interpolate(c),M=d3.svg.area().x(function(e,t){return p(o(e,t))}).y0(function(e){return d(e.display.y0)}).y1(function(e){return d(e.display.y0)}),_=L.select(".nv-areaWrap").selectAll("path.nv-area").data(function(e){return e});_.enter().append("path").attr("class",function(e,t){return"nv-area nv-area-"+t}).attr("d",function(e,t){return M(e.values,e.seriesIndex)}).on("mouseover",function(e,t){d3.select(this).classed("hover",!0),m.areaMouseover({point:e,series:e.key,pos:[d3.event.pageX,d3.event.pageY],seriesIndex:e.seriesIndex})}).on("mouseout",function(e,t){d3.select(this).classed("hover",!1),m.areaMouseout({point:e,series:e.key,pos:[d3.event.pageX,d3.event.pageY],seriesIndex:e.seriesIndex})}).on("click",function(e,t){d3.select(this).classed("hover",!1),m.areaClick({point:e,series:e.key,pos:[d3.event.pageX,d3.event.pageY],seriesIndex:e.seriesIndex})}),_.exit().remove(),_.style("fill",function(e,t){return e.color||i(e,e.seriesIndex)}).style("stroke",function(e,t){return e.color||i(e,e.seriesIndex)}),_.attr("d",function(e,t){return O(e.values,t)}),v.dispatch.on("elementMouseover.area",function(e){L.select(".nv-chart-"+s+" .nv-area-"+e.seriesIndex).classed("hover",!0)}),v.dispatch.on("elementMouseout.area",function(e){L.select(".nv-chart-"+s+" .nv-area-"+e.seriesIndex).classed("hover",!1)}),g.d3_stackedOffset_stackPercent=function(e){var t=e.length,n=e[0].length,r=1/t,i,s,o,a=[];for(s=0;s<n;++s){for(i=0,o=0;i<E.length;i++)o+=u(E[i].values[s]);if(o)for(i=0;i<t;i++)e[i][s][1]/=o;else for(i=0;i<t;i++)e[i][s][1]=r}for(s=0;s<n;++s)a[s]=0;return a}}),g}var t={top:0,right:0,bottom:0,left:0},n=960,r=500,i=e.utils.defaultColor(),s=Math.floor(Math.random()*1e5),o=function(e){return e.x},u=function(e){return e.y},a="stack",f="zero",l="default",c="linear",h=!1,p,d,v=e.models.scatter(),m=d3.dispatch("tooltipShow","tooltipHide","areaClick","areaMouseover","areaMouseout");return v.size(2.2).sizeDomain([2.2,2.2]),v.dispatch.on("elementClick.area",function(e){m.areaClick(e)}),v.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+t.left,e.pos[1]+t.top],m.tooltipShow(e)}),v.dispatch.on("elementMouseout.tooltip",function(e){m.tooltipHide(e)}),g.dispatch=m,g.scatter=v,d3.rebind(g,v,"interactive","size","xScale","yScale","zScale","xDomain","yDomain","xRange","yRange","sizeDomain","forceX","forceY","forceSize","clipVoronoi","useVoronoi","clipRadius","highlightPoint","clearHighlights"),g.options=e.utils.optionsFunc.bind(g),g.x=function(e){return arguments.length?(o=d3.functor(e),g):o},g.y=function(e){return arguments.length?(u=d3.functor(e),g):u},g.margin=function(e){return arguments.length?(t.top=typeof e.top!="undefined"?e.top:t.top,t.right=typeof e.right!="undefined"?e.right:t.right,t.bottom=typeof e.bottom!="undefined"?e.bottom:t.bottom,t.left=typeof e.left!="undefined"?e.left:t.left,g):t},g.width=function(e){return arguments.length?(n=e,g):n},g.height=function(e){return arguments.length?(r=e,g):r},g.clipEdge=function(e){return arguments.length?(h=e,g):h},g.color=function(t){return arguments.length?(i=e.utils.getColor(t),g):i},g.offset=function(e){return arguments.length?(f=e,g):f},g.order=function(e){return arguments.length?(l=e,g):l},g.style=function(e){if(!arguments.length)return a;a=e;switch(a){case"stack":g.offset("zero"),g.order("default");break;case"stream":g.offset("wiggle"),g.order("inside-out");break;case"stream-center":g.offset("silhouette"),g.order("inside-out");break;case"expand":g.offset("expand"),g.order("default");break;case"stack_percent":g.offset(g.d3_stackedOffset_stackPercent),g.order("default")}return g},g.interpolate=function(e){return arguments.length?(c=e,g):c},g},e.models.stackedAreaChart=function(){function M(y){return y.each(function(y){var A=d3.select(this),_=this,D=(a||parseInt(A.style("width"))||960)-u.left-u.right,P=(f||parseInt(A.style("height"))||400)-u.top-u.bottom;M.update=function(){A.call(M)},M.container=this,S.disabled=y.map(function(e){return!!e.disabled});if(!x){var H;x={};for(H in S)S[H]instanceof Array?x[H]=S[H].slice(0):x[H]=S[H]}if(!y||!y.length||!y.filter(function(e){return e.values.length}).length){var B=A.selectAll(".nv-noData").data([T]);return B.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),B.attr("x",u.left+D/2).attr("y",u.top+P/2).text(function(e){return e}),M}A.selectAll(".nv-noData").remove(),b=t.xScale(),w=t.yScale();var j=A.selectAll("g.nv-wrap.nv-stackedAreaChart").data([y]),F=j.enter().append("g").attr("class","nvd3 nv-wrap nv-stackedAreaChart").append("g"),I=j.select("g");F.append("rect").style("opacity",0),F.append("g").attr("class","nv-x nv-axis"),F.append("g").attr("class","nv-y nv-axis"),F.append("g").attr("class","nv-stackedWrap"),F.append("g").attr("class","nv-legendWrap"),F.append("g").attr("class","nv-controlsWrap"),F.append("g").attr("class","nv-interactive"),I.select("rect").attr("width",D).attr("height",P);if(h){var q=c?D-C:D;i.width(q),I.select(".nv-legendWrap").datum(y).call(i),u.top!=i.height()&&(u.top=i.height(),P=(f||parseInt(A.style("height"))||400)-u.top-u.bottom),I.select(".nv-legendWrap").attr("transform","translate("+(D-q)+","+ -u.top+")")}if(c){var R=[{key:L.stacked||"Stacked",metaKey:"Stacked",disabled:t.style()!="stack",style:"stack"},{key:L.stream||"Stream",metaKey:"Stream",disabled:t.style()!="stream",style:"stream"},{key:L.expanded||"Expanded",metaKey:"Expanded",disabled:t.style()!="expand",style:"expand"},{key:L.stack_percent||"Stack %",metaKey:"Stack_Percent",disabled:t.style()!="stack_percent",style:"stack_percent"}];C=k.length/3*260,R=R.filter(function(e){return k.indexOf(e.metaKey)!==-1}),s.width(C).color(["#444","#444","#444"]),I.select(".nv-controlsWrap").datum(R).call(s),u.top!=Math.max(s.height(),i.height())&&(u.top=Math.max(s.height(),i.height()),P=(f||parseInt(A.style("height"))||400)-u.top-u.bottom),I.select(".nv-controlsWrap").attr("transform","translate(0,"+ -u.top+")")}j.attr("transform","translate("+u.left+","+u.top+")"),v&&I.select(".nv-y.nv-axis").attr("transform","translate("+D+",0)"),m&&(o.width(D).height(P).margin({left:u.left,top:u.top}).svgContainer(A).xScale(b),j.select(".nv-interactive").call(o)),t.width(D).height(P);var U=I.select(".nv-stackedWrap").datum(y);U.call(t),p&&(n.scale(b).ticks(D/100).tickSize(-P,0),I.select(".nv-x.nv-axis").attr("transform","translate(0,"+P+")"),I.select(".nv-x.nv-axis").call(n)),d&&(r.scale(w).ticks(t.offset()=="wiggle"?0:P/36).tickSize(-D,0).setTickFormat(t.style()=="expand"||t.style()=="stack_percent"?d3.format("%"):E),I.select(".nv-y.nv-axis").call(r)),t.dispatch.on("areaClick.toggle",function(e){y.filter(function(e){return!e.disabled}).length===1?y.forEach(function(e){e.disabled=!1}):y.forEach(function(t,n){t.disabled=n!=e.seriesIndex}),S.disabled=y.map(function(e){return!!e.disabled}),N.stateChange(S),M.update()}),i.dispatch.on("stateChange",function(e){S.disabled=e.disabled,N.stateChange(S),M.update()}),s.dispatch.on("legendClick",function(e,n){if(!e.disabled)return;R=R.map(function(e){return e.disabled=!0,e}),e.disabled=!1,t.style(e.style),S.style=t.style(),N.stateChange(S),M.update()}),o.dispatch.on("elementMousemove",function(i){t.clearHighlights();var s,a,f,c=[];y.filter(function(e,t){return e.seriesIndex=t,!e.disabled}).forEach(function(n,r){a=e.interactiveBisect(n.values,i.pointXValue,M.x()),t.highlightPoint(r,a,!0);var o=n.values[a];if(typeof o=="undefined")return;typeof s=="undefined"&&(s=o),typeof f=="undefined"&&(f=M.xScale()(M.x()(o,a)));var u=t.style()=="expand"?o.display.y:M.y()(o,a);c.push({key:n.key,value:u,color:l(n,n.seriesIndex),stackedValue:o.display})}),c.reverse();if(c.length>2){var h=M.yScale().invert(i.mouseY),p=Infinity,d=null;c.forEach(function(e,t){h=Math.abs(h);var n=Math.abs(e.stackedValue.y0),r=Math.abs(e.stackedValue.y);if(h>=n&&h<=r+n){d=t;return}}),d!=null&&(c[d].highlight=!0)}var v=n.tickFormat()(M.x()(s,a)),m=t.style()=="expand"?function(e,t){return d3.format(".1%")(e)}:function(e,t){return r.tickFormat()(e)};o.tooltip.position({left:f+u.left,top:i.mouseY+u.top}).chartContainer(_.parentNode).enabled(g).valueFormatter(m).data({value:v,series:c})(),o.renderGuideLine(f)}),o.dispatch.on("elementMouseout",function(e){N.tooltipHide(),t.clearHighlights()}),N.on("tooltipShow",function(e){g&&O(e,_.parentNode)}),N.on("changeState",function(e){typeof e.disabled!="undefined"&&y.length===e.disabled.length&&(y.forEach(function(t,n){t.disabled=e.disabled[n]}),S.disabled=e.disabled),typeof e.style!="undefined"&&t.style(e.style),M.update()})}),M}var t=e.models.stackedArea(),n=e.models.axis(),r=e.models.axis(),i=e.models.legend(),s=e.models.legend(),o=e.interactiveGuideline(),u={top:30,right:25,bottom:50,left:60},a=null,f=null,l=e.utils.defaultColor(),c=!0,h=!0,p=!0,d=!0,v=!1,m=!1,g=!0,y=function(e,t,n,r,i){return"<h3>"+e+"</h3>"+"<p>"+n+" on "+t+"</p>"},b,w,E=d3.format(",.2f"),S={style:t.style()},x=null,T="No Data Available.",N=d3.dispatch("tooltipShow","tooltipHide","stateChange","changeState"),C=250,k=["Stacked","Stream","Expanded"],L={},A=0;n.orient("bottom").tickPadding(7),r.orient(v?"right":"left"),s.updateState(!1);var O=function(i,s){var o=i.pos[0]+(s.offsetLeft||0),u=i.pos[1]+(s.offsetTop||0),a=n.tickFormat()(t.x()(i.point,i.pointIndex)),f=r.tickFormat()(t.y()(i.point,i.pointIndex)),l=y(i.series.key,a,f,i,M);e.tooltip.show([o,u],l,i.value<0?"n":"s",null,s)};return t.dispatch.on("tooltipShow",function(e){e.pos=[e.pos[0]+u.left,e.pos[1]+u.top],N.tooltipShow(e)}),t.dispatch.on("tooltipHide",function(e){N.tooltipHide(e)}),N.on("tooltipHide",function(){g&&e.tooltip.cleanup()}),M.dispatch=N,M.stacked=t,M.legend=i,M.controls=s,M.xAxis=n,M.yAxis=r,M.interactiveLayer=o,d3.rebind(M,t,"x","y","size","xScale","yScale","xDomain","yDomain","xRange","yRange","sizeDomain","interactive","useVoronoi","offset","order","style","clipEdge","forceX","forceY","forceSize","interpolate"),M.options=e.utils.optionsFunc.bind(M),M.margin=function(e){return arguments.length?(u.top=typeof e.top!="undefined"?e.top:u.top,u.right=typeof e.right!="undefined"?e.right:u.right,u.bottom=typeof e.bottom!="undefined"?e.bottom:u.bottom,u.left=typeof e.left!="undefined"?e.left:u.left,M):u},M.width=function(e){return arguments.length?(a=e,M):a},M.height=function(e){return arguments.length?(f=e,M):f},M.color=function(n){return arguments.length?(l=e.utils.getColor(n),i.color(l),t.color(l),M):l},M.showControls=function(e){return arguments.length?(c=e,M):c},M.showLegend=function(e){return arguments.length?(h=e,M):h},M.showXAxis=function(e){return arguments.length?(p=e,M):p},M.showYAxis=function(e){return arguments.length?(d=e,M):d},M.rightAlignYAxis=function(e){return arguments.length?(v=e,r.orient(e?"right":"left"),M):v},M.useInteractiveGuideline=function(e){return arguments.length?(m=e,e===!0&&(M.interactive(!1),M.useVoronoi(!1)),M):m},M.tooltip=function(e){return arguments.length?(y=e,M):y},M.tooltips=function(e){return arguments.length?(g=e,M):g},M.tooltipContent=function(e){return arguments.length?(y=e,M):y},M.state=function(e){return arguments.length?(S=e,M):S},M.defaultState=function(e){return arguments.length?(x=e,M):x},M.noData=function(e){return arguments.length?(T=e,M):T},M.transitionDuration=function(e){return arguments.length?(A=e,M):A},M.controlsData=function(e){return arguments.length?(k=e,M):k},M.controlLabels=function(e){return arguments.length?typeof e!="object"?L:(L=e,M):L},r.setTickFormat=r.tickFormat,r.tickFormat=function(e){return arguments.length?(E=e,r):E},M}}(),define("plugin/plugins/nvd3/nv.d3",function(){}),define("plugin/charts/nvd3/common/config",["plugin/charts/forms/default","plugin/plugins/nvd3/nv.d3"],function(e){return $.extend(!0,{},e,{title:"",category:"",library:"NVD3",tag:"svg",keywords:"small"})}),define("plugin/charts/nvd3/bar/config",["plugin/charts/nvd3/common/config"],function(e){return $.extend(!0,{},e,{title:"Regular",category:"Bar diagrams",columns:{x:{title:"Values for x-axis",is_label:!0,is_auto:!0,is_unique:!0},y:{title:"Values for y-axis",is_numeric:!0}}})}),define("plugin/charts/nvd3/bar_stacked/config",["plugin/charts/nvd3/common/config"],function(e){return $.extend(!0,{},e,{title:"Stacked",category:"Bar diagrams",columns:{x:{title:"Values for x-axis",is_label:!0,is_auto:!0,is_unique:!0},y:{title:"Values for y-axis",is_numeric:!0}}})}),define("plugin/charts/nvd3/bar_horizontal/config",["plugin/charts/nvd3/common/config"],function(e){return $.extend(!0,{},e,{title:"Horizontal",category:"Bar diagrams",settings:{x_axis_type:{init:"hide"}},columns:{x:{title:"Values for x-axis",is_label:!0,is_auto:!0,is_unique:!0},y:{title:"Values for y-axis",is_numeric:!0}}})}),define("plugin/charts/nvd3/bar_horizontal_stacked/config",["plugin/charts/nvd3/common/config"],function(e){return $.extend(!0,{},e,{title:"Stacked horizontal",category:"Bar diagrams",settings:{x_axis_type:{init:"hide"}},columns:{x:{title:"Values for x-axis",is_label:!0,is_auto:!0,is_unique:!0},y:{title:"Values for y-axis",is_numeric:!0}}})}),define("plugin/charts/nvd3/line_focus/config",["plugin/charts/nvd3/common/config"],function(e){return $.extend(!0,{},e,{title:"Line with focus",category:"Others",zoomable:"native",columns:{x:{title:"Values for x-axis",is_label:!0,is_auto:!0,is_unique:!0},y:{title:"Values for y-axis",is_numeric:!0}}})}),define("plugin/charts/nvd3/pie/config",["plugin/plugins/nvd3/nv.d3"],function(){return $.extend(!0,{},{title:"Pie chart",category:"Area charts",library:"NVD3",tag:"svg",keywords:"small",columns:{label:{title:"Labels",is_label:!0,is_auto:!0},y:{title:"Values",is_numeric:!0}},settings:{main_separator:{type:"separator",title:"Pie chart settings"},donut_ratio:{title:"Donut ratio",info:"Determine how large the donut hole will be.",type:"select",init:"0.5",data:[{label:"50%",value:"0.5"},{label:"25%",value:"0.25"},{label:"10%",value:"0.10"},{label:"0%",value:"0"}]},show_legend:{title:"Show legend",info:"Would you like to add a legend?",type:"radiobutton",init:"false",data:[{label:"Yes",value:"true"},{label:"No",value:"false"}]},label_separator:{type:"separator",title:"Label settings"},label_type:{title:"Donut label",info:"What would you like to show for each slice?",type:"select",init:"percent",data:[{label:"-- Nothing --",value:"hide",hide:"label_outside"},{label:"Label column",value:"key",show:"label_outside"},{label:"Value column",value:"value",show:"label_outside"},{label:"Percentage",value:"percent",show:"label_outside"}]},label_outside:{title:"Show outside",info:"Would you like to show labels outside the donut?",type:"radiobutton",init:"false",data:[{label:"Yes",value:"true"},{label:"No",value:"false"}]},use_panels:{init:"true",hide:!0}}})}),define("plugin/charts/nvd3/stackedarea_full/config",["plugin/charts/nvd3/common/config"],function(e){return $.extend(!0,{},e,{title:"Expanded",zoomable:!0,category:"Area charts",keywords:"default small",columns:{x:{title:"Values for x-axis",is_label:!0,is_auto:!0,is_unique:!0},y:{title:"Values for y-axis",is_numeric:!0}}})}),define("plugin/charts/nvd3/stackedarea_stream/config",["plugin/charts/nvd3/common/config"],function(e){return $.extend(!0,{},e,{title:"Stream",category:"Area charts",zoomable:!0,keywords:"default small",showmaxmin:!0,columns:{x:{title:"Values for x-axis",is_label:!0,is_auto:!0,is_unique:!0},y:{title:"Values for y-axis",is_numeric:!0}}})}),define("plugin/charts/nvd3/histogram/config",["plugin/charts/nvd3/common/config"],function(e){return $.extend(!0,{},e,{title:"Histogram",category:"Data processing (requires 'charts' tool from Toolshed)",execute:"histogram",keywords:"small medium large",columns:{y:{title:"Observations",is_numeric:!0}},settings:{x_axis_label:{init:"Values"},y_axis_label:{init:"Density"},y_axis_type:{init:"f"},y_axis_precision:{init:".2"}}})}),define("plugin/charts/nvd3/line/config",["plugin/charts/nvd3/common/config"],function(e){return $.extend(!0,{},e,{title:"Line chart",category:"Others",zoomable:!0,columns:{x:{title:"Values for x-axis",is_label:!0,is_auto:!0,is_unique:!0},y:{title:"Values for y-axis",is_numeric:!0}}})}),define("plugin/charts/nvd3/scatter/config",["plugin/charts/nvd3/common/config"],function(e){return $.extend(!0,{},e,{title:"Scatter plot",category:"Others",zoomable:!0,columns:{x:{title:"Values for x-axis",is_numeric:!0},y:{title:"Values for y-axis",is_numeric:!0}}})}),define("plugin/charts/nvd3/stackedarea/config",["plugin/charts/nvd3/common/config"],function(e){return $.extend(!0,{},e,{title:"Regular",zoomable:!0,category:"Area charts",keywords:"default small",columns:{x:{title:"Values for x-axis",is_label:!0,is_auto:!0,is_unique:!0},y:{title:"Values for y-axis",is_numeric:!0}}})}),define("plugin/charts/jqplot/common/config",["plugin/charts/forms/default"],function(e){return $.extend(!0,{},e,{title:"",category:"",library:"jqPlot",tag:"div",zoomable:!0,keywords:"medium",settings:{separator_grid:{title:"Grids",type:"separator"},x_axis_grid:{title:"Axis grid",info:"Would you like to show grid lines for the X axis?",type:"radiobutton",init:"false",data:[{label:"On",value:"true"},{label:"Off",value:"false"}]},y_axis_grid:{title:"Axis grid",info:"Would you like to show grid lines for the Y axis?",type:"radiobutton",init:"true",data:[{label:"On",value:"true"},{label:"Off",value:"false"}]}}})}),define("plugin/charts/jqplot/bar/config",["plugin/charts/jqplot/common/config"],function(e){return $.extend(!0,{},e,{title:"Regular",category:"Bar diagrams",columns:{x:{title:"Values for x-axis",is_label:!0,is_auto:!0,is_unique:!0},y:{title:"Values for y-axis",is_numeric:!0}}})}),define("plugin/charts/jqplot/line/config",["plugin/charts/jqplot/common/config"],function(e){return $.extend(!0,{},e,{title:"Line chart",category:"Others",columns:{x:{title:"Values for x-axis",is_label:!0,is_auto:!0,is_unique:!0},y:{title:"Values for y-axis",is_numeric:!0}}})}),define("plugin/charts/jqplot/scatter/config",["plugin/charts/jqplot/common/config"],function(e){return $.extend(!0,{},e,{title:"Scatter plot",category:"Others",columns:{x:{title:"Values for x-axis",is_numeric:!0},y:{title:"Values for y-axis",is_numeric:!0}},settings:{x_axis_grid:{init:"true"}}})}),define("plugin/charts/jqplot/boxplot/config",["plugin/charts/jqplot/common/config"],function(e){return $.extend(!0,{},e,{title:"Box plot",category:"Data processing (requires 'charts' tool from Toolshed)",library:"jqPlot",tag:"div",execute:"boxplot",keywords:"small medium large",columns:{y:{title:"Observations",is_numeric:!0}},settings:{show_legend:{init:"false"}}})}),define("plugin/charts/jqplot/histogram_discrete/config",["plugin/charts/jqplot/common/config"],function(e){return $.extend(!0,{},e,{title:"Discrete Histogram",category:"Data processing (requires 'charts' tool from Toolshed)",execute:"histogramdiscrete",keywords:"small medium large",columns:{x:{title:"Observations",is_label:!0}},settings:{x_axis_label:{init:"Breaks"},y_axis_label:{init:"Density"}}})}),define("plugin/charts/others/heatmap/config",["plugin/charts/forms/default"],function(e){return $.extend(!0,{},e,{title:"Heatmap",category:"Others",library:"Custom",tag:"svg",keywords:"small",zoomable:!0,columns:{x:{title:"Column labels",is_label:!0,is_numeric:!0,is_unique:!0},y:{title:"Row labels",is_label:!0,is_numeric:!0,is_unique:!0},z:{title:"Observation",is_numeric:!0}},settings:{use_panels:{init:"true",hide:!0},color_set:{title:"Color scheme",info:"Select a color scheme for your heatmap",type:"select",init:"jet",data:[{label:"Cold-to-Hot",value:"hot"},{label:"Cool",value:"cool"},{label:"Copper",value:"copper"},{label:"Gray scale",value:"gray"},{label:"Jet",value:"jet"},{label:"No-Green",value:"no_green"},{label:"Ocean",value:"ocean"},{label:"Polar",value:"polar"},{label:"Red-to-Green",value:"redgreen"},{label:"Red-to-green (saturated)",value:"red2green"},{label:"Relief",value:"relief"},{label:"Seismograph",value:"seis"},{label:"Sealand",value:"sealand"},{label:"Split",value:"split"},{label:"Wysiwyg",value:"wysiwyg"}]},url_template:{title:"Url template",info:"Enter a url to link the labels with external sources. Use __LABEL__ as placeholder.",type:"text",init:"",placeholder:"http://someurl.com?id=__LABEL__"}}})}),define("plugin/charts/others/heatmap_cluster/config",["plugin/charts/others/heatmap/config"],function(e){return $.extend(!0,{},e,{title:"Clustered Heatmap",category:"Data processing (requires 'charts' tool from Toolshed)",execute:"heatmap",keywords:"small medium large"})}),define("plugin/charts/types",["plugin/charts/nvd3/bar/config","plugin/charts/nvd3/bar_stacked/config","plugin/charts/nvd3/bar_horizontal/config","plugin/charts/nvd3/bar_horizontal_stacked/config","plugin/charts/nvd3/line_focus/config","plugin/charts/nvd3/pie/config","plugin/charts/nvd3/stackedarea_full/config","plugin/charts/nvd3/stackedarea_stream/config","plugin/charts/nvd3/histogram/config","plugin/charts/nvd3/line/config","plugin/charts/nvd3/scatter/config","plugin/charts/nvd3/stackedarea/config","plugin/charts/jqplot/bar/config","plugin/charts/jqplot/line/config","plugin/charts/jqplot/scatter/config","plugin/charts/jqplot/boxplot/config","plugin/charts/jqplot/histogram_discrete/config","plugin/charts/others/heatmap/config","plugin/charts/others/heatmap_cluster/config"],function(e,t,n,r,i,s,o,u,a,f,l,c,h,p,d,v,m,g,y){return Backbone.Model.extend({defaults:{nvd3_bar:e,nvd3_bar_stacked:t,nvd3_bar_horizontal:n,nvd3_bar_horizontal_stacked:r,nvd3_line_focus:i,nvd3_stackedarea:c,nvd3_stackedarea_full:o,nvd3_stackedarea_stream:u,nvd3_pie:s,nvd3_line:f,nvd3_scatter:l,nvd3_histogram:a,jqplot_bar:h,jqplot_histogram_discrete:m,jqplot_line:p,jqplot_scatter:d,jqplot_boxplot:v,others_heatmap:g,others_heatmap_cluster:y}})}),define("plugin/app",["mvc/ui/ui-modal","mvc/ui/ui-portlet","mvc/ui/ui-misc","utils/utils","plugin/library/jobs","plugin/library/datasets","plugin/library/storage","utils/deferred","plugin/views/viewer","plugin/views/editor","plugin/models/config","plugin/models/chart","plugin/charts/types"],function(e,t,n,r,i,s,o,u,a,f,l,c,h){return Backbone.View.extend({initialize:function(t){this.options=t,Galaxy&&Galaxy.modal?this.modal=Galaxy.modal:this.modal=new e.View,this.config=new l,this.types=new h,this.chart=new c,this.jobs=new i(this),this.datasets=new s(this),this.storage=new o(this),this.deferred=new u,this.viewer_view=new a(this),this.editor_view=new f(this),this.$el.append(this.viewer_view.$el),this.$el.append(this.editor_view.$el);if(!this.storage.load())this.go("editor");else{this.go("viewer");var n=this;this.deferred.execute(function(){n.chart.trigger("redraw")})}},go:function(e){$(".tooltip").hide();switch(e){case"editor":this.editor_view.show(),this.viewer_view.hide();break;case"viewer":this.editor_view.hide(),this.viewer_view.show()}},chartPath:function(e){var t=e.split(/_(.+)/);return t.length>=2?t[0]+"/"+t[1]:(console.debug("FAILED App:chartPath() - Invalid format: "+e),undefined)}})});
\ No newline at end of file
+define("mvc/ui/ui-modal",[],function(){var e=Backbone.View.extend({elMain:"body",optionsDefault:{title:"ui-modal",body:"",backdrop:!0,height:null,width:null,closing_events:!1,closing_callback:null},buttonList:{},initialize:function(e){e&&this._create(e)},show:function(e){this.initialize(e),this.options.height?(this.$body.css("height",this.options.height),this.$body.css("overflow","hidden")):this.$body.css("max-height",$(window).height()/2),this.options.width&&this.$dialog.css("width",this.options.width),this.visible?this.$el.show():this.$el.fadeIn("fast"),this.visible=!0},hide:function(){this.visible=!1,this.$el.fadeOut("fast"),this.options.closing_callback&&this.options.closing_callback()},enableButton:function(e){var t=this.buttonList[e];this.$buttons.find("#"+t).prop("disabled",!1)},disableButton:function(e){var t=this.buttonList[e];this.$buttons.find("#"+t).prop("disabled",!0)},showButton:function(e){var t=this.buttonList[e];this.$buttons.find("#"+t).show()},hideButton:function(e){var t=this.buttonList[e];this.$buttons.find("#"+t).hide()},getButton:function(e){var t=this.buttonList[e];return this.$buttons.find("#"+t)},scrollTop:function(){return this.$body.scrollTop()},_create:function(e){var t=this;this.options=_.defaults(e,this.optionsDefault),this.options.body=="progress"&&(this.options.body=$('<div class="progress progress-striped active"><div class="progress-bar progress-bar-info" style="width:100%"></div></div>')),this.$el&&(this.$el.remove(),$(document).off("keyup.ui-modal")),this.setElement(this._template(this.options.title)),this.$dialog=this.$el.find(".modal-dialog"),this.$body=this.$el.find(".modal-body"),this.$footer=this.$el.find(".modal-footer"),this.$buttons=this.$el.find(".buttons"),this.$backdrop=this.$el.find(".modal-backdrop"),this.$body.html(this.options.body),this.options.backdrop||this.$backdrop.removeClass("in");if(this.options.buttons){this.buttonList={};var n=0;$.each(this.options.buttons,function(e,r){var i="button-"+n++;t.$buttons.append($('<button id="'+i+'"></button>').text(e).click(r)).append(" "),t.buttonList[e]=i})}else this.$footer.hide();$(this.elMain).append($(this.el)),this.options.closing_events&&($(document).on("keyup.ui-modal",function(e){e.keyCode==27&&t.hide()}),this.$el.find(".modal-backdrop").on("click",function(){t.hide()}))},_template:function(e){return'<div class="ui-modal modal"><div class="modal-backdrop fade in" style="z-index: -1;"></div><div class="modal-dialog"><div class="modal-content"><div class="modal-header"><button type="button" class="close" style="display: none;">×</button><h4 class="title">'+e+"</h4>"+"</div>"+'<div class="modal-body" style="position: static;"></div>'+'<div class="modal-footer">'+'<div class="buttons" style="float: right;"></div>'+"</div>"+"</div"+"</div>"+"</div>"}});return{View:e}}),function(){var e=this,t=e._,n=Array.prototype,r=Object.prototype,i=Function.prototype,s=n.push,o=n.slice,u=n.concat,a=r.toString,f=r.hasOwnProperty,l=Array.isArray,c=Object.keys,h=i.bind,p=function(e){if(e instanceof p)return e;if(!(this instanceof p))return new p(e);this._wrapped=e};typeof exports!="undefined"?(typeof module!="undefined"&&module.exports&&(exports=module.exports=p),exports._=p):e._=p,p.VERSION="1.7.0";var d=function(e,t,n){if(t===void 0)return e;switch(n==null?3:n){case 1:return function(n){return e.call(t,n)};case 2:return function(n,r){return e.call(t,n,r)};case 3:return function(n,r,i){return e.call(t,n,r,i)};case 4:return function(n,r,i,s){return e.call(t,n,r,i,s)}}return function(){return e.apply(t,arguments)}};p.iteratee=function(e,t,n){return e==null?p.identity:p.isFunction(e)?d(e,t,n):p.isObject(e)?p.matches(e):p.property(e)},p.each=p.forEach=function(e,t,n){if(e==null)return e;t=d(t,n);var r,i=e.length;if(i===+i)for(r=0;r<i;r++)t(e[r],r,e);else{var s=p.keys(e);for(r=0,i=s.length;r<i;r++)t(e[s[r]],s[r],e)}return e},p.map=p.collect=function(e,t,n){if(e==null)return[];t=p.iteratee(t,n);var r=e.length!==+e.length&&p.keys(e),i=(r||e).length,s=Array(i),o;for(var u=0;u<i;u++)o=r?r[u]:u,s[u]=t(e[o],o,e);return s};var v="Reduce of empty array with no initial value";p.reduce=p.foldl=p.inject=function(e,t,n,r){e==null&&(e=[]),t=d(t,r,4);var i=e.length!==+e.length&&p.keys(e),s=(i||e).length,o=0,u;if(arguments.length<3){if(!s)throw new TypeError(v);n=e[i?i[o++]:o++]}for(;o<s;o++)u=i?i[o]:o,n=t(n,e[u],u,e);return n},p.reduceRight=p.foldr=function(e,t,n,r){e==null&&(e=[]),t=d(t,r,4);var i=e.length!==+e.length&&p.keys(e),s=(i||e).length,o;if(arguments.length<3){if(!s)throw new TypeError(v);n=e[i?i[--s]:--s]}while(s--)o=i?i[s]:s,n=t(n,e[o],o,e);return n},p.find=p.detect=function(e,t,n){var r;return t=p.iteratee(t,n),p.some(e,function(e,n,i){if(t(e,n,i))return r=e,!0}),r},p.filter=p.select=function(e,t,n){var r=[];return e==null?r:(t=p.iteratee(t,n),p.each(e,function(e,n,i){t(e,n,i)&&r.push(e)}),r)},p.reject=function(e,t,n){return p.filter(e,p.negate(p.iteratee(t)),n)},p.every=p.all=function(e,t,n){if(e==null)return!0;t=p.iteratee(t,n);var r=e.length!==+e.length&&p.keys(e),i=(r||e).length,s,o;for(s=0;s<i;s++){o=r?r[s]:s;if(!t(e[o],o,e))return!1}return!0},p.some=p.any=function(e,t,n){if(e==null)return!1;t=p.iteratee(t,n);var r=e.length!==+e.length&&p.keys(e),i=(r||e).length,s,o;for(s=0;s<i;s++){o=r?r[s]:s;if(t(e[o],o,e))return!0}return!1},p.contains=p.include=function(e,t){return e==null?!1:(e.length!==+e.length&&(e=p.values(e)),p.indexOf(e,t)>=0)},p.invoke=function(e,t){var n=o.call(arguments,2),r=p.isFunction(t);return p.map(e,function(e){return(r?t:e[t]).apply(e,n)})},p.pluck=function(e,t){return p.map(e,p.property(t))},p.where=function(e,t){return p.filter(e,p.matches(t))},p.findWhere=function(e,t){return p.find(e,p.matches(t))},p.max=function(e,t,n){var r=-Infinity,i=-Infinity,s,o;if(t==null&&e!=null){e=e.length===+e.length?e:p.values(e);for(var u=0,a=e.length;u<a;u++)s=e[u],s>r&&(r=s)}else t=p.iteratee(t,n),p.each(e,function(e,n,s){o=t(e,n,s);if(o>i||o===-Infinity&&r===-Infinity)r=e,i=o});return r},p.min=function(e,t,n){var r=Infinity,i=Infinity,s,o;if(t==null&&e!=null){e=e.length===+e.length?e:p.values(e);for(var u=0,a=e.length;u<a;u++)s=e[u],s<r&&(r=s)}else t=p.iteratee(t,n),p.each(e,function(e,n,s){o=t(e,n,s);if(o<i||o===Infinity&&r===Infinity)r=e,i=o});return r},p.shuffle=function(e){var t=e&&e.length===+e.length?e:p.values(e),n=t.length,r=Array(n);for(var i=0,s;i<n;i++)s=p.random(0,i),s!==i&&(r[i]=r[s]),r[s]=t[i];return r},p.sample=function(e,t,n){return t==null||n?(e.length!==+e.length&&(e=p.values(e)),e[p.random(e.length-1)]):p.shuffle(e).slice(0,Math.max(0,t))},p.sortBy=function(e,t,n){return t=p.iteratee(t,n),p.pluck(p.map(e,function(e,n,r){return{value:e,index:n,criteria:t(e,n,r)}}).sort(function(e,t){var n=e.criteria,r=t.criteria;if(n!==r){if(n>r||n===void 0)return 1;if(n<r||r===void 0)return-1}return e.index-t.index}),"value")};var m=function(e){return function(t,n,r){var i={};return n=p.iteratee(n,r),p.each(t,function(r,s){var o=n(r,s,t);e(i,r,o)}),i}};p.groupBy=m(function(e,t,n){p.has(e,n)?e[n].push(t):e[n]=[t]}),p.indexBy=m(function(e,t,n){e[n]=t}),p.countBy=m(function(e,t,n){p.has(e,n)?e[n]++:e[n]=1}),p.sortedIndex=function(e,t,n,r){n=p.iteratee(n,r,1);var i=n(t),s=0,o=e.length;while(s<o){var u=s+o>>>1;n(e[u])<i?s=u+1:o=u}return s},p.toArray=function(e){return e?p.isArray(e)?o.call(e):e.length===+e.length?p.map(e,p.identity):p.values(e):[]},p.size=function(e){return e==null?0:e.length===+e.length?e.length:p.keys(e).length},p.partition=function(e,t,n){t=p.iteratee(t,n);var r=[],i=[];return p.each(e,function(e,n,s){(t(e,n,s)?r:i).push(e)}),[r,i]},p.first=p.head=p.take=function(e,t,n){return e==null?void 0:t==null||n?e[0]:t<0?[]:o.call(e,0,t)},p.initial=function(e,t,n){return o.call(e,0,Math.max(0,e.length-(t==null||n?1:t)))},p.last=function(e,t,n){return e==null?void 0:t==null||n?e[e.length-1]:o.call(e,Math.max(e.length-t,0))},p.rest=p.tail=p.drop=function(e,t,n){return o.call(e,t==null||n?1:t)},p.compact=function(e){return p.filter(e,p.identity)};var g=function(e,t,n,r){if(t&&p.every(e,p.isArray))return u.apply(r,e);for(var i=0,o=e.length;i<o;i++){var a=e[i];!p.isArray(a)&&!p.isArguments(a)?n||r.push(a):t?s.apply(r,a):g(a,t,n,r)}return r};p.flatten=function(e,t){return g(e,t,!1,[])},p.without=function(e){return p.difference(e,o.call(arguments,1))},p.uniq=p.unique=function(e,t,n,r){if(e==null)return[];p.isBoolean(t)||(r=n,n=t,t=!1),n!=null&&(n=p.iteratee(n,r));var i=[],s=[];for(var o=0,u=e.length;o<u;o++){var a=e[o];if(t)(!o||s!==a)&&i.push(a),s=a;else if(n){var f=n(a,o,e);p.indexOf(s,f)<0&&(s.push(f),i.push(a))}else p.indexOf(i,a)<0&&i.push(a)}return i},p.union=function(){return p.uniq(g(arguments,!0,!0,[]))},p.intersection=function(e){if(e==null)return[];var t=[],n=arguments.length;for(var r=0,i=e.length;r<i;r++){var s=e[r];if(p.contains(t,s))continue;for(var o=1;o<n;o++)if(!p.contains(arguments[o],s))break;o===n&&t.push(s)}return t},p.difference=function(e){var t=g(o.call(arguments,1),!0,!0,[]);return p.filter(e,function(e){return!p.contains(t,e)})},p.zip=function(e){if(e==null)return[];var t=p.max(arguments,"length").length,n=Array(t);for(var r=0;r<t;r++)n[r]=p.pluck(arguments,r);return n},p.object=function(e,t){if(e==null)return{};var n={};for(var r=0,i=e.length;r<i;r++)t?n[e[r]]=t[r]:n[e[r][0]]=e[r][1];return n},p.indexOf=function(e,t,n){if(e==null)return-1;var r=0,i=e.length;if(n){if(typeof n!="number")return r=p.sortedIndex(e,t),e[r]===t?r:-1;r=n<0?Math.max(0,i+n):n}for(;r<i;r++)if(e[r]===t)return r;return-1},p.lastIndexOf=function(e,t,n){if(e==null)return-1;var r=e.length;typeof n=="number"&&(r=n<0?r+n+1:Math.min(r,n+1));while(--r>=0)if(e[r]===t)return r;return-1},p.range=function(e,t,n){arguments.length<=1&&(t=e||0,e=0),n=n||1;var r=Math.max(Math.ceil((t-e)/n),0),i=Array(r);for(var s=0;s<r;s++,e+=n)i[s]=e;return i};var y=function(){};p.bind=function(e,t){var n,r;if(h&&e.bind===h)return h.apply(e,o.call(arguments,1));if(!p.isFunction(e))throw new TypeError("Bind must be called on a function");return n=o.call(arguments,2),r=function(){if(this instanceof r){y.prototype=e.prototype;var i=new y;y.prototype=null;var s=e.apply(i,n.concat(o.call(arguments)));return p.isObject(s)?s:i}return e.apply(t,n.concat(o.call(arguments)))},r},p.partial=function(e){var t=o.call(arguments,1);return function(){var n=0,r=t.slice();for(var i=0,s=r.length;i<s;i++)r[i]===p&&(r[i]=arguments[n++]);while(n<arguments.length)r.push(arguments[n++]);return e.apply(this,r)}},p.bindAll=function(e){var t,n=arguments.length,r;if(n<=1)throw new Error("bindAll must be passed function names");for(t=1;t<n;t++)r=arguments[t],e[r]=p.bind(e[r],e);return e},p.memoize=function(e,t){var n=function(r){var i=n.cache,s=t?t.apply(this,arguments):r;return p.has(i,s)||(i[s]=e.apply(this,arguments)),i[s]};return n.cache={},n},p.delay=function(e,t){var n=o.call(arguments,2);return setTimeout(function(){return e.apply(null,n)},t)},p.defer=function(e){return p.delay.apply(p,[e,1].concat(o.call(arguments,1)))},p.throttle=function(e,t,n){var r,i,s,o=null,u=0;n||(n={});var a=function(){u=n.leading===!1?0:p.now(),o=null,s=e.apply(r,i),o||(r=i=null)};return function(){var f=p.now();!u&&n.leading===!1&&(u=f);var l=t-(f-u);return r=this,i=arguments,l<=0||l>t?(clearTimeout(o),o=null,u=f,s=e.apply(r,i),o||(r=i=null)):!o&&n.trailing!==!1&&(o=setTimeout(a,l)),s}},p.debounce=function(e,t,n){var r,i,s,o,u,a=function(){var f=p.now()-o;f<t&&f>0?r=setTimeout(a,t-f):(r=null,n||(u=e.apply(s,i),r||(s=i=null)))};return function(){s=this,i=arguments,o=p.now();var f=n&&!r;return r||(r=setTimeout(a,t)),f&&(u=e.apply(s,i),s=i=null),u}},p.wrap=function(e,t){return p.partial(t,e)},p.negate=function(e){return function(){return!e.apply(this,arguments)}},p.compose=function(){var e=arguments,t=e.length-1;return function(){var n=t,r=e[t].apply(this,arguments);while(n--)r=e[n].call(this,r);return r}},p.after=function(e,t){return function(){if(--e<1)return t.apply(this,arguments)}},p.before=function(e,t){var n;return function(){return--e>0?n=t.apply(this,arguments):t=null,n}},p.once=p.partial(p.before,2),p.keys=function(e){if(!p.isObject(e))return[];if(c)return c(e);var t=[];for(var n in e)p.has(e,n)&&t.push(n);return t},p.values=function(e){var t=p.keys(e),n=t.length,r=Array(n);for(var i=0;i<n;i++)r[i]=e[t[i]];return r},p.pairs=function(e){var t=p.keys(e),n=t.length,r=Array(n);for(var i=0;i<n;i++)r[i]=[t[i],e[t[i]]];return r},p.invert=function(e){var t={},n=p.keys(e);for(var r=0,i=n.length;r<i;r++)t[e[n[r]]]=n[r];return t},p.functions=p.methods=function(e){var t=[];for(var n in e)p.isFunction(e[n])&&t.push(n);return t.sort()},p.extend=function(e){if(!p.isObject(e))return e;var t,n;for(var r=1,i=arguments.length;r<i;r++){t=arguments[r];for(n in t)f.call(t,n)&&(e[n]=t[n])}return e},p.pick=function(e,t,n){var r={},i;if(e==null)return r;if(p.isFunction(t)){t=d(t,n);for(i in e){var s=e[i];t(s,i,e)&&(r[i]=s)}}else{var a=u.apply([],o.call(arguments,1));e=new Object(e);for(var f=0,l=a.length;f<l;f++)i=a[f],i in e&&(r[i]=e[i])}return r},p.omit=function(e,t,n){if(p.isFunction(t))t=p.negate(t);else{var r=p.map(u.apply([],o.call(arguments,1)),String);t=function(e,t){return!p.contains(r,t)}}return p.pick(e,t,n)},p.defaults=function(e){if(!p.isObject(e))return e;for(var t=1,n=arguments.length;t<n;t++){var r=arguments[t];for(var i in r)e[i]===void 0&&(e[i]=r[i])}return e},p.clone=function(e){return p.isObject(e)?p.isArray(e)?e.slice():p.extend({},e):e},p.tap=function(e,t){return t(e),e};var b=function(e,t,n,r){if(e===t)return e!==0||1/e===1/t;if(e==null||t==null)return e===t;e instanceof p&&(e=e._wrapped),t instanceof p&&(t=t._wrapped);var i=a.call(e);if(i!==a.call(t))return!1;switch(i){case"[object RegExp]":case"[object String]":return""+e==""+t;case"[object Number]":if(+e!==+e)return+t!==+t;return+e===0?1/+e===1/t:+e===+t;case"[object Date]":case"[object Boolean]":return+e===+t}if(typeof e!="object"||typeof t!="object")return!1;var s=n.length;while(s--)if(n[s]===e)return r[s]===t;var o=e.constructor,u=t.constructor;if(o!==u&&"constructor"in e&&"constructor"in t&&!(p.isFunction(o)&&o instanceof o&&p.isFunction(u)&&u instanceof u))return!1;n.push(e),r.push(t);var f,l;if(i==="[object Array]"){f=e.length,l=f===t.length;if(l)while(f--)if(!(l=b(e[f],t[f],n,r)))break}else{var c=p.keys(e),h;f=c.length,l=p.keys(t).length===f;if(l)while(f--){h=c[f];if(!(l=p.has(t,h)&&b(e[h],t[h],n,r)))break}}return n.pop(),r.pop(),l};p.isEqual=function(e,t){return b(e,t,[],[])},p.isEmpty=function(e){if(e==null)return!0;if(p.isArray(e)||p.isString(e)||p.isArguments(e))return e.length===0;for(var t in e)if(p.has(e,t))return!1;return!0},p.isElement=function(e){return!!e&&e.nodeType===1},p.isArray=l||function(e){return a.call(e)==="[object Array]"},p.isObject=function(e){var t=typeof e;return t==="function"||t==="object"&&!!e},p.each(["Arguments","Function","String","Number","Date","RegExp"],function(e){p["is"+e]=function(t){return a.call(t)==="[object "+e+"]"}}),p.isArguments(arguments)||(p.isArguments=function(e){return p.has(e,"callee")}),typeof /./!="function"&&(p.isFunction=function(e){return typeof e=="function"||!1}),p.isFinite=function(e){return isFinite(e)&&!isNaN(parseFloat(e))},p.isNaN=function(e){return p.isNumber(e)&&e!==+e},p.isBoolean=function(e){return e===!0||e===!1||a.call(e)==="[object Boolean]"},p.isNull=function(e){return e===null},p.isUndefined=function(e){return e===void 0},p.has=function(e,t){return e!=null&&f.call(e,t)},p.noConflict=function(){return e._=t,this},p.identity=function(e){return e},p.constant=function(e){return function(){return e}},p.noop=function(){},p.property=function(e){return function(t){return t[e]}},p.matches=function(e){var t=p.pairs(e),n=t.length;return function(e){if(e==null)return!n;e=new Object(e);for(var r=0;r<n;r++){var i=t[r],s=i[0];if(i[1]!==e[s]||!(s in e))return!1}return!0}},p.times=function(e,t,n){var r=Array(Math.max(0,e));t=d(t,n,1);for(var i=0;i<e;i++)r[i]=t(i);return r},p.random=function(e,t){return t==null&&(t=e,e=0),e+Math.floor(Math.random()*(t-e+1))},p.now=Date.now||function(){return(new Date).getTime()};var w={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"},E=p.invert(w),S=function(e){var t=function(t){return e[t]},n="(?:"+p.keys(e).join("|")+")",r=RegExp(n),i=RegExp(n,"g");return function(e){return e=e==null?"":""+e,r.test(e)?e.replace(i,t):e}};p.escape=S(w),p.unescape=S(E),p.result=function(e,t){if(e==null)return void 0;var n=e[t];return p.isFunction(n)?e[t]():n};var x=0;p.uniqueId=function(e){var t=++x+"";return e?e+t:t},p.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var T=/(.)^/,N={"'":"'","\\":"\\","\r":"r","\n":"n","\u2028":"u2028","\u2029":"u2029"},C=/\\|'|\r|\n|\u2028|\u2029/g,k=function(e){return"\\"+N[e]};p.template=function(e,t,n){!t&&n&&(t=n),t=p.defaults({},t,p.templateSettings);var r=RegExp([(t.escape||T).source,(t.interpolate||T).source,(t.evaluate||T).source].join("|")+"|$","g"),i=0,s="__p+='";e.replace(r,function(t,n,r,o,u){return s+=e.slice(i,u).replace(C,k),i=u+t.length,n?s+="'+\n((__t=("+n+"))==null?'':_.escape(__t))+\n'":r?s+="'+\n((__t=("+r+"))==null?'':__t)+\n'":o&&(s+="';\n"+o+"\n__p+='"),t}),s+="';\n",t.variable||(s="with(obj||{}){\n"+s+"}\n"),s="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+s+"return __p;\n";try{var o=new Function(t.variable||"obj","_",s)}catch(u){throw u.source=s,u}var a=function(e){return o.call(this,e,p)},f=t.variable||"obj";return a.source="function("+f+"){\n"+s+"}",a},p.chain=function(e){var t=p(e);return t._chain=!0,t};var L=function(e){return this._chain?p(e).chain():e};p.mixin=function(e){p.each(p.functions(e),function(t){var n=p[t]=e[t];p.prototype[t]=function(){var e=[this._wrapped];return s.apply(e,arguments),L.call(this,n.apply(p,e))}})},p.mixin(p),p.each(["pop","push","reverse","shift","sort","splice","unshift"],function(e){var t=n[e];p.prototype[e]=function(){var n=this._wrapped;return t.apply(n,arguments),(e==="shift"||e==="splice")&&n.length===0&&delete n[0],L.call(this,n)}}),p.each(["concat","join","slice"],function(e){var t=n[e];p.prototype[e]=function(){return L.call(this,t.apply(this._wrapped,arguments))}}),p.prototype.value=function(){return this._wrapped},typeof define=="function"&&define.amd&&define("underscore",[],function(){return p})}.call(this),define("libs/underscore",function(e){return function(){var t,n;return t||e._}}(this)),define("utils/utils",["libs/underscore"],function(e){function t(e,n){for(var r in e){var i=e[r];i&&typeof i=="object"&&(n(i),t(i,n))}}function n(e){return $("<div/>").text(e).html()}function r(e){e instanceof Array||(e=[e]);for(var t in e)if(["None",null,"null",undefined,"undefined"].indexOf(e[t])>-1)return!1;return!0}function i(e){var e=e.toString();if(e){e=e.replace(/,/g,", ");var t=e.lastIndexOf(", ");return t!=-1&&(e=e.substr(0,t)+" or "+e.substr(t+1)),e}return""}function s(e){top.__utils__get__=top.__utils__get__||{},e.cache&&top.__utils__get__[e.url]?(e.success&&e.success(top.__utils__get__[e.url]),console.debug("utils.js::get() - Fetching from cache ["+e.url+"].")):o({url:e.url,data:e.data,success:function(t){top.__utils__get__[e.url]=t,e.success&&e.success(t)},error:function(t){e.error&&e.error(t)}})}function o(e){var t={contentType:"application/json",type:e.type||"GET",data:e.data||{},url:e.url};t.type=="GET"||t.type=="DELETE"?(t.url.indexOf("?")==-1?t.url+="?":t.url+="&",t.url=t.url+$.param(t.data),t.data=null):(t.dataType="json",t.url=t.url,t.data=JSON.stringify(t.data)),$.ajax(t).done(function(t){if(typeof t=="string")try{t=t.replace("Infinity,",'"Infinity",'),t=jQuery.parseJSON(t)}catch(n){console.debug(n)}e.success&&e.success(t)}).fail(function(t){var n=null;try{n=jQuery.parseJSON(t.responseText)}catch(r){n=t.responseText}e.error&&e.error(n,t)})}function u(e,t){var n=$('<div class="'+e+'"></div>');n.appendTo(":eq(0)");var r=n.css(t);return n.remove(),r}function a(e){$('link[href^="'+e+'"]').length||$('<link href="'+galaxy_config.root+e+'" rel="stylesheet">').appendTo("head")}function f(t,n){return t?e.defaults(t,n):n}function l(e,t){var n="";if(e>=1e11)e/=1e11,n="TB";else if(e>=1e8)e/=1e8,n="GB";else if(e>=1e5)e/=1e5,n="MB";else if(e>=100)e/=100,n="KB";else{if(!(e>0))return"<strong>-</strong>";e*=10,n="b"}var r=Math.round(e)/10;return t?r+" "+n:"<strong>"+r+"</strong> "+n}function c(){return"x"+Math.random().toString(36).substring(2,9)}function h(e){var t=$("<p></p>");return t.append(e),t}function p(){var e=new Date,t=(e.getHours()<10?"0":"")+e.getHours(),n=(e.getMinutes()<10?"0":"")+e.getMinutes(),r=e.getDate()+"/"+(e.getMonth()+1)+"/"+e.getFullYear()+", "+t+":"+n;return r}return{cssLoadFile:a,cssGetAttribute:u,get:s,merge:f,bytesToString:l,uuid:c,time:p,wrap:h,request:o,sanitize:n,textify:i,validate:r,deepeach:t}}),define("mvc/ui/ui-portlet",["utils/utils"],function(e){var t=Backbone.View.extend({visible:!1,optionsDefault:{title:"",icon:"",buttons:null,body:null,scrollable:!0,nopadding:!1,operations:null,placement:"bottom",cls:"ui-portlet",operations_flt:"right"},$title:null,$content:null,$buttons:null,$operations:null,$header:null,initialize:function(t){this.options=e.merge(t,this.optionsDefault),this.setElement(this._template(this.options)),this.$content=this.$el.find(".content"),this.$title=this.$el.find(".portlet-title-text"),this.$header=this.$el.find(".portlet-header");var n=this.$el.find(".portlet-content");this.options.nopadding&&(n.css("padding","0px"),this.$content.css("padding","0px")),this.$buttons=$(this.el).find(".buttons");if(this.options.buttons){var r=this;$.each(this.options.buttons,function(e,t){t.$el.prop("id",e),r.$buttons.append(t.$el)})}else this.$buttons.remove();this.$operations=$(this.el).find(".operations");if(this.options.operations){var r=this;$.each(this.options.operations,function(e,t){t.$el.prop("id",e),r.$operations.append(t.$el)})}this.options.body&&this.append(this.options.body)},append:function(t,n){n?this.$content.append(t):this.$content.append(e.wrap(t))},content:function(){return this.$content},show:function(){this.$el.fadeIn("fast"),this.visible=!0},hide:function(){this.$el.fadeOut("fast"),this.visible=!1},enableButton:function(e){this.$buttons.find("#"+e).prop("disabled",!1)},disableButton:function(e){this.$buttons.find("#"+e).prop("disabled",!0)},hideOperation:function(e){this.$operations.find("#"+e).hide()},showOperation:function(e){this.$operations.find("#"+e).show()},setOperation:function(e,t){var n=this.$operations.find("#"+e);n.off("click"),n.on("click",t)},title:function(e){var t=this.$title;return e&&t.html(e),t.html()},_template:function(e){var t='<div id="'+e.id+'" class="'+e.cls+'">';return e.title&&(t+='<div class="portlet-header"><div class="operations" style="float: '+e.operations_flt+';"></div>'+'<div class="portlet-title">',e.icon&&(t+='<i class="icon fa '+e.icon+'"> </i>'),t+='<span class="portlet-title-text">'+e.title+"</span>"+"</div>"+"</div>"),t+='<div class="portlet-content">',e.placement=="top"&&(t+='<div class="buttons"></div>'),t+='<div class="content"></div>',e.placement=="bottom"&&(t+='<div class="buttons"></div>'),t+="</div></div>",t}});return{View:t}}),define("mvc/ui/ui-select-default",["utils/utils"],function(e){var t=Backbone.View.extend({optionsDefault:{id:"",cls:"",error_text:"No data available",visible:!0,wait:!1,multiple:!1,searchable:!1},initialize:function(t){this.options=e.merge(t,this.optionsDefault),this.setElement(this._template(this.options)),this.$select=this.$el.find(".select"),this.$icon=this.$el.find(".icon"),this.$button=this.$el.find(".button"),this.options.multiple?(this.$select.prop("multiple",!0),this.$select.addClass("ui-select-multiple"),this.$icon.remove()):this.$el.addClass("ui-select"),this.update(this.options.data),this.options.value!==undefined&&this.value(this.options.value),this.options.visible||this.hide(),this.options.wait?this.wait():this.show();var n=this;this.$select.on("change",function(){n._change()}),this.on("change",function(){n._change()})},value:function(e){return e!==undefined&&(this.$select.val(e),this.$select.select2&&this.$select.select2("val",e)),this.$select.val()},first:function(){var e=this.$select.find("option");return e.length>0?e.val():undefined},validate:function(){return e.validate(this.value())},text:function(){return this.$select.find("option:selected").text()},show:function(){this.unwait(),this.$select.show(),this.$el.show()},hide:function(){this.$el.hide()},wait:function(){this.$icon.removeClass(),this.$icon.addClass("fa fa-spinner fa-spin")},unwait:function(){this.$icon.removeClass(),this.$icon.addClass("fa fa-caret-down")},disabled:function(){return this.$select.is(":disabled")},enable:function(){this.$select.prop("disabled",!1)},disable:function(){this.$select.prop("disabled",!0)},add:function(e){this.$select.append(this._templateOption(e)),this._refresh()},del:function(e){this.$select.find("option[value="+e+"]").remove(),this.$select.trigger("change"),this._refresh()},update:function(e){var t=this.$select.val();this.$select.find("option").remove();for(var n in e)this.$select.append(this._templateOption(e[n]));this._refresh(),this.$select.val(t),this.$select.val()||this.$select.val(this.first()),this.options.searchable&&(this.$button.hide(),this.$select.select2("destroy"),this.$select.select2())},setOnChange:function(e){this.options.onchange=e},exists:function(e){return this.$select.find('option[value="'+e+'"]').length>0},_change:function(){this.options.onchange&&this.options.onchange(this.$select.val())},_refresh:function(){this.$select.find("option[value=null]").remove();var e=this.$select.find("option").length;e==0?(this.disable(),this.$select.append(this._templateOption({value:"null",label:this.options.error_text}))):this.enable()},_templateOption:function(e){return'<option value="'+e.value+'">'+e.label+"</option>"},_template:function(e){return'<div id="'+e.id+'">'+'<select id="select" class="select '+e.cls+" "+e.id+'"></select>'+'<div class="button">'+'<i class="icon"/>'+"</div>"+"</div>"}});return{View:t}}),define("mvc/ui/ui-slider",["utils/utils"],function(e){var t=Backbone.View.extend({optionsDefault:{min:null,max:null,step:null,precise:!1,split:1e4},initialize:function(t){var n=this;this.options=e.merge(t,this.optionsDefault),this.setElement(this._template(this.options)),this.useslider=this.options.max!==null&&this.options.min!==null&&this.options.max>this.options.min,this.options.step===null&&(this.options.step=1,this.options.precise&&this.useslider&&(this.options.step=(this.options.max-this.options.min)/this.options.split)),this.useslider?(this.$slider=this.$el.find("#slider"),this.$slider.slider(this.options),this.$slider.on("slide",function(e,t){n.value(t.value)})):this.$el.find(".ui-form-slider-text").css("width","100%"),this.$text=this.$el.find("#text"),this.options.value!==undefined&&this.value(this.options.value),this.$text.on("change",function(){n.value($(this).val())});var r=[];this.$text.on("keyup",function(e){r[e.which]=!1}),this.$text.on("keydown",function(e){var t=e.which;r[t]=!0,t==8||t==9||t==13||t==37||t==39||t>=48&&t<=57||t==190&&$(this).val().indexOf(".")==-1&&n.options.precise||t==189&&$(this).val().indexOf("-")==-1||r[91]||r[17]||event.preventDefault()})},value:function(e){return e!==undefined&&(isNaN(e)&&(e=0),this.options.max!==null&&(e=Math.min(e,this.options.max)),this.options.min!==null&&(e=Math.max(e,this.options.min)),this.options.onchange&&this.options.onchange(e),this.$slider&&this.$slider.slider("value",e),this.$text.val(e)),this.$text.val()},_template:function(e){return'<div id="'+e.id+'" class="ui-form-slider">'+'<input id="text" type="text" class="ui-form-slider-text"/>'+'<div id="slider" class="ui-form-slider-element"/>'+"</div>"}});return{View:t}}),define("mvc/ui/ui-options",["utils/utils"],function(e){var t=Backbone.View.extend({initialize:function(t){this.optionsDefault={visible:!0,data:[],id:e.uuid(),error_text:"No data available.",wait_text:"Please wait..."},this.options=e.merge(t,this.optionsDefault),this.setElement("<div/>"),this.$message=$("<div/>"),this.$options=$(this._template(t)),this.$el.append(this.$message),this.$el.append(this.$options),this.options.visible||this.$el.hide(),this.update(this.options.data),this.options.value!==undefined&&this.value(this.options.value);var n=this;this.on("change",function(){n._change()})},update:function(e){var t=this._getValue();this.$options.empty();if(this._templateOptions)this.$options.append(this._templateOptions(e));else for(var n in e){var r=$(this._templateOption(e[n]));r.addClass("ui-option"),this.$options.append(r)}var i=this;this.$el.find("input").on("change",function(){i.value(i._getValue()),i._change()}),this._refresh(),this.value(t)},value:function(e){if(e!==undefined){e instanceof Array||(e=[e]),this.$el.find("input").prop("checked",!1);for(var t in e)this.$el.find('input[value="'+e[t]+'"]').first().prop("checked",!0)}return this._getValue()},exists:function(e){if(e!==undefined){e instanceof Array||(e=[e]);for(var t in e)if(this.$el.find('input[value="'+e[t]+'"]').length>0)return!0}return!1},first:function(){var e=this.$el.find("input");return e.length>0?e.val():undefined},validate:function(){return e.validate(this.value())},wait:function(){this._size()==0&&(this._messageShow(this.options.wait_text,"info"),this.$options.hide())},unwait:function(){this._messageHide(),this._refresh()},_change:function(){this.options.onchange&&this.options.onchange(this._getValue())},_refresh:function(){this._size()==0?(this._messageShow(this.options.error_text,"danger"),this.$options.hide()):(this._messageHide(),this.$options.css("display","inline-block"))},_getValue:function(){var e=this.$el.find(":checked");if(e.length==0)return"null";if(this.options.multiple){var t=[];return e.each(function(){t.push($(this).val())}),t}return e.val()},_size:function(){return this.$el.find(".ui-option").length},_messageShow:function(e,t){this.$message.show(),this.$message.removeClass(),this.$message.addClass("ui-message alert alert-"+t),this.$message.html(e)},_messageHide:function(){this.$message.hide()},_template:function(){return'<div class="ui-options"/>'}}),n={};n.View=t.extend({initialize:function(e){t.prototype.initialize.call(this,e)},_templateOption:function(e){return'<div><input type="radio" name="'+this.options.id+'" value="'+e.value+'"/>'+e.label+"<br>"+"</div>"}});var r={};r.View=t.extend({initialize:function(e){e.multiple=!0,t.prototype.initialize.call(this,e)},_templateOption:function(e){return'<div><input type="checkbox" name="'+this.options.id+'" value="'+e.value+'"/>'+e.label+"<br>"+"</div>"}});var i={};return i.View=t.extend({initialize:function(e){t.prototype.initialize.call(this,e)},value:function(e){return e!==undefined&&(this.$el.find("input").prop("checked",!1),this.$el.find("label").removeClass("active"),this.$el.find('[value="'+e+'"]').prop("checked",!0).closest("label").addClass("active")),this._getValue()},_templateOption:function(e){var t='<label class="btn btn-default">';return e.icon&&(t+='<i class="fa '+e.icon+'"/>'),t+='<input type="radio" name="'+this.options.id+'" value="'+e.value+'">'+e.label+"</label>",t},_template:function(){return'<div class="btn-group ui-radiobutton" data-toggle="buttons"/>'}}),{Base:t,Radio:n,RadioButton:i,Checkbox:r}}),define("mvc/ui/ui-drilldown",["utils/utils","mvc/ui/ui-options"],function(e,t){var n=t.Base.extend({initialize:function(e){this.display=e.display||"checkbox",e.multiple=this.display=="checkbox",t.Base.prototype.initialize.call(this,e)},_templateOption:function(e,t,n){return'<div><input name="'+this.options.id+'" class="ui-option" type="'+this.display+'" value="'+t+'">'+e+"<div/>"},_templateOptions:function(e){function n(e,t){function n(n){n?(t.fadeIn("fast"),e.removeClass("toggle-expand"),e.addClass("toggle"),e.is_expanded=!0):(t.hide(),e.removeClass("toggle"),e.addClass("toggle-expand"),e.is_expanded=!1)}e.on("click",function(){n(!e.is_expanded)})}function r(e,s){for(i in s){var o=s[i],u=o.options.length>0,a=$("<div/>");if(u){var f=$('<span class="ui-drilldown-button form-toggle icon-button toggle-expand" style="position: relative; top: 2px;"/>'),l=$("<div/>");l.append(f),l.append(t._templateOption(o.name,o.value)),a.append(l);var c=$('<div style="display: none; margin-left: 25px;"/>');r(c,o.options),a.append(c),n(f,c)}else a.append(t._templateOption(o.name,o.value));e.append(a)}}var t=this,s=$("<div/>");return r(s,e),s},_template:function(e){return'<div class="ui-options drilldown-container" id="'+e.id+'"/>'}});return{View:n}}),define("mvc/ui/ui-button-menu",["utils/utils"],function(e){return Backbone.View.extend({optionsDefault:{id:"",title:"",floating:"right",icon:null,onclick:null,cls:"ui-button-icon ui-button-menu",tooltip:"",target:"",href:"",onunload:null,visible:!0,tag:""},$menu:null,initialize:function(t){this.options=e.merge(t,this.optionsDefault),this.setElement($(this._template(this.options)));var n=$(this.el).find(".root"),r=this;n.on("click",function(e){$(".tooltip").hide(),e.preventDefault(),r.options.onclick&&r.options.onclick()}),this.options.visible||this.hide(),n.tooltip({title:t.tooltip,placement:"bottom"})},show:function(){$(this.el).show()},hide:function(){$(this.el).hide()},addMenu:function(t){var n={title:"",target:"",href:"",onclick:null,divider:!1,icon:null,cls:"button-menu btn-group"};n=e.merge(t,n),this.$menu||($(this.el).append(this._templateMenu()),this.$menu=$(this.el).find(".menu"));var r=$(this._templateMenuItem(n));r.on("click",function(e){e.preventDefault(),n.onclick&&n.onclick()}),this.$menu.append(r),n.divider&&this.$menu.append($(this._templateDivider()))},_templateMenuItem:function(e){var t='<li><a class="dropdown-item" href="'+e.href+'" target="'+e.target+'">';return e.icon&&(t+='<i class="fa '+e.icon+'"></i>'),t+=" "+e.title+"</a>"+"</li>",t},_templateMenu:function(){return'<ul class="menu dropdown-menu pull-right" role="menu"></ul>'},_templateDivider:function(){return'<li class="divider"></li>'},_template:function(e){var t="",n="";e.title?t="width: auto;":n="margin: 0px;";var r='<div id="'+e.id+'" style="float: '+e.floating+"; "+t+'" class="dropdown '+e.cls+'">'+'<div class="root button dropdown-toggle" data-toggle="dropdown" style="'+n+'">'+'<i class="icon fa '+e.icon+'"/>';return e.title&&(r+=' <span class="title">'+e.title+"</span>"),r+="</div></div>",r}})}),define("mvc/ui/ui-misc",["utils/utils","mvc/ui/ui-select-default","mvc/ui/ui-slider","mvc/ui/ui-options","mvc/ui/ui-drilldown","mvc/ui/ui-button-menu","mvc/ui/ui-modal"],function(e,t,n,r,i,s,o){var u=Backbone.View.extend({optionsDefault:{url:"",cls:""},initialize:function(t){this.options=e.merge(t,this.optionsDefault),this.setElement(this._template(this.options))},_template:function(e){return'<img class="ui-image '+e.cls+'" src="'+e.url+'"/>'}}),a=Backbone.View.extend({optionsDefault:{title:"",cls:""},initialize:function(t){this.options=e.merge(t,this.optionsDefault),this.setElement(this._template(this.options))},title:function(e){this.$el.html(e)},_template:function(e){return'<label class="ui-label '+e.cls+'">'+e.title+"</label>"},value:function(){return options.title}}),f=Backbone.View.extend({optionsDefault:{floating:"right",icon:"",tooltip:"",placement:"bottom",title:"",cls:""},initialize:function(t){this.options=e.merge(t,this.optionsDefault),this.setElement(this._template(this.options)),$(this.el).tooltip({title:t.tooltip,placement:"bottom"})},_template:function(e){return'<div><span class="fa '+e.icon+'" class="ui-icon"/> '+e.title+"</div>"}}),l=Backbone.View.extend({optionsDefault:{id:null,title:"",floating:"right",cls:"ui-button btn btn-default",icon:""},initialize:function(t){this.options=e.merge(t,this.optionsDefault),this.setElement(this._template(this.options)),$(this.el).on("click",function(){$(".tooltip").hide(),t.onclick&&t.onclick()}),$(this.el).tooltip({title:t.tooltip,placement:"bottom"})},_template:function(e){var t='<button id="'+e.id+'" type="submit" style="float: '+e.floating+';" type="button" class="'+e.cls+'">';return e.icon&&(t+='<i class="icon fa '+e.icon+'"></i> '),t+=e.title+"</button>",t}}),c=Backbone.View.extend({optionsDefault:{id:null,title:"",floating:"right",cls:"ui-button-icon",icon:"",tooltip:"",onclick:null},initialize:function(t){this.options=e.merge(t,this.optionsDefault),this.setElement(this._template(this.options)),this.$button=this.$el.find(".button");var n=this;$(this.el).on("click",function(){$(".tooltip").hide(),t.onclick&&!n.disabled&&t.onclick()}),$(this.el).tooltip({title:t.tooltip,placement:"bottom"})},disable:function(){this.$button.addClass("disabled"),this.disabled=!0},enable:function(){this.$button.removeClass("disabled"),this.disabled=!1},setIcon:function(e){this.$("i").removeClass(this.options.icon).addClass(e),this.options.icon=e},_template:function(e){var t="";e.title&&(t="width: auto;");var n='<div id="'+e.id+'" style="float: '+e.floating+"; "+t+'" class="'+e.cls+'">';return e.title?n+='<div class="button"><i class="icon fa '+e.icon+'"/> '+'<span class="title">'+e.title+"</span>"+"</div>":n+='<i class="icon fa '+e.icon+'"/>',n+="</div>",n}}),h=Backbone.View.extend({optionsDefault:{title:"",cls:""},initialize:function(t){this.options=e.merge(t,this.optionsDefault),this.setElement(this._template(this.options)),$(this.el).on("click",t.onclick)},_template:function(e){return'<div><a href="javascript:void(0)" class="ui-anchor '+e.cls+'">'+e.title+"</a></div>"}}),p=Backbone.View.extend({optionsDefault:{message:null,status:"info",persistent:!1},initialize:function(t){this.options=e.merge(t,this.optionsDefault),this.setElement("<div></div>"),this.options.message&&this.update(this.options)},update:function(t){this.options=e.merge(t,this.optionsDefault);if(t.message!=""){this.$el.html(this._template(this.options)),this.$el.find(".alert").append(t.message),this.$el.fadeIn(),this.timeout&&window.clearTimeout(this.timeout);if(!t.persistent){var n=this;this.timeout=window.setTimeout(function(){n.$el.is(":visible")?n.$el.fadeOut():n.$el.hide()},3e3)}}else this.$el.fadeOut()},_template:function(e){return'<div class="ui-message alert alert-'+e.status+'"/>'}}),d=Backbone.View.extend({optionsDefault:{onclick:null,searchword:""},initialize:function(t){this.options=e.merge(t,this.optionsDefault),this.setElement(this._template(this.options));var n=this;this.options.onclick&&this.$el.on("submit",function(e){var t=n.$el.find("#search");n.options.onclick(t.val())})},_template:function(e){return'<div class="ui-search"><form onsubmit="return false;"><input id="search" class="form-control input-sm" type="text" name="search" placeholder="Search..." value="'+e.searchword+'">'+'<button type="submit" class="btn search-btn">'+'<i class="fa fa-search"></i>'+"</button>"+"</form>"+"</div>"}}),v=Backbone.View.extend({optionsDefault:{type:"text",placeholder:"",disabled:!1,visible:!0,cls:"",area:!1},initialize:function(t){this.options=e.merge(t,this.optionsDefault),this.setElement(this._template(this.options)),this.options.value!==undefined&&this.value(this.options.value),this.options.disabled&&this.$el.prop("disabled",!0),this.options.visible||this.$el.hide();var n=this;this.$el.on("input",function(){n.options.onchange&&n.options.onchange(n.$el.val())})},value:function(e){return e!==undefined&&this.$el.val(e),this.$el.val()},_template:function(e){return e.area?'<textarea id="'+e.id+'" class="ui-textarea '+e.cls+'"></textarea>':'<input id="'+e.id+'" type="'+e.type+'" value="'+e.value+'" placeholder="'+e.placeholder+'" class="ui-input '+e.cls+'">'}}),m=Backbone.View.extend({initialize:function(e){this.options=e,this.setElement(this._template(this.options)),this.options.value!==undefined&&this.value(this.options.value)},value:function(e){return e!==undefined&&this.$("hidden").val(e),this.$("hidden").val()},_template:function(e){var t='<div id="'+e.id+'" >';return e.info&&(t+="<label>"+e.info+"</label>"),t+='<hidden value="'+e.value+'"/>'+"</div>",t}});return{Anchor:h,Button:l,ButtonIcon:c,ButtonMenu:s,Icon:f,Image:u,Input:v,Label:a,Message:p,Modal:o,RadioButton:r.RadioButton,Checkbox:r.Checkbox,Radio:r.Radio,Searchbox:d,Select:t,Hidden:m,Slider:n,Drilldown:i}}),define("plugin/library/jobs",["utils/utils"],function(e){return Backbone.Model.extend({initialize:function(t,n){this.app=t,this.options=e.merge(n,this.optionsDefault)},request:function(e,t,n,r,i){var s=this;e.state("wait","Requesting job results...");var o=e.get("dataset_id_job");o!=""?s._wait(e,r,i):s._submit(e,t,n,r,i)},cleanup:function(t){var n=this,r=t.get("dataset_id_job");r!=""&&(e.request({type:"PUT",url:config.root+"api/histories/none/contents/"+r,data:{deleted:!0},success:function(){n._refreshHdas()}}),t.set("dataset_id_job",""))},_submit:function(t,n,r,i,s){var o=this,u=t.id,a=t.get("type"),f=t.definition;data={tool_id:"charts",inputs:{input:{id:t.get("dataset_id"),src:"hda"},module:f.execute,columns:r,settings:n}},t.state("wait","Sending job request..."),e.request({type:"POST",url:config.root+"api/tools",data:data,success:function(e){if(!e.outputs||e.outputs.length==0)t.state("failed","Job submission failed. No response."),s&&s();else{o._refreshHdas();var n=e.outputs[0];t.state("wait","Your job has been queued. You may close the browser window. The job will run in the background."),t.set("dataset_id_job",n.id),o.app.storage.save(),o._wait(t,i,s)}},error:function(e){var n="";e&&e.message&&e.message.data&&e.message.data.input&&(n=e.message.data.input+"."),t.state("failed","This visualization requires the 'charts' tool. Please make sure it is installed. "+n),s&&s()}})},_wait:function(t,n,r){var i=this;e.request({type:"GET",url:config.root+"api/datasets/"+t.get("dataset_id_job"),data:{},success:function(e){var s=!1;switch(e.state){case"ok":t.state("wait","Job completed successfully..."),n&&n(e),s=!0;break;case"error":t.state("failed","Job has failed. Please check the history for details."),r&&r(e),s=!0;break;case"running":t.state("wait","Your job is running. You may close the browser window. The job will continue in the background.")}s||setTimeout(function(){i._wait(t,n,r)},i.app.config.get("query_timeout"))}})},_refreshHdas:function(){Galaxy&&Galaxy.currHistoryPanel&&Galaxy.currHistoryPanel.refreshContents()}})}),define("plugin/library/datasets",["utils/utils"],function(e){return Backbone.Collection.extend({list:{},cache:{},initialize:function(t,n){this.app=t,this.options=e.merge(n,this.optionsDefault)},request:function(e){e.groups?this._get_blocks(e):this._get_dataset(e.id,e.success,e.error)},_get_blocks:function(e){function c(i){l._get(i,function(){var s=!1;for(var o in e.groups){destination_group=e.groups[o],source_group=i.groups[o],destination_group.values||(destination_group.values=[]),destination_group.values=destination_group.values.concat(source_group.values);if(source_group.values.length==0){s=!0;break}}if(++f<u&&!s){n&&n(parseInt(f/u*100));var l=i.start+r;i=$.extend(!0,a,{start:l}),c(i)}else t()})}var t=e.success,n=e.progress,r=this.app.config.get("query_limit"),i=e.start||0,s=i+e.query_limit||i+this.app.config.get("query_limit"),o=Math.abs(s-i);if(o<=0){console.debug("FAILED - Datasets::request() - Invalid query range.");return}var u=Math.ceil(o/r)||1,a=$.extend(!0,{},e),f=0,l=this,h=$.extend(!0,a,{start:i});this._get_dataset(e.id,function(){c(h)})},_get_dataset:function(t,n,r){var i=this.list[t];if(i){n(i);return}var s=this;e.request({type:"GET",url:config.root+"api/datasets/"+t,success:function(e){switch(e.state){case"error":r&&r(e);break;default:s.list[t]=e,n(e)}}})},_block_id:function(e,t){return e.id+"_"+e.start+"_"+e.start+this.app.config.get("query_limit")+"_"+t},_get:function(e,t){e.start=e.start||0;var n=[],r={},i=0;for(var s in e.groups){var o=e.groups[s];for(var u in o.columns){var a=o.columns[u].index,f=this._block_id(e,a);if(this.cache[f]||a==="auto"||a==="zero")continue;!r[a]&&a!==undefined&&(r[a]=i,n.push(a),i++)}}if(n.length==0){this._fill_from_cache(e),t(e);return}var l={dataset_id:e.id,start:e.start,columns:n},c=this;this._fetch(l,function(r){for(var i in r){var s=n[i],o=c._block_id(e,s);c.cache[o]=r[i]}c._fill_from_cache(e),t(e)})},_fill_from_cache:function(e){var t=e.start;console.debug("Datasets::_fill_from_cache() - Filling request from cache at "+t+".");var n=0;for(var r in e.groups){var i=e.groups[r];for(var s in i.columns){var o=i.columns[s],u=this._block_id(e,o.index),a=this.cache[u];a&&(n=Math.max(n,a.length))}}n==0&&console.debug("Datasets::_fill_from_cache() - Reached data range limit.");for(var r in e.groups){var i=e.groups[r];i.values=[];for(var f=0;f<n;f++)i.values[f]={x:parseInt(f)+t}}for(var r in e.groups){var i=e.groups[r];for(var s in i.columns){var o=i.columns[s];switch(o.index){case"auto":for(var f=0;f<n;f++){var l=i.values[f];l[s]=parseInt(f)+t}break;case"zero":for(var f=0;f<n;f++){var l=i.values[f];l[s]=0}break;default:var u=this._block_id(e,o.index),a=this.cache[u];for(var f=0;f<n;f++){var l=i.values[f],c=a[f];isNaN(c)&&!o.is_label&&(c=0),l[s]=c}}}}},_fetch:function(t,n){var r=t.start?t.start:0,i=this.app.config.get("query_limit"),s=0;t.columns&&(s=t.columns.length,console.debug("Datasets::_fetch() - Fetching "+s+" column(s) at "+r+".")),s==0&&console.debug("Datasets::_fetch() - No columns requested");var o="";for(var u in t.columns)o+=t.columns[u]+",";o=o.substring(0,o.length-1);var a=this;e.request({type:"GET",url:config.root+"api/datasets/"+t.dataset_id,data:{data_type:"raw_data",provider:"dataset-column",limit:i,offset:r,indeces:o},success:function(e){var t=new Array(s);for(var r=0;r<s;r++)t[r]=[];for(var r in e.data){var i=e.data[r];for(var o in i){var u=i[o];u!==undefined&&u!=2147483647&&t[o].push(u)}}console.debug("Datasets::_fetch() - Fetching complete."),n(t)}})}})}),define("plugin/models/group",[],function(){return Backbone.Model.extend({defaults:{key:"Data label",date:""},reset:function(){this.clear({silent:!0}).set(this.defaults),this.trigger("reset",this)}})}),define("plugin/models/groups",["plugin/models/group"],function(e){return Backbone.Collection.extend({model:e})}),define("plugin/models/chart",["plugin/models/groups"],function(e){return Backbone.Model.extend({defaults:{id:null,title:"",type:"",date:null,state:"",state_info:"",modified:!1,dataset_id:"",dataset_id_job:""},initialize:function(t){this.groups=new e,this.settings=new Backbone.Model},reset:function(){this.clear({silent:!0}).set(this.defaults),this.groups.reset(),this.settings.clear(),this.trigger("reset",this)},copy:function(e){var t=this;t.clear({silent:!0}).set(this.defaults),t.set(e.attributes),t.settings=e.settings.clone(),t.groups.reset(),e.groups.each(function(e){t.groups.add(e.clone())}),t.trigger("change",t)},state:function(e,t){this.set("state",e),this.set("state_info",t),this.trigger("set:state"),console.debug("Chart:state() - "+t+" ("+e+")")}})});var Visualization=Backbone.Model.extend({defaults:{config:{}},urlRoot:function(){var e="/api/visualizations";return window.galaxy_config&&galaxy_config.root?galaxy_config.root+e:e},initialize:function(e){_.isObject(e.config)&&_.isObject(this.defaults.config)&&_.defaults(e.config,this.defaults.config),this._setUpListeners()},_setUpListeners:function(){},set:function(e,t){if(e==="config"){var n=this.get("config");_.isObject(n)&&(t=_.extend(_.clone(n),t))}return Backbone.Model.prototype.set.call(this,e,t),this},toString:function(){var e=this.get("id")||"";return this.get("title")&&(e+=":"+this.get("title")),"Visualization("+e+")"}}),VisualizationCollection=Backbone.Collection.extend({model:Visualization,url:function(){return galaxy_config.root+"api/visualizations"},initialize:function(e,t){t=t||{}},set:function(e,t){var n=this;e=_.map(e,function(e){var t=n.get(e.id);if(!t)return e;var r=t.toJSON();return _.extend(r,e),r}),Backbone.Collection.prototype.set.call(this,e,t)},toString:function(){return["VisualizationCollection(",[this.historyId,this.length].join(),")"].join("")}});define("mvc/visualization/visualization-model",function(){}),define("plugin/library/storage",["utils/utils","plugin/models/chart","plugin/models/group","mvc/visualization/visualization-model"],function(e,t,n){return Backbone.Model.extend({vis:null,initialize:function(e){this.app=e,this.chart=this.app.chart,this.options=this.app.options,this.id=this.options.id,this.vis=new Visualization({type:"charts",config:{dataset_id:this.options.config.dataset_id,chart_dict:{}}}),this.id&&(this.vis.id=this.id);var t=this.options.config.chart_dict;t&&(this.vis.get("config").chart_dict=t)},save:function(){var e=this.app.chart;this.vis.get("config").chart_dict={};var t=e.get("title");t!=""&&this.vis.set("title",t);var n={attributes:e.attributes,settings:e.settings.attributes,groups:[]};e.groups.each(function(e){n.groups.push(e.attributes)}),this.vis.get("config").chart_dict=n;var r=this;this.vis.save().fail(function(e,t,n){console.error(e,t,n)}).then(function(e){e&&e.id&&(r.id=e.id)})},load:function(){var e=this.vis.get("config").chart_dict;if(!e.attributes)return!1;var t=e.attributes.type;if(!t)return console.debug("Storage::load() - Chart type not provided. Invalid format."),!1;var r=this.app.types.get(t);if(!r)return console.debug("Storage::load() - Chart type not supported. Please re-configure the chart. Resetting chart."),!1;console.debug("Storage::load() - Loading chart type "+t+"."),this.chart.definition=r,this.chart.set(e.attributes),this.chart.state("ok","Loading saved visualization..."),this.chart.settings.set(e.settings);for(var i in e.groups)this.chart.groups.add(new n(e.groups[i]));return this.chart.set("modified",!1),!0}})}),define("utils/deferred",["utils/utils"],function(e){return Backbone.Model.extend({queue:[],process:{},counter:0,initialize:function(){this.on("refresh",function(){if(this.queue.length>0&&this.ready()){var e=this.queue[0];this.queue.splice(0,1),e&&e()}})},execute:function(e){this.queue.push(e),this.trigger("refresh")},register:function(){var t=e.uuid();return this.process[t]=!0,this.counter++,console.debug("Deferred:register() - Registering "+t),t},done:function(e){this.process[e]&&(delete this.process[e],this.counter--,console.debug("Deferred:done() - Unregistering "+e),this.trigger("refresh"))},reset:function(){this.queue=[]},ready:function(){return this.counter==0}})}),define("plugin/views/viewport",["mvc/ui/ui-portlet","mvc/ui/ui-misc","utils/utils"],function(e,t,n){return Backbone.View.extend({container_list:[],canvas_list:[],initialize:function(e,t){this.app=e,this.chart=this.app.chart,this.options=n.merge(t,this.optionsDefault),this.setElement($(this._template())),this._fullscreen(this.$el,100);var r=$("body").css("overflow");this.$el.on("mouseover",function(){$("body").css("overflow","hidden")}).on("mouseout",function(){$("body").css("overflow",r)}),this._createContainer("div");var i=this;this.chart.on("redraw",function(){i._draw(i.chart)}),this.chart.on("set:state",function(){var e=i.$el.find("#info"),t=i.$el.find(".charts-viewport-container"),n=e.find("#icon");n.removeClass(),e.show(),e.find("#text").html(i.chart.get("state_info"));var r=i.chart.get("state");switch(r){case"ok":e.hide(),t.show();break;case"failed":n.addClass("icon fa fa-warning"),t.hide();break;default:n.addClass("icon fa fa-spinner fa-spin"),t.show()}})},show:function(){this.$el.show()},hide:function(){this.$el.hide()},_fullscreen:function(e,t){e.css("height",$(window).height()-t),$(window).resize(function(){e.css("height",$(window).height()-t)})},_createContainer:function(e,t){t=t||1;for(var n in this.container_list)this.container_list[n].remove();this.container_list=[],this.canvas_list=[];for(var n=0;n<t;n++){var r=$(this._templateContainer(e,parseInt(100/t)));this.$el.append(r),this.container_list[n]=r,this.canvas_list[n]=r.find(".charts-viewport-canvas").attr("id")}},_draw:function(e){var t=this,n=this.app.deferred.register(),r=e.get("type");this.chart_definition=e.definition;var i=1;e.settings.get("use_panels")==="true"&&(i=e.groups.length),this._createContainer(this.chart_definition.tag,i),e.state("wait","Please wait...");if(!this.chart_definition.execute||this.chart_definition.execute&&e.get("modified"))this.app.jobs.cleanup(e),e.set("modified",!1);var t=this;require(["plugin/charts/"+this.app.chartPath(r)+"/wrapper"],function(r){if(t.chart_definition.execute)t.app.jobs.request(e,t._defaultSettingsString(e),t._defaultRequestString(e),function(){var i=new r(t.app,{process_id:n,chart:e,request_dictionary:t._defaultRequestDictionary(e),canvas_list:t.canvas_list})},function(){this.app.deferred.done(n)});else var i=new r(t.app,{process_id:n,chart:e,request_dictionary:t._defaultRequestDictionary(e),canvas_list:t.canvas_list})})},_defaultRequestString:function(e){var t="",n=0,r=this;return e.groups.each(function(e){n++;for(var i in r.chart_definition.columns)t+=i+"_"+n+":"+(parseInt(e.get(i))+1)+", "}),t.substring(0,t.length-2)},_defaultSettingsString:function(e){var t="";for(key in e.settings.attributes)t+=key+":"+e.settings.get(key)+", ";return t.substring(0,t.length-2)},_defaultRequestDictionary:function(e){var t={groups:[]};this.chart_definition.execute?t.id=e.get("dataset_id_job"):t.id=e.get("dataset_id");var r=0,i=this;return e.groups.each(function(e){var s={};for(var o in i.chart_definition.columns){var u=i.chart_definition.columns[o];s[o]=n.merge({index:e.get(o)},u)}t.groups.push({key:++r+":"+e.get("key"),columns:s})}),t},_template:function(){return'<div class="charts-viewport"><div id="info" class="info"><span id="icon" class="icon"/><span id="text" class="text" /></div></div>'},_templateContainer:function(e,t){return'<div class="charts-viewport-container" style="width:'+t+'%;">'+'<div id="menu"/>'+"<"+e+' id="'+n.uuid()+'" class="charts-viewport-canvas">'+"</div>"}})}),define("plugin/library/screenshot",["libs/underscore"],function(e){function t(e){e.$el.find("svg").length>0?r(e):n(e)}function n(e){try{var t=e.$el.find(".jqplot-target"),n=t.jqplotToImageStr({});n&&(window.location.href=n.replace("image/png","image/octet-stream"))}catch(r){console.debug("FAILED - Screenshot::_fromCanvas() - "+r),e.error&&e.error("Please reduce your chart to a single panel and try again.")}}function r(e){var t=e.$el,n=e.url,r=e.name,s=new XMLSerializer,o=document.createElement("canvas"),u=$(o),a=t.find("svg").length,f=t.find("svg").first(),l=parseInt(f.css("height")),c=parseInt(f.css("width"));u.attr("width",c*a),u.attr("height",l),(!o.getContext||!o.getContext("2d"))&&alert("Your browser doesn't support this feature, please use a modern browser");var h=o.getContext("2d"),p=0;t.find("svg").each(function(){var e=$(this);e.attr({version:"1.1",xmlns:"http://www.w3.org/2000/svg",width:c,height:l});var t=s.serializeToString(this);h.drawSvg(t,p,0,c,l),p+=c}),window.location.href=i(o,o.getContext("2d"),"white").replace("image/png","image/octet-stream")}function i(e,t,n){var r=e.width,i=e.height,s;if(n){s=t.getImageData(0,0,r,i);var o=t.globalCompositeOperation;t.globalCompositeOperation="destination-over",t.fillStyle=n,t.fillRect(0,0,r,i)}var u=e.toDataURL("image/png");return n&&(t.clearRect(0,0,r,i),t.putImageData(s,0,0),t.globalCompositeOperation=o),u}function s(e){window.location.href="data:none/none;base64,"+btoa(a(e).string)}function o(e){for(var t in document.styleSheets){var n=document.styleSheets[t],r=n.cssRules;if(r)for(var i=0,s=r.length;i<s;i++)try{e.find(r[i].selectorText).each(function(e,t){t.style.cssText+=r[i].style.cssText})}catch(o){}}}function u(e){var t=a(e),n={filename:name||"chart",type:"application/pdf",height:t.height,width:t.width,scale:2,svg:t.string},r=$("body"),i=r.find("#viewport-form");i.length===0&&(i=$("<form>",{id:"viewport-form",method:"post",action:"http://export.highcharts.com/",display:"none"}),r.append(i)),i.empty();for(name in n){var s=$("<input/>",{type:"hidden",name:name,value:n[name]});i.append(s)}try{i.submit()}catch(o){console.log(o)}}function a(e){if(e.$el.find("svg").length==0&&e.error){e.error("No SVG found. This chart type does not support SVG/PDF export.");return}var t=e.$el,n=t.find("svg").length,r=parseInt(t.find("svg").first().css("height")),i=parseInt(t.find("svg").first().css("width")),s=new XMLSerializer,u=$("<svg/>");u.attr({version:"1.1",xmlns:"http://www.w3.org/2000/svg",width:i*n,height:r});var a="",f=0;return t.find("svg").each(function(){var e=$(this).clone();o(e);var t=$('<g transform="translate('+f+', 0)">');t.append(e.find("g").first()),u.append(t),f+=i}),{string:s.serializeToString(u[0]),height:r,width:i}}return{createPNG:t,createSVG:s,createPDF:u}}),define("plugin/views/viewer",["utils/utils","mvc/ui/ui-misc","mvc/ui/ui-portlet","plugin/views/viewport","plugin/library/screenshot"],function(e,t,n,r,i){return Backbone.View.extend({initialize:function(e,s){this.app=e,this.chart=this.app.chart,this.viewport_view=new r(e);var o=this;this.message=new t.Message;var u=new t.ButtonMenu({icon:"fa-camera",title:"Screenshot",tooltip:"Download as PNG, SVG or PDF file"});u.addMenu({id:"button-png",title:"Save as PNG",icon:"fa-file",onclick:function(){o._wait(o.chart,function(){i.createPNG({$el:o.viewport_view.$el,title:o.chart.get("title"),error:function(e){o.message.update({message:e,status:"danger"})}})})}}),u.addMenu({id:"button-svg",title:"Save as SVG",icon:"fa-file-text-o",onclick:function(){o._wait(o.chart,function(){i.createSVG({$el:o.viewport_view.$el,title:o.chart.get("title"),error:function(e){o.message.update({message:e,status:"danger"})}})})}}),u.addMenu({id:"button-png",title:"Save as PDF",icon:"fa-file-o",onclick:function(){o.app.modal.show({title:"Send chart data for PDF creation",body:"Galaxy does not provide integrated PDF export scripts. You may click 'Continue' to create the PDF by using a 3rd party service (https://export.highcharts.com)",buttons:{Cancel:function(){o.app.modal.hide()},Continue:function(){o.app.modal.hide(),o._wait(o.chart,function(){i.createPDF({$el:o.viewport_view.$el,title:o.chart.get("title"),error:function(e){o.message.update({message:e,status:"danger"})}})})}}})}}),this.portlet=new n.View({icon:"fa-bar-chart-o",title:"Viewport",operations:{edit_button:new t.ButtonIcon({icon:"fa-edit",tooltip:"Customize this chart",title:"Editor",onclick:function(){o._wait(o.chart,function(){o.app.go("editor")})}}),picture_button_menu:u}}),this.portlet.append(this.message.$el),this.portlet.append(this.viewport_view.$el),this.setElement(this.portlet.$el);var o=this;this.chart.on("change:title",function(){o._refreshTitle()})},show:function(){this.$el.show(),$(window).trigger("resize")},hide:function(){this.$el.hide()},_refreshTitle:function(){var e=this.chart.get("title");this.portlet.title(e)},_wait:function(e,t){this.app.deferred.ready()?t():this.message.update({message:"Your chart is currently being processed. Please wait and try again."})}})}),define("mvc/ui/ui-tabs",["utils/utils"],function(e){var t=Backbone.View.extend({optionsDefault:{title_new:"",operations:null,onnew:null,max:null,onchange:null},initialize:function(t){this.visible=!1,this.$nav=null,this.$content=null,this.first_tab=null,this.current_id=null,this.options=e.merge(t,this.optionsDefault);var n=$(this._template(this.options));this.$nav=n.find(".tab-navigation"),this.$content=n.find(".tab-content"),this.setElement(n),this.list={};var r=this;this.options.operations&&$.each(this.options.operations,function(e,t){t.$el.prop("id",e),r.$nav.find(".operations").append(t.$el)});if(this.options.onnew){var i=$(this._template_tab_new(this.options));this.$nav.append(i),i.tooltip({title:"Add a new tab",placement:"bottom",container:r.$el}),i.on("click",function(e){i.tooltip("hide"),r.options.onnew()})}},size:function(){return _.size(this.list)},current:function(){return this.$el.find(".tab-pane.active").attr("id")},add:function(e){var t=this,n=e.id,r=$(this._template_tab(e)),i=$(this._template_tab_content(e));this.list[n]=e.ondel?!0:!1,this.options.onnew?this.$nav.find("#new-tab").before(r):this.$nav.append(r),i.append(e.$el),this.$content.append(i),this.size()==1&&(r.addClass("active"),i.addClass("active"),this.first_tab=n),this.options.max&&this.size()>=this.options.max&&this.$el.find("#new-tab").hide();if(e.ondel){var s=r.find("#delete");s.tooltip({title:"Delete this tab",placement:"bottom",container:t.$el}),s.on("click",function(){return s.tooltip("destroy"),t.$el.find(".tooltip").remove(),e.ondel(),!1})}r.on("click",function(r){r.preventDefault(),e.onclick?e.onclick():t.show(n)}),this.current_id||(this.current_id=n)},del:function(e){this.$el.find("#tab-"+e).remove(),this.$el.find("#"+e).remove(),this.first_tab==e&&(this.first_tab=null),this.first_tab!=null&&this.show(this.first_tab),this.list[e]&&delete this.list[e],this.size()<this.options.max&&this.$el.find("#new-tab").show()},delRemovable:function(){for(var e in this.list)this.del(e)},show:function(e){this.$el.fadeIn("fast"),this.visible=!0,e&&(this.$el.find("#tab-"+this.current_id).removeClass("active"),this.$el.find("#"+this.current_id).removeClass("active"),this.$el.find("#tab-"+e).addClass("active"),this.$el.find("#"+e).addClass("active"),this.current_id=e),this.options.onchange&&this.options.onchange(e)},hide:function(){this.$el.fadeOut("fast"),this.visible=!1},hideOperation:function(e){this.$nav.find("#"+e).hide()},showOperation:function(e){this.$nav.find("#"+e).show()},setOperation:function(e,t){var n=this.$nav.find("#"+e);n.off("click"),n.on("click",t)},title:function(e,t){var n=this.$el.find("#tab-title-text-"+e);return t&&n.html(t),n.html()},retitle:function(e){var t=0;for(var n in this.list)this.title(n,++t+": "+e)},_template:function(e){return'<div class="ui-tabs tabbable tabs-left"><ul id="tab-navigation" class="tab-navigation nav nav-tabs"><div class="operations" style="float: right; margin-bottom: 4px;"></div></ul><div id="tab-content" class="tab-content"/></div>'},_template_tab_new:function(e){return'<li id="new-tab"><a href="javascript:void(0);"><i class="ui-tabs-add fa fa-plus-circle"/>'+e.title_new+"</a>"+"</li>"},_template_tab:function(e){var t='<li id="tab-'+e.id+'" class="tab-element">'+'<a id="tab-title-link-'+e.id+'" title="" href="#'+e.id+'" data-original-title="">'+'<span id="tab-title-text-'+e.id+'" class="tab-title-text">'+e.title+"</span>";return e.ondel&&(t+='<i id="delete" class="ui-tabs-delete fa fa-minus-circle"/>'),t+="</a></li>",t},_template_tab_content:function(e){return'<div id="'+e.id+'" class="tab-pane"/>'}});return{View:t}}),define("mvc/ui/ui-table",["utils/utils"],function(e){var t=Backbone.View.extend({row:null,row_count:0,optionsDefault:{content:"No content available.",onchange:null,ondblclick:null,onconfirm:null,cls:"ui-table",cls_tr:""},events:{click:"_onclick",dblclick:"_ondblclick"},initialize:function(t){this.options=e.merge(t,this.optionsDefault);var n=$(this._template(this.options));this.$thead=n.find("thead"),this.$tbody=n.find("tbody"),this.$tmessage=n.find("tmessage"),this.setElement(n),this.row=this._row()},addHeader:function(e){var t=$("<th></th>");t.append(e),this.row.append(t)},appendHeader:function(){this.$thead.append(this.row),this.row=$("<tr></tr>")},add:function(e,t,n){var r=$("<td></td>");t&&r.css("width",t),n&&r.css("text-align",n),r.append(e),this.row.append(r)},append:function(e,t){this._commit(e,t,!1)},prepend:function(e,t){this._commit(e,t,!0)},get:function(e){return this.$el.find("#"+e)},del:function(e){var t=this.$tbody.find("#"+e);t.length>0&&(t.remove(),this.row_count--,this._refresh())},delAll:function(){this.$tbody.empty(),this.row_count=0,this._refresh()},value:function(e){this.before=this.$tbody.find(".current").attr("id"),e!==undefined&&(this.$tbody.find("tr").removeClass("current"),e&&this.$tbody.find("#"+e).addClass("current"));var t=this.$tbody.find(".current").attr("id");return t===undefined?null:(t!=this.before&&this.options.onchange&&this.options.onchange(e),t)},size:function(){return this.$tbody.find("tr").length},_commit:function(e,t,n){this.del(e),this.row.attr("id",e),n?this.$tbody.prepend(this.row):this.$tbody.append(this.row),t&&(this.row.hide(),this.row.fadeIn()),this.row=this._row(),this.row_count++,this._refresh()},_row:function(){return $('<tr class="'+this.options.cls_tr+'"></tr>')},_onclick:function(e){var t=this.value(),n=$(e.target).closest("tr").attr("id");n!=""&&n&&t!=n&&(this.options.onconfirm?this.options.onconfirm(n):this.value(n))},_ondblclick:function(e){var t=this.value();t&&this.options.ondblclick&&this.options.ondblclick(t)},_refresh:function(){this.row_count==0?this.$tmessage.show():this.$tmessage.hide()},_template:function(e){return'<div><table class="'+e.cls+'">'+"<thead></thead>"+"<tbody></tbody>"+"</table>"+"<tmessage>"+e.content+"</tmessage>"+"<div>"}});return{View:t}}),define("plugin/views/group",["mvc/ui/ui-table","mvc/ui/ui-misc","utils/utils"],function(e,t,n){return Backbone.View.extend({initialize:function(r,i){this.app=r;var s=this;this.chart=this.app.chart,this.group=i.group,this.group_key=new t.Input({placeholder:"Data label",onchange:function(e){s.group.set("key",e)}}),this.table=new e.View({content:"No data column."});var o=$("<div/>");o.append(n.wrap((new t.Label({title:"Provide a label:"})).$el)),o.append(n.wrap(this.group_key.$el)),o.append(n.wrap((new t.Label({title:"Select columns:"})).$el)),o.append(n.wrap(this.table.$el)),this.setElement(o);var s=this;this.chart.on("change:dataset_id",function(){s._refreshTable()}),this.chart.on("change:type",function(){s._refreshTable()}),this.group.on("change:key",function(){s._refreshGroupKey()}),this.group.on("change",function(){s._refreshGroup()}),this._refreshTable(),this._refreshGroupKey(),this._refreshGroup()},_refreshTable:function(){var e=this.chart.get("dataset_id"),n=this.chart.get("type");if(!e||!n)return;var r=this,i=this.chart.definition;this.table.delAll();var s={};for(var o in i.columns){var u=i.columns[o];if(!u){console.debug("Group::_refreshTable() - Skipping column definition.");continue}var a=new t.Select.View({id:"select_"+o,wait:!0}),f=u.title;u.is_unique&&(f+=" (all data labels)"),this.table.add(f,"25%"),this.table.add(a.$el),this.table.append(o),s[o]=a}this.chart.state("wait","Loading metadata...");var l=this.app.deferred.register(),c={id:e,success:function(e){for(var t in s)r._addRow(t,e,s,i.columns[t]);r.chart.state("ok","Metadata initialized..."),r.app.deferred.done(l)}};this.app.datasets.request(c)},_addRow:function(e,t,n,r){var i=this,s=r.is_label,o=r.is_auto,u=r.is_numeric,a=r.is_unique,f=r.is_zero,l=[],c=n[e];o&&l.push({label:"Column: Row Number",value:"auto"}),f&&l.push({label:"Column: None",value:"zero"});var h=t.metadata_column_types;for(var p in h){var d=!1;h[p]=="int"||h[p]=="float"?d=u:d=s,d&&l.push({label:"Column: "+(parseInt(p)+1)+" ["+h[p]+"]",value:p})}c.update(l),a&&this.chart.groups.first()&&this.group.set(e,this.chart.groups.first().get(e));if(!c.exists(this.group.get(e))){var v=c.first();console.debug('Group()::_addRow() - Switching model value from "'+this.group.get(e)+'" to "'+v+'".'),this.group.set(e,v)}c.value(this.group.get(e)),this.group.off("change:"+e),this.group.on("change:"+e,function(){c.value(i.group.get(e))}),c.setOnChange(function(t){a?i.chart.groups.each(function(n){n.set(e,t)}):i.group.set(e,t),i.chart.set("modified",!0)}),c.show()},_refreshGroup:function(){this.group.set("date",n.time())},_refreshGroupKey:function(){var e=this.group.get("key");e===undefined&&(e=""),e!=this.group_key.value()&&this.group_key.value(e)}})}),define("plugin/library/ui-table-form",["mvc/ui/ui-table","mvc/ui/ui-misc","utils/utils"],function(e,t,n){var r=Backbone.View.extend({optionsDefault:{title:"",content:"",mode:""},list:[],initialize:function(r,i){this.app=r,this.options=n.merge(i,this.optionsDefault),this.table_title=new t.Label({title:this.options.title}),this.table=new e.View({content:this.options.content});var s=$('<div class="ui-table-form"/>');this.options.title&&s.append(n.wrap(this.table_title.$el)),s.append(n.wrap(this.table.$el)),this.setElement(s)},title:function(e){this.table_title.title(e)},update:function(e,t){this.table.delAll(),this.list=[];for(var n in e)this._add(e[n].id||n,e[n],t);for(var n in this.list)this.list[n].trigger("change")},_add:function(e,n,r){var i=this,s=null,o=n.type;switch(o){case"text":s=new t.Input({id:"field-"+e,placeholder:n.placeholder,value:r.get(e),onchange:function(t){r.set(e,t)}});break;case"radiobutton":s=new t.RadioButton.View({id:"field-"+e,data:n.data,value:r.get(e),onchange:function(t){r.set(e,t);var s=_.findWhere(n.data,{value:t});if(s&&s.operations){var o=s.operations;for(var u in o.show){var a=o.show[u];i.table.get(a).show()}for(var u in o.hide){var a=o.hide[u];i.table.get(a).hide()}}}});break;case"select":s=new t.Select.View({id:"field-"+e,data:n.data,value:r.get(e),onchange:function(t){r.set(e,t);var s=_.findWhere(n.data,{value:t});if(s&&s.operations){var o=s.operations;for(var u in o.show){var a=o.show[u];i.table.get(a).show()}for(var u in o.hide){var a=o.hide[u];i.table.get(a).hide()}}}});break;case"dataset":s=new t.Select.View({id:"field-"+e,onchange:function(t){r.set(e,t)}}),i.app.datasets.on("all",function(){var t=[];i.app.datasets.each(function(e){e.get("datatype_id")==n.data&&t.push({value:e.get("id"),label:e.get("name")})}),s.update(t),r.get(e)||r.set(e,s.first()),s.value(r.get(e))}),i.app.datasets.trigger("all.datasets");break;case"textarea":s=new t.Textarea({id:"field-"+e,onchange:function(){r.set(e,s.value())}});break;case"separator":s=$("<div/>");break;default:s=new t.Input({id:"field-"+e,placeholder:n.placeholder,type:n.type,onchange:function(){r.set(e,s.value())}})}if(o!="separator"){r.get(e)||r.set(e,n.init),s.value(r.get(e)),this.list[e]=s;var u=$("<div/>");u.append(s.$el),n.info&&u.append('<div class="ui-table-form-info">'+n.info+"</div>"),this.options.style=="bold"?(this.table.add((new t.Label({title:n.title,cls:"form-label"})).$el),this.table.add(u)):(this.table.add('<span class="ui-table-form-title">'+n.title+"</span>","25%"),this.table.add(u))}else this.table.add('<div class="ui-table-form-separator">'+n.title+":<div/>"),this.table.add($("<div/>"));this.table.append(e),n.hide&&this.table.get(e).hide()}});return{View:r}}),define("plugin/views/settings",["mvc/ui/ui-misc","plugin/library/ui-table-form","utils/utils"],function(e,t,n){return Backbone.View.extend({initialize:function(e,n){this.app=e;var r=this;this.chart=this.app.chart,this.form=new t.View(e,{title:"Configuration",content:"This chart type does not provide any options."}),this.setElement(this.form.$el);var r=this;this.chart.on("change",function(){r._refresh()})},_refresh:function(){var e=this.chart.definition;if(!e)return;this.form.title(e.category+" - "+e.title+":"),this.form.update(e.settings,this.chart.settings)}})}),define("plugin/views/types",["utils/utils","mvc/ui/ui-misc"],function(e,t){return Backbone.View.extend({optionsDefault:{onchange:null,ondblclick:null},events:{click:"_onclick",dblclick:"_ondblclick"},initialize:function(n,r){var i=this;this.app=n,this.options=e.merge(r,this.optionsDefault);var s=$('<div class="charts-grid"/>');s.append(e.wrap((new t.Label({title:"How many data points would you like to analyze?"})).$el)),this.library=new t.RadioButton.View({data:[{label:"Few (<500)",value:"small"},{label:"Some (<10k)",value:"medium"},{label:"Many (>10k)",value:"large"}],onchange:function(e){i._filter(e)}}),s.append(e.wrap(this.library.$el)),this.setElement(s),this._render(),this.library.value("small"),this.library.trigger("change")},value:function(e){var t=this.$el.find(".current").attr("id");e!==undefined&&(this.$el.find(".current").removeClass("current"),this.$el.find("#"+e).addClass("current"));var n=this.$el.find(".current").attr("id");return n===undefined?null:(n!=t&&this.options.onchange&&this.options.onchange(e),n)},_filter:function(e){this.$el.find(".header").hide();var t=this.app.types.attributes;for(var n in t){var r=t[n],i=this.$el.find("#"+n),s=this.$el.find("#types-header-"+this.categories_index[r.category]),o=r.keywords||"";o.indexOf(e)>=0?(i.show(),s.show()):i.hide()}},_render:function(){this.categories={},this.categories_index={};var e=0,t=this.app.types.attributes;for(var n in t){var r=t[n],i=r.category;this.categories[i]||(this.categories[i]={},this.categories_index[i]=e++),this.categories[i][n]=r}for(var i in this.categories){var s=$('<div style="clear: both;"/>');s.append(this._template_header({id:"types-header-"+this.categories_index[i],title:i}));for(var n in this.categories[i]){var r=this.categories[i][n],o=r.title+" ("+r.library+")";r.zoomable&&(o='<span class="fa fa-search-plus"/>'+o),s.append(this._template_item({id:n,title:o,url:config.app_root+"charts/"+this.app.chartPath(n)+"/logo.png"}))}this.$el.append(s)}},_onclick:function(e){var t=this.value(),n=$(e.target).closest(".item").attr("id");n!=""&&n&&t!=n&&this.value(n)},_ondblclick:function(e){var t=this.value();t&&this.options.ondblclick&&this.options.ondblclick(t)},_template_header:function(e){return'<div id="'+e.id+'" class="header">'+"• "+e.title+"<div>"},_template_item:function(e){return'<div id="'+e.id+'" class="item">'+'<img class="image" src="'+e.url+'">'+'<div class="title">'+e.title+"</div>"+"<div>"}})}),define("plugin/views/editor",["mvc/ui/ui-tabs","mvc/ui/ui-misc","mvc/ui/ui-portlet","utils/utils","plugin/models/chart","plugin/models/group","plugin/views/group","plugin/views/settings","plugin/views/types"],function(e,t,n,r,i,s,o,u,a){return Backbone.View.extend({initialize:function(i,s){var o=this;this.app=i,this.chart=this.app.chart,this.message=new t.Message,this.portlet=new n.View({icon:"fa-bar-chart-o",title:"Editor",operations:{save:new t.ButtonIcon({icon:"fa-save",tooltip:"Draw Chart",title:"Draw",onclick:function(){o._saveChart()}}),back:new t.ButtonIcon({icon:"fa-caret-left",tooltip:"Return to Viewer",title:"Cancel",onclick:function(){o.app.go("viewer"),o.app.storage.load()}})}}),this.types=new a(i,{onchange:function(e){var t=o.app.types.get(e);t||console.debug("FAILED - Editor::onchange() - Chart type not supported."),o.chart.definition=t,o.chart.settings.clear(),o.chart.set({type:e}),o.chart.set("modified",!0),console.debug("Editor::onchange() - Switched chart type.")},ondblclick:function(e){o._saveChart()}}),this.tabs=new e.View({title_new:"Add Data",onnew:function(){var e=o._addGroupModel();o.tabs.show(e.id)}}),this.title=new t.Input({placeholder:"Chart title",onchange:function(){o.chart.set("title",o.title.value())}});var f=$("<div/>");f.append(r.wrap((new t.Label({title:"Provide a chart title:"})).$el)),f.append(this.title.$el),f.append($("<div/>").addClass("ui-table-form-info").html("This title will appear in the list of 'Saved Visualizations'. Charts are saved upon creation.")),f.append(r.wrap()),f.append(r.wrap(this.types.$el)),this.tabs.add({id:"main",title:"Start",$el:f}),this.settings=new u(this.app),this.tabs.add({id:"settings",title:"Configuration",$el:this.settings.$el}),this.portlet.append(this.message.$el),this.portlet.append(this.tabs.$el),this.setElement(this.portlet.$el),this.tabs.hideOperation("back");var o=this;this.chart.on("change:title",function(e){o._refreshTitle()}),this.chart.on("change:type",function(e){o.types.value(e.get("type"))}),this.chart.on("reset",function(e){o._resetChart()}),this.app.chart.on("redraw",function(e){o.portlet.showOperation("back")}),this.app.chart.groups.on("add",function(e){o._addGroup(e)}),this.app.chart.groups.on("remove",function(e){o._removeGroup(e)}),this.app.chart.groups.on("reset",function(e){o._removeAllGroups()}),this.app.chart.groups.on("change:key",function(e){o._refreshGroupKey()}),this._resetChart()},show:function(){this.$el.show()},hide:function(){this.$el.hide()},_refreshTitle:function(){var e=this.chart.get("title");this.portlet.title(e),this.title.value()!=e&&this.title.value(e)},_refreshGroupKey:function(){var e=this,t=0;this.chart.groups.each(function(n){var r=n.get("key","");r==""&&(r="Data label"),e.tabs.title(n.id,++t+": "+r)})},_addGroupModel:function(){var e=new s({id:r.uuid()});return this.chart.groups.add(e),e},_addGroup:function(e){var t=this,n=new o(this.app,{group:e});this.tabs.add({id:e.id,$el:n.$el,ondel:function(){t.chart.groups.remove(e.id)}}),this._refreshGroupKey(),this.chart.set("modified",!0)},_removeGroup:function(e){this.tabs.del(e.id),this._refreshGroupKey(),this.chart.set("modified",!0)},_removeAllGroups:function(e){this.tabs.delRemovable()},_resetChart:function(){this.chart.set("id",r.uuid()),this.chart.set("type","nvd3_bar"),this.chart.set("dataset_id",this.app.options.config.dataset_id),this.chart.set("title","New Chart"),this.portlet.hideOperation("back")},_saveChart:function(){this.chart.set({type:this.types.value(),title:this.title.value(),date:r.time()});if(this.chart.groups.length==0){this.message.update({message:"Please select data columns before drawing the chart."});var e=this._addGroupModel();this.tabs.show(e.id);return}var t=this,n=!0,i=this.chart.definition;this.chart.groups.each(function(e){if(!n)return;for(var r in i.columns)if(e.attributes[r]=="null"){t.message.update({status:"danger",message:"This chart type requires column types not found in your tabular file."}),t.tabs.show(e.id),n=!1;return}});if(!n)return;this.app.go("viewer");var t=this;this.app.deferred.execute(function(){t.app.storage.save(),t.chart.trigger("redraw")})}})}),define("plugin/models/config",[],function(){return Backbone.Model.extend({defaults:{query_limit:1e4,query_timeout:100}})}),define("plugin/charts/forms/default",[],function(){return{title:"",category:"",library:"",tag:"",keywords:"",settings:{separator_x:{title:"X axis",type:"separator"},x_axis_label:{title:"Axis label",info:"Provide a label for the axis.",type:"text",init:"X-axis",placeholder:"Axis label"},x_axis_type:{title:"Axis value type",info:"Select the value type of the axis.",type:"select",init:"auto",data:[{label:"-- Do not show values --",value:"hide",operations:{hide:["x_axis_precision"]}},{label:"Auto",value:"auto",operations:{hide:["x_axis_precision"]}},{label:"Float",value:"f",operations:{show:["x_axis_precision"]}},{label:"Exponent",value:"e",operations:{show:["x_axis_precision"]}},{label:"Integer",value:"d",operations:{hide:["x_axis_precision"]}},{label:"Percentage",value:"p",operations:{show:["x_axis_precision"]}},{label:"SI-prefix",value:"s",operations:{hide:["x_axis_precision"]}}]},x_axis_precision:{title:"Axis tick format",info:"Select the tick format for the axis.",type:"select",init:"1",data:[{label:"0.00001",value:"5"},{label:"0.0001",value:"4"},{label:"0.001",value:"3"},{label:"0.01",value:"2"},{label:"0.1",value:"1"},{label:"1",value:"0"}]},separator_y:{title:"Y axis",type:"separator"},y_axis_label:{title:"Axis label",info:"Provide a label for the axis.",type:"text",init:"Y-axis",placeholder:"Axis label"},y_axis_type:{title:"Axis value type",info:"Select the value type of the axis.",type:"select",init:"auto",data:[{label:"-- Do not show values --",value:"hide",operations:{hide:["y_axis_precision"]}},{label:"Auto",value:"auto",operations:{hide:["y_axis_precision"]}},{label:"Float",value:"f",operations:{show:["y_axis_precision"]}},{label:"Exponent",value:"e",operations:{show:["y_axis_precision"]}},{label:"Integer",value:"d",operations:{hide:["y_axis_precision"]}},{label:"Percentage",value:"p",operations:{show:["y_axis_precision"]}},{label:"SI-prefix",value:"s",operations:{hide:["y_axis_precision"]}}]},y_axis_precision:{title:"Axis tick format",info:"Select the tick format for the axis.",type:"select",init:"1",data:[{label:"0.00001",value:"5"},{label:"0.0001",value:"4"},{label:"0.001",value:"3"},{label:"0.01",value:"2"},{label:"0.1",value:"1"},{label:"1",value:"0"}]},separator_legend:{title:"Others",type:"separator"},show_legend:{title:"Show legend",info:"Would you like to add a legend?",type:"radiobutton",init:"true",data:[{label:"Yes",value:"true"},{label:"No",value:"false"}]},use_panels:{title:"Use multi-panels",info:"Would you like to separate your data into individual panels?",type:"radiobutton",init:"false",data:[{label:"Yes",value:"true"},{label:"No",value:"false"}]}}}}),function(){function t(e,t){return(new Date(t,e+1,0)).getDate()}function n(e,t,n){return function(r,i,s){var o=e(r),u=[];o<r&&t(o);if(s>1)while(o<i){var a=new Date(+o);n(a)%s===0&&u.push(a),t(o)}else while(o<i)u.push(new Date(+o)),t(o);return u}}var e=window.nv||{};e.version="1.1.15b",e.dev=!0,window.nv=e,e.tooltip=e.tooltip||{},e.utils=e.utils||{},e.models=e.models||{},e.charts={},e.graphs=[],e.logs={},e.dispatch=d3.dispatch("render_start","render_end"),e.dev&&(e.dispatch.on("render_start",function(t){e.logs.startTime=+(new Date)}),e.dispatch.on("render_end",function(t){e.logs.endTime=+(new Date),e.logs.totalTime=e.logs.endTime-e.logs.startTime,e.log("total",e.logs.totalTime)})),e.log=function(){if(e.dev&&console.log&&console.log.apply)console.log.apply(console,arguments);else if(e.dev&&typeof console.log=="function"&&Function.prototype.bind){var t=Function.prototype.bind.call(console.log,console);t.apply(console,arguments)}return arguments[arguments.length-1]},e.render=function(n){n=n||1,e.render.active=!0,e.dispatch.render_start(),setTimeout(function(){var t,r;for(var i=0;i<n&&(r=e.render.queue[i]);i++)t=r.generate(),typeof r.callback==typeof Function&&r.callback(t),e.graphs.push(t);e.render.queue.splice(0,i),e.render.queue.length?setTimeout(arguments.callee,0):(e.dispatch.render_end(),e.render.active=!1)},0)},e.render.active=!1,e.render.queue=[],e.addGraph=function(t){typeof arguments[0]==typeof Function&&(t={generate:arguments[0],callback:arguments[1]}),e.render.queue.push(t),e.render.active||e.render()},e.identity=function(e){return e},e.strip=function(e){return e.replace(/(\s|&)/g,"")},d3.time.monthEnd=function(e){return new Date(e.getFullYear(),e.getMonth(),0)},d3.time.monthEnds=n(d3.time.monthEnd,function(e){e.setUTCDate(e.getUTCDate()+1),e.setDate(t(e.getMonth()+1,e.getFullYear()))},function(e){return e.getMonth()}),e.interactiveGuideline=function(){function c(o){o.each(function(o){function g(){var e=d3.mouse(this),n=e[0],r=e[1],o=!0,a=!1;l&&(n=d3.event.offsetX,r=d3.event.offsetY,d3.event.target.tagName!=="svg"&&(o=!1),d3.event.target.className.baseVal.match("nv-legend")&&(a=!0)),o&&(n-=i.left,r-=i.top);if(n<0||r<0||n>p||r>d||d3.event.relatedTarget&&d3.event.relatedTarget.ownerSVGElement===undefined||a){if(l&&d3.event.relatedTarget&&d3.event.relatedTarget.ownerSVGElement===undefined&&d3.event.relatedTarget.className.match(t.nvPointerEventsClass))return;u.elementMouseout({mouseX:n,mouseY:r}),c.renderGuideLine(null);return}var f=s.invert(n);u.elementMousemove({mouseX:n,mouseY:r,pointXValue:f}),d3.event.type==="dblclick"&&u.elementDblclick({mouseX:n,mouseY:r,pointXValue:f})}var h=d3.select(this),p=n||960,d=r||400,v=h.selectAll("g.nv-wrap.nv-interactiveLineLayer").data([o]),m=v.enter().append("g").attr("class"," nv-wrap nv-interactiveLineLayer");m.append("g").attr("class","nv-interactiveGuideLine");if(!f)return;f.on("mousemove",g,!0).on("mouseout",g,!0).on("dblclick",g),c.renderGuideLine=function(t){if(!a)return;var n=v.select(".nv-interactiveGuideLine").selectAll("line").data(t!=null?[e.utils.NaNtoZero(t)]:[],String);n.enter().append("line").attr("class","nv-guideline").attr("x1",function(e){return e}).attr("x2",function(e){return e}).attr("y1",d).attr("y2",0),n.exit().remove()}})}var t=e.models.tooltip(),n=null,r=null,i={left:0,top:0},s=d3.scale.linear(),o=d3.scale.linear(),u=d3.dispatch("elementMousemove","elementMouseout","elementDblclick"),a=!0,f=null,l=navigator.userAgent.indexOf("MSIE")!==-1;return c.dispatch=u,c.tooltip=t,c.margin=function(e){return arguments.length?(i.top=typeof e.top!="undefined"?e.top:i.top,i.left=typeof e.left!="undefined"?e.left:i.left,c):i},c.width=function(e){return arguments.length?(n=e,c):n},c.height=function(e){return arguments.length?(r=e,c):r},c.xScale=function(e){return arguments.length?(s=e,c):s},c.showGuideLine=function(e){return arguments.length?(a=e,c):a},c.svgContainer=function(e){return arguments.length?(f=e,c):f},c},e.interactiveBisect=function(e,t,n){if(!e instanceof Array)return null;typeof n!="function"&&(n=function(e,t){return e.x});var r=d3.bisector(n).left,i=d3.max([0,r(e,t)-1]),s=n(e[i],i);typeof s=="undefined"&&(s=i);if(s===t)return i;var o=d3.min([i+1,e.length-1]),u=n(e[o],o);return typeof u=="undefined"&&(u=o),Math.abs(u-t)>=Math.abs(s-t)?i:o},e.nearestValueIndex=function(e,t,n){var r=Infinity,i=null;return e.forEach(function(e,s){var o=Math.abs(t-e);o<=r&&o<n&&(r=o,i=s)}),i},function(){window.nv.tooltip={},window.nv.models.tooltip=function(){function y(){if(a){var e=d3.select(a);e.node().tagName!=="svg"&&(e=e.select("svg"));var t=e.node()?e.attr("viewBox"):null;if(t){t=t.split(" ");var n=parseInt(e.style("width"))/t[2];l.left=l.left*n,l.top=l.top*n}}}function b(e){var t;a?t=d3.select(a):t=d3.select("body");var n=t.select(".nvtooltip");return n.node()===null&&(n=t.append("div").attr("class","nvtooltip "+(u?u:"xy-tooltip")).attr("id",h)),n.node().innerHTML=e,n.style("top",0).style("left",0).style("opacity",0),n.selectAll("div, table, td, tr").classed(p,!0),n.classed(p,!0),n.node()}function w(){if(!c)return;if(!g(n))return;y();var t=l.left,u=o!=null?o:l.top,h=b(m(n));f=h;if(a){var p=a.getElementsByTagName("svg")[0],d=p?p.getBoundingClientRect():a.getBoundingClientRect(),v={left:0,top:0};if(p){var E=p.getBoundingClientRect(),S=a.getBoundingClientRect(),x=E.top;if(x<0){var T=a.getBoundingClientRect();x=Math.abs(x)>T.height?0:x}v.top=Math.abs(x-S.top),v.left=Math.abs(E.left-S.left)}t+=a.offsetLeft+v.left-2*a.scrollLeft,u+=a.offsetTop+v.top-2*a.scrollTop}return s&&s>0&&(u=Math.floor(u/s)*s),e.tooltip.calcTooltipPosition([t,u],r,i,h),w}var t=null,n=null,r="w",i=50,s=25,o=null,u=null,a=null,f=null,l={left:null,top:null},c=!0,h="nvtooltip-"+Math.floor(Math.random()*1e5),p="nv-pointer-events-none",d=function(e,t){return e},v=function(e){return e},m=function(e){if(t!=null)return t;if(e==null)return"";var n=d3.select(document.createElement("table")),r=n.selectAll("thead").data([e]).enter().append("thead");r.append("tr").append("td").attr("colspan",3).append("strong").classed("x-value",!0).html(v(e.value));var i=n.selectAll("tbody").data([e]).enter().append("tbody"),s=i.selectAll("tr").data(function(e){return e.series}).enter().append("tr").classed("highlight",function(e){return e.highlight});s.append("td").classed("legend-color-guide",!0).append("div").style("background-color",function(e){return e.color}),s.append("td").classed("key",!0).html(function(e){return e.key}),s.append("td").classed("value",!0).html(function(e,t){return d(e.value,t)}),s.selectAll("td").each(function(e){if(e.highlight){var t=d3.scale.linear().domain([0,1]).range(["#fff",e.color]),n=.6;d3.select(this).style("border-bottom-color",t(n)).style("border-top-color",t(n))}});var o=n.node().outerHTML;return e.footer!==undefined&&(o+="<div class='footer'>"+e.footer+"</div>"),o},g=function(e){return e&&e.series&&e.series.length>0?!0:!1};return w.nvPointerEventsClass=p,w.content=function(e){return arguments.length?(t=e,w):t},w.tooltipElem=function(){return f},w.contentGenerator=function(e){return arguments.length?(typeof e=="function"&&(m=e),w):m},w.data=function(e){return arguments.length?(n=e,w):n},w.gravity=function(e){return arguments.length?(r=e,w):r},w.distance=function(e){return arguments.length?(i=e,w):i},w.snapDistance=function(e){return arguments.length?(s=e,w):s},w.classes=function(e){return arguments.length?(u=e,w):u},w.chartContainer=function(e){return arguments.length?(a=e,w):a},w.position=function(e){return arguments.length?(l.left=typeof e.left!="undefined"?e.left:l.left,l.top=typeof e.top!="undefined"?e.top:l.top,w):l},w.fixedTop=function(e){return arguments.length?(o=e,w):o},w.enabled=function(e){return arguments.length?(c=e,w):c},w.valueFormatter=function(e){return arguments.length?(typeof e=="function"&&(d=e),w):d},w.headerFormatter=function(e){return arguments.length?(typeof e=="function"&&(v=e),w):v},w.id=function(){return h},w},e.tooltip.show=function(t,n,r,i,s,o){var u=document.createElement("div");u.className="nvtooltip "+(o?o:"xy-tooltip");var a=s;if(!s||s.tagName.match(/g|svg/i))a=document.getElementsByTagName("body")[0];u.style.left=0,u.style.top=0,u.style.opacity=0,u.innerHTML=n,a.appendChild(u),s&&(t[0]=t[0]-s.scrollLeft,t[1]=t[1]-s.scrollTop),e.tooltip.calcTooltipPosition(t,r,i,u)},e.tooltip.findFirstNonSVGParent=function(e){while(e.tagName.match(/^g|svg$/i)!==null)e=e.parentNode;return e},e.tooltip.findTotalOffsetTop=function(e,t){var n=t;do isNaN(e.offsetTop)||(n+=e.offsetTop);while(e=e.offsetParent);return n},e.tooltip.findTotalOffsetLeft=function(e,t){var n=t;do isNaN(e.offsetLeft)||(n+=e.offsetLeft);while(e=e.offsetParent);return n},e.tooltip.calcTooltipPosition=function(t,n,r,i){var s=parseInt(i.offsetHeight),o=parseInt(i.offsetWidth),u=e.utils.windowSize().width,a=e.utils.windowSize().height,f=window.pageYOffset,l=window.pageXOffset,c,h;a=window.innerWidth>=document.body.scrollWidth?a:a-16,u=window.innerHeight>=document.body.scrollHeight?u:u-16,n=n||"s",r=r||20;var p=function(t){return e.tooltip.findTotalOffsetTop(t,h)},d=function(t){return e.tooltip.findTotalOffsetLeft(t,c)};switch(n){case"e":c=t[0]-o-r,h=t[1]-s/2;var v=d(i),m=p(i);v<l&&(c=t[0]+r>l?t[0]+r:l-v+c),m<f&&(h=f-m+h),m+s>f+a&&(h=f+a-m+h-s);break;case"w":c=t[0]+r,h=t[1]-s/2;var v=d(i),m=p(i);v+o>u&&(c=t[0]-o-r),m<f&&(h=f+5),m+s>f+a&&(h=f+a-m+h-s);break;case"n":c=t[0]-o/2-5,h=t[1]+r;var v=d(i),m=p(i);v<l&&(c=l+5),v+o>u&&(c=c-o/2+5),m+s>f+a&&(h=f+a-m+h-s);break;case"s":c=t[0]-o/2,h=t[1]-s-r;var v=d(i),m=p(i);v<l&&(c=l+5),v+o>u&&(c=c-o/2+5),f>m&&(h=f);break;case"none":c=t[0],h=t[1]-r;var v=d(i),m=p(i)}return i.style.left=c+"px",i.style.top=h+"px",i.style.opacity=1,i.style.position="absolute",i},e.tooltip.cleanup=function(){var e=document.getElementsByClassName("nvtooltip"),t=[];while(e.length)t.push(e[0]),e[0].style.transitionDelay="0 !important",e[0].style.opacity=0,e[0].className="nvtooltip-pending-removal";setTimeout(function(){while(t.length){var e=t.pop();e.parentNode.removeChild(e)}},500)}}(),e.utils.windowSize=function(){var e={width:640,height:480};return document.body&&document.body.offsetWidth&&(e.width=document.body.offsetWidth,e.height=document.body.offsetHeight),document.compatMode=="CSS1Compat"&&document.documentElement&&document.documentElement.offsetWidth&&(e.width=document.documentElement.offsetWidth,e.height=document.documentElement.offsetHeight),window.innerWidth&&window.innerHeight&&(e.width=window.innerWidth,e.height=window.innerHeight),e},e.utils.windowResize=function(e){if(e===undefined)return;var t=window.onresize;window.onresize=function(n){typeof t=="function"&&t(n),e(n)}},e.utils.getColor=function(t){return arguments.length?Object.prototype.toString.call(t)==="[object Array]"?function(e,n){return e.color||t[n%t.length]}:t:e.utils.defaultColor()},e.utils.defaultColor=function(){var e=d3.scale.category20().range();return function(t,n){return t.color||e[n%e.length]}},e.utils.customTheme=function(e,t,n){t=t||function(e){return e.key},n=n||d3.scale.category20().range();var r=n.length;return function(i,s){var o=t(i);return r||(r=n.length),typeof e[o]!="undefined"?typeof e[o]=="function"?e[o]():e[o]:n[--r]}},e.utils.pjax=function(t,n){function r(r){d3.html(r,function(r){var i=d3.select(n).node();i.parentNode.replaceChild(d3.select(r).select(n).node(),i),e.utils.pjax(t,n)})}d3.selectAll(t).on("click",function(){history.pushState(this.href,this.textContent,this.href),r(this.href),d3.event.preventDefault()}),d3.select(window).on("popstate",function(){d3.event.state&&r(d3.event.state)})},e.utils.calcApproxTextWidth=function(e){if(typeof e.style=="function"&&typeof e.text=="function"){var t=parseInt(e.style("font-size").replace("px","")),n=e.text().length;return n*t*.5}return 0},e.utils.NaNtoZero=function(e){return typeof e!="number"||isNaN(e)||e===null||e===Infinity?0:e},e.utils.optionsFunc=function(e){return e&&d3.map(e).forEach(function(e,t){typeof this[e]=="function"&&this[e](t)}.bind(this)),this},e.models.axis=function(){function m(e){return e.each(function(e){var i=d3.select(this),m=i.selectAll("g.nv-wrap.nv-axis").data([e]),g=m.enter().append("g").attr("class","nvd3 nv-wrap nv-axis"),y=g.append("g"),b=m.select("g");p!==null?t.ticks(p):(t.orient()=="top"||t.orient()=="bottom")&&t.ticks(Math.abs(s.range()[1]-s.range()[0])/100),b.call(t),v=v||t.scale();var w=t.tickFormat();w==null&&(w=v.tickFormat());var E=b.selectAll("text.nv-axislabel").data([o||null]);E.exit().remove();switch(t.orient()){case"top":E.enter().append("text").attr("class","nv-axislabel");var S=s.range().length==2?s.range()[1]:s.range()[s.range().length-1]+(s.range()[1]-s.range()[0]);E.attr("text-anchor","middle").attr("y",0).attr("x",S/2);if(u){var x=m.selectAll("g.nv-axisMaxMin").data(s.domain());x.enter().append("g").attr("class","nv-axisMaxMin").append("text"),x.exit().remove(),x.attr("transform",function(e,t){return"translate("+s(e)+",0)"}).select("text").attr("dy","-0.5em").attr("y",-t.tickPadding()).attr("text-anchor","middle").text(function(e,t){var n=w(e);return(""+n).match("NaN")?"":n}),x.attr("transform",function(e,t){return"translate("+s.range()[t]+",0)"})}break;case"bottom":var T=36,N=30,C=b.selectAll("g").select("text");if(f%360){C.each(function(e,t){var n=this.getBBox().width;n>N&&(N=n)});var k=Math.abs(Math.sin(f*Math.PI/180)),T=(k?k*N:N)+30;C.attr("transform",function(e,t,n){return"rotate("+f+" 0,0)"}).style("text-anchor",f%360>0?"start":"end")}E.enter().append("text").attr("class","nv-axislabel");var S=s.range().length==2?s.range()[1]:s.range()[s.range().length-1]+(s.range()[1]-s.range()[0]);E.attr("text-anchor","middle").attr("y",T).attr("x",S/2);if(u){var x=m.selectAll("g.nv-axisMaxMin").data([s.domain()[0],s.domain()[s.domain().length-1]]);x.enter().append("g").attr("class","nv-axisMaxMin").append("text"),x.exit().remove(),x.attr("transform",function(e,t){return"translate("+(s(e)+(h?s.rangeBand()/2:0))+",0)"}).select("text").attr("dy",".71em").attr("y",t.tickPadding()).attr("transform",function(e,t,n){return"rotate("+f+" 0,0)"}).style("text-anchor",f?f%360>0?"start":"end":"middle").text(function(e,t){var n=w(e);return(""+n).match("NaN")?"":n}),x.attr("transform",function(e,t){return"translate("+(s(e)+(h?s.rangeBand()/2:0))+",0)"})}c&&C.attr("transform",function(e,t){return"translate(0,"+(t%2==0?"0":"12")+")"});break;case"right":E.enter().append("text").attr("class","nv-axislabel"),E.style("text-anchor",l?"middle":"begin").attr("transform",l?"rotate(90)":"").attr("y",l?-Math.max(n.right,r)+12:-10).attr("x",l?s.range()[0]/2:t.tickPadding());if(u){var x=m.selectAll("g.nv-axisMaxMin").data(s.domain());x.enter().append("g").attr("class","nv-axisMaxMin").append("text").style("opacity",0),x.exit().remove(),x.attr("transform",function(e,t){return"translate(0,"+s(e)+")"}).select("text").attr("dy",".32em").attr("y",0).attr("x",t.tickPadding()).style("text-anchor","start").text(function(e,t){var n=w(e);return(""+n).match("NaN")?"":n}),x.attr("transform",function(e,t){return"translate(0,"+s.range()[t]+")"}).select("text").style("opacity",1)}break;case"left":E.enter().append("text").attr("class","nv-axislabel"),E.style("text-anchor",l?"middle":"end").attr("transform",l?"rotate(-90)":"").attr("y",l?-Math.max(n.left,r)+d:-10).attr("x",l?-s.range()[0]/2:-t.tickPadding());if(u){var x=m.selectAll("g.nv-axisMaxMin").data(s.domain());x.enter().append("g").attr("class","nv-axisMaxMin").append("text").style("opacity",0),x.exit().remove(),x.attr("transform",function(e,t){return"translate(0,"+v(e)+")"}).select("text").attr("dy",".32em").attr("y",0).attr("x",-t.tickPadding()).attr("text-anchor","end").text(function(e,t){var n=w(e);return(""+n).match("NaN")?"":n}),x.attr("transform",function(e,t){return"translate(0,"+s.range()[t]+")"}).select("text").style("opacity",1)}}E.text(function(e){return e}),u&&(t.orient()==="left"||t.orient()==="right")&&(b.selectAll("g").each(function(e,t){d3.select(this).select("text").attr("opacity",1);if(s(e)<s.range()[1]+10||s(e)>s.range()[0]-10)(e>1e-10||e<-1e-10)&&d3.select(this).attr("opacity",0),d3.select(this).select("text").attr("opacity",0)}),s.domain()[0]==s.domain()[1]&&s.domain()[0]==0&&m.selectAll("g.nv-axisMaxMin").style("opacity",function(e,t){return t?0:1}));if(u&&(t.orient()==="top"||t.orient()==="bottom")){var L=[];m.selectAll("g.nv-axisMaxMin").each(function(e,t){try{t?L.push(s(e)-this.getBBox().width-4):L.push(s(e)+this.getBBox().width+4)}catch(n){t?L.push(s(e)-4):L.push(s(e)+4)}}),b.selectAll("g").each(function(e,t){if(s(e)<L[0]||s(e)>L[1])e>1e-10||e<-1e-10?d3.select(this).remove():d3.select(this).select("text").remove()})}a&&b.selectAll(".tick").filter(function(e){return!parseFloat(Math.round(e.__data__*1e5)/1e6)&&e.__data__!==undefined}).classed("zero",!0),v=s.copy()}),m}var t=d3.svg.axis(),n={top:0,right:0,bottom:0,left:0},r=75,i=60,s=d3.scale.linear(),o=null,u=!0,a=!0,f=0,l=!0,c=!1,h=!1,p=null,d=12;t.scale(s).orient("bottom").tickFormat(function(e){return e});var v;return m.axis=t,d3.rebind(m,t,"orient","tickValues","tickSubdivide","tickSize","tickPadding","tickFormat"),d3.rebind(m,s,"domain","range","rangeBand","rangeBands"),m.options=e.utils.optionsFunc.bind(m),m.margin=function(e){return arguments.length?(n.top=typeof e.top!="undefined"?e.top:n.top,n.right=typeof e.right!="undefined"?e.right:n.right,n.bottom=typeof e.bottom!="undefined"?e.bottom:n.bottom,n.left=typeof e.left!="undefined"?e.left:n.left,m):n},m.width=function(e){return arguments.length?(r=e,m):r},m.ticks=function(e){return arguments.length?(p=e,m):p},m.height=function(e){return arguments.length?(i=e,m):i},m.axisLabel=function(e){return arguments.length?(o=e,m):o},m.showMaxMin=function(e){return arguments.length?(u=e,m):u},m.highlightZero=function(e){return arguments.length?(a=e,m):a},m.scale=function(e){return arguments.length?(s=e,t.scale(s),h=typeof s.rangeBands=="function",d3.rebind(m,s,"domain","range","rangeBand","rangeBands"),m):s},m.rotateYLabel=function(e){return arguments.length?(l=e,m):l},m.rotateLabels=function(e){return arguments.length?(f=e,m):f},m.staggerLabels=function(e){return arguments.length?(c=e,m):c},m.axisLabelDistance=function(e){return arguments.length?(d=e,m):d},m},e.models.historicalBar=function(){function w(E){return E.each(function(w){var E=n-t.left-t.right,S=r-t.top-t.bottom,T=d3.select(this);s.domain(d||d3.extent(w[0].values.map(u).concat(f))),c?s.range(m||[E*.5/w[0].values.length,E*(w[0].values.length-.5)/w[0].values.length]):s.range(m||[0,E]),o.domain(v||d3.extent(w[0].values.map(a).concat(l))).range(g||[S,0]),s.domain()[0]===s.domain()[1]&&(s.domain()[0]?s.domain([s.domain()[0]-s.domain()[0]*.01,s.domain()[1]+s.domain()[1]*.01]):s.domain([-1,1])),o.domain()[0]===o.domain()[1]&&(o.domain()[0]?o.domain([o.domain()[0]+o.domain()[0]*.01,o.domain()[1]-o.domain()[1]*.01]):o.domain([-1,1]));var N=T.selectAll("g.nv-wrap.nv-historicalBar-"+i).data([w[0].values]),C=N.enter().append("g").attr("class","nvd3 nv-wrap nv-historicalBar-"+i),k=C.append("defs"),L=C.append("g"),A=N.select("g");L.append("g").attr("class","nv-bars"),N.attr("transform","translate("+t.left+","+t.top+")"),T.on("click",function(e,t){y.chartClick({data:e,index:t,pos:d3.event,id:i})}),k.append("clipPath").attr("id","nv-chart-clip-path-"+i).append("rect"),N.select("#nv-chart-clip-path-"+i+" rect").attr("width",E).attr("height",S),A.attr("clip-path",h?"url(#nv-chart-clip-path-"+i+")":"");var O=N.select(".nv-bars").selectAll(".nv-bar").data(function(e){return e},function(e,t){return u(e,t)});O.exit().remove();var M=O.enter().append("rect").attr("x",0).attr("y",function(t,n){return e.utils.NaNtoZero(o(Math.max(0,a(t,n))))}).attr("height",function(t,n){return e.utils.NaNtoZero(Math.abs(o(a(t,n))-o(0)))}).attr("transform",function(e,t){return"translate("+(s(u(e,t))-E/w[0].values.length*.45)+",0)"}).on("mouseover",function(e,t){if(!b)return;d3.select(this).classed("hover",!0),y.elementMouseover({point:e,series:w[0],pos:[s(u(e,t)),o(a(e,t))],pointIndex:t,seriesIndex:0,e:d3.event})}).on("mouseout",function(e,t){if(!b)return;d3.select(this).classed("hover",!1),y.elementMouseout({point:e,series:w[0],pointIndex:t,seriesIndex:0,e:d3.event})}).on("click",function(e,t){if(!b)return;y.elementClick({value:a(e,t),data:e,index:t,pos:[s(u(e,t)),o(a(e,t))],e:d3.event,id:i}),d3.event.stopPropagation()}).on("dblclick",function(e,t){if(!b)return;y.elementDblClick({value:a(e,t),data:e,index:t,pos:[s(u(e,t)),o(a(e,t))],e:d3.event,id:i}),d3.event.stopPropagation()});O.attr("fill",function(e,t){return p(e,t)}).attr("class",function(e,t,n){return(a(e,t)<0?"nv-bar negative":"nv-bar positive")+" nv-bar-"+n+"-"+t}).attr("transform",function(e,t){return"translate("+(s(u(e,t))-E/w[0].values.length*.45)+",0)"}).attr("width",E/w[0].values.length*.9),O.attr("y",function(t,n){var r=a(t,n)<0?o(0):o(0)-o(a(t,n))<1?o(0)-1:o(a(t,n));return e.utils.NaNtoZero(r)}).attr("height",function(t,n){return e.utils.NaNtoZero(Math.max(Math.abs(o(a(t,n))-o(0)),1))})}),w}var t={top:0,right:0,bottom:0,left:0},n=960,r=500,i=Math.floor(Math.random()*1e4),s=d3.scale.linear(),o=d3.scale.linear(),u=function(e){return e.x},a=function(e){return e.y},f=[],l=[0],c=!1,h=!0,p=e.utils.defaultColor(),d,v,m,g,y=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout"),b=!0;return w.highlightPoint=function(e,t){d3.select(".nv-historicalBar-"+i).select(".nv-bars .nv-bar-0-"+e).classed("hover",t)},w.clearHighlights=function(){d3.select(".nv-historicalBar-"+i).select(".nv-bars .nv-bar.hover").classed("hover",!1)},w.dispatch=y,w.options=e.utils.optionsFunc.bind(w),w.x=function(e){return arguments.length?(u=e,w):u},w.y=function(e){return arguments.length?(a=e,w):a},w.margin=function(e){return arguments.length?(t.top=typeof e.top!="undefined"?e.top:t.top,t.right=typeof e.right!="undefined"?e.right:t.right,t.bottom=typeof e.bottom!="undefined"?e.bottom:t.bottom,t.left=typeof e.left!="undefined"?e.left:t.left,w):t},w.width=function(e){return arguments.length?(n=e,w):n},w.height=function(e){return arguments.length?(r=e,w):r},w.xScale=function(e){return arguments.length?(s=e,w):s},w.yScale=function(e){return arguments.length?(o=e,w):o},w.xDomain=function(e){return arguments.length?(d=e,w):d},w.yDomain=function(e){return arguments.length?(v=e,w):v},w.xRange=function(e){return arguments.length?(m=e,w):m},w.yRange=function(e){return arguments.length?(g=e,w):g},w.forceX=function(e){return arguments.length?(f=e,w):f},w.forceY=function(e){return arguments.length?(l=e,w):l},w.padData=function(e){return arguments.length?(c=e,w):c},w.clipEdge=function(e){return arguments.length?(h=e,w):h},w.color=function(t){return arguments.length?(p=e.utils.getColor(t),w):p},w.id=function(e){return arguments.length?(i=e,w):i},w.interactive=function(e){return arguments.length?(b=!1,w):b},w},e.models.bullet=function(){function m(e){return e.each(function(e,n){var p=c-t.left-t.right,m=h-t.top-t.bottom,g=d3.select(this),y=i.call(this,e,n).slice().sort(d3.descending),b=s.call(this,e,n).slice().sort(d3.descending),w=o.call(this,e,n).slice().sort(d3.descending),E=u.call(this,e,n).slice(),S=a.call(this,e,n).slice(),x=f.call(this,e,n).slice(),T=d3.scale.linear().domain(d3.extent(d3.merge([l,y]))).range(r?[p,0]:[0,p]),N=this.__chart__||d3.scale.linear().domain([0,Infinity]).range(T.range());this.__chart__=T;var C=d3.min(y),k=d3.max(y),L=y[1],A=g.selectAll("g.nv-wrap.nv-bullet").data([e]),O=A.enter().append("g").attr("class","nvd3 nv-wrap nv-bullet"),M=O.append("g"),_=A.select("g");M.append("rect").attr("class","nv-range nv-rangeMax"),M.append("rect").attr("class","nv-range nv-rangeAvg"),M.append("rect").attr("class","nv-range nv-rangeMin"),M.append("rect").attr("class","nv-measure"),M.append("path").attr("class","nv-markerTriangle"),A.attr("transform","translate("+t.left+","+t.top+")");var D=function(e){return Math.abs(N(e)-N(0))},P=function(e){return Math.abs(T(e)-T(0))},H=function(e){return e<0?N(e):N(0)},B=function(e){return e<0?T(e):T(0)};_.select("rect.nv-rangeMax").attr("height",m).attr("width",P(k>0?k:C)).attr("x",B(k>0?k:C)).datum(k>0?k:C),_.select("rect.nv-rangeAvg").attr("height",m).attr("width",P(L)).attr("x",B(L)).datum(L),_.select("rect.nv-rangeMin").attr("height",m).attr("width",P(k)).attr("x",B(k)).attr("width",P(k>0?C:k)).attr("x",B(k>0?C:k)).datum(k>0?C:k),_.select("rect.nv-measure").style("fill",d).attr("height",m/3).attr("y",m/3).attr("width",w<0?T(0)-T(w[0]):T(w[0])-T(0)).attr("x",B(w)).on("mouseover",function(){v.elementMouseover({value:w[0],label:x[0]||"Current",pos:[T(w[0]),m/2]})}).on("mouseout",function(){v.elementMouseout({value:w[0],label:x[0]||"Current"})});var j=m/6;b[0]?_.selectAll("path.nv-markerTriangle").attr("transform",function(e){return"translate("+T(b[0])+","+m/2+")"}).attr("d","M0,"+j+"L"+j+","+ -j+" "+ -j+","+ -j+"Z").on("mouseover",function(){v.elementMouseover({value:b[0],label:S[0]||"Previous",pos:[T(b[0]),m/2]})}).on("mouseout",function(){v.elementMouseout({value:b[0],label:S[0]||"Previous"})}):_.selectAll("path.nv-markerTriangle").remove(),A.selectAll(".nv-range").on("mouseover",function(e,t){var n=E[t]||(t?t==1?"Mean":"Minimum":"Maximum");v.elementMouseover({value:e,label:n,pos:[T(e),m/2]})}).on("mouseout",function(e,t){var n=E[t]||(t?t==1?"Mean":"Minimum":"Maximum");v.elementMouseout({value:e,label:n})})}),m}var t={top:0,right:0,bottom:0,left:0},n="left",r=!1,i=function(e){return e.ranges},s=function(e){return e.markers},o=function(e){return e.measures},u=function(e){return e.rangeLabels?e.rangeLabels:[]},a=function(e){return e.markerLabels?e.markerLabels:[]},f=function(e){return e.measureLabels?e.measureLabels:[]},l=[0],c=380,h=30,p=null,d=e.utils.getColor(["#1f77b4"]),v=d3.dispatch("elementMouseover","elementMouseout");return m.dispatch=v,m.options=e.utils.optionsFunc.bind(m),m.orient=function(e){return arguments.length?(n=e,r=n=="right"||n=="bottom",m):n},m.ranges=function(e){return arguments.length?(i=e,m):i},m.markers=function(e){return arguments.length?(s=e,m):s},m.measures=function(e){return arguments.length?(o=e,m):o},m.forceX=function(e){return arguments.length?(l=e,m):l},m.width=function(e){return arguments.length?(c=e,m):c},m.height=function(e){return arguments.length?(h=e,m):h},m.margin=function(e){return arguments.length?(t.top=typeof e.top!="undefined"?e.top:t.top,t.right=typeof e.right!="undefined"?e.right:t.right,t.bottom=typeof e.bottom!="undefined"?e.bottom:t.bottom,t.left=typeof e.left!="undefined"?e.left:t.left,m):t},m.tickFormat=function(e){return arguments.length?(p=e,m):p},m.color=function(t){return arguments.length?(d=e.utils.getColor(t),m):d},m},e.models.bulletChart=function(){function m(e){return e.each(function(n,h){var g=d3.select(this),y=(a||parseInt(g.style("width"))||960)-i.left-i.right,b=f-i.top-i.bottom,w=this;m.update=function(){m(e)},m.container=this;if(!n||!s.call(this,n,h)){var E=g.selectAll(".nv-noData").data([p]);return E.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),E.attr("x",i.left+y/2).attr("y",18+i.top+b/2).text(function(e){return e}),m}g.selectAll(".nv-noData").remove();var S=s.call(this,n,h).slice().sort(d3.descending),x=o.call(this,n,h).slice().sort(d3.descending),T=u.call(this,n,h).slice().sort(d3.descending),N=g.selectAll("g.nv-wrap.nv-bulletChart").data([n]),C=N.enter().append("g").attr("class","nvd3 nv-wrap nv-bulletChart"),k=C.append("g"),L=N.select("g");k.append("g").attr("class","nv-bulletWrap"),k.append("g").attr("class","nv-titles"),N.attr("transform","translate("+i.left+","+i.top+")");var A=d3.scale.linear().domain([0,Math.max(S[0],x[0],T[0])]).range(r?[y,0]:[0,y]),O=this.__chart__||d3.scale.linear().domain([0,Infinity]).range(A.range());this.__chart__=A;var M=function(e){return Math.abs(O(e)-O(0))},_=function(e){return Math.abs(A(e)-A(0))},D=k.select(".nv-titles").append("g").attr("text-anchor","end").attr("transform","translate(-6,"+(f-i.top-i.bottom)/2+")");D.append("text").attr("class","nv-title").text(function(e){return e.title}),D.append("text").attr("class","nv-subtitle").attr("dy","1em").text(function(e){return e.subtitle}),t.width(y).height(b);var P=L.select(".nv-bulletWrap");d3.transition(P).call(t);var H=l||A.tickFormat(y/100),B=L.selectAll("g.nv-tick").data(A.ticks(y/50),function(e){return this.textContent||H(e)}),j=B.enter().append("g").attr("class","nv-tick").attr("transform",function(e){return"translate("+O(e)+",0)"}).style("opacity",1e-6);j.append("line").attr("y1",b).attr("y2",b*7/6),j.append("text").attr("text-anchor","middle").attr("dy","1em").attr("y",b*7/6).text(H);var F=d3.transition(B).attr("transform",function(e){return"translate("+A(e)+",0)"}).style("opacity",1);F.select("line").attr("y1",b).attr("y2",b*7/6),F.select("text").attr("y",b*7/6),d3.transition(B.exit()).attr("transform",function(e){return"translate("+A(e)+",0)"}).style("opacity",1e-6).remove(),d.on("tooltipShow",function(e){e.key=n.title,c&&v(e,w.parentNode)})}),d3.timer.flush(),m}var t=e.models.bullet(),n="left",r=!1,i={top:5,right:40,bottom:20,left:120},s=function(e){return e.ranges},o=function(e){return e.markers},u=function(e){return e.measures},a=null,f=55,l=null,c=!0,h=function(e,t,n,r,i){return"<h3>"+t+"</h3>"+"<p>"+n+"</p>"},p="No Data Available.",d=d3.dispatch("tooltipShow","tooltipHide"),v=function(t,n){var r=t.pos[0]+(n.offsetLeft||0)+i.left,s=t.pos[1]+(n.offsetTop||0)+i.top,o=h(t.key,t.label,t.value,t,m);e.tooltip.show([r,s],o,t.value<0?"e":"w",null,n)};return t.dispatch.on("elementMouseover.tooltip",function(e){d.tooltipShow(e)}),t.dispatch.on("elementMouseout.tooltip",function(e){d.tooltipHide(e)}),d.on("tooltipHide",function(){c&&e.tooltip.cleanup()}),m.dispatch=d,m.bullet=t,d3.rebind(m,t,"color"),m.options=e.utils.optionsFunc.bind(m),m.orient=function(e){return arguments.length?(n=e,r=n=="right"||n=="bottom",m):n},m.ranges=function(e){return arguments.length?(s=e,m):s},m.markers=function(e){return arguments.length?(o=e,m):o},m.measures=function(e){return arguments.length?(u=e,m):u},m.width=function(e){return arguments.length?(a=e,m):a},m.height=function(e){return arguments.length?(f=e,m):f},m.margin=function(e){return arguments.length?(i.top=typeof e.top!="undefined"?e.top:i.top,i.right=typeof e.right!="undefined"?e.right:i.right,i.bottom=typeof e.bottom!="undefined"?e.bottom:i.bottom,i.left=typeof e.left!="undefined"?e.left:i.left,m):i},m.tickFormat=function(e){return arguments.length?(l=e,m):l},m.tooltips=function(e){return arguments.length?(c=e,m):c},m.tooltipContent=function(e){return arguments.length?(h=e,m):h},m.noData=function(e){return arguments.length?(p=e,m):p},m},e.models.cumulativeLineChart=function(){function D(b){return b.each(function(b){function I(e,t){d3.select(D.container).style("cursor","ew-resize")}function q(e,t){M.x=d3.event.x,M.i=Math.round(O.invert(M.x)),nt()}function R(e,t){d3.select(D.container).style("cursor","auto"),x.index=M.i,k.stateChange(x)}function nt(){tt.data([M]);var e=D.transitionDuration();D.transitionDuration(0),D.update(),D.transitionDuration(e)}var L=d3.select(this).classed("nv-chart-"+S,!0),A=this,H=(f||parseInt(L.style("width"))||960)-u.left-u.right,B=(l||parseInt(L.style("height"))||400)-u.top-u.bottom;D.update=function(){L.call(D)},D.container=this,x.disabled=b.map(function(e){return!!e.disabled});if(!T){var j;T={};for(j in x)x[j]instanceof Array?T[j]=x[j].slice(0):T[j]=x[j]}var F=d3.behavior.drag().on("dragstart",I).on("drag",q).on("dragend",R);if(!b||!b.length||!b.filter(function(e){return e.values.length}).length){var U=L.selectAll(".nv-noData").data([N]);return U.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),U.attr("x",u.left+H/2).attr("y",u.top+B/2).text(function(e){return e}),D}L.selectAll(".nv-noData").remove(),w=t.xScale(),E=t.yScale();if(!y){var z=b.filter(function(e){return!e.disabled}).map(function(e,n){var r=d3.extent(e.values,t.y());return r[0]<-0.95&&(r[0]=-0.95),[(r[0]-r[1])/(1+r[1]),(r[1]-r[0])/(1+r[0])]}),W=[d3.min(z,function(e){return e[0]}),d3.max(z,function(e){return e[1]})];t.yDomain(W)}else t.yDomain(null);O.domain([0,b[0].values.length-1]).range([0,H]).clamp(!0);var b=P(M.i,b),X=g?"none":"all",V=L.selectAll("g.nv-wrap.nv-cumulativeLine").data([b]),$=V.enter().append("g").attr("class","nvd3 nv-wrap nv-cumulativeLine").append("g"),J=V.select("g");$.append("g").attr("class","nv-interactive"),$.append("g").attr("class","nv-x nv-axis").style("pointer-events","none"),$.append("g").attr("class","nv-y nv-axis"),$.append("g").attr("class","nv-background"),$.append("g").attr("class","nv-linesWrap").style("pointer-events",X),$.append("g").attr("class","nv-avgLinesWrap").style("pointer-events","none"),$.append("g").attr("class","nv-legendWrap"),$.append("g").attr("class","nv-controlsWrap"),c&&(i.width(H),J.select(".nv-legendWrap").datum(b).call(i),u.top!=i.height()&&(u.top=i.height(),B=(l||parseInt(L.style("height"))||400)-u.top-u.bottom),J.select(".nv-legendWrap").attr("transform","translate(0,"+ -u.top+")"));if(m){var K=[{key:"Re-scale y-axis",disabled:!y}];s.width(140).color(["#444","#444","#444"]).rightAlign(!1).margin({top:5,right:0,bottom:5,left:20}),J.select(".nv-controlsWrap").datum(K).attr("transform","translate(0,"+ -u.top+")").call(s)}V.attr("transform","translate("+u.left+","+u.top+")"),d&&J.select(".nv-y.nv-axis").attr("transform","translate("+H+",0)");var Q=b.filter(function(e){return e.tempDisabled});V.select(".tempDisabled").remove(),Q.length&&V.append("text").attr("class","tempDisabled").attr("x",H/2).attr("y","-.71em").style("text-anchor","end").text(Q.map(function(e){return e.key}).join(", ")+" values cannot be calculated for this time period."),g&&(o.width(H).height(B).margin({left:u.left,top:u.top}).svgContainer(L).xScale(w),V.select(".nv-interactive").call(o)),$.select(".nv-background").append("rect"),J.select(".nv-background rect").attr("width",H).attr("height",B),t.y(function(e){return e.display.y}).width(H).height(B).color(b.map(function(e,t){return e.color||a(e,t)}).filter(function(e,t){return!b[t].disabled&&!b[t].tempDisabled}));var G=J.select(".nv-linesWrap").datum(b.filter(function(e){return!e.disabled&&!e.tempDisabled}));G.call(t),b.forEach(function(e,t){e.seriesIndex=t});var Y=b.filter(function(e){return!e.disabled&&!!C(e)}),Z=J.select(".nv-avgLinesWrap").selectAll("line").data(Y,function(e){return e.key}),et=function(e){var t=E(C(e));return t<0?0:t>B?B:t};Z.enter().append("line").style("stroke-width",2).style("stroke-dasharray","10,10").style("stroke",function(e,n){return t.color()(e,e.seriesIndex)}).attr("x1",0).attr("x2",H).attr("y1",et).attr("y2",et),Z.style("stroke-opacity",function(e){var t=E(C(e));return t<0||t>B?0:1}).attr("x1",0).attr("x2",H).attr("y1",et).attr("y2",et),Z.exit().remove();var tt=G.selectAll(".nv-indexLine").data([M]);tt.enter().append("rect").attr("class","nv-indexLine").attr("width",3).attr("x",-2).attr("fill","red").attr("fill-opacity",.5).style("pointer-events","all").call(F),tt.attr("transform",function(e){return"translate("+O(e.i)+",0)"}).attr("height",B),h&&(n.scale(w).ticks(Math.min(b[0].values.length,H/70)).tickSize(-B,0),J.select(".nv-x.nv-axis").attr("transform","translate(0,"+E.range()[0]+")"),d3.transition(J.select(".nv-x.nv-axis")).call(n)),p&&(r.scale(E).ticks(B/36).tickSize(-H,0),d3.transition(J.select(".nv-y.nv-axis")).call(r)),J.select(".nv-background rect").on("click",function(){M.x=d3.mouse(this)[0],M.i=Math.round(O.invert(M.x)),x.index=M.i,k.stateChange(x),nt()}),t.dispatch.on("elementClick",function(e){M.i=e.pointIndex,M.x=O(M.i),x.index=M.i,k.stateChange(x),nt()}),s.dispatch.on("legendClick",function(e,t){e.disabled=!e.disabled,y=!e.disabled,x.rescaleY=y,k.stateChange(x),D.update()}),i.dispatch.on("stateChange",function(e){x.disabled=e.disabled,k.stateChange(x),D.update()}),o.dispatch.on("elementMousemove",function(i){t.clearHighlights();var s,f,l,c=[];b.filter(function(e,t){return e.seriesIndex=t,!e.disabled}).forEach(function(n,r){f=e.interactiveBisect(n.values,i.pointXValue,D.x()),t.highlightPoint(r,f,!0);var o=n.values[f];if(typeof o=="undefined")return;typeof s=="undefined"&&(s=o),typeof l=="undefined"&&(l=D.xScale()(D.x()(o,f))),c.push({key:n.key,value:D.y()(o,f),color:a(n,n.seriesIndex)})});if(c.length>2){var h=D.yScale().invert(i.mouseY),p=Math.abs(D.yScale().domain()[0]-D.yScale().domain()[1]),d=.03*p,m=e.nearestValueIndex(c.map(function(e){return e.value}),h,d);m!==null&&(c[m].highlight=!0)}var g=n.tickFormat()(D.x()(s,f),f);o.tooltip.position({left:l+u.left,top:i.mouseY+u.top}).chartContainer(A.parentNode).enabled(v).valueFormatter(function(e,t){return r.tickFormat()(e)}).data({value:g,series:c})(),o.renderGuideLine(l)}),o.dispatch.on("elementMouseout",function(e){k.tooltipHide(),t.clearHighlights()}),k.on("tooltipShow",function(e){v&&_(e,A.parentNode)}),k.on("changeState",function(e){typeof e.disabled!="undefined"&&(b.forEach(function(t,n){t.disabled=e.disabled[n]}),x.disabled=e.disabled),typeof e.index!="undefined"&&(M.i=e.index,M.x=O(M.i),x.index=e.index,tt.data([M])),typeof e.rescaleY!="undefined"&&(y=e.rescaleY),D.update()})}),D}function P(e,n){return n.map(function(n,r){if(!n.values)return n;var i=n.values[e];if(i==null)return n;var s=t.y()(i,e);return s<-0.95&&!A?(n.tempDisabled=!0,n):(n.tempDisabled=!1,n.values=n.values.map(function(e,n){return e.display={y:(t.y()(e,n)-s)/(1+s)},e}),n)})}var t=e.models.line(),n=e.models.axis(),r=e.models.axis(),i=e.models.legend(),s=e.models.legend(),o=e.interactiveGuideline(),u={top:30,right:30,bottom:50,left:60},a=e.utils.defaultColor(),f=null,l=null,c=!0,h=!0,p=!0,d=!1,v=!0,m=!0,g=!1,y=!0,b=function(e,t,n,r,i){return"<h3>"+e+"</h3>"+"<p>"+n+" at "+t+"</p>"},w,E,S=t.id(),x={index:0,rescaleY:y},T=null,N="No Data Available.",C=function(e){return e.average},k=d3.dispatch("tooltipShow","tooltipHide","stateChange","changeState"),L=0,A=!1;n.orient("bottom").tickPadding(7),r.orient(d?"right":"left"),s.updateState(!1);var O=d3.scale.linear(),M={i:0,x:0},_=function(i,s){var o=i.pos[0]+(s.offsetLeft||0),u=i.pos[1]+(s.offsetTop||0),a=n.tickFormat()(t.x()(i.point,i.pointIndex)),f=r.tickFormat()(t.y()(i.point,i.pointIndex)),l=b(i.series.key,a,f,i,D);e.tooltip.show([o,u],l,null,null,s)};return t.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+u.left,e.pos[1]+u.top],k.tooltipShow(e)}),t.dispatch.on("elementMouseout.tooltip",function(e){k.tooltipHide(e)}),k.on("tooltipHide",function(){v&&e.tooltip.cleanup()}),D.dispatch=k,D.lines=t,D.legend=i,D.xAxis=n,D.yAxis=r,D.interactiveLayer=o,d3.rebind(D,t,"defined","isArea","x","y","xScale","yScale","size","xDomain","yDomain","xRange","yRange","forceX","forceY","interactive","clipEdge","clipVoronoi","useVoronoi","id"),D.options=e.utils.optionsFunc.bind(D),D.margin=function(e){return arguments.length?(u.top=typeof e.top!="undefined"?e.top:u.top,u.right=typeof e.right!="undefined"?e.right:u.right,u.bottom=typeof e.bottom!="undefined"?e.bottom:u.bottom,u.left=typeof e.left!="undefined"?e.left:u.left,D):u},D.width=function(e){return arguments.length?(f=e,D):f},D.height=function(e){return arguments.length?(l=e,D):l},D.color=function(t){return arguments.length?(a=e.utils.getColor(t),i.color(a),D):a},D.rescaleY=function(e){return arguments.length?(y=e,D):y},D.showControls=function(e){return arguments.length?(m=e,D):m},D.useInteractiveGuideline=function(e){return arguments.length?(g=e,e===!0&&(D.interactive(!1),D.useVoronoi(!1)),D):g},D.showLegend=function(e){return arguments.length?(c=e,D):c},D.showXAxis=function(e){return arguments.length?(h=e,D):h},D.showYAxis=function(e){return arguments.length?(p=e,D):p},D.rightAlignYAxis=function(e){return arguments.length?(d=e,r.orient(e?"right":"left"),D):d},D.tooltips=function(e){return arguments.length?(v=e,D):v},D.tooltipContent=function(e){return arguments.length?(b=e,D):b},D.state=function(e){return arguments.length?(x=e,D):x},D.defaultState=function(e){return arguments.length?(T=e,D):T},D.noData=function(e){return arguments.length?(N=e,D):N},D.average=function(e){return arguments.length?(C=e,D):C},D.transitionDuration=function(e){return arguments.length?(L=e,D):L},D.noErrorCheck=function(e){return arguments.length?(A=e,D):A},D},e.models.discreteBar=function(){function E(e){return e.each(function(e){var i=n-t.left-t.right,E=r-t.top-t.bottom,S=d3.select(this);e.forEach(function(e,t){e.values.forEach(function(e){e.series=t})});var T=p&&d?[]:e.map(function(e){return e.values.map(function(e,t){return{x:u(e,t),y:a(e,t),y0:e.y0}})});s.domain(p||d3.merge(T).map(function(e){return e.x})).rangeBands(v||[0,i],.1),o.domain(d||d3.extent(d3.merge(T).map(function(e){return e.y}).concat(f))),c?o.range(m||[E-(o.domain()[0]<0?12:0),o.domain()[1]>0?12:0]):o.range(m||[E,0]),b=b||s,w=w||o.copy().range([o(0),o(0)]);var N=S.selectAll("g.nv-wrap.nv-discretebar").data([e]),C=N.enter().append("g").attr("class","nvd3 nv-wrap nv-discretebar"),k=C.append("g"),L=N.select("g");k.append("g").attr("class","nv-groups"),N.attr("transform","translate("+t.left+","+t.top+")");var A=N.select(".nv-groups").selectAll(".nv-group").data(function(e){return e},function(e){return e.key});A.enter().append("g").style("stroke-opacity",1e-6).style("fill-opacity",1e-6),A.exit().style("stroke-opacity",1e-6).style("fill-opacity",1e-6).remove(),A.attr("class",function(e,t){return"nv-group nv-series-"+t}).classed("hover",function(e){return e.hover}),A.style("stroke-opacity",1).style("fill-opacity",.75);var O=A.selectAll("g.nv-bar").data(function(e){return e.values});O.exit().remove();var M=O.enter().append("g").attr("transform",function(e,t,n){return"translate("+(s(u(e,t))+s.rangeBand()*.05)+", "+o(0)+")"}).on("mouseover",function(t,n){d3.select(this).classed("hover",!0),g.elementMouseover({value:a(t,n),point:t,series:e[t.series],pos:[s(u(t,n))+s.rangeBand()*(t.series+.5)/e.length,o(a(t,n))],pointIndex:n,seriesIndex:t.series,e:d3.event})}).on("mouseout",function(t,n){d3.select(this).classed("hover",!1),g.elementMouseout({value:a(t,n),point:t,series:e[t.series],pointIndex:n,seriesIndex:t.series,e:d3.event})}).on("click",function(t,n){g.elementClick({value:a(t,n),point:t,series:e[t.series],pos:[s(u(t,n))+s.rangeBand()*(t.series+.5)/e.length,o(a(t,n))],pointIndex:n,seriesIndex:t.series,e:d3.event}),d3.event.stopPropagation()}).on("dblclick",function(t,n){g.elementDblClick({value:a(t,n),point:t,series:e[t.series],pos:[s(u(t,n))+s.rangeBand()*(t.series+.5)/e.length,o(a(t,n))],pointIndex:n,seriesIndex:t.series,e:d3.event}),d3.event.stopPropagation()});M.append("rect").attr("height",0).attr("width",s.rangeBand()*.9/e.length),c?(M.append("text").attr("text-anchor","middle"),O.select("text").text(function(e,t){return h(a(e,t))}).attr("x",s.rangeBand()*.9/2).attr("y",function(e,t){return a(e,t)<0?o(a(e,t))-o(0)+12:-4})):O.selectAll("text").remove(),O.attr("class",function(e,t){return a(e,t)<0?"nv-bar negative":"nv-bar positive"}).style("fill",function(e,t){return e.color||l(e,t)}).style("stroke",function(e,t){return e.color||l(e,t)}).select("rect").attr("class",y).attr("width",s.rangeBand()*.9/e.length),O.attr("transform",function(e,t){var n=s(u(e,t))+s.rangeBand()*.05,r=a(e,t)<0?o(0):o(0)-o(a(e,t))<1?o(0)-1:o(a(e,t));return"translate("+n+", "+r+")"}).select("rect").attr("height",function(e,t){return Math.max(Math.abs(o(a(e,t))-o(d&&d[0]||0))||1)}),b=s.copy(),w=o.copy()}),E}var t={top:0,right:0,bottom:0,left:0},n=960,r=500,i=Math.floor(Math.random()*1e4),s=d3.scale.ordinal(),o=d3.scale.linear(),u=function(e){return e.x},a=function(e){return e.y},f=[0],l=e.utils.defaultColor(),c=!1,h=d3.format(",.2f"),p,d,v,m,g=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout"),y="discreteBar",b,w;return E.dispatch=g,E.options=e.utils.optionsFunc.bind(E),E.x=function(e){return arguments.length?(u=e,E):u},E.y=function(e){return arguments.length?(a=e,E):a},E.margin=function(e){return arguments.length?(t.top=typeof e.top!="undefined"?e.top:t.top,t.right=typeof e.right!="undefined"?e.right:t.right,t.bottom=typeof e.bottom!="undefined"?e.bottom:t.bottom,t.left=typeof e.left!="undefined"?e.left:t.left,E):t},E.width=function(e){return arguments.length?(n=e,E):n},E.height=function(e){return arguments.length?(r=e,E):r},E.xScale=function(e){return arguments.length?(s=e,E):s},E.yScale=function(e){return arguments.length?(o=e,E):o},E.xDomain=function(e){return arguments.length?(p=e,E):p},E.yDomain=function(e){return arguments.length?(d=e,E):d},E.xRange=function(e){return arguments.length?(v=e,E):v},E.yRange=function(e){return arguments.length?(m=e,E):m},E.forceY=function(e){return arguments.length?(f=e,E):f},E.color=function(t){return arguments.length?(l=e.utils.getColor(t),E):l},E.id=function(e){return arguments.length?(i=e,E):i},E.showValues=function(e){return arguments.length?(c=e,E):c},E.valueFormat=function(e){return arguments.length?(h=e,E):h},E.rectClass=function(e){return arguments.length?(y=e,E):y},E},e.models.discreteBarChart=function(){function w(e){return e.each(function(e){var u=d3.select(this),p=this,y=(s||parseInt(u.style("width"))||960)-i.left-i.right,E=(o||parseInt(u.style("height"))||400)-i.top-i.bottom;w.update=function(){g.beforeUpdate(),u.call(w)},w.container=this;if(!e||!e.length||!e.filter(function(e){return e.values.length}).length){var S=u.selectAll(".nv-noData").data([m]);return S.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),S.attr("x",i.left+y/2).attr("y",i.top+E/2).text(function(e){return e}),w}u.selectAll(".nv-noData").remove(),d=t.xScale(),v=t.yScale().clamp(!0);var T=u.selectAll("g.nv-wrap.nv-discreteBarWithAxes").data([e]),N=T.enter().append("g").attr("class","nvd3 nv-wrap nv-discreteBarWithAxes").append("g"),C=N.append("defs"),k=T.select("g");N.append("g").attr("class","nv-x nv-axis"),N.append("g").attr("class","nv-y nv-axis").append("g").attr("class","nv-zeroLine").append("line"),N.append("g").attr("class","nv-barsWrap"),k.attr("transform","translate("+i.left+","+i.top+")"),l&&k.select(".nv-y.nv-axis").attr("transform","translate("+y+",0)"),t.width(y).height(E);var L=k.select(".nv-barsWrap").datum(e.filter(function(e){return!e.disabled}));L.call(t),C.append("clipPath").attr("id","nv-x-label-clip-"+t.id()).append("rect"),k.select("#nv-x-label-clip-"+t.id()+" rect").attr("width",d.rangeBand()*(c?2:1)).attr("height",16).attr("x",-d.rangeBand()/(c?1:2));if(a){n.scale(d).ticks(y/100).tickSize(-E,0),k.select(".nv-x.nv-axis").attr("transform","translate(0,"+(v.range()[0]+(t.showValues()&&v.domain()[0]<0?16:0))+")"),k.select(".nv-x.nv-axis").call(n);var A=k.select(".nv-x.nv-axis").selectAll("g");c&&A.selectAll("text").attr("transform",function(e,t,n){return"translate(0,"+(n%2==0?"5":"17")+")"})}f&&(r.scale(v).ticks(E/36).tickSize(-y,0),k.select(".nv-y.nv-axis").call(r)),k.select(".nv-zeroLine line").attr("x1",0).attr("x2",y).attr("y1",v(0)).attr("y2",v(0)),g.on("tooltipShow",function(e){h&&b(e,p.parentNode)})}),w}var t=e.models.discreteBar(),n=e.models.axis(),r=e.models.axis(),i={top:15,right:10,bottom:50,left:60},s=null,o=null,u=e.utils.getColor(),a=!0,f=!0,l=!1,c=!1,h=!0,p=function(e,t,n,r,i){return"<h3>"+t+"</h3>"+"<p>"+n+"</p>"},d,v,m="No Data Available.",g=d3.dispatch("tooltipShow","tooltipHide","beforeUpdate"),y=0;n.orient("bottom").highlightZero(!1).showMaxMin(!1).tickFormat(function(e){return e}),r.orient(l?"right":"left").tickFormat(d3.format(",.1f"));var b=function(i,s){var o=i.pos[0]+(s.offsetLeft||0),u=i.pos[1]+(s.offsetTop||0),a=n.tickFormat()(t.x()(i.point,i.pointIndex)),f=r.tickFormat()(t.y()(i.point,i.pointIndex)),l=p(i.series.key,a,f,i,w);e.tooltip.show([o,u],l,i.value<0?"n":"s",null,s)};return t.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+i.left,e.pos[1]+i.top],g.tooltipShow(e)}),t.dispatch.on("elementMouseout.tooltip",function(e){g.tooltipHide(e)}),g.on("tooltipHide",function(){h&&e.tooltip.cleanup()}),w.dispatch=g,w.discretebar=t,w.xAxis=n,w.yAxis=r,d3.rebind(w,t,"x","y","xDomain","yDomain","xRange","yRange","forceX","forceY","id","showValues","valueFormat"),w.options=e.utils.optionsFunc.bind(w),w.margin=function(e){return arguments.length?(i.top=typeof e.top!="undefined"?e.top:i.top,i.right=typeof e.right!="undefined"?e.right:i.right,i.bottom=typeof e.bottom!="undefined"?e.bottom:i.bottom,i.left=typeof e.left!="undefined"?e.left:i.left,w):i},w.width=function(e){return arguments.length?(s=e,w):s},w.height=function(e){return arguments.length?(o=e,w):o},w.color=function(n){return arguments.length?(u=e.utils.getColor(n),t.color(u),w):u},w.showXAxis=function(e){return arguments.length?(a=e,w):a},w.showYAxis=function(e){return arguments.length?(f=e,w):f},w.rightAlignYAxis=function(e){return arguments.length?(l=e,r.orient(e?"right":"left"),w):l},w.staggerLabels=function(e){return arguments.length?(c=e,w):c},w.tooltips=function(e){return arguments.length?(h=e,w):h},w.tooltipContent=function(e){return arguments.length?(p=e,w):p},w.noData=function(e){return arguments.length?(m=e,w):m},w.transitionDuration=function(e){return arguments.length?(y=e,w):y},w},e.models.distribution=function(){function l(e){return e.each(function(e){var a=n-(i==="x"?t.left+t.right:t.top+t.bottom),l=i=="x"?"y":"x",c=d3.select(this);f=f||u;var h=c.selectAll("g.nv-distribution").data([e]),p=h.enter().append("g").attr("class","nvd3 nv-distribution"),d=p.append("g"),v=h.select("g");h.attr("transform","translate("+t.left+","+t.top+")");var m=v.selectAll("g.nv-dist").data(function(e){return e},function(e){return e.key});m.enter().append("g"),m.attr("class",function(e,t){return"nv-dist nv-series-"+t}).style("stroke",function(e,t){return o(e,t)});var g=m.selectAll("line.nv-dist"+i).data(function(e){return e.values});g.enter().append("line").attr(i+"1",function(e,t){return f(s(e,t))}).attr(i+"2",function(e,t){return f(s(e,t))}),m.exit().selectAll("line.nv-dist"+i).attr(i+"1",function(e,t){return u(s(e,t))}).attr(i+"2",function(e,t){return u(s(e,t))}).style("stroke-opacity",0).remove(),g.attr("class",function(e,t){return"nv-dist"+i+" nv-dist"+i+"-"+t}).attr(l+"1",0).attr(l+"2",r),g.attr(i+"1",function(e,t){return u(s(e,t))}).attr(i+"2",function(e,t){return u(s(e,t))}),f=u.copy()}),l}var t={top:0,right:0,bottom:0,left:0},n=400,r=8,i="x",s=function(e){return e[i]},o=e.utils.defaultColor(),u=d3.scale.linear(),a,f;return l.options=e.utils.optionsFunc.bind(l),l.margin=function(e){return arguments.length?(t.top=typeof e.top!="undefined"?e.top:t.top,t.right=typeof e.right!="undefined"?e.right:t.right,t.bottom=typeof e.bottom!="undefined"?e.bottom:t.bottom,t.left=typeof e.left!="undefined"?e.left:t.left,l):t},l.width=function(e){return arguments.length?(n=e,l):n},l.axis=function(e){return arguments.length?(i=e,l):i},l.size=function(e){return arguments.length?(r=e,l):r},l.getData=function(e){return arguments.length?(s=d3.functor(e),l):s},l.scale=function(e){return arguments.length?(u=e,l):u},l.color=function(t){return arguments.length?(o=e.utils.getColor(t),l):o},l},e.models.historicalBarChart=function(){function x(e){return e.each(function(d){var E=d3.select(this),T=this,N=(u||parseInt(E.style("width"))||960)-s.left-s.right,C=(a||parseInt(E.style("height"))||400)-s.top-s.bottom;x.update=function(){E.call(x)},x.container=this,g.disabled=d.map(function(e){return!!e.disabled});if(!y){var k;y={};for(k in g)g[k]instanceof Array?y[k]=g[k].slice(0):y[k]=g[k]}if(!d||!d.length||!d.filter(function(e){return e.values.length}).length){var L=E.selectAll(".nv-noData").data([b]);return L.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),L.attr("x",s.left+N/2).attr("y",s.top+C/2).text(function(e){return e}),x}E.selectAll(".nv-noData").remove(),v=t.xScale(),m=t.yScale();var A=E.selectAll("g.nv-wrap.nv-historicalBarChart").data([d]),O=A.enter().append("g").attr("class","nvd3 nv-wrap nv-historicalBarChart").append("g"),M=A.select("g");O.append("g").attr("class","nv-x nv-axis"),O.append("g").attr("class","nv-y nv-axis"),O.append("g").attr("class","nv-barsWrap"),O.append("g").attr("class","nv-legendWrap"),f&&(i.width(N),M.select(".nv-legendWrap").datum(d).call(i),s.top!=i.height()&&(s.top=i.height(),C=(a||parseInt(E.style("height"))||400)-s.top-s.bottom),A.select(".nv-legendWrap").attr("transform","translate(0,"+ -s.top+")")),A.attr("transform","translate("+s.left+","+s.top+")"),h&&M.select(".nv-y.nv-axis").attr("transform","translate("+N+",0)"),t.width(N).height(C).color(d.map(function(e,t){return e.color||o(e,t)}).filter(function(e,t){return!d[t].disabled}));var _=M.select(".nv-barsWrap").datum(d.filter(function(e){return!e.disabled}));_.call(t),l&&(n.scale(v).tickSize(-C,0),M.select(".nv-x.nv-axis").attr("transform","translate(0,"+m.range()[0]+")"),M.select(".nv-x.nv-axis").call(n)),c&&(r.scale(m).ticks(C/36).tickSize(-N,0),M.select(".nv-y.nv-axis").call(r)),i.dispatch.on("legendClick",function(t,n){t.disabled=!t.disabled,d.filter(function(e){return!e.disabled}).length||d.map(function(e){return e.disabled=!1,A.selectAll(".nv-series").classed("disabled",!1),e}),g.disabled=d.map(function(e){return!!e.disabled}),w.stateChange(g),e.call(x)}),i.dispatch.on("legendDblclick",function(e){d.forEach(function(e){e.disabled=!0}),e.disabled=!1,g.disabled=d.map(function(e){return!!e.disabled}),w.stateChange(g),x.update()}),w.on("tooltipShow",function(e){p&&S(e,T.parentNode)}),w.on("changeState",function(e){typeof e.disabled!="undefined"&&(d.forEach(function(t,n){t.disabled=e.disabled[n]}),g.disabled=e.disabled),x.update()})}),x}var t=e.models.historicalBar(),n=e.models.axis(),r=e.models.axis(),i=e.models.legend(),s={top:30,right:90,bottom:50,left:90},o=e.utils.defaultColor(),u=null,a=null,f=!1,l=!0,c=!0,h=!1,p=!0,d=function(e,t,n,r,i){return"<h3>"+e+"</h3>"+"<p>"+n+" at "+t+"</p>"},v,m,g={},y=null,b="No Data Available.",w=d3.dispatch("tooltipShow","tooltipHide","stateChange","changeState"),E=0;n.orient("bottom").tickPadding(7),r.orient(h?"right":"left");var S=function(i,s){if(s){var o=d3.select(s).select("svg"),u=o.node()?o.attr("viewBox"):null;if(u){u=u.split(" ");var a=parseInt(o.style("width"))/u[2];i.pos[0]=i.pos[0]*a,i.pos[1]=i.pos[1]*a}}var f=i.pos[0]+(s.offsetLeft||0),l=i.pos[1]+(s.offsetTop||0),c=n.tickFormat()(t.x()(i.point,i.pointIndex)),h=r.tickFormat()(t.y()(i.point,i.pointIndex)),p=d(i.series.key,c,h,i,x);e.tooltip.show([f,l],p,null,null,s)};return t.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+s.left,e.pos[1]+s.top],w.tooltipShow(e)}),t.dispatch.on("elementMouseout.tooltip",function(e){w.tooltipHide(e)}),w.on("tooltipHide",function(){p&&e.tooltip.cleanup()}),x.dispatch=w,x.bars=t,x.legend=i,x.xAxis=n,x.yAxis=r,d3.rebind(x,t,"defined","isArea","x","y","size","xScale","yScale","xDomain","yDomain","xRange","yRange","forceX","forceY","interactive","clipEdge","clipVoronoi","id","interpolate","highlightPoint","clearHighlights","interactive"),x.options=e.utils.optionsFunc.bind(x),x.margin=function(e){return arguments.length?(s.top=typeof e.top!="undefined"?e.top:s.top,s.right=typeof e.right!="undefined"?e.right:s.right,s.bottom=typeof e.bottom!="undefined"?e.bottom:s.bottom,s.left=typeof e.left!="undefined"?e.left:s.left,x):s},x.width=function(e){return arguments.length?(u=e,x):u},x.height=function(e){return arguments.length?(a=e,x):a},x.color=function(t){return arguments.length?(o=e.utils.getColor(t),i.color(o),x):o},x.showLegend=function(e){return arguments.length?(f=e,x):f},x.showXAxis=function(e){return arguments.length?(l=e,x):l},x.showYAxis=function(e){return arguments.length?(c=e,x):c},x.rightAlignYAxis=function(e){return arguments.length?(h=e,r.orient(e?"right":"left"),x):h},x.tooltips=function(e){return arguments.length?(p=e,x):p},x.tooltipContent=function(e){return arguments.length?(d=e,x):d},x.state=function(e){return arguments.length?(g=e,x):g},x.defaultState=function(e){return arguments.length?(y=e,x):y},x.noData=function(e){return arguments.length?(b=e,x):b},x.transitionDuration=function(e){return arguments.length?(E=e,x):E},x},e.models.indentedTree=function(){function g(e){return e.each(function(e){function k(e,t,n){d3.event.stopPropagation();if(d3.event.shiftKey&&!n)return d3.event.shiftKey=!1,e.values&&e.values.forEach(function(e){(e.values||e._values)&&k(e,0,!0)}),!0;if(!O(e))return!0;e.values?(e._values=e.values,e.values=null):(e.values=e._values,e._values=null),g.update()}function L(e){return e._values&&e._values.length?h:e.values&&e.values.length?p:""}function A(e){return e._values&&e._values.length}function O(e){var t=e.values||e._values;return t&&t.length}var t=1,n=d3.select(this),i=d3.layout.tree().children(function(e){return e.values}).size([r,f]);g.update=function(){n.call(g)},e[0]||(e[0]={key:a});var s=i.nodes(e[0]),y=d3.select(this).selectAll("div").data([[s]]),b=y.enter().append("div").attr("class","nvd3 nv-wrap nv-indentedtree"),w=b.append("table"),E=y.select("table").attr("width","100%").attr("class",c);if(o){var S=w.append("thead"),x=S.append("tr");l.forEach(function(e){x.append("th").attr("width",e.width?e.width:"10%").style("text-align",e.type=="numeric"?"right":"left").append("span").text(e.label)})}var T=E.selectAll("tbody").data(function(e){return e});T.enter().append("tbody"),t=d3.max(s,function(e){return e.depth}),i.size([r,t*f]);var N=T.selectAll("tr").data(function(e){return e.filter(function(e){return u&&!e.children?u(e):!0})},function(e,t){return e.id||e.id||++m});N.exit().remove(),N.select("img.nv-treeicon").attr("src",L).classed("folded",A);var C=N.enter().append("tr");l.forEach(function(e,t){var n=C.append("td").style("padding-left",function(e){return(t?0:e.depth*f+12+(L(e)?0:16))+"px"},"important").style("text-align",e.type=="numeric"?"right":"left");t==0&&n.append("img").classed("nv-treeicon",!0).classed("nv-folded",A).attr("src",L).style("width","14px").style("height","14px").style("padding","0 1px").style("display",function(e){return L(e)?"inline-block":"none"}).on("click",k),n.each(function(n){!t&&v(n)?d3.select(this).append("a").attr("href",v).attr("class",d3.functor(e.classes)).append("span"):d3.select(this).append("span"),d3.select(this).select("span").attr("class",d3.functor(e.classes)).text(function(t){return e.format?t[e.key]?e.format(t[e.key]):"-":t[e.key]||"-"})}),e.showCount&&(n.append("span").attr("class","nv-childrenCount"),N.selectAll("span.nv-childrenCount").text(function(e){return e.values&&e.values.length||e._values&&e._values.length?"("+(e.values&&e.values.filter(function(e){return u?u(e):!0}).length||e._values&&e._values.filter(function(e){return u?u(e):!0}).length||0)+")":""}))}),N.order().on("click",function(e){d.elementClick({row:this,data:e,pos:[e.x,e.y]})}).on("dblclick",function(e){d.elementDblclick({row:this,data:e,pos:[e.x,e.y]})}).on("mouseover",function(e){d.elementMouseover({row:this,data:e,pos:[e.x,e.y]})}).on("mouseout",function(e){d.elementMouseout({row:this,data:e,pos:[e.x,e.y]})})}),g}var t={top:0,right:0,bottom:0,left:0},n=960,r=500,i=e.utils.defaultColor(),s=Math.floor(Math.random()*1e4),o=!0,u=!1,a="No Data Available.",f=20,l=[{key:"key",label:"Name",type:"text"}],c=null,h="images/grey-plus.png",p="images/grey-minus.png",d=d3.dispatch("elementClick","elementDblclick","elementMouseover","elementMouseout"),v=function(e){return e.url},m=0;return g.options=e.utils.optionsFunc.bind(g),g.margin=function(e){return arguments.length?(t.top=typeof e.top!="undefined"?e.top:t.top,t.right=typeof e.right!="undefined"?e.right:t.right,t.bottom=typeof e.bottom!="undefined"?e.bottom:t.bottom,t.left=typeof e.left!="undefined"?e.left:t.left,g):t},g.width=function(e){return arguments.length?(n=e,g):n},g.height=function(e){return arguments.length?(r=e,g):r},g.color=function(t){return arguments.length?(i=e.utils.getColor(t),scatter.color(i),g):i},g.id=function(e){return arguments.length?(s=e,g):s},g.header=function(e){return arguments.length?(o=e,g):o},g.noData=function(e){return arguments.length?(a=e,g):a},g.filterZero=function(e){return arguments.length?(u=e,g):u},g.columns=function(e){return arguments.length?(l=e,g):l},g.tableClass=function(e){return arguments.length?(c=e,g):c},g.iconOpen=function(e){return arguments.length?(h=e,g):h},g.iconClose=function(e){return arguments.length?(p=e,g):p},g.getUrl=function(e){return arguments.length?(v=e,g):v},g},e.models.legend=function(){function c(h){return h.each(function(c){var h=n-t.left-t.right,p=d3.select(this),d=p.selectAll("g.nv-legend").data([c]),v=d.enter().append("g").attr("class","nvd3 nv-legend").append("g"),m=d.select("g");d.attr("transform","translate("+t.left+","+t.top+")");var g=m.selectAll(".nv-series").data(function(e){return e}),y=g.enter().append("g").attr("class","nv-series").on("mouseover",function(e,t){l.legendMouseover(e,t)}).on("mouseout",function(e,t){l.legendMouseout(e,t)}).on("click",function(e,t){l.legendClick(e,t),a&&(f?(c.forEach(function(e){e.disabled=!0}),e.disabled=!1):(e.disabled=!e.disabled,c.every(function(e){return e.disabled})&&c.forEach(function(e){e.disabled=!1})),l.stateChange({disabled:c.map(function(e){return!!e.disabled})}))}).on("dblclick",function(e,t){l.legendDblclick(e,t),a&&(c.forEach(function(e){e.disabled=!0}),e.disabled=!1,l.stateChange({disabled:c.map(function(e){return!!e.disabled})}))});y.append("circle").style("stroke-width",2).attr("class","nv-legend-symbol").attr("r",5),y.append("text").attr("text-anchor","start").attr("class","nv-legend-text").attr("dy",".32em").attr("dx","8"),g.classed("disabled",function(e){return e.disabled}),g.exit().remove(),g.select("circle").style("fill",function(e,t){return e.color||s(e,t)}).style("stroke",function(e,t){return e.color||s(e,t)}),g.select("text").text(i);if(o){var b=[];g.each(function(t,n){var r=d3.select(this).select("text"),i;try{i=r.getComputedTextLength();if(i<=0)throw Error()}catch(s){i=e.utils.calcApproxTextWidth(r)}b.push(i+28)});var w=0,E=0,S=[];while(E<h&&w<b.length)S[w]=b[w],E+=b[w++];w===0&&(w=1);while(E>h&&w>1){S=[],w--;for(var x=0;x<b.length;x++)b[x]>(S[x%w]||0)&&(S[x%w]=b[x]);E=S.reduce(function(e,t,n,r){return e+t})}var T=[];for(var N=0,C=0;N<w;N++)T[N]=C,C+=S[N];g.attr("transform",function(e,t){return"translate("+T[t%w]+","+(5+Math.floor(t/w)*20)+")"}),u?m.attr("transform","translate("+(n-t.right-E)+","+t.top+")"):m.attr("transform","translate(0,"+t.top+")"),r=t.top+t.bottom+Math.ceil(b.length/w)*20}else{var k=5,L=5,A=0,O;g.attr("transform",function(e,r){var i=d3.select(this).select("text").node().getComputedTextLength()+28;return O=L,n<t.left+t.right+O+i&&(L=O=5,k+=20),L+=i,L>A&&(A=L),"translate("+O+","+k+")"}),m.attr("transform","translate("+(n-t.right-A)+","+t.top+")"),r=t.top+t.bottom+k+15}}),c}var t={top:5,right:0,bottom:5,left:0},n=400,r=20,i=function(e){return e.key},s=e.utils.defaultColor(),o=!0,u=!0,a=!0,f=!1,l=d3.dispatch("legendClick","legendDblclick","legendMouseover","legendMouseout","stateChange");return c.dispatch=l,c.options=e.utils.optionsFunc.bind(c),c.margin=function(e){return arguments.length?(t.top=typeof e.top!="undefined"?e.top:t.top,t.right=typeof e.right!="undefined"?e.right:t.right,t.bottom=typeof e.bottom!="undefined"?e.bottom:t.bottom,t.left=typeof e.left!="undefined"?e.left:t.left,c):t},c.width=function(e){return arguments.length?(n=e,c):n},c.height=function(e){return arguments.length?(r=e,c):r},c.key=function(e){return arguments.length?(i=e,c):i},c.color=function(t){return arguments.length?(s=e.utils.getColor(t),c):s},c.align=function(e){return arguments.length?(o=e,c):o},c.rightAlign=function(e){return arguments.length?(u=e,c):u},c.updateState=function(e){return arguments.length?(a=e,c):a},c.radioButtonMode=function(e){return arguments.length?(f=e,c):f},c},e.models.line=function(){function m(g){return g.each(function(m){var g=r-n.left-n.right,b=i-n.top-n.bottom,w=d3.select(this);c=t.xScale(),h=t.yScale(),d=d||c,v=v||h;var E=w.selectAll("g.nv-wrap.nv-line").data([m]),S=E.enter().append("g").attr("class","nvd3 nv-wrap nv-line"),T=S.append("defs"),N=S.append("g"),C=E.select("g");N.append("g").attr("class","nv-groups"),N.append("g").attr("class","nv-scatterWrap"),E.attr("transform","translate("+n.left+","+n.top+")"),t.width(g).height(b);var k=E.select(".nv-scatterWrap");k.call(t),T.append("clipPath").attr("id","nv-edge-clip-"+t.id()).append("rect"),E.select("#nv-edge-clip-"+t.id()+" rect").attr("width",g).attr("height",b>0?b:0),C.attr("clip-path",l?"url(#nv-edge-clip-"+t.id()+")":""),k.attr("clip-path",l?"url(#nv-edge-clip-"+t.id()+")":"");var L=E.select(".nv-groups").selectAll(".nv-group").data(function(e){return e},function(e){return e.key});L.enter().append("g").style("stroke-opacity",1e-6).style("fill-opacity",1e-6),L.exit().remove(),L.attr("class",function(e,t){return"nv-group nv-series-"+t}).classed("hover",function(e){return e.hover}).style("fill",function(e,t){return s(e,t)}).style("stroke",function(e,t){return s(e,t)}),L.style("stroke-opacity",1).style("fill-opacity",.5);var A=L.selectAll("path.nv-area").data(function(e){return f(e)?[e]:[]});A.enter().append("path").attr("class","nv-area").attr("d",function(t){return d3.svg.area().interpolate(p).defined(a).x(function(t,n){return e.utils.NaNtoZero(d(o(t,n)))}).y0(function(t,n){return e.utils.NaNtoZero(v(u(t,n)))}).y1(function(e,t){return v(h.domain()[0]<=0?h.domain()[1]>=0?0:h.domain()[1]:h.domain()[0])}).apply(this,[t.values])}),L.exit().selectAll("path.nv-area").remove(),A.attr("d",function(t){return d3.svg.area().interpolate(p).defined(a).x(function(t,n){return e.utils.NaNtoZero(c(o(t,n)))}).y0(function(t,n){return e.utils.NaNtoZero(h(u(t,n)))}).y1(function(e,t){return h(h.domain()[0]<=0?h.domain()[1]>=0?0:h.domain()[1]:h.domain()[0])}).apply(this,[t.values])});var O=L.selectAll("path.nv-line").data(function(e){return[e.values]});O.enter().append("path").attr("class","nv-line").attr("d",d3.svg.line().interpolate(p).defined(a).x(function(t,n){return e.utils.NaNtoZero(d(o(t,n)))}).y(function(t,n){return e.utils.NaNtoZero(v(u(t,n)))})),O.attr("d",d3.svg.line().interpolate(p).defined(a).x(function(t,n){return e.utils.NaNtoZero(c(o(t,n)))}).y(function(t,n){return e.utils.NaNtoZero(h(u(t,n)))})),d=c.copy(),v=h.copy()}),m}var t=e.models.scatter(),n={top:0,right:0,bottom:0,left:0},r=960,i=500,s=e.utils.defaultColor(),o=function(e){return e.x},u=function(e){return e.y},a=function(e,t){return!isNaN(u(e,t))&&u(e,t)!==null},f=function(e){return e.area},l=!1,c,h,p="linear";t.size(16).sizeDomain([16,256]);var d,v;return m.dispatch=t.dispatch,m.scatter=t,d3.rebind(m,t,"id","interactive","size","xScale","yScale","zScale","xDomain","yDomain","xRange","yRange","sizeDomain","forceX","forceY","forceSize","clipVoronoi","useVoronoi","clipRadius","padData","highlightPoint","clearHighlights"),m.options=e.utils.optionsFunc.bind(m),m.margin=function(e){return arguments.length?(n.top=typeof e.top!="undefined"?e.top:n.top,n.right=typeof e.right!="undefined"?e.right:n.right,n.bottom=typeof e.bottom!="undefined"?e.bottom:n.bottom,n.left=typeof e.left!="undefined"?e.left:n.left,m):n},m.width=function(e){return arguments.length?(r=e,m):r},m.height=function(e){return arguments.length?(i=e,m):i},m.x=function(e){return arguments.length?(o=e,t.x(e),m):o},m.y=function(e){return arguments.length?(u=e,t.y(e),m):u},m.clipEdge=function(e){return arguments.length?(l=e,m):l},m.color=function(n){return arguments.length?(s=e.utils.getColor(n),t.color(s),m):s},m.interpolate=function(e){return arguments.length?(p=e,m):p},m.defined=function(e){return arguments.length?(a=e,m):a},m.isArea=function(e){return arguments.length?(f=d3.functor(e),m):f},m},e.models.lineChart=function(){function N(m){return m.each(function(m){var x=d3.select(this),C=this,k=(a||parseInt(x.style("width"))||960)-o.left-o.right,L=(f||parseInt(x.style("height"))||400)-o.top-o.bottom;N.update=function(){x.call(N)},N.container=this,b.disabled=m.map(function(e){return!!e.disabled});if(!w){var A;w={};for(A in b)b[A]instanceof Array?w[A]=b[A].slice(0):w[A]=b[A]}if(!m||!m.length||!m.filter(function(e){return e.values.length}).length){var O=x.selectAll(".nv-noData").data([E]);return O.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),O.attr("x",o.left+k/2).attr("y",o.top+L/2).text(function(e){return e}),N}x.selectAll(".nv-noData").remove(),g=t.xScale(),y=t.yScale();var M=x.selectAll("g.nv-wrap.nv-lineChart").data([m]),_=M.enter().append("g").attr("class","nvd3 nv-wrap nv-lineChart").append("g"),D=M.select("g");_.append("rect").style("opacity",0),_.append("g").attr("class","nv-x nv-axis"),_.append("g").attr("class","nv-y nv-axis"),_.append("g").attr("class","nv-linesWrap"),_.append("g").attr("class","nv-legendWrap"),_.append("g").attr("class","nv-interactive"),D.select("rect").attr("width",k).attr("height",L>0?L:0),l&&(i.width(k),D.select(".nv-legendWrap").datum(m).call(i),o.top!=i.height()&&(o.top=i.height(),L=(f||parseInt(x.style("height"))||400)-o.top-o.bottom),M.select(".nv-legendWrap").attr("transform","translate(0,"+ -o.top+")")),M.attr("transform","translate("+o.left+","+o.top+")"),p&&D.select(".nv-y.nv-axis").attr("transform","translate("+k+",0)"),d&&(s.width(k).height(L).margin({left:o.left,top:o.top}).svgContainer(x).xScale(g),M.select(".nv-interactive").call(s)),t.width(k).height(L).color(m.map(function(e,t){return e.color||u(e,t)}).filter(function(e,t){return!m[t].disabled}));var P=D.select(".nv-linesWrap").datum(m.filter(function(e){return!e.disabled}));P.call(t),c&&(n.scale(g).ticks(k/100).tickSize(-L,0),D.select(".nv-x.nv-axis").attr("transform","translate(0,"+y.range()[0]+")"),D.select(".nv-x.nv-axis").call(n)),h&&(r.scale(y).ticks(L/36).tickSize(-k,0),D.select(".nv-y.nv-axis").call(r)),i.dispatch.on("stateChange",function(e){b=e,S.stateChange(b),N.update()}),s.dispatch.on("elementMousemove",function(i){t.clearHighlights();var a,f,l,c=[];m.filter(function(e,t){return e.seriesIndex=t,!e.disabled}).forEach(function(n,r){f=e.interactiveBisect(n.values,i.pointXValue,N.x()),t.highlightPoint(r,f,!0);var s=n.values[f];if(typeof s=="undefined")return;typeof a=="undefined"&&(a=s),typeof l=="undefined"&&(l=N.xScale()(N.x()(s,f))),c.push({key:n.key,value:N.y()(s,f),color:u(n,n.seriesIndex)})});if(c.length>2){var h=N.yScale().invert(i.mouseY),p=Math.abs(N.yScale().domain()[0]-N.yScale().domain()[1]),d=.03*p,g=e.nearestValueIndex(c.map(function(e){return e.value}),h,d);g!==null&&(c[g].highlight=!0)}var y=n.tickFormat()(N.x()(a,f));s.tooltip.position({left:l+o.left,top:i.mouseY+o.top}).chartContainer(C.parentNode).enabled(v).valueFormatter(function(e,t){return r.tickFormat()(e)}).data({value:y,series:c})(),s.renderGuideLine(l)}),s.dispatch.on("elementMouseout",function(e){S.tooltipHide(),t.clearHighlights()}),S.on("tooltipShow",function(e){v&&T(e,C.parentNode)}),S.on("changeState",function(e){typeof e.disabled!="undefined"&&m.length===e.disabled.length&&(m.forEach(function(t,n){t.disabled=e.disabled[n]}),b.disabled=e.disabled),N.update()})}),N}var t=e.models.line(),n=e.models.axis(),r=e.models.axis(),i=e.models.legend(),s=e.interactiveGuideline(),o={top:30,right:20,bottom:50,left:60},u=e.utils.defaultColor(),a=null,f=null,l=!0,c=!0,h=!0,p=!1,d=!1,v=!0,m=function(e,t,n,r,i){return"<h3>"+e+"</h3>"+"<p>"+n+" at "+t+"</p>"},g,y,b={},w=null,E="No Data Available.",S=d3.dispatch("tooltipShow","tooltipHide","stateChange","changeState"),x=0;n.orient("bottom").tickPadding(7),r.orient(p?"right":"left");var T=function(i,s){var o=i.pos[0]+(s.offsetLeft||0),u=i.pos[1]+(s.offsetTop||0),a=n.tickFormat()(t.x()(i.point,i.pointIndex)),f=r.tickFormat()(t.y()(i.point,i.pointIndex)),l=m(i.series.key,a,f,i,N);e.tooltip.show([o,u],l,null,null,s)};return t.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+o.left,e.pos[1]+o.top],S.tooltipShow(e)}),t.dispatch.on("elementMouseout.tooltip",function(e){S.tooltipHide(e)}),S.on("tooltipHide",function(){v&&e.tooltip.cleanup()}),N.dispatch=S,N.lines=t,N.legend=i,N.xAxis=n,N.yAxis=r,N.interactiveLayer=s,d3.rebind(N,t,"defined","isArea","x","y","size","xScale","yScale","xDomain","yDomain","xRange","yRange","forceX","forceY","interactive","clipEdge","clipVoronoi","useVoronoi","id","interpolate"),N.options=e.utils.optionsFunc.bind(N),N.margin=function(e){return arguments.length?(o.top=typeof e.top!="undefined"?e.top:o.top,o.right=typeof e.right!="undefined"?e.right:o.right,o.bottom=typeof e.bottom!="undefined"?e.bottom:o.bottom,o.left=typeof e.left!="undefined"?e.left:o.left,N):o},N.width=function(e){return arguments.length?(a=e,N):a},N.height=function(e){return arguments.length?(f=e,N):f},N.color=function(t){return arguments.length?(u=e.utils.getColor(t),i.color(u),N):u},N.showLegend=function(e){return arguments.length?(l=e,N):l},N.showXAxis=function(e){return arguments.length?(c=e,N):c},N.showYAxis=function(e){return arguments.length?(h=e,N):h},N.rightAlignYAxis=function(e){return arguments.length?(p=e,r.orient(e?"right":"left"),N):p},N.useInteractiveGuideline=function(e){return arguments.length?(d=e,e===!0&&(N.interactive(!1),N.useVoronoi(!1)),N):d},N.tooltips=function(e){return arguments.length?(v=e,N):v},N.tooltipContent=function(e){return arguments.length?(m=e,N):m},N.state=function(e){return arguments.length?(b=e,N):b},N.defaultState=function(e){return arguments.length?(w=e,N):w},N.noData=function(e){return arguments.length?(E=e,N):E},N.transitionDuration=function(e){return arguments.length?(x=e,N):x},N},e.models.linePlusBarChart=function(){function T(e){return e.each(function(e){var l=d3.select(this),c=this,v=(a||parseInt(l.style("width"))||960)-u.left-u.right,N=(f||parseInt(l.style("height"))||400)-u.top-u.bottom;T.update=function(){l.call(T)},b.disabled=e.map(function(e){return!!e.disabled});if(!w){var C;w={};for(C in b)b[C]instanceof Array?w[C]=b[C].slice(0):w[C]=b[C]}if(!e||!e.length||!e.filter(function(e){return e.values.length}).length){var k=l.selectAll(".nv-noData").data([E]);return k.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),k.attr("x",u.left+v/2).attr("y",u.top+N/2).text(function(e){return e}),T}l.selectAll(".nv-noData").remove();var L=e.filter(function(e){return!e.disabled&&e.bar}),A=e.filter(function(e){return!e.bar});m=A.filter(function(e){return!e.disabled}).length&&A.filter(function(e){return!e.disabled})[0].values.length?t.xScale():n.xScale(),g=n.yScale(),y=t.yScale();var O=d3.select(this).selectAll("g.nv-wrap.nv-linePlusBar").data([e]),M=O.enter().append("g").attr("class","nvd3 nv-wrap nv-linePlusBar").append("g"),_=O.select("g");M.append("g").attr("class","nv-x nv-axis"),M.append("g").attr("class","nv-y1 nv-axis"),M.append("g").attr("class","nv-y2 nv-axis"),M.append("g").attr("class","nv-barsWrap"),M.append("g").attr("class","nv-linesWrap"),M.append("g").attr("class","nv-legendWrap"),p&&(o.width(v/2),_.select(".nv-legendWrap").datum(e.map(function(e){return e.originalKey=e.originalKey===undefined?e.key:e.originalKey,e.key=e.originalKey+(e.bar?" (left axis)":" (right axis)"),e})).call(o),u.top!=o.height()&&(u.top=o.height(),N=(f||parseInt(l.style("height"))||400)-u.top-u.bottom),_.select(".nv-legendWrap").attr("transform","translate("+v/2+","+ -u.top+")")),O.attr("transform","translate("+u.left+","+u.top+")"),t.width(v).height(N).color(e.map(function(e,t){return e.color||h(e,t)}).filter(function(t,n){return!e[n].disabled&&!e[n].bar})),n.width(v).height(N).color(e.map(function(e,t){return e.color||h(e,t)}).filter(function(t,n){return!e[n].disabled&&e[n].bar}));var D=_.select(".nv-barsWrap").datum(L.length?L:[{values:[]}]),P=_.select(".nv-linesWrap").datum(A[0]&&!A[0].disabled?A:[{values:[]}]);d3.transition(D).call(n),d3.transition(P).call(t),r.scale(m).ticks(v/100).tickSize(-N,0),_.select(".nv-x.nv-axis").attr("transform","translate(0,"+g.range()[0]+")"),d3.transition(_.select(".nv-x.nv-axis")).call(r),i.scale(g).ticks(N/36).tickSize(-v,0),d3.transition(_.select(".nv-y1.nv-axis")).style("opacity",L.length?1:0).call(i),s.scale(y).ticks(N/36).tickSize(L.length?0:-v,0),_.select(".nv-y2.nv-axis").style("opacity",A.length?1:0).attr("transform","translate("+v+",0)"),d3.transition(_.select(".nv-y2.nv-axis")).call(s),o.dispatch.on("stateChange",function(e){b=e,S.stateChange(b),T.update()}),S.on("tooltipShow",function(e){d&&x(e,c.parentNode)}),S.on("changeState",function(t){typeof t.disabled!="undefined"&&(e.forEach(function(e,n){e.disabled=t.disabled[n]}),b.disabled=t.disabled),T.update()})}),T}var t=e.models.line(),n=e.models.historicalBar(),r=e.models.axis(),i=e.models.axis(),s=e.models.axis(),o=e.models.legend(),u={top:30,right:60,bottom:50,left:60},a=null,f=null,l=function(e){return e.x},c=function(e){return e.y},h=e.utils.defaultColor(),p=!0,d=!0,v=function(e,t,n,r,i){return"<h3>"+e+"</h3>"+"<p>"+n+" at "+t+"</p>"},m,g,y,b={},w=null,E="No Data Available.",S=d3.dispatch("tooltipShow","tooltipHide","stateChange","changeState");n.padData(!0),t.clipEdge(!1).padData(!0),r.orient("bottom").tickPadding(7).highlightZero(!1),i.orient("left"),s.orient("right");var x=function(n,o){var u=n.pos[0]+(o.offsetLeft||0),a=n.pos[1]+(o.offsetTop||0),f=r.tickFormat()(t.x()(n.point,n.pointIndex)),l=(n.series.bar?i:s).tickFormat()(t.y()(n.point,n.pointIndex)),c=v(n.series.key,f,l,n,T);e.tooltip.show([u,a],c,n.value<0?"n":"s",null,o)};return t.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+u.left,e.pos[1]+u.top],S.tooltipShow(e)}),t.dispatch.on("elementMouseout.tooltip",function(e){S.tooltipHide(e)}),n.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+u.left,e.pos[1]+u.top],S.tooltipShow(e)}),n.dispatch.on("elementMouseout.tooltip",function(e){S.tooltipHide(e)}),S.on("tooltipHide",function(){d&&e.tooltip.cleanup()}),T.dispatch=S,T.legend=o,T.lines=t,T.bars=n,T.xAxis=r,T.y1Axis=i,T.y2Axis=s,d3.rebind(T,t,"defined","size","clipVoronoi","interpolate"),T.options=e.utils.optionsFunc.bind(T),T.x=function(e){return arguments.length?(l=e,t.x(e),n.x(e),T):l},T.y=function(e){return arguments.length?(c=e,t.y(e),n.y(e),T):c},T.margin=function(e){return arguments.length?(u.top=typeof e.top!="undefined"?e.top:u.top,u.right=typeof e.right!="undefined"?e.right:u.right,u.bottom=typeof e.bottom!="undefined"?e.bottom:u.bottom,u.left=typeof e.left!="undefined"?e.left:u.left,T):u},T.width=function(e){return arguments.length?(a=e,T):a},T.height=function(e){return arguments.length?(f=e,T):f},T.color=function(t){return arguments.length?(h=e.utils.getColor(t),o.color(h),T):h},T.showLegend=function(e){return arguments.length?(p=e,T):p},T.tooltips=function(e){return arguments.length?(d=e,T):d},T.tooltipContent=function(e){return arguments.length?(v=e,T):v},T.state=function(e){return arguments.length?(b=e,T):b},T.defaultState=function(e){return arguments.length?(w=e,T):w},T.noData=function(e){return arguments.length?(E=e,T):E},T},e.models.lineWithFocusChart=function(){function k(e){return e.each(function(e){function R(e){var t=+(e=="e"),n=t?1:-1,r=O/3;return"M"+.5*n+","+r+"A6,6 0 0 "+t+" "+6.5*n+","+(r+6)+"V"+(2*r-6)+"A6,6 0 0 "+t+" "+.5*n+","+2*r+"Z"+"M"+2.5*n+","+(r+8)+"V"+(2*r-8)+"M"+4.5*n+","+(r+8)+"V"+(2*r-8)}function U(){a.empty()||a.extent(w),F.data([a.empty()?g.domain():w]).each(function(e,t){var n=g(e[0])-v.range()[0],r=v.range()[1]-g(e[1]);d3.select(this).select(".left").attr("width",n<0?0:n),d3.select(this).select(".right").attr("x",g(e[1])).attr("width",r<0?0:r)})}function z(){w=a.empty()?null:a.extent();var n=a.empty()?g.domain():a.extent();if(Math.abs(n[0]-n[1])<=1)return;T.brush({extent:n,brush:a}),U();var s=P.select(".nv-focus .nv-linesWrap").datum(e.filter(function(e){return!e.disabled}).map(function(e,r){return{key:e.key,values:e.values.filter(function(e,r){return t.x()(e,r)>=n[0]&&t.x()(e,r)<=n[1]})}}));s.call(t),P.select(".nv-focus .nv-x.nv-axis").call(r),P.select(".nv-focus .nv-y.nv-axis").call(i)}var S=d3.select(this),N=this,L=(h||parseInt(S.style("width"))||960)-f.left-f.right,A=(p||parseInt(S.style("height"))||400)-f.top-f.bottom-d,O=d-l.top-l.bottom;k.update=function(){S.call(k)},k.container=this;if(!e||!e.length||!e.filter(function(e){return e.values.length}).length){var M=S.selectAll(".nv-noData").data([x]);return M.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),M.attr("x",f.left+L/2).attr("y",f.top+A/2).text(function(e){return e}),k}S.selectAll(".nv-noData").remove(),v=t.xScale(),m=t.yScale(),g=n.xScale(),y=n.yScale();var _=S.selectAll("g.nv-wrap.nv-lineWithFocusChart").data([e]),D=_.enter().append("g").attr("class","nvd3 nv-wrap nv-lineWithFocusChart").append("g"),P=_.select("g");D.append("g").attr("class","nv-legendWrap");var H=D.append("g").attr("class","nv-focus");H.append("g").attr("class","nv-x nv-axis"),H.append("g").attr("class","nv-y nv-axis"),H.append("g").attr("class","nv-linesWrap");var B=D.append("g").attr("class","nv-context");B.append("g").attr("class","nv-x nv-axis"),B.append("g").attr("class","nv-y nv-axis"),B.append("g").attr("class","nv-linesWrap"),B.append("g").attr("class","nv-brushBackground"),B.append("g").attr("class","nv-x nv-brush"),b&&(u.width(L),P.select(".nv-legendWrap").datum(e).call(u),f.top!=u.height()&&(f.top=u.height(),A=(p||parseInt(S.style("height"))||400)-f.top-f.bottom-d),P.select(".nv-legendWrap").attr("transform","translate(0,"+ -f.top+")")),_.attr("transform","translate("+f.left+","+f.top+")"),t.width(L).height(A).color(e.map(function(e,t){return e.color||c(e,t)}).filter(function(t,n){return!e[n].disabled})),n.defined(t.defined()).width(L).height(O).color(e.map(function(e,t){return e.color||c(e,t)}).filter(function(t,n){return!e[n].disabled})),P.select(".nv-context").attr("transform","translate(0,"+(A+f.bottom+l.top)+")");var j=P.select(".nv-context .nv-linesWrap").datum(e.filter(function(e){return!e.disabled}));d3.transition(j).call(n),r.scale(v).ticks(L/100).tickSize(-A,0),i.scale(m).ticks(A/36).tickSize(-L,0),P.select(".nv-focus .nv-x.nv-axis").attr("transform","translate(0,"+A+")"),a.x(g).on("brush",function(){var e=k.transitionDuration();k.transitionDuration(0),z(),k.transitionDuration(e)}),w&&a.extent(w);var F=P.select(".nv-brushBackground").selectAll("g").data([w||a.extent()]),I=F.enter().append("g");I.append("rect").attr("class","left").attr("x",0).attr("y",0).attr("height",O),I.append("rect").attr("class","right").attr("x",0).attr("y",0).attr("height",O);var q=P.select(".nv-x.nv-brush").call(a);q.selectAll("rect").attr("height",O),q.selectAll(".resize").append("path").attr("d",R),z(),s.scale(g).ticks(L/100).tickSize(-O,0),P.select(".nv-context .nv-x.nv-axis").attr("transform","translate(0,"+y.range()[0]+")"),d3.transition(P.select(".nv-context .nv-x.nv-axis")).call(s),o.scale(y).ticks(O/36).tickSize(-L,0),d3.transition(P.select(".nv-context .nv-y.nv-axis")).call(o),P.select(".nv-context .nv-x.nv-axis").attr("transform","translate(0,"+y.range()[0]+")"),u.dispatch.on("stateChange",function(e){k.update()}),T.on("tooltipShow",function(e){E&&C(e,N.parentNode)})}),k}var t=e.models.line(),n=e.models.line(),r=e.models.axis(),i=e.models.axis(),s=e.models.axis(),o=e.models.axis(),u=e.models.legend(),a=d3.svg.brush(),f={top:30,right:30,bottom:30,left:60},l={top:0,right:30,bottom:20,left:60},c=e.utils.defaultColor(),h=null,p=null,d=100,v,m,g,y,b=!0,w=null,E=!0,S=function(e,t,n,r,i){return"<h3>"+e+"</h3>"+"<p>"+n+" at "+t+"</p>"},x="No Data Available.",T=d3.dispatch("tooltipShow","tooltipHide","brush"),N=0;t.clipEdge(!0),n.interactive(!1),r.orient("bottom").tickPadding(5),i.orient("left"),s.orient("bottom").tickPadding(5),o.orient("left");var C=function(n,s){var o=n.pos[0]+(s.offsetLeft||0),u=n.pos[1]+(s.offsetTop||0),a=r.tickFormat()(t.x()(n.point,n.pointIndex)),f=i.tickFormat()(t.y()(n.point,n.pointIndex)),l=S(n.series.key,a,f,n,k);e.tooltip.show([o,u],l,null,null,s)};return t.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+f.left,e.pos[1]+f.top],T.tooltipShow(e)}),t.dispatch.on("elementMouseout.tooltip",function(e){T.tooltipHide(e)}),T.on("tooltipHide",function(){E&&e.tooltip.cleanup()}),k.dispatch=T,k.legend=u,k.lines=t,k.lines2=n,k.xAxis=r,k.yAxis=i,k.x2Axis=s,k.y2Axis=o,d3.rebind(k,t,"defined","isArea","size","xDomain","yDomain","xRange","yRange","forceX","forceY","interactive","clipEdge","clipVoronoi","id"),k.options=e.utils.optionsFunc.bind(k),k.x=function(e){return arguments.length?(t.x(e),n.x(e),k):t.x},k.y=function(e){return arguments.length?(t.y(e),n.y(e),k):t.y},k.margin=function(e){return arguments.length?(f.top=typeof e.top!="undefined"?e.top:f.top,f.right=typeof e.right!="undefined"?e.right:f.right,f.bottom=typeof e.bottom!="undefined"?e.bottom:f.bottom,f.left=typeof e.left!="undefined"?e.left:f.left,k):f},k.margin2=function(e){return arguments.length?(l=e,k):l},k.width=function(e){return arguments.length?(h=e,k):h},k.height=function(e){return arguments.length?(p=e,k):p},k.height2=function(e){return arguments.length?(d=e,k):d},k.color=function(t){return arguments.length?(c=e.utils.getColor(t),u.color(c),k):c},k.showLegend=function(e){return arguments.length?(b=e,k):b},k.tooltips=function(e){return arguments.length?(E=e,k):E},k.tooltipContent=function(e){return arguments.length?(S=e,k):S},k.interpolate=function(e){return arguments.length?(t.interpolate(e),n.interpolate(e),k):t.interpolate()},k.noData=function(e){return arguments.length?(x=e,k):x},k.xTickFormat=function(e){return arguments.length?(r.tickFormat(e),s.tickFormat(e),k):r.tickFormat()},k.yTickFormat=function(e){return arguments.length?(i.tickFormat(e),o.tickFormat(e),k):i.tickFormat()},k.brushExtent=function(e){return arguments.length?(w=e,k):w},k.transitionDuration=function(e){return arguments.length?(N=e,k):N},k},e.models.linePlusBarWithFocusChart=function(){function B(e){return e.each(function(e){function tt(e){var t=+(e=="e"),n=t?1:-1,r=I/3;return"M"+.5*n+","+r+"A6,6 0 0 "+t+" "+6.5*n+","+(r+6)+"V"+(2*r-6)+"A6,6 0 0 "+t+" "+.5*n+","+2*r+"Z"+"M"+2.5*n+","+(r+8)+"V"+(2*r-8)+"M"+4.5*n+","+(r+8)+"V"+(2*r-8)}function nt(){h.empty()||h.extent(x),Y.data([h.empty()?k.domain():x]).each(function(e,t){var n=k(e[0])-k.range()[0],r=k.range()[1]-k(e[1]);d3.select(this).select(".left").attr("width",n<0?0:n),d3.select(this).select(".right").attr("x",k(e[1])).attr("width",r<0?0:r)})}function rt(){x=h.empty()?null:h.extent(),S=h.empty()?k.domain():h.extent(),D.brush({extent:S,brush:h}),nt(),r.width(j).height(F).color(e.map(function(e,t){return e.color||w(e,t)}).filter(function(t,n){return!e[n].disabled&&e[n].bar})),t.width(j).height(F).color(e.map(function(e,t){return e.color||w(e,t)}).filter(function(t,n){return!e[n].disabled&&!e[n].bar}));var n=$.select(".nv-focus .nv-barsWrap").datum(R.length?R.map(function(e,t){return{key:e.key,values:e.values.filter(function(e,t){return r.x()(e,t)>=S[0]&&r.x()(e,t)<=S[1]})}}):[{values:[]}]),i=$.select(".nv-focus .nv-linesWrap").datum(U[0].disabled?[{values:[]}]:U.map(function(e,n){return{key:e.key,values:e.values.filter(function(e,n){return t.x()(e,n)>=S[0]&&t.x()(e,n)<=S[1]})}}));R.length?C=r.xScale():C=t.xScale(),s.scale(C).ticks(j/100).tickSize(-F,0),s.domain([Math.ceil(S[0]),Math.floor(S[1])]),$.select(".nv-x.nv-axis").call(s),n.call(r),i.call(t),$.select(".nv-focus .nv-x.nv-axis").attr("transform","translate(0,"+L.range()[0]+")"),u.scale(L).ticks(F/36).tickSize(-j,0),$.select(".nv-focus .nv-y1.nv-axis").style("opacity",R.length?1:0),a.scale(A).ticks(F/36).tickSize(R.length?0:-j,0),$.select(".nv-focus .nv-y2.nv-axis").style("opacity",U.length?1:0).attr("transform","translate("+C.range()[1]+",0)"),$.select(".nv-focus .nv-y1.nv-axis").call(u),$.select(".nv-focus .nv-y2.nv-axis").call(a)}var N=d3.select(this),P=this,j=(v||parseInt(N.style("width"))||960)-p.left-p.right,F=(m||parseInt(N.style("height"))||400)-p.top-p.bottom-g,I=g-d.top-d.bottom;B.update=function(){N.call(B)},B.container=this;if(!e||!e.length||!e.filter(function(e){return e.values.length}).length){var q=N.selectAll(".nv-noData").data([_]);return q.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),q.attr("x",p.left+j/2).attr("y",p.top+F/2).text(function(e){return e}),B}N.selectAll(".nv-noData").remove();var R=e.filter(function(e){return!e.disabled&&e.bar}),U=e.filter(function(e){return!e.bar});C=r.xScale(),k=o.scale(),L=r.yScale(),A=t.yScale(),O=i.yScale(),M=n.yScale();var z=e.filter(function(e){return!e.disabled&&e.bar}).map(function(e){return e.values.map(function(e,t){return{x:y(e,t),y:b(e,t)}})}),W=e.filter(function(e){return!e.disabled&&!e.bar}).map(function(e){return e.values.map(function(e,t){return{x:y(e,t),y:b(e,t)}})});C.range([0,j]),k.domain(d3.extent(d3.merge(z.concat(W)),function(e){return e.x})).range([0,j]);var X=N.selectAll("g.nv-wrap.nv-linePlusBar").data([e]),V=X.enter().append("g").attr("class","nvd3 nv-wrap nv-linePlusBar").append("g"),$=X.select("g");V.append("g").attr("class","nv-legendWrap");var J=V.append("g").attr("class","nv-focus");J.append("g").attr("class","nv-x nv-axis"),J.append("g").attr("class","nv-y1 nv-axis"),J.append("g").attr("class","nv-y2 nv-axis"),J.append("g").attr("class","nv-barsWrap"),J.append("g").attr("class","nv-linesWrap");var K=V.append("g").attr("class","nv-context");K.append("g").attr("class","nv-x nv-axis"),K.append("g").attr("class","nv-y1 nv-axis"),K.append("g").attr("class","nv-y2 nv-axis"),K.append("g").attr("class","nv-barsWrap"),K.append("g").attr("class","nv-linesWrap"),K.append("g").attr("class","nv-brushBackground"),K.append("g").attr("class","nv-x nv-brush"),E&&(c.width(j/2),$.select(".nv-legendWrap").datum(e.map(function(e){return e.originalKey=e.originalKey===undefined?e.key:e.originalKey,e.key=e.originalKey+(e.bar?" (left axis)":" (right axis)"),e})).call(c),p.top!=c.height()&&(p.top=c.height(),F=(m||parseInt(N.style("height"))||400)-p.top-p.bottom-g),$.select(".nv-legendWrap").attr("transform","translate("+j/2+","+ -p.top+")")),X.attr("transform","translate("+p.left+","+p.top+")"),i.width(j).height(I).color(e.map(function(e,t){return e.color||w(e,t)}).filter(function(t,n){return!e[n].disabled&&e[n].bar})),n.width(j).height(I).color(e.map(function(e,t){return e.color||w(e,t)}).filter(function(t,n){return!e[n].disabled&&!e[n].bar}));var Q=$.select(".nv-context .nv-barsWrap").datum(R.length?R:[{values:[]}]),G=$.select(".nv-context .nv-linesWrap").datum(U[0].disabled?[{values:[]}]:U);$.select(".nv-context").attr("transform","translate(0,"+(F+p.bottom+d.top)+")"),Q.call(i),G.call(n),h.x(k).on("brush",rt),x&&h.extent(x);var Y=$.select(".nv-brushBackground").selectAll("g").data([x||h.extent()]),Z=Y.enter().append("g");Z.append("rect").attr("class","left").attr("x",0).attr("y",0).attr("height",I),Z.append("rect").attr("class","right").attr("x",0).attr("y",0).attr("height",I);var et=$.select(".nv-x.nv-brush").call(h);et.selectAll("rect").attr("height",I),et.selectAll(".resize").append("path").attr("d",tt),o.ticks(j/100).tickSize(-I,0),$.select(".nv-context .nv-x.nv-axis").attr("transform","translate(0,"+O.range()[0]+")"),$.select(".nv-context .nv-x.nv-axis").call(o),f.scale(O).ticks(I/36).tickSize(-j,0),$.select(".nv-context .nv-y1.nv-axis").style("opacity",R.length?1:0).attr("transform","translate(0,"+k.range()[0]+")"),$.select(".nv-context .nv-y1.nv-axis").call(f),l.scale(M).ticks(I/36).tickSize(R.length?0:-j,0),$.select(".nv-context .nv-y2.nv-axis").style("opacity",U.length?1:0).attr("transform","translate("+k.range()[1]+",0)"),$.select(".nv-context .nv-y2.nv-axis").call(l),c.dispatch.on("stateChange",function(e){B.update()}),D.on("tooltipShow",function(e){T&&H(e,P.parentNode)}),rt()}),B}var t=e.models.line(),n=e.models.line(),r=e.models.historicalBar(),i=e.models.historicalBar(),s=e.models.axis(),o=e.models.axis(),u=e.models.axis(),a=e.models.axis(),f=e.models.axis(),l=e.models.axis(),c=e.models.legend(),h=d3.svg.brush(),p={top:30,right:30,bottom:30,left:60},d={top:0,right:30,bottom:20,left:60},v=null,m=null,g=100,y=function(e){return e.x},b=function(e){return e.y},w=e.utils.defaultColor(),E=!0,S,x=null,T=!0,N=function(e,t,n,r,i){return"<h3>"+e+"</h3>"+"<p>"+n+" at "+t+"</p>"},C,k,L,A,O,M,_="No Data Available.",D=d3.dispatch("tooltipShow","tooltipHide","brush"),P=0;t.clipEdge(!0),n.interactive(!1),s.orient("bottom").tickPadding(5),u.orient("left"),a.orient("right"),o.orient("bottom").tickPadding(5),f.orient("left"),l.orient("right");var H=function(n,r){S&&(n.pointIndex+=Math.ceil(S[0]));var i=n.pos[0]+(r.offsetLeft||0),o=n.pos[1]+(r.offsetTop||0),f=s.tickFormat()(t.x()(n.point,n.pointIndex)),l=(n.series.bar?u:a).tickFormat()(t.y()(n.point,n.pointIndex)),c=N(n.series.key,f,l,n,B);e.tooltip.show([i,o],c,n.value<0?"n":"s",null,r)};return t.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+p.left,e.pos[1]+p.top],D.tooltipShow(e)}),t.dispatch.on("elementMouseout.tooltip",function(e){D.tooltipHide(e)}),r.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+p.left,e.pos[1]+p.top],D.tooltipShow(e)}),r.dispatch.on("elementMouseout.tooltip",function(e){D.tooltipHide(e)}),D.on("tooltipHide",function(){T&&e.tooltip.cleanup()}),B.dispatch=D,B.legend=c,B.lines=t,B.lines2=n,B.bars=r,B.bars2=i,B.xAxis=s,B.x2Axis=o,B.y1Axis=u,B.y2Axis=a,B.y3Axis=f,B.y4Axis=l,d3.rebind(B,t,"defined","size","clipVoronoi","interpolate"),B.options=e.utils.optionsFunc.bind(B),B.x=function(e){return arguments.length?(y=e,t.x(e),r.x(e),B):y},B.y=function(e){return arguments.length?(b=e,t.y(e),r.y(e),B):b},B.margin=function(e){return arguments.length?(p.top=typeof e.top!="undefined"?e.top:p.top,p.right=typeof e.right!="undefined"?e.right:p.right,p.bottom=typeof e.bottom!="undefined"?e.bottom:p.bottom,p.left=typeof e.left!="undefined"?e.left:p.left,B):p},B.width=function(e){return arguments.length?(v=e,B):v},B.height=function(e){return arguments.length?(m=e,B):m},B.color=function(t){return arguments.length?(w=e.utils.getColor(t),c.color(w),B):w},B.showLegend=function(e){return arguments.length?(E=e,B):E},B.tooltips=function(e){return arguments.length?(T=e,B):T},B.tooltipContent=function(e){return arguments.length?(N=e,B):N},B.noData=function(e){return arguments.length?(_=e,B):_},B.brushExtent=function(e){return arguments.length?(x=e,B):x},B},e.models.multiBar=function(){function C(e){return e.each(function(e){var g=n-t.left-t.right,C=r-t.top-t.bottom,k=d3.select(this);d&&e.length&&(d=[{values:e[0].values.map(function(e){return{x:e.x,y:0,series:e.series,size:.01}})}]),c&&(e=d3.layout.stack().offset(h).values(function(e){return e.values}).y(a)(!e.length&&d?d:e)),e.forEach(function(e,t){e.values.forEach(function(e){e.series=t})}),c&&e[0].values.map(function(t,n){var r=0,i=0;e.map(function(e){var t=e.values[n];t.size=Math.abs(t.y),t.y<0?(t.y1=i,i-=t.size):(t.y1=t.size+r,r+=t.size)})});var L=y&&b?[]:e.map(function(e){return e.values.map(function(e,t){return{x:u(e,t),y:a(e,t),y0:e.y0,y1:e.y1}})});i.domain(y||d3.merge(L).map(function(e){return e.x})).rangeBands(w||[0,g],S),s.domain(b||d3.extent(d3.merge(L).map(function(e){return c?e.y>0?e.y1:e.y1+e.y:e.y}).concat(f))).range(E||[C,0]),i.domain()[0]===i.domain()[1]&&(i.domain()[0]?i.domain([i.domain()[0]-i.domain()[0]*.01,i.domain()[1]+i.domain()[1]*.01]):i.domain([-1,1])),s.domain()[0]===s.domain()[1]&&(s.domain()[0]?s.domain([s.domain()[0]+s.domain()[0]*.01,s.domain()[1]-s.domain()[1]*.01]):s.domain([-1,1])),T=T||i,N=N||s;var A=k.selectAll("g.nv-wrap.nv-multibar").data([e]),O=A.enter().append("g").attr("class","nvd3 nv-wrap nv-multibar"),M=O.append("defs"),_=O.append("g"),D=A.select("g");_.append("g").attr("class","nv-groups"),A.attr("transform","translate("+t.left+","+t.top+")"),M.append("clipPath").attr("id","nv-edge-clip-"+o).append("rect"),A.select("#nv-edge-clip-"+o+" rect").attr("width",g).attr("height",C),D.attr("clip-path",l?"url(#nv-edge-clip-"+o+")":"");var P=A.select(".nv-groups").selectAll(".nv-group").data(function(e){return e},function(e,t){return t});P.enter().append("g").style("stroke-opacity",1e-6).style("fill-opacity",1e-6),P.exit().selectAll("rect.nv-bar").attr("y",function(e){return c?N(e.y0):N(0)}).attr("height",0).remove(),P.attr("class",function(e,t){return"nv-group nv-series-"+t}).classed("hover",function(e){return e.hover}).style("fill",function(e,t){return p(e,t)}).style("stroke",function(e,t){return p(e,t)}),P.style("stroke-opacity",1).style("fill-opacity",.75);var H=P.selectAll("rect.nv-bar").data(function(t){return d&&!e.length?d.values:t.values});H.exit().remove();var B=H.enter().append("rect").attr("class",function(e,t){return a(e,t)<0?"nv-bar negative":"nv-bar positive"}).attr("x",function(t,n,r){return c?0:r*i.rangeBand()/e.length}).attr("y",function(e){return N(c?e.y0:0)}).attr("height",0).attr("width",i.rangeBand()/(c?1:e.length)).attr("transform",function(e,t){return"translate("+i(u(e,t))+",0)"});H.style("fill",function(e,t,n){return p(e,n,t)}).style("stroke",function(e,t,n){return p(e,n,t)}).on("mouseover",function(t,n){d3.select(this).classed("hover",!0),x.elementMouseover({value:a(t,n),point:t,series:e[t.series],pos:[i(u(t,n))+i.rangeBand()*(c?e.length/2:t.series+.5)/e.length,s(a(t,n)+(c?t.y0:0))],pointIndex:n,seriesIndex:t.series,e:d3.event})}).on("mouseout",function(t,n){d3.select(this).classed("hover",!1),x.elementMouseout({value:a(t,n),point:t,series:e[t.series],pointIndex:n,seriesIndex:t.series,e:d3.event})}).on("click",function(t,n){x.elementClick({value:a(t,n),point:t,series:e[t.series],pos:[i(u(t,n))+i.rangeBand()*(c?e.length/2:t.series+.5)/e.length,s(a(t,n)+(c?t.y0:0))],pointIndex:n,seriesIndex:t.series,e:d3.event}),d3.event.stopPropagation()}).on("dblclick",function(t,n){x.elementDblClick({value:a(t,n),point:t,series:e[t.series],pos:[i(u(t,n))+i.rangeBand()*(c?e.length/2:t.series+.5)/e.length,s(a(t,n)+(c?t.y0:0))],pointIndex:n,seriesIndex:t.series,e:d3.event}),d3.event.stopPropagation()}),H.attr("class",function(e,t){return a(e,t)<0?"nv-bar negative":"nv-bar positive"}).attr("transform",function(e,t){return"translate("+i(u(e,t))+",0)"}),v&&(m||(m=e.map(function(){return!0})),H.style("fill",function(e,t,n){return d3.rgb(v(e,t)).darker(m.map(function(e,t){return t}).filter(function(e,t){return!m[t]})[n]).toString()}).style("stroke",function(e,t,n){return d3.rgb(v(e,t)).darker(m.map(function(e,t){return t}).filter(function(e,t){return!m[t]})[n]).toString()})),c?H.attr("y",function(e,t){return s(c?e.y1:0)}).attr("height",function(e,t){return Math.max(Math.abs(s(e.y+(c?e.y0:0))-s(c?e.y0:0)),1)}).attr("x",function(t,n){return c?0:t.series*i.rangeBand()/e.length}).attr("width",i.rangeBand()/(c?1:e.length)):H.attr("x",function(t,n){return t.series*i.rangeBand()/e.length}).attr("width",i.rangeBand()/e.length).attr("y",function(e,t){return a(e,t)<0?s(0):s(0)-s(a(e,t))<1?s(0)-1:s(a(e,t))||0}).attr("height",function(e,t){return Math.max(Math.abs(s(a(e,t))-s(0)),1)||0}),T=i.copy(),N=s.copy()}),C}var t={top:0,right:0,bottom:0,left:0},n=960,r=500,i=d3.scale.ordinal(),s=d3.scale.linear(),o=Math.floor(Math.random()*1e4),u=function(e){return e.x},a=function(e){return e.y},f=[0],l=!0,c=!1,h="zero",p=e.utils.defaultColor(),d=!1,v=null,m,g=1200,y,b,w,E,S=.1,x=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout"),T,N;return C.dispatch=x,C.options=e.utils.optionsFunc.bind(C),C.x=function(e){return arguments.length?(u=e,C):u},C.y=function(e){return arguments.length?(a=e,C):a},C.margin=function(e){return arguments.length?(t.top=typeof e.top!="undefined"?e.top:t.top,t.right=typeof e.right!="undefined"?e.right:t.right,t.bottom=typeof e.bottom!="undefined"?e.bottom:t.bottom,t.left=typeof e.left!="undefined"?e.left:t.left,C):t},C.width=function(e){return arguments.length?(n=e,C):n},C.height=function(e){return arguments.length?(r=e,C):r},C.xScale=function(e){return arguments.length?(i=e,C):i},C.yScale=function(e){return arguments.length?(s=e,C):s},C.xDomain=function(e){return arguments.length?(y=e,C):y},C.yDomain=function(e){return arguments.length?(b=e,C):b},C.xRange=function(e){return arguments.length?(w=e,C):w},C.yRange=function(e){return arguments.length?(E=e,C):E},C.forceY=function(e){return arguments.length?(f=e,C):f},C.stacked=function(e){return arguments.length?(c=e,C):c},C.stackOffset=function(e){return arguments.length?(h=e,C):h},C.clipEdge=function(e){return arguments.length?(l=e,C):l},C.color=function(t){return arguments.length?(p=e.utils.getColor(t),C):p},C.barColor=function(t){return arguments.length?(v=e.utils.getColor(t),C):v},C.disabled=function(e){return arguments.length?(m=e,C):m},C.id=function(e){return arguments.length?(o=e,C):o},C.hideable=function(e){return arguments.length?(d=e,C):d},C.delay=function(e){return arguments.length?(g=e,C):g},C.groupSpacing=function(e){return arguments.length?(S=e,C):S},C},e.models.multiBarChart=function(){function A(e){return e.each(function(e){var b=d3.select(this),k=this,O=(u||parseInt(b.style("width"))||960)-o.left-o.right,M=(a||parseInt(b.style("height"))||400)-o.top-o.bottom;A.update=function(){b.call(A)},A.container=this,S.disabled=e.map(function(e){return!!e.disabled});if(!x){var _;x={};for(_ in S)S[_]instanceof Array?x[_]=S[_].slice(0):x[_]=S[_]}if(!e||!e.length||!e.filter(function(e){return e.values.length}).length){var D=b.selectAll(".nv-noData").data([T]);return D.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),D.attr("x",o.left+O/2).attr("y",o.top+M/2).text(function(e){return e}),A}b.selectAll(".nv-noData").remove(),w=t.xScale(),E=t.yScale();var P=b.selectAll("g.nv-wrap.nv-multiBarWithLegend").data([e]),H=P.enter().append("g").attr("class","nvd3 nv-wrap nv-multiBarWithLegend").append("g"),B=P.select("g");H.append("g").attr("class","nv-x nv-axis"),H.append("g").attr("class","nv-y nv-axis"),H.append("g").attr("class","nv-barsWrap"),H.append("g").attr("class","nv-legendWrap"),H.append("g").attr("class","nv-controlsWrap"),c&&(i.width(O-C()),t.barColor()&&e.forEach(function(e,t){e.color=d3.rgb("#ccc").darker(t*1.5).toString()}),B.select(".nv-legendWrap").datum(e).call(i),o.top!=i.height()&&(o.top=i.height(),M=(a||parseInt(b.style("height"))||400)-o.top-o.bottom),B.select(".nv-legendWrap").attr("transform","translate("+C()+","+ -o.top+")"));if(l){var j=[{key:"Grouped",disabled:t.stacked()},{key:"Stacked",disabled:!t.stacked()}];s.width(C()).color(["#444","#444","#444"]),B.select(".nv-controlsWrap").datum(j).attr("transform","translate(0,"+ -o.top+")").call(s)}P.attr("transform","translate("+o.left+","+o.top+")"),d&&B.select(".nv-y.nv-axis").attr("transform","translate("+O+",0)"),t.disabled(e.map(function(e){return e.disabled})).width(O).height(M).color(e.map(function(e,t){return e.color||f(e,t)}).filter(function(t,n){return!e[n].disabled}));var F=B.select(".nv-barsWrap").datum(e.filter(function(e){return!e.disabled}));F.call(t);if(h){n.scale(w).ticks(O/100).tickSize(-M,0),B.select(".nv-x.nv-axis").attr("transform","translate(0,"+E.range()[0]+")"),B.select(".nv-x.nv-axis").call(n);var I=B.select(".nv-x.nv-axis > g").selectAll("g");I.selectAll("line, text").style("opacity",1);if(m){var q=function(e,t){return"translate("+e+","+t+")"},R=5,U=17;I.selectAll("text").attr("transform",function(e,t,n){return q(0,n%2==0?R:U)});var z=d3.selectAll(".nv-x.nv-axis .nv-wrap g g text")[0].length;B.selectAll(".nv-x.nv-axis .nv-axisMaxMin text").attr("transform",function(e,t){return q(0,t===0||z%2!==0?U:R)})}v&&I.filter(function(t,n){return n%Math.ceil(e[0].values.length/(O/100))!==0}).selectAll("text, line").style("opacity",0),g&&I.selectAll(".tick text").attr("transform","rotate("+g+" 0,0)").style("text-anchor",g>0?"start":"end"),B.select(".nv-x.nv-axis").selectAll("g.nv-axisMaxMin text").style("opacity",1)}p&&(r.scale(E).ticks(M/36).tickSize(-O,0),B.select(".nv-y.nv-axis").call(r)),i.dispatch.on("stateChange",function(e){S=e,N.stateChange(S),A.update()}),s.dispatch.on("legendClick",function(e,n){if(!e.disabled)return;j=j.map(function(e){return e.disabled=!0,e}),e.disabled=!1;switch(e.key){case"Grouped":t.stacked(!1);break;case"Stacked":t.stacked(!0)}S.stacked=t.stacked(),N.stateChange(S),A.update()}),N.on("tooltipShow",function(e){y&&L(e,k.parentNode)}),N.on("changeState",function(n){typeof n.disabled!="undefined"&&(e.forEach(function(e,t){e.disabled=n.disabled[t]}),S.disabled=n.disabled),typeof n.stacked!="undefined"&&(t.stacked(n.stacked),S.stacked=n.stacked),A.update()})}),A}var t=e.models.multiBar(),n=e.models.axis(),r=e.models.axis(),i=e.models.legend(),s=e.models.legend(),o={top:30,right:20,bottom:50,left:60},u=null,a=null,f=e.utils.defaultColor(),l=!0,c=!0,h=!0,p=!0,d=!1,v=!0,m=!1,g=0,y=!0,b=function(e,t,n,r,i){return"<h3>"+e+"</h3>"+"<p>"+n+" on "+t+"</p>"},w,E,S={stacked:!1},x=null,T="No Data Available.",N=d3.dispatch("tooltipShow","tooltipHide","stateChange","changeState"),C=function(){return l?180:0},k=0;t.stacked(!1),n.orient("bottom").tickPadding(7).highlightZero(!0).showMaxMin(!1).tickFormat(function(e){return e}),r.orient(d?"right":"left").tickFormat(d3.format(",.1f")),s.updateState(!1);var L=function(i,s){var o=i.pos[0]+(s.offsetLeft||0),u=i.pos[1]+(s.offsetTop||0),a=n.tickFormat()(t.x()(i.point,i.pointIndex)),f=r.tickFormat()(t.y()(i.point,i.pointIndex)),l=b(i.series.key,a,f,i,A);e.tooltip.show([o,u],l,i.value<0?"n":"s",null,s)};return t.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+o.left,e.pos[1]+o.top],N.tooltipShow(e)}),t.dispatch.on("elementMouseout.tooltip",function(e){N.tooltipHide(e)}),N.on("tooltipHide",function(){y&&e.tooltip.cleanup()}),A.dispatch=N,A.multibar=t,A.legend=i,A.xAxis=n,A.yAxis=r,d3.rebind(A,t,"x","y","xDomain","yDomain","xRange","yRange","forceX","forceY","clipEdge","id","stacked","stackOffset","delay","barColor","groupSpacing"),A.options=e.utils.optionsFunc.bind(A),A.margin=function(e){return arguments.length?(o.top=typeof e.top!="undefined"?e.top:o.top,o.right=typeof e.right!="undefined"?e.right:o.right,o.bottom=typeof e.bottom!="undefined"?e.bottom:o.bottom,o.left=typeof e.left!="undefined"?e.left:o.left,A):o},A.width=function(e){return arguments.length?(u=e,A):u},A.height=function(e){return arguments.length?(a=e,A):a},A.color=function(t){return arguments.length?(f=e.utils.getColor(t),i.color(f),A):f},A.showControls=function(e){return arguments.length?(l=e,A):l},A.showLegend=function(e){return arguments.length?(c=e,A):c},A.showXAxis=function(e){return arguments.length?(h=e,A):h},A.showYAxis=function(e){return arguments.length?(p=e,A):p},A.rightAlignYAxis=function(e){return arguments.length?(d=e,r.orient(e?"right":"left"),A):d},A.reduceXTicks=function(e){return arguments.length?(v=e,A):v},A.rotateLabels=function(e){return arguments.length?(g=e,A):g},A.staggerLabels=function(e){return arguments.length?(m=e,A):m},A.tooltip=function(e){return arguments.length?(b=e,A):b},A.tooltips=function(e){return arguments.length?(y=e,A):y},A.tooltipContent=function(e){return arguments.length?(b=e,A):b},A.state=function(e){return arguments.length?(S=e,A):S},A.defaultState=function(e){return arguments.length?(x=e,A):x},A.noData=function(e){return arguments.length?(T=e,A):T},A.transitionDuration=function(e){return arguments.length?(k=e,A):k},A},e.models.multiBarHorizontal=function(){function C(e){return e.each(function(e){var i=n-t.left-t.right,y=r-t.top-t.bottom,C=d3.select(this);p&&(e=d3.layout.stack().offset("zero").values(function(e){return e.values}).y(a)(e)),e.forEach(function(e,t){e.values.forEach(function(e){e.series=t})}),p&&e[0].values.map(function(t,n){var r=0,i=0;e.map(function(e){var t=e.values[n];t.size=Math.abs(t.y),t.y<0?(t.y1=i-t.size,i-=t.size):(t.y1=r,r+=t.size)})});var k=b&&w?[]:e.map(function(e){return e.values.map(function(e,t){return{x:u(e,t),y:a(e,t),y0:e.y0,y1:e.y1}})});s.domain(b||d3.merge(k).map(function(e){return e.x})).rangeBands(E||[0,y],.1),o.domain(w||d3.extent(d3.merge(k).map(function(e){return p?e.y>0?e.y1+e.y:e.y1:e.y}).concat(f))),d&&!p?o.range(S||[o.domain()[0]<0?m:0,i-(o.domain()[1]>0?m:0)]):o.range(S||[0,i]),T=T||s,N=N||d3.scale.linear().domain(o.domain()).range([o(0),o(0)]);var L=d3.select(this).selectAll("g.nv-wrap.nv-multibarHorizontal").data([e]),A=L.enter().append("g").attr("class","nvd3 nv-wrap nv-multibarHorizontal"),O=A.append("defs"),M=A.append("g"),_=L.select("g");M.append("g").attr("class","nv-groups"),L.attr("transform","translate("+t.left+","+t.top+")");var D=L.select(".nv-groups").selectAll(".nv-group").data(function(e){return e},function(e,t){return t});D.enter().append("g").style("stroke-opacity",1e-6).style("fill-opacity",1e-6),D.exit().style("stroke-opacity",1e-6).style("fill-opacity",1e-6).remove(),D.attr("class",function(e,t){return"nv-group nv-series-"+t}).classed("hover",function(e){return e.hover}).style("fill",function(e,t){return l(e,t)}).style("stroke",function(e,t){return l(e,t)}),D.style("stroke-opacity",1).style("fill-opacity",.75);var P=D.selectAll("g.nv-bar").data(function(e){return e.values});P.exit().remove();var H=P.enter().append("g").attr("transform",function(t,n,r){return"translate("+N(p?t.y0:0)+","+(p?0:r*s.rangeBand()/e.length+s(u(t,n)))+")"});H.append("rect").attr("width",0).attr("height",s.rangeBand()/(p?1:e.length)),P.on("mouseover",function(t,n){d3.select(this).classed("hover",!0),x.elementMouseover({value:a(t,n),point:t,series:e[t.series],pos:[o(a(t,n)+(p?t.y0:0)),s(u(t,n))+s.rangeBand()*(p?e.length/2:t.series+.5)/e.length],pointIndex:n,seriesIndex:t.series,e:d3.event})}).on("mouseout",function(t,n){d3.select(this).classed("hover",!1),x.elementMouseout({value:a(t,n),point:t,series:e[t.series],pointIndex:n,seriesIndex:t.series,e:d3.event})}).on("click",function(t,n){x.elementClick({value:a(t,n),point:t,series:e[t.series],pos:[s(u(t,n))+s.rangeBand()*(p?e.length/2:t.series+.5)/e.length,o(a(t,n)+(p?t.y0:0))],pointIndex:n,seriesIndex:t.series,e:d3.event}),d3.event.stopPropagation()}).on("dblclick",function(t,n){x.elementDblClick({value:a(t,n),point:t,series:e[t.series],pos:[s(u(t,n))+s.rangeBand()*(p?e.length/2:t.series+.5)/e.length,o(a(t,n)+(p?t.y0:0))],pointIndex:n,seriesIndex:t.series,e:d3.event}),d3.event.stopPropagation()}),H.append("text"),d&&!p?(P.select("text").attr("text-anchor",function(e,t){return a(e,t)<0?"end":"start"}).attr("y",s.rangeBand()/(e.length*2)).attr("dy",".32em").text(function(e,t){return g(a(e,t))}),P.select("text").attr("x",function(e,t){return a(e,t)<0?-4:o(a(e,t))-o(0)+4})):P.selectAll("text").text(""),v&&!p?(H.append("text").classed("nv-bar-label",!0),P.select("text.nv-bar-label").attr("text-anchor",function(e,t){return a(e,t)<0?"start":"end"}).attr("y",s.rangeBand()/(e.length*2)).attr("dy",".32em").text(function(e,t){return u(e,t)}),P.select("text.nv-bar-label").attr("x",function(e,t){return a(e,t)<0?o(0)-o(a(e,t))+4:-4})):P.selectAll("text.nv-bar-label").text(""),P.attr("class",function(e,t){return a(e,t)<0?"nv-bar negative":"nv-bar positive"}),c&&(h||(h=e.map(function(){return!0})),P.style("fill",function(e,t,n){return d3.rgb(c(e,t)).darker(h.map(function(e,t){return t}).filter(function(e,t){return!h[t]})[n]).toString()}).style("stroke",function(e,t,n){return d3.rgb(c(e,t)).darker(h.map(function(e,t){return t}).filter(function(e,t){return!h[t]})[n]).toString()})),p?P.attr("transform",function(e,t){return"translate("+o(e.y1)+","+s(u(e,t))+")"}).select("rect").attr("width",function(e,t){return Math.abs(o(a(e,t)+e.y0)-o(e.y0))}).attr("height",s.rangeBand()):P.attr("transform",function(t,n){return"translate("+(a(t,n)<0?o(a(t,n)):o(0))+","+(t.series*s.rangeBand()/e.length+s(u(t,n)))+")"}).select("rect").attr("height",s.rangeBand()/e.length).attr("width",function(e,t){return Math.max(Math.abs(o(a(e,t))-o(0)),1)}),T=s.copy(),N=o.copy()}),C}var t={top:0,right:0,bottom:0,left:0},n=960,r=500,i=Math.floor(Math.random()*1e4),s=d3.scale.ordinal(),o=d3.scale.linear(),u=function(e){return e.x},a=function(e){return e.y},f=[0],l=e.utils.defaultColor(),c=null,h,p=!1,d=!1,v=!1,m=60,g=d3.format(",.2f"),y=1200,b,w,E,S,x=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout"),T,N;return C.dispatch=x,C.options=e.utils.optionsFunc.bind(C),C.x=function(e){return arguments.length?(u=e,C):u},C.y=function(e){return arguments.length?(a=e,C):a},C.margin=function(e){return arguments.length?(t.top=typeof e.top!="undefined"?e.top:t.top,t.right=typeof e.right!="undefined"?e.right:t.right,t.bottom=typeof e.bottom!="undefined"?e.bottom:t.bottom,t.left=typeof e.left!="undefined"?e.left:t.left,C):t},C.width=function(e){return arguments.length?(n=e,C):n},C.height=function(e){return arguments.length?(r=e,C):r},C.xScale=function(e){return arguments.length?(s=e,C):s},C.yScale=function(e){return arguments.length?(o=e,C):o},C.xDomain=function(e){return arguments.length?(b=e,C):b},C.yDomain=function(e){return arguments.length?(w=e,C):w},C.xRange=function(e){return arguments.length?(E=e,C):E},C.yRange=function(e){return arguments.length?(S=e,C):S},C.forceY=function(e){return arguments.length?(f=e,C):f},C.stacked=function(e){return arguments.length?(p=e,C):p},C.color=function(t){return arguments.length?(l=e.utils.getColor(t),C):l},C.barColor=function(t){return arguments.length?(c=e.utils.getColor(t),C):c},C.disabled=function(e){return arguments.length?(h=e,C):h},C.id=function(e){return arguments.length?(i=e,C):i},C.delay=function(e){return arguments.length?(y=e,C):y},C.showValues=function(e){return arguments.length?(d=e,C):d},C.showBarLabels=function(e){return arguments.length?(v=e,C):v},C.valueFormat=function(e){return arguments.length?(g=e,C):g},C.valuePadding=function(e){return arguments.length?(m=e,C):m},C},e.models.multiBarHorizontalChart=function(){function C(e){return e.each(function(e){var d=d3.select(this),m=this,T=(u||parseInt(d.style("width"))||960)-o.left-o.right,k=(a||parseInt(d.style("height"))||400)-o.top-o.bottom;C.update=function(){d.call(C)},C.container=this,b.disabled=e.map(function(e){return!!e.disabled});if(!w){var L;w={};for(L in b)b[L]instanceof Array?w[L]=b[L].slice(0):w[L]=b[L]}if(!e||!e.length||!e.filter(function(e){return e.values.length}).length){var A=d.selectAll(".nv-noData").data([E]);return A.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),A.attr("x",o.left+T/2).attr("y",o.top+k/2).text(function(e){return e}),C}d.selectAll(".nv-noData").remove(),g=t.xScale(),y=t.yScale();var O=d.selectAll("g.nv-wrap.nv-multiBarHorizontalChart").data([e]),M=O.enter().append("g").attr("class","nvd3 nv-wrap nv-multiBarHorizontalChart").append("g"),_=O.select("g");M.append("g").attr("class","nv-x nv-axis"),M.append("g").attr("class","nv-y nv-axis").append("g").attr("class","nv-zeroLine").append("line"),M.append("g").attr("class","nv-barsWrap"),M.append("g").attr("class","nv-legendWrap"),M.append("g").attr("class","nv-controlsWrap"),c&&(i.width(T-x()),t.barColor()&&e.forEach(function(e,t){e.color=d3.rgb("#ccc").darker(t*1.5).toString()}),_.select(".nv-legendWrap").datum(e).call(i),o.top!=i.height()&&(o.top=i.height(),k=(a||parseInt(d.style("height"))||400)-o.top-o.bottom),_.select(".nv-legendWrap").attr("transform","translate("+x()+","+ -o.top+")"));if(l){var D=[{key:"Grouped",disabled:t.stacked()},{key:"Stacked",disabled:!t.stacked()}];s.width(x()).color(["#444","#444","#444"]),_.select(".nv-controlsWrap").datum(D).attr("transform","translate(0,"+ -o.top+")").call(s)}O.attr("transform","translate("+o.left+","+o.top+")"),t.disabled(e.map(function(e){return e.disabled})).width(T).height(k).color(e.map(function(e,t){return e.color||f(e,t)}).filter(function(t,n){return!e[n].disabled}));var P=_.select(".nv-barsWrap").datum(e.filter(function(e){return!e.disabled}));P.call(t);if(h){n.scale(g).ticks(k/24).tickSize(-T,0),_.select(".nv-x.nv-axis").call(n);var H=_.select(".nv-x.nv-axis").selectAll("g");H.selectAll("line, text")}p&&(r.scale(y).ticks(T/100).tickSize(-k,0),_.select(".nv-y.nv-axis").attr("transform","translate(0,"+k+")"),_.select(".nv-y.nv-axis").call(r)),_.select(".nv-zeroLine line").attr("x1",y(0)).attr("x2",y(0)).attr("y1",0).attr("y2",-k),i.dispatch.on("stateChange",function(e){b=e,S.stateChange(b),C.update()}),s.dispatch.on("legendClick",function(e,n){if(!e.disabled)return;D=D.map(function(e){return e.disabled=!0,e}),e.disabled=!1;switch(e.key){case"Grouped":t.stacked(!1);break;case"Stacked":t.stacked(!0)}b.stacked=t.stacked(),S.stateChange(b),C.update()}),S.on("tooltipShow",function(e){v&&N(e,m.parentNode)}),S.on("changeState",function(n){typeof n.disabled!="undefined"&&(e.forEach(function(e,t){e.disabled=n.disabled[t]}),b.disabled=n.disabled),typeof n.stacked!="undefined"&&(t.stacked(n.stacked),b.stacked=n.stacked),C.update()})}),C}var t=e.models.multiBarHorizontal(),n=e.models.axis(),r=e.models.axis(),i=e.models.legend().height(30),s=e.models.legend().height(30),o={top:30,right:20,bottom:50,left:60},u=null,a=null,f=e.utils.defaultColor(),l=!0,c=!0,h=!0,p=!0,d=!1,v=!0,m=function(e,t,n,r,i){return"<h3>"+e+" - "+t+"</h3>"+"<p>"+n+"</p>"},g,y,b={stacked:d},w=null,E="No Data Available.",S=d3.dispatch("tooltipShow","tooltipHide","stateChange","changeState"),x=function(){return l?180:0},T=0;t.stacked(d),n.orient("left").tickPadding(5).highlightZero(!1).showMaxMin(!1).tickFormat(function(e){return e}),r.orient("bottom").tickFormat(d3.format(",.1f")),s.updateState(!1);var N=function(i,s){var o=i.pos[0]+(s.offsetLeft||0),u=i.pos[1]+(s.offsetTop||0),a=n.tickFormat()(t.x()(i.point,i.pointIndex)),f=r.tickFormat()(t.y()(i.point,i.pointIndex)),l=m(i.series.key,a,f,i,C);e.tooltip.show([o,u],l,i.value<0?"e":"w",null,s)};return t.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+o.left,e.pos[1]+o.top],S.tooltipShow(e)}),t.dispatch.on("elementMouseout.tooltip",function(e){S.tooltipHide(e)}),S.on("tooltipHide",function(){v&&e.tooltip.cleanup()}),C.dispatch=S,C.multibar=t,C.legend=i,C.xAxis=n,C.yAxis=r,d3.rebind(C,t,"x","y","xDomain","yDomain","xRange","yRange","forceX","forceY","clipEdge","id","delay","showValues","showBarLabels","valueFormat","stacked","barColor"),C.options=e.utils.optionsFunc.bind(C),C.margin=function(e){return arguments.length?(o.top=typeof e.top!="undefined"?e.top:o.top,o.right=typeof e.right!="undefined"?e.right:o.right,o.bottom=typeof e.bottom!="undefined"?e.bottom:o.bottom,o.left=typeof e.left!="undefined"?e.left:o.left,C):o},C.width=function(e){return arguments.length?(u=e,C):u},C.height=function(e){return arguments.length?(a=e,C):a},C.color=function(t){return arguments.length?(f=e.utils.getColor(t),i.color(f),C):f},C.showControls=function(e){return arguments.length?(l=e,C):l},C.showLegend=function(e){return arguments.length?(c=e,C):c},C.showXAxis=function(e){return arguments.length?(h=e,C):h},C.showYAxis=function(e){return arguments.length?(p=e,C):p},C.tooltip=function(e){return arguments.length?(m=e,C):m},C.tooltips=function(e){return arguments.length?(v=e,C):v},C.tooltipContent=function(e){return arguments.length?(m=e,C):m},C.state=function(e){return arguments.length?(b=e,C):b},C.defaultState=function(e){return arguments.length?(w=e,C):w},C.noData=function(e){return arguments.length?(E=e,C):E},C.transitionDuration=function(e){return arguments.length?(T=e,C):T},C},e.models.multiChart=function(){function C(e){return e.each(function(e){var u=d3.select(this),f=this;C.update=function(){u.call(C)},C.container=this;var k=(r||parseInt(u.style("width"))||960)-t.left-t.right,L=(i||parseInt(u.style("height"))||400)-t.top-t.bottom,A=e.filter(function(e){return!e.disabled&&e.type=="line"&&e.yAxis==1}),O=e.filter(function(e){return!e.disabled&&e.type=="line"&&e.yAxis==2}),M=e.filter(function(e){return!e.disabled&&e.type=="bar"&&e.yAxis==1}),_=e.filter(function(e){return!e.disabled&&e.type=="bar"&&e.yAxis==2}),D=e.filter(function(e){return!e.disabled&&e.type=="area"&&e.yAxis==1}),P=e.filter(function(e){return!e.disabled&&e.type=="area"&&e.yAxis==2}),H=e.filter(function(e){return!e.disabled&&e.yAxis==1}).map(function(e){return e.values.map(function(e,t){return{x:e.x,y:e.y}})}),B=e.filter(function(e){return!e.disabled&&e.yAxis==2}).map(function(e){return e.values.map(function(e,t){return{x:e.x,y:e.y}})});a.domain(d3.extent(d3.merge(H.concat(B)),function(e){return e.x})).range([0,k]);var j=u.selectAll("g.wrap.multiChart").data([e]),F=j.enter().append("g").attr("class","wrap nvd3 multiChart").append("g");F.append("g").attr("class","x axis"),F.append("g").attr("class","y1 axis"),F.append("g").attr("class","y2 axis"),F.append("g").attr("class","lines1Wrap"),F.append("g").attr("class","lines2Wrap"),F.append("g").attr("class","bars1Wrap"),F.append("g").attr("class","bars2Wrap"),F.append("g").attr("class","stack1Wrap"),F.append("g").attr("class","stack2Wrap"),F.append("g").attr("class","legendWrap");var I=j.select("g");s&&(x.width(k/2),I.select(".legendWrap").datum(e.map(function(e){return e.originalKey=e.originalKey===undefined?e.key:e.originalKey,e.key=e.originalKey+(e.yAxis==1?"":" (right axis)"),e})).call(x),t.top!=x.height()&&(t.top=x.height(),L=(i||parseInt(u.style("height"))||400)-t.top-t.bottom),I.select(".legendWrap").attr("transform","translate("+k/2+","+ -t.top+")")),d.width(k).height(L).interpolate("monotone").color(e.map(function(e,t){return e.color||n[t%n.length]}).filter(function(t,n){return!e[n].disabled&&e[n].yAxis==1&&e[n].type=="line"})),v.width(k).height(L).interpolate("monotone").color(e.map(function(e,t){return e.color||n[t%n.length]}).filter(function(t,n){return!e[n].disabled&&e[n].yAxis==2&&e[n].type=="line"})),m.width(k).height(L).color(e.map(function(e,t){return e.color||n[t%n.length]}).filter(function(t,n){return!e[n].disabled&&e[n].yAxis==1&&e[n].type=="bar"})),g.width(k).height(L).color(e.map(function(e,t){return e.color||n[t%n.length]}).filter(function(t,n){return!e[n].disabled&&e[n].yAxis==2&&e[n].type=="bar"})),y.width(k).height(L).color(e.map(function(e,t){return e.color||n[t%n.length]}).filter(function(t,n){return!e[n].disabled&&e[n].yAxis==1&&e[n].type=="area"})),b.width(k).height(L).color(e.map(function(e,t){return e.color||n[t%n.length]}).filter(function(t,n){return!e[n].disabled&&e[n].yAxis==2&&e[n].type=="area"})),I.attr("transform","translate("+t.left+","+t.top+")");var q=I.select(".lines1Wrap").datum(A),R=I.select(".bars1Wrap").datum(M),U=I.select(".stack1Wrap").datum(D),z=I.select(".lines2Wrap").datum(O),W=I.select(".bars2Wrap").datum(_),X=I.select(".stack2Wrap").datum(P),V=D.length?D.map(function(e){return e.values}).reduce(function(e,t){return e.map(function(e,n){return{x:e.x,y:e.y+t[n].y}})}).concat([{x:0,y:0}]):[],$=P.length?P.map(function(e){return e.values}).reduce(function(e,t){return e.map(function(e,n){return{x:e.x,y:e.y+t[n].y}})}).concat([{x:0,y:0}]):[];h.domain(l||d3.extent(d3.merge(H).concat(V),function(e){return e.y})).range([0,L]),p.domain(c||d3.extent(d3.merge(B).concat($),function(e){return e.y})).range([0,L]),d.yDomain(h.domain()),m.yDomain(h.domain()),y.yDomain(h.domain()),v.yDomain(p.domain()),g.yDomain(p.domain()),b.yDomain(p.domain()),D.length&&d3.transition(U).call(y),P.length&&d3.transition(X).call(b),M.length&&d3.transition(R).call(m),_.length&&d3.transition(W).call(g),A.length&&d3.transition(q).call(d),O.length&&d3.transition(z).call(v),w.ticks(k/100).tickSize(-L,0),I.select(".x.axis").attr("transform","translate(0,"+L+")"),d3.transition(I.select(".x.axis")).call(w),E.ticks(L/36).tickSize(-k,0),d3.transition(I.select(".y1.axis")).call(E),S.ticks(L/36).tickSize(-k,0),d3.transition(I.select(".y2.axis")).call(S),I.select(".y2.axis").style("opacity",B.length?1:0).attr("transform","translate("+a.range()[1]+",0)"),x.dispatch.on("stateChange",function(e){C.update()}),T.on("tooltipShow",function(e){o&&N(e,f.parentNode)})}),C}var t={top:30,right:20,bottom:50,left:60},n=d3.scale.category20().range(),r=null,i=null,s=!0,o=!0,u=function(e,t,n,r,i){return"<h3>"+e+"</h3>"+"<p>"+n+" at "+t+"</p>"},a,f,l,c,a=d3.scale.linear(),h=d3.scale.linear(),p=d3.scale.linear(),d=e.models.line().yScale(h),v=e.models.line().yScale(p),m=e.models.multiBar().stacked(!1).yScale(h),g=e.models.multiBar().stacked(!1).yScale(p),y=e.models.stackedArea().yScale(h),b=e.models.stackedArea().yScale(p),w=e.models.axis().scale(a).orient("bottom").tickPadding(5),E=e.models.axis().scale(h).orient("left"),S=e.models.axis().scale(p).orient("right"),x=e.models.legend().height(30),T=d3.dispatch("tooltipShow","tooltipHide"),N=function(t,n){var r=t.pos[0]+(n.offsetLeft||0),i=t.pos[1]+(n.offsetTop||0),s=w.tickFormat()(d.x()(t.point,t.pointIndex)),o=(t.series.yAxis==2?S:E).tickFormat()(d.y()(t.point,t.pointIndex)),a=u(t.series.key,s,o,t,C);e.tooltip.show([r,i],a,undefined,undefined,n.offsetParent)};return d.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+t.left,e.pos[1]+t.top],T.tooltipShow(e)}),d.dispatch.on("elementMouseout.tooltip",function(e){T.tooltipHide(e)}),v.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+t.left,e.pos[1]+t.top],T.tooltipShow(e)}),v.dispatch.on("elementMouseout.tooltip",function(e){T.tooltipHide(e)}),m.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+t.left,e.pos[1]+t.top],T.tooltipShow(e)}),m.dispatch.on("elementMouseout.tooltip",function(e){T.tooltipHide(e)}),g.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+t.left,e.pos[1]+t.top],T.tooltipShow(e)}),g.dispatch.on("elementMouseout.tooltip",function(e){T.tooltipHide(e)}),y.dispatch.on("tooltipShow",function(e){if(!Math.round(y.y()(e.point)*100))return setTimeout(function(){d3.selectAll(".point.hover").classed("hover",!1)},0),!1;e.pos=[e.pos[0]+t.left,e.pos[1]+t.top],T.tooltipShow(e)}),y.dispatch.on("tooltipHide",function(e){T.tooltipHide(e)}),b.dispatch.on("tooltipShow",function(e){if(!Math.round(b.y()(e.point)*100))return setTimeout(function(){d3.selectAll(".point.hover").classed("hover",!1)},0),!1;e.pos=[e.pos[0]+t.left,e.pos[1]+t.top],T.tooltipShow(e)}),b.dispatch.on("tooltipHide",function(e){T.tooltipHide(e)}),d.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+t.left,e.pos[1]+t.top],T.tooltipShow(e)}),d.dispatch.on("elementMouseout.tooltip",function(e){T.tooltipHide(e)}),v.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+t.left,e.pos[1]+t.top],T.tooltipShow(e)}),v.dispatch.on("elementMouseout.tooltip",function(e){T.tooltipHide(e)}),T.on("tooltipHide",function(){o&&e.tooltip.cleanup()}),C.dispatch=T,C.lines1=d,C.lines2=v,C.bars1=m,C.bars2=g,C.stack1=y,C.stack2=b,C.xAxis=w,C.yAxis1=E,C.yAxis2=S,C.options=e.utils.optionsFunc.bind(C),C.x=function(e){return arguments.length?(getX=e,d.x(e),m.x(e),C):getX},C.y=function(e){return arguments.length?(getY=e,d.y(e),m.y(e),C):getY},C.yDomain1=function(e){return arguments.length?(l=e,C):l},C.yDomain2=function(e){return arguments.length?(c=e,C):c},C.margin=function(e){return arguments.length?(t=e,C):t},C.width=function(e){return arguments.length?(r=e,C):r},C.height=function(e){return arguments.length?(i=e,C):i},C.color=function(e){return arguments.length?(n=e,x.color(e),C):n},C.showLegend=function(e){return arguments.length?(s=e,C):s},C.tooltips=function(e){return arguments.length?(o=e,C):o},C.tooltipContent=function(e){return arguments.length?(u=e,C):u},C},e.models.ohlcBar=function(){function x(e){return e.each(function(e){var g=n-t.left-t.right,x=r-t.top-t.bottom,T=d3.select(this);s.domain(y||d3.extent(e[0].values.map(u).concat(p))),v?s.range(w||[g*.5/e[0].values.length,g*(e[0].values.length-.5)/e[0].values.length]):s.range(w||[0,g]),o.domain(b||[d3.min(e[0].values.map(h).concat(d)),d3.max(e[0].values.map(c).concat(d))]).range(E||[x,0]),s.domain()[0]===s.domain()[1]&&(s.domain()[0]?s.domain([s.domain()[0]-s.domain()[0]*.01,s.domain()[1]+s.domain()[1]*.01]):s.domain([-1,1])),o.domain()[0]===o.domain()[1]&&(o.domain()[0]?o.domain([o.domain()[0]+o.domain()[0]*.01,o.domain()[1]-o.domain()[1]*.01]):o.domain([-1,1]));var N=d3.select(this).selectAll("g.nv-wrap.nv-ohlcBar").data([e[0].values]),C=N.enter().append("g").attr("class","nvd3 nv-wrap nv-ohlcBar"),k=C.append("defs"),L=C.append("g"),A=N.select("g");L.append("g").attr("class","nv-ticks"),N.attr("transform","translate("+t.left+","+t.top+")"),T.on("click",function(e,t){S.chartClick({data:e,index:t,pos:d3.event,id:i})}),k.append("clipPath").attr("id","nv-chart-clip-path-"+i).append("rect"),N.select("#nv-chart-clip-path-"+i+" rect").attr("width",g).attr("height",x),A.attr("clip-path",m?"url(#nv-chart-clip-path-"+i+")":"");var O=N.select(".nv-ticks").selectAll(".nv-tick").data(function(e){return e});O.exit().remove();var M=O.enter().append("path").attr("class",function(e,t,n){return(f(e,t)>l(e,t)?"nv-tick negative":"nv-tick positive")+" nv-tick-"+n+"-"+t}).attr("d",function(t,n){var r=g/e[0].values.length*.9;return"m0,0l0,"+(o(f(t,n))-o(c(t,n)))+"l"+ -r/2+",0l"+r/2+",0l0,"+(o(h(t,n))-o(f(t,n)))+"l0,"+(o(l(t,n))-o(h(t,n)))+"l"+r/2+",0l"+ -r/2+",0z"}).attr("transform",function(e,t){return"translate("+s(u(e,t))+","+o(c(e,t))+")"}).on("mouseover",function(t,n){d3.select(this).classed("hover",!0),S.elementMouseover({point:t,series:e[0],pos:[s(u(t,n)),o(a(t,n))],pointIndex:n,seriesIndex:0,e:d3.event})}).on("mouseout",function(t,n){d3.select(this).classed("hover",!1),S.elementMouseout({point:t,series:e[0],pointIndex:n,seriesIndex:0,e:d3.event})}).on("click",function(e,t){S.elementClick({value:a(e,t),data:e,index:t,pos:[s(u(e,t)),o(a(e,t))],e:d3.event,id:i}),d3.event.stopPropagation()}).on("dblclick",function(e,t){S.elementDblClick({value:a(e,t),data:e,index:t,pos:[s(u(e,t)),o(a(e,t))],e:d3.event,id:i}),d3.event.stopPropagation()});O.attr("class",function(e,t,n){return(f(e,t)>l(e,t)?"nv-tick negative":"nv-tick positive")+" nv-tick-"+n+"-"+t}),d3.transition(O).attr("transform",function(e,t){return"translate("+s(u(e,t))+","+o(c(e,t))+")"}).attr("d",function(t,n){var r=g/e[0].values.length*.9;return"m0,0l0,"+(o(f(t,n))-o(c(t,n)))+"l"+ -r/2+",0l"+r/2+",0l0,"+(o(h(t,n))-o(f(t,n)))+"l0,"+(o(l(t,n))-o(h(t,n)))+"l"+r/2+",0l"+ -r/2+",0z"})}),x}var t={top:0,right:0,bottom:0,left:0},n=960,r=500,i=Math.floor(Math.random()*1e4),s=d3.scale.linear(),o=d3.scale.linear(),u=function(e){return e.x},a=function(e){return e.y},f=function(e){return e.open},l=function(e){return e.close},c=function(e){return e.high},h=function(e){return e.low},p=[],d=[],v=!1,m=!0,g=e.utils.defaultColor(),y,b,w,E,S=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout");return x.dispatch=S,x.options=e.utils.optionsFunc.bind(x),x.x=function(e){return arguments.length?(u=e,x):u},x.y=function(e){return arguments.length?(a=e,x):a},x.open=function(e){return arguments.length?(f=e,x):f},x.close=function(e){return arguments.length?(l=e,x):l},x.high=function(e){return arguments.length?(c=e,x):c},x.low=function(e){return arguments.length?(h=e,x):h},x.margin=function(e){return arguments.length?(t.top=typeof e.top!="undefined"?e.top:t.top,t.right=typeof e.right!="undefined"?e.right:t.right,t.bottom=typeof e.bottom!="undefined"?e.bottom:t.bottom,t.left=typeof e.left!="undefined"?e.left:t.left,x):t},x.width=function(e){return arguments.length?(n=e,x):n},x.height=function(e){return arguments.length?(r=e,x):r},x.xScale=function(e){return arguments.length?(s=e,x):s},x.yScale=function(e){return arguments.length?(o=e,x):o},x.xDomain=function(e){return arguments.length?(y=e,x):y},x.yDomain=function(e){return arguments.length?(b=e,x):b},x.xRange=function(e){return arguments.length?(w=e,x):w},x.yRange=function(e){return arguments.length?(E=e,x):E},x.forceX=function(e){return arguments.length?(p=e,x):p},x.forceY=function(e){return arguments.length?(d=e,x):d},x.padData=function(e){return arguments.length?(v=e,x):v},x.clipEdge=function(e){return arguments.length?(m=e,x):m},x.color=function(t){return arguments.length?(g=e.utils.getColor(t),x):g},x.id=function(e){return arguments.length?(i=e,x):i},x},e.models.pie=function(){function S(e){return e.each(function(e){function q(e){var t=(e.startAngle+e.endAngle)*90/Math.PI-90;return t>90?t-180:t}function R(e){e.endAngle=isNaN(e.endAngle)?0:e.endAngle,e.startAngle=isNaN(e.startAngle)?0:e.startAngle,m||(e.innerRadius=0);var t=d3.interpolate(this._current,e);return this._current=t(0),function(e){return A(t(e))}}function U(e){e.innerRadius=0;var t=d3.interpolate({startAngle:0,endAngle:0},e);return function(e){return A(t(e))}}var o=n-t.left-t.right,f=r-t.top-t.bottom,S=Math.min(o,f)/2,x=S-S/5,T=d3.select(this),N=T.selectAll(".nv-wrap.nv-pie").data(e),C=N.enter().append("g").attr("class","nvd3 nv-wrap nv-pie nv-chart-"+u),k=C.append("g"),L=N.select("g");k.append("g").attr("class","nv-pie"),k.append("g").attr("class","nv-pieLabels"),N.attr("transform","translate("+t.left+","+t.top+")"),L.select(".nv-pie").attr("transform","translate("+o/2+","+f/2+")"),L.select(".nv-pieLabels").attr("transform","translate("+o/2+","+f/2+")"),T.on("click",function(e,t){E.chartClick({data:e,index:t,pos:d3.event,id:u})});var A=d3.svg.arc().outerRadius(x);y&&A.startAngle(y),b&&A.endAngle(b),m&&A.innerRadius(S*w);var O=d3.layout.pie().sort(null).value(function(e){return e.disabled?0:s(e)}),M=N.select(".nv-pie").selectAll(".nv-slice").data(O),_=N.select(".nv-pieLabels").selectAll(".nv-label").data(O);M.exit().remove(),_.exit().remove();var D=M.enter().append("g").attr("class","nv-slice").on("mouseover",function(e,t){d3.select(this).classed("hover",!0),E.elementMouseover({label:i(e.data),value:s(e.data),point:e.data,pointIndex:t,pos:[d3.event.pageX,d3.event.pageY],id:u})}).on("mouseout",function(e,t){d3.select(this).classed("hover",!1),E.elementMouseout({label:i(e.data),value:s(e.data),point:e.data,index:t,id:u})}).on("click",function(e,t){E.elementClick({label:i(e.data),value:s(e.data),point:e.data,index:t,pos:d3.event,id:u}),d3.event.stopPropagation()}).on("dblclick",function(e,t){E.elementDblClick({label:i(e.data),value:s(e.data),point:e.data,index:t,pos:d3.event,id:u}),d3.event.stopPropagation()});M.attr("fill",function(e,t){return a(e,t)}).attr("stroke",function(e,t){return a(e,t)});var P=D.append("path").each(function(e){this._current=e});M.select("path").attr("d",A);if(l){var H=d3.svg.arc().innerRadius(0);c&&(H=A),h&&(H=d3.svg.arc().outerRadius(A.outerRadius())),_.enter().append("g").classed("nv-label",!0).each(function(e,t){var n=d3.select(this);n.attr("transform",function(e){if(g){e.outerRadius=x+10,e.innerRadius=x+15;var t=(e.startAngle+e.endAngle)/2*(180/Math.PI);return(e.startAngle+e.endAngle)/2<Math.PI?t-=90:t+=90,"translate("+H.centroid(e)+") rotate("+t+")"}return e.outerRadius=S+10,e.innerRadius=S+15,"translate("+H.centroid(e)+")"}),n.append("rect").style("stroke","#fff").style("fill","#fff").attr("rx",3).attr("ry",3),n.append("text").style("text-anchor",g?(e.startAngle+e.endAngle)/2<Math.PI?"start":"end":"middle").style("fill","#000")});var B={},j=14,F=140,I=function(e){return Math.floor(e[0]/F)*F+","+Math.floor(e[1]/j)*j};_.attr("transform",function(e){if(g){e.outerRadius=x+10,e.innerRadius=x+15;var t=(e.startAngle+e.endAngle)/2*(180/Math.PI);return(e.startAngle+e.endAngle)/2<Math.PI?t-=90:t+=90,"translate("+H.centroid(e)+") rotate("+t+")"}e.outerRadius=S+10,e.innerRadius=S+15;var n=H.centroid(e),r=I(n);return B[r]&&(n[1]-=j),B[I(n)]=!0,"translate("+n+")"}),_.select(".nv-label text").style("text-anchor",g?(d.startAngle+d.endAngle)/2<Math.PI?"start":"end":"middle").text(function(e,t){var n=(e.endAngle-e.startAngle)/(2*Math.PI),r={key:i(e.data),value:s(e.data),percent:d3.format("%")(n)};return e.value&&n>v?r[p]:""})}}),S}var t={top:0,right:0,bottom:0,left:0},n=500,r=500,i=function(e){return e.x},s=function(e){return e.y},o=function(e){return e.description},u=Math.floor(Math.random()*1e4),a=e.utils.defaultColor(),f=d3.format(",.2f"),l=!0,c=!0,h=!1,p="key",v=.02,m=!1,g=!1,y=!1,b=!1,w=.5,E=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout");return S.dispatch=E,S.options=e.utils.optionsFunc.bind(S),S.margin=function(e){return arguments.length?(t.top=typeof e.top!="undefined"?e.top:t.top,t.right=typeof e.right!="undefined"?e.right:t.right,t.bottom=typeof e.bottom!="undefined"?e.bottom:t.bottom,t.left=typeof e.left!="undefined"?e.left:t.left,S):t},S.width=function(e){return arguments.length?(n=e,S):n},S.height=function(e){return arguments.length?(r=e,S):r},S.values=function(t){return e.log("pie.values() is no longer supported."),S},S.x=function(e){return arguments.length?(i=e,S):i},S.y=function(e){return arguments.length?(s=d3.functor(e),S):s},S.description=function(e){return arguments.length?(o=e,S):o},S.showLabels=function(e){return arguments.length?(l=e,S):l},S.labelSunbeamLayout=function(e){return arguments.length?(g=e,S):g},S.donutLabelsOutside=function(e){return arguments.length?(h=e,S):h},S.pieLabelsOutside=function(e){return arguments.length?(c=e,S):c},S.labelType=function(e){return arguments.length?(p=e,p=p||"key",S):p},S.donut=function(e){return arguments.length?(m=e,S):m},S.donutRatio=function(e){return arguments.length?(w=e,S):w},S.startAngle=function(e){return arguments.length?(y=e,S):y},S.endAngle=function(e){return arguments.length?(b=e,S):b},S.id=function(e){return arguments.length?(u=e,S):u},S.color=function(t){return arguments.length?(a=e.utils.getColor(t),S):a},S.valueFormat=function(e){return arguments.length?(f=e,S):f},S.labelThreshold=function(e){return arguments.length?(v=e,S):v},S},e.models.pieChart=function(){function v(e){return e.each(function(e){var u=d3.select(this),a=this,f=(i||parseInt(u.style("width"))||960)-r.left-r.right,d=(s||parseInt(u.style("height"))||400)-r.top-r.bottom;v.update=function(){u.call(v)},v.container=this,l.disabled=e.map(function(e){return!!e.disabled});if(!c){var m;c={};for(m in l)l[m]instanceof Array?c[m]=l[m].slice(0):c[m]=l[m]}if(!e||!e.length){var g=u.selectAll(".nv-noData").data([h]);return g.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),g.attr("x",r.left+f/2).attr("y",r.top+d/2).text(function(e){return e}),v}u.selectAll(".nv-noData").remove();var y=u.selectAll("g.nv-wrap.nv-pieChart").data([e]),b=y.enter().append("g").attr("class","nvd3 nv-wrap nv-pieChart").append("g"),w=y.select("g");b.append("g").attr("class","nv-pieWrap"),b.append("g").attr("class","nv-legendWrap"),o&&(n.width(f).key(t.x()),y.select(".nv-legendWrap").datum(e).call(n),r.top!=n.height()&&(r.top=n.height(),d=(s||parseInt(u.style("height"))||400)-r.top-r.bottom),y.select(".nv-legendWrap").attr("transform","translate(0,"+ -r.top+")")),y.attr("transform","translate("+r.left+","+r.top+")"),t.width(f).height(d);var E=w.select(".nv-pieWrap").datum([e]);d3.transition(E).call(t),n.dispatch.on("stateChange",function(e){l=e,p.stateChange(l),v.update()}),t.dispatch.on("elementMouseout.tooltip",function(e){p.tooltipHide(e)}),p.on("changeState",function(t){typeof t.disabled!="undefined"&&(e.forEach(function(e,n){e.disabled=t.disabled[n]}),l.disabled=t.disabled),v.update()})}),v}var t=e.models.pie(),n=e.models.legend(),r={top:30,right:20,bottom:20,left:20},i=null,s=null,o=!0,u=e.utils.defaultColor(),a=!0,f=function(e,t,n,r){return"<h3>"+e+"</h3>"+"<p>"+t+"</p>"},l={},c=null,h="No Data Available.",p=d3.dispatch("tooltipShow","tooltipHide","stateChange","changeState"),d=function(n,r){var i=t.description()(n.point)||t.x()(n.point),s=n.pos[0]+(r&&r.offsetLeft||0),o=n.pos[1]+(r&&r.offsetTop||0),u=t.valueFormat()(t.y()(n.point)),a=f(i,u,n,v);e.tooltip.show([s,o],a,n.value<0?"n":"s",null,r)};return t.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+r.left,e.pos[1]+r.top],p.tooltipShow(e)}),p.on("tooltipShow",function(e){a&&d(e)}),p.on("tooltipHide",function(){a&&e.tooltip.cleanup()}),v.legend=n,v.dispatch=p,v.pie=t,d3.rebind(v,t,"valueFormat","values","x","y","description","id","showLabels","donutLabelsOutside","pieLabelsOutside","labelType","donut","donutRatio","labelThreshold"),v.options=e.utils.optionsFunc.bind(v),v.margin=function(e){return arguments.length?(r.top=typeof e.top!="undefined"?e.top:r.top,r.right=typeof e.right!="undefined"?e.right:r.right,r.bottom=typeof e.bottom!="undefined"?e.bottom:r.bottom,r.left=typeof e.left!="undefined"?e.left:r.left,v):r},v.width=function(e){return arguments.length?(i=e,v):i},v.height=function(e){return arguments.length?(s=e,v):s},v.color=function(r){return arguments.length?(u=e.utils.getColor(r),n.color(u),t.color(u),v):u},v.showLegend=function(e){return arguments.length?(o=e,v):o},v.tooltips=function(e){return arguments.length?(a=e,v):a},v.tooltipContent=function(e){return arguments.length?(f=e,v):f},v.state=function(e){return arguments.length?(l=e,v):l},v.defaultState=function(e){return arguments.length?(c=e,v):c},v.noData=function(e){return arguments.length?(h=e,v):h},v},e.models.scatter=function(){function I(q){return q.each(function(I){function Q(){if(!g)return!1;var e,i=d3.merge(I.map(function(e,t){return e.values.map(function(e,n){var r=f(e,n),i=l(e,n);return[o(r),u(i),t,n,e]}).filter(function(e,t){return b(e[4],t)})}));if(D===!0){if(x){var a=X.select("defs").selectAll(".nv-point-clips").data([s]).enter();a.append("clipPath").attr("class","nv-point-clips").attr("id","nv-points-clip-"+s);var c=X.select("#nv-points-clip-"+s).selectAll("circle").data(i);c.enter().append("circle").attr("r",T),c.exit().remove(),c.attr("cx",function(e){return e[0]}).attr("cy",function(e){return e[1]}),X.select(".nv-point-paths").attr("clip-path","url(#nv-points-clip-"+s+")")}i.length&&(i.push([o.range()[0]-20,u.range()[0]-20,null,null]),i.push([o.range()[1]+20,u.range()[1]+20,null,null]),i.push([o.range()[0]-20,u.range()[0]+20,null,null]),i.push([o.range()[1]+20,u.range()[1]-20,null,null]));var h=d3.geom.polygon([[-10,-10],[-10,r+10],[n+10,r+10],[n+10,-10]]),p=1e-6;i=i.sort(function(e,t){return e[0]-t[0]||e[1]-t[1]});for(var d=0;d<i.length-1;)Math.abs(i[d][0]-i[d+1][0])<p&&Math.abs(i[d][1]-i[d+1][1])<p?i.splice(d+1,1):d++;var v=d3.geom.voronoi(i).map(function(e,t){return{data:h.clip(e),series:i[t][2],point:i[t][3]}}),m=X.select(".nv-point-paths").selectAll("path").data(v);m.enter().append("path").attr("class",function(e,t){return"nv-path-"+t}),m.exit().remove(),m.attr("d",function(e){return!e||!e.data||e.data.length===0?"M 0 0":"M"+e.data.join("L")+"Z"});var y=function(e,n){if(F)return 0;var r=I[e.series];if(typeof r=="undefined")return;var i=r.values[e.point];n({point:i,series:r,pos:[o(f(i,e.point))+t.left,u(l(i,e.point))+t.top],seriesIndex:e.series,pointIndex:e.point})};m.on("click",function(e){y(e,_.elementClick)}).on("mouseover",function(e){y(e,_.elementMouseover)}).on("mouseout",function(e,t){y(e,_.elementMouseout)})}else X.select(".nv-groups").selectAll(".nv-group").selectAll(".nv-point").on("click",function(e,n){if(F||!I[e.series])return 0;var r=I[e.series],i=r.values[n];_.elementClick({point:i,series:r,pos:[o(f(i,n))+t.left,u(l(i,n))+t.top],seriesIndex:e.series,pointIndex:n})}).on("mouseover",function(e,n){if(F||!I[e.series])return 0;var r=I[e.series],i=r.values[n];_.elementMouseover({point:i,series:r,pos:[o(f(i,n))+t.left,u(l(i,n))+t.top],seriesIndex:e.series,pointIndex:n})}).on("mouseout",function(e,t){if(F||!I[e.series])return 0;var n=I[e.series],r=n.values[t];_.elementMouseout({point:r,series:n,seriesIndex:e.series,pointIndex:t})});F=!1}var q=n-t.left-t.right,R=r-t.top-t.bottom,U=d3.select(this);I.forEach(function(e,t){e.values.forEach(function(e){e.series=t})});var W=N&&C&&A?[]:d3.merge(I.map(function(e){return e.values.map(function(e,t){return{x:f(e,t),y:l(e,t),size:c(e,t)}})}));o.domain(N||d3.extent(W.map(function(e){return e.x}).concat(d))),w&&I[0]?o.range(k||[(q*E+q)/(2*I[0].values.length),q-q*(1+E)/(2*I[0].values.length)]):o.range(k||[0,q]),u.domain(C||d3.extent(W.map(function(e){return e.y}).concat(v))).range(L||[R,0]),a.domain(A||d3.extent(W.map(function(e){return e.size}).concat(m))).range(O||[16,256]);if(o.domain()[0]===o.domain()[1]||u.domain()[0]===u.domain()[1])M=!0;o.domain()[0]===o.domain()[1]&&(o.domain()[0]?o.domain([o.domain()[0]-o.domain()[0]*.01,o.domain()[1]+o.domain()[1]*.01]):o.domain([-1,1])),u.domain()[0]===u.domain()[1]&&(u.domain()[0]?u.domain([u.domain()[0]-u.domain()[0]*.01,u.domain()[1]+u.domain()[1]*.01]):u.domain([-1,1])),isNaN(o.domain()[0])&&o.domain([-1,1]),isNaN(u.domain()[0])&&u.domain([-1,1]),P=P||o,H=H||u,B=B||a;var X=U.selectAll("g.nv-wrap.nv-scatter").data([I]),V=X.enter().append("g").attr("class","nvd3 nv-wrap nv-scatter nv-chart-"+s+(M?" nv-single-point":"")),$=V.append("defs"),J=V.append("g"),K=X.select("g");J.append("g").attr("class","nv-groups"),J.append("g").attr("class","nv-point-paths"),X.attr("transform","translate("+t.left+","+t.top+")"),$.append("clipPath").attr("id","nv-edge-clip-"+s).append("rect"),X.select("#nv-edge-clip-"+s+" rect").attr("width",q).attr("height",R>0?R:0),K.attr("clip-path",S?"url(#nv-edge-clip-"+s+")":""),F=!0;var G=X.select(".nv-groups").selectAll(".nv-group").data(function(e){return e},function(e){return e.key});G.enter().append("g").style("stroke-opacity",1e-6).style("fill-opacity",1e-6),G.exit().remove(),G.attr("class",function(e,t){return"nv-group nv-series-"+t}).classed("hover",function(e){return e.hover}),G.style("fill",function(e,t){return i(e,t)}).style("stroke",function(e,t){return i(e,t)}).style("stroke-opacity",1).style("fill-opacity",.5);if(p){var Y=G.selectAll("circle.nv-point").data(function(e){return e.values},y);Y.enter().append("circle").style("fill",function(e,t){return e.color}).style("stroke",function(e,t){return e.color}).attr("cx",function(t,n){return e.utils.NaNtoZero(P(f(t,n)))}).attr("cy",function(t,n){return e.utils.NaNtoZero(H(l(t,n)))}).attr("r",function(e,t){return Math.sqrt(a(c(e,t))/Math.PI)}),Y.exit().remove(),G.exit().selectAll("path.nv-point").attr("cx",function(t,n){return e.utils.NaNtoZero(o(f(t,n)))}).attr("cy",function(t,n){return e.utils.NaNtoZero(u(l(t,n)))}).remove(),Y.each(function(e,t){d3.select(this).classed("nv-point",!0).classed("nv-point-"+t,!0).classed("hover",!1)}),Y.attr("cx",function(t,n){return e.utils.NaNtoZero(o(f(t,n)))}).attr("cy",function(t,n){return e.utils.NaNtoZero(u(l(t,n)))}).attr("r",function(e,t){return Math.sqrt(a(c(e,t))/Math.PI)})}else{var Y=G.selectAll("path.nv-point").data(function(e){return e.values});Y.enter().append("path").style("fill",function(e,t){return e.color}).style("stroke",function(e,t){return e.color}).attr("transform",function(e,t){return"translate("+P(f(e,t))+","+H(l(e,t))+")"}).attr("d",d3.svg.symbol().type(h).size(function(e,t){return a(c(e,t))})),Y.exit().remove(),G.exit().selectAll("path.nv-point").attr("transform",function(e,t){return"translate("+o(f(e,t))+","+u(l(e,t))+")"}).remove(),Y.each(function(e,t){d3.select(this).classed("nv-point",!0).classed("nv-point-"+t,!0).classed("hover",!1)}),Y.attr("transform",function(e,t){return"translate("+o(f(e,t))+","+u(l(e,t))+")"}).attr("d",d3.svg.symbol().type(h).size(function(e,t){return a(c(e,t))}))}clearTimeout(j),j=setTimeout(Q,300),P=o.copy(),H=u.copy(),B=a.copy()}),I}var t={top:0,right:0,bottom:0,left:0},n=960,r=500,i=e.utils.defaultColor(),s=Math.floor(Math.random()*1e5),o=d3.scale.linear(),u=d3.scale.linear(),a=d3.scale.linear(),f=function(e){return e.x},l=function(e){return e.y},c=function(e){return e.size||1},h=function(e){return e.shape||"circle"},p=!0,d=[],v=[],m=[],g=!0,y=null,b=function(e){return!e.notActive},w=!1,E=.1,S=!1,x=!0,T=function(){return 25},N=null,C=null,k=null,L=null,A=null,O=null,M=!1,_=d3.dispatch("elementClick","elementMouseover","elementMouseout"),D=!0,P,H,B,j,F=!1;return I.clearHighlights=function(){d3.selectAll(".nv-chart-"+s+" .nv-point.hover").classed("hover",!1)},I.highlightPoint=function(e,t,n){d3.select(".nv-chart-"+s+" .nv-series-"+e+" .nv-point-"+t).classed("hover",n)},_.on("elementMouseover.point",function(e){g&&I.highlightPoint(e.seriesIndex,e.pointIndex,!0)}),_.on("elementMouseout.point",function(e){g&&I.highlightPoint(e.seriesIndex,e.pointIndex,!1)}),I.dispatch=_,I.options=e.utils.optionsFunc.bind(I),I.x=function(e){return arguments.length?(f=d3.functor(e),I):f},I.y=function(e){return arguments.length?(l=d3.functor(e),I):l},I.size=function(e){return arguments.length?(c=d3.functor(e),I):c},I.margin=function(e){return arguments.length?(t.top=typeof e.top!="undefined"?e.top:t.top,t.right=typeof e.right!="undefined"?e.right:t.right,t.bottom=typeof e.bottom!="undefined"?e.bottom:t.bottom,t.left=typeof e.left!="undefined"?e.left:t.left,I):t},I.width=function(e){return arguments.length?(n=e,I):n},I.height=function(e){return arguments.length?(r=e,I):r},I.xScale=function(e){return arguments.length?(o=e,I):o},I.yScale=function(e){return arguments.length?(u=e,I):u},I.zScale=function(e){return arguments.length?(a=e,I):a},I.xDomain=function(e){return arguments.length?(N=e,I):N},I.yDomain=function(e){return arguments.length?(C=e,I):C},I.sizeDomain=function(e){return arguments.length?(A=e,I):A},I.xRange=function(e){return arguments.length?(k=e,I):k},I.yRange=function(e){return arguments.length?(L=e,I):L},I.sizeRange=function(e){return arguments.length?(O=e,I):O},I.forceX=function(e){return arguments.length?(d=e,I):d},I.forceY=function(e){return arguments.length?(v=e,I):v},I.forceSize=function(e){return arguments.length?(m=e,I):m},I.interactive=function(e){return arguments.length?(g=e,I):g},I.pointKey=function(e){return arguments.length?(y=e,I):y},I.pointActive=function(e){return arguments.length?(b=e,I):b},I.padData=function(e){return arguments.length?(w=e,I):w},I.padDataOuter=function(e){return arguments.length?(E=e,I):E},I.clipEdge=function(e){return arguments.length?(S=e,I):S},I.clipVoronoi=function(e){return arguments.length?(x=e,I):x},I.useVoronoi=function(e){return arguments.length?(D=e,D===!1&&(x=!1),I):D},I.clipRadius=function(e){return arguments.length?(T=e,I):T},I.color=function(t){return arguments.length?(i=e.utils.getColor(t),I):i},I.shape=function(e){return arguments.length?(h=e,I):h},I.onlyCircles=function(e){return arguments.length?(p=e,I):p},I.id=function(e){return arguments.length?(s=e,I):s},I.singlePoint=function(e){return arguments.length?(M=e,I):M},I},e.models.scatterChart=function(){function F(e){return e.each(function(e){function J(){if(T)return W.select(".nv-point-paths").style("pointer-events","all"),!1;W.select(".nv-point-paths").style("pointer-events","none");var i=d3.mouse(this);h.distortion(x).focus(i[0]),p.distortion(x).focus(i[1]),W.select(".nv-scatterWrap").call(t),b&&W.select(".nv-x.nv-axis").call(n),w&&W.select(".nv-y.nv-axis").call(r),W.select(".nv-distributionX").datum(e.filter(function(e){return!e.disabled})).call(o),W.select(".nv-distributionY").datum(e.filter(function(e){return!e.disabled})).call(u)}var C=d3.select(this),k=this,L=(f||parseInt(C.style("width"))||960)-a.left-a.right,D=(l||parseInt(C.style("height"))||400)-a.top-a.bottom;F.update=function(){C.call(F)},F.container=this,A.disabled=e.map(function(e){return!!e.disabled});if(!O){var I;O={};for(I in A)A[I]instanceof Array?O[I]=A[I].slice(0):O[I]=A[I]}if(!e||!e.length||!e.filter(function(e){return e.values.length}).length){var q=C.selectAll(".nv-noData").data([_]);return q.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),q.attr("x",a.left+L/2).attr("y",a.top+D/2).text(function(e){return e}),F}C.selectAll(".nv-noData").remove(),P=P||h,H=H||p;var R=C.selectAll("g.nv-wrap.nv-scatterChart").data([e]),U=R.enter().append("g").attr("class","nvd3 nv-wrap nv-scatterChart nv-chart-"+t.id()),z=U.append("g"),W=R.select("g");z.append("rect").attr("class","nvd3 nv-background"),z.append("g").attr("class","nv-x nv-axis"),z.append("g").attr("class","nv-y nv-axis"),z.append("g").attr("class","nv-scatterWrap"),z.append("g").attr("class","nv-distWrap"),z.append("g").attr("class","nv-legendWrap"),z.append("g").attr("class","nv-controlsWrap");if(y){var X=S?L/2:L;i.width(X),R.select(".nv-legendWrap").datum(e).call(i),a.top!=i.height()&&(a.top=i.height(),D=(l||parseInt(C.style("height"))||400)-a.top-a.bottom),R.select(".nv-legendWrap").attr("transform","translate("+(L-X)+","+ -a.top+")")}S&&(s.width(180).color(["#444"]),W.select(".nv-controlsWrap").datum(j).attr("transform","translate(0,"+ -a.top+")").call(s)),R.attr("transform","translate("+a.left+","+a.top+")"),E&&W.select(".nv-y.nv-axis").attr("transform","translate("+L+",0)"),t.width(L).height(D).color(e.map(function(e,t){return e.color||c(e,t)}).filter(function(t,n){return!e[n].disabled})),d!==0&&t.xDomain(null),v!==0&&t.yDomain(null),R.select(".nv-scatterWrap").datum(e.filter(function(e){return!e.disabled})).call(t);if(d!==0){var V=h.domain()[1]-h.domain()[0];t.xDomain([h.domain()[0]-d*V,h.domain()[1]+d*V])}if(v!==0){var $=p.domain()[1]-p.domain()[0];t.yDomain([p.domain()[0]-v*$,p.domain()[1]+v*$])}(v!==0||d!==0)&&R.select(".nv-scatterWrap").datum(e.filter(function(e){return!e.disabled})).call(t),b&&(n.scale(h).ticks(n.ticks()&&n.ticks().length?n.ticks():L/100).tickSize(-D,0),W.select(".nv-x.nv-axis").attr("transform","translate(0,"+p.range()[0]+")").call(n)),w&&(r.scale(p).ticks(r.ticks()&&r.ticks().length?r.ticks():D/36).tickSize(-L,0),W.select(".nv-y.nv-axis").call(r)),m&&(o.getData(t.x()).scale(h).width(L).color(e.map(function(e,t){return e.color||c(e,t)}).filter(function(t,n){return!e[n].disabled})),z.select(".nv-distWrap").append("g").attr("class","nv-distributionX"),W.select(".nv-distributionX").attr("transform","translate(0,"+p.range()[0]+")").datum(e.filter(function(e){return!e.disabled})).call(o)),g&&(u.getData(t.y()).scale(p).width(D).color(e.map(function(e,t){return e.color||c(e,t)}).filter(function(t,n){return!e[n].disabled})),z.select(".nv-distWrap").append("g").attr("class","nv-distributionY"),W.select(".nv-distributionY").attr("transform","translate("+(E?L:-u.size())+",0)").datum(e.filter(function(e){return!e.disabled})).call(u)),d3.fisheye&&(W.select(".nv-background").attr("width",L).attr("height",D),W.select(".nv-background").on("mousemove",J),W.select(".nv-background").on("click",function(){T=!T}),t.dispatch.on("elementClick.freezeFisheye",function(){T=!T})),s.dispatch.on("legendClick",function(e,i){e.disabled=!e.disabled,x=e.disabled?0:2.5,W.select(".nv-background").style("pointer-events",e.disabled?"none":"all"),W.select(".nv-point-paths").style("pointer-events",e.disabled?"all":"none"),e.disabled?(h.distortion(x).focus(0),p.distortion(x).focus(0),W.select(".nv-scatterWrap").call(t),W.select(".nv-x.nv-axis").call(n),W.select(".nv-y.nv-axis").call(r)):T=!1,F.update()}),i.dispatch.on("stateChange",function(e){A.disabled=e.disabled,M.stateChange(A),F.update()}),t.dispatch.on("elementMouseover.tooltip",function(e){d3.select(".nv-chart-"+t.id()+" .nv-series-"+e.seriesIndex+" .nv-distx-"+e.pointIndex).attr("y1",function(t,n){return e.pos[1]-D}),d3.select(".nv-chart-"+t.id()+" .nv-series-"+e.seriesIndex+" .nv-disty-"+e.pointIndex).attr("x2",e.pos[0]+o.size()),e.pos=[e.pos[0]+a.left,e.pos[1]+a.top],M.tooltipShow(e)}),M.on("tooltipShow",function(e){N&&B(e,k.parentNode)}),M.on("changeState",function(t){typeof t.disabled!="undefined"&&(e.forEach(function(e,n){e.disabled=t.disabled[n]}),A.disabled=t.disabled),F.update()}),P=h.copy(),H=p.copy()}),F}var t=e.models.scatter(),n=e.models.axis(),r=e.models.axis(),i=e.models.legend(),s=e.models.legend(),o=e.models.distribution(),u=e.models.distribution(),a={top:30,right:20,bottom:50,left:75},f=null,l=null,c=e.utils.defaultColor(),h=d3.fisheye?d3.fisheye.scale(d3.scale.linear).distortion(0):t.xScale(),p=d3.fisheye?d3.fisheye.scale(d3.scale.linear).distortion(0):t.yScale(),d=0,v=0,m=!1,g=!1,y=!0,b=!0,w=!0,E=!1,S=!!d3.fisheye,x=0,T=!1,N=!0,C=function(e,t,n){return"<strong>"+t+"</strong>"},k=function(e,t,n){return"<strong>"+n+"</strong>"},L=null,A={},O=null,M=d3.dispatch("tooltipShow","tooltipHide","stateChange","changeState"),_="No Data Available.",D=0;t.xScale(h).yScale(p),n.orient("bottom").tickPadding(10),r.orient(E?"right":"left").tickPadding(10),o.axis("x"),u.axis("y"),s.updateState(!1);var P,H,B=function(i,s){var o=i.pos[0]+(s.offsetLeft||0),u=i.pos[1]+(s.offsetTop||0),f=i.pos[0]+(s.offsetLeft||0),l=p.range()[0]+a.top+(s.offsetTop||0),c=h.range()[0]+a.left+(s.offsetLeft||0),d=i.pos[1]+(s.offsetTop||0),v=n.tickFormat()(t.x()(i.point,i.pointIndex)),m=r.tickFormat()(t.y()(i.point,i.pointIndex));C!=null&&e.tooltip.show([f,l],C(i.series.key,v,m,i,F),"n",1,s,"x-nvtooltip"),k!=null&&e.tooltip.show([c,d],k(i.series.key,v,m,i,F),"e",1,s,"y-nvtooltip"),L!=null&&e.tooltip.show([o,u],L(i.series.key,v,m,i,F),i.value<0?"n":"s",null,s)},j=[{key:"Magnify",disabled:!0}];return t.dispatch.on("elementMouseout.tooltip",function(e){M.tooltipHide(e),d3.select(".nv-chart-"+t.id()+" .nv-series-"+e.seriesIndex+" .nv-distx-"+e.pointIndex).attr("y1",0),d3.select(".nv-chart-"+t.id()+" .nv-series-"+e.seriesIndex+" .nv-disty-"+e.pointIndex).attr("x2",u.size())}),M.on("tooltipHide",function(){N&&e.tooltip.cleanup()}),F.dispatch=M,F.scatter=t,F.legend=i,F.controls=s,F.xAxis=n,F.yAxis=r,F.distX=o,F.distY=u,d3.rebind(F,t,"id","interactive","pointActive","x","y","shape","size","xScale","yScale","zScale","xDomain","yDomain","xRange","yRange","sizeDomain","sizeRange","forceX","forceY","forceSize","clipVoronoi","clipRadius","useVoronoi"),F.options=e.utils.optionsFunc.bind(F),F.margin=function(e){return arguments.length?(a.top=typeof e.top!="undefined"?e.top:a.top,a.right=typeof e.right!="undefined"?e.right:a.right,a.bottom=typeof e.bottom!="undefined"?e.bottom:a.bottom,a.left=typeof e.left!="undefined"?e.left:a.left,F):a},F.width=function(e){return arguments.length?(f=e,F):f},F.height=function(e){return arguments.length?(l=e,F):l},F.color=function(t){return arguments.length?(c=e.utils.getColor(t),i.color(c),o.color(c),u.color(c),F):c},F.showDistX=function(e){return arguments.length?(m=e,F):m},F.showDistY=function(e){return arguments.length?(g=e,F):g},F.showControls=function(e){return arguments.length?(S=e,F):S},F.showLegend=function(e){return arguments.length?(y=e,F):y},F.showXAxis=function(e){return arguments.length?(b=e,F):b},F.showYAxis=function(e){return arguments.length?(w=e,F):w},F.rightAlignYAxis=function(e){return arguments.length?(E=e,r.orient(e?"right":"left"),F):E},F.fisheye=function(e){return arguments.length?(x=e,F):x},F.xPadding=function(e){return arguments.length?(d=e,F):d},F.yPadding=function(e){return arguments.length?(v=e,F):v},F.tooltips=function(e){return arguments.length?(N=e,F):N},F.tooltipContent=function(e){return arguments.length?(L=e,F):L},F.tooltipXContent=function(e){return arguments.length?(C=e,F):C},F.tooltipYContent=function(e){return arguments.length?(k=e,F):k},F.state=function(e){return arguments.length?(A=e,F):A},F.defaultState=function(e){return arguments.length?(O=e,F):O},F.noData=function(e){return arguments.length?(_=e,F):_},F.transitionDuration=function(e){return arguments.length?(D=e,F):D},F},e.models.scatterPlusLineChart=function(){function B(e){return e.each(function(e){function V(){if(S)return U.select(".nv-point-paths").style("pointer-events","all"),!1;U.select(".nv-point-paths").style("pointer-events","none");var i=d3.mouse(this);h.distortion(E).focus(i[0]),p.distortion(E).focus(i[1]),U.select(".nv-scatterWrap").datum(e.filter(function(e){return!e.disabled})).call(t),g&&U.select(".nv-x.nv-axis").call(n),y&&U.select(".nv-y.nv-axis").call(r),U.select(".nv-distributionX").datum(e.filter(function(e){return!e.disabled})).call(o),U.select(".nv-distributionY").datum(e.filter(function(e){return!e.disabled})).call(u)}var T=d3.select(this),N=this,C=(f||parseInt(T.style("width"))||960)-a.left-a.right,M=(l||parseInt(T.style("height"))||400)-a.top-a.bottom;B.update=function(){T.call(B)},B.container=this,k.disabled=e.map(function(e){return!!e.disabled});if(!L){var j;L={};for(j in k)k[j]instanceof Array?L[j]=k[j].slice(0):L[j]=k[j]}if(!e||!e.length||!e.filter(function(e){return e.values.length}).length){var F=T.selectAll(".nv-noData").data([O]);return F.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),F.attr("x",a.left+C/2).attr("y",a.top+M/2).text(function(e){return e}),B}T.selectAll(".nv-noData").remove(),h=t.xScale(),p=t.yScale(),_=_||h,D=D||p;var I=T.selectAll("g.nv-wrap.nv-scatterChart").data([e]),q=I.enter().append("g").attr("class","nvd3 nv-wrap nv-scatterChart nv-chart-"+t.id()),R=q.append("g"),U=I.select("g");R.append("rect").attr("class","nvd3 nv-background").style("pointer-events","none"),R.append("g").attr("class","nv-x nv-axis"),R.append("g").attr("class","nv-y nv-axis"),R.append("g").attr("class","nv-scatterWrap"),R.append("g").attr("class","nv-regressionLinesWrap"),R.append("g").attr("class","nv-distWrap"),R.append("g").attr("class","nv-legendWrap"),R.append("g").attr("class","nv-controlsWrap"),I.attr("transform","translate("+a.left+","+a.top+")"),b&&U.select(".nv-y.nv-axis").attr("transform","translate("+C+",0)"),m&&(i.width(C/2),I.select(".nv-legendWrap").datum(e).call(i),a.top!=i.height()&&(a.top=i.height(),M=(l||parseInt(T.style("height"))||400)-a.top-a.bottom),I.select(".nv-legendWrap").attr("transform","translate("+C/2+","+ -a.top+")")),w&&(s.width(180).color(["#444"]),U.select(".nv-controlsWrap").datum(H).attr("transform","translate(0,"+ -a.top+")").call(s)),t.width(C).height(M).color(e.map(function(e,t){return e.color||c(e,t)}).filter(function(t,n){return!e[n].disabled})),I.select(".nv-scatterWrap").datum(e.filter(function(e){return!e.disabled})).call(t),I.select(".nv-regressionLinesWrap").attr("clip-path","url(#nv-edge-clip-"+t.id()+")");var z=I.select(".nv-regressionLinesWrap").selectAll(".nv-regLines").data(function(e){return e});z.enter().append("g").attr("class","nv-regLines");var W=z.selectAll(".nv-regLine").data(function(e){return[e]}),X=W.enter().append("line").attr("class","nv-regLine").style("stroke-opacity",0);W.attr("x1",h.range()[0]).attr("x2",h.range()[1]).attr("y1",function(e,t){return p(h.domain()[0]*e.slope+e.intercept)}).attr("y2",function(e,t){return p(h.domain()[1]*e.slope+e.intercept)}).style("stroke",function(e,t,n){return c(e,n)}).style("stroke-opacity",function(e,t){return e.disabled||typeof e.slope=="undefined"||typeof e.intercept=="undefined"?0:1}),g&&(n.scale(h).ticks(n.ticks()?n.ticks():C/100).tickSize(-M,0),U.select(".nv-x.nv-axis").attr("transform","translate(0,"+p.range()[0]+")").call(n)),y&&(r.scale(p).ticks(r.ticks()?r.ticks():M/36).tickSize(-C,0),U.select(".nv-y.nv-axis").call(r)),d&&(o.getData(t.x()).scale(h).width(C).color(e.map(function(e,t){return e.color||c(e,t)}).filter(function(t,n){return!e[n].disabled})),R.select(".nv-distWrap").append("g").attr("class","nv-distributionX"),U.select(".nv-distributionX").attr("transform","translate(0,"+p.range()[0]+")").datum(e.filter(function(e){return!e.disabled})).call(o)),v&&(u.getData(t.y()).scale(p).width(M).color(e.map(function(e,t){return e.color||c(e,t)}).filter(function(t,n){return!e[n].disabled})),R.select(".nv-distWrap").append("g").attr("class","nv-distributionY"),U.select(".nv-distributionY").attr("transform","translate("+(b?C:-u.size())+",0)").datum(e.filter(function(e){return!e.disabled})).call(u)),d3.fisheye&&(U.select(".nv-background").attr("width",C).attr("height",M),U.select(".nv-background").on("mousemove",V),U.select(".nv-background").on("click",function(){S=!S}),t.dispatch.on("elementClick.freezeFisheye",function(){S=!S})),s.dispatch.on("legendClick",function(e,i){e.disabled=!e.disabled,E=e.disabled?0:2.5,U.select(".nv-background").style("pointer-events",e.disabled?"none":"all"),U.select(".nv-point-paths").style("pointer-events",e.disabled?"all":"none"),e.disabled?(h.distortion(E).focus(0),p.distortion(E).focus(0),U.select(".nv-scatterWrap").call(t),U.select(".nv-x.nv-axis").call(n),U.select(".nv-y.nv-axis").call(r)):S=!1,B.update()}),i.dispatch.on("stateChange",function(e){k=e,A.stateChange(k),B.update()}),t.dispatch.on("elementMouseover.tooltip",function(e){d3.select(".nv-chart-"+t.id()+" .nv-series-"+e.seriesIndex+" .nv-distx-"+e.pointIndex).attr("y1",e.pos[1]-M),d3.select(".nv-chart-"+t.id()+" .nv-series-"+e.seriesIndex+" .nv-disty-"+e.pointIndex).attr("x2",e.pos[0]+o.size()),e.pos=[e.pos[0]+a.left,e.pos[1]+a.top],A.tooltipShow(e)}),A.on("tooltipShow",function(e){x&&P(e,N.parentNode)}),A.on("changeState",function(t){typeof t.disabled!="undefined"&&(e.forEach(function(e,n){e.disabled=t.disabled[n]}),k.disabled=t.disabled),B.update()}),_=h.copy(),D=p.copy()}),B}var t=e.models.scatter(),n=e.models.axis(),r=e.models.axis(),i=e.models.legend(),s=e.models.legend(),o=e.models.distribution(),u=e.models.distribution(),a={top:30,right:20,bottom:50,left:75},f=null,l=null,c=e.utils.defaultColor(),h=d3.fisheye?d3.fisheye.scale(d3.scale.linear).distortion(0):t.xScale(),p=d3.fisheye?d3.fisheye.scale(d3.scale.linear).distortion(0):t.yScale(),d=!1,v=!1,m=!0,g=!0,y=!0,b=!1,w=!!d3.fisheye,E=0,S=!1,x=!0,T=function(e,t,n){return"<strong>"+t+"</strong>"},N=function(e,t,n){return"<strong>"+n+"</strong>"},C=function(e,t,n,r){return"<h3>"+e+"</h3>"+"<p>"+r+"</p>"},k={},L=null,A=d3.dispatch("tooltipShow","tooltipHide","stateChange","changeState"),O="No Data Available.",M=0;t.xScale(h).yScale(p),n.orient("bottom").tickPadding(10),r.orient(b?"right":"left").tickPadding(10),o.axis("x"),u.axis("y"),s.updateState(!1);var _,D,P=function(i,s){var o=i.pos[0]+(s.offsetLeft||0),u=i.pos[1]+(s.offsetTop||0),f=i.pos[0]+(s.offsetLeft||0),l=p.range()[0]+a.top+(s.offsetTop||0),c=h.range()[0]+a.left+(s.offsetLeft||0),d=i.pos[1]+(s.offsetTop||0),v=n.tickFormat()(t.x()(i.point,i.pointIndex)),m=r.tickFormat()(t.y()(i.point,i.pointIndex));T!=null&&e.tooltip.show([f,l],T(i.series.key,v,m,i,B),"n",1,s,"x-nvtooltip"),N!=null&&e.tooltip.show([c,d],N(i.series.key,v,m,i,B),"e",1,s,"y-nvtooltip"),C!=null&&e.tooltip.show([o,u],C(i.series.key,v,m,i.point.tooltip,i,B),i.value<0?"n":"s",null,s)},H=[{key:"Magnify",disabled:!0}];return t.dispatch.on("elementMouseout.tooltip",function(e){A.tooltipHide(e),d3.select(".nv-chart-"+t.id()+" .nv-series-"+e.seriesIndex+" .nv-distx-"+e.pointIndex).attr("y1",0),d3.select(".nv-chart-"+t.id()+" .nv-series-"+e.seriesIndex+" .nv-disty-"+e.pointIndex).attr("x2",u.size())}),A.on("tooltipHide",function(){x&&e.tooltip.cleanup()}),B.dispatch=A,B.scatter=t,B.legend=i,B.controls=s,B.xAxis=n,B.yAxis=r,B.distX=o,B.distY=u,d3.rebind(B,t,"id","interactive","pointActive","x","y","shape","size","xScale","yScale","zScale","xDomain","yDomain","xRange","yRange","sizeDomain","sizeRange","forceX","forceY","forceSize","clipVoronoi","clipRadius","useVoronoi"),B.options=e.utils.optionsFunc.bind(B),B.margin=function(e){return arguments.length?(a.top=typeof e.top!="undefined"?e.top:a.top,a.right=typeof e.right!="undefined"?e.right:a.right,a.bottom=typeof e.bottom!="undefined"?e.bottom:a.bottom,a.left=typeof e.left!="undefined"?e.left:a.left,B):a},B.width=function(e){return arguments.length?(f=e,B):f},B.height=function(e){return arguments.length?(l=e,B):l},B.color=function(t){return arguments.length?(c=e.utils.getColor(t),i.color(c),o.color(c),u.color(c),B):c},B.showDistX=function(e){return arguments.length?(d=e,B):d},B.showDistY=function(e){return arguments.length?(v=e,B):v},B.showControls=function(e){return arguments.length?(w=e,B):w},B.showLegend=function(e){return arguments.length?(m=e,B):m},B.showXAxis=function(e){return arguments.length?(g=e,B):g},B.showYAxis=function(e){return arguments.length?(y=e,B):y},B.rightAlignYAxis=function(e){return arguments.length?(b=e,r.orient(e?"right":"left"),B):b},B.fisheye=function(e){return arguments.length?(E=e,B):E},B.tooltips=function(e){return arguments.length?(x=e,B):x},B.tooltipContent=function(e){return arguments.length?(C=e,B):C},B.tooltipXContent=function(e){return arguments.length?(T=e,B):T},B.tooltipYContent=function(e){return arguments.length?(N=e,B):N},B.state=function(e){return arguments.length?(k=e,B):k},B.defaultState=function(e){return arguments.length?(L=e,B):L},B.noData=function(e){return arguments.length?(O=e,B):O},B.transitionDuration=function(e){return arguments.length?(M=e,B):M},B},e.models.sparkline=function(){function d(e){return e.each(function(e){var i=n-t.left-t.right,d=r-t.top-t.bottom,v=d3.select(this);s.domain(l||d3.extent(e,u)).range(h||[0,i]),o.domain(c||d3.extent(e,a)).range(p||[d,0]);var m=v.selectAll("g.nv-wrap.nv-sparkline").data([e]),g=m.enter().append("g").attr("class","nvd3 nv-wrap nv-sparkline"),b=g.append("g"),w=m.select("g");m.attr("transform","translate("+t.left+","+t.top+")");var E=m.selectAll("path").data(function(e){return[e]});E.enter().append("path"),E.exit().remove(),E.style("stroke",function(e,t){return e.color||f(e,t)}).attr("d",d3.svg.line().x(function(e,t){return s(u(e,t))}).y(function(e,t){return o(a(e,t))}));var S=m.selectAll("circle.nv-point").data(function(e){function n(t){if(t!=-1){var n=e[t];return n.pointIndex=t,n}return null}var t=e.map(function(e,t){return a(e,t)}),r=n(t.lastIndexOf(o.domain()[1])),i=n(t.indexOf(o.domain()[0])),s=n(t.length-1);return[i,r,s].filter(function(e){return e!=null})});S.enter().append("circle"),S.exit().remove(),S.attr("cx",function(e,t){return s(u(e,e.pointIndex))}).attr("cy",function(e,t){return o(a(e,e.pointIndex))}).attr("r",2).attr("class",function(e,t){return u(e,e.pointIndex)==s.domain()[1]?"nv-point nv-currentValue":a(e,e.pointIndex)==o.domain()[0]?"nv-point nv-minValue":"nv-point nv-maxValue"})}),d}var t={top:2,right:0,bottom:2,left:0},n=400,r=32,i=!0,s=d3.scale.linear(),o=d3.scale.linear(),u=function(e){return e.x},a=function(e){return e.y},f=e.utils.getColor(["#000"]),l,c,h,p;return d.options=e.utils.optionsFunc.bind(d),d.margin=function(e){return arguments.length?(t.top=typeof e.top!="undefined"?e.top:t.top,t.right=typeof e.right!="undefined"?e.right:t.right,t.bottom=typeof e.bottom!="undefined"?e.bottom:t.bottom,t.left=typeof e.left!="undefined"?e.left:t.left,d):t},d.width=function(e){return arguments.length?(n=e,d):n},d.height=function(e){return arguments.length?(r=e,d):r},d.x=function(e){return arguments.length?(u=d3.functor(e),d):u},d.y=function(e){return arguments.length?(a=d3.functor(e),d):a},d.xScale=function(e){return arguments.length?(s=e,d):s},d.yScale=function(e){return arguments.length?(o=e,d):o},d.xDomain=function(e){return arguments.length?(l=e,d):l},d.yDomain=function(e){return arguments.length?(c=e,d):c},d.xRange=function(e){return arguments.length?(h=e,d):h},d.yRange=function(e){return arguments.length?(p=e,d):p},d.animate=function(e){return arguments.length?(i=e,d):i},d.color=function(t){return arguments.length?(f=e.utils.getColor(t),d):f},d},e.models.sparklinePlus=function(){function v(e){return e.each(function(c){function O(){if(a)return;var e=C.selectAll(".nv-hoverValue").data(u),r=e.enter().append("g").attr("class","nv-hoverValue").style("stroke-opacity",0).style("fill-opacity",0);e.exit().style("stroke-opacity",0).style("fill-opacity",0).remove(),e.attr("transform",function(e){return"translate("+s(t.x()(c[e],e))+",0)"}).style("stroke-opacity",1).style("fill-opacity",1);if(!u.length)return;r.append("line").attr("x1",0).attr("y1",-n.top).attr("x2",0).attr("y2",b),r.append("text").attr("class","nv-xValue").attr("x",-6).attr("y",-n.top).attr("text-anchor","end").attr("dy",".9em"),C.select(".nv-hoverValue .nv-xValue").text(f(t.x()(c[u[0]],u[0]))),r.append("text").attr("class","nv-yValue").attr("x",6).attr("y",-n.top).attr("text-anchor","start").attr("dy",".9em"),C.select(".nv-hoverValue .nv-yValue").text(l(t.y()(c[u[0]],u[0])))}function M(){function r(e,n){var r=Math.abs(t.x()(e[0],0)-n),i=0;for(var s=0;s<e.length;s++)Math.abs(t.x()(e[s],s)-n)<r&&(r=Math.abs(t.x()(e[s],s)-n),i=s);return i}if(a)return;var e=d3.mouse(this)[0]-n.left;u=[r(c,Math.round(s.invert(e)))],O()}var m=d3.select(this),g=(r||parseInt(m.style("width"))||960)-n.left-n.right,b=(i||parseInt(m.style("height"))||400)-n.top-n.bottom;v.update=function(){v(e)},v.container=this;if(!c||!c.length){var w=m.selectAll(".nv-noData").data([d]);return w.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),w.attr("x",n.left+g/2).attr("y",n.top+b/2).text(function(e){return e}),v}m.selectAll(".nv-noData").remove();var E=t.y()(c[c.length-1],c.length-1);s=t.xScale(),o=t.yScale();var S=m.selectAll("g.nv-wrap.nv-sparklineplus").data([c]),T=S.enter().append("g").attr("class","nvd3 nv-wrap nv-sparklineplus"),N=T.append("g"),C=S.select("g");N.append("g").attr("class","nv-sparklineWrap"),N.append("g").attr("class","nv-valueWrap"),N.append("g").attr("class","nv-hoverArea"),S.attr("transform","translate("+n.left+","+n.top+")");var k=C.select(".nv-sparklineWrap");t.width(g).height(b),k.call(t);var L=C.select(".nv-valueWrap"),A=L.selectAll(".nv-currentValue").data([E]);A.enter().append("text").attr("class","nv-currentValue").attr("dx",p?-8:8).attr("dy",".9em").style("text-anchor",p?"end":"start"),A.attr("x",g+(p?n.right:0)).attr("y",h?function(e){return o(e)}:0).style("fill",t.color()(c[c.length-1],c.length-1)).text(l(E)),N.select(".nv-hoverArea").append("rect").on("mousemove",M).on("click",function(){a=!a}).on("mouseout",function(){u=[],O()}),C.select(".nv-hoverArea rect").attr("transform",function(e){return"translate("+ -n.left+","+ -n.top+")"}).attr("width",g+n.left+n.right).attr("height",b+n.top)}),v}var t=e.models.sparkline(),n={top:15,right:100,bottom:10,left:50},r=null,i=null,s,o,u=[],a=!1,f=d3.format(",r"),l=d3.format(",.2f"),c=!0,h=!0,p=!1,d="No Data Available.";return v.sparkline=t,d3.rebind(v,t,"x","y","xScale","yScale","color"),v.options=e.utils.optionsFunc.bind(v),v.margin=function(e){return arguments.length?(n.top=typeof e.top!="undefined"?e.top:n.top,n.right=typeof e.right!="undefined"?e.right:n.right,n.bottom=typeof e.bottom!="undefined"?e.bottom:n.bottom,n.left=typeof e.left!="undefined"?e.left:n.left,v):n},v.width=function(e){return arguments.length?(r=e,v):r},v.height=function(e){return arguments.length?(i=e,v):i},v.xTickFormat=function(e){return arguments.length?(f=e,v):f},v.yTickFormat=function(e){return arguments.length?(l=e,v):l},v.showValue=function(e){return arguments.length?(c=e,v):c},v.alignValue=function(e){return arguments.length?(h=e,v):h},v.rightAlignValue=function(e){return arguments.length?(p=e,v):p},v.noData=function(e){return arguments.length?(d=e,v):d},v},e.models.stackedArea=function(){function g(e){return e.each(function(e){var a=n-t.left-t.right,b=r-t.top-t.bottom,w=d3.select(this);p=v.xScale(),d=v.yScale();var E=e;e.forEach(function(e,t){e.seriesIndex=t,e.values=e.values.map(function(e,n){return e.index=n,e.seriesIndex=t,e})});var S=e.filter(function(e){return!e.disabled});e=d3.layout.stack().order(l).offset(f).values(function(e){return e.values}).x(o).y(u).out(function(e,t,n){var r=u(e)===0?0:n;e.display={y:r,y0:t}})(S);var T=w.selectAll("g.nv-wrap.nv-stackedarea").data([e]),N=T.enter().append("g").attr("class","nvd3 nv-wrap nv-stackedarea"),C=N.append("defs"),k=N.append("g"),L=T.select("g");k.append("g").attr("class","nv-areaWrap"),k.append("g").attr("class","nv-scatterWrap"),T.attr("transform","translate("+t.left+","+t.top+")"),v.width(a).height(b).x(o).y(function(e){return e.display.y+e.display.y0}).forceY([0]).color(e.map(function(e,t){return e.color||i(e,e.seriesIndex)}));var A=L.select(".nv-scatterWrap").datum(e);A.call(v),C.append("clipPath").attr("id","nv-edge-clip-"+s).append("rect"),T.select("#nv-edge-clip-"+s+" rect").attr("width",a).attr("height",b),L.attr("clip-path",h?"url(#nv-edge-clip-"+s+")":"");var O=d3.svg.area().x(function(e,t){return p(o(e,t))}).y0(function(e){return d(e.display.y0)}).y1(function(e){return d(e.display.y+e.display.y0)}).interpolate(c),M=d3.svg.area().x(function(e,t){return p(o(e,t))}).y0(function(e){return d(e.display.y0)}).y1(function(e){return d(e.display.y0)}),_=L.select(".nv-areaWrap").selectAll("path.nv-area").data(function(e){return e});_.enter().append("path").attr("class",function(e,t){return"nv-area nv-area-"+t}).attr("d",function(e,t){return M(e.values,e.seriesIndex)}).on("mouseover",function(e,t){d3.select(this).classed("hover",!0),m.areaMouseover({point:e,series:e.key,pos:[d3.event.pageX,d3.event.pageY],seriesIndex:e.seriesIndex})}).on("mouseout",function(e,t){d3.select(this).classed("hover",!1),m.areaMouseout({point:e,series:e.key,pos:[d3.event.pageX,d3.event.pageY],seriesIndex:e.seriesIndex})}).on("click",function(e,t){d3.select(this).classed("hover",!1),m.areaClick({point:e,series:e.key,pos:[d3.event.pageX,d3.event.pageY],seriesIndex:e.seriesIndex})}),_.exit().remove(),_.style("fill",function(e,t){return e.color||i(e,e.seriesIndex)}).style("stroke",function(e,t){return e.color||i(e,e.seriesIndex)}),_.attr("d",function(e,t){return O(e.values,t)}),v.dispatch.on("elementMouseover.area",function(e){L.select(".nv-chart-"+s+" .nv-area-"+e.seriesIndex).classed("hover",!0)}),v.dispatch.on("elementMouseout.area",function(e){L.select(".nv-chart-"+s+" .nv-area-"+e.seriesIndex).classed("hover",!1)}),g.d3_stackedOffset_stackPercent=function(e){var t=e.length,n=e[0].length,r=1/t,i,s,o,a=[];for(s=0;s<n;++s){for(i=0,o=0;i<E.length;i++)o+=u(E[i].values[s]);if(o)for(i=0;i<t;i++)e[i][s][1]/=o;else for(i=0;i<t;i++)e[i][s][1]=r}for(s=0;s<n;++s)a[s]=0;return a}}),g}var t={top:0,right:0,bottom:0,left:0},n=960,r=500,i=e.utils.defaultColor(),s=Math.floor(Math.random()*1e5),o=function(e){return e.x},u=function(e){return e.y},a="stack",f="zero",l="default",c="linear",h=!1,p,d,v=e.models.scatter(),m=d3.dispatch("tooltipShow","tooltipHide","areaClick","areaMouseover","areaMouseout");return v.size(2.2).sizeDomain([2.2,2.2]),v.dispatch.on("elementClick.area",function(e){m.areaClick(e)}),v.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+t.left,e.pos[1]+t.top],m.tooltipShow(e)}),v.dispatch.on("elementMouseout.tooltip",function(e){m.tooltipHide(e)}),g.dispatch=m,g.scatter=v,d3.rebind(g,v,"interactive","size","xScale","yScale","zScale","xDomain","yDomain","xRange","yRange","sizeDomain","forceX","forceY","forceSize","clipVoronoi","useVoronoi","clipRadius","highlightPoint","clearHighlights"),g.options=e.utils.optionsFunc.bind(g),g.x=function(e){return arguments.length?(o=d3.functor(e),g):o},g.y=function(e){return arguments.length?(u=d3.functor(e),g):u},g.margin=function(e){return arguments.length?(t.top=typeof e.top!="undefined"?e.top:t.top,t.right=typeof e.right!="undefined"?e.right:t.right,t.bottom=typeof e.bottom!="undefined"?e.bottom:t.bottom,t.left=typeof e.left!="undefined"?e.left:t.left,g):t},g.width=function(e){return arguments.length?(n=e,g):n},g.height=function(e){return arguments.length?(r=e,g):r},g.clipEdge=function(e){return arguments.length?(h=e,g):h},g.color=function(t){return arguments.length?(i=e.utils.getColor(t),g):i},g.offset=function(e){return arguments.length?(f=e,g):f},g.order=function(e){return arguments.length?(l=e,g):l},g.style=function(e){if(!arguments.length)return a;a=e;switch(a){case"stack":g.offset("zero"),g.order("default");break;case"stream":g.offset("wiggle"),g.order("inside-out");break;case"stream-center":g.offset("silhouette"),g.order("inside-out");break;case"expand":g.offset("expand"),g.order("default");break;case"stack_percent":g.offset(g.d3_stackedOffset_stackPercent),g.order("default")}return g},g.interpolate=function(e){return arguments.length?(c=e,g):c},g},e.models.stackedAreaChart=function(){function M(y){return y.each(function(y){var A=d3.select(this),_=this,D=(a||parseInt(A.style("width"))||960)-u.left-u.right,P=(f||parseInt(A.style("height"))||400)-u.top-u.bottom;M.update=function(){A.call(M)},M.container=this,S.disabled=y.map(function(e){return!!e.disabled});if(!x){var H;x={};for(H in S)S[H]instanceof Array?x[H]=S[H].slice(0):x[H]=S[H]}if(!y||!y.length||!y.filter(function(e){return e.values.length}).length){var B=A.selectAll(".nv-noData").data([T]);return B.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),B.attr("x",u.left+D/2).attr("y",u.top+P/2).text(function(e){return e}),M}A.selectAll(".nv-noData").remove(),b=t.xScale(),w=t.yScale();var j=A.selectAll("g.nv-wrap.nv-stackedAreaChart").data([y]),F=j.enter().append("g").attr("class","nvd3 nv-wrap nv-stackedAreaChart").append("g"),I=j.select("g");F.append("rect").style("opacity",0),F.append("g").attr("class","nv-x nv-axis"),F.append("g").attr("class","nv-y nv-axis"),F.append("g").attr("class","nv-stackedWrap"),F.append("g").attr("class","nv-legendWrap"),F.append("g").attr("class","nv-controlsWrap"),F.append("g").attr("class","nv-interactive"),I.select("rect").attr("width",D).attr("height",P);if(h){var q=c?D-C:D;i.width(q),I.select(".nv-legendWrap").datum(y).call(i),u.top!=i.height()&&(u.top=i.height(),P=(f||parseInt(A.style("height"))||400)-u.top-u.bottom),I.select(".nv-legendWrap").attr("transform","translate("+(D-q)+","+ -u.top+")")}if(c){var R=[{key:L.stacked||"Stacked",metaKey:"Stacked",disabled:t.style()!="stack",style:"stack"},{key:L.stream||"Stream",metaKey:"Stream",disabled:t.style()!="stream",style:"stream"},{key:L.expanded||"Expanded",metaKey:"Expanded",disabled:t.style()!="expand",style:"expand"},{key:L.stack_percent||"Stack %",metaKey:"Stack_Percent",disabled:t.style()!="stack_percent",style:"stack_percent"}];C=k.length/3*260,R=R.filter(function(e){return k.indexOf(e.metaKey)!==-1}),s.width(C).color(["#444","#444","#444"]),I.select(".nv-controlsWrap").datum(R).call(s),u.top!=Math.max(s.height(),i.height())&&(u.top=Math.max(s.height(),i.height()),P=(f||parseInt(A.style("height"))||400)-u.top-u.bottom),I.select(".nv-controlsWrap").attr("transform","translate(0,"+ -u.top+")")}j.attr("transform","translate("+u.left+","+u.top+")"),v&&I.select(".nv-y.nv-axis").attr("transform","translate("+D+",0)"),m&&(o.width(D).height(P).margin({left:u.left,top:u.top}).svgContainer(A).xScale(b),j.select(".nv-interactive").call(o)),t.width(D).height(P);var U=I.select(".nv-stackedWrap").datum(y);U.call(t),p&&(n.scale(b).ticks(D/100).tickSize(-P,0),I.select(".nv-x.nv-axis").attr("transform","translate(0,"+P+")"),I.select(".nv-x.nv-axis").call(n)),d&&(r.scale(w).ticks(t.offset()=="wiggle"?0:P/36).tickSize(-D,0).setTickFormat(t.style()=="expand"||t.style()=="stack_percent"?d3.format("%"):E),I.select(".nv-y.nv-axis").call(r)),t.dispatch.on("areaClick.toggle",function(e){y.filter(function(e){return!e.disabled}).length===1?y.forEach(function(e){e.disabled=!1}):y.forEach(function(t,n){t.disabled=n!=e.seriesIndex}),S.disabled=y.map(function(e){return!!e.disabled}),N.stateChange(S),M.update()}),i.dispatch.on("stateChange",function(e){S.disabled=e.disabled,N.stateChange(S),M.update()}),s.dispatch.on("legendClick",function(e,n){if(!e.disabled)return;R=R.map(function(e){return e.disabled=!0,e}),e.disabled=!1,t.style(e.style),S.style=t.style(),N.stateChange(S),M.update()}),o.dispatch.on("elementMousemove",function(i){t.clearHighlights();var s,a,f,c=[];y.filter(function(e,t){return e.seriesIndex=t,!e.disabled}).forEach(function(n,r){a=e.interactiveBisect(n.values,i.pointXValue,M.x()),t.highlightPoint(r,a,!0);var o=n.values[a];if(typeof o=="undefined")return;typeof s=="undefined"&&(s=o),typeof f=="undefined"&&(f=M.xScale()(M.x()(o,a)));var u=t.style()=="expand"?o.display.y:M.y()(o,a);c.push({key:n.key,value:u,color:l(n,n.seriesIndex),stackedValue:o.display})}),c.reverse();if(c.length>2){var h=M.yScale().invert(i.mouseY),p=Infinity,d=null;c.forEach(function(e,t){h=Math.abs(h);var n=Math.abs(e.stackedValue.y0),r=Math.abs(e.stackedValue.y);if(h>=n&&h<=r+n){d=t;return}}),d!=null&&(c[d].highlight=!0)}var v=n.tickFormat()(M.x()(s,a)),m=t.style()=="expand"?function(e,t){return d3.format(".1%")(e)}:function(e,t){return r.tickFormat()(e)};o.tooltip.position({left:f+u.left,top:i.mouseY+u.top}).chartContainer(_.parentNode).enabled(g).valueFormatter(m).data({value:v,series:c})(),o.renderGuideLine(f)}),o.dispatch.on("elementMouseout",function(e){N.tooltipHide(),t.clearHighlights()}),N.on("tooltipShow",function(e){g&&O(e,_.parentNode)}),N.on("changeState",function(e){typeof e.disabled!="undefined"&&y.length===e.disabled.length&&(y.forEach(function(t,n){t.disabled=e.disabled[n]}),S.disabled=e.disabled),typeof e.style!="undefined"&&t.style(e.style),M.update()})}),M}var t=e.models.stackedArea(),n=e.models.axis(),r=e.models.axis(),i=e.models.legend(),s=e.models.legend(),o=e.interactiveGuideline(),u={top:30,right:25,bottom:50,left:60},a=null,f=null,l=e.utils.defaultColor(),c=!0,h=!0,p=!0,d=!0,v=!1,m=!1,g=!0,y=function(e,t,n,r,i){return"<h3>"+e+"</h3>"+"<p>"+n+" on "+t+"</p>"},b,w,E=d3.format(",.2f"),S={style:t.style()},x=null,T="No Data Available.",N=d3.dispatch("tooltipShow","tooltipHide","stateChange","changeState"),C=250,k=["Stacked","Stream","Expanded"],L={},A=0;n.orient("bottom").tickPadding(7),r.orient(v?"right":"left"),s.updateState(!1);var O=function(i,s){var o=i.pos[0]+(s.offsetLeft||0),u=i.pos[1]+(s.offsetTop||0),a=n.tickFormat()(t.x()(i.point,i.pointIndex)),f=r.tickFormat()(t.y()(i.point,i.pointIndex)),l=y(i.series.key,a,f,i,M);e.tooltip.show([o,u],l,i.value<0?"n":"s",null,s)};return t.dispatch.on("tooltipShow",function(e){e.pos=[e.pos[0]+u.left,e.pos[1]+u.top],N.tooltipShow(e)}),t.dispatch.on("tooltipHide",function(e){N.tooltipHide(e)}),N.on("tooltipHide",function(){g&&e.tooltip.cleanup()}),M.dispatch=N,M.stacked=t,M.legend=i,M.controls=s,M.xAxis=n,M.yAxis=r,M.interactiveLayer=o,d3.rebind(M,t,"x","y","size","xScale","yScale","xDomain","yDomain","xRange","yRange","sizeDomain","interactive","useVoronoi","offset","order","style","clipEdge","forceX","forceY","forceSize","interpolate"),M.options=e.utils.optionsFunc.bind(M),M.margin=function(e){return arguments.length?(u.top=typeof e.top!="undefined"?e.top:u.top,u.right=typeof e.right!="undefined"?e.right:u.right,u.bottom=typeof e.bottom!="undefined"?e.bottom:u.bottom,u.left=typeof e.left!="undefined"?e.left:u.left,M):u},M.width=function(e){return arguments.length?(a=e,M):a},M.height=function(e){return arguments.length?(f=e,M):f},M.color=function(n){return arguments.length?(l=e.utils.getColor(n),i.color(l),t.color(l),M):l},M.showControls=function(e){return arguments.length?(c=e,M):c},M.showLegend=function(e){return arguments.length?(h=e,M):h},M.showXAxis=function(e){return arguments.length?(p=e,M):p},M.showYAxis=function(e){return arguments.length?(d=e,M):d},M.rightAlignYAxis=function(e){return arguments.length?(v=e,r.orient(e?"right":"left"),M):v},M.useInteractiveGuideline=function(e){return arguments.length?(m=e,e===!0&&(M.interactive(!1),M.useVoronoi(!1)),M):m},M.tooltip=function(e){return arguments.length?(y=e,M):y},M.tooltips=function(e){return arguments.length?(g=e,M):g},M.tooltipContent=function(e){return arguments.length?(y=e,M):y},M.state=function(e){return arguments.length?(S=e,M):S},M.defaultState=function(e){return arguments.length?(x=e,M):x},M.noData=function(e){return arguments.length?(T=e,M):T},M.transitionDuration=function(e){return arguments.length?(A=e,M):A},M.controlsData=function(e){return arguments.length?(k=e,M):k},M.controlLabels=function(e){return arguments.length?typeof e!="object"?L:(L=e,M):L},r.setTickFormat=r.tickFormat,r.tickFormat=function(e){return arguments.length?(E=e,r):E},M}}(),define("plugin/plugins/nvd3/nv.d3",function(){}),define("plugin/charts/nvd3/common/config",["plugin/charts/forms/default","plugin/plugins/nvd3/nv.d3"],function(e){return $.extend(!0,{},e,{title:"",category:"",library:"NVD3",tag:"svg",keywords:"small"})}),define("plugin/charts/nvd3/bar/config",["plugin/charts/nvd3/common/config"],function(e){return $.extend(!0,{},e,{title:"Regular",category:"Bar diagrams",columns:{x:{title:"Values for x-axis",is_label:!0,is_auto:!0,is_unique:!0},y:{title:"Values for y-axis",is_numeric:!0}}})}),define("plugin/charts/nvd3/bar_stacked/config",["plugin/charts/nvd3/common/config"],function(e){return $.extend(!0,{},e,{title:"Stacked",category:"Bar diagrams",columns:{x:{title:"Values for x-axis",is_label:!0,is_auto:!0,is_unique:!0},y:{title:"Values for y-axis",is_numeric:!0}}})}),define("plugin/charts/nvd3/bar_horizontal/config",["plugin/charts/nvd3/common/config"],function(e){return $.extend(!0,{},e,{title:"Horizontal",category:"Bar diagrams",settings:{x_axis_type:{init:"hide"}},columns:{x:{title:"Values for x-axis",is_label:!0,is_auto:!0,is_unique:!0},y:{title:"Values for y-axis",is_numeric:!0}}})}),define("plugin/charts/nvd3/bar_horizontal_stacked/config",["plugin/charts/nvd3/common/config"],function(e){return $.extend(!0,{},e,{title:"Stacked horizontal",category:"Bar diagrams",settings:{x_axis_type:{init:"hide"}},columns:{x:{title:"Values for x-axis",is_label:!0,is_auto:!0,is_unique:!0},y:{title:"Values for y-axis",is_numeric:!0}}})}),define("plugin/charts/nvd3/line_focus/config",["plugin/charts/nvd3/common/config"],function(e){return $.extend(!0,{},e,{title:"Line with focus",category:"Others",zoomable:"native",columns:{x:{title:"Values for x-axis",is_label:!0,is_auto:!0,is_unique:!0},y:{title:"Values for y-axis",is_numeric:!0}}})}),define("plugin/charts/nvd3/pie/config",["plugin/plugins/nvd3/nv.d3"],function(){return $.extend(!0,{},{title:"Pie chart",category:"Area charts",library:"NVD3",tag:"svg",keywords:"small",columns:{label:{title:"Labels",is_label:!0,is_auto:!0},y:{title:"Values",is_numeric:!0}},settings:{main_separator:{type:"separator",title:"Pie chart settings"},donut_ratio:{title:"Donut ratio",info:"Determine how large the donut hole will be.",type:"select",init:"0.5",data:[{label:"50%",value:"0.5"},{label:"25%",value:"0.25"},{label:"10%",value:"0.10"},{label:"0%",value:"0"}]},show_legend:{title:"Show legend",info:"Would you like to add a legend?",type:"radiobutton",init:"false",data:[{label:"Yes",value:"true"},{label:"No",value:"false"}]},label_separator:{type:"separator",title:"Label settings"},label_type:{title:"Donut label",info:"What would you like to show for each slice?",type:"select",init:"percent",data:[{label:"-- Nothing --",value:"hide",hide:"label_outside"},{label:"Label column",value:"key",show:"label_outside"},{label:"Value column",value:"value",show:"label_outside"},{label:"Percentage",value:"percent",show:"label_outside"}]},label_outside:{title:"Show outside",info:"Would you like to show labels outside the donut?",type:"radiobutton",init:"false",data:[{label:"Yes",value:"true"},{label:"No",value:"false"}]},use_panels:{init:"true",hide:!0}}})}),define("plugin/charts/nvd3/stackedarea_full/config",["plugin/charts/nvd3/common/config"],function(e){return $.extend(!0,{},e,{title:"Expanded",zoomable:!0,category:"Area charts",keywords:"default small",columns:{x:{title:"Values for x-axis",is_label:!0,is_auto:!0,is_unique:!0},y:{title:"Values for y-axis",is_numeric:!0}}})}),define("plugin/charts/nvd3/stackedarea_stream/config",["plugin/charts/nvd3/common/config"],function(e){return $.extend(!0,{},e,{title:"Stream",category:"Area charts",zoomable:!0,keywords:"default small",showmaxmin:!0,columns:{x:{title:"Values for x-axis",is_label:!0,is_auto:!0,is_unique:!0},y:{title:"Values for y-axis",is_numeric:!0}}})}),define("plugin/charts/nvd3/histogram/config",["plugin/charts/nvd3/common/config"],function(e){return $.extend(!0,{},e,{title:"Histogram",category:"Data processing (requires 'charts' tool from Toolshed)",execute:"histogram",keywords:"small medium large",columns:{y:{title:"Observations",is_numeric:!0}},settings:{x_axis_label:{init:"Values"},y_axis_label:{init:"Density"},y_axis_type:{init:"f"},y_axis_precision:{init:".2"}}})}),define("plugin/charts/nvd3/line/config",["plugin/charts/nvd3/common/config"],function(e){return $.extend(!0,{},e,{title:"Line chart",category:"Others",zoomable:!0,columns:{x:{title:"Values for x-axis",is_label:!0,is_auto:!0,is_unique:!0},y:{title:"Values for y-axis",is_numeric:!0}}})}),define("plugin/charts/nvd3/scatter/config",["plugin/charts/nvd3/common/config"],function(e){return $.extend(!0,{},e,{title:"Scatter plot",category:"Others",zoomable:!0,columns:{x:{title:"Values for x-axis",is_numeric:!0},y:{title:"Values for y-axis",is_numeric:!0}}})}),define("plugin/charts/nvd3/stackedarea/config",["plugin/charts/nvd3/common/config"],function(e){return $.extend(!0,{},e,{title:"Regular",zoomable:!0,category:"Area charts",keywords:"default small",columns:{x:{title:"Values for x-axis",is_label:!0,is_auto:!0,is_unique:!0},y:{title:"Values for y-axis",is_numeric:!0}}})}),define("plugin/charts/jqplot/common/config",["plugin/charts/forms/default"],function(e){return $.extend(!0,{},e,{title:"",category:"",library:"jqPlot",tag:"div",zoomable:!0,keywords:"medium",settings:{separator_grid:{title:"Grids",type:"separator"},x_axis_grid:{title:"Axis grid",info:"Would you like to show grid lines for the X axis?",type:"radiobutton",init:"false",data:[{label:"On",value:"true"},{label:"Off",value:"false"}]},y_axis_grid:{title:"Axis grid",info:"Would you like to show grid lines for the Y axis?",type:"radiobutton",init:"true",data:[{label:"On",value:"true"},{label:"Off",value:"false"}]}}})}),define("plugin/charts/jqplot/bar/config",["plugin/charts/jqplot/common/config"],function(e){return $.extend(!0,{},e,{title:"Regular",category:"Bar diagrams",columns:{x:{title:"Values for x-axis",is_label:!0,is_auto:!0,is_unique:!0},y:{title:"Values for y-axis",is_numeric:!0}}})}),define("plugin/charts/jqplot/line/config",["plugin/charts/jqplot/common/config"],function(e){return $.extend(!0,{},e,{title:"Line chart",category:"Others",columns:{x:{title:"Values for x-axis",is_label:!0,is_auto:!0,is_unique:!0},y:{title:"Values for y-axis",is_numeric:!0}}})}),define("plugin/charts/jqplot/scatter/config",["plugin/charts/jqplot/common/config"],function(e){return $.extend(!0,{},e,{title:"Scatter plot",category:"Others",columns:{x:{title:"Values for x-axis",is_numeric:!0},y:{title:"Values for y-axis",is_numeric:!0}},settings:{x_axis_grid:{init:"true"}}})}),define("plugin/charts/jqplot/boxplot/config",["plugin/charts/jqplot/common/config"],function(e){return $.extend(!0,{},e,{title:"Box plot",category:"Data processing (requires 'charts' tool from Toolshed)",library:"jqPlot",tag:"div",execute:"boxplot",keywords:"small medium large",columns:{y:{title:"Observations",is_numeric:!0}},settings:{show_legend:{init:"false"}}})}),define("plugin/charts/jqplot/histogram_discrete/config",["plugin/charts/jqplot/common/config"],function(e){return $.extend(!0,{},e,{title:"Discrete Histogram",category:"Data processing (requires 'charts' tool from Toolshed)",execute:"histogramdiscrete",keywords:"small medium large",columns:{x:{title:"Observations",is_label:!0}},settings:{x_axis_label:{init:"Breaks"},y_axis_label:{init:"Density"}}})}),define("plugin/charts/others/heatmap/config",["plugin/charts/forms/default"],function(e){return $.extend(!0,{},e,{title:"Heatmap",category:"Others",library:"Custom",tag:"svg",keywords:"small",zoomable:!0,columns:{x:{title:"Column labels",is_label:!0,is_numeric:!0,is_unique:!0},y:{title:"Row labels",is_label:!0,is_numeric:!0,is_unique:!0},z:{title:"Observation",is_numeric:!0}},settings:{use_panels:{init:"true",hide:!0},color_set:{title:"Color scheme",info:"Select a color scheme for your heatmap",type:"select",init:"jet",data:[{label:"Cold-to-Hot",value:"hot"},{label:"Cool",value:"cool"},{label:"Copper",value:"copper"},{label:"Gray scale",value:"gray"},{label:"Jet",value:"jet"},{label:"No-Green",value:"no_green"},{label:"Ocean",value:"ocean"},{label:"Polar",value:"polar"},{label:"Red-to-Green",value:"redgreen"},{label:"Red-to-green (saturated)",value:"red2green"},{label:"Relief",value:"relief"},{label:"Seismograph",value:"seis"},{label:"Sealand",value:"sealand"},{label:"Split",value:"split"},{label:"Wysiwyg",value:"wysiwyg"}]},url_template:{title:"Url template",info:"Enter a url to link the labels with external sources. Use __LABEL__ as placeholder.",type:"text",init:"",placeholder:"http://someurl.com?id=__LABEL__"}}})}),define("plugin/charts/others/heatmap_cluster/config",["plugin/charts/others/heatmap/config"],function(e){return $.extend(!0,{},e,{title:"Clustered Heatmap",category:"Data processing (requires 'charts' tool from Toolshed)",execute:"heatmap",keywords:"small medium large"})}),define("plugin/charts/types",["plugin/charts/nvd3/bar/config","plugin/charts/nvd3/bar_stacked/config","plugin/charts/nvd3/bar_horizontal/config","plugin/charts/nvd3/bar_horizontal_stacked/config","plugin/charts/nvd3/line_focus/config","plugin/charts/nvd3/pie/config","plugin/charts/nvd3/stackedarea_full/config","plugin/charts/nvd3/stackedarea_stream/config","plugin/charts/nvd3/histogram/config","plugin/charts/nvd3/line/config","plugin/charts/nvd3/scatter/config","plugin/charts/nvd3/stackedarea/config","plugin/charts/jqplot/bar/config","plugin/charts/jqplot/line/config","plugin/charts/jqplot/scatter/config","plugin/charts/jqplot/boxplot/config","plugin/charts/jqplot/histogram_discrete/config","plugin/charts/others/heatmap/config","plugin/charts/others/heatmap_cluster/config"],function(e,t,n,r,i,s,o,u,a,f,l,c,h,p,d,v,m,g,y){return Backbone.Model.extend({defaults:{nvd3_bar:e,nvd3_bar_stacked:t,nvd3_bar_horizontal:n,nvd3_bar_horizontal_stacked:r,nvd3_line_focus:i,nvd3_stackedarea:c,nvd3_stackedarea_full:o,nvd3_stackedarea_stream:u,nvd3_pie:s,nvd3_line:f,nvd3_scatter:l,nvd3_histogram:a,jqplot_bar:h,jqplot_histogram_discrete:m,jqplot_line:p,jqplot_scatter:d,jqplot_boxplot:v,others_heatmap:g,others_heatmap_cluster:y}})}),define("plugin/app",["mvc/ui/ui-modal","mvc/ui/ui-portlet","mvc/ui/ui-misc","utils/utils","plugin/library/jobs","plugin/library/datasets","plugin/library/storage","utils/deferred","plugin/views/viewer","plugin/views/editor","plugin/models/config","plugin/models/chart","plugin/charts/types"],function(e,t,n,r,i,s,o,u,a,f,l,c,h){return Backbone.View.extend({initialize:function(t){this.options=t,Galaxy&&Galaxy.modal?this.modal=Galaxy.modal:this.modal=new e.View,this.config=new l,this.types=new h,this.chart=new c,this.jobs=new i(this),this.datasets=new s(this),this.storage=new o(this),this.deferred=new u,this.viewer_view=new a(this),this.editor_view=new f(this),this.$el.append(this.viewer_view.$el),this.$el.append(this.editor_view.$el);if(!this.storage.load())this.go("editor");else{this.go("viewer");var n=this;this.deferred.execute(function(){n.chart.trigger("redraw")})}},go:function(e){$(".tooltip").hide();switch(e){case"editor":this.editor_view.show(),this.viewer_view.hide();break;case"viewer":this.editor_view.hide(),this.viewer_view.show()}},chartPath:function(e){var t=e.split(/_(.+)/);return t.length>=2?t[0]+"/"+t[1]:(console.debug("FAILED App:chartPath() - Invalid format: "+e),undefined)}})});
\ No newline at end of file
diff -r 1ecb6aaebaf4247a7c71b77cb9a74f63dc937cff -r 4a8a610a97e1762b8ae78280566a23c11676bce9 config/plugins/visualizations/charts/static/charts/others/heatmap/heatmap-plugin.js
--- a/config/plugins/visualizations/charts/static/charts/others/heatmap/heatmap-plugin.js
+++ b/config/plugins/visualizations/charts/static/charts/others/heatmap/heatmap-plugin.js
@@ -83,7 +83,7 @@
Tools.addZoom({
xAxis : this.xAxis,
yAxis : this.yAxis,
- redraw : function() { self.redraw() },
+ redraw : function() { self.redraw(); },
svg : d3.select('#' + this.canvas_id)
});
},
diff -r 1ecb6aaebaf4247a7c71b77cb9a74f63dc937cff -r 4a8a610a97e1762b8ae78280566a23c11676bce9 config/plugins/visualizations/charts/static/views/editor.js
--- a/config/plugins/visualizations/charts/static/views/editor.js
+++ b/config/plugins/visualizations/charts/static/views/editor.js
@@ -108,7 +108,9 @@
// append element
var $main = $('<div/>');
$main.append(Utils.wrap((new Ui.Label({ title : 'Provide a chart title:'})).$el));
- $main.append(Utils.wrap(this.title.$el));
+ $main.append(this.title.$el);
+ $main.append($('<div/>').addClass('ui-table-form-info').html('This title will appear in the list of \'Saved Visualizations\'. Charts are saved upon creation.'));
+ $main.append(Utils.wrap());
$main.append(Utils.wrap(this.types.$el));
// add tab
@@ -189,7 +191,9 @@
_refreshTitle: function() {
var title = this.chart.get('title');
this.portlet.title(title);
- this.title.value(title);
+ if (this.title.value() != title) {
+ this.title.value(title);
+ }
},
// refresh group
diff -r 1ecb6aaebaf4247a7c71b77cb9a74f63dc937cff -r 4a8a610a97e1762b8ae78280566a23c11676bce9 config/plugins/visualizations/charts/static/views/group.js
--- a/config/plugins/visualizations/charts/static/views/group.js
+++ b/config/plugins/visualizations/charts/static/views/group.js
@@ -254,7 +254,9 @@
if (key_text === undefined) {
key_text = '';
}
- this.group_key.value(key_text);
+ if (key_text != this.group_key.value()) {
+ this.group_key.value(key_text);
+ }
}
});
diff -r 1ecb6aaebaf4247a7c71b77cb9a74f63dc937cff -r 4a8a610a97e1762b8ae78280566a23c11676bce9 config/plugins/visualizations/charts/static/views/viewer.js
--- a/config/plugins/visualizations/charts/static/views/viewer.js
+++ b/config/plugins/visualizations/charts/static/views/viewer.js
@@ -99,7 +99,6 @@
this.portlet = new Portlet.View({
icon : 'fa-bar-chart-o',
title: 'Viewport',
- scrollable: false,
operations: {
edit_button: new Ui.ButtonIcon({
icon : 'fa-edit',
diff -r 1ecb6aaebaf4247a7c71b77cb9a74f63dc937cff -r 4a8a610a97e1762b8ae78280566a23c11676bce9 config/plugins/visualizations/charts/static/views/viewport.js
--- a/config/plugins/visualizations/charts/static/views/viewport.js
+++ b/config/plugins/visualizations/charts/static/views/viewport.js
@@ -30,6 +30,14 @@
// use full screen for viewer
this._fullscreen(this.$el, 100);
+ // prevent window scrolling
+ var initial_overflow = $('body').css('overflow');
+ this.$el.on('mouseover', function() {
+ $('body').css('overflow', 'hidden');
+ }).on('mouseout', function() {
+ $('body').css('overflow', initial_overflow);
+ });
+
// create container element
this._createContainer('div');
diff -r 1ecb6aaebaf4247a7c71b77cb9a74f63dc937cff -r 4a8a610a97e1762b8ae78280566a23c11676bce9 eggs.ini
--- a/eggs.ini
+++ b/eggs.ini
@@ -34,7 +34,7 @@
amqp = 1.4.5
anyjson = 0.3.3
Beaker = 1.4
-bioblend = 0.4.2
+bioblend = 0.5.2
boto = 2.27.0
decorator = 3.1.2
docutils = 0.7
@@ -63,6 +63,7 @@
requests = 2.2.1
Routes = 1.12.3
simplejson = 2.1.1
+six = 1.9.0
sqlalchemy_migrate = 0.7.2
ssh = 1.7.14
SVGFig = 1.1.6
diff -r 1ecb6aaebaf4247a7c71b77cb9a74f63dc937cff -r 4a8a610a97e1762b8ae78280566a23c11676bce9 lib/galaxy/config.py
--- a/lib/galaxy/config.py
+++ b/lib/galaxy/config.py
@@ -161,7 +161,6 @@
self.job_walltime_delta = timedelta( 0, s, 0, 0, m, h )
self.admin_users = kwargs.get( "admin_users", "" )
self.admin_users_list = [u.strip() for u in self.admin_users.split(',') if u]
- self.reset_password_length = int( kwargs.get('reset_password_length', '15') )
self.mailing_join_addr = kwargs.get('mailing_join_addr', 'galaxy-announce-join(a)bx.psu.edu')
self.error_email_to = kwargs.get( 'error_email_to', None )
self.activation_email = kwargs.get( 'activation_email', None )
diff -r 1ecb6aaebaf4247a7c71b77cb9a74f63dc937cff -r 4a8a610a97e1762b8ae78280566a23c11676bce9 lib/galaxy/dataset_collections/registry.py
--- a/lib/galaxy/dataset_collections/registry.py
+++ b/lib/galaxy/dataset_collections/registry.py
@@ -1,6 +1,6 @@
from .types import list
from .types import paired
-
+from galaxy import model
PLUGIN_CLASSES = [list.ListDatasetCollectionType, paired.PairedDatasetCollectionType]
@@ -12,3 +12,13 @@
def get( self, plugin_type ):
return self.__plugins[ plugin_type ]
+
+ def prototype( self, plugin_type ):
+ plugin_type_object = self.get( plugin_type )
+ if not hasattr( plugin_type_object, 'prototype_elements' ):
+ raise Exception( "Cannot pre-determine structure for collection of type %s" % plugin_type )
+
+ dataset_collection = model.DatasetCollection()
+ elements = [ e for e in plugin_type_object.prototype_elements() ]
+ dataset_collection.elements = elements
+ return dataset_collection
diff -r 1ecb6aaebaf4247a7c71b77cb9a74f63dc937cff -r 4a8a610a97e1762b8ae78280566a23c11676bce9 lib/galaxy/dataset_collections/types/paired.py
--- a/lib/galaxy/dataset_collections/types/paired.py
+++ b/lib/galaxy/dataset_collections/types/paired.py
@@ -1,6 +1,6 @@
from ..types import BaseDatasetCollectionType
-from galaxy.model import DatasetCollectionElement
+from galaxy.model import DatasetCollectionElement, HistoryDatasetAssociation
FORWARD_IDENTIFIER = "forward"
REVERSE_IDENTIFIER = "reverse"
@@ -32,3 +32,15 @@
)
yield left_association
yield right_association
+
+ def prototype_elements( self ):
+ left_association = DatasetCollectionElement(
+ element=HistoryDatasetAssociation(),
+ element_identifier=FORWARD_IDENTIFIER,
+ )
+ right_association = DatasetCollectionElement(
+ element=HistoryDatasetAssociation(),
+ element_identifier=REVERSE_IDENTIFIER,
+ )
+ yield left_association
+ yield right_association
diff -r 1ecb6aaebaf4247a7c71b77cb9a74f63dc937cff -r 4a8a610a97e1762b8ae78280566a23c11676bce9 lib/galaxy/datatypes/metadata.py
--- a/lib/galaxy/datatypes/metadata.py
+++ b/lib/galaxy/datatypes/metadata.py
@@ -20,6 +20,7 @@
import galaxy.model
from galaxy.util import listify
+from galaxy.util.object_wrapper import sanitize_lists_to_string
from galaxy.util import stringify_dictionary_keys
from galaxy.util import string_as_bool
from galaxy.util import in_directory
@@ -232,6 +233,9 @@
def to_string( self, value ):
return str( value )
+ def to_safe_string( self, value ):
+ return sanitize_lists_to_string( self.to_string( value ) )
+
def make_copy( self, value, target_context = None, source_context = None ):
return copy.deepcopy( value )
@@ -480,6 +484,10 @@
def to_string( self, value ):
return json.dumps( value )
+ def to_safe_string( self, value ):
+ # We do not sanitize json dicts
+ return json.safe_dumps( value )
+
class PythonObjectParameter( MetadataParameter ):
@@ -510,6 +518,10 @@
return str( self.spec.no_value )
return value.file_name
+ def to_safe_string( self, value ):
+ # We do not sanitize file names
+ return self.to_string( value )
+
def get_html_field( self, value=None, context=None, other_values=None, **kwd ):
context = context or {}
other_values = other_values or {}
diff -r 1ecb6aaebaf4247a7c71b77cb9a74f63dc937cff -r 4a8a610a97e1762b8ae78280566a23c11676bce9 lib/galaxy/datatypes/sequence.py
--- a/lib/galaxy/datatypes/sequence.py
+++ b/lib/galaxy/datatypes/sequence.py
@@ -17,7 +17,7 @@
from galaxy.datatypes.checkers import is_gzip
from galaxy.datatypes.sniff import get_test_fname, get_headers
from galaxy.datatypes.metadata import MetadataElement
-
+from galaxy.datatypes.util.image_util import check_image_type
try:
eggs.require( "bx-python" )
@@ -814,3 +814,34 @@
except:
return False
+
+class RNADotPlotMatrix( data.Data ):
+ file_ext = "rna_eps"
+
+ def set_peek( self, dataset, is_multi_byte=False ):
+ if not dataset.dataset.purged:
+ dataset.peek = 'RNA Dot Plot format (Postscript derivative)'
+ dataset.blurb = data.nice_size( dataset.get_size() )
+ else:
+ dataset.peek = 'file does not exist'
+ dataset.blurb = 'file purged from disk'
+
+ def sniff(self, filename):
+ """Determine if the file is in RNA dot plot format."""
+ if check_image_type( filename, ['EPS'] ):
+ seq = False
+ coor = False
+ pairs = False
+ with open( filename ) as handle:
+ for line in handle:
+ line = line.strip()
+ if line:
+ if line.startswith('/sequence'):
+ seq = True
+ elif line.startswith('/coor'):
+ coor = True
+ elif line.startswith('/pairs'):
+ pairs = True
+ if seq and coor and pairs:
+ return True
+ return False
\ No newline at end of file
diff -r 1ecb6aaebaf4247a7c71b77cb9a74f63dc937cff -r 4a8a610a97e1762b8ae78280566a23c11676bce9 lib/galaxy/datatypes/util/image_util.py
--- a/lib/galaxy/datatypes/util/image_util.py
+++ b/lib/galaxy/datatypes/util/image_util.py
@@ -71,6 +71,4 @@
return 'pbm'
if format == 'PGM':
return 'pgm'
- if format == 'EPS':
- return 'eps'
return None
diff -r 1ecb6aaebaf4247a7c71b77cb9a74f63dc937cff -r 4a8a610a97e1762b8ae78280566a23c11676bce9 lib/galaxy/jobs/__init__.py
--- a/lib/galaxy/jobs/__init__.py
+++ b/lib/galaxy/jobs/__init__.py
@@ -1202,6 +1202,11 @@
out_data = dict( [ ( da.name, da.dataset ) for da in job.output_datasets ] )
inp_data.update( [ ( da.name, da.dataset ) for da in job.input_library_datasets ] )
out_data.update( [ ( da.name, da.dataset ) for da in job.output_library_datasets ] )
+
+ # TODO: eliminate overlap with tools/evaluation.py
+ out_collections = dict( [ ( obj.name, obj.dataset_collection_instance ) for obj in job.output_dataset_collection_instances ] )
+ out_collections.update( [ ( obj.name, obj.dataset_collection ) for obj in job.output_dataset_collections ] )
+
input_ext = 'data'
for _, data in inp_data.items():
# For loop odd, but sort simulating behavior in galaxy.tools.actions
@@ -1218,6 +1223,12 @@
'children': self.tool.collect_child_datasets(out_data, self.working_directory),
'primary': self.tool.collect_primary_datasets(out_data, self.working_directory, input_ext)
}
+ self.tool.collect_dynamic_collections(
+ out_collections,
+ job_working_directory=self.working_directory,
+ inp_data=inp_data,
+ job=job,
+ )
param_dict.update({'__collected_datasets__': collected_datasets})
# Certain tools require tasks to be completed after job execution
# ( this used to be performed in the "exec_after_process" hook, but hooks are deprecated ).
diff -r 1ecb6aaebaf4247a7c71b77cb9a74f63dc937cff -r 4a8a610a97e1762b8ae78280566a23c11676bce9 lib/galaxy/jobs/runners/__init__.py
--- a/lib/galaxy/jobs/runners/__init__.py
+++ b/lib/galaxy/jobs/runners/__init__.py
@@ -216,7 +216,7 @@
job_tool = job_wrapper.tool
for (joda, dataset) in self._walk_dataset_outputs( job ):
if joda and job_tool:
- hda_tool_output = job_tool.outputs.get( joda.name, None )
+ hda_tool_output = job_tool.find_output_def( joda.name )
if hda_tool_output and hda_tool_output.from_work_dir:
# Copy from working dir to HDA.
# TODO: move instead of copy to save time?
diff -r 1ecb6aaebaf4247a7c71b77cb9a74f63dc937cff -r 4a8a610a97e1762b8ae78280566a23c11676bce9 lib/galaxy/managers/collections.py
--- a/lib/galaxy/managers/collections.py
+++ b/lib/galaxy/managers/collections.py
@@ -28,6 +28,7 @@
Abstraction for interfacing with dataset collections instance - ideally abstarcts
out model and plugin details.
"""
+ ELEMENTS_UNINITIALIZED = object()
def __init__( self, app ):
self.type_registry = DatasetCollectionTypesRegistry( app )
@@ -72,7 +73,11 @@
for input_name, input_collection in implicit_collection_info[ "implicit_inputs" ]:
dataset_collection_instance.add_implicit_input_collection( input_name, input_collection )
for output_dataset in implicit_collection_info.get( "outputs" ):
- output_dataset.hidden_beneath_collection_instance = dataset_collection_instance
+ if isinstance( output_dataset, model.HistoryDatasetCollectionAssociation ):
+ dataset_collection_instance.add_implicit_input_collection( input_name, input_collection )
+ else:
+ # dataset collection, don't need to do anything...
+ pass
trans.sa_session.add( output_dataset )
dataset_collection_instance.implicit_output_name = implicit_collection_info[ "implicit_output_name" ]
@@ -92,6 +97,18 @@
return self.__persist( dataset_collection_instance )
+ def create_dataset_collection(
+ self,
+ trans,
+ collection_type,
+ elements=None,
+ ):
+ return self.__create_dataset_collection(
+ trans=trans,
+ collection_type=collection_type,
+ elements=elements,
+ )
+
def __create_dataset_collection(
self,
trans,
@@ -113,9 +130,24 @@
elements = self.__load_elements( trans, element_identifiers )
# else if elements is set, it better be an ordered dict!
+ if elements is not self.ELEMENTS_UNINITIALIZED:
+ type_plugin = collection_type_description.rank_type_plugin()
+ dataset_collection = builder.build_collection( type_plugin, elements )
+ else:
+ dataset_collection = model.DatasetCollection( populated=False )
+ dataset_collection.collection_type = collection_type
+ return dataset_collection
+
+ def set_collection_elements( self, dataset_collection, dataset_instances ):
+ if dataset_collection.populated:
+ raise Exception("Cannot reset elements of an already populated dataset collection.")
+
+ collection_type = dataset_collection.collection_type
+ collection_type_description = self.collection_type_descriptions.for_collection_type( collection_type )
type_plugin = collection_type_description.rank_type_plugin()
- dataset_collection = builder.build_collection( type_plugin, elements )
- dataset_collection.collection_type = collection_type
+ builder.set_collection_elements( dataset_collection, type_plugin, dataset_instances )
+ dataset_collection.mark_as_populated()
+
return dataset_collection
def delete( self, trans, instance_type, id ):
diff -r 1ecb6aaebaf4247a7c71b77cb9a74f63dc937cff -r 4a8a610a97e1762b8ae78280566a23c11676bce9 lib/galaxy/managers/collections_util.py
--- a/lib/galaxy/managers/collections_util.py
+++ b/lib/galaxy/managers/collections_util.py
@@ -77,7 +77,9 @@
# TODO: Work in progress - this end-point is not right yet...
dict_value[ 'url' ] = web.url_for( 'library_content', library_id=encoded_library_id, id=encoded_id, folder_id=encoded_folder_id )
if view == "element":
- dict_value[ 'elements' ] = map( dictify_element, dataset_colleciton_instance.collection.elements )
+ collection = dataset_colleciton_instance.collection
+ dict_value[ 'elements' ] = map( dictify_element, collection.elements )
+ dict_value[ 'populated' ] = collection.populated
security.encode_all_ids( dict_value, recursive=True ) # TODO: Use Kyle's recusrive formulation of this.
return dict_value
@@ -87,7 +89,9 @@
object_detials = element.element_object.to_dict()
if element.child_collection:
# Recursively yield elements for each nested collection...
- object_detials[ "elements" ] = map( dictify_element, element.child_collection.elements )
+ child_collection = element.child_collection
+ object_detials[ "elements" ] = map( dictify_element, child_collection.elements )
+ object_detials[ "populated" ] = child_collection.populated
dictified[ "object" ] = object_detials
return dictified
diff -r 1ecb6aaebaf4247a7c71b77cb9a74f63dc937cff -r 4a8a610a97e1762b8ae78280566a23c11676bce9 lib/galaxy/model/__init__.py
--- a/lib/galaxy/model/__init__.py
+++ b/lib/galaxy/model/__init__.py
@@ -18,6 +18,7 @@
import socket
import time
import numbers
+from datetime import datetime, timedelta
from uuid import UUID, uuid4
from string import Template
from itertools import ifilter
@@ -31,7 +32,7 @@
import galaxy.model.orm.now
from galaxy.security import get_permitted_actions
from galaxy.util import is_multi_byte, nice_size, Params, restore_text, send_mail
-from galaxy.util import ready_name_for_url
+from galaxy.util import ready_name_for_url, unique_id
from galaxy.util.bunch import Bunch
from galaxy.util.hash_util import new_secure_hash
from galaxy.util.directory_hash import directory_hash_id
@@ -261,6 +262,14 @@
environment = User.user_template_environment( user )
return Template( in_string ).safe_substitute( environment )
+class PasswordResetToken( object ):
+ def __init__( self, user, token=None):
+ if token:
+ self.token = token
+ else:
+ self.token = unique_id()
+ self.user = user
+ self.expiration_time = datetime.now() + timedelta(hours=24)
class BaseJobMetric( object ):
@@ -320,6 +329,7 @@
self.input_datasets = []
self.output_datasets = []
self.input_dataset_collections = []
+ self.output_dataset_collection_instances = []
self.output_dataset_collections = []
self.input_library_datasets = []
self.output_library_datasets = []
@@ -463,8 +473,10 @@
self.output_datasets.append( JobToOutputDatasetAssociation( name, dataset ) )
def add_input_dataset_collection( self, name, dataset ):
self.input_dataset_collections.append( JobToInputDatasetCollectionAssociation( name, dataset ) )
- def add_output_dataset_collection( self, name, dataset ):
- self.output_dataset_collections.append( JobToOutputDatasetCollectionAssociation( name, dataset ) )
+ def add_output_dataset_collection( self, name, dataset_collection_instance ):
+ self.output_dataset_collection_instances.append( JobToOutputDatasetCollectionAssociation( name, dataset_collection_instance ) )
+ def add_implicit_output_dataset_collection( self, name, dataset_collection ):
+ self.output_dataset_collections.append( JobToImplicitOutputDatasetCollectionAssociation( name, dataset_collection ) )
def add_input_library_dataset( self, name, dataset ):
self.input_library_datasets.append( JobToInputLibraryDatasetAssociation( name, dataset ) )
def add_output_library_dataset( self, name, dataset ):
@@ -725,7 +737,18 @@
self.dataset = dataset
+# Many jobs may map to one HistoryDatasetCollection using these for a given
+# tool output (if mapping over an input collection).
class JobToOutputDatasetCollectionAssociation( object ):
+ def __init__( self, name, dataset_collection_instance ):
+ self.name = name
+ self.dataset_collection_instance = dataset_collection_instance
+
+
+# A DatasetCollection will be mapped to at most one job per tool output
+# using these. (You can think of many of these models as going into the
+# creation of a JobToOutputDatasetCollectionAssociation.)
+class JobToImplicitOutputDatasetCollectionAssociation( object ):
def __init__( self, name, dataset_collection ):
self.name = name
self.dataset_collection = dataset_collection
@@ -2653,14 +2676,37 @@
"""
dict_collection_visible_keys = ( 'id', 'collection_type' )
dict_element_visible_keys = ( 'id', 'collection_type' )
+ populated_states = Bunch(
+ NEW='new', # New dataset collection, unpopulated elements
+ OK='ok', # Collection elements populated (HDAs may or may not have errors)
+ FAILED='failed', # some problem populating state, won't be populated
+ )
def __init__(
self,
id=None,
collection_type=None,
+ populated=True,
):
self.id = id
self.collection_type = collection_type
+ if not populated:
+ self.populated_state = DatasetCollection.populated_states.NEW
+
+ @property
+ def populated( self ):
+ return self.populated_state == DatasetCollection.populated_states.OK
+
+ @property
+ def waiting_for_elements( self ):
+ return self.populated_state == DatasetCollection.populated_states.NEW
+
+ def mark_as_populated( self ):
+ self.populated_state = DatasetCollection.populated_states.OK
+
+ def handle_population_failed( self, message ):
+ self.populated_state = DatasetCollection.populated_states.FAILED
+ self.populated_state_message = message
@property
def dataset_instances( self ):
diff -r 1ecb6aaebaf4247a7c71b77cb9a74f63dc937cff -r 4a8a610a97e1762b8ae78280566a23c11676bce9 lib/galaxy/model/mapping.py
--- a/lib/galaxy/model/mapping.py
+++ b/lib/galaxy/model/mapping.py
@@ -68,6 +68,11 @@
Column( "provider", TrimmedString( 255 ) ),
)
+model.PasswordResetToken.table = Table("password_reset_token", metadata,
+ Column( "token", String( 32 ), primary_key=True, unique=True, index=True ),
+ Column( "expiration_time", DateTime ),
+ Column( "user_id", Integer, ForeignKey( "galaxy_user.id" ), index=True ) )
+
model.History.table = Table( "history", metadata,
Column( "id", Integer, primary_key=True),
Column( "create_time", DateTime, default=now ),
@@ -443,6 +448,12 @@
Column( "dataset_collection_id", Integer, ForeignKey( "history_dataset_collection_association.id" ), index=True ),
Column( "name", Unicode(255) ) )
+model.JobToImplicitOutputDatasetCollectionAssociation.table = Table( "job_to_implicit_output_dataset_collection", metadata,
+ Column( "id", Integer, primary_key=True ),
+ Column( "job_id", Integer, ForeignKey( "job.id" ), index=True ),
+ Column( "dataset_collection_id", Integer, ForeignKey( "dataset_collection.id" ), index=True ),
+ Column( "name", Unicode(255) ) )
+
model.JobToOutputDatasetCollectionAssociation.table = Table( "job_to_output_dataset_collection", metadata,
Column( "id", Integer, primary_key=True ),
Column( "job_id", Integer, ForeignKey( "job.id" ), index=True ),
@@ -610,6 +621,8 @@
model.DatasetCollection.table = Table( "dataset_collection", metadata,
Column( "id", Integer, primary_key=True ),
Column( "collection_type", Unicode(255), nullable=False ),
+ Column( "populated_state", TrimmedString( 64 ), default='ok', nullable=False ),
+ Column( "populated_state_message", TEXT ),
Column( "create_time", DateTime, default=now ),
Column( "update_time", DateTime, default=now, onupdate=now ),
)
@@ -1564,6 +1577,10 @@
api_keys=relation( model.APIKeys, backref="user", order_by=desc( model.APIKeys.table.c.create_time ) ),
) )
+mapper( model.PasswordResetToken, model.PasswordResetToken.table,
+ properties=dict( user=relation( model.User, backref="reset_tokens") ) )
+
+
# Set up proxy so that this syntax is possible:
# <user_obj>.preferences[pref_name] = pref_value
model.User.preferences = association_proxy('_preferences', 'value', creator=model.UserPreference)
@@ -1800,8 +1817,13 @@
mapper( model.JobToOutputDatasetCollectionAssociation,
model.JobToOutputDatasetCollectionAssociation.table, properties=dict(
+ job=relation( model.Job ), dataset_collection_instance=relation(
+ model.HistoryDatasetCollectionAssociation, lazy=False, backref="output_dataset_collection_instances" ) ) )
+
+mapper( model.JobToImplicitOutputDatasetCollectionAssociation,
+ model.JobToImplicitOutputDatasetCollectionAssociation.table, properties=dict(
job=relation( model.Job ), dataset_collection=relation(
- model.HistoryDatasetCollectionAssociation, lazy=False ) ) )
+ model.DatasetCollection, backref="output_dataset_collections" ) ) )
mapper( model.JobToInputLibraryDatasetAssociation,
model.JobToInputLibraryDatasetAssociation.table, properties=dict(
@@ -1886,6 +1908,8 @@
parameters=relation( model.JobParameter, lazy=False ),
input_datasets=relation( model.JobToInputDatasetAssociation ),
output_datasets=relation( model.JobToOutputDatasetAssociation ),
+ output_dataset_collection_instances=relation( model.JobToOutputDatasetCollectionAssociation ),
+ output_dataset_collections=relation( model.JobToImplicitOutputDatasetCollectionAssociation ),
post_job_actions=relation( model.PostJobActionAssociation, lazy=False ),
input_library_datasets=relation( model.JobToInputLibraryDatasetAssociation ),
output_library_datasets=relation( model.JobToOutputLibraryDatasetAssociation ),
diff -r 1ecb6aaebaf4247a7c71b77cb9a74f63dc937cff -r 4a8a610a97e1762b8ae78280566a23c11676bce9 lib/galaxy/model/migrate/versions/0126_password_reset.py
--- /dev/null
+++ b/lib/galaxy/model/migrate/versions/0126_password_reset.py
@@ -0,0 +1,43 @@
+"""
+Migration script for the password reset table
+"""
+
+from sqlalchemy import *
+from sqlalchemy.orm import *
+from migrate import *
+from migrate.changeset import *
+from galaxy.model.custom_types import *
+
+import datetime
+now = datetime.datetime.utcnow
+
+import logging
+log = logging.getLogger( __name__ )
+
+metadata = MetaData()
+
+PasswordResetToken_table = Table("password_reset_token", metadata,
+ Column( "token", String( 32 ), primary_key=True, unique=True, index=True ),
+ Column( "expiration_time", DateTime ),
+ Column( "user_id", Integer, ForeignKey( "galaxy_user.id" ), index=True ))
+
+
+def upgrade(migrate_engine):
+ metadata.bind = migrate_engine
+ print __doc__
+ metadata.reflect()
+ try:
+ PasswordResetToken_table.create()
+ except Exception as e:
+ print str(e)
+ log.exception("Creating %s table failed: %s" % (PasswordResetToken_table.name, str( e ) ) )
+
+
+def downgrade(migrate_engine):
+ metadata.bind = migrate_engine
+ metadata.reflect()
+ try:
+ PasswordResetToken_table.drop()
+ except Exception as e:
+ print str(e)
+ log.exception("Dropping %s table failed: %s" % (PasswordResetToken_table.name, str( e ) ) )
diff -r 1ecb6aaebaf4247a7c71b77cb9a74f63dc937cff -r 4a8a610a97e1762b8ae78280566a23c11676bce9 lib/galaxy/model/migrate/versions/0127_output_collection_adjustments.py
--- /dev/null
+++ b/lib/galaxy/model/migrate/versions/0127_output_collection_adjustments.py
@@ -0,0 +1,85 @@
+"""
+Migration script updating collections tables for output collections.
+"""
+
+from sqlalchemy import *
+from sqlalchemy.orm import *
+from migrate import *
+from migrate.changeset import *
+from galaxy.model.custom_types import *
+
+import datetime
+now = datetime.datetime.utcnow
+
+import logging
+log = logging.getLogger( __name__ )
+
+metadata = MetaData()
+
+JobToImplicitOutputDatasetCollectionAssociation_table = Table(
+ "job_to_implicit_output_dataset_collection", metadata,
+ Column( "id", Integer, primary_key=True ),
+ Column( "job_id", Integer, ForeignKey( "job.id" ), index=True ),
+ Column( "dataset_collection_id", Integer, ForeignKey( "dataset_collection.id" ), index=True ),
+ Column( "name", Unicode(255) )
+)
+
+
+TABLES = [
+ JobToImplicitOutputDatasetCollectionAssociation_table,
+]
+
+
+def upgrade(migrate_engine):
+ metadata.bind = migrate_engine
+ print __doc__
+ metadata.reflect()
+
+ for table in TABLES:
+ __create(table)
+
+ try:
+ dataset_collection_table = Table( "dataset_collection", metadata, autoload=True )
+ # need server_default because column in non-null
+ populated_state_column = Column( 'populated_state', TrimmedString( 64 ), default='ok', server_default="ok", nullable=False )
+ populated_state_column.create( dataset_collection_table )
+
+ populated_message_column = Column( 'populated_state_message', TEXT, nullable=True )
+ populated_message_column.create( dataset_collection_table )
+ except Exception as e:
+ print str(e)
+ log.exception( "Creating dataset collection populated column failed." )
+
+
+def downgrade(migrate_engine):
+ metadata.bind = migrate_engine
+ metadata.reflect()
+
+ for table in TABLES:
+ __drop(table)
+
+ try:
+ dataset_collection_table = Table( "dataset_collection", metadata, autoload=True )
+ populated_state_column = dataset_collection_table.c.populated_state
+ populated_state_column.drop()
+ populated_message_column = dataset_collection_table.c.populated_state_message
+ populated_message_column.drop()
+ except Exception as e:
+ print str(e)
+ log.exception( "Dropping dataset collection populated_state/ column failed." )
+
+
+def __create(table):
+ try:
+ table.create()
+ except Exception as e:
+ print str(e)
+ log.exception("Creating %s table failed: %s" % (table.name, str( e ) ) )
+
+
+def __drop(table):
+ try:
+ table.drop()
+ except Exception as e:
+ print str(e)
+ log.exception("Dropping %s table failed: %s" % (table.name, str( e ) ) )
This diff is so big that we needed to truncate the remainder.
https://bitbucket.org/galaxy/galaxy-central/commits/4366bbe56e0a/
Changeset: 4366bbe56e0a
Branch: compressed_upload
User: BjoernGruening
Date: 2015-01-16 22:38:41+00:00
Summary: add back RNADotPlotMatrix sniffing
Affected #: 1 file
diff -r 4a8a610a97e1762b8ae78280566a23c11676bce9 -r 4366bbe56e0a6c53f621cdf2ff049d65d5c7502a config/datatypes_conf.xml.sample
--- a/config/datatypes_conf.xml.sample
+++ b/config/datatypes_conf.xml.sample
@@ -307,6 +307,7 @@
<sniffer type="galaxy.datatypes.text:Arff"/><sniffer type="galaxy.datatypes.text:Ipynb"/><sniffer type="galaxy.datatypes.text:Json"/>
+ <sniffer type="galaxy.datatypes.sequence:RNADotPlotMatrix"/><sniffer type="galaxy.datatypes.images:Jpg"/><sniffer type="galaxy.datatypes.images:Png"/><sniffer type="galaxy.datatypes.images:Tiff"/>
https://bitbucket.org/galaxy/galaxy-central/commits/9ef517d8e767/
Changeset: 9ef517d8e767
User: jmchilton
Date: 2015-01-23 19:13:25+00:00
Summary: Merged in BjoernGruening/galaxy-central-1/compressed_upload (pull request #630)
Add CompressedArchive as datatype and do not uncomress it during upload.
Affected #: 3 files
diff -r a6855d0b02d70cd35ae312f48bd704590805ca15 -r 9ef517d8e767037e1633f6063c6edb3023f86499 config/datatypes_conf.xml.sample
--- a/config/datatypes_conf.xml.sample
+++ b/config/datatypes_conf.xml.sample
@@ -141,6 +141,8 @@
<datatype extension="pbm" type="galaxy.datatypes.images:Pbm" mimetype="image/pbm"/><datatype extension="pgm" type="galaxy.datatypes.images:Pgm" mimetype="image/pgm"/><datatype extension="rna_eps" type="galaxy.datatypes.sequence:RNADotPlotMatrix" mimetype="image/eps" display_in_upload="True"/>
+ <datatype extension="searchgui_archive" type="galaxy.datatypes.binary:CompressedArchive" subclass="True" display_in_upload="True"/>
+ <datatype extension="peptideshaker_archive" type="galaxy.datatypes.binary:CompressedArchive" subclass="True" display_in_upload="True"/><datatype extension="eps" type="galaxy.datatypes.images:Eps" mimetype="image/eps"/><datatype extension="rast" type="galaxy.datatypes.images:Rast" mimetype="image/rast"/><datatype extension="laj" type="galaxy.datatypes.images:Laj"/>
diff -r a6855d0b02d70cd35ae312f48bd704590805ca15 -r 9ef517d8e767037e1633f6063c6edb3023f86499 lib/galaxy/datatypes/binary.py
--- a/lib/galaxy/datatypes/binary.py
+++ b/lib/galaxy/datatypes/binary.py
@@ -106,6 +106,30 @@
Binary.register_unsniffable_binary_ext("ab1")
+class CompressedArchive( Binary ):
+ """
+ Class describing an compressed binary file
+ This class can be sublass'ed to implement archive filetypes that will not be unpacked by upload.py.
+ """
+ file_ext = "compressed_archive"
+ compressed = True
+
+ def set_peek( self, dataset, is_multi_byte=False ):
+ if not dataset.dataset.purged:
+ dataset.peek = "Compressed binary file"
+ dataset.blurb = data.nice_size( dataset.get_size() )
+ else:
+ dataset.peek = 'file does not exist'
+ dataset.blurb = 'file purged from disk'
+
+ def display_peek( self, dataset ):
+ try:
+ return dataset.peek
+ except:
+ return "Compressed binary file (%s)" % ( data.nice_size( dataset.get_size() ) )
+
+Binary.register_unsniffable_binary_ext("compressed_archive")
+
class GenericAsn1Binary( Binary ):
"""Class for generic ASN.1 binary format"""
diff -r a6855d0b02d70cd35ae312f48bd704590805ca15 -r 9ef517d8e767037e1633f6063c6edb3023f86499 tools/data_source/upload.py
--- a/tools/data_source/upload.py
+++ b/tools/data_source/upload.py
@@ -120,171 +120,176 @@
data_type = type_info[0]
ext = type_info[1]
if not data_type:
- # See if we have a gzipped file, which, if it passes our restrictions, we'll uncompress
- is_gzipped, is_valid = check_gzip( dataset.path )
- if is_gzipped and not is_valid:
- file_err( 'The gzipped uploaded file contains inappropriate content', dataset, json_file )
- return
- elif is_gzipped and is_valid:
- if link_data_only == 'copy_files':
- # We need to uncompress the temp_name file, but BAM files must remain compressed in the BGZF format
- CHUNK_SIZE = 2**20 # 1Mb
- fd, uncompressed = tempfile.mkstemp( prefix='data_id_%s_upload_gunzip_' % dataset.dataset_id, dir=os.path.dirname( output_path ), text=False )
- gzipped_file = gzip.GzipFile( dataset.path, 'rb' )
- while 1:
- try:
- chunk = gzipped_file.read( CHUNK_SIZE )
- except IOError:
- os.close( fd )
- os.remove( uncompressed )
- file_err( 'Problem decompressing gzipped data', dataset, json_file )
- return
- if not chunk:
- break
- os.write( fd, chunk )
- os.close( fd )
- gzipped_file.close()
- # Replace the gzipped file with the decompressed file if it's safe to do so
- if dataset.type in ( 'server_dir', 'path_paste' ) or not in_place:
- dataset.path = uncompressed
- else:
- shutil.move( uncompressed, dataset.path )
- os.chmod(dataset.path, 0644)
- dataset.name = dataset.name.rstrip( '.gz' )
- data_type = 'gzip'
- if not data_type and bz2 is not None:
- # See if we have a bz2 file, much like gzip
- is_bzipped, is_valid = check_bz2( dataset.path )
- if is_bzipped and not is_valid:
+ root_datatype = registry.get_datatype_by_extension( dataset.file_type )
+ if getattr( root_datatype, 'compressed', False ):
+ data_type = 'compressed archive'
+ ext = dataset.file_type
+ else:
+ # See if we have a gzipped file, which, if it passes our restrictions, we'll uncompress
+ is_gzipped, is_valid = check_gzip( dataset.path )
+ if is_gzipped and not is_valid:
file_err( 'The gzipped uploaded file contains inappropriate content', dataset, json_file )
return
- elif is_bzipped and is_valid:
+ elif is_gzipped and is_valid:
if link_data_only == 'copy_files':
- # We need to uncompress the temp_name file
+ # We need to uncompress the temp_name file, but BAM files must remain compressed in the BGZF format
CHUNK_SIZE = 2**20 # 1Mb
- fd, uncompressed = tempfile.mkstemp( prefix='data_id_%s_upload_bunzip2_' % dataset.dataset_id, dir=os.path.dirname( output_path ), text=False )
- bzipped_file = bz2.BZ2File( dataset.path, 'rb' )
+ fd, uncompressed = tempfile.mkstemp( prefix='data_id_%s_upload_gunzip_' % dataset.dataset_id, dir=os.path.dirname( output_path ), text=False )
+ gzipped_file = gzip.GzipFile( dataset.path, 'rb' )
while 1:
try:
- chunk = bzipped_file.read( CHUNK_SIZE )
+ chunk = gzipped_file.read( CHUNK_SIZE )
except IOError:
os.close( fd )
os.remove( uncompressed )
- file_err( 'Problem decompressing bz2 compressed data', dataset, json_file )
+ file_err( 'Problem decompressing gzipped data', dataset, json_file )
return
if not chunk:
break
os.write( fd, chunk )
os.close( fd )
- bzipped_file.close()
- # Replace the bzipped file with the decompressed file if it's safe to do so
+ gzipped_file.close()
+ # Replace the gzipped file with the decompressed file if it's safe to do so
if dataset.type in ( 'server_dir', 'path_paste' ) or not in_place:
dataset.path = uncompressed
else:
shutil.move( uncompressed, dataset.path )
os.chmod(dataset.path, 0644)
- dataset.name = dataset.name.rstrip( '.bz2' )
- data_type = 'bz2'
- if not data_type:
- # See if we have a zip archive
- is_zipped = check_zip( dataset.path )
- if is_zipped:
- if link_data_only == 'copy_files':
- CHUNK_SIZE = 2**20 # 1Mb
- uncompressed = None
- uncompressed_name = None
- unzipped = False
- z = zipfile.ZipFile( dataset.path )
- for name in z.namelist():
- if name.endswith('/'):
- continue
- if unzipped:
- stdout = 'ZIP file contained more than one file, only the first file was added to Galaxy.'
- break
- fd, uncompressed = tempfile.mkstemp( prefix='data_id_%s_upload_zip_' % dataset.dataset_id, dir=os.path.dirname( output_path ), text=False )
- if sys.version_info[:2] >= ( 2, 6 ):
- zipped_file = z.open( name )
- while 1:
+ dataset.name = dataset.name.rstrip( '.gz' )
+ data_type = 'gzip'
+ if not data_type and bz2 is not None:
+ # See if we have a bz2 file, much like gzip
+ is_bzipped, is_valid = check_bz2( dataset.path )
+ if is_bzipped and not is_valid:
+ file_err( 'The gzipped uploaded file contains inappropriate content', dataset, json_file )
+ return
+ elif is_bzipped and is_valid:
+ if link_data_only == 'copy_files':
+ # We need to uncompress the temp_name file
+ CHUNK_SIZE = 2**20 # 1Mb
+ fd, uncompressed = tempfile.mkstemp( prefix='data_id_%s_upload_bunzip2_' % dataset.dataset_id, dir=os.path.dirname( output_path ), text=False )
+ bzipped_file = bz2.BZ2File( dataset.path, 'rb' )
+ while 1:
+ try:
+ chunk = bzipped_file.read( CHUNK_SIZE )
+ except IOError:
+ os.close( fd )
+ os.remove( uncompressed )
+ file_err( 'Problem decompressing bz2 compressed data', dataset, json_file )
+ return
+ if not chunk:
+ break
+ os.write( fd, chunk )
+ os.close( fd )
+ bzipped_file.close()
+ # Replace the bzipped file with the decompressed file if it's safe to do so
+ if dataset.type in ( 'server_dir', 'path_paste' ) or not in_place:
+ dataset.path = uncompressed
+ else:
+ shutil.move( uncompressed, dataset.path )
+ os.chmod(dataset.path, 0644)
+ dataset.name = dataset.name.rstrip( '.bz2' )
+ data_type = 'bz2'
+ if not data_type:
+ # See if we have a zip archive
+ is_zipped = check_zip( dataset.path )
+ if is_zipped:
+ if link_data_only == 'copy_files':
+ CHUNK_SIZE = 2**20 # 1Mb
+ uncompressed = None
+ uncompressed_name = None
+ unzipped = False
+ z = zipfile.ZipFile( dataset.path )
+ for name in z.namelist():
+ if name.endswith('/'):
+ continue
+ if unzipped:
+ stdout = 'ZIP file contained more than one file, only the first file was added to Galaxy.'
+ break
+ fd, uncompressed = tempfile.mkstemp( prefix='data_id_%s_upload_zip_' % dataset.dataset_id, dir=os.path.dirname( output_path ), text=False )
+ if sys.version_info[:2] >= ( 2, 6 ):
+ zipped_file = z.open( name )
+ while 1:
+ try:
+ chunk = zipped_file.read( CHUNK_SIZE )
+ except IOError:
+ os.close( fd )
+ os.remove( uncompressed )
+ file_err( 'Problem decompressing zipped data', dataset, json_file )
+ return
+ if not chunk:
+ break
+ os.write( fd, chunk )
+ os.close( fd )
+ zipped_file.close()
+ uncompressed_name = name
+ unzipped = True
+ else:
+ # python < 2.5 doesn't have a way to read members in chunks(!)
try:
- chunk = zipped_file.read( CHUNK_SIZE )
+ outfile = open( uncompressed, 'wb' )
+ outfile.write( z.read( name ) )
+ outfile.close()
+ uncompressed_name = name
+ unzipped = True
except IOError:
os.close( fd )
os.remove( uncompressed )
file_err( 'Problem decompressing zipped data', dataset, json_file )
return
- if not chunk:
- break
- os.write( fd, chunk )
- os.close( fd )
- zipped_file.close()
- uncompressed_name = name
- unzipped = True
+ z.close()
+ # Replace the zipped file with the decompressed file if it's safe to do so
+ if uncompressed is not None:
+ if dataset.type in ( 'server_dir', 'path_paste' ) or not in_place:
+ dataset.path = uncompressed
+ else:
+ shutil.move( uncompressed, dataset.path )
+ os.chmod(dataset.path, 0644)
+ dataset.name = uncompressed_name
+ data_type = 'zip'
+ if not data_type:
+ # TODO refactor this logic. check_binary isn't guaranteed to be
+ # correct since it only looks at whether the first 100 chars are
+ # printable or not. If someone specifies a known unsniffable
+ # binary datatype and check_binary fails, the file gets mangled.
+ if check_binary( dataset.path ) or Binary.is_ext_unsniffable(dataset.file_type):
+ # We have a binary dataset, but it is not Bam, Sff or Pdf
+ data_type = 'binary'
+ #binary_ok = False
+ parts = dataset.name.split( "." )
+ if len( parts ) > 1:
+ ext = parts[-1].strip().lower()
+ if not Binary.is_ext_unsniffable(ext):
+ file_err( 'The uploaded binary file contains inappropriate content', dataset, json_file )
+ return
+ elif Binary.is_ext_unsniffable(ext) and dataset.file_type != ext:
+ err_msg = "You must manually set the 'File Format' to '%s' when uploading %s files." % ( ext.capitalize(), ext )
+ file_err( err_msg, dataset, json_file )
+ return
+ if not data_type:
+ # We must have a text file
+ if check_html( dataset.path ):
+ file_err( 'The uploaded file contains inappropriate HTML content', dataset, json_file )
+ return
+ if data_type != 'binary':
+ if link_data_only == 'copy_files':
+ if dataset.type in ( 'server_dir', 'path_paste' ) and data_type not in [ 'gzip', 'bz2', 'zip' ]:
+ in_place = False
+ # Convert universal line endings to Posix line endings, but allow the user to turn it off,
+ # so that is becomes possible to upload gzip, bz2 or zip files with binary data without
+ # corrupting the content of those files.
+ if dataset.to_posix_lines:
+ tmpdir = output_adjacent_tmpdir( output_path )
+ tmp_prefix = 'data_id_%s_convert_' % dataset.dataset_id
+ if dataset.space_to_tab:
+ line_count, converted_path = sniff.convert_newlines_sep2tabs( dataset.path, in_place=in_place, tmp_dir=tmpdir, tmp_prefix=tmp_prefix )
else:
- # python < 2.5 doesn't have a way to read members in chunks(!)
- try:
- outfile = open( uncompressed, 'wb' )
- outfile.write( z.read( name ) )
- outfile.close()
- uncompressed_name = name
- unzipped = True
- except IOError:
- os.close( fd )
- os.remove( uncompressed )
- file_err( 'Problem decompressing zipped data', dataset, json_file )
- return
- z.close()
- # Replace the zipped file with the decompressed file if it's safe to do so
- if uncompressed is not None:
- if dataset.type in ( 'server_dir', 'path_paste' ) or not in_place:
- dataset.path = uncompressed
- else:
- shutil.move( uncompressed, dataset.path )
- os.chmod(dataset.path, 0644)
- dataset.name = uncompressed_name
- data_type = 'zip'
- if not data_type:
- # TODO refactor this logic. check_binary isn't guaranteed to be
- # correct since it only looks at whether the first 100 chars are
- # printable or not. If someone specifies a known unsniffable
- # binary datatype and check_binary fails, the file gets mangled.
- if check_binary( dataset.path ) or Binary.is_ext_unsniffable(dataset.file_type):
- # We have a binary dataset, but it is not Bam, Sff or Pdf
- data_type = 'binary'
- #binary_ok = False
- parts = dataset.name.split( "." )
- if len( parts ) > 1:
- ext = parts[-1].strip().lower()
- if not Binary.is_ext_unsniffable(ext):
- file_err( 'The uploaded binary file contains inappropriate content', dataset, json_file )
- return
- elif Binary.is_ext_unsniffable(ext) and dataset.file_type != ext:
- err_msg = "You must manually set the 'File Format' to '%s' when uploading %s files." % ( ext.capitalize(), ext )
- file_err( err_msg, dataset, json_file )
- return
- if not data_type:
- # We must have a text file
- if check_html( dataset.path ):
- file_err( 'The uploaded file contains inappropriate HTML content', dataset, json_file )
- return
- if data_type != 'binary':
- if link_data_only == 'copy_files':
- if dataset.type in ( 'server_dir', 'path_paste' ) and data_type not in [ 'gzip', 'bz2', 'zip' ]:
- in_place = False
- # Convert universal line endings to Posix line endings, but allow the user to turn it off,
- # so that is becomes possible to upload gzip, bz2 or zip files with binary data without
- # corrupting the content of those files.
- if dataset.to_posix_lines:
- tmpdir = output_adjacent_tmpdir( output_path )
- tmp_prefix = 'data_id_%s_convert_' % dataset.dataset_id
- if dataset.space_to_tab:
- line_count, converted_path = sniff.convert_newlines_sep2tabs( dataset.path, in_place=in_place, tmp_dir=tmpdir, tmp_prefix=tmp_prefix )
- else:
- line_count, converted_path = sniff.convert_newlines( dataset.path, in_place=in_place, tmp_dir=tmpdir, tmp_prefix=tmp_prefix )
- if dataset.file_type == 'auto':
- ext = sniff.guess_ext( dataset.path, registry.sniff_order )
- else:
- ext = dataset.file_type
- data_type = ext
+ line_count, converted_path = sniff.convert_newlines( dataset.path, in_place=in_place, tmp_dir=tmpdir, tmp_prefix=tmp_prefix )
+ if dataset.file_type == 'auto':
+ ext = sniff.guess_ext( dataset.path, registry.sniff_order )
+ else:
+ ext = dataset.file_type
+ data_type = ext
# Save job info for the framework
if ext == 'auto' and dataset.ext:
ext = dataset.ext
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
commit/galaxy-central: dannon: Remove arbitrary limit of '50' uploads via FTP. If this turns out to be an issue, we can revisit it. This was actually an old bug if you manually selected more than 50 unexpected things would happen without erroring.
by commits-noreply@bitbucket.org 23 Jan '15
by commits-noreply@bitbucket.org 23 Jan '15
23 Jan '15
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/a6855d0b02d7/
Changeset: a6855d0b02d7
User: dannon
Date: 2015-01-23 18:23:15+00:00
Summary: Remove arbitrary limit of '50' uploads via FTP. If this turns out to be an issue, we can revisit it. This was actually an old bug if you manually selected more than 50 unexpected things would happen without erroring.
Affected #: 3 files
diff -r a626b45a14dce92771043ae55e2872b720f15f00 -r a6855d0b02d70cd35ae312f48bd704590805ca15 client/galaxy/scripts/utils/uploadbox.js
--- a/client/galaxy/scripts/utils/uploadbox.js
+++ b/client/galaxy/scripts/utils/uploadbox.js
@@ -12,7 +12,6 @@
url : '',
paramname : 'content',
maxfilesize : 2048,
- maxfilenumber : 50,
dragover : function() {},
dragleave : function() {},
announce : function() {},
@@ -129,9 +128,6 @@
// add files to queue
for (var i = 0; i < files.length; i++)
{
- // check
- if(queue_length >= opts.maxfilenumber)
- break;
// new identifier
var index = String(queue_index++);
diff -r a626b45a14dce92771043ae55e2872b720f15f00 -r a6855d0b02d70cd35ae312f48bd704590805ca15 static/scripts/packed/utils/uploadbox.js
--- a/static/scripts/packed/utils/uploadbox.js
+++ b/static/scripts/packed/utils/uploadbox.js
@@ -1,1 +1,1 @@
-(function(c){jQuery.event.props.push("dataTransfer");var h={url:"",paramname:"content",maxfilesize:2048,maxfilenumber:50,dragover:function(){},dragleave:function(){},announce:function(){},initialize:function(){},progress:function(){},success:function(){},error:function(k,l,m){alert(m)},complete:function(){},error_filesize:"File exceeds 2GB. Please use an FTP client.",error_default:"Please make sure the file is available.",error_server:"Upload request failed.",error_login:"Uploads require you to log in.",error_missing:"No upload content available."};var a={};var e={};var f=0;var j=0;var d=false;var g=false;var b=null;var i=null;c.fn.uploadbox=function(A){a=c.extend({},h,A);b=this;b.append('<input id="uploadbox_input" type="file" style="display: none" multiple>');b.on("drop",o);b.on("dragover",p);b.on("dragleave",x);c("#uploadbox_input").change(function(B){z(B.target.files);c(this).val("")});function o(B){if(!B.dataTransfer){return}z(B.dataTransfer.files);B.preventDefault();return false}function p(B){B.preventDefault();a.dragover.call(B)}function x(B){B.stopPropagation();a.dragleave.call(B)}function k(B){if(B.lengthComputable){a.progress(this.index,this.file,Math.round((B.loaded*100)/B.total))}}function z(D){if(d){return}var E=f;for(var C=0;C<D.length;C++){if(j>=a.maxfilenumber){break}var B=String(f++);e[B]=D[C];a.announce(B,e[B],"");j++}return E}function r(B){if(e[B]){delete e[B];j--}}function m(){if(j==0||g){g=false;d=false;a.complete();return}else{d=true}var D=-1;for(var F in e){D=F;break}var E=e[D];r(D);var C=E.size;var H=E.mode;var B=1048576*a.maxfilesize;if(C<B||E.mode=="ftp"){var G=a.initialize(D,E);if(G){q(D,E,G)}else{u(D,E,a.error_missing)}}else{u(D,E,a.error_filesize)}}function q(B,D,E){var F=new FormData();for(var C in E){F.append(C,E[C])}if(D.size>0&&a.paramname){F.append(a.paramname,D,D.name)}i=new XMLHttpRequest();i.open("POST",a.url,true);i.setRequestHeader("Accept","application/json");i.setRequestHeader("Cache-Control","no-cache");i.setRequestHeader("X-Requested-With","XMLHttpRequest");i.onreadystatechange=function(){if(i.readyState!=i.DONE){return}var G=null;if(i.responseText){try{G=jQuery.parseJSON(i.responseText)}catch(H){G=i.responseText}}if(i.status<200||i.status>299){var I=i.statusText;if(i.status==403){I=a.error_login}else{if(i.status==0){I=a.error_server}else{if(!I){I=a.error_default}}}u(B,D,I+" ("+i.status+")")}else{y(B,D,G)}};i.upload.index=B;i.upload.file=D;i.upload.addEventListener("progress",k,false);i.send(F)}function y(B,C,D){a.success(B,C,D);m()}function u(B,C,D){a.error(B,C,D);m()}function w(){c("#uploadbox_input").trigger("click")}function t(B){for(B in e){r(B)}}function l(){if(!d){d=true;m()}}function v(){g=true}function n(B){a=c.extend({},a,B);return a}function s(){return window.File&&window.FormData&&window.XMLHttpRequest&&window.FileList}return{select:w,add:z,remove:r,start:l,stop:v,reset:t,configure:n,compatible:s}}})(jQuery);
\ No newline at end of file
+(function(c){jQuery.event.props.push("dataTransfer");var h={url:"",paramname:"content",maxfilesize:2048,dragover:function(){},dragleave:function(){},announce:function(){},initialize:function(){},progress:function(){},success:function(){},error:function(k,l,m){alert(m)},complete:function(){},error_filesize:"File exceeds 2GB. Please use an FTP client.",error_default:"Please make sure the file is available.",error_server:"Upload request failed.",error_login:"Uploads require you to log in.",error_missing:"No upload content available."};var a={};var e={};var f=0;var j=0;var d=false;var g=false;var b=null;var i=null;c.fn.uploadbox=function(A){a=c.extend({},h,A);b=this;b.append('<input id="uploadbox_input" type="file" style="display: none" multiple>');b.on("drop",o);b.on("dragover",p);b.on("dragleave",x);c("#uploadbox_input").change(function(B){z(B.target.files);c(this).val("")});function o(B){if(!B.dataTransfer){return}z(B.dataTransfer.files);B.preventDefault();return false}function p(B){B.preventDefault();a.dragover.call(B)}function x(B){B.stopPropagation();a.dragleave.call(B)}function k(B){if(B.lengthComputable){a.progress(this.index,this.file,Math.round((B.loaded*100)/B.total))}}function z(D){if(d){return}var E=f;for(var C=0;C<D.length;C++){var B=String(f++);e[B]=D[C];a.announce(B,e[B],"");j++}return E}function r(B){if(e[B]){delete e[B];j--}}function m(){if(j==0||g){g=false;d=false;a.complete();return}else{d=true}var D=-1;for(var F in e){D=F;break}var E=e[D];r(D);var C=E.size;var H=E.mode;var B=1048576*a.maxfilesize;if(C<B||E.mode=="ftp"){var G=a.initialize(D,E);if(G){q(D,E,G)}else{u(D,E,a.error_missing)}}else{u(D,E,a.error_filesize)}}function q(B,D,E){var F=new FormData();for(var C in E){F.append(C,E[C])}if(D.size>0&&a.paramname){F.append(a.paramname,D,D.name)}i=new XMLHttpRequest();i.open("POST",a.url,true);i.setRequestHeader("Accept","application/json");i.setRequestHeader("Cache-Control","no-cache");i.setRequestHeader("X-Requested-With","XMLHttpRequest");i.onreadystatechange=function(){if(i.readyState!=i.DONE){return}var G=null;if(i.responseText){try{G=jQuery.parseJSON(i.responseText)}catch(H){G=i.responseText}}if(i.status<200||i.status>299){var I=i.statusText;if(i.status==403){I=a.error_login}else{if(i.status==0){I=a.error_server}else{if(!I){I=a.error_default}}}u(B,D,I+" ("+i.status+")")}else{y(B,D,G)}};i.upload.index=B;i.upload.file=D;i.upload.addEventListener("progress",k,false);i.send(F)}function y(B,C,D){a.success(B,C,D);m()}function u(B,C,D){a.error(B,C,D);m()}function w(){c("#uploadbox_input").trigger("click")}function t(B){for(B in e){r(B)}}function l(){if(!d){d=true;m()}}function v(){g=true}function n(B){a=c.extend({},a,B);return a}function s(){return window.File&&window.FormData&&window.XMLHttpRequest&&window.FileList}return{select:w,add:z,remove:r,start:l,stop:v,reset:t,configure:n,compatible:s}}})(jQuery);
\ No newline at end of file
diff -r a626b45a14dce92771043ae55e2872b720f15f00 -r a6855d0b02d70cd35ae312f48bd704590805ca15 static/scripts/utils/uploadbox.js
--- a/static/scripts/utils/uploadbox.js
+++ b/static/scripts/utils/uploadbox.js
@@ -12,7 +12,6 @@
url : '',
paramname : 'content',
maxfilesize : 2048,
- maxfilenumber : 50,
dragover : function() {},
dragleave : function() {},
announce : function() {},
@@ -129,9 +128,6 @@
// add files to queue
for (var i = 0; i < files.length; i++)
{
- // check
- if(queue_length >= opts.maxfilenumber)
- break;
// new identifier
var index = String(queue_index++);
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
commit/galaxy-central: carlfeberhard: Fix Ratable to add emtpy stubs
by commits-noreply@bitbucket.org 23 Jan '15
by commits-noreply@bitbucket.org 23 Jan '15
23 Jan '15
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/a626b45a14dc/
Changeset: a626b45a14dc
User: carlfeberhard
Date: 2015-01-23 18:15:59+00:00
Summary: Fix Ratable to add emtpy stubs
Affected #: 1 file
diff -r f9199d6aca6eeca511d1895f3265831e1e01714d -r a626b45a14dce92771043ae55e2872b720f15f00 lib/galaxy/managers/ratable.py
--- a/lib/galaxy/managers/ratable.py
+++ b/lib/galaxy/managers/ratable.py
@@ -18,21 +18,20 @@
class RatableSerializer( object ):
- pass
- #def add_serializers( self ):
- # self.serializers[ 'user_rating' ] = self.serialize_user_rating
- # self.serializers[ 'community_rating' ] = self.serialize_community_rating
+ def add_serializers( self ):
+ self.serializers[ 'user_rating' ] = self.serialize_user_rating
+ self.serializers[ 'community_rating' ] = self.serialize_community_rating
- #def serialize_user_rating( self, trans, item, key ):
- # """
- # """
- # pass
+ def serialize_user_rating( self, trans, item, key ):
+ """
+ """
+ pass
- #def serialize_community_rating( self, trans, item, key ):
- # """
- # """
- # pass
+ def serialize_community_rating( self, trans, item, key ):
+ """
+ """
+ pass
class RatableDeserializer( object ):
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
commit/galaxy-central: carlfeberhard: Managers: cleanup and removal of my awesome ascii art
by commits-noreply@bitbucket.org 23 Jan '15
by commits-noreply@bitbucket.org 23 Jan '15
23 Jan '15
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/f9199d6aca6e/
Changeset: f9199d6aca6e
User: carlfeberhard
Date: 2015-01-23 18:09:42+00:00
Summary: Managers: cleanup and removal of my awesome ascii art
Affected #: 11 files
diff -r a059e05442354478bfa551621718afbc18cc6263 -r f9199d6aca6eeca511d1895f3265831e1e01714d lib/galaxy/managers/annotatable.py
--- a/lib/galaxy/managers/annotatable.py
+++ b/lib/galaxy/managers/annotatable.py
@@ -6,14 +6,13 @@
log = logging.getLogger( __name__ )
-# =============================================================================
class AnnotatableManagerInterface( object ):
+ #: class of AnnotationAssociation (e.g. HistoryAnnotationAssociation)
annotation_assoc = None
# TODO: most of this seems to be covered by item_attrs.UsesAnnotations
-# =============================================================================
class AnnotatableSerializer( object ):
def add_serializers( self ):
@@ -31,7 +30,6 @@
return returned
-# =============================================================================
class AnnotatableDeserializer( object ):
def add_deserializers( self ):
diff -r a059e05442354478bfa551621718afbc18cc6263 -r f9199d6aca6eeca511d1895f3265831e1e01714d lib/galaxy/managers/base.py
--- a/lib/galaxy/managers/base.py
+++ b/lib/galaxy/managers/base.py
@@ -33,12 +33,11 @@
from galaxy import model
from galaxy.model import tool_shed_install
-
import logging
log = logging.getLogger( __name__ )
-# =============================================================================
+# ==== accessors from base/controller.py
def security_check( trans, item, check_ownership=False, check_accessible=False ):
"""
Security checks for an item: checks if (a) user owns item or (b) item
@@ -166,8 +165,6 @@
"""
return ( self.model_class.create_time, )
- # NOTE: at this layer, all ids are expected to be decoded and in int form
- # ------------------------------------------------------------------------- get/read/query
def query( self, trans, eagerloads=True, filters=None, order_by=None, limit=None, offset=None, **kwargs ):
"""
Return a basic query from model_class, filters, order_by, and limit and offset.
@@ -246,7 +243,6 @@
query = query.offset( offset )
return query
- # ......................................................................... common queries
def one( self, trans, **kwargs ):
"""
Sends kwargs to build the query and returns one and only one model.
@@ -280,8 +276,7 @@
except exceptions.ObjectNotFound:
return None
- # TODO: get?
-
+ #NOTE: at this layer, all ids are expected to be decoded and in int form
def by_id( self, trans, id, **kwargs ):
"""
Gets a model by primary id.
@@ -341,7 +336,6 @@
in_order.append( item_dict[ id ] )
return in_order
- # ------------------------------------------------------------------------- create
def create( self, trans, flush=True, *args, **kwargs ):
"""
Generically create a new model.
@@ -359,7 +353,6 @@
"""
raise exceptions.NotImplemented( 'Abstract method' )
- # ------------------------------------------------------------------------- update
def update( self, trans, item, new_values, flush=True, **kwargs ):
"""
Given a dictionary of new values, update `item` and return it.
@@ -391,13 +384,12 @@
foreign_key = getattr( associated_model_class, foreign_key_name )
return trans.sa_session.query( associated_model_class ).filter( foreign_key == item )
- # ------------------------------------------------------------------------- delete
# a rename of sql DELETE to differentiate from the Galaxy notion of mark_as_deleted
# def destroy( self, trans, item, **kwargs ):
# return item
-# ============================================================================= SERIALIZERS/to_dict,from_dict
+# ==== SERIALIZERS/to_dict,from_dict
class ModelSerializingError( exceptions.InternalServerError ):
"""Thrown when request model values can't be serialized"""
pass
@@ -410,7 +402,6 @@
pass
-# -----------------------------------------------------------------------------
class ModelSerializer( object ):
"""
Turns models into JSONable dicts.
@@ -447,7 +438,6 @@
self.views = {}
self.default_view = None
- # ......................................................................... serializing
def add_serializers( self ):
"""
Register a map of attribute keys -> serializing functions that will serialize
@@ -482,7 +472,7 @@
# TODO:?? point of change but not really necessary?
return getattr( item, key )
- # ......................................................................... serializers for common galaxy objects
+ # serializers for common galaxy objects
def serialize_date( self, trans, item, key ):
"""
Serialize a date attribute of `item`.
@@ -497,8 +487,7 @@
id = getattr( item, key )
return self.app.security.encode_id( id ) if id is not None else None
- # ......................................................................... serializing to a view
- # where a view is a predefied list of keys to serialize
+ # serializing to a view where a view is a predefied list of keys to serialize
def serialize_to_view( self, trans, item, view=None, keys=None, default_view=None ):
"""
Use a predefined list of keys (the string `view`) and any additional keys
@@ -539,7 +528,6 @@
return self.views[ view ][:]
-# -----------------------------------------------------------------------------
class ModelDeserializer( object ):
"""
An object that converts an incoming serialized dict into values that can be
@@ -548,6 +536,8 @@
#: the class used to create this deserializer's generically accessible model_manager
model_manager_class = None
+ #TODO:?? a larger question is: which should be first? Deserialize then validate - or - validate then deserialize?
+
def __init__( self, app ):
"""
Set up deserializers and validator.
@@ -626,8 +616,6 @@
return self.default_deserializer( trans, item, key, val )
-# -----------------------------------------------------------------------------
-# TODO:?? a larger question is: which should be first? Deserialize then validate - or - validate then deserialize?
class ModelValidator( object ):
"""
An object that inspects a dictionary (generally meant to be a set of
@@ -703,9 +691,7 @@
# pass
-# =============================================================================
-# Mixins (here for now)
-# =============================================================================
+# ==== Security Mixins
class AccessibleModelInterface( object ):
"""
A security interface to check if a User can read/view an item's.
@@ -764,7 +750,6 @@
# return filter( lambda item: self.is_accessible( trans, item, user ), items )
-# =============================================================================
class OwnableModelInterface( object ):
"""
A security interface to check if a User is an item's owner.
@@ -820,7 +805,7 @@
return self.list_owned( trans, user, **kwargs )
-# -----------------------------------------------------------------------------
+# ---- Deletable and Purgable models
class DeletableModelInterface( object ):
"""
A mixin/interface for a model that is deletable (i.e. has a 'deleted' attr).
@@ -878,7 +863,6 @@
return item.deleted
-# -----------------------------------------------------------------------------
class PurgableModelInterface( DeletableModelInterface ):
"""
A manager interface/mixin for a resource that allows deleting and purging where
diff -r a059e05442354478bfa551621718afbc18cc6263 -r f9199d6aca6eeca511d1895f3265831e1e01714d lib/galaxy/managers/datasets.py
--- a/lib/galaxy/managers/datasets.py
+++ b/lib/galaxy/managers/datasets.py
@@ -11,12 +11,10 @@
log = logging.getLogger( __name__ )
-# =============================================================================
class DatasetManager( base.ModelManager, base.AccessibleModelInterface, base.PurgableModelInterface ):
"""
Manipulate datasets: the components contained in DatasetAssociations/DatasetInstances/HDAs/LDDAs
"""
-
model_class = model.Dataset
foreign_key_name = 'dataset'
@@ -27,7 +25,6 @@
# need for admin test
self.user_manager = users.UserManager( app )
- # ......................................................................... create
def create( self, trans, flush=True, **kwargs ):
"""
Create and return a new Dataset object.
@@ -47,7 +44,6 @@
# """
# pass
- # ......................................................................... add to dataset association
#def to_hda( self, trans, dataset, history, **kwargs ):
# """
# Create an hda from this dataset.
@@ -60,7 +56,6 @@
# """
# pass
- # ......................................................................... delete
#TODO: this may be more conv. somewhere else
#TODO: how to allow admin bypass?
def error_unless_dataset_purge_allowed( self, trans, item, msg=None ):
@@ -85,7 +80,7 @@
self.app.model.context.flush()
return dataset
- # ......................................................................... accessibility
+ # .... accessibility
# datasets can implement the accessible interface, but accessibility is checked in an entirely different way
# than those resources that have a user attribute (histories, pages, etc.)
def is_accessible( self, trans, dataset, user ):
@@ -105,7 +100,7 @@
roles = user.all_roles() if user else []
return self.app.security_agent.can_access_dataset( roles, dataset )
-#TODO: these need work
+ #TODO: these need work
def _access_permission( self, trans, dataset, user=None, role=None ):
"""
Return most recent DatasetPermissions for the dataset and user.
@@ -168,7 +163,7 @@
# """
# pass
- # ......................................................................... manage/modify
+ # .... manage/modify
#def has_manage_permission( self, trans, dataset, user ):
# """
# """
@@ -187,10 +182,9 @@
#TODO: implement above for groups
#TODO: datatypes?
- # ......................................................................... data, object_store
+ # .... data, object_store
-# -----------------------------------------------------------------------------
class DatasetSerializer( base.ModelSerializer, base.PurgableModelSerializer ):
def __init__( self, app ):
@@ -227,7 +221,6 @@
})
-# -----------------------------------------------------------------------------
class DatasetDeserializer( base.ModelDeserializer, base.PurgableModelDeserializer ):
model_manager_class = DatasetManager
@@ -236,9 +229,12 @@
base.PurgableModelDeserializer.add_deserializers( self )
-# =============================================================================
+
class DatasetAssociationManager( base.ModelManager, base.AccessibleModelInterface, base.PurgableModelInterface ):
"""
+ DatasetAssociation/DatasetInstances are intended to be working
+ proxies to a Dataset, associated with either a library or a
+ user/history (HistoryDatasetAssociation).
"""
# DA's were meant to be proxies - but were never fully implemented as them
# Instead, a dataset association HAS a dataset but contains metadata specific to a library (lda) or user (hda)
@@ -269,7 +265,6 @@
# pass
-# -----------------------------------------------------------------------------
class DatasetAssociationSerializer( base.ModelSerializer, base.PurgableModelSerializer ):
def add_serializers( self ):
@@ -277,7 +272,6 @@
base.PurgableModelSerializer.add_serializers( self )
-# -----------------------------------------------------------------------------
class DatasetAssociationDeserializer( base.ModelDeserializer, base.PurgableModelDeserializer ):
def add_deserializers( self ):
diff -r a059e05442354478bfa551621718afbc18cc6263 -r f9199d6aca6eeca511d1895f3265831e1e01714d lib/galaxy/managers/hdas.py
--- a/lib/galaxy/managers/hdas.py
+++ b/lib/galaxy/managers/hdas.py
@@ -24,10 +24,9 @@
import logging
log = logging.getLogger( __name__ )
-# =============================================================================
+
class HDAManager( datasets.DatasetAssociationManager, base.OwnableModelInterface,
taggable.TaggableManagerInterface, annotatable.AnnotatableManagerInterface ):
- #TODO: move what makes sense into DatasetManager
"""
Interface/service object for interacting with HDAs.
"""
@@ -37,6 +36,7 @@
tag_assoc = model.HistoryDatasetAssociationTagAssociation
annotation_assoc = model.HistoryDatasetAssociationAnnotationAssociation
+ #TODO: move what makes sense into DatasetManager
#TODO: which of these are common with LDDAs and can be pushed down into DatasetAssociationManager?
def __init__( self, app ):
@@ -46,7 +46,7 @@
super( HDAManager, self ).__init__( app )
self.user_manager = users.UserManager( app )
- # ......................................................................... security and permissions
+ # .... security and permissions
def is_accessible( self, trans, hda, user ):
"""
Override to allow owners (those that own the associated history).
@@ -67,7 +67,7 @@
return True
return history.user == user
- # ......................................................................... create and copy
+ # .... create and copy
def create( self, trans, history=None, dataset=None, flush=True, **kwargs ):
"""
Create a new hda optionally passing in it's history and dataset.
@@ -177,7 +177,7 @@
raise exceptions.Conflict( "Please wait until this dataset finishes uploading" )
return hda
- # ......................................................................... via history
+ # .... via history
#def by_history_id( self, trans, history_id, filters=None, **kwargs ):
# history_id_filter = self.model_class.history_id == history_id
# filters = self._munge_filters( history_id_filter, filters )
@@ -186,16 +186,16 @@
#def by_history( self, trans, history, filters=None, **kwargs ):
# return history.datasets
- # ......................................................................... associated
-#TODO: is this needed? Can't you use the hda.creating_job attribute? When is this None?
+ # .... associated
def creating_job( self, trans, hda ):
+ #TODO: is this needed? Can't you use the hda.creating_job attribute? When is this None?
job = None
for job_output_assoc in hda.creating_job_associations:
job = job_output_assoc.job
break
return job
- # ......................................................................... serialization
+ # .... serialization
def get_display_apps( self, trans, hda ):
"""
Return dictionary containing new-style display app urls.
@@ -307,7 +307,6 @@
return False
-# =============================================================================
class HDASerializer( datasets.DatasetAssociationSerializer,
taggable.TaggableSerializer, annotatable.AnnotatableSerializer ):
#TODO: inherit from datasets.DatasetAssociationSerializer
@@ -454,7 +453,7 @@
Override to add metadata as flattened keys on the serialized HDA.
"""
# if 'metadata' isn't removed from keys here serialize will retrieve the un-serializable MetadataCollection
-#TODO: remove these when metadata is sub-object
+ #TODO: remove these when metadata is sub-object
KEYS_HANDLED_SEPARATELY = ( 'metadata', )
left_to_handle = self.pluck_from_list( keys, KEYS_HANDLED_SEPARATELY )
serialized = super( HDASerializer, self ).serialize( trans, hda, keys )
@@ -537,7 +536,7 @@
"""
Return the `file_name` of the HDA if the config exposes it, None otherwise.
"""
-#TODO: allow admin
+ #TODO: allow admin
if self.app.config.expose_dataset_path:
try:
return hda.file_name
@@ -568,7 +567,6 @@
return urls
-# =============================================================================
class HDADeserializer( datasets.DatasetAssociationDeserializer,
taggable.TaggableDeserializer, annotatable.AnnotatableDeserializer ):
"""
diff -r a059e05442354478bfa551621718afbc18cc6263 -r f9199d6aca6eeca511d1895f3265831e1e01714d lib/galaxy/managers/histories.py
--- a/lib/galaxy/managers/histories.py
+++ b/lib/galaxy/managers/histories.py
@@ -12,12 +12,10 @@
from galaxy.managers import sharable
from galaxy.managers.collections_util import dictify_dataset_collection_instance
-
import logging
log = logging.getLogger( __name__ )
-# =============================================================================
class HistoryManager( sharable.SharableModelManager, base.PurgableModelInterface ):
model_class = model.History
@@ -28,7 +26,7 @@
annotation_assoc = model.HistoryAnnotationAssociation
rating_assoc = model.HistoryRatingAssociation
- #TODO: incorporate imp/exp (or link to)
+ #TODO: incorporate imp/exp (or alias to)
def __init__( self, app, *args, **kwargs ):
super( HistoryManager, self ).__init__( app, *args, **kwargs )
@@ -41,17 +39,7 @@
"""
return history.copy( target_user=user, **kwargs )
- def most_recent( self, trans, user, **kwargs ):
- """
- Return the most recently update history for the user.
- """
-#TODO: normalize this
- if not user:
- return None if trans.history.deleted else trans.history
- desc_update_time = self.model_class.table.c.update_time
- return self._query_by_user( trans, user, order_by=desc_update_time, limit=1, **kwargs ).first()
-
- # ......................................................................... sharable
+ # .... sharable
# overriding to handle anonymous users' current histories in both cases
def by_user( self, trans, user, **kwargs ):
"""
@@ -74,7 +62,18 @@
return True
return super( HistoryManager, self ).is_owner( trans, history, user )
- # ......................................................................... purgable
+ #TODO: possibly to sharable
+ def most_recent( self, trans, user, **kwargs ):
+ """
+ Return the most recently update history for the user.
+ """
+ #TODO: normalize this return value
+ if not user:
+ return None if trans.history.deleted else trans.history
+ desc_update_time = self.model_class.table.c.update_time
+ return self._query_by_user( trans, user, order_by=desc_update_time, limit=1, **kwargs ).first()
+
+ # .... purgable
def purge( self, trans, history, flush=True, **kwargs ):
"""
Purge this history and all HDAs, Collections, and Datasets inside this history.
@@ -89,10 +88,7 @@
# Now mark the history as purged
super( HistoryManager, self ).purge( trans, history, flush=flush, **kwargs )
- # ......................................................................... contents
-
-
- # ......................................................................... current
+ # .... current
def get_current( self, trans ):
"""
Return the current history.
@@ -112,7 +108,7 @@
"""
return self.set_current( trans, self.by_id( trans, history_id ) )
- # ......................................................................... serialization
+ # .... serialization
#TODO: move to serializer (i.e. history with contents attr)
def _get_history_data( self, trans, history ):
"""
@@ -237,7 +233,6 @@
return state
-## =============================================================================
class HistorySerializer( sharable.SharableModelSerializer, base.PurgableModelSerializer ):
"""
Interface/service object for serializing histories into dictionaries.
@@ -337,7 +332,6 @@
security=self.app.security, parent=dataset_collection_instance.history, view="element" )
-# =============================================================================
class HistoryDeserializer( sharable.SharableModelDeserializer, base.PurgableModelDeserializer ):
"""
Interface/service object for validating and deserializing dictionaries into histories.
diff -r a059e05442354478bfa551621718afbc18cc6263 -r f9199d6aca6eeca511d1895f3265831e1e01714d lib/galaxy/managers/pages.py
--- a/lib/galaxy/managers/pages.py
+++ b/lib/galaxy/managers/pages.py
@@ -13,7 +13,6 @@
log = logging.getLogger( __name__ )
-# =============================================================================
class PageManager( sharable.SharableModelManager ):
"""
"""
@@ -37,7 +36,6 @@
pass
-# =============================================================================
class PageSerializer( sharable.SharableModelSerializer ):
"""
Interface/service object for serializing pages into dictionaries.
@@ -66,7 +64,6 @@
})
-# =============================================================================
class PageDeserializer( sharable.SharableModelDeserializer ):
"""
Interface/service object for validating and deserializing dictionaries
diff -r a059e05442354478bfa551621718afbc18cc6263 -r f9199d6aca6eeca511d1895f3265831e1e01714d lib/galaxy/managers/ratable.py
--- a/lib/galaxy/managers/ratable.py
+++ b/lib/galaxy/managers/ratable.py
@@ -9,31 +9,31 @@
log = logging.getLogger( __name__ )
-# =============================================================================
+#TODO: stub
class RatableManagerInterface( object ):
+ #: class of RatingAssociation (e.g. HistoryRatingAssociation)
rating_assoc = None
#TODO: most of this seems to be covered by item_attrs.UsesItemRatings
-# =============================================================================
class RatableSerializer( object ):
+ pass
- def add_serializers( self ):
- self.serializers[ 'user_rating' ] = self.serialize_user_rating
- self.serializers[ 'community_rating' ] = self.serialize_community_rating
+ #def add_serializers( self ):
+ # self.serializers[ 'user_rating' ] = self.serialize_user_rating
+ # self.serializers[ 'community_rating' ] = self.serialize_community_rating
- def serialize_user_rating( self, trans, item, key ):
- """
- """
- pass
+ #def serialize_user_rating( self, trans, item, key ):
+ # """
+ # """
+ # pass
- def serialize_community_rating( self, trans, item, key ):
- """
- """
- pass
+ #def serialize_community_rating( self, trans, item, key ):
+ # """
+ # """
+ # pass
-# =============================================================================
class RatableDeserializer( object ):
def add_deserializers( self ):
diff -r a059e05442354478bfa551621718afbc18cc6263 -r f9199d6aca6eeca511d1895f3265831e1e01714d lib/galaxy/managers/sharable.py
--- a/lib/galaxy/managers/sharable.py
+++ b/lib/galaxy/managers/sharable.py
@@ -24,13 +24,12 @@
log = logging.getLogger( __name__ )
-# =============================================================================
class SharableModelManager( base.ModelManager, base.OwnableModelInterface, base.AccessibleModelInterface,
taggable.TaggableManagerInterface, annotatable.AnnotatableManagerInterface, ratable.RatableManagerInterface ):
# e.g. histories, pages, stored workflows, visualizations
- # base.DeleteableModelInterface?
+ # base.DeleteableModelInterface? (all four are deletable)
- # the model used for UserShareAssociations with this model
+ #: the model used for UserShareAssociations with this model
user_share_model = None
#: the single character abbreviation used in username_and_slug: e.g. 'h' for histories: u/user/h/slug
@@ -41,7 +40,7 @@
# user manager is needed to check access/ownership/admin
self.user_manager = users.UserManager( app )
- # ......................................................................... has a user
+ # .... has a user
def _query_by_user( self, trans, user, filters=None, **kwargs ):
"""
Return query for all items (of model_class type) associated with the given
@@ -59,7 +58,7 @@
query = self._query_by_user( trans, user, **kwargs )
return self.list( trans, query=query, **kwargs )
- # ......................................................................... owned model interface
+ # .... owned model interface
def is_owner( self, trans, item, user ):
"""
Return true if this sharable belongs to `user` (or `user` is an admin).
@@ -72,7 +71,7 @@
return True
return item.user == user
- # ......................................................................... accessible interface
+ # .... accessible interface
def is_accessible( self, trans, item, user ):
"""
If the item is importable, is owned by `user`, or (the valid) `user`
@@ -89,7 +88,7 @@
return True
return False
- # ......................................................................... importable
+ # .... importable
def make_importable( self, trans, item, flush=True ):
"""
Makes item accessible--viewable and importable--and sets item's slug.
@@ -131,7 +130,7 @@
# query = self._query_importable( trans, user, **kwargs )
# return self.list( trans, query=query, **kwargs )
- # ......................................................................... published
+ # .... published
def publish( self, trans, item, flush=True ):
"""
Set both the importable and published flags on `item` to True.
@@ -168,7 +167,7 @@
# query = self._query_published( trans, user, **kwargs )
# return self.list( trans, query=query, **kwargs )
- # ......................................................................... user sharing
+ # .... user sharing
# sharing is often done via a 3rd table btwn a User and an item -> a <Item>UserShareAssociation
def get_share_assocs( self, trans, item, user=None ):
"""
@@ -236,7 +235,7 @@
# query = self._query_shared_with( trans, user, **kwargs )
# return self.list( trans, query=query, **kwargs )
- # ......................................................................... slugs
+ # .... slugs
# slugs are human readable strings often used to link to sharable resources (replacing ids)
#TODO: as validator, deserializer, etc. (maybe another object entirely?)
def set_slug( self, trans, item, new_slug, flush=True ):
@@ -331,7 +330,7 @@
# """
# pass
- # ......................................................................... display
+ # .... display
#def display_by_username_and_slug( self, trans, username, slug ):
# """ Display item by username and slug. """
@@ -341,7 +340,6 @@
# """ Handle item sharing. """
-# =============================================================================
class SharableModelSerializer( base.ModelSerializer,
taggable.TaggableSerializer, annotatable.AnnotatableSerializer, ratable.RatableSerializer ):
#TODO: stub
@@ -379,10 +377,8 @@
# return url
-# =============================================================================
class SharableModelDeserializer( base.ModelDeserializer,
taggable.TaggableDeserializer, annotatable.AnnotatableDeserializer, ratable.RatableDeserializer ):
-#TODO: stub
def add_deserializers( self ):
super( SharableModelDeserializer, self ).add_deserializers()
diff -r a059e05442354478bfa551621718afbc18cc6263 -r f9199d6aca6eeca511d1895f3265831e1e01714d lib/galaxy/managers/taggable.py
--- a/lib/galaxy/managers/taggable.py
+++ b/lib/galaxy/managers/taggable.py
@@ -9,14 +9,13 @@
log = logging.getLogger( __name__ )
-# =============================================================================
class TaggableManagerInterface( object ):
+ #: class of TagAssociation (e.g. HistoryTagAssociation)
tag_assoc = None
#TODO: most of this can be done by delegating to the TagManager?
-# =============================================================================
class TaggableSerializer( object ):
def add_serializers( self ):
@@ -38,7 +37,6 @@
return tags_str_list
-# =============================================================================
class TaggableDeserializer( object ):
def add_deserializers( self ):
@@ -60,6 +58,6 @@
tag_handler.apply_item_tags( user, item, unicode( new_tags_str.encode( 'utf-8' ), 'utf-8' ) )
#trans.sa_session.flush()
-#TODO:!! does the creation of new_tags_list mean there are now more and more unused tag rows in the db?
+ #TODO:!! does the creation of new_tags_list mean there are now more and more unused tag rows in the db?
return item.tags
diff -r a059e05442354478bfa551621718afbc18cc6263 -r f9199d6aca6eeca511d1895f3265831e1e01714d lib/galaxy/managers/users.py
--- a/lib/galaxy/managers/users.py
+++ b/lib/galaxy/managers/users.py
@@ -12,12 +12,10 @@
from galaxy.managers import base
from galaxy.managers import api_keys
-
import logging
log = logging.getLogger( __name__ )
-# =============================================================================
class UserManager( base.ModelManager ):
model_class = model.User
foreign_key_name = 'user'
@@ -77,7 +75,7 @@
if self.by_email( trans, email ) is not None:
raise exceptions.Conflict( 'Email must be unique', email=email )
- # ------------------------------------------------------------------------- filters
+ # ---- filters
def by_email( self, trans, email, filters=None, **kwargs ):
"""
Find a user by their email.
@@ -97,7 +95,7 @@
order_by = order_by or ( model.User.email, )
return super( UserManager, self ).list( trans, filters=filters, order_by=order_by, **kwargs )
- # ------------------------------------------------------------------------- admin
+ # ---- admin
def is_admin( self, trans, user ):
"""
Return True if this user is an admin.
@@ -129,7 +127,7 @@
raise exceptions.AdminRequiredException( msg, **kwargs )
return user
- # ------------------------------------------------------------------------- anonymous
+ # ---- anonymous
def is_anonymous( self, user ):
"""
Return True if `user` is anonymous.
@@ -146,7 +144,7 @@
raise exceptions.AuthenticationFailed( msg, **kwargs )
return user
- # ------------------------------------------------------------------------- current
+ # ---- current
def is_current_user( self, trans, user ):
"""
Return True if this user is the trans' current user.
@@ -166,7 +164,7 @@
"""
return self.is_admin( trans, trans.user )
- # ------------------------------------------------------------------------- ?
+ # ---- User-created notes/metadata on other models
#def tags( self, trans, user, **kwargs ):
# """
# Return all tags created by this user.
@@ -179,7 +177,7 @@
# """
# pass
- # ------------------------------------------------------------------------- api keys
+ # ---- api keys
def create_api_key( self, trans, user ):
"""
Create and return an API key for `user`.
@@ -215,7 +213,7 @@
return existing
return self.create_api_key( self, trans, user )
- # ------------------------------------------------------------------------- roles
+ # ---- roles
def private_role( self, trans, user ):
"""
Return the security agent's private role for `user`.
@@ -224,7 +222,6 @@
return self.app.security_agent.get_private_user_role( user )
-# =============================================================================
class UserSerializer( base.ModelSerializer ):
def __init__( self ):
diff -r a059e05442354478bfa551621718afbc18cc6263 -r f9199d6aca6eeca511d1895f3265831e1e01714d lib/galaxy/managers/visualizations.py
--- a/lib/galaxy/managers/visualizations.py
+++ b/lib/galaxy/managers/visualizations.py
@@ -12,11 +12,13 @@
log = logging.getLogger( __name__ )
-# =============================================================================
class VisualizationManager( sharable.SharableModelManager ):
"""
+ Handle operations outside and between visualizations and other models.
"""
+ # TODO: revisions
+
model_class = model.Visualization
foreign_key_name = 'visualization'
user_share_model = model.VisualizationUserShareAssociation
@@ -30,15 +32,12 @@
"""
super( VisualizationManager, self ).__init__( app, *args, **kwargs )
- def copy( self, trans, visualization, user, **kwargs ):
- """
- """
- pass
+ #def copy( self, trans, visualization, user, **kwargs ):
+ # """
+ # """
+ # pass
- # TODO: revisions
-
-# =============================================================================
class VisualizationSerializer( sharable.SharableModelSerializer ):
"""
Interface/service object for serializing visualizations into dictionaries.
@@ -67,7 +66,6 @@
})
-# =============================================================================
class VisualizationDeserializer( sharable.SharableModelDeserializer ):
"""
Interface/service object for validating and deserializing
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
commit/galaxy-central: carlfeberhard: Plugins, Scatterplot: fix library imports to use proper path after ui.js breakup
by commits-noreply@bitbucket.org 23 Jan '15
by commits-noreply@bitbucket.org 23 Jan '15
23 Jan '15
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/a059e0544235/
Changeset: a059e0544235
User: carlfeberhard
Date: 2015-01-23 17:50:21+00:00
Summary: Plugins, Scatterplot: fix library imports to use proper path after ui.js breakup
Affected #: 1 file
diff -r a95230bfcbe7777562ccf808cb86a471aac4bda4 -r a059e05442354478bfa551621718afbc18cc6263 config/plugins/visualizations/scatterplot/templates/scatterplot.mako
--- a/config/plugins/visualizations/scatterplot/templates/scatterplot.mako
+++ b/config/plugins/visualizations/scatterplot/templates/scatterplot.mako
@@ -31,9 +31,8 @@
'libs/backbone/backbone',
'libs/d3',
'libs/handlebars.runtime',
- 'mvc/ui',
- 'jq-plugins/ui/peek-column-selector',
- 'jq-plugins/ui/pagination',
+ 'ui/peek-column-selector',
+ 'ui/pagination',
'mvc/visualization/visualization-model' )}
${h.javascript_link( root + 'plugins/visualizations/scatterplot/static/scatterplot-edit.js' )}
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
commit/galaxy-central: carlfeberhard: Fix to replace get_dataset in visualization registry ResourceParser with hda_manager.get_accessible
by commits-noreply@bitbucket.org 23 Jan '15
by commits-noreply@bitbucket.org 23 Jan '15
23 Jan '15
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/a95230bfcbe7/
Changeset: a95230bfcbe7
User: carlfeberhard
Date: 2015-01-23 17:44:46+00:00
Summary: Fix to replace get_dataset in visualization registry ResourceParser with hda_manager.get_accessible
Affected #: 1 file
diff -r 482d85dda5d3546e1d6e9cca6d712d7af8c772ba -r a95230bfcbe7777562ccf808cb86a471aac4bda4 lib/galaxy/visualization/registry.py
--- a/lib/galaxy/visualization/registry.py
+++ b/lib/galaxy/visualization/registry.py
@@ -960,10 +960,8 @@
check_ownership=False, check_accessible=True )
elif param_type == 'dataset':
- encoded_dataset_id = query_param
- # really an hda...
- parsed_param = controller.get_dataset( trans, encoded_dataset_id,
- check_ownership=False, check_accessible=True )
+ decoded_dataset_id = trans.security.decode_id( query_param )
+ parsed_param = controller.hda_manager.get_accessible( trans, decoded_dataset_id, trans.user )
elif param_type == 'hda_or_ldda':
encoded_dataset_id = query_param
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
commit/galaxy-central: jmchilton: Merged in BjoernGruening/galaxy-central-1/snpeff_datatype (pull request #640)
by commits-noreply@bitbucket.org 23 Jan '15
by commits-noreply@bitbucket.org 23 Jan '15
23 Jan '15
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/482d85dda5d3/
Changeset: 482d85dda5d3
User: jmchilton
Date: 2015-01-23 17:12:43+00:00
Summary: Merged in BjoernGruening/galaxy-central-1/snpeff_datatype (pull request #640)
Add SnpEff datatypes
Affected #: 3 files
diff -r 2fd8714c4faeb580f3ccf1591003f10e821397a1 -r 482d85dda5d3546e1d6e9cca6d712d7af8c772ba config/datatypes_conf.xml.sample
--- a/config/datatypes_conf.xml.sample
+++ b/config/datatypes_conf.xml.sample
@@ -113,7 +113,7 @@
<converter file="interval_to_bed12_converter.xml" target_datatype="bed12"/><converter file="interval_to_bgzip_converter.xml" target_datatype="bgzip"/><converter file="interval_to_tabix_converter.xml" target_datatype="tabix" depends_on="bgzip"/>
- <converter file="interval_to_bigwig_converter.xml" target_datatype="bigwig"/>
+ <converter file="interval_to_bigwig_converter.xml" target_datatype="bigwig"/><!-- <display file="ucsc/interval_as_bed.xml" inherit="True" /> --><display file="ensembl/ensembl_interval_as_bed.xml" inherit="True"/><display file="gbrowse/gbrowse_interval_as_bed.xml" inherit="True"/>
@@ -152,11 +152,11 @@
<datatype extension="mafcustomtrack" type="galaxy.datatypes.sequence:MafCustomTrack"><display file="ucsc/maf_customtrack.xml" /></datatype>
- <datatype extension="encodepeak" type="galaxy.datatypes.interval:ENCODEPeak" display_in_upload="True">
- <converter file="encodepeak_to_tabix_converter.xml" target_datatype="tabix" depends_on="bgzip"/>
- <converter file="encodepeak_to_bgzip_converter.xml" target_datatype="bgzip"/>
- <converter file="bed_gff_or_vcf_to_bigwig_converter.xml" target_datatype="bigwig"/>
- </datatype>
+ <datatype extension="encodepeak" type="galaxy.datatypes.interval:ENCODEPeak" display_in_upload="True">
+ <converter file="encodepeak_to_tabix_converter.xml" target_datatype="tabix" depends_on="bgzip"/>
+ <converter file="encodepeak_to_bgzip_converter.xml" target_datatype="bgzip"/>
+ <converter file="bed_gff_or_vcf_to_bigwig_converter.xml" target_datatype="bigwig"/>
+ </datatype><datatype extension="pdf" type="galaxy.datatypes.images:Pdf" mimetype="application/pdf"/><datatype extension="pileup" type="galaxy.datatypes.tabular:Pileup" display_in_upload="true"><converter file="interval_to_bgzip_converter.xml" target_datatype="bgzip"/>
@@ -172,11 +172,16 @@
<datatype extension="qual454" type="galaxy.datatypes.qualityscore:QualityScore454" display_in_upload="true"/><datatype extension="Roadmaps" type="galaxy.datatypes.assembly:Roadmaps" display_in_upload="false"/><datatype extension="sam" type="galaxy.datatypes.tabular:Sam" display_in_upload="true">
- <converter file="sam_to_bam.xml" target_datatype="bam"/>
- <converter file="sam_to_bigwig_converter.xml" target_datatype="bigwig"/>
- </datatype>
+ <converter file="sam_to_bam.xml" target_datatype="bam"/>
+ <converter file="sam_to_bigwig_converter.xml" target_datatype="bigwig"/>
+ </datatype><datatype extension="scf" type="galaxy.datatypes.binary:Scf" mimetype="application/octet-stream" display_in_upload="true" description="A binary sequence file in 'scf' format with a '.scf' file extension. You must manually select this 'File Format' when uploading the file." description_url="https://wiki.galaxyproject.org/Learn/Datatypes#Scf"/><datatype extension="Sequences" type="galaxy.datatypes.assembly:Sequences" display_in_upload="false"/>
+ <datatype extension="snpeffdb" type="galaxy.datatypes.text:SnpEffDb" display_in_upload="True"/>
+ <datatype extension="snpsiftdbnsfp" type="galaxy.datatypes.txt:SnpSiftDbNSFP" display_in_upload="True"/>
+ <datatype extension="dbnsfp.tabular" type="galaxy.datatypes.tabular:Tabular" subclass="True" display_in_upload="True">
+ <converter file="tabular_to_dbnsfp.xml" target_datatype="snpsiftdbnsfp"/>
+ </datatype><datatype extension="sff" type="galaxy.datatypes.binary:Sff" mimetype="application/octet-stream" display_in_upload="true" description="A binary file in 'Standard Flowgram Format' with a '.sff' file extension." description_url="https://wiki.galaxyproject.org/Learn/Datatypes#Sff"/><datatype extension="svg" type="galaxy.datatypes.images:Image" mimetype="image/svg+xml"/><datatype extension="taxonomy" type="galaxy.datatypes.tabular:Taxonomy" display_in_upload="true"/>
diff -r 2fd8714c4faeb580f3ccf1591003f10e821397a1 -r 482d85dda5d3546e1d6e9cca6d712d7af8c772ba lib/galaxy/datatypes/converters/tabular_to_dbnsfp.xml
--- /dev/null
+++ b/lib/galaxy/datatypes/converters/tabular_to_dbnsfp.xml
@@ -0,0 +1,12 @@
+<tool id="tabular_to_dbnsfp" name="Convert tabular to dbnsfp" version="1.0.0">
+ <description></description>
+ <command interpreter="python">tabular_to_dbnsfp.py $input $dbnsfp.extra_files_path/dbNSFP.gz</command>
+ <inputs>
+ <param format="tabular" name="input" type="data" label="Choose a dbnsfp tabular file"/>
+ </inputs>
+ <outputs>
+ <data format="snpsiftdbnsfp" name="dbnsfp"/>
+ </outputs>
+ <help>
+ </help>
+</tool>
diff -r 2fd8714c4faeb580f3ccf1591003f10e821397a1 -r 482d85dda5d3546e1d6e9cca6d712d7af8c772ba lib/galaxy/datatypes/text.py
--- a/lib/galaxy/datatypes/text.py
+++ b/lib/galaxy/datatypes/text.py
@@ -2,7 +2,6 @@
""" Clearing house for generic text datatypes that are not XML or tabular.
"""
-
from galaxy.datatypes.data import Text
from galaxy.datatypes.data import get_file_peek
from galaxy.datatypes.data import nice_size
@@ -12,13 +11,13 @@
import tempfile
import subprocess
import json
+import gzip
import os
import re
import logging
log = logging.getLogger(__name__)
-
class Json( Text ):
file_ext = "json"
@@ -259,3 +258,121 @@
dataset.metadata.comment_lines = comment_lines
dataset.metadata.columns = column_count
+
+class SnpEffDb( Text ):
+ """Class describing a SnpEff genome build"""
+ file_ext = "snpeffdb"
+ MetadataElement( name="genome_version", default=None, desc="Genome Version", readonly=True, visible=True, no_value=None )
+ MetadataElement( name="regulation", default=[], desc="Regulation Names", readonly=True, visible=True, no_value=[], optional=True)
+ MetadataElement( name="annotation", default=[], desc="Annotation Names", readonly=True, visible=True, no_value=[], optional=True)
+
+ def __init__( self, **kwd ):
+ Text.__init__( self, **kwd )
+
+ def set_meta( self, dataset, **kwd ):
+ Text.set_meta(self, dataset, **kwd )
+ data_dir = dataset.extra_files_path
+ ## search data_dir/genome_version for files
+ regulation_pattern = 'regulation_(.+).bin'
+ # annotation files that are included in snpEff by a flag
+ annotations_dict = {'nextProt.bin' : '-nextprot','motif.bin': '-motif'}
+ regulations = []
+ annotations = []
+ if data_dir and os.path.isdir(data_dir):
+ for root, dirs, files in os.walk(data_dir):
+ for fname in files:
+ if fname.startswith('snpEffectPredictor'):
+ # if snpEffectPredictor.bin download succeeded
+ genome_version = os.path.basename(root)
+ dataset.metadata.genome_version = genome_version
+ else:
+ m = re.match(regulation_pattern,fname)
+ if m:
+ name = m.groups()[0]
+ regulations.append(name)
+ elif fname in annotations_dict:
+ value = annotations_dict[fname]
+ name = value.lstrip('-')
+ annotations.append(name)
+ dataset.metadata.regulation = regulations
+ dataset.metadata.annotation = annotations
+ try:
+ fh = file(dataset.file_name,'w')
+ fh.write("%s\n" % genome_version)
+ if annotations:
+ fh.write("annotations: %s\n" % ','.join(annotations))
+ if regulations:
+ fh.write("regulations: %s\n" % ','.join(regulations))
+ fh.close()
+ except:
+ pass
+
+
+class SnpSiftDbNSFP( Text ):
+ """Class describing a dbNSFP database prepared fpr use by SnpSift dbnsfp """
+ MetadataElement( name='reference_name', default='dbSNFP' , desc='Reference Name', readonly=True, visible=True, set_in_upload=True, no_value='dbSNFP' )
+ MetadataElement( name="bgzip", default=None, desc="dbNSFP bgzip", readonly=True, visible=True, no_value=None )
+ MetadataElement( name="index", default=None, desc="Tabix Index File", readonly=True, visible=True, no_value=None)
+ MetadataElement( name="annotation", default=[], desc="Annotation Names", readonly=True, visible=True, no_value=[] )
+ file_ext = "snpsiftdbnsfp"
+ composite_type = 'auto_primary_file'
+ allow_datatype_change = False
+ """
+ ## The dbNSFP file is a tabular file with 1 header line
+ ## The first 4 columns are required to be: chrom pos ref alt
+ ## These match columns 1,2,4,5 of the VCF file
+ ## SnpSift requires the file to be block-gzipped and the indexed with samtools tabix
+ ## Example:
+ ## Compress using block-gzip algorithm
+ bgzip dbNSFP2.3.txt
+ ## Create tabix index
+ tabix -s 1 -b 2 -e 2 dbNSFP2.3.txt.gz
+ """
+ def __init__( self, **kwd ):
+ Text.__init__( self, **kwd )
+ self.add_composite_file( '%s.grp', description = 'Group File', substitute_name_with_metadata = 'reference_name', is_binary = False )
+ self.add_composite_file( '%s.ti', description = '', substitute_name_with_metadata = 'reference_name', is_binary = False )
+ def init_meta( self, dataset, copy_from=None ):
+ Text.init_meta( self, dataset, copy_from=copy_from )
+ def generate_primary_file( self, dataset = None ):
+ """
+ This is called only at upload to write the html file
+ cannot rename the datasets here - they come with the default unfortunately
+ """
+ regenerate_primary_file( self, dataset)
+ def regenerate_primary_file(self,dataset):
+ """
+ cannot do this until we are setting metadata
+ """
+ annotations = "dbNSFP Annotations: %s\n" % ','.join(dataset.metadata.annotation)
+ f = open(dataset.file_name,'a')
+ if dataset.metadata.bgzip:
+ bn = dataset.metadata.bgzip
+ f.write(bn)
+ f.write('\n')
+ f.write(annotations)
+ f.close()
+ def set_meta( self, dataset, overwrite=True, **kwd ):
+ try:
+ efp = dataset.extra_files_path
+ if os.path.exists(efp):
+ flist = os.listdir(efp)
+ for i,fname in enumerate(flist):
+ if fname.endswith('.gz'):
+ dataset.metadata.bgzip = fname
+ try:
+ fh = gzip.open(os.path.join(efp,fname),'r')
+ buf = fh.read(5000)
+ lines = buf.splitlines()
+ headers = lines[0].split('\t')
+ dataset.metadata.annotation = headers[4:]
+ except Exception,e:
+ log.warn("set_meta fname: %s %s" % (fname,str(e)))
+ finally:
+ fh.close()
+ if fname.endswith('.tbi'):
+ dataset.metadata.index = fname
+ self.regenerate_primary_file(dataset)
+ except Exception,e:
+ log.warn("set_meta fname: %s %s" % (dataset.file_name if dataset and dataset.file_name else 'Unkwown',str(e)))
+
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
7 new commits in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/5046a675329b/
Changeset: 5046a675329b
Branch: snpeff_datatype
User: BjoernGruening
Date: 2015-01-16 20:38:18+00:00
Summary: add SnpEffDb datatype
Affected #: 1 file
diff -r b5c7266dbb69f81864d96247ff11be42246e94de -r 5046a675329b6ff33b79a412f4a195b5932dec96 lib/galaxy/datatypes/text.py
--- a/lib/galaxy/datatypes/text.py
+++ b/lib/galaxy/datatypes/text.py
@@ -18,7 +18,6 @@
import logging
log = logging.getLogger(__name__)
-
class Json( Text ):
file_ext = "json"
@@ -259,3 +258,52 @@
dataset.metadata.comment_lines = comment_lines
dataset.metadata.columns = column_count
+
+class SnpEffDb( Text ):
+ """Class describing a SnpEff genome build"""
+ file_ext = "snpeffdb"
+ MetadataElement( name="genome_version", default=None, desc="Genome Version", readonly=True, visible=True, no_value=None )
+ MetadataElement( name="regulation", default=[], desc="Regulation Names", readonly=True, visible=True, no_value=[], optional=True)
+ MetadataElement( name="annotation", default=[], desc="Annotation Names", readonly=True, visible=True, no_value=[], optional=True)
+
+ def __init__( self, **kwd ):
+ Text.__init__( self, **kwd )
+
+ def set_meta( self, dataset, **kwd ):
+ Text.set_meta(self, dataset, **kwd )
+ data_dir = dataset.extra_files_path
+ ## search data_dir/genome_version for files
+ regulation_pattern = 'regulation_(.+).bin'
+ # annotation files that are included in snpEff by a flag
+ annotations_dict = {'nextProt.bin' : '-nextprot','motif.bin': '-motif'}
+ regulations = []
+ annotations = []
+ if data_dir and os.path.isdir(data_dir):
+ for root, dirs, files in os.walk(data_dir):
+ for fname in files:
+ if fname.startswith('snpEffectPredictor'):
+ # if snpEffectPredictor.bin download succeeded
+ genome_version = os.path.basename(root)
+ dataset.metadata.genome_version = genome_version
+ else:
+ m = re.match(regulation_pattern,fname)
+ if m:
+ name = m.groups()[0]
+ regulations.append(name)
+ elif fname in annotations_dict:
+ value = annotations_dict[fname]
+ name = value.lstrip('-')
+ annotations.append(name)
+ dataset.metadata.regulation = regulations
+ dataset.metadata.annotation = annotations
+ try:
+ fh = file(dataset.file_name,'w')
+ fh.write("%s\n" % genome_version)
+ if annotations:
+ fh.write("annotations: %s\n" % ','.join(annotations))
+ if regulations:
+ fh.write("regulations: %s\n" % ','.join(regulations))
+ fh.close()
+ except:
+ pass
+
https://bitbucket.org/galaxy/galaxy-central/commits/2ce557458f86/
Changeset: 2ce557458f86
Branch: snpeff_datatype
User: BjoernGruening
Date: 2015-01-16 20:42:08+00:00
Summary: activate snpeffdb and snpeffdbv4
Affected #: 1 file
diff -r 5046a675329b6ff33b79a412f4a195b5932dec96 -r 2ce557458f868a44d068b148651cf4c9af6f573f config/datatypes_conf.xml.sample
--- a/config/datatypes_conf.xml.sample
+++ b/config/datatypes_conf.xml.sample
@@ -176,6 +176,8 @@
</datatype><datatype extension="scf" type="galaxy.datatypes.binary:Scf" mimetype="application/octet-stream" display_in_upload="true" description="A binary sequence file in 'scf' format with a '.scf' file extension. You must manually select this 'File Format' when uploading the file." description_url="https://wiki.galaxyproject.org/Learn/Datatypes#Scf"/><datatype extension="Sequences" type="galaxy.datatypes.assembly:Sequences" display_in_upload="false"/>
+ <datatype extension="snpeffdb" type="galaxy.datatypes.snpeff:SnpEffDb" display_in_upload="True"/>
+ <datatype extension="snpeffdbv4" type="galaxy.datatypes.snpeff:SnpEffDb" subclass="True" display_in_upload="True"/><datatype extension="sff" type="galaxy.datatypes.binary:Sff" mimetype="application/octet-stream" display_in_upload="true" description="A binary file in 'Standard Flowgram Format' with a '.sff' file extension." description_url="https://wiki.galaxyproject.org/Learn/Datatypes#Sff"/><datatype extension="svg" type="galaxy.datatypes.images:Image" mimetype="image/svg+xml"/><datatype extension="taxonomy" type="galaxy.datatypes.tabular:Taxonomy" display_in_upload="true"/>
https://bitbucket.org/galaxy/galaxy-central/commits/e161cc633e06/
Changeset: e161cc633e06
Branch: snpeff_datatype
User: BjoernGruening
Date: 2015-01-16 21:07:41+00:00
Summary: add SnpSiftDbNSFP datatype
Affected #: 1 file
diff -r 2ce557458f868a44d068b148651cf4c9af6f573f -r e161cc633e066626e93ad5892170e22e9d198579 lib/galaxy/datatypes/text.py
--- a/lib/galaxy/datatypes/text.py
+++ b/lib/galaxy/datatypes/text.py
@@ -2,7 +2,6 @@
""" Clearing house for generic text datatypes that are not XML or tabular.
"""
-
from galaxy.datatypes.data import Text
from galaxy.datatypes.data import get_file_peek
from galaxy.datatypes.data import nice_size
@@ -12,6 +11,7 @@
import tempfile
import subprocess
import json
+import gzip
import os
import re
@@ -307,3 +307,72 @@
except:
pass
+
+class SnpSiftDbNSFP( Text ):
+ """Class describing a dbNSFP database prepared fpr use by SnpSift dbnsfp """
+ MetadataElement( name='reference_name', default='dbSNFP' , desc='Reference Name', readonly=True, visible=True, set_in_upload=True, no_value='dbSNFP' )
+ MetadataElement( name="bgzip", default=None, desc="dbNSFP bgzip", readonly=True, visible=True, no_value=None )
+ MetadataElement( name="index", default=None, desc="Tabix Index File", readonly=True, visible=True, no_value=None)
+ MetadataElement( name="annotation", default=[], desc="Annotation Names", readonly=True, visible=True, no_value=[] )
+ file_ext = "snpsiftdbnsfp"
+ composite_type = 'auto_primary_file'
+ allow_datatype_change = False
+ """
+ ## The dbNSFP file is a tabular file with 1 header line
+ ## The first 4 columns are required to be: chrom pos ref alt
+ ## These match columns 1,2,4,5 of the VCF file
+ ## SnpSift requires the file to be block-gzipped and the indexed with samtools tabix
+ ## Example:
+ ## Compress using block-gzip algorithm
+ bgzip dbNSFP2.3.txt
+ ## Create tabix index
+ tabix -s 1 -b 2 -e 2 dbNSFP2.3.txt.gz
+ """
+ def __init__( self, **kwd ):
+ Text.__init__( self, **kwd )
+ self.add_composite_file( '%s.grp', description = 'Group File', substitute_name_with_metadata = 'reference_name', is_binary = False )
+ self.add_composite_file( '%s.ti', description = '', substitute_name_with_metadata = 'reference_name', is_binary = False )
+ def init_meta( self, dataset, copy_from=None ):
+ Text.init_meta( self, dataset, copy_from=copy_from )
+ def generate_primary_file( self, dataset = None ):
+ """
+ This is called only at upload to write the html file
+ cannot rename the datasets here - they come with the default unfortunately
+ """
+ regenerate_primary_file( self, dataset)
+ def regenerate_primary_file(self,dataset):
+ """
+ cannot do this until we are setting metadata
+ """
+ annotations = "dbNSFP Annotations: %s\n" % ','.join(dataset.metadata.annotation)
+ f = open(dataset.file_name,'a')
+ if dataset.metadata.bgzip:
+ bn = dataset.metadata.bgzip
+ f.write(bn)
+ f.write('\n')
+ f.write(annotations)
+ f.close()
+ def set_meta( self, dataset, overwrite=True, **kwd ):
+ try:
+ efp = dataset.extra_files_path
+ if os.path.exists(efp):
+ flist = os.listdir(efp)
+ for i,fname in enumerate(flist):
+ if fname.endswith('.gz'):
+ dataset.metadata.bgzip = fname
+ try:
+ fh = gzip.open(os.path.join(efp,fname),'r')
+ buf = fh.read(5000)
+ lines = buf.splitlines()
+ headers = lines[0].split('\t')
+ dataset.metadata.annotation = headers[4:]
+ except Exception,e:
+ log.warn("set_meta fname: %s %s" % (fname,str(e)))
+ finally:
+ fh.close()
+ if fname.endswith('.tbi'):
+ dataset.metadata.index = fname
+ self.regenerate_primary_file(dataset)
+ except Exception,e:
+ log.warn("set_meta fname: %s %s" % (dataset.file_name if dataset and dataset.file_name else 'Unkwown',str(e)))
+
https://bitbucket.org/galaxy/galaxy-central/commits/11491dfccddb/
Changeset: 11491dfccddb
Branch: snpeff_datatype
User: BjoernGruening
Date: 2015-01-16 21:08:29+00:00
Summary: activate SnpSiftDbNSFP and dbnsfp.tabular
Affected #: 1 file
diff -r e161cc633e066626e93ad5892170e22e9d198579 -r 11491dfccddbf671a96ea73d78d42666521e4a53 config/datatypes_conf.xml.sample
--- a/config/datatypes_conf.xml.sample
+++ b/config/datatypes_conf.xml.sample
@@ -113,7 +113,7 @@
<converter file="interval_to_bed12_converter.xml" target_datatype="bed12"/><converter file="interval_to_bgzip_converter.xml" target_datatype="bgzip"/><converter file="interval_to_tabix_converter.xml" target_datatype="tabix" depends_on="bgzip"/>
- <converter file="interval_to_bigwig_converter.xml" target_datatype="bigwig"/>
+ <converter file="interval_to_bigwig_converter.xml" target_datatype="bigwig"/><!-- <display file="ucsc/interval_as_bed.xml" inherit="True" /> --><display file="ensembl/ensembl_interval_as_bed.xml" inherit="True"/><display file="gbrowse/gbrowse_interval_as_bed.xml" inherit="True"/>
@@ -151,11 +151,11 @@
<datatype extension="mafcustomtrack" type="galaxy.datatypes.sequence:MafCustomTrack"><display file="ucsc/maf_customtrack.xml" /></datatype>
- <datatype extension="encodepeak" type="galaxy.datatypes.interval:ENCODEPeak" display_in_upload="True">
- <converter file="encodepeak_to_tabix_converter.xml" target_datatype="tabix" depends_on="bgzip"/>
- <converter file="encodepeak_to_bgzip_converter.xml" target_datatype="bgzip"/>
- <converter file="bed_gff_or_vcf_to_bigwig_converter.xml" target_datatype="bigwig"/>
- </datatype>
+ <datatype extension="encodepeak" type="galaxy.datatypes.interval:ENCODEPeak" display_in_upload="True">
+ <converter file="encodepeak_to_tabix_converter.xml" target_datatype="tabix" depends_on="bgzip"/>
+ <converter file="encodepeak_to_bgzip_converter.xml" target_datatype="bgzip"/>
+ <converter file="bed_gff_or_vcf_to_bigwig_converter.xml" target_datatype="bigwig"/>
+ </datatype><datatype extension="pdf" type="galaxy.datatypes.images:Pdf" mimetype="application/pdf"/><datatype extension="pileup" type="galaxy.datatypes.tabular:Pileup" display_in_upload="true"><converter file="interval_to_bgzip_converter.xml" target_datatype="bgzip"/>
@@ -171,13 +171,17 @@
<datatype extension="qual454" type="galaxy.datatypes.qualityscore:QualityScore454" display_in_upload="true"/><datatype extension="Roadmaps" type="galaxy.datatypes.assembly:Roadmaps" display_in_upload="false"/><datatype extension="sam" type="galaxy.datatypes.tabular:Sam" display_in_upload="true">
- <converter file="sam_to_bam.xml" target_datatype="bam"/>
- <converter file="sam_to_bigwig_converter.xml" target_datatype="bigwig"/>
- </datatype>
+ <converter file="sam_to_bam.xml" target_datatype="bam"/>
+ <converter file="sam_to_bigwig_converter.xml" target_datatype="bigwig"/>
+ </datatype><datatype extension="scf" type="galaxy.datatypes.binary:Scf" mimetype="application/octet-stream" display_in_upload="true" description="A binary sequence file in 'scf' format with a '.scf' file extension. You must manually select this 'File Format' when uploading the file." description_url="https://wiki.galaxyproject.org/Learn/Datatypes#Scf"/><datatype extension="Sequences" type="galaxy.datatypes.assembly:Sequences" display_in_upload="false"/>
- <datatype extension="snpeffdb" type="galaxy.datatypes.snpeff:SnpEffDb" display_in_upload="True"/>
- <datatype extension="snpeffdbv4" type="galaxy.datatypes.snpeff:SnpEffDb" subclass="True" display_in_upload="True"/>
+ <datatype extension="snpeffdb" type="galaxy.datatypes.text:SnpEffDb" display_in_upload="True"/>
+ <datatype extension="snpeffdbv4" type="galaxy.datatypes.text:SnpEffDb" subclass="True" display_in_upload="True"/>
+ <datatype extension="snpsiftdbnsfp" type="galaxy.datatypes.txt:SnpSiftDbNSFP" display_in_upload="True"/>
+ <datatype extension="dbnsfp.tabular" type="galaxy.datatypes.tabular:Tabular" subclass="True" display_in_upload="True">
+ <converter file="tabular_to_dbnsfp.xml" target_datatype="snpsiftdbnsfp"/>
+ </datatype><datatype extension="sff" type="galaxy.datatypes.binary:Sff" mimetype="application/octet-stream" display_in_upload="true" description="A binary file in 'Standard Flowgram Format' with a '.sff' file extension." description_url="https://wiki.galaxyproject.org/Learn/Datatypes#Sff"/><datatype extension="svg" type="galaxy.datatypes.images:Image" mimetype="image/svg+xml"/><datatype extension="taxonomy" type="galaxy.datatypes.tabular:Taxonomy" display_in_upload="true"/>
https://bitbucket.org/galaxy/galaxy-central/commits/f4c5ac446f19/
Changeset: f4c5ac446f19
Branch: snpeff_datatype
User: BjoernGruening
Date: 2015-01-16 21:59:04+00:00
Summary: add converters
Affected #: 1 file
diff -r 11491dfccddbf671a96ea73d78d42666521e4a53 -r f4c5ac446f191b504ef2d9f31c9e3d33aa29c52e lib/galaxy/datatypes/converters/tabular_to_dbnsfp.xml
--- /dev/null
+++ b/lib/galaxy/datatypes/converters/tabular_to_dbnsfp.xml
@@ -0,0 +1,12 @@
+<tool id="tabular_to_dbnsfp" name="Convert tabular to dbnsfp" version="1.0.0">
+ <description></description>
+ <command interpreter="python">tabular_to_dbnsfp.py $input $dbnsfp.extra_files_path/dbNSFP.gz</command>
+ <inputs>
+ <param format="tabular" name="input" type="data" label="Choose a dbnsfp tabular file"/>
+ </inputs>
+ <outputs>
+ <data format="snpsiftdbnsfp" name="dbnsfp"/>
+ </outputs>
+ <help>
+ </help>
+</tool>
https://bitbucket.org/galaxy/galaxy-central/commits/c862a73eb896/
Changeset: c862a73eb896
Branch: snpeff_datatype
User: BjoernGruening
Date: 2015-01-17 13:05:44+00:00
Summary: Remove not needed datatype, we now can filter datatypes by metadata.
Affected #: 1 file
diff -r f4c5ac446f191b504ef2d9f31c9e3d33aa29c52e -r c862a73eb8967624ccfb9c2847a030176a7c4981 config/datatypes_conf.xml.sample
--- a/config/datatypes_conf.xml.sample
+++ b/config/datatypes_conf.xml.sample
@@ -177,7 +177,6 @@
<datatype extension="scf" type="galaxy.datatypes.binary:Scf" mimetype="application/octet-stream" display_in_upload="true" description="A binary sequence file in 'scf' format with a '.scf' file extension. You must manually select this 'File Format' when uploading the file." description_url="https://wiki.galaxyproject.org/Learn/Datatypes#Scf"/><datatype extension="Sequences" type="galaxy.datatypes.assembly:Sequences" display_in_upload="false"/><datatype extension="snpeffdb" type="galaxy.datatypes.text:SnpEffDb" display_in_upload="True"/>
- <datatype extension="snpeffdbv4" type="galaxy.datatypes.text:SnpEffDb" subclass="True" display_in_upload="True"/><datatype extension="snpsiftdbnsfp" type="galaxy.datatypes.txt:SnpSiftDbNSFP" display_in_upload="True"/><datatype extension="dbnsfp.tabular" type="galaxy.datatypes.tabular:Tabular" subclass="True" display_in_upload="True"><converter file="tabular_to_dbnsfp.xml" target_datatype="snpsiftdbnsfp"/>
https://bitbucket.org/galaxy/galaxy-central/commits/482d85dda5d3/
Changeset: 482d85dda5d3
User: jmchilton
Date: 2015-01-23 17:12:43+00:00
Summary: Merged in BjoernGruening/galaxy-central-1/snpeff_datatype (pull request #640)
Add SnpEff datatypes
Affected #: 3 files
diff -r 2fd8714c4faeb580f3ccf1591003f10e821397a1 -r 482d85dda5d3546e1d6e9cca6d712d7af8c772ba config/datatypes_conf.xml.sample
--- a/config/datatypes_conf.xml.sample
+++ b/config/datatypes_conf.xml.sample
@@ -113,7 +113,7 @@
<converter file="interval_to_bed12_converter.xml" target_datatype="bed12"/><converter file="interval_to_bgzip_converter.xml" target_datatype="bgzip"/><converter file="interval_to_tabix_converter.xml" target_datatype="tabix" depends_on="bgzip"/>
- <converter file="interval_to_bigwig_converter.xml" target_datatype="bigwig"/>
+ <converter file="interval_to_bigwig_converter.xml" target_datatype="bigwig"/><!-- <display file="ucsc/interval_as_bed.xml" inherit="True" /> --><display file="ensembl/ensembl_interval_as_bed.xml" inherit="True"/><display file="gbrowse/gbrowse_interval_as_bed.xml" inherit="True"/>
@@ -152,11 +152,11 @@
<datatype extension="mafcustomtrack" type="galaxy.datatypes.sequence:MafCustomTrack"><display file="ucsc/maf_customtrack.xml" /></datatype>
- <datatype extension="encodepeak" type="galaxy.datatypes.interval:ENCODEPeak" display_in_upload="True">
- <converter file="encodepeak_to_tabix_converter.xml" target_datatype="tabix" depends_on="bgzip"/>
- <converter file="encodepeak_to_bgzip_converter.xml" target_datatype="bgzip"/>
- <converter file="bed_gff_or_vcf_to_bigwig_converter.xml" target_datatype="bigwig"/>
- </datatype>
+ <datatype extension="encodepeak" type="galaxy.datatypes.interval:ENCODEPeak" display_in_upload="True">
+ <converter file="encodepeak_to_tabix_converter.xml" target_datatype="tabix" depends_on="bgzip"/>
+ <converter file="encodepeak_to_bgzip_converter.xml" target_datatype="bgzip"/>
+ <converter file="bed_gff_or_vcf_to_bigwig_converter.xml" target_datatype="bigwig"/>
+ </datatype><datatype extension="pdf" type="galaxy.datatypes.images:Pdf" mimetype="application/pdf"/><datatype extension="pileup" type="galaxy.datatypes.tabular:Pileup" display_in_upload="true"><converter file="interval_to_bgzip_converter.xml" target_datatype="bgzip"/>
@@ -172,11 +172,16 @@
<datatype extension="qual454" type="galaxy.datatypes.qualityscore:QualityScore454" display_in_upload="true"/><datatype extension="Roadmaps" type="galaxy.datatypes.assembly:Roadmaps" display_in_upload="false"/><datatype extension="sam" type="galaxy.datatypes.tabular:Sam" display_in_upload="true">
- <converter file="sam_to_bam.xml" target_datatype="bam"/>
- <converter file="sam_to_bigwig_converter.xml" target_datatype="bigwig"/>
- </datatype>
+ <converter file="sam_to_bam.xml" target_datatype="bam"/>
+ <converter file="sam_to_bigwig_converter.xml" target_datatype="bigwig"/>
+ </datatype><datatype extension="scf" type="galaxy.datatypes.binary:Scf" mimetype="application/octet-stream" display_in_upload="true" description="A binary sequence file in 'scf' format with a '.scf' file extension. You must manually select this 'File Format' when uploading the file." description_url="https://wiki.galaxyproject.org/Learn/Datatypes#Scf"/><datatype extension="Sequences" type="galaxy.datatypes.assembly:Sequences" display_in_upload="false"/>
+ <datatype extension="snpeffdb" type="galaxy.datatypes.text:SnpEffDb" display_in_upload="True"/>
+ <datatype extension="snpsiftdbnsfp" type="galaxy.datatypes.txt:SnpSiftDbNSFP" display_in_upload="True"/>
+ <datatype extension="dbnsfp.tabular" type="galaxy.datatypes.tabular:Tabular" subclass="True" display_in_upload="True">
+ <converter file="tabular_to_dbnsfp.xml" target_datatype="snpsiftdbnsfp"/>
+ </datatype><datatype extension="sff" type="galaxy.datatypes.binary:Sff" mimetype="application/octet-stream" display_in_upload="true" description="A binary file in 'Standard Flowgram Format' with a '.sff' file extension." description_url="https://wiki.galaxyproject.org/Learn/Datatypes#Sff"/><datatype extension="svg" type="galaxy.datatypes.images:Image" mimetype="image/svg+xml"/><datatype extension="taxonomy" type="galaxy.datatypes.tabular:Taxonomy" display_in_upload="true"/>
diff -r 2fd8714c4faeb580f3ccf1591003f10e821397a1 -r 482d85dda5d3546e1d6e9cca6d712d7af8c772ba lib/galaxy/datatypes/converters/tabular_to_dbnsfp.xml
--- /dev/null
+++ b/lib/galaxy/datatypes/converters/tabular_to_dbnsfp.xml
@@ -0,0 +1,12 @@
+<tool id="tabular_to_dbnsfp" name="Convert tabular to dbnsfp" version="1.0.0">
+ <description></description>
+ <command interpreter="python">tabular_to_dbnsfp.py $input $dbnsfp.extra_files_path/dbNSFP.gz</command>
+ <inputs>
+ <param format="tabular" name="input" type="data" label="Choose a dbnsfp tabular file"/>
+ </inputs>
+ <outputs>
+ <data format="snpsiftdbnsfp" name="dbnsfp"/>
+ </outputs>
+ <help>
+ </help>
+</tool>
diff -r 2fd8714c4faeb580f3ccf1591003f10e821397a1 -r 482d85dda5d3546e1d6e9cca6d712d7af8c772ba lib/galaxy/datatypes/text.py
--- a/lib/galaxy/datatypes/text.py
+++ b/lib/galaxy/datatypes/text.py
@@ -2,7 +2,6 @@
""" Clearing house for generic text datatypes that are not XML or tabular.
"""
-
from galaxy.datatypes.data import Text
from galaxy.datatypes.data import get_file_peek
from galaxy.datatypes.data import nice_size
@@ -12,13 +11,13 @@
import tempfile
import subprocess
import json
+import gzip
import os
import re
import logging
log = logging.getLogger(__name__)
-
class Json( Text ):
file_ext = "json"
@@ -259,3 +258,121 @@
dataset.metadata.comment_lines = comment_lines
dataset.metadata.columns = column_count
+
+class SnpEffDb( Text ):
+ """Class describing a SnpEff genome build"""
+ file_ext = "snpeffdb"
+ MetadataElement( name="genome_version", default=None, desc="Genome Version", readonly=True, visible=True, no_value=None )
+ MetadataElement( name="regulation", default=[], desc="Regulation Names", readonly=True, visible=True, no_value=[], optional=True)
+ MetadataElement( name="annotation", default=[], desc="Annotation Names", readonly=True, visible=True, no_value=[], optional=True)
+
+ def __init__( self, **kwd ):
+ Text.__init__( self, **kwd )
+
+ def set_meta( self, dataset, **kwd ):
+ Text.set_meta(self, dataset, **kwd )
+ data_dir = dataset.extra_files_path
+ ## search data_dir/genome_version for files
+ regulation_pattern = 'regulation_(.+).bin'
+ # annotation files that are included in snpEff by a flag
+ annotations_dict = {'nextProt.bin' : '-nextprot','motif.bin': '-motif'}
+ regulations = []
+ annotations = []
+ if data_dir and os.path.isdir(data_dir):
+ for root, dirs, files in os.walk(data_dir):
+ for fname in files:
+ if fname.startswith('snpEffectPredictor'):
+ # if snpEffectPredictor.bin download succeeded
+ genome_version = os.path.basename(root)
+ dataset.metadata.genome_version = genome_version
+ else:
+ m = re.match(regulation_pattern,fname)
+ if m:
+ name = m.groups()[0]
+ regulations.append(name)
+ elif fname in annotations_dict:
+ value = annotations_dict[fname]
+ name = value.lstrip('-')
+ annotations.append(name)
+ dataset.metadata.regulation = regulations
+ dataset.metadata.annotation = annotations
+ try:
+ fh = file(dataset.file_name,'w')
+ fh.write("%s\n" % genome_version)
+ if annotations:
+ fh.write("annotations: %s\n" % ','.join(annotations))
+ if regulations:
+ fh.write("regulations: %s\n" % ','.join(regulations))
+ fh.close()
+ except:
+ pass
+
+
+class SnpSiftDbNSFP( Text ):
+ """Class describing a dbNSFP database prepared fpr use by SnpSift dbnsfp """
+ MetadataElement( name='reference_name', default='dbSNFP' , desc='Reference Name', readonly=True, visible=True, set_in_upload=True, no_value='dbSNFP' )
+ MetadataElement( name="bgzip", default=None, desc="dbNSFP bgzip", readonly=True, visible=True, no_value=None )
+ MetadataElement( name="index", default=None, desc="Tabix Index File", readonly=True, visible=True, no_value=None)
+ MetadataElement( name="annotation", default=[], desc="Annotation Names", readonly=True, visible=True, no_value=[] )
+ file_ext = "snpsiftdbnsfp"
+ composite_type = 'auto_primary_file'
+ allow_datatype_change = False
+ """
+ ## The dbNSFP file is a tabular file with 1 header line
+ ## The first 4 columns are required to be: chrom pos ref alt
+ ## These match columns 1,2,4,5 of the VCF file
+ ## SnpSift requires the file to be block-gzipped and the indexed with samtools tabix
+ ## Example:
+ ## Compress using block-gzip algorithm
+ bgzip dbNSFP2.3.txt
+ ## Create tabix index
+ tabix -s 1 -b 2 -e 2 dbNSFP2.3.txt.gz
+ """
+ def __init__( self, **kwd ):
+ Text.__init__( self, **kwd )
+ self.add_composite_file( '%s.grp', description = 'Group File', substitute_name_with_metadata = 'reference_name', is_binary = False )
+ self.add_composite_file( '%s.ti', description = '', substitute_name_with_metadata = 'reference_name', is_binary = False )
+ def init_meta( self, dataset, copy_from=None ):
+ Text.init_meta( self, dataset, copy_from=copy_from )
+ def generate_primary_file( self, dataset = None ):
+ """
+ This is called only at upload to write the html file
+ cannot rename the datasets here - they come with the default unfortunately
+ """
+ regenerate_primary_file( self, dataset)
+ def regenerate_primary_file(self,dataset):
+ """
+ cannot do this until we are setting metadata
+ """
+ annotations = "dbNSFP Annotations: %s\n" % ','.join(dataset.metadata.annotation)
+ f = open(dataset.file_name,'a')
+ if dataset.metadata.bgzip:
+ bn = dataset.metadata.bgzip
+ f.write(bn)
+ f.write('\n')
+ f.write(annotations)
+ f.close()
+ def set_meta( self, dataset, overwrite=True, **kwd ):
+ try:
+ efp = dataset.extra_files_path
+ if os.path.exists(efp):
+ flist = os.listdir(efp)
+ for i,fname in enumerate(flist):
+ if fname.endswith('.gz'):
+ dataset.metadata.bgzip = fname
+ try:
+ fh = gzip.open(os.path.join(efp,fname),'r')
+ buf = fh.read(5000)
+ lines = buf.splitlines()
+ headers = lines[0].split('\t')
+ dataset.metadata.annotation = headers[4:]
+ except Exception,e:
+ log.warn("set_meta fname: %s %s" % (fname,str(e)))
+ finally:
+ fh.close()
+ if fname.endswith('.tbi'):
+ dataset.metadata.index = fname
+ self.regenerate_primary_file(dataset)
+ except Exception,e:
+ log.warn("set_meta fname: %s %s" % (dataset.file_name if dataset and dataset.file_name else 'Unkwown',str(e)))
+
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
commit/galaxy-central: jmchilton: Merged in BjoernGruening/galaxy-central-1/toolshed_blacklist_additions (pull request #627)
by commits-noreply@bitbucket.org 23 Jan '15
by commits-noreply@bitbucket.org 23 Jan '15
23 Jan '15
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/2fd8714c4fae/
Changeset: 2fd8714c4fae
User: jmchilton
Date: 2015-01-23 17:11:03+00:00
Summary: Merged in BjoernGruening/galaxy-central-1/toolshed_blacklist_additions (pull request #627)
Add planemo test file to tool shed upoad blacklist.
Affected #: 1 file
diff -r 820114af3bf0689131885c8c99165532902bd2af -r 2fd8714c4faeb580f3ccf1591003f10e821397a1 lib/tool_shed/util/commit_util.py
--- a/lib/tool_shed/util/commit_util.py
+++ b/lib/tool_shed/util/commit_util.py
@@ -18,7 +18,7 @@
log = logging.getLogger( __name__ )
UNDESIRABLE_DIRS = [ '.hg', '.svn', '.git', '.cvs' ]
-UNDESIRABLE_FILES = [ '.hg_archival.txt', 'hgrc', '.DS_Store' ]
+UNDESIRABLE_FILES = [ '.hg_archival.txt', 'hgrc', '.DS_Store', 'tool_test_output.html', 'tool_test_output.json' ]
def check_archive( repository, archive ):
for member in archive.getmembers():
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
3 new commits in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/97a77506847e/
Changeset: 97a77506847e
Branch: toolshed_blacklist_additions
User: BjoernGruening
Date: 2015-01-09 18:59:30+00:00
Summary: Created new branch toolshed_blacklist_additions
Affected #: 0 files
https://bitbucket.org/galaxy/galaxy-central/commits/bd2fa769a2ac/
Changeset: bd2fa769a2ac
Branch: toolshed_blacklist_additions
User: BjoernGruening
Date: 2015-01-09 19:02:42+00:00
Summary: Add planemo test files to the tool shed upload blacklist.
Affected #: 1 file
diff -r 97a77506847e010f4ab460f9890a214dce679cdf -r bd2fa769a2acf77b6a66e921bab6498ccfd199dc lib/tool_shed/util/commit_util.py
--- a/lib/tool_shed/util/commit_util.py
+++ b/lib/tool_shed/util/commit_util.py
@@ -18,7 +18,7 @@
log = logging.getLogger( __name__ )
UNDESIRABLE_DIRS = [ '.hg', '.svn', '.git', '.cvs' ]
-UNDESIRABLE_FILES = [ '.hg_archival.txt', 'hgrc', '.DS_Store' ]
+UNDESIRABLE_FILES = [ '.hg_archival.txt', 'hgrc', '.DS_Store', 'tool_test_output.html', 'tool_test_output.json' ]
def check_archive( repository, archive ):
for member in archive.getmembers():
https://bitbucket.org/galaxy/galaxy-central/commits/2fd8714c4fae/
Changeset: 2fd8714c4fae
User: jmchilton
Date: 2015-01-23 17:11:03+00:00
Summary: Merged in BjoernGruening/galaxy-central-1/toolshed_blacklist_additions (pull request #627)
Add planemo test file to tool shed upoad blacklist.
Affected #: 1 file
diff -r 820114af3bf0689131885c8c99165532902bd2af -r 2fd8714c4faeb580f3ccf1591003f10e821397a1 lib/tool_shed/util/commit_util.py
--- a/lib/tool_shed/util/commit_util.py
+++ b/lib/tool_shed/util/commit_util.py
@@ -18,7 +18,7 @@
log = logging.getLogger( __name__ )
UNDESIRABLE_DIRS = [ '.hg', '.svn', '.git', '.cvs' ]
-UNDESIRABLE_FILES = [ '.hg_archival.txt', 'hgrc', '.DS_Store' ]
+UNDESIRABLE_FILES = [ '.hg_archival.txt', 'hgrc', '.DS_Store', 'tool_test_output.html', 'tool_test_output.json' ]
def check_archive( repository, archive ):
for member in archive.getmembers():
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
commit/galaxy-central: guerler: ToolForm: Fix optional dataset parameters, fix inconsistencies in parameter handling
by commits-noreply@bitbucket.org 23 Jan '15
by commits-noreply@bitbucket.org 23 Jan '15
23 Jan '15
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/820114af3bf0/
Changeset: 820114af3bf0
User: guerler
Date: 2015-01-23 17:04:50+00:00
Summary: ToolForm: Fix optional dataset parameters, fix inconsistencies in parameter handling
Affected #: 30 files
diff -r b73cb7a7cdca3545d6347c5c4da24cfcc0841c2d -r 820114af3bf0689131885c8c99165532902bd2af client/galaxy/scripts/mvc/tools/tools-form-base.js
--- a/client/galaxy/scripts/mvc/tools/tools-form-base.js
+++ b/client/galaxy/scripts/mvc/tools/tools-form-base.js
@@ -18,9 +18,7 @@
// shows form in compact view mode
compact : false,
// shows errors on start
- initial_errors : false,
- // ensures that all data including disabled optional fields are submitted to the server
- send_all : false
+ initial_errors : false
};
// configure options
diff -r b73cb7a7cdca3545d6347c5c4da24cfcc0841c2d -r 820114af3bf0689131885c8c99165532902bd2af client/galaxy/scripts/mvc/tools/tools-form-workflow.js
--- a/client/galaxy/scripts/mvc/tools/tools-form-workflow.js
+++ b/client/galaxy/scripts/mvc/tools/tools-form-workflow.js
@@ -16,13 +16,16 @@
}
// initialize parameters
- this.workflow = true;
this.options = options;
-
+
+ // set labels
+ this.options.text_enable = 'In Advance';
+ this.options.text_disable = 'At Runtime';
+
// declare fields as optional
Utils.deepeach(options.inputs, function(item) {
if (item.type) {
- item.optional = (['data', 'data_hidden', 'hidden', 'drill_down']).indexOf(item.type) == -1;
+ item.optional = (['data', 'data_hidden', 'hidden', 'drill_down', 'repeat', 'conditional']).indexOf(item.type) == -1;
}
});
diff -r b73cb7a7cdca3545d6347c5c4da24cfcc0841c2d -r 820114af3bf0689131885c8c99165532902bd2af client/galaxy/scripts/mvc/tools/tools-input.js
--- a/client/galaxy/scripts/mvc/tools/tools-input.js
+++ b/client/galaxy/scripts/mvc/tools/tools-input.js
@@ -10,9 +10,13 @@
// link app
this.app = app;
+ // set text labels
+ this.text_enable = app.options.text_enable || 'Enable';
+ this.text_disable = app.options.text_disable || 'Disable';
+
// link field
this.field = options.field;
- this.defaultvalue = options.defaultvalue;
+ this.default_value = options.default_value;
// set element
this.setElement(this._template(options));
@@ -30,10 +34,11 @@
this.field.skip = false;
var v = this.field.value && this.field.value();
this.field.skip = Boolean(options.optional &&
+ ((this.default_value === undefined) ||
((this.field.validate && !this.field.validate()) || !v ||
- (v == this.defaultvalue) || (Number(v) == Number(this.defaultvalue)) ||
- (JSON.stringify(v) == JSON.stringify(this.defaultvalue))));
-
+ (v == this.default_value) || (Number(v) == Number(this.default_value)) ||
+ (JSON.stringify(v) == JSON.stringify(this.default_value)))));
+
// refresh view
this._refresh();
@@ -53,7 +58,7 @@
error: function(text) {
if (!this.field.skip) {
this.$error_text.html(text);
- this.$error.fadeIn('fast');
+ this.$error.show();
this.$el.addClass('ui-error');
}
},
@@ -70,12 +75,12 @@
_refresh: function() {
if (!this.field.skip) {
this.$field.fadeIn('fast');
- this.$title_optional.html('Disable');
+ this.$title_optional.html(this.text_disable);
} else {
this.reset();
this.$field.hide();
- this.$title_optional.html('Enable');
- this.field.value && this.field.value(this.defaultvalue);
+ this.$title_optional.html(this.text_enable);
+ this.field.value && this.field.value(this.default_value);
}
this.app.trigger('refresh');
},
diff -r b73cb7a7cdca3545d6347c5c4da24cfcc0841c2d -r 820114af3bf0689131885c8c99165532902bd2af client/galaxy/scripts/mvc/tools/tools-section.js
--- a/client/galaxy/scripts/mvc/tools/tools-section.js
+++ b/client/galaxy/scripts/mvc/tools/tools-section.js
@@ -319,7 +319,7 @@
// create input field wrapper
var input_element = new InputElement(this.app, {
label : input_def.label,
- defaultvalue : input_def.defaultvalue,
+ default_value : input_def.default_value,
optional : input_def.optional,
help : input_def.help,
field : field
@@ -457,6 +457,7 @@
return new SelectContent.View(this.app, {
id : 'field-' + input_def.id,
extensions : input_def.extensions,
+ optional : input_def.optional,
multiple : input_def.multiple,
type : input_def.type,
data : input_def.options,
diff -r b73cb7a7cdca3545d6347c5c4da24cfcc0841c2d -r 820114af3bf0689131885c8c99165532902bd2af client/galaxy/scripts/mvc/tools/tools-select-content.js
--- a/client/galaxy/scripts/mvc/tools/tools-select-content.js
+++ b/client/galaxy/scripts/mvc/tools/tools-select-content.js
@@ -50,6 +50,7 @@
if (this.mode == 'single') {
radio_buttons.push({icon: 'fa-file-o', label : 'Single dataset', value : 'single'});
this.select_single = new Ui.Select.View({
+ optional : options.optional,
error_text : hda_error,
onchange : function() {
self.trigger('change');
@@ -82,6 +83,7 @@
radio_buttons.push({icon: 'fa-folder-o', label : 'Dataset collection', value : 'collection' });
this.select_collection = new Ui.Select.View({
error_text : hdca_error,
+ optional : options.optional,
onchange : function() {
self.trigger('change');
}
@@ -180,39 +182,38 @@
},
/** Return the currently selected dataset values */
- value : function (dict) {
+ value : function (new_value) {
// update current value
- if (dict && dict.values) {
- try {
- // create list
- var list = [];
- for (var i in dict.values) {
- list.push(dict.values[i].id);
+ if (new_value !== undefined) {
+ if (new_value && new_value.values) {
+ try {
+ // create list with values
+ var list = [];
+ for (var i in new_value.values) {
+ list.push(new_value.values[i].id);
+ }
+
+ // identify suitable select field
+ if (new_value && new_value.values.length > 0 && new_value.values[0].src == 'hcda') {
+ this.current = 'collection';
+ this.select_collection.value(list[0]);
+ } else {
+ if (this.mode == 'multiple') {
+ this.current = 'multiple';
+ this.select_multiple.value(list);
+ } else {
+ this.current = 'single';
+ this.select_single.value(list[0]);
+ }
+ }
+ } catch (err) {
+ console.debug('tools-select-content::value() - Skipped.');
}
-
- // identify suitable select field
- if (dict && dict.values.length > 0 && dict.values[0].src == 'hcda') {
- this.current = 'collection';
- this.select_collection.value(list[0]);
- } else {
- if (this.mode == 'multiple') {
- this.current = 'multiple';
- this.select_multiple.value(list);
- } else {
- this.current = 'single';
- this.select_single.value(list[0]);
- }
- }
- this.refresh();
-
- // check if value has been set
- var select = this._select();
- if (!select.validate()) {
- select.value(select.first());
- }
- } catch (err) {
- console.debug('tools-select-content::value() - Skipped.');
+ } else {
+ this.current = 'single';
+ this.select_single.value('__null__');
}
+ this.refresh();
}
// transform into an array
@@ -247,6 +248,7 @@
/** Refreshes data selection view */
refresh: function() {
+ this.button_type.value(this.current);
for (var i in this.list) {
var $el = this.list[i].field.$el;
if (this.current == i) {
diff -r b73cb7a7cdca3545d6347c5c4da24cfcc0841c2d -r 820114af3bf0689131885c8c99165532902bd2af client/galaxy/scripts/mvc/tools/tools-tree.js
--- a/client/galaxy/scripts/mvc/tools/tools-tree.js
+++ b/client/galaxy/scripts/mvc/tools/tools-tree.js
@@ -121,21 +121,21 @@
if (patch[input.type]) {
value = patch[input.type](value);
}
-
- // handle simple value
- if (!field.skip || self.app.options.send_all) {
- if (field.validate && !field.validate()) {
- value = null;
- }
- if (input.ignore === undefined || (value !== null && input.ignore != value)) {
- // add value to submission
- add (job_input_id, input.id, value);
- // add payload to submission
- if (input.payload) {
- for (var p_id in input.payload) {
- add (p_id, input.id, input.payload[p_id]);
- }
+ // validate value
+ if ((field.skip && input.optional) || (field.validate && !field.validate())) {
+ value = null;
+ }
+
+ // ignore certain values
+ if (input.ignore === undefined || (value !== null && input.ignore != value)) {
+ // add value to submission
+ add (job_input_id, input.id, value);
+
+ // add payload to submission
+ if (input.payload) {
+ for (var p_id in input.payload) {
+ add (p_id, input.id, input.payload[p_id]);
}
}
}
diff -r b73cb7a7cdca3545d6347c5c4da24cfcc0841c2d -r 820114af3bf0689131885c8c99165532902bd2af client/galaxy/scripts/mvc/ui/ui-options.js
--- a/client/galaxy/scripts/mvc/ui/ui-options.js
+++ b/client/galaxy/scripts/mvc/ui/ui-options.js
@@ -182,7 +182,7 @@
// get selected values
var selected = this.$el.find(':checked');
if (selected.length == 0) {
- return 'null';
+ return '__null__';
}
// return multiple or single value
diff -r b73cb7a7cdca3545d6347c5c4da24cfcc0841c2d -r 820114af3bf0689131885c8c99165532902bd2af client/galaxy/scripts/mvc/ui/ui-select-default.js
--- a/client/galaxy/scripts/mvc/ui/ui-select-default.js
+++ b/client/galaxy/scripts/mvc/ui/ui-select-default.js
@@ -10,10 +10,12 @@
id : '',
cls : '',
error_text : 'No data available',
+ empty_text : 'No selection',
visible : true,
wait : false,
multiple : false,
- searchable : false
+ searchable : false,
+ optional : false
},
// initialize
@@ -181,6 +183,11 @@
// remove all options
this.$select.find('option').remove();
+ // add optional field
+ if (this.options.optional && !this.options.multiple) {
+ this.$select.append(this._templateOption({value : '__null__', label : this.options.empty_text}));
+ }
+
// add new options
for (var key in options) {
this.$select.append(this._templateOption(options[key]));
@@ -229,7 +236,7 @@
*/
_refresh: function() {
// remove placeholder
- this.$select.find('option[value=null]').remove();
+ this.$select.find('option[value="__undefined__"]').remove();
// count remaining entries
var remaining = this.$select.find('option').length;
@@ -238,7 +245,7 @@
this.disable();
// append placeholder
- this.$select.append(this._templateOption({value : 'null', label : this.options.error_text}));
+ this.$select.append(this._templateOption({value : '__undefined__', label : this.options.error_text}));
} else {
// enable select field
this.enable();
diff -r b73cb7a7cdca3545d6347c5c4da24cfcc0841c2d -r 820114af3bf0689131885c8c99165532902bd2af client/galaxy/scripts/utils/utils.js
--- a/client/galaxy/scripts/utils/utils.js
+++ b/client/galaxy/scripts/utils/utils.js
@@ -36,7 +36,7 @@
value = [value];
}
for (var i in value) {
- if (['None', null, 'null', undefined, 'undefined'].indexOf(value[i]) > -1) {
+ if (['__null__', '__undefined__', 'None', null, undefined].indexOf(value[i]) > -1) {
return false;
}
}
diff -r b73cb7a7cdca3545d6347c5c4da24cfcc0841c2d -r 820114af3bf0689131885c8c99165532902bd2af lib/galaxy/tools/__init__.py
--- a/lib/galaxy/tools/__init__.py
+++ b/lib/galaxy/tools/__init__.py
@@ -2333,7 +2333,10 @@
value = [ jsonify(v) for v in value ]
else:
value = [ jsonify(value) ]
- value = { 'values': value }
+ if None in value:
+ value = None
+ else:
+ value = { 'values': value }
elif isinstance(value, list):
value = [ jsonify(v) for v in value ]
else:
@@ -2444,15 +2447,19 @@
input_name = tool_dict.get('name')
if input_name:
# backup default value
- tool_dict['defaultvalue'] = input.get_initial_value(trans, other_values)
+ tool_dict['default_value'] = input.get_initial_value(trans, other_values)
# update input value from tool state
if input_name in state_inputs:
tool_dict['value'] = state_inputs[input_name]
-
+
# sanitize values
sanitize(tool_dict, 'value')
- sanitize(tool_dict, 'defaultvalue')
+ sanitize(tool_dict, 'default_value')
+
+ # set default value if necessary
+ if not tool_dict['value']:
+ tool_dict['value'] = tool_dict['default_value']
# backup final input dictionary
group_inputs[input_index] = tool_dict
diff -r b73cb7a7cdca3545d6347c5c4da24cfcc0841c2d -r 820114af3bf0689131885c8c99165532902bd2af lib/galaxy/tools/parameters/basic.py
--- a/lib/galaxy/tools/parameters/basic.py
+++ b/lib/galaxy/tools/parameters/basic.py
@@ -866,6 +866,8 @@
value = value.split()
return UnvalidatedValue( value )
legal_values = self.get_legal_values( trans, context )
+ if not legal_values and self.optional:
+ return None
assert legal_values, "Parameter %s requires a value, but has no legal values defined" % self.name
if isinstance( value, list ):
if not(self.repeat):
@@ -878,7 +880,7 @@
return rval
else:
value_is_none = ( value == "None" and "None" not in legal_values )
- if value_is_none:
+ if value_is_none or not value:
if self.multiple:
if self.optional:
return []
diff -r b73cb7a7cdca3545d6347c5c4da24cfcc0841c2d -r 820114af3bf0689131885c8c99165532902bd2af static/scripts/mvc/tools/tools-form-base.js
--- a/static/scripts/mvc/tools/tools-form-base.js
+++ b/static/scripts/mvc/tools/tools-form-base.js
@@ -18,9 +18,7 @@
// shows form in compact view mode
compact : false,
// shows errors on start
- initial_errors : false,
- // ensures that all data including disabled optional fields are submitted to the server
- send_all : false
+ initial_errors : false
};
// configure options
diff -r b73cb7a7cdca3545d6347c5c4da24cfcc0841c2d -r 820114af3bf0689131885c8c99165532902bd2af static/scripts/mvc/tools/tools-form-workflow.js
--- a/static/scripts/mvc/tools/tools-form-workflow.js
+++ b/static/scripts/mvc/tools/tools-form-workflow.js
@@ -16,13 +16,16 @@
}
// initialize parameters
- this.workflow = true;
this.options = options;
-
+
+ // set labels
+ this.options.text_enable = 'In Advance';
+ this.options.text_disable = 'At Runtime';
+
// declare fields as optional
Utils.deepeach(options.inputs, function(item) {
if (item.type) {
- item.optional = (['data', 'data_hidden', 'hidden', 'drill_down']).indexOf(item.type) == -1;
+ item.optional = (['data', 'data_hidden', 'hidden', 'drill_down', 'repeat', 'conditional']).indexOf(item.type) == -1;
}
});
diff -r b73cb7a7cdca3545d6347c5c4da24cfcc0841c2d -r 820114af3bf0689131885c8c99165532902bd2af static/scripts/mvc/tools/tools-input.js
--- a/static/scripts/mvc/tools/tools-input.js
+++ b/static/scripts/mvc/tools/tools-input.js
@@ -10,9 +10,13 @@
// link app
this.app = app;
+ // set text labels
+ this.text_enable = app.options.text_enable || 'Enable';
+ this.text_disable = app.options.text_disable || 'Disable';
+
// link field
this.field = options.field;
- this.defaultvalue = options.defaultvalue;
+ this.default_value = options.default_value;
// set element
this.setElement(this._template(options));
@@ -30,10 +34,11 @@
this.field.skip = false;
var v = this.field.value && this.field.value();
this.field.skip = Boolean(options.optional &&
+ ((this.default_value === undefined) ||
((this.field.validate && !this.field.validate()) || !v ||
- (v == this.defaultvalue) || (Number(v) == Number(this.defaultvalue)) ||
- (JSON.stringify(v) == JSON.stringify(this.defaultvalue))));
-
+ (v == this.default_value) || (Number(v) == Number(this.default_value)) ||
+ (JSON.stringify(v) == JSON.stringify(this.default_value)))));
+
// refresh view
this._refresh();
@@ -53,7 +58,7 @@
error: function(text) {
if (!this.field.skip) {
this.$error_text.html(text);
- this.$error.fadeIn('fast');
+ this.$error.show();
this.$el.addClass('ui-error');
}
},
@@ -70,12 +75,12 @@
_refresh: function() {
if (!this.field.skip) {
this.$field.fadeIn('fast');
- this.$title_optional.html('Disable');
+ this.$title_optional.html(this.text_disable);
} else {
this.reset();
this.$field.hide();
- this.$title_optional.html('Enable');
- this.field.value && this.field.value(this.defaultvalue);
+ this.$title_optional.html(this.text_enable);
+ this.field.value && this.field.value(this.default_value);
}
this.app.trigger('refresh');
},
diff -r b73cb7a7cdca3545d6347c5c4da24cfcc0841c2d -r 820114af3bf0689131885c8c99165532902bd2af static/scripts/mvc/tools/tools-section.js
--- a/static/scripts/mvc/tools/tools-section.js
+++ b/static/scripts/mvc/tools/tools-section.js
@@ -319,7 +319,7 @@
// create input field wrapper
var input_element = new InputElement(this.app, {
label : input_def.label,
- defaultvalue : input_def.defaultvalue,
+ default_value : input_def.default_value,
optional : input_def.optional,
help : input_def.help,
field : field
@@ -457,6 +457,7 @@
return new SelectContent.View(this.app, {
id : 'field-' + input_def.id,
extensions : input_def.extensions,
+ optional : input_def.optional,
multiple : input_def.multiple,
type : input_def.type,
data : input_def.options,
diff -r b73cb7a7cdca3545d6347c5c4da24cfcc0841c2d -r 820114af3bf0689131885c8c99165532902bd2af static/scripts/mvc/tools/tools-select-content.js
--- a/static/scripts/mvc/tools/tools-select-content.js
+++ b/static/scripts/mvc/tools/tools-select-content.js
@@ -50,6 +50,7 @@
if (this.mode == 'single') {
radio_buttons.push({icon: 'fa-file-o', label : 'Single dataset', value : 'single'});
this.select_single = new Ui.Select.View({
+ optional : options.optional,
error_text : hda_error,
onchange : function() {
self.trigger('change');
@@ -82,6 +83,7 @@
radio_buttons.push({icon: 'fa-folder-o', label : 'Dataset collection', value : 'collection' });
this.select_collection = new Ui.Select.View({
error_text : hdca_error,
+ optional : options.optional,
onchange : function() {
self.trigger('change');
}
@@ -180,39 +182,38 @@
},
/** Return the currently selected dataset values */
- value : function (dict) {
+ value : function (new_value) {
// update current value
- if (dict && dict.values) {
- try {
- // create list
- var list = [];
- for (var i in dict.values) {
- list.push(dict.values[i].id);
+ if (new_value !== undefined) {
+ if (new_value && new_value.values) {
+ try {
+ // create list with values
+ var list = [];
+ for (var i in new_value.values) {
+ list.push(new_value.values[i].id);
+ }
+
+ // identify suitable select field
+ if (new_value && new_value.values.length > 0 && new_value.values[0].src == 'hcda') {
+ this.current = 'collection';
+ this.select_collection.value(list[0]);
+ } else {
+ if (this.mode == 'multiple') {
+ this.current = 'multiple';
+ this.select_multiple.value(list);
+ } else {
+ this.current = 'single';
+ this.select_single.value(list[0]);
+ }
+ }
+ } catch (err) {
+ console.debug('tools-select-content::value() - Skipped.');
}
-
- // identify suitable select field
- if (dict && dict.values.length > 0 && dict.values[0].src == 'hcda') {
- this.current = 'collection';
- this.select_collection.value(list[0]);
- } else {
- if (this.mode == 'multiple') {
- this.current = 'multiple';
- this.select_multiple.value(list);
- } else {
- this.current = 'single';
- this.select_single.value(list[0]);
- }
- }
- this.refresh();
-
- // check if value has been set
- var select = this._select();
- if (!select.validate()) {
- select.value(select.first());
- }
- } catch (err) {
- console.debug('tools-select-content::value() - Skipped.');
+ } else {
+ this.current = 'single';
+ this.select_single.value('__null__');
}
+ this.refresh();
}
// transform into an array
@@ -247,6 +248,7 @@
/** Refreshes data selection view */
refresh: function() {
+ this.button_type.value(this.current);
for (var i in this.list) {
var $el = this.list[i].field.$el;
if (this.current == i) {
diff -r b73cb7a7cdca3545d6347c5c4da24cfcc0841c2d -r 820114af3bf0689131885c8c99165532902bd2af static/scripts/mvc/tools/tools-tree.js
--- a/static/scripts/mvc/tools/tools-tree.js
+++ b/static/scripts/mvc/tools/tools-tree.js
@@ -121,21 +121,21 @@
if (patch[input.type]) {
value = patch[input.type](value);
}
-
- // handle simple value
- if (!field.skip || self.app.options.send_all) {
- if (field.validate && !field.validate()) {
- value = null;
- }
- if (input.ignore === undefined || (value !== null && input.ignore != value)) {
- // add value to submission
- add (job_input_id, input.id, value);
- // add payload to submission
- if (input.payload) {
- for (var p_id in input.payload) {
- add (p_id, input.id, input.payload[p_id]);
- }
+ // validate value
+ if ((field.skip && input.optional) || (field.validate && !field.validate())) {
+ value = null;
+ }
+
+ // ignore certain values
+ if (input.ignore === undefined || (value !== null && input.ignore != value)) {
+ // add value to submission
+ add (job_input_id, input.id, value);
+
+ // add payload to submission
+ if (input.payload) {
+ for (var p_id in input.payload) {
+ add (p_id, input.id, input.payload[p_id]);
}
}
}
diff -r b73cb7a7cdca3545d6347c5c4da24cfcc0841c2d -r 820114af3bf0689131885c8c99165532902bd2af static/scripts/mvc/ui/ui-options.js
--- a/static/scripts/mvc/ui/ui-options.js
+++ b/static/scripts/mvc/ui/ui-options.js
@@ -182,7 +182,7 @@
// get selected values
var selected = this.$el.find(':checked');
if (selected.length == 0) {
- return 'null';
+ return '__null__';
}
// return multiple or single value
diff -r b73cb7a7cdca3545d6347c5c4da24cfcc0841c2d -r 820114af3bf0689131885c8c99165532902bd2af static/scripts/mvc/ui/ui-select-default.js
--- a/static/scripts/mvc/ui/ui-select-default.js
+++ b/static/scripts/mvc/ui/ui-select-default.js
@@ -10,10 +10,12 @@
id : '',
cls : '',
error_text : 'No data available',
+ empty_text : 'No selection',
visible : true,
wait : false,
multiple : false,
- searchable : false
+ searchable : false,
+ optional : false
},
// initialize
@@ -181,6 +183,11 @@
// remove all options
this.$select.find('option').remove();
+ // add optional field
+ if (this.options.optional && !this.options.multiple) {
+ this.$select.append(this._templateOption({value : '__null__', label : this.options.empty_text}));
+ }
+
// add new options
for (var key in options) {
this.$select.append(this._templateOption(options[key]));
@@ -229,7 +236,7 @@
*/
_refresh: function() {
// remove placeholder
- this.$select.find('option[value=null]').remove();
+ this.$select.find('option[value="__undefined__"]').remove();
// count remaining entries
var remaining = this.$select.find('option').length;
@@ -238,7 +245,7 @@
this.disable();
// append placeholder
- this.$select.append(this._templateOption({value : 'null', label : this.options.error_text}));
+ this.$select.append(this._templateOption({value : '__undefined__', label : this.options.error_text}));
} else {
// enable select field
this.enable();
diff -r b73cb7a7cdca3545d6347c5c4da24cfcc0841c2d -r 820114af3bf0689131885c8c99165532902bd2af static/scripts/packed/mvc/tools/tools-form-base.js
--- a/static/scripts/packed/mvc/tools/tools-form-base.js
+++ b/static/scripts/packed/mvc/tools/tools-form-base.js
@@ -1,1 +1,1 @@
-define(["utils/utils","utils/deferred","mvc/ui/ui-portlet","mvc/ui/ui-misc","mvc/citation/citation-model","mvc/citation/citation-view","mvc/tools","mvc/tools/tools-template","mvc/tools/tools-content","mvc/tools/tools-section","mvc/tools/tools-tree"],function(g,h,f,k,i,a,d,c,e,j,b){return Backbone.View.extend({initialize:function(l){this.optionsDefault={is_dynamic:true,compact:false,initial_errors:false,send_all:false};this.options=g.merge(l,this.optionsDefault);console.debug(this.options);var m=parent.Galaxy;if(m&&m.modal){this.modal=m.modal}else{this.modal=new k.Modal.View()}if(m&&m.currUser){this.is_admin=m.currUser.get("is_admin")}else{this.is_admin=false}this.container=this.options.container||"body";this.deferred=new h();this.setElement("<div/>");$(this.container).append(this.$el);this._buildForm()},reciept:function(l){$(this.container).empty();$(this.container).append(l)},highlight:function(m,n,l){var o=this.element_list[m];if(o){o.error(n||"Please verify this parameter.");if(!l){$(this.container).animate({scrollTop:o.$el.offset().top-20},500)}}},_errors:function(n){this.trigger("reset");if(n&&n.errors){var o=this.tree.matchResponse(n.errors);for(var m in this.element_list){var l=this.element_list[m];if(o[m]){this.highlight(m,o[m],true)}}}},_buildForm:function(){var l=this;this.off("refresh");this.off("reset");this.field_list={};this.input_list={};this.element_list={};this.tree=new b(this);this.content=new e(this);var m=this.options;this._renderForm(m);this.tree.finalize();if(m.initial_errors){this._errors(m)}this.on("refresh",function(){l.deferred.reset();l.deferred.execute(function(){l._updateModel()})});this.on("reset",function(){for(var n in this.element_list){this.element_list[n].reset()}});this.trigger("refresh")},_renderForm:function(u){var t=this;this.message=new k.Message();var q=new k.ButtonIcon({icon:"fa-info-circle",title:(!u.compact&&"Requirements")||null,tooltip:"Display tool requirements",onclick:function(){if(!this.visible){this.visible=true;t.message.update({persistent:true,message:c.requirements(u),status:"info"})}else{this.visible=false;t.message.update({message:""})}}});if(!u.requirements||u.requirements.length==0){q.$el.hide()}var m=new k.ButtonMenu({icon:"fa-cubes",title:(!u.compact&&"Versions")||null,tooltip:"Select another tool version"});if(u.versions&&u.versions.length>1){for(var o in u.versions){var r=u.versions[o];if(r!=u.version){m.addMenu({title:"Switch to "+r,version:r,icon:"fa-cube",onclick:function(){u.id=u.id.replace(u.version,this.version);u.version=this.version;t.deferred.reset();t.deferred.execute(function(){t._buildModel()})}})}}}else{m.$el.hide()}var p=new k.ButtonMenu({icon:"fa-caret-down",title:(!u.compact&&"Options")||null,tooltip:"View available options"});if(u.biostar_url){p.addMenu({icon:"fa-question-circle",title:"Question?",tooltip:"Ask a question about this tool (Biostar)",onclick:function(){window.open(u.biostar_url+"/p/new/post/")}});p.addMenu({icon:"fa-search",title:"Search",tooltip:"Search help for this tool (Biostar)",onclick:function(){window.open(u.biostar_url+"/t/"+u.id+"/")}})}p.addMenu({icon:"fa-share",title:"Share",tooltip:"Share this tool",onclick:function(){prompt("Copy to clipboard: Ctrl+C, Enter",window.location.origin+galaxy_config.root+"root?tool_id="+u.id)}});if(this.is_admin){p.addMenu({icon:"fa-download",title:"Download",tooltip:"Download this tool",onclick:function(){window.location.href=galaxy_config.root+"api/tools/"+u.id+"/download"}})}this.section=new j.View(t,{inputs:u.inputs,cls:"ui-table-plain"});if(this.incompatible){this.$el.hide();$("#tool-form-classic").show();return}this.portlet=new f.View({icon:"fa-wrench",title:"<b>"+u.name+"</b> "+u.description+" (Galaxy Tool Version "+u.version+")",cls:"ui-portlet-slim",operations:{requirements:q,menu:p,versions:m},buttons:this.buttons});if(u.compact){this.portlet.$content.css("padding","0px")}this.portlet.append(this.message.$el,true);this.portlet.append(this.section.$el);this.$el.empty();this.$el.append(this.portlet.$el);if(u.help!=""){this.$el.append(c.help(u.help))}if(u.citations){var s=$("<div/>");var l=new i.ToolCitationCollection();l.tool_id=u.id;var n=new a.CitationListView({el:s,collection:l});n.render();l.fetch();this.$el.append(s)}if(u.message){this.message.update({persistent:true,status:"warning",message:u.message})}}})});
\ No newline at end of file
+define(["utils/utils","utils/deferred","mvc/ui/ui-portlet","mvc/ui/ui-misc","mvc/citation/citation-model","mvc/citation/citation-view","mvc/tools","mvc/tools/tools-template","mvc/tools/tools-content","mvc/tools/tools-section","mvc/tools/tools-tree"],function(g,h,f,k,i,a,d,c,e,j,b){return Backbone.View.extend({initialize:function(l){this.optionsDefault={is_dynamic:true,compact:false,initial_errors:false};this.options=g.merge(l,this.optionsDefault);console.debug(this.options);var m=parent.Galaxy;if(m&&m.modal){this.modal=m.modal}else{this.modal=new k.Modal.View()}if(m&&m.currUser){this.is_admin=m.currUser.get("is_admin")}else{this.is_admin=false}this.container=this.options.container||"body";this.deferred=new h();this.setElement("<div/>");$(this.container).append(this.$el);this._buildForm()},reciept:function(l){$(this.container).empty();$(this.container).append(l)},highlight:function(m,n,l){var o=this.element_list[m];if(o){o.error(n||"Please verify this parameter.");if(!l){$(this.container).animate({scrollTop:o.$el.offset().top-20},500)}}},_errors:function(n){this.trigger("reset");if(n&&n.errors){var o=this.tree.matchResponse(n.errors);for(var m in this.element_list){var l=this.element_list[m];if(o[m]){this.highlight(m,o[m],true)}}}},_buildForm:function(){var l=this;this.off("refresh");this.off("reset");this.field_list={};this.input_list={};this.element_list={};this.tree=new b(this);this.content=new e(this);var m=this.options;this._renderForm(m);this.tree.finalize();if(m.initial_errors){this._errors(m)}this.on("refresh",function(){l.deferred.reset();l.deferred.execute(function(){l._updateModel()})});this.on("reset",function(){for(var n in this.element_list){this.element_list[n].reset()}});this.trigger("refresh")},_renderForm:function(u){var t=this;this.message=new k.Message();var q=new k.ButtonIcon({icon:"fa-info-circle",title:(!u.compact&&"Requirements")||null,tooltip:"Display tool requirements",onclick:function(){if(!this.visible){this.visible=true;t.message.update({persistent:true,message:c.requirements(u),status:"info"})}else{this.visible=false;t.message.update({message:""})}}});if(!u.requirements||u.requirements.length==0){q.$el.hide()}var m=new k.ButtonMenu({icon:"fa-cubes",title:(!u.compact&&"Versions")||null,tooltip:"Select another tool version"});if(u.versions&&u.versions.length>1){for(var o in u.versions){var r=u.versions[o];if(r!=u.version){m.addMenu({title:"Switch to "+r,version:r,icon:"fa-cube",onclick:function(){u.id=u.id.replace(u.version,this.version);u.version=this.version;t.deferred.reset();t.deferred.execute(function(){t._buildModel()})}})}}}else{m.$el.hide()}var p=new k.ButtonMenu({icon:"fa-caret-down",title:(!u.compact&&"Options")||null,tooltip:"View available options"});if(u.biostar_url){p.addMenu({icon:"fa-question-circle",title:"Question?",tooltip:"Ask a question about this tool (Biostar)",onclick:function(){window.open(u.biostar_url+"/p/new/post/")}});p.addMenu({icon:"fa-search",title:"Search",tooltip:"Search help for this tool (Biostar)",onclick:function(){window.open(u.biostar_url+"/t/"+u.id+"/")}})}p.addMenu({icon:"fa-share",title:"Share",tooltip:"Share this tool",onclick:function(){prompt("Copy to clipboard: Ctrl+C, Enter",window.location.origin+galaxy_config.root+"root?tool_id="+u.id)}});if(this.is_admin){p.addMenu({icon:"fa-download",title:"Download",tooltip:"Download this tool",onclick:function(){window.location.href=galaxy_config.root+"api/tools/"+u.id+"/download"}})}this.section=new j.View(t,{inputs:u.inputs,cls:"ui-table-plain"});if(this.incompatible){this.$el.hide();$("#tool-form-classic").show();return}this.portlet=new f.View({icon:"fa-wrench",title:"<b>"+u.name+"</b> "+u.description+" (Galaxy Tool Version "+u.version+")",cls:"ui-portlet-slim",operations:{requirements:q,menu:p,versions:m},buttons:this.buttons});if(u.compact){this.portlet.$content.css("padding","0px")}this.portlet.append(this.message.$el,true);this.portlet.append(this.section.$el);this.$el.empty();this.$el.append(this.portlet.$el);if(u.help!=""){this.$el.append(c.help(u.help))}if(u.citations){var s=$("<div/>");var l=new i.ToolCitationCollection();l.tool_id=u.id;var n=new a.CitationListView({el:s,collection:l});n.render();l.fetch();this.$el.append(s)}if(u.message){this.message.update({persistent:true,status:"warning",message:u.message})}}})});
\ No newline at end of file
diff -r b73cb7a7cdca3545d6347c5c4da24cfcc0841c2d -r 820114af3bf0689131885c8c99165532902bd2af static/scripts/packed/mvc/tools/tools-form-workflow.js
--- a/static/scripts/packed/mvc/tools/tools-form-workflow.js
+++ b/static/scripts/packed/mvc/tools/tools-form-workflow.js
@@ -1,1 +1,1 @@
-define(["utils/utils","mvc/tools/tools-form-base"],function(b,a){var c=a.extend({initialize:function(e){this.node=workflow.active_node;if(!this.node){console.debug("FAILED - tools-form-workflow:initialize() - Node not found in workflow.");return}this.workflow=true;this.options=e;b.deepeach(e.inputs,function(f){if(f.type){f.optional=(["data","data_hidden","hidden","drill_down"]).indexOf(f.type)==-1}});b.deepeach(e.inputs,function(f){if(f.type){if(f.type=="conditional"){f.test_param.optional=false}}});var d=this;b.get({url:galaxy_config.root+"api/datatypes",cache:true,success:function(f){d.datatypes=f;d._makeSections(e.inputs);a.prototype.initialize.call(d,e)}})},_makeSections:function(d){d[b.uuid()]={label:"Edit Step Attributes",type:"section",expand:this.node.annotation,inputs:[{label:"Annotation / Notes",name:"annotation",type:"text",area:true,help:"Add an annotation or notes to this step; annotations are available when a workflow is viewed.",value:this.node.annotation}]};this.post_job_actions=this.node.post_job_actions;for(var e in this.node.output_terminals){d[b.uuid()]=this._makeSection(e)}},_makeSection:function(h){var g=[];for(key in this.datatypes){g.push({0:this.datatypes[key],1:this.datatypes[key]})}g.sort(function(j,i){return j.label>i.label?1:j.label<i.label?-1:0});g.unshift({0:"Sequences",1:"Sequences"});g.unshift({0:"Roadmaps",1:"Roadmaps"});g.unshift({0:"Leave unchanged",1:"None"});var f={label:"Edit Step Action: '"+h+"'",type:"section",inputs:[{action:"RenameDatasetAction",argument:"newname",label:"Rename dataset",type:"text",value:"",ignore:"",help:'This action will rename the result dataset. Click <a href="https://wiki.galaxyproject.org/Learn/AdvancedWorkflow/Variables">here</a> for more information.'},{action:"ChangeDatatypeAction",argument:"newtype",label:"Change datatype",type:"select",ignore:"None",options:g,help:"This action will change the datatype of the output to the indicated value."},{action:"TagDatasetAction",argument:"tags",label:"Tags",type:"text",value:"",ignore:"",help:"This action will set tags for the dataset."},{label:"Assign columns",type:"section",inputs:[{action:"ColumnSetAction",argument:"chromCol",label:"Chrom column",type:"text",value:"",ignore:""},{action:"ColumnSetAction",argument:"startCol",label:"Start column",type:"text",value:"",ignore:""},{action:"ColumnSetAction",argument:"endCol",label:"End column",type:"text",value:"",ignore:""},{action:"ColumnSetAction",argument:"strandCol",label:"Strand column",type:"text",value:"",ignore:""},{action:"ColumnSetAction",argument:"nameCol",label:"Name column",type:"text",value:"",ignore:""}],help:"This action will set column assignments in the output dataset. Blank fields are ignored."},{action:"EmailAction",label:"Email notification",type:"boolean",value:"false",ignore:"false",help:"This action will send an email notifying you when the job is done.",payload:{host:window.location.host}},{action:"DeleteIntermediatesAction",label:"Delete non-outputs",type:"boolean",value:"false",ignore:"false",help:"All non-output steps of this workflow will have datasets deleted if they are no longer being used as job inputs when the job this action is attached to is finished. You *must* be using workflow outputs (the snowflake) in your workflow for this to have any effect."}]};var d=this;function e(n,o){o=o||[];o.push(n);for(var m in n.inputs){var k=n.inputs[m];if(k.action){k.name="pja__"+h+"__"+k.action;if(k.argument){k.name+="__"+k.argument}if(k.payload){for(var s in k.payload){var q=k.payload[s];k.payload[k.name+"__"+s]=q;delete q}}var r=d.post_job_actions[k.action+h];if(r){for(var l in o){o[l].expand=true}if(k.argument){k.value=r.action_arguments&&r.action_arguments[k.argument]||k.value}else{k.value="true"}}}if(k.inputs){e(k,o.slice(0))}}}e(f);return f},_buildModel:function(){Galaxy.modal.show({title:"Coming soon...",body:"This feature has not been implemented yet.",buttons:{Close:function(){Galaxy.modal.hide()}}})},_updateModel:function(){var d=this;var e=this.tree.finalize();console.debug("tools-form-workflow::_refreshForm() - Refreshing states.");console.debug(e);var g=this.deferred.register();var f=galaxy_config.root+"workflow/editor_form_post?tool_id="+this.options.id+"&__is_dynamic__=False";b.request({type:"GET",url:f,data:e,success:function(h){d.node.update_field_data(h);d._errors(h&&h.tool_model);d.deferred.done(g);console.debug("tools-form::_refreshForm() - States refreshed.");console.debug(h)},error:function(h){d.deferred.done(g);console.debug("tools-form::_refreshForm() - Refresh request failed.");console.debug(h)}})}});return{View:c}});
\ No newline at end of file
+define(["utils/utils","mvc/tools/tools-form-base"],function(b,a){var c=a.extend({initialize:function(e){this.node=workflow.active_node;if(!this.node){console.debug("FAILED - tools-form-workflow:initialize() - Node not found in workflow.");return}this.options=e;this.options.text_enable="In Advance";this.options.text_disable="At Runtime";b.deepeach(e.inputs,function(f){if(f.type){f.optional=(["data","data_hidden","hidden","drill_down","repeat","conditional"]).indexOf(f.type)==-1}});b.deepeach(e.inputs,function(f){if(f.type){if(f.type=="conditional"){f.test_param.optional=false}}});var d=this;b.get({url:galaxy_config.root+"api/datatypes",cache:true,success:function(f){d.datatypes=f;d._makeSections(e.inputs);a.prototype.initialize.call(d,e)}})},_makeSections:function(d){d[b.uuid()]={label:"Edit Step Attributes",type:"section",expand:this.node.annotation,inputs:[{label:"Annotation / Notes",name:"annotation",type:"text",area:true,help:"Add an annotation or notes to this step; annotations are available when a workflow is viewed.",value:this.node.annotation}]};this.post_job_actions=this.node.post_job_actions;for(var e in this.node.output_terminals){d[b.uuid()]=this._makeSection(e)}},_makeSection:function(h){var g=[];for(key in this.datatypes){g.push({0:this.datatypes[key],1:this.datatypes[key]})}g.sort(function(j,i){return j.label>i.label?1:j.label<i.label?-1:0});g.unshift({0:"Sequences",1:"Sequences"});g.unshift({0:"Roadmaps",1:"Roadmaps"});g.unshift({0:"Leave unchanged",1:"None"});var f={label:"Edit Step Action: '"+h+"'",type:"section",inputs:[{action:"RenameDatasetAction",argument:"newname",label:"Rename dataset",type:"text",value:"",ignore:"",help:'This action will rename the result dataset. Click <a href="https://wiki.galaxyproject.org/Learn/AdvancedWorkflow/Variables">here</a> for more information.'},{action:"ChangeDatatypeAction",argument:"newtype",label:"Change datatype",type:"select",ignore:"None",options:g,help:"This action will change the datatype of the output to the indicated value."},{action:"TagDatasetAction",argument:"tags",label:"Tags",type:"text",value:"",ignore:"",help:"This action will set tags for the dataset."},{label:"Assign columns",type:"section",inputs:[{action:"ColumnSetAction",argument:"chromCol",label:"Chrom column",type:"text",value:"",ignore:""},{action:"ColumnSetAction",argument:"startCol",label:"Start column",type:"text",value:"",ignore:""},{action:"ColumnSetAction",argument:"endCol",label:"End column",type:"text",value:"",ignore:""},{action:"ColumnSetAction",argument:"strandCol",label:"Strand column",type:"text",value:"",ignore:""},{action:"ColumnSetAction",argument:"nameCol",label:"Name column",type:"text",value:"",ignore:""}],help:"This action will set column assignments in the output dataset. Blank fields are ignored."},{action:"EmailAction",label:"Email notification",type:"boolean",value:"false",ignore:"false",help:"This action will send an email notifying you when the job is done.",payload:{host:window.location.host}},{action:"DeleteIntermediatesAction",label:"Delete non-outputs",type:"boolean",value:"false",ignore:"false",help:"All non-output steps of this workflow will have datasets deleted if they are no longer being used as job inputs when the job this action is attached to is finished. You *must* be using workflow outputs (the snowflake) in your workflow for this to have any effect."}]};var d=this;function e(n,o){o=o||[];o.push(n);for(var m in n.inputs){var k=n.inputs[m];if(k.action){k.name="pja__"+h+"__"+k.action;if(k.argument){k.name+="__"+k.argument}if(k.payload){for(var s in k.payload){var q=k.payload[s];k.payload[k.name+"__"+s]=q;delete q}}var r=d.post_job_actions[k.action+h];if(r){for(var l in o){o[l].expand=true}if(k.argument){k.value=r.action_arguments&&r.action_arguments[k.argument]||k.value}else{k.value="true"}}}if(k.inputs){e(k,o.slice(0))}}}e(f);return f},_buildModel:function(){Galaxy.modal.show({title:"Coming soon...",body:"This feature has not been implemented yet.",buttons:{Close:function(){Galaxy.modal.hide()}}})},_updateModel:function(){var d=this;var e=this.tree.finalize();console.debug("tools-form-workflow::_refreshForm() - Refreshing states.");console.debug(e);var g=this.deferred.register();var f=galaxy_config.root+"workflow/editor_form_post?tool_id="+this.options.id+"&__is_dynamic__=False";b.request({type:"GET",url:f,data:e,success:function(h){d.node.update_field_data(h);d._errors(h&&h.tool_model);d.deferred.done(g);console.debug("tools-form::_refreshForm() - States refreshed.");console.debug(h)},error:function(h){d.deferred.done(g);console.debug("tools-form::_refreshForm() - Refresh request failed.");console.debug(h)}})}});return{View:c}});
\ No newline at end of file
diff -r b73cb7a7cdca3545d6347c5c4da24cfcc0841c2d -r 820114af3bf0689131885c8c99165532902bd2af static/scripts/packed/mvc/tools/tools-input.js
--- a/static/scripts/packed/mvc/tools/tools-input.js
+++ b/static/scripts/packed/mvc/tools/tools-input.js
@@ -1,1 +1,1 @@
-define([],function(){return Backbone.View.extend({initialize:function(d,c){this.app=d;this.field=c.field;this.defaultvalue=c.defaultvalue;this.setElement(this._template(c));this.$field=this.$el.find(".ui-table-form-field");this.$title_optional=this.$el.find(".ui-table-form-title-optional");this.$error_text=this.$el.find(".ui-table-form-error-text");this.$error=this.$el.find(".ui-table-form-error");this.$field.prepend(this.field.$el);this.field.skip=false;var b=this.field.value&&this.field.value();this.field.skip=Boolean(c.optional&&((this.field.validate&&!this.field.validate())||!b||(b==this.defaultvalue)||(Number(b)==Number(this.defaultvalue))||(JSON.stringify(b)==JSON.stringify(this.defaultvalue))));this._refresh();var a=this;this.$title_optional.on("click",function(){a.field.skip=!a.field.skip;a._refresh()})},error:function(a){if(!this.field.skip){this.$error_text.html(a);this.$error.fadeIn("fast");this.$el.addClass("ui-error")}},reset:function(){this.$error.hide();this.$el.removeClass("ui-error")},_refresh:function(){if(!this.field.skip){this.$field.fadeIn("fast");this.$title_optional.html("Disable")}else{this.reset();this.$field.hide();this.$title_optional.html("Enable");this.field.value&&this.field.value(this.defaultvalue)}this.app.trigger("refresh")},_template:function(a){var b='<div class="ui-table-form-element"><div class="ui-table-form-error ui-error"><span class="fa fa-arrow-down"/><span class="ui-table-form-error-text"/></div><div class="ui-table-form-title-strong">';if(a.optional){b+=a.label+'<span> [<span class="ui-table-form-title-optional"/>]</span>'}else{b+=a.label}b+='</div><div class="ui-table-form-field">';if(a.help){b+='<div class="ui-table-form-info">'+a.help+"</div>"}b+="</div></div>";return b}})});
\ No newline at end of file
+define([],function(){return Backbone.View.extend({initialize:function(d,c){this.app=d;this.text_enable=d.options.text_enable||"Enable";this.text_disable=d.options.text_disable||"Disable";this.field=c.field;this.default_value=c.default_value;this.setElement(this._template(c));this.$field=this.$el.find(".ui-table-form-field");this.$title_optional=this.$el.find(".ui-table-form-title-optional");this.$error_text=this.$el.find(".ui-table-form-error-text");this.$error=this.$el.find(".ui-table-form-error");this.$field.prepend(this.field.$el);this.field.skip=false;var b=this.field.value&&this.field.value();this.field.skip=Boolean(c.optional&&((this.default_value===undefined)||((this.field.validate&&!this.field.validate())||!b||(b==this.default_value)||(Number(b)==Number(this.default_value))||(JSON.stringify(b)==JSON.stringify(this.default_value)))));this._refresh();var a=this;this.$title_optional.on("click",function(){a.field.skip=!a.field.skip;a._refresh()})},error:function(a){if(!this.field.skip){this.$error_text.html(a);this.$error.show();this.$el.addClass("ui-error")}},reset:function(){this.$error.hide();this.$el.removeClass("ui-error")},_refresh:function(){if(!this.field.skip){this.$field.fadeIn("fast");this.$title_optional.html(this.text_disable)}else{this.reset();this.$field.hide();this.$title_optional.html(this.text_enable);this.field.value&&this.field.value(this.default_value)}this.app.trigger("refresh")},_template:function(a){var b='<div class="ui-table-form-element"><div class="ui-table-form-error ui-error"><span class="fa fa-arrow-down"/><span class="ui-table-form-error-text"/></div><div class="ui-table-form-title-strong">';if(a.optional){b+=a.label+'<span> [<span class="ui-table-form-title-optional"/>]</span>'}else{b+=a.label}b+='</div><div class="ui-table-form-field">';if(a.help){b+='<div class="ui-table-form-info">'+a.help+"</div>"}b+="</div></div>";return b}})});
\ No newline at end of file
diff -r b73cb7a7cdca3545d6347c5c4da24cfcc0841c2d -r 820114af3bf0689131885c8c99165532902bd2af static/scripts/packed/mvc/tools/tools-section.js
--- a/static/scripts/packed/mvc/tools/tools-section.js
+++ b/static/scripts/packed/mvc/tools/tools-section.js
@@ -1,1 +1,1 @@
-define(["utils/utils","mvc/ui/ui-table","mvc/ui/ui-misc","mvc/ui/ui-portlet","mvc/tools/tools-repeat","mvc/tools/tools-select-content","mvc/tools/tools-input"],function(e,b,h,d,c,a,f){var g=Backbone.View.extend({initialize:function(j,i){this.app=j;this.inputs=i.inputs;i.cls_tr="section-row";this.table=new b.View(i);this.setElement(this.table.$el);this.render()},render:function(){this.table.delAll();for(var j in this.inputs){this.add(this.inputs[j])}},add:function(k){var j=this;var i=jQuery.extend(true,{},k);i.id=k.id=e.uuid();this.app.input_list[i.id]=i;var l=i.type;switch(l){case"conditional":this._addConditional(i);break;case"repeat":this._addRepeat(i);break;case"section":this._addSection(i);break;default:this._addRow(i)}},_addConditional:function(j){var k=this;j.test_param.id=j.id;var n=this._addRow(j.test_param);n.options.onchange=function(w){var v=k.app.tree.matchCase(j,w);for(var u in j.cases){var q=j.cases[u];var t=j.id+"-section-"+u;var p=k.table.get(t);var s=false;for(var r in q.inputs){if(!q.inputs[r].hidden){s=true;break}}if(u==v&&s){p.fadeIn("fast")}else{p.hide()}}k.app.trigger("refresh")};for(var m in j.cases){var l=j.id+"-section-"+m;var o=new g(this.app,{inputs:j.cases[m].inputs,cls:"ui-table-plain"});o.$el.addClass("ui-table-form-section");this.table.add(o.$el);this.table.append(l)}n.trigger("change")},_addRepeat:function(p){var s=this;var q=0;function n(i,u){var t=p.id+"-section-"+(q++);var v=null;if(u){v=function(){l.del(t);l.retitle(p.title);s.app.trigger("refresh")}}var w=new g(s.app,{inputs:i,cls:"ui-table-plain"});l.add({id:t,title:p.title,$el:w.$el,ondel:v});l.retitle(p.title)}var l=new c.View({title_new:p.title,max:p.max,onnew:function(){n(p.inputs,true);s.app.trigger("refresh")}});var j=p.min;var r=_.size(p.cache);for(var m=0;m<Math.max(r,j);m++){var o=null;if(m<r){o=p.cache[m]}else{o=p.inputs}n(o,m>=j)}var k=new f(this.app,{label:p.title,help:p.help,field:l});k.$el.addClass("ui-table-form-section");this.table.add(k.$el);this.table.append(p.id)},_addSection:function(i){var j=this;var n=new g(j.app,{inputs:i.inputs,cls:"ui-table-plain"});var m=new h.ButtonIcon({icon:"fa-eye-slash",tooltip:"Show/hide section",cls:"ui-button-icon-plain"});var l=new d.View({title:i.label,cls:"ui-portlet-section",operations:{button_visible:m}});l.append(n.$el);var k=false;l.$content.hide();l.$header.css("cursor","pointer");l.$header.on("click",function(){if(k){k=false;l.$content.hide();m.setIcon("fa-eye-slash")}else{k=true;l.$content.fadeIn("fast");m.setIcon("fa-eye")}});if(i.expand){l.$header.trigger("click")}this.table.add(l.$el);this.table.append(i.id)},_addRow:function(i){var l=i.id;var j=this._createField(i);this.app.field_list[l]=j;var k=new f(this.app,{label:i.label,defaultvalue:i.defaultvalue,optional:i.optional,help:i.help,field:j});this.app.element_list[l]=k;this.table.add(k.$el);this.table.append(l);if(i.hidden){this.table.get(l).hide()}return j},_createField:function(i){var j=null;switch(i.type){case"text":j=this._fieldText(i);break;case"select":j=this._fieldSelect(i);break;case"data":j=this._fieldData(i);break;case"data_collection":j=this._fieldData(i);break;case"data_column":i.error_text="Missing columns in referenced dataset.";j=this._fieldSelect(i);break;case"hidden":j=this._fieldHidden(i);break;case"hidden_data":j=this._fieldHidden(i);break;case"integer":j=this._fieldSlider(i);break;case"float":j=this._fieldSlider(i);break;case"boolean":j=this._fieldBoolean(i);break;case"genomebuild":i.searchable=true;j=this._fieldSelect(i);break;case"drill_down":j=this._fieldDrilldown(i);break;case"baseurl":j=this._fieldHidden(i);break;default:this.app.incompatible=true;if(i.options){j=this._fieldSelect(i)}else{j=this._fieldText(i)}console.debug("tools-form::_addRow() : Auto matched field type ("+i.type+").")}if(i.value!==undefined){j.value(i.value)}return j},_fieldData:function(i){if(!this.app.options.is_dynamic){i.info="Data input '"+i.name+"' ("+e.textify(i.extensions.toString())+")";i.value=null;return this._fieldHidden(i)}var j=this;return new a.View(this.app,{id:"field-"+i.id,extensions:i.extensions,multiple:i.multiple,type:i.type,data:i.options,onchange:function(){j.app.trigger("refresh")}})},_fieldSelect:function(j){if(!this.app.options.is_dynamic&&j.is_dynamic){return this._fieldText(j)}var l=[];for(var m in j.options){var n=j.options[m];l.push({label:n[0],value:n[1]})}var o=h.Select;switch(j.display){case"checkboxes":o=h.Checkbox;break;case"radio":o=h.Radio;break}var k=this;return new o.View({id:"field-"+j.id,data:l,error_text:j.error_text||"No options available",multiple:j.multiple,searchable:j.searchable,onchange:function(){k.app.trigger("refresh")}})},_fieldDrilldown:function(i){if(!this.app.options.is_dynamic&&i.is_dynamic){return this._fieldText(i)}var j=this;return new h.Drilldown.View({id:"field-"+i.id,data:i.options,display:i.display,onchange:function(){j.app.trigger("refresh")}})},_fieldText:function(i){if(i.options){i.area=i.multiple;if(!e.validate(i.value)){i.value=""}else{if(i.value instanceof Array){i.value=value.toString()}else{i.value=String(i.value).replace(/[\[\]'"\s]/g,"");if(i.multiple){i.value=i.value.replace(/,/g,"\n")}}}}var j=this;return new h.Input({id:"field-"+i.id,area:i.area,onchange:function(){j.app.trigger("refresh")}})},_fieldSlider:function(i){var j=this;return new h.Slider.View({id:"field-"+i.id,precise:i.type=="float",min:i.min,max:i.max,onchange:function(){j.app.trigger("refresh")}})},_fieldHidden:function(i){return new h.Hidden({id:"field-"+i.id,info:i.info})},_fieldBoolean:function(i){var j=this;return new h.RadioButton.View({id:"field-"+i.id,data:[{label:"Yes",value:"true"},{label:"No",value:"false"}],onchange:function(){j.app.trigger("refresh")}})}});return{View:g}});
\ No newline at end of file
+define(["utils/utils","mvc/ui/ui-table","mvc/ui/ui-misc","mvc/ui/ui-portlet","mvc/tools/tools-repeat","mvc/tools/tools-select-content","mvc/tools/tools-input"],function(e,b,h,d,c,a,f){var g=Backbone.View.extend({initialize:function(j,i){this.app=j;this.inputs=i.inputs;i.cls_tr="section-row";this.table=new b.View(i);this.setElement(this.table.$el);this.render()},render:function(){this.table.delAll();for(var j in this.inputs){this.add(this.inputs[j])}},add:function(k){var j=this;var i=jQuery.extend(true,{},k);i.id=k.id=e.uuid();this.app.input_list[i.id]=i;var l=i.type;switch(l){case"conditional":this._addConditional(i);break;case"repeat":this._addRepeat(i);break;case"section":this._addSection(i);break;default:this._addRow(i)}},_addConditional:function(j){var k=this;j.test_param.id=j.id;var n=this._addRow(j.test_param);n.options.onchange=function(w){var v=k.app.tree.matchCase(j,w);for(var u in j.cases){var q=j.cases[u];var t=j.id+"-section-"+u;var p=k.table.get(t);var s=false;for(var r in q.inputs){if(!q.inputs[r].hidden){s=true;break}}if(u==v&&s){p.fadeIn("fast")}else{p.hide()}}k.app.trigger("refresh")};for(var m in j.cases){var l=j.id+"-section-"+m;var o=new g(this.app,{inputs:j.cases[m].inputs,cls:"ui-table-plain"});o.$el.addClass("ui-table-form-section");this.table.add(o.$el);this.table.append(l)}n.trigger("change")},_addRepeat:function(p){var s=this;var q=0;function n(i,u){var t=p.id+"-section-"+(q++);var v=null;if(u){v=function(){l.del(t);l.retitle(p.title);s.app.trigger("refresh")}}var w=new g(s.app,{inputs:i,cls:"ui-table-plain"});l.add({id:t,title:p.title,$el:w.$el,ondel:v});l.retitle(p.title)}var l=new c.View({title_new:p.title,max:p.max,onnew:function(){n(p.inputs,true);s.app.trigger("refresh")}});var j=p.min;var r=_.size(p.cache);for(var m=0;m<Math.max(r,j);m++){var o=null;if(m<r){o=p.cache[m]}else{o=p.inputs}n(o,m>=j)}var k=new f(this.app,{label:p.title,help:p.help,field:l});k.$el.addClass("ui-table-form-section");this.table.add(k.$el);this.table.append(p.id)},_addSection:function(i){var j=this;var n=new g(j.app,{inputs:i.inputs,cls:"ui-table-plain"});var m=new h.ButtonIcon({icon:"fa-eye-slash",tooltip:"Show/hide section",cls:"ui-button-icon-plain"});var l=new d.View({title:i.label,cls:"ui-portlet-section",operations:{button_visible:m}});l.append(n.$el);var k=false;l.$content.hide();l.$header.css("cursor","pointer");l.$header.on("click",function(){if(k){k=false;l.$content.hide();m.setIcon("fa-eye-slash")}else{k=true;l.$content.fadeIn("fast");m.setIcon("fa-eye")}});if(i.expand){l.$header.trigger("click")}this.table.add(l.$el);this.table.append(i.id)},_addRow:function(i){var l=i.id;var j=this._createField(i);this.app.field_list[l]=j;var k=new f(this.app,{label:i.label,default_value:i.default_value,optional:i.optional,help:i.help,field:j});this.app.element_list[l]=k;this.table.add(k.$el);this.table.append(l);if(i.hidden){this.table.get(l).hide()}return j},_createField:function(i){var j=null;switch(i.type){case"text":j=this._fieldText(i);break;case"select":j=this._fieldSelect(i);break;case"data":j=this._fieldData(i);break;case"data_collection":j=this._fieldData(i);break;case"data_column":i.error_text="Missing columns in referenced dataset.";j=this._fieldSelect(i);break;case"hidden":j=this._fieldHidden(i);break;case"hidden_data":j=this._fieldHidden(i);break;case"integer":j=this._fieldSlider(i);break;case"float":j=this._fieldSlider(i);break;case"boolean":j=this._fieldBoolean(i);break;case"genomebuild":i.searchable=true;j=this._fieldSelect(i);break;case"drill_down":j=this._fieldDrilldown(i);break;case"baseurl":j=this._fieldHidden(i);break;default:this.app.incompatible=true;if(i.options){j=this._fieldSelect(i)}else{j=this._fieldText(i)}console.debug("tools-form::_addRow() : Auto matched field type ("+i.type+").")}if(i.value!==undefined){j.value(i.value)}return j},_fieldData:function(i){if(!this.app.options.is_dynamic){i.info="Data input '"+i.name+"' ("+e.textify(i.extensions.toString())+")";i.value=null;return this._fieldHidden(i)}var j=this;return new a.View(this.app,{id:"field-"+i.id,extensions:i.extensions,optional:i.optional,multiple:i.multiple,type:i.type,data:i.options,onchange:function(){j.app.trigger("refresh")}})},_fieldSelect:function(j){if(!this.app.options.is_dynamic&&j.is_dynamic){return this._fieldText(j)}var l=[];for(var m in j.options){var n=j.options[m];l.push({label:n[0],value:n[1]})}var o=h.Select;switch(j.display){case"checkboxes":o=h.Checkbox;break;case"radio":o=h.Radio;break}var k=this;return new o.View({id:"field-"+j.id,data:l,error_text:j.error_text||"No options available",multiple:j.multiple,searchable:j.searchable,onchange:function(){k.app.trigger("refresh")}})},_fieldDrilldown:function(i){if(!this.app.options.is_dynamic&&i.is_dynamic){return this._fieldText(i)}var j=this;return new h.Drilldown.View({id:"field-"+i.id,data:i.options,display:i.display,onchange:function(){j.app.trigger("refresh")}})},_fieldText:function(i){if(i.options){i.area=i.multiple;if(!e.validate(i.value)){i.value=""}else{if(i.value instanceof Array){i.value=value.toString()}else{i.value=String(i.value).replace(/[\[\]'"\s]/g,"");if(i.multiple){i.value=i.value.replace(/,/g,"\n")}}}}var j=this;return new h.Input({id:"field-"+i.id,area:i.area,onchange:function(){j.app.trigger("refresh")}})},_fieldSlider:function(i){var j=this;return new h.Slider.View({id:"field-"+i.id,precise:i.type=="float",min:i.min,max:i.max,onchange:function(){j.app.trigger("refresh")}})},_fieldHidden:function(i){return new h.Hidden({id:"field-"+i.id,info:i.info})},_fieldBoolean:function(i){var j=this;return new h.RadioButton.View({id:"field-"+i.id,data:[{label:"Yes",value:"true"},{label:"No",value:"false"}],onchange:function(){j.app.trigger("refresh")}})}});return{View:g}});
\ No newline at end of file
diff -r b73cb7a7cdca3545d6347c5c4da24cfcc0841c2d -r 820114af3bf0689131885c8c99165532902bd2af static/scripts/packed/mvc/tools/tools-select-content.js
--- a/static/scripts/packed/mvc/tools/tools-select-content.js
+++ b/static/scripts/packed/mvc/tools/tools-select-content.js
@@ -1,1 +1,1 @@
-define(["utils/utils","mvc/ui/ui-misc","mvc/ui/ui-tabs","mvc/tools/tools-template"],function(c,e,b,a){var d=Backbone.View.extend({initialize:function(l,g){this.app=l;this.options=g;var f=this;this.setElement("<div/>");this.list={};var j=[];if(g.type=="data_collection"){this.mode="collection"}else{if(g.multiple){this.mode="multiple"}else{this.mode="single"}}this.current=this.mode;this.list={};var k=c.textify(g.extensions);var n="No dataset available.";if(k){n="No "+k+" dataset available."}var m="No dataset list available.";if(k){m="No "+k+" dataset collection available."}if(this.mode=="single"){j.push({icon:"fa-file-o",label:"Single dataset",value:"single"});this.select_single=new e.Select.View({error_text:n,onchange:function(){f.trigger("change")}});this.list.single={field:this.select_single,type:"hda"}}if(this.mode=="single"||this.mode=="multiple"){j.push({icon:"fa-files-o",label:"Multiple datasets",value:"multiple"});this.select_multiple=new e.Select.View({multiple:true,error_text:n,onchange:function(){f.trigger("change")}});this.list.multiple={field:this.select_multiple,type:"hda"}}if(this.mode=="single"||this.mode=="collection"){j.push({icon:"fa-folder-o",label:"Dataset collection",value:"collection"});this.select_collection=new e.Select.View({error_text:m,onchange:function(){f.trigger("change")}});this.list.collection={field:this.select_collection,type:"hdca"}}this.button_type=new e.RadioButton.View({value:this.current,data:j,onchange:function(i){f.current=i;f.refresh();f.trigger("change")}});this.$batch=$(a.batchMode());if(_.size(this.list)>1){this.$el.append(c.wrap(this.button_type.$el))}for(var h in this.list){this.$el.append(this.list[h].field.$el)}this.$el.append(this.$batch);this.update(g.data);if(this.options.value!==undefined){this.value(this.options.value)}this.refresh();this.on("change",function(){if(g.onchange){g.onchange(f.value())}})},wait:function(){for(var f in this.list){this.list[f].field.wait()}},unwait:function(){for(var f in this.list){this.list[f].field.unwait()}},update:function(g){var l=[];for(var j in g.hda){var k=g.hda[j];l.push({label:k.hid+": "+k.name,value:k.id})}var f=[];for(var j in g.hdca){var h=g.hdca[j];f.push({label:h.hid+": "+h.name,value:h.id})}this.select_single&&this.select_single.update(l);this.select_multiple&&this.select_multiple.update(l);this.select_collection&&this.select_collection.update(f);this.app.content.add(g)},value:function(m){if(m&&m.values){try{var l=[];for(var h in m.values){l.push(m.values[h].id)}if(m&&m.values.length>0&&m.values[0].src=="hcda"){this.current="collection";this.select_collection.value(l[0])}else{if(this.mode=="multiple"){this.current="multiple";this.select_multiple.value(l)}else{this.current="single";this.select_single.value(l[0])}}this.refresh();var g=this._select();if(!g.validate()){g.value(g.first())}}catch(k){console.debug("tools-select-content::value() - Skipped.")}}var j=this._select().value();if(!(j instanceof Array)){j=[j]}var f={batch:this.mode=="single"&&this.current!="single",values:[]};for(var h in j){f.values.push({id:j[h],src:this.list[this.current].type})}return f},validate:function(){return this._select().validate()},refresh:function(){for(var g in this.list){var f=this.list[g].field.$el;if(this.current==g){f.show()}else{f.hide()}}if(this.mode=="single"&&this.current!="single"){this.$batch.show()}else{this.$batch.hide()}},_select:function(){return this.list[this.current].field}});return{View:d}});
\ No newline at end of file
+define(["utils/utils","mvc/ui/ui-misc","mvc/ui/ui-tabs","mvc/tools/tools-template"],function(c,e,b,a){var d=Backbone.View.extend({initialize:function(l,g){this.app=l;this.options=g;var f=this;this.setElement("<div/>");this.list={};var j=[];if(g.type=="data_collection"){this.mode="collection"}else{if(g.multiple){this.mode="multiple"}else{this.mode="single"}}this.current=this.mode;this.list={};var k=c.textify(g.extensions);var n="No dataset available.";if(k){n="No "+k+" dataset available."}var m="No dataset list available.";if(k){m="No "+k+" dataset collection available."}if(this.mode=="single"){j.push({icon:"fa-file-o",label:"Single dataset",value:"single"});this.select_single=new e.Select.View({optional:g.optional,error_text:n,onchange:function(){f.trigger("change")}});this.list.single={field:this.select_single,type:"hda"}}if(this.mode=="single"||this.mode=="multiple"){j.push({icon:"fa-files-o",label:"Multiple datasets",value:"multiple"});this.select_multiple=new e.Select.View({multiple:true,error_text:n,onchange:function(){f.trigger("change")}});this.list.multiple={field:this.select_multiple,type:"hda"}}if(this.mode=="single"||this.mode=="collection"){j.push({icon:"fa-folder-o",label:"Dataset collection",value:"collection"});this.select_collection=new e.Select.View({error_text:m,optional:g.optional,onchange:function(){f.trigger("change")}});this.list.collection={field:this.select_collection,type:"hdca"}}this.button_type=new e.RadioButton.View({value:this.current,data:j,onchange:function(i){f.current=i;f.refresh();f.trigger("change")}});this.$batch=$(a.batchMode());if(_.size(this.list)>1){this.$el.append(c.wrap(this.button_type.$el))}for(var h in this.list){this.$el.append(this.list[h].field.$el)}this.$el.append(this.$batch);this.update(g.data);if(this.options.value!==undefined){this.value(this.options.value)}this.refresh();this.on("change",function(){if(g.onchange){g.onchange(f.value())}})},wait:function(){for(var f in this.list){this.list[f].field.wait()}},unwait:function(){for(var f in this.list){this.list[f].field.unwait()}},update:function(g){var l=[];for(var j in g.hda){var k=g.hda[j];l.push({label:k.hid+": "+k.name,value:k.id})}var f=[];for(var j in g.hdca){var h=g.hdca[j];f.push({label:h.hid+": "+h.name,value:h.id})}this.select_single&&this.select_single.update(l);this.select_multiple&&this.select_multiple.update(l);this.select_collection&&this.select_collection.update(f);this.app.content.add(g)},value:function(h){if(h!==undefined){if(h&&h.values){try{var l=[];for(var g in h.values){l.push(h.values[g].id)}if(h&&h.values.length>0&&h.values[0].src=="hcda"){this.current="collection";this.select_collection.value(l[0])}else{if(this.mode=="multiple"){this.current="multiple";this.select_multiple.value(l)}else{this.current="single";this.select_single.value(l[0])}}}catch(k){console.debug("tools-select-content::value() - Skipped.")}}else{this.current="single";this.select_single.value("__null__")}this.refresh()}var j=this._select().value();if(!(j instanceof Array)){j=[j]}var f={batch:this.mode=="single"&&this.current!="single",values:[]};for(var g in j){f.values.push({id:j[g],src:this.list[this.current].type})}return f},validate:function(){return this._select().validate()},refresh:function(){this.button_type.value(this.current);for(var g in this.list){var f=this.list[g].field.$el;if(this.current==g){f.show()}else{f.hide()}}if(this.mode=="single"&&this.current!="single"){this.$batch.show()}else{this.$batch.hide()}},_select:function(){return this.list[this.current].field}});return{View:d}});
\ No newline at end of file
diff -r b73cb7a7cdca3545d6347c5c4da24cfcc0841c2d -r 820114af3bf0689131885c8c99165532902bd2af static/scripts/packed/mvc/tools/tools-tree.js
--- a/static/scripts/packed/mvc/tools/tools-tree.js
+++ b/static/scripts/packed/mvc/tools/tools-tree.js
@@ -1,1 +1,1 @@
-define(["utils/utils"],function(a){return Backbone.Model.extend({initialize:function(b){this.app=b},finalize:function(g){var b=this;this.map_dict={};if(!this.app.section){return{}}g=g||{};var f={};var e={};this._iterate(this.app.section.$el,e);function d(j,i,h){f[j]=h;b.map_dict[j]=i}function c(p,s){for(var n in s){var k=s[n];if(k.input){var u=k.input;var o=p;if(p!=""){o+="|"}o+=u.name;switch(u.type){case"repeat":var j="section-";var x=[];var r=null;for(var w in k){var q=w.indexOf(j);if(q!=-1){q+=j.length;x.push(parseInt(w.substr(q)));if(!r){r=w.substr(0,q)}}}x.sort(function(y,i){return y-i});var n=0;for(var l in x){c(o+"_"+n++,k[r+x[l]])}break;case"conditional":var v=b.app.field_list[u.id].value();if(g[u.test_param.type]){v=g[u.test_param.type](v)}d(o+"|"+u.test_param.name,u.id,v);var h=b.matchCase(u,v);if(h!=-1){c(o,s[u.id+"-section-"+h])}break;case"section":c("",k);break;default:var t=b.app.field_list[u.id];if(t&&t.value){var v=t.value();if(g[u.type]){v=g[u.type](v)}if(!t.skip||b.app.options.send_all){if(t.validate&&!t.validate()){v=null}if(u.ignore===undefined||(v!==null&&u.ignore!=v)){d(o,u.id,v);if(u.payload){for(var m in u.payload){d(m,u.id,u.payload[m])}}}}}}}}}c("",e);return f},match:function(b){return this.map_dict&&this.map_dict[b]},matchCase:function(b,d){if(b.test_param.type=="boolean"){if(d=="true"){d=b.test_param.truevalue||"true"}else{d=b.test_param.falsevalue||"false"}}for(var c in b.cases){if(b.cases[c].value==d){return c}}return -1},matchModel:function(d,f){var b={};var c=this;function e(g,p){for(var m in p){var k=p[m];var n=k.name;if(g!=""){n=g+"|"+n}switch(k.type){case"repeat":for(var l in k.cache){e(n+"_"+l,k.cache[l])}break;case"conditional":var q=k.test_param&&k.test_param.value;var h=c.matchCase(k,q);if(h!=-1){e(n,k.cases[h].inputs)}break;default:var o=c.map_dict[n];if(o){f(o,k)}}}}e("",d.inputs);return b},matchResponse:function(d){var b={};var c=this;function e(l,j){if(typeof j==="string"){var g=c.map_dict[l];if(g){b[g]=j}}else{for(var h in j){var f=h;if(l!==""){var k="|";if(j instanceof Array){k="_"}f=l+k+f}e(f,j[h])}}}e("",d);return b},_iterate:function(d,e){var b=this;var c=$(d).children();c.each(function(){var h=this;var g=$(h).attr("id");if($(h).hasClass("section-row")){e[g]={};var f=b.app.input_list[g];if(f){e[g]={input:f}}b._iterate(h,e[g])}else{b._iterate(h,e)}})}})});
\ No newline at end of file
+define(["utils/utils"],function(a){return Backbone.Model.extend({initialize:function(b){this.app=b},finalize:function(g){var b=this;this.map_dict={};if(!this.app.section){return{}}g=g||{};var f={};var e={};this._iterate(this.app.section.$el,e);function d(j,i,h){f[j]=h;b.map_dict[j]=i}function c(p,s){for(var n in s){var k=s[n];if(k.input){var u=k.input;var o=p;if(p!=""){o+="|"}o+=u.name;switch(u.type){case"repeat":var j="section-";var x=[];var r=null;for(var w in k){var q=w.indexOf(j);if(q!=-1){q+=j.length;x.push(parseInt(w.substr(q)));if(!r){r=w.substr(0,q)}}}x.sort(function(y,i){return y-i});var n=0;for(var l in x){c(o+"_"+n++,k[r+x[l]])}break;case"conditional":var v=b.app.field_list[u.id].value();if(g[u.test_param.type]){v=g[u.test_param.type](v)}d(o+"|"+u.test_param.name,u.id,v);var h=b.matchCase(u,v);if(h!=-1){c(o,s[u.id+"-section-"+h])}break;case"section":c("",k);break;default:var t=b.app.field_list[u.id];if(t&&t.value){var v=t.value();if(g[u.type]){v=g[u.type](v)}if((t.skip&&u.optional)||(t.validate&&!t.validate())){v=null}if(u.ignore===undefined||(v!==null&&u.ignore!=v)){d(o,u.id,v);if(u.payload){for(var m in u.payload){d(m,u.id,u.payload[m])}}}}}}}}c("",e);return f},match:function(b){return this.map_dict&&this.map_dict[b]},matchCase:function(b,d){if(b.test_param.type=="boolean"){if(d=="true"){d=b.test_param.truevalue||"true"}else{d=b.test_param.falsevalue||"false"}}for(var c in b.cases){if(b.cases[c].value==d){return c}}return -1},matchModel:function(d,f){var b={};var c=this;function e(g,p){for(var m in p){var k=p[m];var n=k.name;if(g!=""){n=g+"|"+n}switch(k.type){case"repeat":for(var l in k.cache){e(n+"_"+l,k.cache[l])}break;case"conditional":var q=k.test_param&&k.test_param.value;var h=c.matchCase(k,q);if(h!=-1){e(n,k.cases[h].inputs)}break;default:var o=c.map_dict[n];if(o){f(o,k)}}}}e("",d.inputs);return b},matchResponse:function(d){var b={};var c=this;function e(l,j){if(typeof j==="string"){var g=c.map_dict[l];if(g){b[g]=j}}else{for(var h in j){var f=h;if(l!==""){var k="|";if(j instanceof Array){k="_"}f=l+k+f}e(f,j[h])}}}e("",d);return b},_iterate:function(d,e){var b=this;var c=$(d).children();c.each(function(){var h=this;var g=$(h).attr("id");if($(h).hasClass("section-row")){e[g]={};var f=b.app.input_list[g];if(f){e[g]={input:f}}b._iterate(h,e[g])}else{b._iterate(h,e)}})}})});
\ No newline at end of file
diff -r b73cb7a7cdca3545d6347c5c4da24cfcc0841c2d -r 820114af3bf0689131885c8c99165532902bd2af static/scripts/packed/mvc/ui/ui-options.js
--- a/static/scripts/packed/mvc/ui/ui-options.js
+++ b/static/scripts/packed/mvc/ui/ui-options.js
@@ -1,1 +1,1 @@
-define(["utils/utils"],function(b){var a=Backbone.View.extend({initialize:function(g){this.optionsDefault={visible:true,data:[],id:b.uuid(),error_text:"No data available.",wait_text:"Please wait..."};this.options=b.merge(g,this.optionsDefault);this.setElement("<div/>");this.$message=$("<div/>");this.$options=$(this._template(g));this.$el.append(this.$message);this.$el.append(this.$options);if(!this.options.visible){this.$el.hide()}this.update(this.options.data);if(this.options.value!==undefined){this.value(this.options.value)}var f=this;this.on("change",function(){f._change()})},update:function(g){var j=this._getValue();this.$options.empty();if(this._templateOptions){this.$options.append(this._templateOptions(g))}else{for(var h in g){var i=$(this._templateOption(g[h]));i.addClass("ui-option");this.$options.append(i)}}var f=this;this.$el.find("input").on("change",function(){f.value(f._getValue());f._change()});this._refresh();this.value(j)},value:function(g){if(g!==undefined){if(!(g instanceof Array)){g=[g]}this.$el.find("input").prop("checked",false);for(var f in g){this.$el.find('input[value="'+g[f]+'"]').first().prop("checked",true)}}return this._getValue()},exists:function(g){if(g!==undefined){if(!(g instanceof Array)){g=[g]}for(var f in g){if(this.$el.find('input[value="'+g[f]+'"]').length>0){return true}}}return false},first:function(){var f=this.$el.find("input");if(f.length>0){return f.val()}else{return undefined}},validate:function(){return b.validate(this.value())},wait:function(){if(this._size()==0){this._messageShow(this.options.wait_text,"info");this.$options.hide()}},unwait:function(){this._messageHide();this._refresh()},_change:function(){if(this.options.onchange){this.options.onchange(this._getValue())}},_refresh:function(){if(this._size()==0){this._messageShow(this.options.error_text,"danger");this.$options.hide()}else{this._messageHide();this.$options.css("display","inline-block")}},_getValue:function(){var g=this.$el.find(":checked");if(g.length==0){return"null"}if(this.options.multiple){var f=[];g.each(function(){f.push($(this).val())});return f}else{return g.val()}},_size:function(){return this.$el.find(".ui-option").length},_messageShow:function(g,f){this.$message.show();this.$message.removeClass();this.$message.addClass("ui-message alert alert-"+f);this.$message.html(g)},_messageHide:function(){this.$message.hide()},_template:function(){return'<div class="ui-options"/>'}});var d={};d.View=a.extend({initialize:function(f){a.prototype.initialize.call(this,f)},_templateOption:function(f){return'<div><input type="radio" name="'+this.options.id+'" value="'+f.value+'"/>'+f.label+"<br></div>"}});var c={};c.View=a.extend({initialize:function(f){f.multiple=true;a.prototype.initialize.call(this,f)},_templateOption:function(f){return'<div><input type="checkbox" name="'+this.options.id+'" value="'+f.value+'"/>'+f.label+"<br></div>"}});var e={};e.View=a.extend({initialize:function(f){a.prototype.initialize.call(this,f)},value:function(f){if(f!==undefined){this.$el.find("input").prop("checked",false);this.$el.find("label").removeClass("active");this.$el.find('[value="'+f+'"]').prop("checked",true).closest("label").addClass("active")}return this._getValue()},_templateOption:function(g){var f='<label class="btn btn-default">';if(g.icon){f+='<i class="fa '+g.icon+'"/>'}f+='<input type="radio" name="'+this.options.id+'" value="'+g.value+'">'+g.label+"</label>";return f},_template:function(){return'<div class="btn-group ui-radiobutton" data-toggle="buttons"/>'}});return{Base:a,Radio:d,RadioButton:e,Checkbox:c}});
\ No newline at end of file
+define(["utils/utils"],function(b){var a=Backbone.View.extend({initialize:function(g){this.optionsDefault={visible:true,data:[],id:b.uuid(),error_text:"No data available.",wait_text:"Please wait..."};this.options=b.merge(g,this.optionsDefault);this.setElement("<div/>");this.$message=$("<div/>");this.$options=$(this._template(g));this.$el.append(this.$message);this.$el.append(this.$options);if(!this.options.visible){this.$el.hide()}this.update(this.options.data);if(this.options.value!==undefined){this.value(this.options.value)}var f=this;this.on("change",function(){f._change()})},update:function(g){var j=this._getValue();this.$options.empty();if(this._templateOptions){this.$options.append(this._templateOptions(g))}else{for(var h in g){var i=$(this._templateOption(g[h]));i.addClass("ui-option");this.$options.append(i)}}var f=this;this.$el.find("input").on("change",function(){f.value(f._getValue());f._change()});this._refresh();this.value(j)},value:function(g){if(g!==undefined){if(!(g instanceof Array)){g=[g]}this.$el.find("input").prop("checked",false);for(var f in g){this.$el.find('input[value="'+g[f]+'"]').first().prop("checked",true)}}return this._getValue()},exists:function(g){if(g!==undefined){if(!(g instanceof Array)){g=[g]}for(var f in g){if(this.$el.find('input[value="'+g[f]+'"]').length>0){return true}}}return false},first:function(){var f=this.$el.find("input");if(f.length>0){return f.val()}else{return undefined}},validate:function(){return b.validate(this.value())},wait:function(){if(this._size()==0){this._messageShow(this.options.wait_text,"info");this.$options.hide()}},unwait:function(){this._messageHide();this._refresh()},_change:function(){if(this.options.onchange){this.options.onchange(this._getValue())}},_refresh:function(){if(this._size()==0){this._messageShow(this.options.error_text,"danger");this.$options.hide()}else{this._messageHide();this.$options.css("display","inline-block")}},_getValue:function(){var g=this.$el.find(":checked");if(g.length==0){return"__null__"}if(this.options.multiple){var f=[];g.each(function(){f.push($(this).val())});return f}else{return g.val()}},_size:function(){return this.$el.find(".ui-option").length},_messageShow:function(g,f){this.$message.show();this.$message.removeClass();this.$message.addClass("ui-message alert alert-"+f);this.$message.html(g)},_messageHide:function(){this.$message.hide()},_template:function(){return'<div class="ui-options"/>'}});var d={};d.View=a.extend({initialize:function(f){a.prototype.initialize.call(this,f)},_templateOption:function(f){return'<div><input type="radio" name="'+this.options.id+'" value="'+f.value+'"/>'+f.label+"<br></div>"}});var c={};c.View=a.extend({initialize:function(f){f.multiple=true;a.prototype.initialize.call(this,f)},_templateOption:function(f){return'<div><input type="checkbox" name="'+this.options.id+'" value="'+f.value+'"/>'+f.label+"<br></div>"}});var e={};e.View=a.extend({initialize:function(f){a.prototype.initialize.call(this,f)},value:function(f){if(f!==undefined){this.$el.find("input").prop("checked",false);this.$el.find("label").removeClass("active");this.$el.find('[value="'+f+'"]').prop("checked",true).closest("label").addClass("active")}return this._getValue()},_templateOption:function(g){var f='<label class="btn btn-default">';if(g.icon){f+='<i class="fa '+g.icon+'"/>'}f+='<input type="radio" name="'+this.options.id+'" value="'+g.value+'">'+g.label+"</label>";return f},_template:function(){return'<div class="btn-group ui-radiobutton" data-toggle="buttons"/>'}});return{Base:a,Radio:d,RadioButton:e,Checkbox:c}});
\ No newline at end of file
diff -r b73cb7a7cdca3545d6347c5c4da24cfcc0841c2d -r 820114af3bf0689131885c8c99165532902bd2af static/scripts/packed/mvc/ui/ui-select-default.js
--- a/static/scripts/packed/mvc/ui/ui-select-default.js
+++ b/static/scripts/packed/mvc/ui/ui-select-default.js
@@ -1,1 +1,1 @@
-define(["utils/utils"],function(a){var b=Backbone.View.extend({optionsDefault:{id:"",cls:"",error_text:"No data available",visible:true,wait:false,multiple:false,searchable:false},initialize:function(d){this.options=a.merge(d,this.optionsDefault);this.setElement(this._template(this.options));this.$select=this.$el.find(".select");this.$icon=this.$el.find(".icon");this.$button=this.$el.find(".button");if(this.options.multiple){this.$select.prop("multiple",true);this.$select.addClass("ui-select-multiple");this.$icon.remove()}else{this.$el.addClass("ui-select")}this.update(this.options.data);if(this.options.value!==undefined){this.value(this.options.value)}if(!this.options.visible){this.hide()}if(this.options.wait){this.wait()}else{this.show()}var c=this;this.$select.on("change",function(){c._change()});this.on("change",function(){c._change()})},value:function(c){if(c!==undefined){this.$select.val(c);if(this.$select.select2){this.$select.select2("val",c)}}return this.$select.val()},first:function(){var c=this.$select.find("option");if(c.length>0){return c.val()}else{return undefined}},validate:function(){return a.validate(this.value())},text:function(){return this.$select.find("option:selected").text()},show:function(){this.unwait();this.$select.show();this.$el.show()},hide:function(){this.$el.hide()},wait:function(){this.$icon.removeClass();this.$icon.addClass("fa fa-spinner fa-spin")},unwait:function(){this.$icon.removeClass();this.$icon.addClass("fa fa-caret-down")},disabled:function(){return this.$select.is(":disabled")},enable:function(){this.$select.prop("disabled",false)},disable:function(){this.$select.prop("disabled",true)},add:function(c){this.$select.append(this._templateOption(c));this._refresh()},del:function(c){this.$select.find("option[value="+c+"]").remove();this.$select.trigger("change");this._refresh()},update:function(c){var e=this.$select.val();this.$select.find("option").remove();for(var d in c){this.$select.append(this._templateOption(c[d]))}this._refresh();this.$select.val(e);if(!this.$select.val()){this.$select.val(this.first())}if(this.options.searchable){this.$button.hide();this.$select.select2("destroy");this.$select.select2()}},setOnChange:function(c){this.options.onchange=c},exists:function(c){return this.$select.find('option[value="'+c+'"]').length>0},_change:function(){if(this.options.onchange){this.options.onchange(this.$select.val())}},_refresh:function(){this.$select.find("option[value=null]").remove();var c=this.$select.find("option").length;if(c==0){this.disable();this.$select.append(this._templateOption({value:"null",label:this.options.error_text}))}else{this.enable()}},_templateOption:function(c){return'<option value="'+c.value+'">'+c.label+"</option>"},_template:function(c){return'<div id="'+c.id+'"><select id="select" class="select '+c.cls+" "+c.id+'"></select><div class="button"><i class="icon"/></div></div>'}});return{View:b}});
\ No newline at end of file
+define(["utils/utils"],function(a){var b=Backbone.View.extend({optionsDefault:{id:"",cls:"",error_text:"No data available",empty_text:"No selection",visible:true,wait:false,multiple:false,searchable:false,optional:false},initialize:function(d){this.options=a.merge(d,this.optionsDefault);this.setElement(this._template(this.options));this.$select=this.$el.find(".select");this.$icon=this.$el.find(".icon");this.$button=this.$el.find(".button");if(this.options.multiple){this.$select.prop("multiple",true);this.$select.addClass("ui-select-multiple");this.$icon.remove()}else{this.$el.addClass("ui-select")}this.update(this.options.data);if(this.options.value!==undefined){this.value(this.options.value)}if(!this.options.visible){this.hide()}if(this.options.wait){this.wait()}else{this.show()}var c=this;this.$select.on("change",function(){c._change()});this.on("change",function(){c._change()})},value:function(c){if(c!==undefined){this.$select.val(c);if(this.$select.select2){this.$select.select2("val",c)}}return this.$select.val()},first:function(){var c=this.$select.find("option");if(c.length>0){return c.val()}else{return undefined}},validate:function(){return a.validate(this.value())},text:function(){return this.$select.find("option:selected").text()},show:function(){this.unwait();this.$select.show();this.$el.show()},hide:function(){this.$el.hide()},wait:function(){this.$icon.removeClass();this.$icon.addClass("fa fa-spinner fa-spin")},unwait:function(){this.$icon.removeClass();this.$icon.addClass("fa fa-caret-down")},disabled:function(){return this.$select.is(":disabled")},enable:function(){this.$select.prop("disabled",false)},disable:function(){this.$select.prop("disabled",true)},add:function(c){this.$select.append(this._templateOption(c));this._refresh()},del:function(c){this.$select.find("option[value="+c+"]").remove();this.$select.trigger("change");this._refresh()},update:function(c){var e=this.$select.val();this.$select.find("option").remove();if(this.options.optional&&!this.options.multiple){this.$select.append(this._templateOption({value:"__null__",label:this.options.empty_text}))}for(var d in c){this.$select.append(this._templateOption(c[d]))}this._refresh();this.$select.val(e);if(!this.$select.val()){this.$select.val(this.first())}if(this.options.searchable){this.$button.hide();this.$select.select2("destroy");this.$select.select2()}},setOnChange:function(c){this.options.onchange=c},exists:function(c){return this.$select.find('option[value="'+c+'"]').length>0},_change:function(){if(this.options.onchange){this.options.onchange(this.$select.val())}},_refresh:function(){this.$select.find('option[value="__undefined__"]').remove();var c=this.$select.find("option").length;if(c==0){this.disable();this.$select.append(this._templateOption({value:"__undefined__",label:this.options.error_text}))}else{this.enable()}},_templateOption:function(c){return'<option value="'+c.value+'">'+c.label+"</option>"},_template:function(c){return'<div id="'+c.id+'"><select id="select" class="select '+c.cls+" "+c.id+'"></select><div class="button"><i class="icon"/></div></div>'}});return{View:b}});
\ No newline at end of file
diff -r b73cb7a7cdca3545d6347c5c4da24cfcc0841c2d -r 820114af3bf0689131885c8c99165532902bd2af static/scripts/packed/utils/utils.js
--- a/static/scripts/packed/utils/utils.js
+++ b/static/scripts/packed/utils/utils.js
@@ -1,1 +1,1 @@
-define(["libs/underscore"],function(m){function n(r,q){for(var o in r){var p=r[o];if(p&&typeof(p)=="object"){q(p);n(p,q)}}}function d(o){return $("<div/>").text(o).html()}function l(p){if(!(p instanceof Array)){p=[p]}for(var o in p){if(["None",null,"null",undefined,"undefined"].indexOf(p[o])>-1){return false}}return true}function h(o){var o=o.toString();if(o){o=o.replace(/,/g,", ");var p=o.lastIndexOf(", ");if(p!=-1){o=o.substr(0,p)+" or "+o.substr(p+1)}return o}return""}function e(o){top.__utils__get__=top.__utils__get__||{};if(o.cache&&top.__utils__get__[o.url]){o.success&&o.success(top.__utils__get__[o.url]);console.debug("utils.js::get() - Fetching from cache ["+o.url+"].")}else{i({url:o.url,data:o.data,success:function(p){top.__utils__get__[o.url]=p;o.success&&o.success(p)},error:function(p){o.error&&o.error(p)}})}}function i(p){var o={contentType:"application/json",type:p.type||"GET",data:p.data||{},url:p.url};if(o.type=="GET"||o.type=="DELETE"){if(o.url.indexOf("?")==-1){o.url+="?"}else{o.url+="&"}o.url=o.url+$.param(o.data,true);o.data=null}else{o.dataType="json";o.url=o.url;o.data=JSON.stringify(o.data)}$.ajax(o).done(function(q){if(typeof q==="string"){try{q=q.replace("Infinity,",'"Infinity",');q=jQuery.parseJSON(q)}catch(r){console.debug(r)}}p.success&&p.success(q)}).fail(function(r){var q=null;try{q=jQuery.parseJSON(r.responseText)}catch(s){q=r.responseText}p.error&&p.error(q,r)})}function j(r,o){var p=$('<div class="'+r+'"></div>');p.appendTo(":eq(0)");var q=p.css(o);p.remove();return q}function g(o){if(!$('link[href^="'+o+'"]').length){$('<link href="'+galaxy_config.root+o+'" rel="stylesheet">').appendTo("head")}}function k(o,p){if(o){return m.defaults(o,p)}else{return p}}function b(p,r){var q="";if(p>=100000000000){p=p/100000000000;q="TB"}else{if(p>=100000000){p=p/100000000;q="GB"}else{if(p>=100000){p=p/100000;q="MB"}else{if(p>=100){p=p/100;q="KB"}else{if(p>0){p=p*10;q="b"}else{return"<strong>-</strong>"}}}}}var o=(Math.round(p)/10);if(r){return o+" "+q}else{return"<strong>"+o+"</strong> "+q}}function a(){return"x"+Math.random().toString(36).substring(2,9)}function c(o){var p=$("<p></p>");p.append(o);return p}function f(){var q=new Date();var o=(q.getHours()<10?"0":"")+q.getHours();var p=(q.getMinutes()<10?"0":"")+q.getMinutes();var r=q.getDate()+"/"+(q.getMonth()+1)+"/"+q.getFullYear()+", "+o+":"+p;return r}return{cssLoadFile:g,cssGetAttribute:j,get:e,merge:k,bytesToString:b,uuid:a,time:f,wrap:c,request:i,sanitize:d,textify:h,validate:l,deepeach:n}});
\ No newline at end of file
+define(["libs/underscore"],function(m){function n(r,q){for(var o in r){var p=r[o];if(p&&typeof(p)=="object"){q(p);n(p,q)}}}function d(o){return $("<div/>").text(o).html()}function l(p){if(!(p instanceof Array)){p=[p]}for(var o in p){if(["__null__","__undefined__","None",null,undefined].indexOf(p[o])>-1){return false}}return true}function h(o){var o=o.toString();if(o){o=o.replace(/,/g,", ");var p=o.lastIndexOf(", ");if(p!=-1){o=o.substr(0,p)+" or "+o.substr(p+1)}return o}return""}function e(o){top.__utils__get__=top.__utils__get__||{};if(o.cache&&top.__utils__get__[o.url]){o.success&&o.success(top.__utils__get__[o.url]);console.debug("utils.js::get() - Fetching from cache ["+o.url+"].")}else{i({url:o.url,data:o.data,success:function(p){top.__utils__get__[o.url]=p;o.success&&o.success(p)},error:function(p){o.error&&o.error(p)}})}}function i(p){var o={contentType:"application/json",type:p.type||"GET",data:p.data||{},url:p.url};if(o.type=="GET"||o.type=="DELETE"){if(o.url.indexOf("?")==-1){o.url+="?"}else{o.url+="&"}o.url=o.url+$.param(o.data,true);o.data=null}else{o.dataType="json";o.url=o.url;o.data=JSON.stringify(o.data)}$.ajax(o).done(function(q){if(typeof q==="string"){try{q=q.replace("Infinity,",'"Infinity",');q=jQuery.parseJSON(q)}catch(r){console.debug(r)}}p.success&&p.success(q)}).fail(function(r){var q=null;try{q=jQuery.parseJSON(r.responseText)}catch(s){q=r.responseText}p.error&&p.error(q,r)})}function j(r,o){var p=$('<div class="'+r+'"></div>');p.appendTo(":eq(0)");var q=p.css(o);p.remove();return q}function g(o){if(!$('link[href^="'+o+'"]').length){$('<link href="'+galaxy_config.root+o+'" rel="stylesheet">').appendTo("head")}}function k(o,p){if(o){return m.defaults(o,p)}else{return p}}function b(p,r){var q="";if(p>=100000000000){p=p/100000000000;q="TB"}else{if(p>=100000000){p=p/100000000;q="GB"}else{if(p>=100000){p=p/100000;q="MB"}else{if(p>=100){p=p/100;q="KB"}else{if(p>0){p=p*10;q="b"}else{return"<strong>-</strong>"}}}}}var o=(Math.round(p)/10);if(r){return o+" "+q}else{return"<strong>"+o+"</strong> "+q}}function a(){return"x"+Math.random().toString(36).substring(2,9)}function c(o){var p=$("<p></p>");p.append(o);return p}function f(){var q=new Date();var o=(q.getHours()<10?"0":"")+q.getHours();var p=(q.getMinutes()<10?"0":"")+q.getMinutes();var r=q.getDate()+"/"+(q.getMonth()+1)+"/"+q.getFullYear()+", "+o+":"+p;return r}return{cssLoadFile:g,cssGetAttribute:j,get:e,merge:k,bytesToString:b,uuid:a,time:f,wrap:c,request:i,sanitize:d,textify:h,validate:l,deepeach:n}});
\ No newline at end of file
diff -r b73cb7a7cdca3545d6347c5c4da24cfcc0841c2d -r 820114af3bf0689131885c8c99165532902bd2af static/scripts/utils/utils.js
--- a/static/scripts/utils/utils.js
+++ b/static/scripts/utils/utils.js
@@ -36,7 +36,7 @@
value = [value];
}
for (var i in value) {
- if (['None', null, 'null', undefined, 'undefined'].indexOf(value[i]) > -1) {
+ if (['__null__', '__undefined__', 'None', null, undefined].indexOf(value[i]) > -1) {
return false;
}
}
diff -r b73cb7a7cdca3545d6347c5c4da24cfcc0841c2d -r 820114af3bf0689131885c8c99165532902bd2af templates/webapps/galaxy/workflow/editor_tool_form.mako
--- a/templates/webapps/galaxy/workflow/editor_tool_form.mako
+++ b/templates/webapps/galaxy/workflow/editor_tool_form.mako
@@ -18,7 +18,6 @@
'is_dynamic' : False,
'compact' : True,
'initial_errors' : True,
- 'send_all' : True,
'container' : '#right-content'
})
%>
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
23 new commits in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/7ee46fef21b7/
Changeset: 7ee46fef21b7
Branch: upload-UI-enhancement
User: JenCabral
Date: 2015-01-14 13:30:39+00:00
Summary: Adding select-all to ftpupload
Affected #: 1 file
diff -r a2308bdc93b897af974766b190abe019ade49e9a -r 7ee46fef21b796e355e4dcc995852345f2325879 static/scripts/mvc/upload/upload-ftp.js
--- a/static/scripts/mvc/upload/upload-ftp.js
+++ b/static/scripts/mvc/upload/upload-ftp.js
@@ -49,6 +49,48 @@
// update stats
this.$el.find('#upload-ftp-number').html(ftp_files.length + ' files');
this.$el.find('#upload-ftp-disk').html(Utils.bytesToString (size, true));
+ // ADD THINGS HERE
+ //
+ $($('.upload-ftp')[0]).find('#selectAll').on('click', function(){
+ var checkboxes=$(this).parent().parent().parent().parent().find('tr.upload-ftp-row>td>div');
+ var len = checkboxes.length;
+ var allChecked;
+ $this = $(this);
+ //
+ if($this.hasClass("fa-square-o")){
+ $this.removeClass("fa-square-o");
+ $this.removeClass("fa-minus-square-o");
+ $this.addClass("fa-check-square-o");
+ allChecked=true;
+ }
+ else{
+ $this.removeClass("fa-check-square-o");
+ $this.removeClass("fa-minus-square-o");
+ $this.addClass("fa-square-o");
+ allChecked=false;
+ }
+ //
+ for(i = 0; i < len; i++){
+ if(allChecked)
+ {
+
+ checkboxes.eq(i).removeClass("fa-square-o");
+ checkboxes.eq(i).addClass("fa-check-square-o");
+ }
+ else{
+ checkboxes.eq(i).removeClass("fa-check-square-o");
+ checkboxes.eq(i).addClass("fa-square-o");
+ }
+ }
+ console.log(checkboxes, allChecked);
+ return;
+ } );
+
+
+
+ // END JC ADD
+
+
} else {
// add info
this.$el.find('#upload-ftp-content').html($(this._templateInfo()));
@@ -56,6 +98,10 @@
// hide spinner
this.$el.find('#upload-ftp-wait').hide();
+
+
+
+
},
// add
@@ -110,7 +156,40 @@
// add new icon class
$icon.addClass(self.options.class_add);
}
+
+ var selectBox=$icon.parent().parent().parent().parent().find('#selectAll');
+ var checkboxes=$icon.parent().parent().parent().parent().find('tr.upload-ftp-row>td>div');
+ var checkedCheckboxes=$icon.parent().parent().parent().parent().find('tr.upload-ftp-row>td>div.fa-check-square-o');
+ var lenAll = checkboxes.length;
+ var lenChecked = checkedCheckboxes.length;
+// var checked = 0;
+ // console.log("BeforeLoop " + checked);
+ // for (i = 0; i < len; i++) {
+ // console.log("In loop "+checked, checkboxes.eq(i));
+ // if (checkboxes.eq(i).hasClass("fa-check-square-o")) {
+ // checked++;
+ // console.log("In if "+checked);
+ // }
+ // }
+ if(lenChecked > 0 && lenChecked !== lenAll){
+ selectBox.removeClass("fa-square-o");
+ selectBox.removeClass("fa-check-square-o");
+ selectBox.addClass("fa-minus-square-o");
+ }
+ else if(lenChecked === lenAll){
+ selectBox.removeClass("fa-square-o");
+ selectBox.addClass("fa-check-square-o");
+ selectBox.removeClass("fa-minus-square-o");
+ }
+ else if(lenChecked === 0){
+ selectBox.addClass("fa-square-o");
+ selectBox.removeClass("fa-check-square-o");
+ selectBox.removeClass("fa-minus-square-o");
+ }
+ console.log(checkboxes,lenChecked);
+
});
+
},
// get model index
@@ -130,7 +209,7 @@
// template row
_templateRow: function(options) {
return '<tr class="upload-ftp-row" style="cursor: pointer;">' +
- '<td><div class="icon"/></td>' +
+ '<td><div class="icon " /></td>' +
'<td style="width: 200px"><p style="width: inherit; word-wrap: break-word;">' + options.path + '</p></td>' +
'<td style="white-space: nowrap;">' + Utils.bytesToString(options.size) + '</td>' +
'<td style="white-space: nowrap;">' + options.ctime + '</td>' +
@@ -149,7 +228,9 @@
'<table class="grid" style="float: left;">' +
'<thead>' +
'<tr>' +
- '<th></th>' +
+//jc added
+ '<th><div id="selectAll" class="upload-icon-button fa fa-square-o" ></th>' +
+//end jc added
'<th>Name</th>' +
'<th>Size</th>' +
'<th>Created</th>' +
@@ -171,7 +252,11 @@
return '<div class="upload-ftp">' +
'<div id="upload-ftp-wait" class="upload-ftp-wait fa fa-spinner fa-spin"/>' +
'<div class="upload-ftp-help">This Galaxy server allows you to upload files via FTP. To upload some files, log in to the FTP server at <strong>' + this.app.options.ftp_upload_site + '</strong> using your Galaxy credentials (email address and password).</div>' +
- '<div id="upload-ftp-content"></div>' +
+ '<div id="upload-ftp-content">'
+//jc added
+
+//end jc added
+ '</div>' +
'<div>';
}
https://bitbucket.org/galaxy/galaxy-central/commits/49f601721738/
Changeset: 49f601721738
Branch: upload-UI-enhancement
User: JenCabral
Date: 2015-01-14 20:33:26+00:00
Summary: complete selectAll checkbox
Affected #: 1 file
diff -r 7ee46fef21b796e355e4dcc995852345f2325879 -r 49f601721738ec2742252c090240381ff2551455 static/scripts/mvc/upload/upload-ftp.js
--- a/static/scripts/mvc/upload/upload-ftp.js
+++ b/static/scripts/mvc/upload/upload-ftp.js
@@ -49,59 +49,62 @@
// update stats
this.$el.find('#upload-ftp-number').html(ftp_files.length + ' files');
this.$el.find('#upload-ftp-disk').html(Utils.bytesToString (size, true));
- // ADD THINGS HERE
- //
- $($('.upload-ftp')[0]).find('#selectAll').on('click', function(){
- var checkboxes=$(this).parent().parent().parent().parent().find('tr.upload-ftp-row>td>div');
+
+ var selectAll = this.$el.find('#selectAll');
+
+ // call method to determine and set selectAll status on loading
+ this._updateSelectAll(selectAll);
+
+ // selectAll checkbox has been clicked
+ selectAll.on('click', function(){
+ var checkboxes=$(this).parents().find('tr.upload-ftp-row>td>div');
var len = checkboxes.length;
var allChecked;
$this = $(this);
- //
- if($this.hasClass("fa-square-o")){
- $this.removeClass("fa-square-o");
- $this.removeClass("fa-minus-square-o");
- $this.addClass("fa-check-square-o");
+
+ // change state of the selectAll checkbox
+ if($this.hasClass('fa-square-o')){
+ // in unchecked, change to checked
+ $this.removeClass('fa-square-o fa-minus-square-o');
+ $this.addClass('fa-check-square-o');
allChecked=true;
}
else{
- $this.removeClass("fa-check-square-o");
- $this.removeClass("fa-minus-square-o");
- $this.addClass("fa-square-o");
+ // if checked, change to unchecked
+ $this.removeClass('fa-check-square-o fa-minus-square-o');
+ $this.addClass('fa-square-o');
allChecked=false;
}
- //
+
+ // change state of the sub-checkboxes
for(i = 0; i < len; i++){
if(allChecked)
{
-
- checkboxes.eq(i).removeClass("fa-square-o");
- checkboxes.eq(i).addClass("fa-check-square-o");
+ // all checkboxes should be checked
+ if(checkboxes.eq(i).hasClass('fa-square-o'))
+ {
+ // if they are not checked, check them
+ checkboxes.eq(i).trigger('addToUpBox');
+ }
}
else{
- checkboxes.eq(i).removeClass("fa-check-square-o");
- checkboxes.eq(i).addClass("fa-square-o");
+ // no checkboxes should be checked
+ if(checkboxes.eq(i).hasClass('fa-check-square-o'))
+ {
+ // if they are checked, uncheck them
+ checkboxes.eq(i).trigger('addToUpBox');
+ }
}
}
- console.log(checkboxes, allChecked);
return;
} );
-
-
- // END JC ADD
-
-
} else {
// add info
this.$el.find('#upload-ftp-content').html($(this._templateInfo()));
}
-
// hide spinner
this.$el.find('#upload-ftp-wait').hide();
-
-
-
-
},
// add
@@ -125,73 +128,74 @@
} else {
icon_class = this.options.class_add;
}
-
// add icon class
$icon.addClass(icon_class);
+
+ $it.on('addToUpBox', function(){
+ var model_index = self._find(ftp_file);
- // click to add ftp files
- $it.on('click', function() {
- // find model
- var model_index = self._find(ftp_file);
-
- // update icon
- $icon.removeClass();
-
- // add model
- if (!model_index) {
- // add to uploadbox
- self.app.uploadbox.add([{
- mode : 'ftp',
- name : ftp_file.path,
- size : ftp_file.size,
- path : ftp_file.path
- }]);
-
- // add new icon class
- $icon.addClass(self.options.class_remove);
- } else {
- // remove
- self.app.collection.remove(model_index);
-
- // add new icon class
- $icon.addClass(self.options.class_add);
- }
+ // update icon
+ $icon.removeClass();
- var selectBox=$icon.parent().parent().parent().parent().find('#selectAll');
- var checkboxes=$icon.parent().parent().parent().parent().find('tr.upload-ftp-row>td>div');
- var checkedCheckboxes=$icon.parent().parent().parent().parent().find('tr.upload-ftp-row>td>div.fa-check-square-o');
- var lenAll = checkboxes.length;
- var lenChecked = checkedCheckboxes.length;
-// var checked = 0;
- // console.log("BeforeLoop " + checked);
- // for (i = 0; i < len; i++) {
- // console.log("In loop "+checked, checkboxes.eq(i));
- // if (checkboxes.eq(i).hasClass("fa-check-square-o")) {
- // checked++;
- // console.log("In if "+checked);
- // }
- // }
- if(lenChecked > 0 && lenChecked !== lenAll){
- selectBox.removeClass("fa-square-o");
- selectBox.removeClass("fa-check-square-o");
- selectBox.addClass("fa-minus-square-o");
- }
- else if(lenChecked === lenAll){
- selectBox.removeClass("fa-square-o");
- selectBox.addClass("fa-check-square-o");
- selectBox.removeClass("fa-minus-square-o");
- }
- else if(lenChecked === 0){
- selectBox.addClass("fa-square-o");
- selectBox.removeClass("fa-check-square-o");
- selectBox.removeClass("fa-minus-square-o");
- }
- console.log(checkboxes,lenChecked);
-
+ // add model
+ if (!model_index) {
+ // add to uploadbox
+ self.app.uploadbox.add([{
+ mode : 'ftp',
+ name : ftp_file.path,
+ size : ftp_file.size,
+ path : ftp_file.path
+ }]);
+ // add new icon class
+ $icon.addClass(self.options.class_remove);
+ } else {
+ // remove
+ self.app.collection.remove(model_index);
+ // add new icon class
+ $icon.addClass(self.options.class_add);
+ }
});
- },
-
+ $it.on('click', function() {
+ //trigger my new event
+ $icon.trigger('addToUpBox');
+
+ // click to add ftp files
+ // modify selectAll box based on number of checkboxes checked
+ var selectBox=$icon.parents().find('#selectAll');
+ // determine and set state of selectAll after sub-checkbox clicked
+ self._updateSelectAll(selectBox);
+ });
+ },
+
+ _updateSelectAll: function(selectBox){
+ // array of all checkboxes
+ var checkboxes=selectBox.parents().find('tr.upload-ftp-row>td>div');
+ // array of only checked checkboxes
+ var checkedCheckboxes=selectBox.parents().find('tr.upload-ftp-row>td>div.fa-check-square-o');
+ var lenAll = checkboxes.length;
+ var lenChecked = checkedCheckboxes.length;
+
+ // determine which state the selectAll checkbox needs to be and setting it
+ if(lenChecked > 0 && lenChecked !== lenAll){
+ // indeterminate state
+ selectBox.removeClass('fa-square-o fa-check-square-o');
+ selectBox.addClass('fa-minus-square-o');
+ }
+ else if(lenChecked === lenAll){
+ // checked state
+ selectBox.removeClass('fa-square-o fa-minus-square-o');
+ selectBox.addClass('fa-check-square-o');
+ }
+ else if(lenChecked === 0){
+ // unchecked state
+ selectBox.removeClass('fa-check-square-o fa-minus-square-o');
+ selectBox.addClass('fa-square-o');
+ }
+ },
+
+
+
// get model index
_find: function(ftp_file) {
// check if exists already
https://bitbucket.org/galaxy/galaxy-central/commits/05d85016a5cc/
Changeset: 05d85016a5cc
Branch: upload-UI-enhancement
User: JenCabral
Date: 2015-01-14 20:40:28+00:00
Summary: complete selectAll checkbox cleanup
Affected #: 1 file
diff -r 49f601721738ec2742252c090240381ff2551455 -r 05d85016a5ccf5fc3437e75cc3e3b726387042e6 static/scripts/mvc/upload/upload-ftp.js
--- a/static/scripts/mvc/upload/upload-ftp.js
+++ b/static/scripts/mvc/upload/upload-ftp.js
@@ -103,6 +103,7 @@
// add info
this.$el.find('#upload-ftp-content').html($(this._templateInfo()));
}
+
// hide spinner
this.$el.find('#upload-ftp-wait').hide();
},
@@ -128,10 +129,12 @@
} else {
icon_class = this.options.class_add;
}
+
// add icon class
$icon.addClass(icon_class);
$it.on('addToUpBox', function(){
+ // find model
var model_index = self._find(ftp_file);
// update icon
@@ -146,16 +149,19 @@
size : ftp_file.size,
path : ftp_file.path
}]);
+
// add new icon class
$icon.addClass(self.options.class_remove);
} else {
// remove
self.app.collection.remove(model_index);
+
// add new icon class
$icon.addClass(self.options.class_add);
}
});
+ // click to add ftp files
$it.on('click', function() {
//trigger my new event
$icon.trigger('addToUpBox');
@@ -232,9 +238,7 @@
'<table class="grid" style="float: left;">' +
'<thead>' +
'<tr>' +
-//jc added
'<th><div id="selectAll" class="upload-icon-button fa fa-square-o" ></th>' +
-//end jc added
'<th>Name</th>' +
'<th>Size</th>' +
'<th>Created</th>' +
@@ -257,9 +261,7 @@
'<div id="upload-ftp-wait" class="upload-ftp-wait fa fa-spinner fa-spin"/>' +
'<div class="upload-ftp-help">This Galaxy server allows you to upload files via FTP. To upload some files, log in to the FTP server at <strong>' + this.app.options.ftp_upload_site + '</strong> using your Galaxy credentials (email address and password).</div>' +
'<div id="upload-ftp-content">'
-//jc added
-//end jc added
'</div>' +
'<div>';
}
https://bitbucket.org/galaxy/galaxy-central/commits/7be57e717422/
Changeset: 7be57e717422
Branch: upload-UI-enhancement
User: JenCabral
Date: 2015-01-14 20:53:07+00:00
Summary: complete selectAll tab fixes
Affected #: 1 file
diff -r 05d85016a5ccf5fc3437e75cc3e3b726387042e6 -r 7be57e7174228c8300fc76d1514f25f7408bf32a static/scripts/mvc/upload/upload-ftp.js
--- a/static/scripts/mvc/upload/upload-ftp.js
+++ b/static/scripts/mvc/upload/upload-ftp.js
@@ -56,48 +56,48 @@
this._updateSelectAll(selectAll);
// selectAll checkbox has been clicked
- selectAll.on('click', function(){
- var checkboxes=$(this).parents().find('tr.upload-ftp-row>td>div');
- var len = checkboxes.length;
- var allChecked;
- $this = $(this);
+ selectAll.on('click', function(){
+ var checkboxes=$(this).parents().find('tr.upload-ftp-row>td>div');
+ var len = checkboxes.length;
+ var allChecked;
+ $this = $(this);
- // change state of the selectAll checkbox
- if($this.hasClass('fa-square-o')){
- // in unchecked, change to checked
- $this.removeClass('fa-square-o fa-minus-square-o');
- $this.addClass('fa-check-square-o');
- allChecked=true;
- }
- else{
- // if checked, change to unchecked
- $this.removeClass('fa-check-square-o fa-minus-square-o');
- $this.addClass('fa-square-o');
- allChecked=false;
- }
+ // change state of the selectAll checkbox
+ if($this.hasClass('fa-square-o')){
+ // in unchecked, change to checked
+ $this.removeClass('fa-square-o fa-minus-square-o');
+ $this.addClass('fa-check-square-o');
+ allChecked=true;
+ }
+ else{
+ // if checked, change to unchecked
+ $this.removeClass('fa-check-square-o fa-minus-square-o');
+ $this.addClass('fa-square-o');
+ allChecked=false;
+ }
- // change state of the sub-checkboxes
- for(i = 0; i < len; i++){
- if(allChecked)
- {
- // all checkboxes should be checked
+ // change state of the sub-checkboxes
+ for(i = 0; i < len; i++){
+ if(allChecked)
+ {
+ // all checkboxes should be checked
if(checkboxes.eq(i).hasClass('fa-square-o'))
{
- // if they are not checked, check them
+ // if they are not checked, check them
checkboxes.eq(i).trigger('addToUpBox');
}
- }
- else{
- // no checkboxes should be checked
+ }
+ else{
+ // no checkboxes should be checked
if(checkboxes.eq(i).hasClass('fa-check-square-o'))
{
- // if they are checked, uncheck them
- checkboxes.eq(i).trigger('addToUpBox');
+ // if they are checked, uncheck them
+ checkboxes.eq(i).trigger('addToUpBox');
}
- }
- }
- return;
- } );
+ }
+ }
+ return;
+ } );
} else {
// add info
@@ -134,74 +134,74 @@
$icon.addClass(icon_class);
$it.on('addToUpBox', function(){
- // find model
- var model_index = self._find(ftp_file);
+// find model
+var model_index = self._find(ftp_file);
- // update icon
- $icon.removeClass();
+ // update icon
+ $icon.removeClass();
- // add model
- if (!model_index) {
- // add to uploadbox
- self.app.uploadbox.add([{
- mode : 'ftp',
- name : ftp_file.path,
- size : ftp_file.size,
- path : ftp_file.path
- }]);
+ // add model
+ if (!model_index) {
+ // add to uploadbox
+ self.app.uploadbox.add([{
+ mode : 'ftp',
+ name : ftp_file.path,
+ size : ftp_file.size,
+ path : ftp_file.path
+ }]);
- // add new icon class
- $icon.addClass(self.options.class_remove);
- } else {
- // remove
- self.app.collection.remove(model_index);
-
- // add new icon class
- $icon.addClass(self.options.class_add);
- }
+ // add new icon class
+ $icon.addClass(self.options.class_remove);
+ } else {
+ // remove
+ self.app.collection.remove(model_index);
+
+ // add new icon class
+ $icon.addClass(self.options.class_add);
+ }
});
// click to add ftp files
- $it.on('click', function() {
- //trigger my new event
- $icon.trigger('addToUpBox');
+ $it.on('click', function() {
+ //trigger my new event
+ $icon.trigger('addToUpBox');
- // click to add ftp files
- // modify selectAll box based on number of checkboxes checked
- var selectBox=$icon.parents().find('#selectAll');
- // determine and set state of selectAll after sub-checkbox clicked
- self._updateSelectAll(selectBox);
- });
- },
+ // click to add ftp files
+ // modify selectAll box based on number of checkboxes checked
+ var selectBox=$icon.parents().find('#selectAll');
+ // determine and set state of selectAll after sub-checkbox clicked
+ self._updateSelectAll(selectBox);
+ });
+ },
- _updateSelectAll: function(selectBox){
- // array of all checkboxes
- var checkboxes=selectBox.parents().find('tr.upload-ftp-row>td>div');
- // array of only checked checkboxes
- var checkedCheckboxes=selectBox.parents().find('tr.upload-ftp-row>td>div.fa-check-square-o');
- var lenAll = checkboxes.length;
- var lenChecked = checkedCheckboxes.length;
+ _updateSelectAll: function(selectBox){
+ // array of all checkboxes
+ var checkboxes=selectBox.parents().find('tr.upload-ftp-row>td>div');
+ // array of only checked checkboxes
+ var checkedCheckboxes=selectBox.parents().find('tr.upload-ftp-row>td>div.fa-check-square-o');
+ var lenAll = checkboxes.length;
+ var lenChecked = checkedCheckboxes.length;
- // determine which state the selectAll checkbox needs to be and setting it
- if(lenChecked > 0 && lenChecked !== lenAll){
- // indeterminate state
- selectBox.removeClass('fa-square-o fa-check-square-o');
- selectBox.addClass('fa-minus-square-o');
- }
- else if(lenChecked === lenAll){
- // checked state
- selectBox.removeClass('fa-square-o fa-minus-square-o');
- selectBox.addClass('fa-check-square-o');
- }
- else if(lenChecked === 0){
- // unchecked state
- selectBox.removeClass('fa-check-square-o fa-minus-square-o');
- selectBox.addClass('fa-square-o');
- }
- },
+ // determine which state the selectAll checkbox needs to be and setting it
+ if(lenChecked > 0 && lenChecked !== lenAll){
+ // indeterminate state
+ selectBox.removeClass('fa-square-o fa-check-square-o');
+ selectBox.addClass('fa-minus-square-o');
+ }
+ else if(lenChecked === lenAll){
+ // checked state
+ selectBox.removeClass('fa-square-o fa-minus-square-o');
+ selectBox.addClass('fa-check-square-o');
+ }
+ else if(lenChecked === 0){
+ // unchecked state
+ selectBox.removeClass('fa-check-square-o fa-minus-square-o');
+ selectBox.addClass('fa-square-o');
+ }
+ },
-
+
// get model index
_find: function(ftp_file) {
// check if exists already
https://bitbucket.org/galaxy/galaxy-central/commits/a0c0e0b6188c/
Changeset: a0c0e0b6188c
Branch: upload-UI-enhancement
User: JenCabral
Date: 2015-01-14 20:56:46+00:00
Summary: complete selectAll tab fixes2
Affected #: 1 file
diff -r 7be57e7174228c8300fc76d1514f25f7408bf32a -r a0c0e0b6188c5144564175a664c66c2f66915d17 static/scripts/mvc/upload/upload-ftp.js
--- a/static/scripts/mvc/upload/upload-ftp.js
+++ b/static/scripts/mvc/upload/upload-ftp.js
@@ -78,8 +78,8 @@
// change state of the sub-checkboxes
for(i = 0; i < len; i++){
- if(allChecked)
- {
+ if(allChecked)
+ {
// all checkboxes should be checked
if(checkboxes.eq(i).hasClass('fa-square-o'))
{
@@ -97,7 +97,7 @@
}
}
return;
- } );
+ });
} else {
// add info
@@ -134,24 +134,24 @@
$icon.addClass(icon_class);
$it.on('addToUpBox', function(){
-// find model
-var model_index = self._find(ftp_file);
+ // find model
+ var model_index = self._find(ftp_file);
// update icon
$icon.removeClass();
// add model
if (!model_index) {
- // add to uploadbox
- self.app.uploadbox.add([{
- mode : 'ftp',
- name : ftp_file.path,
- size : ftp_file.size,
- path : ftp_file.path
- }]);
+ // add to uploadbox
+ self.app.uploadbox.add([{
+ mode : 'ftp',
+ name : ftp_file.path,
+ size : ftp_file.size,
+ path : ftp_file.path
+ }]);
- // add new icon class
- $icon.addClass(self.options.class_remove);
+ // add new icon class
+ $icon.addClass(self.options.class_remove);
} else {
// remove
self.app.collection.remove(model_index);
https://bitbucket.org/galaxy/galaxy-central/commits/fe8d22502cde/
Changeset: fe8d22502cde
Branch: upload-UI-enhancement
User: JenCabral
Date: 2015-01-14 20:59:58+00:00
Summary: complete selectAll tab fixes2
Affected #: 1 file
diff -r a0c0e0b6188c5144564175a664c66c2f66915d17 -r fe8d22502cde12470b14597669d350b94046c579 static/scripts/mvc/upload/upload-ftp.js
--- a/static/scripts/mvc/upload/upload-ftp.js
+++ b/static/scripts/mvc/upload/upload-ftp.js
@@ -63,18 +63,18 @@
$this = $(this);
// change state of the selectAll checkbox
- if($this.hasClass('fa-square-o')){
- // in unchecked, change to checked
+ if($this.hasClass('fa-check-square-o')){
+ $this.removeClass('fa-check-square-o fa-minus-square-o');
+ $this.addClass('fa-square-o');
+ allChecked=false;
+
+ }
+ else{
+ // in unchecked, change to checked
$this.removeClass('fa-square-o fa-minus-square-o');
$this.addClass('fa-check-square-o');
allChecked=true;
}
- else{
- // if checked, change to unchecked
- $this.removeClass('fa-check-square-o fa-minus-square-o');
- $this.addClass('fa-square-o');
- allChecked=false;
- }
// change state of the sub-checkboxes
for(i = 0; i < len; i++){
https://bitbucket.org/galaxy/galaxy-central/commits/e43cffbd226d/
Changeset: e43cffbd226d
Branch: upload-UI-enhancement
User: JenCabral
Date: 2015-01-14 21:10:38+00:00
Summary: complete selectAll indeter to checked
Affected #: 1 file
diff -r fe8d22502cde12470b14597669d350b94046c579 -r e43cffbd226d85ef0565a6b513f583d3fdf21957 static/scripts/mvc/upload/upload-ftp.js
--- a/static/scripts/mvc/upload/upload-ftp.js
+++ b/static/scripts/mvc/upload/upload-ftp.js
@@ -56,41 +56,36 @@
this._updateSelectAll(selectAll);
// selectAll checkbox has been clicked
- selectAll.on('click', function(){
+ selectAll.on('click', function() {
var checkboxes=$(this).parents().find('tr.upload-ftp-row>td>div');
var len = checkboxes.length;
var allChecked;
$this = $(this);
// change state of the selectAll checkbox
- if($this.hasClass('fa-check-square-o')){
- $this.removeClass('fa-check-square-o fa-minus-square-o');
+ if($this.hasClass('fa-check-square-o')) {
+ // if checked change to unchecked
+ $this.removeClass('fa-check-square-o');
$this.addClass('fa-square-o');
allChecked=false;
-
- }
- else{
- // in unchecked, change to checked
+ } else {
+ // if checked or partially checked, change to checked
$this.removeClass('fa-square-o fa-minus-square-o');
$this.addClass('fa-check-square-o');
allChecked=true;
}
// change state of the sub-checkboxes
- for(i = 0; i < len; i++){
- if(allChecked)
- {
+ for(i = 0; i < len; i++) {
+ if(allChecked) {
// all checkboxes should be checked
- if(checkboxes.eq(i).hasClass('fa-square-o'))
- {
+ if(checkboxes.eq(i).hasClass('fa-square-o')) {
// if they are not checked, check them
checkboxes.eq(i).trigger('addToUpBox');
}
- }
- else{
+ } else {
// no checkboxes should be checked
- if(checkboxes.eq(i).hasClass('fa-check-square-o'))
- {
+ if(checkboxes.eq(i).hasClass('fa-check-square-o')) {
// if they are checked, uncheck them
checkboxes.eq(i).trigger('addToUpBox');
}
@@ -133,9 +128,9 @@
// add icon class
$icon.addClass(icon_class);
- $it.on('addToUpBox', function(){
- // find model
- var model_index = self._find(ftp_file);
+ $it.on('addToUpBox', function() {
+ // find model
+ var model_index = self._find(ftp_file);
// update icon
$icon.removeClass();
@@ -174,7 +169,7 @@
});
},
- _updateSelectAll: function(selectBox){
+ _updateSelectAll: function(selectBox) {
// array of all checkboxes
var checkboxes=selectBox.parents().find('tr.upload-ftp-row>td>div');
// array of only checked checkboxes
@@ -183,17 +178,15 @@
var lenChecked = checkedCheckboxes.length;
// determine which state the selectAll checkbox needs to be and setting it
- if(lenChecked > 0 && lenChecked !== lenAll){
+ if(lenChecked > 0 && lenChecked !== lenAll) {
// indeterminate state
selectBox.removeClass('fa-square-o fa-check-square-o');
selectBox.addClass('fa-minus-square-o');
- }
- else if(lenChecked === lenAll){
+ } else if(lenChecked === lenAll) {
// checked state
selectBox.removeClass('fa-square-o fa-minus-square-o');
selectBox.addClass('fa-check-square-o');
- }
- else if(lenChecked === 0){
+ } else if(lenChecked === 0) {
// unchecked state
selectBox.removeClass('fa-check-square-o fa-minus-square-o');
selectBox.addClass('fa-square-o');
https://bitbucket.org/galaxy/galaxy-central/commits/599ebe1f1ea4/
Changeset: 599ebe1f1ea4
Branch: upload-UI-enhancement
User: JenCabral
Date: 2015-01-15 13:35:52+00:00
Summary: remove non changes and use _updateSelectAll
Affected #: 1 file
diff -r e43cffbd226d85ef0565a6b513f583d3fdf21957 -r 599ebe1f1ea49845e139fc6b0124416e5b95d0ad static/scripts/mvc/upload/upload-ftp.js
--- a/static/scripts/mvc/upload/upload-ftp.js
+++ b/static/scripts/mvc/upload/upload-ftp.js
@@ -35,6 +35,7 @@
// fill table
_fill: function(ftp_files) {
+ var self = this;
if (ftp_files && ftp_files.length > 0) {
// add table
this.$el.find('#upload-ftp-content').html($(this._templateTable()));
@@ -59,21 +60,23 @@
selectAll.on('click', function() {
var checkboxes=$(this).parents().find('tr.upload-ftp-row>td>div');
var len = checkboxes.length;
- var allChecked;
$this = $(this);
+ var allChecked = !($this.hasClass('fa-check-square-o'));
+
+
// change state of the selectAll checkbox
- if($this.hasClass('fa-check-square-o')) {
- // if checked change to unchecked
- $this.removeClass('fa-check-square-o');
- $this.addClass('fa-square-o');
- allChecked=false;
- } else {
- // if checked or partially checked, change to checked
- $this.removeClass('fa-square-o fa-minus-square-o');
- $this.addClass('fa-check-square-o');
- allChecked=true;
- }
+ // if($this.hasClass('fa-check-square-o')) {
+ // // if checked change to unchecked
+ // $this.removeClass('fa-check-square-o');
+ // $this.addClass('fa-square-o');
+ // allChecked=false;
+ // } else {
+ // // if checked or partially checked, change to checked
+ // $this.removeClass('fa-square-o fa-minus-square-o');
+ // $this.addClass('fa-check-square-o');
+ // allChecked=true;
+ // }
// change state of the sub-checkboxes
for(i = 0; i < len; i++) {
@@ -91,6 +94,7 @@
}
}
}
+ self._updateSelectAll(selectAll);
return;
});
@@ -212,7 +216,7 @@
// template row
_templateRow: function(options) {
return '<tr class="upload-ftp-row" style="cursor: pointer;">' +
- '<td><div class="icon " /></td>' +
+ '<td><div class="icon" /></td>' +
'<td style="width: 200px"><p style="width: inherit; word-wrap: break-word;">' + options.path + '</p></td>' +
'<td style="white-space: nowrap;">' + Utils.bytesToString(options.size) + '</td>' +
'<td style="white-space: nowrap;">' + options.ctime + '</td>' +
@@ -253,9 +257,7 @@
return '<div class="upload-ftp">' +
'<div id="upload-ftp-wait" class="upload-ftp-wait fa fa-spinner fa-spin"/>' +
'<div class="upload-ftp-help">This Galaxy server allows you to upload files via FTP. To upload some files, log in to the FTP server at <strong>' + this.app.options.ftp_upload_site + '</strong> using your Galaxy credentials (email address and password).</div>' +
- '<div id="upload-ftp-content">'
-
- '</div>' +
+ '<div id="upload-ftp-content"></div>' +
'<div>';
}
https://bitbucket.org/galaxy/galaxy-central/commits/4ef51dde1d05/
Changeset: 4ef51dde1d05
Branch: upload-UI-enhancement
User: JenCabral
Date: 2015-01-15 13:37:40+00:00
Summary: remove non changes and use _updateSelectAll2
Affected #: 1 file
diff -r 599ebe1f1ea49845e139fc6b0124416e5b95d0ad -r 4ef51dde1d050ca04999343699db84340e9dde22 static/scripts/mvc/upload/upload-ftp.js
--- a/static/scripts/mvc/upload/upload-ftp.js
+++ b/static/scripts/mvc/upload/upload-ftp.js
@@ -102,7 +102,6 @@
// add info
this.$el.find('#upload-ftp-content').html($(this._templateInfo()));
}
-
// hide spinner
this.$el.find('#upload-ftp-wait').hide();
},
@@ -128,17 +127,14 @@
} else {
icon_class = this.options.class_add;
}
-
// add icon class
$icon.addClass(icon_class);
$it.on('addToUpBox', function() {
// find model
var model_index = self._find(ftp_file);
-
// update icon
$icon.removeClass();
-
// add model
if (!model_index) {
// add to uploadbox
@@ -148,13 +144,11 @@
size : ftp_file.size,
path : ftp_file.path
}]);
-
// add new icon class
$icon.addClass(self.options.class_remove);
} else {
// remove
self.app.collection.remove(model_index);
-
// add new icon class
$icon.addClass(self.options.class_add);
}
@@ -216,7 +210,7 @@
// template row
_templateRow: function(options) {
return '<tr class="upload-ftp-row" style="cursor: pointer;">' +
- '<td><div class="icon" /></td>' +
+ '<td><div class="icon"/></td>' +
'<td style="width: 200px"><p style="width: inherit; word-wrap: break-word;">' + options.path + '</p></td>' +
'<td style="white-space: nowrap;">' + Utils.bytesToString(options.size) + '</td>' +
'<td style="white-space: nowrap;">' + options.ctime + '</td>' +
https://bitbucket.org/galaxy/galaxy-central/commits/8a6305f20e33/
Changeset: 8a6305f20e33
Branch: upload-UI-enhancement
User: JenCabral
Date: 2015-01-15 13:41:26+00:00
Summary: remove non changes and use _updateSelectAll3
Affected #: 1 file
diff -r 4ef51dde1d050ca04999343699db84340e9dde22 -r 8a6305f20e3328aa9db245d58d59a7ab448ee28a static/scripts/mvc/upload/upload-ftp.js
--- a/static/scripts/mvc/upload/upload-ftp.js
+++ b/static/scripts/mvc/upload/upload-ftp.js
@@ -102,6 +102,7 @@
// add info
this.$el.find('#upload-ftp-content').html($(this._templateInfo()));
}
+
// hide spinner
this.$el.find('#upload-ftp-wait').hide();
},
@@ -127,14 +128,17 @@
} else {
icon_class = this.options.class_add;
}
+
// add icon class
$icon.addClass(icon_class);
$it.on('addToUpBox', function() {
// find model
var model_index = self._find(ftp_file);
+
// update icon
$icon.removeClass();
+
// add model
if (!model_index) {
// add to uploadbox
@@ -144,11 +148,13 @@
size : ftp_file.size,
path : ftp_file.path
}]);
+
// add new icon class
$icon.addClass(self.options.class_remove);
} else {
// remove
self.app.collection.remove(model_index);
+
// add new icon class
$icon.addClass(self.options.class_add);
}
https://bitbucket.org/galaxy/galaxy-central/commits/53bb9c3c16a0/
Changeset: 53bb9c3c16a0
Branch: upload-UI-enhancement
User: JenCabral
Date: 2015-01-15 13:44:15+00:00
Summary: remove non changes and use _updateSelectAll4
Affected #: 1 file
diff -r 8a6305f20e3328aa9db245d58d59a7ab448ee28a -r 53bb9c3c16a04a64984803e2fef125ba1d9319db static/scripts/mvc/upload/upload-ftp.js
--- a/static/scripts/mvc/upload/upload-ftp.js
+++ b/static/scripts/mvc/upload/upload-ftp.js
@@ -62,21 +62,6 @@
var len = checkboxes.length;
$this = $(this);
var allChecked = !($this.hasClass('fa-check-square-o'));
-
-
-
- // change state of the selectAll checkbox
- // if($this.hasClass('fa-check-square-o')) {
- // // if checked change to unchecked
- // $this.removeClass('fa-check-square-o');
- // $this.addClass('fa-square-o');
- // allChecked=false;
- // } else {
- // // if checked or partially checked, change to checked
- // $this.removeClass('fa-square-o fa-minus-square-o');
- // $this.addClass('fa-check-square-o');
- // allChecked=true;
- // }
// change state of the sub-checkboxes
for(i = 0; i < len; i++) {
@@ -94,8 +79,8 @@
}
}
}
+
self._updateSelectAll(selectAll);
- return;
});
} else {
https://bitbucket.org/galaxy/galaxy-central/commits/af54fe317fba/
Changeset: af54fe317fba
Branch: upload-UI-enhancement
User: JenCabral
Date: 2015-01-15 15:44:03+00:00
Summary: adding packed file
Affected #: 1 file
diff -r 53bb9c3c16a04a64984803e2fef125ba1d9319db -r af54fe317fbab0336a549ece5909a5f17eb42cb7 static/scripts/packed/mvc/upload/upload-ftp.js
--- a/static/scripts/packed/mvc/upload/upload-ftp.js
+++ b/static/scripts/packed/mvc/upload/upload-ftp.js
@@ -1,1 +1,2 @@
-define(["utils/utils"],function(a){return Backbone.View.extend({options:{class_add:"upload-icon-button fa fa-square-o",class_remove:"upload-icon-button fa fa-check-square-o"},initialize:function(c){this.app=c;var b=this;this.setElement(this._template());a.get({url:galaxy_config.root+"api/ftp_files",success:function(d){b._fill(d)},error:function(){b._fill()}})},events:{mousedown:function(b){b.preventDefault()}},_fill:function(c){if(c&&c.length>0){this.$el.find("#upload-ftp-content").html($(this._templateTable()));var b=0;for(key in c){this.add(c[key]);b+=c[key].size}this.$el.find("#upload-ftp-number").html(c.length+" files");this.$el.find("#upload-ftp-disk").html(a.bytesToString(b,true))}else{this.$el.find("#upload-ftp-content").html($(this._templateInfo()))}this.$el.find("#upload-ftp-wait").hide()},add:function(f){var d=this;var e=$(this._templateRow(f));var b=e.find(".icon");$(this.el).find("tbody").append(e);var c="";if(this._find(f)){c=this.options.class_remove}else{c=this.options.class_add}b.addClass(c);e.on("click",function(){var g=d._find(f);b.removeClass();if(!g){d.app.uploadbox.add([{mode:"ftp",name:f.path,size:f.size,path:f.path}]);b.addClass(d.options.class_remove)}else{d.app.collection.remove(g);b.addClass(d.options.class_add)}})},_find:function(f){var c=this.app.collection.where({file_path:f.path});var b=null;for(var d in c){var e=c[d];if(e.get("status")=="init"&&e.get("file_mode")=="ftp"){b=e.get("id")}}return b},_templateRow:function(b){return'<tr class="upload-ftp-row" style="cursor: pointer;"><td><div class="icon"/></td><td style="width: 200px"><p style="width: inherit; word-wrap: break-word;">'+b.path+'</p></td><td style="white-space: nowrap;">'+a.bytesToString(b.size)+'</td><td style="white-space: nowrap;">'+b.ctime+"</td></tr>"},_templateTable:function(){return'<span style="whitespace: nowrap; float: left;">Available files: </span><span style="whitespace: nowrap; float: right;"><span class="upload-icon fa fa-file-text-o"/><span id="upload-ftp-number"/> <span class="upload-icon fa fa-hdd-o"/><span id="upload-ftp-disk"/></span><table class="grid" style="float: left;"><thead><tr><th></th><th>Name</th><th>Size</th><th>Created</th></tr></thead><tbody></tbody></table>'},_templateInfo:function(){return'<div class="upload-ftp-warning warningmessage">Your FTP directory does not contain any files.</div>'},_template:function(){return'<div class="upload-ftp"><div id="upload-ftp-wait" class="upload-ftp-wait fa fa-spinner fa-spin"/><div class="upload-ftp-help">This Galaxy server allows you to upload files via FTP. To upload some files, log in to the FTP server at <strong>'+this.app.options.ftp_upload_site+'</strong> using your Galaxy credentials (email address and password).</div><div id="upload-ftp-content"></div><div>'}})});
\ No newline at end of file
+// dependencies
+define(["utils/utils"],function(e){return Backbone.View.extend({options:{class_add:"upload-icon-button fa fa-square-o",class_remove:"upload-icon-button fa fa-check-square-o"},initialize:function(t){this.app=t;var n=this;this.setElement(this._template()),e.get({url:galaxy_config.root+"api/ftp_files",success:function(e){n._fill(e)},error:function(){n._fill()}})},events:{mousedown:function(e){e.preventDefault()}},_fill:function(t){var n=this;if(t&&t.length>0){this.$el.find("#upload-ftp-content").html($(this._templateTable()));var r=0;for(key in t)this.add(t[key]),r+=t[key].size;this.$el.find("#upload-ftp-number").html(t.length+" files"),this.$el.find("#upload-ftp-disk").html(e.bytesToString(r,!0));var s=this.$el.find("#selectAll");this._updateSelectAll(s),s.on("click",function(){var e=$(this).parents().find("tr.upload-ftp-row>td>div"),t=e.length;$this=$(this);var r=!$this.hasClass("fa-check-square-o");for(i=0;i<t;i++)r?e.eq(i).hasClass("fa-square-o")&&e.eq(i).trigger("addToUpBox"):e.eq(i).hasClass("fa-check-square-o")&&e.eq(i).trigger("addToUpBox");n._updateSelectAll(s)})}else this.$el.find("#upload-ftp-content").html($(this._templateInfo()));this.$el.find("#upload-ftp-wait").hide()},add:function(e){var t=this,n=$(this._templateRow(e)),r=n.find(".icon");$(this.el).find("tbody").append(n);var i="";this._find(e)?i=this.options.class_remove:i=this.options.class_add,r.addClass(i),n.on("addToUpBox",function(){var n=t._find(e);r.removeClass(),n?(t.app.collection.remove(n),r.addClass(t.options.class_add)):(t.app.uploadbox.add([{mode:"ftp",name:e.path,size:e.size,path:e.path}]),r.addClass(t.options.class_remove))}),n.on("click",function(){r.trigger("addToUpBox");var e=r.parents().find("#selectAll");t._updateSelectAll(e)})},_updateSelectAll:function(e){var t=e.parents().find("tr.upload-ftp-row>td>div"),n=e.parents().find("tr.upload-ftp-row>td>div.fa-check-square-o"),r=t.length,i=n.length;i>0&&i!==r?(e.removeClass("fa-square-o fa-check-square-o"),e.addClass("fa-minus-square-o")):i===r?(e.removeClass("fa-square-o fa-minus-square-o"),e.addClass("fa-check-square-o")):i===0&&(e.removeClass("fa-check-square-o fa-minus-square-o"),e.addClass("fa-square-o"))},_find:function(e){var t=this.app.collection.where({file_path:e.path}),n=null;for(var r in t){var i=t[r];i.get("status")=="init"&&i.get("file_mode")=="ftp"&&(n=i.get("id"))}return n},_templateRow:function(t){return'<tr class="upload-ftp-row" style="cursor: pointer;"><td><div class="icon"/></td><td style="width: 200px"><p style="width: inherit; word-wrap: break-word;">'+t.path+"</p></td>"+'<td style="white-space: nowrap;">'+e.bytesToString(t.size)+"</td>"+'<td style="white-space: nowrap;">'+t.ctime+"</td>"+"</tr>"},_templateTable:function(){return'<span style="whitespace: nowrap; float: left;">Available files: </span><span style="whitespace: nowrap; float: right;"><span class="upload-icon fa fa-file-text-o"/><span id="upload-ftp-number"/> <span class="upload-icon fa fa-hdd-o"/><span id="upload-ftp-disk"/></span><table class="grid" style="float: left;"><thead><tr><th><div id="selectAll" class="upload-icon-button fa fa-square-o" ></th><th>Name</th><th>Size</th><th>Created</th></tr></thead><tbody></tbody></table>'},_templateInfo:function(){return'<div class="upload-ftp-warning warningmessage">Your FTP directory does not contain any files.</div>'},_template:function(){return'<div class="upload-ftp"><div id="upload-ftp-wait" class="upload-ftp-wait fa fa-spinner fa-spin"/><div class="upload-ftp-help">This Galaxy server allows you to upload files via FTP. To upload some files, log in to the FTP server at <strong>'+this.app.options.ftp_upload_site+"</strong> using your Galaxy credentials (email address and password).</div>"+'<div id="upload-ftp-content"></div>'+"<div>"}})});
\ No newline at end of file
https://bitbucket.org/galaxy/galaxy-central/commits/c37851171ccd/
Changeset: c37851171ccd
Branch: upload-UI-enhancement
User: JenCabral
Date: 2015-01-16 21:23:05+00:00
Summary: Type drop-down for all files
Affected #: 3 files
diff -r af54fe317fbab0336a549ece5909a5f17eb42cb7 -r c37851171ccd8656657ea77de388b853baf8946e static/scripts/mvc/upload/upload-model.js
--- a/static/scripts/mvc/upload/upload-model.js
+++ b/static/scripts/mvc/upload/upload-model.js
@@ -14,6 +14,7 @@
file_type : null,
file_path : '',
percentage : 0,
+ row : null,
// settings
space_to_tabs : false,
diff -r af54fe317fbab0336a549ece5909a5f17eb42cb7 -r c37851171ccd8656657ea77de388b853baf8946e static/scripts/mvc/upload/upload-row.js
--- a/static/scripts/mvc/upload/upload-row.js
+++ b/static/scripts/mvc/upload/upload-row.js
@@ -83,7 +83,7 @@
},
data: self.app.list_extensions,
container: it.find('#extension'),
- value: self.model.get('extension')
+ value: self.app.select_extension.value()
});
// initialize extension
@@ -139,6 +139,7 @@
this.app.collection.on('reset', function() {
self.remove();
});
+ self.model.set('row', self);
},
// render
diff -r af54fe317fbab0336a549ece5909a5f17eb42cb7 -r c37851171ccd8656657ea77de388b853baf8946e static/scripts/mvc/upload/upload-view.js
--- a/static/scripts/mvc/upload/upload-view.js
+++ b/static/scripts/mvc/upload/upload-view.js
@@ -6,6 +6,7 @@
"mvc/upload/upload-ftp",
"mvc/ui/ui-popover",
"mvc/ui/ui-modal",
+ "mvc/ui/ui-select",
"utils/uploadbox"],
function( Utils,
@@ -14,7 +15,8 @@
UploadItem,
UploadFtp,
Popover,
- Modal
+ Modal,
+ Select
) {
// galaxy upload
@@ -35,6 +37,9 @@
// current history
current_history: null,
+
+ // extension selector
+ select_extension : null,
// current upload size
upload_size: 0,
@@ -218,6 +223,23 @@
title : 'FTP files',
container : button
});
+
+ // select extension
+ this.select_extension = new Select.View({
+ css: 'extension',
+ onchange : function() {
+ var newExten =self.select_extension.value()
+ var len = self.collection.models.length;
+ for(i = 0; i < len; i++)
+ {
+ self.collection.models[i].attributes['row'].select_extension.value(newExten);
+ }
+ },
+ data: self.list_extensions,
+ container: self.$el.find('#extension'),
+ value: self.list_extensions[0]
+ });
+
}
// show modal
@@ -228,6 +250,66 @@
// setup info
this._updateScreen();
+
+ // handle extension info popover
+ self.$el.find('#extension-info').on('click' , function(e) { self._showExtensionInfo(); })
+ .on('mousedown', function(e) { e.preventDefault(); });
+
+ },
+
+ _showExtensionInfo : function() {
+ // initialize
+ var self = this;
+ var $el = $(this.el).find('#extension-info');
+ var extension = self.select_extension.value();
+
+ var title = this.select_extension.text();
+
+ var description = _.findWhere(self.list_extensions, {'id': extension});
+ //console.log(extension, $el);
+
+ // create popup
+ if (!this.extension_popup) {
+ this.extension_popup = new Popover.View({
+ placement: 'bottom',
+ container: $el
+ });
+ }
+ //console.log(description);
+ // show / hide popup
+ if (!this.extension_popup.visible) {
+ this.extension_popup.title(title);
+ this.extension_popup.empty();
+ this.extension_popup.append(this._templateDescription(description));
+ this.extension_popup.show();
+ } else {
+ this.extension_popup.hide();
+ }
+ },
+
+ _showSettings : function() {
+ // check if popover is visible
+ if (!this.settings.visible) {
+ // show popover
+ this.settings.empty();
+ this.settings.append((new UploadSettings(this)).$el);
+ this.settings.show();
+ } else {
+ // hide popover
+ this.settings.hide();
+ }
+ },
+
+ _templateDescription: function(options) {
+ if (options.description) {
+ var tmpl = options.description;
+ if (options.description_url) {
+ tmpl += ' (<a href="' + options.description_url + '" target="_blank">read more</a>)';
+ }
+ return tmpl;
+ } else {
+ return 'There is no description available for this file extension.';
+ }
},
//
@@ -513,6 +595,9 @@
// remove from queue
this.uploadbox.reset();
+
+ // reset value for universal type drop-down
+ this.select_extension.value(this.list_extensions[0]);
// reset button
this.ui_button.set('percentage', 0);
@@ -612,7 +697,10 @@
'<tr>' +
'<th>Name</th>' +
'<th>Size</th>' +
- '<th>Type</th>' +
+ '<th>Type' +
+ '<div id="extension" class="extension" style="float: left;"/>  ' +
+ '<div id="extension-info" class="upload-icon-button fa fa-search"/>' +
+ '</th>' +
'<th>Genome</th>' +
'<th>Settings</th>' +
'<th>Status</th>' +
https://bitbucket.org/galaxy/galaxy-central/commits/b7729c84ae07/
Changeset: b7729c84ae07
Branch: upload-UI-enhancement
User: JenCabral
Date: 2015-01-20 17:36:08+00:00
Summary: UI changes - added global file format selector
Affected #: 3 files
diff -r c37851171ccd8656657ea77de388b853baf8946e -r b7729c84ae071644c45d3c32bdfd4dfeb8b1914e static/scripts/mvc/upload/upload-row.js
--- a/static/scripts/mvc/upload/upload-row.js
+++ b/static/scripts/mvc/upload/upload-row.js
@@ -80,6 +80,13 @@
css: 'extension',
onchange : function() {
self.model.set('extension', self.select_extension.value());
+ // if user has changed individual row type, then change "set all"
+ // type to '---'
+ if(!(self.select_extension.value() == app.select_extension.value()))
+ {
+ var newExte = '---';
+ app.select_extension.value(newExte);
+ }
},
data: self.app.list_extensions,
container: it.find('#extension'),
diff -r c37851171ccd8656657ea77de388b853baf8946e -r b7729c84ae071644c45d3c32bdfd4dfeb8b1914e static/scripts/mvc/upload/upload-view.js
--- a/static/scripts/mvc/upload/upload-view.js
+++ b/static/scripts/mvc/upload/upload-view.js
@@ -129,6 +129,14 @@
self.list_extensions.sort(function(a, b) {
return a.id > b.id ? 1 : a.id < b.id ? -1 : 0;
});
+
+ // add the '---' extension for use when the row types are changed individually
+ self.list_extensions.push({
+ id : "---",
+ text : "---",
+ description : "",
+ description_url : ""
+ });
// add auto field
if (!self.options.datatypes_disable_auto) {
@@ -230,16 +238,22 @@
onchange : function() {
var newExten =self.select_extension.value()
var len = self.collection.models.length;
- for(i = 0; i < len; i++)
- {
- self.collection.models[i].attributes['row'].select_extension.value(newExten);
+ // Only trigger changing the rows if the "set all" isn't set to '---'
+ // Prevents recursively changing the rows after an individual row has been changed
+ if(!(newExten=='---')){
+ for(i = 0; i < len; i++){
+ self.collection.models[i].attributes['row'].select_extension.value(newExten);
+ }
}
},
data: self.list_extensions,
- container: self.$el.find('#extension'),
+ container: self.$el.parents().find('#extension'),
value: self.list_extensions[0]
});
+ // handle extension info popover
+ self.$el.parents().find('#extension-info_out').on('click' , function(e) { self._showExtensionInfo(); })
+ .on('mousedown', function(e) { e.preventDefault(); });
}
// show modal
@@ -251,22 +265,17 @@
// setup info
this._updateScreen();
- // handle extension info popover
- self.$el.find('#extension-info').on('click' , function(e) { self._showExtensionInfo(); })
- .on('mousedown', function(e) { e.preventDefault(); });
-
},
_showExtensionInfo : function() {
// initialize
var self = this;
- var $el = $(this.el).find('#extension-info');
+ var $el = $(this.el).parents().find('#extension-info_out');
var extension = self.select_extension.value();
var title = this.select_extension.text();
var description = _.findWhere(self.list_extensions, {'id': extension});
- //console.log(extension, $el);
// create popup
if (!this.extension_popup) {
@@ -275,7 +284,7 @@
container: $el
});
}
- //console.log(description);
+
// show / hide popup
if (!this.extension_popup.visible) {
this.extension_popup.title(title);
@@ -691,26 +700,36 @@
// load html template
_template: function(id, idInfo) {
- return '<div id="' + id + '" class="upload-box">' +
- '<table id="upload-table" class="table table-striped" style="display: none;">' +
- '<thead>' +
- '<tr>' +
- '<th>Name</th>' +
- '<th>Size</th>' +
- '<th>Type' +
- '<div id="extension" class="extension" style="float: left;"/>  ' +
- '<div id="extension-info" class="upload-icon-button fa fa-search"/>' +
- '</th>' +
- '<th>Genome</th>' +
- '<th>Settings</th>' +
- '<th>Status</th>' +
- '<th></th>' +
- '</tr>' +
- '</thead>' +
- '<tbody></tbody>' +
- '</table>' +
- '</div>' +
- '<h6 id="' + idInfo + '" class="upload-info"></h6>';
+ return '<div class="uploadwrap">' +
+ '<div id="uploadhead" class="uploadhead">' +
+ '<span class="fftext">"Set All" Types:  </span>' +
+ '<span id="extension" class="extension"/>  ' +
+ '<span id="extension-info_out" class="upload-icon-button fa fa-search"/> ' +
+ '</div>' +
+ '<div class="uploadcont">' +
+ '<div class="uploadcont-wrap">' +
+ '<div id="' + id + '" class="upload-box">' +
+ '<table id="upload-table" class="table table-striped" style="display: none;">' +
+ '<thead>' +
+ '<tr>' +
+ '<th>Name</th>' +
+ '<th>Size</th>' +
+ '<th>Type</th>' +
+ '<th>Genome</th>' +
+ '<th>Settings</th>' +
+ '<th>Status</th>' +
+ '<th></th>' +
+ '</tr>' +
+ '</thead>' +
+ '<tbody></tbody>' +
+ '</table>' +
+ '</div>' +
+ '</div>' +
+ '</div>' +
+ '<div class="uploadfoot">' +
+ '<h6 id="' + idInfo + '" class="upload-info"></h6>' +
+ '</div>' +
+ '</div>';
}
});
diff -r c37851171ccd8656657ea77de388b853baf8946e -r b7729c84ae071644c45d3c32bdfd4dfeb8b1914e static/style/blue/base.css
--- a/static/style/blue/base.css
+++ b/static/style/blue/base.css
@@ -119,6 +119,15 @@
.table caption+thead tr:first-child th,.table colgroup+thead tr:first-child th,.table thead:first-child tr:first-child th,.table caption+thead tr:first-child td,.table colgroup+thead tr:first-child td,.table thead:first-child tr:first-child td{border-top:0}
.table tbody+tbody{border-top:2px solid #d6b161}
.table .table{background-color:#fff}
+.uploadwrap {display: table; height: 100%; width: 100%;}
+.uploadcont{display: table-row; height: 100%;}
+.uploadcont-wrap{height: 100%; overflow: auto;}
+.uploadfoot{display: table-row; text-align:center;}
+.uploadhead{display: table-row; float:left; text-align:left; max-height:20px; line-height:18px; margin-bottom: 5px;}
+.uploadhead .fftext{font-weight: bold;}
+.uploadhead .select2-container .select2-choice .select2-arrow b{background-position:0 -3px}
+.uploadhead .extension{width:100px;min-width:100px;font-size:11px}
+.uploadhead .select2-container .select2-choice{max-height:20px;line-height:18px;text-align:center; font-weight: normal;}
.table-condensed thead>tr>th,.table-condensed tbody>tr>th,.table-condensed tfoot>tr>th,.table-condensed thead>tr>td,.table-condensed tbody>tr>td,.table-condensed tfoot>tr>td{padding:5px}
.table-bordered{border:1px solid #d6b161}.table-bordered>thead>tr>th,.table-bordered>tbody>tr>th,.table-bordered>tfoot>tr>th,.table-bordered>thead>tr>td,.table-bordered>tbody>tr>td,.table-bordered>tfoot>tr>td{border:1px solid #d6b161}
.table-bordered>thead>tr>th,.table-bordered>thead>tr>td{border-bottom-width:2px}
@@ -1370,7 +1379,7 @@
.upload-icon{font-size:1.2em;width:1.2em}
.upload-icon-button{font-size:1.2em;width:1.2em;cursor:pointer}
.upload-info{font-weight:normal;text-align:center}
-.upload-box{width:100%;height:95%;text-align:center;overflow:scroll;font-size:12px;line-height:1.33;-moz-border-radius:5px;border-radius:5px;border:1px dashed #bfbfbf;padding:10px;overflow-x:hidden;-ms-overflow-style:none}.upload-box .table{width:100%}
+.upload-box{width:100%;height:100%;text-align:center;overflow:scroll;font-size:12px;line-height:1.33;-moz-border-radius:5px;border-radius:5px;border:1px dashed #bfbfbf;padding:10px;overflow-x:hidden;-ms-overflow-style:none}.upload-box .table{width:100%}
.upload-box .table th{text-align:center;white-space:nowrap}
.upload-box .table td{margin:0px}
.upload-box .upload-item .select2-arrow b{background-position:0 -3px}
https://bitbucket.org/galaxy/galaxy-central/commits/b995da1e4740/
Changeset: b995da1e4740
Branch: upload-UI-enhancement
User: JenCabral
Date: 2015-01-20 17:46:34+00:00
Summary: UI changes - added global file format selector - fixed code spacing
Affected #: 2 files
diff -r b7729c84ae071644c45d3c32bdfd4dfeb8b1914e -r b995da1e4740a55aafdba8fa67987ba52aacdbba static/scripts/mvc/upload/upload-ftp.js
--- a/static/scripts/mvc/upload/upload-ftp.js
+++ b/static/scripts/mvc/upload/upload-ftp.js
@@ -82,7 +82,6 @@
self._updateSelectAll(selectAll);
});
-
} else {
// add info
this.$el.find('#upload-ftp-content').html($(this._templateInfo()));
@@ -117,6 +116,7 @@
// add icon class
$icon.addClass(icon_class);
+ // add files to the uploadbox
$it.on('addToUpBox', function() {
// find model
var model_index = self._find(ftp_file);
@@ -182,8 +182,6 @@
}
},
-
-
// get model index
_find: function(ftp_file) {
// check if exists already
diff -r b7729c84ae071644c45d3c32bdfd4dfeb8b1914e -r b995da1e4740a55aafdba8fa67987ba52aacdbba static/scripts/mvc/upload/upload-view.js
--- a/static/scripts/mvc/upload/upload-view.js
+++ b/static/scripts/mvc/upload/upload-view.js
@@ -124,7 +124,7 @@
description_url : datatypes[key].description_url
});
}
-
+
// sort
self.list_extensions.sort(function(a, b) {
return a.id > b.id ? 1 : a.id < b.id ? -1 : 0;
@@ -264,7 +264,6 @@
// setup info
this._updateScreen();
-
},
_showExtensionInfo : function() {
https://bitbucket.org/galaxy/galaxy-central/commits/4019ee6c42c1/
Changeset: 4019ee6c42c1
Branch: upload-UI-enhancement
User: JenCabral
Date: 2015-01-20 20:20:01+00:00
Summary: UI changes - added global file format selector - fixed error on adding another file after ---
Affected #: 1 file
diff -r b995da1e4740a55aafdba8fa67987ba52aacdbba -r 4019ee6c42c1bc97e1ee493fdfe9c5ff31de96d9 static/scripts/mvc/upload/upload-row.js
--- a/static/scripts/mvc/upload/upload-row.js
+++ b/static/scripts/mvc/upload/upload-row.js
@@ -42,6 +42,9 @@
// link app
this.app = app;
+ // default value for extension of files
+ var default_ext = 'Auto-detect';
+
// link this
var self = this;
@@ -75,6 +78,12 @@
// initialize genome
this.model.set('genome', self.select_genome.value());
+ // ensure files added after an individual row has changed
+ // default to Auto-detect instead of ---
+ if(!(this.app.select_extension.value()=='---')){
+ this.default_ext=this.app.select_extension.value();
+ }
+
// select extension
this.select_extension = new Select.View({
css: 'extension',
@@ -90,7 +99,7 @@
},
data: self.app.list_extensions,
container: it.find('#extension'),
- value: self.app.select_extension.value()
+ value: self.default_ext
});
// initialize extension
https://bitbucket.org/galaxy/galaxy-central/commits/126f96bd87a3/
Changeset: 126f96bd87a3
Branch: upload-UI-enhancement
User: JenCabral
Date: 2015-01-20 20:40:55+00:00
Summary: UI changes - added global file format selector - fixed text spacing
Affected #: 2 files
diff -r 4019ee6c42c1bc97e1ee493fdfe9c5ff31de96d9 -r 126f96bd87a3e55e55ae324b343e66cb3b6ab419 static/scripts/mvc/upload/upload-row.js
--- a/static/scripts/mvc/upload/upload-row.js
+++ b/static/scripts/mvc/upload/upload-row.js
@@ -80,8 +80,8 @@
// ensure files added after an individual row has changed
// default to Auto-detect instead of ---
- if(!(this.app.select_extension.value()=='---')){
- this.default_ext=this.app.select_extension.value();
+ if(!(this.app.select_extension.value() === '---')){
+ this.default_ext = this.app.select_extension.value();
}
// select extension
@@ -91,7 +91,7 @@
self.model.set('extension', self.select_extension.value());
// if user has changed individual row type, then change "set all"
// type to '---'
- if(!(self.select_extension.value() == app.select_extension.value()))
+ if(!(self.select_extension.value() === app.select_extension.value()))
{
var newExte = '---';
app.select_extension.value(newExte);
diff -r 4019ee6c42c1bc97e1ee493fdfe9c5ff31de96d9 -r 126f96bd87a3e55e55ae324b343e66cb3b6ab419 static/scripts/mvc/upload/upload-view.js
--- a/static/scripts/mvc/upload/upload-view.js
+++ b/static/scripts/mvc/upload/upload-view.js
@@ -236,11 +236,11 @@
this.select_extension = new Select.View({
css: 'extension',
onchange : function() {
- var newExten =self.select_extension.value()
+ var newExten = self.select_extension.value()
var len = self.collection.models.length;
// Only trigger changing the rows if the "set all" isn't set to '---'
// Prevents recursively changing the rows after an individual row has been changed
- if(!(newExten=='---')){
+ if(!(newExten === '---')){
for(i = 0; i < len; i++){
self.collection.models[i].attributes['row'].select_extension.value(newExten);
}
https://bitbucket.org/galaxy/galaxy-central/commits/fdb6215d8c09/
Changeset: fdb6215d8c09
Branch: upload-UI-enhancement
User: JenCabral
Date: 2015-01-23 14:19:25+00:00
Summary: adding packed files and changing fcn name for addToUpBox to updateUpBox
Affected #: 5 files
diff -r 126f96bd87a3e55e55ae324b343e66cb3b6ab419 -r fdb6215d8c090154aa6f9d0719d281cdb8526848 static/scripts/mvc/upload/upload-ftp.js
--- a/static/scripts/mvc/upload/upload-ftp.js
+++ b/static/scripts/mvc/upload/upload-ftp.js
@@ -69,13 +69,13 @@
// all checkboxes should be checked
if(checkboxes.eq(i).hasClass('fa-square-o')) {
// if they are not checked, check them
- checkboxes.eq(i).trigger('addToUpBox');
+ checkboxes.eq(i).trigger('updateUpBox');
}
} else {
// no checkboxes should be checked
if(checkboxes.eq(i).hasClass('fa-check-square-o')) {
// if they are checked, uncheck them
- checkboxes.eq(i).trigger('addToUpBox');
+ checkboxes.eq(i).trigger('updateUpBox');
}
}
}
@@ -117,7 +117,7 @@
$icon.addClass(icon_class);
// add files to the uploadbox
- $it.on('addToUpBox', function() {
+ $it.on('updateUpBox', function() {
// find model
var model_index = self._find(ftp_file);
@@ -148,7 +148,7 @@
// click to add ftp files
$it.on('click', function() {
//trigger my new event
- $icon.trigger('addToUpBox');
+ $icon.trigger('updateUpBox');
// click to add ftp files
// modify selectAll box based on number of checkboxes checked
diff -r 126f96bd87a3e55e55ae324b343e66cb3b6ab419 -r fdb6215d8c090154aa6f9d0719d281cdb8526848 static/scripts/packed/mvc/upload/upload-ftp.js
--- a/static/scripts/packed/mvc/upload/upload-ftp.js
+++ b/static/scripts/packed/mvc/upload/upload-ftp.js
@@ -1,2 +1,1 @@
-// dependencies
-define(["utils/utils"],function(e){return Backbone.View.extend({options:{class_add:"upload-icon-button fa fa-square-o",class_remove:"upload-icon-button fa fa-check-square-o"},initialize:function(t){this.app=t;var n=this;this.setElement(this._template()),e.get({url:galaxy_config.root+"api/ftp_files",success:function(e){n._fill(e)},error:function(){n._fill()}})},events:{mousedown:function(e){e.preventDefault()}},_fill:function(t){var n=this;if(t&&t.length>0){this.$el.find("#upload-ftp-content").html($(this._templateTable()));var r=0;for(key in t)this.add(t[key]),r+=t[key].size;this.$el.find("#upload-ftp-number").html(t.length+" files"),this.$el.find("#upload-ftp-disk").html(e.bytesToString(r,!0));var s=this.$el.find("#selectAll");this._updateSelectAll(s),s.on("click",function(){var e=$(this).parents().find("tr.upload-ftp-row>td>div"),t=e.length;$this=$(this);var r=!$this.hasClass("fa-check-square-o");for(i=0;i<t;i++)r?e.eq(i).hasClass("fa-square-o")&&e.eq(i).trigger("addToUpBox"):e.eq(i).hasClass("fa-check-square-o")&&e.eq(i).trigger("addToUpBox");n._updateSelectAll(s)})}else this.$el.find("#upload-ftp-content").html($(this._templateInfo()));this.$el.find("#upload-ftp-wait").hide()},add:function(e){var t=this,n=$(this._templateRow(e)),r=n.find(".icon");$(this.el).find("tbody").append(n);var i="";this._find(e)?i=this.options.class_remove:i=this.options.class_add,r.addClass(i),n.on("addToUpBox",function(){var n=t._find(e);r.removeClass(),n?(t.app.collection.remove(n),r.addClass(t.options.class_add)):(t.app.uploadbox.add([{mode:"ftp",name:e.path,size:e.size,path:e.path}]),r.addClass(t.options.class_remove))}),n.on("click",function(){r.trigger("addToUpBox");var e=r.parents().find("#selectAll");t._updateSelectAll(e)})},_updateSelectAll:function(e){var t=e.parents().find("tr.upload-ftp-row>td>div"),n=e.parents().find("tr.upload-ftp-row>td>div.fa-check-square-o"),r=t.length,i=n.length;i>0&&i!==r?(e.removeClass("fa-square-o fa-check-square-o"),e.addClass("fa-minus-square-o")):i===r?(e.removeClass("fa-square-o fa-minus-square-o"),e.addClass("fa-check-square-o")):i===0&&(e.removeClass("fa-check-square-o fa-minus-square-o"),e.addClass("fa-square-o"))},_find:function(e){var t=this.app.collection.where({file_path:e.path}),n=null;for(var r in t){var i=t[r];i.get("status")=="init"&&i.get("file_mode")=="ftp"&&(n=i.get("id"))}return n},_templateRow:function(t){return'<tr class="upload-ftp-row" style="cursor: pointer;"><td><div class="icon"/></td><td style="width: 200px"><p style="width: inherit; word-wrap: break-word;">'+t.path+"</p></td>"+'<td style="white-space: nowrap;">'+e.bytesToString(t.size)+"</td>"+'<td style="white-space: nowrap;">'+t.ctime+"</td>"+"</tr>"},_templateTable:function(){return'<span style="whitespace: nowrap; float: left;">Available files: </span><span style="whitespace: nowrap; float: right;"><span class="upload-icon fa fa-file-text-o"/><span id="upload-ftp-number"/> <span class="upload-icon fa fa-hdd-o"/><span id="upload-ftp-disk"/></span><table class="grid" style="float: left;"><thead><tr><th><div id="selectAll" class="upload-icon-button fa fa-square-o" ></th><th>Name</th><th>Size</th><th>Created</th></tr></thead><tbody></tbody></table>'},_templateInfo:function(){return'<div class="upload-ftp-warning warningmessage">Your FTP directory does not contain any files.</div>'},_template:function(){return'<div class="upload-ftp"><div id="upload-ftp-wait" class="upload-ftp-wait fa fa-spinner fa-spin"/><div class="upload-ftp-help">This Galaxy server allows you to upload files via FTP. To upload some files, log in to the FTP server at <strong>'+this.app.options.ftp_upload_site+"</strong> using your Galaxy credentials (email address and password).</div>"+'<div id="upload-ftp-content"></div>'+"<div>"}})});
\ No newline at end of file
+define(["utils/utils"],function(e){return Backbone.View.extend({options:{class_add:"upload-icon-button fa fa-square-o",class_remove:"upload-icon-button fa fa-check-square-o"},initialize:function(t){this.app=t;var n=this;this.setElement(this._template()),e.get({url:galaxy_config.root+"api/ftp_files",success:function(e){n._fill(e)},error:function(){n._fill()}})},events:{mousedown:function(e){e.preventDefault()}},_fill:function(t){var n=this;if(t&&t.length>0){this.$el.find("#upload-ftp-content").html($(this._templateTable()));var r=0;for(key in t)this.add(t[key]),r+=t[key].size;this.$el.find("#upload-ftp-number").html(t.length+" files"),this.$el.find("#upload-ftp-disk").html(e.bytesToString(r,!0));var s=this.$el.find("#selectAll");this._updateSelectAll(s),s.on("click",function(){var e=$(this).parents().find("tr.upload-ftp-row>td>div"),t=e.length;$this=$(this);var r=!$this.hasClass("fa-check-square-o");for(i=0;i<t;i++)r?e.eq(i).hasClass("fa-square-o")&&e.eq(i).trigger("updateUpBox"):e.eq(i).hasClass("fa-check-square-o")&&e.eq(i).trigger("updateUpBox");n._updateSelectAll(s)})}else this.$el.find("#upload-ftp-content").html($(this._templateInfo()));this.$el.find("#upload-ftp-wait").hide()},add:function(e){var t=this,n=$(this._templateRow(e)),r=n.find(".icon");$(this.el).find("tbody").append(n);var i="";this._find(e)?i=this.options.class_remove:i=this.options.class_add,r.addClass(i),n.on("updateUpBox",function(){var n=t._find(e);r.removeClass(),n?(t.app.collection.remove(n),r.addClass(t.options.class_add)):(t.app.uploadbox.add([{mode:"ftp",name:e.path,size:e.size,path:e.path}]),r.addClass(t.options.class_remove))}),n.on("click",function(){r.trigger("updateUpBox");var e=r.parents().find("#selectAll");t._updateSelectAll(e)})},_updateSelectAll:function(e){var t=e.parents().find("tr.upload-ftp-row>td>div"),n=e.parents().find("tr.upload-ftp-row>td>div.fa-check-square-o"),r=t.length,i=n.length;i>0&&i!==r?(e.removeClass("fa-square-o fa-check-square-o"),e.addClass("fa-minus-square-o")):i===r?(e.removeClass("fa-square-o fa-minus-square-o"),e.addClass("fa-check-square-o")):i===0&&(e.removeClass("fa-check-square-o fa-minus-square-o"),e.addClass("fa-square-o"))},_find:function(e){var t=this.app.collection.where({file_path:e.path}),n=null;for(var r in t){var i=t[r];i.get("status")=="init"&&i.get("file_mode")=="ftp"&&(n=i.get("id"))}return n},_templateRow:function(t){return'<tr class="upload-ftp-row" style="cursor: pointer;"><td><div class="icon"/></td><td style="width: 200px"><p style="width: inherit; word-wrap: break-word;">'+t.path+"</p></td>"+'<td style="white-space: nowrap;">'+e.bytesToString(t.size)+"</td>"+'<td style="white-space: nowrap;">'+t.ctime+"</td>"+"</tr>"},_templateTable:function(){return'<span style="whitespace: nowrap; float: left;">Available files: </span><span style="whitespace: nowrap; float: right;"><span class="upload-icon fa fa-file-text-o"/><span id="upload-ftp-number"/> <span class="upload-icon fa fa-hdd-o"/><span id="upload-ftp-disk"/></span><table class="grid" style="float: left;"><thead><tr><th><div id="selectAll" class="upload-icon-button fa fa-square-o" ></th><th>Name</th><th>Size</th><th>Created</th></tr></thead><tbody></tbody></table>'},_templateInfo:function(){return'<div class="upload-ftp-warning warningmessage">Your FTP directory does not contain any files.</div>'},_template:function(){return'<div class="upload-ftp"><div id="upload-ftp-wait" class="upload-ftp-wait fa fa-spinner fa-spin"/><div class="upload-ftp-help">This Galaxy server allows you to upload files via FTP. To upload some files, log in to the FTP server at <strong>'+this.app.options.ftp_upload_site+"</strong> using your Galaxy credentials (email address and password).</div>"+'<div id="upload-ftp-content"></div>'+"<div>"}})});
\ No newline at end of file
diff -r 126f96bd87a3e55e55ae324b343e66cb3b6ab419 -r fdb6215d8c090154aa6f9d0719d281cdb8526848 static/scripts/packed/mvc/upload/upload-model.js
--- a/static/scripts/packed/mvc/upload/upload-model.js
+++ b/static/scripts/packed/mvc/upload/upload-model.js
@@ -1,1 +1,1 @@
-define([],function(){var b=Backbone.Model.extend({defaults:{extension:"auto",genome:"?",url_paste:"",status:"init",info:null,file_mode:"local",file_size:0,file_type:null,file_path:"",percentage:0,space_to_tabs:false,to_posix_lines:true}});var a=Backbone.Collection.extend({model:b});return{Model:b,Collection:a}});
\ No newline at end of file
+define([],function(){var e=Backbone.Model.extend({defaults:{extension:"auto",genome:"?",url_paste:"",status:"init",info:null,file_mode:"local",file_size:0,file_type:null,file_path:"",percentage:0,row:null,space_to_tabs:!1,to_posix_lines:!0}}),t=Backbone.Collection.extend({model:e});return{Model:e,Collection:t}});
\ No newline at end of file
diff -r 126f96bd87a3e55e55ae324b343e66cb3b6ab419 -r fdb6215d8c090154aa6f9d0719d281cdb8526848 static/scripts/packed/mvc/upload/upload-row.js
--- a/static/scripts/packed/mvc/upload/upload-row.js
+++ b/static/scripts/packed/mvc/upload/upload-row.js
@@ -1,1 +1,1 @@
-define(["utils/utils","mvc/upload/upload-model","mvc/upload/upload-settings","mvc/ui/ui-popover","mvc/ui/ui-select"],function(d,b,a,c,e){return Backbone.View.extend({options:{padding:8},status_classes:{init:"upload-icon-button fa fa-trash-o",queued:"upload-icon fa fa-spinner fa-spin",running:"upload-icon fa fa-spinner fa-spin",success:"upload-icon-button fa fa-check",error:"upload-icon-button fa fa-exclamation-triangle"},settings:null,select_genome:null,select_extension:null,initialize:function(i,g){this.app=i;var f=this;this.model=new b.Model(g);this.setElement(this._template(g));var h=this.$el;this.settings=new c.View({title:"Upload configuration",container:h.find("#settings"),placement:"bottom"});this.select_genome=new e.View({css:"genome",onchange:function(){f.model.set("genome",f.select_genome.value())},data:f.app.list_genomes,container:h.find("#genome"),value:f.model.get("genome")});this.model.set("genome",f.select_genome.value());this.select_extension=new e.View({css:"extension",onchange:function(){f.model.set("extension",f.select_extension.value())},data:f.app.list_extensions,container:h.find("#extension"),value:f.model.get("extension")});this.model.set("extension",f.select_extension.value());h.find("#symbol").on("click",function(){f._removeRow()});h.find("#extension-info").on("click",function(j){f._showExtensionInfo()}).on("mousedown",function(j){j.preventDefault()});h.find("#settings").on("click",function(j){f._showSettings()}).on("mousedown",function(j){j.preventDefault()});h.find("#text-content").on("keyup",function(j){f.model.set("url_paste",$(j.target).val());f.model.set("file_size",$(j.target).val().length)});h.find("#space_to_tabs").on("change",function(j){f.model.set("space_to_tabs",$(j.target).prop("checked"))});this.model.on("change:percentage",function(){f._refreshPercentage()});this.model.on("change:status",function(){f._refreshStatus()});this.model.on("change:info",function(){f._refreshInfo()});this.model.on("change:genome",function(){f._refreshGenome()});this.model.on("change:file_size",function(){f._refreshFileSize()});this.model.on("remove",function(){f.remove()});this.app.collection.on("reset",function(){f.remove()})},render:function(){var m=this.model.get("file_name");var g=this.model.get("file_size");var j=this.model.get("file_mode");var i=this.$el;i.find("#title").html(m);i.find("#size").html(d.bytesToString(g));i.find("#mode").removeClass().addClass("mode");if(j=="new"){var l=i.find("#text");var k=this.options.padding;var h=i.width()-2*k;var f=i.height()-k;l.css("width",h+"px");l.css("top",f+"px");i.height(f+l.height()+2*k);l.show();i.find("#mode").addClass("fa fa-pencil")}if(j=="local"){i.find("#mode").addClass("fa fa-laptop")}if(j=="ftp"){i.find("#mode").addClass("fa fa-code-fork")}},remove:function(){this.select_genome.remove();this.select_extension.remove();Backbone.View.prototype.remove.apply(this)},_refreshGenome:function(){var f=this.model.get("genome");this.select_genome.value(f)},_refreshInfo:function(){var f=this.model.get("info");if(f){this.$el.find("#info").html("<strong>Failed: </strong>"+f).show()}else{this.$el.find("#info").hide()}},_refreshPercentage:function(){var f=parseInt(this.model.get("percentage"));this.$el.find(".progress-bar").css({width:f+"%"});if(f!=100){this.$el.find("#percentage").html(f+"%")}else{this.$el.find("#percentage").html("Adding to history...")}},_refreshStatus:function(){var g=this.$el;var f=this.model.get("status");var i=this.status_classes[f];var h=this.$el.find("#symbol");h.removeClass();h.addClass(i);if(f=="init"){this.select_genome.enable();this.select_extension.enable();g.find("#text-content").attr("disabled",false);g.find("#space_to_tabs").attr("disabled",false)}else{this.select_genome.disable();this.select_extension.disable();g.find("#text-content").attr("disabled",true);g.find("#space_to_tabs").attr("disabled",true)}if(f=="success"){g.addClass("success");g.find("#percentage").html("100%")}if(f=="error"){g.addClass("danger");g.find(".progress").remove()}},_refreshFileSize:function(){var f=this.model.get("file_size");this.$el.find("#size").html(d.bytesToString(f))},_removeRow:function(){var f=this.model.get("status");if(f=="init"||f=="success"||f=="error"){this.app.collection.remove(this.model)}},_showExtensionInfo:function(){var f=$(this.el).find("#extension-info");var i=this.model.get("extension");var h=this.select_extension.text();var g=_.findWhere(this.app.list_extensions,{id:i});if(!this.extension_popup){this.extension_popup=new c.View({placement:"bottom",container:f})}if(!this.extension_popup.visible){this.extension_popup.title(h);this.extension_popup.empty();this.extension_popup.append(this._templateDescription(g));this.extension_popup.show()}else{this.extension_popup.hide()}},_showSettings:function(){if(!this.settings.visible){this.settings.empty();this.settings.append((new a(this)).$el);this.settings.show()}else{this.settings.hide()}},_templateDescription:function(g){if(g.description){var f=g.description;if(g.description_url){f+=' (<a href="'+g.description_url+'" target="_blank">read more</a>)'}return f}else{return"There is no description available for this file extension."}},_template:function(f){return'<tr id="upload-item-'+f.id+'" class="upload-item"><td><div style="position: relative;"><div id="mode"></div><div id="title" class="title"></div><div id="text" class="text"><div class="text-info">You can tell Galaxy to download data from web by entering URL in this box (one per line). You can also directly paste the contents of a file.</div><textarea id="text-content" class="text-content form-control"></textarea></div></div></td><td><div id="size" class="size"></div></td><td><div id="extension" class="extension" style="float: left;"/>  <div id="extension-info" class="upload-icon-button fa fa-search"/></td><td><div id="genome" class="genome" /></td><td><div id="settings" class="upload-icon-button fa fa-gear"></div><td><div id="info" class="info"><div class="progress"><div class="progress-bar progress-bar-success"></div><div id="percentage" class="percentage">0%</div></div></div></td><td><div id="symbol" class="'+this.status_classes.init+'"></div></td></tr>'}})});
\ No newline at end of file
+define(["utils/utils","mvc/upload/upload-model","mvc/upload/upload-settings","mvc/ui/ui-popover","mvc/ui/ui-select"],function(e,t,n,r,i){return Backbone.View.extend({options:{padding:8},status_classes:{init:"upload-icon-button fa fa-trash-o",queued:"upload-icon fa fa-spinner fa-spin",running:"upload-icon fa fa-spinner fa-spin",success:"upload-icon-button fa fa-check",error:"upload-icon-button fa fa-exclamation-triangle"},settings:null,select_genome:null,select_extension:null,initialize:function(e,n){this.app=e;var s="Auto-detect",o=this;this.model=new t.Model(n),this.setElement(this._template(n));var u=this.$el;this.settings=new r.View({title:"Upload configuration",container:u.find("#settings"),placement:"bottom"}),this.select_genome=new i.View({css:"genome",onchange:function(){o.model.set("genome",o.select_genome.value())},data:o.app.list_genomes,container:u.find("#genome"),value:o.model.get("genome")}),this.model.set("genome",o.select_genome.value()),this.app.select_extension.value()!=="---"&&(this.default_ext=this.app.select_extension.value()),this.select_extension=new i.View({css:"extension",onchange:function(){o.model.set("extension",o.select_extension.value());if(o.select_extension.value()!==e.select_extension.value()){var t="---";e.select_extension.value(t)}},data:o.app.list_extensions,container:u.find("#extension"),value:o.default_ext}),this.model.set("extension",o.select_extension.value()),u.find("#symbol").on("click",function(){o._removeRow()}),u.find("#extension-info").on("click",function(e){o._showExtensionInfo()}).on("mousedown",function(e){e.preventDefault()}),u.find("#settings").on("click",function(e){o._showSettings()}).on("mousedown",function(e){e.preventDefault()}),u.find("#text-content").on("keyup",function(e){o.model.set("url_paste",$(e.target).val()),o.model.set("file_size",$(e.target).val().length)}),u.find("#space_to_tabs").on("change",function(e){o.model.set("space_to_tabs",$(e.target).prop("checked"))}),this.model.on("change:percentage",function(){o._refreshPercentage()}),this.model.on("change:status",function(){o._refreshStatus()}),this.model.on("change:info",function(){o._refreshInfo()}),this.model.on("change:genome",function(){o._refreshGenome()}),this.model.on("change:file_size",function(){o._refreshFileSize()}),this.model.on("remove",function(){o.remove()}),this.app.collection.on("reset",function(){o.remove()}),o.model.set("row",o)},render:function(){var t=this.model.get("file_name"),n=this.model.get("file_size"),r=this.model.get("file_mode"),i=this.$el;i.find("#title").html(t),i.find("#size").html(e.bytesToString(n)),i.find("#mode").removeClass().addClass("mode");if(r=="new"){var s=i.find("#text"),o=this.options.padding,u=i.width()-2*o,a=i.height()-o;s.css("width",u+"px"),s.css("top",a+"px"),i.height(a+s.height()+2*o),s.show(),i.find("#mode").addClass("fa fa-pencil")}r=="local"&&i.find("#mode").addClass("fa fa-laptop"),r=="ftp"&&i.find("#mode").addClass("fa fa-code-fork")},remove:function(){this.select_genome.remove(),this.select_extension.remove(),Backbone.View.prototype.remove.apply(this)},_refreshGenome:function(){var e=this.model.get("genome");this.select_genome.value(e)},_refreshInfo:function(){var e=this.model.get("info");e?this.$el.find("#info").html("<strong>Failed: </strong>"+e).show():this.$el.find("#info").hide()},_refreshPercentage:function(){var e=parseInt(this.model.get("percentage"));this.$el.find(".progress-bar").css({width:e+"%"}),e!=100?this.$el.find("#percentage").html(e+"%"):this.$el.find("#percentage").html("Adding to history...")},_refreshStatus:function(){var e=this.$el,t=this.model.get("status"),n=this.status_classes[t],r=this.$el.find("#symbol");r.removeClass(),r.addClass(n),t=="init"?(this.select_genome.enable(),this.select_extension.enable(),e.find("#text-content").attr("disabled",!1),e.find("#space_to_tabs").attr("disabled",!1)):(this.select_genome.disable(),this.select_extension.disable(),e.find("#text-content").attr("disabled",!0),e.find("#space_to_tabs").attr("disabled",!0)),t=="success"&&(e.addClass("success"),e.find("#percentage").html("100%")),t=="error"&&(e.addClass("danger"),e.find(".progress").remove())},_refreshFileSize:function(){var t=this.model.get("file_size");this.$el.find("#size").html(e.bytesToString(t))},_removeRow:function(){var e=this.model.get("status");(e=="init"||e=="success"||e=="error")&&this.app.collection.remove(this.model)},_showExtensionInfo:function(){var e=$(this.el).find("#extension-info"),t=this.model.get("extension"),n=this.select_extension.text(),i=_.findWhere(this.app.list_extensions,{id:t});this.extension_popup||(this.extension_popup=new r.View({placement:"bottom",container:e})),this.extension_popup.visible?this.extension_popup.hide():(this.extension_popup.title(n),this.extension_popup.empty(),this.extension_popup.append(this._templateDescription(i)),this.extension_popup.show())},_showSettings:function(){this.settings.visible?this.settings.hide():(this.settings.empty(),this.settings.append((new n(this)).$el),this.settings.show())},_templateDescription:function(e){if(e.description){var t=e.description;return e.description_url&&(t+=' (<a href="'+e.description_url+'" target="_blank">read more</a>)'),t}return"There is no description available for this file extension."},_template:function(e){return'<tr id="upload-item-'+e.id+'" class="upload-item">'+"<td>"+'<div style="position: relative;">'+'<div id="mode"></div>'+'<div id="title" class="title"></div>'+'<div id="text" class="text">'+'<div class="text-info">You can tell Galaxy to download data from web by entering URL in this box (one per line). You can also directly paste the contents of a file.</div>'+'<textarea id="text-content" class="text-content form-control"></textarea>'+"</div>"+"</div>"+"</td>"+"<td>"+'<div id="size" class="size"></div>'+"</td>"+"<td>"+'<div id="extension" class="extension" style="float: left;"/>  '+'<div id="extension-info" class="upload-icon-button fa fa-search"/>'+"</td>"+"<td>"+'<div id="genome" class="genome" />'+"</td>"+'<td><div id="settings" class="upload-icon-button fa fa-gear"></div>'+"<td>"+'<div id="info" class="info">'+'<div class="progress">'+'<div class="progress-bar progress-bar-success"></div>'+'<div id="percentage" class="percentage">0%</div>'+"</div>"+"</div>"+"</td>"+"<td>"+'<div id="symbol" class="'+this.status_classes.init+'"></div>'+"</td>"+"</tr>"}})});
\ No newline at end of file
diff -r 126f96bd87a3e55e55ae324b343e66cb3b6ab419 -r fdb6215d8c090154aa6f9d0719d281cdb8526848 static/scripts/packed/mvc/upload/upload-view.js
--- a/static/scripts/packed/mvc/upload/upload-view.js
+++ b/static/scripts/packed/mvc/upload/upload-view.js
@@ -1,1 +1,1 @@
-define(["utils/utils","mvc/upload/upload-button","mvc/upload/upload-model","mvc/upload/upload-row","mvc/upload/upload-ftp","mvc/ui/ui-popover","mvc/ui/ui-modal","utils/uploadbox"],function(f,e,c,b,g,d,a){return Backbone.View.extend({options:{nginx_upload_path:""},modal:null,ui_button:null,uploadbox:null,current_history:null,upload_size:0,list_extensions:[],list_genomes:[],auto:{id:"auto",text:"Auto-detect",description:"This system will try to detect the file type automatically. If your file is not detected properly as one of the known formats, it most likely means that it has some format problems (e.g., different number of columns on different rows). You can still coerce the system to set your data to the format you think it should be. You can also upload compressed files, which will automatically be decompressed."},collection:new c.Collection(),ftp:null,counter:{announce:0,success:0,error:0,running:0,reset:function(){this.announce=this.success=this.error=this.running=0}},initialize:function(i){var h=this;if(i){this.options=_.defaults(i,this.options)}this.ui_button=new e.Model({icon:"fa-upload",tooltip:"Download from URL or upload files from disk",label:"Load Data",onclick:function(j){if(j){j.preventDefault();h.show()}},onunload:function(){if(h.counter.running>0){return"Several uploads are still processing."}}});$(".with-upload-button").append((new e.View(this.ui_button)).$el);var h=this;f.get({url:galaxy_config.root+"api/datatypes?extension_only=False",success:function(j){for(key in j){h.list_extensions.push({id:j[key].extension,text:j[key].extension,description:j[key].description,description_url:j[key].description_url})}h.list_extensions.sort(function(l,k){return l.id>k.id?1:l.id<k.id?-1:0});if(!h.options.datatypes_disable_auto){h.list_extensions.unshift(h.auto)}}});f.get({url:galaxy_config.root+"api/genomes",success:function(j){for(key in j){h.list_genomes.push({id:j[key][1],text:j[key][0]})}h.list_genomes.sort(function(l,k){return l.id>k.id?1:l.id<k.id?-1:0})}});this.collection.on("remove",function(j){h._eventRemove(j)});this.collection.on("change:genome",function(k){var j=k.get("genome");h.collection.each(function(l){if(l.get("status")=="init"&&l.get("genome")=="?"){l.set("genome",j)}})})},show:function(){var h=this;if(!Galaxy.currHistoryPanel||!Galaxy.currHistoryPanel.model){window.setTimeout(function(){h.show()},500);return}if(!this.modal){var h=this;this.modal=new a.View({title:"Download data directly from web or upload files from your disk",body:this._template("upload-box","upload-info"),buttons:{"Choose local file":function(){h.uploadbox.select()},"Choose FTP file":function(){h._eventFtp()},"Paste/Fetch data":function(){h._eventCreate()},Start:function(){h._eventStart()},Pause:function(){h._eventStop()},Reset:function(){h._eventReset()},Close:function(){h.modal.hide()},},height:"400",width:"900",closing_events:true});this.setElement("#upload-box");var h=this;this.uploadbox=this.$el.uploadbox({announce:function(j,k,l){h._eventAnnounce(j,k,l)},initialize:function(j,k,l){return h._eventInitialize(j,k,l)},progress:function(j,k,l){h._eventProgress(j,k,l)},success:function(j,k,l){h._eventSuccess(j,k,l)},error:function(j,k,l){h._eventError(j,k,l)},complete:function(){h._eventComplete()}});var i=this.modal.getButton("Choose FTP file");this.ftp=new d.View({title:"FTP files",container:i})}this.modal.show();this._updateUser();this._updateScreen()},_eventRemove:function(i){var h=i.get("status");if(h=="success"){this.counter.success--}else{if(h=="error"){this.counter.error--}else{this.counter.announce--}}this._updateScreen();this.uploadbox.remove(i.id)},_eventAnnounce:function(h,i,k){this.counter.announce++;this._updateScreen();var j=new b(this,{id:h,file_name:i.name,file_size:i.size,file_mode:i.mode,file_path:i.path});this.collection.add(j.model);$(this.el).find("tbody:first").append(j.$el);j.render()},_eventInitialize:function(m,j,s){var k=this.collection.get(m);k.set("status","running");var o=k.get("file_name");var n=k.get("file_path");var h=k.get("file_mode");var p=k.get("extension");var r=k.get("genome");var q=k.get("url_paste");var l=k.get("space_to_tabs");var i=k.get("to_posix_lines");if(!q&&!(j.size>0)){return null}this.uploadbox.configure({url:this.options.nginx_upload_path});if(h=="local"){this.uploadbox.configure({paramname:"files_0|file_data"})}else{this.uploadbox.configure({paramname:null})}tool_input={};if(h=="new"){tool_input["files_0|url_paste"]=q}if(h=="ftp"){tool_input["files_0|ftp_files"]=n}tool_input.dbkey=r;tool_input.file_type=p;tool_input["files_0|type"]="upload_dataset";tool_input.space_to_tabs=l;tool_input.to_posix_lines=i;data={};data.history_id=this.current_history;data.tool_id="upload1";data.inputs=JSON.stringify(tool_input);return data},_eventProgress:function(i,j,h){var k=this.collection.get(i);k.set("percentage",h);this.ui_button.set("percentage",this._upload_percentage(h,j.size))},_eventSuccess:function(i,j,l){var k=this.collection.get(i);k.set("percentage",100);k.set("status","success");var h=k.get("file_size");this.ui_button.set("percentage",this._upload_percentage(100,h));this.upload_completed+=h*100;this.counter.announce--;this.counter.success++;this._updateScreen();Galaxy.currHistoryPanel.refreshContents()},_eventError:function(h,i,k){var j=this.collection.get(h);j.set("percentage",100);j.set("status","error");j.set("info",k);this.ui_button.set("percentage",this._upload_percentage(100,i.size));this.ui_button.set("status","danger");this.upload_completed+=i.size*100;this.counter.announce--;this.counter.error++;this._updateScreen()},_eventComplete:function(){this.collection.each(function(h){if(h.get("status")=="queued"){h.set("status","init")}});this.counter.running=0;this._updateScreen()},_eventFtp:function(){if(!this.ftp.visible){this.ftp.empty();this.ftp.append((new g(this)).$el);this.ftp.show()}else{this.ftp.hide()}},_eventCreate:function(){this.uploadbox.add([{name:"New File",size:0,mode:"new"}])},_eventStart:function(){if(this.counter.announce==0||this.counter.running>0){return}var h=this;this.upload_size=0;this.upload_completed=0;this.collection.each(function(i){if(i.get("status")=="init"){i.set("status","queued");h.upload_size+=i.get("file_size")}});this.ui_button.set("percentage",0);this.ui_button.set("status","success");this.counter.running=this.counter.announce;this._updateScreen();this.uploadbox.start()},_eventStop:function(){if(this.counter.running==0){return}this.ui_button.set("status","info");this.uploadbox.stop();$("#upload-info").html("Queue will pause after completing the current file...")},_eventReset:function(){if(this.counter.running==0){this.collection.reset();this.counter.reset();this._updateScreen();this.uploadbox.reset();this.ui_button.set("percentage",0)}},_updateUser:function(){this.current_user=Galaxy.currUser.get("id");this.current_history=null;if(this.current_user){this.current_history=Galaxy.currHistoryPanel.model.get("id")}},_updateScreen:function(){if(this.counter.announce==0){if(this.uploadbox.compatible()){message="You can Drag & Drop files into this box."}else{message="Unfortunately, your browser does not support multiple file uploads or drag&drop.<br>Some supported browsers are: Firefox 4+, Chrome 7+, IE 10+, Opera 12+ or Safari 6+."}}else{if(this.counter.running==0){message="You added "+this.counter.announce+" file(s) to the queue. Add more files or click 'Start' to proceed."}else{message="Please wait..."+this.counter.announce+" out of "+this.counter.running+" remaining."}}$("#upload-info").html(message);if(this.counter.running==0&&this.counter.announce+this.counter.success+this.counter.error>0){this.modal.enableButton("Reset")}else{this.modal.disableButton("Reset")}if(this.counter.running==0&&this.counter.announce>0){this.modal.enableButton("Start")}else{this.modal.disableButton("Start")}if(this.counter.running>0){this.modal.enableButton("Pause")}else{this.modal.disableButton("Pause")}if(this.counter.running==0){this.modal.enableButton("Choose local file");this.modal.enableButton("Choose FTP file");this.modal.enableButton("Paste/Fetch data")}else{this.modal.disableButton("Choose local file");this.modal.disableButton("Choose FTP file");this.modal.disableButton("Paste/Fetch data")}if(this.current_user&&this.options.ftp_upload_dir&&this.options.ftp_upload_site){this.modal.showButton("Choose FTP file")}else{this.modal.hideButton("Choose FTP file")}if(this.counter.announce+this.counter.success+this.counter.error>0){$(this.el).find("#upload-table").show()}else{$(this.el).find("#upload-table").hide()}},_upload_percentage:function(h,i){return(this.upload_completed+(h*i))/this.upload_size},_template:function(i,h){return'<div id="'+i+'" class="upload-box"><table id="upload-table" class="table table-striped" style="display: none;"><thead><tr><th>Name</th><th>Size</th><th>Type</th><th>Genome</th><th>Settings</th><th>Status</th><th></th></tr></thead><tbody></tbody></table></div><h6 id="'+h+'" class="upload-info"></h6>'}})});
\ No newline at end of file
+define(["utils/utils","mvc/upload/upload-button","mvc/upload/upload-model","mvc/upload/upload-row","mvc/upload/upload-ftp","mvc/ui/ui-popover","mvc/ui/ui-modal","mvc/ui/ui-select","utils/uploadbox"],function(e,t,n,r,s,o,u,a){return Backbone.View.extend({options:{nginx_upload_path:""},modal:null,ui_button:null,uploadbox:null,current_history:null,select_extension:null,upload_size:0,list_extensions:[],list_genomes:[],auto:{id:"auto",text:"Auto-detect",description:"This system will try to detect the file type automatically. If your file is not detected properly as one of the known formats, it most likely means that it has some format problems (e.g., different number of columns on different rows). You can still coerce the system to set your data to the format you think it should be. You can also upload compressed files, which will automatically be decompressed."},collection:new n.Collection,ftp:null,counter:{announce:0,success:0,error:0,running:0,reset:function(){this.announce=this.success=this.error=this.running=0}},initialize:function(n){var r=this;n&&(this.options=_.defaults(n,this.options)),this.ui_button=new t.Model({icon:"fa-upload",tooltip:"Download from URL or upload files from disk",label:"Load Data",onclick:function(e){e&&(e.preventDefault(),r.show())},onunload:function(){if(r.counter.running>0)return"Several uploads are still processing."}}),$(".with-upload-button").append((new t.View(this.ui_button)).$el);var r=this;e.get({url:galaxy_config.root+"api/datatypes?extension_only=False",success:function(e){for(key in e)r.list_extensions.push({id:e[key].extension,text:e[key].extension,description:e[key].description,description_url:e[key].description_url});r.list_extensions.sort(function(e,t){return e.id>t.id?1:e.id<t.id?-1:0}),r.list_extensions.push({id:"---",text:"---",description:"",description_url:""}),r.options.datatypes_disable_auto||r.list_extensions.unshift(r.auto)}}),e.get({url:galaxy_config.root+"api/genomes",success:function(e){for(key in e)r.list_genomes.push({id:e[key][1],text:e[key][0]});r.list_genomes.sort(function(e,t){return e.id>t.id?1:e.id<t.id?-1:0})}}),this.collection.on("remove",function(e){r._eventRemove(e)}),this.collection.on("change:genome",function(e){var t=e.get("genome");r.collection.each(function(e){e.get("status")=="init"&&e.get("genome")=="?"&&e.set("genome",t)})})},show:function(){var e=this;if(!Galaxy.currHistoryPanel||!Galaxy.currHistoryPanel.model){window.setTimeout(function(){e.show()},500);return}if(!this.modal){var e=this;this.modal=new u.View({title:"Download data directly from web or upload files from your disk",body:this._template("upload-box","upload-info"),buttons:{"Choose local file":function(){e.uploadbox.select()},"Choose FTP file":function(){e._eventFtp()},"Paste/Fetch data":function(){e._eventCreate()},Start:function(){e._eventStart()},Pause:function(){e._eventStop()},Reset:function(){e._eventReset()},Close:function(){e.modal.hide()}},height:"400",width:"900",closing_events:!0}),this.setElement("#upload-box");var e=this;this.uploadbox=this.$el.uploadbox({announce:function(t,n,r){e._eventAnnounce(t,n,r)},initialize:function(t,n,r){return e._eventInitialize(t,n,r)},progress:function(t,n,r){e._eventProgress(t,n,r)},success:function(t,n,r){e._eventSuccess(t,n,r)},error:function(t,n,r){e._eventError(t,n,r)},complete:function(){e._eventComplete()}});var t=this.modal.getButton("Choose FTP file");this.ftp=new o.View({title:"FTP files",container:t}),this.select_extension=new a.View({css:"extension",onchange:function(){var t=e.select_extension.value(),n=e.collection.models.length;if(t!=="---")for(i=0;i<n;i++)e.collection.models[i].attributes.row.select_extension.value(t)},data:e.list_extensions,container:e.$el.parents().find("#extension"),value:e.list_extensions[0]}),e.$el.parents().find("#extension-info_out").on("click",function(t){e._showExtensionInfo()}).on("mousedown",function(e){e.preventDefault()})}this.modal.show(),this._updateUser(),this._updateScreen()},_showExtensionInfo:function(){var e=this,t=$(this.el).parents().find("#extension-info_out"),n=e.select_extension.value(),r=this.select_extension.text(),i=_.findWhere(e.list_extensions,{id:n});this.extension_popup||(this.extension_popup=new o.View({placement:"bottom",container:t})),this.extension_popup.visible?this.extension_popup.hide():(this.extension_popup.title(r),this.extension_popup.empty(),this.extension_popup.append(this._templateDescription(i)),this.extension_popup.show())},_showSettings:function(){this.settings.visible?this.settings.hide():(this.settings.empty(),this.settings.append((new UploadSettings(this)).$el),this.settings.show())},_templateDescription:function(e){if(e.description){var t=e.description;return e.description_url&&(t+=' (<a href="'+e.description_url+'" target="_blank">read more</a>)'),t}return"There is no description available for this file extension."},_eventRemove:function(e){var t=e.get("status");t=="success"?this.counter.success--:t=="error"?this.counter.error--:this.counter.announce--,this._updateScreen(),this.uploadbox.remove(e.id)},_eventAnnounce:function(e,t,n){this.counter.announce++,this._updateScreen();var i=new r(this,{id:e,file_name:t.name,file_size:t.size,file_mode:t.mode,file_path:t.path});this.collection.add(i.model),$(this.el).find("tbody:first").append(i.$el),i.render()},_eventInitialize:function(e,t,n){var r=this.collection.get(e);r.set("status","running");var i=r.get("file_name"),s=r.get("file_path"),o=r.get("file_mode"),u=r.get("extension"),a=r.get("genome"),f=r.get("url_paste"),l=r.get("space_to_tabs"),c=r.get("to_posix_lines");return!!f||t.size>0?(this.uploadbox.configure({url:this.options.nginx_upload_path}),o=="local"?this.uploadbox.configure({paramname:"files_0|file_data"}):this.uploadbox.configure({paramname:null}),tool_input={},o=="new"&&(tool_input["files_0|url_paste"]=f),o=="ftp"&&(tool_input["files_0|ftp_files"]=s),tool_input.dbkey=a,tool_input.file_type=u,tool_input["files_0|type"]="upload_dataset",tool_input.space_to_tabs=l,tool_input.to_posix_lines=c,data={},data.history_id=this.current_history,data.tool_id="upload1",data.inputs=JSON.stringify(tool_input),data):null},_eventProgress:function(e,t,n){var r=this.collection.get(e);r.set("percentage",n),this.ui_button.set("percentage",this._upload_percentage(n,t.size))},_eventSuccess:function(e,t,n){var r=this.collection.get(e);r.set("percentage",100),r.set("status","success");var i=r.get("file_size");this.ui_button.set("percentage",this._upload_percentage(100,i)),this.upload_completed+=i*100,this.counter.announce--,this.counter.success++,this._updateScreen(),Galaxy.currHistoryPanel.refreshContents()},_eventError:function(e,t,n){var r=this.collection.get(e);r.set("percentage",100),r.set("status","error"),r.set("info",n),this.ui_button.set("percentage",this._upload_percentage(100,t.size)),this.ui_button.set("status","danger"),this.upload_completed+=t.size*100,this.counter.announce--,this.counter.error++,this._updateScreen()},_eventComplete:function(){this.collection.each(function(e){e.get("status")=="queued"&&e.set("status","init")}),this.counter.running=0,this._updateScreen()},_eventFtp:function(){this.ftp.visible?this.ftp.hide():(this.ftp.empty(),this.ftp.append((new s(this)).$el),this.ftp.show())},_eventCreate:function(){this.uploadbox.add([{name:"New File",size:0,mode:"new"}])},_eventStart:function(){if(this.counter.announce==0||this.counter.running>0)return;var e=this;this.upload_size=0,this.upload_completed=0,this.collection.each(function(t){t.get("status")=="init"&&(t.set("status","queued"),e.upload_size+=t.get("file_size"))}),this.ui_button.set("percentage",0),this.ui_button.set("status","success"),this.counter.running=this.counter.announce,this._updateScreen(),this.uploadbox.start()},_eventStop:function(){if(this.counter.running==0)return;this.ui_button.set("status","info"),this.uploadbox.stop(),$("#upload-info").html("Queue will pause after completing the current file...")},_eventReset:function(){this.counter.running==0&&(this.collection.reset(),this.counter.reset(),this._updateScreen(),this.uploadbox.reset(),this.select_extension.value(this.list_extensions[0]),this.ui_button.set("percentage",0))},_updateUser:function(){this.current_user=Galaxy.currUser.get("id"),this.current_history=null,this.current_user&&(this.current_history=Galaxy.currHistoryPanel.model.get("id"))},_updateScreen:function(){this.counter.announce==0?this.uploadbox.compatible()?message="You can Drag & Drop files into this box.":message="Unfortunately, your browser does not support multiple file uploads or drag&drop.<br>Some supported browsers are: Firefox 4+, Chrome 7+, IE 10+, Opera 12+ or Safari 6+.":this.counter.running==0?message="You added "+this.counter.announce+" file(s) to the queue. Add more files or click 'Start' to proceed.":message="Please wait..."+this.counter.announce+" out of "+this.counter.running+" remaining.",$("#upload-info").html(message),this.counter.running==0&&this.counter.announce+this.counter.success+this.counter.error>0?this.modal.enableButton("Reset"):this.modal.disableButton("Reset"),this.counter.running==0&&this.counter.announce>0?this.modal.enableButton("Start"):this.modal.disableButton("Start"),this.counter.running>0?this.modal.enableButton("Pause"):this.modal.disableButton("Pause"),this.counter.running==0?(this.modal.enableButton("Choose local file"),this.modal.enableButton("Choose FTP file"),this.modal.enableButton("Paste/Fetch data")):(this.modal.disableButton("Choose local file"),this.modal.disableButton("Choose FTP file"),this.modal.disableButton("Paste/Fetch data")),this.current_user&&this.options.ftp_upload_dir&&this.options.ftp_upload_site?this.modal.showButton("Choose FTP file"):this.modal.hideButton("Choose FTP file"),this.counter.announce+this.counter.success+this.counter.error>0?$(this.el).find("#upload-table").show():$(this.el).find("#upload-table").hide()},_upload_percentage:function(e,t){return(this.upload_completed+e*t)/this.upload_size},_template:function(e,t){return'<div class="uploadwrap"><div id="uploadhead" class="uploadhead"><span class="fftext">"Set All" Types:  </span><span id="extension" class="extension"/>  <span id="extension-info_out" class="upload-icon-button fa fa-search"/></div><div class="uploadcont"><div class="uploadcont-wrap"><div id="'+e+'" class="upload-box">'+'<table id="upload-table" class="table table-striped" style="display: none;">'+"<thead>"+"<tr>"+"<th>Name</th>"+"<th>Size</th>"+"<th>Type</th>"+"<th>Genome</th>"+"<th>Settings</th>"+"<th>Status</th>"+"<th></th>"+"</tr>"+"</thead>"+"<tbody></tbody>"+"</table>"+"</div>"+"</div>"+"</div>"+'<div class="uploadfoot">'+'<h6 id="'+t+'" class="upload-info"></h6>'+"</div>"+"</div>"}})});
\ No newline at end of file
https://bitbucket.org/galaxy/galaxy-central/commits/32c0e2ce30dc/
Changeset: 32c0e2ce30dc
Branch: upload-UI-enhancement
User: JenCabral
Date: 2015-01-23 15:13:13+00:00
Summary: fixing compatibility issues in IE and Firefox
Affected #: 3 files
diff -r fdb6215d8c090154aa6f9d0719d281cdb8526848 -r 32c0e2ce30dce27b22646031e408c400d735863e static/scripts/mvc/upload/upload-view.js
--- a/static/scripts/mvc/upload/upload-view.js
+++ b/static/scripts/mvc/upload/upload-view.js
@@ -699,36 +699,30 @@
// load html template
_template: function(id, idInfo) {
- return '<div class="uploadwrap">' +
- '<div id="uploadhead" class="uploadhead">' +
- '<span class="fftext">"Set All" Types:  </span>' +
- '<span id="extension" class="extension"/>  ' +
- '<span id="extension-info_out" class="upload-icon-button fa fa-search"/> ' +
- '</div>' +
- '<div class="uploadcont">' +
- '<div class="uploadcont-wrap">' +
- '<div id="' + id + '" class="upload-box">' +
- '<table id="upload-table" class="table table-striped" style="display: none;">' +
- '<thead>' +
- '<tr>' +
- '<th>Name</th>' +
- '<th>Size</th>' +
- '<th>Type</th>' +
- '<th>Genome</th>' +
- '<th>Settings</th>' +
- '<th>Status</th>' +
- '<th></th>' +
- '</tr>' +
- '</thead>' +
- '<tbody></tbody>' +
- '</table>' +
- '</div>' +
- '</div>' +
- '</div>' +
- '<div class="uploadfoot">' +
- '<h6 id="' + idInfo + '" class="upload-info"></h6>' +
- '</div>' +
- '</div>';
+ return '<div id="uploadhead" class="uploadhead">' +
+ '<span class="fftext">"Set All" Types:  </span>' +
+ '<span id="extension" class="extension"/>  ' +
+ '<span id="extension-info_out" class="upload-icon-button fa fa-search"/> ' +
+ '</div>' +
+ '<div id="' + id + '" class="upload-box">' +
+ '<table id="upload-table" class="table table-striped" style="display: none;">' +
+ '<thead>' +
+ '<tr>' +
+ '<th>Name</th>' +
+ '<th>Size</th>' +
+ '<th>Type</th>' +
+ '<th>Genome</th>' +
+ '<th>Settings</th>' +
+ '<th>Status</th>' +
+ '<th></th>' +
+ '</tr>' +
+ '</thead>' +
+ '<tbody></tbody>' +
+ '</table>' +
+ '</div>' +
+ '<div class="uploadfoot">' +
+ '<h6 id="' + idInfo + '" class="upload-info"></h6>' +
+ '</div>' ;
}
});
diff -r fdb6215d8c090154aa6f9d0719d281cdb8526848 -r 32c0e2ce30dce27b22646031e408c400d735863e static/scripts/packed/mvc/upload/upload-view.js
--- a/static/scripts/packed/mvc/upload/upload-view.js
+++ b/static/scripts/packed/mvc/upload/upload-view.js
@@ -1,1 +1,1 @@
-define(["utils/utils","mvc/upload/upload-button","mvc/upload/upload-model","mvc/upload/upload-row","mvc/upload/upload-ftp","mvc/ui/ui-popover","mvc/ui/ui-modal","mvc/ui/ui-select","utils/uploadbox"],function(e,t,n,r,s,o,u,a){return Backbone.View.extend({options:{nginx_upload_path:""},modal:null,ui_button:null,uploadbox:null,current_history:null,select_extension:null,upload_size:0,list_extensions:[],list_genomes:[],auto:{id:"auto",text:"Auto-detect",description:"This system will try to detect the file type automatically. If your file is not detected properly as one of the known formats, it most likely means that it has some format problems (e.g., different number of columns on different rows). You can still coerce the system to set your data to the format you think it should be. You can also upload compressed files, which will automatically be decompressed."},collection:new n.Collection,ftp:null,counter:{announce:0,success:0,error:0,running:0,reset:function(){this.announce=this.success=this.error=this.running=0}},initialize:function(n){var r=this;n&&(this.options=_.defaults(n,this.options)),this.ui_button=new t.Model({icon:"fa-upload",tooltip:"Download from URL or upload files from disk",label:"Load Data",onclick:function(e){e&&(e.preventDefault(),r.show())},onunload:function(){if(r.counter.running>0)return"Several uploads are still processing."}}),$(".with-upload-button").append((new t.View(this.ui_button)).$el);var r=this;e.get({url:galaxy_config.root+"api/datatypes?extension_only=False",success:function(e){for(key in e)r.list_extensions.push({id:e[key].extension,text:e[key].extension,description:e[key].description,description_url:e[key].description_url});r.list_extensions.sort(function(e,t){return e.id>t.id?1:e.id<t.id?-1:0}),r.list_extensions.push({id:"---",text:"---",description:"",description_url:""}),r.options.datatypes_disable_auto||r.list_extensions.unshift(r.auto)}}),e.get({url:galaxy_config.root+"api/genomes",success:function(e){for(key in e)r.list_genomes.push({id:e[key][1],text:e[key][0]});r.list_genomes.sort(function(e,t){return e.id>t.id?1:e.id<t.id?-1:0})}}),this.collection.on("remove",function(e){r._eventRemove(e)}),this.collection.on("change:genome",function(e){var t=e.get("genome");r.collection.each(function(e){e.get("status")=="init"&&e.get("genome")=="?"&&e.set("genome",t)})})},show:function(){var e=this;if(!Galaxy.currHistoryPanel||!Galaxy.currHistoryPanel.model){window.setTimeout(function(){e.show()},500);return}if(!this.modal){var e=this;this.modal=new u.View({title:"Download data directly from web or upload files from your disk",body:this._template("upload-box","upload-info"),buttons:{"Choose local file":function(){e.uploadbox.select()},"Choose FTP file":function(){e._eventFtp()},"Paste/Fetch data":function(){e._eventCreate()},Start:function(){e._eventStart()},Pause:function(){e._eventStop()},Reset:function(){e._eventReset()},Close:function(){e.modal.hide()}},height:"400",width:"900",closing_events:!0}),this.setElement("#upload-box");var e=this;this.uploadbox=this.$el.uploadbox({announce:function(t,n,r){e._eventAnnounce(t,n,r)},initialize:function(t,n,r){return e._eventInitialize(t,n,r)},progress:function(t,n,r){e._eventProgress(t,n,r)},success:function(t,n,r){e._eventSuccess(t,n,r)},error:function(t,n,r){e._eventError(t,n,r)},complete:function(){e._eventComplete()}});var t=this.modal.getButton("Choose FTP file");this.ftp=new o.View({title:"FTP files",container:t}),this.select_extension=new a.View({css:"extension",onchange:function(){var t=e.select_extension.value(),n=e.collection.models.length;if(t!=="---")for(i=0;i<n;i++)e.collection.models[i].attributes.row.select_extension.value(t)},data:e.list_extensions,container:e.$el.parents().find("#extension"),value:e.list_extensions[0]}),e.$el.parents().find("#extension-info_out").on("click",function(t){e._showExtensionInfo()}).on("mousedown",function(e){e.preventDefault()})}this.modal.show(),this._updateUser(),this._updateScreen()},_showExtensionInfo:function(){var e=this,t=$(this.el).parents().find("#extension-info_out"),n=e.select_extension.value(),r=this.select_extension.text(),i=_.findWhere(e.list_extensions,{id:n});this.extension_popup||(this.extension_popup=new o.View({placement:"bottom",container:t})),this.extension_popup.visible?this.extension_popup.hide():(this.extension_popup.title(r),this.extension_popup.empty(),this.extension_popup.append(this._templateDescription(i)),this.extension_popup.show())},_showSettings:function(){this.settings.visible?this.settings.hide():(this.settings.empty(),this.settings.append((new UploadSettings(this)).$el),this.settings.show())},_templateDescription:function(e){if(e.description){var t=e.description;return e.description_url&&(t+=' (<a href="'+e.description_url+'" target="_blank">read more</a>)'),t}return"There is no description available for this file extension."},_eventRemove:function(e){var t=e.get("status");t=="success"?this.counter.success--:t=="error"?this.counter.error--:this.counter.announce--,this._updateScreen(),this.uploadbox.remove(e.id)},_eventAnnounce:function(e,t,n){this.counter.announce++,this._updateScreen();var i=new r(this,{id:e,file_name:t.name,file_size:t.size,file_mode:t.mode,file_path:t.path});this.collection.add(i.model),$(this.el).find("tbody:first").append(i.$el),i.render()},_eventInitialize:function(e,t,n){var r=this.collection.get(e);r.set("status","running");var i=r.get("file_name"),s=r.get("file_path"),o=r.get("file_mode"),u=r.get("extension"),a=r.get("genome"),f=r.get("url_paste"),l=r.get("space_to_tabs"),c=r.get("to_posix_lines");return!!f||t.size>0?(this.uploadbox.configure({url:this.options.nginx_upload_path}),o=="local"?this.uploadbox.configure({paramname:"files_0|file_data"}):this.uploadbox.configure({paramname:null}),tool_input={},o=="new"&&(tool_input["files_0|url_paste"]=f),o=="ftp"&&(tool_input["files_0|ftp_files"]=s),tool_input.dbkey=a,tool_input.file_type=u,tool_input["files_0|type"]="upload_dataset",tool_input.space_to_tabs=l,tool_input.to_posix_lines=c,data={},data.history_id=this.current_history,data.tool_id="upload1",data.inputs=JSON.stringify(tool_input),data):null},_eventProgress:function(e,t,n){var r=this.collection.get(e);r.set("percentage",n),this.ui_button.set("percentage",this._upload_percentage(n,t.size))},_eventSuccess:function(e,t,n){var r=this.collection.get(e);r.set("percentage",100),r.set("status","success");var i=r.get("file_size");this.ui_button.set("percentage",this._upload_percentage(100,i)),this.upload_completed+=i*100,this.counter.announce--,this.counter.success++,this._updateScreen(),Galaxy.currHistoryPanel.refreshContents()},_eventError:function(e,t,n){var r=this.collection.get(e);r.set("percentage",100),r.set("status","error"),r.set("info",n),this.ui_button.set("percentage",this._upload_percentage(100,t.size)),this.ui_button.set("status","danger"),this.upload_completed+=t.size*100,this.counter.announce--,this.counter.error++,this._updateScreen()},_eventComplete:function(){this.collection.each(function(e){e.get("status")=="queued"&&e.set("status","init")}),this.counter.running=0,this._updateScreen()},_eventFtp:function(){this.ftp.visible?this.ftp.hide():(this.ftp.empty(),this.ftp.append((new s(this)).$el),this.ftp.show())},_eventCreate:function(){this.uploadbox.add([{name:"New File",size:0,mode:"new"}])},_eventStart:function(){if(this.counter.announce==0||this.counter.running>0)return;var e=this;this.upload_size=0,this.upload_completed=0,this.collection.each(function(t){t.get("status")=="init"&&(t.set("status","queued"),e.upload_size+=t.get("file_size"))}),this.ui_button.set("percentage",0),this.ui_button.set("status","success"),this.counter.running=this.counter.announce,this._updateScreen(),this.uploadbox.start()},_eventStop:function(){if(this.counter.running==0)return;this.ui_button.set("status","info"),this.uploadbox.stop(),$("#upload-info").html("Queue will pause after completing the current file...")},_eventReset:function(){this.counter.running==0&&(this.collection.reset(),this.counter.reset(),this._updateScreen(),this.uploadbox.reset(),this.select_extension.value(this.list_extensions[0]),this.ui_button.set("percentage",0))},_updateUser:function(){this.current_user=Galaxy.currUser.get("id"),this.current_history=null,this.current_user&&(this.current_history=Galaxy.currHistoryPanel.model.get("id"))},_updateScreen:function(){this.counter.announce==0?this.uploadbox.compatible()?message="You can Drag & Drop files into this box.":message="Unfortunately, your browser does not support multiple file uploads or drag&drop.<br>Some supported browsers are: Firefox 4+, Chrome 7+, IE 10+, Opera 12+ or Safari 6+.":this.counter.running==0?message="You added "+this.counter.announce+" file(s) to the queue. Add more files or click 'Start' to proceed.":message="Please wait..."+this.counter.announce+" out of "+this.counter.running+" remaining.",$("#upload-info").html(message),this.counter.running==0&&this.counter.announce+this.counter.success+this.counter.error>0?this.modal.enableButton("Reset"):this.modal.disableButton("Reset"),this.counter.running==0&&this.counter.announce>0?this.modal.enableButton("Start"):this.modal.disableButton("Start"),this.counter.running>0?this.modal.enableButton("Pause"):this.modal.disableButton("Pause"),this.counter.running==0?(this.modal.enableButton("Choose local file"),this.modal.enableButton("Choose FTP file"),this.modal.enableButton("Paste/Fetch data")):(this.modal.disableButton("Choose local file"),this.modal.disableButton("Choose FTP file"),this.modal.disableButton("Paste/Fetch data")),this.current_user&&this.options.ftp_upload_dir&&this.options.ftp_upload_site?this.modal.showButton("Choose FTP file"):this.modal.hideButton("Choose FTP file"),this.counter.announce+this.counter.success+this.counter.error>0?$(this.el).find("#upload-table").show():$(this.el).find("#upload-table").hide()},_upload_percentage:function(e,t){return(this.upload_completed+e*t)/this.upload_size},_template:function(e,t){return'<div class="uploadwrap"><div id="uploadhead" class="uploadhead"><span class="fftext">"Set All" Types:  </span><span id="extension" class="extension"/>  <span id="extension-info_out" class="upload-icon-button fa fa-search"/></div><div class="uploadcont"><div class="uploadcont-wrap"><div id="'+e+'" class="upload-box">'+'<table id="upload-table" class="table table-striped" style="display: none;">'+"<thead>"+"<tr>"+"<th>Name</th>"+"<th>Size</th>"+"<th>Type</th>"+"<th>Genome</th>"+"<th>Settings</th>"+"<th>Status</th>"+"<th></th>"+"</tr>"+"</thead>"+"<tbody></tbody>"+"</table>"+"</div>"+"</div>"+"</div>"+'<div class="uploadfoot">'+'<h6 id="'+t+'" class="upload-info"></h6>'+"</div>"+"</div>"}})});
\ No newline at end of file
+define(["utils/utils","mvc/upload/upload-button","mvc/upload/upload-model","mvc/upload/upload-row","mvc/upload/upload-ftp","mvc/ui/ui-popover","mvc/ui/ui-modal","mvc/ui/ui-select","utils/uploadbox"],function(e,t,n,r,s,o,u,a){return Backbone.View.extend({options:{nginx_upload_path:""},modal:null,ui_button:null,uploadbox:null,current_history:null,select_extension:null,upload_size:0,list_extensions:[],list_genomes:[],auto:{id:"auto",text:"Auto-detect",description:"This system will try to detect the file type automatically. If your file is not detected properly as one of the known formats, it most likely means that it has some format problems (e.g., different number of columns on different rows). You can still coerce the system to set your data to the format you think it should be. You can also upload compressed files, which will automatically be decompressed."},collection:new n.Collection,ftp:null,counter:{announce:0,success:0,error:0,running:0,reset:function(){this.announce=this.success=this.error=this.running=0}},initialize:function(n){var r=this;n&&(this.options=_.defaults(n,this.options)),this.ui_button=new t.Model({icon:"fa-upload",tooltip:"Download from URL or upload files from disk",label:"Load Data",onclick:function(e){e&&(e.preventDefault(),r.show())},onunload:function(){if(r.counter.running>0)return"Several uploads are still processing."}}),$(".with-upload-button").append((new t.View(this.ui_button)).$el);var r=this;e.get({url:galaxy_config.root+"api/datatypes?extension_only=False",success:function(e){for(key in e)r.list_extensions.push({id:e[key].extension,text:e[key].extension,description:e[key].description,description_url:e[key].description_url});r.list_extensions.sort(function(e,t){return e.id>t.id?1:e.id<t.id?-1:0}),r.list_extensions.push({id:"---",text:"---",description:"",description_url:""}),r.options.datatypes_disable_auto||r.list_extensions.unshift(r.auto)}}),e.get({url:galaxy_config.root+"api/genomes",success:function(e){for(key in e)r.list_genomes.push({id:e[key][1],text:e[key][0]});r.list_genomes.sort(function(e,t){return e.id>t.id?1:e.id<t.id?-1:0})}}),this.collection.on("remove",function(e){r._eventRemove(e)}),this.collection.on("change:genome",function(e){var t=e.get("genome");r.collection.each(function(e){e.get("status")=="init"&&e.get("genome")=="?"&&e.set("genome",t)})})},show:function(){var e=this;if(!Galaxy.currHistoryPanel||!Galaxy.currHistoryPanel.model){window.setTimeout(function(){e.show()},500);return}if(!this.modal){var e=this;this.modal=new u.View({title:"Download data directly from web or upload files from your disk",body:this._template("upload-box","upload-info"),buttons:{"Choose local file":function(){e.uploadbox.select()},"Choose FTP file":function(){e._eventFtp()},"Paste/Fetch data":function(){e._eventCreate()},Start:function(){e._eventStart()},Pause:function(){e._eventStop()},Reset:function(){e._eventReset()},Close:function(){e.modal.hide()}},height:"400",width:"900",closing_events:!0}),this.setElement("#upload-box");var e=this;this.uploadbox=this.$el.uploadbox({announce:function(t,n,r){e._eventAnnounce(t,n,r)},initialize:function(t,n,r){return e._eventInitialize(t,n,r)},progress:function(t,n,r){e._eventProgress(t,n,r)},success:function(t,n,r){e._eventSuccess(t,n,r)},error:function(t,n,r){e._eventError(t,n,r)},complete:function(){e._eventComplete()}});var t=this.modal.getButton("Choose FTP file");this.ftp=new o.View({title:"FTP files",container:t}),this.select_extension=new a.View({css:"extension",onchange:function(){var t=e.select_extension.value(),n=e.collection.models.length;if(t!=="---")for(i=0;i<n;i++)e.collection.models[i].attributes.row.select_extension.value(t)},data:e.list_extensions,container:e.$el.parents().find("#extension"),value:e.list_extensions[0]}),e.$el.parents().find("#extension-info_out").on("click",function(t){e._showExtensionInfo()}).on("mousedown",function(e){e.preventDefault()})}this.modal.show(),this._updateUser(),this._updateScreen()},_showExtensionInfo:function(){var e=this,t=$(this.el).parents().find("#extension-info_out"),n=e.select_extension.value(),r=this.select_extension.text(),i=_.findWhere(e.list_extensions,{id:n});this.extension_popup||(this.extension_popup=new o.View({placement:"bottom",container:t})),this.extension_popup.visible?this.extension_popup.hide():(this.extension_popup.title(r),this.extension_popup.empty(),this.extension_popup.append(this._templateDescription(i)),this.extension_popup.show())},_showSettings:function(){this.settings.visible?this.settings.hide():(this.settings.empty(),this.settings.append((new UploadSettings(this)).$el),this.settings.show())},_templateDescription:function(e){if(e.description){var t=e.description;return e.description_url&&(t+=' (<a href="'+e.description_url+'" target="_blank">read more</a>)'),t}return"There is no description available for this file extension."},_eventRemove:function(e){var t=e.get("status");t=="success"?this.counter.success--:t=="error"?this.counter.error--:this.counter.announce--,this._updateScreen(),this.uploadbox.remove(e.id)},_eventAnnounce:function(e,t,n){this.counter.announce++,this._updateScreen();var i=new r(this,{id:e,file_name:t.name,file_size:t.size,file_mode:t.mode,file_path:t.path});this.collection.add(i.model),$(this.el).find("tbody:first").append(i.$el),i.render()},_eventInitialize:function(e,t,n){var r=this.collection.get(e);r.set("status","running");var i=r.get("file_name"),s=r.get("file_path"),o=r.get("file_mode"),u=r.get("extension"),a=r.get("genome"),f=r.get("url_paste"),l=r.get("space_to_tabs"),c=r.get("to_posix_lines");return!!f||t.size>0?(this.uploadbox.configure({url:this.options.nginx_upload_path}),o=="local"?this.uploadbox.configure({paramname:"files_0|file_data"}):this.uploadbox.configure({paramname:null}),tool_input={},o=="new"&&(tool_input["files_0|url_paste"]=f),o=="ftp"&&(tool_input["files_0|ftp_files"]=s),tool_input.dbkey=a,tool_input.file_type=u,tool_input["files_0|type"]="upload_dataset",tool_input.space_to_tabs=l,tool_input.to_posix_lines=c,data={},data.history_id=this.current_history,data.tool_id="upload1",data.inputs=JSON.stringify(tool_input),data):null},_eventProgress:function(e,t,n){var r=this.collection.get(e);r.set("percentage",n),this.ui_button.set("percentage",this._upload_percentage(n,t.size))},_eventSuccess:function(e,t,n){var r=this.collection.get(e);r.set("percentage",100),r.set("status","success");var i=r.get("file_size");this.ui_button.set("percentage",this._upload_percentage(100,i)),this.upload_completed+=i*100,this.counter.announce--,this.counter.success++,this._updateScreen(),Galaxy.currHistoryPanel.refreshContents()},_eventError:function(e,t,n){var r=this.collection.get(e);r.set("percentage",100),r.set("status","error"),r.set("info",n),this.ui_button.set("percentage",this._upload_percentage(100,t.size)),this.ui_button.set("status","danger"),this.upload_completed+=t.size*100,this.counter.announce--,this.counter.error++,this._updateScreen()},_eventComplete:function(){this.collection.each(function(e){e.get("status")=="queued"&&e.set("status","init")}),this.counter.running=0,this._updateScreen()},_eventFtp:function(){this.ftp.visible?this.ftp.hide():(this.ftp.empty(),this.ftp.append((new s(this)).$el),this.ftp.show())},_eventCreate:function(){this.uploadbox.add([{name:"New File",size:0,mode:"new"}])},_eventStart:function(){if(this.counter.announce==0||this.counter.running>0)return;var e=this;this.upload_size=0,this.upload_completed=0,this.collection.each(function(t){t.get("status")=="init"&&(t.set("status","queued"),e.upload_size+=t.get("file_size"))}),this.ui_button.set("percentage",0),this.ui_button.set("status","success"),this.counter.running=this.counter.announce,this._updateScreen(),this.uploadbox.start()},_eventStop:function(){if(this.counter.running==0)return;this.ui_button.set("status","info"),this.uploadbox.stop(),$("#upload-info").html("Queue will pause after completing the current file...")},_eventReset:function(){this.counter.running==0&&(this.collection.reset(),this.counter.reset(),this._updateScreen(),this.uploadbox.reset(),this.select_extension.value(this.list_extensions[0]),this.ui_button.set("percentage",0))},_updateUser:function(){this.current_user=Galaxy.currUser.get("id"),this.current_history=null,this.current_user&&(this.current_history=Galaxy.currHistoryPanel.model.get("id"))},_updateScreen:function(){this.counter.announce==0?this.uploadbox.compatible()?message="You can Drag & Drop files into this box.":message="Unfortunately, your browser does not support multiple file uploads or drag&drop.<br>Some supported browsers are: Firefox 4+, Chrome 7+, IE 10+, Opera 12+ or Safari 6+.":this.counter.running==0?message="You added "+this.counter.announce+" file(s) to the queue. Add more files or click 'Start' to proceed.":message="Please wait..."+this.counter.announce+" out of "+this.counter.running+" remaining.",$("#upload-info").html(message),this.counter.running==0&&this.counter.announce+this.counter.success+this.counter.error>0?this.modal.enableButton("Reset"):this.modal.disableButton("Reset"),this.counter.running==0&&this.counter.announce>0?this.modal.enableButton("Start"):this.modal.disableButton("Start"),this.counter.running>0?this.modal.enableButton("Pause"):this.modal.disableButton("Pause"),this.counter.running==0?(this.modal.enableButton("Choose local file"),this.modal.enableButton("Choose FTP file"),this.modal.enableButton("Paste/Fetch data")):(this.modal.disableButton("Choose local file"),this.modal.disableButton("Choose FTP file"),this.modal.disableButton("Paste/Fetch data")),this.current_user&&this.options.ftp_upload_dir&&this.options.ftp_upload_site?this.modal.showButton("Choose FTP file"):this.modal.hideButton("Choose FTP file"),this.counter.announce+this.counter.success+this.counter.error>0?$(this.el).find("#upload-table").show():$(this.el).find("#upload-table").hide()},_upload_percentage:function(e,t){return(this.upload_completed+e*t)/this.upload_size},_template:function(e,t){return'<div id="uploadhead" class="uploadhead"><span class="fftext">"Set All" Types:  </span><span id="extension" class="extension"/>  <span id="extension-info_out" class="upload-icon-button fa fa-search"/></div><div id="'+e+'" class="upload-box">'+'<table id="upload-table" class="table table-striped" style="display: none;">'+"<thead>"+"<tr>"+"<th>Name</th>"+"<th>Size</th>"+"<th>Type</th>"+"<th>Genome</th>"+"<th>Settings</th>"+"<th>Status</th>"+"<th></th>"+"</tr>"+"</thead>"+"<tbody></tbody>"+"</table>"+"</div>"+'<div class="uploadfoot">'+'<h6 id="'+t+'" class="upload-info"></h6>'+"</div>"}})});
\ No newline at end of file
diff -r fdb6215d8c090154aa6f9d0719d281cdb8526848 -r 32c0e2ce30dce27b22646031e408c400d735863e static/style/blue/base.css
--- a/static/style/blue/base.css
+++ b/static/style/blue/base.css
@@ -119,11 +119,8 @@
.table caption+thead tr:first-child th,.table colgroup+thead tr:first-child th,.table thead:first-child tr:first-child th,.table caption+thead tr:first-child td,.table colgroup+thead tr:first-child td,.table thead:first-child tr:first-child td{border-top:0}
.table tbody+tbody{border-top:2px solid #d6b161}
.table .table{background-color:#fff}
-.uploadwrap {display: table; height: 100%; width: 100%;}
-.uploadcont{display: table-row; height: 100%;}
-.uploadcont-wrap{height: 100%; overflow: auto;}
-.uploadfoot{display: table-row; text-align:center;}
-.uploadhead{display: table-row; float:left; text-align:left; max-height:20px; line-height:18px; margin-bottom: 5px;}
+.uploadhead{height:10%; text-align:left; max-height:20px; line-height:18px; margin-bottom: 5px;}
+.uploadfoot{height:5%; text-align:center;}
.uploadhead .fftext{font-weight: bold;}
.uploadhead .select2-container .select2-choice .select2-arrow b{background-position:0 -3px}
.uploadhead .extension{width:100px;min-width:100px;font-size:11px}
@@ -1379,7 +1376,7 @@
.upload-icon{font-size:1.2em;width:1.2em}
.upload-icon-button{font-size:1.2em;width:1.2em;cursor:pointer}
.upload-info{font-weight:normal;text-align:center}
-.upload-box{width:100%;height:100%;text-align:center;overflow:scroll;font-size:12px;line-height:1.33;-moz-border-radius:5px;border-radius:5px;border:1px dashed #bfbfbf;padding:10px;overflow-x:hidden;-ms-overflow-style:none}.upload-box .table{width:100%}
+.upload-box{width:100%;height:85%;text-align:center;overflow:scroll;font-size:12px;line-height:1.33;-moz-border-radius:5px;border-radius:5px;border:1px dashed #bfbfbf;padding:10px;overflow-x:hidden;-ms-overflow-style:none}.upload-box .table{width:100%}
.upload-box .table th{text-align:center;white-space:nowrap}
.upload-box .table td{margin:0px}
.upload-box .upload-item .select2-arrow b{background-position:0 -3px}
https://bitbucket.org/galaxy/galaxy-central/commits/e5e6fb30d560/
Changeset: e5e6fb30d560
User: dannon
Date: 2015-01-23 15:59:45+00:00
Summary: Merge Upload UI Enhancements from JCabral
Affected #: 9 files
diff -r 58e5b7165b1ad59d0547bf287e24988a3271449e -r e5e6fb30d560b950dd0d773f1226fd84e87c4860 static/scripts/mvc/upload/upload-ftp.js
--- a/static/scripts/mvc/upload/upload-ftp.js
+++ b/static/scripts/mvc/upload/upload-ftp.js
@@ -35,6 +35,7 @@
// fill table
_fill: function(ftp_files) {
+ var self = this;
if (ftp_files && ftp_files.length > 0) {
// add table
this.$el.find('#upload-ftp-content').html($(this._templateTable()));
@@ -49,11 +50,43 @@
// update stats
this.$el.find('#upload-ftp-number').html(ftp_files.length + ' files');
this.$el.find('#upload-ftp-disk').html(Utils.bytesToString (size, true));
+
+ var selectAll = this.$el.find('#selectAll');
+
+ // call method to determine and set selectAll status on loading
+ this._updateSelectAll(selectAll);
+
+ // selectAll checkbox has been clicked
+ selectAll.on('click', function() {
+ var checkboxes=$(this).parents().find('tr.upload-ftp-row>td>div');
+ var len = checkboxes.length;
+ $this = $(this);
+ var allChecked = !($this.hasClass('fa-check-square-o'));
+
+ // change state of the sub-checkboxes
+ for(i = 0; i < len; i++) {
+ if(allChecked) {
+ // all checkboxes should be checked
+ if(checkboxes.eq(i).hasClass('fa-square-o')) {
+ // if they are not checked, check them
+ checkboxes.eq(i).trigger('updateUpBox');
+ }
+ } else {
+ // no checkboxes should be checked
+ if(checkboxes.eq(i).hasClass('fa-check-square-o')) {
+ // if they are checked, uncheck them
+ checkboxes.eq(i).trigger('updateUpBox');
+ }
+ }
+ }
+
+ self._updateSelectAll(selectAll);
+ });
} else {
// add info
this.$el.find('#upload-ftp-content').html($(this._templateInfo()));
}
-
+
// hide spinner
this.$el.find('#upload-ftp-wait').hide();
},
@@ -79,18 +112,18 @@
} else {
icon_class = this.options.class_add;
}
-
+
// add icon class
$icon.addClass(icon_class);
-
- // click to add ftp files
- $it.on('click', function() {
+
+ // add files to the uploadbox
+ $it.on('updateUpBox', function() {
// find model
var model_index = self._find(ftp_file);
-
+
// update icon
$icon.removeClass();
-
+
// add model
if (!model_index) {
// add to uploadbox
@@ -100,19 +133,55 @@
size : ftp_file.size,
path : ftp_file.path
}]);
-
+
// add new icon class
$icon.addClass(self.options.class_remove);
} else {
// remove
self.app.collection.remove(model_index);
-
+
// add new icon class
$icon.addClass(self.options.class_add);
}
});
+
+ // click to add ftp files
+ $it.on('click', function() {
+ //trigger my new event
+ $icon.trigger('updateUpBox');
+
+ // click to add ftp files
+ // modify selectAll box based on number of checkboxes checked
+ var selectBox=$icon.parents().find('#selectAll');
+ // determine and set state of selectAll after sub-checkbox clicked
+ self._updateSelectAll(selectBox);
+ });
},
-
+
+ _updateSelectAll: function(selectBox) {
+ // array of all checkboxes
+ var checkboxes=selectBox.parents().find('tr.upload-ftp-row>td>div');
+ // array of only checked checkboxes
+ var checkedCheckboxes=selectBox.parents().find('tr.upload-ftp-row>td>div.fa-check-square-o');
+ var lenAll = checkboxes.length;
+ var lenChecked = checkedCheckboxes.length;
+
+ // determine which state the selectAll checkbox needs to be and setting it
+ if(lenChecked > 0 && lenChecked !== lenAll) {
+ // indeterminate state
+ selectBox.removeClass('fa-square-o fa-check-square-o');
+ selectBox.addClass('fa-minus-square-o');
+ } else if(lenChecked === lenAll) {
+ // checked state
+ selectBox.removeClass('fa-square-o fa-minus-square-o');
+ selectBox.addClass('fa-check-square-o');
+ } else if(lenChecked === 0) {
+ // unchecked state
+ selectBox.removeClass('fa-check-square-o fa-minus-square-o');
+ selectBox.addClass('fa-square-o');
+ }
+ },
+
// get model index
_find: function(ftp_file) {
// check if exists already
@@ -149,7 +218,7 @@
'<table class="grid" style="float: left;">' +
'<thead>' +
'<tr>' +
- '<th></th>' +
+ '<th><div id="selectAll" class="upload-icon-button fa fa-square-o" ></th>' +
'<th>Name</th>' +
'<th>Size</th>' +
'<th>Created</th>' +
diff -r 58e5b7165b1ad59d0547bf287e24988a3271449e -r e5e6fb30d560b950dd0d773f1226fd84e87c4860 static/scripts/mvc/upload/upload-model.js
--- a/static/scripts/mvc/upload/upload-model.js
+++ b/static/scripts/mvc/upload/upload-model.js
@@ -14,6 +14,7 @@
file_type : null,
file_path : '',
percentage : 0,
+ row : null,
// settings
space_to_tabs : false,
diff -r 58e5b7165b1ad59d0547bf287e24988a3271449e -r e5e6fb30d560b950dd0d773f1226fd84e87c4860 static/scripts/mvc/upload/upload-row.js
--- a/static/scripts/mvc/upload/upload-row.js
+++ b/static/scripts/mvc/upload/upload-row.js
@@ -42,6 +42,9 @@
// link app
this.app = app;
+ // default value for extension of files
+ var default_ext = 'Auto-detect';
+
// link this
var self = this;
@@ -75,15 +78,28 @@
// initialize genome
this.model.set('genome', self.select_genome.value());
+ // ensure files added after an individual row has changed
+ // default to Auto-detect instead of ---
+ if(!(this.app.select_extension.value() === '---')){
+ this.default_ext = this.app.select_extension.value();
+ }
+
// select extension
this.select_extension = new Select.View({
css: 'extension',
onchange : function() {
self.model.set('extension', self.select_extension.value());
+ // if user has changed individual row type, then change "set all"
+ // type to '---'
+ if(!(self.select_extension.value() === app.select_extension.value()))
+ {
+ var newExte = '---';
+ app.select_extension.value(newExte);
+ }
},
data: self.app.list_extensions,
container: it.find('#extension'),
- value: self.model.get('extension')
+ value: self.default_ext
});
// initialize extension
@@ -139,6 +155,7 @@
this.app.collection.on('reset', function() {
self.remove();
});
+ self.model.set('row', self);
},
// render
diff -r 58e5b7165b1ad59d0547bf287e24988a3271449e -r e5e6fb30d560b950dd0d773f1226fd84e87c4860 static/scripts/mvc/upload/upload-view.js
--- a/static/scripts/mvc/upload/upload-view.js
+++ b/static/scripts/mvc/upload/upload-view.js
@@ -6,6 +6,7 @@
"mvc/upload/upload-ftp",
"mvc/ui/ui-popover",
"mvc/ui/ui-modal",
+ "mvc/ui/ui-select",
"utils/uploadbox"],
function( Utils,
@@ -14,7 +15,8 @@
UploadItem,
UploadFtp,
Popover,
- Modal
+ Modal,
+ Select
) {
// galaxy upload
@@ -35,6 +37,9 @@
// current history
current_history: null,
+
+ // extension selector
+ select_extension : null,
// current upload size
upload_size: 0,
@@ -119,11 +124,19 @@
description_url : datatypes[key].description_url
});
}
-
+
// sort
self.list_extensions.sort(function(a, b) {
return a.id > b.id ? 1 : a.id < b.id ? -1 : 0;
});
+
+ // add the '---' extension for use when the row types are changed individually
+ self.list_extensions.push({
+ id : "---",
+ text : "---",
+ description : "",
+ description_url : ""
+ });
// add auto field
if (!self.options.datatypes_disable_auto) {
@@ -218,6 +231,29 @@
title : 'FTP files',
container : button
});
+
+ // select extension
+ this.select_extension = new Select.View({
+ css: 'extension',
+ onchange : function() {
+ var newExten = self.select_extension.value()
+ var len = self.collection.models.length;
+ // Only trigger changing the rows if the "set all" isn't set to '---'
+ // Prevents recursively changing the rows after an individual row has been changed
+ if(!(newExten === '---')){
+ for(i = 0; i < len; i++){
+ self.collection.models[i].attributes['row'].select_extension.value(newExten);
+ }
+ }
+ },
+ data: self.list_extensions,
+ container: self.$el.parents().find('#extension'),
+ value: self.list_extensions[0]
+ });
+
+ // handle extension info popover
+ self.$el.parents().find('#extension-info_out').on('click' , function(e) { self._showExtensionInfo(); })
+ .on('mousedown', function(e) { e.preventDefault(); });
}
// show modal
@@ -230,6 +266,60 @@
this._updateScreen();
},
+ _showExtensionInfo : function() {
+ // initialize
+ var self = this;
+ var $el = $(this.el).parents().find('#extension-info_out');
+ var extension = self.select_extension.value();
+
+ var title = this.select_extension.text();
+
+ var description = _.findWhere(self.list_extensions, {'id': extension});
+
+ // create popup
+ if (!this.extension_popup) {
+ this.extension_popup = new Popover.View({
+ placement: 'bottom',
+ container: $el
+ });
+ }
+
+ // show / hide popup
+ if (!this.extension_popup.visible) {
+ this.extension_popup.title(title);
+ this.extension_popup.empty();
+ this.extension_popup.append(this._templateDescription(description));
+ this.extension_popup.show();
+ } else {
+ this.extension_popup.hide();
+ }
+ },
+
+ _showSettings : function() {
+ // check if popover is visible
+ if (!this.settings.visible) {
+ // show popover
+ this.settings.empty();
+ this.settings.append((new UploadSettings(this)).$el);
+ this.settings.show();
+ } else {
+ // hide popover
+ this.settings.hide();
+ }
+ },
+
+ _templateDescription: function(options) {
+ if (options.description) {
+ var tmpl = options.description;
+ if (options.description_url) {
+ tmpl += ' (<a href="' + options.description_url + '" target="_blank">read more</a>)';
+ }
+ return tmpl;
+ } else {
+ return 'There is no description available for this file extension.';
+ }
+ },
+
//
// events triggered by collection
//
@@ -513,6 +603,9 @@
// remove from queue
this.uploadbox.reset();
+
+ // reset value for universal type drop-down
+ this.select_extension.value(this.list_extensions[0]);
// reset button
this.ui_button.set('percentage', 0);
@@ -606,7 +699,12 @@
// load html template
_template: function(id, idInfo) {
- return '<div id="' + id + '" class="upload-box">' +
+ return '<div id="uploadhead" class="uploadhead">' +
+ '<span class="fftext">"Set All" Types:  </span>' +
+ '<span id="extension" class="extension"/>  ' +
+ '<span id="extension-info_out" class="upload-icon-button fa fa-search"/> ' +
+ '</div>' +
+ '<div id="' + id + '" class="upload-box">' +
'<table id="upload-table" class="table table-striped" style="display: none;">' +
'<thead>' +
'<tr>' +
@@ -622,7 +720,9 @@
'<tbody></tbody>' +
'</table>' +
'</div>' +
- '<h6 id="' + idInfo + '" class="upload-info"></h6>';
+ '<div class="uploadfoot">' +
+ '<h6 id="' + idInfo + '" class="upload-info"></h6>' +
+ '</div>' ;
}
});
diff -r 58e5b7165b1ad59d0547bf287e24988a3271449e -r e5e6fb30d560b950dd0d773f1226fd84e87c4860 static/scripts/packed/mvc/upload/upload-ftp.js
--- a/static/scripts/packed/mvc/upload/upload-ftp.js
+++ b/static/scripts/packed/mvc/upload/upload-ftp.js
@@ -1,1 +1,1 @@
-define(["utils/utils"],function(a){return Backbone.View.extend({options:{class_add:"upload-icon-button fa fa-square-o",class_remove:"upload-icon-button fa fa-check-square-o"},initialize:function(c){this.app=c;var b=this;this.setElement(this._template());a.get({url:galaxy_config.root+"api/ftp_files",success:function(d){b._fill(d)},error:function(){b._fill()}})},events:{mousedown:function(b){b.preventDefault()}},_fill:function(c){if(c&&c.length>0){this.$el.find("#upload-ftp-content").html($(this._templateTable()));var b=0;for(key in c){this.add(c[key]);b+=c[key].size}this.$el.find("#upload-ftp-number").html(c.length+" files");this.$el.find("#upload-ftp-disk").html(a.bytesToString(b,true))}else{this.$el.find("#upload-ftp-content").html($(this._templateInfo()))}this.$el.find("#upload-ftp-wait").hide()},add:function(f){var d=this;var e=$(this._templateRow(f));var b=e.find(".icon");$(this.el).find("tbody").append(e);var c="";if(this._find(f)){c=this.options.class_remove}else{c=this.options.class_add}b.addClass(c);e.on("click",function(){var g=d._find(f);b.removeClass();if(!g){d.app.uploadbox.add([{mode:"ftp",name:f.path,size:f.size,path:f.path}]);b.addClass(d.options.class_remove)}else{d.app.collection.remove(g);b.addClass(d.options.class_add)}})},_find:function(f){var c=this.app.collection.where({file_path:f.path});var b=null;for(var d in c){var e=c[d];if(e.get("status")=="init"&&e.get("file_mode")=="ftp"){b=e.get("id")}}return b},_templateRow:function(b){return'<tr class="upload-ftp-row" style="cursor: pointer;"><td><div class="icon"/></td><td style="width: 200px"><p style="width: inherit; word-wrap: break-word;">'+b.path+'</p></td><td style="white-space: nowrap;">'+a.bytesToString(b.size)+'</td><td style="white-space: nowrap;">'+b.ctime+"</td></tr>"},_templateTable:function(){return'<span style="whitespace: nowrap; float: left;">Available files: </span><span style="whitespace: nowrap; float: right;"><span class="upload-icon fa fa-file-text-o"/><span id="upload-ftp-number"/> <span class="upload-icon fa fa-hdd-o"/><span id="upload-ftp-disk"/></span><table class="grid" style="float: left;"><thead><tr><th></th><th>Name</th><th>Size</th><th>Created</th></tr></thead><tbody></tbody></table>'},_templateInfo:function(){return'<div class="upload-ftp-warning warningmessage">Your FTP directory does not contain any files.</div>'},_template:function(){return'<div class="upload-ftp"><div id="upload-ftp-wait" class="upload-ftp-wait fa fa-spinner fa-spin"/><div class="upload-ftp-help">This Galaxy server allows you to upload files via FTP. To upload some files, log in to the FTP server at <strong>'+this.app.options.ftp_upload_site+'</strong> using your Galaxy credentials (email address and password).</div><div id="upload-ftp-content"></div><div>'}})});
\ No newline at end of file
+define(["utils/utils"],function(e){return Backbone.View.extend({options:{class_add:"upload-icon-button fa fa-square-o",class_remove:"upload-icon-button fa fa-check-square-o"},initialize:function(t){this.app=t;var n=this;this.setElement(this._template()),e.get({url:galaxy_config.root+"api/ftp_files",success:function(e){n._fill(e)},error:function(){n._fill()}})},events:{mousedown:function(e){e.preventDefault()}},_fill:function(t){var n=this;if(t&&t.length>0){this.$el.find("#upload-ftp-content").html($(this._templateTable()));var r=0;for(key in t)this.add(t[key]),r+=t[key].size;this.$el.find("#upload-ftp-number").html(t.length+" files"),this.$el.find("#upload-ftp-disk").html(e.bytesToString(r,!0));var s=this.$el.find("#selectAll");this._updateSelectAll(s),s.on("click",function(){var e=$(this).parents().find("tr.upload-ftp-row>td>div"),t=e.length;$this=$(this);var r=!$this.hasClass("fa-check-square-o");for(i=0;i<t;i++)r?e.eq(i).hasClass("fa-square-o")&&e.eq(i).trigger("updateUpBox"):e.eq(i).hasClass("fa-check-square-o")&&e.eq(i).trigger("updateUpBox");n._updateSelectAll(s)})}else this.$el.find("#upload-ftp-content").html($(this._templateInfo()));this.$el.find("#upload-ftp-wait").hide()},add:function(e){var t=this,n=$(this._templateRow(e)),r=n.find(".icon");$(this.el).find("tbody").append(n);var i="";this._find(e)?i=this.options.class_remove:i=this.options.class_add,r.addClass(i),n.on("updateUpBox",function(){var n=t._find(e);r.removeClass(),n?(t.app.collection.remove(n),r.addClass(t.options.class_add)):(t.app.uploadbox.add([{mode:"ftp",name:e.path,size:e.size,path:e.path}]),r.addClass(t.options.class_remove))}),n.on("click",function(){r.trigger("updateUpBox");var e=r.parents().find("#selectAll");t._updateSelectAll(e)})},_updateSelectAll:function(e){var t=e.parents().find("tr.upload-ftp-row>td>div"),n=e.parents().find("tr.upload-ftp-row>td>div.fa-check-square-o"),r=t.length,i=n.length;i>0&&i!==r?(e.removeClass("fa-square-o fa-check-square-o"),e.addClass("fa-minus-square-o")):i===r?(e.removeClass("fa-square-o fa-minus-square-o"),e.addClass("fa-check-square-o")):i===0&&(e.removeClass("fa-check-square-o fa-minus-square-o"),e.addClass("fa-square-o"))},_find:function(e){var t=this.app.collection.where({file_path:e.path}),n=null;for(var r in t){var i=t[r];i.get("status")=="init"&&i.get("file_mode")=="ftp"&&(n=i.get("id"))}return n},_templateRow:function(t){return'<tr class="upload-ftp-row" style="cursor: pointer;"><td><div class="icon"/></td><td style="width: 200px"><p style="width: inherit; word-wrap: break-word;">'+t.path+"</p></td>"+'<td style="white-space: nowrap;">'+e.bytesToString(t.size)+"</td>"+'<td style="white-space: nowrap;">'+t.ctime+"</td>"+"</tr>"},_templateTable:function(){return'<span style="whitespace: nowrap; float: left;">Available files: </span><span style="whitespace: nowrap; float: right;"><span class="upload-icon fa fa-file-text-o"/><span id="upload-ftp-number"/> <span class="upload-icon fa fa-hdd-o"/><span id="upload-ftp-disk"/></span><table class="grid" style="float: left;"><thead><tr><th><div id="selectAll" class="upload-icon-button fa fa-square-o" ></th><th>Name</th><th>Size</th><th>Created</th></tr></thead><tbody></tbody></table>'},_templateInfo:function(){return'<div class="upload-ftp-warning warningmessage">Your FTP directory does not contain any files.</div>'},_template:function(){return'<div class="upload-ftp"><div id="upload-ftp-wait" class="upload-ftp-wait fa fa-spinner fa-spin"/><div class="upload-ftp-help">This Galaxy server allows you to upload files via FTP. To upload some files, log in to the FTP server at <strong>'+this.app.options.ftp_upload_site+"</strong> using your Galaxy credentials (email address and password).</div>"+'<div id="upload-ftp-content"></div>'+"<div>"}})});
\ No newline at end of file
diff -r 58e5b7165b1ad59d0547bf287e24988a3271449e -r e5e6fb30d560b950dd0d773f1226fd84e87c4860 static/scripts/packed/mvc/upload/upload-model.js
--- a/static/scripts/packed/mvc/upload/upload-model.js
+++ b/static/scripts/packed/mvc/upload/upload-model.js
@@ -1,1 +1,1 @@
-define([],function(){var b=Backbone.Model.extend({defaults:{extension:"auto",genome:"?",url_paste:"",status:"init",info:null,file_mode:"local",file_size:0,file_type:null,file_path:"",percentage:0,space_to_tabs:false,to_posix_lines:true}});var a=Backbone.Collection.extend({model:b});return{Model:b,Collection:a}});
\ No newline at end of file
+define([],function(){var e=Backbone.Model.extend({defaults:{extension:"auto",genome:"?",url_paste:"",status:"init",info:null,file_mode:"local",file_size:0,file_type:null,file_path:"",percentage:0,row:null,space_to_tabs:!1,to_posix_lines:!0}}),t=Backbone.Collection.extend({model:e});return{Model:e,Collection:t}});
\ No newline at end of file
diff -r 58e5b7165b1ad59d0547bf287e24988a3271449e -r e5e6fb30d560b950dd0d773f1226fd84e87c4860 static/scripts/packed/mvc/upload/upload-row.js
--- a/static/scripts/packed/mvc/upload/upload-row.js
+++ b/static/scripts/packed/mvc/upload/upload-row.js
@@ -1,1 +1,1 @@
-define(["utils/utils","mvc/upload/upload-model","mvc/upload/upload-settings","mvc/ui/ui-popover","mvc/ui/ui-select"],function(d,b,a,c,e){return Backbone.View.extend({options:{padding:8},status_classes:{init:"upload-icon-button fa fa-trash-o",queued:"upload-icon fa fa-spinner fa-spin",running:"upload-icon fa fa-spinner fa-spin",success:"upload-icon-button fa fa-check",error:"upload-icon-button fa fa-exclamation-triangle"},settings:null,select_genome:null,select_extension:null,initialize:function(i,g){this.app=i;var f=this;this.model=new b.Model(g);this.setElement(this._template(g));var h=this.$el;this.settings=new c.View({title:"Upload configuration",container:h.find("#settings"),placement:"bottom"});this.select_genome=new e.View({css:"genome",onchange:function(){f.model.set("genome",f.select_genome.value())},data:f.app.list_genomes,container:h.find("#genome"),value:f.model.get("genome")});this.model.set("genome",f.select_genome.value());this.select_extension=new e.View({css:"extension",onchange:function(){f.model.set("extension",f.select_extension.value())},data:f.app.list_extensions,container:h.find("#extension"),value:f.model.get("extension")});this.model.set("extension",f.select_extension.value());h.find("#symbol").on("click",function(){f._removeRow()});h.find("#extension-info").on("click",function(j){f._showExtensionInfo()}).on("mousedown",function(j){j.preventDefault()});h.find("#settings").on("click",function(j){f._showSettings()}).on("mousedown",function(j){j.preventDefault()});h.find("#text-content").on("keyup",function(j){f.model.set("url_paste",$(j.target).val());f.model.set("file_size",$(j.target).val().length)});h.find("#space_to_tabs").on("change",function(j){f.model.set("space_to_tabs",$(j.target).prop("checked"))});this.model.on("change:percentage",function(){f._refreshPercentage()});this.model.on("change:status",function(){f._refreshStatus()});this.model.on("change:info",function(){f._refreshInfo()});this.model.on("change:genome",function(){f._refreshGenome()});this.model.on("change:file_size",function(){f._refreshFileSize()});this.model.on("remove",function(){f.remove()});this.app.collection.on("reset",function(){f.remove()})},render:function(){var m=this.model.get("file_name");var g=this.model.get("file_size");var j=this.model.get("file_mode");var i=this.$el;i.find("#title").html(m);i.find("#size").html(d.bytesToString(g));i.find("#mode").removeClass().addClass("mode");if(j=="new"){var l=i.find("#text");var k=this.options.padding;var h=i.width()-2*k;var f=i.height()-k;l.css("width",h+"px");l.css("top",f+"px");i.height(f+l.height()+2*k);l.show();i.find("#mode").addClass("fa fa-pencil")}if(j=="local"){i.find("#mode").addClass("fa fa-laptop")}if(j=="ftp"){i.find("#mode").addClass("fa fa-code-fork")}},remove:function(){this.select_genome.remove();this.select_extension.remove();Backbone.View.prototype.remove.apply(this)},_refreshGenome:function(){var f=this.model.get("genome");this.select_genome.value(f)},_refreshInfo:function(){var f=this.model.get("info");if(f){this.$el.find("#info").html("<strong>Failed: </strong>"+f).show()}else{this.$el.find("#info").hide()}},_refreshPercentage:function(){var f=parseInt(this.model.get("percentage"));this.$el.find(".progress-bar").css({width:f+"%"});if(f!=100){this.$el.find("#percentage").html(f+"%")}else{this.$el.find("#percentage").html("Adding to history...")}},_refreshStatus:function(){var g=this.$el;var f=this.model.get("status");var i=this.status_classes[f];var h=this.$el.find("#symbol");h.removeClass();h.addClass(i);if(f=="init"){this.select_genome.enable();this.select_extension.enable();g.find("#text-content").attr("disabled",false);g.find("#space_to_tabs").attr("disabled",false)}else{this.select_genome.disable();this.select_extension.disable();g.find("#text-content").attr("disabled",true);g.find("#space_to_tabs").attr("disabled",true)}if(f=="success"){g.addClass("success");g.find("#percentage").html("100%")}if(f=="error"){g.addClass("danger");g.find(".progress").remove()}},_refreshFileSize:function(){var f=this.model.get("file_size");this.$el.find("#size").html(d.bytesToString(f))},_removeRow:function(){var f=this.model.get("status");if(f=="init"||f=="success"||f=="error"){this.app.collection.remove(this.model)}},_showExtensionInfo:function(){var f=$(this.el).find("#extension-info");var i=this.model.get("extension");var h=this.select_extension.text();var g=_.findWhere(this.app.list_extensions,{id:i});if(!this.extension_popup){this.extension_popup=new c.View({placement:"bottom",container:f})}if(!this.extension_popup.visible){this.extension_popup.title(h);this.extension_popup.empty();this.extension_popup.append(this._templateDescription(g));this.extension_popup.show()}else{this.extension_popup.hide()}},_showSettings:function(){if(!this.settings.visible){this.settings.empty();this.settings.append((new a(this)).$el);this.settings.show()}else{this.settings.hide()}},_templateDescription:function(g){if(g.description){var f=g.description;if(g.description_url){f+=' (<a href="'+g.description_url+'" target="_blank">read more</a>)'}return f}else{return"There is no description available for this file extension."}},_template:function(f){return'<tr id="upload-item-'+f.id+'" class="upload-item"><td><div style="position: relative;"><div id="mode"></div><div id="title" class="title"></div><div id="text" class="text"><div class="text-info">You can tell Galaxy to download data from web by entering URL in this box (one per line). You can also directly paste the contents of a file.</div><textarea id="text-content" class="text-content form-control"></textarea></div></div></td><td><div id="size" class="size"></div></td><td><div id="extension" class="extension" style="float: left;"/>  <div id="extension-info" class="upload-icon-button fa fa-search"/></td><td><div id="genome" class="genome" /></td><td><div id="settings" class="upload-icon-button fa fa-gear"></div><td><div id="info" class="info"><div class="progress"><div class="progress-bar progress-bar-success"></div><div id="percentage" class="percentage">0%</div></div></div></td><td><div id="symbol" class="'+this.status_classes.init+'"></div></td></tr>'}})});
\ No newline at end of file
+define(["utils/utils","mvc/upload/upload-model","mvc/upload/upload-settings","mvc/ui/ui-popover","mvc/ui/ui-select"],function(e,t,n,r,i){return Backbone.View.extend({options:{padding:8},status_classes:{init:"upload-icon-button fa fa-trash-o",queued:"upload-icon fa fa-spinner fa-spin",running:"upload-icon fa fa-spinner fa-spin",success:"upload-icon-button fa fa-check",error:"upload-icon-button fa fa-exclamation-triangle"},settings:null,select_genome:null,select_extension:null,initialize:function(e,n){this.app=e;var s="Auto-detect",o=this;this.model=new t.Model(n),this.setElement(this._template(n));var u=this.$el;this.settings=new r.View({title:"Upload configuration",container:u.find("#settings"),placement:"bottom"}),this.select_genome=new i.View({css:"genome",onchange:function(){o.model.set("genome",o.select_genome.value())},data:o.app.list_genomes,container:u.find("#genome"),value:o.model.get("genome")}),this.model.set("genome",o.select_genome.value()),this.app.select_extension.value()!=="---"&&(this.default_ext=this.app.select_extension.value()),this.select_extension=new i.View({css:"extension",onchange:function(){o.model.set("extension",o.select_extension.value());if(o.select_extension.value()!==e.select_extension.value()){var t="---";e.select_extension.value(t)}},data:o.app.list_extensions,container:u.find("#extension"),value:o.default_ext}),this.model.set("extension",o.select_extension.value()),u.find("#symbol").on("click",function(){o._removeRow()}),u.find("#extension-info").on("click",function(e){o._showExtensionInfo()}).on("mousedown",function(e){e.preventDefault()}),u.find("#settings").on("click",function(e){o._showSettings()}).on("mousedown",function(e){e.preventDefault()}),u.find("#text-content").on("keyup",function(e){o.model.set("url_paste",$(e.target).val()),o.model.set("file_size",$(e.target).val().length)}),u.find("#space_to_tabs").on("change",function(e){o.model.set("space_to_tabs",$(e.target).prop("checked"))}),this.model.on("change:percentage",function(){o._refreshPercentage()}),this.model.on("change:status",function(){o._refreshStatus()}),this.model.on("change:info",function(){o._refreshInfo()}),this.model.on("change:genome",function(){o._refreshGenome()}),this.model.on("change:file_size",function(){o._refreshFileSize()}),this.model.on("remove",function(){o.remove()}),this.app.collection.on("reset",function(){o.remove()}),o.model.set("row",o)},render:function(){var t=this.model.get("file_name"),n=this.model.get("file_size"),r=this.model.get("file_mode"),i=this.$el;i.find("#title").html(t),i.find("#size").html(e.bytesToString(n)),i.find("#mode").removeClass().addClass("mode");if(r=="new"){var s=i.find("#text"),o=this.options.padding,u=i.width()-2*o,a=i.height()-o;s.css("width",u+"px"),s.css("top",a+"px"),i.height(a+s.height()+2*o),s.show(),i.find("#mode").addClass("fa fa-pencil")}r=="local"&&i.find("#mode").addClass("fa fa-laptop"),r=="ftp"&&i.find("#mode").addClass("fa fa-code-fork")},remove:function(){this.select_genome.remove(),this.select_extension.remove(),Backbone.View.prototype.remove.apply(this)},_refreshGenome:function(){var e=this.model.get("genome");this.select_genome.value(e)},_refreshInfo:function(){var e=this.model.get("info");e?this.$el.find("#info").html("<strong>Failed: </strong>"+e).show():this.$el.find("#info").hide()},_refreshPercentage:function(){var e=parseInt(this.model.get("percentage"));this.$el.find(".progress-bar").css({width:e+"%"}),e!=100?this.$el.find("#percentage").html(e+"%"):this.$el.find("#percentage").html("Adding to history...")},_refreshStatus:function(){var e=this.$el,t=this.model.get("status"),n=this.status_classes[t],r=this.$el.find("#symbol");r.removeClass(),r.addClass(n),t=="init"?(this.select_genome.enable(),this.select_extension.enable(),e.find("#text-content").attr("disabled",!1),e.find("#space_to_tabs").attr("disabled",!1)):(this.select_genome.disable(),this.select_extension.disable(),e.find("#text-content").attr("disabled",!0),e.find("#space_to_tabs").attr("disabled",!0)),t=="success"&&(e.addClass("success"),e.find("#percentage").html("100%")),t=="error"&&(e.addClass("danger"),e.find(".progress").remove())},_refreshFileSize:function(){var t=this.model.get("file_size");this.$el.find("#size").html(e.bytesToString(t))},_removeRow:function(){var e=this.model.get("status");(e=="init"||e=="success"||e=="error")&&this.app.collection.remove(this.model)},_showExtensionInfo:function(){var e=$(this.el).find("#extension-info"),t=this.model.get("extension"),n=this.select_extension.text(),i=_.findWhere(this.app.list_extensions,{id:t});this.extension_popup||(this.extension_popup=new r.View({placement:"bottom",container:e})),this.extension_popup.visible?this.extension_popup.hide():(this.extension_popup.title(n),this.extension_popup.empty(),this.extension_popup.append(this._templateDescription(i)),this.extension_popup.show())},_showSettings:function(){this.settings.visible?this.settings.hide():(this.settings.empty(),this.settings.append((new n(this)).$el),this.settings.show())},_templateDescription:function(e){if(e.description){var t=e.description;return e.description_url&&(t+=' (<a href="'+e.description_url+'" target="_blank">read more</a>)'),t}return"There is no description available for this file extension."},_template:function(e){return'<tr id="upload-item-'+e.id+'" class="upload-item">'+"<td>"+'<div style="position: relative;">'+'<div id="mode"></div>'+'<div id="title" class="title"></div>'+'<div id="text" class="text">'+'<div class="text-info">You can tell Galaxy to download data from web by entering URL in this box (one per line). You can also directly paste the contents of a file.</div>'+'<textarea id="text-content" class="text-content form-control"></textarea>'+"</div>"+"</div>"+"</td>"+"<td>"+'<div id="size" class="size"></div>'+"</td>"+"<td>"+'<div id="extension" class="extension" style="float: left;"/>  '+'<div id="extension-info" class="upload-icon-button fa fa-search"/>'+"</td>"+"<td>"+'<div id="genome" class="genome" />'+"</td>"+'<td><div id="settings" class="upload-icon-button fa fa-gear"></div>'+"<td>"+'<div id="info" class="info">'+'<div class="progress">'+'<div class="progress-bar progress-bar-success"></div>'+'<div id="percentage" class="percentage">0%</div>'+"</div>"+"</div>"+"</td>"+"<td>"+'<div id="symbol" class="'+this.status_classes.init+'"></div>'+"</td>"+"</tr>"}})});
\ No newline at end of file
diff -r 58e5b7165b1ad59d0547bf287e24988a3271449e -r e5e6fb30d560b950dd0d773f1226fd84e87c4860 static/style/blue/base.css
--- a/static/style/blue/base.css
+++ b/static/style/blue/base.css
@@ -119,6 +119,12 @@
.table caption+thead tr:first-child th,.table colgroup+thead tr:first-child th,.table thead:first-child tr:first-child th,.table caption+thead tr:first-child td,.table colgroup+thead tr:first-child td,.table thead:first-child tr:first-child td{border-top:0}
.table tbody+tbody{border-top:2px solid #d6b161}
.table .table{background-color:#fff}
+.uploadhead{height:10%; text-align:left; max-height:20px; line-height:18px; margin-bottom: 5px;}
+.uploadfoot{height:5%; text-align:center;}
+.uploadhead .fftext{font-weight: bold;}
+.uploadhead .select2-container .select2-choice .select2-arrow b{background-position:0 -3px}
+.uploadhead .extension{width:100px;min-width:100px;font-size:11px}
+.uploadhead .select2-container .select2-choice{max-height:20px;line-height:18px;text-align:center; font-weight: normal;}
.table-condensed thead>tr>th,.table-condensed tbody>tr>th,.table-condensed tfoot>tr>th,.table-condensed thead>tr>td,.table-condensed tbody>tr>td,.table-condensed tfoot>tr>td{padding:5px}
.table-bordered{border:1px solid #d6b161}.table-bordered>thead>tr>th,.table-bordered>tbody>tr>th,.table-bordered>tfoot>tr>th,.table-bordered>thead>tr>td,.table-bordered>tbody>tr>td,.table-bordered>tfoot>tr>td{border:1px solid #d6b161}
.table-bordered>thead>tr>th,.table-bordered>thead>tr>td{border-bottom-width:2px}
@@ -1370,7 +1376,7 @@
.upload-icon{font-size:1.2em;width:1.2em}
.upload-icon-button{font-size:1.2em;width:1.2em;cursor:pointer}
.upload-info{font-weight:normal;text-align:center}
-.upload-box{width:100%;height:95%;text-align:center;overflow:scroll;font-size:12px;line-height:1.33;-moz-border-radius:5px;border-radius:5px;border:1px dashed #bfbfbf;padding:10px;overflow-x:hidden;-ms-overflow-style:none}.upload-box .table{width:100%}
+.upload-box{width:100%;height:85%;text-align:center;overflow:scroll;font-size:12px;line-height:1.33;-moz-border-radius:5px;border-radius:5px;border:1px dashed #bfbfbf;padding:10px;overflow-x:hidden;-ms-overflow-style:none}.upload-box .table{width:100%}
.upload-box .table th{text-align:center;white-space:nowrap}
.upload-box .table td{margin:0px}
.upload-box .upload-item .select2-arrow b{background-position:0 -3px}
https://bitbucket.org/galaxy/galaxy-central/commits/693f01fe6a68/
Changeset: 693f01fe6a68
User: dannon
Date: 2015-01-23 16:08:05+00:00
Summary: Copy changes from PR644 to client.
Affected #: 4 files
diff -r e5e6fb30d560b950dd0d773f1226fd84e87c4860 -r 693f01fe6a682a8b4934317a04c40c3919a3fbf6 client/galaxy/scripts/mvc/upload/upload-ftp.js
--- a/client/galaxy/scripts/mvc/upload/upload-ftp.js
+++ b/client/galaxy/scripts/mvc/upload/upload-ftp.js
@@ -35,6 +35,7 @@
// fill table
_fill: function(ftp_files) {
+ var self = this;
if (ftp_files && ftp_files.length > 0) {
// add table
this.$el.find('#upload-ftp-content').html($(this._templateTable()));
@@ -49,11 +50,43 @@
// update stats
this.$el.find('#upload-ftp-number').html(ftp_files.length + ' files');
this.$el.find('#upload-ftp-disk').html(Utils.bytesToString (size, true));
+
+ var selectAll = this.$el.find('#selectAll');
+
+ // call method to determine and set selectAll status on loading
+ this._updateSelectAll(selectAll);
+
+ // selectAll checkbox has been clicked
+ selectAll.on('click', function() {
+ var checkboxes=$(this).parents().find('tr.upload-ftp-row>td>div');
+ var len = checkboxes.length;
+ $this = $(this);
+ var allChecked = !($this.hasClass('fa-check-square-o'));
+
+ // change state of the sub-checkboxes
+ for(i = 0; i < len; i++) {
+ if(allChecked) {
+ // all checkboxes should be checked
+ if(checkboxes.eq(i).hasClass('fa-square-o')) {
+ // if they are not checked, check them
+ checkboxes.eq(i).trigger('updateUpBox');
+ }
+ } else {
+ // no checkboxes should be checked
+ if(checkboxes.eq(i).hasClass('fa-check-square-o')) {
+ // if they are checked, uncheck them
+ checkboxes.eq(i).trigger('updateUpBox');
+ }
+ }
+ }
+
+ self._updateSelectAll(selectAll);
+ });
} else {
// add info
this.$el.find('#upload-ftp-content').html($(this._templateInfo()));
}
-
+
// hide spinner
this.$el.find('#upload-ftp-wait').hide();
},
@@ -79,18 +112,18 @@
} else {
icon_class = this.options.class_add;
}
-
+
// add icon class
$icon.addClass(icon_class);
-
- // click to add ftp files
- $it.on('click', function() {
+
+ // add files to the uploadbox
+ $it.on('updateUpBox', function() {
// find model
var model_index = self._find(ftp_file);
-
+
// update icon
$icon.removeClass();
-
+
// add model
if (!model_index) {
// add to uploadbox
@@ -100,19 +133,55 @@
size : ftp_file.size,
path : ftp_file.path
}]);
-
+
// add new icon class
$icon.addClass(self.options.class_remove);
} else {
// remove
self.app.collection.remove(model_index);
-
+
// add new icon class
$icon.addClass(self.options.class_add);
}
});
+
+ // click to add ftp files
+ $it.on('click', function() {
+ //trigger my new event
+ $icon.trigger('updateUpBox');
+
+ // click to add ftp files
+ // modify selectAll box based on number of checkboxes checked
+ var selectBox=$icon.parents().find('#selectAll');
+ // determine and set state of selectAll after sub-checkbox clicked
+ self._updateSelectAll(selectBox);
+ });
},
-
+
+ _updateSelectAll: function(selectBox) {
+ // array of all checkboxes
+ var checkboxes=selectBox.parents().find('tr.upload-ftp-row>td>div');
+ // array of only checked checkboxes
+ var checkedCheckboxes=selectBox.parents().find('tr.upload-ftp-row>td>div.fa-check-square-o');
+ var lenAll = checkboxes.length;
+ var lenChecked = checkedCheckboxes.length;
+
+ // determine which state the selectAll checkbox needs to be and setting it
+ if(lenChecked > 0 && lenChecked !== lenAll) {
+ // indeterminate state
+ selectBox.removeClass('fa-square-o fa-check-square-o');
+ selectBox.addClass('fa-minus-square-o');
+ } else if(lenChecked === lenAll) {
+ // checked state
+ selectBox.removeClass('fa-square-o fa-minus-square-o');
+ selectBox.addClass('fa-check-square-o');
+ } else if(lenChecked === 0) {
+ // unchecked state
+ selectBox.removeClass('fa-check-square-o fa-minus-square-o');
+ selectBox.addClass('fa-square-o');
+ }
+ },
+
// get model index
_find: function(ftp_file) {
// check if exists already
@@ -149,7 +218,7 @@
'<table class="grid" style="float: left;">' +
'<thead>' +
'<tr>' +
- '<th></th>' +
+ '<th><div id="selectAll" class="upload-icon-button fa fa-square-o" ></th>' +
'<th>Name</th>' +
'<th>Size</th>' +
'<th>Created</th>' +
diff -r e5e6fb30d560b950dd0d773f1226fd84e87c4860 -r 693f01fe6a682a8b4934317a04c40c3919a3fbf6 client/galaxy/scripts/mvc/upload/upload-model.js
--- a/client/galaxy/scripts/mvc/upload/upload-model.js
+++ b/client/galaxy/scripts/mvc/upload/upload-model.js
@@ -14,6 +14,7 @@
file_type : null,
file_path : '',
percentage : 0,
+ row : null,
// settings
space_to_tabs : false,
diff -r e5e6fb30d560b950dd0d773f1226fd84e87c4860 -r 693f01fe6a682a8b4934317a04c40c3919a3fbf6 client/galaxy/scripts/mvc/upload/upload-row.js
--- a/client/galaxy/scripts/mvc/upload/upload-row.js
+++ b/client/galaxy/scripts/mvc/upload/upload-row.js
@@ -42,6 +42,9 @@
// link app
this.app = app;
+ // default value for extension of files
+ var default_ext = 'Auto-detect';
+
// link this
var self = this;
@@ -75,15 +78,28 @@
// initialize genome
this.model.set('genome', self.select_genome.value());
+ // ensure files added after an individual row has changed
+ // default to Auto-detect instead of ---
+ if(!(this.app.select_extension.value() === '---')){
+ this.default_ext = this.app.select_extension.value();
+ }
+
// select extension
this.select_extension = new Select.View({
css: 'extension',
onchange : function() {
self.model.set('extension', self.select_extension.value());
+ // if user has changed individual row type, then change "set all"
+ // type to '---'
+ if(!(self.select_extension.value() === app.select_extension.value()))
+ {
+ var newExte = '---';
+ app.select_extension.value(newExte);
+ }
},
data: self.app.list_extensions,
container: it.find('#extension'),
- value: self.model.get('extension')
+ value: self.default_ext
});
// initialize extension
@@ -139,6 +155,7 @@
this.app.collection.on('reset', function() {
self.remove();
});
+ self.model.set('row', self);
},
// render
diff -r e5e6fb30d560b950dd0d773f1226fd84e87c4860 -r 693f01fe6a682a8b4934317a04c40c3919a3fbf6 client/galaxy/scripts/mvc/upload/upload-view.js
--- a/client/galaxy/scripts/mvc/upload/upload-view.js
+++ b/client/galaxy/scripts/mvc/upload/upload-view.js
@@ -6,6 +6,7 @@
"mvc/upload/upload-ftp",
"mvc/ui/ui-popover",
"mvc/ui/ui-modal",
+ "mvc/ui/ui-select",
"utils/uploadbox"],
function( Utils,
@@ -14,7 +15,8 @@
UploadItem,
UploadFtp,
Popover,
- Modal
+ Modal,
+ Select
) {
// galaxy upload
@@ -35,6 +37,9 @@
// current history
current_history: null,
+
+ // extension selector
+ select_extension : null,
// current upload size
upload_size: 0,
@@ -119,11 +124,19 @@
description_url : datatypes[key].description_url
});
}
-
+
// sort
self.list_extensions.sort(function(a, b) {
return a.id > b.id ? 1 : a.id < b.id ? -1 : 0;
});
+
+ // add the '---' extension for use when the row types are changed individually
+ self.list_extensions.push({
+ id : "---",
+ text : "---",
+ description : "",
+ description_url : ""
+ });
// add auto field
if (!self.options.datatypes_disable_auto) {
@@ -218,6 +231,29 @@
title : 'FTP files',
container : button
});
+
+ // select extension
+ this.select_extension = new Select.View({
+ css: 'extension',
+ onchange : function() {
+ var newExten = self.select_extension.value()
+ var len = self.collection.models.length;
+ // Only trigger changing the rows if the "set all" isn't set to '---'
+ // Prevents recursively changing the rows after an individual row has been changed
+ if(!(newExten === '---')){
+ for(i = 0; i < len; i++){
+ self.collection.models[i].attributes['row'].select_extension.value(newExten);
+ }
+ }
+ },
+ data: self.list_extensions,
+ container: self.$el.parents().find('#extension'),
+ value: self.list_extensions[0]
+ });
+
+ // handle extension info popover
+ self.$el.parents().find('#extension-info_out').on('click' , function(e) { self._showExtensionInfo(); })
+ .on('mousedown', function(e) { e.preventDefault(); });
}
// show modal
@@ -230,6 +266,60 @@
this._updateScreen();
},
+ _showExtensionInfo : function() {
+ // initialize
+ var self = this;
+ var $el = $(this.el).parents().find('#extension-info_out');
+ var extension = self.select_extension.value();
+
+ var title = this.select_extension.text();
+
+ var description = _.findWhere(self.list_extensions, {'id': extension});
+
+ // create popup
+ if (!this.extension_popup) {
+ this.extension_popup = new Popover.View({
+ placement: 'bottom',
+ container: $el
+ });
+ }
+
+ // show / hide popup
+ if (!this.extension_popup.visible) {
+ this.extension_popup.title(title);
+ this.extension_popup.empty();
+ this.extension_popup.append(this._templateDescription(description));
+ this.extension_popup.show();
+ } else {
+ this.extension_popup.hide();
+ }
+ },
+
+ _showSettings : function() {
+ // check if popover is visible
+ if (!this.settings.visible) {
+ // show popover
+ this.settings.empty();
+ this.settings.append((new UploadSettings(this)).$el);
+ this.settings.show();
+ } else {
+ // hide popover
+ this.settings.hide();
+ }
+ },
+
+ _templateDescription: function(options) {
+ if (options.description) {
+ var tmpl = options.description;
+ if (options.description_url) {
+ tmpl += ' (<a href="' + options.description_url + '" target="_blank">read more</a>)';
+ }
+ return tmpl;
+ } else {
+ return 'There is no description available for this file extension.';
+ }
+ },
+
//
// events triggered by collection
//
@@ -513,6 +603,9 @@
// remove from queue
this.uploadbox.reset();
+
+ // reset value for universal type drop-down
+ this.select_extension.value(this.list_extensions[0]);
// reset button
this.ui_button.set('percentage', 0);
@@ -606,7 +699,12 @@
// load html template
_template: function(id, idInfo) {
- return '<div id="' + id + '" class="upload-box">' +
+ return '<div id="uploadhead" class="uploadhead">' +
+ '<span class="fftext">"Set All" Types:  </span>' +
+ '<span id="extension" class="extension"/>  ' +
+ '<span id="extension-info_out" class="upload-icon-button fa fa-search"/> ' +
+ '</div>' +
+ '<div id="' + id + '" class="upload-box">' +
'<table id="upload-table" class="table table-striped" style="display: none;">' +
'<thead>' +
'<tr>' +
@@ -622,7 +720,9 @@
'<tbody></tbody>' +
'</table>' +
'</div>' +
- '<h6 id="' + idInfo + '" class="upload-info"></h6>';
+ '<div class="uploadfoot">' +
+ '<h6 id="' + idInfo + '" class="upload-info"></h6>' +
+ '</div>' ;
}
});
https://bitbucket.org/galaxy/galaxy-central/commits/b73cb7a7cdca/
Changeset: b73cb7a7cdca
User: dannon
Date: 2015-01-23 16:10:17+00:00
Summary: Pack scripts
Affected #: 4 files
diff -r 693f01fe6a682a8b4934317a04c40c3919a3fbf6 -r b73cb7a7cdca3545d6347c5c4da24cfcc0841c2d static/scripts/packed/mvc/upload/upload-ftp.js
--- a/static/scripts/packed/mvc/upload/upload-ftp.js
+++ b/static/scripts/packed/mvc/upload/upload-ftp.js
@@ -1,1 +1,1 @@
-define(["utils/utils"],function(e){return Backbone.View.extend({options:{class_add:"upload-icon-button fa fa-square-o",class_remove:"upload-icon-button fa fa-check-square-o"},initialize:function(t){this.app=t;var n=this;this.setElement(this._template()),e.get({url:galaxy_config.root+"api/ftp_files",success:function(e){n._fill(e)},error:function(){n._fill()}})},events:{mousedown:function(e){e.preventDefault()}},_fill:function(t){var n=this;if(t&&t.length>0){this.$el.find("#upload-ftp-content").html($(this._templateTable()));var r=0;for(key in t)this.add(t[key]),r+=t[key].size;this.$el.find("#upload-ftp-number").html(t.length+" files"),this.$el.find("#upload-ftp-disk").html(e.bytesToString(r,!0));var s=this.$el.find("#selectAll");this._updateSelectAll(s),s.on("click",function(){var e=$(this).parents().find("tr.upload-ftp-row>td>div"),t=e.length;$this=$(this);var r=!$this.hasClass("fa-check-square-o");for(i=0;i<t;i++)r?e.eq(i).hasClass("fa-square-o")&&e.eq(i).trigger("updateUpBox"):e.eq(i).hasClass("fa-check-square-o")&&e.eq(i).trigger("updateUpBox");n._updateSelectAll(s)})}else this.$el.find("#upload-ftp-content").html($(this._templateInfo()));this.$el.find("#upload-ftp-wait").hide()},add:function(e){var t=this,n=$(this._templateRow(e)),r=n.find(".icon");$(this.el).find("tbody").append(n);var i="";this._find(e)?i=this.options.class_remove:i=this.options.class_add,r.addClass(i),n.on("updateUpBox",function(){var n=t._find(e);r.removeClass(),n?(t.app.collection.remove(n),r.addClass(t.options.class_add)):(t.app.uploadbox.add([{mode:"ftp",name:e.path,size:e.size,path:e.path}]),r.addClass(t.options.class_remove))}),n.on("click",function(){r.trigger("updateUpBox");var e=r.parents().find("#selectAll");t._updateSelectAll(e)})},_updateSelectAll:function(e){var t=e.parents().find("tr.upload-ftp-row>td>div"),n=e.parents().find("tr.upload-ftp-row>td>div.fa-check-square-o"),r=t.length,i=n.length;i>0&&i!==r?(e.removeClass("fa-square-o fa-check-square-o"),e.addClass("fa-minus-square-o")):i===r?(e.removeClass("fa-square-o fa-minus-square-o"),e.addClass("fa-check-square-o")):i===0&&(e.removeClass("fa-check-square-o fa-minus-square-o"),e.addClass("fa-square-o"))},_find:function(e){var t=this.app.collection.where({file_path:e.path}),n=null;for(var r in t){var i=t[r];i.get("status")=="init"&&i.get("file_mode")=="ftp"&&(n=i.get("id"))}return n},_templateRow:function(t){return'<tr class="upload-ftp-row" style="cursor: pointer;"><td><div class="icon"/></td><td style="width: 200px"><p style="width: inherit; word-wrap: break-word;">'+t.path+"</p></td>"+'<td style="white-space: nowrap;">'+e.bytesToString(t.size)+"</td>"+'<td style="white-space: nowrap;">'+t.ctime+"</td>"+"</tr>"},_templateTable:function(){return'<span style="whitespace: nowrap; float: left;">Available files: </span><span style="whitespace: nowrap; float: right;"><span class="upload-icon fa fa-file-text-o"/><span id="upload-ftp-number"/> <span class="upload-icon fa fa-hdd-o"/><span id="upload-ftp-disk"/></span><table class="grid" style="float: left;"><thead><tr><th><div id="selectAll" class="upload-icon-button fa fa-square-o" ></th><th>Name</th><th>Size</th><th>Created</th></tr></thead><tbody></tbody></table>'},_templateInfo:function(){return'<div class="upload-ftp-warning warningmessage">Your FTP directory does not contain any files.</div>'},_template:function(){return'<div class="upload-ftp"><div id="upload-ftp-wait" class="upload-ftp-wait fa fa-spinner fa-spin"/><div class="upload-ftp-help">This Galaxy server allows you to upload files via FTP. To upload some files, log in to the FTP server at <strong>'+this.app.options.ftp_upload_site+"</strong> using your Galaxy credentials (email address and password).</div>"+'<div id="upload-ftp-content"></div>'+"<div>"}})});
\ No newline at end of file
+define(["utils/utils"],function(a){return Backbone.View.extend({options:{class_add:"upload-icon-button fa fa-square-o",class_remove:"upload-icon-button fa fa-check-square-o"},initialize:function(c){this.app=c;var b=this;this.setElement(this._template());a.get({url:galaxy_config.root+"api/ftp_files",success:function(d){b._fill(d)},error:function(){b._fill()}})},events:{mousedown:function(b){b.preventDefault()}},_fill:function(d){var b=this;if(d&&d.length>0){this.$el.find("#upload-ftp-content").html($(this._templateTable()));var c=0;for(key in d){this.add(d[key]);c+=d[key].size}this.$el.find("#upload-ftp-number").html(d.length+" files");this.$el.find("#upload-ftp-disk").html(a.bytesToString(c,true));var e=this.$el.find("#selectAll");this._updateSelectAll(e);e.on("click",function(){var h=$(this).parents().find("tr.upload-ftp-row>td>div");var g=h.length;$this=$(this);var f=!($this.hasClass("fa-check-square-o"));for(i=0;i<g;i++){if(f){if(h.eq(i).hasClass("fa-square-o")){h.eq(i).trigger("updateUpBox")}}else{if(h.eq(i).hasClass("fa-check-square-o")){h.eq(i).trigger("updateUpBox")}}}b._updateSelectAll(e)})}else{this.$el.find("#upload-ftp-content").html($(this._templateInfo()))}this.$el.find("#upload-ftp-wait").hide()},add:function(f){var d=this;var e=$(this._templateRow(f));var b=e.find(".icon");$(this.el).find("tbody").append(e);var c="";if(this._find(f)){c=this.options.class_remove}else{c=this.options.class_add}b.addClass(c);e.on("updateUpBox",function(){var g=d._find(f);b.removeClass();if(!g){d.app.uploadbox.add([{mode:"ftp",name:f.path,size:f.size,path:f.path}]);b.addClass(d.options.class_remove)}else{d.app.collection.remove(g);b.addClass(d.options.class_add)}});e.on("click",function(){b.trigger("updateUpBox");var g=b.parents().find("#selectAll");d._updateSelectAll(g)})},_updateSelectAll:function(e){var d=e.parents().find("tr.upload-ftp-row>td>div");var f=e.parents().find("tr.upload-ftp-row>td>div.fa-check-square-o");var c=d.length;var b=f.length;if(b>0&&b!==c){e.removeClass("fa-square-o fa-check-square-o");e.addClass("fa-minus-square-o")}else{if(b===c){e.removeClass("fa-square-o fa-minus-square-o");e.addClass("fa-check-square-o")}else{if(b===0){e.removeClass("fa-check-square-o fa-minus-square-o");e.addClass("fa-square-o")}}}},_find:function(f){var c=this.app.collection.where({file_path:f.path});var b=null;for(var d in c){var e=c[d];if(e.get("status")=="init"&&e.get("file_mode")=="ftp"){b=e.get("id")}}return b},_templateRow:function(b){return'<tr class="upload-ftp-row" style="cursor: pointer;"><td><div class="icon"/></td><td style="width: 200px"><p style="width: inherit; word-wrap: break-word;">'+b.path+'</p></td><td style="white-space: nowrap;">'+a.bytesToString(b.size)+'</td><td style="white-space: nowrap;">'+b.ctime+"</td></tr>"},_templateTable:function(){return'<span style="whitespace: nowrap; float: left;">Available files: </span><span style="whitespace: nowrap; float: right;"><span class="upload-icon fa fa-file-text-o"/><span id="upload-ftp-number"/> <span class="upload-icon fa fa-hdd-o"/><span id="upload-ftp-disk"/></span><table class="grid" style="float: left;"><thead><tr><th><div id="selectAll" class="upload-icon-button fa fa-square-o" ></th><th>Name</th><th>Size</th><th>Created</th></tr></thead><tbody></tbody></table>'},_templateInfo:function(){return'<div class="upload-ftp-warning warningmessage">Your FTP directory does not contain any files.</div>'},_template:function(){return'<div class="upload-ftp"><div id="upload-ftp-wait" class="upload-ftp-wait fa fa-spinner fa-spin"/><div class="upload-ftp-help">This Galaxy server allows you to upload files via FTP. To upload some files, log in to the FTP server at <strong>'+this.app.options.ftp_upload_site+'</strong> using your Galaxy credentials (email address and password).</div><div id="upload-ftp-content"></div><div>'}})});
\ No newline at end of file
diff -r 693f01fe6a682a8b4934317a04c40c3919a3fbf6 -r b73cb7a7cdca3545d6347c5c4da24cfcc0841c2d static/scripts/packed/mvc/upload/upload-model.js
--- a/static/scripts/packed/mvc/upload/upload-model.js
+++ b/static/scripts/packed/mvc/upload/upload-model.js
@@ -1,1 +1,1 @@
-define([],function(){var e=Backbone.Model.extend({defaults:{extension:"auto",genome:"?",url_paste:"",status:"init",info:null,file_mode:"local",file_size:0,file_type:null,file_path:"",percentage:0,row:null,space_to_tabs:!1,to_posix_lines:!0}}),t=Backbone.Collection.extend({model:e});return{Model:e,Collection:t}});
\ No newline at end of file
+define([],function(){var b=Backbone.Model.extend({defaults:{extension:"auto",genome:"?",url_paste:"",status:"init",info:null,file_mode:"local",file_size:0,file_type:null,file_path:"",percentage:0,row:null,space_to_tabs:false,to_posix_lines:true}});var a=Backbone.Collection.extend({model:b});return{Model:b,Collection:a}});
\ No newline at end of file
diff -r 693f01fe6a682a8b4934317a04c40c3919a3fbf6 -r b73cb7a7cdca3545d6347c5c4da24cfcc0841c2d static/scripts/packed/mvc/upload/upload-row.js
--- a/static/scripts/packed/mvc/upload/upload-row.js
+++ b/static/scripts/packed/mvc/upload/upload-row.js
@@ -1,1 +1,1 @@
-define(["utils/utils","mvc/upload/upload-model","mvc/upload/upload-settings","mvc/ui/ui-popover","mvc/ui/ui-select"],function(e,t,n,r,i){return Backbone.View.extend({options:{padding:8},status_classes:{init:"upload-icon-button fa fa-trash-o",queued:"upload-icon fa fa-spinner fa-spin",running:"upload-icon fa fa-spinner fa-spin",success:"upload-icon-button fa fa-check",error:"upload-icon-button fa fa-exclamation-triangle"},settings:null,select_genome:null,select_extension:null,initialize:function(e,n){this.app=e;var s="Auto-detect",o=this;this.model=new t.Model(n),this.setElement(this._template(n));var u=this.$el;this.settings=new r.View({title:"Upload configuration",container:u.find("#settings"),placement:"bottom"}),this.select_genome=new i.View({css:"genome",onchange:function(){o.model.set("genome",o.select_genome.value())},data:o.app.list_genomes,container:u.find("#genome"),value:o.model.get("genome")}),this.model.set("genome",o.select_genome.value()),this.app.select_extension.value()!=="---"&&(this.default_ext=this.app.select_extension.value()),this.select_extension=new i.View({css:"extension",onchange:function(){o.model.set("extension",o.select_extension.value());if(o.select_extension.value()!==e.select_extension.value()){var t="---";e.select_extension.value(t)}},data:o.app.list_extensions,container:u.find("#extension"),value:o.default_ext}),this.model.set("extension",o.select_extension.value()),u.find("#symbol").on("click",function(){o._removeRow()}),u.find("#extension-info").on("click",function(e){o._showExtensionInfo()}).on("mousedown",function(e){e.preventDefault()}),u.find("#settings").on("click",function(e){o._showSettings()}).on("mousedown",function(e){e.preventDefault()}),u.find("#text-content").on("keyup",function(e){o.model.set("url_paste",$(e.target).val()),o.model.set("file_size",$(e.target).val().length)}),u.find("#space_to_tabs").on("change",function(e){o.model.set("space_to_tabs",$(e.target).prop("checked"))}),this.model.on("change:percentage",function(){o._refreshPercentage()}),this.model.on("change:status",function(){o._refreshStatus()}),this.model.on("change:info",function(){o._refreshInfo()}),this.model.on("change:genome",function(){o._refreshGenome()}),this.model.on("change:file_size",function(){o._refreshFileSize()}),this.model.on("remove",function(){o.remove()}),this.app.collection.on("reset",function(){o.remove()}),o.model.set("row",o)},render:function(){var t=this.model.get("file_name"),n=this.model.get("file_size"),r=this.model.get("file_mode"),i=this.$el;i.find("#title").html(t),i.find("#size").html(e.bytesToString(n)),i.find("#mode").removeClass().addClass("mode");if(r=="new"){var s=i.find("#text"),o=this.options.padding,u=i.width()-2*o,a=i.height()-o;s.css("width",u+"px"),s.css("top",a+"px"),i.height(a+s.height()+2*o),s.show(),i.find("#mode").addClass("fa fa-pencil")}r=="local"&&i.find("#mode").addClass("fa fa-laptop"),r=="ftp"&&i.find("#mode").addClass("fa fa-code-fork")},remove:function(){this.select_genome.remove(),this.select_extension.remove(),Backbone.View.prototype.remove.apply(this)},_refreshGenome:function(){var e=this.model.get("genome");this.select_genome.value(e)},_refreshInfo:function(){var e=this.model.get("info");e?this.$el.find("#info").html("<strong>Failed: </strong>"+e).show():this.$el.find("#info").hide()},_refreshPercentage:function(){var e=parseInt(this.model.get("percentage"));this.$el.find(".progress-bar").css({width:e+"%"}),e!=100?this.$el.find("#percentage").html(e+"%"):this.$el.find("#percentage").html("Adding to history...")},_refreshStatus:function(){var e=this.$el,t=this.model.get("status"),n=this.status_classes[t],r=this.$el.find("#symbol");r.removeClass(),r.addClass(n),t=="init"?(this.select_genome.enable(),this.select_extension.enable(),e.find("#text-content").attr("disabled",!1),e.find("#space_to_tabs").attr("disabled",!1)):(this.select_genome.disable(),this.select_extension.disable(),e.find("#text-content").attr("disabled",!0),e.find("#space_to_tabs").attr("disabled",!0)),t=="success"&&(e.addClass("success"),e.find("#percentage").html("100%")),t=="error"&&(e.addClass("danger"),e.find(".progress").remove())},_refreshFileSize:function(){var t=this.model.get("file_size");this.$el.find("#size").html(e.bytesToString(t))},_removeRow:function(){var e=this.model.get("status");(e=="init"||e=="success"||e=="error")&&this.app.collection.remove(this.model)},_showExtensionInfo:function(){var e=$(this.el).find("#extension-info"),t=this.model.get("extension"),n=this.select_extension.text(),i=_.findWhere(this.app.list_extensions,{id:t});this.extension_popup||(this.extension_popup=new r.View({placement:"bottom",container:e})),this.extension_popup.visible?this.extension_popup.hide():(this.extension_popup.title(n),this.extension_popup.empty(),this.extension_popup.append(this._templateDescription(i)),this.extension_popup.show())},_showSettings:function(){this.settings.visible?this.settings.hide():(this.settings.empty(),this.settings.append((new n(this)).$el),this.settings.show())},_templateDescription:function(e){if(e.description){var t=e.description;return e.description_url&&(t+=' (<a href="'+e.description_url+'" target="_blank">read more</a>)'),t}return"There is no description available for this file extension."},_template:function(e){return'<tr id="upload-item-'+e.id+'" class="upload-item">'+"<td>"+'<div style="position: relative;">'+'<div id="mode"></div>'+'<div id="title" class="title"></div>'+'<div id="text" class="text">'+'<div class="text-info">You can tell Galaxy to download data from web by entering URL in this box (one per line). You can also directly paste the contents of a file.</div>'+'<textarea id="text-content" class="text-content form-control"></textarea>'+"</div>"+"</div>"+"</td>"+"<td>"+'<div id="size" class="size"></div>'+"</td>"+"<td>"+'<div id="extension" class="extension" style="float: left;"/>  '+'<div id="extension-info" class="upload-icon-button fa fa-search"/>'+"</td>"+"<td>"+'<div id="genome" class="genome" />'+"</td>"+'<td><div id="settings" class="upload-icon-button fa fa-gear"></div>'+"<td>"+'<div id="info" class="info">'+'<div class="progress">'+'<div class="progress-bar progress-bar-success"></div>'+'<div id="percentage" class="percentage">0%</div>'+"</div>"+"</div>"+"</td>"+"<td>"+'<div id="symbol" class="'+this.status_classes.init+'"></div>'+"</td>"+"</tr>"}})});
\ No newline at end of file
+define(["utils/utils","mvc/upload/upload-model","mvc/upload/upload-settings","mvc/ui/ui-popover","mvc/ui/ui-select"],function(d,b,a,c,e){return Backbone.View.extend({options:{padding:8},status_classes:{init:"upload-icon-button fa fa-trash-o",queued:"upload-icon fa fa-spinner fa-spin",running:"upload-icon fa fa-spinner fa-spin",success:"upload-icon-button fa fa-check",error:"upload-icon-button fa fa-exclamation-triangle"},settings:null,select_genome:null,select_extension:null,initialize:function(j,h){this.app=j;var g="Auto-detect";var f=this;this.model=new b.Model(h);this.setElement(this._template(h));var i=this.$el;this.settings=new c.View({title:"Upload configuration",container:i.find("#settings"),placement:"bottom"});this.select_genome=new e.View({css:"genome",onchange:function(){f.model.set("genome",f.select_genome.value())},data:f.app.list_genomes,container:i.find("#genome"),value:f.model.get("genome")});this.model.set("genome",f.select_genome.value());if(!(this.app.select_extension.value()==="---")){this.default_ext=this.app.select_extension.value()}this.select_extension=new e.View({css:"extension",onchange:function(){f.model.set("extension",f.select_extension.value());if(!(f.select_extension.value()===j.select_extension.value())){var k="---";j.select_extension.value(k)}},data:f.app.list_extensions,container:i.find("#extension"),value:f.default_ext});this.model.set("extension",f.select_extension.value());i.find("#symbol").on("click",function(){f._removeRow()});i.find("#extension-info").on("click",function(k){f._showExtensionInfo()}).on("mousedown",function(k){k.preventDefault()});i.find("#settings").on("click",function(k){f._showSettings()}).on("mousedown",function(k){k.preventDefault()});i.find("#text-content").on("keyup",function(k){f.model.set("url_paste",$(k.target).val());f.model.set("file_size",$(k.target).val().length)});i.find("#space_to_tabs").on("change",function(k){f.model.set("space_to_tabs",$(k.target).prop("checked"))});this.model.on("change:percentage",function(){f._refreshPercentage()});this.model.on("change:status",function(){f._refreshStatus()});this.model.on("change:info",function(){f._refreshInfo()});this.model.on("change:genome",function(){f._refreshGenome()});this.model.on("change:file_size",function(){f._refreshFileSize()});this.model.on("remove",function(){f.remove()});this.app.collection.on("reset",function(){f.remove()});f.model.set("row",f)},render:function(){var m=this.model.get("file_name");var g=this.model.get("file_size");var j=this.model.get("file_mode");var i=this.$el;i.find("#title").html(m);i.find("#size").html(d.bytesToString(g));i.find("#mode").removeClass().addClass("mode");if(j=="new"){var l=i.find("#text");var k=this.options.padding;var h=i.width()-2*k;var f=i.height()-k;l.css("width",h+"px");l.css("top",f+"px");i.height(f+l.height()+2*k);l.show();i.find("#mode").addClass("fa fa-pencil")}if(j=="local"){i.find("#mode").addClass("fa fa-laptop")}if(j=="ftp"){i.find("#mode").addClass("fa fa-code-fork")}},remove:function(){this.select_genome.remove();this.select_extension.remove();Backbone.View.prototype.remove.apply(this)},_refreshGenome:function(){var f=this.model.get("genome");this.select_genome.value(f)},_refreshInfo:function(){var f=this.model.get("info");if(f){this.$el.find("#info").html("<strong>Failed: </strong>"+f).show()}else{this.$el.find("#info").hide()}},_refreshPercentage:function(){var f=parseInt(this.model.get("percentage"));this.$el.find(".progress-bar").css({width:f+"%"});if(f!=100){this.$el.find("#percentage").html(f+"%")}else{this.$el.find("#percentage").html("Adding to history...")}},_refreshStatus:function(){var g=this.$el;var f=this.model.get("status");var i=this.status_classes[f];var h=this.$el.find("#symbol");h.removeClass();h.addClass(i);if(f=="init"){this.select_genome.enable();this.select_extension.enable();g.find("#text-content").attr("disabled",false);g.find("#space_to_tabs").attr("disabled",false)}else{this.select_genome.disable();this.select_extension.disable();g.find("#text-content").attr("disabled",true);g.find("#space_to_tabs").attr("disabled",true)}if(f=="success"){g.addClass("success");g.find("#percentage").html("100%")}if(f=="error"){g.addClass("danger");g.find(".progress").remove()}},_refreshFileSize:function(){var f=this.model.get("file_size");this.$el.find("#size").html(d.bytesToString(f))},_removeRow:function(){var f=this.model.get("status");if(f=="init"||f=="success"||f=="error"){this.app.collection.remove(this.model)}},_showExtensionInfo:function(){var f=$(this.el).find("#extension-info");var i=this.model.get("extension");var h=this.select_extension.text();var g=_.findWhere(this.app.list_extensions,{id:i});if(!this.extension_popup){this.extension_popup=new c.View({placement:"bottom",container:f})}if(!this.extension_popup.visible){this.extension_popup.title(h);this.extension_popup.empty();this.extension_popup.append(this._templateDescription(g));this.extension_popup.show()}else{this.extension_popup.hide()}},_showSettings:function(){if(!this.settings.visible){this.settings.empty();this.settings.append((new a(this)).$el);this.settings.show()}else{this.settings.hide()}},_templateDescription:function(g){if(g.description){var f=g.description;if(g.description_url){f+=' (<a href="'+g.description_url+'" target="_blank">read more</a>)'}return f}else{return"There is no description available for this file extension."}},_template:function(f){return'<tr id="upload-item-'+f.id+'" class="upload-item"><td><div style="position: relative;"><div id="mode"></div><div id="title" class="title"></div><div id="text" class="text"><div class="text-info">You can tell Galaxy to download data from web by entering URL in this box (one per line). You can also directly paste the contents of a file.</div><textarea id="text-content" class="text-content form-control"></textarea></div></div></td><td><div id="size" class="size"></div></td><td><div id="extension" class="extension" style="float: left;"/>  <div id="extension-info" class="upload-icon-button fa fa-search"/></td><td><div id="genome" class="genome" /></td><td><div id="settings" class="upload-icon-button fa fa-gear"></div><td><div id="info" class="info"><div class="progress"><div class="progress-bar progress-bar-success"></div><div id="percentage" class="percentage">0%</div></div></div></td><td><div id="symbol" class="'+this.status_classes.init+'"></div></td></tr>'}})});
\ No newline at end of file
diff -r 693f01fe6a682a8b4934317a04c40c3919a3fbf6 -r b73cb7a7cdca3545d6347c5c4da24cfcc0841c2d static/scripts/packed/mvc/upload/upload-view.js
--- a/static/scripts/packed/mvc/upload/upload-view.js
+++ b/static/scripts/packed/mvc/upload/upload-view.js
@@ -1,1 +1,1 @@
-define(["utils/utils","mvc/upload/upload-button","mvc/upload/upload-model","mvc/upload/upload-row","mvc/upload/upload-ftp","mvc/ui/ui-popover","mvc/ui/ui-modal","utils/uploadbox"],function(f,e,c,b,g,d,a){return Backbone.View.extend({options:{nginx_upload_path:""},modal:null,ui_button:null,uploadbox:null,current_history:null,upload_size:0,list_extensions:[],list_genomes:[],auto:{id:"auto",text:"Auto-detect",description:"This system will try to detect the file type automatically. If your file is not detected properly as one of the known formats, it most likely means that it has some format problems (e.g., different number of columns on different rows). You can still coerce the system to set your data to the format you think it should be. You can also upload compressed files, which will automatically be decompressed."},collection:new c.Collection(),ftp:null,counter:{announce:0,success:0,error:0,running:0,reset:function(){this.announce=this.success=this.error=this.running=0}},initialize:function(i){var h=this;if(i){this.options=_.defaults(i,this.options)}this.ui_button=new e.Model({icon:"fa-upload",tooltip:"Download from URL or upload files from disk",label:"Load Data",onclick:function(j){if(j){j.preventDefault();h.show()}},onunload:function(){if(h.counter.running>0){return"Several uploads are still processing."}}});$(".with-upload-button").append((new e.View(this.ui_button)).$el);var h=this;f.get({url:galaxy_config.root+"api/datatypes?extension_only=False",success:function(j){for(key in j){h.list_extensions.push({id:j[key].extension,text:j[key].extension,description:j[key].description,description_url:j[key].description_url})}h.list_extensions.sort(function(l,k){return l.id>k.id?1:l.id<k.id?-1:0});if(!h.options.datatypes_disable_auto){h.list_extensions.unshift(h.auto)}}});f.get({url:galaxy_config.root+"api/genomes",success:function(j){for(key in j){h.list_genomes.push({id:j[key][1],text:j[key][0]})}h.list_genomes.sort(function(l,k){return l.id>k.id?1:l.id<k.id?-1:0})}});this.collection.on("remove",function(j){h._eventRemove(j)});this.collection.on("change:genome",function(k){var j=k.get("genome");h.collection.each(function(l){if(l.get("status")=="init"&&l.get("genome")=="?"){l.set("genome",j)}})})},show:function(){var h=this;if(!Galaxy.currHistoryPanel||!Galaxy.currHistoryPanel.model){window.setTimeout(function(){h.show()},500);return}if(!this.modal){var h=this;this.modal=new a.View({title:"Download data directly from web or upload files from your disk",body:this._template("upload-box","upload-info"),buttons:{"Choose local file":function(){h.uploadbox.select()},"Choose FTP file":function(){h._eventFtp()},"Paste/Fetch data":function(){h._eventCreate()},Start:function(){h._eventStart()},Pause:function(){h._eventStop()},Reset:function(){h._eventReset()},Close:function(){h.modal.hide()},},height:"400",width:"900",closing_events:true});this.setElement("#upload-box");var h=this;this.uploadbox=this.$el.uploadbox({announce:function(j,k,l){h._eventAnnounce(j,k,l)},initialize:function(j,k,l){return h._eventInitialize(j,k,l)},progress:function(j,k,l){h._eventProgress(j,k,l)},success:function(j,k,l){h._eventSuccess(j,k,l)},error:function(j,k,l){h._eventError(j,k,l)},complete:function(){h._eventComplete()}});var i=this.modal.getButton("Choose FTP file");this.ftp=new d.View({title:"FTP files",container:i})}this.modal.show();this._updateUser();this._updateScreen()},_eventRemove:function(i){var h=i.get("status");if(h=="success"){this.counter.success--}else{if(h=="error"){this.counter.error--}else{this.counter.announce--}}this._updateScreen();this.uploadbox.remove(i.id)},_eventAnnounce:function(h,i,k){this.counter.announce++;this._updateScreen();var j=new b(this,{id:h,file_name:i.name,file_size:i.size,file_mode:i.mode,file_path:i.path});this.collection.add(j.model);$(this.el).find("tbody:first").append(j.$el);j.render()},_eventInitialize:function(m,j,s){var k=this.collection.get(m);k.set("status","running");var o=k.get("file_name");var n=k.get("file_path");var h=k.get("file_mode");var p=k.get("extension");var r=k.get("genome");var q=k.get("url_paste");var l=k.get("space_to_tabs");var i=k.get("to_posix_lines");if(!q&&!(j.size>0)){return null}this.uploadbox.configure({url:this.options.nginx_upload_path});if(h=="local"){this.uploadbox.configure({paramname:"files_0|file_data"})}else{this.uploadbox.configure({paramname:null})}tool_input={};if(h=="new"){tool_input["files_0|url_paste"]=q}if(h=="ftp"){tool_input["files_0|ftp_files"]=n}tool_input.dbkey=r;tool_input.file_type=p;tool_input["files_0|type"]="upload_dataset";tool_input["files_0|space_to_tab"]=l&&"Yes"||null;tool_input["files_0|to_posix_lines"]=i&&"Yes"||null;data={};data.history_id=this.current_history;data.tool_id="upload1";data.inputs=JSON.stringify(tool_input);return data},_eventProgress:function(i,j,h){var k=this.collection.get(i);k.set("percentage",h);this.ui_button.set("percentage",this._upload_percentage(h,j.size))},_eventSuccess:function(i,j,l){var k=this.collection.get(i);k.set("percentage",100);k.set("status","success");var h=k.get("file_size");this.ui_button.set("percentage",this._upload_percentage(100,h));this.upload_completed+=h*100;this.counter.announce--;this.counter.success++;this._updateScreen();Galaxy.currHistoryPanel.refreshContents()},_eventError:function(h,i,k){var j=this.collection.get(h);j.set("percentage",100);j.set("status","error");j.set("info",k);this.ui_button.set("percentage",this._upload_percentage(100,i.size));this.ui_button.set("status","danger");this.upload_completed+=i.size*100;this.counter.announce--;this.counter.error++;this._updateScreen()},_eventComplete:function(){this.collection.each(function(h){if(h.get("status")=="queued"){h.set("status","init")}});this.counter.running=0;this._updateScreen()},_eventFtp:function(){if(!this.ftp.visible){this.ftp.empty();this.ftp.append((new g(this)).$el);this.ftp.show()}else{this.ftp.hide()}},_eventCreate:function(){this.uploadbox.add([{name:"New File",size:0,mode:"new"}])},_eventStart:function(){if(this.counter.announce==0||this.counter.running>0){return}var h=this;this.upload_size=0;this.upload_completed=0;this.collection.each(function(i){if(i.get("status")=="init"){i.set("status","queued");h.upload_size+=i.get("file_size")}});this.ui_button.set("percentage",0);this.ui_button.set("status","success");this.counter.running=this.counter.announce;this._updateScreen();this.uploadbox.start()},_eventStop:function(){if(this.counter.running==0){return}this.ui_button.set("status","info");this.uploadbox.stop();$("#upload-info").html("Queue will pause after completing the current file...")},_eventReset:function(){if(this.counter.running==0){this.collection.reset();this.counter.reset();this._updateScreen();this.uploadbox.reset();this.ui_button.set("percentage",0)}},_updateUser:function(){this.current_user=Galaxy.currUser.get("id");this.current_history=null;if(this.current_user){this.current_history=Galaxy.currHistoryPanel.model.get("id")}},_updateScreen:function(){if(this.counter.announce==0){if(this.uploadbox.compatible()){message="You can Drag & Drop files into this box."}else{message="Unfortunately, your browser does not support multiple file uploads or drag&drop.<br>Some supported browsers are: Firefox 4+, Chrome 7+, IE 10+, Opera 12+ or Safari 6+."}}else{if(this.counter.running==0){message="You added "+this.counter.announce+" file(s) to the queue. Add more files or click 'Start' to proceed."}else{message="Please wait..."+this.counter.announce+" out of "+this.counter.running+" remaining."}}$("#upload-info").html(message);if(this.counter.running==0&&this.counter.announce+this.counter.success+this.counter.error>0){this.modal.enableButton("Reset")}else{this.modal.disableButton("Reset")}if(this.counter.running==0&&this.counter.announce>0){this.modal.enableButton("Start")}else{this.modal.disableButton("Start")}if(this.counter.running>0){this.modal.enableButton("Pause")}else{this.modal.disableButton("Pause")}if(this.counter.running==0){this.modal.enableButton("Choose local file");this.modal.enableButton("Choose FTP file");this.modal.enableButton("Paste/Fetch data")}else{this.modal.disableButton("Choose local file");this.modal.disableButton("Choose FTP file");this.modal.disableButton("Paste/Fetch data")}if(this.current_user&&this.options.ftp_upload_dir&&this.options.ftp_upload_site){this.modal.showButton("Choose FTP file")}else{this.modal.hideButton("Choose FTP file")}if(this.counter.announce+this.counter.success+this.counter.error>0){$(this.el).find("#upload-table").show()}else{$(this.el).find("#upload-table").hide()}},_upload_percentage:function(h,i){return(this.upload_completed+(h*i))/this.upload_size},_template:function(i,h){return'<div id="'+i+'" class="upload-box"><table id="upload-table" class="table table-striped" style="display: none;"><thead><tr><th>Name</th><th>Size</th><th>Type</th><th>Genome</th><th>Settings</th><th>Status</th><th></th></tr></thead><tbody></tbody></table></div><h6 id="'+h+'" class="upload-info"></h6>'}})});
\ No newline at end of file
+define(["utils/utils","mvc/upload/upload-button","mvc/upload/upload-model","mvc/upload/upload-row","mvc/upload/upload-ftp","mvc/ui/ui-popover","mvc/ui/ui-modal","mvc/ui/ui-select","utils/uploadbox"],function(f,e,c,b,g,d,a,h){return Backbone.View.extend({options:{nginx_upload_path:""},modal:null,ui_button:null,uploadbox:null,current_history:null,select_extension:null,upload_size:0,list_extensions:[],list_genomes:[],auto:{id:"auto",text:"Auto-detect",description:"This system will try to detect the file type automatically. If your file is not detected properly as one of the known formats, it most likely means that it has some format problems (e.g., different number of columns on different rows). You can still coerce the system to set your data to the format you think it should be. You can also upload compressed files, which will automatically be decompressed."},collection:new c.Collection(),ftp:null,counter:{announce:0,success:0,error:0,running:0,reset:function(){this.announce=this.success=this.error=this.running=0}},initialize:function(k){var j=this;if(k){this.options=_.defaults(k,this.options)}this.ui_button=new e.Model({icon:"fa-upload",tooltip:"Download from URL or upload files from disk",label:"Load Data",onclick:function(l){if(l){l.preventDefault();j.show()}},onunload:function(){if(j.counter.running>0){return"Several uploads are still processing."}}});$(".with-upload-button").append((new e.View(this.ui_button)).$el);var j=this;f.get({url:galaxy_config.root+"api/datatypes?extension_only=False",success:function(l){for(key in l){j.list_extensions.push({id:l[key].extension,text:l[key].extension,description:l[key].description,description_url:l[key].description_url})}j.list_extensions.sort(function(n,m){return n.id>m.id?1:n.id<m.id?-1:0});j.list_extensions.push({id:"---",text:"---",description:"",description_url:""});if(!j.options.datatypes_disable_auto){j.list_extensions.unshift(j.auto)}}});f.get({url:galaxy_config.root+"api/genomes",success:function(l){for(key in l){j.list_genomes.push({id:l[key][1],text:l[key][0]})}j.list_genomes.sort(function(n,m){return n.id>m.id?1:n.id<m.id?-1:0})}});this.collection.on("remove",function(l){j._eventRemove(l)});this.collection.on("change:genome",function(m){var l=m.get("genome");j.collection.each(function(n){if(n.get("status")=="init"&&n.get("genome")=="?"){n.set("genome",l)}})})},show:function(){var j=this;if(!Galaxy.currHistoryPanel||!Galaxy.currHistoryPanel.model){window.setTimeout(function(){j.show()},500);return}if(!this.modal){var j=this;this.modal=new a.View({title:"Download data directly from web or upload files from your disk",body:this._template("upload-box","upload-info"),buttons:{"Choose local file":function(){j.uploadbox.select()},"Choose FTP file":function(){j._eventFtp()},"Paste/Fetch data":function(){j._eventCreate()},Start:function(){j._eventStart()},Pause:function(){j._eventStop()},Reset:function(){j._eventReset()},Close:function(){j.modal.hide()},},height:"400",width:"900",closing_events:true});this.setElement("#upload-box");var j=this;this.uploadbox=this.$el.uploadbox({announce:function(l,m,n){j._eventAnnounce(l,m,n)},initialize:function(l,m,n){return j._eventInitialize(l,m,n)},progress:function(l,m,n){j._eventProgress(l,m,n)},success:function(l,m,n){j._eventSuccess(l,m,n)},error:function(l,m,n){j._eventError(l,m,n)},complete:function(){j._eventComplete()}});var k=this.modal.getButton("Choose FTP file");this.ftp=new d.View({title:"FTP files",container:k});this.select_extension=new h.View({css:"extension",onchange:function(){var m=j.select_extension.value();var l=j.collection.models.length;if(!(m==="---")){for(i=0;i<l;i++){j.collection.models[i].attributes.row.select_extension.value(m)}}},data:j.list_extensions,container:j.$el.parents().find("#extension"),value:j.list_extensions[0]});j.$el.parents().find("#extension-info_out").on("click",function(l){j._showExtensionInfo()}).on("mousedown",function(l){l.preventDefault()})}this.modal.show();this._updateUser();this._updateScreen()},_showExtensionInfo:function(){var j=this;var k=$(this.el).parents().find("#extension-info_out");var n=j.select_extension.value();var m=this.select_extension.text();var l=_.findWhere(j.list_extensions,{id:n});if(!this.extension_popup){this.extension_popup=new d.View({placement:"bottom",container:k})}if(!this.extension_popup.visible){this.extension_popup.title(m);this.extension_popup.empty();this.extension_popup.append(this._templateDescription(l));this.extension_popup.show()}else{this.extension_popup.hide()}},_showSettings:function(){if(!this.settings.visible){this.settings.empty();this.settings.append((new UploadSettings(this)).$el);this.settings.show()}else{this.settings.hide()}},_templateDescription:function(k){if(k.description){var j=k.description;if(k.description_url){j+=' (<a href="'+k.description_url+'" target="_blank">read more</a>)'}return j}else{return"There is no description available for this file extension."}},_eventRemove:function(k){var j=k.get("status");if(j=="success"){this.counter.success--}else{if(j=="error"){this.counter.error--}else{this.counter.announce--}}this._updateScreen();this.uploadbox.remove(k.id)},_eventAnnounce:function(j,k,m){this.counter.announce++;this._updateScreen();var l=new b(this,{id:j,file_name:k.name,file_size:k.size,file_mode:k.mode,file_path:k.path});this.collection.add(l.model);$(this.el).find("tbody:first").append(l.$el);l.render()},_eventInitialize:function(o,l,u){var m=this.collection.get(o);m.set("status","running");var q=m.get("file_name");var p=m.get("file_path");var j=m.get("file_mode");var r=m.get("extension");var t=m.get("genome");var s=m.get("url_paste");var n=m.get("space_to_tabs");var k=m.get("to_posix_lines");if(!s&&!(l.size>0)){return null}this.uploadbox.configure({url:this.options.nginx_upload_path});if(j=="local"){this.uploadbox.configure({paramname:"files_0|file_data"})}else{this.uploadbox.configure({paramname:null})}tool_input={};if(j=="new"){tool_input["files_0|url_paste"]=s}if(j=="ftp"){tool_input["files_0|ftp_files"]=p}tool_input.dbkey=t;tool_input.file_type=r;tool_input["files_0|type"]="upload_dataset";tool_input["files_0|space_to_tab"]=n&&"Yes"||null;tool_input["files_0|to_posix_lines"]=k&&"Yes"||null;data={};data.history_id=this.current_history;data.tool_id="upload1";data.inputs=JSON.stringify(tool_input);return data},_eventProgress:function(k,l,j){var m=this.collection.get(k);m.set("percentage",j);this.ui_button.set("percentage",this._upload_percentage(j,l.size))},_eventSuccess:function(k,l,n){var m=this.collection.get(k);m.set("percentage",100);m.set("status","success");var j=m.get("file_size");this.ui_button.set("percentage",this._upload_percentage(100,j));this.upload_completed+=j*100;this.counter.announce--;this.counter.success++;this._updateScreen();Galaxy.currHistoryPanel.refreshContents()},_eventError:function(j,k,m){var l=this.collection.get(j);l.set("percentage",100);l.set("status","error");l.set("info",m);this.ui_button.set("percentage",this._upload_percentage(100,k.size));this.ui_button.set("status","danger");this.upload_completed+=k.size*100;this.counter.announce--;this.counter.error++;this._updateScreen()},_eventComplete:function(){this.collection.each(function(j){if(j.get("status")=="queued"){j.set("status","init")}});this.counter.running=0;this._updateScreen()},_eventFtp:function(){if(!this.ftp.visible){this.ftp.empty();this.ftp.append((new g(this)).$el);this.ftp.show()}else{this.ftp.hide()}},_eventCreate:function(){this.uploadbox.add([{name:"New File",size:0,mode:"new"}])},_eventStart:function(){if(this.counter.announce==0||this.counter.running>0){return}var j=this;this.upload_size=0;this.upload_completed=0;this.collection.each(function(k){if(k.get("status")=="init"){k.set("status","queued");j.upload_size+=k.get("file_size")}});this.ui_button.set("percentage",0);this.ui_button.set("status","success");this.counter.running=this.counter.announce;this._updateScreen();this.uploadbox.start()},_eventStop:function(){if(this.counter.running==0){return}this.ui_button.set("status","info");this.uploadbox.stop();$("#upload-info").html("Queue will pause after completing the current file...")},_eventReset:function(){if(this.counter.running==0){this.collection.reset();this.counter.reset();this._updateScreen();this.uploadbox.reset();this.select_extension.value(this.list_extensions[0]);this.ui_button.set("percentage",0)}},_updateUser:function(){this.current_user=Galaxy.currUser.get("id");this.current_history=null;if(this.current_user){this.current_history=Galaxy.currHistoryPanel.model.get("id")}},_updateScreen:function(){if(this.counter.announce==0){if(this.uploadbox.compatible()){message="You can Drag & Drop files into this box."}else{message="Unfortunately, your browser does not support multiple file uploads or drag&drop.<br>Some supported browsers are: Firefox 4+, Chrome 7+, IE 10+, Opera 12+ or Safari 6+."}}else{if(this.counter.running==0){message="You added "+this.counter.announce+" file(s) to the queue. Add more files or click 'Start' to proceed."}else{message="Please wait..."+this.counter.announce+" out of "+this.counter.running+" remaining."}}$("#upload-info").html(message);if(this.counter.running==0&&this.counter.announce+this.counter.success+this.counter.error>0){this.modal.enableButton("Reset")}else{this.modal.disableButton("Reset")}if(this.counter.running==0&&this.counter.announce>0){this.modal.enableButton("Start")}else{this.modal.disableButton("Start")}if(this.counter.running>0){this.modal.enableButton("Pause")}else{this.modal.disableButton("Pause")}if(this.counter.running==0){this.modal.enableButton("Choose local file");this.modal.enableButton("Choose FTP file");this.modal.enableButton("Paste/Fetch data")}else{this.modal.disableButton("Choose local file");this.modal.disableButton("Choose FTP file");this.modal.disableButton("Paste/Fetch data")}if(this.current_user&&this.options.ftp_upload_dir&&this.options.ftp_upload_site){this.modal.showButton("Choose FTP file")}else{this.modal.hideButton("Choose FTP file")}if(this.counter.announce+this.counter.success+this.counter.error>0){$(this.el).find("#upload-table").show()}else{$(this.el).find("#upload-table").hide()}},_upload_percentage:function(j,k){return(this.upload_completed+(j*k))/this.upload_size},_template:function(k,j){return'<div id="uploadhead" class="uploadhead"><span class="fftext">"Set All" Types:  </span><span id="extension" class="extension"/>  <span id="extension-info_out" class="upload-icon-button fa fa-search"/></div><div id="'+k+'" class="upload-box"><table id="upload-table" class="table table-striped" style="display: none;"><thead><tr><th>Name</th><th>Size</th><th>Type</th><th>Genome</th><th>Settings</th><th>Status</th><th></th></tr></thead><tbody></tbody></table></div><div class="uploadfoot"><h6 id="'+j+'" class="upload-info"></h6></div>'}})});
\ No newline at end of file
https://bitbucket.org/galaxy/galaxy-central/commits/4da8605f69c8/
Changeset: 4da8605f69c8
Branch: upload-UI-enhancement
User: dannon
Date: 2015-01-23 16:12:35+00:00
Summary: Branch prune.
Affected #: 0 files
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
2 new commits in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/92258dc7b1e3/
Changeset: 92258dc7b1e3
User: dannon
Date: 2015-01-23 13:13:45+00:00
Summary: Add missing parameter in provenance controller.
Affected #: 1 file
diff -r fc8e37c905ef95395f3aeb2ea24f52d1a622015f -r 92258dc7b1e37eb21ad648724ffd1f3026fb59ab lib/galaxy/webapps/galaxy/api/provenance.py
--- a/lib/galaxy/webapps/galaxy/api/provenance.py
+++ b/lib/galaxy/webapps/galaxy/api/provenance.py
@@ -41,7 +41,7 @@
def _get_provenance( self, trans, item_class_name, item_id, follow=True ):
provenance_item = self.get_object( trans, item_id, item_class_name, check_ownership=False, check_accessible=False)
if item_class_name == "HistoryDatasetAssociation":
- self.hda_manager.error_unless_accessible( trans, provenance_item )
+ self.hda_manager.error_unless_accessible( trans, provenance_item, trans.user )
else:
self.security_check( trans, provenance_item, check_accessible=True )
out = self._get_record( trans, provenance_item, follow )
https://bitbucket.org/galaxy/galaxy-central/commits/58e5b7165b1a/
Changeset: 58e5b7165b1a
User: dannon
Date: 2015-01-23 13:14:02+00:00
Summary: Merge.
Affected #: 1 file
diff -r 92258dc7b1e37eb21ad648724ffd1f3026fb59ab -r 58e5b7165b1ad59d0547bf287e24988a3271449e templates/galaxy_client_app.mako
--- a/templates/galaxy_client_app.mako
+++ b/templates/galaxy_client_app.mako
@@ -83,7 +83,7 @@
users_api_controller = trans.webapp.api_controllers[ 'users' ]
tags_used = []
for tag in users_api_controller.get_user_tags_used( trans, user=trans.user ):
- tag = tag | h
+ tag = escape( tag )
if tag:
tags_used.append( tag )
user_dict[ 'tags_used' ] = tags_used
@@ -106,6 +106,8 @@
except Exception, exc:
pass
+ #TODO: no logging available?
+ #log.exception( exc )
return user_dict
%>
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
commit/galaxy-central: carlfeberhard: Fix bootstrapped user data to use proper escaping (crap...) and allow history/hda tag to autocomplete again
by commits-noreply@bitbucket.org 22 Jan '15
by commits-noreply@bitbucket.org 22 Jan '15
22 Jan '15
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/e5969ffd8f6b/
Changeset: e5969ffd8f6b
User: carlfeberhard
Date: 2015-01-22 23:55:37+00:00
Summary: Fix bootstrapped user data to use proper escaping (crap...) and allow history/hda tag to autocomplete again
Affected #: 1 file
diff -r fc8e37c905ef95395f3aeb2ea24f52d1a622015f -r e5969ffd8f6b548e064ee57d740e06f03ce7efc2 templates/galaxy_client_app.mako
--- a/templates/galaxy_client_app.mako
+++ b/templates/galaxy_client_app.mako
@@ -83,7 +83,7 @@
users_api_controller = trans.webapp.api_controllers[ 'users' ]
tags_used = []
for tag in users_api_controller.get_user_tags_used( trans, user=trans.user ):
- tag = tag | h
+ tag = escape( tag )
if tag:
tags_used.append( tag )
user_dict[ 'tags_used' ] = tags_used
@@ -106,6 +106,8 @@
except Exception, exc:
pass
+ #TODO: no logging available?
+ #log.exception( exc )
return user_dict
%>
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
commit/galaxy-central: dannon: Resolve scope issues in visualization controller, add missing imports and organize.
by commits-noreply@bitbucket.org 22 Jan '15
by commits-noreply@bitbucket.org 22 Jan '15
22 Jan '15
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/fc8e37c905ef/
Changeset: fc8e37c905ef
User: dannon
Date: 2015-01-22 23:24:25+00:00
Summary: Resolve scope issues in visualization controller, add missing imports and organize.
Affected #: 1 file
diff -r 0bedbfc59efdf459b62a70ee9da69449b1f12d45 -r fc8e37c905ef95395f3aeb2ea24f52d1a622015f lib/galaxy/webapps/galaxy/controllers/visualization.py
--- a/lib/galaxy/webapps/galaxy/controllers/visualization.py
+++ b/lib/galaxy/webapps/galaxy/controllers/visualization.py
@@ -1,26 +1,25 @@
from __future__ import absolute_import
-import os
import copy
from sqlalchemy import desc, or_, and_
from paste.httpexceptions import HTTPNotFound, HTTPBadRequest
+from galaxy import managers
from galaxy import model, web
-from galaxy import managers
-from galaxy.model.item_attrs import UsesAnnotations, UsesItemRatings
-from galaxy.web.base.controller import BaseUIController, SharableMixin, UsesVisualizationMixin
-from galaxy.web.framework.helpers import time_ago, grids, escape
from galaxy import util
from galaxy.datatypes.interval import Bed
+from galaxy.model.item_attrs import UsesAnnotations, UsesItemRatings
from galaxy.util.json import loads
from galaxy.util.sanitize_html import sanitize_html
-from galaxy.util import bunch
-from galaxy import util
from galaxy.visualization import registry
+from galaxy.visualization.data_providers.phyloviz import PhylovizDataProvider
+from galaxy.visualization.data_providers.genome import RawBedDataProvider
from galaxy.visualization.genomes import decode_dbkey
-from galaxy.visualization.data_providers.phyloviz import PhylovizDataProvider
from galaxy.visualization.genomes import GenomeRegion
+from galaxy.web import error
+from galaxy.web.base.controller import BaseUIController, SharableMixin, UsesVisualizationMixin
+from galaxy.web.framework.helpers import escape, grids, time_ago
from .library import LibraryListGrid
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
2 new commits in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/501f5553f247/
Changeset: 501f5553f247
User: dannon
Date: 2015-01-22 23:18:14+00:00
Summary: misc cleanup, pep8 in page controller
Affected #: 1 file
diff -r 8ad3076155100bbc841efca1b4e4c91376e11568 -r 501f5553f24775044882d47f7e481f114eb092bb lib/galaxy/webapps/galaxy/controllers/page.py
--- a/lib/galaxy/webapps/galaxy/controllers/page.py
+++ b/lib/galaxy/webapps/galaxy/controllers/page.py
@@ -10,12 +10,14 @@
from galaxy.util.json import loads
from markupsafe import escape
+
def format_bool( b ):
if b:
return "yes"
else:
return ""
+
class PageListGrid( grids.Grid ):
# Custom column.
class URLColumn( grids.PublicURLColumn ):
@@ -26,7 +28,7 @@
use_panels = True
title = "Pages"
model_class = model.Page
- default_filter = { "published" : "All", "tags" : "All", "title" : "All", "sharing" : "All" }
+ default_filter = { "published": "All", "tags": "All", "title": "All", "sharing": "All" }
default_sort_key = "-update_time"
columns = [
grids.TextColumn( "Title", key="title", attach_popup=True, filterable="advanced" ),
@@ -37,12 +39,11 @@
grids.GridColumn( "Created", key="create_time", format=time_ago ),
grids.GridColumn( "Last Updated", key="update_time", format=time_ago ),
]
- columns.append(
- grids.MulticolFilterColumn(
- "Search",
- cols_to_filter=[ columns[0], columns[2] ],
- key="free-text-search", visible=False, filterable="standard" )
- )
+ columns.append( grids.MulticolFilterColumn(
+ "Search",
+ cols_to_filter=[ columns[0], columns[2] ],
+ key="free-text-search", visible=False, filterable="standard" )
+ )
global_actions = [
grids.GridAction( "Add new page", dict( action='create' ) )
]
@@ -53,9 +54,11 @@
grids.GridOperation( "Share or Publish", allow_multiple=False, condition=( lambda item: not item.deleted ), async_compatible=False ),
grids.GridOperation( "Delete", confirm="Are you sure you want to delete this page?" ),
]
+
def apply_query_filter( self, trans, query, **kwargs ):
return query.filter_by( user=trans.user, deleted=False )
+
class PageAllPublishedGrid( grids.Grid ):
# Grid definition
use_panels = True
@@ -74,15 +77,18 @@
]
columns.append(
grids.MulticolFilterColumn(
- "Search title, annotation, owner, and tags",
- cols_to_filter=[ columns[0], columns[1], columns[2], columns[4] ],
- key="free-text-search", visible=False, filterable="standard" )
- )
+ "Search title, annotation, owner, and tags",
+ cols_to_filter=[ columns[0], columns[1], columns[2], columns[4] ],
+ key="free-text-search", visible=False, filterable="standard" )
+ )
+
def build_initial_query( self, trans, **kwargs ):
# Join so that searching history.user makes sense.
return trans.sa_session.query( self.model_class ).join( model.User.table )
+
def apply_query_filter( self, trans, query, **kwargs ):
- return query.filter( self.model_class.deleted==False ).filter( self.model_class.published==True )
+ return query.filter( self.model_class.deleted == False ).filter( self.model_class.published == True )
+
class ItemSelectionGrid( grids.Grid ):
""" Base class for pages' item selection grids. """
@@ -97,7 +103,7 @@
# Grid definition.
show_item_checkboxes = True
template = "/page/select_items_grid.mako"
- default_filter = { "deleted" : "False" , "sharing" : "All" }
+ default_filter = { "deleted": "False" , "sharing": "All" }
default_sort_key = "-update_time"
use_async = True
use_paging = True
@@ -106,6 +112,7 @@
def apply_query_filter( self, trans, query, **kwargs ):
return query.filter_by( user=trans.user )
+
class HistorySelectionGrid( ItemSelectionGrid ):
""" Grid for selecting histories. """
# Grid definition.
@@ -121,14 +128,15 @@
]
columns.append(
grids.MulticolFilterColumn(
- "Search",
- cols_to_filter=[ columns[0], columns[1] ],
- key="free-text-search", visible=False, filterable="standard" )
- )
+ "Search",
+ cols_to_filter=[ columns[0], columns[1] ],
+ key="free-text-search", visible=False, filterable="standard" )
+ )
def apply_query_filter( self, trans, query, **kwargs ):
return query.filter_by( user=trans.user, purged=False )
+
class HistoryDatasetAssociationSelectionGrid( ItemSelectionGrid ):
""" Grid for selecting HDAs. """
# Grid definition.
@@ -144,10 +152,11 @@
]
columns.append(
grids.MulticolFilterColumn(
- "Search",
- cols_to_filter=[ columns[0], columns[1] ],
- key="free-text-search", visible=False, filterable="standard" )
- )
+ "Search",
+ cols_to_filter=[ columns[0], columns[1] ],
+ key="free-text-search", visible=False, filterable="standard" )
+ )
+
def apply_query_filter( self, trans, query, **kwargs ):
# To filter HDAs by user, need to join HDA and History table and then filter histories by user. This is necessary because HDAs do not have
# a user relation.
@@ -169,10 +178,11 @@
]
columns.append(
grids.MulticolFilterColumn(
- "Search",
- cols_to_filter=[ columns[0], columns[1] ],
- key="free-text-search", visible=False, filterable="standard" )
- )
+ "Search",
+ cols_to_filter=[ columns[0], columns[1] ],
+ key="free-text-search", visible=False, filterable="standard" )
+ )
+
class PageSelectionGrid( ItemSelectionGrid ):
""" Grid for selecting pages. """
@@ -189,10 +199,11 @@
]
columns.append(
grids.MulticolFilterColumn(
- "Search",
- cols_to_filter=[ columns[0], columns[1] ],
- key="free-text-search", visible=False, filterable="standard" )
- )
+ "Search",
+ cols_to_filter=[ columns[0], columns[1] ],
+ key="free-text-search", visible=False, filterable="standard" )
+ )
+
class VisualizationSelectionGrid( ItemSelectionGrid ):
""" Grid for selecting visualizations. """
@@ -208,10 +219,11 @@
]
columns.append(
grids.MulticolFilterColumn(
- "Search",
- cols_to_filter=[ columns[0], columns[2] ],
- key="free-text-search", visible=False, filterable="standard" )
- )
+ "Search",
+ cols_to_filter=[ columns[0], columns[2] ],
+ key="free-text-search", visible=False, filterable="standard" )
+ )
+
class _PageContentProcessor( _BaseHTMLProcessor ):
""" Processes page content to produce HTML that is suitable for display. For now, processor renders embedded objects. """
@@ -276,6 +288,7 @@
# Default behavior:
_BaseHTMLProcessor.unknown_endtag( self, tag )
+
class PageController( BaseUIController, SharableMixin,
UsesStoredWorkflowMixin, UsesVisualizationMixin, UsesItemRatings ):
@@ -309,7 +322,7 @@
return self.sharing( trans, **kwargs )
session.flush()
- #HACK: to prevent the insertion of an entire html document inside another
+ # HACK: to prevent the insertion of an entire html document inside another
kwargs[ 'embedded' ] = True
# Build grid HTML.
grid = self._page_list( trans, *args, **kwargs )
@@ -336,7 +349,6 @@
# Render grid wrapped in panels
return trans.fill_template( "page/list_published.mako", embedded_grid=grid )
-
@web.expose
@web.require_login( "create pages" )
def create( self, trans, page_title="", page_slug="", page_annotation="" ):
@@ -373,7 +385,7 @@
session.add( page )
session.flush()
# Display the management page
- ## trans.set_message( "Page '%s' created" % page.title )
+ # trans.set_message( "Page '%s' created" % page.title )
return trans.response.send_redirect( web.url_for(controller='page', action='list' ) )
return trans.show_form(
web.FormBuilder( web.url_for(controller='page', action='create'), "Create new page", submit_text="Submit" )
@@ -520,8 +532,8 @@
trans.set_message( "Page '%s' shared with user '%s'" % ( page_title, other_email ) )
return trans.response.send_redirect( url_for( controller='page', action='sharing', id=id ) )
return trans.fill_template( "/ind_share_base.mako",
- message = msg,
- messagetype = mtype,
+ message=msg,
+ messagetype=mtype,
item=page,
email=email,
use_panels=use_panels )
@@ -614,8 +626,11 @@
# Output is string, so convert to unicode for display.
page_content = unicode( processor.output(), 'utf-8' )
- return trans.fill_template_mako( "page/display.mako", item=page, item_data=page_content,
- user_item_rating = user_item_rating, ave_item_rating=ave_item_rating, num_ratings=num_ratings,
+ return trans.fill_template_mako( "page/display.mako", item=page,
+ item_data=page_content,
+ user_item_rating=user_item_rating,
+ ave_item_rating=ave_item_rating,
+ num_ratings=num_ratings,
content_only=True )
@web.expose
@@ -645,7 +660,7 @@
return trans.show_error_message( "The specified page does not exist." )
# Rate page.
- page_rating = self.rate_item( trans.sa_session, trans.get_user(), page, rating )
+ self.rate_item( trans.sa_session, trans.get_user(), page, rating )
return self.get_ave_item_rating_data( trans.sa_session, page )
@@ -667,7 +682,10 @@
if self.create_item_slug( trans.sa_session, page ):
trans.sa_session.flush()
- return_dict = { "name" : page.title, "link" : url_for(controller='page', action="display_by_username_and_slug", username=page.user.username, slug=page.slug ) }
+ return_dict = { "name": page.title, "link": url_for(controller='page',
+ action="display_by_username_and_slug",
+ username=page.user.username,
+ slug=page.slug ) }
return return_dict
@web.expose
@@ -727,7 +745,7 @@
"""
Returns html suitable for embedding in another page.
"""
- #TODO: should be moved to history controller and/or called via ajax from the template
+ # TODO: should be moved to history controller and/or called via ajax from the template
decoded_id = self.decode_id( id )
# histories embedded in pages are set to importable when embedded, check for access here
history = self.history_manager.get_accessible( trans, decoded_id, trans.user )
@@ -740,11 +758,13 @@
# include all datasets: hidden, deleted, and purged
history_data = self.history_manager._get_history_data( trans, history )
history_dictionary = history_data[ 'history' ]
- hda_dictionaries = history_data[ 'contents' ]
+ hda_dictionaries = history_data[ 'contents' ]
history_dictionary[ 'annotation' ] = history.annotation
filled = trans.fill_template( "history/embed.mako", item=history,
- user_is_owner=user_is_owner, history_dict=history_dictionary, hda_dicts=hda_dictionaries )
+ user_is_owner=user_is_owner,
+ history_dict=history_dictionary,
+ hda_dicts=hda_dictionaries )
return filled
def _get_embedded_visualization_html( self, trans, id ):
@@ -757,15 +777,16 @@
return None
# Fork to template based on visualization.type (registry or builtin).
- if( ( trans.app.visualizations_registry and visualization.type in trans.app.visualizations_registry.plugins )
- and ( visualization.type not in trans.app.visualizations_registry.BUILT_IN_VISUALIZATIONS ) ):
+ if(( trans.app.visualizations_registry and visualization.type in trans.app.visualizations_registry.plugins )
+ and ( visualization.type not in trans.app.visualizations_registry.BUILT_IN_VISUALIZATIONS ) ):
# if a registry visualization, load a version into an iframe :(
- #TODO: simplest path from A to B but not optimal - will be difficult to do reg visualizations any other way
- #TODO: this will load the visualization twice (once above, once when the iframe src calls 'saved')
+ # TODO: simplest path from A to B but not optimal - will be difficult to do reg visualizations any other way
+ # TODO: this will load the visualization twice (once above, once when the iframe src calls 'saved')
encoded_visualization_id = trans.security.encode_id( visualization.id )
return trans.fill_template( 'visualization/embed_in_frame.mako',
- item=visualization, encoded_visualization_id=encoded_visualization_id,
- content_only=True )
+ item=visualization,
+ encoded_visualization_id=encoded_visualization_id,
+ content_only=True )
return trans.fill_template( "visualization/embed.mako", item=visualization, item_data=None )
@@ -797,6 +818,3 @@
elif item_class == model.Page:
pass
-
-
-
https://bitbucket.org/galaxy/galaxy-central/commits/0bedbfc59efd/
Changeset: 0bedbfc59efd
User: dannon
Date: 2015-01-22 23:19:08+00:00
Summary: Remove a trailing semicolon in the page controller.
Affected #: 1 file
diff -r 501f5553f24775044882d47f7e481f114eb092bb -r 0bedbfc59efdf459b62a70ee9da69449b1f12d45 lib/galaxy/webapps/galaxy/controllers/page.py
--- a/lib/galaxy/webapps/galaxy/controllers/page.py
+++ b/lib/galaxy/webapps/galaxy/controllers/page.py
@@ -640,7 +640,7 @@
page = self.get_page( trans, id )
# Only set if importable value would change; this prevents a change in the update_time unless attribute really changed.
- importable = accessible in ['True', 'true', 't', 'T'];
+ importable = accessible in ['True', 'true', 't', 'T']
if page.importable != importable:
if importable:
self._make_item_accessible( trans.sa_session, page )
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0