galaxy-commits
Threads by month
- ----- 2025 -----
- 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

commit/galaxy-central: dannon: Update cloudlaunch text to explicitly state that instances cost money.
by Bitbucket 14 Sep '12
by Bitbucket 14 Sep '12
14 Sep '12
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/changeset/a5f93d5b5098/
changeset: a5f93d5b5098
user: dannon
date: 2012-09-14 15:52:05
summary: Update cloudlaunch text to explicitly state that instances cost money.
affected #: 1 file
diff -r 0bb0a2d4bf3cd19b822394f36b36f2d13c02339d -r a5f93d5b509835c9e4a29ba793c6406cb3a63ca2 templates/cloud/index.mako
--- a/templates/cloud/index.mako
+++ b/templates/cloud/index.mako
@@ -158,8 +158,11 @@
<div id="launchFormContainer" class="toolForm"><form id="cloudlaunch_form" action="${h.url_for( controller='/cloudlaunch', action='launch_instance')}" method="post">
- <p>To launch a Galaxy Cloud Cluster, enter your AWS Secret Key ID, and Secret Key. Galaxy will use these to present appropriate
-options for launching your cluster.</p>
+ <p>To launch a Galaxy Cloud Cluster, enter your AWS Secret Key ID, and Secret Key. Galaxy will use
+ these to present appropriate options for launching your cluster. Note that using this form to
+ launch computational resources in the Amazon Cloud will result in costs to the account indicated
+ above. See <a href="http://aws.amazon.com/ec2/pricing/">Amazon's pricing</a> for more information.
+ options for launching your cluster.</p></p><div class="form-row"><label for="id_key_id">Key ID</label>
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

13 Sep '12
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/changeset/0bb0a2d4bf3c/
changeset: 0bb0a2d4bf3c
user: carlfeberhard
date: 2012-09-14 01:53:12
summary: history.js: refactored body renderers
affected #: 19 files
diff -r 5088185a5bca723d5e58bb6672327e0310f86fbc -r 0bb0a2d4bf3cd19b822394f36b36f2d13c02339d static/scripts/libs/handlebars.full.js
--- a/static/scripts/libs/handlebars.full.js
+++ /dev/null
@@ -1,1550 +0,0 @@
-// lib/handlebars/base.js
-var Handlebars = {};
-
-Handlebars.VERSION = "1.0.beta.6";
-
-Handlebars.helpers = {};
-Handlebars.partials = {};
-
-Handlebars.registerHelper = function(name, fn, inverse) {
- if(inverse) { fn.not = inverse; }
- this.helpers[name] = fn;
-};
-
-Handlebars.registerPartial = function(name, str) {
- this.partials[name] = str;
-};
-
-Handlebars.registerHelper('helperMissing', function(arg) {
- if(arguments.length === 2) {
- return undefined;
- } else {
- throw new Error("Could not find property '" + arg + "'");
- }
-});
-
-var toString = Object.prototype.toString, functionType = "[object Function]";
-
-Handlebars.registerHelper('blockHelperMissing', function(context, options) {
- var inverse = options.inverse || function() {}, fn = options.fn;
-
-
- var ret = "";
- var type = toString.call(context);
-
- if(type === functionType) { context = context.call(this); }
-
- if(context === true) {
- return fn(this);
- } else if(context === false || context == null) {
- return inverse(this);
- } else if(type === "[object Array]") {
- if(context.length > 0) {
- for(var i=0, j=context.length; i<j; i++) {
- ret = ret + fn(context[i]);
- }
- } else {
- ret = inverse(this);
- }
- return ret;
- } else {
- return fn(context);
- }
-});
-
-Handlebars.registerHelper('each', function(context, options) {
- var fn = options.fn, inverse = options.inverse;
- var ret = "";
-
- if(context && context.length > 0) {
- for(var i=0, j=context.length; i<j; i++) {
- ret = ret + fn(context[i]);
- }
- } else {
- ret = inverse(this);
- }
- return ret;
-});
-
-Handlebars.registerHelper('if', function(context, options) {
- var type = toString.call(context);
- if(type === functionType) { context = context.call(this); }
-
- if(!context || Handlebars.Utils.isEmpty(context)) {
- return options.inverse(this);
- } else {
- return options.fn(this);
- }
-});
-
-Handlebars.registerHelper('unless', function(context, options) {
- var fn = options.fn, inverse = options.inverse;
- options.fn = inverse;
- options.inverse = fn;
-
- return Handlebars.helpers['if'].call(this, context, options);
-});
-
-Handlebars.registerHelper('with', function(context, options) {
- return options.fn(context);
-});
-
-Handlebars.registerHelper('log', function(context) {
- Handlebars.log(context);
-});
-;
-// lib/handlebars/compiler/parser.js
-/* Jison generated parser */
-var handlebars = (function(){
-
-var parser = {trace: function trace() { },
-yy: {},
-symbols_: {"error":2,"root":3,"program":4,"EOF":5,"statements":6,"simpleInverse":7,"statement":8,"openInverse":9,"closeBlock":10,"openBlock":11,"mustache":12,"partial":13,"CONTENT":14,"COMMENT":15,"OPEN_BLOCK":16,"inMustache":17,"CLOSE":18,"OPEN_INVERSE":19,"OPEN_ENDBLOCK":20,"path":21,"OPEN":22,"OPEN_UNESCAPED":23,"OPEN_PARTIAL":24,"params":25,"hash":26,"param":27,"STRING":28,"INTEGER":29,"BOOLEAN":30,"hashSegments":31,"hashSegment":32,"ID":33,"EQUALS":34,"pathSegments":35,"SEP":36,"$accept":0,"$end":1},
-terminals_: {2:"error",5:"EOF",14:"CONTENT",15:"COMMENT",16:"OPEN_BLOCK",18:"CLOSE",19:"OPEN_INVERSE",20:"OPEN_ENDBLOCK",22:"OPEN",23:"OPEN_UNESCAPED",24:"OPEN_PARTIAL",28:"STRING",29:"INTEGER",30:"BOOLEAN",33:"ID",34:"EQUALS",36:"SEP"},
-productions_: [0,[3,2],[4,3],[4,1],[4,0],[6,1],[6,2],[8,3],[8,3],[8,1],[8,1],[8,1],[8,1],[11,3],[9,3],[10,3],[12,3],[12,3],[13,3],[13,4],[7,2],[17,3],[17,2],[17,2],[17,1],[25,2],[25,1],[27,1],[27,1],[27,1],[27,1],[26,1],[31,2],[31,1],[32,3],[32,3],[32,3],[32,3],[21,1],[35,3],[35,1]],
-performAction: function anonymous(yytext,yyleng,yylineno,yy,yystate,$$,_$) {
-
-var $0 = $$.length - 1;
-switch (yystate) {
-case 1: return $$[$0-1]
-break;
-case 2: this.$ = new yy.ProgramNode($$[$0-2], $$[$0])
-break;
-case 3: this.$ = new yy.ProgramNode($$[$0])
-break;
-case 4: this.$ = new yy.ProgramNode([])
-break;
-case 5: this.$ = [$$[$0]]
-break;
-case 6: $$[$0-1].push($$[$0]); this.$ = $$[$0-1]
-break;
-case 7: this.$ = new yy.InverseNode($$[$0-2], $$[$0-1], $$[$0])
-break;
-case 8: this.$ = new yy.BlockNode($$[$0-2], $$[$0-1], $$[$0])
-break;
-case 9: this.$ = $$[$0]
-break;
-case 10: this.$ = $$[$0]
-break;
-case 11: this.$ = new yy.ContentNode($$[$0])
-break;
-case 12: this.$ = new yy.CommentNode($$[$0])
-break;
-case 13: this.$ = new yy.MustacheNode($$[$0-1][0], $$[$0-1][1])
-break;
-case 14: this.$ = new yy.MustacheNode($$[$0-1][0], $$[$0-1][1])
-break;
-case 15: this.$ = $$[$0-1]
-break;
-case 16: this.$ = new yy.MustacheNode($$[$0-1][0], $$[$0-1][1])
-break;
-case 17: this.$ = new yy.MustacheNode($$[$0-1][0], $$[$0-1][1], true)
-break;
-case 18: this.$ = new yy.PartialNode($$[$0-1])
-break;
-case 19: this.$ = new yy.PartialNode($$[$0-2], $$[$0-1])
-break;
-case 20:
-break;
-case 21: this.$ = [[$$[$0-2]].concat($$[$0-1]), $$[$0]]
-break;
-case 22: this.$ = [[$$[$0-1]].concat($$[$0]), null]
-break;
-case 23: this.$ = [[$$[$0-1]], $$[$0]]
-break;
-case 24: this.$ = [[$$[$0]], null]
-break;
-case 25: $$[$0-1].push($$[$0]); this.$ = $$[$0-1];
-break;
-case 26: this.$ = [$$[$0]]
-break;
-case 27: this.$ = $$[$0]
-break;
-case 28: this.$ = new yy.StringNode($$[$0])
-break;
-case 29: this.$ = new yy.IntegerNode($$[$0])
-break;
-case 30: this.$ = new yy.BooleanNode($$[$0])
-break;
-case 31: this.$ = new yy.HashNode($$[$0])
-break;
-case 32: $$[$0-1].push($$[$0]); this.$ = $$[$0-1]
-break;
-case 33: this.$ = [$$[$0]]
-break;
-case 34: this.$ = [$$[$0-2], $$[$0]]
-break;
-case 35: this.$ = [$$[$0-2], new yy.StringNode($$[$0])]
-break;
-case 36: this.$ = [$$[$0-2], new yy.IntegerNode($$[$0])]
-break;
-case 37: this.$ = [$$[$0-2], new yy.BooleanNode($$[$0])]
-break;
-case 38: this.$ = new yy.IdNode($$[$0])
-break;
-case 39: $$[$0-2].push($$[$0]); this.$ = $$[$0-2];
-break;
-case 40: this.$ = [$$[$0]]
-break;
-}
-},
-table: [{3:1,4:2,5:[2,4],6:3,8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],22:[1,13],23:[1,14],24:[1,15]},{1:[3]},{5:[1,16]},{5:[2,3],7:17,8:18,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,19],20:[2,3],22:[1,13],23:[1,14],24:[1,15]},{5:[2,5],14:[2,5],15:[2,5],16:[2,5],19:[2,5],20:[2,5],22:[2,5],23:[2,5],24:[2,5]},{4:20,6:3,8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],20:[2,4],22:[1,13],23:[1,14],24:[1,15]},{4:21,6:3,8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],20:[2,4],22:[1,13],23:[1,14],24:[1,15]},{5:[2,9],14:[2,9],15:[2,9],16:[2,9],19:[2,9],20:[2,9],22:[2,9],23:[2,9],24:[2,9]},{5:[2,10],14:[2,10],15:[2,10],16:[2,10],19:[2,10],20:[2,10],22:[2,10],23:[2,10],24:[2,10]},{5:[2,11],14:[2,11],15:[2,11],16:[2,11],19:[2,11],20:[2,11],22:[2,11],23:[2,11],24:[2,11]},{5:[2,12],14:[2,12],15:[2,12],16:[2,12],19:[2,12],20:[2,12],22:[2,12],23:[2,12],24:[2,12]},{17:22,21:23,33:[1,25],35:24},{17:26,21:23,33:[1,25],35:24},{17:27,21:23,33:[1,25],35:24},{17:28,21:23,33:[1,25],35:24},{21:29,33:[1,25],35:24},{1:[2,1]},{6:30,8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],22:[1,13],23:[1,14],24:[1,15]},{5:[2,6],14:[2,6],15:[2,6],16:[2,6],19:[2,6],20:[2,6],22:[2,6],23:[2,6],24:[2,6]},{17:22,18:[1,31],21:23,33:[1,25],35:24},{10:32,20:[1,33]},{10:34,20:[1,33]},{18:[1,35]},{18:[2,24],21:40,25:36,26:37,27:38,28:[1,41],29:[1,42],30:[1,43],31:39,32:44,33:[1,45],35:24},{18:[2,38],28:[2,38],29:[2,38],30:[2,38],33:[2,38],36:[1,46]},{18:[2,40],28:[2,40],29:[2,40],30:[2,40],33:[2,40],36:[2,40]},{18:[1,47]},{18:[1,48]},{18:[1,49]},{18:[1,50],21:51,33:[1,25],35:24},{5:[2,2],8:18,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],20:[2,2],22:[1,13],23:[1,14],24:[1,15]},{14:[2,20],15:[2,20],16:[2,20],19:[2,20],22:[2,20],23:[2,20],24:[2,20]},{5:[2,7],14:[2,7],15:[2,7],16:[2,7],19:[2,7],20:[2,7],22:[2,7],23:[2,7],24:[2,7]},{21:52,33:[1,25],35:24},{5:[2,8],14:[2,8],15:[2,8],16:[2,8],19:[2,8],20:[2,8],22:[2,8],23:[2,8],24:[2,8]},{14:[2,14],15:[2,14],16:[2,14],19:[2,14],20:[2,14],22:[2,14],23:[2,14],24:[2,14]},{18:[2,22],21:40,26:53,27:54,28:[1,41],29:[1,42],30:[1,43],31:39,32:44,33:[1,45],35:24},{18:[2,23]},{18:[2,26],28:[2,26],29:[2,26],30:[2,26],33:[2,26]},{18:[2,31],32:55,33:[1,56]},{18:[2,27],28:[2,27],29:[2,27],30:[2,27],33:[2,27]},{18:[2,28],28:[2,28],29:[2,28],30:[2,28],33:[2,28]},{18:[2,29],28:[2,29],29:[2,29],30:[2,29],33:[2,29]},{18:[2,30],28:[2,30],29:[2,30],30:[2,30],33:[2,30]},{18:[2,33],33:[2,33]},{18:[2,40],28:[2,40],29:[2,40],30:[2,40],33:[2,40],34:[1,57],36:[2,40]},{33:[1,58]},{14:[2,13],15:[2,13],16:[2,13],19:[2,13],20:[2,13],22:[2,13],23:[2,13],24:[2,13]},{5:[2,16],14:[2,16],15:[2,16],16:[2,16],19:[2,16],20:[2,16],22:[2,16],23:[2,16],24:[2,16]},{5:[2,17],14:[2,17],15:[2,17],16:[2,17],19:[2,17],20:[2,17],22:[2,17],23:[2,17],24:[2,17]},{5:[2,18],14:[2,18],15:[2,18],16:[2,18],19:[2,18],20:[2,18],22:[2,18],23:[2,18],24:[2,18]},{18:[1,59]},{18:[1,60]},{18:[2,21]},{18:[2,25],28:[2,25],29:[2,25],30:[2,25],33:[2,25]},{18:[2,32],33:[2,32]},{34:[1,57]},{21:61,28:[1,62],29:[1,63],30:[1,64],33:[1,25],35:24},{18:[2,39],28:[2,39],29:[2,39],30:[2,39],33:[2,39],36:[2,39]},{5:[2,19],14:[2,19],15:[2,19],16:[2,19],19:[2,19],20:[2,19],22:[2,19],23:[2,19],24:[2,19]},{5:[2,15],14:[2,15],15:[2,15],16:[2,15],19:[2,15],20:[2,15],22:[2,15],23:[2,15],24:[2,15]},{18:[2,34],33:[2,34]},{18:[2,35],33:[2,35]},{18:[2,36],33:[2,36]},{18:[2,37],33:[2,37]}],
-defaultActions: {16:[2,1],37:[2,23],53:[2,21]},
-parseError: function parseError(str, hash) {
- throw new Error(str);
-},
-parse: function parse(input) {
- var self = this, stack = [0], vstack = [null], lstack = [], table = this.table, yytext = "", yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1;
- this.lexer.setInput(input);
- this.lexer.yy = this.yy;
- this.yy.lexer = this.lexer;
- if (typeof this.lexer.yylloc == "undefined")
- this.lexer.yylloc = {};
- var yyloc = this.lexer.yylloc;
- lstack.push(yyloc);
- if (typeof this.yy.parseError === "function")
- this.parseError = this.yy.parseError;
- function popStack(n) {
- stack.length = stack.length - 2 * n;
- vstack.length = vstack.length - n;
- lstack.length = lstack.length - n;
- }
- function lex() {
- var token;
- token = self.lexer.lex() || 1;
- if (typeof token !== "number") {
- token = self.symbols_[token] || token;
- }
- return token;
- }
- var symbol, preErrorSymbol, state, action, a, r, yyval = {}, p, len, newState, expected;
- while (true) {
- state = stack[stack.length - 1];
- if (this.defaultActions[state]) {
- action = this.defaultActions[state];
- } else {
- if (symbol == null)
- symbol = lex();
- action = table[state] && table[state][symbol];
- }
- if (typeof action === "undefined" || !action.length || !action[0]) {
- if (!recovering) {
- expected = [];
- for (p in table[state])
- if (this.terminals_[p] && p > 2) {
- expected.push("'" + this.terminals_[p] + "'");
- }
- var errStr = "";
- if (this.lexer.showPosition) {
- errStr = "Parse error on line " + (yylineno + 1) + ":\n" + this.lexer.showPosition() + "\nExpecting " + expected.join(", ") + ", got '" + this.terminals_[symbol] + "'";
- } else {
- errStr = "Parse error on line " + (yylineno + 1) + ": Unexpected " + (symbol == 1?"end of input":"'" + (this.terminals_[symbol] || symbol) + "'");
- }
- this.parseError(errStr, {text: this.lexer.match, token: this.terminals_[symbol] || symbol, line: this.lexer.yylineno, loc: yyloc, expected: expected});
- }
- }
- if (action[0] instanceof Array && action.length > 1) {
- throw new Error("Parse Error: multiple actions possible at state: " + state + ", token: " + symbol);
- }
- switch (action[0]) {
- case 1:
- stack.push(symbol);
- vstack.push(this.lexer.yytext);
- lstack.push(this.lexer.yylloc);
- stack.push(action[1]);
- symbol = null;
- if (!preErrorSymbol) {
- yyleng = this.lexer.yyleng;
- yytext = this.lexer.yytext;
- yylineno = this.lexer.yylineno;
- yyloc = this.lexer.yylloc;
- if (recovering > 0)
- recovering--;
- } else {
- symbol = preErrorSymbol;
- preErrorSymbol = null;
- }
- break;
- case 2:
- len = this.productions_[action[1]][1];
- yyval.$ = vstack[vstack.length - len];
- yyval._$ = {first_line: lstack[lstack.length - (len || 1)].first_line, last_line: lstack[lstack.length - 1].last_line, first_column: lstack[lstack.length - (len || 1)].first_column, last_column: lstack[lstack.length - 1].last_column};
- r = this.performAction.call(yyval, yytext, yyleng, yylineno, this.yy, action[1], vstack, lstack);
- if (typeof r !== "undefined") {
- return r;
- }
- if (len) {
- stack = stack.slice(0, -1 * len * 2);
- vstack = vstack.slice(0, -1 * len);
- lstack = lstack.slice(0, -1 * len);
- }
- stack.push(this.productions_[action[1]][0]);
- vstack.push(yyval.$);
- lstack.push(yyval._$);
- newState = table[stack[stack.length - 2]][stack[stack.length - 1]];
- stack.push(newState);
- break;
- case 3:
- return true;
- }
- }
- return true;
-}
-};/* Jison generated lexer */
-var lexer = (function(){
-
-var lexer = ({EOF:1,
-parseError:function parseError(str, hash) {
- if (this.yy.parseError) {
- this.yy.parseError(str, hash);
- } else {
- throw new Error(str);
- }
- },
-setInput:function (input) {
- this._input = input;
- this._more = this._less = this.done = false;
- this.yylineno = this.yyleng = 0;
- this.yytext = this.matched = this.match = '';
- this.conditionStack = ['INITIAL'];
- this.yylloc = {first_line:1,first_column:0,last_line:1,last_column:0};
- return this;
- },
-input:function () {
- var ch = this._input[0];
- this.yytext+=ch;
- this.yyleng++;
- this.match+=ch;
- this.matched+=ch;
- var lines = ch.match(/\n/);
- if (lines) this.yylineno++;
- this._input = this._input.slice(1);
- return ch;
- },
-unput:function (ch) {
- this._input = ch + this._input;
- return this;
- },
-more:function () {
- this._more = true;
- return this;
- },
-pastInput:function () {
- var past = this.matched.substr(0, this.matched.length - this.match.length);
- return (past.length > 20 ? '...':'') + past.substr(-20).replace(/\n/g, "");
- },
-upcomingInput:function () {
- var next = this.match;
- if (next.length < 20) {
- next += this._input.substr(0, 20-next.length);
- }
- return (next.substr(0,20)+(next.length > 20 ? '...':'')).replace(/\n/g, "");
- },
-showPosition:function () {
- var pre = this.pastInput();
- var c = new Array(pre.length + 1).join("-");
- return pre + this.upcomingInput() + "\n" + c+"^";
- },
-next:function () {
- if (this.done) {
- return this.EOF;
- }
- if (!this._input) this.done = true;
-
- var token,
- match,
- col,
- lines;
- if (!this._more) {
- this.yytext = '';
- this.match = '';
- }
- var rules = this._currentRules();
- for (var i=0;i < rules.length; i++) {
- match = this._input.match(this.rules[rules[i]]);
- if (match) {
- lines = match[0].match(/\n.*/g);
- if (lines) this.yylineno += lines.length;
- this.yylloc = {first_line: this.yylloc.last_line,
- last_line: this.yylineno+1,
- first_column: this.yylloc.last_column,
- last_column: lines ? lines[lines.length-1].length-1 : this.yylloc.last_column + match[0].length}
- this.yytext += match[0];
- this.match += match[0];
- this.matches = match;
- this.yyleng = this.yytext.length;
- this._more = false;
- this._input = this._input.slice(match[0].length);
- this.matched += match[0];
- token = this.performAction.call(this, this.yy, this, rules[i],this.conditionStack[this.conditionStack.length-1]);
- if (token) return token;
- else return;
- }
- }
- if (this._input === "") {
- return this.EOF;
- } else {
- this.parseError('Lexical error on line '+(this.yylineno+1)+'. Unrecognized text.\n'+this.showPosition(),
- {text: "", token: null, line: this.yylineno});
- }
- },
-lex:function lex() {
- var r = this.next();
- if (typeof r !== 'undefined') {
- return r;
- } else {
- return this.lex();
- }
- },
-begin:function begin(condition) {
- this.conditionStack.push(condition);
- },
-popState:function popState() {
- return this.conditionStack.pop();
- },
-_currentRules:function _currentRules() {
- return this.conditions[this.conditionStack[this.conditionStack.length-1]].rules;
- },
-topState:function () {
- return this.conditionStack[this.conditionStack.length-2];
- },
-pushState:function begin(condition) {
- this.begin(condition);
- }});
-lexer.performAction = function anonymous(yy,yy_,$avoiding_name_collisions,YY_START) {
-
-var YYSTATE=YY_START
-switch($avoiding_name_collisions) {
-case 0:
- if(yy_.yytext.slice(-1) !== "\\") this.begin("mu");
- if(yy_.yytext.slice(-1) === "\\") yy_.yytext = yy_.yytext.substr(0,yy_.yyleng-1), this.begin("emu");
- if(yy_.yytext) return 14;
-
-break;
-case 1: return 14;
-break;
-case 2: this.popState(); return 14;
-break;
-case 3: return 24;
-break;
-case 4: return 16;
-break;
-case 5: return 20;
-break;
-case 6: return 19;
-break;
-case 7: return 19;
-break;
-case 8: return 23;
-break;
-case 9: return 23;
-break;
-case 10: yy_.yytext = yy_.yytext.substr(3,yy_.yyleng-5); this.popState(); return 15;
-break;
-case 11: return 22;
-break;
-case 12: return 34;
-break;
-case 13: return 33;
-break;
-case 14: return 33;
-break;
-case 15: return 36;
-break;
-case 16: /*ignore whitespace*/
-break;
-case 17: this.popState(); return 18;
-break;
-case 18: this.popState(); return 18;
-break;
-case 19: yy_.yytext = yy_.yytext.substr(1,yy_.yyleng-2).replace(/\\"/g,'"'); return 28;
-break;
-case 20: return 30;
-break;
-case 21: return 30;
-break;
-case 22: return 29;
-break;
-case 23: return 33;
-break;
-case 24: yy_.yytext = yy_.yytext.substr(1, yy_.yyleng-2); return 33;
-break;
-case 25: return 'INVALID';
-break;
-case 26: return 5;
-break;
-}
-};
-lexer.rules = [/^[^\x00]*?(?=(\{\{))/,/^[^\x00]+/,/^[^\x00]{2,}?(?=(\{\{))/,/^\{\{>/,/^\{\{#/,/^\{\{\//,/^\{\{\^/,/^\{\{\s*else\b/,/^\{\{\{/,/^\{\{&/,/^\{\{![\s\S]*?\}\}/,/^\{\{/,/^=/,/^\.(?=[} ])/,/^\.\./,/^[\/.]/,/^\s+/,/^\}\}\}/,/^\}\}/,/^"(\\["]|[^"])*"/,/^true(?=[}\s])/,/^false(?=[}\s])/,/^[0-9]+(?=[}\s])/,/^[a-zA-Z0-9_$-]+(?=[=}\s\/.])/,/^\[[^\]]*\]/,/^./,/^$/];
-lexer.conditions = {"mu":{"rules":[3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26],"inclusive":false},"emu":{"rules":[2],"inclusive":false},"INITIAL":{"rules":[0,1,26],"inclusive":true}};return lexer;})()
-parser.lexer = lexer;
-return parser;
-})();
-if (typeof require !== 'undefined' && typeof exports !== 'undefined') {
-exports.parser = handlebars;
-exports.parse = function () { return handlebars.parse.apply(handlebars, arguments); }
-exports.main = function commonjsMain(args) {
- if (!args[1])
- throw new Error('Usage: '+args[0]+' FILE');
- if (typeof process !== 'undefined') {
- var source = require('fs').readFileSync(require('path').join(process.cwd(), args[1]), "utf8");
- } else {
- var cwd = require("file").path(require("file").cwd());
- var source = cwd.join(args[1]).read({charset: "utf-8"});
- }
- return exports.parser.parse(source);
-}
-if (typeof module !== 'undefined' && require.main === module) {
- exports.main(typeof process !== 'undefined' ? process.argv.slice(1) : require("system").args);
-}
-};
-;
-// lib/handlebars/compiler/base.js
-Handlebars.Parser = handlebars;
-
-Handlebars.parse = function(string) {
- Handlebars.Parser.yy = Handlebars.AST;
- return Handlebars.Parser.parse(string);
-};
-
-Handlebars.print = function(ast) {
- return new Handlebars.PrintVisitor().accept(ast);
-};
-
-Handlebars.logger = {
- DEBUG: 0, INFO: 1, WARN: 2, ERROR: 3, level: 3,
-
- // override in the host environment
- log: function(level, str) {}
-};
-
-Handlebars.log = function(level, str) { Handlebars.logger.log(level, str); };
-;
-// lib/handlebars/compiler/ast.js
-(function() {
-
- Handlebars.AST = {};
-
- Handlebars.AST.ProgramNode = function(statements, inverse) {
- this.type = "program";
- this.statements = statements;
- if(inverse) { this.inverse = new Handlebars.AST.ProgramNode(inverse); }
- };
-
- Handlebars.AST.MustacheNode = function(params, hash, unescaped) {
- this.type = "mustache";
- this.id = params[0];
- this.params = params.slice(1);
- this.hash = hash;
- this.escaped = !unescaped;
- };
-
- Handlebars.AST.PartialNode = function(id, context) {
- this.type = "partial";
-
- // TODO: disallow complex IDs
-
- this.id = id;
- this.context = context;
- };
-
- var verifyMatch = function(open, close) {
- if(open.original !== close.original) {
- throw new Handlebars.Exception(open.original + " doesn't match " + close.original);
- }
- };
-
- Handlebars.AST.BlockNode = function(mustache, program, close) {
- verifyMatch(mustache.id, close);
- this.type = "block";
- this.mustache = mustache;
- this.program = program;
- };
-
- Handlebars.AST.InverseNode = function(mustache, program, close) {
- verifyMatch(mustache.id, close);
- this.type = "inverse";
- this.mustache = mustache;
- this.program = program;
- };
-
- Handlebars.AST.ContentNode = function(string) {
- this.type = "content";
- this.string = string;
- };
-
- Handlebars.AST.HashNode = function(pairs) {
- this.type = "hash";
- this.pairs = pairs;
- };
-
- Handlebars.AST.IdNode = function(parts) {
- this.type = "ID";
- this.original = parts.join(".");
-
- var dig = [], depth = 0;
-
- for(var i=0,l=parts.length; i<l; i++) {
- var part = parts[i];
-
- if(part === "..") { depth++; }
- else if(part === "." || part === "this") { this.isScoped = true; }
- else { dig.push(part); }
- }
-
- this.parts = dig;
- this.string = dig.join('.');
- this.depth = depth;
- this.isSimple = (dig.length === 1) && (depth === 0);
- };
-
- Handlebars.AST.StringNode = function(string) {
- this.type = "STRING";
- this.string = string;
- };
-
- Handlebars.AST.IntegerNode = function(integer) {
- this.type = "INTEGER";
- this.integer = integer;
- };
-
- Handlebars.AST.BooleanNode = function(bool) {
- this.type = "BOOLEAN";
- this.bool = bool;
- };
-
- Handlebars.AST.CommentNode = function(comment) {
- this.type = "comment";
- this.comment = comment;
- };
-
-})();;
-// lib/handlebars/utils.js
-Handlebars.Exception = function(message) {
- var tmp = Error.prototype.constructor.apply(this, arguments);
-
- for (var p in tmp) {
- if (tmp.hasOwnProperty(p)) { this[p] = tmp[p]; }
- }
-
- this.message = tmp.message;
-};
-Handlebars.Exception.prototype = new Error;
-
-// Build out our basic SafeString type
-Handlebars.SafeString = function(string) {
- this.string = string;
-};
-Handlebars.SafeString.prototype.toString = function() {
- return this.string.toString();
-};
-
-(function() {
- var escape = {
- "<": "<",
- ">": ">",
- '"': """,
- "'": "'",
- "`": "`"
- };
-
- var badChars = /&(?!\w+;)|[<>"'`]/g;
- var possible = /[&<>"'`]/;
-
- var escapeChar = function(chr) {
- return escape[chr] || "&";
- };
-
- Handlebars.Utils = {
- escapeExpression: function(string) {
- // don't escape SafeStrings, since they're already safe
- if (string instanceof Handlebars.SafeString) {
- return string.toString();
- } else if (string == null || string === false) {
- return "";
- }
-
- if(!possible.test(string)) { return string; }
- return string.replace(badChars, escapeChar);
- },
-
- isEmpty: function(value) {
- if (typeof value === "undefined") {
- return true;
- } else if (value === null) {
- return true;
- } else if (value === false) {
- return true;
- } else if(Object.prototype.toString.call(value) === "[object Array]" && value.length === 0) {
- return true;
- } else {
- return false;
- }
- }
- };
-})();;
-// lib/handlebars/compiler/compiler.js
-Handlebars.Compiler = function() {};
-Handlebars.JavaScriptCompiler = function() {};
-
-(function(Compiler, JavaScriptCompiler) {
- Compiler.OPCODE_MAP = {
- appendContent: 1,
- getContext: 2,
- lookupWithHelpers: 3,
- lookup: 4,
- append: 5,
- invokeMustache: 6,
- appendEscaped: 7,
- pushString: 8,
- truthyOrFallback: 9,
- functionOrFallback: 10,
- invokeProgram: 11,
- invokePartial: 12,
- push: 13,
- assignToHash: 15,
- pushStringParam: 16
- };
-
- Compiler.MULTI_PARAM_OPCODES = {
- appendContent: 1,
- getContext: 1,
- lookupWithHelpers: 2,
- lookup: 1,
- invokeMustache: 3,
- pushString: 1,
- truthyOrFallback: 1,
- functionOrFallback: 1,
- invokeProgram: 3,
- invokePartial: 1,
- push: 1,
- assignToHash: 1,
- pushStringParam: 1
- };
-
- Compiler.DISASSEMBLE_MAP = {};
-
- for(var prop in Compiler.OPCODE_MAP) {
- var value = Compiler.OPCODE_MAP[prop];
- Compiler.DISASSEMBLE_MAP[value] = prop;
- }
-
- Compiler.multiParamSize = function(code) {
- return Compiler.MULTI_PARAM_OPCODES[Compiler.DISASSEMBLE_MAP[code]];
- };
-
- Compiler.prototype = {
- compiler: Compiler,
-
- disassemble: function() {
- var opcodes = this.opcodes, opcode, nextCode;
- var out = [], str, name, value;
-
- for(var i=0, l=opcodes.length; i<l; i++) {
- opcode = opcodes[i];
-
- if(opcode === 'DECLARE') {
- name = opcodes[++i];
- value = opcodes[++i];
- out.push("DECLARE " + name + " = " + value);
- } else {
- str = Compiler.DISASSEMBLE_MAP[opcode];
-
- var extraParams = Compiler.multiParamSize(opcode);
- var codes = [];
-
- for(var j=0; j<extraParams; j++) {
- nextCode = opcodes[++i];
-
- if(typeof nextCode === "string") {
- nextCode = "\"" + nextCode.replace("\n", "\\n") + "\"";
- }
-
- codes.push(nextCode);
- }
-
- str = str + " " + codes.join(" ");
-
- out.push(str);
- }
- }
-
- return out.join("\n");
- },
-
- guid: 0,
-
- compile: function(program, options) {
- this.children = [];
- this.depths = {list: []};
- this.options = options;
-
- // These changes will propagate to the other compiler components
- var knownHelpers = this.options.knownHelpers;
- this.options.knownHelpers = {
- 'helperMissing': true,
- 'blockHelperMissing': true,
- 'each': true,
- 'if': true,
- 'unless': true,
- 'with': true,
- 'log': true
- };
- if (knownHelpers) {
- for (var name in knownHelpers) {
- this.options.knownHelpers[name] = knownHelpers[name];
- }
- }
-
- return this.program(program);
- },
-
- accept: function(node) {
- return this[node.type](node);
- },
-
- program: function(program) {
- var statements = program.statements, statement;
- this.opcodes = [];
-
- for(var i=0, l=statements.length; i<l; i++) {
- statement = statements[i];
- this[statement.type](statement);
- }
- this.isSimple = l === 1;
-
- this.depths.list = this.depths.list.sort(function(a, b) {
- return a - b;
- });
-
- return this;
- },
-
- compileProgram: function(program) {
- var result = new this.compiler().compile(program, this.options);
- var guid = this.guid++;
-
- this.usePartial = this.usePartial || result.usePartial;
-
- this.children[guid] = result;
-
- for(var i=0, l=result.depths.list.length; i<l; i++) {
- depth = result.depths.list[i];
-
- if(depth < 2) { continue; }
- else { this.addDepth(depth - 1); }
- }
-
- return guid;
- },
-
- block: function(block) {
- var mustache = block.mustache;
- var depth, child, inverse, inverseGuid;
-
- var params = this.setupStackForMustache(mustache);
-
- var programGuid = this.compileProgram(block.program);
-
- if(block.program.inverse) {
- inverseGuid = this.compileProgram(block.program.inverse);
- this.declare('inverse', inverseGuid);
- }
-
- this.opcode('invokeProgram', programGuid, params.length, !!mustache.hash);
- this.declare('inverse', null);
- this.opcode('append');
- },
-
- inverse: function(block) {
- var params = this.setupStackForMustache(block.mustache);
-
- var programGuid = this.compileProgram(block.program);
-
- this.declare('inverse', programGuid);
-
- this.opcode('invokeProgram', null, params.length, !!block.mustache.hash);
- this.declare('inverse', null);
- this.opcode('append');
- },
-
- hash: function(hash) {
- var pairs = hash.pairs, pair, val;
-
- this.opcode('push', '{}');
-
- for(var i=0, l=pairs.length; i<l; i++) {
- pair = pairs[i];
- val = pair[1];
-
- this.accept(val);
- this.opcode('assignToHash', pair[0]);
- }
- },
-
- partial: function(partial) {
- var id = partial.id;
- this.usePartial = true;
-
- if(partial.context) {
- this.ID(partial.context);
- } else {
- this.opcode('push', 'depth0');
- }
-
- this.opcode('invokePartial', id.original);
- this.opcode('append');
- },
-
- content: function(content) {
- this.opcode('appendContent', content.string);
- },
-
- mustache: function(mustache) {
- var params = this.setupStackForMustache(mustache);
-
- this.opcode('invokeMustache', params.length, mustache.id.original, !!mustache.hash);
-
- if(mustache.escaped && !this.options.noEscape) {
- this.opcode('appendEscaped');
- } else {
- this.opcode('append');
- }
- },
-
- ID: function(id) {
- this.addDepth(id.depth);
-
- this.opcode('getContext', id.depth);
-
- this.opcode('lookupWithHelpers', id.parts[0] || null, id.isScoped || false);
-
- for(var i=1, l=id.parts.length; i<l; i++) {
- this.opcode('lookup', id.parts[i]);
- }
- },
-
- STRING: function(string) {
- this.opcode('pushString', string.string);
- },
-
- INTEGER: function(integer) {
- this.opcode('push', integer.integer);
- },
-
- BOOLEAN: function(bool) {
- this.opcode('push', bool.bool);
- },
-
- comment: function() {},
-
- // HELPERS
- pushParams: function(params) {
- var i = params.length, param;
-
- while(i--) {
- param = params[i];
-
- if(this.options.stringParams) {
- if(param.depth) {
- this.addDepth(param.depth);
- }
-
- this.opcode('getContext', param.depth || 0);
- this.opcode('pushStringParam', param.string);
- } else {
- this[param.type](param);
- }
- }
- },
-
- opcode: function(name, val1, val2, val3) {
- this.opcodes.push(Compiler.OPCODE_MAP[name]);
- if(val1 !== undefined) { this.opcodes.push(val1); }
- if(val2 !== undefined) { this.opcodes.push(val2); }
- if(val3 !== undefined) { this.opcodes.push(val3); }
- },
-
- declare: function(name, value) {
- this.opcodes.push('DECLARE');
- this.opcodes.push(name);
- this.opcodes.push(value);
- },
-
- addDepth: function(depth) {
- if(depth === 0) { return; }
-
- if(!this.depths[depth]) {
- this.depths[depth] = true;
- this.depths.list.push(depth);
- }
- },
-
- setupStackForMustache: function(mustache) {
- var params = mustache.params;
-
- this.pushParams(params);
-
- if(mustache.hash) {
- this.hash(mustache.hash);
- }
-
- this.ID(mustache.id);
-
- return params;
- }
- };
-
- JavaScriptCompiler.prototype = {
- // PUBLIC API: You can override these methods in a subclass to provide
- // alternative compiled forms for name lookup and buffering semantics
- nameLookup: function(parent, name, type) {
- if (/^[0-9]+$/.test(name)) {
- return parent + "[" + name + "]";
- } else if (JavaScriptCompiler.isValidJavaScriptVariableName(name)) {
- return parent + "." + name;
- }
- else {
- return parent + "['" + name + "']";
- }
- },
-
- appendToBuffer: function(string) {
- if (this.environment.isSimple) {
- return "return " + string + ";";
- } else {
- return "buffer += " + string + ";";
- }
- },
-
- initializeBuffer: function() {
- return this.quotedString("");
- },
-
- namespace: "Handlebars",
- // END PUBLIC API
-
- compile: function(environment, options, context, asObject) {
- this.environment = environment;
- this.options = options || {};
-
- this.name = this.environment.name;
- this.isChild = !!context;
- this.context = context || {
- programs: [],
- aliases: { self: 'this' },
- registers: {list: []}
- };
-
- this.preamble();
-
- this.stackSlot = 0;
- this.stackVars = [];
-
- this.compileChildren(environment, options);
-
- var opcodes = environment.opcodes, opcode;
-
- this.i = 0;
-
- for(l=opcodes.length; this.i<l; this.i++) {
- opcode = this.nextOpcode(0);
-
- if(opcode[0] === 'DECLARE') {
- this.i = this.i + 2;
- this[opcode[1]] = opcode[2];
- } else {
- this.i = this.i + opcode[1].length;
- this[opcode[0]].apply(this, opcode[1]);
- }
- }
-
- return this.createFunctionContext(asObject);
- },
-
- nextOpcode: function(n) {
- var opcodes = this.environment.opcodes, opcode = opcodes[this.i + n], name, val;
- var extraParams, codes;
-
- if(opcode === 'DECLARE') {
- name = opcodes[this.i + 1];
- val = opcodes[this.i + 2];
- return ['DECLARE', name, val];
- } else {
- name = Compiler.DISASSEMBLE_MAP[opcode];
-
- extraParams = Compiler.multiParamSize(opcode);
- codes = [];
-
- for(var j=0; j<extraParams; j++) {
- codes.push(opcodes[this.i + j + 1 + n]);
- }
-
- return [name, codes];
- }
- },
-
- eat: function(opcode) {
- this.i = this.i + opcode.length;
- },
-
- preamble: function() {
- var out = [];
-
- // this register will disambiguate helper lookup from finding a function in
- // a context. This is necessary for mustache compatibility, which requires
- // that context functions in blocks are evaluated by blockHelperMissing, and
- // then proceed as if the resulting value was provided to blockHelperMissing.
- this.useRegister('foundHelper');
-
- if (!this.isChild) {
- var namespace = this.namespace;
- var copies = "helpers = helpers || " + namespace + ".helpers;";
- if(this.environment.usePartial) { copies = copies + " partials = partials || " + namespace + ".partials;"; }
- out.push(copies);
- } else {
- out.push('');
- }
-
- if (!this.environment.isSimple) {
- out.push(", buffer = " + this.initializeBuffer());
- } else {
- out.push("");
- }
-
- // track the last context pushed into place to allow skipping the
- // getContext opcode when it would be a noop
- this.lastContext = 0;
- this.source = out;
- },
-
- createFunctionContext: function(asObject) {
- var locals = this.stackVars;
- if (!this.isChild) {
- locals = locals.concat(this.context.registers.list);
- }
-
- if(locals.length > 0) {
- this.source[1] = this.source[1] + ", " + locals.join(", ");
- }
-
- // Generate minimizer alias mappings
- if (!this.isChild) {
- var aliases = []
- for (var alias in this.context.aliases) {
- this.source[1] = this.source[1] + ', ' + alias + '=' + this.context.aliases[alias];
- }
- }
-
- if (this.source[1]) {
- this.source[1] = "var " + this.source[1].substring(2) + ";";
- }
-
- // Merge children
- if (!this.isChild) {
- this.source[1] += '\n' + this.context.programs.join('\n') + '\n';
- }
-
- if (!this.environment.isSimple) {
- this.source.push("return buffer;");
- }
-
- var params = this.isChild ? ["depth0", "data"] : ["Handlebars", "depth0", "helpers", "partials", "data"];
-
- for(var i=0, l=this.environment.depths.list.length; i<l; i++) {
- params.push("depth" + this.environment.depths.list[i]);
- }
-
- if (asObject) {
- params.push(this.source.join("\n "));
-
- return Function.apply(this, params);
- } else {
- var functionSource = 'function ' + (this.name || '') + '(' + params.join(',') + ') {\n ' + this.source.join("\n ") + '}';
- Handlebars.log(Handlebars.logger.DEBUG, functionSource + "\n\n");
- return functionSource;
- }
- },
-
- appendContent: function(content) {
- this.source.push(this.appendToBuffer(this.quotedString(content)));
- },
-
- append: function() {
- var local = this.popStack();
- this.source.push("if(" + local + " || " + local + " === 0) { " + this.appendToBuffer(local) + " }");
- if (this.environment.isSimple) {
- this.source.push("else { " + this.appendToBuffer("''") + " }");
- }
- },
-
- appendEscaped: function() {
- var opcode = this.nextOpcode(1), extra = "";
- this.context.aliases.escapeExpression = 'this.escapeExpression';
-
- if(opcode[0] === 'appendContent') {
- extra = " + " + this.quotedString(opcode[1][0]);
- this.eat(opcode);
- }
-
- this.source.push(this.appendToBuffer("escapeExpression(" + this.popStack() + ")" + extra));
- },
-
- getContext: function(depth) {
- if(this.lastContext !== depth) {
- this.lastContext = depth;
- }
- },
-
- lookupWithHelpers: function(name, isScoped) {
- if(name) {
- var topStack = this.nextStack();
-
- this.usingKnownHelper = false;
-
- var toPush;
- if (!isScoped && this.options.knownHelpers[name]) {
- toPush = topStack + " = " + this.nameLookup('helpers', name, 'helper');
- this.usingKnownHelper = true;
- } else if (isScoped || this.options.knownHelpersOnly) {
- toPush = topStack + " = " + this.nameLookup('depth' + this.lastContext, name, 'context');
- } else {
- this.register('foundHelper', this.nameLookup('helpers', name, 'helper'));
- toPush = topStack + " = foundHelper || " + this.nameLookup('depth' + this.lastContext, name, 'context');
- }
-
- toPush += ';';
- this.source.push(toPush);
- } else {
- this.pushStack('depth' + this.lastContext);
- }
- },
-
- lookup: function(name) {
- var topStack = this.topStack();
- this.source.push(topStack + " = (" + topStack + " === null || " + topStack + " === undefined || " + topStack + " === false ? " +
- topStack + " : " + this.nameLookup(topStack, name, 'context') + ");");
- },
-
- pushStringParam: function(string) {
- this.pushStack('depth' + this.lastContext);
- this.pushString(string);
- },
-
- pushString: function(string) {
- this.pushStack(this.quotedString(string));
- },
-
- push: function(name) {
- this.pushStack(name);
- },
-
- invokeMustache: function(paramSize, original, hasHash) {
- this.populateParams(paramSize, this.quotedString(original), "{}", null, hasHash, function(nextStack, helperMissingString, id) {
- if (!this.usingKnownHelper) {
- this.context.aliases.helperMissing = 'helpers.helperMissing';
- this.context.aliases.undef = 'void 0';
- this.source.push("else if(" + id + "=== undef) { " + nextStack + " = helperMissing.call(" + helperMissingString + "); }");
- if (nextStack !== id) {
- this.source.push("else { " + nextStack + " = " + id + "; }");
- }
- }
- });
- },
-
- invokeProgram: function(guid, paramSize, hasHash) {
- var inverse = this.programExpression(this.inverse);
- var mainProgram = this.programExpression(guid);
-
- this.populateParams(paramSize, null, mainProgram, inverse, hasHash, function(nextStack, helperMissingString, id) {
- if (!this.usingKnownHelper) {
- this.context.aliases.blockHelperMissing = 'helpers.blockHelperMissing';
- this.source.push("else { " + nextStack + " = blockHelperMissing.call(" + helperMissingString + "); }");
- }
- });
- },
-
- populateParams: function(paramSize, helperId, program, inverse, hasHash, fn) {
- var needsRegister = hasHash || this.options.stringParams || inverse || this.options.data;
- var id = this.popStack(), nextStack;
- var params = [], param, stringParam, stringOptions;
-
- if (needsRegister) {
- this.register('tmp1', program);
- stringOptions = 'tmp1';
- } else {
- stringOptions = '{ hash: {} }';
- }
-
- if (needsRegister) {
- var hash = (hasHash ? this.popStack() : '{}');
- this.source.push('tmp1.hash = ' + hash + ';');
- }
-
- if(this.options.stringParams) {
- this.source.push('tmp1.contexts = [];');
- }
-
- for(var i=0; i<paramSize; i++) {
- param = this.popStack();
- params.push(param);
-
- if(this.options.stringParams) {
- this.source.push('tmp1.contexts.push(' + this.popStack() + ');');
- }
- }
-
- if(inverse) {
- this.source.push('tmp1.fn = tmp1;');
- this.source.push('tmp1.inverse = ' + inverse + ';');
- }
-
- if(this.options.data) {
- this.source.push('tmp1.data = data;');
- }
-
- params.push(stringOptions);
-
- this.populateCall(params, id, helperId || id, fn, program !== '{}');
- },
-
- populateCall: function(params, id, helperId, fn, program) {
- var paramString = ["depth0"].concat(params).join(", ");
- var helperMissingString = ["depth0"].concat(helperId).concat(params).join(", ");
-
- var nextStack = this.nextStack();
-
- if (this.usingKnownHelper) {
- this.source.push(nextStack + " = " + id + ".call(" + paramString + ");");
- } else {
- this.context.aliases.functionType = '"function"';
- var condition = program ? "foundHelper && " : ""
- this.source.push("if(" + condition + "typeof " + id + " === functionType) { " + nextStack + " = " + id + ".call(" + paramString + "); }");
- }
- fn.call(this, nextStack, helperMissingString, id);
- this.usingKnownHelper = false;
- },
-
- invokePartial: function(context) {
- params = [this.nameLookup('partials', context, 'partial'), "'" + context + "'", this.popStack(), "helpers", "partials"];
-
- if (this.options.data) {
- params.push("data");
- }
-
- this.pushStack("self.invokePartial(" + params.join(", ") + ");");
- },
-
- assignToHash: function(key) {
- var value = this.popStack();
- var hash = this.topStack();
-
- this.source.push(hash + "['" + key + "'] = " + value + ";");
- },
-
- // HELPERS
-
- compiler: JavaScriptCompiler,
-
- compileChildren: function(environment, options) {
- var children = environment.children, child, compiler;
-
- for(var i=0, l=children.length; i<l; i++) {
- child = children[i];
- compiler = new this.compiler();
-
- this.context.programs.push(''); // Placeholder to prevent name conflicts for nested children
- var index = this.context.programs.length;
- child.index = index;
- child.name = 'program' + index;
- this.context.programs[index] = compiler.compile(child, options, this.context);
- }
- },
-
- programExpression: function(guid) {
- if(guid == null) { return "self.noop"; }
-
- var child = this.environment.children[guid],
- depths = child.depths.list;
- var programParams = [child.index, child.name, "data"];
-
- for(var i=0, l = depths.length; i<l; i++) {
- depth = depths[i];
-
- if(depth === 1) { programParams.push("depth0"); }
- else { programParams.push("depth" + (depth - 1)); }
- }
-
- if(depths.length === 0) {
- return "self.program(" + programParams.join(", ") + ")";
- } else {
- programParams.shift();
- return "self.programWithDepth(" + programParams.join(", ") + ")";
- }
- },
-
- register: function(name, val) {
- this.useRegister(name);
- this.source.push(name + " = " + val + ";");
- },
-
- useRegister: function(name) {
- if(!this.context.registers[name]) {
- this.context.registers[name] = true;
- this.context.registers.list.push(name);
- }
- },
-
- pushStack: function(item) {
- this.source.push(this.nextStack() + " = " + item + ";");
- return "stack" + this.stackSlot;
- },
-
- nextStack: function() {
- this.stackSlot++;
- if(this.stackSlot > this.stackVars.length) { this.stackVars.push("stack" + this.stackSlot); }
- return "stack" + this.stackSlot;
- },
-
- popStack: function() {
- return "stack" + this.stackSlot--;
- },
-
- topStack: function() {
- return "stack" + this.stackSlot;
- },
-
- quotedString: function(str) {
- return '"' + str
- .replace(/\\/g, '\\\\')
- .replace(/"/g, '\\"')
- .replace(/\n/g, '\\n')
- .replace(/\r/g, '\\r') + '"';
- }
- };
-
- var reservedWords = (
- "break else new var" +
- " case finally return void" +
- " catch for switch while" +
- " continue function this with" +
- " default if throw" +
- " delete in try" +
- " do instanceof typeof" +
- " abstract enum int short" +
- " boolean export interface static" +
- " byte extends long super" +
- " char final native synchronized" +
- " class float package throws" +
- " const goto private transient" +
- " debugger implements protected volatile" +
- " double import public let yield"
- ).split(" ");
-
- var compilerWords = JavaScriptCompiler.RESERVED_WORDS = {};
-
- for(var i=0, l=reservedWords.length; i<l; i++) {
- compilerWords[reservedWords[i]] = true;
- }
-
- JavaScriptCompiler.isValidJavaScriptVariableName = function(name) {
- if(!JavaScriptCompiler.RESERVED_WORDS[name] && /^[a-zA-Z_$][0-9a-zA-Z_$]+$/.test(name)) {
- return true;
- }
- return false;
- }
-
-})(Handlebars.Compiler, Handlebars.JavaScriptCompiler);
-
-Handlebars.precompile = function(string, options) {
- options = options || {};
-
- var ast = Handlebars.parse(string);
- var environment = new Handlebars.Compiler().compile(ast, options);
- return new Handlebars.JavaScriptCompiler().compile(environment, options);
-};
-
-Handlebars.compile = function(string, options) {
- options = options || {};
-
- var compiled;
- function compile() {
- var ast = Handlebars.parse(string);
- var environment = new Handlebars.Compiler().compile(ast, options);
- var templateSpec = new Handlebars.JavaScriptCompiler().compile(environment, options, undefined, true);
- return Handlebars.template(templateSpec);
- }
-
- // Template is only compiled on first use and cached after that point.
- return function(context, options) {
- if (!compiled) {
- compiled = compile();
- }
- return compiled.call(this, context, options);
- };
-};
-;
-// lib/handlebars/runtime.js
-Handlebars.VM = {
- template: function(templateSpec) {
- // Just add water
- var container = {
- escapeExpression: Handlebars.Utils.escapeExpression,
- invokePartial: Handlebars.VM.invokePartial,
- programs: [],
- program: function(i, fn, data) {
- var programWrapper = this.programs[i];
- if(data) {
- return Handlebars.VM.program(fn, data);
- } else if(programWrapper) {
- return programWrapper;
- } else {
- programWrapper = this.programs[i] = Handlebars.VM.program(fn);
- return programWrapper;
- }
- },
- programWithDepth: Handlebars.VM.programWithDepth,
- noop: Handlebars.VM.noop
- };
-
- return function(context, options) {
- options = options || {};
- return templateSpec.call(container, Handlebars, context, options.helpers, options.partials, options.data);
- };
- },
-
- programWithDepth: function(fn, data, $depth) {
- var args = Array.prototype.slice.call(arguments, 2);
-
- return function(context, options) {
- options = options || {};
-
- return fn.apply(this, [context, options.data || data].concat(args));
- };
- },
- program: function(fn, data) {
- return function(context, options) {
- options = options || {};
-
- return fn(context, options.data || data);
- };
- },
- noop: function() { return ""; },
- invokePartial: function(partial, name, context, helpers, partials, data) {
- options = { helpers: helpers, partials: partials, data: data };
-
- if(partial === undefined) {
- throw new Handlebars.Exception("The partial " + name + " could not be found");
- } else if(partial instanceof Function) {
- return partial(context, options);
- } else if (!Handlebars.compile) {
- throw new Handlebars.Exception("The partial " + name + " could not be compiled when running in runtime-only mode");
- } else {
- partials[name] = Handlebars.compile(partial);
- return partials[name](context, options);
- }
- }
-};
-
-Handlebars.template = Handlebars.VM.template;
-;
diff -r 5088185a5bca723d5e58bb6672327e0310f86fbc -r 0bb0a2d4bf3cd19b822394f36b36f2d13c02339d static/scripts/mvc/history.js
--- a/static/scripts/mvc/history.js
+++ b/static/scripts/mvc/history.js
@@ -3,34 +3,33 @@
TODO:
replicate then refactor (could be the wrong order)
- History meta controls (rename, annotate, etc. - see history.js.120823.bak)
- choose a templating system and use it consistently
- HIview state transitions (eg. upload -> ok), curr: build new, delete old, place new (in render)
- events (local/ui and otherwise)
- widget building (popupmenu, etc.)
- localization
- incorporate relations
- convert function comments to /** style
- complete comments
+
+ fix:
+ tags
+ annotations
+ _render_displayApps
+ _render_downloadButton
+ widget building (popupmenu, etc.)
don't draw body until it's first unhide event
-
- as always: where does the model end and the view begin?
- HistoryPanel
+ all history.mako js -> this
+ HIview state transitions (eg. upload -> ok), curr: build new, delete old, place new (in render)
+ History (meta controls : collapse all, rename, annotate, etc. - see history.js.120823.bak)
+ events (local/ui and otherwise)
HistoryCollection: (collection of History: 'Saved Histories')
- CASES:
- logged-in/NOT
- show-deleted/DONT
-
- ?? anyway to _clone_ base HistoryItemView instead of creating a new one each time?
+ ?move IconButtonViews -> templates?
+
+ convert function comments to jsDoc style, complete comments
+ collection -> show_deleted, show_hidden
+ poly HistoryItemView on: for_editing, display_structured, trans.user
+ incorporate relations?
+ localization
+ template helper {{#local}} calls _l()
move inline styles into base.less
add classes, ids on empty divs
- localized text from template
watch the magic strings
-
- poly HistoryItemView on: can/cant_edit
*/
//==============================================================================
@@ -121,6 +120,12 @@
initialize : function(){
this.log( this + '.initialize', this.attributes );
this.log( '\tparent history_id: ' + this.get( 'history_id' ) );
+
+ //TODO: accessible is set in alt_hist
+ // this state is not in trans.app.model.Dataset.states - set it here
+ if( !this.get( 'accessible' ) ){
+ this.set( 'state', HistoryItem.STATES.NOT_VIEWABLE );
+ }
},
isEditable : function(){
@@ -148,14 +153,15 @@
//------------------------------------------------------------------------------
HistoryItem.STATES = {
- NEW : 'new',
- UPLOAD : 'upload',
- QUEUED : 'queued',
- RUNNING : 'running',
- OK : 'ok',
- EMPTY : 'empty',
- ERROR : 'error',
- DISCARDED : 'discarded',
+ NOT_VIEWABLE : 'not_viewable', // not in trans.app.model.Dataset.states
+ NEW : 'new',
+ UPLOAD : 'upload',
+ QUEUED : 'queued',
+ RUNNING : 'running',
+ OK : 'ok',
+ EMPTY : 'empty',
+ ERROR : 'error',
+ DISCARDED : 'discarded',
SETTING_METADATA : 'setting_metadata',
FAILED_METADATA : 'failed_metadata'
};
@@ -175,13 +181,11 @@
// ................................................................................ SET UP
initialize : function(){
this.log( this + '.initialize:', this, this.model );
-
},
// ................................................................................ RENDER MAIN
//??: this style builds an entire, new DOM tree - is that what we want??
render : function(){
- this.log( this + '.model:', this.model );
var id = this.model.get( 'id' ),
state = this.model.get( 'state' );
this.clearReferences();
@@ -214,6 +218,7 @@
clearReferences : function(){
//??TODO: best way?
+ //?? do we really need these - not so far
this.displayButton = null;
this.editButton = null;
this.deleteButton = null;
@@ -235,7 +240,7 @@
return titleBar;
},
- // ................................................................................ DISPLAY, EDIT ATTR, DELETE
+ // ................................................................................ display, edit attr, delete
_render_titleButtons : function(){
// render the display, edit attr and delete icon-buttons
var buttonDiv = $( '<div class="historyItemButtons"></div>' );
@@ -245,11 +250,7 @@
return buttonDiv;
},
- //TODO: refactor the following three - use extend for new href (with model data or something else)
- //TODO: move other data (non-href) into {} in view definition, cycle over those keys in _titlebuttons
- //TODO: move disabled span data into view def, move logic into _titlebuttons
_render_displayButton : function(){
-
// don't show display while uploading
if( this.model.get( 'state' ) === HistoryItem.STATES.UPLOAD ){ return null; }
@@ -257,21 +258,20 @@
displayBtnData = ( this.model.get( 'purged' ) )?({
title : 'Cannot display datasets removed from disk',
enabled : false,
- icon_class : 'display',
+ icon_class : 'display'
// if not, render the display icon-button with href
}):({
title : 'Display data in browser',
href : this.model.get( 'display_url' ),
target : ( this.model.get( 'for_editing' ) )?( 'galaxy_main' ):( null ),
- icon_class : 'display',
+ icon_class : 'display'
});
this.displayButton = new IconButtonView({ model : new IconButton( displayBtnData ) });
return this.displayButton.render().$el;
},
_render_editButton : function(){
-
// don't show edit while uploading, or if editable
if( ( this.model.get( 'state' ) === HistoryItem.STATES.UPLOAD )
|| ( !this.model.get( 'for_editing' ) ) ){
@@ -306,29 +306,266 @@
// don't show delete if not editable
if( !this.model.get( 'for_editing' ) ){ return null; }
- var deleteBtnData = ( this.model.get( 'delete_url' ) )?({
+ var deleteBtnData = {
title : 'Delete',
href : this.model.get( 'delete_url' ),
target : 'galaxy_main',
id : 'historyItemDeleter-' + this.model.get( 'id' ),
icon_class : 'delete'
- }):({
- title : 'Dataset is already deleted',
- icon_class : 'delete',
- enabled : false
- });
+ };
+ if( ( this.model.get( 'deleted' ) || this.model.get( 'purged' ) )
+ && ( !this.model.get( 'delete_url' ) ) ){
+ deleteBtnData = {
+ title : 'Dataset is already deleted',
+ icon_class : 'delete',
+ enabled : false
+ };
+ }
this.deleteButton = new IconButtonView({ model : new IconButton( deleteBtnData ) });
return this.deleteButton.render().$el;
},
+ // ................................................................................ titleLink
_render_titleLink : function(){
- this.log( 'model:', this.model.toJSON() );
return $( jQuery.trim( HistoryItemView.templates.titleLink( this.model.toJSON() ) ) );
},
// ................................................................................ RENDER BODY
+ _render_hdaSummary : function(){
+ var modelData = this.model.toJSON();
+ // if there's no dbkey and it's editable : pass a flag to the template to render a link to editing in the '?'
+ if( this.model.get( 'metadata_dbkey' ) === '?'
+ && this.model.isEditable() ){
+ _.extend( modelData, { dbkey_unknown_and_editable : true });
+ }
+ return HistoryItemView.templates.hdaSummary( modelData );
+ },
+
+ // ................................................................................ primary actions
+ _render_primaryActionButtons : function( buttonRenderingFuncs ){
+ var primaryActionButtons = $( '<div/>' ),
+ view = this;
+ _.each( buttonRenderingFuncs, function( fn ){
+ primaryActionButtons.append( fn.call( view ) );
+ });
+ return primaryActionButtons;
+ },
+
+ _render_downloadButton : function(){
+ // return either: a single download icon-button (if there are no meta files)
+ // or a popupmenu with links to download assoc. meta files (if there are meta files)
+
+ // don't show anything if the data's been purged
+ if( this.model.get( 'purged' ) ){ return null; }
+
+ var downloadLink = linkHTMLTemplate({
+ title : 'Download',
+ href : this.model.get( 'download_url' ),
+ classes : [ 'icon-button', 'tooltip', 'disk' ]
+ });
+
+ // if no metafiles, return only the main download link
+ var download_meta_urls = this.model.get( 'download_meta_urls' );
+ if( !download_meta_urls ){
+ return downloadLink;
+ }
+
+ // build the popupmenu for downloading main, meta files
+ var popupmenu = $( '<div popupmenu="dataset-' + this.model.get( 'id' ) + '-popup"></div>' );
+ popupmenu.append( linkHTMLTemplate({
+ text : 'Download Dataset',
+ title : 'Download',
+ href : this.model.get( 'download_url' ),
+ classes : [ 'icon-button', 'tooltip', 'disk' ]
+ }));
+ popupmenu.append( '<a>Additional Files</a>' );
+ for( file_type in download_meta_urls ){
+ popupmenu.append( linkHTMLTemplate({
+ text : 'Download ' + file_type,
+ href : download_meta_urls[ file_type ],
+ classes : [ 'action-button' ]
+ }));
+ }
+ var menuButton = $( ( '<div style="float:left;" class="menubutton split popup"'
+ + ' id="dataset-${dataset_id}-popup"></div>' ) );
+ menuButton.append( downloadLink );
+ popupmenu.append( menuButton );
+ return popupmenu;
+ },
+
+ //NOTE: button renderers have the side effect of caching their IconButtonViews to this view
+ _render_errButton : function(){
+ if( ( this.model.get( 'state' ) !== HistoryItem.STATES.ERROR )
+ || ( !this.model.get( 'for_editing' ) ) ){ return null; }
+
+ this.errButton = new IconButtonView({ model : new IconButton({
+ title : 'View or report this error',
+ href : this.model.get( 'report_error_url' ),
+ target : 'galaxy_main',
+ icon_class : 'bug'
+ })});
+ return this.errButton.render().$el;
+ },
+
+ _render_showParamsButton : function(){
+ // gen. safe to show in all cases
+ this.showParamsButton = new IconButtonView({ model : new IconButton({
+ title : 'View details',
+ href : this.model.get( 'show_params_url' ),
+ target : 'galaxy_main',
+ icon_class : 'information'
+ }) });
+ return this.showParamsButton.render().$el;
+ },
+
+ _render_rerunButton : function(){
+ if( !this.model.get( 'for_editing' ) ){ return null; }
+ this.rerunButton = new IconButtonView({ model : new IconButton({
+ title : 'Run this job again',
+ href : this.model.get( 'rerun_url' ),
+ target : 'galaxy_main',
+ icon_class : 'arrow-circle'
+ }) });
+ return this.rerunButton.render().$el;
+ },
+
+ _render_tracksterButton : function(){
+ var trackster_urls = this.model.get( 'trackster_urls' );
+ if( !( this.model.hasData() )
+ || !( this.model.get( 'for_editing' ) )
+ || !( trackster_urls ) ){ return null; }
+
+ this.tracksterButton = new IconButtonView({ model : new IconButton({
+ title : 'View in Trackster',
+ icon_class : 'chart_curve'
+ })});
+ this.errButton.render(); //?? needed?
+ this.errButton.$el.addClass( 'trackster-add' ).attr({
+ 'data-url' : trackster_urls[ 'data-url' ],
+ 'action-url': trackster_urls[ 'action-url' ],
+ 'new-url' : trackster_urls[ 'new-url' ]
+ });
+ return this.errButton.$el;
+ },
+
+ // ................................................................................ secondary actions
+ _render_secondaryActionButtons : function( buttonRenderingFuncs ){
+ // move to the right (same level as primary)
+ var secondaryActionButtons = $( '<div style="float: right;"></div>' ),
+ view = this;
+ _.each( buttonRenderingFuncs, function( fn ){
+ secondaryActionButtons.append( fn.call( view ) );
+ });
+ return secondaryActionButtons;
+ },
+
+ _render_tagButton : function(){
+ if( !( this.model.hasData() )
+ || !( this.model.get( 'for_editing' ) )
+ || ( !this.model.get( 'retag_url' ) ) ){ return null; }
+
+ this.tagButton = new IconButtonView({ model : new IconButton({
+ title : 'Edit dataset tags',
+ target : 'galaxy_main',
+ href : this.model.get( 'retag_url' ),
+ icon_class : 'tags'
+ })});
+ return this.tagButton.render().$el;
+ },
+
+ _render_annotateButton : function(){
+ if( !( this.model.hasData() )
+ || !( this.model.get( 'for_editing' ) )
+ || ( !this.model.get( 'annotate_url' ) ) ){ return null; }
+
+ this.annotateButton = new IconButtonView({ model : new IconButton({
+ title : 'Edit dataset annotation',
+ target : 'galaxy_main',
+ href : this.model.get( 'annotate_url' ),
+ icon_class : 'annotate'
+ })});
+ return this.annotateButton.render().$el;
+ },
+
+ // ................................................................................ other elements
+ _render_tagArea : function(){
+ if( this.model.get( 'retag_url' ) ){ return null; }
+ //TODO: move to mvc/tags.js
+ return $( HistoryItemView.templates.tagArea( this.model.toJSON() ) );
+ },
+
+ _render_annotationArea : function(){
+ if( !this.model.get( 'annotate_url' ) ){ return null; }
+ //TODO: move to mvc/annotations.js
+ return $( HistoryItemView.templates.annotationArea( this.model.toJSON() ) );
+ },
+
+ _render_displayApps : function(){
+ if( !this.model.get( 'display_apps' ) ){ return null; }
+ var displayApps = this.model.get( 'displayApps' ),
+ displayAppsDiv = $( '<div/>' ),
+ displayAppSpan = $( '<span/>' );
+
+ this.log( this + 'displayApps:', displayApps );
+ ////TODO: grrr...somethings not in the right scope here
+ //for( app_name in displayApps ){
+ // //TODO: to template
+ // var display_app = displayApps[ app_name ],
+ // display_app_HTML = app_name + ' ';
+ // for( location_name in display_app ){
+ // display_app_HTML += linkHTMLTemplate({
+ // text : location_name,
+ // href : display_app[ location_name ].url,
+ // target : display_app[ location_name ].target
+ // }) + ' ';
+ // }
+ // display_app_span.append( display_app_HTML );
+ //}
+ //displayAppsDiv.append( display_app_span );
+
+ //displayAppsDiv.append( '<br />' );
+
+ //var display_appsDiv = $( '<div/>' );
+ //if( this.model.get( 'display_apps' ) ){
+ //
+ // var display_apps = this.model.get( 'display_apps' ),
+ // display_app_span = $( '<span/>' );
+ //
+ // //TODO: grrr...somethings not in the right scope here
+ // for( app_name in display_apps ){
+ // //TODO: to template
+ // var display_app = display_apps[ app_name ],
+ // display_app_HTML = app_name + ' ';
+ // for( location_name in display_app ){
+ // display_app_HTML += linkHTMLTemplate({
+ // text : location_name,
+ // href : display_app[ location_name ].url,
+ // target : display_app[ location_name ].target
+ // }) + ' ';
+ // }
+ // display_app_span.append( display_app_HTML );
+ // }
+ // display_appsDiv.append( display_app_span );
+ //}
+ ////display_appsDiv.append( '<br />' );
+ //parent.append( display_appsDiv );
+ return displayAppsDiv;
+ },
+
+ _render_peek : function(){
+ if( !this.model.get( 'peek' ) ){ return null; }
+ return $( '<div/>' ).append(
+ $( '<pre/>' )
+ .attr( 'id', 'peek' + this.model.get( 'id' ) )
+ .addClass( 'peek' )
+ .append( this.model.get( 'peek' ) )
+ );
+ },
+
+ // ................................................................................ state body renderers
// _render_body fns for the various states
_render_body_not_viewable : function( parent ){
+ //TODO: revisit - still showing display, edit, delete (as common) - that CAN'T be right
parent.append( $( '<div>You do not have permission to view dataset.</div>' ) );
},
@@ -338,12 +575,18 @@
_render_body_queued : function( parent ){
parent.append( $( '<div>Job is waiting to run.</div>' ) );
- parent.append( this._render_showParamsAndRerun() );
+ parent.append( this._render_primaryActionButtons([
+ this._render_showParamsButton,
+ this._render_rerunButton
+ ]));
},
_render_body_running : function( parent ){
parent.append( '<div>Job is currently running.</div>' );
- parent.append( this._render_showParamsAndRerun() );
+ parent.append( this._render_primaryActionButtons([
+ this._render_showParamsButton,
+ this._render_rerunButton
+ ]));
},
_render_body_error : function( parent ){
@@ -352,31 +595,20 @@
}
parent.append( ( 'An error occurred running this job: '
+ '<i>' + $.trim( this.model.get( 'misc_info' ) ) + '</i>' ) );
-
- var actionBtnDiv = $( this._render_showParamsAndRerun() );
- // bug report button
- //NOTE: these are shown _before_ info, rerun so use _prepend_
- if( this.model.get( 'for_editing' ) ){
- //TODO??: save to view 'this.errButton'
- this.errButton = new IconButtonView({ model : new IconButton({
- title : 'View or report this error',
- href : this.model.get( 'report_error_url' ),
- target : 'galaxy_main',
- icon_class : 'bug'
- })});
- actionBtnDiv.prepend( this.errButton.render().$el );
- }
- if( this.model.hasData() ){
- //TODO: render_download_links( data, dataset_id )
- // download dropdown
- actionBtnDiv.prepend( this._render_downloadLinks() );
- }
- parent.append( actionBtnDiv );
+ parent.append( this._render_primaryActionButtons([
+ this._render_downloadButton,
+ this._render_errButton,
+ this._render_showParamsButton,
+ this._render_rerunButton
+ ]));
},
_render_body_discarded : function( parent ){
parent.append( '<div>The job creating this dataset was cancelled before completion.</div>' );
- parent.append( this._render_showParamsAndRerun() );
+ parent.append( this._render_primaryActionButtons([
+ this._render_showParamsButton,
+ this._render_rerunButton
+ ]));
},
_render_body_setting_metadata : function( parent ){
@@ -387,150 +619,46 @@
//TODO: replace i with dataset-misc-info class
//?? why are we showing the file size when we know it's zero??
parent.append( $( '<div>No data: <i>' + this.model.get( 'misc_blurb' ) + '</i></div>' ) );
- parent.append( this._render_showParamsAndRerun() );
+ parent.append( this._render_primaryActionButtons([
+ this._render_showParamsButton,
+ this._render_rerunButton
+ ]));
},
_render_body_failed_metadata : function( parent ){
- // add a message box about the failure at the top of the body, then...
- var warningMsgText = 'An error occurred setting the metadata for this dataset.';
- if( this.model.isEditable() ){
- var editLink = linkHTMLTemplate({
- text : 'set it manually or retry auto-detection',
- href : this.model.get( 'edit_url' ),
- target : 'galaxy_main'
- });
- warningMsgText += 'You may be able to ' + editLink + '.';
- }
- parent.append( $( HistoryItemView.templates.warningMsg({ warning: warningMsgText }) ) );
-
- //...render the remaining body as STATES.OK (only diff between these states is the box above)
+ //TODO: the css for this box is broken (unlike the others)
+ // add a message box about the failure at the top of the body...
+ parent.append( $( HistoryItemView.templates.failedMetadata( this.model.toJSON() ) ) );
+ //...then render the remaining body as STATES.OK (only diff between these states is the box above)
this._render_body_ok( parent );
},
_render_body_ok : function( parent ){
// most common state renderer and the most complicated
-
- // build the summary info (using template and dbkey data)
parent.append( this._render_hdaSummary() );
- if( this.model.get( 'misc_info' ) ){
- parent.append( $( '<div class="info">Info: ' + this.model.get( 'misc_info' ) + '</div>' ) );
- }
+ parent.append( this._render_primaryActionButtons([
+ this._render_downloadButton,
+ this._render_errButton,
+ this._render_showParamsButton,
+ this._render_rerunButton
+ ]));
+ parent.append( this._render_secondaryActionButtons([
+ this._render_tagButton,
+ this._render_annotateButton
+ ]));
+ parent.append( '<div class="clear"/>' );
- // hasData
- if( this.model.hasData() ){
- var actionBtnDiv = $( '<div/>' );
-
- // render download links, show_params
- actionBtnDiv.append( this._render_downloadLinks() );
- actionBtnDiv.append( $( linkHTMLTemplate({
- title : 'View details',
- href : this.model.get( 'show_params_url' ),
- target : 'galaxy_main',
- classes : [ 'icon-button', 'tooltip', 'information' ]
- })));
-
- // if for_editing
- if( this.model.get( 'for_editing' ) ){
-
- // rerun
- actionBtnDiv.append( $( linkHTMLTemplate({
- title : 'Run this job again',
- href : this.model.get( 'rerun_url' ),
- target : 'galaxy_main',
- classes : [ 'icon-button', 'tooltip', 'arrow-circle' ]
- })));
-
- if( this.model.get( 'trackster_urls' ) ){
- // link to trackster
- var trackster_urls = this.model.get( 'trackster_urls' );
- actionBtnDiv.append( $( linkHTMLTemplate({
- title : 'View in Trackster',
- href : "javascript:void(0)",
- classes : [ 'icon-button', 'tooltip', 'chart_curve', 'trackster-add' ],
- // prob just _.extend
- 'data-url' : trackster_urls[ 'data-url' ],
- 'action-url': trackster_urls[ 'action-url' ],
- 'new-url' : trackster_urls[ 'new-url' ]
- })));
- }
-
- // if trans.user
- if( this.model.get( 'retag_url' ) && this.model.get( 'annotate_url' ) ){
- // tag, annotate buttons
- //TODO: move to tag, Annot MV
- var tagsAnnotationsBtns = $( '<div style="float: right;"></div>' );
- tagsAnnotationsBtns.append( $( linkHTMLTemplate({
- title : 'Edit dataset tags',
- target : 'galaxy_main',
- href : this.model.get( 'retag_url' ),
- classes : [ 'icon-button', 'tooltip', 'tags' ]
- })));
- tagsAnnotationsBtns.append( $( linkHTMLTemplate({
- title : 'Edit dataset annotation',
- target : 'galaxy_main',
- href : this.model.get( 'annotation_url' ),
- classes : [ 'icon-button', 'tooltip', 'annotate' ]
- })));
- actionBtnDiv.append( tagsAnnotationsBtns );
- actionBtnDiv.append( '<div style="clear: both"></div>' );
-
- // tag/annot display areas
- this.tagArea = $( '<div class="tag-area" style="display: none">' );
- this.tagArea.append( '<strong>Tags:</strong>' );
- this.tagElt = $( '<div class="tag-elt"></div>' );
- actionBtnDiv.append( this.tagArea.append( this.tagElt ) );
-
- var annotationArea = $( ( '<div id="${dataset_id}-annotation-area"'
- + ' class="annotation-area" style="display: none">' ) );
- this.annotationArea = annotationArea;
- annotationArea.append( '<strong>Annotation:</strong>' );
- this.annotationElem = $( '<div id="' + this.model.get( 'id' ) + '-annotation-elt" '
- + 'style="margin: 1px 0px 1px 0px" class="annotation-elt tooltip editable-text" '
- + 'title="Edit dataset annotation"></div>' );
- annotationArea.append( this.annotationElem );
- actionBtnDiv.append( annotationArea );
- }
- }
- // clear div
- actionBtnDiv.append( '<div style="clear: both;"></div>' );
- parent.append( actionBtnDiv );
-
- var display_appsDiv = $( '<div/>' );
- if( this.model.get( 'display_apps' ) ){
- var display_apps = this.model.get( 'display_apps' ),
- display_app_span = $( '<span/>' );
-
- //TODO: grrr...somethings not in the right scope here
- for( app_name in display_apps ){
- //TODO: to template
- var display_app = display_apps[ app_name ],
- display_app_HTML = app_name + ' ';
- for( location_name in display_app ){
- display_app_HTML += linkHTMLTemplate({
- text : location_name,
- href : display_app[ location_name ].url,
- target : display_app[ location_name ].target
- }) + ' ';
- }
- display_app_span.append( display_app_HTML );
- }
- display_appsDiv.append( display_app_span );
- }
- //display_appsDiv.append( '<br />' );
- parent.append( display_appsDiv );
+ parent.append( this._render_tagArea() );
+ parent.append( this._render_annotationArea() );
- } else if( this.model.get( 'for_editing' ) ){
- parent.append( this._render_showParamsAndRerun() );
- }
-
+ parent.append( this._render_displayApps() );
parent.append( this._render_peek() );
},
_render_body : function(){
//this.log( this + '_render_body' );
- var state = this.model.get( 'state' ),
- for_editing = this.model.get( 'for_editing' );
+ var state = this.model.get( 'state' );
//this.log( 'state:', state, 'for_editing', for_editing );
//TODO: incorrect id (encoded - use hid?)
@@ -539,6 +667,7 @@
.addClass( 'historyItemBody' )
.attr( 'style', 'display: block' );
+ //TODO: not a fan of this
switch( state ){
case HistoryItem.STATES.NOT_VIEWABLE :
this._render_body_not_viewable( body );
@@ -582,92 +711,6 @@
return body;
},
- _render_hdaSummary : function(){
- var modelData = this.model.toJSON();
-
- // if there's no dbkey and it's editable : pass a flag to the template to render a link to editing in the '?'
- if( this.model.get( 'metadata_dbkey' ) === '?'
- && this.model.isEditable() ){
- _.extend( modelData, { dbkey_unknown_and_editable : true });
- }
- return HistoryItemView.templates.hdaSummary( modelData );
- },
-
- _render_showParamsAndRerun : function(){
- //TODO??: generalize to _render_actionButtons, pass in list of 'buttons' to render, default to these two
- var actionBtnDiv = $( '<div/>' );
-
- this.showParamsButton = new IconButtonView({ model : new IconButton({
- title : 'View details',
- href : this.model.get( 'show_params_url' ),
- target : 'galaxy_main',
- icon_class : 'information'
- }) });
- actionBtnDiv.append( this.showParamsButton.render().$el );
-
- if( this.model.get( 'for_editing' ) ){
- this.rerunButton = new IconButtonView({ model : new IconButton({
- title : 'Run this job again',
- href : this.model.get( 'rerun_url' ),
- target : 'galaxy_main',
- icon_class : 'arrow-circle'
- }) });
- }
- return actionBtnDiv;
- },
-
- _render_downloadLinks : function(){
- // return either: a single download icon-button (if there are no meta files)
- // or a popupmenu with links to download assoc. meta files (if there are meta files)
-
- // don't show anything if the data's been purged
- if( this.model.get( 'purged' ) ){ return null; }
-
- var downloadLink = linkHTMLTemplate({
- title : 'Download',
- href : this.model.get( 'download_url' ),
- classes : [ 'icon-button', 'tooltip', 'disk' ]
- });
-
- // if no metafiles, return only the main download link
- var download_meta_urls = this.model.get( 'download_meta_urls' );
- if( !download_meta_urls ){
- return downloadLink;
- }
-
- // build the popupmenu for downloading main, meta files
- var popupmenu = $( '<div popupmenu="dataset-' + this.model.get( 'id' ) + '-popup"></div>' );
- popupmenu.append( linkHTMLTemplate({
- text : 'Download Dataset',
- title : 'Download',
- href : this.model.get( 'download_url' ),
- classes : [ 'icon-button', 'tooltip', 'disk' ]
- }));
- popupmenu.append( '<a>Additional Files</a>' );
- for( file_type in download_meta_urls ){
- popupmenu.append( linkHTMLTemplate({
- text : 'Download ' + file_type,
- href : download_meta_urls[ file_type ],
- classes : [ 'action-button' ]
- }));
- }
- var menuButton = $( ( '<div style="float:left;" class="menubutton split popup"'
- + ' id="dataset-${dataset_id}-popup"></div>' ) );
- menuButton.append( downloadLink );
- popupmenu.append( menuButton );
- return popupmenu;
- },
-
- _render_peek : function(){
- if( !this.model.get( 'peek' ) ){ return null; }
- return $( '<div/>' ).append(
- $( '<pre/>' )
- .attr( 'id', 'peek' + this.model.get( 'id' ) )
- .addClass( 'peek' )
- .append( this.model.get( 'peek' ) )
- );
- },
-
// ................................................................................ EVENTS
events : {
'click .historyItemTitle' : 'toggleBodyVisibility',
@@ -677,10 +720,11 @@
// ................................................................................ STATE CHANGES / MANIPULATION
loadAndDisplayTags : function( event ){
+ //BUG: broken with latest
//TODO: this is a drop in from history.mako - should use MV as well
- this.log( this, '.loadAndDisplayTags', event );
- var tagArea = this.tagArea;
- var tagElt = this.tagElt;
+ this.log( this + '.loadAndDisplayTags', event );
+ var tagArea = this.$el.find( '.tag-area' ),
+ tagElt = tagArea.find( '.tag-elt' );
// Show or hide tag area; if showing tag area and it's empty, fill it.
if( tagArea.is( ":hidden" ) ){
@@ -688,9 +732,8 @@
// Need to fill tag element.
$.ajax({
url: this.model.get( 'ajax_get_tag_url' ),
- error: function() { alert( "Tagging failed" ) },
+ error: function() { alert( "Tagging failed" ); },
success: function(tag_elt_html) {
- this.log( 'tag_elt_html:', tag_elt_html );
tagElt.html(tag_elt_html);
tagElt.find(".tooltip").tooltip();
tagArea.slideDown("fast");
@@ -709,21 +752,20 @@
},
loadAndDisplayAnnotation : function( event ){
+ //BUG: broken with latest
//TODO: this is a drop in from history.mako - should use MV as well
- this.log( this, '.loadAndDisplayAnnotation', event );
- var annotationArea = this.annotationArea,
- annotationElem = this.annotationElem,
+ this.log( this + '.loadAndDisplayAnnotation', event );
+ var annotationArea = this.$el.find( '.annotation-area' ),
+ annotationElem = annotationArea.find( '.annotation-elt' ),
setAnnotationUrl = this.model.get( 'ajax_set_annotation_url' );
// Show or hide annotation area; if showing annotation area and it's empty, fill it.
- this.log( 'annotationArea hidden:', annotationArea.is( ":hidden" ) );
- this.log( 'annotationElem html:', annotationElem.html() );
if ( annotationArea.is( ":hidden" ) ){
if( !annotationElem.html() ){
// Need to fill annotation element.
$.ajax({
url: this.model.get( 'ajax_get_annotation_url' ),
- error: function(){ alert( "Annotations failed" ) },
+ error: function(){ alert( "Annotations failed" ); },
success: function( htmlFromAjax ){
if( htmlFromAjax === "" ){
htmlFromAjax = "<em>Describe or add notes to dataset</em>";
@@ -767,12 +809,15 @@
//HistoryItemView.templates = InDomTemplateLoader.getTemplates({
HistoryItemView.templates = CompiledTemplateLoader.getTemplates({
'common-templates.html' : {
- warningMsg : 'template-warningmessagesmall',
+ warningMsg : 'template-warningmessagesmall'
},
'history-templates.html' : {
messages : 'template-history-warning-messages',
titleLink : 'template-history-titleLink',
- hdaSummary : 'template-history-hdaSummary'
+ hdaSummary : 'template-history-hdaSummary',
+ failedMetadata : 'template-history-failedMetaData',
+ tagArea : 'template-history-tagArea',
+ annotationArea : 'template-history-annotationArea'
}
});
@@ -936,7 +981,7 @@
metadata_dbkey : '?',
metadata_sequences : 0,
misc_blurb : '215.8 MB',
- misc_info : 'uploaded fastq file',
+ misc_info : 'uploaded fastq file (misc_info)',
model_class : 'HistoryDatasetAssociation',
download_url : '',
state : 'ok',
@@ -953,13 +998,15 @@
//can_edit : true,
//can_edit : false,
+ accessible : true,
+
//TODO: move into model functions (build there (and cache?))
//!! be careful with adding these accrd. to permissions
//!! IOW, don't send them via template/API if the user doesn't have perms to use
//!! (even if they don't show up)
- undelete_url : 'example.com/undelete',
- purge_url : 'example.com/purge',
- unhide_url : 'example.com/unhide',
+ undelete_url : '',
+ purge_url : '',
+ unhide_url : '',
display_url : 'example.com/display',
edit_url : 'example.com/edit',
@@ -986,19 +1033,25 @@
};
_.extend( mockHistory.data, {
+ notAccessible :
+ _.extend( _.clone( mockHistory.data.template ),
+ { accessible : false }),
+
//deleted, purged, visible
deleted :
_.extend( _.clone( mockHistory.data.template ),
- { deleted : true }),
- //purged :
- // _.extend( _.clone( mockHistory.data.template ),
- // { purged : true, deleted : true }),
+ { deleted : true,
+ delete_url : '',
+ purge_url : 'example.com/purge',
+ undelete_url : 'example.com/undelete' }),
purgedNotDeleted :
_.extend( _.clone( mockHistory.data.template ),
- { purged : true }),
+ { purged : true,
+ delete_url : '' }),
notvisible :
_.extend( _.clone( mockHistory.data.template ),
- { visible : false }),
+ { visible : false,
+ unhide_url : 'example.com/unhide' }),
hasDisplayApps :
_.extend( _.clone( mockHistory.data.template ),
diff -r 5088185a5bca723d5e58bb6672327e0310f86fbc -r 0bb0a2d4bf3cd19b822394f36b36f2d13c02339d static/scripts/mvc/ui.js
--- a/static/scripts/mvc/ui.js
+++ b/static/scripts/mvc/ui.js
@@ -36,7 +36,6 @@
*/
var IconButtonView = Backbone.View.extend({
-
initialize : function(){
// better rendering this way (for me anyway)
this.model.attributes.tooltip_config = { placement : 'bottom' };
@@ -62,7 +61,6 @@
},
click : function( event ){
- console.debug( 'click event' );
// if on_click pass to that function
if( this.model.attributes.on_click ){
this.model.attributes.on_click( event );
diff -r 5088185a5bca723d5e58bb6672327e0310f86fbc -r 0bb0a2d4bf3cd19b822394f36b36f2d13c02339d static/scripts/templates/common-templates.html
--- a/static/scripts/templates/common-templates.html
+++ b/static/scripts/templates/common-templates.html
@@ -48,3 +48,10 @@
return buffer;
});
</script>
+
+<script type="text/template" class="template-common" id="template-iconButton">
+{{! alternate template-based icon-button }}
+{{> iconButton this}}
+</script>
+
+
diff -r 5088185a5bca723d5e58bb6672327e0310f86fbc -r 0bb0a2d4bf3cd19b822394f36b36f2d13c02339d static/scripts/templates/compile_templates.py
--- a/static/scripts/templates/compile_templates.py
+++ b/static/scripts/templates/compile_templates.py
@@ -39,6 +39,7 @@
# ------------------------------------------------------------------------------
TODO = """
+remove intermediate, handlebars step of multi->handlebars->compiled/.js (if handlebars does stdin)
"""
import sys
@@ -273,4 +274,4 @@
( options, args ) = optparser.parse_args()
sys.exit( main( options, args ) )
-
\ No newline at end of file
+
diff -r 5088185a5bca723d5e58bb6672327e0310f86fbc -r 0bb0a2d4bf3cd19b822394f36b36f2d13c02339d static/scripts/templates/compiled/template-history-annotationArea.js
--- /dev/null
+++ b/static/scripts/templates/compiled/template-history-annotationArea.js
@@ -0,0 +1,18 @@
+(function() {
+ var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
+templates['template-history-annotationArea'] = template(function (Handlebars,depth0,helpers,partials,data) {
+ helpers = helpers || Handlebars.helpers;
+ var buffer = "", stack1, foundHelper, functionType="function", escapeExpression=this.escapeExpression;
+
+
+ buffer += "\n<div id=\"";
+ foundHelper = helpers.id;
+ if (foundHelper) { stack1 = foundHelper.call(depth0, {hash:{}}); }
+ else { stack1 = depth0.id; stack1 = typeof stack1 === functionType ? stack1() : stack1; }
+ buffer += escapeExpression(stack1) + "-annotation-area\" class=\"annotation-area\" style=\"display: none;\">\n <strong>Annotation:</strong>\n <div id=\"";
+ foundHelper = helpers.id;
+ if (foundHelper) { stack1 = foundHelper.call(depth0, {hash:{}}); }
+ else { stack1 = depth0.id; stack1 = typeof stack1 === functionType ? stack1() : stack1; }
+ buffer += escapeExpression(stack1) + "-anotation-elt\" class=\"annotation-elt tooltip editable-text\"\n style=\"margin: 1px 0px 1px 0px\" title=\"Edit dataset annotation\">\n </div>\n</div>";
+ return buffer;});
+})();
\ No newline at end of file
diff -r 5088185a5bca723d5e58bb6672327e0310f86fbc -r 0bb0a2d4bf3cd19b822394f36b36f2d13c02339d static/scripts/templates/compiled/template-history-failedMetaData.js
--- /dev/null
+++ b/static/scripts/templates/compiled/template-history-failedMetaData.js
@@ -0,0 +1,23 @@
+(function() {
+ var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
+templates['template-history-failedMetaData'] = template(function (Handlebars,depth0,helpers,partials,data) {
+ helpers = helpers || Handlebars.helpers;
+ var stack1, foundHelper, functionType="function", escapeExpression=this.escapeExpression, self=this, blockHelperMissing=helpers.blockHelperMissing;
+
+function program1(depth0,data) {
+
+ var buffer = "", stack1, foundHelper;
+ buffer += "\nAn error occurred setting the metadata for this dataset.\nYou may be able to <a href=\"";
+ foundHelper = helpers.edit_url;
+ if (foundHelper) { stack1 = foundHelper.call(depth0, {hash:{}}); }
+ else { stack1 = depth0.edit_url; stack1 = typeof stack1 === functionType ? stack1() : stack1; }
+ buffer += escapeExpression(stack1) + "\" target=\"galaxy_main\">set it manually or retry auto-detection</a>.\n";
+ return buffer;}
+
+ foundHelper = helpers.warningmessagesmall;
+ if (foundHelper) { stack1 = foundHelper.call(depth0, {hash:{},inverse:self.noop,fn:self.program(1, program1, data)}); }
+ else { stack1 = depth0.warningmessagesmall; stack1 = typeof stack1 === functionType ? stack1() : stack1; }
+ if (!helpers.warningmessagesmall) { stack1 = blockHelperMissing.call(depth0, stack1, {hash:{},inverse:self.noop,fn:self.program(1, program1, data)}); }
+ if(stack1 || stack1 === 0) { return stack1; }
+ else { return ''; }});
+})();
\ No newline at end of file
diff -r 5088185a5bca723d5e58bb6672327e0310f86fbc -r 0bb0a2d4bf3cd19b822394f36b36f2d13c02339d static/scripts/templates/compiled/template-history-hdaSummary.js
--- a/static/scripts/templates/compiled/template-history-hdaSummary.js
+++ b/static/scripts/templates/compiled/template-history-hdaSummary.js
@@ -7,7 +7,7 @@
function program1(depth0,data) {
var buffer = "", stack1, foundHelper;
- buffer += "\n <a href=\"";
+ buffer += "\n <a href=\"";
foundHelper = helpers.edit_url;
if (foundHelper) { stack1 = foundHelper.call(depth0, {hash:{}}); }
else { stack1 = depth0.edit_url; stack1 = typeof stack1 === functionType ? stack1() : stack1; }
@@ -15,13 +15,13 @@
foundHelper = helpers.metadata_dbkey;
if (foundHelper) { stack1 = foundHelper.call(depth0, {hash:{}}); }
else { stack1 = depth0.metadata_dbkey; stack1 = typeof stack1 === functionType ? stack1() : stack1; }
- buffer += escapeExpression(stack1) + "</a>\n";
+ buffer += escapeExpression(stack1) + "</a>\n ";
return buffer;}
function program3(depth0,data) {
var buffer = "", stack1, foundHelper;
- buffer += "\n <span class=\"";
+ buffer += "\n <span class=\"";
foundHelper = helpers.metadata_dbkey;
if (foundHelper) { stack1 = foundHelper.call(depth0, {hash:{}}); }
else { stack1 = depth0.metadata_dbkey; stack1 = typeof stack1 === functionType ? stack1() : stack1; }
@@ -29,13 +29,24 @@
foundHelper = helpers.metadata_dbkey;
if (foundHelper) { stack1 = foundHelper.call(depth0, {hash:{}}); }
else { stack1 = depth0.metadata_dbkey; stack1 = typeof stack1 === functionType ? stack1() : stack1; }
- buffer += escapeExpression(stack1) + "</span>\n";
+ buffer += escapeExpression(stack1) + "</span>\n ";
return buffer;}
+function program5(depth0,data) {
+
+ var buffer = "", stack1, foundHelper;
+ buffer += "\n<div class=\"hda-info\">";
+ foundHelper = helpers.misc_info;
+ if (foundHelper) { stack1 = foundHelper.call(depth0, {hash:{}}); }
+ else { stack1 = depth0.misc_info; stack1 = typeof stack1 === functionType ? stack1() : stack1; }
+ buffer += escapeExpression(stack1) + "</div>\n";
+ return buffer;}
+
+ buffer += "<div class=\"hda-summary\">\n ";
foundHelper = helpers.misc_blurb;
if (foundHelper) { stack1 = foundHelper.call(depth0, {hash:{}}); }
else { stack1 = depth0.misc_blurb; stack1 = typeof stack1 === functionType ? stack1() : stack1; }
- buffer += escapeExpression(stack1) + "<br />\nformat: <span class=\"";
+ buffer += escapeExpression(stack1) + "<br />\n format: <span class=\"";
foundHelper = helpers.data_type;
if (foundHelper) { stack1 = foundHelper.call(depth0, {hash:{}}); }
else { stack1 = depth0.data_type; stack1 = typeof stack1 === functionType ? stack1() : stack1; }
@@ -43,9 +54,13 @@
foundHelper = helpers.data_type;
if (foundHelper) { stack1 = foundHelper.call(depth0, {hash:{}}); }
else { stack1 = depth0.data_type; stack1 = typeof stack1 === functionType ? stack1() : stack1; }
- buffer += escapeExpression(stack1) + "</span>,\ndatabase:\n";
+ buffer += escapeExpression(stack1) + "</span>,\n database:\n ";
stack1 = depth0.dbkey_unknown_and_editable;
stack1 = helpers['if'].call(depth0, stack1, {hash:{},inverse:self.program(3, program3, data),fn:self.program(1, program1, data)});
if(stack1 || stack1 === 0) { buffer += stack1; }
+ buffer += "\n</div>\n";
+ stack1 = depth0.misc_info;
+ stack1 = helpers['if'].call(depth0, stack1, {hash:{},inverse:self.noop,fn:self.program(5, program5, data)});
+ if(stack1 || stack1 === 0) { buffer += stack1; }
return buffer;});
})();
\ No newline at end of file
diff -r 5088185a5bca723d5e58bb6672327e0310f86fbc -r 0bb0a2d4bf3cd19b822394f36b36f2d13c02339d static/scripts/templates/compiled/template-history-tagArea.js
--- /dev/null
+++ b/static/scripts/templates/compiled/template-history-tagArea.js
@@ -0,0 +1,10 @@
+(function() {
+ var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
+templates['template-history-tagArea'] = template(function (Handlebars,depth0,helpers,partials,data) {
+ helpers = helpers || Handlebars.helpers;
+ var buffer = "";
+
+
+ buffer += "\n<div class=\"tag-area\" style=\"display: none;\">\n <strong>Tags:</strong>\n <div class=\"tag-elt\">\n </div>\n</div>";
+ return buffer;});
+})();
\ No newline at end of file
diff -r 5088185a5bca723d5e58bb6672327e0310f86fbc -r 0bb0a2d4bf3cd19b822394f36b36f2d13c02339d static/scripts/templates/compiled/template-history-warning-messages.js
--- a/static/scripts/templates/compiled/template-history-warning-messages.js
+++ b/static/scripts/templates/compiled/template-history-warning-messages.js
@@ -80,7 +80,7 @@
var buffer = "", stack1;
buffer += "\n This dataset has been hidden.\n ";
- stack1 = depth0.undelete_url;
+ stack1 = depth0.unhide_url;
stack1 = helpers['if'].call(depth0, stack1, {hash:{},inverse:self.noop,fn:self.program(11, program11, data)});
if(stack1 || stack1 === 0) { buffer += stack1; }
buffer += "\n";
diff -r 5088185a5bca723d5e58bb6672327e0310f86fbc -r 0bb0a2d4bf3cd19b822394f36b36f2d13c02339d static/scripts/templates/compiled/template-iconButton.js
--- /dev/null
+++ b/static/scripts/templates/compiled/template-iconButton.js
@@ -0,0 +1,12 @@
+(function() {
+ var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
+templates['template-iconButton'] = template(function (Handlebars,depth0,helpers,partials,data) {
+ helpers = helpers || Handlebars.helpers; partials = partials || Handlebars.partials;
+ var buffer = "", stack1, self=this;
+
+
+ buffer += "\n";
+ stack1 = self.invokePartial(partials.iconButton, 'iconButton', depth0, helpers, partials);;
+ if(stack1 || stack1 === 0) { buffer += stack1; }
+ return buffer;});
+})();
\ No newline at end of file
diff -r 5088185a5bca723d5e58bb6672327e0310f86fbc -r 0bb0a2d4bf3cd19b822394f36b36f2d13c02339d static/scripts/templates/history-templates.html
--- a/static/scripts/templates/history-templates.html
+++ b/static/scripts/templates/history-templates.html
@@ -17,7 +17,7 @@
{{#unless visible}}{{#warningmessagesmall}}
This dataset has been hidden.
- {{#if undelete_url}}
+ {{#if unhide_url}}
Click <a href="{{ unhide_url }}" class="historyItemUnhide" id="historyItemUnhider-{{ id }}"
target="galaxy_history">here</a> to unhide it
{{/if}}
@@ -29,12 +29,44 @@
</script><script type="text/template" class="template-history" id="template-history-hdaSummary">
-{{ misc_blurb }}<br />
-format: <span class="{{ data_type }}">{{ data_type }}</span>,
-database:
-{{#if dbkey_unknown_and_editable }}
- <a href="{{ edit_url }}" target="galaxy_main">{{ metadata_dbkey }}</a>
-{{else}}
- <span class="{{ metadata_dbkey }}">{{ metadata_dbkey }}</span>
+<div class="hda-summary">
+ {{ misc_blurb }}<br />
+ format: <span class="{{ data_type }}">{{ data_type }}</span>,
+ database:
+ {{#if dbkey_unknown_and_editable }}
+ <a href="{{ edit_url }}" target="galaxy_main">{{ metadata_dbkey }}</a>
+ {{else}}
+ <span class="{{ metadata_dbkey }}">{{ metadata_dbkey }}</span>
+ {{/if}}
+</div>
+{{#if misc_info}}
+<div class="hda-info">{{ misc_info }}</div>
{{/if}}
</script>
+
+<script type="text/template" class="template-history" id="template-history-failedMetaData">
+{{#warningmessagesmall}}
+An error occurred setting the metadata for this dataset.
+You may be able to <a href="{{ edit_url }}" target="galaxy_main">set it manually or retry auto-detection</a>.
+{{/warningmessagesmall}}
+</script>
+
+<script type="text/template" class="template-history" id="template-history-tagArea">
+{{! TODO: move to mvc/tag.js templates }}
+<div class="tag-area" style="display: none;">
+ <strong>Tags:</strong>
+ <div class="tag-elt">
+ </div>
+</div>
+</script>
+
+<script type="text/template" class="template-history" id="template-history-annotationArea">
+{{! TODO: move to mvc/annotations.js templates, editable-text }}
+<div id="{{ id }}-annotation-area" class="annotation-area" style="display: none;">
+ <strong>Annotation:</strong>
+ <div id="{{ id }}-anotation-elt" class="annotation-elt tooltip editable-text"
+ style="margin: 1px 0px 1px 0px" title="Edit dataset annotation">
+ </div>
+</div>
+</script>
+
diff -r 5088185a5bca723d5e58bb6672327e0310f86fbc -r 0bb0a2d4bf3cd19b822394f36b36f2d13c02339d static/scripts/templates/template-history-annotationArea.handlebars
--- /dev/null
+++ b/static/scripts/templates/template-history-annotationArea.handlebars
@@ -0,0 +1,7 @@
+{{! TODO: move to mvc/annotations.js templates, editable-text }}
+<div id="{{ id }}-annotation-area" class="annotation-area" style="display: none;">
+ <strong>Annotation:</strong>
+ <div id="{{ id }}-anotation-elt" class="annotation-elt tooltip editable-text"
+ style="margin: 1px 0px 1px 0px" title="Edit dataset annotation">
+ </div>
+</div>
\ No newline at end of file
diff -r 5088185a5bca723d5e58bb6672327e0310f86fbc -r 0bb0a2d4bf3cd19b822394f36b36f2d13c02339d static/scripts/templates/template-history-failedMetaData.handlebars
--- /dev/null
+++ b/static/scripts/templates/template-history-failedMetaData.handlebars
@@ -0,0 +1,4 @@
+{{#warningmessagesmall}}
+An error occurred setting the metadata for this dataset.
+You may be able to <a href="{{ edit_url }}" target="galaxy_main">set it manually or retry auto-detection</a>.
+{{/warningmessagesmall}}
\ No newline at end of file
diff -r 5088185a5bca723d5e58bb6672327e0310f86fbc -r 0bb0a2d4bf3cd19b822394f36b36f2d13c02339d static/scripts/templates/template-history-hdaSummary.handlebars
--- a/static/scripts/templates/template-history-hdaSummary.handlebars
+++ b/static/scripts/templates/template-history-hdaSummary.handlebars
@@ -1,8 +1,13 @@
-{{ misc_blurb }}<br />
-format: <span class="{{ data_type }}">{{ data_type }}</span>,
-database:
-{{#if dbkey_unknown_and_editable }}
- <a href="{{ edit_url }}" target="galaxy_main">{{ metadata_dbkey }}</a>
-{{else}}
- <span class="{{ metadata_dbkey }}">{{ metadata_dbkey }}</span>
+<div class="hda-summary">
+ {{ misc_blurb }}<br />
+ format: <span class="{{ data_type }}">{{ data_type }}</span>,
+ database:
+ {{#if dbkey_unknown_and_editable }}
+ <a href="{{ edit_url }}" target="galaxy_main">{{ metadata_dbkey }}</a>
+ {{else}}
+ <span class="{{ metadata_dbkey }}">{{ metadata_dbkey }}</span>
+ {{/if}}
+</div>
+{{#if misc_info}}
+<div class="hda-info">{{ misc_info }}</div>
{{/if}}
\ No newline at end of file
diff -r 5088185a5bca723d5e58bb6672327e0310f86fbc -r 0bb0a2d4bf3cd19b822394f36b36f2d13c02339d static/scripts/templates/template-history-tagArea.handlebars
--- /dev/null
+++ b/static/scripts/templates/template-history-tagArea.handlebars
@@ -0,0 +1,6 @@
+{{! TODO: move to mvc/tag.js templates }}
+<div class="tag-area" style="display: none;">
+ <strong>Tags:</strong>
+ <div class="tag-elt">
+ </div>
+</div>
\ No newline at end of file
diff -r 5088185a5bca723d5e58bb6672327e0310f86fbc -r 0bb0a2d4bf3cd19b822394f36b36f2d13c02339d static/scripts/templates/template-history-warning-messages.handlebars
--- a/static/scripts/templates/template-history-warning-messages.handlebars
+++ b/static/scripts/templates/template-history-warning-messages.handlebars
@@ -16,7 +16,7 @@
{{#unless visible}}{{#warningmessagesmall}}
This dataset has been hidden.
- {{#if undelete_url}}
+ {{#if unhide_url}}
Click <a href="{{ unhide_url }}" class="historyItemUnhide" id="historyItemUnhider-{{ id }}"
target="galaxy_history">here</a> to unhide it
{{/if}}
diff -r 5088185a5bca723d5e58bb6672327e0310f86fbc -r 0bb0a2d4bf3cd19b822394f36b36f2d13c02339d static/scripts/templates/template-iconButton.handlebars
--- /dev/null
+++ b/static/scripts/templates/template-iconButton.handlebars
@@ -0,0 +1,2 @@
+{{! alternate template-based icon-button }}
+{{> iconButton this}}
\ No newline at end of file
diff -r 5088185a5bca723d5e58bb6672327e0310f86fbc -r 0bb0a2d4bf3cd19b822394f36b36f2d13c02339d templates/root/alternate_history.mako
--- a/templates/root/alternate_history.mako
+++ b/templates/root/alternate_history.mako
@@ -302,7 +302,10 @@
"template-history-warning-messages",
"template-history-titleLink",
- "template-history-hdaSummary"
+ "template-history-hdaSummary",
+ "template-history-failedMetadata",
+ "template-history-tagArea",
+ "template-history-annotationArea"
)}
## if using in-dom templates they need to go here (before the Backbone classes are defined)
@@ -315,6 +318,53 @@
"mvc/history"
##"mvc/tags", "mvc/annotations"
)}
+
+ <script type="text/javascript">
+ GalaxyLocalization.setLocalizedString( ${ create_localization_json( get_page_localized_strings() ) } );
+ // add needed controller urls to GalaxyPaths
+ galaxy_paths.set( 'dataset_path', "${h.url_for( controller='dataset' )}" )
+
+ // Init. on document load.
+ var pageData = ${context_to_js()};
+
+ //USE_MOCK_DATA = true;
+ USE_CURR_DATA = true;
+
+ // on ready
+ $(function(){
+ if( console && console.debug ){ console.debug( 'using backbone.js in history panel' ); }
+
+ if( window.USE_MOCK_DATA ){
+ if( console && console.debug ){ console.debug( '\t using mock data' ); }
+ createMockHistoryData();
+ return;
+
+ } else if ( window.USE_CURR_DATA ){
+ if( console && console.debug ){ console.debug( '\t using current history data' ); }
+ glx_history = new History( pageData.history ).loadDatasetsAsHistoryItems( pageData.hdas );
+ glx_history_view = new HistoryView({ model: glx_history });
+ glx_history_view.render();
+
+ hi = glx_history.items.at( 0 );
+ hi_view = new HistoryItemView({ model: hi });
+ $( 'body' ).append( hi_view.render() );
+ return;
+ }
+
+ // sandbox here
+ // testing iconButton
+ //ibm = new IconButton({
+ // icon_class : 'information',
+ // on_click : function( event ){ console.debug( 'blerg' ); },
+ //});
+ //mockObj = { one : 1 };
+ //ibv = new IconButtonView({ model : ibm });
+ //new_click = function( event ){ console.debug( mockObj.one ); }
+ //$( 'body' ).append( ibv.render().$el );
+
+ });
+ </script>
+
</%def><%def name="stylesheets()">
@@ -358,41 +408,4 @@
${_('Galaxy History')}
</%def>
-<script type="text/javascript">
- GalaxyLocalization.setLocalizedString( ${ create_localization_json( get_page_localized_strings() ) } );
- // add needed controller urls to GalaxyPaths
- galaxy_paths.set( 'dataset_path', "${h.url_for( controller='dataset' )}" )
-
- // Init. on document load.
- var pageData = ${context_to_js()};
-
- //USE_MOCK_DATA = true;
- USE_CURR_DATA = true;
-
- $(function(){
- if( console && console.debug ){ console.debug( 'using backbone.js in history panel' ); }
-
- if( window.USE_MOCK_DATA ){
- if( console && console.debug ){ console.debug( '\t using mock data' ); }
- createMockHistoryData();
- return;
-
- } else if ( USE_CURR_DATA ){
- if( console && console.debug ){ console.debug( '\t using current history data' ); }
- glx_history = new History( pageData.history ).loadDatasetsAsHistoryItems( pageData.hdas );
- glx_history_view = new HistoryView({ model: glx_history });
- glx_history_view.render();
-
- hi = glx_history.items.at( 0 );
- hi_view = new HistoryItemView({ model: hi });
- $( 'body' ).append( hi_view.render() );
- return;
- }
-
- // sandbox here
- });
-</script>
-
-
-<body class="historyPage">
-</body>
+<body class="historyPage"></body>
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: greg: Add fix from Bjorn Gruning for telling the user which file is the offender if an uploaded tarball gets rejected in the tool shed.
by Bitbucket 13 Sep '12
by Bitbucket 13 Sep '12
13 Sep '12
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/changeset/5088185a5bca/
changeset: 5088185a5bca
user: greg
date: 2012-09-13 22:56:44
summary: Add fix from Bjorn Gruning for telling the user which file is the offender if an uploaded tarball gets rejected in the tool shed.
affected #: 1 file
diff -r 802413bc137b5701699b90ce97a2c4c8c6072679 -r 5088185a5bca723d5e58bb6672327e0310f86fbc lib/galaxy/webapps/community/controllers/upload.py
--- a/lib/galaxy/webapps/community/controllers/upload.py
+++ b/lib/galaxy/webapps/community/controllers/upload.py
@@ -336,8 +336,8 @@
def __check_archive( self, archive ):
for member in archive.getmembers():
# Allow regular files and directories only
- if not ( member.isdir() or member.isfile() ):
- message = "Uploaded archives can only include regular directories and files (no symbolic links, devices, etc)."
+ if not ( member.isdir() or member.isfile() or member.islnk() ):
+ message = "Uploaded archives can only include regular directories and files (no symbolic links, devices, etc). Offender: %s" % str( member )
return False, message
for item in [ '.hg', '..', '/' ]:
if member.name.startswith( item ):
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: greg: Copy required sample files before attempting to load a tool included in a tool shed repository that is being installed into a local Galaxy instance.
by Bitbucket 13 Sep '12
by Bitbucket 13 Sep '12
13 Sep '12
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/changeset/802413bc137b/
changeset: 802413bc137b
user: greg
date: 2012-09-13 22:41:03
summary: Copy required sample files before attempting to load a tool included in a tool shed repository that is being installed into a local Galaxy instance.
affected #: 3 files
diff -r 563ab1b6b311af66818ca7031746ba7201b2d7db -r 802413bc137b5701699b90ce97a2c4c8c6072679 lib/galaxy/tool_shed/install_manager.py
--- a/lib/galaxy/tool_shed/install_manager.py
+++ b/lib/galaxy/tool_shed/install_manager.py
@@ -147,13 +147,20 @@
else:
tool_dependencies = None
if 'tools' in metadata_dict:
+ sample_files = metadata_dict.get( 'sample_files', [] )
+ tool_index_sample_files = get_tool_index_sample_files( sample_files )
+ copy_sample_files( self.app, tool_index_sample_files )
+ sample_files_copied = [ s for s in tool_index_sample_files ]
repository_tools_tups = get_repository_tools_tups( self.app, metadata_dict )
if repository_tools_tups:
- sample_files = metadata_dict.get( 'sample_files', [] )
# Handle missing data table entries for tool parameters that are dynamically generated select lists.
repository_tools_tups = handle_missing_data_table_entry( self.app, relative_install_dir, self.tool_path, repository_tools_tups )
# Handle missing index files for tool parameters that are dynamically generated select lists.
- repository_tools_tups, sample_files_copied = handle_missing_index_file( self.app, self.tool_path, sample_files, repository_tools_tups )
+ repository_tools_tups, sample_files_copied = handle_missing_index_file( self.app,
+ self.tool_path,
+ sample_files,
+ repository_tools_tups,
+ sample_files_copied )
# Copy remaining sample files included in the repository to the ~/tool-data directory of the local Galaxy instance.
copy_sample_files( self.app, sample_files, sample_files_copied=sample_files_copied )
if install_dependencies and tool_dependencies and 'tool_dependencies' in metadata_dict:
diff -r 563ab1b6b311af66818ca7031746ba7201b2d7db -r 802413bc137b5701699b90ce97a2c4c8c6072679 lib/galaxy/util/shed_util.py
--- a/lib/galaxy/util/shed_util.py
+++ b/lib/galaxy/util/shed_util.py
@@ -1170,6 +1170,12 @@
file_name = strip_path( shed_tool_conf_dict[ 'config_filename' ] )
if shed_tool_conf == file_name:
return index, shed_tool_conf_dict
+def get_tool_index_sample_files( sample_files ):
+ tool_index_sample_files = []
+ for s in sample_files:
+ if s.endswith( '.loc.sample' ):
+ tool_index_sample_files.append( s )
+ return tool_index_sample_files
def get_tool_dependency( trans, id ):
"""Get a tool_dependency from the database via id"""
return trans.sa_session.query( trans.model.ToolDependency ).get( trans.security.decode_id( id ) )
@@ -1341,12 +1347,11 @@
# Reset the tool_data_tables by loading the empty tool_data_table_conf.xml file.
reset_tool_data_tables( app )
return repository_tools_tups
-def handle_missing_index_file( app, tool_path, sample_files, repository_tools_tups ):
+def handle_missing_index_file( app, tool_path, sample_files, repository_tools_tups, sample_files_copied ):
"""
Inspect each tool to see if it has any input parameters that are dynamically generated select lists that depend on a .loc file.
This method is not called from the tool shed, but from Galaxy when a repository is being installed.
"""
- sample_files_copied = []
for index, repository_tools_tup in enumerate( repository_tools_tups ):
tup_path, guid, repository_tool = repository_tools_tup
params_with_missing_index_file = repository_tool.params_with_missing_index_file
diff -r 563ab1b6b311af66818ca7031746ba7201b2d7db -r 802413bc137b5701699b90ce97a2c4c8c6072679 lib/galaxy/web/controllers/admin_toolshed.py
--- a/lib/galaxy/web/controllers/admin_toolshed.py
+++ b/lib/galaxy/web/controllers/admin_toolshed.py
@@ -720,13 +720,20 @@
tool_dependencies = create_tool_dependency_objects( trans.app, tool_shed_repository, relative_install_dir, set_status=True )
if 'tools' in metadata_dict:
tool_panel_dict = generate_tool_panel_dict_for_new_install( metadata_dict[ 'tools' ], tool_section )
+ sample_files = metadata_dict.get( 'sample_files', [] )
+ tool_index_sample_files = get_tool_index_sample_files( sample_files )
+ copy_sample_files( self.app, tool_index_sample_files )
+ sample_files_copied = [ s for s in tool_index_sample_files ]
repository_tools_tups = get_repository_tools_tups( trans.app, metadata_dict )
if repository_tools_tups:
# Handle missing data table entries for tool parameters that are dynamically generated select lists.
repository_tools_tups = handle_missing_data_table_entry( trans.app, relative_install_dir, tool_path, repository_tools_tups )
# Handle missing index files for tool parameters that are dynamically generated select lists.
- sample_files = metadata_dict.get( 'sample_files', [] )
- repository_tools_tups, sample_files_copied = handle_missing_index_file( trans.app, tool_path, sample_files, repository_tools_tups )
+ repository_tools_tups, sample_files_copied = handle_missing_index_file( trans.app,
+ tool_path,
+ sample_files,
+ repository_tools_tups,
+ sample_files_copied )
# Copy remaining sample files included in the repository to the ~/tool-data directory of the local Galaxy instance.
copy_sample_files( trans.app, sample_files, sample_files_copied=sample_files_copied )
add_to_tool_panel( app=trans.app,
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

13 Sep '12
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/changeset/563ab1b6b311/
changeset: 563ab1b6b311
user: jgoecks
date: 2012-09-13 22:23:08
summary: Move require.js to libs directory.
affected #: 3 files
diff -r 4368df9df27896599a64236a6f8f80ebb0baf8c5 -r 563ab1b6b311af66818ca7031746ba7201b2d7db static/scripts/libs/require.js
--- /dev/null
+++ b/static/scripts/libs/require.js
@@ -0,0 +1,2041 @@
+/** vim: et:ts=4:sw=4:sts=4
+ * @license RequireJS 2.0.6 Copyright (c) 2010-2012, The Dojo Foundation All Rights Reserved.
+ * Available via the MIT or new BSD license.
+ * see: http://github.com/jrburke/requirejs for details
+ */
+//Not using strict: uneven strict support in browsers, #392, and causes
+//problems with requirejs.exec()/transpiler plugins that may not be strict.
+/*jslint regexp: true, nomen: true, sloppy: true */
+/*global window, navigator, document, importScripts, jQuery, setTimeout, opera */
+
+var requirejs, require, define;
+(function (global) {
+ var req, s, head, baseElement, dataMain, src,
+ interactiveScript, currentlyAddingScript, mainScript, subPath,
+ version = '2.0.6',
+ commentRegExp = /(\/\*([\s\S]*?)\*\/|([^:]|^)\/\/(.*)$)/mg,
+ cjsRequireRegExp = /[^.]\s*require\s*\(\s*["']([^'"\s]+)["']\s*\)/g,
+ jsSuffixRegExp = /\.js$/,
+ currDirRegExp = /^\.\//,
+ op = Object.prototype,
+ ostring = op.toString,
+ hasOwn = op.hasOwnProperty,
+ ap = Array.prototype,
+ aps = ap.slice,
+ apsp = ap.splice,
+ isBrowser = !!(typeof window !== 'undefined' && navigator && document),
+ isWebWorker = !isBrowser && typeof importScripts !== 'undefined',
+ //PS3 indicates loaded and complete, but need to wait for complete
+ //specifically. Sequence is 'loading', 'loaded', execution,
+ // then 'complete'. The UA check is unfortunate, but not sure how
+ //to feature test w/o causing perf issues.
+ readyRegExp = isBrowser && navigator.platform === 'PLAYSTATION 3' ?
+ /^complete$/ : /^(complete|loaded)$/,
+ defContextName = '_',
+ //Oh the tragedy, detecting opera. See the usage of isOpera for reason.
+ isOpera = typeof opera !== 'undefined' && opera.toString() === '[object Opera]',
+ contexts = {},
+ cfg = {},
+ globalDefQueue = [],
+ useInteractive = false;
+
+ function isFunction(it) {
+ return ostring.call(it) === '[object Function]';
+ }
+
+ function isArray(it) {
+ return ostring.call(it) === '[object Array]';
+ }
+
+ /**
+ * Helper function for iterating over an array. If the func returns
+ * a true value, it will break out of the loop.
+ */
+ function each(ary, func) {
+ if (ary) {
+ var i;
+ for (i = 0; i < ary.length; i += 1) {
+ if (ary[i] && func(ary[i], i, ary)) {
+ break;
+ }
+ }
+ }
+ }
+
+ /**
+ * Helper function for iterating over an array backwards. If the func
+ * returns a true value, it will break out of the loop.
+ */
+ function eachReverse(ary, func) {
+ if (ary) {
+ var i;
+ for (i = ary.length - 1; i > -1; i -= 1) {
+ if (ary[i] && func(ary[i], i, ary)) {
+ break;
+ }
+ }
+ }
+ }
+
+ function hasProp(obj, prop) {
+ return hasOwn.call(obj, prop);
+ }
+
+ /**
+ * Cycles over properties in an object and calls a function for each
+ * property value. If the function returns a truthy value, then the
+ * iteration is stopped.
+ */
+ function eachProp(obj, func) {
+ var prop;
+ for (prop in obj) {
+ if (obj.hasOwnProperty(prop)) {
+ if (func(obj[prop], prop)) {
+ break;
+ }
+ }
+ }
+ }
+
+ /**
+ * Simple function to mix in properties from source into target,
+ * but only if target does not already have a property of the same name.
+ * This is not robust in IE for transferring methods that match
+ * Object.prototype names, but the uses of mixin here seem unlikely to
+ * trigger a problem related to that.
+ */
+ function mixin(target, source, force, deepStringMixin) {
+ if (source) {
+ eachProp(source, function (value, prop) {
+ if (force || !hasProp(target, prop)) {
+ if (deepStringMixin && typeof value !== 'string') {
+ if (!target[prop]) {
+ target[prop] = {};
+ }
+ mixin(target[prop], value, force, deepStringMixin);
+ } else {
+ target[prop] = value;
+ }
+ }
+ });
+ }
+ return target;
+ }
+
+ //Similar to Function.prototype.bind, but the 'this' object is specified
+ //first, since it is easier to read/figure out what 'this' will be.
+ function bind(obj, fn) {
+ return function () {
+ return fn.apply(obj, arguments);
+ };
+ }
+
+ function scripts() {
+ return document.getElementsByTagName('script');
+ }
+
+ //Allow getting a global that expressed in
+ //dot notation, like 'a.b.c'.
+ function getGlobal(value) {
+ if (!value) {
+ return value;
+ }
+ var g = global;
+ each(value.split('.'), function (part) {
+ g = g[part];
+ });
+ return g;
+ }
+
+ function makeContextModuleFunc(func, relMap, enableBuildCallback) {
+ return function () {
+ //A version of a require function that passes a moduleName
+ //value for items that may need to
+ //look up paths relative to the moduleName
+ var args = aps.call(arguments, 0), lastArg;
+ if (enableBuildCallback &&
+ isFunction((lastArg = args[args.length - 1]))) {
+ lastArg.__requireJsBuild = true;
+ }
+ args.push(relMap);
+ return func.apply(null, args);
+ };
+ }
+
+ function addRequireMethods(req, context, relMap) {
+ each([
+ ['toUrl'],
+ ['undef'],
+ ['defined', 'requireDefined'],
+ ['specified', 'requireSpecified']
+ ], function (item) {
+ var prop = item[1] || item[0];
+ req[item[0]] = context ? makeContextModuleFunc(context[prop], relMap) :
+ //If no context, then use default context. Reference from
+ //contexts instead of early binding to default context, so
+ //that during builds, the latest instance of the default
+ //context with its config gets used.
+ function () {
+ var ctx = contexts[defContextName];
+ return ctx[prop].apply(ctx, arguments);
+ };
+ });
+ }
+
+ /**
+ * Constructs an error with a pointer to an URL with more information.
+ * @param {String} id the error ID that maps to an ID on a web page.
+ * @param {String} message human readable error.
+ * @param {Error} [err] the original error, if there is one.
+ *
+ * @returns {Error}
+ */
+ function makeError(id, msg, err, requireModules) {
+ var e = new Error(msg + '\nhttp://requirejs.org/docs/errors.html#' + id);
+ e.requireType = id;
+ e.requireModules = requireModules;
+ if (err) {
+ e.originalError = err;
+ }
+ return e;
+ }
+
+ if (typeof define !== 'undefined') {
+ //If a define is already in play via another AMD loader,
+ //do not overwrite.
+ return;
+ }
+
+ if (typeof requirejs !== 'undefined') {
+ if (isFunction(requirejs)) {
+ //Do not overwrite and existing requirejs instance.
+ return;
+ }
+ cfg = requirejs;
+ requirejs = undefined;
+ }
+
+ //Allow for a require config object
+ if (typeof require !== 'undefined' && !isFunction(require)) {
+ //assume it is a config object.
+ cfg = require;
+ require = undefined;
+ }
+
+ function newContext(contextName) {
+ var inCheckLoaded, Module, context, handlers,
+ checkLoadedTimeoutId,
+ config = {
+ waitSeconds: 7,
+ baseUrl: './',
+ paths: {},
+ pkgs: {},
+ shim: {}
+ },
+ registry = {},
+ undefEvents = {},
+ defQueue = [],
+ defined = {},
+ urlFetched = {},
+ requireCounter = 1,
+ unnormalizedCounter = 1,
+ //Used to track the order in which modules
+ //should be executed, by the order they
+ //load. Important for consistent cycle resolution
+ //behavior.
+ waitAry = [];
+
+ /**
+ * Trims the . and .. from an array of path segments.
+ * It will keep a leading path segment if a .. will become
+ * the first path segment, to help with module name lookups,
+ * which act like paths, but can be remapped. But the end result,
+ * all paths that use this function should look normalized.
+ * NOTE: this method MODIFIES the input array.
+ * @param {Array} ary the array of path segments.
+ */
+ function trimDots(ary) {
+ var i, part;
+ for (i = 0; ary[i]; i += 1) {
+ part = ary[i];
+ if (part === '.') {
+ ary.splice(i, 1);
+ i -= 1;
+ } else if (part === '..') {
+ if (i === 1 && (ary[2] === '..' || ary[0] === '..')) {
+ //End of the line. Keep at least one non-dot
+ //path segment at the front so it can be mapped
+ //correctly to disk. Otherwise, there is likely
+ //no path mapping for a path starting with '..'.
+ //This can still fail, but catches the most reasonable
+ //uses of ..
+ break;
+ } else if (i > 0) {
+ ary.splice(i - 1, 2);
+ i -= 2;
+ }
+ }
+ }
+ }
+
+ /**
+ * Given a relative module name, like ./something, normalize it to
+ * a real name that can be mapped to a path.
+ * @param {String} name the relative name
+ * @param {String} baseName a real name that the name arg is relative
+ * to.
+ * @param {Boolean} applyMap apply the map config to the value. Should
+ * only be done if this normalization is for a dependency ID.
+ * @returns {String} normalized name
+ */
+ function normalize(name, baseName, applyMap) {
+ var pkgName, pkgConfig, mapValue, nameParts, i, j, nameSegment,
+ foundMap, foundI, foundStarMap, starI,
+ baseParts = baseName && baseName.split('/'),
+ normalizedBaseParts = baseParts,
+ map = config.map,
+ starMap = map && map['*'];
+
+ //Adjust any relative paths.
+ if (name && name.charAt(0) === '.') {
+ //If have a base name, try to normalize against it,
+ //otherwise, assume it is a top-level require that will
+ //be relative to baseUrl in the end.
+ if (baseName) {
+ if (config.pkgs[baseName]) {
+ //If the baseName is a package name, then just treat it as one
+ //name to concat the name with.
+ normalizedBaseParts = baseParts = [baseName];
+ } else {
+ //Convert baseName to array, and lop off the last part,
+ //so that . matches that 'directory' and not name of the baseName's
+ //module. For instance, baseName of 'one/two/three', maps to
+ //'one/two/three.js', but we want the directory, 'one/two' for
+ //this normalization.
+ normalizedBaseParts = baseParts.slice(0, baseParts.length - 1);
+ }
+
+ name = normalizedBaseParts.concat(name.split('/'));
+ trimDots(name);
+
+ //Some use of packages may use a . path to reference the
+ //'main' module name, so normalize for that.
+ pkgConfig = config.pkgs[(pkgName = name[0])];
+ name = name.join('/');
+ if (pkgConfig && name === pkgName + '/' + pkgConfig.main) {
+ name = pkgName;
+ }
+ } else if (name.indexOf('./') === 0) {
+ // No baseName, so this is ID is resolved relative
+ // to baseUrl, pull off the leading dot.
+ name = name.substring(2);
+ }
+ }
+
+ //Apply map config if available.
+ if (applyMap && (baseParts || starMap) && map) {
+ nameParts = name.split('/');
+
+ for (i = nameParts.length; i > 0; i -= 1) {
+ nameSegment = nameParts.slice(0, i).join('/');
+
+ if (baseParts) {
+ //Find the longest baseName segment match in the config.
+ //So, do joins on the biggest to smallest lengths of baseParts.
+ for (j = baseParts.length; j > 0; j -= 1) {
+ mapValue = map[baseParts.slice(0, j).join('/')];
+
+ //baseName segment has config, find if it has one for
+ //this name.
+ if (mapValue) {
+ mapValue = mapValue[nameSegment];
+ if (mapValue) {
+ //Match, update name to the new value.
+ foundMap = mapValue;
+ foundI = i;
+ break;
+ }
+ }
+ }
+ }
+
+ if (foundMap) {
+ break;
+ }
+
+ //Check for a star map match, but just hold on to it,
+ //if there is a shorter segment match later in a matching
+ //config, then favor over this star map.
+ if (!foundStarMap && starMap && starMap[nameSegment]) {
+ foundStarMap = starMap[nameSegment];
+ starI = i;
+ }
+ }
+
+ if (!foundMap && foundStarMap) {
+ foundMap = foundStarMap;
+ foundI = starI;
+ }
+
+ if (foundMap) {
+ nameParts.splice(0, foundI, foundMap);
+ name = nameParts.join('/');
+ }
+ }
+
+ return name;
+ }
+
+ function removeScript(name) {
+ if (isBrowser) {
+ each(scripts(), function (scriptNode) {
+ if (scriptNode.getAttribute('data-requiremodule') === name &&
+ scriptNode.getAttribute('data-requirecontext') === context.contextName) {
+ scriptNode.parentNode.removeChild(scriptNode);
+ return true;
+ }
+ });
+ }
+ }
+
+ function hasPathFallback(id) {
+ var pathConfig = config.paths[id];
+ if (pathConfig && isArray(pathConfig) && pathConfig.length > 1) {
+ removeScript(id);
+ //Pop off the first array value, since it failed, and
+ //retry
+ pathConfig.shift();
+ context.undef(id);
+ context.require([id]);
+ return true;
+ }
+ }
+
+ /**
+ * Creates a module mapping that includes plugin prefix, module
+ * name, and path. If parentModuleMap is provided it will
+ * also normalize the name via require.normalize()
+ *
+ * @param {String} name the module name
+ * @param {String} [parentModuleMap] parent module map
+ * for the module name, used to resolve relative names.
+ * @param {Boolean} isNormalized: is the ID already normalized.
+ * This is true if this call is done for a define() module ID.
+ * @param {Boolean} applyMap: apply the map config to the ID.
+ * Should only be true if this map is for a dependency.
+ *
+ * @returns {Object}
+ */
+ function makeModuleMap(name, parentModuleMap, isNormalized, applyMap) {
+ var url, pluginModule, suffix,
+ index = name ? name.indexOf('!') : -1,
+ prefix = null,
+ parentName = parentModuleMap ? parentModuleMap.name : null,
+ originalName = name,
+ isDefine = true,
+ normalizedName = '';
+
+ //If no name, then it means it is a require call, generate an
+ //internal name.
+ if (!name) {
+ isDefine = false;
+ name = '_@r' + (requireCounter += 1);
+ }
+
+ if (index !== -1) {
+ prefix = name.substring(0, index);
+ name = name.substring(index + 1, name.length);
+ }
+
+ if (prefix) {
+ prefix = normalize(prefix, parentName, applyMap);
+ pluginModule = defined[prefix];
+ }
+
+ //Account for relative paths if there is a base name.
+ if (name) {
+ if (prefix) {
+ if (pluginModule && pluginModule.normalize) {
+ //Plugin is loaded, use its normalize method.
+ normalizedName = pluginModule.normalize(name, function (name) {
+ return normalize(name, parentName, applyMap);
+ });
+ } else {
+ normalizedName = normalize(name, parentName, applyMap);
+ }
+ } else {
+ //A regular module.
+ normalizedName = normalize(name, parentName, applyMap);
+ url = context.nameToUrl(normalizedName);
+ }
+ }
+
+ //If the id is a plugin id that cannot be determined if it needs
+ //normalization, stamp it with a unique ID so two matching relative
+ //ids that may conflict can be separate.
+ suffix = prefix && !pluginModule && !isNormalized ?
+ '_unnormalized' + (unnormalizedCounter += 1) :
+ '';
+
+ return {
+ prefix: prefix,
+ name: normalizedName,
+ parentMap: parentModuleMap,
+ unnormalized: !!suffix,
+ url: url,
+ originalName: originalName,
+ isDefine: isDefine,
+ id: (prefix ?
+ prefix + '!' + normalizedName :
+ normalizedName) + suffix
+ };
+ }
+
+ function getModule(depMap) {
+ var id = depMap.id,
+ mod = registry[id];
+
+ if (!mod) {
+ mod = registry[id] = new context.Module(depMap);
+ }
+
+ return mod;
+ }
+
+ function on(depMap, name, fn) {
+ var id = depMap.id,
+ mod = registry[id];
+
+ if (hasProp(defined, id) &&
+ (!mod || mod.defineEmitComplete)) {
+ if (name === 'defined') {
+ fn(defined[id]);
+ }
+ } else {
+ getModule(depMap).on(name, fn);
+ }
+ }
+
+ function onError(err, errback) {
+ var ids = err.requireModules,
+ notified = false;
+
+ if (errback) {
+ errback(err);
+ } else {
+ each(ids, function (id) {
+ var mod = registry[id];
+ if (mod) {
+ //Set error on module, so it skips timeout checks.
+ mod.error = err;
+ if (mod.events.error) {
+ notified = true;
+ mod.emit('error', err);
+ }
+ }
+ });
+
+ if (!notified) {
+ req.onError(err);
+ }
+ }
+ }
+
+ /**
+ * Internal method to transfer globalQueue items to this context's
+ * defQueue.
+ */
+ function takeGlobalQueue() {
+ //Push all the globalDefQueue items into the context's defQueue
+ if (globalDefQueue.length) {
+ //Array splice in the values since the context code has a
+ //local var ref to defQueue, so cannot just reassign the one
+ //on context.
+ apsp.apply(defQueue,
+ [defQueue.length - 1, 0].concat(globalDefQueue));
+ globalDefQueue = [];
+ }
+ }
+
+ /**
+ * Helper function that creates a require function object to give to
+ * modules that ask for it as a dependency. It needs to be specific
+ * per module because of the implication of path mappings that may
+ * need to be relative to the module name.
+ */
+ function makeRequire(mod, enableBuildCallback, altRequire) {
+ var relMap = mod && mod.map,
+ modRequire = makeContextModuleFunc(altRequire || context.require,
+ relMap,
+ enableBuildCallback);
+
+ addRequireMethods(modRequire, context, relMap);
+ modRequire.isBrowser = isBrowser;
+
+ return modRequire;
+ }
+
+ handlers = {
+ 'require': function (mod) {
+ return makeRequire(mod);
+ },
+ 'exports': function (mod) {
+ mod.usingExports = true;
+ if (mod.map.isDefine) {
+ return (mod.exports = defined[mod.map.id] = {});
+ }
+ },
+ 'module': function (mod) {
+ return (mod.module = {
+ id: mod.map.id,
+ uri: mod.map.url,
+ config: function () {
+ return (config.config && config.config[mod.map.id]) || {};
+ },
+ exports: defined[mod.map.id]
+ });
+ }
+ };
+
+ function removeWaiting(id) {
+ //Clean up machinery used for waiting modules.
+ delete registry[id];
+
+ each(waitAry, function (mod, i) {
+ if (mod.map.id === id) {
+ waitAry.splice(i, 1);
+ if (!mod.defined) {
+ context.waitCount -= 1;
+ }
+ return true;
+ }
+ });
+ }
+
+ function findCycle(mod, traced, processed) {
+ var id = mod.map.id,
+ depArray = mod.depMaps,
+ foundModule;
+
+ //Do not bother with unitialized modules or not yet enabled
+ //modules.
+ if (!mod.inited) {
+ return;
+ }
+
+ //Found the cycle.
+ if (traced[id]) {
+ return mod;
+ }
+
+ traced[id] = true;
+
+ //Trace through the dependencies.
+ each(depArray, function (depMap) {
+ var depId = depMap.id,
+ depMod = registry[depId];
+
+ if (!depMod || processed[depId] ||
+ !depMod.inited || !depMod.enabled) {
+ return;
+ }
+
+ return (foundModule = findCycle(depMod, traced, processed));
+ });
+
+ processed[id] = true;
+
+ return foundModule;
+ }
+
+ function forceExec(mod, traced, uninited) {
+ var id = mod.map.id,
+ depArray = mod.depMaps;
+
+ if (!mod.inited || !mod.map.isDefine) {
+ return;
+ }
+
+ if (traced[id]) {
+ return defined[id];
+ }
+
+ traced[id] = mod;
+
+ each(depArray, function (depMap) {
+ var depId = depMap.id,
+ depMod = registry[depId],
+ value;
+
+ if (handlers[depId]) {
+ return;
+ }
+
+ if (depMod) {
+ if (!depMod.inited || !depMod.enabled) {
+ //Dependency is not inited,
+ //so this module cannot be
+ //given a forced value yet.
+ uninited[id] = true;
+ return;
+ }
+
+ //Get the value for the current dependency
+ value = forceExec(depMod, traced, uninited);
+
+ //Even with forcing it may not be done,
+ //in particular if the module is waiting
+ //on a plugin resource.
+ if (!uninited[depId]) {
+ mod.defineDepById(depId, value);
+ }
+ }
+ });
+
+ mod.check(true);
+
+ return defined[id];
+ }
+
+ function modCheck(mod) {
+ mod.check();
+ }
+
+ function checkLoaded() {
+ var map, modId, err, usingPathFallback,
+ waitInterval = config.waitSeconds * 1000,
+ //It is possible to disable the wait interval by using waitSeconds of 0.
+ expired = waitInterval && (context.startTime + waitInterval) < new Date().getTime(),
+ noLoads = [],
+ stillLoading = false,
+ needCycleCheck = true;
+
+ //Do not bother if this call was a result of a cycle break.
+ if (inCheckLoaded) {
+ return;
+ }
+
+ inCheckLoaded = true;
+
+ //Figure out the state of all the modules.
+ eachProp(registry, function (mod) {
+ map = mod.map;
+ modId = map.id;
+
+ //Skip things that are not enabled or in error state.
+ if (!mod.enabled) {
+ return;
+ }
+
+ if (!mod.error) {
+ //If the module should be executed, and it has not
+ //been inited and time is up, remember it.
+ if (!mod.inited && expired) {
+ if (hasPathFallback(modId)) {
+ usingPathFallback = true;
+ stillLoading = true;
+ } else {
+ noLoads.push(modId);
+ removeScript(modId);
+ }
+ } else if (!mod.inited && mod.fetched && map.isDefine) {
+ stillLoading = true;
+ if (!map.prefix) {
+ //No reason to keep looking for unfinished
+ //loading. If the only stillLoading is a
+ //plugin resource though, keep going,
+ //because it may be that a plugin resource
+ //is waiting on a non-plugin cycle.
+ return (needCycleCheck = false);
+ }
+ }
+ }
+ });
+
+ if (expired && noLoads.length) {
+ //If wait time expired, throw error of unloaded modules.
+ err = makeError('timeout', 'Load timeout for modules: ' + noLoads, null, noLoads);
+ err.contextName = context.contextName;
+ return onError(err);
+ }
+
+ //Not expired, check for a cycle.
+ if (needCycleCheck) {
+
+ each(waitAry, function (mod) {
+ if (mod.defined) {
+ return;
+ }
+
+ var cycleMod = findCycle(mod, {}, {}),
+ traced = {};
+
+ if (cycleMod) {
+ forceExec(cycleMod, traced, {});
+
+ //traced modules may have been
+ //removed from the registry, but
+ //their listeners still need to
+ //be called.
+ eachProp(traced, modCheck);
+ }
+ });
+
+ //Now that dependencies have
+ //been satisfied, trigger the
+ //completion check that then
+ //notifies listeners.
+ eachProp(registry, modCheck);
+ }
+
+ //If still waiting on loads, and the waiting load is something
+ //other than a plugin resource, or there are still outstanding
+ //scripts, then just try back later.
+ if ((!expired || usingPathFallback) && stillLoading) {
+ //Something is still waiting to load. Wait for it, but only
+ //if a timeout is not already in effect.
+ if ((isBrowser || isWebWorker) && !checkLoadedTimeoutId) {
+ checkLoadedTimeoutId = setTimeout(function () {
+ checkLoadedTimeoutId = 0;
+ checkLoaded();
+ }, 50);
+ }
+ }
+
+ inCheckLoaded = false;
+ }
+
+ Module = function (map) {
+ this.events = undefEvents[map.id] || {};
+ this.map = map;
+ this.shim = config.shim[map.id];
+ this.depExports = [];
+ this.depMaps = [];
+ this.depMatched = [];
+ this.pluginMaps = {};
+ this.depCount = 0;
+
+ /* this.exports this.factory
+ this.depMaps = [],
+ this.enabled, this.fetched
+ */
+ };
+
+ Module.prototype = {
+ init: function (depMaps, factory, errback, options) {
+ options = options || {};
+
+ //Do not do more inits if already done. Can happen if there
+ //are multiple define calls for the same module. That is not
+ //a normal, common case, but it is also not unexpected.
+ if (this.inited) {
+ return;
+ }
+
+ this.factory = factory;
+
+ if (errback) {
+ //Register for errors on this module.
+ this.on('error', errback);
+ } else if (this.events.error) {
+ //If no errback already, but there are error listeners
+ //on this module, set up an errback to pass to the deps.
+ errback = bind(this, function (err) {
+ this.emit('error', err);
+ });
+ }
+
+ //Do a copy of the dependency array, so that
+ //source inputs are not modified. For example
+ //"shim" deps are passed in here directly, and
+ //doing a direct modification of the depMaps array
+ //would affect that config.
+ this.depMaps = depMaps && depMaps.slice(0);
+ this.depMaps.rjsSkipMap = depMaps.rjsSkipMap;
+
+ this.errback = errback;
+
+ //Indicate this module has be initialized
+ this.inited = true;
+
+ this.ignore = options.ignore;
+
+ //Could have option to init this module in enabled mode,
+ //or could have been previously marked as enabled. However,
+ //the dependencies are not known until init is called. So
+ //if enabled previously, now trigger dependencies as enabled.
+ if (options.enabled || this.enabled) {
+ //Enable this module and dependencies.
+ //Will call this.check()
+ this.enable();
+ } else {
+ this.check();
+ }
+ },
+
+ defineDepById: function (id, depExports) {
+ var i;
+
+ //Find the index for this dependency.
+ each(this.depMaps, function (map, index) {
+ if (map.id === id) {
+ i = index;
+ return true;
+ }
+ });
+
+ return this.defineDep(i, depExports);
+ },
+
+ defineDep: function (i, depExports) {
+ //Because of cycles, defined callback for a given
+ //export can be called more than once.
+ if (!this.depMatched[i]) {
+ this.depMatched[i] = true;
+ this.depCount -= 1;
+ this.depExports[i] = depExports;
+ }
+ },
+
+ fetch: function () {
+ if (this.fetched) {
+ return;
+ }
+ this.fetched = true;
+
+ context.startTime = (new Date()).getTime();
+
+ var map = this.map;
+
+ //If the manager is for a plugin managed resource,
+ //ask the plugin to load it now.
+ if (this.shim) {
+ makeRequire(this, true)(this.shim.deps || [], bind(this, function () {
+ return map.prefix ? this.callPlugin() : this.load();
+ }));
+ } else {
+ //Regular dependency.
+ return map.prefix ? this.callPlugin() : this.load();
+ }
+ },
+
+ load: function () {
+ var url = this.map.url;
+
+ //Regular dependency.
+ if (!urlFetched[url]) {
+ urlFetched[url] = true;
+ context.load(this.map.id, url);
+ }
+ },
+
+ /**
+ * Checks is the module is ready to define itself, and if so,
+ * define it. If the silent argument is true, then it will just
+ * define, but not notify listeners, and not ask for a context-wide
+ * check of all loaded modules. That is useful for cycle breaking.
+ */
+ check: function (silent) {
+ if (!this.enabled || this.enabling) {
+ return;
+ }
+
+ var err, cjsModule,
+ id = this.map.id,
+ depExports = this.depExports,
+ exports = this.exports,
+ factory = this.factory;
+
+ if (!this.inited) {
+ this.fetch();
+ } else if (this.error) {
+ this.emit('error', this.error);
+ } else if (!this.defining) {
+ //The factory could trigger another require call
+ //that would result in checking this module to
+ //define itself again. If already in the process
+ //of doing that, skip this work.
+ this.defining = true;
+
+ if (this.depCount < 1 && !this.defined) {
+ if (isFunction(factory)) {
+ //If there is an error listener, favor passing
+ //to that instead of throwing an error.
+ if (this.events.error) {
+ try {
+ exports = context.execCb(id, factory, depExports, exports);
+ } catch (e) {
+ err = e;
+ }
+ } else {
+ exports = context.execCb(id, factory, depExports, exports);
+ }
+
+ if (this.map.isDefine) {
+ //If setting exports via 'module' is in play,
+ //favor that over return value and exports. After that,
+ //favor a non-undefined return value over exports use.
+ cjsModule = this.module;
+ if (cjsModule &&
+ cjsModule.exports !== undefined &&
+ //Make sure it is not already the exports value
+ cjsModule.exports !== this.exports) {
+ exports = cjsModule.exports;
+ } else if (exports === undefined && this.usingExports) {
+ //exports already set the defined value.
+ exports = this.exports;
+ }
+ }
+
+ if (err) {
+ err.requireMap = this.map;
+ err.requireModules = [this.map.id];
+ err.requireType = 'define';
+ return onError((this.error = err));
+ }
+
+ } else {
+ //Just a literal value
+ exports = factory;
+ }
+
+ this.exports = exports;
+
+ if (this.map.isDefine && !this.ignore) {
+ defined[id] = exports;
+
+ if (req.onResourceLoad) {
+ req.onResourceLoad(context, this.map, this.depMaps);
+ }
+ }
+
+ //Clean up
+ delete registry[id];
+
+ this.defined = true;
+ context.waitCount -= 1;
+ if (context.waitCount === 0) {
+ //Clear the wait array used for cycles.
+ waitAry = [];
+ }
+ }
+
+ //Finished the define stage. Allow calling check again
+ //to allow define notifications below in the case of a
+ //cycle.
+ this.defining = false;
+
+ if (!silent) {
+ if (this.defined && !this.defineEmitted) {
+ this.defineEmitted = true;
+ this.emit('defined', this.exports);
+ this.defineEmitComplete = true;
+ }
+ }
+ }
+ },
+
+ callPlugin: function () {
+ var map = this.map,
+ id = map.id,
+ pluginMap = makeModuleMap(map.prefix, null, false, true);
+
+ on(pluginMap, 'defined', bind(this, function (plugin) {
+ var load, normalizedMap, normalizedMod,
+ name = this.map.name,
+ parentName = this.map.parentMap ? this.map.parentMap.name : null;
+
+ //If current map is not normalized, wait for that
+ //normalized name to load instead of continuing.
+ if (this.map.unnormalized) {
+ //Normalize the ID if the plugin allows it.
+ if (plugin.normalize) {
+ name = plugin.normalize(name, function (name) {
+ return normalize(name, parentName, true);
+ }) || '';
+ }
+
+ normalizedMap = makeModuleMap(map.prefix + '!' + name,
+ this.map.parentMap,
+ false,
+ true);
+ on(normalizedMap,
+ 'defined', bind(this, function (value) {
+ this.init([], function () { return value; }, null, {
+ enabled: true,
+ ignore: true
+ });
+ }));
+ normalizedMod = registry[normalizedMap.id];
+ if (normalizedMod) {
+ if (this.events.error) {
+ normalizedMod.on('error', bind(this, function (err) {
+ this.emit('error', err);
+ }));
+ }
+ normalizedMod.enable();
+ }
+
+ return;
+ }
+
+ load = bind(this, function (value) {
+ this.init([], function () { return value; }, null, {
+ enabled: true
+ });
+ });
+
+ load.error = bind(this, function (err) {
+ this.inited = true;
+ this.error = err;
+ err.requireModules = [id];
+
+ //Remove temp unnormalized modules for this module,
+ //since they will never be resolved otherwise now.
+ eachProp(registry, function (mod) {
+ if (mod.map.id.indexOf(id + '_unnormalized') === 0) {
+ removeWaiting(mod.map.id);
+ }
+ });
+
+ onError(err);
+ });
+
+ //Allow plugins to load other code without having to know the
+ //context or how to 'complete' the load.
+ load.fromText = function (moduleName, text) {
+ /*jslint evil: true */
+ var hasInteractive = useInteractive;
+
+ //Turn off interactive script matching for IE for any define
+ //calls in the text, then turn it back on at the end.
+ if (hasInteractive) {
+ useInteractive = false;
+ }
+
+ //Prime the system by creating a module instance for
+ //it.
+ getModule(makeModuleMap(moduleName));
+
+ req.exec(text);
+
+ if (hasInteractive) {
+ useInteractive = true;
+ }
+
+ //Support anonymous modules.
+ context.completeLoad(moduleName);
+ };
+
+ //Use parentName here since the plugin's name is not reliable,
+ //could be some weird string with no path that actually wants to
+ //reference the parentName's path.
+ plugin.load(map.name, makeRequire(map.parentMap, true, function (deps, cb, er) {
+ deps.rjsSkipMap = true;
+ return context.require(deps, cb, er);
+ }), load, config);
+ }));
+
+ context.enable(pluginMap, this);
+ this.pluginMaps[pluginMap.id] = pluginMap;
+ },
+
+ enable: function () {
+ this.enabled = true;
+
+ if (!this.waitPushed) {
+ waitAry.push(this);
+ context.waitCount += 1;
+ this.waitPushed = true;
+ }
+
+ //Set flag mentioning that the module is enabling,
+ //so that immediate calls to the defined callbacks
+ //for dependencies do not trigger inadvertent load
+ //with the depCount still being zero.
+ this.enabling = true;
+
+ //Enable each dependency
+ each(this.depMaps, bind(this, function (depMap, i) {
+ var id, mod, handler;
+
+ if (typeof depMap === 'string') {
+ //Dependency needs to be converted to a depMap
+ //and wired up to this module.
+ depMap = makeModuleMap(depMap,
+ (this.map.isDefine ? this.map : this.map.parentMap),
+ false,
+ !this.depMaps.rjsSkipMap);
+ this.depMaps[i] = depMap;
+
+ handler = handlers[depMap.id];
+
+ if (handler) {
+ this.depExports[i] = handler(this);
+ return;
+ }
+
+ this.depCount += 1;
+
+ on(depMap, 'defined', bind(this, function (depExports) {
+ this.defineDep(i, depExports);
+ this.check();
+ }));
+
+ if (this.errback) {
+ on(depMap, 'error', this.errback);
+ }
+ }
+
+ id = depMap.id;
+ mod = registry[id];
+
+ //Skip special modules like 'require', 'exports', 'module'
+ //Also, don't call enable if it is already enabled,
+ //important in circular dependency cases.
+ if (!handlers[id] && mod && !mod.enabled) {
+ context.enable(depMap, this);
+ }
+ }));
+
+ //Enable each plugin that is used in
+ //a dependency
+ eachProp(this.pluginMaps, bind(this, function (pluginMap) {
+ var mod = registry[pluginMap.id];
+ if (mod && !mod.enabled) {
+ context.enable(pluginMap, this);
+ }
+ }));
+
+ this.enabling = false;
+
+ this.check();
+ },
+
+ on: function (name, cb) {
+ var cbs = this.events[name];
+ if (!cbs) {
+ cbs = this.events[name] = [];
+ }
+ cbs.push(cb);
+ },
+
+ emit: function (name, evt) {
+ each(this.events[name], function (cb) {
+ cb(evt);
+ });
+ if (name === 'error') {
+ //Now that the error handler was triggered, remove
+ //the listeners, since this broken Module instance
+ //can stay around for a while in the registry/waitAry.
+ delete this.events[name];
+ }
+ }
+ };
+
+ function callGetModule(args) {
+ getModule(makeModuleMap(args[0], null, true)).init(args[1], args[2]);
+ }
+
+ function removeListener(node, func, name, ieName) {
+ //Favor detachEvent because of IE9
+ //issue, see attachEvent/addEventListener comment elsewhere
+ //in this file.
+ if (node.detachEvent && !isOpera) {
+ //Probably IE. If not it will throw an error, which will be
+ //useful to know.
+ if (ieName) {
+ node.detachEvent(ieName, func);
+ }
+ } else {
+ node.removeEventListener(name, func, false);
+ }
+ }
+
+ /**
+ * Given an event from a script node, get the requirejs info from it,
+ * and then removes the event listeners on the node.
+ * @param {Event} evt
+ * @returns {Object}
+ */
+ function getScriptData(evt) {
+ //Using currentTarget instead of target for Firefox 2.0's sake. Not
+ //all old browsers will be supported, but this one was easy enough
+ //to support and still makes sense.
+ var node = evt.currentTarget || evt.srcElement;
+
+ //Remove the listeners once here.
+ removeListener(node, context.onScriptLoad, 'load', 'onreadystatechange');
+ removeListener(node, context.onScriptError, 'error');
+
+ return {
+ node: node,
+ id: node && node.getAttribute('data-requiremodule')
+ };
+ }
+
+ return (context = {
+ config: config,
+ contextName: contextName,
+ registry: registry,
+ defined: defined,
+ urlFetched: urlFetched,
+ waitCount: 0,
+ defQueue: defQueue,
+ Module: Module,
+ makeModuleMap: makeModuleMap,
+
+ /**
+ * Set a configuration for the context.
+ * @param {Object} cfg config object to integrate.
+ */
+ configure: function (cfg) {
+ //Make sure the baseUrl ends in a slash.
+ if (cfg.baseUrl) {
+ if (cfg.baseUrl.charAt(cfg.baseUrl.length - 1) !== '/') {
+ cfg.baseUrl += '/';
+ }
+ }
+
+ //Save off the paths and packages since they require special processing,
+ //they are additive.
+ var pkgs = config.pkgs,
+ shim = config.shim,
+ paths = config.paths,
+ map = config.map;
+
+ //Mix in the config values, favoring the new values over
+ //existing ones in context.config.
+ mixin(config, cfg, true);
+
+ //Merge paths.
+ config.paths = mixin(paths, cfg.paths, true);
+
+ //Merge map
+ if (cfg.map) {
+ config.map = mixin(map || {}, cfg.map, true, true);
+ }
+
+ //Merge shim
+ if (cfg.shim) {
+ eachProp(cfg.shim, function (value, id) {
+ //Normalize the structure
+ if (isArray(value)) {
+ value = {
+ deps: value
+ };
+ }
+ if (value.exports && !value.exports.__buildReady) {
+ value.exports = context.makeShimExports(value.exports);
+ }
+ shim[id] = value;
+ });
+ config.shim = shim;
+ }
+
+ //Adjust packages if necessary.
+ if (cfg.packages) {
+ each(cfg.packages, function (pkgObj) {
+ var location;
+
+ pkgObj = typeof pkgObj === 'string' ? { name: pkgObj } : pkgObj;
+ location = pkgObj.location;
+
+ //Create a brand new object on pkgs, since currentPackages can
+ //be passed in again, and config.pkgs is the internal transformed
+ //state for all package configs.
+ pkgs[pkgObj.name] = {
+ name: pkgObj.name,
+ location: location || pkgObj.name,
+ //Remove leading dot in main, so main paths are normalized,
+ //and remove any trailing .js, since different package
+ //envs have different conventions: some use a module name,
+ //some use a file name.
+ main: (pkgObj.main || 'main')
+ .replace(currDirRegExp, '')
+ .replace(jsSuffixRegExp, '')
+ };
+ });
+
+ //Done with modifications, assing packages back to context config
+ config.pkgs = pkgs;
+ }
+
+ //If there are any "waiting to execute" modules in the registry,
+ //update the maps for them, since their info, like URLs to load,
+ //may have changed.
+ eachProp(registry, function (mod, id) {
+ //If module already has init called, since it is too
+ //late to modify them, and ignore unnormalized ones
+ //since they are transient.
+ if (!mod.inited && !mod.map.unnormalized) {
+ mod.map = makeModuleMap(id);
+ }
+ });
+
+ //If a deps array or a config callback is specified, then call
+ //require with those args. This is useful when require is defined as a
+ //config object before require.js is loaded.
+ if (cfg.deps || cfg.callback) {
+ context.require(cfg.deps || [], cfg.callback);
+ }
+ },
+
+ makeShimExports: function (exports) {
+ var func;
+ if (typeof exports === 'string') {
+ func = function () {
+ return getGlobal(exports);
+ };
+ //Save the exports for use in nodefine checking.
+ func.exports = exports;
+ return func;
+ } else {
+ return function () {
+ return exports.apply(global, arguments);
+ };
+ }
+ },
+
+ requireDefined: function (id, relMap) {
+ return hasProp(defined, makeModuleMap(id, relMap, false, true).id);
+ },
+
+ requireSpecified: function (id, relMap) {
+ id = makeModuleMap(id, relMap, false, true).id;
+ return hasProp(defined, id) || hasProp(registry, id);
+ },
+
+ require: function (deps, callback, errback, relMap) {
+ var moduleName, id, map, requireMod, args;
+ if (typeof deps === 'string') {
+ if (isFunction(callback)) {
+ //Invalid call
+ return onError(makeError('requireargs', 'Invalid require call'), errback);
+ }
+
+ //Synchronous access to one module. If require.get is
+ //available (as in the Node adapter), prefer that.
+ //In this case deps is the moduleName and callback is
+ //the relMap
+ if (req.get) {
+ return req.get(context, deps, callback);
+ }
+
+ //Just return the module wanted. In this scenario, the
+ //second arg (if passed) is just the relMap.
+ moduleName = deps;
+ relMap = callback;
+
+ //Normalize module name, if it contains . or ..
+ map = makeModuleMap(moduleName, relMap, false, true);
+ id = map.id;
+
+ if (!hasProp(defined, id)) {
+ return onError(makeError('notloaded', 'Module name "' +
+ id +
+ '" has not been loaded yet for context: ' +
+ contextName));
+ }
+ return defined[id];
+ }
+
+ //Callback require. Normalize args. if callback or errback is
+ //not a function, it means it is a relMap. Test errback first.
+ if (errback && !isFunction(errback)) {
+ relMap = errback;
+ errback = undefined;
+ }
+ if (callback && !isFunction(callback)) {
+ relMap = callback;
+ callback = undefined;
+ }
+
+ //Any defined modules in the global queue, intake them now.
+ takeGlobalQueue();
+
+ //Make sure any remaining defQueue items get properly processed.
+ while (defQueue.length) {
+ args = defQueue.shift();
+ if (args[0] === null) {
+ return onError(makeError('mismatch', 'Mismatched anonymous define() module: ' + args[args.length - 1]));
+ } else {
+ //args are id, deps, factory. Should be normalized by the
+ //define() function.
+ callGetModule(args);
+ }
+ }
+
+ //Mark all the dependencies as needing to be loaded.
+ requireMod = getModule(makeModuleMap(null, relMap));
+
+ requireMod.init(deps, callback, errback, {
+ enabled: true
+ });
+
+ checkLoaded();
+
+ return context.require;
+ },
+
+ undef: function (id) {
+ //Bind any waiting define() calls to this context,
+ //fix for #408
+ takeGlobalQueue();
+
+ var map = makeModuleMap(id, null, true),
+ mod = registry[id];
+
+ delete defined[id];
+ delete urlFetched[map.url];
+ delete undefEvents[id];
+
+ if (mod) {
+ //Hold on to listeners in case the
+ //module will be attempted to be reloaded
+ //using a different config.
+ if (mod.events.defined) {
+ undefEvents[id] = mod.events;
+ }
+
+ removeWaiting(id);
+ }
+ },
+
+ /**
+ * Called to enable a module if it is still in the registry
+ * awaiting enablement. parent module is passed in for context,
+ * used by the optimizer.
+ */
+ enable: function (depMap, parent) {
+ var mod = registry[depMap.id];
+ if (mod) {
+ getModule(depMap).enable();
+ }
+ },
+
+ /**
+ * Internal method used by environment adapters to complete a load event.
+ * A load event could be a script load or just a load pass from a synchronous
+ * load call.
+ * @param {String} moduleName the name of the module to potentially complete.
+ */
+ completeLoad: function (moduleName) {
+ var found, args, mod,
+ shim = config.shim[moduleName] || {},
+ shExports = shim.exports && shim.exports.exports;
+
+ takeGlobalQueue();
+
+ while (defQueue.length) {
+ args = defQueue.shift();
+ if (args[0] === null) {
+ args[0] = moduleName;
+ //If already found an anonymous module and bound it
+ //to this name, then this is some other anon module
+ //waiting for its completeLoad to fire.
+ if (found) {
+ break;
+ }
+ found = true;
+ } else if (args[0] === moduleName) {
+ //Found matching define call for this script!
+ found = true;
+ }
+
+ callGetModule(args);
+ }
+
+ //Do this after the cycle of callGetModule in case the result
+ //of those calls/init calls changes the registry.
+ mod = registry[moduleName];
+
+ if (!found && !defined[moduleName] && mod && !mod.inited) {
+ if (config.enforceDefine && (!shExports || !getGlobal(shExports))) {
+ if (hasPathFallback(moduleName)) {
+ return;
+ } else {
+ return onError(makeError('nodefine',
+ 'No define call for ' + moduleName,
+ null,
+ [moduleName]));
+ }
+ } else {
+ //A script that does not call define(), so just simulate
+ //the call for it.
+ callGetModule([moduleName, (shim.deps || []), shim.exports]);
+ }
+ }
+
+ checkLoaded();
+ },
+
+ /**
+ * Converts a module name + .extension into an URL path.
+ * *Requires* the use of a module name. It does not support using
+ * plain URLs like nameToUrl.
+ */
+ toUrl: function (moduleNamePlusExt, relModuleMap) {
+ var index = moduleNamePlusExt.lastIndexOf('.'),
+ ext = null;
+
+ if (index !== -1) {
+ ext = moduleNamePlusExt.substring(index, moduleNamePlusExt.length);
+ moduleNamePlusExt = moduleNamePlusExt.substring(0, index);
+ }
+
+ return context.nameToUrl(normalize(moduleNamePlusExt, relModuleMap && relModuleMap.id, true),
+ ext);
+ },
+
+ /**
+ * Converts a module name to a file path. Supports cases where
+ * moduleName may actually be just an URL.
+ * Note that it **does not** call normalize on the moduleName,
+ * it is assumed to have already been normalized. This is an
+ * internal API, not a public one. Use toUrl for the public API.
+ */
+ nameToUrl: function (moduleName, ext) {
+ var paths, pkgs, pkg, pkgPath, syms, i, parentModule, url,
+ parentPath;
+
+ //If a colon is in the URL, it indicates a protocol is used and it is just
+ //an URL to a file, or if it starts with a slash, contains a query arg (i.e. ?)
+ //or ends with .js, then assume the user meant to use an url and not a module id.
+ //The slash is important for protocol-less URLs as well as full paths.
+ if (req.jsExtRegExp.test(moduleName)) {
+ //Just a plain path, not module name lookup, so just return it.
+ //Add extension if it is included. This is a bit wonky, only non-.js things pass
+ //an extension, this method probably needs to be reworked.
+ url = moduleName + (ext || '');
+ } else {
+ //A module that needs to be converted to a path.
+ paths = config.paths;
+ pkgs = config.pkgs;
+
+ syms = moduleName.split('/');
+ //For each module name segment, see if there is a path
+ //registered for it. Start with most specific name
+ //and work up from it.
+ for (i = syms.length; i > 0; i -= 1) {
+ parentModule = syms.slice(0, i).join('/');
+ pkg = pkgs[parentModule];
+ parentPath = paths[parentModule];
+ if (parentPath) {
+ //If an array, it means there are a few choices,
+ //Choose the one that is desired
+ if (isArray(parentPath)) {
+ parentPath = parentPath[0];
+ }
+ syms.splice(0, i, parentPath);
+ break;
+ } else if (pkg) {
+ //If module name is just the package name, then looking
+ //for the main module.
+ if (moduleName === pkg.name) {
+ pkgPath = pkg.location + '/' + pkg.main;
+ } else {
+ pkgPath = pkg.location;
+ }
+ syms.splice(0, i, pkgPath);
+ break;
+ }
+ }
+
+ //Join the path parts together, then figure out if baseUrl is needed.
+ url = syms.join('/');
+ url += (ext || (/\?/.test(url) ? '' : '.js'));
+ url = (url.charAt(0) === '/' || url.match(/^[\w\+\.\-]+:/) ? '' : config.baseUrl) + url;
+ }
+
+ return config.urlArgs ? url +
+ ((url.indexOf('?') === -1 ? '?' : '&') +
+ config.urlArgs) : url;
+ },
+
+ //Delegates to req.load. Broken out as a separate function to
+ //allow overriding in the optimizer.
+ load: function (id, url) {
+ req.load(context, id, url);
+ },
+
+ /**
+ * Executes a module callack function. Broken out as a separate function
+ * solely to allow the build system to sequence the files in the built
+ * layer in the right sequence.
+ *
+ * @private
+ */
+ execCb: function (name, callback, args, exports) {
+ return callback.apply(exports, args);
+ },
+
+ /**
+ * callback for script loads, used to check status of loading.
+ *
+ * @param {Event} evt the event from the browser for the script
+ * that was loaded.
+ */
+ onScriptLoad: function (evt) {
+ //Using currentTarget instead of target for Firefox 2.0's sake. Not
+ //all old browsers will be supported, but this one was easy enough
+ //to support and still makes sense.
+ if (evt.type === 'load' ||
+ (readyRegExp.test((evt.currentTarget || evt.srcElement).readyState))) {
+ //Reset interactive script so a script node is not held onto for
+ //to long.
+ interactiveScript = null;
+
+ //Pull out the name of the module and the context.
+ var data = getScriptData(evt);
+ context.completeLoad(data.id);
+ }
+ },
+
+ /**
+ * Callback for script errors.
+ */
+ onScriptError: function (evt) {
+ var data = getScriptData(evt);
+ if (!hasPathFallback(data.id)) {
+ return onError(makeError('scripterror', 'Script error', evt, [data.id]));
+ }
+ }
+ });
+ }
+
+ /**
+ * Main entry point.
+ *
+ * If the only argument to require is a string, then the module that
+ * is represented by that string is fetched for the appropriate context.
+ *
+ * If the first argument is an array, then it will be treated as an array
+ * of dependency string names to fetch. An optional function callback can
+ * be specified to execute when all of those dependencies are available.
+ *
+ * Make a local req variable to help Caja compliance (it assumes things
+ * on a require that are not standardized), and to give a short
+ * name for minification/local scope use.
+ */
+ req = requirejs = function (deps, callback, errback, optional) {
+
+ //Find the right context, use default
+ var context, config,
+ contextName = defContextName;
+
+ // Determine if have config object in the call.
+ if (!isArray(deps) && typeof deps !== 'string') {
+ // deps is a config object
+ config = deps;
+ if (isArray(callback)) {
+ // Adjust args if there are dependencies
+ deps = callback;
+ callback = errback;
+ errback = optional;
+ } else {
+ deps = [];
+ }
+ }
+
+ if (config && config.context) {
+ contextName = config.context;
+ }
+
+ context = contexts[contextName];
+ if (!context) {
+ context = contexts[contextName] = req.s.newContext(contextName);
+ }
+
+ if (config) {
+ context.configure(config);
+ }
+
+ return context.require(deps, callback, errback);
+ };
+
+ /**
+ * Support require.config() to make it easier to cooperate with other
+ * AMD loaders on globally agreed names.
+ */
+ req.config = function (config) {
+ return req(config);
+ };
+
+ /**
+ * Export require as a global, but only if it does not already exist.
+ */
+ if (!require) {
+ require = req;
+ }
+
+ req.version = version;
+
+ //Used to filter out dependencies that are already paths.
+ req.jsExtRegExp = /^\/|:|\?|\.js$/;
+ req.isBrowser = isBrowser;
+ s = req.s = {
+ contexts: contexts,
+ newContext: newContext
+ };
+
+ //Create default context.
+ req({});
+
+ //Exports some context-sensitive methods on global require, using
+ //default context if no context specified.
+ addRequireMethods(req);
+
+ if (isBrowser) {
+ head = s.head = document.getElementsByTagName('head')[0];
+ //If BASE tag is in play, using appendChild is a problem for IE6.
+ //When that browser dies, this can be removed. Details in this jQuery bug:
+ //http://dev.jquery.com/ticket/2709
+ baseElement = document.getElementsByTagName('base')[0];
+ if (baseElement) {
+ head = s.head = baseElement.parentNode;
+ }
+ }
+
+ /**
+ * Any errors that require explicitly generates will be passed to this
+ * function. Intercept/override it if you want custom error handling.
+ * @param {Error} err the error object.
+ */
+ req.onError = function (err) {
+ throw err;
+ };
+
+ /**
+ * Does the request to load a module for the browser case.
+ * Make this a separate function to allow other environments
+ * to override it.
+ *
+ * @param {Object} context the require context to find state.
+ * @param {String} moduleName the name of the module.
+ * @param {Object} url the URL to the module.
+ */
+ req.load = function (context, moduleName, url) {
+ var config = (context && context.config) || {},
+ node;
+ if (isBrowser) {
+ //In the browser so use a script tag
+ node = config.xhtml ?
+ document.createElementNS('http://www.w3.org/1999/xhtml', 'html:script') :
+ document.createElement('script');
+ node.type = config.scriptType || 'text/javascript';
+ node.charset = 'utf-8';
+ node.async = true;
+
+ node.setAttribute('data-requirecontext', context.contextName);
+ node.setAttribute('data-requiremodule', moduleName);
+
+ //Set up load listener. Test attachEvent first because IE9 has
+ //a subtle issue in its addEventListener and script onload firings
+ //that do not match the behavior of all other browsers with
+ //addEventListener support, which fire the onload event for a
+ //script right after the script execution. See:
+ //https://connect.microsoft.com/IE/feedback/details/648057/script-onload-event-is-not-fired-immediately-after-script-execution
+ //UNFORTUNATELY Opera implements attachEvent but does not follow the script
+ //script execution mode.
+ if (node.attachEvent &&
+ //Check if node.attachEvent is artificially added by custom script or
+ //natively supported by browser
+ //read https://github.com/jrburke/requirejs/issues/187
+ //if we can NOT find [native code] then it must NOT natively supported.
+ //in IE8, node.attachEvent does not have toString()
+ //Note the test for "[native code" with no closing brace, see:
+ //https://github.com/jrburke/requirejs/issues/273
+ !(node.attachEvent.toString && node.attachEvent.toString().indexOf('[native code') < 0) &&
+ !isOpera) {
+ //Probably IE. IE (at least 6-8) do not fire
+ //script onload right after executing the script, so
+ //we cannot tie the anonymous define call to a name.
+ //However, IE reports the script as being in 'interactive'
+ //readyState at the time of the define call.
+ useInteractive = true;
+
+ node.attachEvent('onreadystatechange', context.onScriptLoad);
+ //It would be great to add an error handler here to catch
+ //404s in IE9+. However, onreadystatechange will fire before
+ //the error handler, so that does not help. If addEvenListener
+ //is used, then IE will fire error before load, but we cannot
+ //use that pathway given the connect.microsoft.com issue
+ //mentioned above about not doing the 'script execute,
+ //then fire the script load event listener before execute
+ //next script' that other browsers do.
+ //Best hope: IE10 fixes the issues,
+ //and then destroys all installs of IE 6-9.
+ //node.attachEvent('onerror', context.onScriptError);
+ } else {
+ node.addEventListener('load', context.onScriptLoad, false);
+ node.addEventListener('error', context.onScriptError, false);
+ }
+ node.src = url;
+
+ //For some cache cases in IE 6-8, the script executes before the end
+ //of the appendChild execution, so to tie an anonymous define
+ //call to the module name (which is stored on the node), hold on
+ //to a reference to this node, but clear after the DOM insertion.
+ currentlyAddingScript = node;
+ if (baseElement) {
+ head.insertBefore(node, baseElement);
+ } else {
+ head.appendChild(node);
+ }
+ currentlyAddingScript = null;
+
+ return node;
+ } else if (isWebWorker) {
+ //In a web worker, use importScripts. This is not a very
+ //efficient use of importScripts, importScripts will block until
+ //its script is downloaded and evaluated. However, if web workers
+ //are in play, the expectation that a build has been done so that
+ //only one script needs to be loaded anyway. This may need to be
+ //reevaluated if other use cases become common.
+ importScripts(url);
+
+ //Account for anonymous modules
+ context.completeLoad(moduleName);
+ }
+ };
+
+ function getInteractiveScript() {
+ if (interactiveScript && interactiveScript.readyState === 'interactive') {
+ return interactiveScript;
+ }
+
+ eachReverse(scripts(), function (script) {
+ if (script.readyState === 'interactive') {
+ return (interactiveScript = script);
+ }
+ });
+ return interactiveScript;
+ }
+
+ //Look for a data-main script attribute, which could also adjust the baseUrl.
+ if (isBrowser) {
+ //Figure out baseUrl. Get it from the script tag with require.js in it.
+ eachReverse(scripts(), function (script) {
+ //Set the 'head' where we can append children by
+ //using the script's parent.
+ if (!head) {
+ head = script.parentNode;
+ }
+
+ //Look for a data-main attribute to set main script for the page
+ //to load. If it is there, the path to data main becomes the
+ //baseUrl, if it is not already set.
+ dataMain = script.getAttribute('data-main');
+ if (dataMain) {
+ //Set final baseUrl if there is not already an explicit one.
+ if (!cfg.baseUrl) {
+ //Pull off the directory of data-main for use as the
+ //baseUrl.
+ src = dataMain.split('/');
+ mainScript = src.pop();
+ subPath = src.length ? src.join('/') + '/' : './';
+
+ cfg.baseUrl = subPath;
+ dataMain = mainScript;
+ }
+
+ //Strip off any trailing .js since dataMain is now
+ //like a module name.
+ dataMain = dataMain.replace(jsSuffixRegExp, '');
+
+ //Put the data-main script in the files to load.
+ cfg.deps = cfg.deps ? cfg.deps.concat(dataMain) : [dataMain];
+
+ return true;
+ }
+ });
+ }
+
+ /**
+ * The function that handles definitions of modules. Differs from
+ * require() in that a string for the module should be the first argument,
+ * and the function to execute after dependencies are loaded should
+ * return a value to define the module corresponding to the first argument's
+ * name.
+ */
+ define = function (name, deps, callback) {
+ var node, context;
+
+ //Allow for anonymous functions
+ if (typeof name !== 'string') {
+ //Adjust args appropriately
+ callback = deps;
+ deps = name;
+ name = null;
+ }
+
+ //This module may not have dependencies
+ if (!isArray(deps)) {
+ callback = deps;
+ deps = [];
+ }
+
+ //If no name, and callback is a function, then figure out if it a
+ //CommonJS thing with dependencies.
+ if (!deps.length && isFunction(callback)) {
+ //Remove comments from the callback string,
+ //look for require calls, and pull them into the dependencies,
+ //but only if there are function args.
+ if (callback.length) {
+ callback
+ .toString()
+ .replace(commentRegExp, '')
+ .replace(cjsRequireRegExp, function (match, dep) {
+ deps.push(dep);
+ });
+
+ //May be a CommonJS thing even without require calls, but still
+ //could use exports, and module. Avoid doing exports and module
+ //work though if it just needs require.
+ //REQUIRES the function to expect the CommonJS variables in the
+ //order listed below.
+ deps = (callback.length === 1 ? ['require'] : ['require', 'exports', 'module']).concat(deps);
+ }
+ }
+
+ //If in IE 6-8 and hit an anonymous define() call, do the interactive
+ //work.
+ if (useInteractive) {
+ node = currentlyAddingScript || getInteractiveScript();
+ if (node) {
+ if (!name) {
+ name = node.getAttribute('data-requiremodule');
+ }
+ context = contexts[node.getAttribute('data-requirecontext')];
+ }
+ }
+
+ //Always save off evaluating the def call until the script onload handler.
+ //This allows multiple modules to be in a file without prematurely
+ //tracing dependencies, and allows for anonymous module support,
+ //where the module name is not known until the script onload event
+ //occurs. If no context, use the global queue, and get it processed
+ //in the onscript load callback.
+ (context ? context.defQueue : globalDefQueue).push([name, deps, callback]);
+ };
+
+ define.amd = {
+ jQuery: true
+ };
+
+
+ /**
+ * Executes the text. Normally just uses eval, but can be modified
+ * to use a better, environment-specific call. Only used for transpiling
+ * loader plugins, not for plain JS modules.
+ * @param {String} text the text to execute/evaluate.
+ */
+ req.exec = function (text) {
+ /*jslint evil: true */
+ return eval(text);
+ };
+
+ //Set up with config info.
+ req(cfg);
+}(this));
diff -r 4368df9df27896599a64236a6f8f80ebb0baf8c5 -r 563ab1b6b311af66818ca7031746ba7201b2d7db static/scripts/require.js
--- a/static/scripts/require.js
+++ /dev/null
@@ -1,2041 +0,0 @@
-/** vim: et:ts=4:sw=4:sts=4
- * @license RequireJS 2.0.6 Copyright (c) 2010-2012, The Dojo Foundation All Rights Reserved.
- * Available via the MIT or new BSD license.
- * see: http://github.com/jrburke/requirejs for details
- */
-//Not using strict: uneven strict support in browsers, #392, and causes
-//problems with requirejs.exec()/transpiler plugins that may not be strict.
-/*jslint regexp: true, nomen: true, sloppy: true */
-/*global window, navigator, document, importScripts, jQuery, setTimeout, opera */
-
-var requirejs, require, define;
-(function (global) {
- var req, s, head, baseElement, dataMain, src,
- interactiveScript, currentlyAddingScript, mainScript, subPath,
- version = '2.0.6',
- commentRegExp = /(\/\*([\s\S]*?)\*\/|([^:]|^)\/\/(.*)$)/mg,
- cjsRequireRegExp = /[^.]\s*require\s*\(\s*["']([^'"\s]+)["']\s*\)/g,
- jsSuffixRegExp = /\.js$/,
- currDirRegExp = /^\.\//,
- op = Object.prototype,
- ostring = op.toString,
- hasOwn = op.hasOwnProperty,
- ap = Array.prototype,
- aps = ap.slice,
- apsp = ap.splice,
- isBrowser = !!(typeof window !== 'undefined' && navigator && document),
- isWebWorker = !isBrowser && typeof importScripts !== 'undefined',
- //PS3 indicates loaded and complete, but need to wait for complete
- //specifically. Sequence is 'loading', 'loaded', execution,
- // then 'complete'. The UA check is unfortunate, but not sure how
- //to feature test w/o causing perf issues.
- readyRegExp = isBrowser && navigator.platform === 'PLAYSTATION 3' ?
- /^complete$/ : /^(complete|loaded)$/,
- defContextName = '_',
- //Oh the tragedy, detecting opera. See the usage of isOpera for reason.
- isOpera = typeof opera !== 'undefined' && opera.toString() === '[object Opera]',
- contexts = {},
- cfg = {},
- globalDefQueue = [],
- useInteractive = false;
-
- function isFunction(it) {
- return ostring.call(it) === '[object Function]';
- }
-
- function isArray(it) {
- return ostring.call(it) === '[object Array]';
- }
-
- /**
- * Helper function for iterating over an array. If the func returns
- * a true value, it will break out of the loop.
- */
- function each(ary, func) {
- if (ary) {
- var i;
- for (i = 0; i < ary.length; i += 1) {
- if (ary[i] && func(ary[i], i, ary)) {
- break;
- }
- }
- }
- }
-
- /**
- * Helper function for iterating over an array backwards. If the func
- * returns a true value, it will break out of the loop.
- */
- function eachReverse(ary, func) {
- if (ary) {
- var i;
- for (i = ary.length - 1; i > -1; i -= 1) {
- if (ary[i] && func(ary[i], i, ary)) {
- break;
- }
- }
- }
- }
-
- function hasProp(obj, prop) {
- return hasOwn.call(obj, prop);
- }
-
- /**
- * Cycles over properties in an object and calls a function for each
- * property value. If the function returns a truthy value, then the
- * iteration is stopped.
- */
- function eachProp(obj, func) {
- var prop;
- for (prop in obj) {
- if (obj.hasOwnProperty(prop)) {
- if (func(obj[prop], prop)) {
- break;
- }
- }
- }
- }
-
- /**
- * Simple function to mix in properties from source into target,
- * but only if target does not already have a property of the same name.
- * This is not robust in IE for transferring methods that match
- * Object.prototype names, but the uses of mixin here seem unlikely to
- * trigger a problem related to that.
- */
- function mixin(target, source, force, deepStringMixin) {
- if (source) {
- eachProp(source, function (value, prop) {
- if (force || !hasProp(target, prop)) {
- if (deepStringMixin && typeof value !== 'string') {
- if (!target[prop]) {
- target[prop] = {};
- }
- mixin(target[prop], value, force, deepStringMixin);
- } else {
- target[prop] = value;
- }
- }
- });
- }
- return target;
- }
-
- //Similar to Function.prototype.bind, but the 'this' object is specified
- //first, since it is easier to read/figure out what 'this' will be.
- function bind(obj, fn) {
- return function () {
- return fn.apply(obj, arguments);
- };
- }
-
- function scripts() {
- return document.getElementsByTagName('script');
- }
-
- //Allow getting a global that expressed in
- //dot notation, like 'a.b.c'.
- function getGlobal(value) {
- if (!value) {
- return value;
- }
- var g = global;
- each(value.split('.'), function (part) {
- g = g[part];
- });
- return g;
- }
-
- function makeContextModuleFunc(func, relMap, enableBuildCallback) {
- return function () {
- //A version of a require function that passes a moduleName
- //value for items that may need to
- //look up paths relative to the moduleName
- var args = aps.call(arguments, 0), lastArg;
- if (enableBuildCallback &&
- isFunction((lastArg = args[args.length - 1]))) {
- lastArg.__requireJsBuild = true;
- }
- args.push(relMap);
- return func.apply(null, args);
- };
- }
-
- function addRequireMethods(req, context, relMap) {
- each([
- ['toUrl'],
- ['undef'],
- ['defined', 'requireDefined'],
- ['specified', 'requireSpecified']
- ], function (item) {
- var prop = item[1] || item[0];
- req[item[0]] = context ? makeContextModuleFunc(context[prop], relMap) :
- //If no context, then use default context. Reference from
- //contexts instead of early binding to default context, so
- //that during builds, the latest instance of the default
- //context with its config gets used.
- function () {
- var ctx = contexts[defContextName];
- return ctx[prop].apply(ctx, arguments);
- };
- });
- }
-
- /**
- * Constructs an error with a pointer to an URL with more information.
- * @param {String} id the error ID that maps to an ID on a web page.
- * @param {String} message human readable error.
- * @param {Error} [err] the original error, if there is one.
- *
- * @returns {Error}
- */
- function makeError(id, msg, err, requireModules) {
- var e = new Error(msg + '\nhttp://requirejs.org/docs/errors.html#' + id);
- e.requireType = id;
- e.requireModules = requireModules;
- if (err) {
- e.originalError = err;
- }
- return e;
- }
-
- if (typeof define !== 'undefined') {
- //If a define is already in play via another AMD loader,
- //do not overwrite.
- return;
- }
-
- if (typeof requirejs !== 'undefined') {
- if (isFunction(requirejs)) {
- //Do not overwrite and existing requirejs instance.
- return;
- }
- cfg = requirejs;
- requirejs = undefined;
- }
-
- //Allow for a require config object
- if (typeof require !== 'undefined' && !isFunction(require)) {
- //assume it is a config object.
- cfg = require;
- require = undefined;
- }
-
- function newContext(contextName) {
- var inCheckLoaded, Module, context, handlers,
- checkLoadedTimeoutId,
- config = {
- waitSeconds: 7,
- baseUrl: './',
- paths: {},
- pkgs: {},
- shim: {}
- },
- registry = {},
- undefEvents = {},
- defQueue = [],
- defined = {},
- urlFetched = {},
- requireCounter = 1,
- unnormalizedCounter = 1,
- //Used to track the order in which modules
- //should be executed, by the order they
- //load. Important for consistent cycle resolution
- //behavior.
- waitAry = [];
-
- /**
- * Trims the . and .. from an array of path segments.
- * It will keep a leading path segment if a .. will become
- * the first path segment, to help with module name lookups,
- * which act like paths, but can be remapped. But the end result,
- * all paths that use this function should look normalized.
- * NOTE: this method MODIFIES the input array.
- * @param {Array} ary the array of path segments.
- */
- function trimDots(ary) {
- var i, part;
- for (i = 0; ary[i]; i += 1) {
- part = ary[i];
- if (part === '.') {
- ary.splice(i, 1);
- i -= 1;
- } else if (part === '..') {
- if (i === 1 && (ary[2] === '..' || ary[0] === '..')) {
- //End of the line. Keep at least one non-dot
- //path segment at the front so it can be mapped
- //correctly to disk. Otherwise, there is likely
- //no path mapping for a path starting with '..'.
- //This can still fail, but catches the most reasonable
- //uses of ..
- break;
- } else if (i > 0) {
- ary.splice(i - 1, 2);
- i -= 2;
- }
- }
- }
- }
-
- /**
- * Given a relative module name, like ./something, normalize it to
- * a real name that can be mapped to a path.
- * @param {String} name the relative name
- * @param {String} baseName a real name that the name arg is relative
- * to.
- * @param {Boolean} applyMap apply the map config to the value. Should
- * only be done if this normalization is for a dependency ID.
- * @returns {String} normalized name
- */
- function normalize(name, baseName, applyMap) {
- var pkgName, pkgConfig, mapValue, nameParts, i, j, nameSegment,
- foundMap, foundI, foundStarMap, starI,
- baseParts = baseName && baseName.split('/'),
- normalizedBaseParts = baseParts,
- map = config.map,
- starMap = map && map['*'];
-
- //Adjust any relative paths.
- if (name && name.charAt(0) === '.') {
- //If have a base name, try to normalize against it,
- //otherwise, assume it is a top-level require that will
- //be relative to baseUrl in the end.
- if (baseName) {
- if (config.pkgs[baseName]) {
- //If the baseName is a package name, then just treat it as one
- //name to concat the name with.
- normalizedBaseParts = baseParts = [baseName];
- } else {
- //Convert baseName to array, and lop off the last part,
- //so that . matches that 'directory' and not name of the baseName's
- //module. For instance, baseName of 'one/two/three', maps to
- //'one/two/three.js', but we want the directory, 'one/two' for
- //this normalization.
- normalizedBaseParts = baseParts.slice(0, baseParts.length - 1);
- }
-
- name = normalizedBaseParts.concat(name.split('/'));
- trimDots(name);
-
- //Some use of packages may use a . path to reference the
- //'main' module name, so normalize for that.
- pkgConfig = config.pkgs[(pkgName = name[0])];
- name = name.join('/');
- if (pkgConfig && name === pkgName + '/' + pkgConfig.main) {
- name = pkgName;
- }
- } else if (name.indexOf('./') === 0) {
- // No baseName, so this is ID is resolved relative
- // to baseUrl, pull off the leading dot.
- name = name.substring(2);
- }
- }
-
- //Apply map config if available.
- if (applyMap && (baseParts || starMap) && map) {
- nameParts = name.split('/');
-
- for (i = nameParts.length; i > 0; i -= 1) {
- nameSegment = nameParts.slice(0, i).join('/');
-
- if (baseParts) {
- //Find the longest baseName segment match in the config.
- //So, do joins on the biggest to smallest lengths of baseParts.
- for (j = baseParts.length; j > 0; j -= 1) {
- mapValue = map[baseParts.slice(0, j).join('/')];
-
- //baseName segment has config, find if it has one for
- //this name.
- if (mapValue) {
- mapValue = mapValue[nameSegment];
- if (mapValue) {
- //Match, update name to the new value.
- foundMap = mapValue;
- foundI = i;
- break;
- }
- }
- }
- }
-
- if (foundMap) {
- break;
- }
-
- //Check for a star map match, but just hold on to it,
- //if there is a shorter segment match later in a matching
- //config, then favor over this star map.
- if (!foundStarMap && starMap && starMap[nameSegment]) {
- foundStarMap = starMap[nameSegment];
- starI = i;
- }
- }
-
- if (!foundMap && foundStarMap) {
- foundMap = foundStarMap;
- foundI = starI;
- }
-
- if (foundMap) {
- nameParts.splice(0, foundI, foundMap);
- name = nameParts.join('/');
- }
- }
-
- return name;
- }
-
- function removeScript(name) {
- if (isBrowser) {
- each(scripts(), function (scriptNode) {
- if (scriptNode.getAttribute('data-requiremodule') === name &&
- scriptNode.getAttribute('data-requirecontext') === context.contextName) {
- scriptNode.parentNode.removeChild(scriptNode);
- return true;
- }
- });
- }
- }
-
- function hasPathFallback(id) {
- var pathConfig = config.paths[id];
- if (pathConfig && isArray(pathConfig) && pathConfig.length > 1) {
- removeScript(id);
- //Pop off the first array value, since it failed, and
- //retry
- pathConfig.shift();
- context.undef(id);
- context.require([id]);
- return true;
- }
- }
-
- /**
- * Creates a module mapping that includes plugin prefix, module
- * name, and path. If parentModuleMap is provided it will
- * also normalize the name via require.normalize()
- *
- * @param {String} name the module name
- * @param {String} [parentModuleMap] parent module map
- * for the module name, used to resolve relative names.
- * @param {Boolean} isNormalized: is the ID already normalized.
- * This is true if this call is done for a define() module ID.
- * @param {Boolean} applyMap: apply the map config to the ID.
- * Should only be true if this map is for a dependency.
- *
- * @returns {Object}
- */
- function makeModuleMap(name, parentModuleMap, isNormalized, applyMap) {
- var url, pluginModule, suffix,
- index = name ? name.indexOf('!') : -1,
- prefix = null,
- parentName = parentModuleMap ? parentModuleMap.name : null,
- originalName = name,
- isDefine = true,
- normalizedName = '';
-
- //If no name, then it means it is a require call, generate an
- //internal name.
- if (!name) {
- isDefine = false;
- name = '_@r' + (requireCounter += 1);
- }
-
- if (index !== -1) {
- prefix = name.substring(0, index);
- name = name.substring(index + 1, name.length);
- }
-
- if (prefix) {
- prefix = normalize(prefix, parentName, applyMap);
- pluginModule = defined[prefix];
- }
-
- //Account for relative paths if there is a base name.
- if (name) {
- if (prefix) {
- if (pluginModule && pluginModule.normalize) {
- //Plugin is loaded, use its normalize method.
- normalizedName = pluginModule.normalize(name, function (name) {
- return normalize(name, parentName, applyMap);
- });
- } else {
- normalizedName = normalize(name, parentName, applyMap);
- }
- } else {
- //A regular module.
- normalizedName = normalize(name, parentName, applyMap);
- url = context.nameToUrl(normalizedName);
- }
- }
-
- //If the id is a plugin id that cannot be determined if it needs
- //normalization, stamp it with a unique ID so two matching relative
- //ids that may conflict can be separate.
- suffix = prefix && !pluginModule && !isNormalized ?
- '_unnormalized' + (unnormalizedCounter += 1) :
- '';
-
- return {
- prefix: prefix,
- name: normalizedName,
- parentMap: parentModuleMap,
- unnormalized: !!suffix,
- url: url,
- originalName: originalName,
- isDefine: isDefine,
- id: (prefix ?
- prefix + '!' + normalizedName :
- normalizedName) + suffix
- };
- }
-
- function getModule(depMap) {
- var id = depMap.id,
- mod = registry[id];
-
- if (!mod) {
- mod = registry[id] = new context.Module(depMap);
- }
-
- return mod;
- }
-
- function on(depMap, name, fn) {
- var id = depMap.id,
- mod = registry[id];
-
- if (hasProp(defined, id) &&
- (!mod || mod.defineEmitComplete)) {
- if (name === 'defined') {
- fn(defined[id]);
- }
- } else {
- getModule(depMap).on(name, fn);
- }
- }
-
- function onError(err, errback) {
- var ids = err.requireModules,
- notified = false;
-
- if (errback) {
- errback(err);
- } else {
- each(ids, function (id) {
- var mod = registry[id];
- if (mod) {
- //Set error on module, so it skips timeout checks.
- mod.error = err;
- if (mod.events.error) {
- notified = true;
- mod.emit('error', err);
- }
- }
- });
-
- if (!notified) {
- req.onError(err);
- }
- }
- }
-
- /**
- * Internal method to transfer globalQueue items to this context's
- * defQueue.
- */
- function takeGlobalQueue() {
- //Push all the globalDefQueue items into the context's defQueue
- if (globalDefQueue.length) {
- //Array splice in the values since the context code has a
- //local var ref to defQueue, so cannot just reassign the one
- //on context.
- apsp.apply(defQueue,
- [defQueue.length - 1, 0].concat(globalDefQueue));
- globalDefQueue = [];
- }
- }
-
- /**
- * Helper function that creates a require function object to give to
- * modules that ask for it as a dependency. It needs to be specific
- * per module because of the implication of path mappings that may
- * need to be relative to the module name.
- */
- function makeRequire(mod, enableBuildCallback, altRequire) {
- var relMap = mod && mod.map,
- modRequire = makeContextModuleFunc(altRequire || context.require,
- relMap,
- enableBuildCallback);
-
- addRequireMethods(modRequire, context, relMap);
- modRequire.isBrowser = isBrowser;
-
- return modRequire;
- }
-
- handlers = {
- 'require': function (mod) {
- return makeRequire(mod);
- },
- 'exports': function (mod) {
- mod.usingExports = true;
- if (mod.map.isDefine) {
- return (mod.exports = defined[mod.map.id] = {});
- }
- },
- 'module': function (mod) {
- return (mod.module = {
- id: mod.map.id,
- uri: mod.map.url,
- config: function () {
- return (config.config && config.config[mod.map.id]) || {};
- },
- exports: defined[mod.map.id]
- });
- }
- };
-
- function removeWaiting(id) {
- //Clean up machinery used for waiting modules.
- delete registry[id];
-
- each(waitAry, function (mod, i) {
- if (mod.map.id === id) {
- waitAry.splice(i, 1);
- if (!mod.defined) {
- context.waitCount -= 1;
- }
- return true;
- }
- });
- }
-
- function findCycle(mod, traced, processed) {
- var id = mod.map.id,
- depArray = mod.depMaps,
- foundModule;
-
- //Do not bother with unitialized modules or not yet enabled
- //modules.
- if (!mod.inited) {
- return;
- }
-
- //Found the cycle.
- if (traced[id]) {
- return mod;
- }
-
- traced[id] = true;
-
- //Trace through the dependencies.
- each(depArray, function (depMap) {
- var depId = depMap.id,
- depMod = registry[depId];
-
- if (!depMod || processed[depId] ||
- !depMod.inited || !depMod.enabled) {
- return;
- }
-
- return (foundModule = findCycle(depMod, traced, processed));
- });
-
- processed[id] = true;
-
- return foundModule;
- }
-
- function forceExec(mod, traced, uninited) {
- var id = mod.map.id,
- depArray = mod.depMaps;
-
- if (!mod.inited || !mod.map.isDefine) {
- return;
- }
-
- if (traced[id]) {
- return defined[id];
- }
-
- traced[id] = mod;
-
- each(depArray, function (depMap) {
- var depId = depMap.id,
- depMod = registry[depId],
- value;
-
- if (handlers[depId]) {
- return;
- }
-
- if (depMod) {
- if (!depMod.inited || !depMod.enabled) {
- //Dependency is not inited,
- //so this module cannot be
- //given a forced value yet.
- uninited[id] = true;
- return;
- }
-
- //Get the value for the current dependency
- value = forceExec(depMod, traced, uninited);
-
- //Even with forcing it may not be done,
- //in particular if the module is waiting
- //on a plugin resource.
- if (!uninited[depId]) {
- mod.defineDepById(depId, value);
- }
- }
- });
-
- mod.check(true);
-
- return defined[id];
- }
-
- function modCheck(mod) {
- mod.check();
- }
-
- function checkLoaded() {
- var map, modId, err, usingPathFallback,
- waitInterval = config.waitSeconds * 1000,
- //It is possible to disable the wait interval by using waitSeconds of 0.
- expired = waitInterval && (context.startTime + waitInterval) < new Date().getTime(),
- noLoads = [],
- stillLoading = false,
- needCycleCheck = true;
-
- //Do not bother if this call was a result of a cycle break.
- if (inCheckLoaded) {
- return;
- }
-
- inCheckLoaded = true;
-
- //Figure out the state of all the modules.
- eachProp(registry, function (mod) {
- map = mod.map;
- modId = map.id;
-
- //Skip things that are not enabled or in error state.
- if (!mod.enabled) {
- return;
- }
-
- if (!mod.error) {
- //If the module should be executed, and it has not
- //been inited and time is up, remember it.
- if (!mod.inited && expired) {
- if (hasPathFallback(modId)) {
- usingPathFallback = true;
- stillLoading = true;
- } else {
- noLoads.push(modId);
- removeScript(modId);
- }
- } else if (!mod.inited && mod.fetched && map.isDefine) {
- stillLoading = true;
- if (!map.prefix) {
- //No reason to keep looking for unfinished
- //loading. If the only stillLoading is a
- //plugin resource though, keep going,
- //because it may be that a plugin resource
- //is waiting on a non-plugin cycle.
- return (needCycleCheck = false);
- }
- }
- }
- });
-
- if (expired && noLoads.length) {
- //If wait time expired, throw error of unloaded modules.
- err = makeError('timeout', 'Load timeout for modules: ' + noLoads, null, noLoads);
- err.contextName = context.contextName;
- return onError(err);
- }
-
- //Not expired, check for a cycle.
- if (needCycleCheck) {
-
- each(waitAry, function (mod) {
- if (mod.defined) {
- return;
- }
-
- var cycleMod = findCycle(mod, {}, {}),
- traced = {};
-
- if (cycleMod) {
- forceExec(cycleMod, traced, {});
-
- //traced modules may have been
- //removed from the registry, but
- //their listeners still need to
- //be called.
- eachProp(traced, modCheck);
- }
- });
-
- //Now that dependencies have
- //been satisfied, trigger the
- //completion check that then
- //notifies listeners.
- eachProp(registry, modCheck);
- }
-
- //If still waiting on loads, and the waiting load is something
- //other than a plugin resource, or there are still outstanding
- //scripts, then just try back later.
- if ((!expired || usingPathFallback) && stillLoading) {
- //Something is still waiting to load. Wait for it, but only
- //if a timeout is not already in effect.
- if ((isBrowser || isWebWorker) && !checkLoadedTimeoutId) {
- checkLoadedTimeoutId = setTimeout(function () {
- checkLoadedTimeoutId = 0;
- checkLoaded();
- }, 50);
- }
- }
-
- inCheckLoaded = false;
- }
-
- Module = function (map) {
- this.events = undefEvents[map.id] || {};
- this.map = map;
- this.shim = config.shim[map.id];
- this.depExports = [];
- this.depMaps = [];
- this.depMatched = [];
- this.pluginMaps = {};
- this.depCount = 0;
-
- /* this.exports this.factory
- this.depMaps = [],
- this.enabled, this.fetched
- */
- };
-
- Module.prototype = {
- init: function (depMaps, factory, errback, options) {
- options = options || {};
-
- //Do not do more inits if already done. Can happen if there
- //are multiple define calls for the same module. That is not
- //a normal, common case, but it is also not unexpected.
- if (this.inited) {
- return;
- }
-
- this.factory = factory;
-
- if (errback) {
- //Register for errors on this module.
- this.on('error', errback);
- } else if (this.events.error) {
- //If no errback already, but there are error listeners
- //on this module, set up an errback to pass to the deps.
- errback = bind(this, function (err) {
- this.emit('error', err);
- });
- }
-
- //Do a copy of the dependency array, so that
- //source inputs are not modified. For example
- //"shim" deps are passed in here directly, and
- //doing a direct modification of the depMaps array
- //would affect that config.
- this.depMaps = depMaps && depMaps.slice(0);
- this.depMaps.rjsSkipMap = depMaps.rjsSkipMap;
-
- this.errback = errback;
-
- //Indicate this module has be initialized
- this.inited = true;
-
- this.ignore = options.ignore;
-
- //Could have option to init this module in enabled mode,
- //or could have been previously marked as enabled. However,
- //the dependencies are not known until init is called. So
- //if enabled previously, now trigger dependencies as enabled.
- if (options.enabled || this.enabled) {
- //Enable this module and dependencies.
- //Will call this.check()
- this.enable();
- } else {
- this.check();
- }
- },
-
- defineDepById: function (id, depExports) {
- var i;
-
- //Find the index for this dependency.
- each(this.depMaps, function (map, index) {
- if (map.id === id) {
- i = index;
- return true;
- }
- });
-
- return this.defineDep(i, depExports);
- },
-
- defineDep: function (i, depExports) {
- //Because of cycles, defined callback for a given
- //export can be called more than once.
- if (!this.depMatched[i]) {
- this.depMatched[i] = true;
- this.depCount -= 1;
- this.depExports[i] = depExports;
- }
- },
-
- fetch: function () {
- if (this.fetched) {
- return;
- }
- this.fetched = true;
-
- context.startTime = (new Date()).getTime();
-
- var map = this.map;
-
- //If the manager is for a plugin managed resource,
- //ask the plugin to load it now.
- if (this.shim) {
- makeRequire(this, true)(this.shim.deps || [], bind(this, function () {
- return map.prefix ? this.callPlugin() : this.load();
- }));
- } else {
- //Regular dependency.
- return map.prefix ? this.callPlugin() : this.load();
- }
- },
-
- load: function () {
- var url = this.map.url;
-
- //Regular dependency.
- if (!urlFetched[url]) {
- urlFetched[url] = true;
- context.load(this.map.id, url);
- }
- },
-
- /**
- * Checks is the module is ready to define itself, and if so,
- * define it. If the silent argument is true, then it will just
- * define, but not notify listeners, and not ask for a context-wide
- * check of all loaded modules. That is useful for cycle breaking.
- */
- check: function (silent) {
- if (!this.enabled || this.enabling) {
- return;
- }
-
- var err, cjsModule,
- id = this.map.id,
- depExports = this.depExports,
- exports = this.exports,
- factory = this.factory;
-
- if (!this.inited) {
- this.fetch();
- } else if (this.error) {
- this.emit('error', this.error);
- } else if (!this.defining) {
- //The factory could trigger another require call
- //that would result in checking this module to
- //define itself again. If already in the process
- //of doing that, skip this work.
- this.defining = true;
-
- if (this.depCount < 1 && !this.defined) {
- if (isFunction(factory)) {
- //If there is an error listener, favor passing
- //to that instead of throwing an error.
- if (this.events.error) {
- try {
- exports = context.execCb(id, factory, depExports, exports);
- } catch (e) {
- err = e;
- }
- } else {
- exports = context.execCb(id, factory, depExports, exports);
- }
-
- if (this.map.isDefine) {
- //If setting exports via 'module' is in play,
- //favor that over return value and exports. After that,
- //favor a non-undefined return value over exports use.
- cjsModule = this.module;
- if (cjsModule &&
- cjsModule.exports !== undefined &&
- //Make sure it is not already the exports value
- cjsModule.exports !== this.exports) {
- exports = cjsModule.exports;
- } else if (exports === undefined && this.usingExports) {
- //exports already set the defined value.
- exports = this.exports;
- }
- }
-
- if (err) {
- err.requireMap = this.map;
- err.requireModules = [this.map.id];
- err.requireType = 'define';
- return onError((this.error = err));
- }
-
- } else {
- //Just a literal value
- exports = factory;
- }
-
- this.exports = exports;
-
- if (this.map.isDefine && !this.ignore) {
- defined[id] = exports;
-
- if (req.onResourceLoad) {
- req.onResourceLoad(context, this.map, this.depMaps);
- }
- }
-
- //Clean up
- delete registry[id];
-
- this.defined = true;
- context.waitCount -= 1;
- if (context.waitCount === 0) {
- //Clear the wait array used for cycles.
- waitAry = [];
- }
- }
-
- //Finished the define stage. Allow calling check again
- //to allow define notifications below in the case of a
- //cycle.
- this.defining = false;
-
- if (!silent) {
- if (this.defined && !this.defineEmitted) {
- this.defineEmitted = true;
- this.emit('defined', this.exports);
- this.defineEmitComplete = true;
- }
- }
- }
- },
-
- callPlugin: function () {
- var map = this.map,
- id = map.id,
- pluginMap = makeModuleMap(map.prefix, null, false, true);
-
- on(pluginMap, 'defined', bind(this, function (plugin) {
- var load, normalizedMap, normalizedMod,
- name = this.map.name,
- parentName = this.map.parentMap ? this.map.parentMap.name : null;
-
- //If current map is not normalized, wait for that
- //normalized name to load instead of continuing.
- if (this.map.unnormalized) {
- //Normalize the ID if the plugin allows it.
- if (plugin.normalize) {
- name = plugin.normalize(name, function (name) {
- return normalize(name, parentName, true);
- }) || '';
- }
-
- normalizedMap = makeModuleMap(map.prefix + '!' + name,
- this.map.parentMap,
- false,
- true);
- on(normalizedMap,
- 'defined', bind(this, function (value) {
- this.init([], function () { return value; }, null, {
- enabled: true,
- ignore: true
- });
- }));
- normalizedMod = registry[normalizedMap.id];
- if (normalizedMod) {
- if (this.events.error) {
- normalizedMod.on('error', bind(this, function (err) {
- this.emit('error', err);
- }));
- }
- normalizedMod.enable();
- }
-
- return;
- }
-
- load = bind(this, function (value) {
- this.init([], function () { return value; }, null, {
- enabled: true
- });
- });
-
- load.error = bind(this, function (err) {
- this.inited = true;
- this.error = err;
- err.requireModules = [id];
-
- //Remove temp unnormalized modules for this module,
- //since they will never be resolved otherwise now.
- eachProp(registry, function (mod) {
- if (mod.map.id.indexOf(id + '_unnormalized') === 0) {
- removeWaiting(mod.map.id);
- }
- });
-
- onError(err);
- });
-
- //Allow plugins to load other code without having to know the
- //context or how to 'complete' the load.
- load.fromText = function (moduleName, text) {
- /*jslint evil: true */
- var hasInteractive = useInteractive;
-
- //Turn off interactive script matching for IE for any define
- //calls in the text, then turn it back on at the end.
- if (hasInteractive) {
- useInteractive = false;
- }
-
- //Prime the system by creating a module instance for
- //it.
- getModule(makeModuleMap(moduleName));
-
- req.exec(text);
-
- if (hasInteractive) {
- useInteractive = true;
- }
-
- //Support anonymous modules.
- context.completeLoad(moduleName);
- };
-
- //Use parentName here since the plugin's name is not reliable,
- //could be some weird string with no path that actually wants to
- //reference the parentName's path.
- plugin.load(map.name, makeRequire(map.parentMap, true, function (deps, cb, er) {
- deps.rjsSkipMap = true;
- return context.require(deps, cb, er);
- }), load, config);
- }));
-
- context.enable(pluginMap, this);
- this.pluginMaps[pluginMap.id] = pluginMap;
- },
-
- enable: function () {
- this.enabled = true;
-
- if (!this.waitPushed) {
- waitAry.push(this);
- context.waitCount += 1;
- this.waitPushed = true;
- }
-
- //Set flag mentioning that the module is enabling,
- //so that immediate calls to the defined callbacks
- //for dependencies do not trigger inadvertent load
- //with the depCount still being zero.
- this.enabling = true;
-
- //Enable each dependency
- each(this.depMaps, bind(this, function (depMap, i) {
- var id, mod, handler;
-
- if (typeof depMap === 'string') {
- //Dependency needs to be converted to a depMap
- //and wired up to this module.
- depMap = makeModuleMap(depMap,
- (this.map.isDefine ? this.map : this.map.parentMap),
- false,
- !this.depMaps.rjsSkipMap);
- this.depMaps[i] = depMap;
-
- handler = handlers[depMap.id];
-
- if (handler) {
- this.depExports[i] = handler(this);
- return;
- }
-
- this.depCount += 1;
-
- on(depMap, 'defined', bind(this, function (depExports) {
- this.defineDep(i, depExports);
- this.check();
- }));
-
- if (this.errback) {
- on(depMap, 'error', this.errback);
- }
- }
-
- id = depMap.id;
- mod = registry[id];
-
- //Skip special modules like 'require', 'exports', 'module'
- //Also, don't call enable if it is already enabled,
- //important in circular dependency cases.
- if (!handlers[id] && mod && !mod.enabled) {
- context.enable(depMap, this);
- }
- }));
-
- //Enable each plugin that is used in
- //a dependency
- eachProp(this.pluginMaps, bind(this, function (pluginMap) {
- var mod = registry[pluginMap.id];
- if (mod && !mod.enabled) {
- context.enable(pluginMap, this);
- }
- }));
-
- this.enabling = false;
-
- this.check();
- },
-
- on: function (name, cb) {
- var cbs = this.events[name];
- if (!cbs) {
- cbs = this.events[name] = [];
- }
- cbs.push(cb);
- },
-
- emit: function (name, evt) {
- each(this.events[name], function (cb) {
- cb(evt);
- });
- if (name === 'error') {
- //Now that the error handler was triggered, remove
- //the listeners, since this broken Module instance
- //can stay around for a while in the registry/waitAry.
- delete this.events[name];
- }
- }
- };
-
- function callGetModule(args) {
- getModule(makeModuleMap(args[0], null, true)).init(args[1], args[2]);
- }
-
- function removeListener(node, func, name, ieName) {
- //Favor detachEvent because of IE9
- //issue, see attachEvent/addEventListener comment elsewhere
- //in this file.
- if (node.detachEvent && !isOpera) {
- //Probably IE. If not it will throw an error, which will be
- //useful to know.
- if (ieName) {
- node.detachEvent(ieName, func);
- }
- } else {
- node.removeEventListener(name, func, false);
- }
- }
-
- /**
- * Given an event from a script node, get the requirejs info from it,
- * and then removes the event listeners on the node.
- * @param {Event} evt
- * @returns {Object}
- */
- function getScriptData(evt) {
- //Using currentTarget instead of target for Firefox 2.0's sake. Not
- //all old browsers will be supported, but this one was easy enough
- //to support and still makes sense.
- var node = evt.currentTarget || evt.srcElement;
-
- //Remove the listeners once here.
- removeListener(node, context.onScriptLoad, 'load', 'onreadystatechange');
- removeListener(node, context.onScriptError, 'error');
-
- return {
- node: node,
- id: node && node.getAttribute('data-requiremodule')
- };
- }
-
- return (context = {
- config: config,
- contextName: contextName,
- registry: registry,
- defined: defined,
- urlFetched: urlFetched,
- waitCount: 0,
- defQueue: defQueue,
- Module: Module,
- makeModuleMap: makeModuleMap,
-
- /**
- * Set a configuration for the context.
- * @param {Object} cfg config object to integrate.
- */
- configure: function (cfg) {
- //Make sure the baseUrl ends in a slash.
- if (cfg.baseUrl) {
- if (cfg.baseUrl.charAt(cfg.baseUrl.length - 1) !== '/') {
- cfg.baseUrl += '/';
- }
- }
-
- //Save off the paths and packages since they require special processing,
- //they are additive.
- var pkgs = config.pkgs,
- shim = config.shim,
- paths = config.paths,
- map = config.map;
-
- //Mix in the config values, favoring the new values over
- //existing ones in context.config.
- mixin(config, cfg, true);
-
- //Merge paths.
- config.paths = mixin(paths, cfg.paths, true);
-
- //Merge map
- if (cfg.map) {
- config.map = mixin(map || {}, cfg.map, true, true);
- }
-
- //Merge shim
- if (cfg.shim) {
- eachProp(cfg.shim, function (value, id) {
- //Normalize the structure
- if (isArray(value)) {
- value = {
- deps: value
- };
- }
- if (value.exports && !value.exports.__buildReady) {
- value.exports = context.makeShimExports(value.exports);
- }
- shim[id] = value;
- });
- config.shim = shim;
- }
-
- //Adjust packages if necessary.
- if (cfg.packages) {
- each(cfg.packages, function (pkgObj) {
- var location;
-
- pkgObj = typeof pkgObj === 'string' ? { name: pkgObj } : pkgObj;
- location = pkgObj.location;
-
- //Create a brand new object on pkgs, since currentPackages can
- //be passed in again, and config.pkgs is the internal transformed
- //state for all package configs.
- pkgs[pkgObj.name] = {
- name: pkgObj.name,
- location: location || pkgObj.name,
- //Remove leading dot in main, so main paths are normalized,
- //and remove any trailing .js, since different package
- //envs have different conventions: some use a module name,
- //some use a file name.
- main: (pkgObj.main || 'main')
- .replace(currDirRegExp, '')
- .replace(jsSuffixRegExp, '')
- };
- });
-
- //Done with modifications, assing packages back to context config
- config.pkgs = pkgs;
- }
-
- //If there are any "waiting to execute" modules in the registry,
- //update the maps for them, since their info, like URLs to load,
- //may have changed.
- eachProp(registry, function (mod, id) {
- //If module already has init called, since it is too
- //late to modify them, and ignore unnormalized ones
- //since they are transient.
- if (!mod.inited && !mod.map.unnormalized) {
- mod.map = makeModuleMap(id);
- }
- });
-
- //If a deps array or a config callback is specified, then call
- //require with those args. This is useful when require is defined as a
- //config object before require.js is loaded.
- if (cfg.deps || cfg.callback) {
- context.require(cfg.deps || [], cfg.callback);
- }
- },
-
- makeShimExports: function (exports) {
- var func;
- if (typeof exports === 'string') {
- func = function () {
- return getGlobal(exports);
- };
- //Save the exports for use in nodefine checking.
- func.exports = exports;
- return func;
- } else {
- return function () {
- return exports.apply(global, arguments);
- };
- }
- },
-
- requireDefined: function (id, relMap) {
- return hasProp(defined, makeModuleMap(id, relMap, false, true).id);
- },
-
- requireSpecified: function (id, relMap) {
- id = makeModuleMap(id, relMap, false, true).id;
- return hasProp(defined, id) || hasProp(registry, id);
- },
-
- require: function (deps, callback, errback, relMap) {
- var moduleName, id, map, requireMod, args;
- if (typeof deps === 'string') {
- if (isFunction(callback)) {
- //Invalid call
- return onError(makeError('requireargs', 'Invalid require call'), errback);
- }
-
- //Synchronous access to one module. If require.get is
- //available (as in the Node adapter), prefer that.
- //In this case deps is the moduleName and callback is
- //the relMap
- if (req.get) {
- return req.get(context, deps, callback);
- }
-
- //Just return the module wanted. In this scenario, the
- //second arg (if passed) is just the relMap.
- moduleName = deps;
- relMap = callback;
-
- //Normalize module name, if it contains . or ..
- map = makeModuleMap(moduleName, relMap, false, true);
- id = map.id;
-
- if (!hasProp(defined, id)) {
- return onError(makeError('notloaded', 'Module name "' +
- id +
- '" has not been loaded yet for context: ' +
- contextName));
- }
- return defined[id];
- }
-
- //Callback require. Normalize args. if callback or errback is
- //not a function, it means it is a relMap. Test errback first.
- if (errback && !isFunction(errback)) {
- relMap = errback;
- errback = undefined;
- }
- if (callback && !isFunction(callback)) {
- relMap = callback;
- callback = undefined;
- }
-
- //Any defined modules in the global queue, intake them now.
- takeGlobalQueue();
-
- //Make sure any remaining defQueue items get properly processed.
- while (defQueue.length) {
- args = defQueue.shift();
- if (args[0] === null) {
- return onError(makeError('mismatch', 'Mismatched anonymous define() module: ' + args[args.length - 1]));
- } else {
- //args are id, deps, factory. Should be normalized by the
- //define() function.
- callGetModule(args);
- }
- }
-
- //Mark all the dependencies as needing to be loaded.
- requireMod = getModule(makeModuleMap(null, relMap));
-
- requireMod.init(deps, callback, errback, {
- enabled: true
- });
-
- checkLoaded();
-
- return context.require;
- },
-
- undef: function (id) {
- //Bind any waiting define() calls to this context,
- //fix for #408
- takeGlobalQueue();
-
- var map = makeModuleMap(id, null, true),
- mod = registry[id];
-
- delete defined[id];
- delete urlFetched[map.url];
- delete undefEvents[id];
-
- if (mod) {
- //Hold on to listeners in case the
- //module will be attempted to be reloaded
- //using a different config.
- if (mod.events.defined) {
- undefEvents[id] = mod.events;
- }
-
- removeWaiting(id);
- }
- },
-
- /**
- * Called to enable a module if it is still in the registry
- * awaiting enablement. parent module is passed in for context,
- * used by the optimizer.
- */
- enable: function (depMap, parent) {
- var mod = registry[depMap.id];
- if (mod) {
- getModule(depMap).enable();
- }
- },
-
- /**
- * Internal method used by environment adapters to complete a load event.
- * A load event could be a script load or just a load pass from a synchronous
- * load call.
- * @param {String} moduleName the name of the module to potentially complete.
- */
- completeLoad: function (moduleName) {
- var found, args, mod,
- shim = config.shim[moduleName] || {},
- shExports = shim.exports && shim.exports.exports;
-
- takeGlobalQueue();
-
- while (defQueue.length) {
- args = defQueue.shift();
- if (args[0] === null) {
- args[0] = moduleName;
- //If already found an anonymous module and bound it
- //to this name, then this is some other anon module
- //waiting for its completeLoad to fire.
- if (found) {
- break;
- }
- found = true;
- } else if (args[0] === moduleName) {
- //Found matching define call for this script!
- found = true;
- }
-
- callGetModule(args);
- }
-
- //Do this after the cycle of callGetModule in case the result
- //of those calls/init calls changes the registry.
- mod = registry[moduleName];
-
- if (!found && !defined[moduleName] && mod && !mod.inited) {
- if (config.enforceDefine && (!shExports || !getGlobal(shExports))) {
- if (hasPathFallback(moduleName)) {
- return;
- } else {
- return onError(makeError('nodefine',
- 'No define call for ' + moduleName,
- null,
- [moduleName]));
- }
- } else {
- //A script that does not call define(), so just simulate
- //the call for it.
- callGetModule([moduleName, (shim.deps || []), shim.exports]);
- }
- }
-
- checkLoaded();
- },
-
- /**
- * Converts a module name + .extension into an URL path.
- * *Requires* the use of a module name. It does not support using
- * plain URLs like nameToUrl.
- */
- toUrl: function (moduleNamePlusExt, relModuleMap) {
- var index = moduleNamePlusExt.lastIndexOf('.'),
- ext = null;
-
- if (index !== -1) {
- ext = moduleNamePlusExt.substring(index, moduleNamePlusExt.length);
- moduleNamePlusExt = moduleNamePlusExt.substring(0, index);
- }
-
- return context.nameToUrl(normalize(moduleNamePlusExt, relModuleMap && relModuleMap.id, true),
- ext);
- },
-
- /**
- * Converts a module name to a file path. Supports cases where
- * moduleName may actually be just an URL.
- * Note that it **does not** call normalize on the moduleName,
- * it is assumed to have already been normalized. This is an
- * internal API, not a public one. Use toUrl for the public API.
- */
- nameToUrl: function (moduleName, ext) {
- var paths, pkgs, pkg, pkgPath, syms, i, parentModule, url,
- parentPath;
-
- //If a colon is in the URL, it indicates a protocol is used and it is just
- //an URL to a file, or if it starts with a slash, contains a query arg (i.e. ?)
- //or ends with .js, then assume the user meant to use an url and not a module id.
- //The slash is important for protocol-less URLs as well as full paths.
- if (req.jsExtRegExp.test(moduleName)) {
- //Just a plain path, not module name lookup, so just return it.
- //Add extension if it is included. This is a bit wonky, only non-.js things pass
- //an extension, this method probably needs to be reworked.
- url = moduleName + (ext || '');
- } else {
- //A module that needs to be converted to a path.
- paths = config.paths;
- pkgs = config.pkgs;
-
- syms = moduleName.split('/');
- //For each module name segment, see if there is a path
- //registered for it. Start with most specific name
- //and work up from it.
- for (i = syms.length; i > 0; i -= 1) {
- parentModule = syms.slice(0, i).join('/');
- pkg = pkgs[parentModule];
- parentPath = paths[parentModule];
- if (parentPath) {
- //If an array, it means there are a few choices,
- //Choose the one that is desired
- if (isArray(parentPath)) {
- parentPath = parentPath[0];
- }
- syms.splice(0, i, parentPath);
- break;
- } else if (pkg) {
- //If module name is just the package name, then looking
- //for the main module.
- if (moduleName === pkg.name) {
- pkgPath = pkg.location + '/' + pkg.main;
- } else {
- pkgPath = pkg.location;
- }
- syms.splice(0, i, pkgPath);
- break;
- }
- }
-
- //Join the path parts together, then figure out if baseUrl is needed.
- url = syms.join('/');
- url += (ext || (/\?/.test(url) ? '' : '.js'));
- url = (url.charAt(0) === '/' || url.match(/^[\w\+\.\-]+:/) ? '' : config.baseUrl) + url;
- }
-
- return config.urlArgs ? url +
- ((url.indexOf('?') === -1 ? '?' : '&') +
- config.urlArgs) : url;
- },
-
- //Delegates to req.load. Broken out as a separate function to
- //allow overriding in the optimizer.
- load: function (id, url) {
- req.load(context, id, url);
- },
-
- /**
- * Executes a module callack function. Broken out as a separate function
- * solely to allow the build system to sequence the files in the built
- * layer in the right sequence.
- *
- * @private
- */
- execCb: function (name, callback, args, exports) {
- return callback.apply(exports, args);
- },
-
- /**
- * callback for script loads, used to check status of loading.
- *
- * @param {Event} evt the event from the browser for the script
- * that was loaded.
- */
- onScriptLoad: function (evt) {
- //Using currentTarget instead of target for Firefox 2.0's sake. Not
- //all old browsers will be supported, but this one was easy enough
- //to support and still makes sense.
- if (evt.type === 'load' ||
- (readyRegExp.test((evt.currentTarget || evt.srcElement).readyState))) {
- //Reset interactive script so a script node is not held onto for
- //to long.
- interactiveScript = null;
-
- //Pull out the name of the module and the context.
- var data = getScriptData(evt);
- context.completeLoad(data.id);
- }
- },
-
- /**
- * Callback for script errors.
- */
- onScriptError: function (evt) {
- var data = getScriptData(evt);
- if (!hasPathFallback(data.id)) {
- return onError(makeError('scripterror', 'Script error', evt, [data.id]));
- }
- }
- });
- }
-
- /**
- * Main entry point.
- *
- * If the only argument to require is a string, then the module that
- * is represented by that string is fetched for the appropriate context.
- *
- * If the first argument is an array, then it will be treated as an array
- * of dependency string names to fetch. An optional function callback can
- * be specified to execute when all of those dependencies are available.
- *
- * Make a local req variable to help Caja compliance (it assumes things
- * on a require that are not standardized), and to give a short
- * name for minification/local scope use.
- */
- req = requirejs = function (deps, callback, errback, optional) {
-
- //Find the right context, use default
- var context, config,
- contextName = defContextName;
-
- // Determine if have config object in the call.
- if (!isArray(deps) && typeof deps !== 'string') {
- // deps is a config object
- config = deps;
- if (isArray(callback)) {
- // Adjust args if there are dependencies
- deps = callback;
- callback = errback;
- errback = optional;
- } else {
- deps = [];
- }
- }
-
- if (config && config.context) {
- contextName = config.context;
- }
-
- context = contexts[contextName];
- if (!context) {
- context = contexts[contextName] = req.s.newContext(contextName);
- }
-
- if (config) {
- context.configure(config);
- }
-
- return context.require(deps, callback, errback);
- };
-
- /**
- * Support require.config() to make it easier to cooperate with other
- * AMD loaders on globally agreed names.
- */
- req.config = function (config) {
- return req(config);
- };
-
- /**
- * Export require as a global, but only if it does not already exist.
- */
- if (!require) {
- require = req;
- }
-
- req.version = version;
-
- //Used to filter out dependencies that are already paths.
- req.jsExtRegExp = /^\/|:|\?|\.js$/;
- req.isBrowser = isBrowser;
- s = req.s = {
- contexts: contexts,
- newContext: newContext
- };
-
- //Create default context.
- req({});
-
- //Exports some context-sensitive methods on global require, using
- //default context if no context specified.
- addRequireMethods(req);
-
- if (isBrowser) {
- head = s.head = document.getElementsByTagName('head')[0];
- //If BASE tag is in play, using appendChild is a problem for IE6.
- //When that browser dies, this can be removed. Details in this jQuery bug:
- //http://dev.jquery.com/ticket/2709
- baseElement = document.getElementsByTagName('base')[0];
- if (baseElement) {
- head = s.head = baseElement.parentNode;
- }
- }
-
- /**
- * Any errors that require explicitly generates will be passed to this
- * function. Intercept/override it if you want custom error handling.
- * @param {Error} err the error object.
- */
- req.onError = function (err) {
- throw err;
- };
-
- /**
- * Does the request to load a module for the browser case.
- * Make this a separate function to allow other environments
- * to override it.
- *
- * @param {Object} context the require context to find state.
- * @param {String} moduleName the name of the module.
- * @param {Object} url the URL to the module.
- */
- req.load = function (context, moduleName, url) {
- var config = (context && context.config) || {},
- node;
- if (isBrowser) {
- //In the browser so use a script tag
- node = config.xhtml ?
- document.createElementNS('http://www.w3.org/1999/xhtml', 'html:script') :
- document.createElement('script');
- node.type = config.scriptType || 'text/javascript';
- node.charset = 'utf-8';
- node.async = true;
-
- node.setAttribute('data-requirecontext', context.contextName);
- node.setAttribute('data-requiremodule', moduleName);
-
- //Set up load listener. Test attachEvent first because IE9 has
- //a subtle issue in its addEventListener and script onload firings
- //that do not match the behavior of all other browsers with
- //addEventListener support, which fire the onload event for a
- //script right after the script execution. See:
- //https://connect.microsoft.com/IE/feedback/details/648057/script-onload-event-is-not-fired-immediately-after-script-execution
- //UNFORTUNATELY Opera implements attachEvent but does not follow the script
- //script execution mode.
- if (node.attachEvent &&
- //Check if node.attachEvent is artificially added by custom script or
- //natively supported by browser
- //read https://github.com/jrburke/requirejs/issues/187
- //if we can NOT find [native code] then it must NOT natively supported.
- //in IE8, node.attachEvent does not have toString()
- //Note the test for "[native code" with no closing brace, see:
- //https://github.com/jrburke/requirejs/issues/273
- !(node.attachEvent.toString && node.attachEvent.toString().indexOf('[native code') < 0) &&
- !isOpera) {
- //Probably IE. IE (at least 6-8) do not fire
- //script onload right after executing the script, so
- //we cannot tie the anonymous define call to a name.
- //However, IE reports the script as being in 'interactive'
- //readyState at the time of the define call.
- useInteractive = true;
-
- node.attachEvent('onreadystatechange', context.onScriptLoad);
- //It would be great to add an error handler here to catch
- //404s in IE9+. However, onreadystatechange will fire before
- //the error handler, so that does not help. If addEvenListener
- //is used, then IE will fire error before load, but we cannot
- //use that pathway given the connect.microsoft.com issue
- //mentioned above about not doing the 'script execute,
- //then fire the script load event listener before execute
- //next script' that other browsers do.
- //Best hope: IE10 fixes the issues,
- //and then destroys all installs of IE 6-9.
- //node.attachEvent('onerror', context.onScriptError);
- } else {
- node.addEventListener('load', context.onScriptLoad, false);
- node.addEventListener('error', context.onScriptError, false);
- }
- node.src = url;
-
- //For some cache cases in IE 6-8, the script executes before the end
- //of the appendChild execution, so to tie an anonymous define
- //call to the module name (which is stored on the node), hold on
- //to a reference to this node, but clear after the DOM insertion.
- currentlyAddingScript = node;
- if (baseElement) {
- head.insertBefore(node, baseElement);
- } else {
- head.appendChild(node);
- }
- currentlyAddingScript = null;
-
- return node;
- } else if (isWebWorker) {
- //In a web worker, use importScripts. This is not a very
- //efficient use of importScripts, importScripts will block until
- //its script is downloaded and evaluated. However, if web workers
- //are in play, the expectation that a build has been done so that
- //only one script needs to be loaded anyway. This may need to be
- //reevaluated if other use cases become common.
- importScripts(url);
-
- //Account for anonymous modules
- context.completeLoad(moduleName);
- }
- };
-
- function getInteractiveScript() {
- if (interactiveScript && interactiveScript.readyState === 'interactive') {
- return interactiveScript;
- }
-
- eachReverse(scripts(), function (script) {
- if (script.readyState === 'interactive') {
- return (interactiveScript = script);
- }
- });
- return interactiveScript;
- }
-
- //Look for a data-main script attribute, which could also adjust the baseUrl.
- if (isBrowser) {
- //Figure out baseUrl. Get it from the script tag with require.js in it.
- eachReverse(scripts(), function (script) {
- //Set the 'head' where we can append children by
- //using the script's parent.
- if (!head) {
- head = script.parentNode;
- }
-
- //Look for a data-main attribute to set main script for the page
- //to load. If it is there, the path to data main becomes the
- //baseUrl, if it is not already set.
- dataMain = script.getAttribute('data-main');
- if (dataMain) {
- //Set final baseUrl if there is not already an explicit one.
- if (!cfg.baseUrl) {
- //Pull off the directory of data-main for use as the
- //baseUrl.
- src = dataMain.split('/');
- mainScript = src.pop();
- subPath = src.length ? src.join('/') + '/' : './';
-
- cfg.baseUrl = subPath;
- dataMain = mainScript;
- }
-
- //Strip off any trailing .js since dataMain is now
- //like a module name.
- dataMain = dataMain.replace(jsSuffixRegExp, '');
-
- //Put the data-main script in the files to load.
- cfg.deps = cfg.deps ? cfg.deps.concat(dataMain) : [dataMain];
-
- return true;
- }
- });
- }
-
- /**
- * The function that handles definitions of modules. Differs from
- * require() in that a string for the module should be the first argument,
- * and the function to execute after dependencies are loaded should
- * return a value to define the module corresponding to the first argument's
- * name.
- */
- define = function (name, deps, callback) {
- var node, context;
-
- //Allow for anonymous functions
- if (typeof name !== 'string') {
- //Adjust args appropriately
- callback = deps;
- deps = name;
- name = null;
- }
-
- //This module may not have dependencies
- if (!isArray(deps)) {
- callback = deps;
- deps = [];
- }
-
- //If no name, and callback is a function, then figure out if it a
- //CommonJS thing with dependencies.
- if (!deps.length && isFunction(callback)) {
- //Remove comments from the callback string,
- //look for require calls, and pull them into the dependencies,
- //but only if there are function args.
- if (callback.length) {
- callback
- .toString()
- .replace(commentRegExp, '')
- .replace(cjsRequireRegExp, function (match, dep) {
- deps.push(dep);
- });
-
- //May be a CommonJS thing even without require calls, but still
- //could use exports, and module. Avoid doing exports and module
- //work though if it just needs require.
- //REQUIRES the function to expect the CommonJS variables in the
- //order listed below.
- deps = (callback.length === 1 ? ['require'] : ['require', 'exports', 'module']).concat(deps);
- }
- }
-
- //If in IE 6-8 and hit an anonymous define() call, do the interactive
- //work.
- if (useInteractive) {
- node = currentlyAddingScript || getInteractiveScript();
- if (node) {
- if (!name) {
- name = node.getAttribute('data-requiremodule');
- }
- context = contexts[node.getAttribute('data-requirecontext')];
- }
- }
-
- //Always save off evaluating the def call until the script onload handler.
- //This allows multiple modules to be in a file without prematurely
- //tracing dependencies, and allows for anonymous module support,
- //where the module name is not known until the script onload event
- //occurs. If no context, use the global queue, and get it processed
- //in the onscript load callback.
- (context ? context.defQueue : globalDefQueue).push([name, deps, callback]);
- };
-
- define.amd = {
- jQuery: true
- };
-
-
- /**
- * Executes the text. Normally just uses eval, but can be modified
- * to use a better, environment-specific call. Only used for transpiling
- * loader plugins, not for plain JS modules.
- * @param {String} text the text to execute/evaluate.
- */
- req.exec = function (text) {
- /*jslint evil: true */
- return eval(text);
- };
-
- //Set up with config info.
- req(cfg);
-}(this));
diff -r 4368df9df27896599a64236a6f8f80ebb0baf8c5 -r 563ab1b6b311af66818ca7031746ba7201b2d7db templates/visualization/circster.mako
--- a/templates/visualization/circster.mako
+++ b/templates/visualization/circster.mako
@@ -16,7 +16,7 @@
<%def name="javascripts()">
${parent.javascripts()}
- ${h.js( "require", "mvc/data" )}
+ ${h.js( "libs/require", "mvc/data" )}
<script type="text/javascript">
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: jgoecks: Fix bug in tool_form JS reorganization and fix labels for two Cuffdiff options.
by Bitbucket 13 Sep '12
by Bitbucket 13 Sep '12
13 Sep '12
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/changeset/4368df9df278/
changeset: 4368df9df278
user: jgoecks
date: 2012-09-13 22:04:03
summary: Fix bug in tool_form JS reorganization and fix labels for two Cuffdiff options.
affected #: 2 files
diff -r a683489600be0deb53e5abe6eb07c399e417342e -r 4368df9df27896599a64236a6f8f80ebb0baf8c5 templates/tool_form.mako
--- a/templates/tool_form.mako
+++ b/templates/tool_form.mako
@@ -12,6 +12,7 @@
</%def><%def name="javascripts()">
+ ${parent.javascripts()}
${h.js( "galaxy.panels", "libs/jquery/jquery.autocomplete", "libs/jquery/jstorage" )}
<script type="text/javascript">
$(function() {
diff -r a683489600be0deb53e5abe6eb07c399e417342e -r 4368df9df27896599a64236a6f8f80ebb0baf8c5 tools/ngs_rna/cuffdiff_wrapper.xml
--- a/tools/ngs_rna/cuffdiff_wrapper.xml
+++ b/tools/ngs_rna/cuffdiff_wrapper.xml
@@ -24,8 +24,8 @@
## Set paired-end data parameters?
#if $singlePaired.sPaired == "Yes":
- -m $singlePaired.mean_inner_distance
- -s $singlePaired.inner_distance_std_dev
+ -m $singlePaired.frag_mean_len
+ -s $singlePaired.frag_len_std_dev
#end if
## Normalization?
@@ -120,8 +120,8 @@
</param><when value="No"></when><when value="Yes">
- <param name="mean_inner_distance" type="integer" value="20" label="Mean Inner Distance between Mate Pairs"/>
- <param name="inner_distance_std_dev" type="integer" value="20" label="Standard Deviation for Inner Distance between Mate Pairs"/>
+ <param name="frag_mean_len" type="integer" value="20" label="Average Fragment Length"/>
+ <param name="frag_len_std_dev" type="integer" value="20" label="Fragment Length Standard Deviation"/></when></conditional></inputs>
@@ -226,8 +226,8 @@
This is a list of implemented Cuffdiff options::
- -m INT This is the expected (mean) inner distance between mate pairs. For, example, for paired end runs with fragments selected at 300bp, where each end is 50bp, you should set -r to be 200. The default is 45bp.
- -s INT The standard deviation for the distribution on inner distances between mate pairs. The default is 20bp.
+ -m INT Average fragement length; default 200
+ -s INT Fragment legnth standard deviation; default 80
-c INT The minimum number of alignments in a locus for needed to conduct significance testing on changes in that locus observed between samples. If no testing is performed, changes in the locus are deemed not significant, and the locus' observed changes don't contribute to correction for multiple testing. The default is 1,000 fragment alignments (up to 2,000 paired reads).
--FDR FLOAT The allowed false discovery rate. The default is 0.05.
--num-importance-samples INT Sets the number of importance samples generated for each locus during abundance estimation. Default: 1000
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: greg: import re into ~/tools.__init__ since some recent methods use it.
by Bitbucket 13 Sep '12
by Bitbucket 13 Sep '12
13 Sep '12
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/changeset/a683489600be/
changeset: a683489600be
user: greg
date: 2012-09-13 21:57:48
summary: import re into ~/tools.__init__ since some recent methods use it.
affected #: 1 file
diff -r 9b13c3554a09eefd75387f1740ed9e4b0c32c50f -r a683489600be0deb53e5abe6eb07c399e417342e lib/galaxy/tools/__init__.py
--- a/lib/galaxy/tools/__init__.py
+++ b/lib/galaxy/tools/__init__.py
@@ -6,7 +6,7 @@
pkg_resources.require( "simplejson" )
pkg_resources.require( "Mako" )
-import logging, os, string, sys, tempfile, glob, shutil, types, urllib, subprocess, random, math, traceback
+import logging, os, string, sys, tempfile, glob, shutil, types, urllib, subprocess, random, math, traceback, re
import simplejson
import binascii
from mako.template import Template
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: jgoecks: Add mako template for rendering common trackster dependencies. This fixes shared/embedded visualizations, which were broken in recent commits.
by Bitbucket 13 Sep '12
by Bitbucket 13 Sep '12
13 Sep '12
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/changeset/9b13c3554a09/
changeset: 9b13c3554a09
user: jgoecks
date: 2012-09-13 21:51:50
summary: Add mako template for rendering common trackster dependencies. This fixes shared/embedded visualizations, which were broken in recent commits.
affected #: 5 files
diff -r cc064ff4249b2701198a4121154f62182cd048ce -r 9b13c3554a09eefd75387f1740ed9e4b0c32c50f templates/base_panels.mako
--- a/templates/base_panels.mako
+++ b/templates/base_panels.mako
@@ -48,7 +48,7 @@
<!--[if lt IE 7]>
${h.js( 'libs/IE/IE7', 'libs/IE/ie7-recalc' )}
<![endif]-->
- ${h.js( 'libs/jquery/jquery', 'libs/json2', 'libs/bootstrap', 'libs/underscore', 'libs/backbone/backbone', 'libs/backbone/backbone-relational', 'libs/handlebars.runtime', 'mvc/ui' )}
+ ${h.js( 'libs/jquery/jquery', 'libs/json2', 'libs/bootstrap', 'libs/underscore', 'libs/backbone/backbone', 'libs/backbone/backbone-relational', 'libs/handlebars.runtime', 'mvc/ui', 'galaxy.base' )}
<script type="text/javascript">
// Set up needed paths.
var galaxy_paths = new GalaxyPaths({
@@ -73,7 +73,7 @@
<%def name="late_javascripts()">
## Scripts can be loaded later since they progressively add features to
## the panels, but do not change layout
- ${h.js( 'libs/jquery/jquery.event.drag', 'libs/jquery/jquery.event.hover', 'libs/jquery/jquery.form', 'libs/jquery/jquery.rating', 'galaxy.base', 'galaxy.panels' )}
+ ${h.js( 'libs/jquery/jquery.event.drag', 'libs/jquery/jquery.event.hover', 'libs/jquery/jquery.form', 'libs/jquery/jquery.rating', 'galaxy.panels' )}
<script type="text/javascript">
ensure_dd_helper();
diff -r cc064ff4249b2701198a4121154f62182cd048ce -r 9b13c3554a09eefd75387f1740ed9e4b0c32c50f templates/display_base.mako
--- a/templates/display_base.mako
+++ b/templates/display_base.mako
@@ -11,6 +11,7 @@
<%inherit file="${inherit( context )}"/><%namespace file="/tagging_common.mako" import="render_individual_tagging_element, render_community_tagging_element" /><%namespace file="/display_common.mako" import="*" />
+<%namespace file="/visualization/trackster_common.mako" import="*" />
##
## Functions used by base.mako and base_panels.mako to display content.
@@ -33,8 +34,8 @@
<%def name="javascripts()">
${parent.javascripts()}
${h.js( "libs/jquery/jstorage", "libs/jquery/jquery.autocomplete", "libs/jquery/jquery.rating",
- "galaxy.autocom_tagging", "viz/trackster", "viz/trackster_ui", "libs/jquery/jquery.event.drag", "libs/jquery/jquery.mousewheel",
- "libs/jquery/jquery.autocomplete", "libs/jquery/jquery.ui.sortable.slider", "libs/farbtastic", "mvc/data", "viz/visualization" )}
+ "galaxy.autocom_tagging" )}
+ ${render_trackster_js_files()}
<script type="text/javascript">
@@ -113,7 +114,8 @@
<%def name="stylesheets()">
${parent.stylesheets()}
- ${h.css( "autocomplete_tagging", "embed_item", "trackster", "jquery.rating", "jquery-ui/smoothness/jquery-ui-1.8.23.custom" )}
+ ${h.css( "autocomplete_tagging", "embed_item", "jquery.rating" )}
+ ${render_trackster_css_files()}
<style type="text/css">
.page-body {
diff -r cc064ff4249b2701198a4121154f62182cd048ce -r 9b13c3554a09eefd75387f1740ed9e4b0c32c50f templates/tracks/browser.mako
--- a/templates/tracks/browser.mako
+++ b/templates/tracks/browser.mako
@@ -1,4 +1,5 @@
<%inherit file="/webapps/galaxy/base_panels.mako"/>
+<%namespace file="/visualization/trackster_common.mako" import="*" /><%def name="init()"><%
@@ -11,7 +12,7 @@
<%def name="stylesheets()">
${parent.stylesheets()}
- ${h.css( "history", "autocomplete_tagging", "trackster", "library", "jquery-ui/smoothness/jquery-ui-1.8.23.custom" )}
+ ${render_trackster_css_files()}
</%def><%def name="javascripts()">
@@ -21,7 +22,7 @@
<script type='text/javascript' src="${h.url_for('/static/scripts/libs/IE/excanvas.js')}"></script><![endif]-->
-${h.js( "galaxy.panels", "libs/jquery/jstorage", "libs/jquery/jquery.event.drag", "libs/jquery/jquery.event.hover","libs/jquery/jquery.mousewheel", "libs/jquery/jquery-ui-1.8.23.custom.min", "mvc/data", "viz/visualization", "viz/trackster", "viz/trackster_ui", "libs/farbtastic" )}
+${render_trackster_js_files()}
<script type="text/javascript">
//
@@ -30,17 +31,10 @@
galaxy_paths.set({
visualization_url: "${h.url_for( action='save' )}"
});
- var
- add_track_async_url = "${h.url_for( action='add_track_async' )}",
- add_datasets_url = "${h.url_for( action='list_current_history_datasets' )}",
- default_data_url = "${h.url_for( action='data' )}",
- raw_data_url = "${h.url_for( action='raw_data' )}",
- reference_url = "${h.url_for( action='reference' )}",
- chrom_url = "${h.url_for( action='chroms' )}",
- dataset_state_url = "${h.url_for( action='dataset_state' )}",
- converted_datasets_state_url = "${h.url_for( action='converted_datasets_state' )}",
- feature_search_url = "${h.url_for( action='search_features' )}",
- view,
+
+ ${render_trackster_js_vars()}
+
+ var view,
browser_router;
/**
diff -r cc064ff4249b2701198a4121154f62182cd048ce -r 9b13c3554a09eefd75387f1740ed9e4b0c32c50f templates/visualization/display.mako
--- a/templates/visualization/display.mako
+++ b/templates/visualization/display.mako
@@ -1,4 +1,5 @@
<%inherit file="/display_base.mako"/>
+<%namespace file="/visualization/trackster_common.mako" import="*" /><%def name="javascripts()"><% config = item_data %>
@@ -54,20 +55,9 @@
<script type="text/javascript">
// TODO: much of this code is copied from browser.mako -- create shared base and use in both places.
-
- //
- // Place URLs here so that url_for can be used to generate them.
- //
- var default_data_url = "${h.url_for( controller='/tracks', action='data' )}",
- raw_data_url = "${h.url_for( controller='/tracks', action='raw_data' )}",
- run_tool_url = "${h.url_for( controller='/tracks', action='run_tool' )}",
- rerun_tool_url = "${h.url_for( controller='/tracks', action='rerun_tool' )}",
- reference_url = "${h.url_for( controller='/tracks', action='reference' )}",
- chrom_url = "${h.url_for( controller='/tracks', action='chroms' )}",
- dataset_state_url = "${h.url_for( controller='/tracks', action='dataset_state' )}",
- converted_datasets_state_url = "${h.url_for( controller='/tracks', action='converted_datasets_state' )}",
- addable_track_types = { "LineTrack": LineTrack, "FeatureTrack": FeatureTrack, "ReadTrack": ReadTrack },
- view,
+ ${render_trackster_js_vars()}
+
+ var view,
container_element = $("#${trans.security.encode_id( visualization.id )}");
$(function() {
diff -r cc064ff4249b2701198a4121154f62182cd048ce -r 9b13c3554a09eefd75387f1740ed9e4b0c32c50f templates/visualization/trackster_common.mako
--- /dev/null
+++ b/templates/visualization/trackster_common.mako
@@ -0,0 +1,28 @@
+##
+## Utilities for creating Trackster visualizations.
+##
+
+## Render needed CSS files.
+<%def name="render_trackster_css_files()">
+ ${h.css( "history", "autocomplete_tagging", "trackster", "library",
+ "jquery-ui/smoothness/jquery-ui-1.8.23.custom" )}
+</%def>
+
+
+## Render needed JavaScript files.
+<%def name="render_trackster_js_files()">
+ ${h.js( "galaxy.panels", "libs/jquery/jstorage", "libs/jquery/jquery.event.drag", "libs/jquery/jquery.event.hover","libs/jquery/jquery.mousewheel", "libs/jquery/jquery-ui-1.8.23.custom.min", "mvc/data", "viz/visualization", "viz/trackster", "viz/trackster_ui", "libs/farbtastic" )}
+</%def>
+
+## Render a block of JavaScript that contains all necessary variables for Trackster.
+<%def name="render_trackster_js_vars()">
+ var add_track_async_url = "${h.url_for( controller='/tracks', action='add_track_async' )}",
+ add_datasets_url = "${h.url_for( controller='/tracks', action='list_current_history_datasets' )}",
+ default_data_url = "${h.url_for( controller='/tracks', action='data' )}",
+ raw_data_url = "${h.url_for( controller='/tracks', action='raw_data' )}",
+ reference_url = "${h.url_for( controller='/tracks', action='reference' )}",
+ chrom_url = "${h.url_for( controller='/tracks', action='chroms' )}",
+ dataset_state_url = "${h.url_for( controller='/tracks', action='dataset_state' )}",
+ converted_datasets_state_url = "${h.url_for( controller='/tracks', action='converted_datasets_state' )}",
+ feature_search_url = "${h.url_for( controller='/tracks', action='search_features' )}";
+</%def>
\ 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

13 Sep '12
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/changeset/cc064ff4249b/
changeset: cc064ff4249b
user: dan
date: 2012-09-13 21:41:18
summary: Fix for fastq filter tool single-ended reads.
affected #: 1 file
diff -r c4ced3262d0d50719dd5d7d24ed10627b75d67ba -r cc064ff4249b2701198a4121154f62182cd048ce tools/fastq/fastq_filter.xml
--- a/tools/fastq/fastq_filter.xml
+++ b/tools/fastq/fastq_filter.xml
@@ -74,7 +74,7 @@
return False
else:
num_deviates -= 1
-#if $paired_end.value == 'single_end':
+#if not $paired_end:
qual_scores_split = [ qual_scores ]
#else:
qual_scores_split = [ qual_scores[ 0:int( len( qual_scores ) / 2 ) ], qual_scores[ int( len( qual_scores ) / 2 ): ] ]
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: greg: Another fix for handling Galaxy's ToolDataTableManager correctly in the tool shed.
by Bitbucket 13 Sep '12
by Bitbucket 13 Sep '12
13 Sep '12
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/changeset/c4ced3262d0d/
changeset: c4ced3262d0d
user: greg
date: 2012-09-13 21:31:56
summary: Another fix for handling Galaxy's ToolDataTableManager correctly in the tool shed.
affected #: 4 files
diff -r 2551b8632edea0df8b71ef6b426e30b7159153a4 -r c4ced3262d0d50719dd5d7d24ed10627b75d67ba lib/galaxy/util/shed_util.py
--- a/lib/galaxy/util/shed_util.py
+++ b/lib/galaxy/util/shed_util.py
@@ -340,9 +340,6 @@
correction_msg = "This file refers to a file named <b>%s</b>. " % str( index_file )
correction_msg += "Upload a file named <b>%s.sample</b> to the repository to correct this error." % str( index_file_name )
invalid_files_and_errors_tups.append( ( tool_config_name, correction_msg ) )
- if webapp == 'community':
- # Reset the tool_data_tables by loading the empty tool_data_table_conf.xml file.
- reset_tool_data_tables( app )
return invalid_files_and_errors_tups
def config_elems_to_xml_file( app, config_elems, config_filename, tool_path ):
# Persist the current in-memory list of config_elems to a file named by the value of config_filename.
@@ -583,31 +580,6 @@
else:
tool_dependencies_dict[ 'set_environment' ] = [ requirements_dict ]
return tool_dependencies_dict
-def generate_tool_dependency_metadata( tool_dependencies_config, metadata_dict ):
- """
- If the combination of name, version and type of each element is defined in the <requirement> tag for at least one tool in the repository,
- then update the received metadata_dict with information from the parsed tool_dependencies_config.
- """
- try:
- tree = ElementTree.parse( tool_dependencies_config )
- except Exception, e:
- log.debug( "Exception attempting to parse tool_dependencies.xml: %s" %str( e ) )
- return metadata_dict
- root = tree.getroot()
- ElementInclude.include( root )
- tool_dependencies_dict = {}
- if can_generate_tool_dependency_metadata( root, metadata_dict ):
- for elem in root:
- if elem.tag == 'package':
- tool_dependencies_dict = generate_package_dependency_metadata( elem, tool_dependencies_dict )
- elif elem.tag == 'set_environment':
- tool_dependencies_dict = generate_environment_dependency_metadata( elem, tool_dependencies_dict )
- # Handle tool dependency installation via other means here (future).
- if tool_dependencies_dict:
- metadata_dict[ 'tool_dependencies' ] = tool_dependencies_dict
- if tool_dependencies_dict:
- metadata_dict[ 'tool_dependencies' ] = tool_dependencies_dict
- return metadata_dict
def generate_metadata_for_changeset_revision( app, repository_clone_url, relative_install_dir=None, repository_files_dir=None,
resetting_all_metadata_on_repository=False, webapp='galaxy' ):
"""
@@ -621,6 +593,7 @@
invalid_tool_configs = []
tool_dependencies_config = None
original_tool_data_path = app.config.tool_data_path
+ original_tool_data_table_config_path = app.config.tool_data_table_config_path
if resetting_all_metadata_on_repository:
if not relative_install_dir:
raise Exception( "The value of repository.repo_path must be sent when resetting all metadata on a repository." )
@@ -630,12 +603,14 @@
files_dir = repository_files_dir
# Since we're working from a temporary directory, we can safely copy sample files included in the repository to the repository root.
app.config.tool_data_path = repository_files_dir
+ app.config.tool_data_table_config_path = repository_files_dir
else:
# Use a temporary working directory to copy all sample files.
work_dir = tempfile.mkdtemp()
# All other files are on disk in the repository's repo_path, which is the value of relative_install_dir.
files_dir = relative_install_dir
app.config.tool_data_path = work_dir
+ app.config.tool_data_table_config_path = work_dir
# Handle proprietary datatypes, if any.
datatypes_config = get_config_from_disk( 'datatypes_conf.xml', files_dir )
if datatypes_config:
@@ -719,11 +694,9 @@
metadata_dict = generate_tool_dependency_metadata( tool_dependencies_config, metadata_dict )
if invalid_tool_configs:
metadata_dict [ 'invalid_tools' ] = invalid_tool_configs
- if webapp == 'community' and resetting_all_metadata_on_repository:
- # Reset the tool_data_tables by loading the empty tool_data_table_conf.xml file.
- reset_tool_data_tables( app )
- # Reset the value of the app's tool_data_path to it's original value.
- app.config.tool_data_path = original_tool_data_path
+ # Reset the value of the app's tool_data_path and tool_data_table_config_path to their respective original values.
+ app.config.tool_data_path = original_tool_data_path
+ app.config.tool_data_table_config_path = original_tool_data_table_config_path
return metadata_dict, invalid_file_tups
def generate_package_dependency_metadata( elem, tool_dependencies_dict ):
"""The value of package_name must match the value of the "package" type in the tool config's <requirements> tag set."""
@@ -741,6 +714,31 @@
if requirements_dict:
tool_dependencies_dict[ dependency_key ] = requirements_dict
return tool_dependencies_dict
+def generate_tool_dependency_metadata( tool_dependencies_config, metadata_dict ):
+ """
+ If the combination of name, version and type of each element is defined in the <requirement> tag for at least one tool in the repository,
+ then update the received metadata_dict with information from the parsed tool_dependencies_config.
+ """
+ try:
+ tree = ElementTree.parse( tool_dependencies_config )
+ except Exception, e:
+ log.debug( "Exception attempting to parse tool_dependencies.xml: %s" %str( e ) )
+ return metadata_dict
+ root = tree.getroot()
+ ElementInclude.include( root )
+ tool_dependencies_dict = {}
+ if can_generate_tool_dependency_metadata( root, metadata_dict ):
+ for elem in root:
+ if elem.tag == 'package':
+ tool_dependencies_dict = generate_package_dependency_metadata( elem, tool_dependencies_dict )
+ elif elem.tag == 'set_environment':
+ tool_dependencies_dict = generate_environment_dependency_metadata( elem, tool_dependencies_dict )
+ # Handle tool dependency installation via other means here (future).
+ if tool_dependencies_dict:
+ metadata_dict[ 'tool_dependencies' ] = tool_dependencies_dict
+ if tool_dependencies_dict:
+ metadata_dict[ 'tool_dependencies' ] = tool_dependencies_dict
+ return metadata_dict
def generate_tool_guid( repository_clone_url, tool ):
"""
Generate a guid for the installed tool. It is critical that this guid matches the guid for
diff -r 2551b8632edea0df8b71ef6b426e30b7159153a4 -r c4ced3262d0d50719dd5d7d24ed10627b75d67ba lib/galaxy/webapps/community/controllers/admin.py
--- a/lib/galaxy/webapps/community/controllers/admin.py
+++ b/lib/galaxy/webapps/community/controllers/admin.py
@@ -696,7 +696,7 @@
owner = repository_name_owner_list[ 1 ]
repository = get_repository_by_name_and_owner( trans, name, owner )
try:
- invalid_file_tups = reset_all_metadata_on_repository( trans, trans.security.encode_id( repository.id ) )
+ invalid_file_tups, metadata_dict = reset_all_metadata_on_repository( trans, trans.security.encode_id( repository.id ) )
if invalid_file_tups:
message = generate_message_for_invalid_tools( invalid_file_tups, repository, None, as_html=False )
log.debug( message )
diff -r 2551b8632edea0df8b71ef6b426e30b7159153a4 -r c4ced3262d0d50719dd5d7d24ed10627b75d67ba lib/galaxy/webapps/community/controllers/common.py
--- a/lib/galaxy/webapps/community/controllers/common.py
+++ b/lib/galaxy/webapps/community/controllers/common.py
@@ -937,7 +937,9 @@
clean_repository_metadata( trans, id, changeset_revisions )
# Set tool version information for all downloadable changeset revisions. Get the list of changeset revisions from the changelog.
reset_all_tool_versions( trans, id, repo )
- return invalid_file_tups
+ # Reset the tool_data_tables by loading the empty tool_data_table_conf.xml file.
+ reset_tool_data_tables( trans.app )
+ return invalid_file_tups, metadata_dict
def set_repository_metadata( trans, repository, content_alert_str='', **kwd ):
"""
Set metadata using the repository's current disk files, returning specific error messages (if any) to alert the repository owner that the changeset
@@ -1000,6 +1002,8 @@
if invalid_file_tups:
message = generate_message_for_invalid_tools( invalid_file_tups, repository, metadata_dict )
status = 'error'
+ # Reset the tool_data_tables by loading the empty tool_data_table_conf.xml file.
+ reset_tool_data_tables( trans.app )
return message, status
def set_repository_metadata_due_to_new_tip( trans, repository, content_alert_str=None, **kwd ):
# Set metadata on the repository tip.
diff -r 2551b8632edea0df8b71ef6b426e30b7159153a4 -r c4ced3262d0d50719dd5d7d24ed10627b75d67ba lib/galaxy/webapps/community/controllers/repository.py
--- a/lib/galaxy/webapps/community/controllers/repository.py
+++ b/lib/galaxy/webapps/community/controllers/repository.py
@@ -1817,10 +1817,10 @@
status=status )
@web.expose
def reset_all_metadata( self, trans, id, **kwd ):
- invalid_file_tups = reset_all_metadata_on_repository( trans, id, **kwd )
+ invalid_file_tups, metadata_dict = reset_all_metadata_on_repository( trans, id, **kwd )
if invalid_file_tups:
repository = get_repository( trans, id )
- message = generate_message_for_invalid_tools( invalid_file_tups, repository, None )
+ message = generate_message_for_invalid_tools( invalid_file_tups, repository, metadata_dict )
status = 'error'
else:
message = "All repository metadata has been reset."
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
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/changeset/2551b8632ede/
changeset: 2551b8632ede
user: richard_burhans
date: 2012-09-13 20:47:21
summary: added missing comma
affected #: 1 file
diff -r 74b67f34a4dfae65dc2dd01cbd1ad9010e1c4ab4 -r 2551b8632edea0df8b71ef6b426e30b7159153a4 templates/webapps/community/base_panels.mako
--- a/templates/webapps/community/base_panels.mako
+++ b/templates/webapps/community/base_panels.mako
@@ -72,7 +72,7 @@
## Help tab.
<%
menu_options = [
- [_('Galaxy Q&A'), app.config.get( "qa_url", "http://slyfox.bx.psu.edu:8080/" ), "_blank" ]
+ [_('Galaxy Q&A'), app.config.get( "qa_url", "http://slyfox.bx.psu.edu:8080/" ), "_blank" ],
[_('Support'), app.config.get( "support_url", "http://wiki.g2.bx.psu.edu/Support" ), "_blank" ],
[_('Tool shed wiki'), app.config.get( "wiki_url", "http://wiki.g2.bx.psu.edu/Tool%20Shed" ), "_blank" ],
[_('Galaxy wiki'), app.config.get( "wiki_url", "http://wiki.g2.bx.psu.edu/" ), "_blank" ],
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/changeset/fa6772cf1d8b/
changeset: fa6772cf1d8b
user: dannon
date: 2012-09-13 18:48:18
summary: Correct default keypair_name for cloud_launch.
affected #: 1 file
diff -r 802b87d6491087f6e82d8490d0d603b7affc3491 -r fa6772cf1d8b6171f835a7401aa8df95c0bbebaa lib/galaxy/web/controllers/cloudlaunch.py
--- a/lib/galaxy/web/controllers/cloudlaunch.py
+++ b/lib/galaxy/web/controllers/cloudlaunch.py
@@ -26,7 +26,7 @@
log = logging.getLogger(__name__)
PKEY_PREFIX = 'gxy_pkey'
-DEFAULT_KEYPAIR = 'deleteme_keypair'
+DEFAULT_KEYPAIR = 'cloudman_keypair'
DEFAULT_AMI = 'ami-da58aab3'
class CloudController(BaseUIController):
https://bitbucket.org/galaxy/galaxy-central/changeset/74b67f34a4df/
changeset: 74b67f34a4df
user: dannon
date: 2012-09-13 20:19:49
summary: Merge
affected #: 8 files
diff -r fa6772cf1d8b6171f835a7401aa8df95c0bbebaa -r 74b67f34a4dfae65dc2dd01cbd1ad9010e1c4ab4 lib/galaxy/web/controllers/root.py
--- a/lib/galaxy/web/controllers/root.py
+++ b/lib/galaxy/web/controllers/root.py
@@ -122,7 +122,7 @@
history_panel_template = "root/history.mako"
# history panel -> backbone
- ##history_panel_template = "root/alternate_history.mako"
+ #history_panel_template = "root/alternate_history.mako"
return trans.stream_template_mako( history_panel_template,
history = history,
annotation = self.get_item_annotation_str( trans.sa_session, trans.user, history ),
diff -r fa6772cf1d8b6171f835a7401aa8df95c0bbebaa -r 74b67f34a4dfae65dc2dd01cbd1ad9010e1c4ab4 static/scripts/mvc/history.js
--- a/static/scripts/mvc/history.js
+++ b/static/scripts/mvc/history.js
@@ -167,7 +167,7 @@
// view for HistoryItem model above
// uncomment this out see log messages
- logger : console,
+ //logger : console,
tagName : "div",
className : "historyItemContainer",
@@ -763,9 +763,12 @@
});
-//==============================================================================
+//------------------------------------------------------------------------------
//HistoryItemView.templates = InDomTemplateLoader.getTemplates({
HistoryItemView.templates = CompiledTemplateLoader.getTemplates({
+ 'common-templates.html' : {
+ warningMsg : 'template-warningmessagesmall',
+ },
'history-templates.html' : {
messages : 'template-history-warning-messages',
titleLink : 'template-history-titleLink',
diff -r fa6772cf1d8b6171f835a7401aa8df95c0bbebaa -r 74b67f34a4dfae65dc2dd01cbd1ad9010e1c4ab4 static/scripts/mvc/ui.js
--- a/static/scripts/mvc/ui.js
+++ b/static/scripts/mvc/ui.js
@@ -35,12 +35,7 @@
*
*/
var IconButtonView = Backbone.View.extend({
- tagName : 'a',
- className : 'icon-button',
- // jsHint.shut( up )
- hrefVoidFn : [ 'javascript', ':void(0)' ].join( '' ),
- fadeSpeed : 0,
initialize : function(){
// better rendering this way (for me anyway)
@@ -49,48 +44,16 @@
},
render : function(){
- //NOTE: this is meant to be rerendered on a model change
- // - since most of the rendering is attributes, it gets complicated
- //TODO: template would be faster, more concise - more PITA
- var disabled_class = this.model.attributes.icon_class + '_disabled';
+ //NOTE: not doing this hide will lead to disappearing buttons when they're both being hovered over & rendered
+ this.$el.tooltip( 'hide' );
- if( !this.model.attributes.visible ){
- //TODO: fancy - but may not work as you expect
- this.$el.fadeOut( this.fadeSpeed );
- }
+ // template in common-templates.html
+ var newElem = $( Handlebars.partials.iconButton( this.model.toJSON() ) );
+ newElem.tooltip( this.model.get( 'tooltip_config' ) );
- if( this.model.attributes.enabled ){
- if( this.$el.hasClass( disabled_class ) ){
- this.$el.removeClass( disabled_class );
- }
- this.$el.addClass( this.model.attributes.icon_class );
- } else {
- this.$el.removeClass( this.model.attributes.icon_class );
- this.$el.addClass( disabled_class );
- }
+ this.$el.replaceWith( newElem );
+ this.setElement( newElem );
- if( this.model.attributes.isMenuButton ){
- this.$el.addClass( 'menu-button' );
- } else {
- this.$el.removeClass( 'menu-button' );
- }
-
- this.$el.data( 'tooltip', false );
- this.$el.attr( 'data-original-title', null );
- this.$el.removeClass( 'tooltip' );
- if( this.model.attributes.title ){
- this.$el.attr( 'title', this.model.attributes.title ).addClass( 'tooltip' );
- this.$el.tooltip( this.model.attributes.tooltip_config );
- }
-
- this.$el.attr( 'id', ( this.model.attributes.id )?( this.model.attributes.id ):( null ) );
- this.$el.attr( 'target', ( this.model.attributes.target )?( this.model.attributes.target ):( null ) );
- this.$el.attr( 'href', ( this.model.attributes.href && !this.model.attributes.on_click )?
- ( this.model.attributes.href ):( this.hrefVoidFn ) );
-
- if( this.model.attributes.visible ){
- this.$el.fadeIn( this.fadeSpeed );
- }
return this;
},
@@ -99,6 +62,7 @@
},
click : function( event ){
+ console.debug( 'click event' );
// if on_click pass to that function
if( this.model.attributes.on_click ){
this.model.attributes.on_click( event );
@@ -108,6 +72,10 @@
return true;
}
});
+//TODO: bc h.templates is gen. loaded AFTER ui, Handlebars.partials.iconButton === undefined
+IconButtonView.templates = {
+ iconButton : Handlebars.partials.iconButton
+};
var IconButtonCollection = Backbone.Collection.extend({
diff -r fa6772cf1d8b6171f835a7401aa8df95c0bbebaa -r 74b67f34a4dfae65dc2dd01cbd1ad9010e1c4ab4 static/scripts/templates/common-templates.html
--- a/static/scripts/templates/common-templates.html
+++ b/static/scripts/templates/common-templates.html
@@ -16,7 +16,7 @@
<script type="text/template" class="template-common" id="template-warningmessagesmall">
{{! renders a warning in a (mostly css) highlighted, iconned warning box }}
- <div class="warningmessagesmall"><strong>{{ warning }}</strong></div>
+ <div class="warningmessagesmall"><strong>{{{ warning }}}</strong></div></script><script type="text/javascript" class="helper-common" id="helper-iconButton">
@@ -29,7 +29,7 @@
var buffer = "";
buffer += ( buttonData.enabled )?( '<a' ):( '<span' );
- if( buttonData.title ){ buttonData.buffer += ' title="' + buttonData.title + '"'; }
+ if( buttonData.title ){ buffer += ' title="' + buttonData.title + '"'; }
buffer += ' class="icon-button';
if( buttonData.isMenuButton ){ buffer += ' menu-button'; }
@@ -44,7 +44,7 @@
if( !buttonData.visible ){ buffer += ' style="display: none;"'; }
- buffer += '>Bler' + ( ( buttonData.enabled )?( '</a>' ):( '</span>' ) );
+ buffer += '>' + ( ( buttonData.enabled )?( '</a>' ):( '</span>' ) );
return buffer;
});
</script>
diff -r fa6772cf1d8b6171f835a7401aa8df95c0bbebaa -r 74b67f34a4dfae65dc2dd01cbd1ad9010e1c4ab4 static/scripts/templates/compiled/helpers-common-templates.js
--- a/static/scripts/templates/compiled/helpers-common-templates.js
+++ b/static/scripts/templates/compiled/helpers-common-templates.js
@@ -12,7 +12,7 @@
var buffer = "";
buffer += ( buttonData.enabled )?( '<a' ):( '<span' );
- if( buttonData.title ){ buttonData.buffer += ' title="' + buttonData.title + '"'; }
+ if( buttonData.title ){ buffer += ' title="' + buttonData.title + '"'; }
buffer += ' class="icon-button';
if( buttonData.isMenuButton ){ buffer += ' menu-button'; }
@@ -27,7 +27,7 @@
if( !buttonData.visible ){ buffer += ' style="display: none;"'; }
- buffer += '>Bler' + ( ( buttonData.enabled )?( '</a>' ):( '</span>' ) );
+ buffer += '>' + ( ( buttonData.enabled )?( '</a>' ):( '</span>' ) );
return buffer;
});
/** Renders a warning in a (mostly css) highlighted, iconned warning box
diff -r fa6772cf1d8b6171f835a7401aa8df95c0bbebaa -r 74b67f34a4dfae65dc2dd01cbd1ad9010e1c4ab4 static/scripts/templates/compiled/template-warningmessagesmall.js
--- a/static/scripts/templates/compiled/template-warningmessagesmall.js
+++ b/static/scripts/templates/compiled/template-warningmessagesmall.js
@@ -2,13 +2,14 @@
var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
templates['template-warningmessagesmall'] = template(function (Handlebars,depth0,helpers,partials,data) {
helpers = helpers || Handlebars.helpers;
- var buffer = "", stack1, foundHelper, functionType="function", escapeExpression=this.escapeExpression;
+ var buffer = "", stack1, foundHelper, functionType="function";
buffer += " \n <div class=\"warningmessagesmall\"><strong>";
foundHelper = helpers.warning;
if (foundHelper) { stack1 = foundHelper.call(depth0, {hash:{}}); }
else { stack1 = depth0.warning; stack1 = typeof stack1 === functionType ? stack1() : stack1; }
- buffer += escapeExpression(stack1) + "</strong></div>";
+ if(stack1 || stack1 === 0) { buffer += stack1; }
+ buffer += "</strong></div>";
return buffer;});
})();
\ No newline at end of file
diff -r fa6772cf1d8b6171f835a7401aa8df95c0bbebaa -r 74b67f34a4dfae65dc2dd01cbd1ad9010e1c4ab4 static/scripts/templates/template-warningmessagesmall.handlebars
--- a/static/scripts/templates/template-warningmessagesmall.handlebars
+++ b/static/scripts/templates/template-warningmessagesmall.handlebars
@@ -1,2 +1,2 @@
{{! renders a warning in a (mostly css) highlighted, iconned warning box }}
- <div class="warningmessagesmall"><strong>{{ warning }}</strong></div>
\ No newline at end of file
+ <div class="warningmessagesmall"><strong>{{{ warning }}}</strong></div>
\ No newline at end of file
diff -r fa6772cf1d8b6171f835a7401aa8df95c0bbebaa -r 74b67f34a4dfae65dc2dd01cbd1ad9010e1c4ab4 templates/root/alternate_history.mako
--- a/templates/root/alternate_history.mako
+++ b/templates/root/alternate_history.mako
@@ -298,6 +298,7 @@
${h.templates(
"helpers-common-templates",
+ "template-warningmessagesmall",
"template-history-warning-messages",
"template-history-titleLink",
@@ -314,34 +315,6 @@
"mvc/history"
##"mvc/tags", "mvc/annotations"
)}
-
- <script type="text/javascript">
- GalaxyLocalization.setLocalizedString( ${ create_localization_json( get_page_localized_strings() ) } );
- // add needed controller urls to GalaxyPaths
- galaxy_paths.set( 'dataset_path', "${h.url_for( controller='dataset' )}" )
-
- // Init. on document load.
- var pageData = ${context_to_js()};
-
- //USE_MOCK_DATA = true;
-
- $(function(){
- if( console && console.debug ){ console.debug( 'using backbone.js in history panel' ); }
- if( window.USE_MOCK_DATA ){
- if( console && console.debug ){ console.debug( '\t using mock data' ); }
- createMockHistoryData();
- return;
- }
-
- glx_history = new History( pageData.history ).loadDatasetsAsHistoryItems( pageData.hdas );
- glx_history_view = new HistoryView({ model: glx_history });
- glx_history_view.render();
-
- hi = glx_history.items.at( 0 );
- hi_view = new HistoryItemView({ model: hi });
- $( 'body' ).append( hi_view.render() );
- });
- </script></%def><%def name="stylesheets()">
@@ -385,5 +358,41 @@
${_('Galaxy History')}
</%def>
+<script type="text/javascript">
+ GalaxyLocalization.setLocalizedString( ${ create_localization_json( get_page_localized_strings() ) } );
+ // add needed controller urls to GalaxyPaths
+ galaxy_paths.set( 'dataset_path', "${h.url_for( controller='dataset' )}" )
+
+ // Init. on document load.
+ var pageData = ${context_to_js()};
+
+ //USE_MOCK_DATA = true;
+ USE_CURR_DATA = true;
+
+ $(function(){
+ if( console && console.debug ){ console.debug( 'using backbone.js in history panel' ); }
+
+ if( window.USE_MOCK_DATA ){
+ if( console && console.debug ){ console.debug( '\t using mock data' ); }
+ createMockHistoryData();
+ return;
+
+ } else if ( USE_CURR_DATA ){
+ if( console && console.debug ){ console.debug( '\t using current history data' ); }
+ glx_history = new History( pageData.history ).loadDatasetsAsHistoryItems( pageData.hdas );
+ glx_history_view = new HistoryView({ model: glx_history });
+ glx_history_view.render();
+
+ hi = glx_history.items.at( 0 );
+ hi_view = new HistoryItemView({ model: hi });
+ $( 'body' ).append( hi_view.render() );
+ return;
+ }
+
+ // sandbox here
+ });
+</script>
+
+
<body class="historyPage"></body>
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: fixes to iconButton template; have IconButtonView use that template
by Bitbucket 13 Sep '12
by Bitbucket 13 Sep '12
13 Sep '12
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/changeset/9867a7110f6d/
changeset: 9867a7110f6d
user: carlfeberhard
date: 2012-09-13 20:08:09
summary: fixes to iconButton template; have IconButtonView use that template
affected #: 8 files
diff -r 802b87d6491087f6e82d8490d0d603b7affc3491 -r 9867a7110f6d03488ca3f96e6a924346c8450cd8 lib/galaxy/web/controllers/root.py
--- a/lib/galaxy/web/controllers/root.py
+++ b/lib/galaxy/web/controllers/root.py
@@ -122,7 +122,7 @@
history_panel_template = "root/history.mako"
# history panel -> backbone
- ##history_panel_template = "root/alternate_history.mako"
+ #history_panel_template = "root/alternate_history.mako"
return trans.stream_template_mako( history_panel_template,
history = history,
annotation = self.get_item_annotation_str( trans.sa_session, trans.user, history ),
diff -r 802b87d6491087f6e82d8490d0d603b7affc3491 -r 9867a7110f6d03488ca3f96e6a924346c8450cd8 static/scripts/mvc/history.js
--- a/static/scripts/mvc/history.js
+++ b/static/scripts/mvc/history.js
@@ -167,7 +167,7 @@
// view for HistoryItem model above
// uncomment this out see log messages
- logger : console,
+ //logger : console,
tagName : "div",
className : "historyItemContainer",
@@ -763,9 +763,12 @@
});
-//==============================================================================
+//------------------------------------------------------------------------------
//HistoryItemView.templates = InDomTemplateLoader.getTemplates({
HistoryItemView.templates = CompiledTemplateLoader.getTemplates({
+ 'common-templates.html' : {
+ warningMsg : 'template-warningmessagesmall',
+ },
'history-templates.html' : {
messages : 'template-history-warning-messages',
titleLink : 'template-history-titleLink',
diff -r 802b87d6491087f6e82d8490d0d603b7affc3491 -r 9867a7110f6d03488ca3f96e6a924346c8450cd8 static/scripts/mvc/ui.js
--- a/static/scripts/mvc/ui.js
+++ b/static/scripts/mvc/ui.js
@@ -35,12 +35,7 @@
*
*/
var IconButtonView = Backbone.View.extend({
- tagName : 'a',
- className : 'icon-button',
- // jsHint.shut( up )
- hrefVoidFn : [ 'javascript', ':void(0)' ].join( '' ),
- fadeSpeed : 0,
initialize : function(){
// better rendering this way (for me anyway)
@@ -49,48 +44,16 @@
},
render : function(){
- //NOTE: this is meant to be rerendered on a model change
- // - since most of the rendering is attributes, it gets complicated
- //TODO: template would be faster, more concise - more PITA
- var disabled_class = this.model.attributes.icon_class + '_disabled';
+ //NOTE: not doing this hide will lead to disappearing buttons when they're both being hovered over & rendered
+ this.$el.tooltip( 'hide' );
- if( !this.model.attributes.visible ){
- //TODO: fancy - but may not work as you expect
- this.$el.fadeOut( this.fadeSpeed );
- }
+ // template in common-templates.html
+ var newElem = $( Handlebars.partials.iconButton( this.model.toJSON() ) );
+ newElem.tooltip( this.model.get( 'tooltip_config' ) );
- if( this.model.attributes.enabled ){
- if( this.$el.hasClass( disabled_class ) ){
- this.$el.removeClass( disabled_class );
- }
- this.$el.addClass( this.model.attributes.icon_class );
- } else {
- this.$el.removeClass( this.model.attributes.icon_class );
- this.$el.addClass( disabled_class );
- }
+ this.$el.replaceWith( newElem );
+ this.setElement( newElem );
- if( this.model.attributes.isMenuButton ){
- this.$el.addClass( 'menu-button' );
- } else {
- this.$el.removeClass( 'menu-button' );
- }
-
- this.$el.data( 'tooltip', false );
- this.$el.attr( 'data-original-title', null );
- this.$el.removeClass( 'tooltip' );
- if( this.model.attributes.title ){
- this.$el.attr( 'title', this.model.attributes.title ).addClass( 'tooltip' );
- this.$el.tooltip( this.model.attributes.tooltip_config );
- }
-
- this.$el.attr( 'id', ( this.model.attributes.id )?( this.model.attributes.id ):( null ) );
- this.$el.attr( 'target', ( this.model.attributes.target )?( this.model.attributes.target ):( null ) );
- this.$el.attr( 'href', ( this.model.attributes.href && !this.model.attributes.on_click )?
- ( this.model.attributes.href ):( this.hrefVoidFn ) );
-
- if( this.model.attributes.visible ){
- this.$el.fadeIn( this.fadeSpeed );
- }
return this;
},
@@ -99,6 +62,7 @@
},
click : function( event ){
+ console.debug( 'click event' );
// if on_click pass to that function
if( this.model.attributes.on_click ){
this.model.attributes.on_click( event );
@@ -108,6 +72,10 @@
return true;
}
});
+//TODO: bc h.templates is gen. loaded AFTER ui, Handlebars.partials.iconButton === undefined
+IconButtonView.templates = {
+ iconButton : Handlebars.partials.iconButton
+};
var IconButtonCollection = Backbone.Collection.extend({
diff -r 802b87d6491087f6e82d8490d0d603b7affc3491 -r 9867a7110f6d03488ca3f96e6a924346c8450cd8 static/scripts/templates/common-templates.html
--- a/static/scripts/templates/common-templates.html
+++ b/static/scripts/templates/common-templates.html
@@ -16,7 +16,7 @@
<script type="text/template" class="template-common" id="template-warningmessagesmall">
{{! renders a warning in a (mostly css) highlighted, iconned warning box }}
- <div class="warningmessagesmall"><strong>{{ warning }}</strong></div>
+ <div class="warningmessagesmall"><strong>{{{ warning }}}</strong></div></script><script type="text/javascript" class="helper-common" id="helper-iconButton">
@@ -29,7 +29,7 @@
var buffer = "";
buffer += ( buttonData.enabled )?( '<a' ):( '<span' );
- if( buttonData.title ){ buttonData.buffer += ' title="' + buttonData.title + '"'; }
+ if( buttonData.title ){ buffer += ' title="' + buttonData.title + '"'; }
buffer += ' class="icon-button';
if( buttonData.isMenuButton ){ buffer += ' menu-button'; }
@@ -44,7 +44,7 @@
if( !buttonData.visible ){ buffer += ' style="display: none;"'; }
- buffer += '>Bler' + ( ( buttonData.enabled )?( '</a>' ):( '</span>' ) );
+ buffer += '>' + ( ( buttonData.enabled )?( '</a>' ):( '</span>' ) );
return buffer;
});
</script>
diff -r 802b87d6491087f6e82d8490d0d603b7affc3491 -r 9867a7110f6d03488ca3f96e6a924346c8450cd8 static/scripts/templates/compiled/helpers-common-templates.js
--- a/static/scripts/templates/compiled/helpers-common-templates.js
+++ b/static/scripts/templates/compiled/helpers-common-templates.js
@@ -12,7 +12,7 @@
var buffer = "";
buffer += ( buttonData.enabled )?( '<a' ):( '<span' );
- if( buttonData.title ){ buttonData.buffer += ' title="' + buttonData.title + '"'; }
+ if( buttonData.title ){ buffer += ' title="' + buttonData.title + '"'; }
buffer += ' class="icon-button';
if( buttonData.isMenuButton ){ buffer += ' menu-button'; }
@@ -27,7 +27,7 @@
if( !buttonData.visible ){ buffer += ' style="display: none;"'; }
- buffer += '>Bler' + ( ( buttonData.enabled )?( '</a>' ):( '</span>' ) );
+ buffer += '>' + ( ( buttonData.enabled )?( '</a>' ):( '</span>' ) );
return buffer;
});
/** Renders a warning in a (mostly css) highlighted, iconned warning box
diff -r 802b87d6491087f6e82d8490d0d603b7affc3491 -r 9867a7110f6d03488ca3f96e6a924346c8450cd8 static/scripts/templates/compiled/template-warningmessagesmall.js
--- a/static/scripts/templates/compiled/template-warningmessagesmall.js
+++ b/static/scripts/templates/compiled/template-warningmessagesmall.js
@@ -2,13 +2,14 @@
var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
templates['template-warningmessagesmall'] = template(function (Handlebars,depth0,helpers,partials,data) {
helpers = helpers || Handlebars.helpers;
- var buffer = "", stack1, foundHelper, functionType="function", escapeExpression=this.escapeExpression;
+ var buffer = "", stack1, foundHelper, functionType="function";
buffer += " \n <div class=\"warningmessagesmall\"><strong>";
foundHelper = helpers.warning;
if (foundHelper) { stack1 = foundHelper.call(depth0, {hash:{}}); }
else { stack1 = depth0.warning; stack1 = typeof stack1 === functionType ? stack1() : stack1; }
- buffer += escapeExpression(stack1) + "</strong></div>";
+ if(stack1 || stack1 === 0) { buffer += stack1; }
+ buffer += "</strong></div>";
return buffer;});
})();
\ No newline at end of file
diff -r 802b87d6491087f6e82d8490d0d603b7affc3491 -r 9867a7110f6d03488ca3f96e6a924346c8450cd8 static/scripts/templates/template-warningmessagesmall.handlebars
--- a/static/scripts/templates/template-warningmessagesmall.handlebars
+++ b/static/scripts/templates/template-warningmessagesmall.handlebars
@@ -1,2 +1,2 @@
{{! renders a warning in a (mostly css) highlighted, iconned warning box }}
- <div class="warningmessagesmall"><strong>{{ warning }}</strong></div>
\ No newline at end of file
+ <div class="warningmessagesmall"><strong>{{{ warning }}}</strong></div>
\ No newline at end of file
diff -r 802b87d6491087f6e82d8490d0d603b7affc3491 -r 9867a7110f6d03488ca3f96e6a924346c8450cd8 templates/root/alternate_history.mako
--- a/templates/root/alternate_history.mako
+++ b/templates/root/alternate_history.mako
@@ -298,6 +298,7 @@
${h.templates(
"helpers-common-templates",
+ "template-warningmessagesmall",
"template-history-warning-messages",
"template-history-titleLink",
@@ -314,34 +315,6 @@
"mvc/history"
##"mvc/tags", "mvc/annotations"
)}
-
- <script type="text/javascript">
- GalaxyLocalization.setLocalizedString( ${ create_localization_json( get_page_localized_strings() ) } );
- // add needed controller urls to GalaxyPaths
- galaxy_paths.set( 'dataset_path', "${h.url_for( controller='dataset' )}" )
-
- // Init. on document load.
- var pageData = ${context_to_js()};
-
- //USE_MOCK_DATA = true;
-
- $(function(){
- if( console && console.debug ){ console.debug( 'using backbone.js in history panel' ); }
- if( window.USE_MOCK_DATA ){
- if( console && console.debug ){ console.debug( '\t using mock data' ); }
- createMockHistoryData();
- return;
- }
-
- glx_history = new History( pageData.history ).loadDatasetsAsHistoryItems( pageData.hdas );
- glx_history_view = new HistoryView({ model: glx_history });
- glx_history_view.render();
-
- hi = glx_history.items.at( 0 );
- hi_view = new HistoryItemView({ model: hi });
- $( 'body' ).append( hi_view.render() );
- });
- </script></%def><%def name="stylesheets()">
@@ -385,5 +358,41 @@
${_('Galaxy History')}
</%def>
+<script type="text/javascript">
+ GalaxyLocalization.setLocalizedString( ${ create_localization_json( get_page_localized_strings() ) } );
+ // add needed controller urls to GalaxyPaths
+ galaxy_paths.set( 'dataset_path', "${h.url_for( controller='dataset' )}" )
+
+ // Init. on document load.
+ var pageData = ${context_to_js()};
+
+ //USE_MOCK_DATA = true;
+ USE_CURR_DATA = true;
+
+ $(function(){
+ if( console && console.debug ){ console.debug( 'using backbone.js in history panel' ); }
+
+ if( window.USE_MOCK_DATA ){
+ if( console && console.debug ){ console.debug( '\t using mock data' ); }
+ createMockHistoryData();
+ return;
+
+ } else if ( USE_CURR_DATA ){
+ if( console && console.debug ){ console.debug( '\t using current history data' ); }
+ glx_history = new History( pageData.history ).loadDatasetsAsHistoryItems( pageData.hdas );
+ glx_history_view = new HistoryView({ model: glx_history });
+ glx_history_view.render();
+
+ hi = glx_history.items.at( 0 );
+ hi_view = new HistoryItemView({ model: hi });
+ $( 'body' ).append( hi_view.render() );
+ return;
+ }
+
+ // sandbox here
+ });
+</script>
+
+
<body class="historyPage"></body>
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: Added history.js templates: icon-button partial, hdaSummary, titleLink; packed scripts
by Bitbucket 13 Sep '12
by Bitbucket 13 Sep '12
13 Sep '12
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/changeset/802b87d64910/
changeset: 802b87d64910
user: carlfeberhard
date: 2012-09-13 17:58:14
summary: Added history.js templates: icon-button partial, hdaSummary, titleLink; packed scripts
affected #: 25 files
diff -r 6aadac8026cb55844a0e8e49360ad30a9f6d0a25 -r 802b87d6491087f6e82d8490d0d603b7affc3491 static/scripts/mvc/history.js
--- a/static/scripts/mvc/history.js
+++ b/static/scripts/mvc/history.js
@@ -124,8 +124,12 @@
},
isEditable : function(){
- // roughly can_edit from history_common.mako
- return ( !( this.get( 'deleted' ) || this.get( 'purged' ) ) );
+ // roughly can_edit from history_common.mako - not deleted or purged = editable
+ return (
+ //this.get( 'for_editing' )
+ //&& !( this.get( 'deleted' ) || this.get( 'purged' ) )
+ !( this.get( 'deleted' ) || this.get( 'purged' ) )
+ );
},
hasData : function(){
@@ -159,10 +163,11 @@
//==============================================================================
var HistoryItemView = BaseView.extend( LoggableMixin ).extend({
+ //??TODO: add alias in initialize this.hda = this.model?
// view for HistoryItem model above
// uncomment this out see log messages
- //logger : console,
+ logger : console,
tagName : "div",
className : "historyItemContainer",
@@ -179,6 +184,7 @@
this.log( this + '.model:', this.model );
var id = this.model.get( 'id' ),
state = this.model.get( 'state' );
+ this.clearReferences();
this.$el.attr( 'id', 'historyItemContainer-' + id );
@@ -191,7 +197,7 @@
this.body = $( this._render_body() );
itemWrapper.append( this.body );
- // set up canned behavior (bootstrap, popupmenus, editable_text, etc.)
+ // set up canned behavior on children (bootstrap, popupmenus, editable_text, etc.)
itemWrapper.find( '.tooltip' ).tooltip({ placement : 'bottom' });
//TODO: broken
@@ -206,6 +212,14 @@
return this.$el.append( itemWrapper );
},
+ clearReferences : function(){
+ //??TODO: best way?
+ this.displayButton = null;
+ this.editButton = null;
+ this.deleteButton = null;
+ this.errButton = null;
+ },
+
// ................................................................................ RENDER WARNINGS
_render_warnings : function(){
// jQ errs on building dom with whitespace - if there are no messages, trim -> ''
@@ -224,16 +238,10 @@
// ................................................................................ DISPLAY, EDIT ATTR, DELETE
_render_titleButtons : function(){
// render the display, edit attr and delete icon-buttons
- var buttonDiv = $( '<div class="historyItemButtons"></div>' ),
- for_editing = this.model.get( 'for_editing' );
-
- // don't show display, edit while uploading
- if( this.model.get( 'state' ) !== HistoryItem.STATES.UPLOAD ){
- buttonDiv.append( this._render_displayButton() );
-
- if( for_editing ){ buttonDiv.append( this._render_editButton() ); }
- }
- if( for_editing ){ buttonDiv.append( this._render_deleteButton() ); }
+ var buttonDiv = $( '<div class="historyItemButtons"></div>' );
+ buttonDiv.append( this._render_displayButton() );
+ buttonDiv.append( this._render_editButton() );
+ buttonDiv.append( this._render_deleteButton() );
return buttonDiv;
},
@@ -241,15 +249,19 @@
//TODO: move other data (non-href) into {} in view definition, cycle over those keys in _titlebuttons
//TODO: move disabled span data into view def, move logic into _titlebuttons
_render_displayButton : function(){
+
+ // don't show display while uploading
+ if( this.model.get( 'state' ) === HistoryItem.STATES.UPLOAD ){ return null; }
+
+ // show a disabled display if the data's been purged
displayBtnData = ( this.model.get( 'purged' ) )?({
- // show a disabled display if the data's been purged
title : 'Cannot display datasets removed from disk',
+ enabled : false,
icon_class : 'display',
- enabled : false,
+
+ // if not, render the display icon-button with href
}):({
- // if not, render the display icon-button with href
title : 'Display data in browser',
- //TODO: need generated url here
href : this.model.get( 'display_url' ),
target : ( this.model.get( 'for_editing' ) )?( 'galaxy_main' ):( null ),
icon_class : 'display',
@@ -259,32 +271,39 @@
},
_render_editButton : function(){
- // render the edit attr icon-button
- var id = this.model.get( 'id' ),
- purged = this.model.get( 'purged' ),
- deleted = this.model.get( 'deleted' );
+
+ // don't show edit while uploading, or if editable
+ if( ( this.model.get( 'state' ) === HistoryItem.STATES.UPLOAD )
+ || ( !this.model.get( 'for_editing' ) ) ){
+ return null;
+ }
+
+ var purged = this.model.get( 'purged' ),
+ deleted = this.model.get( 'deleted' ),
+ editBtnData = {
+ title : 'Edit attributes',
+ href : this.model.get( 'edit_url' ),
+ target : 'galaxy_main',
+ icon_class : 'edit'
+ };
- var editBtnData = {
- title : 'Edit attributes',
- href : this.model.get( 'edit_url' ),
- target : 'galaxy_main',
- icon_class : 'edit'
- }
// disable if purged or deleted and explain why in the tooltip
//TODO: if for_editing
if( deleted || purged ){
- editBtnData = {
- enabled : false,
- icon_class : 'edit'
- };
- editBtnData.title = ( !purged )?( 'Undelete dataset to edit attributes' ):
- ( 'Cannot edit attributes of datasets removed from disk' );
+ editBtnData.enabled = false;
}
+ if( deleted ){
+ editBtnData.title = 'Undelete dataset to edit attributes';
+ } else if( purged ){
+ editBtnData.title = 'Cannot edit attributes of datasets removed from disk';
+ }
+
this.editButton = new IconButtonView({ model : new IconButton( editBtnData ) });
return this.editButton.render().$el;
},
_render_deleteButton : function(){
+ // don't show delete if not editable
if( !this.model.get( 'for_editing' ) ){ return null; }
var deleteBtnData = ( this.model.get( 'delete_url' ) )?({
@@ -303,14 +322,8 @@
},
_render_titleLink : function(){
- // render the title (hda name)
- var h_name = this.model.get( 'name' ),
- hid = this.model.get( 'hid' );
- title = ( hid + ': ' + h_name );
- return $( linkHTMLTemplate({
- href : 'javascript:void(0);',
- text : '<span class="historyItemTitle">' + title + '</span>'
- }));
+ this.log( 'model:', this.model.toJSON() );
+ return $( jQuery.trim( HistoryItemView.templates.titleLink( this.model.toJSON() ) ) );
},
// ................................................................................ RENDER BODY
@@ -344,12 +357,14 @@
// bug report button
//NOTE: these are shown _before_ info, rerun so use _prepend_
if( this.model.get( 'for_editing' ) ){
- actionBtnDiv.prepend( $( linkHTMLTemplate({
+ //TODO??: save to view 'this.errButton'
+ this.errButton = new IconButtonView({ model : new IconButton({
title : 'View or report this error',
- href : this.model.get( 'report_errors_url' ),
+ href : this.model.get( 'report_error_url' ),
target : 'galaxy_main',
- classes : [ 'icon-button', 'tooltip', 'bug' ]
- })));
+ icon_class : 'bug'
+ })});
+ actionBtnDiv.prepend( this.errButton.render().$el );
}
if( this.model.hasData() ){
//TODO: render_download_links( data, dataset_id )
@@ -568,37 +583,35 @@
},
_render_hdaSummary : function(){
- // default span rendering
- var dbkeyHTML = _.template( '<span class="<%= dbkey %>"><%= dbkey %></span>',
- { dbkey: this.model.get( 'metadata_dbkey' ) } );
- // if there's no dbkey and it's editable : render a link to editing in the '?'
- if( this.model.get( 'metadata_dbkey' ) === '?' && this.model.isEditable() ){
- dbkeyHTML = linkHTMLTemplate({
- text : this.model.get( 'metadata_dbkey' ),
- href : this.model.get( 'edit_url' ),
- target : 'galaxy_main'
- });
+ var modelData = this.model.toJSON();
+
+ // if there's no dbkey and it's editable : pass a flag to the template to render a link to editing in the '?'
+ if( this.model.get( 'metadata_dbkey' ) === '?'
+ && this.model.isEditable() ){
+ _.extend( modelData, { dbkey_unknown_and_editable : true });
}
- return ( HistoryItemView.TEMPLATES.hdaSummary(
- _.extend({ dbkeyHTML: dbkeyHTML }, this.model.attributes ) ) );
+ return HistoryItemView.templates.hdaSummary( modelData );
},
_render_showParamsAndRerun : function(){
//TODO??: generalize to _render_actionButtons, pass in list of 'buttons' to render, default to these two
var actionBtnDiv = $( '<div/>' );
- actionBtnDiv.append( $( linkHTMLTemplate({
+
+ this.showParamsButton = new IconButtonView({ model : new IconButton({
title : 'View details',
href : this.model.get( 'show_params_url' ),
target : 'galaxy_main',
- classes : [ 'icon-button', 'tooltip', 'information' ]
- })));
+ icon_class : 'information'
+ }) });
+ actionBtnDiv.append( this.showParamsButton.render().$el );
+
if( this.model.get( 'for_editing' ) ){
- actionBtnDiv.append( $( linkHTMLTemplate({
+ this.rerunButton = new IconButtonView({ model : new IconButton({
title : 'Run this job again',
href : this.model.get( 'rerun_url' ),
target : 'galaxy_main',
- classes : [ 'icon-button', 'tooltip', 'arrow-circle' ]
- })));
+ icon_class : 'arrow-circle'
+ }) });
}
return actionBtnDiv;
},
@@ -748,24 +761,14 @@
return 'HistoryItemView(' + modelString + ')';
}
});
-HistoryItemView.TEMPLATES = {};
-
-//TODO: contains localized strings
-HistoryItemView.TEMPLATES.hdaSummary = _.template([
- '<%= misc_blurb %><br />',
- 'format: <span class="<%= data_type %>"><%= data_type %></span>, ',
- 'database: <%= dbkeyHTML %>'
-].join( '' ));
//==============================================================================
//HistoryItemView.templates = InDomTemplateLoader.getTemplates({
HistoryItemView.templates = CompiledTemplateLoader.getTemplates({
- 'common-templates.html' : {
- warningMsg : 'template-warningmessagesmall',
- },
'history-templates.html' : {
- messages : 'template-history-warning-messages2',
+ messages : 'template-history-warning-messages',
+ titleLink : 'template-history-titleLink',
hdaSummary : 'template-history-hdaSummary'
}
});
@@ -1039,7 +1042,8 @@
{ state : HistoryItem.STATES.EMPTY }),
error :
_.extend( _.clone( mockHistory.data.template ),
- { state : HistoryItem.STATES.ERROR }),
+ { state : HistoryItem.STATES.ERROR,
+ report_error_url: 'example.com/report_err' }),
discarded :
_.extend( _.clone( mockHistory.data.template ),
{ state : HistoryItem.STATES.DISCARDED }),
diff -r 6aadac8026cb55844a0e8e49360ad30a9f6d0a25 -r 802b87d6491087f6e82d8490d0d603b7affc3491 static/scripts/packed/libs/handlebars.full.js
--- /dev/null
+++ b/static/scripts/packed/libs/handlebars.full.js
@@ -0,0 +1,1 @@
+var Handlebars={};Handlebars.VERSION="1.0.beta.6";Handlebars.helpers={};Handlebars.partials={};Handlebars.registerHelper=function(b,c,a){if(a){c.not=a}this.helpers[b]=c};Handlebars.registerPartial=function(a,b){this.partials[a]=b};Handlebars.registerHelper("helperMissing",function(a){if(arguments.length===2){return undefined}else{throw new Error("Could not find property '"+a+"'")}});var toString=Object.prototype.toString,functionType="[object Function]";Handlebars.registerHelper("blockHelperMissing",function(f,d){var a=d.inverse||function(){},h=d.fn;var c="";var g=toString.call(f);if(g===functionType){f=f.call(this)}if(f===true){return h(this)}else{if(f===false||f==null){return a(this)}else{if(g==="[object Array]"){if(f.length>0){for(var e=0,b=f.length;e<b;e++){c=c+h(f[e])}}else{c=a(this)}return c}else{return h(f)}}}});Handlebars.registerHelper("each",function(f,d){var g=d.fn,a=d.inverse;var c="";if(f&&f.length>0){for(var e=0,b=f.length;e<b;e++){c=c+g(f[e])}}else{c=a(this)}return c});Handlebars.registerHelper("if",function(b,a){var c=toString.call(b);if(c===functionType){b=b.call(this)}if(!b||Handlebars.Utils.isEmpty(b)){return a.inverse(this)}else{return a.fn(this)}});Handlebars.registerHelper("unless",function(c,b){var d=b.fn,a=b.inverse;b.fn=a;b.inverse=d;return Handlebars.helpers["if"].call(this,c,b)});Handlebars.registerHelper("with",function(b,a){return a.fn(b)});Handlebars.registerHelper("log",function(a){Handlebars.log(a)});var handlebars=(function(){var f={trace:function c(){},yy:{},symbols_:{error:2,root:3,program:4,EOF:5,statements:6,simpleInverse:7,statement:8,openInverse:9,closeBlock:10,openBlock:11,mustache:12,partial:13,CONTENT:14,COMMENT:15,OPEN_BLOCK:16,inMustache:17,CLOSE:18,OPEN_INVERSE:19,OPEN_ENDBLOCK:20,path:21,OPEN:22,OPEN_UNESCAPED:23,OPEN_PARTIAL:24,params:25,hash:26,param:27,STRING:28,INTEGER:29,BOOLEAN:30,hashSegments:31,hashSegment:32,ID:33,EQUALS:34,pathSegments:35,SEP:36,"$accept":0,"$end":1},terminals_:{2:"error",5:"EOF",14:"CONTENT",15:"COMMENT",16:"OPEN_BLOCK",18:"CLOSE",19:"OPEN_INVERSE",20:"OPEN_ENDBLOCK",22:"OPEN",23:"OPEN_UNESCAPED",24:"OPEN_PARTIAL",28:"STRING",29:"INTEGER",30:"BOOLEAN",33:"ID",34:"EQUALS",36:"SEP"},productions_:[0,[3,2],[4,3],[4,1],[4,0],[6,1],[6,2],[8,3],[8,3],[8,1],[8,1],[8,1],[8,1],[11,3],[9,3],[10,3],[12,3],[12,3],[13,3],[13,4],[7,2],[17,3],[17,2],[17,2],[17,1],[25,2],[25,1],[27,1],[27,1],[27,1],[27,1],[26,1],[31,2],[31,1],[32,3],[32,3],[32,3],[32,3],[21,1],[35,3],[35,1]],performAction:function b(g,j,k,n,m,i,l){var h=i.length-1;switch(m){case 1:return i[h-1];break;case 2:this.$=new n.ProgramNode(i[h-2],i[h]);break;case 3:this.$=new n.ProgramNode(i[h]);break;case 4:this.$=new n.ProgramNode([]);break;case 5:this.$=[i[h]];break;case 6:i[h-1].push(i[h]);this.$=i[h-1];break;case 7:this.$=new n.InverseNode(i[h-2],i[h-1],i[h]);break;case 8:this.$=new n.BlockNode(i[h-2],i[h-1],i[h]);break;case 9:this.$=i[h];break;case 10:this.$=i[h];break;case 11:this.$=new n.ContentNode(i[h]);break;case 12:this.$=new n.CommentNode(i[h]);break;case 13:this.$=new n.MustacheNode(i[h-1][0],i[h-1][1]);break;case 14:this.$=new n.MustacheNode(i[h-1][0],i[h-1][1]);break;case 15:this.$=i[h-1];break;case 16:this.$=new n.MustacheNode(i[h-1][0],i[h-1][1]);break;case 17:this.$=new n.MustacheNode(i[h-1][0],i[h-1][1],true);break;case 18:this.$=new n.PartialNode(i[h-1]);break;case 19:this.$=new n.PartialNode(i[h-2],i[h-1]);break;case 20:break;case 21:this.$=[[i[h-2]].concat(i[h-1]),i[h]];break;case 22:this.$=[[i[h-1]].concat(i[h]),null];break;case 23:this.$=[[i[h-1]],i[h]];break;case 24:this.$=[[i[h]],null];break;case 25:i[h-1].push(i[h]);this.$=i[h-1];break;case 26:this.$=[i[h]];break;case 27:this.$=i[h];break;case 28:this.$=new n.StringNode(i[h]);break;case 29:this.$=new n.IntegerNode(i[h]);break;case 30:this.$=new n.BooleanNode(i[h]);break;case 31:this.$=new n.HashNode(i[h]);break;case 32:i[h-1].push(i[h]);this.$=i[h-1];break;case 33:this.$=[i[h]];break;case 34:this.$=[i[h-2],i[h]];break;case 35:this.$=[i[h-2],new n.StringNode(i[h])];break;case 36:this.$=[i[h-2],new n.IntegerNode(i[h])];break;case 37:this.$=[i[h-2],new n.BooleanNode(i[h])];break;case 38:this.$=new n.IdNode(i[h]);break;case 39:i[h-2].push(i[h]);this.$=i[h-2];break;case 40:this.$=[i[h]];break}},table:[{3:1,4:2,5:[2,4],6:3,8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],22:[1,13],23:[1,14],24:[1,15]},{1:[3]},{5:[1,16]},{5:[2,3],7:17,8:18,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,19],20:[2,3],22:[1,13],23:[1,14],24:[1,15]},{5:[2,5],14:[2,5],15:[2,5],16:[2,5],19:[2,5],20:[2,5],22:[2,5],23:[2,5],24:[2,5]},{4:20,6:3,8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],20:[2,4],22:[1,13],23:[1,14],24:[1,15]},{4:21,6:3,8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],20:[2,4],22:[1,13],23:[1,14],24:[1,15]},{5:[2,9],14:[2,9],15:[2,9],16:[2,9],19:[2,9],20:[2,9],22:[2,9],23:[2,9],24:[2,9]},{5:[2,10],14:[2,10],15:[2,10],16:[2,10],19:[2,10],20:[2,10],22:[2,10],23:[2,10],24:[2,10]},{5:[2,11],14:[2,11],15:[2,11],16:[2,11],19:[2,11],20:[2,11],22:[2,11],23:[2,11],24:[2,11]},{5:[2,12],14:[2,12],15:[2,12],16:[2,12],19:[2,12],20:[2,12],22:[2,12],23:[2,12],24:[2,12]},{17:22,21:23,33:[1,25],35:24},{17:26,21:23,33:[1,25],35:24},{17:27,21:23,33:[1,25],35:24},{17:28,21:23,33:[1,25],35:24},{21:29,33:[1,25],35:24},{1:[2,1]},{6:30,8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],22:[1,13],23:[1,14],24:[1,15]},{5:[2,6],14:[2,6],15:[2,6],16:[2,6],19:[2,6],20:[2,6],22:[2,6],23:[2,6],24:[2,6]},{17:22,18:[1,31],21:23,33:[1,25],35:24},{10:32,20:[1,33]},{10:34,20:[1,33]},{18:[1,35]},{18:[2,24],21:40,25:36,26:37,27:38,28:[1,41],29:[1,42],30:[1,43],31:39,32:44,33:[1,45],35:24},{18:[2,38],28:[2,38],29:[2,38],30:[2,38],33:[2,38],36:[1,46]},{18:[2,40],28:[2,40],29:[2,40],30:[2,40],33:[2,40],36:[2,40]},{18:[1,47]},{18:[1,48]},{18:[1,49]},{18:[1,50],21:51,33:[1,25],35:24},{5:[2,2],8:18,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],20:[2,2],22:[1,13],23:[1,14],24:[1,15]},{14:[2,20],15:[2,20],16:[2,20],19:[2,20],22:[2,20],23:[2,20],24:[2,20]},{5:[2,7],14:[2,7],15:[2,7],16:[2,7],19:[2,7],20:[2,7],22:[2,7],23:[2,7],24:[2,7]},{21:52,33:[1,25],35:24},{5:[2,8],14:[2,8],15:[2,8],16:[2,8],19:[2,8],20:[2,8],22:[2,8],23:[2,8],24:[2,8]},{14:[2,14],15:[2,14],16:[2,14],19:[2,14],20:[2,14],22:[2,14],23:[2,14],24:[2,14]},{18:[2,22],21:40,26:53,27:54,28:[1,41],29:[1,42],30:[1,43],31:39,32:44,33:[1,45],35:24},{18:[2,23]},{18:[2,26],28:[2,26],29:[2,26],30:[2,26],33:[2,26]},{18:[2,31],32:55,33:[1,56]},{18:[2,27],28:[2,27],29:[2,27],30:[2,27],33:[2,27]},{18:[2,28],28:[2,28],29:[2,28],30:[2,28],33:[2,28]},{18:[2,29],28:[2,29],29:[2,29],30:[2,29],33:[2,29]},{18:[2,30],28:[2,30],29:[2,30],30:[2,30],33:[2,30]},{18:[2,33],33:[2,33]},{18:[2,40],28:[2,40],29:[2,40],30:[2,40],33:[2,40],34:[1,57],36:[2,40]},{33:[1,58]},{14:[2,13],15:[2,13],16:[2,13],19:[2,13],20:[2,13],22:[2,13],23:[2,13],24:[2,13]},{5:[2,16],14:[2,16],15:[2,16],16:[2,16],19:[2,16],20:[2,16],22:[2,16],23:[2,16],24:[2,16]},{5:[2,17],14:[2,17],15:[2,17],16:[2,17],19:[2,17],20:[2,17],22:[2,17],23:[2,17],24:[2,17]},{5:[2,18],14:[2,18],15:[2,18],16:[2,18],19:[2,18],20:[2,18],22:[2,18],23:[2,18],24:[2,18]},{18:[1,59]},{18:[1,60]},{18:[2,21]},{18:[2,25],28:[2,25],29:[2,25],30:[2,25],33:[2,25]},{18:[2,32],33:[2,32]},{34:[1,57]},{21:61,28:[1,62],29:[1,63],30:[1,64],33:[1,25],35:24},{18:[2,39],28:[2,39],29:[2,39],30:[2,39],33:[2,39],36:[2,39]},{5:[2,19],14:[2,19],15:[2,19],16:[2,19],19:[2,19],20:[2,19],22:[2,19],23:[2,19],24:[2,19]},{5:[2,15],14:[2,15],15:[2,15],16:[2,15],19:[2,15],20:[2,15],22:[2,15],23:[2,15],24:[2,15]},{18:[2,34],33:[2,34]},{18:[2,35],33:[2,35]},{18:[2,36],33:[2,36]},{18:[2,37],33:[2,37]}],defaultActions:{16:[2,1],37:[2,23],53:[2,21]},parseError:function d(h,g){throw new Error(h)},parse:function e(o){var x=this,l=[0],G=[null],s=[],H=this.table,h="",q=0,E=0,j=0,n=2,u=1;this.lexer.setInput(o);this.lexer.yy=this.yy;this.yy.lexer=this.lexer;if(typeof this.lexer.yylloc=="undefined"){this.lexer.yylloc={}}var i=this.lexer.yylloc;s.push(i);if(typeof this.yy.parseError==="function"){this.parseError=this.yy.parseError}function w(p){l.length=l.length-2*p;G.length=G.length-p;s.length=s.length-p}function v(){var p;p=x.lexer.lex()||1;if(typeof p!=="number"){p=x.symbols_[p]||p}return p}var D,z,k,C,I,t,B={},y,F,g,m;while(true){k=l[l.length-1];if(this.defaultActions[k]){C=this.defaultActions[k]}else{if(D==null){D=v()}C=H[k]&&H[k][D]}if(typeof C==="undefined"||!C.length||!C[0]){if(!j){m=[];for(y in H[k]){if(this.terminals_[y]&&y>2){m.push("'"+this.terminals_[y]+"'")}}var A="";if(this.lexer.showPosition){A="Parse error on line "+(q+1)+":\n"+this.lexer.showPosition()+"\nExpecting "+m.join(", ")+", got '"+this.terminals_[D]+"'"}else{A="Parse error on line "+(q+1)+": Unexpected "+(D==1?"end of input":"'"+(this.terminals_[D]||D)+"'")}this.parseError(A,{text:this.lexer.match,token:this.terminals_[D]||D,line:this.lexer.yylineno,loc:i,expected:m})}}if(C[0] instanceof Array&&C.length>1){throw new Error("Parse Error: multiple actions possible at state: "+k+", token: "+D)}switch(C[0]){case 1:l.push(D);G.push(this.lexer.yytext);s.push(this.lexer.yylloc);l.push(C[1]);D=null;if(!z){E=this.lexer.yyleng;h=this.lexer.yytext;q=this.lexer.yylineno;i=this.lexer.yylloc;if(j>0){j--}}else{D=z;z=null}break;case 2:F=this.productions_[C[1]][1];B.$=G[G.length-F];B._$={first_line:s[s.length-(F||1)].first_line,last_line:s[s.length-1].last_line,first_column:s[s.length-(F||1)].first_column,last_column:s[s.length-1].last_column};t=this.performAction.call(B,h,E,q,this.yy,C[1],G,s);if(typeof t!=="undefined"){return t}if(F){l=l.slice(0,-1*F*2);G=G.slice(0,-1*F);s=s.slice(0,-1*F)}l.push(this.productions_[C[1]][0]);G.push(B.$);s.push(B._$);g=H[l[l.length-2]][l[l.length-1]];l.push(g);break;case 3:return true}}return true}};var a=(function(){var j=({EOF:1,parseError:function l(o,n){if(this.yy.parseError){this.yy.parseError(o,n)}else{throw new Error(o)}},setInput:function(n){this._input=n;this._more=this._less=this.done=false;this.yylineno=this.yyleng=0;this.yytext=this.matched=this.match="";this.conditionStack=["INITIAL"];this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0};return this},input:function(){var o=this._input[0];this.yytext+=o;this.yyleng++;this.match+=o;this.matched+=o;var n=o.match(/\n/);if(n){this.yylineno++}this._input=this._input.slice(1);return o},unput:function(n){this._input=n+this._input;return this},more:function(){this._more=true;return this},pastInput:function(){var n=this.matched.substr(0,this.matched.length-this.match.length);return(n.length>20?"...":"")+n.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var n=this.match;if(n.length<20){n+=this._input.substr(0,20-n.length)}return(n.substr(0,20)+(n.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var n=this.pastInput();var o=new Array(n.length+1).join("-");return n+this.upcomingInput()+"\n"+o+"^"},next:function(){if(this.done){return this.EOF}if(!this._input){this.done=true}var r,p,o,n;if(!this._more){this.yytext="";this.match=""}var s=this._currentRules();for(var q=0;q<s.length;q++){p=this._input.match(this.rules[s[q]]);if(p){n=p[0].match(/\n.*/g);if(n){this.yylineno+=n.length}this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:n?n[n.length-1].length-1:this.yylloc.last_column+p[0].length};this.yytext+=p[0];this.match+=p[0];this.matches=p;this.yyleng=this.yytext.length;this._more=false;this._input=this._input.slice(p[0].length);this.matched+=p[0];r=this.performAction.call(this,this.yy,this,s[q],this.conditionStack[this.conditionStack.length-1]);if(r){return r}else{return}}}if(this._input===""){return this.EOF}else{this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})}},lex:function g(){var n=this.next();if(typeof n!=="undefined"){return n}else{return this.lex()}},begin:function h(n){this.conditionStack.push(n)},popState:function m(){return this.conditionStack.pop()},_currentRules:function k(){return this.conditions[this.conditionStack[this.conditionStack.length-1]].rules},topState:function(){return this.conditionStack[this.conditionStack.length-2]},pushState:function h(n){this.begin(n)}});j.performAction=function i(r,o,q,n){var p=n;switch(q){case 0:if(o.yytext.slice(-1)!=="\\"){this.begin("mu")}if(o.yytext.slice(-1)==="\\"){o.yytext=o.yytext.substr(0,o.yyleng-1),this.begin("emu")}if(o.yytext){return 14}break;case 1:return 14;break;case 2:this.popState();return 14;break;case 3:return 24;break;case 4:return 16;break;case 5:return 20;break;case 6:return 19;break;case 7:return 19;break;case 8:return 23;break;case 9:return 23;break;case 10:o.yytext=o.yytext.substr(3,o.yyleng-5);this.popState();return 15;break;case 11:return 22;break;case 12:return 34;break;case 13:return 33;break;case 14:return 33;break;case 15:return 36;break;case 16:break;case 17:this.popState();return 18;break;case 18:this.popState();return 18;break;case 19:o.yytext=o.yytext.substr(1,o.yyleng-2).replace(/\\"/g,'"');return 28;break;case 20:return 30;break;case 21:return 30;break;case 22:return 29;break;case 23:return 33;break;case 24:o.yytext=o.yytext.substr(1,o.yyleng-2);return 33;break;case 25:return"INVALID";break;case 26:return 5;break}};j.rules=[/^[^\x00]*?(?=(\{\{))/,/^[^\x00]+/,/^[^\x00]{2,}?(?=(\{\{))/,/^\{\{>/,/^\{\{#/,/^\{\{\//,/^\{\{\^/,/^\{\{\s*else\b/,/^\{\{\{/,/^\{\{&/,/^\{\{![\s\S]*?\}\}/,/^\{\{/,/^=/,/^\.(?=[} ])/,/^\.\./,/^[\/.]/,/^\s+/,/^\}\}\}/,/^\}\}/,/^"(\\["]|[^"])*"/,/^true(?=[}\s])/,/^false(?=[}\s])/,/^[0-9]+(?=[}\s])/,/^[a-zA-Z0-9_$-]+(?=[=}\s\/.])/,/^\[[^\]]*\]/,/^./,/^$/];j.conditions={mu:{rules:[3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26],inclusive:false},emu:{rules:[2],inclusive:false},INITIAL:{rules:[0,1,26],inclusive:true}};return j})();f.lexer=a;return f})();if(typeof require!=="undefined"&&typeof exports!=="undefined"){exports.parser=handlebars;exports.parse=function(){return handlebars.parse.apply(handlebars,arguments)};exports.main=function commonjsMain(a){if(!a[1]){throw new Error("Usage: "+a[0]+" FILE")}if(typeof process!=="undefined"){var c=require("fs").readFileSync(require("path").join(process.cwd(),a[1]),"utf8")}else{var b=require("file").path(require("file").cwd());var c=b.join(a[1]).read({charset:"utf-8"})}return exports.parser.parse(c)};if(typeof module!=="undefined"&&require.main===module){exports.main(typeof process!=="undefined"?process.argv.slice(1):require("system").args)}}Handlebars.Parser=handlebars;Handlebars.parse=function(a){Handlebars.Parser.yy=Handlebars.AST;return Handlebars.Parser.parse(a)};Handlebars.print=function(a){return new Handlebars.PrintVisitor().accept(a)};Handlebars.logger={DEBUG:0,INFO:1,WARN:2,ERROR:3,level:3,log:function(b,a){}};Handlebars.log=function(b,a){Handlebars.logger.log(b,a)};(function(){Handlebars.AST={};Handlebars.AST.ProgramNode=function(c,b){this.type="program";this.statements=c;if(b){this.inverse=new Handlebars.AST.ProgramNode(b)}};Handlebars.AST.MustacheNode=function(d,c,b){this.type="mustache";this.id=d[0];this.params=d.slice(1);this.hash=c;this.escaped=!b};Handlebars.AST.PartialNode=function(c,b){this.type="partial";this.id=c;this.context=b};var a=function(b,c){if(b.original!==c.original){throw new Handlebars.Exception(b.original+" doesn't match "+c.original)}};Handlebars.AST.BlockNode=function(c,b,d){a(c.id,d);this.type="block";this.mustache=c;this.program=b};Handlebars.AST.InverseNode=function(c,b,d){a(c.id,d);this.type="inverse";this.mustache=c;this.program=b};Handlebars.AST.ContentNode=function(b){this.type="content";this.string=b};Handlebars.AST.HashNode=function(b){this.type="hash";this.pairs=b};Handlebars.AST.IdNode=function(f){this.type="ID";this.original=f.join(".");var d=[],g=0;for(var e=0,b=f.length;e<b;e++){var c=f[e];if(c===".."){g++}else{if(c==="."||c==="this"){this.isScoped=true}else{d.push(c)}}}this.parts=d;this.string=d.join(".");this.depth=g;this.isSimple=(d.length===1)&&(g===0)};Handlebars.AST.StringNode=function(b){this.type="STRING";this.string=b};Handlebars.AST.IntegerNode=function(b){this.type="INTEGER";this.integer=b};Handlebars.AST.BooleanNode=function(b){this.type="BOOLEAN";this.bool=b};Handlebars.AST.CommentNode=function(b){this.type="comment";this.comment=b}})();Handlebars.Exception=function(b){var a=Error.prototype.constructor.apply(this,arguments);for(var c in a){if(a.hasOwnProperty(c)){this[c]=a[c]}}this.message=a.message};Handlebars.Exception.prototype=new Error;Handlebars.SafeString=function(a){this.string=a};Handlebars.SafeString.prototype.toString=function(){return this.string.toString()};(function(){var c={"<":"<",">":">",'"':""","'":"'","`":"`"};var d=/&(?!\w+;)|[<>"'`]/g;var b=/[&<>"'`]/;var a=function(e){return c[e]||"&"};Handlebars.Utils={escapeExpression:function(e){if(e instanceof Handlebars.SafeString){return e.toString()}else{if(e==null||e===false){return""}}if(!b.test(e)){return e}return e.replace(d,a)},isEmpty:function(e){if(typeof e==="undefined"){return true}else{if(e===null){return true}else{if(e===false){return true}else{if(Object.prototype.toString.call(e)==="[object Array]"&&e.length===0){return true}else{return false}}}}}}})();Handlebars.Compiler=function(){};Handlebars.JavaScriptCompiler=function(){};(function(f,e){f.OPCODE_MAP={appendContent:1,getContext:2,lookupWithHelpers:3,lookup:4,append:5,invokeMustache:6,appendEscaped:7,pushString:8,truthyOrFallback:9,functionOrFallback:10,invokeProgram:11,invokePartial:12,push:13,assignToHash:15,pushStringParam:16};f.MULTI_PARAM_OPCODES={appendContent:1,getContext:1,lookupWithHelpers:2,lookup:1,invokeMustache:3,pushString:1,truthyOrFallback:1,functionOrFallback:1,invokeProgram:3,invokePartial:1,push:1,assignToHash:1,pushStringParam:1};f.DISASSEMBLE_MAP={};for(var h in f.OPCODE_MAP){var g=f.OPCODE_MAP[h];f.DISASSEMBLE_MAP[g]=h}f.multiParamSize=function(i){return f.MULTI_PARAM_OPCODES[f.DISASSEMBLE_MAP[i]]};f.prototype={compiler:f,disassemble:function(){var t=this.opcodes,r,n;var q=[],v,m,w;for(var s=0,o=t.length;s<o;s++){r=t[s];if(r==="DECLARE"){m=t[++s];w=t[++s];q.push("DECLARE "+m+" = "+w)}else{v=f.DISASSEMBLE_MAP[r];var u=f.multiParamSize(r);var k=[];for(var p=0;p<u;p++){n=t[++s];if(typeof n==="string"){n='"'+n.replace("\n","\\n")+'"'}k.push(n)}v=v+" "+k.join(" ");q.push(v)}}return q.join("\n")},guid:0,compile:function(i,k){this.children=[];this.depths={list:[]};this.options=k;var l=this.options.knownHelpers;this.options.knownHelpers={helperMissing:true,blockHelperMissing:true,each:true,"if":true,unless:true,"with":true,log:true};if(l){for(var j in l){this.options.knownHelpers[j]=l[j]}}return this.program(i)},accept:function(i){return this[i.type](i)},program:function(m){var k=m.statements,o;this.opcodes=[];for(var n=0,j=k.length;n<j;n++){o=k[n];this[o.type](o)}this.isSimple=j===1;this.depths.list=this.depths.list.sort(function(l,i){return l-i});return this},compileProgram:function(m){var j=new this.compiler().compile(m,this.options);var n=this.guid++;this.usePartial=this.usePartial||j.usePartial;this.children[n]=j;for(var o=0,k=j.depths.list.length;o<k;o++){depth=j.depths.list[o];if(depth<2){continue}else{this.addDepth(depth-1)}}return n},block:function(o){var l=o.mustache;var n,p,j,k;var m=this.setupStackForMustache(l);var i=this.compileProgram(o.program);if(o.program.inverse){k=this.compileProgram(o.program.inverse);this.declare("inverse",k)}this.opcode("invokeProgram",i,m.length,!!l.hash);this.declare("inverse",null);this.opcode("append")},inverse:function(k){var j=this.setupStackForMustache(k.mustache);var i=this.compileProgram(k.program);this.declare("inverse",i);this.opcode("invokeProgram",null,j.length,!!k.mustache.hash);this.declare("inverse",null);this.opcode("append")},hash:function(n){var m=n.pairs,p,o;this.opcode("push","{}");for(var k=0,j=m.length;k<j;k++){p=m[k];o=p[1];this.accept(o);this.opcode("assignToHash",p[0])}},partial:function(i){var j=i.id;this.usePartial=true;if(i.context){this.ID(i.context)}else{this.opcode("push","depth0")}this.opcode("invokePartial",j.original);this.opcode("append")},content:function(i){this.opcode("appendContent",i.string)},mustache:function(i){var j=this.setupStackForMustache(i);this.opcode("invokeMustache",j.length,i.id.original,!!i.hash);if(i.escaped&&!this.options.noEscape){this.opcode("appendEscaped")}else{this.opcode("append")}},ID:function(m){this.addDepth(m.depth);this.opcode("getContext",m.depth);this.opcode("lookupWithHelpers",m.parts[0]||null,m.isScoped||false);for(var k=1,j=m.parts.length;k<j;k++){this.opcode("lookup",m.parts[k])}},STRING:function(i){this.opcode("pushString",i.string)},INTEGER:function(i){this.opcode("push",i.integer)},BOOLEAN:function(i){this.opcode("push",i.bool)},comment:function(){},pushParams:function(l){var j=l.length,k;while(j--){k=l[j];if(this.options.stringParams){if(k.depth){this.addDepth(k.depth)}this.opcode("getContext",k.depth||0);this.opcode("pushStringParam",k.string)}else{this[k.type](k)}}},opcode:function(i,l,k,j){this.opcodes.push(f.OPCODE_MAP[i]);if(l!==undefined){this.opcodes.push(l)}if(k!==undefined){this.opcodes.push(k)}if(j!==undefined){this.opcodes.push(j)}},declare:function(i,j){this.opcodes.push("DECLARE");this.opcodes.push(i);this.opcodes.push(j)},addDepth:function(i){if(i===0){return}if(!this.depths[i]){this.depths[i]=true;this.depths.list.push(i)}},setupStackForMustache:function(i){var j=i.params;this.pushParams(j);if(i.hash){this.hash(i.hash)}this.ID(i.id);return j}};e.prototype={nameLookup:function(k,i,j){if(/^[0-9]+$/.test(i)){return k+"["+i+"]"}else{if(e.isValidJavaScriptVariableName(i)){return k+"."+i}else{return k+"['"+i+"']"}}},appendToBuffer:function(i){if(this.environment.isSimple){return"return "+i+";"}else{return"buffer += "+i+";"}},initializeBuffer:function(){return this.quotedString("")},namespace:"Handlebars",compile:function(i,j,l,k){this.environment=i;this.options=j||{};this.name=this.environment.name;this.isChild=!!l;this.context=l||{programs:[],aliases:{self:"this"},registers:{list:[]}};this.preamble();this.stackSlot=0;this.stackVars=[];this.compileChildren(i,j);var n=i.opcodes,m;this.i=0;for(b=n.length;this.i<b;this.i++){m=this.nextOpcode(0);if(m[0]==="DECLARE"){this.i=this.i+2;this[m[1]]=m[2]}else{this.i=this.i+m[1].length;this[m[0]].apply(this,m[1])}}return this.createFunctionContext(k)},nextOpcode:function(r){var o=this.environment.opcodes,m=o[this.i+r],l,p;var q,i;if(m==="DECLARE"){l=o[this.i+1];p=o[this.i+2];return["DECLARE",l,p]}else{l=f.DISASSEMBLE_MAP[m];q=f.multiParamSize(m);i=[];for(var k=0;k<q;k++){i.push(o[this.i+k+1+r])}return[l,i]}},eat:function(i){this.i=this.i+i.length},preamble:function(){var i=[];this.useRegister("foundHelper");if(!this.isChild){var j=this.namespace;var k="helpers = helpers || "+j+".helpers;";if(this.environment.usePartial){k=k+" partials = partials || "+j+".partials;"}i.push(k)}else{i.push("")}if(!this.environment.isSimple){i.push(", buffer = "+this.initializeBuffer())}else{i.push("")}this.lastContext=0;this.source=i},createFunctionContext:function(p){var q=this.stackVars;if(!this.isChild){q=q.concat(this.context.registers.list)}if(q.length>0){this.source[1]=this.source[1]+", "+q.join(", ")}if(!this.isChild){var k=[];for(var o in this.context.aliases){this.source[1]=this.source[1]+", "+o+"="+this.context.aliases[o]}}if(this.source[1]){this.source[1]="var "+this.source[1].substring(2)+";"}if(!this.isChild){this.source[1]+="\n"+this.context.programs.join("\n")+"\n"}if(!this.environment.isSimple){this.source.push("return buffer;")}var r=this.isChild?["depth0","data"]:["Handlebars","depth0","helpers","partials","data"];for(var n=0,j=this.environment.depths.list.length;n<j;n++){r.push("depth"+this.environment.depths.list[n])}if(p){r.push(this.source.join("\n "));return Function.apply(this,r)}else{var m="function "+(this.name||"")+"("+r.join(",")+") {\n "+this.source.join("\n ")+"}";Handlebars.log(Handlebars.logger.DEBUG,m+"\n\n");return m}},appendContent:function(i){this.source.push(this.appendToBuffer(this.quotedString(i)))},append:function(){var i=this.popStack();this.source.push("if("+i+" || "+i+" === 0) { "+this.appendToBuffer(i)+" }");if(this.environment.isSimple){this.source.push("else { "+this.appendToBuffer("''")+" }")}},appendEscaped:function(){var j=this.nextOpcode(1),i="";this.context.aliases.escapeExpression="this.escapeExpression";if(j[0]==="appendContent"){i=" + "+this.quotedString(j[1][0]);this.eat(j)}this.source.push(this.appendToBuffer("escapeExpression("+this.popStack()+")"+i))},getContext:function(i){if(this.lastContext!==i){this.lastContext=i}},lookupWithHelpers:function(k,l){if(k){var i=this.nextStack();this.usingKnownHelper=false;var j;if(!l&&this.options.knownHelpers[k]){j=i+" = "+this.nameLookup("helpers",k,"helper");this.usingKnownHelper=true}else{if(l||this.options.knownHelpersOnly){j=i+" = "+this.nameLookup("depth"+this.lastContext,k,"context")}else{this.register("foundHelper",this.nameLookup("helpers",k,"helper"));j=i+" = foundHelper || "+this.nameLookup("depth"+this.lastContext,k,"context")}}j+=";";this.source.push(j)}else{this.pushStack("depth"+this.lastContext)}},lookup:function(j){var i=this.topStack();this.source.push(i+" = ("+i+" === null || "+i+" === undefined || "+i+" === false ? "+i+" : "+this.nameLookup(i,j,"context")+");")},pushStringParam:function(i){this.pushStack("depth"+this.lastContext);this.pushString(i)},pushString:function(i){this.pushStack(this.quotedString(i))},push:function(i){this.pushStack(i)},invokeMustache:function(k,j,i){this.populateParams(k,this.quotedString(j),"{}",null,i,function(l,n,m){if(!this.usingKnownHelper){this.context.aliases.helperMissing="helpers.helperMissing";this.context.aliases.undef="void 0";this.source.push("else if("+m+"=== undef) { "+l+" = helperMissing.call("+n+"); }");if(l!==m){this.source.push("else { "+l+" = "+m+"; }")}}})},invokeProgram:function(k,l,j){var i=this.programExpression(this.inverse);var m=this.programExpression(k);this.populateParams(l,null,m,i,j,function(n,p,o){if(!this.usingKnownHelper){this.context.aliases.blockHelperMissing="helpers.blockHelperMissing";this.source.push("else { "+n+" = blockHelperMissing.call("+p+"); }")}})},populateParams:function(p,k,t,q,x,w){var l=x||this.options.stringParams||q||this.options.data;var j=this.popStack(),v;var n=[],m,o,u;if(l){this.register("tmp1",t);u="tmp1"}else{u="{ hash: {} }"}if(l){var s=(x?this.popStack():"{}");this.source.push("tmp1.hash = "+s+";")}if(this.options.stringParams){this.source.push("tmp1.contexts = [];")}for(var r=0;r<p;r++){m=this.popStack();n.push(m);if(this.options.stringParams){this.source.push("tmp1.contexts.push("+this.popStack()+");")}}if(q){this.source.push("tmp1.fn = tmp1;");this.source.push("tmp1.inverse = "+q+";")}if(this.options.data){this.source.push("tmp1.data = data;")}n.push(u);this.populateCall(n,j,k||j,w,t!=="{}")},populateCall:function(n,j,k,q,o){var m=["depth0"].concat(n).join(", ");var i=["depth0"].concat(k).concat(n).join(", ");var p=this.nextStack();if(this.usingKnownHelper){this.source.push(p+" = "+j+".call("+m+");")}else{this.context.aliases.functionType='"function"';var l=o?"foundHelper && ":"";this.source.push("if("+l+"typeof "+j+" === functionType) { "+p+" = "+j+".call("+m+"); }")}q.call(this,p,i,j);this.usingKnownHelper=false},invokePartial:function(i){params=[this.nameLookup("partials",i,"partial"),"'"+i+"'",this.popStack(),"helpers","partials"];if(this.options.data){params.push("data")}this.pushStack("self.invokePartial("+params.join(", ")+");")},assignToHash:function(i){var j=this.popStack();var k=this.topStack();this.source.push(k+"['"+i+"'] = "+j+";")},compiler:e,compileChildren:function(j,n){var p=j.children,r,q;for(var o=0,k=p.length;o<k;o++){r=p[o];q=new this.compiler();this.context.programs.push("");var m=this.context.programs.length;r.index=m;r.name="program"+m;this.context.programs[m]=q.compile(r,n,this.context)}},programExpression:function(k){if(k==null){return"self.noop"}var p=this.environment.children[k],o=p.depths.list;var n=[p.index,p.name,"data"];for(var m=0,j=o.length;m<j;m++){depth=o[m];if(depth===1){n.push("depth0")}else{n.push("depth"+(depth-1))}}if(o.length===0){return"self.program("+n.join(", ")+")"}else{n.shift();return"self.programWithDepth("+n.join(", ")+")"}},register:function(i,j){this.useRegister(i);this.source.push(i+" = "+j+";")},useRegister:function(i){if(!this.context.registers[i]){this.context.registers[i]=true;this.context.registers.list.push(i)}},pushStack:function(i){this.source.push(this.nextStack()+" = "+i+";");return"stack"+this.stackSlot},nextStack:function(){this.stackSlot++;if(this.stackSlot>this.stackVars.length){this.stackVars.push("stack"+this.stackSlot)}return"stack"+this.stackSlot},popStack:function(){return"stack"+this.stackSlot--},topStack:function(){return"stack"+this.stackSlot},quotedString:function(i){return'"'+i.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r")+'"'}};var a=("break else new var case finally return void catch for switch while continue function this with default if throw delete in try do instanceof typeof abstract enum int short boolean export interface static byte extends long super char final native synchronized class float package throws const goto private transient debugger implements protected volatile double import public let yield").split(" ");var d=e.RESERVED_WORDS={};for(var c=0,b=a.length;c<b;c++){d[a[c]]=true}e.isValidJavaScriptVariableName=function(i){if(!e.RESERVED_WORDS[i]&&/^[a-zA-Z_$][0-9a-zA-Z_$]+$/.test(i)){return true}return false}})(Handlebars.Compiler,Handlebars.JavaScriptCompiler);Handlebars.precompile=function(d,c){c=c||{};var b=Handlebars.parse(d);var a=new Handlebars.Compiler().compile(b,c);return new Handlebars.JavaScriptCompiler().compile(a,c)};Handlebars.compile=function(b,a){a=a||{};var d;function c(){var g=Handlebars.parse(b);var f=new Handlebars.Compiler().compile(g,a);var e=new Handlebars.JavaScriptCompiler().compile(f,a,undefined,true);return Handlebars.template(e)}return function(f,e){if(!d){d=c()}return d.call(this,f,e)}};Handlebars.VM={template:function(a){var b={escapeExpression:Handlebars.Utils.escapeExpression,invokePartial:Handlebars.VM.invokePartial,programs:[],program:function(d,e,f){var c=this.programs[d];if(f){return Handlebars.VM.program(e,f)}else{if(c){return c}else{c=this.programs[d]=Handlebars.VM.program(e);return c}}},programWithDepth:Handlebars.VM.programWithDepth,noop:Handlebars.VM.noop};return function(d,c){c=c||{};return a.call(b,Handlebars,d,c.helpers,c.partials,c.data)}},programWithDepth:function(b,d,c){var a=Array.prototype.slice.call(arguments,2);return function(f,e){e=e||{};return b.apply(this,[f,e.data||d].concat(a))}},program:function(a,b){return function(d,c){c=c||{};return a(d,c.data||b)}},noop:function(){return""},invokePartial:function(a,b,d,e,c,f){options={helpers:e,partials:c,data:f};if(a===undefined){throw new Handlebars.Exception("The partial "+b+" could not be found")}else{if(a instanceof Function){return a(d,options)}else{if(!Handlebars.compile){throw new Handlebars.Exception("The partial "+b+" could not be compiled when running in runtime-only mode")}else{c[b]=Handlebars.compile(a);return c[b](d,options)}}}}};Handlebars.template=Handlebars.VM.template;
\ No newline at end of file
diff -r 6aadac8026cb55844a0e8e49360ad30a9f6d0a25 -r 802b87d6491087f6e82d8490d0d603b7affc3491 static/scripts/packed/mvc/annotations.js
--- /dev/null
+++ b/static/scripts/packed/mvc/annotations.js
@@ -0,0 +1,1 @@
+var Annotation=BaseModel.extend(LoggableMixin).extend({logger:console,toString:function(){return"Annotation()"}});var AnnotationView=BaseView.extend(LoggableMixin).extend({logger:console,toString:function(){return"AnnotationView()"}});
\ No newline at end of file
diff -r 6aadac8026cb55844a0e8e49360ad30a9f6d0a25 -r 802b87d6491087f6e82d8490d0d603b7affc3491 static/scripts/packed/mvc/base-mvc.js
--- /dev/null
+++ b/static/scripts/packed/mvc/base-mvc.js
@@ -0,0 +1,1 @@
+var BaseModel=Backbone.RelationalModel.extend({defaults:{name:null,hidden:false},show:function(){this.set("hidden",false)},hide:function(){this.set("hidden",true)},is_visible:function(){return !this.attributes.hidden}});var BaseView=Backbone.View.extend({initialize:function(){this.model.on("change:hidden",this.update_visible,this);this.update_visible()},update_visible:function(){if(this.model.attributes.hidden){this.$el.hide()}else{this.$el.show()}}});var LoggableMixin={logger:null,log:function(){return(this.logger)?(this.logger.log.apply(this,arguments)):(undefined)}};var TemplateLoader=_.extend({},LoggableMixin,{getTemplateLoadFn:function(){throw ("There is no templateLoadFn. Make sure you're using a subclass of TemplateLoader")},getTemplates:function(d,e){e=e||false;this.log(this,"getTemplates:",d,", forceReload:",e);var c={},a=this,b=this.getTemplateLoadFn();if(!d){return c}jQuery.each(d,function(f,g){jQuery.each(g,function(h,i){a.log(a+", templateFile:",f,"templateName:",h,", templateID:",i);c[h]=b.call(a,f,h,i)})});return c}});var CompiledTemplateLoader=_.extend({},TemplateLoader,{getTemplateLoadFn:function(){return this.loadCompiledHandlebarsTemplate},loadCompiledHandlebarsTemplate:function(b,a,c){this.log("getInDomTemplates, templateFile:",b,"templateName:",a,", templateID:",c);if(!Handlebars.templates||!Handlebars.templates[c]){throw ("Template not found: Handlebars."+c+". Check your h.templates() call in the mako file that rendered this page")}this.log("found template function:",c);return Handlebars.templates[c]}});var InDomTemplateLoader=_.extend({},TemplateLoader,{compileTemplate:function(a){if(!Handlebars||!Handlebars.compile){throw ("No Handlebars.compile found. You may only have Handlebars.runtime loaded.Include handlebars.full for this to work")}this.log("compiling template:",a);return Handlebars.compile(a)},findTemplateInDom:function(b,a,c){return $("script#"+c).last()},getTemplateLoadFn:function(){return this.loadInDomTemplate},loadInDomTemplate:function(b,a,c){this.log("getInDomTemplate, templateFile:",b,"templateName:",a,", templateID:",c);var d=this.findTemplateInDom(b,a,c);if(!d||!d.length){throw ("Template not found within the DOM: "+c+". Check that this template has been included in the page")}this.log("found template in dom:",d.html());return this.compileTemplate(d.html())}});var RemoteTemplateLoader=_.extend({},InDomTemplateLoader,{templateBaseURL:"static/scripts/templates/",getTemplateLoadFn:function(){return this.loadViaHttpGet},loadViaHttpGet:function(d,c,f){var b="static/scripts/templates/";this.log("loadViaHttpGet, templateFile:",d,"templateName:",c,", templateID:",f,"templateBaseURL:",this.templateBaseURL);var h=null;try{h=this.loadInDomTemplate(d,c,f)}catch(g){this.log("getInDomTemplate exception:"+g);if(!Handlebars.compile){throw (g)}this.log("Couldn't locate template in DOM: "+f);var a=this;var e=b+d;jQuery.ajax(e,{method:"GET",async:false,success:function(i){a.log(d+" loaded via GET. Attempting compile...");$("body").append(i);h=a.loadInDomTemplate(d,c,f)},error:function(j,i,k){throw ("Failed to fetch "+e+":"+i)}})}if(!h){throw ("Couldn't load or fetch template: "+f)}return h}});
\ No newline at end of file
diff -r 6aadac8026cb55844a0e8e49360ad30a9f6d0a25 -r 802b87d6491087f6e82d8490d0d603b7affc3491 static/scripts/packed/mvc/history.js
--- a/static/scripts/packed/mvc/history.js
+++ b/static/scripts/packed/mvc/history.js
@@ -1,1 +1,1 @@
-function linkHTMLTemplate(b,a){if(!b){return"<a></a>"}a=a||"a";var c=["<"+a];for(key in b){var d=b[key];if(d===""){continue}switch(key){case"text":continue;case"classes":key="class";d=(b.classes.join)?(b.classes.join(" ")):(b.classes);default:c.push([" ",key,'="',d,'"'].join(""))}}c.push(">");if("text" in b){c.push(b.text)}c.push("</"+a+">");return c.join("")}var HistoryItem=BaseModel.extend(LoggableMixin).extend({defaults:{id:null,name:"",data_type:null,file_size:0,genome_build:null,metadata_data_lines:0,metadata_dbkey:null,metadata_sequences:0,misc_blurb:"",misc_info:"",model_class:"",state:"",deleted:false,purged:false,visible:true,for_editing:true,bodyIsShown:false},initialize:function(){this.log(this+".initialize",this.attributes);this.log("\tparent history_id: "+this.get("history_id"))},isEditable:function(){return(!(this.get("deleted")||this.get("purged")))},hasData:function(){return(this.get("file_size")>0)},toString:function(){var a=this.get("id")||"";if(this.get("name")){a+=':"'+this.get("name")+'"'}return"HistoryItem("+a+")"}});HistoryItem.STATES={NEW:"new",UPLOAD:"upload",QUEUED:"queued",RUNNING:"running",OK:"ok",EMPTY:"empty",ERROR:"error",DISCARDED:"discarded",SETTING_METADATA:"setting_metadata",FAILED_METADATA:"failed_metadata"};var HistoryItemView=BaseView.extend(LoggableMixin).extend({tagName:"div",className:"historyItemContainer",initialize:function(){this.log(this+".initialize:",this,this.model)},render:function(){this.log(this+".model:",this.model);var d=this.model.get("id"),c=this.model.get("state");this.$el.attr("id","historyItemContainer-"+d);var a=$("<div/>").attr("id","historyItem-"+d).addClass("historyItemWrapper").addClass("historyItem").addClass("historyItem-"+c);a.append(this._render_warnings());a.append(this._render_titleBar());this.body=$(this._render_body());a.append(this.body);a.find(".tooltip").tooltip({placement:"bottom"});var b=a.find("[popupmenu]");b.each(function(e,f){f=$(f);make_popupmenu(f)});this.$el.children().remove();return this.$el.append(a)},_render_warnings:function(){return $(jQuery.trim(HistoryItemView.templates.messages(this.model.toJSON())))},_render_titleBar:function(){var a=$('<div class="historyItemTitleBar" style="overflow: hidden"></div>');a.append(this._render_titleButtons());a.append('<span class="state-icon"></span>');a.append(this._render_titleLink());return a},_render_titleButtons:function(){var a=$('<div class="historyItemButtons"></div>'),b=this.model.get("for_editing");if(this.model.get("state")!==HistoryItem.STATES.UPLOAD){a.append(this._render_displayButton());if(b){a.append(this._render_editButton())}}if(b){a.append(this._render_deleteButton())}return a},_render_displayButton:function(){displayBtnData=(this.model.get("purged"))?({title:"Cannot display datasets removed from disk",icon_class:"display",enabled:false,}):({title:"Display data in browser",href:this.model.get("display_url"),target:(this.model.get("for_editing"))?("galaxy_main"):(null),icon_class:"display",});this.displayButton=new IconButtonView({model:new IconButton(displayBtnData)});return this.displayButton.render().$el},_render_editButton:function(){var d=this.model.get("id"),c=this.model.get("purged"),a=this.model.get("deleted");var b={title:"Edit attributes",href:this.model.get("edit_url"),target:"galaxy_main",icon_class:"edit"};if(a||c){b={enabled:false,icon_class:"edit"};b.title=(!c)?("Undelete dataset to edit attributes"):("Cannot edit attributes of datasets removed from disk")}this.editButton=new IconButtonView({model:new IconButton(b)});return this.editButton.render().$el},_render_deleteButton:function(){if(!this.model.get("for_editing")){return null}var a=(this.model.get("delete_url"))?({title:"Delete",href:this.model.get("delete_url"),target:"galaxy_main",id:"historyItemDeleter-"+this.model.get("id"),icon_class:"delete"}):({title:"Dataset is already deleted",icon_class:"delete",enabled:false});this.deleteButton=new IconButtonView({model:new IconButton(a)});return this.deleteButton.render().$el},_render_titleLink:function(){var b=this.model.get("name"),a=this.model.get("hid");title=(a+": "+b);return $(linkHTMLTemplate({href:"javascript:void(0);",text:'<span class="historyItemTitle">'+title+"</span>"}))},_render_body_not_viewable:function(a){a.append($("<div>You do not have permission to view dataset.</div>"))},_render_body_uploading:function(a){a.append($("<div>Dataset is uploading</div>"))},_render_body_queued:function(a){a.append($("<div>Job is waiting to run.</div>"));a.append(this._render_showParamsAndRerun())},_render_body_running:function(a){a.append("<div>Job is currently running.</div>");a.append(this._render_showParamsAndRerun())},_render_body_error:function(a){if(!this.model.get("purged")){a.append($("<div>"+this.model.get("misc_blurb")+"</div>"))}a.append(("An error occurred running this job: <i>"+$.trim(this.model.get("misc_info"))+"</i>"));var b=$(this._render_showParamsAndRerun());if(this.model.get("for_editing")){b.prepend($(linkHTMLTemplate({title:"View or report this error",href:this.model.get("report_errors_url"),target:"galaxy_main",classes:["icon-button","tooltip","bug"]})))}if(this.model.hasData()){b.prepend(this._render_downloadLinks())}a.append(b)},_render_body_discarded:function(a){a.append("<div>The job creating this dataset was cancelled before completion.</div>");a.append(this._render_showParamsAndRerun())},_render_body_setting_metadata:function(a){a.append($("<div>Metadata is being auto-detected.</div>"))},_render_body_empty:function(a){a.append($("<div>No data: <i>"+this.model.get("misc_blurb")+"</i></div>"));a.append(this._render_showParamsAndRerun())},_render_body_failed_metadata:function(b){var c="An error occurred setting the metadata for this dataset.";if(this.model.isEditable()){var a=linkHTMLTemplate({text:"set it manually or retry auto-detection",href:this.model.get("edit_url"),target:"galaxy_main"});c+="You may be able to "+a+"."}b.append($(HistoryItemView.templates.warningMsg({warning:c})));this._render_body_ok(b)},_render_body_ok:function(h){h.append(this._render_hdaSummary());if(this.model.get("misc_info")){h.append($('<div class="info">Info: '+this.model.get("misc_info")+"</div>"))}if(this.model.hasData()){var c=$("<div/>");c.append(this._render_downloadLinks());c.append($(linkHTMLTemplate({title:"View details",href:this.model.get("show_params_url"),target:"galaxy_main",classes:["icon-button","tooltip","information"]})));if(this.model.get("for_editing")){c.append($(linkHTMLTemplate({title:"Run this job again",href:this.model.get("rerun_url"),target:"galaxy_main",classes:["icon-button","tooltip","arrow-circle"]})));if(this.model.get("trackster_urls")){var a=this.model.get("trackster_urls");c.append($(linkHTMLTemplate({title:"View in Trackster",href:"javascript:void(0)",classes:["icon-button","tooltip","chart_curve","trackster-add"],"data-url":a["data-url"],"action-url":a["action-url"],"new-url":a["new-url"]})))}if(this.model.get("retag_url")&&this.model.get("annotate_url")){var d=$('<div style="float: right;"></div>');d.append($(linkHTMLTemplate({title:"Edit dataset tags",target:"galaxy_main",href:this.model.get("retag_url"),classes:["icon-button","tooltip","tags"]})));d.append($(linkHTMLTemplate({title:"Edit dataset annotation",target:"galaxy_main",href:this.model.get("annotation_url"),classes:["icon-button","tooltip","annotate"]})));c.append(d);c.append('<div style="clear: both"></div>');this.tagArea=$('<div class="tag-area" style="display: none">');this.tagArea.append("<strong>Tags:</strong>");this.tagElt=$('<div class="tag-elt"></div>');c.append(this.tagArea.append(this.tagElt));var e=$(('<div id="${dataset_id}-annotation-area" class="annotation-area" style="display: none">'));this.annotationArea=e;e.append("<strong>Annotation:</strong>");this.annotationElem=$('<div id="'+this.model.get("id")+'-annotation-elt" style="margin: 1px 0px 1px 0px" class="annotation-elt tooltip editable-text" title="Edit dataset annotation"></div>');e.append(this.annotationElem);c.append(e)}}c.append('<div style="clear: both;"></div>');h.append(c);var i=$("<div/>");if(this.model.get("display_apps")){var j=this.model.get("display_apps"),b=$("<span/>");for(app_name in j){var g=j[app_name],f=app_name+" ";for(location_name in g){f+=linkHTMLTemplate({text:location_name,href:g[location_name].url,target:g[location_name].target})+" "}b.append(f)}i.append(b)}h.append(i)}else{if(this.model.get("for_editing")){h.append(this._render_showParamsAndRerun())}}h.append(this._render_peek())},_render_body:function(){var b=this.model.get("state"),c=this.model.get("for_editing");var a=$("<div/>").attr("id","info-"+this.model.get("id")).addClass("historyItemBody").attr("style","display: block");switch(b){case HistoryItem.STATES.NOT_VIEWABLE:this._render_body_not_viewable(a);break;case HistoryItem.STATES.UPLOAD:this._render_body_uploading(a);break;case HistoryItem.STATES.QUEUED:this._render_body_queued(a);break;case HistoryItem.STATES.RUNNING:this._render_body_running(a);break;case HistoryItem.STATES.ERROR:this._render_body_error(a);break;case HistoryItem.STATES.DISCARDED:this._render_body_discarded(a);break;case HistoryItem.STATES.SETTING_METADATA:this._render_body_setting_metadata(a);break;case HistoryItem.STATES.EMPTY:this._render_body_empty(a);break;case HistoryItem.STATES.FAILED_METADATA:this._render_body_failed_metadata(a);break;case HistoryItem.STATES.OK:this._render_body_ok(a);break;default:a.append($('<div>Error: unknown dataset state "'+b+'".</div>'))}a.append('<div style="clear: both"></div>');if(this.model.get("bodyIsShown")===false){a.hide()}return a},_render_hdaSummary:function(){var a=_.template('<span class="<%= dbkey %>"><%= dbkey %></span>',{dbkey:this.model.get("metadata_dbkey")});if(this.model.get("metadata_dbkey")==="?"&&this.model.isEditable()){a=linkHTMLTemplate({text:this.model.get("metadata_dbkey"),href:this.model.get("edit_url"),target:"galaxy_main"})}return(HistoryItemView.TEMPLATES.hdaSummary(_.extend({dbkeyHTML:a},this.model.attributes)))},_render_showParamsAndRerun:function(){var a=$("<div/>");a.append($(linkHTMLTemplate({title:"View details",href:this.model.get("show_params_url"),target:"galaxy_main",classes:["icon-button","tooltip","information"]})));if(this.model.get("for_editing")){a.append($(linkHTMLTemplate({title:"Run this job again",href:this.model.get("rerun_url"),target:"galaxy_main",classes:["icon-button","tooltip","arrow-circle"]})))}return a},_render_downloadLinks:function(){if(this.model.get("purged")){return null}var a=linkHTMLTemplate({title:"Download",href:this.model.get("download_url"),classes:["icon-button","tooltip","disk"]});var d=this.model.get("download_meta_urls");if(!d){return a}var c=$('<div popupmenu="dataset-'+this.model.get("id")+'-popup"></div>');c.append(linkHTMLTemplate({text:"Download Dataset",title:"Download",href:this.model.get("download_url"),classes:["icon-button","tooltip","disk"]}));c.append("<a>Additional Files</a>");for(file_type in d){c.append(linkHTMLTemplate({text:"Download "+file_type,href:d[file_type],classes:["action-button"]}))}var b=$(('<div style="float:left;" class="menubutton split popup" id="dataset-${dataset_id}-popup"></div>'));b.append(a);c.append(b);return c},_render_peek:function(){if(!this.model.get("peek")){return null}return $("<div/>").append($("<pre/>").attr("id","peek"+this.model.get("id")).addClass("peek").append(this.model.get("peek")))},events:{"click .historyItemTitle":"toggleBodyVisibility","click a.icon-button.tags":"loadAndDisplayTags","click a.icon-button.annotate":"loadAndDisplayAnnotation"},loadAndDisplayTags:function(b){this.log(this,".loadAndDisplayTags",b);var c=this.tagArea;var a=this.tagElt;if(c.is(":hidden")){if(!a.html()){$.ajax({url:this.model.get("ajax_get_tag_url"),error:function(){alert("Tagging failed")},success:function(d){this.log("tag_elt_html:",d);a.html(d);a.find(".tooltip").tooltip();c.slideDown("fast")}})}else{c.slideDown("fast")}}else{c.slideUp("fast")}return false},loadAndDisplayAnnotation:function(b){this.log(this,".loadAndDisplayAnnotation",b);var d=this.annotationArea,c=this.annotationElem,a=this.model.get("ajax_set_annotation_url");this.log("annotationArea hidden:",d.is(":hidden"));this.log("annotationElem html:",c.html());if(d.is(":hidden")){if(!c.html()){$.ajax({url:this.model.get("ajax_get_annotation_url"),error:function(){alert("Annotations failed")},success:function(e){if(e===""){e="<em>Describe or add notes to dataset</em>"}c.html(e);d.find(".tooltip").tooltip();async_save_text(c.attr("id"),c.attr("id"),a,"new_annotation",18,true,4);d.slideDown("fast")}})}else{d.slideDown("fast")}}else{d.slideUp("fast")}return false},toggleBodyVisibility:function(){this.log(this+".toggleBodyVisibility");this.$el.find(".historyItemBody").toggle()},toString:function(){var a=(this.model)?(this.model+""):("");return"HistoryItemView("+a+")"}});HistoryItemView.TEMPLATES={};HistoryItemView.TEMPLATES.hdaSummary=_.template(["<%= misc_blurb %><br />",'format: <span class="<%= data_type %>"><%= data_type %></span>, ',"database: <%= dbkeyHTML %>"].join(""));HistoryItemView.templates=CompiledTemplateLoader.getTemplates({"common-templates.html":{warningMsg:"template-warningmessagesmall",},"history-templates.html":{messages:"template-history-warning-messages2",hdaSummary:"template-history-hdaSummary"}});var HistoryCollection=Backbone.Collection.extend({model:HistoryItem,toString:function(){return("HistoryCollection()")}});var History=BaseModel.extend(LoggableMixin).extend({defaults:{id:"",name:"",state:"",state_details:{discarded:0,empty:0,error:0,failed_metadata:0,ok:0,queued:0,running:0,setting_metadata:0,upload:0}},initialize:function(b,a){this.log(this+".initialize",b,a);this.items=new HistoryCollection()},loadDatasetsAsHistoryItems:function(c){var a=this,b=this.get("id"),d=this.get("state_details");_.each(c,function(f,e){a.log("loading dataset: ",f,e);var h=new HistoryItem(_.extend(f,{history_id:b}));a.log("as History:",h);a.items.add(h);var g=f.state;d[g]+=1});this.set("state_details",d);this._stateFromStateDetails();return this},_stateFromStateDetails:function(){this.set("state","");var a=this.get("state_details");if((a.error>0)||(a.failed_metadata>0)){this.set("state",HistoryItem.STATES.ERROR)}else{if((a.running>0)||(a.setting_metadata>0)){this.set("state",HistoryItem.STATES.RUNNING)}else{if(a.queued>0){this.set("state",HistoryItem.STATES.QUEUED)}else{if(a.ok===this.items.length){this.set("state",HistoryItem.STATES.OK)}else{throw ("_stateFromStateDetails: unable to determine history state from state details: "+this.state_details)}}}}return this},toString:function(){var a=(this.get("name"))?(","+this.get("name")):("");return"History("+this.get("id")+a+")"}});var HistoryView=BaseView.extend(LoggableMixin).extend({el:"body.historyPage",initialize:function(){this.log(this+".initialize");this.itemViews=[];var a=this;this.model.items.each(function(c){var b=new HistoryItemView({model:c});a.itemViews.push(b)})},render:function(){this.log(this+".render");var a=$("<div/>");_.each(this.itemViews,function(b){a.prepend(b.render())});this.$el.append(a.children());a.remove()},toString:function(){var a=this.model.get("name")||"";return"HistoryView("+a+")"}});function createMockHistoryData(){mockHistory={};mockHistory.data={template:{id:"a799d38679e985db",name:"template",data_type:"fastq",file_size:226297533,genome_build:"?",metadata_data_lines:0,metadata_dbkey:"?",metadata_sequences:0,misc_blurb:"215.8 MB",misc_info:"uploaded fastq file",model_class:"HistoryDatasetAssociation",download_url:"",state:"ok",visible:true,deleted:false,purged:false,hid:0,for_editing:true,undelete_url:"example.com/undelete",purge_url:"example.com/purge",unhide_url:"example.com/unhide",display_url:"example.com/display",edit_url:"example.com/edit",delete_url:"example.com/delete",show_params_url:"example.com/show_params",rerun_url:"example.com/rerun",retag_url:"example.com/retag",annotate_url:"example.com/annotate",peek:['<table cellspacing="0" cellpadding="3"><tr><th>1.QNAME</th><th>2.FLAG</th><th>3.RNAME</th><th>4.POS</th><th>5.MAPQ</th><th>6.CIGAR</th><th>7.MRNM</th><th>8.MPOS</th><th>9.ISIZE</th><th>10.SEQ</th><th>11.QUAL</th><th>12.OPT</th></tr>','<tr><td colspan="100%">@SQ SN:gi|87159884|ref|NC_007793.1| LN:2872769</td></tr>','<tr><td colspan="100%">@PG ID:bwa PN:bwa VN:0.5.9-r16</td></tr>','<tr><td colspan="100%">HWUSI-EAS664L:15:64HOJAAXX:1:1:13280:968 73 gi|87159884|ref|NC_007793.1| 2720169 37 101M = 2720169 0 NAATATGACATTATTTTCAAAACAGCTGAAAATTTAGACGTACCGATTTATCTACATCCCGCGCCAGTTAACAGTGACATTTATCAATCATACTATAAAGG !!!!!!!!!!$!!!$!!!!!$!!!!!!$!$!$$$!!$!!$!!!!!!!!!!!$!</td></tr>','<tr><td colspan="100%">!!!$!$!$$!!$$!!$!!!!!!!!!!!!!!!!!!!!!!!!!!$!!$!! XT:A:U NM:i:1 SM:i:37 AM:i:0 X0:i:1 X1:i:0 XM:i:1 XO:i:0 XG:i:0 MD:Z:0A100</td></tr>','<tr><td colspan="100%">HWUSI-EAS664L:15:64HOJAAXX:1:1:13280:968 133 gi|87159884|ref|NC_007793.1| 2720169 0 * = 2720169 0 NAAACTGTGGCTTCGTTNNNNNNNNNNNNNNNGTGANNNNNNNNNNNNNNNNNNNGNNNNNNNNNNNNNNNNNNNNCNAANNNNNNNNNNNNNNNNNNNNN !!!!!!!!!!!!$!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!</td></tr>','<tr><td colspan="100%">!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!</td></tr>',"</table>"].join("")}};_.extend(mockHistory.data,{deleted:_.extend(_.clone(mockHistory.data.template),{deleted:true}),purgedNotDeleted:_.extend(_.clone(mockHistory.data.template),{purged:true}),notvisible:_.extend(_.clone(mockHistory.data.template),{visible:false}),hasDisplayApps:_.extend(_.clone(mockHistory.data.template),{display_apps:{"display in IGB":{Web:"/display_application/63cd3858d057a6d1/igb_bam/Web",Local:"/display_application/63cd3858d057a6d1/igb_bam/Local"}}}),canTrackster:_.extend(_.clone(mockHistory.data.template),{trackster_urls:{"data-url":"example.com/trackster-data","action-url":"example.com/trackster-action","new-url":"example.com/trackster-new"}}),zeroSize:_.extend(_.clone(mockHistory.data.template),{file_size:0}),hasMetafiles:_.extend(_.clone(mockHistory.data.template),{download_meta_urls:{bam_index:"example.com/bam-index"}}),upload:_.extend(_.clone(mockHistory.data.template),{state:HistoryItem.STATES.UPLOAD}),queued:_.extend(_.clone(mockHistory.data.template),{state:HistoryItem.STATES.QUEUED}),running:_.extend(_.clone(mockHistory.data.template),{state:HistoryItem.STATES.RUNNING}),empty:_.extend(_.clone(mockHistory.data.template),{state:HistoryItem.STATES.EMPTY}),error:_.extend(_.clone(mockHistory.data.template),{state:HistoryItem.STATES.ERROR}),discarded:_.extend(_.clone(mockHistory.data.template),{state:HistoryItem.STATES.DISCARDED}),setting_metadata:_.extend(_.clone(mockHistory.data.template),{state:HistoryItem.STATES.SETTING_METADATA}),failed_metadata:_.extend(_.clone(mockHistory.data.template),{state:HistoryItem.STATES.FAILED_METADATA})});$(document).ready(function(){mockHistory.items={};mockHistory.views={};for(key in mockHistory.data){mockHistory.items[key]=new HistoryItem(mockHistory.data[key]);mockHistory.items[key].set("name",key);mockHistory.views[key]=new HistoryItemView({model:mockHistory.items[key]});$("body").append(mockHistory.views[key].render())}})};
\ No newline at end of file
+function linkHTMLTemplate(b,a){if(!b){return"<a></a>"}a=a||"a";var c=["<"+a];for(key in b){var d=b[key];if(d===""){continue}switch(key){case"text":continue;case"classes":key="class";d=(b.classes.join)?(b.classes.join(" ")):(b.classes);default:c.push([" ",key,'="',d,'"'].join(""))}}c.push(">");if("text" in b){c.push(b.text)}c.push("</"+a+">");return c.join("")}var HistoryItem=BaseModel.extend(LoggableMixin).extend({defaults:{id:null,name:"",data_type:null,file_size:0,genome_build:null,metadata_data_lines:0,metadata_dbkey:null,metadata_sequences:0,misc_blurb:"",misc_info:"",model_class:"",state:"",deleted:false,purged:false,visible:true,for_editing:true,bodyIsShown:false},initialize:function(){this.log(this+".initialize",this.attributes);this.log("\tparent history_id: "+this.get("history_id"))},isEditable:function(){return(!(this.get("deleted")||this.get("purged")))},hasData:function(){return(this.get("file_size")>0)},toString:function(){var a=this.get("id")||"";if(this.get("name")){a+=':"'+this.get("name")+'"'}return"HistoryItem("+a+")"}});HistoryItem.STATES={NEW:"new",UPLOAD:"upload",QUEUED:"queued",RUNNING:"running",OK:"ok",EMPTY:"empty",ERROR:"error",DISCARDED:"discarded",SETTING_METADATA:"setting_metadata",FAILED_METADATA:"failed_metadata"};var HistoryItemView=BaseView.extend(LoggableMixin).extend({logger:console,tagName:"div",className:"historyItemContainer",initialize:function(){this.log(this+".initialize:",this,this.model)},render:function(){this.log(this+".model:",this.model);var d=this.model.get("id"),c=this.model.get("state");this.clearReferences();this.$el.attr("id","historyItemContainer-"+d);var a=$("<div/>").attr("id","historyItem-"+d).addClass("historyItemWrapper").addClass("historyItem").addClass("historyItem-"+c);a.append(this._render_warnings());a.append(this._render_titleBar());this.body=$(this._render_body());a.append(this.body);a.find(".tooltip").tooltip({placement:"bottom"});var b=a.find("[popupmenu]");b.each(function(e,f){f=$(f);make_popupmenu(f)});this.$el.children().remove();return this.$el.append(a)},clearReferences:function(){this.displayButton=null;this.editButton=null;this.deleteButton=null;this.errButton=null},_render_warnings:function(){return $(jQuery.trim(HistoryItemView.templates.messages(this.model.toJSON())))},_render_titleBar:function(){var a=$('<div class="historyItemTitleBar" style="overflow: hidden"></div>');a.append(this._render_titleButtons());a.append('<span class="state-icon"></span>');a.append(this._render_titleLink());return a},_render_titleButtons:function(){var a=$('<div class="historyItemButtons"></div>');a.append(this._render_displayButton());a.append(this._render_editButton());a.append(this._render_deleteButton());return a},_render_displayButton:function(){if(this.model.get("state")===HistoryItem.STATES.UPLOAD){return null}displayBtnData=(this.model.get("purged"))?({title:"Cannot display datasets removed from disk",enabled:false,icon_class:"display",}):({title:"Display data in browser",href:this.model.get("display_url"),target:(this.model.get("for_editing"))?("galaxy_main"):(null),icon_class:"display",});this.displayButton=new IconButtonView({model:new IconButton(displayBtnData)});return this.displayButton.render().$el},_render_editButton:function(){if((this.model.get("state")===HistoryItem.STATES.UPLOAD)||(!this.model.get("for_editing"))){return null}var c=this.model.get("purged"),a=this.model.get("deleted"),b={title:"Edit attributes",href:this.model.get("edit_url"),target:"galaxy_main",icon_class:"edit"};if(a||c){b.enabled=false}if(a){b.title="Undelete dataset to edit attributes"}else{if(c){b.title="Cannot edit attributes of datasets removed from disk"}}this.editButton=new IconButtonView({model:new IconButton(b)});return this.editButton.render().$el},_render_deleteButton:function(){if(!this.model.get("for_editing")){return null}var a=(this.model.get("delete_url"))?({title:"Delete",href:this.model.get("delete_url"),target:"galaxy_main",id:"historyItemDeleter-"+this.model.get("id"),icon_class:"delete"}):({title:"Dataset is already deleted",icon_class:"delete",enabled:false});this.deleteButton=new IconButtonView({model:new IconButton(a)});return this.deleteButton.render().$el},_render_titleLink:function(){this.log("model:",this.model.toJSON());return $(jQuery.trim(HistoryItemView.templates.titleLink(this.model.toJSON())))},_render_body_not_viewable:function(a){a.append($("<div>You do not have permission to view dataset.</div>"))},_render_body_uploading:function(a){a.append($("<div>Dataset is uploading</div>"))},_render_body_queued:function(a){a.append($("<div>Job is waiting to run.</div>"));a.append(this._render_showParamsAndRerun())},_render_body_running:function(a){a.append("<div>Job is currently running.</div>");a.append(this._render_showParamsAndRerun())},_render_body_error:function(a){if(!this.model.get("purged")){a.append($("<div>"+this.model.get("misc_blurb")+"</div>"))}a.append(("An error occurred running this job: <i>"+$.trim(this.model.get("misc_info"))+"</i>"));var b=$(this._render_showParamsAndRerun());if(this.model.get("for_editing")){this.errButton=new IconButtonView({model:new IconButton({title:"View or report this error",href:this.model.get("report_error_url"),target:"galaxy_main",icon_class:"bug"})});b.prepend(this.errButton.render().$el)}if(this.model.hasData()){b.prepend(this._render_downloadLinks())}a.append(b)},_render_body_discarded:function(a){a.append("<div>The job creating this dataset was cancelled before completion.</div>");a.append(this._render_showParamsAndRerun())},_render_body_setting_metadata:function(a){a.append($("<div>Metadata is being auto-detected.</div>"))},_render_body_empty:function(a){a.append($("<div>No data: <i>"+this.model.get("misc_blurb")+"</i></div>"));a.append(this._render_showParamsAndRerun())},_render_body_failed_metadata:function(b){var c="An error occurred setting the metadata for this dataset.";if(this.model.isEditable()){var a=linkHTMLTemplate({text:"set it manually or retry auto-detection",href:this.model.get("edit_url"),target:"galaxy_main"});c+="You may be able to "+a+"."}b.append($(HistoryItemView.templates.warningMsg({warning:c})));this._render_body_ok(b)},_render_body_ok:function(h){h.append(this._render_hdaSummary());if(this.model.get("misc_info")){h.append($('<div class="info">Info: '+this.model.get("misc_info")+"</div>"))}if(this.model.hasData()){var c=$("<div/>");c.append(this._render_downloadLinks());c.append($(linkHTMLTemplate({title:"View details",href:this.model.get("show_params_url"),target:"galaxy_main",classes:["icon-button","tooltip","information"]})));if(this.model.get("for_editing")){c.append($(linkHTMLTemplate({title:"Run this job again",href:this.model.get("rerun_url"),target:"galaxy_main",classes:["icon-button","tooltip","arrow-circle"]})));if(this.model.get("trackster_urls")){var a=this.model.get("trackster_urls");c.append($(linkHTMLTemplate({title:"View in Trackster",href:"javascript:void(0)",classes:["icon-button","tooltip","chart_curve","trackster-add"],"data-url":a["data-url"],"action-url":a["action-url"],"new-url":a["new-url"]})))}if(this.model.get("retag_url")&&this.model.get("annotate_url")){var d=$('<div style="float: right;"></div>');d.append($(linkHTMLTemplate({title:"Edit dataset tags",target:"galaxy_main",href:this.model.get("retag_url"),classes:["icon-button","tooltip","tags"]})));d.append($(linkHTMLTemplate({title:"Edit dataset annotation",target:"galaxy_main",href:this.model.get("annotation_url"),classes:["icon-button","tooltip","annotate"]})));c.append(d);c.append('<div style="clear: both"></div>');this.tagArea=$('<div class="tag-area" style="display: none">');this.tagArea.append("<strong>Tags:</strong>");this.tagElt=$('<div class="tag-elt"></div>');c.append(this.tagArea.append(this.tagElt));var e=$(('<div id="${dataset_id}-annotation-area" class="annotation-area" style="display: none">'));this.annotationArea=e;e.append("<strong>Annotation:</strong>");this.annotationElem=$('<div id="'+this.model.get("id")+'-annotation-elt" style="margin: 1px 0px 1px 0px" class="annotation-elt tooltip editable-text" title="Edit dataset annotation"></div>');e.append(this.annotationElem);c.append(e)}}c.append('<div style="clear: both;"></div>');h.append(c);var i=$("<div/>");if(this.model.get("display_apps")){var j=this.model.get("display_apps"),b=$("<span/>");for(app_name in j){var g=j[app_name],f=app_name+" ";for(location_name in g){f+=linkHTMLTemplate({text:location_name,href:g[location_name].url,target:g[location_name].target})+" "}b.append(f)}i.append(b)}h.append(i)}else{if(this.model.get("for_editing")){h.append(this._render_showParamsAndRerun())}}h.append(this._render_peek())},_render_body:function(){var b=this.model.get("state"),c=this.model.get("for_editing");var a=$("<div/>").attr("id","info-"+this.model.get("id")).addClass("historyItemBody").attr("style","display: block");switch(b){case HistoryItem.STATES.NOT_VIEWABLE:this._render_body_not_viewable(a);break;case HistoryItem.STATES.UPLOAD:this._render_body_uploading(a);break;case HistoryItem.STATES.QUEUED:this._render_body_queued(a);break;case HistoryItem.STATES.RUNNING:this._render_body_running(a);break;case HistoryItem.STATES.ERROR:this._render_body_error(a);break;case HistoryItem.STATES.DISCARDED:this._render_body_discarded(a);break;case HistoryItem.STATES.SETTING_METADATA:this._render_body_setting_metadata(a);break;case HistoryItem.STATES.EMPTY:this._render_body_empty(a);break;case HistoryItem.STATES.FAILED_METADATA:this._render_body_failed_metadata(a);break;case HistoryItem.STATES.OK:this._render_body_ok(a);break;default:a.append($('<div>Error: unknown dataset state "'+b+'".</div>'))}a.append('<div style="clear: both"></div>');if(this.model.get("bodyIsShown")===false){a.hide()}return a},_render_hdaSummary:function(){var a=this.model.toJSON();if(this.model.get("metadata_dbkey")==="?"&&this.model.isEditable()){_.extend(a,{dbkey_unknown_and_editable:true})}return HistoryItemView.templates.hdaSummary(a)},_render_showParamsAndRerun:function(){var a=$("<div/>");this.showParamsButton=new IconButtonView({model:new IconButton({title:"View details",href:this.model.get("show_params_url"),target:"galaxy_main",icon_class:"information"})});a.append(this.showParamsButton.render().$el);if(this.model.get("for_editing")){this.rerunButton=new IconButtonView({model:new IconButton({title:"Run this job again",href:this.model.get("rerun_url"),target:"galaxy_main",icon_class:"arrow-circle"})})}return a},_render_downloadLinks:function(){if(this.model.get("purged")){return null}var a=linkHTMLTemplate({title:"Download",href:this.model.get("download_url"),classes:["icon-button","tooltip","disk"]});var d=this.model.get("download_meta_urls");if(!d){return a}var c=$('<div popupmenu="dataset-'+this.model.get("id")+'-popup"></div>');c.append(linkHTMLTemplate({text:"Download Dataset",title:"Download",href:this.model.get("download_url"),classes:["icon-button","tooltip","disk"]}));c.append("<a>Additional Files</a>");for(file_type in d){c.append(linkHTMLTemplate({text:"Download "+file_type,href:d[file_type],classes:["action-button"]}))}var b=$(('<div style="float:left;" class="menubutton split popup" id="dataset-${dataset_id}-popup"></div>'));b.append(a);c.append(b);return c},_render_peek:function(){if(!this.model.get("peek")){return null}return $("<div/>").append($("<pre/>").attr("id","peek"+this.model.get("id")).addClass("peek").append(this.model.get("peek")))},events:{"click .historyItemTitle":"toggleBodyVisibility","click a.icon-button.tags":"loadAndDisplayTags","click a.icon-button.annotate":"loadAndDisplayAnnotation"},loadAndDisplayTags:function(b){this.log(this,".loadAndDisplayTags",b);var c=this.tagArea;var a=this.tagElt;if(c.is(":hidden")){if(!a.html()){$.ajax({url:this.model.get("ajax_get_tag_url"),error:function(){alert("Tagging failed")},success:function(d){this.log("tag_elt_html:",d);a.html(d);a.find(".tooltip").tooltip();c.slideDown("fast")}})}else{c.slideDown("fast")}}else{c.slideUp("fast")}return false},loadAndDisplayAnnotation:function(b){this.log(this,".loadAndDisplayAnnotation",b);var d=this.annotationArea,c=this.annotationElem,a=this.model.get("ajax_set_annotation_url");this.log("annotationArea hidden:",d.is(":hidden"));this.log("annotationElem html:",c.html());if(d.is(":hidden")){if(!c.html()){$.ajax({url:this.model.get("ajax_get_annotation_url"),error:function(){alert("Annotations failed")},success:function(e){if(e===""){e="<em>Describe or add notes to dataset</em>"}c.html(e);d.find(".tooltip").tooltip();async_save_text(c.attr("id"),c.attr("id"),a,"new_annotation",18,true,4);d.slideDown("fast")}})}else{d.slideDown("fast")}}else{d.slideUp("fast")}return false},toggleBodyVisibility:function(){this.log(this+".toggleBodyVisibility");this.$el.find(".historyItemBody").toggle()},toString:function(){var a=(this.model)?(this.model+""):("");return"HistoryItemView("+a+")"}});HistoryItemView.templates=CompiledTemplateLoader.getTemplates({"history-templates.html":{messages:"template-history-warning-messages",titleLink:"template-history-titleLink",hdaSummary:"template-history-hdaSummary"}});var HistoryCollection=Backbone.Collection.extend({model:HistoryItem,toString:function(){return("HistoryCollection()")}});var History=BaseModel.extend(LoggableMixin).extend({defaults:{id:"",name:"",state:"",state_details:{discarded:0,empty:0,error:0,failed_metadata:0,ok:0,queued:0,running:0,setting_metadata:0,upload:0}},initialize:function(b,a){this.log(this+".initialize",b,a);this.items=new HistoryCollection()},loadDatasetsAsHistoryItems:function(c){var a=this,b=this.get("id"),d=this.get("state_details");_.each(c,function(f,e){a.log("loading dataset: ",f,e);var h=new HistoryItem(_.extend(f,{history_id:b}));a.log("as History:",h);a.items.add(h);var g=f.state;d[g]+=1});this.set("state_details",d);this._stateFromStateDetails();return this},_stateFromStateDetails:function(){this.set("state","");var a=this.get("state_details");if((a.error>0)||(a.failed_metadata>0)){this.set("state",HistoryItem.STATES.ERROR)}else{if((a.running>0)||(a.setting_metadata>0)){this.set("state",HistoryItem.STATES.RUNNING)}else{if(a.queued>0){this.set("state",HistoryItem.STATES.QUEUED)}else{if(a.ok===this.items.length){this.set("state",HistoryItem.STATES.OK)}else{throw ("_stateFromStateDetails: unable to determine history state from state details: "+this.state_details)}}}}return this},toString:function(){var a=(this.get("name"))?(","+this.get("name")):("");return"History("+this.get("id")+a+")"}});var HistoryView=BaseView.extend(LoggableMixin).extend({el:"body.historyPage",initialize:function(){this.log(this+".initialize");this.itemViews=[];var a=this;this.model.items.each(function(c){var b=new HistoryItemView({model:c});a.itemViews.push(b)})},render:function(){this.log(this+".render");var a=$("<div/>");_.each(this.itemViews,function(b){a.prepend(b.render())});this.$el.append(a.children());a.remove()},toString:function(){var a=this.model.get("name")||"";return"HistoryView("+a+")"}});function createMockHistoryData(){mockHistory={};mockHistory.data={template:{id:"a799d38679e985db",name:"template",data_type:"fastq",file_size:226297533,genome_build:"?",metadata_data_lines:0,metadata_dbkey:"?",metadata_sequences:0,misc_blurb:"215.8 MB",misc_info:"uploaded fastq file",model_class:"HistoryDatasetAssociation",download_url:"",state:"ok",visible:true,deleted:false,purged:false,hid:0,for_editing:true,undelete_url:"example.com/undelete",purge_url:"example.com/purge",unhide_url:"example.com/unhide",display_url:"example.com/display",edit_url:"example.com/edit",delete_url:"example.com/delete",show_params_url:"example.com/show_params",rerun_url:"example.com/rerun",retag_url:"example.com/retag",annotate_url:"example.com/annotate",peek:['<table cellspacing="0" cellpadding="3"><tr><th>1.QNAME</th><th>2.FLAG</th><th>3.RNAME</th><th>4.POS</th><th>5.MAPQ</th><th>6.CIGAR</th><th>7.MRNM</th><th>8.MPOS</th><th>9.ISIZE</th><th>10.SEQ</th><th>11.QUAL</th><th>12.OPT</th></tr>','<tr><td colspan="100%">@SQ SN:gi|87159884|ref|NC_007793.1| LN:2872769</td></tr>','<tr><td colspan="100%">@PG ID:bwa PN:bwa VN:0.5.9-r16</td></tr>','<tr><td colspan="100%">HWUSI-EAS664L:15:64HOJAAXX:1:1:13280:968 73 gi|87159884|ref|NC_007793.1| 2720169 37 101M = 2720169 0 NAATATGACATTATTTTCAAAACAGCTGAAAATTTAGACGTACCGATTTATCTACATCCCGCGCCAGTTAACAGTGACATTTATCAATCATACTATAAAGG !!!!!!!!!!$!!!$!!!!!$!!!!!!$!$!$$$!!$!!$!!!!!!!!!!!$!</td></tr>','<tr><td colspan="100%">!!!$!$!$$!!$$!!$!!!!!!!!!!!!!!!!!!!!!!!!!!$!!$!! XT:A:U NM:i:1 SM:i:37 AM:i:0 X0:i:1 X1:i:0 XM:i:1 XO:i:0 XG:i:0 MD:Z:0A100</td></tr>','<tr><td colspan="100%">HWUSI-EAS664L:15:64HOJAAXX:1:1:13280:968 133 gi|87159884|ref|NC_007793.1| 2720169 0 * = 2720169 0 NAAACTGTGGCTTCGTTNNNNNNNNNNNNNNNGTGANNNNNNNNNNNNNNNNNNNGNNNNNNNNNNNNNNNNNNNNCNAANNNNNNNNNNNNNNNNNNNNN !!!!!!!!!!!!$!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!</td></tr>','<tr><td colspan="100%">!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!</td></tr>',"</table>"].join("")}};_.extend(mockHistory.data,{deleted:_.extend(_.clone(mockHistory.data.template),{deleted:true}),purgedNotDeleted:_.extend(_.clone(mockHistory.data.template),{purged:true}),notvisible:_.extend(_.clone(mockHistory.data.template),{visible:false}),hasDisplayApps:_.extend(_.clone(mockHistory.data.template),{display_apps:{"display in IGB":{Web:"/display_application/63cd3858d057a6d1/igb_bam/Web",Local:"/display_application/63cd3858d057a6d1/igb_bam/Local"}}}),canTrackster:_.extend(_.clone(mockHistory.data.template),{trackster_urls:{"data-url":"example.com/trackster-data","action-url":"example.com/trackster-action","new-url":"example.com/trackster-new"}}),zeroSize:_.extend(_.clone(mockHistory.data.template),{file_size:0}),hasMetafiles:_.extend(_.clone(mockHistory.data.template),{download_meta_urls:{bam_index:"example.com/bam-index"}}),upload:_.extend(_.clone(mockHistory.data.template),{state:HistoryItem.STATES.UPLOAD}),queued:_.extend(_.clone(mockHistory.data.template),{state:HistoryItem.STATES.QUEUED}),running:_.extend(_.clone(mockHistory.data.template),{state:HistoryItem.STATES.RUNNING}),empty:_.extend(_.clone(mockHistory.data.template),{state:HistoryItem.STATES.EMPTY}),error:_.extend(_.clone(mockHistory.data.template),{state:HistoryItem.STATES.ERROR,report_error_url:"example.com/report_err"}),discarded:_.extend(_.clone(mockHistory.data.template),{state:HistoryItem.STATES.DISCARDED}),setting_metadata:_.extend(_.clone(mockHistory.data.template),{state:HistoryItem.STATES.SETTING_METADATA}),failed_metadata:_.extend(_.clone(mockHistory.data.template),{state:HistoryItem.STATES.FAILED_METADATA})});$(document).ready(function(){mockHistory.items={};mockHistory.views={};for(key in mockHistory.data){mockHistory.items[key]=new HistoryItem(mockHistory.data[key]);mockHistory.items[key].set("name",key);mockHistory.views[key]=new HistoryItemView({model:mockHistory.items[key]});$("body").append(mockHistory.views[key].render())}})};
\ No newline at end of file
diff -r 6aadac8026cb55844a0e8e49360ad30a9f6d0a25 -r 802b87d6491087f6e82d8490d0d603b7affc3491 static/scripts/packed/mvc/tags.js
--- /dev/null
+++ b/static/scripts/packed/mvc/tags.js
@@ -0,0 +1,1 @@
+var Tag=BaseModel.extend(LoggableMixin).extend({logger:console,defaults:{id:null,itemClass:null},toString:function(){return"Tag()"}});var TagView=BaseView.extend(LoggableMixin).extend({logger:console,toString:function(){return"TagView()"}});var TagCollection=Backbone.Collection.extend(LoggableMixin).extend({model:Tag,logger:console,toString:function(){return"TagCollection()"}});var TagList=BaseView.extend(LoggableMixin).extend({logger:console,toString:function(){return"TagList()"}});
\ No newline at end of file
diff -r 6aadac8026cb55844a0e8e49360ad30a9f6d0a25 -r 802b87d6491087f6e82d8490d0d603b7affc3491 static/scripts/packed/templates/compiled/helpers-common-templates.js
--- /dev/null
+++ b/static/scripts/packed/templates/compiled/helpers-common-templates.js
@@ -0,0 +1,1 @@
+Handlebars.registerPartial("clearFloatDiv",function(a){return'<div class="clear"></div>'});Handlebars.registerPartial("iconButton",function(c,b){var a="";a+=(c.enabled)?("<a"):("<span");if(c.title){c.buffer+=' title="'+c.title+'"'}a+=' class="icon-button';if(c.isMenuButton){a+=" menu-button"}if(c.title){a+=" tooltip"}a+=" "+c.icon_class;if(!c.enabled){a+="_disabled"}a+='"';if(c.id){a+=' id="'+c.id+'"'}a+=' href="'+((c.href)?(c.href):("javascript:void(0);"))+'"';if(c.target){a+=' target="'+c.target+'"'}if(!c.visible){a+=' style="display: none;"'}a+=">Bler"+((c.enabled)?("</a>"):("</span>"));return a});Handlebars.registerHelper("warningmessagesmall",function(a){return'<div class="warningmessagesmall"><strong>'+a.fn(this)+"</strong></div>"});
\ No newline at end of file
diff -r 6aadac8026cb55844a0e8e49360ad30a9f6d0a25 -r 802b87d6491087f6e82d8490d0d603b7affc3491 static/scripts/packed/templates/compiled/template-history-hdaSummary.js
--- /dev/null
+++ b/static/scripts/packed/templates/compiled/template-history-hdaSummary.js
@@ -0,0 +1,1 @@
+(function(){var b=Handlebars.template,a=Handlebars.templates=Handlebars.templates||{};a["template-history-hdaSummary"]=b(function(g,n,f,m,l){f=f||g.helpers;var j="",d,i,h="function",k=this.escapeExpression,o=this;function e(t,s){var q="",r,p;q+='\n <a href="';p=f.edit_url;if(p){r=p.call(t,{hash:{}})}else{r=t.edit_url;r=typeof r===h?r():r}q+=k(r)+'" target="galaxy_main">';p=f.metadata_dbkey;if(p){r=p.call(t,{hash:{}})}else{r=t.metadata_dbkey;r=typeof r===h?r():r}q+=k(r)+"</a>\n";return q}function c(t,s){var q="",r,p;q+='\n <span class="';p=f.metadata_dbkey;if(p){r=p.call(t,{hash:{}})}else{r=t.metadata_dbkey;r=typeof r===h?r():r}q+=k(r)+'">';p=f.metadata_dbkey;if(p){r=p.call(t,{hash:{}})}else{r=t.metadata_dbkey;r=typeof r===h?r():r}q+=k(r)+"</span>\n";return q}i=f.misc_blurb;if(i){d=i.call(n,{hash:{}})}else{d=n.misc_blurb;d=typeof d===h?d():d}j+=k(d)+'<br />\nformat: <span class="';i=f.data_type;if(i){d=i.call(n,{hash:{}})}else{d=n.data_type;d=typeof d===h?d():d}j+=k(d)+'">';i=f.data_type;if(i){d=i.call(n,{hash:{}})}else{d=n.data_type;d=typeof d===h?d():d}j+=k(d)+"</span>,\ndatabase:\n";d=n.dbkey_unknown_and_editable;d=f["if"].call(n,d,{hash:{},inverse:o.program(3,c,l),fn:o.program(1,e,l)});if(d||d===0){j+=d}return j})})();
\ No newline at end of file
diff -r 6aadac8026cb55844a0e8e49360ad30a9f6d0a25 -r 802b87d6491087f6e82d8490d0d603b7affc3491 static/scripts/packed/templates/compiled/template-history-titleLink.js
--- /dev/null
+++ b/static/scripts/packed/templates/compiled/template-history-titleLink.js
@@ -0,0 +1,1 @@
+(function(){var b=Handlebars.template,a=Handlebars.templates=Handlebars.templates||{};a["template-history-titleLink"]=b(function(e,l,d,k,j){d=d||e.helpers;var h="",c,g,f="function",i=this.escapeExpression;h+='<a href="javascript:void(0);"><span class="historyItemTitle">';g=d.hid;if(g){c=g.call(l,{hash:{}})}else{c=l.hid;c=typeof c===f?c():c}h+=i(c)+": ";g=d.name;if(g){c=g.call(l,{hash:{}})}else{c=l.name;c=typeof c===f?c():c}h+=i(c)+"</span></a>";return h})})();
\ No newline at end of file
diff -r 6aadac8026cb55844a0e8e49360ad30a9f6d0a25 -r 802b87d6491087f6e82d8490d0d603b7affc3491 static/scripts/packed/templates/compiled/template-history-warning-messages.js
--- /dev/null
+++ b/static/scripts/packed/templates/compiled/template-history-warning-messages.js
@@ -0,0 +1,1 @@
+(function(){var b=Handlebars.template,a=Handlebars.templates=Handlebars.templates||{};a["template-history-warning-messages"]=b(function(g,s,q,k,v){q=q||g.helpers;var r="",h,e="function",d=this.escapeExpression,p=this,c=q.blockHelperMissing;function o(z,y){var x,w;w=q.warningmessagesmall;if(w){x=w.call(z,{hash:{},inverse:p.noop,fn:p.program(2,n,y)})}else{x=z.warningmessagesmall;x=typeof x===e?x():x}if(!q.warningmessagesmall){x=c.call(z,x,{hash:{},inverse:p.noop,fn:p.program(2,n,y)})}if(x||x===0){return x}else{return""}}function n(z,y){var w="",x;w+="\n This dataset has been deleted.\n ";x=z.undelete_url;x=q["if"].call(z,x,{hash:{},inverse:p.noop,fn:p.program(3,m,y)});if(x||x===0){w+=x}w+="\n";return w}function m(A,z){var x="",y,w;x+='\n Click <a href="';w=q.undelete_url;if(w){y=w.call(A,{hash:{}})}else{y=A.undelete_url;y=typeof y===e?y():y}x+=d(y)+'" class="historyItemUndelete" id="historyItemUndeleter-';w=q.id;if(w){y=w.call(A,{hash:{}})}else{y=A.id;y=typeof y===e?y():y}x+=d(y)+'"\n target="galaxy_history">here</a> to undelete it\n ';y=A.purge_url;y=q["if"].call(A,y,{hash:{},inverse:p.noop,fn:p.program(4,l,z)});if(y||y===0){x+=y}x+="\n ";return x}function l(A,z){var x="",y,w;x+='\n or <a href="';w=q.purge_url;if(w){y=w.call(A,{hash:{}})}else{y=A.purge_url;y=typeof y===e?y():y}x+=d(y)+'" class="historyItemPurge" id="historyItemPurger-';w=q.id;if(w){y=w.call(A,{hash:{}})}else{y=A.id;y=typeof y===e?y():y}x+=d(y)+'"\n target="galaxy_history">here</a> to immediately remove it from disk\n ';return x}function j(z,y){var x,w;w=q.warningmessagesmall;if(w){x=w.call(z,{hash:{},inverse:p.noop,fn:p.program(7,i,y)})}else{x=z.warningmessagesmall;x=typeof x===e?x():x}if(!q.warningmessagesmall){x=c.call(z,x,{hash:{},inverse:p.noop,fn:p.program(7,i,y)})}if(x||x===0){return x}else{return""}}function i(x,w){return"\n This dataset has been deleted and removed from disk.\n"}function f(z,y){var x,w;w=q.warningmessagesmall;if(w){x=w.call(z,{hash:{},inverse:p.noop,fn:p.program(10,u,y)})}else{x=z.warningmessagesmall;x=typeof x===e?x():x}if(!q.warningmessagesmall){x=c.call(z,x,{hash:{},inverse:p.noop,fn:p.program(10,u,y)})}if(x||x===0){return x}else{return""}}function u(z,y){var w="",x;w+="\n This dataset has been hidden.\n ";x=z.undelete_url;x=q["if"].call(z,x,{hash:{},inverse:p.noop,fn:p.program(11,t,y)});if(x||x===0){w+=x}w+="\n";return w}function t(A,z){var x="",y,w;x+='\n Click <a href="';w=q.unhide_url;if(w){y=w.call(A,{hash:{}})}else{y=A.unhide_url;y=typeof y===e?y():y}x+=d(y)+'" class="historyItemUnhide" id="historyItemUnhider-';w=q.id;if(w){y=w.call(A,{hash:{}})}else{y=A.id;y=typeof y===e?y():y}x+=d(y)+'"\n target="galaxy_history">here</a> to unhide it\n ';return x}h=s.deleted;h=q["if"].call(s,h,{hash:{},inverse:p.noop,fn:p.program(1,o,v)});if(h||h===0){r+=h}r+="\n\n";h=s.purged;h=q["if"].call(s,h,{hash:{},inverse:p.noop,fn:p.program(6,j,v)});if(h||h===0){r+=h}r+="\n\n";h=s.visible;h=q.unless.call(s,h,{hash:{},inverse:p.noop,fn:p.program(9,f,v)});if(h||h===0){r+=h}return r})})();
\ No newline at end of file
diff -r 6aadac8026cb55844a0e8e49360ad30a9f6d0a25 -r 802b87d6491087f6e82d8490d0d603b7affc3491 static/scripts/packed/templates/compiled/template-warningmessagesmall.js
--- /dev/null
+++ b/static/scripts/packed/templates/compiled/template-warningmessagesmall.js
@@ -0,0 +1,1 @@
+(function(){var b=Handlebars.template,a=Handlebars.templates=Handlebars.templates||{};a["template-warningmessagesmall"]=b(function(e,l,d,k,j){d=d||e.helpers;var h="",c,g,f="function",i=this.escapeExpression;h+=' \n <div class="warningmessagesmall"><strong>';g=d.warning;if(g){c=g.call(l,{hash:{}})}else{c=l.warning;c=typeof c===f?c():c}h+=i(c)+"</strong></div>";return h})})();
\ No newline at end of file
diff -r 6aadac8026cb55844a0e8e49360ad30a9f6d0a25 -r 802b87d6491087f6e82d8490d0d603b7affc3491 static/scripts/packed/viz/circster.js
--- a/static/scripts/packed/viz/circster.js
+++ b/static/scripts/packed/viz/circster.js
@@ -1,1 +1,1 @@
-define(["libs/d3","viz/visualization"],function(d,e){var c=function(){this.initialize&&this.initialize.apply(this,arguments)};c.extend=Backbone.Model.extend;var b=Backbone.View.extend({className:"circster",initialize:function(h){this.total_gap=h.total_gap;this.genome=h.genome;this.dataset_arc_height=h.dataset_arc_height;this.track_gap=5},render:function(){var j=this,l=this.dataset_arc_height,m=j.$el.width(),h=j.$el.height(),k=(Math.min(m,h)/2-this.model.get("tracks").length*(this.dataset_arc_height+this.track_gap));var i=d.select(j.$el[0]).append("svg").attr("width",m).attr("height",h).attr("pointer-events","all").append("svg:g").call(d.behavior.zoom().on("zoom",function(){i.attr("transform","translate("+d.event.translate+") scale("+d.event.scale+")")})).attr("transform","translate("+m/2+","+h/2+")").append("svg:g");this.model.get("tracks").each(function(n,p){var q=n.get("genome_wide_data"),r=k+p*(l+j.track_gap),o=(q instanceof e.GenomeWideBigWigData?f:CircsterSummaryTreeTrackRenderer);track_renderer=new o({track:n,radius_start:r,radius_end:r+l,genome:j.genome,total_gap:j.total_gap});track_renderer.render(i)})}});var a=c.extend({initialize:function(h){this.options=h},render:function(i){genome_arcs=this.chroms_layout(),chroms_arcs=this.genome_data_layout();var n=this.options.radius_start,l=this.options.radius_end,o=i.append("g").attr("id","inner-arc"),m=d.svg.arc().innerRadius(n).outerRadius(l),h=o.selectAll("#inner-arc>path").data(genome_arcs).enter().append("path").attr("d",m).style("stroke","#ccc").style("fill","#ccc").append("title").text(function(p){return p.data.chrom});var j=this.options.track.get("prefs"),k=j.block_color;_.each(chroms_arcs,function(p){if(!p){return}var s=i.append("g"),r=d.svg.arc().innerRadius(n),q=s.selectAll("path").data(p).enter();q.append("path").attr("d",r).style("stroke",k)})},chroms_layout:function(){var i=this.options.genome.get_chroms_info(),k=d.layout.pie().value(function(m){return m.len}).sort(null),l=k(i),h=this.options.total_gap/i.length,j=_.map(l,function(o,n){var m=o.endAngle-h;o.endAngle=(m>o.startAngle?m:o.startAngle);return o});return j},chrom_data_layout:function(k,j,i,l,h){},genome_data_layout:function(){var i=this,h=this.chroms_layout(),m=this.options.track.get("genome_wide_data"),l=this.options.radius_start,j=this.options.radius_end,k=_.zip(h,m.get("data")),n=_.map(k,function(p){var q=p[0],o=p[1];return i.chrom_data_layout(q,o,l,j,m.get("min"),m.get("max"))});return n}});var g=a.extend({chrom_data_layout:function(r,i,o,n,k,p){if(!i||typeof i==="string"){return null}var l=i[0],q=i[3],j=d.scale.linear().domain([k,p]).range([o,n]),m=d.layout.pie().value(function(s){return q}).startAngle(r.startAngle).endAngle(r.endAngle),h=m(l);_.each(l,function(s,t){h[t].outerRadius=j(s[1])});return h}});var f=a.extend({chrom_data_layout:function(q,i,o,n,k,p){var l=i.data;if(l.length===0){return}var j=d.scale.linear().domain([k,p]).range([o,n]),m=d.layout.pie().value(function(s,r){if(r+1===l.length){return 0}return l[r+1][0]-l[r][0]}).startAngle(q.startAngle).endAngle(q.endAngle),h=m(l);_.each(l,function(r,s){h[s].outerRadius=j(r[1])});return h}});return{CircsterView:b}});
\ No newline at end of file
+define(["libs/d3","viz/visualization"],function(e,f){var d=function(){this.initialize&&this.initialize.apply(this,arguments)};d.extend=Backbone.Model.extend;var c=Backbone.View.extend({className:"circster",initialize:function(h){this.total_gap=h.total_gap;this.genome=h.genome;this.dataset_arc_height=h.dataset_arc_height;this.track_gap=5},render:function(){var j=this,l=this.dataset_arc_height,m=j.$el.width(),h=j.$el.height(),k=(Math.min(m,h)/2-this.model.get("tracks").length*(this.dataset_arc_height+this.track_gap));var i=e.select(j.$el[0]).append("svg").attr("width",m).attr("height",h).attr("pointer-events","all").append("svg:g").call(e.behavior.zoom().on("zoom",function(){i.attr("transform","translate("+e.event.translate+") scale("+e.event.scale+")")})).attr("transform","translate("+m/2+","+h/2+")").append("svg:g");this.model.get("tracks").each(function(n,p){var q=n.get("genome_wide_data"),s=k+p*(l+j.track_gap),o=(q instanceof f.GenomeWideBigWigData?g:a);var r=new o({track:n,radius_start:s,radius_end:s+l,genome:j.genome,total_gap:j.total_gap});r.render(i)})}});var b=d.extend({initialize:function(h){this.options=h},render:function(m){var h=this.chroms_layout(),k=this.genome_data_layout();var n=this.options.radius_start,j=this.options.radius_end,p=m.append("g").attr("id","inner-arc"),o=e.svg.arc().innerRadius(n).outerRadius(j),i=p.selectAll("#inner-arc>path").data(h).enter().append("path").attr("d",o).style("stroke","#ccc").style("fill","#ccc").append("title").text(function(r){return r.data.chrom});var q=this.options.track.get("prefs"),l=q.block_color;_.each(k,function(r){if(!r){return}var u=m.append("g"),t=e.svg.arc().innerRadius(n),s=u.selectAll("path").data(r).enter();s.append("path").attr("d",t).style("stroke",l)})},chroms_layout:function(){var i=this.options.genome.get_chroms_info(),k=e.layout.pie().value(function(m){return m.len}).sort(null),l=k(i),h=this.options.total_gap/i.length,j=_.map(l,function(o,n){var m=o.endAngle-h;o.endAngle=(m>o.startAngle?m:o.startAngle);return o});return j},chrom_data_layout:function(k,j,i,l,h){},genome_data_layout:function(){var i=this,h=this.chroms_layout(),m=this.options.track.get("genome_wide_data"),l=this.options.radius_start,j=this.options.radius_end,k=_.zip(h,m.get("data")),n=_.map(k,function(p){var q=p[0],o=p[1];return i.chrom_data_layout(q,o,l,j,m.get("min"),m.get("max"))});return n}});var a=b.extend({chrom_data_layout:function(r,i,o,n,k,p){if(!i||typeof i==="string"){return null}var l=i[0],q=i[3],j=e.scale.linear().domain([k,p]).range([o,n]),m=e.layout.pie().value(function(s){return q}).startAngle(r.startAngle).endAngle(r.endAngle),h=m(l);_.each(l,function(s,t){h[t].outerRadius=j(s[1])});return h}});var g=b.extend({chrom_data_layout:function(q,i,o,n,k,p){var l=i.data;if(l.length===0){return}var j=e.scale.linear().domain([k,p]).range([o,n]),m=e.layout.pie().value(function(s,r){if(r+1===l.length){return 0}return l[r+1][0]-l[r][0]}).startAngle(q.startAngle).endAngle(q.endAngle),h=m(l);_.each(l,function(r,s){h[s].outerRadius=j(r[1])});return h}});return{CircsterView:c}});
\ No newline at end of file
diff -r 6aadac8026cb55844a0e8e49360ad30a9f6d0a25 -r 802b87d6491087f6e82d8490d0d603b7affc3491 static/scripts/packed/viz/visualization.js
--- a/static/scripts/packed/viz/visualization.js
+++ b/static/scripts/packed/viz/visualization.js
@@ -1,1 +1,1 @@
-var ServerStateDeferred=Backbone.Model.extend({defaults:{ajax_settings:{},interval:1000,success_fn:function(a){return true}},go:function(){var d=$.Deferred(),c=this,f=c.get("ajax_settings"),e=c.get("success_fn"),b=c.get("interval"),a=function(){$.ajax(f).success(function(g){if(e(g)){d.resolve(g)}else{setTimeout(a,b)}})};a();return d}});var CanvasManager=function(a){this.default_font=a!==undefined?a:"9px Monaco, Lucida Console, monospace";this.dummy_canvas=this.new_canvas();this.dummy_context=this.dummy_canvas.getContext("2d");this.dummy_context.font=this.default_font;this.char_width_px=this.dummy_context.measureText("A").width;this.patterns={};this.load_pattern("right_strand","/visualization/strand_right.png");this.load_pattern("left_strand","/visualization/strand_left.png");this.load_pattern("right_strand_inv","/visualization/strand_right_inv.png");this.load_pattern("left_strand_inv","/visualization/strand_left_inv.png")};_.extend(CanvasManager.prototype,{load_pattern:function(a,e){var b=this.patterns,c=this.dummy_context,d=new Image();d.src=galaxy_paths.attributes.image_path+e;d.onload=function(){b[a]=c.createPattern(d,"repeat")}},get_pattern:function(a){return this.patterns[a]},new_canvas:function(){var a=$("<canvas/>")[0];if(window.G_vmlCanvasManager){G_vmlCanvasManager.initElement(a)}a.manager=this;return a}});var Cache=Backbone.Model.extend({defaults:{num_elements:20,obj_cache:null,key_ary:null},initialize:function(a){this.clear()},get_elt:function(b){var c=this.attributes.obj_cache,d=this.attributes.key_ary,a=d.indexOf(b);if(a!==-1){if(c[b].stale){d.splice(a,1);delete c[b]}else{this.move_key_to_end(b,a)}}return c[b]},set_elt:function(b,d){var e=this.attributes.obj_cache,f=this.attributes.key_ary,c=this.attributes.num_elements;if(!e[b]){if(f.length>=c){var a=f.shift();delete e[a]}f.push(b)}e[b]=d;return d},move_key_to_end:function(b,a){this.attributes.key_ary.splice(a,1);this.attributes.key_ary.push(b)},clear:function(){this.attributes.obj_cache={};this.attributes.key_ary=[]},size:function(){return this.attributes.key_ary.length}});var GenomeDataManager=Cache.extend({defaults:_.extend({},Cache.prototype.defaults,{dataset:null,filters_manager:null,data_url:null,dataset_state_url:null,feature_search_url:null,genome_wide_summary_data:null,data_mode_compatible:function(a,b){return true},can_subset:function(a){return false}}),data_is_ready:function(){var c=this.get("dataset"),b=$.Deferred(),a=new ServerStateDeferred({ajax_settings:{url:this.get("dataset_state_url"),data:{dataset_id:c.id,hda_ldda:c.get("hda_ldda")},dataType:"json"},interval:5000,success_fn:function(d){return d!=="pending"}});$.when(a.go()).then(function(d){b.resolve(d==="ok"||d==="data")});return b},search_features:function(a){var b=this.get("dataset"),c={query:a,dataset_id:b.id,hda_ldda:b.get("hda_ldda")};return $.getJSON(this.get("feature_search_url"),c)},load_data:function(j,h,b,g){var d={chrom:j.get("chrom"),low:j.get("start"),high:j.get("end"),mode:h,resolution:b},e=this.get("dataset");if(e){d.dataset_id=e.id;d.hda_ldda=e.get("hda_ldda")}$.extend(d,g);var k=this.get("filters_manager");if(k){var l=[];var a=k.filters;for(var f=0;f<a.length;f++){l.push(a[f].name)}d.filter_cols=JSON.stringify(l)}var c=this;return $.getJSON(this.get("data_url"),d,function(i){c.set_data(j,i)})},get_data:function(g,f,c,e){var h=this.get_elt(g);if(h&&(is_deferred(h)||this.get("data_mode_compatible")(h,f))){return h}var j=this.get("key_ary"),b=this.get("obj_cache"),k,a;for(var d=0;d<j.length;d++){k=j[d];a=new GenomeRegion({from_str:k});if(a.contains(g)){h=b[k];if(is_deferred(h)||(this.get("data_mode_compatible")(h,f)&&this.get("can_subset")(h))){this.move_key_to_end(k,d);return h}}}h=this.load_data(g,f,c,e);this.set_data(g,h);return h},set_data:function(b,a){this.set_elt(b,a)},DEEP_DATA_REQ:"deep",BROAD_DATA_REQ:"breadth",get_more_data:function(i,h,d,g,e){var k=this.get_elt(i);if(!(k&&this.get("data_mode_compatible")(k,h))){console.log("ERROR: no current data for: ",dataset,i.toString(),h,d,g);return}k.stale=true;var c=i.get("start");if(e===this.DEEP_DATA_REQ){$.extend(g,{start_val:k.data.length+1})}else{if(e===this.BROAD_DATA_REQ){c=(k.max_high?k.max_high:k.data[k.data.length-1][2])+1}}var j=i.copy().set("start",c);var b=this,f=this.load_data(j,h,d,g),a=$.Deferred();this.set_data(i,a);$.when(f).then(function(l){if(l.data){l.data=k.data.concat(l.data);if(l.max_low){l.max_low=k.max_low}if(l.message){l.message=l.message.replace(/[0-9]+/,l.data.length)}}b.set_data(i,l);a.resolve(l)});return a},get_elt:function(a){return Cache.prototype.get_elt.call(this,a.toString())},set_elt:function(b,a){return Cache.prototype.set_elt.call(this,b.toString(),a)}});var ReferenceTrackDataManager=GenomeDataManager.extend({load_data:function(a,d,e,b,c){if(b>1){return{data:null}}return GenomeDataManager.prototype.load_data.call(this,a,d,e,b,c)}});var Genome=Backbone.Model.extend({defaults:{name:null,key:null,chroms_info:null},get_chroms_info:function(){return this.attributes.chroms_info.chrom_info}});var GenomeRegion=Backbone.RelationalModel.extend({defaults:{chrom:null,start:0,end:0,DIF_CHROMS:1000,BEFORE:1001,CONTAINS:1002,OVERLAP_START:1003,OVERLAP_END:1004,CONTAINED_BY:1005,AFTER:1006},initialize:function(b){if(b.from_str){var d=b.from_str.split(":"),c=d[0],a=d[1].split("-");this.set({chrom:c,start:parseInt(a[0],10),end:parseInt(a[1],10)})}},copy:function(){return new GenomeRegion({chrom:this.get("chrom"),start:this.get("start"),end:this.get("end")})},length:function(){return this.get("end")-this.get("start")},toString:function(){return this.get("chrom")+":"+this.get("start")+"-"+this.get("end")},toJSON:function(){return{chrom:this.get("chrom"),start:this.get("start"),end:this.get("end")}},compute_overlap:function(h){var b=this.get("chrom"),g=h.get("chrom"),f=this.get("start"),d=h.get("start"),e=this.get("end"),c=h.get("end"),a;if(b&&g&&b!==g){return this.get("DIF_CHROMS")}if(f<d){if(e<d){a=this.get("BEFORE")}else{if(e<=c){a=this.get("OVERLAP_START")}else{a=this.get("CONTAINS")}}}else{if(f>c){a=this.get("AFTER")}else{if(e<=c){a=this.get("CONTAINED_BY")}else{a=this.get("OVERLAP_END")}}}return a},contains:function(a){return this.compute_overlap(a)===this.get("CONTAINS")},overlaps:function(a){return _.intersection([this.compute_overlap(a)],[this.get("DIF_CHROMS"),this.get("BEFORE"),this.get("AFTER")]).length===0}});var GenomeRegionCollection=Backbone.Collection.extend({model:GenomeRegion});var BrowserBookmark=Backbone.RelationalModel.extend({defaults:{region:null,note:""},relations:[{type:Backbone.HasOne,key:"region",relatedModel:"GenomeRegion"}]});var BrowserBookmarkCollection=Backbone.Collection.extend({model:BrowserBookmark});var GenomeWideBigWigData=Backbone.Model.extend({defaults:{data:null,min:0,max:0},initialize:function(b){var a=_.flatten(_.map(this.get("data"),function(c){if(c.data.length!==0){return _.map(c.data,function(d){return d[1]})}else{return 0}}));this.set("max",_.max(a));this.set("min",_.min(a))}});var GenomeWideSummaryTreeData=Backbone.RelationalModel.extend({defaults:{data:null,min:0,max:0},initialize:function(b){var a=_.max(this.get("data"),function(c){if(!c||typeof c==="string"){return 0}return c[1]});this.attributes.max=(a&&typeof a!=="string"?a[1]:0)}});var BackboneTrack=Dataset.extend({initialize:function(a){this.set("id",a.dataset_id);var c=this.get("genome_wide_data");if(c){var b=(this.get("track_type")==="LineTrack"?GenomeWideBigWigData:GenomeWideSummaryTreeData);this.set("genome_wide_data",new b(c))}}});var Visualization=Backbone.RelationalModel.extend({defaults:{id:"",title:"",type:"",dbkey:"",tracks:null},relations:[{type:Backbone.HasMany,key:"tracks",relatedModel:"BackboneTrack"}],url:function(){return galaxy_paths.get("visualization_url")},save:function(){return $.ajax({url:this.url(),type:"POST",dataType:"json",data:{vis_json:JSON.stringify(this)}})}});var GenomeVisualization=Visualization.extend({defaults:_.extend({},Visualization.prototype.defaults,{bookmarks:null,viewport:null})});var TrackConfig=Backbone.Model.extend({});var CircsterDataLayout=Backbone.Model.extend({defaults:{genome:null,dataset:null,total_gap:null},chroms_layout:function(){var b=this.attributes.genome.get_chroms_info(),d=d3.layout.pie().value(function(f){return f.len}).sort(null),e=d(b),a=this.attributes.total_gap/b.length,c=_.map(e,function(h,g){var f=h.endAngle-a;h.endAngle=(f>h.startAngle?f:h.startAngle);return h});return c},chrom_data_layout:function(d,c,b,e,a){},genome_data_layout:function(){var b=this,a=this.chroms_layout(),f=this.get("track").get("genome_wide_data"),e=this.get("radius_start"),c=this.get("radius_end"),d=_.zip(a,f.get("data")),g=_.map(d,function(i){var j=i[0],h=i[1];return b.chrom_data_layout(j,h,e,c,f.get("min"),f.get("max"))});return g}});var CircsterSummaryTreeLayout=CircsterDataLayout.extend({chrom_data_layout:function(k,b,h,g,d,i){if(!b||typeof b==="string"){return null}var e=b[0],j=b[3],c=d3.scale.linear().domain([d,i]).range([h,g]),f=d3.layout.pie().value(function(l){return j}).startAngle(k.startAngle).endAngle(k.endAngle),a=f(e);_.each(e,function(l,m){a[m].outerRadius=c(l[1])});return a}});var CircsterBigWigLayout=CircsterDataLayout.extend({chrom_data_layout:function(j,b,h,g,d,i){var e=b.data;if(e.length===0){return}var c=d3.scale.linear().domain([d,i]).range([h,g]),f=d3.layout.pie().value(function(l,k){if(k+1===e.length){return 0}return e[k+1][0]-e[k][0]}).startAngle(j.startAngle).endAngle(j.endAngle),a=f(e);_.each(e,function(k,l){a[l].outerRadius=c(k[1])});return a}});var CircsterView=Backbone.View.extend({className:"circster",initialize:function(a){this.total_gap=a.total_gap;this.genome=a.genome;this.dataset_arc_height=a.dataset_arc_height;this.track_gap=5},render:function(){var c=this,e=this.dataset_arc_height,f=c.$el.width(),a=c.$el.height(),d=(Math.min(f,a)/2-this.model.get("tracks").length*(this.dataset_arc_height+this.track_gap));var b=d3.select(c.$el[0]).append("svg").attr("width",f).attr("height",a).attr("pointer-events","all").append("svg:g").call(d3.behavior.zoom().on("zoom",function(){b.attr("transform","translate("+d3.event.translate+") scale("+d3.event.scale+")")})).attr("transform","translate("+f/2+","+a/2+")").append("svg:g");this.model.get("tracks").each(function(i,o){var j=i.get("genome_wide_data"),n=d+o*(e+c.track_gap),k=(j instanceof GenomeWideBigWigData?CircsterBigWigLayout:CircsterSummaryTreeLayout),q=new k({track:i,radius_start:n,radius_end:n+e,genome:c.genome,total_gap:c.total_gap}),g=q.chroms_layout(),l=q.genome_data_layout();var r=b.append("g").attr("id","inner-arc"),p=d3.svg.arc().innerRadius(n).outerRadius(n+e),h=r.selectAll("#inner-arc>path").data(g).enter().append("path").attr("d",p).style("stroke","#ccc").style("fill","#ccc").append("title").text(function(t){return t.data.chrom});var s=i.get("prefs"),m=s.block_color;_.each(l,function(t){if(!t){return}var w=b.append("g"),v=d3.svg.arc().innerRadius(n),u=w.selectAll("path").data(t).enter().append("path").attr("d",v).style("stroke",m).style("fill",m)})})}});var TrackBrowserRouter=Backbone.Router.extend({initialize:function(b){this.view=b.view;this.route(/([\w]+)$/,"change_location");this.route(/([\w]+\:[\d,]+-[\d,]+)$/,"change_location");var a=this;a.view.on("navigate",function(c){a.navigate(c)})},change_location:function(a){this.view.go_to(a)}});var add_datasets=function(a,c,b){$.ajax({url:a,data:{"f-dbkey":view.dbkey},error:function(){alert("Grid failed")},success:function(d){show_modal("Select datasets for new tracks",d,{Cancel:function(){hide_modal()},Add:function(){var e=[];$("input[name=id]:checked,input[name=ldda_ids]:checked").each(function(){var f,g=$(this).val();if($(this).attr("name")==="id"){f={hda_id:g}}else{f={ldda_id:g}}e[e.length]=$.ajax({url:c,data:f,dataType:"json"})});$.when.apply($,e).then(function(){var f=(arguments[0] instanceof Array?$.map(arguments,function(g){return g[0]}):[arguments[0]]);b(f)});hide_modal()}})}})};
\ No newline at end of file
+(function(){var f=Backbone.Model.extend({defaults:{ajax_settings:{},interval:1000,success_fn:function(t){return true}},go:function(){var w=$.Deferred(),v=this,y=v.get("ajax_settings"),x=v.get("success_fn"),u=v.get("interval"),t=function(){$.ajax(y).success(function(z){if(x(z)){w.resolve(z)}else{setTimeout(t,u)}})};t();return w}});var g=function(t){this.default_font=t!==undefined?t:"9px Monaco, Lucida Console, monospace";this.dummy_canvas=this.new_canvas();this.dummy_context=this.dummy_canvas.getContext("2d");this.dummy_context.font=this.default_font;this.char_width_px=this.dummy_context.measureText("A").width;this.patterns={};this.load_pattern("right_strand","/visualization/strand_right.png");this.load_pattern("left_strand","/visualization/strand_left.png");this.load_pattern("right_strand_inv","/visualization/strand_right_inv.png");this.load_pattern("left_strand_inv","/visualization/strand_left_inv.png")};_.extend(g.prototype,{load_pattern:function(t,x){var u=this.patterns,v=this.dummy_context,w=new Image();w.src=galaxy_paths.attributes.image_path+x;w.onload=function(){u[t]=v.createPattern(w,"repeat")}},get_pattern:function(t){return this.patterns[t]},new_canvas:function(){var t=$("<canvas/>")[0];if(window.G_vmlCanvasManager){G_vmlCanvasManager.initElement(t)}t.manager=this;return t}});var p=Backbone.Model.extend({defaults:{num_elements:20,obj_cache:null,key_ary:null},initialize:function(t){this.clear()},get_elt:function(u){var v=this.attributes.obj_cache,w=this.attributes.key_ary,t=w.indexOf(u);if(t!==-1){if(v[u].stale){w.splice(t,1);delete v[u]}else{this.move_key_to_end(u,t)}}return v[u]},set_elt:function(u,w){var x=this.attributes.obj_cache,y=this.attributes.key_ary,v=this.attributes.num_elements;if(!x[u]){if(y.length>=v){var t=y.shift();delete x[t]}y.push(u)}x[u]=w;return w},move_key_to_end:function(u,t){this.attributes.key_ary.splice(t,1);this.attributes.key_ary.push(u)},clear:function(){this.attributes.obj_cache={};this.attributes.key_ary=[]},size:function(){return this.attributes.key_ary.length}});var d=p.extend({defaults:_.extend({},p.prototype.defaults,{dataset:null,filters_manager:null,data_url:null,dataset_state_url:null,feature_search_url:null,genome_wide_summary_data:null,data_mode_compatible:function(t,u){return true},can_subset:function(t){return false}}),data_is_ready:function(){var v=this.get("dataset"),u=$.Deferred(),t=new f({ajax_settings:{url:this.get("dataset_state_url"),data:{dataset_id:v.id,hda_ldda:v.get("hda_ldda")},dataType:"json"},interval:5000,success_fn:function(w){return w!=="pending"}});$.when(t.go()).then(function(w){u.resolve(w==="ok"||w==="data")});return u},search_features:function(t){var u=this.get("dataset"),v={query:t,dataset_id:u.id,hda_ldda:u.get("hda_ldda")};return $.getJSON(this.get("feature_search_url"),v)},load_data:function(B,A,u,z){var w={chrom:B.get("chrom"),low:B.get("start"),high:B.get("end"),mode:A,resolution:u},x=this.get("dataset");if(x){w.dataset_id=x.id;w.hda_ldda=x.get("hda_ldda")}$.extend(w,z);var C=this.get("filters_manager");if(C){var D=[];var t=C.filters;for(var y=0;y<t.length;y++){D.push(t[y].name)}w.filter_cols=JSON.stringify(D)}var v=this;return $.getJSON(this.get("data_url"),w,function(E){v.set_data(B,E)})},get_data:function(z,y,v,x){var A=this.get_elt(z);if(A&&(is_deferred(A)||this.get("data_mode_compatible")(A,y))){return A}var B=this.get("key_ary"),u=this.get("obj_cache"),C,t;for(var w=0;w<B.length;w++){C=B[w];t=new h({from_str:C});if(t.contains(z)){A=u[C];if(is_deferred(A)||(this.get("data_mode_compatible")(A,y)&&this.get("can_subset")(A))){this.move_key_to_end(C,w);return A}}}A=this.load_data(z,y,v,x);this.set_data(z,A);return A},set_data:function(u,t){this.set_elt(u,t)},DEEP_DATA_REQ:"deep",BROAD_DATA_REQ:"breadth",get_more_data:function(B,A,w,z,x){var D=this.get_elt(B);if(!(D&&this.get("data_mode_compatible")(D,A))){console.log("ERROR: no current data for: ",dataset,B.toString(),A,w,z);return}D.stale=true;var v=B.get("start");if(x===this.DEEP_DATA_REQ){$.extend(z,{start_val:D.data.length+1})}else{if(x===this.BROAD_DATA_REQ){v=(D.max_high?D.max_high:D.data[D.data.length-1][2])+1}}var C=B.copy().set("start",v);var u=this,y=this.load_data(C,A,w,z),t=$.Deferred();this.set_data(B,t);$.when(y).then(function(E){if(E.data){E.data=D.data.concat(E.data);if(E.max_low){E.max_low=D.max_low}if(E.message){E.message=E.message.replace(/[0-9]+/,E.data.length)}}u.set_data(B,E);t.resolve(E)});return t},get_elt:function(t){return p.prototype.get_elt.call(this,t.toString())},set_elt:function(u,t){return p.prototype.set_elt.call(this,u.toString(),t)}});var n=d.extend({load_data:function(t,w,x,u,v){if(u>1){return{data:null}}return d.prototype.load_data.call(this,t,w,x,u,v)}});var c=Backbone.Model.extend({defaults:{name:null,key:null,chroms_info:null},get_chroms_info:function(){return this.attributes.chroms_info.chrom_info}});var h=Backbone.RelationalModel.extend({defaults:{chrom:null,start:0,end:0,DIF_CHROMS:1000,BEFORE:1001,CONTAINS:1002,OVERLAP_START:1003,OVERLAP_END:1004,CONTAINED_BY:1005,AFTER:1006},initialize:function(u){if(u.from_str){var w=u.from_str.split(":"),v=w[0],t=w[1].split("-");this.set({chrom:v,start:parseInt(t[0],10),end:parseInt(t[1],10)})}},copy:function(){return new h({chrom:this.get("chrom"),start:this.get("start"),end:this.get("end")})},length:function(){return this.get("end")-this.get("start")},toString:function(){return this.get("chrom")+":"+this.get("start")+"-"+this.get("end")},toJSON:function(){return{chrom:this.get("chrom"),start:this.get("start"),end:this.get("end")}},compute_overlap:function(A){var u=this.get("chrom"),z=A.get("chrom"),y=this.get("start"),w=A.get("start"),x=this.get("end"),v=A.get("end"),t;if(u&&z&&u!==z){return this.get("DIF_CHROMS")}if(y<w){if(x<w){t=this.get("BEFORE")}else{if(x<=v){t=this.get("OVERLAP_START")}else{t=this.get("CONTAINS")}}}else{if(y>v){t=this.get("AFTER")}else{if(x<=v){t=this.get("CONTAINED_BY")}else{t=this.get("OVERLAP_END")}}}return t},contains:function(t){return this.compute_overlap(t)===this.get("CONTAINS")},overlaps:function(t){return _.intersection([this.compute_overlap(t)],[this.get("DIF_CHROMS"),this.get("BEFORE"),this.get("AFTER")]).length===0}});var l=Backbone.Collection.extend({model:h});var e=Backbone.RelationalModel.extend({defaults:{region:null,note:""},relations:[{type:Backbone.HasOne,key:"region",relatedModel:h}]});var q=Backbone.Collection.extend({model:e});var b=Backbone.Model.extend({defaults:{data:null,min:0,max:0},initialize:function(u){var t=_.flatten(_.map(this.get("data"),function(v){if(v.data.length!==0){return _.map(v.data,function(w){return w[1]})}else{return 0}}));this.set("max",_.max(t));this.set("min",_.min(t))}});var m=Backbone.RelationalModel.extend({defaults:{data:null,min:0,max:0},initialize:function(u){var t=_.max(this.get("data"),function(v){if(!v||typeof v==="string"){return 0}return v[1]});this.attributes.max=(t&&typeof t!=="string"?t[1]:0)}});var s=Dataset.extend({initialize:function(t){this.set("id",t.dataset_id);var v=this.get("genome_wide_data");if(v){var u=(this.get("track_type")==="LineTrack"?b:m);this.set("genome_wide_data",new u(v))}}});var o=Backbone.RelationalModel.extend({defaults:{id:"",title:"",type:"",dbkey:"",tracks:null},relations:[{type:Backbone.HasMany,key:"tracks",relatedModel:s}],url:function(){return galaxy_paths.get("visualization_url")},save:function(){return $.ajax({url:this.url(),type:"POST",dataType:"json",data:{vis_json:JSON.stringify(this)}})}});var k=o.extend({defaults:_.extend({},o.prototype.defaults,{bookmarks:null,viewport:null})});var a=Backbone.Model.extend({});var i=Backbone.Router.extend({initialize:function(u){this.view=u.view;this.route(/([\w]+)$/,"change_location");this.route(/([\w]+\:[\d,]+-[\d,]+)$/,"change_location");var t=this;t.view.on("navigate",function(v){t.navigate(v)})},change_location:function(t){this.view.go_to(t)}});var j=function(t,v,u){$.ajax({url:t,data:{"f-dbkey":view.dbkey},error:function(){alert("Grid failed")},success:function(w){show_modal("Select datasets for new tracks",w,{Cancel:function(){hide_modal()},Add:function(){var x=[];$("input[name=id]:checked,input[name=ldda_ids]:checked").each(function(){var y,z=$(this).val();if($(this).attr("name")==="id"){y={hda_id:z}}else{y={ldda_id:z}}x[x.length]=$.ajax({url:v,data:y,dataType:"json"})});$.when.apply($,x).then(function(){var y=(arguments[0] instanceof Array?$.map(arguments,function(z){return z[0]}):[arguments[0]]);u(y)});hide_modal()}})}})};var r=(function(){if(typeof module!=="undefined"&&module.exports){return module.exports}else{if(typeof define==="function"&&define.amd){r={};define(function(){return r});return r}else{return window}}})();r.BrowserBookmark=e;r.BrowserBookmarkCollection=q;r.Cache=p;r.CanvasManager=g;r.Genome=c;r.GenomeDataManager=d;r.GenomeRegion=h;r.GenomeRegionCollection=l;r.GenomeVisualization=k;r.GenomeWideBigWigData=b;r.GenomeWideSummaryTreeData=m;r.ReferenceTrackDataManager=n;r.ServerStateDeferred=f;r.TrackBrowserRouter=i;r.TrackConfig=a;r.Visualization=o;r.add_datasets=j}).call(this);
\ No newline at end of file
diff -r 6aadac8026cb55844a0e8e49360ad30a9f6d0a25 -r 802b87d6491087f6e82d8490d0d603b7affc3491 static/scripts/templates/common-templates.html
--- a/static/scripts/templates/common-templates.html
+++ b/static/scripts/templates/common-templates.html
@@ -1,3 +1,50 @@
+<script type="text/javascript" class="helper-common" id="helper-clearFloatDiv">
+/** Hack div to clear re-enclose float'd elements above it in the parent div
+ */
+Handlebars.registerPartial( 'clearFloatDiv', function( options ){
+ return '<div class="clear"></div>';
+});
+</script>
+
+<script type="text/javascript" class="helper-common" id="helper-warningmessagesmall">
+/** Renders a warning in a (mostly css) highlighted, iconned warning box
+ */
+Handlebars.registerHelper( 'warningmessagesmall', function( options ){
+ return '<div class="warningmessagesmall"><strong>' + options.fn( this ) + '</strong></div>'
+});
+</script>
+
<script type="text/template" class="template-common" id="template-warningmessagesmall">
- <div class=warningmessagesmall><strong>{{{warning}}}</strong></div>
+{{! renders a warning in a (mostly css) highlighted, iconned warning box }}
+ <div class="warningmessagesmall"><strong>{{ warning }}</strong></div></script>
+
+<script type="text/javascript" class="helper-common" id="helper-iconButton">
+/** Renders a glx style icon-button (see IconButton in mvc/ui.js)
+ * can be used in either of the following ways:
+ * within a template: {{> iconButton buttonData}}
+ * from js: var templated = ( Handlebars.partials.iconButton( buttonData ) );
+ */
+Handlebars.registerPartial( 'iconButton', function( buttonData, options ){
+ var buffer = "";
+ buffer += ( buttonData.enabled )?( '<a' ):( '<span' );
+
+ if( buttonData.title ){ buttonData.buffer += ' title="' + buttonData.title + '"'; }
+
+ buffer += ' class="icon-button';
+ if( buttonData.isMenuButton ){ buffer += ' menu-button'; }
+ if( buttonData.title ){ buffer += ' tooltip'; }
+ buffer += ' ' + buttonData.icon_class;
+ if( !buttonData.enabled ){ buffer += '_disabled'; }
+ buffer += '"';
+
+ if( buttonData.id ){ buffer += ' id="' + buttonData.id + '"'; }
+ buffer += ' href="' + ( ( buttonData.href )?( buttonData.href ):( 'javascript:void(0);' ) ) + '"';
+ if( buttonData.target ){ buffer += ' target="' + buttonData.target + '"'; }
+
+ if( !buttonData.visible ){ buffer += ' style="display: none;"'; }
+
+ buffer += '>Bler' + ( ( buttonData.enabled )?( '</a>' ):( '</span>' ) );
+ return buffer;
+});
+</script>
diff -r 6aadac8026cb55844a0e8e49360ad30a9f6d0a25 -r 802b87d6491087f6e82d8490d0d603b7affc3491 static/scripts/templates/compiled/helpers-common-templates.js
--- /dev/null
+++ b/static/scripts/templates/compiled/helpers-common-templates.js
@@ -0,0 +1,37 @@
+/** Hack div to clear re-enclose float'd elements above it in the parent div
+ */
+Handlebars.registerPartial( 'clearFloatDiv', function( options ){
+ return '<div class="clear"></div>';
+});
+/** Renders a glx style icon-button (see IconButton in mvc/ui.js)
+ * can be used in either of the following ways:
+ * within a template: {{> iconButton buttonData}}
+ * from js: var templated = ( Handlebars.partials.iconButton( buttonData ) );
+ */
+Handlebars.registerPartial( 'iconButton', function( buttonData, options ){
+ var buffer = "";
+ buffer += ( buttonData.enabled )?( '<a' ):( '<span' );
+
+ if( buttonData.title ){ buttonData.buffer += ' title="' + buttonData.title + '"'; }
+
+ buffer += ' class="icon-button';
+ if( buttonData.isMenuButton ){ buffer += ' menu-button'; }
+ if( buttonData.title ){ buffer += ' tooltip'; }
+ buffer += ' ' + buttonData.icon_class;
+ if( !buttonData.enabled ){ buffer += '_disabled'; }
+ buffer += '"';
+
+ if( buttonData.id ){ buffer += ' id="' + buttonData.id + '"'; }
+ buffer += ' href="' + ( ( buttonData.href )?( buttonData.href ):( 'javascript:void(0);' ) ) + '"';
+ if( buttonData.target ){ buffer += ' target="' + buttonData.target + '"'; }
+
+ if( !buttonData.visible ){ buffer += ' style="display: none;"'; }
+
+ buffer += '>Bler' + ( ( buttonData.enabled )?( '</a>' ):( '</span>' ) );
+ return buffer;
+});
+/** Renders a warning in a (mostly css) highlighted, iconned warning box
+ */
+Handlebars.registerHelper( 'warningmessagesmall', function( options ){
+ return '<div class="warningmessagesmall"><strong>' + options.fn( this ) + '</strong></div>'
+});
diff -r 6aadac8026cb55844a0e8e49360ad30a9f6d0a25 -r 802b87d6491087f6e82d8490d0d603b7affc3491 static/scripts/templates/compiled/template-history-hdaSummary.js
--- a/static/scripts/templates/compiled/template-history-hdaSummary.js
+++ b/static/scripts/templates/compiled/template-history-hdaSummary.js
@@ -2,8 +2,35 @@
var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
templates['template-history-hdaSummary'] = template(function (Handlebars,depth0,helpers,partials,data) {
helpers = helpers || Handlebars.helpers;
- var buffer = "", stack1, foundHelper, functionType="function", escapeExpression=this.escapeExpression;
+ var buffer = "", stack1, foundHelper, functionType="function", escapeExpression=this.escapeExpression, self=this;
+function program1(depth0,data) {
+
+ var buffer = "", stack1, foundHelper;
+ buffer += "\n <a href=\"";
+ foundHelper = helpers.edit_url;
+ if (foundHelper) { stack1 = foundHelper.call(depth0, {hash:{}}); }
+ else { stack1 = depth0.edit_url; stack1 = typeof stack1 === functionType ? stack1() : stack1; }
+ buffer += escapeExpression(stack1) + "\" target=\"galaxy_main\">";
+ foundHelper = helpers.metadata_dbkey;
+ if (foundHelper) { stack1 = foundHelper.call(depth0, {hash:{}}); }
+ else { stack1 = depth0.metadata_dbkey; stack1 = typeof stack1 === functionType ? stack1() : stack1; }
+ buffer += escapeExpression(stack1) + "</a>\n";
+ return buffer;}
+
+function program3(depth0,data) {
+
+ var buffer = "", stack1, foundHelper;
+ buffer += "\n <span class=\"";
+ foundHelper = helpers.metadata_dbkey;
+ if (foundHelper) { stack1 = foundHelper.call(depth0, {hash:{}}); }
+ else { stack1 = depth0.metadata_dbkey; stack1 = typeof stack1 === functionType ? stack1() : stack1; }
+ buffer += escapeExpression(stack1) + "\">";
+ foundHelper = helpers.metadata_dbkey;
+ if (foundHelper) { stack1 = foundHelper.call(depth0, {hash:{}}); }
+ else { stack1 = depth0.metadata_dbkey; stack1 = typeof stack1 === functionType ? stack1() : stack1; }
+ buffer += escapeExpression(stack1) + "</span>\n";
+ return buffer;}
foundHelper = helpers.misc_blurb;
if (foundHelper) { stack1 = foundHelper.call(depth0, {hash:{}}); }
@@ -16,10 +43,9 @@
foundHelper = helpers.data_type;
if (foundHelper) { stack1 = foundHelper.call(depth0, {hash:{}}); }
else { stack1 = depth0.data_type; stack1 = typeof stack1 === functionType ? stack1() : stack1; }
- buffer += escapeExpression(stack1) + "</span>, ',\ndatabase: ";
- foundHelper = helpers.dbkeyHTML;
- if (foundHelper) { stack1 = foundHelper.call(depth0, {hash:{}}); }
- else { stack1 = depth0.dbkeyHTML; stack1 = typeof stack1 === functionType ? stack1() : stack1; }
- buffer += escapeExpression(stack1);
+ buffer += escapeExpression(stack1) + "</span>,\ndatabase:\n";
+ stack1 = depth0.dbkey_unknown_and_editable;
+ stack1 = helpers['if'].call(depth0, stack1, {hash:{},inverse:self.program(3, program3, data),fn:self.program(1, program1, data)});
+ if(stack1 || stack1 === 0) { buffer += stack1; }
return buffer;});
})();
\ No newline at end of file
diff -r 6aadac8026cb55844a0e8e49360ad30a9f6d0a25 -r 802b87d6491087f6e82d8490d0d603b7affc3491 static/scripts/templates/compiled/template-history-titleLink.js
--- /dev/null
+++ b/static/scripts/templates/compiled/template-history-titleLink.js
@@ -0,0 +1,18 @@
+(function() {
+ var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
+templates['template-history-titleLink'] = template(function (Handlebars,depth0,helpers,partials,data) {
+ helpers = helpers || Handlebars.helpers;
+ var buffer = "", stack1, foundHelper, functionType="function", escapeExpression=this.escapeExpression;
+
+
+ buffer += "<a href=\"javascript:void(0);\"><span class=\"historyItemTitle\">";
+ foundHelper = helpers.hid;
+ if (foundHelper) { stack1 = foundHelper.call(depth0, {hash:{}}); }
+ else { stack1 = depth0.hid; stack1 = typeof stack1 === functionType ? stack1() : stack1; }
+ buffer += escapeExpression(stack1) + ": ";
+ foundHelper = helpers.name;
+ if (foundHelper) { stack1 = foundHelper.call(depth0, {hash:{}}); }
+ else { stack1 = depth0.name; stack1 = typeof stack1 === functionType ? stack1() : stack1; }
+ buffer += escapeExpression(stack1) + "</span></a>";
+ return buffer;});
+})();
\ No newline at end of file
diff -r 6aadac8026cb55844a0e8e49360ad30a9f6d0a25 -r 802b87d6491087f6e82d8490d0d603b7affc3491 static/scripts/templates/compiled/template-history-warning-messages.js
--- a/static/scripts/templates/compiled/template-history-warning-messages.js
+++ b/static/scripts/templates/compiled/template-history-warning-messages.js
@@ -2,21 +2,30 @@
var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
templates['template-history-warning-messages'] = template(function (Handlebars,depth0,helpers,partials,data) {
helpers = helpers || Handlebars.helpers;
- var buffer = "", stack1, functionType="function", escapeExpression=this.escapeExpression, self=this;
+ var buffer = "", stack1, functionType="function", escapeExpression=this.escapeExpression, self=this, blockHelperMissing=helpers.blockHelperMissing;
function program1(depth0,data) {
- var buffer = "", stack1;
- buffer += "\n<div class=warningmessagesmall><strong>\nThis dataset has been deleted.\n ";
- stack1 = depth0.undelete_url;
- stack1 = helpers['if'].call(depth0, stack1, {hash:{},inverse:self.noop,fn:self.program(2, program2, data)});
- if(stack1 || stack1 === 0) { buffer += stack1; }
- buffer += "\n</strong></div>\n";
- return buffer;}
+ var stack1, foundHelper;
+ foundHelper = helpers.warningmessagesmall;
+ if (foundHelper) { stack1 = foundHelper.call(depth0, {hash:{},inverse:self.noop,fn:self.program(2, program2, data)}); }
+ else { stack1 = depth0.warningmessagesmall; stack1 = typeof stack1 === functionType ? stack1() : stack1; }
+ if (!helpers.warningmessagesmall) { stack1 = blockHelperMissing.call(depth0, stack1, {hash:{},inverse:self.noop,fn:self.program(2, program2, data)}); }
+ if(stack1 || stack1 === 0) { return stack1; }
+ else { return ''; }}
function program2(depth0,data) {
+ var buffer = "", stack1;
+ buffer += "\n This dataset has been deleted.\n ";
+ stack1 = depth0.undelete_url;
+ stack1 = helpers['if'].call(depth0, stack1, {hash:{},inverse:self.noop,fn:self.program(3, program3, data)});
+ if(stack1 || stack1 === 0) { buffer += stack1; }
+ buffer += "\n";
+ return buffer;}
+function program3(depth0,data) {
+
var buffer = "", stack1, foundHelper;
- buffer += "\n Click <a href=\"";
+ buffer += "\n Click <a href=\"";
foundHelper = helpers.undelete_url;
if (foundHelper) { stack1 = foundHelper.call(depth0, {hash:{}}); }
else { stack1 = depth0.undelete_url; stack1 = typeof stack1 === functionType ? stack1() : stack1; }
@@ -24,16 +33,16 @@
foundHelper = helpers.id;
if (foundHelper) { stack1 = foundHelper.call(depth0, {hash:{}}); }
else { stack1 = depth0.id; stack1 = typeof stack1 === functionType ? stack1() : stack1; }
- buffer += escapeExpression(stack1) + "\"\n target=\"galaxy_history\">here</a> to undelete it\n ";
+ buffer += escapeExpression(stack1) + "\"\n target=\"galaxy_history\">here</a> to undelete it\n ";
stack1 = depth0.purge_url;
- stack1 = helpers['if'].call(depth0, stack1, {hash:{},inverse:self.noop,fn:self.program(3, program3, data)});
+ stack1 = helpers['if'].call(depth0, stack1, {hash:{},inverse:self.noop,fn:self.program(4, program4, data)});
if(stack1 || stack1 === 0) { buffer += stack1; }
buffer += "\n ";
return buffer;}
-function program3(depth0,data) {
+function program4(depth0,data) {
var buffer = "", stack1, foundHelper;
- buffer += "\n or\n <a href=\"";
+ buffer += "\n or <a href=\"";
foundHelper = helpers.purge_url;
if (foundHelper) { stack1 = foundHelper.call(depth0, {hash:{}}); }
else { stack1 = depth0.purge_url; stack1 = typeof stack1 === functionType ? stack1() : stack1; }
@@ -44,24 +53,42 @@
buffer += escapeExpression(stack1) + "\"\n target=\"galaxy_history\">here</a> to immediately remove it from disk\n ";
return buffer;}
-function program5(depth0,data) {
+function program6(depth0,data) {
-
- return "\n<div class=warningmessagesmall><strong>\nThis dataset has been deleted and removed from disk.\n</strong></div>\n";}
-
+ var stack1, foundHelper;
+ foundHelper = helpers.warningmessagesmall;
+ if (foundHelper) { stack1 = foundHelper.call(depth0, {hash:{},inverse:self.noop,fn:self.program(7, program7, data)}); }
+ else { stack1 = depth0.warningmessagesmall; stack1 = typeof stack1 === functionType ? stack1() : stack1; }
+ if (!helpers.warningmessagesmall) { stack1 = blockHelperMissing.call(depth0, stack1, {hash:{},inverse:self.noop,fn:self.program(7, program7, data)}); }
+ if(stack1 || stack1 === 0) { return stack1; }
+ else { return ''; }}
function program7(depth0,data) {
+
+ return "\n This dataset has been deleted and removed from disk.\n";}
+
+function program9(depth0,data) {
+
+ var stack1, foundHelper;
+ foundHelper = helpers.warningmessagesmall;
+ if (foundHelper) { stack1 = foundHelper.call(depth0, {hash:{},inverse:self.noop,fn:self.program(10, program10, data)}); }
+ else { stack1 = depth0.warningmessagesmall; stack1 = typeof stack1 === functionType ? stack1() : stack1; }
+ if (!helpers.warningmessagesmall) { stack1 = blockHelperMissing.call(depth0, stack1, {hash:{},inverse:self.noop,fn:self.program(10, program10, data)}); }
+ if(stack1 || stack1 === 0) { return stack1; }
+ else { return ''; }}
+function program10(depth0,data) {
+
var buffer = "", stack1;
- buffer += "\n<div class=warningmessagesmall><strong>\nThis dataset has been hidden.\n ";
+ buffer += "\n This dataset has been hidden.\n ";
stack1 = depth0.undelete_url;
- stack1 = helpers['if'].call(depth0, stack1, {hash:{},inverse:self.noop,fn:self.program(8, program8, data)});
+ stack1 = helpers['if'].call(depth0, stack1, {hash:{},inverse:self.noop,fn:self.program(11, program11, data)});
if(stack1 || stack1 === 0) { buffer += stack1; }
- buffer += "\n</strong></div>\n";
+ buffer += "\n";
return buffer;}
-function program8(depth0,data) {
+function program11(depth0,data) {
var buffer = "", stack1, foundHelper;
- buffer += "\n Click <a href=\"";
+ buffer += "\n Click <a href=\"";
foundHelper = helpers.unhide_url;
if (foundHelper) { stack1 = foundHelper.call(depth0, {hash:{}}); }
else { stack1 = depth0.unhide_url; stack1 = typeof stack1 === functionType ? stack1() : stack1; }
@@ -69,7 +96,7 @@
foundHelper = helpers.id;
if (foundHelper) { stack1 = foundHelper.call(depth0, {hash:{}}); }
else { stack1 = depth0.id; stack1 = typeof stack1 === functionType ? stack1() : stack1; }
- buffer += escapeExpression(stack1) + "\"\n target=\"galaxy_history\">here</a> to unhide it\n ";
+ buffer += escapeExpression(stack1) + "\"\n target=\"galaxy_history\">here</a> to unhide it\n ";
return buffer;}
stack1 = depth0.deleted;
@@ -77,11 +104,11 @@
if(stack1 || stack1 === 0) { buffer += stack1; }
buffer += "\n\n";
stack1 = depth0.purged;
- stack1 = helpers['if'].call(depth0, stack1, {hash:{},inverse:self.noop,fn:self.program(5, program5, data)});
+ stack1 = helpers['if'].call(depth0, stack1, {hash:{},inverse:self.noop,fn:self.program(6, program6, data)});
if(stack1 || stack1 === 0) { buffer += stack1; }
buffer += "\n\n";
stack1 = depth0.visible;
- stack1 = helpers.unless.call(depth0, stack1, {hash:{},inverse:self.noop,fn:self.program(7, program7, data)});
+ stack1 = helpers.unless.call(depth0, stack1, {hash:{},inverse:self.noop,fn:self.program(9, program9, data)});
if(stack1 || stack1 === 0) { buffer += stack1; }
return buffer;});
})();
\ No newline at end of file
diff -r 6aadac8026cb55844a0e8e49360ad30a9f6d0a25 -r 802b87d6491087f6e82d8490d0d603b7affc3491 static/scripts/templates/compiled/template-warningmessagesmall.js
--- a/static/scripts/templates/compiled/template-warningmessagesmall.js
+++ b/static/scripts/templates/compiled/template-warningmessagesmall.js
@@ -2,14 +2,13 @@
var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
templates['template-warningmessagesmall'] = template(function (Handlebars,depth0,helpers,partials,data) {
helpers = helpers || Handlebars.helpers;
- var buffer = "", stack1, foundHelper, functionType="function";
+ var buffer = "", stack1, foundHelper, functionType="function", escapeExpression=this.escapeExpression;
- buffer += "<div class=warningmessagesmall><strong>";
+ buffer += " \n <div class=\"warningmessagesmall\"><strong>";
foundHelper = helpers.warning;
if (foundHelper) { stack1 = foundHelper.call(depth0, {hash:{}}); }
else { stack1 = depth0.warning; stack1 = typeof stack1 === functionType ? stack1() : stack1; }
- if(stack1 || stack1 === 0) { buffer += stack1; }
- buffer += "</strong></div>";
+ buffer += escapeExpression(stack1) + "</strong></div>";
return buffer;});
})();
\ No newline at end of file
diff -r 6aadac8026cb55844a0e8e49360ad30a9f6d0a25 -r 802b87d6491087f6e82d8490d0d603b7affc3491 static/scripts/templates/history-templates.html
--- a/static/scripts/templates/history-templates.html
+++ b/static/scripts/templates/history-templates.html
@@ -1,38 +1,40 @@
<script type="text/template" class="template-history" id="template-history-warning-messages">
-{{#if deleted}}
-<div class=warningmessagesmall><strong>
-This dataset has been deleted.
+{{#if deleted}}{{#warningmessagesmall}}
+ This dataset has been deleted.
{{#if undelete_url}}
- Click <a href="{{ undelete_url }}" class="historyItemUndelete" id="historyItemUndeleter-{{ id }}"
- target="galaxy_history">here</a> to undelete it
+ Click <a href="{{ undelete_url }}" class="historyItemUndelete" id="historyItemUndeleter-{{ id }}"
+ target="galaxy_history">here</a> to undelete it
{{#if purge_url}}
- or
- <a href="{{ purge_url }}" class="historyItemPurge" id="historyItemPurger-{{ id }}"
+ or <a href="{{ purge_url }}" class="historyItemPurge" id="historyItemPurger-{{ id }}"
target="galaxy_history">here</a> to immediately remove it from disk
{{/if}}
{{/if}}
-</strong></div>
-{{/if}}
+{{/warningmessagesmall}}{{/if}}
-{{#if purged}}
-<div class=warningmessagesmall><strong>
-This dataset has been deleted and removed from disk.
-</strong></div>
-{{/if}}
+{{#if purged}}{{#warningmessagesmall}}
+ This dataset has been deleted and removed from disk.
+{{/warningmessagesmall}}{{/if}}
-{{#unless visible}}
-<div class=warningmessagesmall><strong>
-This dataset has been hidden.
+{{#unless visible}}{{#warningmessagesmall}}
+ This dataset has been hidden.
{{#if undelete_url}}
- Click <a href="{{ unhide_url }}" class="historyItemUnhide" id="historyItemUnhider-{{ id }}"
- target="galaxy_history">here</a> to unhide it
+ Click <a href="{{ unhide_url }}" class="historyItemUnhide" id="historyItemUnhider-{{ id }}"
+ target="galaxy_history">here</a> to unhide it
{{/if}}
-</strong></div>
-{{/unless}}
+{{/warningmessagesmall}}{{/unless}}
+</script>
+
+<script type="text/template" class="template-history" id="template-history-titleLink">
+<a href="javascript:void(0);"><span class="historyItemTitle">{{ hid }}: {{ name }}</span></a></script><script type="text/template" class="template-history" id="template-history-hdaSummary">
{{ misc_blurb }}<br />
-format: <span class="{{ data_type }}">{{ data_type }}</span>, ',
-database: {{ dbkeyHTML }}
+format: <span class="{{ data_type }}">{{ data_type }}</span>,
+database:
+{{#if dbkey_unknown_and_editable }}
+ <a href="{{ edit_url }}" target="galaxy_main">{{ metadata_dbkey }}</a>
+{{else}}
+ <span class="{{ metadata_dbkey }}">{{ metadata_dbkey }}</span>
+{{/if}}
</script>
diff -r 6aadac8026cb55844a0e8e49360ad30a9f6d0a25 -r 802b87d6491087f6e82d8490d0d603b7affc3491 static/scripts/templates/template-history-hdaSummary.handlebars
--- a/static/scripts/templates/template-history-hdaSummary.handlebars
+++ b/static/scripts/templates/template-history-hdaSummary.handlebars
@@ -1,3 +1,8 @@
{{ misc_blurb }}<br />
-format: <span class="{{ data_type }}">{{ data_type }}</span>, ',
-database: {{ dbkeyHTML }}
\ No newline at end of file
+format: <span class="{{ data_type }}">{{ data_type }}</span>,
+database:
+{{#if dbkey_unknown_and_editable }}
+ <a href="{{ edit_url }}" target="galaxy_main">{{ metadata_dbkey }}</a>
+{{else}}
+ <span class="{{ metadata_dbkey }}">{{ metadata_dbkey }}</span>
+{{/if}}
\ No newline at end of file
diff -r 6aadac8026cb55844a0e8e49360ad30a9f6d0a25 -r 802b87d6491087f6e82d8490d0d603b7affc3491 static/scripts/templates/template-history-titleLink.handlebars
--- /dev/null
+++ b/static/scripts/templates/template-history-titleLink.handlebars
@@ -0,0 +1,1 @@
+<a href="javascript:void(0);"><span class="historyItemTitle">{{ hid }}: {{ name }}</span></a>
\ No newline at end of file
diff -r 6aadac8026cb55844a0e8e49360ad30a9f6d0a25 -r 802b87d6491087f6e82d8490d0d603b7affc3491 static/scripts/templates/template-history-warning-messages.handlebars
--- a/static/scripts/templates/template-history-warning-messages.handlebars
+++ b/static/scripts/templates/template-history-warning-messages.handlebars
@@ -1,30 +1,23 @@
-{{#if deleted}}
-<div class=warningmessagesmall><strong>
-This dataset has been deleted.
+{{#if deleted}}{{#warningmessagesmall}}
+ This dataset has been deleted.
{{#if undelete_url}}
- Click <a href="{{ undelete_url }}" class="historyItemUndelete" id="historyItemUndeleter-{{ id }}"
- target="galaxy_history">here</a> to undelete it
+ Click <a href="{{ undelete_url }}" class="historyItemUndelete" id="historyItemUndeleter-{{ id }}"
+ target="galaxy_history">here</a> to undelete it
{{#if purge_url}}
- or
- <a href="{{ purge_url }}" class="historyItemPurge" id="historyItemPurger-{{ id }}"
+ or <a href="{{ purge_url }}" class="historyItemPurge" id="historyItemPurger-{{ id }}"
target="galaxy_history">here</a> to immediately remove it from disk
{{/if}}
{{/if}}
-</strong></div>
-{{/if}}
+{{/warningmessagesmall}}{{/if}}
-{{#if purged}}
-<div class=warningmessagesmall><strong>
-This dataset has been deleted and removed from disk.
-</strong></div>
-{{/if}}
+{{#if purged}}{{#warningmessagesmall}}
+ This dataset has been deleted and removed from disk.
+{{/warningmessagesmall}}{{/if}}
-{{#unless visible}}
-<div class=warningmessagesmall><strong>
-This dataset has been hidden.
+{{#unless visible}}{{#warningmessagesmall}}
+ This dataset has been hidden.
{{#if undelete_url}}
- Click <a href="{{ unhide_url }}" class="historyItemUnhide" id="historyItemUnhider-{{ id }}"
- target="galaxy_history">here</a> to unhide it
+ Click <a href="{{ unhide_url }}" class="historyItemUnhide" id="historyItemUnhider-{{ id }}"
+ target="galaxy_history">here</a> to unhide it
{{/if}}
-</strong></div>
-{{/unless}}
\ No newline at end of file
+{{/warningmessagesmall}}{{/unless}}
\ No newline at end of file
diff -r 6aadac8026cb55844a0e8e49360ad30a9f6d0a25 -r 802b87d6491087f6e82d8490d0d603b7affc3491 static/scripts/templates/template-warningmessagesmall.handlebars
--- a/static/scripts/templates/template-warningmessagesmall.handlebars
+++ b/static/scripts/templates/template-warningmessagesmall.handlebars
@@ -1,1 +1,2 @@
-<div class=warningmessagesmall><strong>{{{warning}}}</strong></div>
\ No newline at end of file
+{{! renders a warning in a (mostly css) highlighted, iconned warning box }}
+ <div class="warningmessagesmall"><strong>{{ warning }}</strong></div>
\ No newline at end of file
diff -r 6aadac8026cb55844a0e8e49360ad30a9f6d0a25 -r 802b87d6491087f6e82d8490d0d603b7affc3491 templates/root/alternate_history.mako
--- a/templates/root/alternate_history.mako
+++ b/templates/root/alternate_history.mako
@@ -116,13 +116,17 @@
add_to_data( edit_url=edit_url )
# delete button
- if for_editing and not ( dataset_purged or purged ):
- add_to_data( delete_url=h.url_for( controller='dataset', action='delete', dataset_id=encoded_data_id ) )
+ if for_editing and not ( deleted or dataset_purged or purged ):
+ add_to_data( delete_url=h.url_for( controller='dataset', action='delete', dataset_id=encoded_data_id,
##TODO: loose end
- ##show_deleted_on_refresh=show_deleted_on_refresh ) )
- #show_deleted_on_refresh=False ) )
+ show_deleted_on_refresh=show_deleted
+ ))
- #print app
+ # error report
+ if for_editing:
+ #NOTE: no state == 'error' check
+ add_to_data( report_error_url=h.url_for( h.url_for( controller='dataset', action='errors', id=encoded_data_id ) ) )
+
if hda.ext in app.datatypes_registry.get_available_tracks():
# do these need _localized_ dbkeys?
trackster_urls = {}
@@ -209,7 +213,7 @@
data_dict.update( kwargs )
# trans
- add_to_data( non_encoded_id=data.id )
+ add_to_data( hid=data.hid )
encoded_data_id = trans.security.encode_id( data.id )
add_to_data( id=encoded_data_id )
@@ -294,9 +298,9 @@
${h.templates(
"helpers-common-templates",
- "template-warningmessagesmall",
"template-history-warning-messages",
+ "template-history-titleLink",
"template-history-hdaSummary"
)}
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
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/changeset/6aadac8026cb/
changeset: 6aadac8026cb
user: greg
date: 2012-09-13 17:21:51
summary: Add support for a new <set_environment> tag set in a tool shed repository's tool_dependencies.xml file. This new tag set is defined outside of <package> tag sets, and allows for setting environment variables to point to tool dependency files (scripts, binaries, etc) that are included in the installed repository.
affected #: 12 files
diff -r 1eba2def52653577163901c765fd4686c9d42dfc -r 6aadac8026cb55844a0e8e49360ad30a9f6d0a25 lib/galaxy/model/__init__.py
--- a/lib/galaxy/model/__init__.py
+++ b/lib/galaxy/model/__init__.py
@@ -2996,12 +2996,20 @@
self.status = status
self.error_message = error_message
def installation_directory( self, app ):
- return os.path.join( app.config.tool_dependency_dir,
- self.name,
- self.version,
- self.tool_shed_repository.owner,
- self.tool_shed_repository.name,
- self.tool_shed_repository.installed_changeset_revision )
+ if self.type == 'package':
+ return os.path.join( app.config.tool_dependency_dir,
+ self.name,
+ self.version,
+ self.tool_shed_repository.owner,
+ self.tool_shed_repository.name,
+ self.tool_shed_repository.installed_changeset_revision )
+ if self.type == 'set_environment':
+ return os.path.join( app.config.tool_dependency_dir,
+ 'environment_settings',
+ self.name,
+ self.tool_shed_repository.owner,
+ self.tool_shed_repository.name,
+ self.tool_shed_repository.installed_changeset_revision )
class ToolVersion( object ):
def __init__( self, id=None, create_time=None, tool_id=None, tool_shed_repository=None ):
diff -r 1eba2def52653577163901c765fd4686c9d42dfc -r 6aadac8026cb55844a0e8e49360ad30a9f6d0a25 lib/galaxy/tool_shed/tool_dependencies/common_util.py
--- a/lib/galaxy/tool_shed/tool_dependencies/common_util.py
+++ b/lib/galaxy/tool_shed/tool_dependencies/common_util.py
@@ -1,6 +1,47 @@
import os, shutil, tarfile, urllib2
from galaxy.datatypes.checkers import *
+def create_env_var_dict( elem, tool_dependency_install_dir=None, tool_shed_repository_install_dir=None ):
+ env_var_name = elem.get( 'name', 'PATH' )
+ env_var_action = elem.get( 'action', 'prepend_to' )
+ env_var_text = None
+ if elem.text and elem.text.find( 'REPOSITORY_INSTALL_DIR' ) >= 0:
+ if tool_shed_repository_install_dir:
+ env_var_text = elem.text.replace( '$REPOSITORY_INSTALL_DIR', tool_shed_repository_install_dir )
+ return dict( name=env_var_name, action=env_var_action, value=env_var_text )
+ else:
+ env_var_text = elem.text.replace( '$REPOSITORY_INSTALL_DIR', tool_dependency_install_dir )
+ return dict( name=env_var_name, action=env_var_action, value=env_var_text )
+ if elem.text and elem.text.find( 'INSTALL_DIR' ) >= 0:
+ if tool_dependency_install_dir:
+ env_var_text = elem.text.replace( '$INSTALL_DIR', tool_dependency_install_dir )
+ return dict( name=env_var_name, action=env_var_action, value=env_var_text )
+ else:
+ env_var_text = elem.text.replace( '$INSTALL_DIR', tool_shed_repository_install_dir )
+ return dict( name=env_var_name, action=env_var_action, value=env_var_text )
+ return None
+def create_or_update_env_shell_file( install_dir, env_var_dict ):
+ env_var_name = env_var_dict[ 'name' ]
+ env_var_action = env_var_dict[ 'action' ]
+ env_var_value = env_var_dict[ 'value' ]
+ if env_var_action == 'prepend_to':
+ changed_value = '%s:$%s' % ( env_var_value, env_var_name )
+ elif env_var_action == 'set_to':
+ changed_value = '%s' % env_var_value
+ elif env_var_action == 'append_to':
+ changed_value = '$%s:%s' % ( env_var_name, env_var_value )
+ env_shell_file_path = '%s/env.sh' % install_dir
+ if os.path.exists( env_shell_file_path ):
+ write_action = '>>'
+ else:
+ write_action = '>'
+ cmd = "echo '%s=%s; export %s' %s %s;chmod +x %s" % ( env_var_name,
+ changed_value,
+ env_var_name,
+ write_action,
+ env_shell_file_path,
+ env_shell_file_path )
+ return cmd
def extract_tar( file_name, file_path ):
if isgzip( file_name ) or isbz2( file_name ):
# Open for reading with transparent compression.
diff -r 1eba2def52653577163901c765fd4686c9d42dfc -r 6aadac8026cb55844a0e8e49360ad30a9f6d0a25 lib/galaxy/tool_shed/tool_dependencies/fabric_util.py
--- a/lib/galaxy/tool_shed/tool_dependencies/fabric_util.py
+++ b/lib/galaxy/tool_shed/tool_dependencies/fabric_util.py
@@ -34,10 +34,8 @@
yield work_dir
if os.path.exists( work_dir ):
local( 'rm -rf %s' % work_dir )
-def handle_post_build_processing( app, tool_dependency, install_dir, env_dependency_path, package_name=None ):
- # TODO: This method is deprecated and should be eliminated when the implementation for handling proprietary fabric scripts is implemented.
+def handle_command( app, tool_dependency, install_dir, cmd ):
sa_session = app.model.context.current
- cmd = "echo 'PATH=%s:$PATH; export PATH' > %s/env.sh;chmod +x %s/env.sh" % ( env_dependency_path, install_dir, install_dir )
output = local( cmd, capture=True )
log_results( cmd, output, os.path.join( install_dir, INSTALLATION_LOG ) )
if output.return_code:
@@ -45,6 +43,7 @@
tool_dependency.error_message = str( output.stderr )
sa_session.add( tool_dependency )
sa_session.flush()
+ return output.return_code
def install_and_build_package( app, tool_dependency, actions_dict ):
"""Install a Galaxy tool dependency package either via a url or a mercurial or git clone command."""
sa_session = app.model.context.current
@@ -71,14 +70,8 @@
dir = work_dir
elif action_type == 'shell_command':
# <action type="shell_command">git clone --recursive git://github.com/ekg/freebayes.git</action>
- clone_cmd = action_dict[ 'command' ]
- output = local( clone_cmd, capture=True )
- log_results( clone_cmd, output, os.path.join( install_dir, INSTALLATION_LOG ) )
- if output.return_code:
- tool_dependency.status = app.model.ToolDependency.installation_status.ERROR
- tool_dependency.error_message = str( output.stderr )
- sa_session.add( tool_dependency )
- sa_session.flush()
+ return_code = handle_command( app, tool_dependency, install_dir, action_dict[ 'command' ] )
+ if return_code:
return
dir = package_name
if not os.path.exists( dir ):
@@ -102,44 +95,14 @@
# Currently the only action supported in this category is "environment_variable".
env_var_dicts = action_dict[ 'environment_variable' ]
for env_var_dict in env_var_dicts:
- env_var_name = env_var_dict[ 'name' ]
- env_var_action = env_var_dict[ 'action' ]
- env_var_value = env_var_dict[ 'value' ]
- if env_var_action == 'prepend_to':
- changed_value = '%s:$%s' % ( env_var_value, env_var_name )
- elif env_var_action == 'set_to':
- changed_value = '%s' % env_var_value
- elif env_var_action == 'append_to':
- changed_value = '$%s:%s' % ( env_var_name, env_var_value )
- env_shell_file_path = '%s/env.sh' % install_dir
- if os.path.exists( env_shell_file_path ):
- write_action = '>>'
- else:
- write_action = '>'
- cmd = "echo '%s=%s; export %s' %s %s;chmod +x %s" % ( env_var_name,
- changed_value,
- env_var_name,
- write_action,
- env_shell_file_path,
- env_shell_file_path )
- output = local( cmd, capture=True )
- log_results( cmd, output, os.path.join( install_dir, INSTALLATION_LOG ) )
- if output.return_code:
- tool_dependency.status = app.model.ToolDependency.installation_status.ERROR
- tool_dependency.error_message = str( output.stderr )
- sa_session.add( tool_dependency )
- sa_session.flush()
+ cmd = common_util.create_or_update_env_shell_file( install_dir, env_var_dict )
+ return_code = handle_command( app, tool_dependency, install_dir, cmd )
+ if return_code:
return
elif action_type == 'shell_command':
- action = action_dict[ 'command' ]
with settings( warn_only=True ):
- output = local( action, capture=True )
- log_results( action, output, os.path.join( install_dir, INSTALLATION_LOG ) )
- if output.return_code:
- tool_dependency.status = app.model.ToolDependency.installation_status.ERROR
- tool_dependency.error_message = str( output.stderr )
- sa_session.add( tool_dependency )
- sa_session.flush()
+ return_code = handle_command( app, tool_dependency, install_dir, action_dict[ 'command' ] )
+ if return_code:
return
def log_results( command, fabric_AttributeString, file_path ):
"""
diff -r 1eba2def52653577163901c765fd4686c9d42dfc -r 6aadac8026cb55844a0e8e49360ad30a9f6d0a25 lib/galaxy/tool_shed/tool_dependencies/install_util.py
--- a/lib/galaxy/tool_shed/tool_dependencies/install_util.py
+++ b/lib/galaxy/tool_shed/tool_dependencies/install_util.py
@@ -15,7 +15,10 @@
# Called from Galaxy (never the tool shed) when a new repository is being installed or when an uninstalled repository is being reinstalled.
sa_session = app.model.context.current
# First see if an appropriate tool_dependency record exists for the received tool_shed_repository.
- tool_dependency = get_tool_dependency_by_name_version_type_repository( app, tool_shed_repository, name, version, type )
+ if version:
+ tool_dependency = get_tool_dependency_by_name_version_type_repository( app, tool_shed_repository, name, version, type )
+ else:
+ tool_dependency = get_tool_dependency_by_name_type_repository( app, tool_shed_repository, name, type )
if tool_dependency:
if set_status:
tool_dependency.status = status
@@ -25,6 +28,13 @@
sa_session.add( tool_dependency )
sa_session.flush()
return tool_dependency
+def get_tool_dependency_by_name_type_repository( app, repository, name, type ):
+ sa_session = app.model.context.current
+ return sa_session.query( app.model.ToolDependency ) \
+ .filter( and_( app.model.ToolDependency.table.c.tool_shed_repository_id == repository.id,
+ app.model.ToolDependency.table.c.name == name,
+ app.model.ToolDependency.table.c.type == type ) ) \
+ .first()
def get_tool_dependency_by_name_version_type_repository( app, repository, name, version, type ):
sa_session = app.model.context.current
return sa_session.query( app.model.ToolDependency ) \
@@ -33,13 +43,23 @@
app.model.ToolDependency.table.c.version == version,
app.model.ToolDependency.table.c.type == type ) ) \
.first()
-def get_tool_dependency_install_dir( app, repository, package_name, package_version ):
- return os.path.abspath( os.path.join( app.config.tool_dependency_dir,
- package_name,
- package_version,
- repository.owner,
- repository.name,
- repository.installed_changeset_revision ) )
+def get_tool_dependency_install_dir( app, repository, type, name, version ):
+ if type == 'package':
+ return os.path.abspath( os.path.join( app.config.tool_dependency_dir,
+ name,
+ version,
+ repository.owner,
+ repository.name,
+ repository.installed_changeset_revision ) )
+ if type == 'set_environment':
+ return os.path.abspath( os.path.join( app.config.tool_dependency_dir,
+ 'environment_settings',
+ name,
+ repository.owner,
+ repository.name,
+ repository.installed_changeset_revision ) )
+def get_tool_shed_repository_install_dir( app, tool_shed_repository ):
+ return os.path.abspath( tool_shed_repository.repo_files_directory( app ) )
def install_package( app, elem, tool_shed_repository, tool_dependencies=None ):
# The value of tool_dependencies is a partial or full list of ToolDependency records associated with the tool_shed_repository.
sa_session = app.model.context.current
@@ -49,7 +69,11 @@
package_version = elem.get( 'version', None )
if package_name and package_version:
if tool_dependencies:
- install_dir = get_tool_dependency_install_dir( app, tool_shed_repository, package_name, package_version )
+ install_dir = get_tool_dependency_install_dir( app,
+ repository=tool_shed_repository,
+ type='package',
+ name=package_name,
+ version=package_version )
if not os.path.exists( install_dir ):
for package_elem in elem:
if package_elem.tag == 'install':
@@ -140,11 +164,9 @@
env_var_dicts = []
for env_elem in action_elem:
if env_elem.tag == 'environment_variable':
- env_var_name = env_elem.get( 'name', 'PATH' )
- env_var_action = env_elem.get( 'action', 'prepend_to' )
- env_var_text = env_elem.text.replace( '$INSTALL_DIR', install_dir )
- if env_var_text:
- env_var_dicts.append( dict( name=env_var_name, action=env_var_action, value=env_var_text ) )
+ env_var_dict = create_env_var_dict( env_elem, tool_dependency_install_dir=install_dir )
+ if env_var_dict:
+ env_var_dicts.append( env_var_dict )
if env_var_dicts:
action_dict[ env_elem.tag ] = env_var_dicts
else:
@@ -206,11 +228,7 @@
return "Exception executing fabric script %s: %s. " % ( str( proprietary_fabfile_path ), str( e ) )
if returncode:
return message
- message = handle_post_build_processing( app, tool_dependency, install_dir, env_dependency_path, package_name=package_name )
- if message:
- return message
- else:
- return ''
+ handle_environment_settings( app, tool_dependency, install_dir, cmd )
def run_subprocess( app, cmd ):
env = os.environ
PYTHONPATH = env.get( 'PYTHONPATH', '' )
@@ -229,3 +247,47 @@
message = '%s\n' % str( tmp_stderr.read() )
tmp_stderr.close()
return returncode, message
+def set_environment( app, elem, tool_shed_repository ):
+ """
+ Create a ToolDependency to set an environment variable. This is different from the process used to set an environment variable that is associated
+ with a package. An example entry in a tool_dependencies.xml file is:
+ <set_environment version="1.0">
+ <environment_variable name="R_SCRIPT_PATH" action="set_to">$REPOSITORY_INSTALL_DIR</environment_variable>
+ </set_environment>
+ """
+ sa_session = app.model.context.current
+ tool_dependency = None
+ env_var_version = elem.get( 'version', '1.0' )
+ for env_var_elem in elem:
+ # The value of env_var_name must match the text value of at least 1 <requirement> tag in the tool config's <requirements> tag set whose
+ # "type" attribute is "set_environment" (e.g., <requirement type="set_environment">R_SCRIPT_PATH</requirement>).
+ env_var_name = env_var_elem.get( 'name', None )
+ env_var_action = env_var_elem.get( 'action', None )
+ if env_var_name and env_var_action:
+ install_dir = get_tool_dependency_install_dir( app,
+ repository=tool_shed_repository,
+ type='set_environment',
+ name=env_var_name,
+ version=None )
+ tool_shed_repository_install_dir = get_tool_shed_repository_install_dir( app, tool_shed_repository )
+ env_var_dict = create_env_var_dict( env_var_elem, tool_shed_repository_install_dir=tool_shed_repository_install_dir )
+ if env_var_dict:
+ if not os.path.exists( install_dir ):
+ os.makedirs( install_dir )
+ tool_dependency = create_or_update_tool_dependency( app,
+ tool_shed_repository,
+ name=env_var_name,
+ version=None,
+ type='set_environment',
+ status=app.model.ToolDependency.installation_status.INSTALLING,
+ set_status=True )
+ cmd = create_or_update_env_shell_file( install_dir, env_var_dict )
+ if env_var_version == '1.0':
+ # Handle setting environment variables using a fabric method.
+ handle_command( app, tool_dependency, install_dir, cmd )
+ sa_session.refresh( tool_dependency )
+ if tool_dependency.status != app.model.ToolDependency.installation_status.ERROR:
+ tool_dependency.status = app.model.ToolDependency.installation_status.INSTALLED
+ sa_session.add( tool_dependency )
+ sa_session.flush()
+ print 'Environment variable ', env_var_name, 'set in', install_dir
diff -r 1eba2def52653577163901c765fd4686c9d42dfc -r 6aadac8026cb55844a0e8e49360ad30a9f6d0a25 lib/galaxy/tools/__init__.py
--- a/lib/galaxy/tools/__init__.py
+++ b/lib/galaxy/tools/__init__.py
@@ -2402,31 +2402,28 @@
command_line = self.interpreter + " " + command_line
return command_line
def build_dependency_shell_commands( self ):
- """
- Return a list of commands to be run to populate the current
- environment to include this tools requirements.
- """
+ """Return a list of commands to be run to populate the current environment to include this tools requirements."""
commands = []
if self.tool_shed_repository:
installed_tool_dependencies = self.tool_shed_repository.installed_tool_dependencies
else:
installed_tool_dependencies = None
for requirement in self.requirements:
- # TODO: currently only supporting requirements of type package,
- # need to implement some mechanism for mapping other types
- # back to packages
log.debug( "Building dependency shell command for dependency '%s'", requirement.name )
- if requirement.type == 'package':
+ script_file = None
+ base_path = None
+ version = None
+ if requirement.type in [ 'package', 'set_environment' ]:
script_file, base_path, version = self.app.toolbox.dependency_manager.find_dep( name=requirement.name,
version=requirement.version,
type=requirement.type,
installed_tool_dependencies=installed_tool_dependencies )
- if script_file is None and base_path is None:
- log.warn( "Failed to resolve dependency on '%s', ignoring", requirement.name )
- elif script_file is None:
- commands.append( 'PACKAGE_BASE=%s; export PACKAGE_BASE; PATH="%s/bin:$PATH"; export PATH' % ( base_path, base_path ) )
- else:
- commands.append( 'PACKAGE_BASE=%s; export PACKAGE_BASE; . %s' % ( base_path, script_file ) )
+ if script_file is None and base_path is None:
+ log.warn( "Failed to resolve dependency on '%s', ignoring", requirement.name )
+ elif requirement.type == 'package' and script_file is None:
+ commands.append( 'PACKAGE_BASE=%s; export PACKAGE_BASE; PATH="%s/bin:$PATH"; export PATH' % ( base_path, base_path ) )
+ else:
+ commands.append( 'PACKAGE_BASE=%s; export PACKAGE_BASE; . %s' % ( base_path, script_file ) )
return commands
def build_redirect_url_params( self, param_dict ):
"""
diff -r 1eba2def52653577163901c765fd4686c9d42dfc -r 6aadac8026cb55844a0e8e49360ad30a9f6d0a25 lib/galaxy/tools/deps/__init__.py
--- a/lib/galaxy/tools/deps/__init__.py
+++ b/lib/galaxy/tools/deps/__init__.py
@@ -9,14 +9,12 @@
class DependencyManager( object ):
"""
- A DependencyManager attempts to resolve named and versioned dependencies
- by searching for them under a list of directories. Directories should be
+ A DependencyManager attempts to resolve named and versioned dependencies by searching for them under a list of directories. Directories should be
of the form:
$BASE/name/version/...
- and should each contain a file 'env.sh' which can be sourced to make the
- dependency available in the current shell environment.
+ and should each contain a file 'env.sh' which can be sourced to make the dependency available in the current shell environment.
"""
def __init__( self, base_paths=[] ):
"""
@@ -32,31 +30,18 @@
self.base_paths.append( os.path.abspath( base_path ) )
def find_dep( self, name, version=None, type='package', installed_tool_dependencies=None ):
"""
- Attempt to find a dependency named `name` at version `version`. If
- version is None, return the "default" version as determined using a
- symbolic link (if found). Returns a triple of:
- env_script, base_path, real_version
+ Attempt to find a dependency named `name` at version `version`. If version is None, return the "default" version as determined using a
+ symbolic link (if found). Returns a triple of: env_script, base_path, real_version
"""
if version is None:
- return self._find_dep_default( name )
+ return self._find_dep_default( name, type=type, installed_tool_dependencies=installed_tool_dependencies )
else:
- return self._find_dep_versioned( name, version, installed_tool_dependencies=installed_tool_dependencies )
+ return self._find_dep_versioned( name, version, type=type, installed_tool_dependencies=installed_tool_dependencies )
def _find_dep_versioned( self, name, version, type='package', installed_tool_dependencies=None ):
- installed_dependency = None
- if installed_tool_dependencies:
- for installed_tool_dependency in installed_tool_dependencies:
- if installed_tool_dependency.name==name and installed_tool_dependency.version==version and installed_tool_dependency.type==type:
- installed_dependency = installed_tool_dependency
- break
+ installed_tool_dependency = self._get_installed_dependency( installed_tool_dependencies, name, type, version=version )
for base_path in self.base_paths:
- if installed_dependency:
- tool_shed_repository = installed_dependency.tool_shed_repository
- path = os.path.join( base_path,
- name,
- version,
- tool_shed_repository.owner,
- tool_shed_repository.name,
- tool_shed_repository.installed_changeset_revision )
+ if installed_tool_dependency:
+ path = self._get_package_installed_dependency_path( installed_tool_dependency, base_path, name, version )
else:
path = os.path.join( base_path, name, version )
script = os.path.join( path, 'env.sh' )
@@ -66,8 +51,14 @@
return None, path, version
else:
return None, None, None
- def _find_dep_default( self, name, type='package' ):
- version = None
+ def _find_dep_default( self, name, type='package', installed_tool_dependencies=None ):
+ if type == 'set_environment' and installed_tool_dependencies:
+ installed_tool_dependency = self._get_installed_dependency( installed_tool_dependencies, name, type, version=None )
+ if installed_tool_dependency:
+ script, path, version = self._get_set_environment_installed_dependency_script_path( installed_tool_dependency, name )
+ if script and path:
+ # Environment settings do not use versions.
+ return script, path, None
for base_path in self.base_paths:
path = os.path.join( base_path, name, 'default' )
if os.path.islink( path ):
@@ -81,3 +72,33 @@
return None, real_path, real_version
else:
return None, None, None
+ def _get_installed_dependency( self, installed_tool_dependencies, name, type, version=None ):
+ for installed_tool_dependency in installed_tool_dependencies:
+ if version:
+ if installed_tool_dependency.name==name and installed_tool_dependency.type==type and installed_tool_dependency.version==version:
+ return installed_tool_dependency
+ else:
+ if installed_tool_dependency.name==name and installed_tool_dependency.type==type:
+ return installed_tool_dependency
+ return None
+ def _get_package_installed_dependency_path( self, installed_tool_dependency, base_path, name, version ):
+ tool_shed_repository = installed_tool_dependency.tool_shed_repository
+ return os.path.join( base_path,
+ name,
+ version,
+ tool_shed_repository.owner,
+ tool_shed_repository.name,
+ tool_shed_repository.installed_changeset_revision )
+ def _get_set_environment_installed_dependency_script_path( self, installed_tool_dependency, name ):
+ tool_shed_repository = installed_tool_dependency.tool_shed_repository
+ for base_path in self.base_paths:
+ path = os.path.abspath( os.path.join( base_path,
+ 'environment_settings',
+ name,
+ tool_shed_repository.owner,
+ tool_shed_repository.name,
+ tool_shed_repository.installed_changeset_revision ) )
+ if os.path.exists( path ):
+ script = os.path.join( path, 'env.sh' )
+ return script, path, None
+ return None, None, None
diff -r 1eba2def52653577163901c765fd4686c9d42dfc -r 6aadac8026cb55844a0e8e49360ad30a9f6d0a25 lib/galaxy/util/shed_util.py
--- a/lib/galaxy/util/shed_util.py
+++ b/lib/galaxy/util/shed_util.py
@@ -7,7 +7,7 @@
from galaxy.datatypes.checkers import *
from galaxy.util.json import *
from galaxy.tools.search import ToolBoxSearch
-from galaxy.tool_shed.tool_dependencies.install_util import create_or_update_tool_dependency, install_package
+from galaxy.tool_shed.tool_dependencies.install_util import create_or_update_tool_dependency, install_package, set_environment
from galaxy.tool_shed.encoding_util import *
from galaxy.model.orm import *
@@ -255,26 +255,47 @@
"""
can_generate_dependency_metadata = False
for elem in root:
- can_generate_dependency_metadata = False
- tool_dependency_name = elem.get( 'name', None )
+ tool_dependency_type = elem.tag
tool_dependency_version = elem.get( 'version', None )
- tool_dependency_type = elem.tag
- if tool_dependency_name and tool_dependency_version and tool_dependency_type:
- for tool_dict in metadata_dict[ 'tools' ]:
- requirements = tool_dict.get( 'requirements', [] )
- for requirement_dict in requirements:
- req_name = requirement_dict.get( 'name', None )
- req_version = requirement_dict.get( 'version', None )
- req_type = requirement_dict.get( 'type', None )
- if req_name==tool_dependency_name and req_version==tool_dependency_version and req_type==tool_dependency_type:
- can_generate_dependency_metadata = True
+ if tool_dependency_type == 'package':
+ can_generate_dependency_metadata = False
+ tool_dependency_name = elem.get( 'name', None )
+ if tool_dependency_name and tool_dependency_version:
+ for tool_dict in metadata_dict[ 'tools' ]:
+ requirements = tool_dict.get( 'requirements', [] )
+ for requirement_dict in requirements:
+ req_name = requirement_dict.get( 'name', None )
+ req_version = requirement_dict.get( 'version', None )
+ req_type = requirement_dict.get( 'type', None )
+ if req_name==tool_dependency_name and req_version==tool_dependency_version and req_type==tool_dependency_type:
+ can_generate_dependency_metadata = True
+ break
+ if requirements and not can_generate_dependency_metadata:
+ # We've discovered at least 1 combination of name, version and type that is not defined in the <requirement>
+ # tag for any tool in the repository.
break
- if requirements and not can_generate_dependency_metadata:
- # We've discovered at least 1 combination of name, version and type that is not defined in the <requirement>
- # tag for any tool in the repository.
+ if not can_generate_dependency_metadata:
break
- if not can_generate_dependency_metadata:
- break
+ elif tool_dependency_type == 'set_environment':
+ # Here elem is something like: <set_environment version="1.0">
+ for env_var_elem in elem:
+ can_generate_dependency_metadata = False
+ # <environment_variable name="R_SCRIPT_PATH" action="set_to">$REPOSITORY_INSTALL_DIR</environment_variable>
+ env_var_name = env_var_elem.get( 'name', None )
+ if env_var_name:
+ for tool_dict in metadata_dict[ 'tools' ]:
+ requirements = tool_dict.get( 'requirements', [] )
+ for requirement_dict in requirements:
+ # {"name": "R_SCRIPT_PATH", "type": "set_environment", "version": null}
+ req_name = requirement_dict.get( 'name', None )
+ req_type = requirement_dict.get( 'type', None )
+ if req_name==env_var_name and req_type==tool_dependency_type:
+ can_generate_dependency_metadata = True
+ break
+ if requirements and not can_generate_dependency_metadata:
+ # We've discovered at least 1 combination of name, version and type that is not defined in the <requirement>
+ # tag for any tool in the repository.
+ break
return can_generate_dependency_metadata
def check_tool_input_params( app, repo_dir, tool_config_name, tool, sample_files, webapp='galaxy' ):
"""
@@ -466,23 +487,43 @@
tool_dependency_objects = []
# Get the tool_dependencies.xml file from the repository.
tool_dependencies_config = get_config_from_disk( 'tool_dependencies.xml', relative_install_dir )
- tree = ElementTree.parse( tool_dependencies_config )
+ try:
+ tree = ElementTree.parse( tool_dependencies_config )
+ except Exception, e:
+ log.debug( "Exception attempting to parse tool_dependencies.xml: %s" %str( e ) )
+ return tool_dependency_objects
root = tree.getroot()
ElementInclude.include( root )
fabric_version_checked = False
for elem in root:
- if elem.tag == 'package':
- package_name = elem.get( 'name', None )
- package_version = elem.get( 'version', None )
- if package_name and package_version:
+ tool_dependency_type = elem.tag
+ if tool_dependency_type == 'package':
+ name = elem.get( 'name', None )
+ version = elem.get( 'version', None )
+ if name and version:
tool_dependency = create_or_update_tool_dependency( app,
tool_shed_repository,
- name=package_name,
- version=package_version,
- type='package',
+ name=name,
+ version=version,
+ type=tool_dependency_type,
status=app.model.ToolDependency.installation_status.NEVER_INSTALLED,
set_status=set_status )
tool_dependency_objects.append( tool_dependency )
+
+ elif tool_dependency_type == 'set_environment':
+ for env_elem in elem:
+ # <environment_variable name="R_SCRIPT_PATH" action="set_to">$REPOSITORY_INSTALL_DIR</environment_variable>
+ name = env_elem.get( 'name', None )
+ action = env_elem.get( 'action', None )
+ if name and action:
+ tool_dependency = create_or_update_tool_dependency( app,
+ tool_shed_repository,
+ name=name,
+ version=None,
+ type=tool_dependency_type,
+ status=app.model.ToolDependency.installation_status.NEVER_INSTALLED,
+ set_status=set_status )
+ tool_dependency_objects.append( tool_dependency )
return tool_dependency_objects
def generate_clone_url( trans, repository ):
"""Generate the URL for cloning a repository."""
@@ -528,12 +569,30 @@
if datatypes:
metadata_dict[ 'datatypes' ] = datatypes
return metadata_dict
+def generate_environment_dependency_metadata( elem, tool_dependencies_dict ):
+ """The value of env_var_name must match the value of the "set_environment" type in the tool config's <requirements> tag set."""
+ requirements_dict = {}
+ for env_elem in elem:
+ env_name = env_elem.get( 'name', None )
+ if env_name:
+ requirements_dict [ 'name' ] = env_name
+ requirements_dict [ 'type' ] = 'environment variable'
+ if requirements_dict:
+ if 'set_environment' in tool_dependencies_dict:
+ tool_dependencies_dict[ 'set_environment' ].append( requirements_dict )
+ else:
+ tool_dependencies_dict[ 'set_environment' ] = [ requirements_dict ]
+ return tool_dependencies_dict
def generate_tool_dependency_metadata( tool_dependencies_config, metadata_dict ):
"""
If the combination of name, version and type of each element is defined in the <requirement> tag for at least one tool in the repository,
then update the received metadata_dict with information from the parsed tool_dependencies_config.
"""
- tree = ElementTree.parse( tool_dependencies_config )
+ try:
+ tree = ElementTree.parse( tool_dependencies_config )
+ except Exception, e:
+ log.debug( "Exception attempting to parse tool_dependencies.xml: %s" %str( e ) )
+ return metadata_dict
root = tree.getroot()
ElementInclude.include( root )
tool_dependencies_dict = {}
@@ -541,9 +600,13 @@
for elem in root:
if elem.tag == 'package':
tool_dependencies_dict = generate_package_dependency_metadata( elem, tool_dependencies_dict )
+ elif elem.tag == 'set_environment':
+ tool_dependencies_dict = generate_environment_dependency_metadata( elem, tool_dependencies_dict )
# Handle tool dependency installation via other means here (future).
if tool_dependencies_dict:
metadata_dict[ 'tool_dependencies' ] = tool_dependencies_dict
+ if tool_dependencies_dict:
+ metadata_dict[ 'tool_dependencies' ] = tool_dependencies_dict
return metadata_dict
def generate_metadata_for_changeset_revision( app, repository_clone_url, relative_install_dir=None, repository_files_dir=None,
resetting_all_metadata_on_repository=False, webapp='galaxy' ):
@@ -712,7 +775,7 @@
outputs = []
for output in ttb.outputs:
name, file_name, extra = output
- outputs.append( ( name, strip_path( file_name ) ) )
+ outputs.append( ( name, strip_path( file_name ) if file_name else None ) )
test_dict = dict( name=ttb.name,
required_files=required_files,
inputs=inputs,
@@ -1337,27 +1400,27 @@
ElementInclude.include( root )
fabric_version_checked = False
for elem in root:
- # Only install the package if it is not already installed.
- can_install = False
if elem.tag == 'package':
+ # Only install the tool_dependency if it is not already installed.
+ can_install = False
package_name = elem.get( 'name', None )
package_version = elem.get( 'version', None )
if package_name and package_version:
- # The value of tool_dependencies will be None only when this method is called by the InstallManager. In that case, tool
- # dependency installation is not ajaxian, so the ToolDependency objects do not yet exist.
- if tool_dependencies:
- for tool_dependency in tool_dependencies:
- if tool_dependency.name==package_name and tool_dependency.version==package_version:
- can_install = tool_dependency.status in [ app.model.ToolDependency.installation_status.NEVER_INSTALLED,
- app.model.ToolDependency.installation_status.UNINSTALLED ]
- break
- else:
- can_install = False
+ for tool_dependency in tool_dependencies:
+ if tool_dependency.name==package_name and tool_dependency.version==package_version:
+ can_install = tool_dependency.status in [ app.model.ToolDependency.installation_status.NEVER_INSTALLED,
+ app.model.ToolDependency.installation_status.UNINSTALLED ]
+ break
if can_install:
tool_dependency = install_package( app, elem, tool_shed_repository, tool_dependencies=tool_dependencies )
if tool_dependency and tool_dependency.status in [ app.model.ToolDependency.installation_status.INSTALLED,
app.model.ToolDependency.installation_status.ERROR ]:
installed_tool_dependencies.append( tool_dependency )
+ elif elem.tag == 'set_environment':
+ tool_dependency = set_environment( app, elem, tool_shed_repository )
+ if tool_dependency and tool_dependency.status in [ app.model.ToolDependency.installation_status.INSTALLED,
+ app.model.ToolDependency.installation_status.ERROR ]:
+ installed_tool_dependencies.append( tool_dependency )
return installed_tool_dependencies
def handle_tool_versions( app, tool_version_dicts, tool_shed_repository ):
"""
@@ -1662,7 +1725,12 @@
def reversed_upper_bounded_changelog( repo, included_upper_bounds_changeset_revision ):
return reversed_lower_upper_bounded_changelog( repo, INITIAL_CHANGELOG_HASH, included_upper_bounds_changeset_revision )
def strip_path( fpath ):
- file_path, file_name = os.path.split( fpath )
+ if not fpath:
+ return fpath
+ try:
+ file_path, file_name = os.path.split( fpath )
+ except:
+ file_name = fpath
return file_name
def to_html_escaped( text ):
"""Translates the characters in text to html values"""
diff -r 1eba2def52653577163901c765fd4686c9d42dfc -r 6aadac8026cb55844a0e8e49360ad30a9f6d0a25 lib/galaxy/web/controllers/admin_toolshed.py
--- a/lib/galaxy/web/controllers/admin_toolshed.py
+++ b/lib/galaxy/web/controllers/admin_toolshed.py
@@ -2,7 +2,6 @@
from galaxy.web.controllers.admin import *
from galaxy.util.json import from_json_string, to_json_string
from galaxy.util.shed_util import *
-from galaxy.tool_shed.tool_dependencies.install_util import get_tool_dependency_install_dir
from galaxy.tool_shed.encoding_util import *
from galaxy import eggs, tools
@@ -1364,10 +1363,11 @@
% ( repository.name, original_section_name )
message += "Uncheck the <b>No changes</b> check box and select a different tool panel section to load the tools in a "
message += "different section in the tool panel."
+ status = 'warning'
else:
message = "The tools contained in your <b>%s</b> repository were last loaded into the tool panel outside of any sections. " % repository.name
message += "Uncheck the <b>No changes</b> check box and select a tool panel section to load the tools into that section."
- status = 'done'
+ status = 'warning'
includes_tool_dependencies = 'tool_dependencies' in metadata
install_tool_dependencies_check_box = CheckboxField( 'install_tool_dependencies', checked=True )
return trans.fill_template( '/admin/tool_shed_repository/reselect_tool_panel_section.mako',
diff -r 1eba2def52653577163901c765fd4686c9d42dfc -r 6aadac8026cb55844a0e8e49360ad30a9f6d0a25 lib/galaxy/webapps/community/controllers/repository.py
--- a/lib/galaxy/webapps/community/controllers/repository.py
+++ b/lib/galaxy/webapps/community/controllers/repository.py
@@ -2263,25 +2263,27 @@
guid = None
revision_label = get_revision_label( trans, repository, changeset_revision )
repository_metadata = get_repository_metadata_by_changeset_revision( trans, repository_id, changeset_revision )
- metadata = repository_metadata.metadata
- if 'tools' in metadata:
- for tool_metadata_dict in metadata[ 'tools' ]:
- if tool_metadata_dict[ 'id' ] == tool_id:
- relative_path_to_tool_config = tool_metadata_dict[ 'tool_config' ]
- guid = tool_metadata_dict[ 'guid' ]
- full_path = os.path.abspath( relative_path_to_tool_config )
- can_use_disk_file = can_use_tool_config_disk_file( trans, repository, repo, full_path, changeset_revision )
- if can_use_disk_file:
- tool, valid, message = load_tool_from_config( trans.app, full_path )
- else:
- # We're attempting to load a tool using a config that no longer exists on disk.
- work_dir = tempfile.mkdtemp()
- manifest_ctx, ctx_file = get_ctx_file_path_from_manifest( relative_path_to_tool_config, repo, changeset_revision )
- if manifest_ctx and ctx_file:
- tool, message = load_tool_from_tmp_config( trans, repo, manifest_ctx, ctx_file, work_dir )
- break
- if guid:
- tool_lineage = self.get_versions_of_tool( trans, repository, repository_metadata, guid )
+ if repository_metadata:
+ metadata = repository_metadata.metadata
+ if metadata:
+ if 'tools' in metadata:
+ for tool_metadata_dict in metadata[ 'tools' ]:
+ if tool_metadata_dict[ 'id' ] == tool_id:
+ relative_path_to_tool_config = tool_metadata_dict[ 'tool_config' ]
+ guid = tool_metadata_dict[ 'guid' ]
+ full_path = os.path.abspath( relative_path_to_tool_config )
+ can_use_disk_file = can_use_tool_config_disk_file( trans, repository, repo, full_path, changeset_revision )
+ if can_use_disk_file:
+ tool, valid, message = load_tool_from_config( trans.app, full_path )
+ else:
+ # We're attempting to load a tool using a config that no longer exists on disk.
+ work_dir = tempfile.mkdtemp()
+ manifest_ctx, ctx_file = get_ctx_file_path_from_manifest( relative_path_to_tool_config, repo, changeset_revision )
+ if manifest_ctx and ctx_file:
+ tool, message = load_tool_from_tmp_config( trans, repo, manifest_ctx, ctx_file, work_dir )
+ break
+ if guid:
+ tool_lineage = self.get_versions_of_tool( trans, repository, repository_metadata, guid )
is_malicious = changeset_is_malicious( trans, repository_id, repository.tip )
changeset_revision_select_field = build_changeset_revision_select_field( trans,
repository,
diff -r 1eba2def52653577163901c765fd4686c9d42dfc -r 6aadac8026cb55844a0e8e49360ad30a9f6d0a25 templates/admin/tool_shed_repository/common.mako
--- a/templates/admin/tool_shed_repository/common.mako
+++ b/templates/admin/tool_shed_repository/common.mako
@@ -72,26 +72,20 @@
<div class="form-row"><div class="toolParamHelp" style="clear: both;"><p>
- These tool dependencies can be automatically installed with the repository. Installing them provides significant benefits and
+ These tool dependencies can be automatically handled with the installed repository, providing significant benefits, and
Galaxy includes various features to manage them.
</p>
- <p>
- Each of these dependencies may require their own build requirements (e.g., CMake, g++, etc). Galaxy will not attempt to install
- these build requirements, so tool dependency installation may partially fail if any are missing from your environment, but the
- repository and all of it's contents will be installed. You can install the missing build requirements and have Galaxy attempt
- to install the tool dependencies again if tool dependency installation fails in any way.
- </p></div></div><div class="form-row">
- <label>Install tool dependencies?</label>
+ <label>Handle tool dependencies?</label><% disabled = trans.app.config.tool_dependency_dir is None %>
${install_tool_dependencies_check_box.get_html( disabled=disabled )}
<div class="toolParamHelp" style="clear: both;">
%if disabled:
- Set the tool_dependency_dir configuration value in your universe_wsgi.ini to automatically install tool dependencies.
+ Set the tool_dependency_dir configuration value in your universe_wsgi.ini to automatically handle tool dependencies.
%else:
- Un-check to skip automatic installation of these tool dependencies.
+ Un-check to skip automatic handling of these tool dependencies.
%endif
</div></div>
@@ -99,42 +93,102 @@
<div class="form-row"><table class="grid"><tr><td colspan="4" bgcolor="#D8D8D8"><b>Tool dependencies</b></td></tr>
- <tr>
- <th>Name</th>
- <th>Version</th>
- <th>Type</th>
- <th>Install directory</th>
- </tr>
+ <%
+ env_settings_heaader_row_displayed = False
+ package_header_row_displayed = False
+ %>
%for repo_info_dict in repo_info_dicts:
%for repository_name, repo_info_tuple in repo_info_dict.items():
<% description, repository_clone_url, changeset_revision, ctx_rev, repository_owner, tool_dependencies = repo_info_tuple %>
%if tool_dependencies:
- %for dependency_key, requirements_dict in tool_dependencies.items():
- <%
- name = requirements_dict[ 'name' ]
- version = requirements_dict[ 'version' ]
- type = requirements_dict[ 'type' ]
- install_dir = os.path.join( trans.app.config.tool_dependency_dir,
- name,
- version,
- repository_owner,
- repository_name,
- changeset_revision )
- tool_dependency_readme_text = requirements_dict.get( 'readme', None )
- %>
- %if not os.path.exists( install_dir ):
+ <%
+ # See if tool dependencies are packages, environment settings or both.
+ contains_packages = False
+ for k in tool_dependencies.keys():
+ if k != 'set_environment':
+ contains_packages = True
+ break
+ contains_env_settings = 'set_environment' in tool_dependencies.keys()
+ %>
+ %if contains_packages:
+ %if not package_header_row_displayed:
+ <%
+ info_str = "Each of these packages may require their own build requirements (e.g., CMake, g++, etc). "
+ info_str += "Galaxy will not attempt to install these build requirements, so tool dependency installation "
+ info_str += "may partially fail if any are missing from your environment, but the repository and all of it's "
+ info_str += "contents will be installed. You can install the missing build requirements and have Galaxy attempt "
+ info_str += "to install the packages again if tool dependency installation fails in any way."
+ %>
+ </tr><td bgcolor="#FFFFCC" colspan="4">${info_str}</td></tr><tr>
- <td>${name}</td>
- <td>${version}</td>
- <td>${type}</td>
- <td>${install_dir}</td>
+ <th>Name</th>
+ <th>Version</th>
+ <th>Type</th>
+ <th>Install directory</th></tr>
- %if tool_dependency_readme_text:
- <tr><td colspan="4" bgcolor="#FFFFCC">${name} ${version} requirements and installation information</td></tr>
- <tr><td colspan="4"><pre>${tool_dependency_readme_text}</pre></td></tr>
+ <% package_header_row_displayed = True %>
+ %endif
+ %for dependency_key, requirements_dict in tool_dependencies.items():
+ <%
+ name = requirements_dict[ 'name' ]
+ version = requirements_dict[ 'version' ]
+ type = requirements_dict[ 'type' ]
+ install_dir = os.path.join( trans.app.config.tool_dependency_dir,
+ name,
+ version,
+ repository_owner,
+ repository_name,
+ changeset_revision )
+ tool_dependency_readme_text = requirements_dict.get( 'readme', None )
+ %>
+ %if not os.path.exists( install_dir ):
+ <tr>
+ <td>${name}</td>
+ <td>${version}</td>
+ <td>${type}</td>
+ <td>${install_dir}</td>
+ </tr>
+ %if tool_dependency_readme_text:
+ <tr><td colspan="4" bgcolor="#FFFFCC">${name} ${version} requirements and installation information</td></tr>
+ <tr><td colspan="4"><pre>${tool_dependency_readme_text}</pre></td></tr>
+ %endif
%endif
+ %endfor
+ %endif
+ %if contains_env_settings:
+ <% environment_settings = tool_dependencies[ 'set_environment' ] %>
+ %if not env_settings_heaader_row_displayed:
+ <%
+ info_str = "Each of these environment settings will be defined in a file named env.sh in the installation directory."
+ %>
+ </tr><td bgcolor="#FFFFCC" colspan="4">${info_str}</td></tr>
+ <tr>
+ <th>Name</th>
+ <th>Type</th>
+ <th colspan="2">Install directory for environment shell file</th>
+ </tr>
+ <% env_settings_heaader_row_displayed = True %>
%endif
- %endfor
+ %for environment_setting_dict in environment_settings:
+ <%
+ name = environment_setting_dict[ 'name' ]
+ type = environment_setting_dict[ 'type' ]
+ install_dir = os.path.join( trans.app.config.tool_dependency_dir,
+ 'environment_settings',
+ name,
+ repository_owner,
+ repository_name,
+ changeset_revision )
+ %>
+ %if not os.path.exists( install_dir ):
+ <tr>
+ <td>${name}</td>
+ <td>${type}</td>
+ <td colspan="2">${install_dir}</td>
+ </tr>
+ %endif
+ %endfor
+ %endif
%endif
%endfor
%endfor
diff -r 1eba2def52653577163901c765fd4686c9d42dfc -r 6aadac8026cb55844a0e8e49360ad30a9f6d0a25 templates/admin/tool_shed_repository/uninstall_tool_dependencies.mako
--- a/templates/admin/tool_shed_repository/uninstall_tool_dependencies.mako
+++ b/templates/admin/tool_shed_repository/uninstall_tool_dependencies.mako
@@ -22,12 +22,20 @@
%for tool_dependency in tool_dependencies:
<input type="hidden" name="tool_dependency_ids" value="${trans.security.encode_id( tool_dependency.id )}"/><%
- install_dir = os.path.join( trans.app.config.tool_dependency_dir,
- tool_dependency.name,
- tool_dependency.version,
- tool_dependency.tool_shed_repository.owner,
- tool_dependency.tool_shed_repository.name,
- tool_dependency.tool_shed_repository.installed_changeset_revision )
+ if tool_dependency.type == 'package':
+ install_dir = os.path.join( trans.app.config.tool_dependency_dir,
+ tool_dependency.name,
+ tool_dependency.version,
+ tool_dependency.tool_shed_repository.owner,
+ tool_dependency.tool_shed_repository.name,
+ tool_dependency.tool_shed_repository.installed_changeset_revision )
+ elif tool_dependency.type == 'set_environment':
+ install_dir = os.path.join( trans.app.config.tool_dependency_dir,
+ 'environment_settings',
+ tool_dependency.name,
+ tool_dependency.tool_shed_repository.owner,
+ tool_dependency.tool_shed_repository.name,
+ tool_dependency.tool_shed_repository.installed_changeset_revision )
%>
%if os.path.exists( install_dir ):
<tr>
diff -r 1eba2def52653577163901c765fd4686c9d42dfc -r 6aadac8026cb55844a0e8e49360ad30a9f6d0a25 templates/webapps/community/repository/common.mako
--- a/templates/webapps/community/repository/common.mako
+++ b/templates/webapps/community/repository/common.mako
@@ -92,38 +92,76 @@
<div class="toolFormBody">
%if metadata:
%if 'tool_dependencies' in metadata:
- <div class="form-row">
- <table width="100%">
- <tr bgcolor="#D8D8D8" width="100%">
- <td><b>The following tool dependencies can optionally be automatically installed</i></td>
- </tr>
- </table>
- </div>
- <div style="clear: both"></div>
- <div class="form-row">
- <% tool_dependencies = metadata[ 'tool_dependencies' ] %>
- <table class="grid">
- <tr>
- <td><b>name</b></td>
- <td><b>version</b></td>
- <td><b>type</b></td>
- </tr>
- %for dependency_key, requirements_dict in tool_dependencies.items():
- <%
- name = requirements_dict[ 'name' ]
- version = requirements_dict[ 'version' ]
- type = requirements_dict[ 'type' ]
-
- %>
+ <%
+ # See if tool dependencies are packages, environment settings or both.
+ tool_dependencies = metadata[ 'tool_dependencies' ]
+ contains_packages = False
+ for k in tool_dependencies.keys():
+ if k != 'set_environment':
+ contains_packages = True
+ break
+ contains_env_settings = 'set_environment' in tool_dependencies.keys()
+ %>
+ %if contains_packages:
+ <div class="form-row">
+ <table width="100%">
+ <tr bgcolor="#D8D8D8" width="100%">
+ <td><b>The following tool dependencies can optionally be automatically installed</i></td>
+ </tr>
+ </table>
+ </div>
+ <div style="clear: both"></div>
+ <div class="form-row">
+ <table class="grid"><tr>
- <td>${name}</td>
- <td>${version}</td>
- <td>${type}</td>
+ <td><b>name</b></td>
+ <td><b>version</b></td>
+ <td><b>type</b></td></tr>
- %endfor
- </table>
- </div>
- <div style="clear: both"></div>
+ %for dependency_key, requirements_dict in tool_dependencies.items():
+ %if dependency_key != 'set_environment':
+ <%
+ name = requirements_dict[ 'name' ]
+ version = requirements_dict[ 'version' ]
+ type = requirements_dict[ 'type' ]
+ %>
+ <tr>
+ <td>${name}</td>
+ <td>${version}</td>
+ <td>${type}</td>
+ </tr>
+ %endif
+ %endfor
+ </table>
+ </div>
+ <div style="clear: both"></div>
+ %endif
+ %if contains_env_settings:
+ <div class="form-row">
+ <table width="100%">
+ <tr bgcolor="#D8D8D8" width="100%">
+ <td><b>The following environment settings can optionally be handled as part of the installation</i></td>
+ </tr>
+ </table>
+ </div>
+ <div style="clear: both"></div>
+ <div class="form-row">
+ <table class="grid">
+ <tr>
+ <td><b>name</b></td>
+ <td><b>type</b></td>
+ </tr>
+ <% environment_settings = tool_dependencies[ 'set_environment' ] %>
+ %for requirements_dict in environment_settings:
+ <tr>
+ <td>${requirements_dict[ 'name' ]}</td>
+ <td>${requirements_dict[ 'type' ]}</td>
+ </tr>
+ %endfor
+ </table>
+ </div>
+ <div style="clear: both"></div>
+ %endif
%endif
%if 'tools' in metadata:
<div class="form-row">
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: jgoecks: Clean up JavaScript loading: (1) ensure galaxy.base is always loaded and (2) remove all duplicate loading of jQuery, bootstrap, and galaxy.base
by Bitbucket 13 Sep '12
by Bitbucket 13 Sep '12
13 Sep '12
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/changeset/1eba2def5265/
changeset: 1eba2def5265
user: jgoecks
date: 2012-09-13 16:18:22
summary: Clean up JavaScript loading: (1) ensure galaxy.base is always loaded and (2) remove all duplicate loading of jQuery, bootstrap, and galaxy.base
affected #: 20 files
diff -r 7663ed1ce1779b78f5f39037def1c4610b96ce56 -r 1eba2def52653577163901c765fd4686c9d42dfc templates/base.mako
--- a/templates/base.mako
+++ b/templates/base.mako
@@ -29,6 +29,7 @@
${h.js(
"libs/jquery/jquery",
+ "libs/json2",
"libs/bootstrap",
"galaxy.base",
"libs/underscore",
diff -r 7663ed1ce1779b78f5f39037def1c4610b96ce56 -r 1eba2def52653577163901c765fd4686c9d42dfc templates/base_panels.mako
--- a/templates/base_panels.mako
+++ b/templates/base_panels.mako
@@ -48,7 +48,7 @@
<!--[if lt IE 7]>
${h.js( 'libs/IE/IE7', 'libs/IE/ie7-recalc' )}
<![endif]-->
- ${h.js( 'libs/jquery/jquery', 'libs/bootstrap', 'libs/underscore', 'libs/backbone/backbone', 'libs/backbone/backbone-relational', 'libs/handlebars.runtime', 'mvc/ui' )}
+ ${h.js( 'libs/jquery/jquery', 'libs/json2', 'libs/bootstrap', 'libs/underscore', 'libs/backbone/backbone', 'libs/backbone/backbone-relational', 'libs/handlebars.runtime', 'mvc/ui' )}
<script type="text/javascript">
// Set up needed paths.
var galaxy_paths = new GalaxyPaths({
diff -r 7663ed1ce1779b78f5f39037def1c4610b96ce56 -r 1eba2def52653577163901c765fd4686c9d42dfc templates/dataset/copy_view.mako
--- a/templates/dataset/copy_view.mako
+++ b/templates/dataset/copy_view.mako
@@ -4,7 +4,6 @@
<%def name="javascripts()">
${parent.javascripts()}
- ${h.js( "libs/jquery/jquery", "galaxy.base" )}
<script type="text/javascript">
$(function() {
diff -r 7663ed1ce1779b78f5f39037def1c4610b96ce56 -r 1eba2def52653577163901c765fd4686c9d42dfc templates/dataset/edit_attributes.mako
--- a/templates/dataset/edit_attributes.mako
+++ b/templates/dataset/edit_attributes.mako
@@ -11,7 +11,7 @@
<%def name="javascripts()">
${parent.javascripts()}
${message_ns.javascripts()}
- ${h.js( "galaxy.base", "libs/jquery/jquery.autocomplete", "galaxy.autocom_tagging" )}
+ ${h.js( "libs/jquery/jquery.autocomplete", "galaxy.autocom_tagging" )}
</%def><%def name="datatype( dataset, datatypes )">
diff -r 7663ed1ce1779b78f5f39037def1c4610b96ce56 -r 1eba2def52653577163901c765fd4686c9d42dfc templates/display_base.mako
--- a/templates/display_base.mako
+++ b/templates/display_base.mako
@@ -32,7 +32,7 @@
<%def name="javascripts()">
${parent.javascripts()}
- ${h.js( "libs/jquery/jquery", "libs/bootstrap", "galaxy.base", "libs/json2", "libs/jquery/jstorage", "libs/jquery/jquery.autocomplete", "libs/jquery/jquery.rating",
+ ${h.js( "libs/jquery/jstorage", "libs/jquery/jquery.autocomplete", "libs/jquery/jquery.rating",
"galaxy.autocom_tagging", "viz/trackster", "viz/trackster_ui", "libs/jquery/jquery.event.drag", "libs/jquery/jquery.mousewheel",
"libs/jquery/jquery.autocomplete", "libs/jquery/jquery.ui.sortable.slider", "libs/farbtastic", "mvc/data", "viz/visualization" )}
@@ -113,7 +113,7 @@
<%def name="stylesheets()">
${parent.stylesheets()}
- ${h.css( "autocomplete_tagging", "embed_item", "trackster", "jquery.rating", "overcast/jquery-ui-1.8.5.custom" )}
+ ${h.css( "autocomplete_tagging", "embed_item", "trackster", "jquery.rating", "jquery-ui/smoothness/jquery-ui-1.8.23.custom" )}
<style type="text/css">
.page-body {
diff -r 7663ed1ce1779b78f5f39037def1c4610b96ce56 -r 1eba2def52653577163901c765fd4686c9d42dfc templates/history/view.mako
--- a/templates/history/view.mako
+++ b/templates/history/view.mako
@@ -13,7 +13,7 @@
<%def name="javascripts()">
${parent.javascripts()}
- ${h.js( "galaxy.base", "libs/jquery/jquery", "libs/json2", "libs/jquery/jstorage" )}
+ ${h.js( "libs/jquery/jstorage" )}
<script type="text/javascript">
$(function() {
init_history_items( $("div.historyItemWrapper"), false, "nochanges" );
diff -r 7663ed1ce1779b78f5f39037def1c4610b96ce56 -r 1eba2def52653577163901c765fd4686c9d42dfc templates/library/common/browse_library.mako
--- a/templates/library/common/browse_library.mako
+++ b/templates/library/common/browse_library.mako
@@ -48,7 +48,6 @@
<%def name="javascripts()">
${parent.javascripts()}
- ${h.js("libs/json2")}
${h.js("libs/jquery/jstorage")}
${common_javascripts()}
${self.grid_javascripts()}
diff -r 7663ed1ce1779b78f5f39037def1c4610b96ce56 -r 1eba2def52653577163901c765fd4686c9d42dfc templates/library/common/import_datasets_to_histories.mako
--- a/templates/library/common/import_datasets_to_histories.mako
+++ b/templates/library/common/import_datasets_to_histories.mako
@@ -5,7 +5,6 @@
<%def name="javascripts()">
${parent.javascripts()}
- ${h.js( "libs/jquery/jquery", "galaxy.base" )}
<script type="text/javascript">
$(function() {
$("#select-multiple").click(function() {
diff -r 7663ed1ce1779b78f5f39037def1c4610b96ce56 -r 1eba2def52653577163901c765fd4686c9d42dfc templates/page/editor.mako
--- a/templates/page/editor.mako
+++ b/templates/page/editor.mako
@@ -21,8 +21,8 @@
<%def name="javascripts()">
${parent.javascripts()}
- ${h.js( "libs/jquery/jquery.event.drag", "libs/jquery/jquery.event.drop", "libs/jquery/jquery.event.hover", "libs/jquery/jquery.form", "libs/json2", "libs/jquery/jstorage",
- "galaxy.base", "libs/jquery/jquery.wymeditor", "libs/jquery/jquery.autocomplete", "galaxy.autocom_tagging")}
+ ${h.js( "libs/jquery/jquery.event.drag", "libs/jquery/jquery.event.drop", "libs/jquery/jquery.event.hover", "libs/jquery/jquery.form",
+ "libs/jquery/jstorage", "libs/jquery/jquery.wymeditor", "libs/jquery/jquery.autocomplete", "galaxy.autocom_tagging")}
<script type="text/javascript">
// Useful Galaxy stuff.
diff -r 7663ed1ce1779b78f5f39037def1c4610b96ce56 -r 1eba2def52653577163901c765fd4686c9d42dfc templates/root/alternate_history.mako
--- a/templates/root/alternate_history.mako
+++ b/templates/root/alternate_history.mako
@@ -286,7 +286,7 @@
${parent.javascripts()}
${h.js(
- "libs/json2", "libs/jquery/jstorage", "libs/jquery/jquery.autocomplete",
+ "libs/jquery/jstorage", "libs/jquery/jquery.autocomplete",
##"libs/handlebars.full",
"galaxy.autocom_tagging",
"mvc/base-mvc", "mvc/ui"
diff -r 7663ed1ce1779b78f5f39037def1c4610b96ce56 -r 1eba2def52653577163901c765fd4686c9d42dfc templates/root/tool_menu.mako
--- a/templates/root/tool_menu.mako
+++ b/templates/root/tool_menu.mako
@@ -17,7 +17,7 @@
<%def name="javascripts()">
${parent.javascripts()}
${h.templates( "tool_link", "panel_section", "tool_search" )}
- ${h.js( "galaxy.base", "libs/json2", "galaxy.autocom_tagging", "mvc/tools", "libs/bootstrap" )}
+ ${h.js( "galaxy.autocom_tagging", "mvc/tools" )}
<%
# Set up for creating tool panel.
diff -r 7663ed1ce1779b78f5f39037def1c4610b96ce56 -r 1eba2def52653577163901c765fd4686c9d42dfc templates/tool_form.mako
--- a/templates/tool_form.mako
+++ b/templates/tool_form.mako
@@ -12,7 +12,7 @@
</%def><%def name="javascripts()">
- ${h.js( "libs/jquery/jquery", "galaxy.panels", "galaxy.base", "libs/jquery/jquery.autocomplete", "libs/jquery/jstorage", "libs/bootstrap" )}
+ ${h.js( "galaxy.panels", "libs/jquery/jquery.autocomplete", "libs/jquery/jstorage" )}
<script type="text/javascript">
$(function() {
$(window).bind("refresh_on_change", function() {
diff -r 7663ed1ce1779b78f5f39037def1c4610b96ce56 -r 1eba2def52653577163901c765fd4686c9d42dfc templates/tracks/browser.mako
--- a/templates/tracks/browser.mako
+++ b/templates/tracks/browser.mako
@@ -21,7 +21,7 @@
<script type='text/javascript' src="${h.url_for('/static/scripts/libs/IE/excanvas.js')}"></script><![endif]-->
-${h.js( "galaxy.base", "galaxy.panels", "libs/json2", "libs/jquery/jquery", "libs/bootstrap", "libs/jquery/jstorage", "libs/jquery/jquery.event.drag", "libs/jquery/jquery.event.hover","libs/jquery/jquery.mousewheel", "libs/jquery/jquery-ui-1.8.23.custom.min", "mvc/data", "viz/visualization", "viz/trackster", "viz/trackster_ui", "libs/farbtastic" )}
+${h.js( "galaxy.panels", "libs/jquery/jstorage", "libs/jquery/jquery.event.drag", "libs/jquery/jquery.event.hover","libs/jquery/jquery.mousewheel", "libs/jquery/jquery-ui-1.8.23.custom.min", "mvc/data", "viz/visualization", "viz/trackster", "viz/trackster_ui", "libs/farbtastic" )}
<script type="text/javascript">
//
diff -r 7663ed1ce1779b78f5f39037def1c4610b96ce56 -r 1eba2def52653577163901c765fd4686c9d42dfc templates/webapps/community/admin/index.mako
--- a/templates/webapps/community/admin/index.mako
+++ b/templates/webapps/community/admin/index.mako
@@ -18,7 +18,6 @@
<%def name="javascripts()">
${parent.javascripts()}
- ${h.js( "libs/jquery/jquery", "galaxy.base" )}
</%def><%def name="init()">
diff -r 7663ed1ce1779b78f5f39037def1c4610b96ce56 -r 1eba2def52653577163901c765fd4686c9d42dfc templates/webapps/community/index.mako
--- a/templates/webapps/community/index.mako
+++ b/templates/webapps/community/index.mako
@@ -19,7 +19,6 @@
<%def name="javascripts()">
${parent.javascripts()}
- ${h.js( "libs/jquery/jquery", "galaxy.base" )}
</%def><%def name="init()">
diff -r 7663ed1ce1779b78f5f39037def1c4610b96ce56 -r 1eba2def52653577163901c765fd4686c9d42dfc templates/webapps/galaxy/admin/index.mako
--- a/templates/webapps/galaxy/admin/index.mako
+++ b/templates/webapps/galaxy/admin/index.mako
@@ -22,7 +22,6 @@
<%def name="javascripts()">
${parent.javascripts()}
- ${h.js( "libs/jquery/jquery", "galaxy.base" )}
</%def><%def name="init()">
diff -r 7663ed1ce1779b78f5f39037def1c4610b96ce56 -r 1eba2def52653577163901c765fd4686c9d42dfc templates/webapps/reports/index.mako
--- a/templates/webapps/reports/index.mako
+++ b/templates/webapps/reports/index.mako
@@ -26,7 +26,6 @@
<%def name="javascripts()">
${parent.javascripts()}
- ${h.js( "libs/jquery/jquery", "galaxy.base" )}
</%def><%def name="left_panel()">
diff -r 7663ed1ce1779b78f5f39037def1c4610b96ce56 -r 1eba2def52653577163901c765fd4686c9d42dfc templates/workflow/edit_attributes.mako
--- a/templates/workflow/edit_attributes.mako
+++ b/templates/workflow/edit_attributes.mako
@@ -9,7 +9,7 @@
<%def name="javascripts()">
${parent.javascripts()}
- ${h.js( "galaxy.base", "libs/jquery/jquery.autocomplete", "galaxy.autocom_tagging" )}
+ ${h.js( "libs/jquery/jquery.autocomplete", "galaxy.autocom_tagging" )}
</%def>
%if msg:
diff -r 7663ed1ce1779b78f5f39037def1c4610b96ce56 -r 1eba2def52653577163901c765fd4686c9d42dfc templates/workflow/editor.mako
--- a/templates/workflow/editor.mako
+++ b/templates/workflow/editor.mako
@@ -25,15 +25,11 @@
<script type='text/javascript' src="${h.url_for('/static/scripts/libs/IE/excanvas.js')}"></script><![endif]-->
- ${h.js( "libs/jquery/jquery",
- "libs/bootstrap",
- "libs/jquery/jquery.event.drag",
+ ${h.js( "libs/jquery/jquery.event.drag",
"libs/jquery/jquery.event.drop",
"libs/jquery/jquery.event.hover",
"libs/jquery/jquery.form",
- "libs/json2",
"libs/jquery/jstorage",
- "galaxy.base",
"galaxy.workflow_editor.canvas",
"libs/jquery/jquery.autocomplete",
"galaxy.autocom_tagging")}
diff -r 7663ed1ce1779b78f5f39037def1c4610b96ce56 -r 1eba2def52653577163901c765fd4686c9d42dfc templates/workflow/run.mako
--- a/templates/workflow/run.mako
+++ b/templates/workflow/run.mako
@@ -2,7 +2,7 @@
<%def name="javascripts()">
${parent.javascripts()}
- ${h.js( "libs/jquery/jquery.autocomplete", "libs/bootstrap" )}
+ ${h.js( "libs/jquery/jquery.autocomplete" )}
<script type="text/javascript">
$( function() {
function show_tool_body(title){
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: jgoecks: Bug fix and code cleanup for recent visualization commits.
by Bitbucket 13 Sep '12
by Bitbucket 13 Sep '12
13 Sep '12
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/changeset/7663ed1ce177/
changeset: 7663ed1ce177
user: jgoecks
date: 2012-09-13 15:30:42
summary: Bug fix and code cleanup for recent visualization commits.
affected #: 2 files
diff -r eb55dd8768cefb1548b2ced2e44a7df4fe8dde5e -r 7663ed1ce1779b78f5f39037def1c4610b96ce56 static/scripts/viz/circster.js
--- a/static/scripts/viz/circster.js
+++ b/static/scripts/viz/circster.js
@@ -1,7 +1,7 @@
define( ["libs/d3", "viz/visualization"], function( d3, visualization ) {
// General backbone style inheritence
-var Base = function() { this.initialize && this.initialize.apply(this, arguments) }; Base.extend = Backbone.Model.extend;
+var Base = function() { this.initialize && this.initialize.apply(this, arguments); }; Base.extend = Backbone.Model.extend;
/**
* Renders a full circster visualization
@@ -23,8 +23,8 @@
height = self.$el.height(),
// Compute radius start based on model, will be centered
// and fit entirely inside element by default
- init_radius_start = ( Math.min(width,height)/2
- - this.model.get('tracks').length * (this.dataset_arc_height + this.track_gap) );
+ init_radius_start = ( Math.min(width,height)/2 -
+ this.model.get('tracks').length * (this.dataset_arc_height + this.track_gap) );
// Set up SVG element.
var svg = d3.select(self.$el[0])
@@ -36,11 +36,11 @@
.append('svg:g')
.call(d3.behavior.zoom().on('zoom', function() {
svg.attr("transform",
- "translate(" + d3.event.translate + ")"
- + " scale(" + d3.event.scale + ")");
+ "translate(" + d3.event.translate + ")" +
+ " scale(" + d3.event.scale + ")");
}))
.attr("transform", "translate(" + width / 2 + "," + height / 2 + ")")
- .append('svg:g')
+ .append('svg:g');
// -- Render each dataset in the visualization. --
@@ -49,7 +49,7 @@
radius_start = init_radius_start + index * (dataset_arc_height + self.track_gap),
track_renderer_class = (dataset instanceof visualization.GenomeWideBigWigData ? CircsterBigWigTrackRenderer : CircsterSummaryTreeTrackRenderer );
- track_renderer = new track_renderer_class({
+ var track_renderer = new track_renderer_class({
track: track,
radius_start: radius_start,
radius_end: radius_start + dataset_arc_height,
@@ -71,8 +71,8 @@
render: function( svg ) {
- genome_arcs = this.chroms_layout(),
- chroms_arcs = this.genome_data_layout();
+ var genome_arcs = this.chroms_layout(),
+ chroms_arcs = this.genome_data_layout();
// -- Render. --
@@ -106,7 +106,7 @@
//.style("stroke", block_color)
//.style("fill", block_color)
- dataset_elts.append("path").attr("d", arc_gen).style("stroke", block_color)
+ dataset_elts.append("path").attr("d", arc_gen).style("stroke", block_color);
});
},
@@ -160,7 +160,7 @@
/**
* Layout for summary tree data in a circster visualization.
*/
-var CircsterSummaryTrackRenderer = CircsterTrackRenderer.extend({
+var CircsterSummaryTreeTrackRenderer = CircsterTrackRenderer.extend({
/**
* Returns layouts for drawing a chromosome's data.
@@ -230,6 +230,6 @@
return {
CircsterView: CircsterView
-}
+};
});
diff -r eb55dd8768cefb1548b2ced2e44a7df4fe8dde5e -r 7663ed1ce1779b78f5f39037def1c4610b96ce56 static/scripts/viz/visualization.js
--- a/static/scripts/viz/visualization.js
+++ b/static/scripts/viz/visualization.js
@@ -783,31 +783,31 @@
return module.exports;
} else if ( typeof define === 'function' && define.amd ) {
// AMD
- exports = {}
- define( function() { return exports } );
- return exports
+ exports = {};
+ define( function() { return exports; } );
+ return exports;
} else {
// Browser global
return window;
}
})();
-exports.BrowserBookmark = BrowserBookmark
-exports.BrowserBookmarkCollection = BrowserBookmarkCollection
-exports.Cache = Cache
-exports.CanvasManager = CanvasManager
-exports.Genome = Genome
-exports.GenomeDataManager = GenomeDataManager
-exports.GenomeRegion = GenomeRegion
-exports.GenomeRegionCollection = GenomeRegionCollection
-exports.GenomeVisualization = GenomeVisualization
-exports.GenomeWideBigWigData = GenomeWideBigWigData
-exports.GenomeWideSummaryTreeData = GenomeWideSummaryTreeData
-exports.ReferenceTrackDataManager = ReferenceTrackDataManager
-exports.ServerStateDeferred = ServerStateDeferred
-exports.TrackBrowserRouter = TrackBrowserRouter
-exports.TrackConfig = TrackConfig
-exports.Visualization = Visualization
-exports.add_datasets = add_datasets
+exports.BrowserBookmark = BrowserBookmark;
+exports.BrowserBookmarkCollection = BrowserBookmarkCollection;
+exports.Cache = Cache;
+exports.CanvasManager = CanvasManager;
+exports.Genome = Genome;
+exports.GenomeDataManager = GenomeDataManager;
+exports.GenomeRegion = GenomeRegion;
+exports.GenomeRegionCollection = GenomeRegionCollection;
+exports.GenomeVisualization = GenomeVisualization;
+exports.GenomeWideBigWigData = GenomeWideBigWigData;
+exports.GenomeWideSummaryTreeData = GenomeWideSummaryTreeData;
+exports.ReferenceTrackDataManager = ReferenceTrackDataManager;
+exports.ServerStateDeferred = ServerStateDeferred;
+exports.TrackBrowserRouter = TrackBrowserRouter;
+exports.TrackConfig = TrackConfig;
+exports.Visualization = Visualization;
+exports.add_datasets = add_datasets;
}).call(this);
\ 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: dannon: Temporarily hide (though not remove) share string option in cloud launch form due to it sometimes failing on the cloudman end.
by Bitbucket 12 Sep '12
by Bitbucket 12 Sep '12
12 Sep '12
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/changeset/eb55dd8768ce/
changeset: eb55dd8768ce
user: dannon
date: 2012-09-12 22:23:26
summary: Temporarily hide (though not remove) share string option in cloud launch form due to it sometimes failing on the cloudman end.
affected #: 1 file
diff -r 3668de7a24ef93da9ef6d5ef7f45a61966fbe19f -r eb55dd8768cefb1548b2ced2e44a7df4fe8dde5e templates/cloud/index.mako
--- a/templates/cloud/index.mako
+++ b/templates/cloud/index.mako
@@ -150,8 +150,6 @@
</script></%def>
-
-
<%def name="center_panel()"><div style="overflow: auto; height: 100%;"><div class="page-container" style="padding: 10px;">
@@ -167,9 +165,8 @@
<label for="id_key_id">Key ID</label><input type="text" size="30" maxlength="20" name="key_id" id="id_key_id" value=""/><br/><div class="toolParamHelp">
- This is the text string that uniquely identifies your account, found in the <a
-href="https://portal.aws.amazon.com/gp/aws/securityCredentials">Security Credentials section of the AWS
-Console</a>.
+ This is the text string that uniquely identifies your account, found in the
+ <a href="https://portal.aws.amazon.com/gp/aws/securityCredentials">Security Credentials section of the AWS Console</a>.
</div></div>
@@ -210,11 +207,13 @@
%if share_string:
<input type='hidden' name='share_string' value='${share_string}'/>
%else:
- <div class="form-row">
+ <!-- DBEDIT temporary hide share string due to it being broken on the cloudman end -->
+ <div class="form-row" style="display:none;"><label for="id_share_string">Instance Share String (optional)</label><input type="text" size="120" name="share_string" id="id_share_string"/><br/></div>
%endif
+
<div class="form-row"><label for="id_instance_type">Instance Type</label><select name="instance_type" id="id_instance_type">
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
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/changeset/3668de7a24ef/
changeset: 3668de7a24ef
user: james_taylor
date: 2012-09-12 21:43:03
summary: adding packed scripts
affected #: 2 files
diff -r 45ddaa89e9855d21ce2f6a29a0eb90cc61abd7cd -r 3668de7a24ef93da9ef6d5ef7f45a61966fbe19f static/scripts/packed/require.js
--- /dev/null
+++ b/static/scripts/packed/require.js
@@ -0,0 +1,1 @@
+var requirejs,require,define;(function(global){var req,s,head,baseElement,dataMain,src,interactiveScript,currentlyAddingScript,mainScript,subPath,version="2.0.6",commentRegExp=/(\/\*([\s\S]*?)\*\/|([^:]|^)\/\/(.*)$)/mg,cjsRequireRegExp=/[^.]\s*require\s*\(\s*["']([^'"\s]+)["']\s*\)/g,jsSuffixRegExp=/\.js$/,currDirRegExp=/^\.\//,op=Object.prototype,ostring=op.toString,hasOwn=op.hasOwnProperty,ap=Array.prototype,aps=ap.slice,apsp=ap.splice,isBrowser=!!(typeof window!=="undefined"&&navigator&&document),isWebWorker=!isBrowser&&typeof importScripts!=="undefined",readyRegExp=isBrowser&&navigator.platform==="PLAYSTATION 3"?/^complete$/:/^(complete|loaded)$/,defContextName="_",isOpera=typeof opera!=="undefined"&&opera.toString()==="[object Opera]",contexts={},cfg={},globalDefQueue=[],useInteractive=false;function isFunction(it){return ostring.call(it)==="[object Function]"}function isArray(it){return ostring.call(it)==="[object Array]"}function each(ary,func){if(ary){var i;for(i=0;i<ary.length;i+=1){if(ary[i]&&func(ary[i],i,ary)){break}}}}function eachReverse(ary,func){if(ary){var i;for(i=ary.length-1;i>-1;i-=1){if(ary[i]&&func(ary[i],i,ary)){break}}}}function hasProp(obj,prop){return hasOwn.call(obj,prop)}function eachProp(obj,func){var prop;for(prop in obj){if(obj.hasOwnProperty(prop)){if(func(obj[prop],prop)){break}}}}function mixin(target,source,force,deepStringMixin){if(source){eachProp(source,function(value,prop){if(force||!hasProp(target,prop)){if(deepStringMixin&&typeof value!=="string"){if(!target[prop]){target[prop]={}}mixin(target[prop],value,force,deepStringMixin)}else{target[prop]=value}}})}return target}function bind(obj,fn){return function(){return fn.apply(obj,arguments)}}function scripts(){return document.getElementsByTagName("script")}function getGlobal(value){if(!value){return value}var g=global;each(value.split("."),function(part){g=g[part]});return g}function makeContextModuleFunc(func,relMap,enableBuildCallback){return function(){var args=aps.call(arguments,0),lastArg;if(enableBuildCallback&&isFunction((lastArg=args[args.length-1]))){lastArg.__requireJsBuild=true}args.push(relMap);return func.apply(null,args)}}function addRequireMethods(req,context,relMap){each([["toUrl"],["undef"],["defined","requireDefined"],["specified","requireSpecified"]],function(item){var prop=item[1]||item[0];req[item[0]]=context?makeContextModuleFunc(context[prop],relMap):function(){var ctx=contexts[defContextName];return ctx[prop].apply(ctx,arguments)}})}function makeError(id,msg,err,requireModules){var e=new Error(msg+"\nhttp://requirejs.org/docs/errors.html#"+id);e.requireType=id;e.requireModules=requireModules;if(err){e.originalError=err}return e}if(typeof define!=="undefined"){return}if(typeof requirejs!=="undefined"){if(isFunction(requirejs)){return}cfg=requirejs;requirejs=undefined}if(typeof require!=="undefined"&&!isFunction(require)){cfg=require;require=undefined}function newContext(contextName){var inCheckLoaded,Module,context,handlers,checkLoadedTimeoutId,config={waitSeconds:7,baseUrl:"./",paths:{},pkgs:{},shim:{}},registry={},undefEvents={},defQueue=[],defined={},urlFetched={},requireCounter=1,unnormalizedCounter=1,waitAry=[];function trimDots(ary){var i,part;for(i=0;ary[i];i+=1){part=ary[i];if(part==="."){ary.splice(i,1);i-=1}else{if(part===".."){if(i===1&&(ary[2]===".."||ary[0]==="..")){break}else{if(i>0){ary.splice(i-1,2);i-=2}}}}}}function normalize(name,baseName,applyMap){var pkgName,pkgConfig,mapValue,nameParts,i,j,nameSegment,foundMap,foundI,foundStarMap,starI,baseParts=baseName&&baseName.split("/"),normalizedBaseParts=baseParts,map=config.map,starMap=map&&map["*"];if(name&&name.charAt(0)==="."){if(baseName){if(config.pkgs[baseName]){normalizedBaseParts=baseParts=[baseName]}else{normalizedBaseParts=baseParts.slice(0,baseParts.length-1)}name=normalizedBaseParts.concat(name.split("/"));trimDots(name);pkgConfig=config.pkgs[(pkgName=name[0])];name=name.join("/");if(pkgConfig&&name===pkgName+"/"+pkgConfig.main){name=pkgName}}else{if(name.indexOf("./")===0){name=name.substring(2)}}}if(applyMap&&(baseParts||starMap)&&map){nameParts=name.split("/");for(i=nameParts.length;i>0;i-=1){nameSegment=nameParts.slice(0,i).join("/");if(baseParts){for(j=baseParts.length;j>0;j-=1){mapValue=map[baseParts.slice(0,j).join("/")];if(mapValue){mapValue=mapValue[nameSegment];if(mapValue){foundMap=mapValue;foundI=i;break}}}}if(foundMap){break}if(!foundStarMap&&starMap&&starMap[nameSegment]){foundStarMap=starMap[nameSegment];starI=i}}if(!foundMap&&foundStarMap){foundMap=foundStarMap;foundI=starI}if(foundMap){nameParts.splice(0,foundI,foundMap);name=nameParts.join("/")}}return name}function removeScript(name){if(isBrowser){each(scripts(),function(scriptNode){if(scriptNode.getAttribute("data-requiremodule")===name&&scriptNode.getAttribute("data-requirecontext")===context.contextName){scriptNode.parentNode.removeChild(scriptNode);return true}})}}function hasPathFallback(id){var pathConfig=config.paths[id];if(pathConfig&&isArray(pathConfig)&&pathConfig.length>1){removeScript(id);pathConfig.shift();context.undef(id);context.require([id]);return true}}function makeModuleMap(name,parentModuleMap,isNormalized,applyMap){var url,pluginModule,suffix,index=name?name.indexOf("!"):-1,prefix=null,parentName=parentModuleMap?parentModuleMap.name:null,originalName=name,isDefine=true,normalizedName="";if(!name){isDefine=false;name="_@r"+(requireCounter+=1)}if(index!==-1){prefix=name.substring(0,index);name=name.substring(index+1,name.length)}if(prefix){prefix=normalize(prefix,parentName,applyMap);pluginModule=defined[prefix]}if(name){if(prefix){if(pluginModule&&pluginModule.normalize){normalizedName=pluginModule.normalize(name,function(name){return normalize(name,parentName,applyMap)})}else{normalizedName=normalize(name,parentName,applyMap)}}else{normalizedName=normalize(name,parentName,applyMap);url=context.nameToUrl(normalizedName)}}suffix=prefix&&!pluginModule&&!isNormalized?"_unnormalized"+(unnormalizedCounter+=1):"";return{prefix:prefix,name:normalizedName,parentMap:parentModuleMap,unnormalized:!!suffix,url:url,originalName:originalName,isDefine:isDefine,id:(prefix?prefix+"!"+normalizedName:normalizedName)+suffix}}function getModule(depMap){var id=depMap.id,mod=registry[id];if(!mod){mod=registry[id]=new context.Module(depMap)}return mod}function on(depMap,name,fn){var id=depMap.id,mod=registry[id];if(hasProp(defined,id)&&(!mod||mod.defineEmitComplete)){if(name==="defined"){fn(defined[id])}}else{getModule(depMap).on(name,fn)}}function onError(err,errback){var ids=err.requireModules,notified=false;if(errback){errback(err)}else{each(ids,function(id){var mod=registry[id];if(mod){mod.error=err;if(mod.events.error){notified=true;mod.emit("error",err)}}});if(!notified){req.onError(err)}}}function takeGlobalQueue(){if(globalDefQueue.length){apsp.apply(defQueue,[defQueue.length-1,0].concat(globalDefQueue));globalDefQueue=[]}}function makeRequire(mod,enableBuildCallback,altRequire){var relMap=mod&&mod.map,modRequire=makeContextModuleFunc(altRequire||context.require,relMap,enableBuildCallback);addRequireMethods(modRequire,context,relMap);modRequire.isBrowser=isBrowser;return modRequire}handlers={require:function(mod){return makeRequire(mod)},exports:function(mod){mod.usingExports=true;if(mod.map.isDefine){return(mod.exports=defined[mod.map.id]={})}},module:function(mod){return(mod.module={id:mod.map.id,uri:mod.map.url,config:function(){return(config.config&&config.config[mod.map.id])||{}},exports:defined[mod.map.id]})}};function removeWaiting(id){delete registry[id];each(waitAry,function(mod,i){if(mod.map.id===id){waitAry.splice(i,1);if(!mod.defined){context.waitCount-=1}return true}})}function findCycle(mod,traced,processed){var id=mod.map.id,depArray=mod.depMaps,foundModule;if(!mod.inited){return}if(traced[id]){return mod}traced[id]=true;each(depArray,function(depMap){var depId=depMap.id,depMod=registry[depId];if(!depMod||processed[depId]||!depMod.inited||!depMod.enabled){return}return(foundModule=findCycle(depMod,traced,processed))});processed[id]=true;return foundModule}function forceExec(mod,traced,uninited){var id=mod.map.id,depArray=mod.depMaps;if(!mod.inited||!mod.map.isDefine){return}if(traced[id]){return defined[id]}traced[id]=mod;each(depArray,function(depMap){var depId=depMap.id,depMod=registry[depId],value;if(handlers[depId]){return}if(depMod){if(!depMod.inited||!depMod.enabled){uninited[id]=true;return}value=forceExec(depMod,traced,uninited);if(!uninited[depId]){mod.defineDepById(depId,value)}}});mod.check(true);return defined[id]}function modCheck(mod){mod.check()}function checkLoaded(){var map,modId,err,usingPathFallback,waitInterval=config.waitSeconds*1000,expired=waitInterval&&(context.startTime+waitInterval)<new Date().getTime(),noLoads=[],stillLoading=false,needCycleCheck=true;if(inCheckLoaded){return}inCheckLoaded=true;eachProp(registry,function(mod){map=mod.map;modId=map.id;if(!mod.enabled){return}if(!mod.error){if(!mod.inited&&expired){if(hasPathFallback(modId)){usingPathFallback=true;stillLoading=true}else{noLoads.push(modId);removeScript(modId)}}else{if(!mod.inited&&mod.fetched&&map.isDefine){stillLoading=true;if(!map.prefix){return(needCycleCheck=false)}}}}});if(expired&&noLoads.length){err=makeError("timeout","Load timeout for modules: "+noLoads,null,noLoads);err.contextName=context.contextName;return onError(err)}if(needCycleCheck){each(waitAry,function(mod){if(mod.defined){return}var cycleMod=findCycle(mod,{},{}),traced={};if(cycleMod){forceExec(cycleMod,traced,{});eachProp(traced,modCheck)}});eachProp(registry,modCheck)}if((!expired||usingPathFallback)&&stillLoading){if((isBrowser||isWebWorker)&&!checkLoadedTimeoutId){checkLoadedTimeoutId=setTimeout(function(){checkLoadedTimeoutId=0;checkLoaded()},50)}}inCheckLoaded=false}Module=function(map){this.events=undefEvents[map.id]||{};this.map=map;this.shim=config.shim[map.id];this.depExports=[];this.depMaps=[];this.depMatched=[];this.pluginMaps={};this.depCount=0};Module.prototype={init:function(depMaps,factory,errback,options){options=options||{};if(this.inited){return}this.factory=factory;if(errback){this.on("error",errback)}else{if(this.events.error){errback=bind(this,function(err){this.emit("error",err)})}}this.depMaps=depMaps&&depMaps.slice(0);this.depMaps.rjsSkipMap=depMaps.rjsSkipMap;this.errback=errback;this.inited=true;this.ignore=options.ignore;if(options.enabled||this.enabled){this.enable()}else{this.check()}},defineDepById:function(id,depExports){var i;each(this.depMaps,function(map,index){if(map.id===id){i=index;return true}});return this.defineDep(i,depExports)},defineDep:function(i,depExports){if(!this.depMatched[i]){this.depMatched[i]=true;this.depCount-=1;this.depExports[i]=depExports}},fetch:function(){if(this.fetched){return}this.fetched=true;context.startTime=(new Date()).getTime();var map=this.map;if(this.shim){makeRequire(this,true)(this.shim.deps||[],bind(this,function(){return map.prefix?this.callPlugin():this.load()}))}else{return map.prefix?this.callPlugin():this.load()}},load:function(){var url=this.map.url;if(!urlFetched[url]){urlFetched[url]=true;context.load(this.map.id,url)}},check:function(silent){if(!this.enabled||this.enabling){return}var err,cjsModule,id=this.map.id,depExports=this.depExports,exports=this.exports,factory=this.factory;if(!this.inited){this.fetch()}else{if(this.error){this.emit("error",this.error)}else{if(!this.defining){this.defining=true;if(this.depCount<1&&!this.defined){if(isFunction(factory)){if(this.events.error){try{exports=context.execCb(id,factory,depExports,exports)}catch(e){err=e}}else{exports=context.execCb(id,factory,depExports,exports)}if(this.map.isDefine){cjsModule=this.module;if(cjsModule&&cjsModule.exports!==undefined&&cjsModule.exports!==this.exports){exports=cjsModule.exports}else{if(exports===undefined&&this.usingExports){exports=this.exports}}}if(err){err.requireMap=this.map;err.requireModules=[this.map.id];err.requireType="define";return onError((this.error=err))}}else{exports=factory}this.exports=exports;if(this.map.isDefine&&!this.ignore){defined[id]=exports;if(req.onResourceLoad){req.onResourceLoad(context,this.map,this.depMaps)}}delete registry[id];this.defined=true;context.waitCount-=1;if(context.waitCount===0){waitAry=[]}}this.defining=false;if(!silent){if(this.defined&&!this.defineEmitted){this.defineEmitted=true;this.emit("defined",this.exports);this.defineEmitComplete=true}}}}}},callPlugin:function(){var map=this.map,id=map.id,pluginMap=makeModuleMap(map.prefix,null,false,true);on(pluginMap,"defined",bind(this,function(plugin){var load,normalizedMap,normalizedMod,name=this.map.name,parentName=this.map.parentMap?this.map.parentMap.name:null;if(this.map.unnormalized){if(plugin.normalize){name=plugin.normalize(name,function(name){return normalize(name,parentName,true)})||""}normalizedMap=makeModuleMap(map.prefix+"!"+name,this.map.parentMap,false,true);on(normalizedMap,"defined",bind(this,function(value){this.init([],function(){return value},null,{enabled:true,ignore:true})}));normalizedMod=registry[normalizedMap.id];if(normalizedMod){if(this.events.error){normalizedMod.on("error",bind(this,function(err){this.emit("error",err)}))}normalizedMod.enable()}return}load=bind(this,function(value){this.init([],function(){return value},null,{enabled:true})});load.error=bind(this,function(err){this.inited=true;this.error=err;err.requireModules=[id];eachProp(registry,function(mod){if(mod.map.id.indexOf(id+"_unnormalized")===0){removeWaiting(mod.map.id)}});onError(err)});load.fromText=function(moduleName,text){var hasInteractive=useInteractive;if(hasInteractive){useInteractive=false}getModule(makeModuleMap(moduleName));req.exec(text);if(hasInteractive){useInteractive=true}context.completeLoad(moduleName)};plugin.load(map.name,makeRequire(map.parentMap,true,function(deps,cb,er){deps.rjsSkipMap=true;return context.require(deps,cb,er)}),load,config)}));context.enable(pluginMap,this);this.pluginMaps[pluginMap.id]=pluginMap},enable:function(){this.enabled=true;if(!this.waitPushed){waitAry.push(this);context.waitCount+=1;this.waitPushed=true}this.enabling=true;each(this.depMaps,bind(this,function(depMap,i){var id,mod,handler;if(typeof depMap==="string"){depMap=makeModuleMap(depMap,(this.map.isDefine?this.map:this.map.parentMap),false,!this.depMaps.rjsSkipMap);this.depMaps[i]=depMap;handler=handlers[depMap.id];if(handler){this.depExports[i]=handler(this);return}this.depCount+=1;on(depMap,"defined",bind(this,function(depExports){this.defineDep(i,depExports);this.check()}));if(this.errback){on(depMap,"error",this.errback)}}id=depMap.id;mod=registry[id];if(!handlers[id]&&mod&&!mod.enabled){context.enable(depMap,this)}}));eachProp(this.pluginMaps,bind(this,function(pluginMap){var mod=registry[pluginMap.id];if(mod&&!mod.enabled){context.enable(pluginMap,this)}}));this.enabling=false;this.check()},on:function(name,cb){var cbs=this.events[name];if(!cbs){cbs=this.events[name]=[]}cbs.push(cb)},emit:function(name,evt){each(this.events[name],function(cb){cb(evt)});if(name==="error"){delete this.events[name]}}};function callGetModule(args){getModule(makeModuleMap(args[0],null,true)).init(args[1],args[2])}function removeListener(node,func,name,ieName){if(node.detachEvent&&!isOpera){if(ieName){node.detachEvent(ieName,func)}}else{node.removeEventListener(name,func,false)}}function getScriptData(evt){var node=evt.currentTarget||evt.srcElement;removeListener(node,context.onScriptLoad,"load","onreadystatechange");removeListener(node,context.onScriptError,"error");return{node:node,id:node&&node.getAttribute("data-requiremodule")}}return(context={config:config,contextName:contextName,registry:registry,defined:defined,urlFetched:urlFetched,waitCount:0,defQueue:defQueue,Module:Module,makeModuleMap:makeModuleMap,configure:function(cfg){if(cfg.baseUrl){if(cfg.baseUrl.charAt(cfg.baseUrl.length-1)!=="/"){cfg.baseUrl+="/"}}var pkgs=config.pkgs,shim=config.shim,paths=config.paths,map=config.map;mixin(config,cfg,true);config.paths=mixin(paths,cfg.paths,true);if(cfg.map){config.map=mixin(map||{},cfg.map,true,true)}if(cfg.shim){eachProp(cfg.shim,function(value,id){if(isArray(value)){value={deps:value}}if(value.exports&&!value.exports.__buildReady){value.exports=context.makeShimExports(value.exports)}shim[id]=value});config.shim=shim}if(cfg.packages){each(cfg.packages,function(pkgObj){var location;pkgObj=typeof pkgObj==="string"?{name:pkgObj}:pkgObj;location=pkgObj.location;pkgs[pkgObj.name]={name:pkgObj.name,location:location||pkgObj.name,main:(pkgObj.main||"main").replace(currDirRegExp,"").replace(jsSuffixRegExp,"")}});config.pkgs=pkgs}eachProp(registry,function(mod,id){if(!mod.inited&&!mod.map.unnormalized){mod.map=makeModuleMap(id)}});if(cfg.deps||cfg.callback){context.require(cfg.deps||[],cfg.callback)}},makeShimExports:function(exports){var func;if(typeof exports==="string"){func=function(){return getGlobal(exports)};func.exports=exports;return func}else{return function(){return exports.apply(global,arguments)}}},requireDefined:function(id,relMap){return hasProp(defined,makeModuleMap(id,relMap,false,true).id)},requireSpecified:function(id,relMap){id=makeModuleMap(id,relMap,false,true).id;return hasProp(defined,id)||hasProp(registry,id)},require:function(deps,callback,errback,relMap){var moduleName,id,map,requireMod,args;if(typeof deps==="string"){if(isFunction(callback)){return onError(makeError("requireargs","Invalid require call"),errback)}if(req.get){return req.get(context,deps,callback)}moduleName=deps;relMap=callback;map=makeModuleMap(moduleName,relMap,false,true);id=map.id;if(!hasProp(defined,id)){return onError(makeError("notloaded",'Module name "'+id+'" has not been loaded yet for context: '+contextName))}return defined[id]}if(errback&&!isFunction(errback)){relMap=errback;errback=undefined}if(callback&&!isFunction(callback)){relMap=callback;callback=undefined}takeGlobalQueue();while(defQueue.length){args=defQueue.shift();if(args[0]===null){return onError(makeError("mismatch","Mismatched anonymous define() module: "+args[args.length-1]))}else{callGetModule(args)}}requireMod=getModule(makeModuleMap(null,relMap));requireMod.init(deps,callback,errback,{enabled:true});checkLoaded();return context.require},undef:function(id){takeGlobalQueue();var map=makeModuleMap(id,null,true),mod=registry[id];delete defined[id];delete urlFetched[map.url];delete undefEvents[id];if(mod){if(mod.events.defined){undefEvents[id]=mod.events}removeWaiting(id)}},enable:function(depMap,parent){var mod=registry[depMap.id];if(mod){getModule(depMap).enable()}},completeLoad:function(moduleName){var found,args,mod,shim=config.shim[moduleName]||{},shExports=shim.exports&&shim.exports.exports;takeGlobalQueue();while(defQueue.length){args=defQueue.shift();if(args[0]===null){args[0]=moduleName;if(found){break}found=true}else{if(args[0]===moduleName){found=true}}callGetModule(args)}mod=registry[moduleName];if(!found&&!defined[moduleName]&&mod&&!mod.inited){if(config.enforceDefine&&(!shExports||!getGlobal(shExports))){if(hasPathFallback(moduleName)){return}else{return onError(makeError("nodefine","No define call for "+moduleName,null,[moduleName]))}}else{callGetModule([moduleName,(shim.deps||[]),shim.exports])}}checkLoaded()},toUrl:function(moduleNamePlusExt,relModuleMap){var index=moduleNamePlusExt.lastIndexOf("."),ext=null;if(index!==-1){ext=moduleNamePlusExt.substring(index,moduleNamePlusExt.length);moduleNamePlusExt=moduleNamePlusExt.substring(0,index)}return context.nameToUrl(normalize(moduleNamePlusExt,relModuleMap&&relModuleMap.id,true),ext)},nameToUrl:function(moduleName,ext){var paths,pkgs,pkg,pkgPath,syms,i,parentModule,url,parentPath;if(req.jsExtRegExp.test(moduleName)){url=moduleName+(ext||"")}else{paths=config.paths;pkgs=config.pkgs;syms=moduleName.split("/");for(i=syms.length;i>0;i-=1){parentModule=syms.slice(0,i).join("/");pkg=pkgs[parentModule];parentPath=paths[parentModule];if(parentPath){if(isArray(parentPath)){parentPath=parentPath[0]}syms.splice(0,i,parentPath);break}else{if(pkg){if(moduleName===pkg.name){pkgPath=pkg.location+"/"+pkg.main}else{pkgPath=pkg.location}syms.splice(0,i,pkgPath);break}}}url=syms.join("/");url+=(ext||(/\?/.test(url)?"":".js"));url=(url.charAt(0)==="/"||url.match(/^[\w\+\.\-]+:/)?"":config.baseUrl)+url}return config.urlArgs?url+((url.indexOf("?")===-1?"?":"&")+config.urlArgs):url},load:function(id,url){req.load(context,id,url)},execCb:function(name,callback,args,exports){return callback.apply(exports,args)},onScriptLoad:function(evt){if(evt.type==="load"||(readyRegExp.test((evt.currentTarget||evt.srcElement).readyState))){interactiveScript=null;var data=getScriptData(evt);context.completeLoad(data.id)}},onScriptError:function(evt){var data=getScriptData(evt);if(!hasPathFallback(data.id)){return onError(makeError("scripterror","Script error",evt,[data.id]))}}})}req=requirejs=function(deps,callback,errback,optional){var context,config,contextName=defContextName;if(!isArray(deps)&&typeof deps!=="string"){config=deps;if(isArray(callback)){deps=callback;callback=errback;errback=optional}else{deps=[]}}if(config&&config.context){contextName=config.context}context=contexts[contextName];if(!context){context=contexts[contextName]=req.s.newContext(contextName)}if(config){context.configure(config)}return context.require(deps,callback,errback)};req.config=function(config){return req(config)};if(!require){require=req}req.version=version;req.jsExtRegExp=/^\/|:|\?|\.js$/;req.isBrowser=isBrowser;s=req.s={contexts:contexts,newContext:newContext};req({});addRequireMethods(req);if(isBrowser){head=s.head=document.getElementsByTagName("head")[0];baseElement=document.getElementsByTagName("base")[0];if(baseElement){head=s.head=baseElement.parentNode}}req.onError=function(err){throw err};req.load=function(context,moduleName,url){var config=(context&&context.config)||{},node;if(isBrowser){node=config.xhtml?document.createElementNS("http://www.w3.org/1999/xhtml","html:script"):document.createElement("script");node.type=config.scriptType||"text/javascript";node.charset="utf-8";node.async=true;node.setAttribute("data-requirecontext",context.contextName);node.setAttribute("data-requiremodule",moduleName);if(node.attachEvent&&!(node.attachEvent.toString&&node.attachEvent.toString().indexOf("[native code")<0)&&!isOpera){useInteractive=true;node.attachEvent("onreadystatechange",context.onScriptLoad)}else{node.addEventListener("load",context.onScriptLoad,false);node.addEventListener("error",context.onScriptError,false)}node.src=url;currentlyAddingScript=node;if(baseElement){head.insertBefore(node,baseElement)}else{head.appendChild(node)}currentlyAddingScript=null;return node}else{if(isWebWorker){importScripts(url);context.completeLoad(moduleName)}}};function getInteractiveScript(){if(interactiveScript&&interactiveScript.readyState==="interactive"){return interactiveScript}eachReverse(scripts(),function(script){if(script.readyState==="interactive"){return(interactiveScript=script)}});return interactiveScript}if(isBrowser){eachReverse(scripts(),function(script){if(!head){head=script.parentNode}dataMain=script.getAttribute("data-main");if(dataMain){if(!cfg.baseUrl){src=dataMain.split("/");mainScript=src.pop();subPath=src.length?src.join("/")+"/":"./";cfg.baseUrl=subPath;dataMain=mainScript}dataMain=dataMain.replace(jsSuffixRegExp,"");cfg.deps=cfg.deps?cfg.deps.concat(dataMain):[dataMain];return true}})}define=function(name,deps,callback){var node,context;if(typeof name!=="string"){callback=deps;deps=name;name=null}if(!isArray(deps)){callback=deps;deps=[]}if(!deps.length&&isFunction(callback)){if(callback.length){callback.toString().replace(commentRegExp,"").replace(cjsRequireRegExp,function(match,dep){deps.push(dep)});deps=(callback.length===1?["require"]:["require","exports","module"]).concat(deps)}}if(useInteractive){node=currentlyAddingScript||getInteractiveScript();if(node){if(!name){name=node.getAttribute("data-requiremodule")}context=contexts[node.getAttribute("data-requirecontext")]}}(context?context.defQueue:globalDefQueue).push([name,deps,callback])};define.amd={jQuery:true};req.exec=function(text){return eval(text)};req(cfg)}(this));
\ No newline at end of file
diff -r 45ddaa89e9855d21ce2f6a29a0eb90cc61abd7cd -r 3668de7a24ef93da9ef6d5ef7f45a61966fbe19f static/scripts/packed/viz/circster.js
--- /dev/null
+++ b/static/scripts/packed/viz/circster.js
@@ -0,0 +1,1 @@
+define(["libs/d3","viz/visualization"],function(d,e){var c=function(){this.initialize&&this.initialize.apply(this,arguments)};c.extend=Backbone.Model.extend;var b=Backbone.View.extend({className:"circster",initialize:function(h){this.total_gap=h.total_gap;this.genome=h.genome;this.dataset_arc_height=h.dataset_arc_height;this.track_gap=5},render:function(){var j=this,l=this.dataset_arc_height,m=j.$el.width(),h=j.$el.height(),k=(Math.min(m,h)/2-this.model.get("tracks").length*(this.dataset_arc_height+this.track_gap));var i=d.select(j.$el[0]).append("svg").attr("width",m).attr("height",h).attr("pointer-events","all").append("svg:g").call(d.behavior.zoom().on("zoom",function(){i.attr("transform","translate("+d.event.translate+") scale("+d.event.scale+")")})).attr("transform","translate("+m/2+","+h/2+")").append("svg:g");this.model.get("tracks").each(function(n,p){var q=n.get("genome_wide_data"),r=k+p*(l+j.track_gap),o=(q instanceof e.GenomeWideBigWigData?f:CircsterSummaryTreeTrackRenderer);track_renderer=new o({track:n,radius_start:r,radius_end:r+l,genome:j.genome,total_gap:j.total_gap});track_renderer.render(i)})}});var a=c.extend({initialize:function(h){this.options=h},render:function(i){genome_arcs=this.chroms_layout(),chroms_arcs=this.genome_data_layout();var n=this.options.radius_start,l=this.options.radius_end,o=i.append("g").attr("id","inner-arc"),m=d.svg.arc().innerRadius(n).outerRadius(l),h=o.selectAll("#inner-arc>path").data(genome_arcs).enter().append("path").attr("d",m).style("stroke","#ccc").style("fill","#ccc").append("title").text(function(p){return p.data.chrom});var j=this.options.track.get("prefs"),k=j.block_color;_.each(chroms_arcs,function(p){if(!p){return}var s=i.append("g"),r=d.svg.arc().innerRadius(n),q=s.selectAll("path").data(p).enter();q.append("path").attr("d",r).style("stroke",k)})},chroms_layout:function(){var i=this.options.genome.get_chroms_info(),k=d.layout.pie().value(function(m){return m.len}).sort(null),l=k(i),h=this.options.total_gap/i.length,j=_.map(l,function(o,n){var m=o.endAngle-h;o.endAngle=(m>o.startAngle?m:o.startAngle);return o});return j},chrom_data_layout:function(k,j,i,l,h){},genome_data_layout:function(){var i=this,h=this.chroms_layout(),m=this.options.track.get("genome_wide_data"),l=this.options.radius_start,j=this.options.radius_end,k=_.zip(h,m.get("data")),n=_.map(k,function(p){var q=p[0],o=p[1];return i.chrom_data_layout(q,o,l,j,m.get("min"),m.get("max"))});return n}});var g=a.extend({chrom_data_layout:function(r,i,o,n,k,p){if(!i||typeof i==="string"){return null}var l=i[0],q=i[3],j=d.scale.linear().domain([k,p]).range([o,n]),m=d.layout.pie().value(function(s){return q}).startAngle(r.startAngle).endAngle(r.endAngle),h=m(l);_.each(l,function(s,t){h[t].outerRadius=j(s[1])});return h}});var f=a.extend({chrom_data_layout:function(q,i,o,n,k,p){var l=i.data;if(l.length===0){return}var j=d.scale.linear().domain([k,p]).range([o,n]),m=d.layout.pie().value(function(s,r){if(r+1===l.length){return 0}return l[r+1][0]-l[r][0]}).startAngle(q.startAngle).endAngle(q.endAngle),h=m(l);_.each(l,function(r,s){h[s].outerRadius=j(r[1])});return h}});return{CircsterView:b}});
\ 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
3 new commits in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/changeset/3e41b027b184/
changeset: 3e41b027b184
user: james_taylor
date: 2012-09-12 00:24:26
summary: circster: moving some rendering code around to enable faster bigwig rendering, adding a Base class using Backbone style inheritence
affected #: 1 file
diff -r 72f1dcdf1c542e6d4689305f5de2077c0bfb4035 -r 3e41b027b1840bfd7f6e08b7c425c87508a19c4f static/scripts/viz/visualization.js
--- a/static/scripts/viz/visualization.js
+++ b/static/scripts/viz/visualization.js
@@ -7,7 +7,7 @@
* changes; this is advantageous because multiple views can use the same object
* and models can be used without views.
*/
-
+
// --------- Models ---------
/**
@@ -690,12 +690,58 @@
});
+// General backbone style inheritence
+var Base = function() { this.__init__ && this.__init__.apply(this, arguments) }; Base.extend = Backbone.Model.extend;
-var CircsterDataLayout = Backbone.Model.extend({
- defaults: {
- genome: null,
- dataset: null,
- total_gap: null
+// ---- Circster views ----
+
+var CircsterTrackView = Base.extend( {
+
+ __init__: function( options ) {
+ this.options = options;
+ },
+
+ render: function() {
+
+ genome_arcs = this.chroms_layout(),
+ chroms_arcs = this.genome_data_layout();
+
+ // -- Render. --
+
+ // Draw background arcs for each chromosome.
+ var svg = this.options.svg,
+ radius_start = this.options.radius_start,
+ radius_end = this.options.radius_end,
+ base_arc = svg.append("g").attr("id", "inner-arc"),
+ arc_gen = d3.svg.arc()
+ .innerRadius(radius_start)
+ .outerRadius(radius_end),
+ // Draw arcs.
+ chroms_elts = base_arc.selectAll("#inner-arc>path")
+ .data(genome_arcs).enter().append("path")
+ .attr("d", arc_gen)
+ .style("stroke", "#ccc")
+ .style("fill", "#ccc")
+ .append("title").text(function(d) { return d.data.chrom; });
+
+ // For each chromosome, draw dataset.
+ var prefs = this.options.track.get('prefs'),
+ block_color = prefs.block_color;
+
+ _.each(chroms_arcs, function(chrom_layout) {
+ if (!chrom_layout) { return; }
+
+ var group = svg.append("g"),
+ arc_gen = d3.svg.arc().innerRadius(radius_start),
+ dataset_elts = group.selectAll("path")
+ .data(chrom_layout).enter()
+ ;
+ //.style("stroke", block_color)
+ //.style("fill", block_color)
+
+ dataset_elts.append("path").attr("d", arc_gen).style("stroke", block_color)
+
+ });
},
/**
@@ -704,10 +750,10 @@
*/
chroms_layout: function() {
// Setup chroms layout using pie.
- var chroms_info = this.attributes.genome.get_chroms_info(),
+ var chroms_info = this.options.genome.get_chroms_info(),
pie_layout = d3.layout.pie().value(function(d) { return d.len; }).sort(null),
init_arcs = pie_layout(chroms_info),
- gap_per_chrom = this.attributes.total_gap / chroms_info.length,
+ gap_per_chrom = this.options.total_gap / chroms_info.length,
chrom_arcs = _.map(init_arcs, function(arc, index) {
// For short chroms, endAngle === startAngle.
var new_endAngle = arc.endAngle - gap_per_chrom;
@@ -726,9 +772,9 @@
genome_data_layout: function() {
var self = this,
chrom_arcs = this.chroms_layout(),
- dataset = this.get('track').get('genome_wide_data'),
- r_start = this.get('radius_start'),
- r_end = this.get('radius_end'),
+ dataset = this.options.track.get('genome_wide_data'),
+ r_start = this.options.radius_start,
+ r_end = this.options.radius_end,
// Merge chroms layout with data.
layout_and_data = _.zip(chrom_arcs, dataset.get('data')),
@@ -747,7 +793,7 @@
/**
* Layout for summary tree data in a circster visualization.
*/
-var CircsterSummaryTreeLayout = CircsterDataLayout.extend({
+var CircsterSummaryTrackView = CircsterTrackView.extend({
/**
* Returns layouts for drawing a chromosome's data.
@@ -782,7 +828,7 @@
/**
* Layout for BigWig data in a circster visualization.
*/
-var CircsterBigWigLayout = CircsterDataLayout.extend({
+var CircsterBigWigTrackView = CircsterTrackView.extend({
/**
* Returns layouts for drawing a chromosome's data.
@@ -860,47 +906,19 @@
this.model.get('tracks').each(function(track, index) {
var dataset = track.get('genome_wide_data'),
radius_start = init_radius_start + index * (dataset_arc_height + self.track_gap),
- // Layout chromosome arcs.
- layout_class = (dataset instanceof GenomeWideBigWigData ? CircsterBigWigLayout : CircsterSummaryTreeLayout ),
- arcs_layout = new layout_class({
- track: track,
- radius_start: radius_start,
- radius_end: radius_start + dataset_arc_height,
- genome: self.genome,
- total_gap: self.total_gap
- }),
- genome_arcs = arcs_layout.chroms_layout(),
- chroms_arcs = arcs_layout.genome_data_layout();
-
- // -- Render. --
+ track_view_class = (dataset instanceof GenomeWideBigWigData ? CircsterBigWigTrackView : CircsterSummaryTreeTrackView );
- // Draw background arcs for each chromosome.
- var base_arc = svg.append("g").attr("id", "inner-arc"),
- arc_gen = d3.svg.arc()
- .innerRadius(radius_start)
- .outerRadius(radius_start + dataset_arc_height),
- // Draw arcs.
- chroms_elts = base_arc.selectAll("#inner-arc>path")
- .data(genome_arcs).enter().append("path")
- .attr("d", arc_gen)
- .style("stroke", "#ccc")
- .style("fill", "#ccc")
- .append("title").text(function(d) { return d.data.chrom; });
+ track_view = new track_view_class({
+ track: track,
+ radius_start: radius_start,
+ radius_end: radius_start + dataset_arc_height,
+ genome: self.genome,
+ total_gap: self.total_gap,
+ svg: svg
+ });
- // For each chromosome, draw dataset.
- var prefs = track.get('prefs'),
- block_color = prefs.block_color;
- _.each(chroms_arcs, function(chrom_layout) {
- if (!chrom_layout) { return; }
+ track_view.render();
- var group = svg.append("g"),
- arc_gen = d3.svg.arc().innerRadius(radius_start),
- dataset_elts = group.selectAll("path")
- .data(chrom_layout).enter().append("path")
- .attr("d", arc_gen)
- .style("stroke", block_color)
- .style("fill", block_color);
- });
});
}
});
https://bitbucket.org/galaxy/galaxy-central/changeset/db2be15c1258/
changeset: db2be15c1258
user: james_taylor
date: 2012-09-12 00:43:09
summary: circster: pull out circster code an encapsulate
affected #: 3 files
diff -r 3e41b027b1840bfd7f6e08b7c425c87508a19c4f -r db2be15c12584351ef4f58bff0069ee5a4eed5a9 static/scripts/viz/circster.js
--- /dev/null
+++ b/static/scripts/viz/circster.js
@@ -0,0 +1,244 @@
+(function(){
+
+// General backbone style inheritence
+var Base = function() { this.initialize && this.initialize.apply(this, arguments) }; Base.extend = Backbone.Model.extend;
+
+// ---- Circster views ----
+
+/**
+ * -- Views --
+ */
+
+var CircsterView = Backbone.View.extend({
+ className: 'circster',
+
+ initialize: function(options) {
+ this.total_gap = options.total_gap;
+ this.genome = options.genome;
+ this.dataset_arc_height = options.dataset_arc_height;
+ this.track_gap = 5;
+ },
+
+ render: function() {
+ var self = this,
+ dataset_arc_height = this.dataset_arc_height,
+ width = self.$el.width(),
+ height = self.$el.height(),
+ // Compute radius start based on model, will be centered
+ // and fit entirely inside element by default
+ init_radius_start = ( Math.min(width,height)/2
+ - this.model.get('tracks').length * (this.dataset_arc_height + this.track_gap) );
+
+ // Set up SVG element.
+ var svg = d3.select(self.$el[0])
+ .append("svg")
+ .attr("width", width)
+ .attr("height", height)
+ .attr("pointer-events", "all")
+ // Set up zooming, dragging.
+ .append('svg:g')
+ .call(d3.behavior.zoom().on('zoom', function() {
+ svg.attr("transform",
+ "translate(" + d3.event.translate + ")"
+ + " scale(" + d3.event.scale + ")");
+ }))
+ .attr("transform", "translate(" + width / 2 + "," + height / 2 + ")")
+ .append('svg:g')
+
+
+ // -- Render each dataset in the visualization. --
+ this.model.get('tracks').each(function(track, index) {
+ var dataset = track.get('genome_wide_data'),
+ radius_start = init_radius_start + index * (dataset_arc_height + self.track_gap),
+ track_view_class = (dataset instanceof GenomeWideBigWigData ? CircsterBigWigTrackView : CircsterSummaryTreeTrackView );
+
+ track_view = new track_view_class({
+ track: track,
+ radius_start: radius_start,
+ radius_end: radius_start + dataset_arc_height,
+ genome: self.genome,
+ total_gap: self.total_gap,
+ svg: svg
+ });
+
+ track_view.render();
+
+ });
+ }
+});
+
+var CircsterTrackView = Base.extend( {
+
+ initialize: function( options ) {
+ this.options = options;
+ },
+
+ render: function() {
+
+ genome_arcs = this.chroms_layout(),
+ chroms_arcs = this.genome_data_layout();
+
+ // -- Render. --
+
+ // Draw background arcs for each chromosome.
+ var svg = this.options.svg,
+ radius_start = this.options.radius_start,
+ radius_end = this.options.radius_end,
+ base_arc = svg.append("g").attr("id", "inner-arc"),
+ arc_gen = d3.svg.arc()
+ .innerRadius(radius_start)
+ .outerRadius(radius_end),
+ // Draw arcs.
+ chroms_elts = base_arc.selectAll("#inner-arc>path")
+ .data(genome_arcs).enter().append("path")
+ .attr("d", arc_gen)
+ .style("stroke", "#ccc")
+ .style("fill", "#ccc")
+ .append("title").text(function(d) { return d.data.chrom; });
+
+ // For each chromosome, draw dataset.
+ var prefs = this.options.track.get('prefs'),
+ block_color = prefs.block_color;
+
+ _.each(chroms_arcs, function(chrom_layout) {
+ if (!chrom_layout) { return; }
+
+ var group = svg.append("g"),
+ arc_gen = d3.svg.arc().innerRadius(radius_start),
+ dataset_elts = group.selectAll("path")
+ .data(chrom_layout).enter()
+ ;
+ //.style("stroke", block_color)
+ //.style("fill", block_color)
+
+ dataset_elts.append("path").attr("d", arc_gen).style("stroke", block_color)
+
+ });
+ },
+
+ /**
+ * Returns arc layouts for genome's chromosomes/contigs. Arcs are arranged in a circle
+ * separated by gaps.
+ */
+ chroms_layout: function() {
+ // Setup chroms layout using pie.
+ var chroms_info = this.options.genome.get_chroms_info(),
+ pie_layout = d3.layout.pie().value(function(d) { return d.len; }).sort(null),
+ init_arcs = pie_layout(chroms_info),
+ gap_per_chrom = this.options.total_gap / chroms_info.length,
+ chrom_arcs = _.map(init_arcs, function(arc, index) {
+ // For short chroms, endAngle === startAngle.
+ var new_endAngle = arc.endAngle - gap_per_chrom;
+ arc.endAngle = (new_endAngle > arc.startAngle ? new_endAngle : arc.startAngle);
+ return arc;
+ });
+ return chrom_arcs;
+ },
+
+ /**
+ * Returns layouts for drawing a chromosome's data.
+ */
+ chrom_data_layout: function(chrom_arc, chrom_data, inner_radius, outer_radius, max) {
+ },
+
+ genome_data_layout: function() {
+ var self = this,
+ chrom_arcs = this.chroms_layout(),
+ dataset = this.options.track.get('genome_wide_data'),
+ r_start = this.options.radius_start,
+ r_end = this.options.radius_end,
+
+ // Merge chroms layout with data.
+ layout_and_data = _.zip(chrom_arcs, dataset.get('data')),
+
+ // Do dataset layout for each chromosome's data using pie layout.
+ chroms_data_layout = _.map(layout_and_data, function(chrom_info) {
+ var chrom_arc = chrom_info[0],
+ chrom_data = chrom_info[1];
+ return self.chrom_data_layout(chrom_arc, chrom_data, r_start, r_end, dataset.get('min'), dataset.get('max'));
+ });
+
+ return chroms_data_layout;
+ }
+});
+
+/**
+ * Layout for summary tree data in a circster visualization.
+ */
+var CircsterSummaryTrackView = CircsterTrackView.extend({
+
+ /**
+ * Returns layouts for drawing a chromosome's data.
+ */
+ chrom_data_layout: function(chrom_arc, chrom_data, inner_radius, outer_radius, min, max) {
+ // If no chrom data, return null.
+ if (!chrom_data || typeof chrom_data === "string") {
+ return null;
+ }
+
+ var data = chrom_data[0],
+ delta = chrom_data[3],
+ scale = d3.scale.linear()
+ .domain( [min, max] )
+ .range( [inner_radius, outer_radius] ),
+ arc_layout = d3.layout.pie().value(function(d) {
+ return delta;
+ })
+ .startAngle(chrom_arc.startAngle)
+ .endAngle(chrom_arc.endAngle),
+ arcs = arc_layout(data);
+
+ // Use scale to assign outer radius.
+ _.each(data, function(datum, index) {
+ arcs[index].outerRadius = scale(datum[1]);
+ });
+
+ return arcs;
+ }
+});
+
+/**
+ * Layout for BigWig data in a circster visualization.
+ */
+var CircsterBigWigTrackView = CircsterTrackView.extend({
+
+ /**
+ * Returns layouts for drawing a chromosome's data.
+ */
+ chrom_data_layout: function(chrom_arc, chrom_data, inner_radius, outer_radius, min, max) {
+ var data = chrom_data.data;
+ if (data.length === 0) { return; }
+
+ var scale = d3.scale.linear()
+ .domain( [min, max] )
+ .range( [inner_radius, outer_radius] ),
+ arc_layout = d3.layout.pie().value(function(d, i) {
+ // If at end of data, draw nothing.
+ if (i + 1 === data.length) { return 0; }
+
+ // Layout is from current position to next position.
+ return data[i+1][0] - data[i][0];
+ })
+ .startAngle(chrom_arc.startAngle)
+ .endAngle(chrom_arc.endAngle),
+ arcs = arc_layout(data);
+
+ // Use scale to assign outer radius.
+ _.each(data, function(datum, index) {
+ arcs[index].outerRadius = scale(datum[1]);
+ });
+
+ return arcs;
+ }
+
+});
+
+// ---- Browser or CommonJS compatible exports ----
+
+if (typeof exports === 'undefined') {
+ var exports = this;
+}
+
+exports.CircsterView = CircsterView;
+
+}).call(this);
diff -r 3e41b027b1840bfd7f6e08b7c425c87508a19c4f -r db2be15c12584351ef4f58bff0069ee5a4eed5a9 static/scripts/viz/visualization.js
--- a/static/scripts/viz/visualization.js
+++ b/static/scripts/viz/visualization.js
@@ -690,239 +690,6 @@
});
-// General backbone style inheritence
-var Base = function() { this.__init__ && this.__init__.apply(this, arguments) }; Base.extend = Backbone.Model.extend;
-
-// ---- Circster views ----
-
-var CircsterTrackView = Base.extend( {
-
- __init__: function( options ) {
- this.options = options;
- },
-
- render: function() {
-
- genome_arcs = this.chroms_layout(),
- chroms_arcs = this.genome_data_layout();
-
- // -- Render. --
-
- // Draw background arcs for each chromosome.
- var svg = this.options.svg,
- radius_start = this.options.radius_start,
- radius_end = this.options.radius_end,
- base_arc = svg.append("g").attr("id", "inner-arc"),
- arc_gen = d3.svg.arc()
- .innerRadius(radius_start)
- .outerRadius(radius_end),
- // Draw arcs.
- chroms_elts = base_arc.selectAll("#inner-arc>path")
- .data(genome_arcs).enter().append("path")
- .attr("d", arc_gen)
- .style("stroke", "#ccc")
- .style("fill", "#ccc")
- .append("title").text(function(d) { return d.data.chrom; });
-
- // For each chromosome, draw dataset.
- var prefs = this.options.track.get('prefs'),
- block_color = prefs.block_color;
-
- _.each(chroms_arcs, function(chrom_layout) {
- if (!chrom_layout) { return; }
-
- var group = svg.append("g"),
- arc_gen = d3.svg.arc().innerRadius(radius_start),
- dataset_elts = group.selectAll("path")
- .data(chrom_layout).enter()
- ;
- //.style("stroke", block_color)
- //.style("fill", block_color)
-
- dataset_elts.append("path").attr("d", arc_gen).style("stroke", block_color)
-
- });
- },
-
- /**
- * Returns arc layouts for genome's chromosomes/contigs. Arcs are arranged in a circle
- * separated by gaps.
- */
- chroms_layout: function() {
- // Setup chroms layout using pie.
- var chroms_info = this.options.genome.get_chroms_info(),
- pie_layout = d3.layout.pie().value(function(d) { return d.len; }).sort(null),
- init_arcs = pie_layout(chroms_info),
- gap_per_chrom = this.options.total_gap / chroms_info.length,
- chrom_arcs = _.map(init_arcs, function(arc, index) {
- // For short chroms, endAngle === startAngle.
- var new_endAngle = arc.endAngle - gap_per_chrom;
- arc.endAngle = (new_endAngle > arc.startAngle ? new_endAngle : arc.startAngle);
- return arc;
- });
- return chrom_arcs;
- },
-
- /**
- * Returns layouts for drawing a chromosome's data.
- */
- chrom_data_layout: function(chrom_arc, chrom_data, inner_radius, outer_radius, max) {
- },
-
- genome_data_layout: function() {
- var self = this,
- chrom_arcs = this.chroms_layout(),
- dataset = this.options.track.get('genome_wide_data'),
- r_start = this.options.radius_start,
- r_end = this.options.radius_end,
-
- // Merge chroms layout with data.
- layout_and_data = _.zip(chrom_arcs, dataset.get('data')),
-
- // Do dataset layout for each chromosome's data using pie layout.
- chroms_data_layout = _.map(layout_and_data, function(chrom_info) {
- var chrom_arc = chrom_info[0],
- chrom_data = chrom_info[1];
- return self.chrom_data_layout(chrom_arc, chrom_data, r_start, r_end, dataset.get('min'), dataset.get('max'));
- });
-
- return chroms_data_layout;
- }
-});
-
-/**
- * Layout for summary tree data in a circster visualization.
- */
-var CircsterSummaryTrackView = CircsterTrackView.extend({
-
- /**
- * Returns layouts for drawing a chromosome's data.
- */
- chrom_data_layout: function(chrom_arc, chrom_data, inner_radius, outer_radius, min, max) {
- // If no chrom data, return null.
- if (!chrom_data || typeof chrom_data === "string") {
- return null;
- }
-
- var data = chrom_data[0],
- delta = chrom_data[3],
- scale = d3.scale.linear()
- .domain( [min, max] )
- .range( [inner_radius, outer_radius] ),
- arc_layout = d3.layout.pie().value(function(d) {
- return delta;
- })
- .startAngle(chrom_arc.startAngle)
- .endAngle(chrom_arc.endAngle),
- arcs = arc_layout(data);
-
- // Use scale to assign outer radius.
- _.each(data, function(datum, index) {
- arcs[index].outerRadius = scale(datum[1]);
- });
-
- return arcs;
- }
-});
-
-/**
- * Layout for BigWig data in a circster visualization.
- */
-var CircsterBigWigTrackView = CircsterTrackView.extend({
-
- /**
- * Returns layouts for drawing a chromosome's data.
- */
- chrom_data_layout: function(chrom_arc, chrom_data, inner_radius, outer_radius, min, max) {
- var data = chrom_data.data;
- if (data.length === 0) { return; }
-
- var scale = d3.scale.linear()
- .domain( [min, max] )
- .range( [inner_radius, outer_radius] ),
- arc_layout = d3.layout.pie().value(function(d, i) {
- // If at end of data, draw nothing.
- if (i + 1 === data.length) { return 0; }
-
- // Layout is from current position to next position.
- return data[i+1][0] - data[i][0];
- })
- .startAngle(chrom_arc.startAngle)
- .endAngle(chrom_arc.endAngle),
- arcs = arc_layout(data);
-
- // Use scale to assign outer radius.
- _.each(data, function(datum, index) {
- arcs[index].outerRadius = scale(datum[1]);
- });
-
- return arcs;
- }
-
-});
-
-/**
- * -- Views --
- */
-
-var CircsterView = Backbone.View.extend({
- className: 'circster',
-
- initialize: function(options) {
- this.total_gap = options.total_gap;
- this.genome = options.genome;
- this.dataset_arc_height = options.dataset_arc_height;
- this.track_gap = 5;
- },
-
- render: function() {
- var self = this,
- dataset_arc_height = this.dataset_arc_height,
- width = self.$el.width(),
- height = self.$el.height(),
- // Compute radius start based on model, will be centered
- // and fit entirely inside element by default
- init_radius_start = ( Math.min(width,height)/2
- - this.model.get('tracks').length * (this.dataset_arc_height + this.track_gap) );
-
- // Set up SVG element.
- var svg = d3.select(self.$el[0])
- .append("svg")
- .attr("width", width)
- .attr("height", height)
- .attr("pointer-events", "all")
- // Set up zooming, dragging.
- .append('svg:g')
- .call(d3.behavior.zoom().on('zoom', function() {
- svg.attr("transform",
- "translate(" + d3.event.translate + ")"
- + " scale(" + d3.event.scale + ")");
- }))
- .attr("transform", "translate(" + width / 2 + "," + height / 2 + ")")
- .append('svg:g')
-
-
- // -- Render each dataset in the visualization. --
- this.model.get('tracks').each(function(track, index) {
- var dataset = track.get('genome_wide_data'),
- radius_start = init_radius_start + index * (dataset_arc_height + self.track_gap),
- track_view_class = (dataset instanceof GenomeWideBigWigData ? CircsterBigWigTrackView : CircsterSummaryTreeTrackView );
-
- track_view = new track_view_class({
- track: track,
- radius_start: radius_start,
- radius_end: radius_start + dataset_arc_height,
- genome: self.genome,
- total_gap: self.total_gap,
- svg: svg
- });
-
- track_view.render();
-
- });
- }
-});
-
/**
* -- Routers --
*/
diff -r 3e41b027b1840bfd7f6e08b7c425c87508a19c4f -r db2be15c12584351ef4f58bff0069ee5a4eed5a9 templates/visualization/circster.mako
--- a/templates/visualization/circster.mako
+++ b/templates/visualization/circster.mako
@@ -16,7 +16,7 @@
<%def name="javascripts()">
${parent.javascripts()}
- ${h.js( "libs/d3", "mvc/data", "viz/visualization" )}
+ ${h.js( "libs/d3", "mvc/data", "viz/visualization", "viz/circster" )}
<script type="text/javascript">
$(function() {
https://bitbucket.org/galaxy/galaxy-central/changeset/45ddaa89e985/
changeset: 45ddaa89e985
user: james_taylor
date: 2012-09-12 21:38:52
summary: js: introducing a requirejs starting with circster. circster.js is a pure AMD module. visualization.js is AMD/browser compatible
affected #: 5 files
diff -r db2be15c12584351ef4f58bff0069ee5a4eed5a9 -r 45ddaa89e9855d21ce2f6a29a0eb90cc61abd7cd static/scripts/mvc/data.js
--- a/static/scripts/mvc/data.js
+++ b/static/scripts/mvc/data.js
@@ -13,4 +13,5 @@
var DatasetCollection = Backbone.Collection.extend({
model: Dataset
-});
\ No newline at end of file
+});
+
diff -r db2be15c12584351ef4f58bff0069ee5a4eed5a9 -r 45ddaa89e9855d21ce2f6a29a0eb90cc61abd7cd static/scripts/require.js
--- /dev/null
+++ b/static/scripts/require.js
@@ -0,0 +1,2041 @@
+/** vim: et:ts=4:sw=4:sts=4
+ * @license RequireJS 2.0.6 Copyright (c) 2010-2012, The Dojo Foundation All Rights Reserved.
+ * Available via the MIT or new BSD license.
+ * see: http://github.com/jrburke/requirejs for details
+ */
+//Not using strict: uneven strict support in browsers, #392, and causes
+//problems with requirejs.exec()/transpiler plugins that may not be strict.
+/*jslint regexp: true, nomen: true, sloppy: true */
+/*global window, navigator, document, importScripts, jQuery, setTimeout, opera */
+
+var requirejs, require, define;
+(function (global) {
+ var req, s, head, baseElement, dataMain, src,
+ interactiveScript, currentlyAddingScript, mainScript, subPath,
+ version = '2.0.6',
+ commentRegExp = /(\/\*([\s\S]*?)\*\/|([^:]|^)\/\/(.*)$)/mg,
+ cjsRequireRegExp = /[^.]\s*require\s*\(\s*["']([^'"\s]+)["']\s*\)/g,
+ jsSuffixRegExp = /\.js$/,
+ currDirRegExp = /^\.\//,
+ op = Object.prototype,
+ ostring = op.toString,
+ hasOwn = op.hasOwnProperty,
+ ap = Array.prototype,
+ aps = ap.slice,
+ apsp = ap.splice,
+ isBrowser = !!(typeof window !== 'undefined' && navigator && document),
+ isWebWorker = !isBrowser && typeof importScripts !== 'undefined',
+ //PS3 indicates loaded and complete, but need to wait for complete
+ //specifically. Sequence is 'loading', 'loaded', execution,
+ // then 'complete'. The UA check is unfortunate, but not sure how
+ //to feature test w/o causing perf issues.
+ readyRegExp = isBrowser && navigator.platform === 'PLAYSTATION 3' ?
+ /^complete$/ : /^(complete|loaded)$/,
+ defContextName = '_',
+ //Oh the tragedy, detecting opera. See the usage of isOpera for reason.
+ isOpera = typeof opera !== 'undefined' && opera.toString() === '[object Opera]',
+ contexts = {},
+ cfg = {},
+ globalDefQueue = [],
+ useInteractive = false;
+
+ function isFunction(it) {
+ return ostring.call(it) === '[object Function]';
+ }
+
+ function isArray(it) {
+ return ostring.call(it) === '[object Array]';
+ }
+
+ /**
+ * Helper function for iterating over an array. If the func returns
+ * a true value, it will break out of the loop.
+ */
+ function each(ary, func) {
+ if (ary) {
+ var i;
+ for (i = 0; i < ary.length; i += 1) {
+ if (ary[i] && func(ary[i], i, ary)) {
+ break;
+ }
+ }
+ }
+ }
+
+ /**
+ * Helper function for iterating over an array backwards. If the func
+ * returns a true value, it will break out of the loop.
+ */
+ function eachReverse(ary, func) {
+ if (ary) {
+ var i;
+ for (i = ary.length - 1; i > -1; i -= 1) {
+ if (ary[i] && func(ary[i], i, ary)) {
+ break;
+ }
+ }
+ }
+ }
+
+ function hasProp(obj, prop) {
+ return hasOwn.call(obj, prop);
+ }
+
+ /**
+ * Cycles over properties in an object and calls a function for each
+ * property value. If the function returns a truthy value, then the
+ * iteration is stopped.
+ */
+ function eachProp(obj, func) {
+ var prop;
+ for (prop in obj) {
+ if (obj.hasOwnProperty(prop)) {
+ if (func(obj[prop], prop)) {
+ break;
+ }
+ }
+ }
+ }
+
+ /**
+ * Simple function to mix in properties from source into target,
+ * but only if target does not already have a property of the same name.
+ * This is not robust in IE for transferring methods that match
+ * Object.prototype names, but the uses of mixin here seem unlikely to
+ * trigger a problem related to that.
+ */
+ function mixin(target, source, force, deepStringMixin) {
+ if (source) {
+ eachProp(source, function (value, prop) {
+ if (force || !hasProp(target, prop)) {
+ if (deepStringMixin && typeof value !== 'string') {
+ if (!target[prop]) {
+ target[prop] = {};
+ }
+ mixin(target[prop], value, force, deepStringMixin);
+ } else {
+ target[prop] = value;
+ }
+ }
+ });
+ }
+ return target;
+ }
+
+ //Similar to Function.prototype.bind, but the 'this' object is specified
+ //first, since it is easier to read/figure out what 'this' will be.
+ function bind(obj, fn) {
+ return function () {
+ return fn.apply(obj, arguments);
+ };
+ }
+
+ function scripts() {
+ return document.getElementsByTagName('script');
+ }
+
+ //Allow getting a global that expressed in
+ //dot notation, like 'a.b.c'.
+ function getGlobal(value) {
+ if (!value) {
+ return value;
+ }
+ var g = global;
+ each(value.split('.'), function (part) {
+ g = g[part];
+ });
+ return g;
+ }
+
+ function makeContextModuleFunc(func, relMap, enableBuildCallback) {
+ return function () {
+ //A version of a require function that passes a moduleName
+ //value for items that may need to
+ //look up paths relative to the moduleName
+ var args = aps.call(arguments, 0), lastArg;
+ if (enableBuildCallback &&
+ isFunction((lastArg = args[args.length - 1]))) {
+ lastArg.__requireJsBuild = true;
+ }
+ args.push(relMap);
+ return func.apply(null, args);
+ };
+ }
+
+ function addRequireMethods(req, context, relMap) {
+ each([
+ ['toUrl'],
+ ['undef'],
+ ['defined', 'requireDefined'],
+ ['specified', 'requireSpecified']
+ ], function (item) {
+ var prop = item[1] || item[0];
+ req[item[0]] = context ? makeContextModuleFunc(context[prop], relMap) :
+ //If no context, then use default context. Reference from
+ //contexts instead of early binding to default context, so
+ //that during builds, the latest instance of the default
+ //context with its config gets used.
+ function () {
+ var ctx = contexts[defContextName];
+ return ctx[prop].apply(ctx, arguments);
+ };
+ });
+ }
+
+ /**
+ * Constructs an error with a pointer to an URL with more information.
+ * @param {String} id the error ID that maps to an ID on a web page.
+ * @param {String} message human readable error.
+ * @param {Error} [err] the original error, if there is one.
+ *
+ * @returns {Error}
+ */
+ function makeError(id, msg, err, requireModules) {
+ var e = new Error(msg + '\nhttp://requirejs.org/docs/errors.html#' + id);
+ e.requireType = id;
+ e.requireModules = requireModules;
+ if (err) {
+ e.originalError = err;
+ }
+ return e;
+ }
+
+ if (typeof define !== 'undefined') {
+ //If a define is already in play via another AMD loader,
+ //do not overwrite.
+ return;
+ }
+
+ if (typeof requirejs !== 'undefined') {
+ if (isFunction(requirejs)) {
+ //Do not overwrite and existing requirejs instance.
+ return;
+ }
+ cfg = requirejs;
+ requirejs = undefined;
+ }
+
+ //Allow for a require config object
+ if (typeof require !== 'undefined' && !isFunction(require)) {
+ //assume it is a config object.
+ cfg = require;
+ require = undefined;
+ }
+
+ function newContext(contextName) {
+ var inCheckLoaded, Module, context, handlers,
+ checkLoadedTimeoutId,
+ config = {
+ waitSeconds: 7,
+ baseUrl: './',
+ paths: {},
+ pkgs: {},
+ shim: {}
+ },
+ registry = {},
+ undefEvents = {},
+ defQueue = [],
+ defined = {},
+ urlFetched = {},
+ requireCounter = 1,
+ unnormalizedCounter = 1,
+ //Used to track the order in which modules
+ //should be executed, by the order they
+ //load. Important for consistent cycle resolution
+ //behavior.
+ waitAry = [];
+
+ /**
+ * Trims the . and .. from an array of path segments.
+ * It will keep a leading path segment if a .. will become
+ * the first path segment, to help with module name lookups,
+ * which act like paths, but can be remapped. But the end result,
+ * all paths that use this function should look normalized.
+ * NOTE: this method MODIFIES the input array.
+ * @param {Array} ary the array of path segments.
+ */
+ function trimDots(ary) {
+ var i, part;
+ for (i = 0; ary[i]; i += 1) {
+ part = ary[i];
+ if (part === '.') {
+ ary.splice(i, 1);
+ i -= 1;
+ } else if (part === '..') {
+ if (i === 1 && (ary[2] === '..' || ary[0] === '..')) {
+ //End of the line. Keep at least one non-dot
+ //path segment at the front so it can be mapped
+ //correctly to disk. Otherwise, there is likely
+ //no path mapping for a path starting with '..'.
+ //This can still fail, but catches the most reasonable
+ //uses of ..
+ break;
+ } else if (i > 0) {
+ ary.splice(i - 1, 2);
+ i -= 2;
+ }
+ }
+ }
+ }
+
+ /**
+ * Given a relative module name, like ./something, normalize it to
+ * a real name that can be mapped to a path.
+ * @param {String} name the relative name
+ * @param {String} baseName a real name that the name arg is relative
+ * to.
+ * @param {Boolean} applyMap apply the map config to the value. Should
+ * only be done if this normalization is for a dependency ID.
+ * @returns {String} normalized name
+ */
+ function normalize(name, baseName, applyMap) {
+ var pkgName, pkgConfig, mapValue, nameParts, i, j, nameSegment,
+ foundMap, foundI, foundStarMap, starI,
+ baseParts = baseName && baseName.split('/'),
+ normalizedBaseParts = baseParts,
+ map = config.map,
+ starMap = map && map['*'];
+
+ //Adjust any relative paths.
+ if (name && name.charAt(0) === '.') {
+ //If have a base name, try to normalize against it,
+ //otherwise, assume it is a top-level require that will
+ //be relative to baseUrl in the end.
+ if (baseName) {
+ if (config.pkgs[baseName]) {
+ //If the baseName is a package name, then just treat it as one
+ //name to concat the name with.
+ normalizedBaseParts = baseParts = [baseName];
+ } else {
+ //Convert baseName to array, and lop off the last part,
+ //so that . matches that 'directory' and not name of the baseName's
+ //module. For instance, baseName of 'one/two/three', maps to
+ //'one/two/three.js', but we want the directory, 'one/two' for
+ //this normalization.
+ normalizedBaseParts = baseParts.slice(0, baseParts.length - 1);
+ }
+
+ name = normalizedBaseParts.concat(name.split('/'));
+ trimDots(name);
+
+ //Some use of packages may use a . path to reference the
+ //'main' module name, so normalize for that.
+ pkgConfig = config.pkgs[(pkgName = name[0])];
+ name = name.join('/');
+ if (pkgConfig && name === pkgName + '/' + pkgConfig.main) {
+ name = pkgName;
+ }
+ } else if (name.indexOf('./') === 0) {
+ // No baseName, so this is ID is resolved relative
+ // to baseUrl, pull off the leading dot.
+ name = name.substring(2);
+ }
+ }
+
+ //Apply map config if available.
+ if (applyMap && (baseParts || starMap) && map) {
+ nameParts = name.split('/');
+
+ for (i = nameParts.length; i > 0; i -= 1) {
+ nameSegment = nameParts.slice(0, i).join('/');
+
+ if (baseParts) {
+ //Find the longest baseName segment match in the config.
+ //So, do joins on the biggest to smallest lengths of baseParts.
+ for (j = baseParts.length; j > 0; j -= 1) {
+ mapValue = map[baseParts.slice(0, j).join('/')];
+
+ //baseName segment has config, find if it has one for
+ //this name.
+ if (mapValue) {
+ mapValue = mapValue[nameSegment];
+ if (mapValue) {
+ //Match, update name to the new value.
+ foundMap = mapValue;
+ foundI = i;
+ break;
+ }
+ }
+ }
+ }
+
+ if (foundMap) {
+ break;
+ }
+
+ //Check for a star map match, but just hold on to it,
+ //if there is a shorter segment match later in a matching
+ //config, then favor over this star map.
+ if (!foundStarMap && starMap && starMap[nameSegment]) {
+ foundStarMap = starMap[nameSegment];
+ starI = i;
+ }
+ }
+
+ if (!foundMap && foundStarMap) {
+ foundMap = foundStarMap;
+ foundI = starI;
+ }
+
+ if (foundMap) {
+ nameParts.splice(0, foundI, foundMap);
+ name = nameParts.join('/');
+ }
+ }
+
+ return name;
+ }
+
+ function removeScript(name) {
+ if (isBrowser) {
+ each(scripts(), function (scriptNode) {
+ if (scriptNode.getAttribute('data-requiremodule') === name &&
+ scriptNode.getAttribute('data-requirecontext') === context.contextName) {
+ scriptNode.parentNode.removeChild(scriptNode);
+ return true;
+ }
+ });
+ }
+ }
+
+ function hasPathFallback(id) {
+ var pathConfig = config.paths[id];
+ if (pathConfig && isArray(pathConfig) && pathConfig.length > 1) {
+ removeScript(id);
+ //Pop off the first array value, since it failed, and
+ //retry
+ pathConfig.shift();
+ context.undef(id);
+ context.require([id]);
+ return true;
+ }
+ }
+
+ /**
+ * Creates a module mapping that includes plugin prefix, module
+ * name, and path. If parentModuleMap is provided it will
+ * also normalize the name via require.normalize()
+ *
+ * @param {String} name the module name
+ * @param {String} [parentModuleMap] parent module map
+ * for the module name, used to resolve relative names.
+ * @param {Boolean} isNormalized: is the ID already normalized.
+ * This is true if this call is done for a define() module ID.
+ * @param {Boolean} applyMap: apply the map config to the ID.
+ * Should only be true if this map is for a dependency.
+ *
+ * @returns {Object}
+ */
+ function makeModuleMap(name, parentModuleMap, isNormalized, applyMap) {
+ var url, pluginModule, suffix,
+ index = name ? name.indexOf('!') : -1,
+ prefix = null,
+ parentName = parentModuleMap ? parentModuleMap.name : null,
+ originalName = name,
+ isDefine = true,
+ normalizedName = '';
+
+ //If no name, then it means it is a require call, generate an
+ //internal name.
+ if (!name) {
+ isDefine = false;
+ name = '_@r' + (requireCounter += 1);
+ }
+
+ if (index !== -1) {
+ prefix = name.substring(0, index);
+ name = name.substring(index + 1, name.length);
+ }
+
+ if (prefix) {
+ prefix = normalize(prefix, parentName, applyMap);
+ pluginModule = defined[prefix];
+ }
+
+ //Account for relative paths if there is a base name.
+ if (name) {
+ if (prefix) {
+ if (pluginModule && pluginModule.normalize) {
+ //Plugin is loaded, use its normalize method.
+ normalizedName = pluginModule.normalize(name, function (name) {
+ return normalize(name, parentName, applyMap);
+ });
+ } else {
+ normalizedName = normalize(name, parentName, applyMap);
+ }
+ } else {
+ //A regular module.
+ normalizedName = normalize(name, parentName, applyMap);
+ url = context.nameToUrl(normalizedName);
+ }
+ }
+
+ //If the id is a plugin id that cannot be determined if it needs
+ //normalization, stamp it with a unique ID so two matching relative
+ //ids that may conflict can be separate.
+ suffix = prefix && !pluginModule && !isNormalized ?
+ '_unnormalized' + (unnormalizedCounter += 1) :
+ '';
+
+ return {
+ prefix: prefix,
+ name: normalizedName,
+ parentMap: parentModuleMap,
+ unnormalized: !!suffix,
+ url: url,
+ originalName: originalName,
+ isDefine: isDefine,
+ id: (prefix ?
+ prefix + '!' + normalizedName :
+ normalizedName) + suffix
+ };
+ }
+
+ function getModule(depMap) {
+ var id = depMap.id,
+ mod = registry[id];
+
+ if (!mod) {
+ mod = registry[id] = new context.Module(depMap);
+ }
+
+ return mod;
+ }
+
+ function on(depMap, name, fn) {
+ var id = depMap.id,
+ mod = registry[id];
+
+ if (hasProp(defined, id) &&
+ (!mod || mod.defineEmitComplete)) {
+ if (name === 'defined') {
+ fn(defined[id]);
+ }
+ } else {
+ getModule(depMap).on(name, fn);
+ }
+ }
+
+ function onError(err, errback) {
+ var ids = err.requireModules,
+ notified = false;
+
+ if (errback) {
+ errback(err);
+ } else {
+ each(ids, function (id) {
+ var mod = registry[id];
+ if (mod) {
+ //Set error on module, so it skips timeout checks.
+ mod.error = err;
+ if (mod.events.error) {
+ notified = true;
+ mod.emit('error', err);
+ }
+ }
+ });
+
+ if (!notified) {
+ req.onError(err);
+ }
+ }
+ }
+
+ /**
+ * Internal method to transfer globalQueue items to this context's
+ * defQueue.
+ */
+ function takeGlobalQueue() {
+ //Push all the globalDefQueue items into the context's defQueue
+ if (globalDefQueue.length) {
+ //Array splice in the values since the context code has a
+ //local var ref to defQueue, so cannot just reassign the one
+ //on context.
+ apsp.apply(defQueue,
+ [defQueue.length - 1, 0].concat(globalDefQueue));
+ globalDefQueue = [];
+ }
+ }
+
+ /**
+ * Helper function that creates a require function object to give to
+ * modules that ask for it as a dependency. It needs to be specific
+ * per module because of the implication of path mappings that may
+ * need to be relative to the module name.
+ */
+ function makeRequire(mod, enableBuildCallback, altRequire) {
+ var relMap = mod && mod.map,
+ modRequire = makeContextModuleFunc(altRequire || context.require,
+ relMap,
+ enableBuildCallback);
+
+ addRequireMethods(modRequire, context, relMap);
+ modRequire.isBrowser = isBrowser;
+
+ return modRequire;
+ }
+
+ handlers = {
+ 'require': function (mod) {
+ return makeRequire(mod);
+ },
+ 'exports': function (mod) {
+ mod.usingExports = true;
+ if (mod.map.isDefine) {
+ return (mod.exports = defined[mod.map.id] = {});
+ }
+ },
+ 'module': function (mod) {
+ return (mod.module = {
+ id: mod.map.id,
+ uri: mod.map.url,
+ config: function () {
+ return (config.config && config.config[mod.map.id]) || {};
+ },
+ exports: defined[mod.map.id]
+ });
+ }
+ };
+
+ function removeWaiting(id) {
+ //Clean up machinery used for waiting modules.
+ delete registry[id];
+
+ each(waitAry, function (mod, i) {
+ if (mod.map.id === id) {
+ waitAry.splice(i, 1);
+ if (!mod.defined) {
+ context.waitCount -= 1;
+ }
+ return true;
+ }
+ });
+ }
+
+ function findCycle(mod, traced, processed) {
+ var id = mod.map.id,
+ depArray = mod.depMaps,
+ foundModule;
+
+ //Do not bother with unitialized modules or not yet enabled
+ //modules.
+ if (!mod.inited) {
+ return;
+ }
+
+ //Found the cycle.
+ if (traced[id]) {
+ return mod;
+ }
+
+ traced[id] = true;
+
+ //Trace through the dependencies.
+ each(depArray, function (depMap) {
+ var depId = depMap.id,
+ depMod = registry[depId];
+
+ if (!depMod || processed[depId] ||
+ !depMod.inited || !depMod.enabled) {
+ return;
+ }
+
+ return (foundModule = findCycle(depMod, traced, processed));
+ });
+
+ processed[id] = true;
+
+ return foundModule;
+ }
+
+ function forceExec(mod, traced, uninited) {
+ var id = mod.map.id,
+ depArray = mod.depMaps;
+
+ if (!mod.inited || !mod.map.isDefine) {
+ return;
+ }
+
+ if (traced[id]) {
+ return defined[id];
+ }
+
+ traced[id] = mod;
+
+ each(depArray, function (depMap) {
+ var depId = depMap.id,
+ depMod = registry[depId],
+ value;
+
+ if (handlers[depId]) {
+ return;
+ }
+
+ if (depMod) {
+ if (!depMod.inited || !depMod.enabled) {
+ //Dependency is not inited,
+ //so this module cannot be
+ //given a forced value yet.
+ uninited[id] = true;
+ return;
+ }
+
+ //Get the value for the current dependency
+ value = forceExec(depMod, traced, uninited);
+
+ //Even with forcing it may not be done,
+ //in particular if the module is waiting
+ //on a plugin resource.
+ if (!uninited[depId]) {
+ mod.defineDepById(depId, value);
+ }
+ }
+ });
+
+ mod.check(true);
+
+ return defined[id];
+ }
+
+ function modCheck(mod) {
+ mod.check();
+ }
+
+ function checkLoaded() {
+ var map, modId, err, usingPathFallback,
+ waitInterval = config.waitSeconds * 1000,
+ //It is possible to disable the wait interval by using waitSeconds of 0.
+ expired = waitInterval && (context.startTime + waitInterval) < new Date().getTime(),
+ noLoads = [],
+ stillLoading = false,
+ needCycleCheck = true;
+
+ //Do not bother if this call was a result of a cycle break.
+ if (inCheckLoaded) {
+ return;
+ }
+
+ inCheckLoaded = true;
+
+ //Figure out the state of all the modules.
+ eachProp(registry, function (mod) {
+ map = mod.map;
+ modId = map.id;
+
+ //Skip things that are not enabled or in error state.
+ if (!mod.enabled) {
+ return;
+ }
+
+ if (!mod.error) {
+ //If the module should be executed, and it has not
+ //been inited and time is up, remember it.
+ if (!mod.inited && expired) {
+ if (hasPathFallback(modId)) {
+ usingPathFallback = true;
+ stillLoading = true;
+ } else {
+ noLoads.push(modId);
+ removeScript(modId);
+ }
+ } else if (!mod.inited && mod.fetched && map.isDefine) {
+ stillLoading = true;
+ if (!map.prefix) {
+ //No reason to keep looking for unfinished
+ //loading. If the only stillLoading is a
+ //plugin resource though, keep going,
+ //because it may be that a plugin resource
+ //is waiting on a non-plugin cycle.
+ return (needCycleCheck = false);
+ }
+ }
+ }
+ });
+
+ if (expired && noLoads.length) {
+ //If wait time expired, throw error of unloaded modules.
+ err = makeError('timeout', 'Load timeout for modules: ' + noLoads, null, noLoads);
+ err.contextName = context.contextName;
+ return onError(err);
+ }
+
+ //Not expired, check for a cycle.
+ if (needCycleCheck) {
+
+ each(waitAry, function (mod) {
+ if (mod.defined) {
+ return;
+ }
+
+ var cycleMod = findCycle(mod, {}, {}),
+ traced = {};
+
+ if (cycleMod) {
+ forceExec(cycleMod, traced, {});
+
+ //traced modules may have been
+ //removed from the registry, but
+ //their listeners still need to
+ //be called.
+ eachProp(traced, modCheck);
+ }
+ });
+
+ //Now that dependencies have
+ //been satisfied, trigger the
+ //completion check that then
+ //notifies listeners.
+ eachProp(registry, modCheck);
+ }
+
+ //If still waiting on loads, and the waiting load is something
+ //other than a plugin resource, or there are still outstanding
+ //scripts, then just try back later.
+ if ((!expired || usingPathFallback) && stillLoading) {
+ //Something is still waiting to load. Wait for it, but only
+ //if a timeout is not already in effect.
+ if ((isBrowser || isWebWorker) && !checkLoadedTimeoutId) {
+ checkLoadedTimeoutId = setTimeout(function () {
+ checkLoadedTimeoutId = 0;
+ checkLoaded();
+ }, 50);
+ }
+ }
+
+ inCheckLoaded = false;
+ }
+
+ Module = function (map) {
+ this.events = undefEvents[map.id] || {};
+ this.map = map;
+ this.shim = config.shim[map.id];
+ this.depExports = [];
+ this.depMaps = [];
+ this.depMatched = [];
+ this.pluginMaps = {};
+ this.depCount = 0;
+
+ /* this.exports this.factory
+ this.depMaps = [],
+ this.enabled, this.fetched
+ */
+ };
+
+ Module.prototype = {
+ init: function (depMaps, factory, errback, options) {
+ options = options || {};
+
+ //Do not do more inits if already done. Can happen if there
+ //are multiple define calls for the same module. That is not
+ //a normal, common case, but it is also not unexpected.
+ if (this.inited) {
+ return;
+ }
+
+ this.factory = factory;
+
+ if (errback) {
+ //Register for errors on this module.
+ this.on('error', errback);
+ } else if (this.events.error) {
+ //If no errback already, but there are error listeners
+ //on this module, set up an errback to pass to the deps.
+ errback = bind(this, function (err) {
+ this.emit('error', err);
+ });
+ }
+
+ //Do a copy of the dependency array, so that
+ //source inputs are not modified. For example
+ //"shim" deps are passed in here directly, and
+ //doing a direct modification of the depMaps array
+ //would affect that config.
+ this.depMaps = depMaps && depMaps.slice(0);
+ this.depMaps.rjsSkipMap = depMaps.rjsSkipMap;
+
+ this.errback = errback;
+
+ //Indicate this module has be initialized
+ this.inited = true;
+
+ this.ignore = options.ignore;
+
+ //Could have option to init this module in enabled mode,
+ //or could have been previously marked as enabled. However,
+ //the dependencies are not known until init is called. So
+ //if enabled previously, now trigger dependencies as enabled.
+ if (options.enabled || this.enabled) {
+ //Enable this module and dependencies.
+ //Will call this.check()
+ this.enable();
+ } else {
+ this.check();
+ }
+ },
+
+ defineDepById: function (id, depExports) {
+ var i;
+
+ //Find the index for this dependency.
+ each(this.depMaps, function (map, index) {
+ if (map.id === id) {
+ i = index;
+ return true;
+ }
+ });
+
+ return this.defineDep(i, depExports);
+ },
+
+ defineDep: function (i, depExports) {
+ //Because of cycles, defined callback for a given
+ //export can be called more than once.
+ if (!this.depMatched[i]) {
+ this.depMatched[i] = true;
+ this.depCount -= 1;
+ this.depExports[i] = depExports;
+ }
+ },
+
+ fetch: function () {
+ if (this.fetched) {
+ return;
+ }
+ this.fetched = true;
+
+ context.startTime = (new Date()).getTime();
+
+ var map = this.map;
+
+ //If the manager is for a plugin managed resource,
+ //ask the plugin to load it now.
+ if (this.shim) {
+ makeRequire(this, true)(this.shim.deps || [], bind(this, function () {
+ return map.prefix ? this.callPlugin() : this.load();
+ }));
+ } else {
+ //Regular dependency.
+ return map.prefix ? this.callPlugin() : this.load();
+ }
+ },
+
+ load: function () {
+ var url = this.map.url;
+
+ //Regular dependency.
+ if (!urlFetched[url]) {
+ urlFetched[url] = true;
+ context.load(this.map.id, url);
+ }
+ },
+
+ /**
+ * Checks is the module is ready to define itself, and if so,
+ * define it. If the silent argument is true, then it will just
+ * define, but not notify listeners, and not ask for a context-wide
+ * check of all loaded modules. That is useful for cycle breaking.
+ */
+ check: function (silent) {
+ if (!this.enabled || this.enabling) {
+ return;
+ }
+
+ var err, cjsModule,
+ id = this.map.id,
+ depExports = this.depExports,
+ exports = this.exports,
+ factory = this.factory;
+
+ if (!this.inited) {
+ this.fetch();
+ } else if (this.error) {
+ this.emit('error', this.error);
+ } else if (!this.defining) {
+ //The factory could trigger another require call
+ //that would result in checking this module to
+ //define itself again. If already in the process
+ //of doing that, skip this work.
+ this.defining = true;
+
+ if (this.depCount < 1 && !this.defined) {
+ if (isFunction(factory)) {
+ //If there is an error listener, favor passing
+ //to that instead of throwing an error.
+ if (this.events.error) {
+ try {
+ exports = context.execCb(id, factory, depExports, exports);
+ } catch (e) {
+ err = e;
+ }
+ } else {
+ exports = context.execCb(id, factory, depExports, exports);
+ }
+
+ if (this.map.isDefine) {
+ //If setting exports via 'module' is in play,
+ //favor that over return value and exports. After that,
+ //favor a non-undefined return value over exports use.
+ cjsModule = this.module;
+ if (cjsModule &&
+ cjsModule.exports !== undefined &&
+ //Make sure it is not already the exports value
+ cjsModule.exports !== this.exports) {
+ exports = cjsModule.exports;
+ } else if (exports === undefined && this.usingExports) {
+ //exports already set the defined value.
+ exports = this.exports;
+ }
+ }
+
+ if (err) {
+ err.requireMap = this.map;
+ err.requireModules = [this.map.id];
+ err.requireType = 'define';
+ return onError((this.error = err));
+ }
+
+ } else {
+ //Just a literal value
+ exports = factory;
+ }
+
+ this.exports = exports;
+
+ if (this.map.isDefine && !this.ignore) {
+ defined[id] = exports;
+
+ if (req.onResourceLoad) {
+ req.onResourceLoad(context, this.map, this.depMaps);
+ }
+ }
+
+ //Clean up
+ delete registry[id];
+
+ this.defined = true;
+ context.waitCount -= 1;
+ if (context.waitCount === 0) {
+ //Clear the wait array used for cycles.
+ waitAry = [];
+ }
+ }
+
+ //Finished the define stage. Allow calling check again
+ //to allow define notifications below in the case of a
+ //cycle.
+ this.defining = false;
+
+ if (!silent) {
+ if (this.defined && !this.defineEmitted) {
+ this.defineEmitted = true;
+ this.emit('defined', this.exports);
+ this.defineEmitComplete = true;
+ }
+ }
+ }
+ },
+
+ callPlugin: function () {
+ var map = this.map,
+ id = map.id,
+ pluginMap = makeModuleMap(map.prefix, null, false, true);
+
+ on(pluginMap, 'defined', bind(this, function (plugin) {
+ var load, normalizedMap, normalizedMod,
+ name = this.map.name,
+ parentName = this.map.parentMap ? this.map.parentMap.name : null;
+
+ //If current map is not normalized, wait for that
+ //normalized name to load instead of continuing.
+ if (this.map.unnormalized) {
+ //Normalize the ID if the plugin allows it.
+ if (plugin.normalize) {
+ name = plugin.normalize(name, function (name) {
+ return normalize(name, parentName, true);
+ }) || '';
+ }
+
+ normalizedMap = makeModuleMap(map.prefix + '!' + name,
+ this.map.parentMap,
+ false,
+ true);
+ on(normalizedMap,
+ 'defined', bind(this, function (value) {
+ this.init([], function () { return value; }, null, {
+ enabled: true,
+ ignore: true
+ });
+ }));
+ normalizedMod = registry[normalizedMap.id];
+ if (normalizedMod) {
+ if (this.events.error) {
+ normalizedMod.on('error', bind(this, function (err) {
+ this.emit('error', err);
+ }));
+ }
+ normalizedMod.enable();
+ }
+
+ return;
+ }
+
+ load = bind(this, function (value) {
+ this.init([], function () { return value; }, null, {
+ enabled: true
+ });
+ });
+
+ load.error = bind(this, function (err) {
+ this.inited = true;
+ this.error = err;
+ err.requireModules = [id];
+
+ //Remove temp unnormalized modules for this module,
+ //since they will never be resolved otherwise now.
+ eachProp(registry, function (mod) {
+ if (mod.map.id.indexOf(id + '_unnormalized') === 0) {
+ removeWaiting(mod.map.id);
+ }
+ });
+
+ onError(err);
+ });
+
+ //Allow plugins to load other code without having to know the
+ //context or how to 'complete' the load.
+ load.fromText = function (moduleName, text) {
+ /*jslint evil: true */
+ var hasInteractive = useInteractive;
+
+ //Turn off interactive script matching for IE for any define
+ //calls in the text, then turn it back on at the end.
+ if (hasInteractive) {
+ useInteractive = false;
+ }
+
+ //Prime the system by creating a module instance for
+ //it.
+ getModule(makeModuleMap(moduleName));
+
+ req.exec(text);
+
+ if (hasInteractive) {
+ useInteractive = true;
+ }
+
+ //Support anonymous modules.
+ context.completeLoad(moduleName);
+ };
+
+ //Use parentName here since the plugin's name is not reliable,
+ //could be some weird string with no path that actually wants to
+ //reference the parentName's path.
+ plugin.load(map.name, makeRequire(map.parentMap, true, function (deps, cb, er) {
+ deps.rjsSkipMap = true;
+ return context.require(deps, cb, er);
+ }), load, config);
+ }));
+
+ context.enable(pluginMap, this);
+ this.pluginMaps[pluginMap.id] = pluginMap;
+ },
+
+ enable: function () {
+ this.enabled = true;
+
+ if (!this.waitPushed) {
+ waitAry.push(this);
+ context.waitCount += 1;
+ this.waitPushed = true;
+ }
+
+ //Set flag mentioning that the module is enabling,
+ //so that immediate calls to the defined callbacks
+ //for dependencies do not trigger inadvertent load
+ //with the depCount still being zero.
+ this.enabling = true;
+
+ //Enable each dependency
+ each(this.depMaps, bind(this, function (depMap, i) {
+ var id, mod, handler;
+
+ if (typeof depMap === 'string') {
+ //Dependency needs to be converted to a depMap
+ //and wired up to this module.
+ depMap = makeModuleMap(depMap,
+ (this.map.isDefine ? this.map : this.map.parentMap),
+ false,
+ !this.depMaps.rjsSkipMap);
+ this.depMaps[i] = depMap;
+
+ handler = handlers[depMap.id];
+
+ if (handler) {
+ this.depExports[i] = handler(this);
+ return;
+ }
+
+ this.depCount += 1;
+
+ on(depMap, 'defined', bind(this, function (depExports) {
+ this.defineDep(i, depExports);
+ this.check();
+ }));
+
+ if (this.errback) {
+ on(depMap, 'error', this.errback);
+ }
+ }
+
+ id = depMap.id;
+ mod = registry[id];
+
+ //Skip special modules like 'require', 'exports', 'module'
+ //Also, don't call enable if it is already enabled,
+ //important in circular dependency cases.
+ if (!handlers[id] && mod && !mod.enabled) {
+ context.enable(depMap, this);
+ }
+ }));
+
+ //Enable each plugin that is used in
+ //a dependency
+ eachProp(this.pluginMaps, bind(this, function (pluginMap) {
+ var mod = registry[pluginMap.id];
+ if (mod && !mod.enabled) {
+ context.enable(pluginMap, this);
+ }
+ }));
+
+ this.enabling = false;
+
+ this.check();
+ },
+
+ on: function (name, cb) {
+ var cbs = this.events[name];
+ if (!cbs) {
+ cbs = this.events[name] = [];
+ }
+ cbs.push(cb);
+ },
+
+ emit: function (name, evt) {
+ each(this.events[name], function (cb) {
+ cb(evt);
+ });
+ if (name === 'error') {
+ //Now that the error handler was triggered, remove
+ //the listeners, since this broken Module instance
+ //can stay around for a while in the registry/waitAry.
+ delete this.events[name];
+ }
+ }
+ };
+
+ function callGetModule(args) {
+ getModule(makeModuleMap(args[0], null, true)).init(args[1], args[2]);
+ }
+
+ function removeListener(node, func, name, ieName) {
+ //Favor detachEvent because of IE9
+ //issue, see attachEvent/addEventListener comment elsewhere
+ //in this file.
+ if (node.detachEvent && !isOpera) {
+ //Probably IE. If not it will throw an error, which will be
+ //useful to know.
+ if (ieName) {
+ node.detachEvent(ieName, func);
+ }
+ } else {
+ node.removeEventListener(name, func, false);
+ }
+ }
+
+ /**
+ * Given an event from a script node, get the requirejs info from it,
+ * and then removes the event listeners on the node.
+ * @param {Event} evt
+ * @returns {Object}
+ */
+ function getScriptData(evt) {
+ //Using currentTarget instead of target for Firefox 2.0's sake. Not
+ //all old browsers will be supported, but this one was easy enough
+ //to support and still makes sense.
+ var node = evt.currentTarget || evt.srcElement;
+
+ //Remove the listeners once here.
+ removeListener(node, context.onScriptLoad, 'load', 'onreadystatechange');
+ removeListener(node, context.onScriptError, 'error');
+
+ return {
+ node: node,
+ id: node && node.getAttribute('data-requiremodule')
+ };
+ }
+
+ return (context = {
+ config: config,
+ contextName: contextName,
+ registry: registry,
+ defined: defined,
+ urlFetched: urlFetched,
+ waitCount: 0,
+ defQueue: defQueue,
+ Module: Module,
+ makeModuleMap: makeModuleMap,
+
+ /**
+ * Set a configuration for the context.
+ * @param {Object} cfg config object to integrate.
+ */
+ configure: function (cfg) {
+ //Make sure the baseUrl ends in a slash.
+ if (cfg.baseUrl) {
+ if (cfg.baseUrl.charAt(cfg.baseUrl.length - 1) !== '/') {
+ cfg.baseUrl += '/';
+ }
+ }
+
+ //Save off the paths and packages since they require special processing,
+ //they are additive.
+ var pkgs = config.pkgs,
+ shim = config.shim,
+ paths = config.paths,
+ map = config.map;
+
+ //Mix in the config values, favoring the new values over
+ //existing ones in context.config.
+ mixin(config, cfg, true);
+
+ //Merge paths.
+ config.paths = mixin(paths, cfg.paths, true);
+
+ //Merge map
+ if (cfg.map) {
+ config.map = mixin(map || {}, cfg.map, true, true);
+ }
+
+ //Merge shim
+ if (cfg.shim) {
+ eachProp(cfg.shim, function (value, id) {
+ //Normalize the structure
+ if (isArray(value)) {
+ value = {
+ deps: value
+ };
+ }
+ if (value.exports && !value.exports.__buildReady) {
+ value.exports = context.makeShimExports(value.exports);
+ }
+ shim[id] = value;
+ });
+ config.shim = shim;
+ }
+
+ //Adjust packages if necessary.
+ if (cfg.packages) {
+ each(cfg.packages, function (pkgObj) {
+ var location;
+
+ pkgObj = typeof pkgObj === 'string' ? { name: pkgObj } : pkgObj;
+ location = pkgObj.location;
+
+ //Create a brand new object on pkgs, since currentPackages can
+ //be passed in again, and config.pkgs is the internal transformed
+ //state for all package configs.
+ pkgs[pkgObj.name] = {
+ name: pkgObj.name,
+ location: location || pkgObj.name,
+ //Remove leading dot in main, so main paths are normalized,
+ //and remove any trailing .js, since different package
+ //envs have different conventions: some use a module name,
+ //some use a file name.
+ main: (pkgObj.main || 'main')
+ .replace(currDirRegExp, '')
+ .replace(jsSuffixRegExp, '')
+ };
+ });
+
+ //Done with modifications, assing packages back to context config
+ config.pkgs = pkgs;
+ }
+
+ //If there are any "waiting to execute" modules in the registry,
+ //update the maps for them, since their info, like URLs to load,
+ //may have changed.
+ eachProp(registry, function (mod, id) {
+ //If module already has init called, since it is too
+ //late to modify them, and ignore unnormalized ones
+ //since they are transient.
+ if (!mod.inited && !mod.map.unnormalized) {
+ mod.map = makeModuleMap(id);
+ }
+ });
+
+ //If a deps array or a config callback is specified, then call
+ //require with those args. This is useful when require is defined as a
+ //config object before require.js is loaded.
+ if (cfg.deps || cfg.callback) {
+ context.require(cfg.deps || [], cfg.callback);
+ }
+ },
+
+ makeShimExports: function (exports) {
+ var func;
+ if (typeof exports === 'string') {
+ func = function () {
+ return getGlobal(exports);
+ };
+ //Save the exports for use in nodefine checking.
+ func.exports = exports;
+ return func;
+ } else {
+ return function () {
+ return exports.apply(global, arguments);
+ };
+ }
+ },
+
+ requireDefined: function (id, relMap) {
+ return hasProp(defined, makeModuleMap(id, relMap, false, true).id);
+ },
+
+ requireSpecified: function (id, relMap) {
+ id = makeModuleMap(id, relMap, false, true).id;
+ return hasProp(defined, id) || hasProp(registry, id);
+ },
+
+ require: function (deps, callback, errback, relMap) {
+ var moduleName, id, map, requireMod, args;
+ if (typeof deps === 'string') {
+ if (isFunction(callback)) {
+ //Invalid call
+ return onError(makeError('requireargs', 'Invalid require call'), errback);
+ }
+
+ //Synchronous access to one module. If require.get is
+ //available (as in the Node adapter), prefer that.
+ //In this case deps is the moduleName and callback is
+ //the relMap
+ if (req.get) {
+ return req.get(context, deps, callback);
+ }
+
+ //Just return the module wanted. In this scenario, the
+ //second arg (if passed) is just the relMap.
+ moduleName = deps;
+ relMap = callback;
+
+ //Normalize module name, if it contains . or ..
+ map = makeModuleMap(moduleName, relMap, false, true);
+ id = map.id;
+
+ if (!hasProp(defined, id)) {
+ return onError(makeError('notloaded', 'Module name "' +
+ id +
+ '" has not been loaded yet for context: ' +
+ contextName));
+ }
+ return defined[id];
+ }
+
+ //Callback require. Normalize args. if callback or errback is
+ //not a function, it means it is a relMap. Test errback first.
+ if (errback && !isFunction(errback)) {
+ relMap = errback;
+ errback = undefined;
+ }
+ if (callback && !isFunction(callback)) {
+ relMap = callback;
+ callback = undefined;
+ }
+
+ //Any defined modules in the global queue, intake them now.
+ takeGlobalQueue();
+
+ //Make sure any remaining defQueue items get properly processed.
+ while (defQueue.length) {
+ args = defQueue.shift();
+ if (args[0] === null) {
+ return onError(makeError('mismatch', 'Mismatched anonymous define() module: ' + args[args.length - 1]));
+ } else {
+ //args are id, deps, factory. Should be normalized by the
+ //define() function.
+ callGetModule(args);
+ }
+ }
+
+ //Mark all the dependencies as needing to be loaded.
+ requireMod = getModule(makeModuleMap(null, relMap));
+
+ requireMod.init(deps, callback, errback, {
+ enabled: true
+ });
+
+ checkLoaded();
+
+ return context.require;
+ },
+
+ undef: function (id) {
+ //Bind any waiting define() calls to this context,
+ //fix for #408
+ takeGlobalQueue();
+
+ var map = makeModuleMap(id, null, true),
+ mod = registry[id];
+
+ delete defined[id];
+ delete urlFetched[map.url];
+ delete undefEvents[id];
+
+ if (mod) {
+ //Hold on to listeners in case the
+ //module will be attempted to be reloaded
+ //using a different config.
+ if (mod.events.defined) {
+ undefEvents[id] = mod.events;
+ }
+
+ removeWaiting(id);
+ }
+ },
+
+ /**
+ * Called to enable a module if it is still in the registry
+ * awaiting enablement. parent module is passed in for context,
+ * used by the optimizer.
+ */
+ enable: function (depMap, parent) {
+ var mod = registry[depMap.id];
+ if (mod) {
+ getModule(depMap).enable();
+ }
+ },
+
+ /**
+ * Internal method used by environment adapters to complete a load event.
+ * A load event could be a script load or just a load pass from a synchronous
+ * load call.
+ * @param {String} moduleName the name of the module to potentially complete.
+ */
+ completeLoad: function (moduleName) {
+ var found, args, mod,
+ shim = config.shim[moduleName] || {},
+ shExports = shim.exports && shim.exports.exports;
+
+ takeGlobalQueue();
+
+ while (defQueue.length) {
+ args = defQueue.shift();
+ if (args[0] === null) {
+ args[0] = moduleName;
+ //If already found an anonymous module and bound it
+ //to this name, then this is some other anon module
+ //waiting for its completeLoad to fire.
+ if (found) {
+ break;
+ }
+ found = true;
+ } else if (args[0] === moduleName) {
+ //Found matching define call for this script!
+ found = true;
+ }
+
+ callGetModule(args);
+ }
+
+ //Do this after the cycle of callGetModule in case the result
+ //of those calls/init calls changes the registry.
+ mod = registry[moduleName];
+
+ if (!found && !defined[moduleName] && mod && !mod.inited) {
+ if (config.enforceDefine && (!shExports || !getGlobal(shExports))) {
+ if (hasPathFallback(moduleName)) {
+ return;
+ } else {
+ return onError(makeError('nodefine',
+ 'No define call for ' + moduleName,
+ null,
+ [moduleName]));
+ }
+ } else {
+ //A script that does not call define(), so just simulate
+ //the call for it.
+ callGetModule([moduleName, (shim.deps || []), shim.exports]);
+ }
+ }
+
+ checkLoaded();
+ },
+
+ /**
+ * Converts a module name + .extension into an URL path.
+ * *Requires* the use of a module name. It does not support using
+ * plain URLs like nameToUrl.
+ */
+ toUrl: function (moduleNamePlusExt, relModuleMap) {
+ var index = moduleNamePlusExt.lastIndexOf('.'),
+ ext = null;
+
+ if (index !== -1) {
+ ext = moduleNamePlusExt.substring(index, moduleNamePlusExt.length);
+ moduleNamePlusExt = moduleNamePlusExt.substring(0, index);
+ }
+
+ return context.nameToUrl(normalize(moduleNamePlusExt, relModuleMap && relModuleMap.id, true),
+ ext);
+ },
+
+ /**
+ * Converts a module name to a file path. Supports cases where
+ * moduleName may actually be just an URL.
+ * Note that it **does not** call normalize on the moduleName,
+ * it is assumed to have already been normalized. This is an
+ * internal API, not a public one. Use toUrl for the public API.
+ */
+ nameToUrl: function (moduleName, ext) {
+ var paths, pkgs, pkg, pkgPath, syms, i, parentModule, url,
+ parentPath;
+
+ //If a colon is in the URL, it indicates a protocol is used and it is just
+ //an URL to a file, or if it starts with a slash, contains a query arg (i.e. ?)
+ //or ends with .js, then assume the user meant to use an url and not a module id.
+ //The slash is important for protocol-less URLs as well as full paths.
+ if (req.jsExtRegExp.test(moduleName)) {
+ //Just a plain path, not module name lookup, so just return it.
+ //Add extension if it is included. This is a bit wonky, only non-.js things pass
+ //an extension, this method probably needs to be reworked.
+ url = moduleName + (ext || '');
+ } else {
+ //A module that needs to be converted to a path.
+ paths = config.paths;
+ pkgs = config.pkgs;
+
+ syms = moduleName.split('/');
+ //For each module name segment, see if there is a path
+ //registered for it. Start with most specific name
+ //and work up from it.
+ for (i = syms.length; i > 0; i -= 1) {
+ parentModule = syms.slice(0, i).join('/');
+ pkg = pkgs[parentModule];
+ parentPath = paths[parentModule];
+ if (parentPath) {
+ //If an array, it means there are a few choices,
+ //Choose the one that is desired
+ if (isArray(parentPath)) {
+ parentPath = parentPath[0];
+ }
+ syms.splice(0, i, parentPath);
+ break;
+ } else if (pkg) {
+ //If module name is just the package name, then looking
+ //for the main module.
+ if (moduleName === pkg.name) {
+ pkgPath = pkg.location + '/' + pkg.main;
+ } else {
+ pkgPath = pkg.location;
+ }
+ syms.splice(0, i, pkgPath);
+ break;
+ }
+ }
+
+ //Join the path parts together, then figure out if baseUrl is needed.
+ url = syms.join('/');
+ url += (ext || (/\?/.test(url) ? '' : '.js'));
+ url = (url.charAt(0) === '/' || url.match(/^[\w\+\.\-]+:/) ? '' : config.baseUrl) + url;
+ }
+
+ return config.urlArgs ? url +
+ ((url.indexOf('?') === -1 ? '?' : '&') +
+ config.urlArgs) : url;
+ },
+
+ //Delegates to req.load. Broken out as a separate function to
+ //allow overriding in the optimizer.
+ load: function (id, url) {
+ req.load(context, id, url);
+ },
+
+ /**
+ * Executes a module callack function. Broken out as a separate function
+ * solely to allow the build system to sequence the files in the built
+ * layer in the right sequence.
+ *
+ * @private
+ */
+ execCb: function (name, callback, args, exports) {
+ return callback.apply(exports, args);
+ },
+
+ /**
+ * callback for script loads, used to check status of loading.
+ *
+ * @param {Event} evt the event from the browser for the script
+ * that was loaded.
+ */
+ onScriptLoad: function (evt) {
+ //Using currentTarget instead of target for Firefox 2.0's sake. Not
+ //all old browsers will be supported, but this one was easy enough
+ //to support and still makes sense.
+ if (evt.type === 'load' ||
+ (readyRegExp.test((evt.currentTarget || evt.srcElement).readyState))) {
+ //Reset interactive script so a script node is not held onto for
+ //to long.
+ interactiveScript = null;
+
+ //Pull out the name of the module and the context.
+ var data = getScriptData(evt);
+ context.completeLoad(data.id);
+ }
+ },
+
+ /**
+ * Callback for script errors.
+ */
+ onScriptError: function (evt) {
+ var data = getScriptData(evt);
+ if (!hasPathFallback(data.id)) {
+ return onError(makeError('scripterror', 'Script error', evt, [data.id]));
+ }
+ }
+ });
+ }
+
+ /**
+ * Main entry point.
+ *
+ * If the only argument to require is a string, then the module that
+ * is represented by that string is fetched for the appropriate context.
+ *
+ * If the first argument is an array, then it will be treated as an array
+ * of dependency string names to fetch. An optional function callback can
+ * be specified to execute when all of those dependencies are available.
+ *
+ * Make a local req variable to help Caja compliance (it assumes things
+ * on a require that are not standardized), and to give a short
+ * name for minification/local scope use.
+ */
+ req = requirejs = function (deps, callback, errback, optional) {
+
+ //Find the right context, use default
+ var context, config,
+ contextName = defContextName;
+
+ // Determine if have config object in the call.
+ if (!isArray(deps) && typeof deps !== 'string') {
+ // deps is a config object
+ config = deps;
+ if (isArray(callback)) {
+ // Adjust args if there are dependencies
+ deps = callback;
+ callback = errback;
+ errback = optional;
+ } else {
+ deps = [];
+ }
+ }
+
+ if (config && config.context) {
+ contextName = config.context;
+ }
+
+ context = contexts[contextName];
+ if (!context) {
+ context = contexts[contextName] = req.s.newContext(contextName);
+ }
+
+ if (config) {
+ context.configure(config);
+ }
+
+ return context.require(deps, callback, errback);
+ };
+
+ /**
+ * Support require.config() to make it easier to cooperate with other
+ * AMD loaders on globally agreed names.
+ */
+ req.config = function (config) {
+ return req(config);
+ };
+
+ /**
+ * Export require as a global, but only if it does not already exist.
+ */
+ if (!require) {
+ require = req;
+ }
+
+ req.version = version;
+
+ //Used to filter out dependencies that are already paths.
+ req.jsExtRegExp = /^\/|:|\?|\.js$/;
+ req.isBrowser = isBrowser;
+ s = req.s = {
+ contexts: contexts,
+ newContext: newContext
+ };
+
+ //Create default context.
+ req({});
+
+ //Exports some context-sensitive methods on global require, using
+ //default context if no context specified.
+ addRequireMethods(req);
+
+ if (isBrowser) {
+ head = s.head = document.getElementsByTagName('head')[0];
+ //If BASE tag is in play, using appendChild is a problem for IE6.
+ //When that browser dies, this can be removed. Details in this jQuery bug:
+ //http://dev.jquery.com/ticket/2709
+ baseElement = document.getElementsByTagName('base')[0];
+ if (baseElement) {
+ head = s.head = baseElement.parentNode;
+ }
+ }
+
+ /**
+ * Any errors that require explicitly generates will be passed to this
+ * function. Intercept/override it if you want custom error handling.
+ * @param {Error} err the error object.
+ */
+ req.onError = function (err) {
+ throw err;
+ };
+
+ /**
+ * Does the request to load a module for the browser case.
+ * Make this a separate function to allow other environments
+ * to override it.
+ *
+ * @param {Object} context the require context to find state.
+ * @param {String} moduleName the name of the module.
+ * @param {Object} url the URL to the module.
+ */
+ req.load = function (context, moduleName, url) {
+ var config = (context && context.config) || {},
+ node;
+ if (isBrowser) {
+ //In the browser so use a script tag
+ node = config.xhtml ?
+ document.createElementNS('http://www.w3.org/1999/xhtml', 'html:script') :
+ document.createElement('script');
+ node.type = config.scriptType || 'text/javascript';
+ node.charset = 'utf-8';
+ node.async = true;
+
+ node.setAttribute('data-requirecontext', context.contextName);
+ node.setAttribute('data-requiremodule', moduleName);
+
+ //Set up load listener. Test attachEvent first because IE9 has
+ //a subtle issue in its addEventListener and script onload firings
+ //that do not match the behavior of all other browsers with
+ //addEventListener support, which fire the onload event for a
+ //script right after the script execution. See:
+ //https://connect.microsoft.com/IE/feedback/details/648057/script-onload-event-is-not-fired-immediately-after-script-execution
+ //UNFORTUNATELY Opera implements attachEvent but does not follow the script
+ //script execution mode.
+ if (node.attachEvent &&
+ //Check if node.attachEvent is artificially added by custom script or
+ //natively supported by browser
+ //read https://github.com/jrburke/requirejs/issues/187
+ //if we can NOT find [native code] then it must NOT natively supported.
+ //in IE8, node.attachEvent does not have toString()
+ //Note the test for "[native code" with no closing brace, see:
+ //https://github.com/jrburke/requirejs/issues/273
+ !(node.attachEvent.toString && node.attachEvent.toString().indexOf('[native code') < 0) &&
+ !isOpera) {
+ //Probably IE. IE (at least 6-8) do not fire
+ //script onload right after executing the script, so
+ //we cannot tie the anonymous define call to a name.
+ //However, IE reports the script as being in 'interactive'
+ //readyState at the time of the define call.
+ useInteractive = true;
+
+ node.attachEvent('onreadystatechange', context.onScriptLoad);
+ //It would be great to add an error handler here to catch
+ //404s in IE9+. However, onreadystatechange will fire before
+ //the error handler, so that does not help. If addEvenListener
+ //is used, then IE will fire error before load, but we cannot
+ //use that pathway given the connect.microsoft.com issue
+ //mentioned above about not doing the 'script execute,
+ //then fire the script load event listener before execute
+ //next script' that other browsers do.
+ //Best hope: IE10 fixes the issues,
+ //and then destroys all installs of IE 6-9.
+ //node.attachEvent('onerror', context.onScriptError);
+ } else {
+ node.addEventListener('load', context.onScriptLoad, false);
+ node.addEventListener('error', context.onScriptError, false);
+ }
+ node.src = url;
+
+ //For some cache cases in IE 6-8, the script executes before the end
+ //of the appendChild execution, so to tie an anonymous define
+ //call to the module name (which is stored on the node), hold on
+ //to a reference to this node, but clear after the DOM insertion.
+ currentlyAddingScript = node;
+ if (baseElement) {
+ head.insertBefore(node, baseElement);
+ } else {
+ head.appendChild(node);
+ }
+ currentlyAddingScript = null;
+
+ return node;
+ } else if (isWebWorker) {
+ //In a web worker, use importScripts. This is not a very
+ //efficient use of importScripts, importScripts will block until
+ //its script is downloaded and evaluated. However, if web workers
+ //are in play, the expectation that a build has been done so that
+ //only one script needs to be loaded anyway. This may need to be
+ //reevaluated if other use cases become common.
+ importScripts(url);
+
+ //Account for anonymous modules
+ context.completeLoad(moduleName);
+ }
+ };
+
+ function getInteractiveScript() {
+ if (interactiveScript && interactiveScript.readyState === 'interactive') {
+ return interactiveScript;
+ }
+
+ eachReverse(scripts(), function (script) {
+ if (script.readyState === 'interactive') {
+ return (interactiveScript = script);
+ }
+ });
+ return interactiveScript;
+ }
+
+ //Look for a data-main script attribute, which could also adjust the baseUrl.
+ if (isBrowser) {
+ //Figure out baseUrl. Get it from the script tag with require.js in it.
+ eachReverse(scripts(), function (script) {
+ //Set the 'head' where we can append children by
+ //using the script's parent.
+ if (!head) {
+ head = script.parentNode;
+ }
+
+ //Look for a data-main attribute to set main script for the page
+ //to load. If it is there, the path to data main becomes the
+ //baseUrl, if it is not already set.
+ dataMain = script.getAttribute('data-main');
+ if (dataMain) {
+ //Set final baseUrl if there is not already an explicit one.
+ if (!cfg.baseUrl) {
+ //Pull off the directory of data-main for use as the
+ //baseUrl.
+ src = dataMain.split('/');
+ mainScript = src.pop();
+ subPath = src.length ? src.join('/') + '/' : './';
+
+ cfg.baseUrl = subPath;
+ dataMain = mainScript;
+ }
+
+ //Strip off any trailing .js since dataMain is now
+ //like a module name.
+ dataMain = dataMain.replace(jsSuffixRegExp, '');
+
+ //Put the data-main script in the files to load.
+ cfg.deps = cfg.deps ? cfg.deps.concat(dataMain) : [dataMain];
+
+ return true;
+ }
+ });
+ }
+
+ /**
+ * The function that handles definitions of modules. Differs from
+ * require() in that a string for the module should be the first argument,
+ * and the function to execute after dependencies are loaded should
+ * return a value to define the module corresponding to the first argument's
+ * name.
+ */
+ define = function (name, deps, callback) {
+ var node, context;
+
+ //Allow for anonymous functions
+ if (typeof name !== 'string') {
+ //Adjust args appropriately
+ callback = deps;
+ deps = name;
+ name = null;
+ }
+
+ //This module may not have dependencies
+ if (!isArray(deps)) {
+ callback = deps;
+ deps = [];
+ }
+
+ //If no name, and callback is a function, then figure out if it a
+ //CommonJS thing with dependencies.
+ if (!deps.length && isFunction(callback)) {
+ //Remove comments from the callback string,
+ //look for require calls, and pull them into the dependencies,
+ //but only if there are function args.
+ if (callback.length) {
+ callback
+ .toString()
+ .replace(commentRegExp, '')
+ .replace(cjsRequireRegExp, function (match, dep) {
+ deps.push(dep);
+ });
+
+ //May be a CommonJS thing even without require calls, but still
+ //could use exports, and module. Avoid doing exports and module
+ //work though if it just needs require.
+ //REQUIRES the function to expect the CommonJS variables in the
+ //order listed below.
+ deps = (callback.length === 1 ? ['require'] : ['require', 'exports', 'module']).concat(deps);
+ }
+ }
+
+ //If in IE 6-8 and hit an anonymous define() call, do the interactive
+ //work.
+ if (useInteractive) {
+ node = currentlyAddingScript || getInteractiveScript();
+ if (node) {
+ if (!name) {
+ name = node.getAttribute('data-requiremodule');
+ }
+ context = contexts[node.getAttribute('data-requirecontext')];
+ }
+ }
+
+ //Always save off evaluating the def call until the script onload handler.
+ //This allows multiple modules to be in a file without prematurely
+ //tracing dependencies, and allows for anonymous module support,
+ //where the module name is not known until the script onload event
+ //occurs. If no context, use the global queue, and get it processed
+ //in the onscript load callback.
+ (context ? context.defQueue : globalDefQueue).push([name, deps, callback]);
+ };
+
+ define.amd = {
+ jQuery: true
+ };
+
+
+ /**
+ * Executes the text. Normally just uses eval, but can be modified
+ * to use a better, environment-specific call. Only used for transpiling
+ * loader plugins, not for plain JS modules.
+ * @param {String} text the text to execute/evaluate.
+ */
+ req.exec = function (text) {
+ /*jslint evil: true */
+ return eval(text);
+ };
+
+ //Set up with config info.
+ req(cfg);
+}(this));
diff -r db2be15c12584351ef4f58bff0069ee5a4eed5a9 -r 45ddaa89e9855d21ce2f6a29a0eb90cc61abd7cd static/scripts/viz/circster.js
--- a/static/scripts/viz/circster.js
+++ b/static/scripts/viz/circster.js
@@ -1,14 +1,11 @@
-(function(){
+define( ["libs/d3", "viz/visualization"], function( d3, visualization ) {
// General backbone style inheritence
var Base = function() { this.initialize && this.initialize.apply(this, arguments) }; Base.extend = Backbone.Model.extend;
-// ---- Circster views ----
-
/**
- * -- Views --
- */
-
+ * Renders a full circster visualization
+ */
var CircsterView = Backbone.View.extend({
className: 'circster',
@@ -50,30 +47,29 @@
this.model.get('tracks').each(function(track, index) {
var dataset = track.get('genome_wide_data'),
radius_start = init_radius_start + index * (dataset_arc_height + self.track_gap),
- track_view_class = (dataset instanceof GenomeWideBigWigData ? CircsterBigWigTrackView : CircsterSummaryTreeTrackView );
+ track_renderer_class = (dataset instanceof visualization.GenomeWideBigWigData ? CircsterBigWigTrackRenderer : CircsterSummaryTreeTrackRenderer );
- track_view = new track_view_class({
+ track_renderer = new track_renderer_class({
track: track,
radius_start: radius_start,
radius_end: radius_start + dataset_arc_height,
genome: self.genome,
- total_gap: self.total_gap,
- svg: svg
+ total_gap: self.total_gap
});
- track_view.render();
+ track_renderer.render( svg );
});
}
});
-var CircsterTrackView = Base.extend( {
+var CircsterTrackRenderer = Base.extend( {
initialize: function( options ) {
this.options = options;
},
- render: function() {
+ render: function( svg ) {
genome_arcs = this.chroms_layout(),
chroms_arcs = this.genome_data_layout();
@@ -81,8 +77,7 @@
// -- Render. --
// Draw background arcs for each chromosome.
- var svg = this.options.svg,
- radius_start = this.options.radius_start,
+ var radius_start = this.options.radius_start,
radius_end = this.options.radius_end,
base_arc = svg.append("g").attr("id", "inner-arc"),
arc_gen = d3.svg.arc()
@@ -165,7 +160,7 @@
/**
* Layout for summary tree data in a circster visualization.
*/
-var CircsterSummaryTrackView = CircsterTrackView.extend({
+var CircsterSummaryTrackRenderer = CircsterTrackRenderer.extend({
/**
* Returns layouts for drawing a chromosome's data.
@@ -200,7 +195,7 @@
/**
* Layout for BigWig data in a circster visualization.
*/
-var CircsterBigWigTrackView = CircsterTrackView.extend({
+var CircsterBigWigTrackRenderer = CircsterTrackRenderer.extend({
/**
* Returns layouts for drawing a chromosome's data.
@@ -233,12 +228,8 @@
});
-// ---- Browser or CommonJS compatible exports ----
-
-if (typeof exports === 'undefined') {
- var exports = this;
+return {
+ CircsterView: CircsterView
}
-exports.CircsterView = CircsterView;
-
-}).call(this);
+});
diff -r db2be15c12584351ef4f58bff0069ee5a4eed5a9 -r 45ddaa89e9855d21ce2f6a29a0eb90cc61abd7cd static/scripts/viz/visualization.js
--- a/static/scripts/viz/visualization.js
+++ b/static/scripts/viz/visualization.js
@@ -1,3 +1,5 @@
+(function(){
+
/**
* Model, view, and controller objects for Galaxy visualization framework.
*
@@ -551,7 +553,7 @@
{
type: Backbone.HasOne,
key: 'region',
- relatedModel: 'GenomeRegion'
+ relatedModel: GenomeRegion
}
]
});
@@ -645,7 +647,7 @@
{
type: Backbone.HasMany,
key: 'tracks',
- relatedModel: 'BackboneTrack'
+ relatedModel: BackboneTrack
}
],
@@ -772,3 +774,40 @@
}
});
};
+
+// ---- Exports ----
+
+var exports = (function() {
+ if ( typeof module !== 'undefined' && module.exports ) {
+ // CommonJS
+ return module.exports;
+ } else if ( typeof define === 'function' && define.amd ) {
+ // AMD
+ exports = {}
+ define( function() { return exports } );
+ return exports
+ } else {
+ // Browser global
+ return window;
+ }
+})();
+
+exports.BrowserBookmark = BrowserBookmark
+exports.BrowserBookmarkCollection = BrowserBookmarkCollection
+exports.Cache = Cache
+exports.CanvasManager = CanvasManager
+exports.Genome = Genome
+exports.GenomeDataManager = GenomeDataManager
+exports.GenomeRegion = GenomeRegion
+exports.GenomeRegionCollection = GenomeRegionCollection
+exports.GenomeVisualization = GenomeVisualization
+exports.GenomeWideBigWigData = GenomeWideBigWigData
+exports.GenomeWideSummaryTreeData = GenomeWideSummaryTreeData
+exports.ReferenceTrackDataManager = ReferenceTrackDataManager
+exports.ServerStateDeferred = ServerStateDeferred
+exports.TrackBrowserRouter = TrackBrowserRouter
+exports.TrackConfig = TrackConfig
+exports.Visualization = Visualization
+exports.add_datasets = add_datasets
+
+}).call(this);
\ No newline at end of file
diff -r db2be15c12584351ef4f58bff0069ee5a4eed5a9 -r 45ddaa89e9855d21ce2f6a29a0eb90cc61abd7cd templates/visualization/circster.mako
--- a/templates/visualization/circster.mako
+++ b/templates/visualization/circster.mako
@@ -16,71 +16,83 @@
<%def name="javascripts()">
${parent.javascripts()}
- ${h.js( "libs/d3", "mvc/data", "viz/visualization", "viz/circster" )}
+ ${h.js( "require", "mvc/data" )}
<script type="text/javascript">
- $(function() {
- // -- Visualization menu and set up.
- var menu = create_icon_buttons_menu([
- { icon_class: 'plus-button', title: 'Add tracks', on_click: function() { add_tracks(); } },
- { icon_class: 'disk--arrow', title: 'Save', on_click: function() {
- // Show saving dialog box
- show_modal("Saving...", "progress");
- $.ajax({
- url: "${h.url_for( action='save' )}",
- type: "POST",
- data: {
- 'id': view.vis_id,
- 'title': view.name,
- 'dbkey': view.dbkey,
- 'type': 'trackster',
- 'config': JSON.stringify(payload)
- },
- dataType: "json",
- success: function(vis_info) {
- hide_modal();
- view.vis_id = vis_info.vis_id;
- view.has_changes = false;
+ require.config({
+ baseUrl: "${h.url_for('/static/scripts')}",
+ shim: {
+ "libs/d3": { exports: "d3" }
+ }
+ });
- // Needed to set URL when first saving a visualization.
- window.history.pushState({}, "", vis_info.url + window.location.hash);
- },
- error: function() {
- show_modal( "Could Not Save", "Could not save visualization. Please try again later.",
- { "Close" : hide_modal } );
- }
+ require( [ "libs/d3", "viz/visualization", "viz/circster" ], function( d3, visualization, circster ) {
+
+ $(function() {
+
+ // -- Visualization menu and set up.
+ var menu = create_icon_buttons_menu([
+ { icon_class: 'plus-button', title: 'Add tracks', on_click: function() { add_tracks(); } },
+ { icon_class: 'disk--arrow', title: 'Save', on_click: function() {
+ // Show saving dialog box
+ show_modal("Saving...", "progress");
+
+ $.ajax({
+ url: "${h.url_for( action='save' )}",
+ type: "POST",
+ data: {
+ 'id': view.vis_id,
+ 'title': view.name,
+ 'dbkey': view.dbkey,
+ 'type': 'trackster',
+ 'config': JSON.stringify(payload)
+ },
+ dataType: "json",
+ success: function(vis_info) {
+ hide_modal();
+ view.vis_id = vis_info.vis_id;
+ view.has_changes = false;
+
+ // Needed to set URL when first saving a visualization.
+ window.history.pushState({}, "", vis_info.url + window.location.hash);
+ },
+ error: function() {
+ show_modal( "Could Not Save", "Could not save visualization. Please try again later.",
+ { "Close" : hide_modal } );
+ }
+ });
+ } },
+ { icon_class: 'cross-circle', title: 'Close', on_click: function() {
+ window.location = "${h.url_for( controller='visualization', action='list' )}";
+ } }
+ ], {
+ tooltip_config: { placement: 'bottom' }
+ });
+
+ menu.$el.attr("style", "float: right");
+ $("#center .unified-panel-header-inner").append(menu.$el);
+ // Manual tooltip config because default gravity is S and cannot be changed.
+ $(".menu-button").tooltip( { placement: 'bottom' } );
+
+ // -- Viz set up. --
+
+ var genome = new visualization.Genome(JSON.parse('${ h.to_json_string( genome ) }'))
+ vis = new visualization.GenomeVisualization(JSON.parse('${ h.to_json_string( viz_config ) }')),
+ viz_view = new circster.CircsterView({
+ el: $('#vis'),
+ // Gap is difficult to set because it very dependent on chromosome size and organization.
+ total_gap: 2 * Math.PI * 0.1,
+ genome: genome,
+ model: vis,
+ dataset_arc_height: 25
});
- } },
- { icon_class: 'cross-circle', title: 'Close', on_click: function() {
- window.location = "${h.url_for( controller='visualization', action='list' )}";
- } }
- ], {
- tooltip_config: { placement: 'bottom' }
+
+ // -- Render viz. --
+
+ viz_view.render();
+
});
-
- menu.$el.attr("style", "float: right");
- $("#center .unified-panel-header-inner").append(menu.$el);
- // Manual tooltip config because default gravity is S and cannot be changed.
- $(".menu-button").tooltip( { placement: 'bottom' } );
-
- // -- Viz set up. --
-
- var genome = new Genome(JSON.parse('${ h.to_json_string( genome ) }'))
- visualization = new GenomeVisualization(JSON.parse('${ h.to_json_string( viz_config ) }')),
- viz_view = new CircsterView({
- el: $('#vis'),
- // Gap is difficult to set because it very dependent on chromosome size and organization.
- total_gap: 2 * Math.PI * 0.1,
- genome: genome,
- model: visualization,
- dataset_arc_height: 25
- });
-
- // -- Render viz. --
-
- viz_view.render();
-
});
</script></%def>
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
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/changeset/72f1dcdf1c54/
changeset: 72f1dcdf1c54
user: dannon
date: 2012-09-12 19:05:15
summary: Pack scripts.
affected #: 4 files
diff -r 8b301f6af8340f8cd01022035d5765cf0aba3ede -r 72f1dcdf1c542e6d4689305f5de2077c0bfb4035 static/scripts/packed/galaxy.base.js
--- a/static/scripts/packed/galaxy.base.js
+++ b/static/scripts/packed/galaxy.base.js
@@ -1,1 +1,1 @@
-if(!Array.indexOf){Array.prototype.indexOf=function(c){for(var b=0,a=this.length;b<a;b++){if(this[b]==c){return b}}return -1}}function obj_length(c){if(c.length!==undefined){return c.length}var b=0;for(var a in c){b++}return b}$.fn.makeAbsolute=function(a){return this.each(function(){var b=$(this);var c=b.position();b.css({position:"absolute",marginLeft:0,marginTop:0,top:c.top,left:c.left,right:$(window).width()-(c.left+b.width())});if(a){b.remove().appendTo("body")}})};function make_popupmenu(b,c){var a=(b.data("menu_options"));b.data("menu_options",c);if(a){return}b.bind("click.show_popup",function(d){$(".popmenu-wrapper").remove();setTimeout(function(){var g=$("<ul class='dropdown-menu' id='"+b.attr("id")+"-menu'></ul>");var f=b.data("menu_options");if(obj_length(f)<=0){$("<li>No Options.</li>").appendTo(g)}$.each(f,function(j,i){if(i){g.append($("<li></li>").append($("<a href='#'></a>").html(j).click(i)))}else{g.append($("<li></li>").addClass("head").append($("<a href='#'></a>").html(j)))}});var h=$("<div class='popmenu-wrapper' style='position: absolute;left: 0; top: -1000;'></div>").append(g).appendTo("body");var e=d.pageX-h.width()/2;e=Math.min(e,$(document).scrollLeft()+$(window).width()-$(h).width()-5);e=Math.max(e,$(document).scrollLeft()+5);h.css({top:d.pageY,left:e})},10);setTimeout(function(){var f=function(h){$(h).bind("click.close_popup",function(){$(".popmenu-wrapper").remove();h.unbind("click.close_popup")})};f($(window.document));f($(window.top.document));for(var e=window.top.frames.length;e--;){var g=$(window.top.frames[e].document);f(g)}},50);return false})}function make_popup_menus(){jQuery("div[popupmenu]").each(function(){var a={};var c=$(this);c.find("a").each(function(){var f=$(this),h=f.get(0);var d=h.getAttribute("confirm"),e=h.getAttribute("href"),g=h.getAttribute("target");if(!e){a[f.text()]=null}else{a[f.text()]=function(){if(!d||confirm(d)){var i;if(g=="_parent"){window.parent.location=e}else{if(g=="_top"){window.top.location=e}else{if(g=="demo"){if(i===undefined||i.closed){i=window.open(e,g);i.creator=self}}else{window.location=e}}}}}}});var b=$("#"+c.attr("popupmenu"));b.find("a").bind("click",function(d){d.stopPropagation();return true});make_popupmenu(b,a);b.addClass("popup");c.remove()})}function naturalSort(j,h){var p=/(-?[0-9\.]+)/g,k=j.toString().toLowerCase()||"",g=h.toString().toLowerCase()||"",l=String.fromCharCode(0),n=k.replace(p,l+"$1"+l).split(l),e=g.replace(p,l+"$1"+l).split(l),d=(new Date(k)).getTime(),o=d?(new Date(g)).getTime():null;if(o){if(d<o){return -1}else{if(d>o){return 1}}}var m,f;for(var i=0,c=Math.max(n.length,e.length);i<c;i++){m=parseFloat(n[i])||n[i];f=parseFloat(e[i])||e[i];if(m<f){return -1}else{if(m>f){return 1}}}return 0}function replace_big_select_inputs(a,b){if(!jQuery().autocomplete){return}if(a===undefined){a=20}if(b===undefined){b=3000}$("select").each(function(){var d=$(this);var g=d.find("option").length;if((g<a)||(g>b)){return}if(d.attr("multiple")==="multiple"){return}if(d.hasClass("no-autocomplete")){return}var m=d.attr("value");var c=$("<input type='text' class='text-and-autocomplete-select'></input>");c.attr("size",40);c.attr("name",d.attr("name"));c.attr("id",d.attr("id"));c.click(function(){var n=$(this).val();$(this).val("Loading...");$(this).showAllInCache();$(this).val(n);$(this).select()});var e=[];var i={};d.children("option").each(function(){var o=$(this).text();var n=$(this).attr("value");e.push(o);i[o]=n;i[n]=n;if(n==m){c.attr("value",o)}});if(m===""||m==="?"){c.attr("value","Click to Search or Select")}if(d.attr("name")=="dbkey"){e=e.sort(naturalSort)}var f={selectFirst:false,autoFill:false,mustMatch:false,matchContains:true,max:b,minChars:0,hideForLessThanMinChars:false};c.autocomplete(e,f);d.replaceWith(c);var k=function(){var o=c.attr("value");var n=i[o];if(n!==null&&n!==undefined){c.attr("value",n)}else{if(m!==""){c.attr("value",m)}else{c.attr("value","?")}}};c.parents("form").submit(function(){k()});$(document).bind("convert_to_values",function(){k()});if(d.attr("refresh_on_change")=="true"){var h=d.attr("refresh_on_change_values"),l=d.attr("last_selected_value");if(h!==undefined){h=h.split(",")}var j=function(){var n=i[c.attr("value")];if(l!==n&&n!==null&&n!==undefined){if(h!==undefined&&$.inArray(n,h)===-1&&$.inArray(l,h)===-1){return}c.attr("value",n);$(window).trigger("refresh_on_change");c.parents("form").submit()}};c.bind("result",j);c.keyup(function(n){if(n.keyCode===13){j()}});c.keydown(function(n){if(n.keyCode===13){return false}})}})}$.fn.make_text_editable=function(g){var d=("num_cols" in g?g.num_cols:30),c=("num_rows" in g?g.num_rows:4),e=("use_textarea" in g?g.use_textarea:false),b=("on_finish" in g?g.on_finish:null),f=("help_text" in g?g.help_text:null);var a=$(this);a.addClass("editable-text").click(function(l){if($(this).children(":input").length>0){return}a.removeClass("editable-text");var i=function(m){a.find(":input").remove();if(m!==""){a.text(m)}else{a.html("<br>")}a.addClass("editable-text");if(b){b(m)}};var h=a.text(),k,j;if(e){k=$("<textarea/>").attr({rows:c,cols:d}).text($.trim(h)).keyup(function(m){if(m.keyCode===27){i(h)}});j=$("<button/>").text("Done").click(function(){i(k.val());return false})}else{k=$("<input type='text'/>").attr({value:$.trim(h),size:d}).blur(function(){i(h)}).keyup(function(m){if(m.keyCode===27){$(this).trigger("blur")}else{if(m.keyCode===13){i($(this).val())}}})}a.text("");a.append(k);if(j){a.append(j)}k.focus();k.select();l.stopPropagation()});if(f){a.attr("title",f).tooltip()}return a};function async_save_text(d,f,e,a,c,h,i,g,b){if(c===undefined){c=30}if(i===undefined){i=4}$("#"+d).live("click",function(){if($("#renaming-active").length>0){return}var l=$("#"+f),k=l.text(),j;if(h){j=$("<textarea></textarea>").attr({rows:i,cols:c}).text($.trim(k))}else{j=$("<input type='text'></input>").attr({value:$.trim(k),size:c})}j.attr("id","renaming-active");j.blur(function(){$(this).remove();l.show();if(b){b(j)}});j.keyup(function(n){if(n.keyCode===27){$(this).trigger("blur")}else{if(n.keyCode===13){var m={};m[a]=$(this).val();$(this).trigger("blur");$.ajax({url:e,data:m,error:function(){alert("Text editing for elt "+f+" failed")},success:function(o){if(o!==""){l.text(o)}else{l.html("<em>None</em>")}if(b){b(j)}}})}}});if(g){g(j)}l.hide();j.insertAfter(l);j.focus();j.select();return})}function init_history_items(d,a,c){var b=function(){try{var e=$.jStorage.get("history_expand_state");if(e){for(var g in e){$("#"+g+" div.historyItemBody").show()}}}catch(f){$.jStorage.deleteKey("history_expand_state")}if($.browser.mozilla){$("div.historyItemBody").each(function(){if(!$(this).is(":visible")){$(this).find("pre.peek").css("overflow","hidden")}})}d.each(function(){var j=this.id,h=$(this).children("div.historyItemBody"),i=h.find("pre.peek");$(this).find(".historyItemTitleBar > .historyItemTitle").wrap("<a href='javascript:void(0);'></a>").click(function(){var k;if(h.is(":visible")){if($.browser.mozilla){i.css("overflow","hidden")}h.slideUp("fast");if(!c){k=$.jStorage.get("history_expand_state");if(k){delete k[j];$.jStorage.set("history_expand_state",k)}}}else{h.slideDown("fast",function(){if($.browser.mozilla){i.css("overflow","auto")}});if(!c){k=$.jStorage.get("history_expand_state");if(!k){k={}}k[j]=true;$.jStorage.set("history_expand_state",k)}}return false})});$("#top-links > a.toggle").click(function(){var h=$.jStorage.get("history_expand_state");if(!h){h={}}$("div.historyItemBody:visible").each(function(){if($.browser.mozilla){$(this).find("pre.peek").css("overflow","hidden")}$(this).slideUp("fast");if(h){delete h[$(this).parent().attr("id")]}});$.jStorage.set("history_expand_state",h)}).show()};b()}function commatize(b){b+="";var a=/(\d+)(\d{3})/;while(a.test(b)){b=b.replace(a,"$1,$2")}return b}function reset_tool_search(a){var c=$("#galaxy_tools").contents();if(c.length===0){c=$(document)}$(this).removeClass("search_active");c.find(".toolTitle").removeClass("search_match");c.find(".toolSectionBody").hide();c.find(".toolTitle").show();c.find(".toolPanelLabel").show();c.find(".toolSectionWrapper").each(function(){if($(this).attr("id")!="recently_used_wrapper"){$(this).show()}else{if($(this).hasClass("user_pref_visible")){$(this).show()}}});c.find("#search-no-results").hide();c.find("#search-spinner").hide();if(a){var b=c.find("#tool-search-query");b.val("search tools")}}var GalaxyAsync=function(a){this.url_dict={};this.log_action=(a===undefined?false:a)};GalaxyAsync.prototype.set_func_url=function(a,b){this.url_dict[a]=b};GalaxyAsync.prototype.set_user_pref=function(a,b){var c=this.url_dict[arguments.callee];if(c===undefined){return false}$.ajax({url:c,data:{pref_name:a,pref_value:b},error:function(){return false},success:function(){return true}})};GalaxyAsync.prototype.log_user_action=function(c,b,d){if(!this.log_action){return}var a=this.url_dict[arguments.callee];if(a===undefined){return false}$.ajax({url:a,data:{action:c,context:b,params:d},error:function(){return false},success:function(){return true}})};$(document).ready(function(){$("select[refresh_on_change='true']").change(function(){var a=$(this),e=a.val(),d=false,c=a.attr("refresh_on_change_values");if(c){c=c.split(",");var b=a.attr("last_selected_value");if($.inArray(e,c)===-1&&$.inArray(b,c)===-1){return}}$(window).trigger("refresh_on_change");$(document).trigger("convert_to_values");a.get(0).form.submit()});$(":checkbox[refresh_on_change='true']").click(function(){var a=$(this),e=a.val(),d=false,c=a.attr("refresh_on_change_values");if(c){c=c.split(",");var b=a.attr("last_selected_value");if($.inArray(e,c)===-1&&$.inArray(b,c)===-1){return}}$(window).trigger("refresh_on_change");a.get(0).form.submit()});$("a[confirm]").click(function(){return confirm($(this).attr("confirm"))});if($.fn.tooltip){$(".tooltip").tooltip({placement:"top"})}make_popup_menus();replace_big_select_inputs(20,1500);$("a").click(function(){var b=$(this);var c=(parent.frames&&parent.frames.galaxy_main);if((b.attr("target")=="galaxy_main")&&(!c)){var a=b.attr("href");if(a.indexOf("?")==-1){a+="?"}else{a+="&"}a+="use_panels=True";b.attr("href",a);b.attr("target","_self")}return b})});
\ No newline at end of file
+if(!Array.indexOf){Array.prototype.indexOf=function(c){for(var b=0,a=this.length;b<a;b++){if(this[b]==c){return b}}return -1}}function obj_length(c){if(c.length!==undefined){return c.length}var b=0;for(var a in c){b++}return b}$.fn.makeAbsolute=function(a){return this.each(function(){var b=$(this);var c=b.position();b.css({position:"absolute",marginLeft:0,marginTop:0,top:c.top,left:c.left,right:$(window).width()-(c.left+b.width())});if(a){b.remove().appendTo("body")}})};function make_popupmenu(b,c){var a=(b.data("menu_options"));b.data("menu_options",c);if(a){return}b.bind("click.show_popup",function(d){$(".popmenu-wrapper").remove();setTimeout(function(){var g=$("<ul class='dropdown-menu' id='"+b.attr("id")+"-menu'></ul>");var f=b.data("menu_options");if(obj_length(f)<=0){$("<li>No Options.</li>").appendTo(g)}$.each(f,function(j,i){if(i){g.append($("<li></li>").append($("<a href='#'></a>").html(j).click(i)))}else{g.append($("<li></li>").addClass("head").append($("<a href='#'></a>").html(j)))}});var h=$("<div class='popmenu-wrapper' style='position: absolute;left: 0; top: -1000;'></div>").append(g).appendTo("body");var e=d.pageX-h.width()/2;e=Math.min(e,$(document).scrollLeft()+$(window).width()-$(h).width()-5);e=Math.max(e,$(document).scrollLeft()+5);h.css({top:d.pageY,left:e})},10);setTimeout(function(){var f=function(h){$(h).bind("click.close_popup",function(){$(".popmenu-wrapper").remove();h.unbind("click.close_popup")})};f($(window.document));f($(window.top.document));for(var e=window.top.frames.length;e--;){var g=$(window.top.frames[e].document);f(g)}},50);return false})}function make_popup_menus(){jQuery("div[popupmenu]").each(function(){var a={};var c=$(this);c.find("a").each(function(){var f=$(this),h=f.get(0);var d=h.getAttribute("confirm"),e=h.getAttribute("href"),g=h.getAttribute("target");if(!e){a[f.text()]=null}else{a[f.text()]=function(){if(!d||confirm(d)){var i;if(g=="_parent"){window.parent.location=e}else{if(g=="_top"){window.top.location=e}else{if(g=="demo"){if(i===undefined||i.closed){i=window.open(e,g);i.creator=self}}else{window.location=e}}}}}}});var b=$("#"+c.attr("popupmenu"));b.find("a").bind("click",function(d){d.stopPropagation();return true});make_popupmenu(b,a);b.addClass("popup");c.remove()})}function naturalSort(j,h){var p=/(-?[0-9\.]+)/g,k=j.toString().toLowerCase()||"",g=h.toString().toLowerCase()||"",l=String.fromCharCode(0),n=k.replace(p,l+"$1"+l).split(l),e=g.replace(p,l+"$1"+l).split(l),d=(new Date(k)).getTime(),o=d?(new Date(g)).getTime():null;if(o){if(d<o){return -1}else{if(d>o){return 1}}}var m,f;for(var i=0,c=Math.max(n.length,e.length);i<c;i++){m=parseFloat(n[i])||n[i];f=parseFloat(e[i])||e[i];if(m<f){return -1}else{if(m>f){return 1}}}return 0}function replace_big_select_inputs(a,c,b){if(!jQuery().autocomplete){return}if(a===undefined){a=20}if(c===undefined){c=3000}var b=b||$("select");b.each(function(){var e=$(this);var h=e.find("option").length;if((h<a)||(h>c)){return}if(e.attr("multiple")==="multiple"){return}if(e.hasClass("no-autocomplete")){return}var n=e.attr("value");var d=$("<input type='text' class='text-and-autocomplete-select'></input>");d.attr("size",40);d.attr("name",e.attr("name"));d.attr("id",e.attr("id"));d.click(function(){var o=$(this).val();$(this).val("Loading...");$(this).showAllInCache();$(this).val(o);$(this).select()});var f=[];var j={};e.children("option").each(function(){var p=$(this).text();var o=$(this).attr("value");f.push(p);j[p]=o;j[o]=o;if(o==n){d.attr("value",p)}});if(n===""||n==="?"){d.attr("value","Click to Search or Select")}if(e.attr("name")=="dbkey"){f=f.sort(naturalSort)}var g={selectFirst:false,autoFill:false,mustMatch:false,matchContains:true,max:c,minChars:0,hideForLessThanMinChars:false};d.autocomplete(f,g);e.replaceWith(d);var l=function(){var p=d.attr("value");var o=j[p];if(o!==null&&o!==undefined){d.attr("value",o)}else{if(n!==""){d.attr("value",n)}else{d.attr("value","?")}}};d.parents("form").submit(function(){l()});$(document).bind("convert_to_values",function(){l()});if(e.attr("refresh_on_change")=="true"){var i=e.attr("refresh_on_change_values"),m=e.attr("last_selected_value");if(i!==undefined){i=i.split(",")}var k=function(){var o=j[d.attr("value")];if(m!==o&&o!==null&&o!==undefined){if(i!==undefined&&$.inArray(o,i)===-1&&$.inArray(m,i)===-1){return}d.attr("value",o);$(window).trigger("refresh_on_change");d.parents("form").submit()}};d.bind("result",k);d.keyup(function(o){if(o.keyCode===13){k()}});d.keydown(function(o){if(o.keyCode===13){return false}})}})}$.fn.make_text_editable=function(g){var d=("num_cols" in g?g.num_cols:30),c=("num_rows" in g?g.num_rows:4),e=("use_textarea" in g?g.use_textarea:false),b=("on_finish" in g?g.on_finish:null),f=("help_text" in g?g.help_text:null);var a=$(this);a.addClass("editable-text").click(function(l){if($(this).children(":input").length>0){return}a.removeClass("editable-text");var i=function(m){a.find(":input").remove();if(m!==""){a.text(m)}else{a.html("<br>")}a.addClass("editable-text");if(b){b(m)}};var h=a.text(),k,j;if(e){k=$("<textarea/>").attr({rows:c,cols:d}).text($.trim(h)).keyup(function(m){if(m.keyCode===27){i(h)}});j=$("<button/>").text("Done").click(function(){i(k.val());return false})}else{k=$("<input type='text'/>").attr({value:$.trim(h),size:d}).blur(function(){i(h)}).keyup(function(m){if(m.keyCode===27){$(this).trigger("blur")}else{if(m.keyCode===13){i($(this).val())}}})}a.text("");a.append(k);if(j){a.append(j)}k.focus();k.select();l.stopPropagation()});if(f){a.attr("title",f).tooltip()}return a};function async_save_text(d,f,e,a,c,h,i,g,b){if(c===undefined){c=30}if(i===undefined){i=4}$("#"+d).live("click",function(){if($("#renaming-active").length>0){return}var l=$("#"+f),k=l.text(),j;if(h){j=$("<textarea></textarea>").attr({rows:i,cols:c}).text($.trim(k))}else{j=$("<input type='text'></input>").attr({value:$.trim(k),size:c})}j.attr("id","renaming-active");j.blur(function(){$(this).remove();l.show();if(b){b(j)}});j.keyup(function(n){if(n.keyCode===27){$(this).trigger("blur")}else{if(n.keyCode===13){var m={};m[a]=$(this).val();$(this).trigger("blur");$.ajax({url:e,data:m,error:function(){alert("Text editing for elt "+f+" failed")},success:function(o){if(o!==""){l.text(o)}else{l.html("<em>None</em>")}if(b){b(j)}}})}}});if(g){g(j)}l.hide();j.insertAfter(l);j.focus();j.select();return})}function init_history_items(d,a,c){var b=function(){try{var e=$.jStorage.get("history_expand_state");if(e){for(var g in e){$("#"+g+" div.historyItemBody").show()}}}catch(f){$.jStorage.deleteKey("history_expand_state")}if($.browser.mozilla){$("div.historyItemBody").each(function(){if(!$(this).is(":visible")){$(this).find("pre.peek").css("overflow","hidden")}})}d.each(function(){var j=this.id,h=$(this).children("div.historyItemBody"),i=h.find("pre.peek");$(this).find(".historyItemTitleBar > .historyItemTitle").wrap("<a href='javascript:void(0);'></a>").click(function(){var k;if(h.is(":visible")){if($.browser.mozilla){i.css("overflow","hidden")}h.slideUp("fast");if(!c){k=$.jStorage.get("history_expand_state");if(k){delete k[j];$.jStorage.set("history_expand_state",k)}}}else{h.slideDown("fast",function(){if($.browser.mozilla){i.css("overflow","auto")}});if(!c){k=$.jStorage.get("history_expand_state");if(!k){k={}}k[j]=true;$.jStorage.set("history_expand_state",k)}}return false})});$("#top-links > a.toggle").click(function(){var h=$.jStorage.get("history_expand_state");if(!h){h={}}$("div.historyItemBody:visible").each(function(){if($.browser.mozilla){$(this).find("pre.peek").css("overflow","hidden")}$(this).slideUp("fast");if(h){delete h[$(this).parent().attr("id")]}});$.jStorage.set("history_expand_state",h)}).show()};b()}function commatize(b){b+="";var a=/(\d+)(\d{3})/;while(a.test(b)){b=b.replace(a,"$1,$2")}return b}function reset_tool_search(a){var c=$("#galaxy_tools").contents();if(c.length===0){c=$(document)}$(this).removeClass("search_active");c.find(".toolTitle").removeClass("search_match");c.find(".toolSectionBody").hide();c.find(".toolTitle").show();c.find(".toolPanelLabel").show();c.find(".toolSectionWrapper").each(function(){if($(this).attr("id")!="recently_used_wrapper"){$(this).show()}else{if($(this).hasClass("user_pref_visible")){$(this).show()}}});c.find("#search-no-results").hide();c.find("#search-spinner").hide();if(a){var b=c.find("#tool-search-query");b.val("search tools")}}var GalaxyAsync=function(a){this.url_dict={};this.log_action=(a===undefined?false:a)};GalaxyAsync.prototype.set_func_url=function(a,b){this.url_dict[a]=b};GalaxyAsync.prototype.set_user_pref=function(a,b){var c=this.url_dict[arguments.callee];if(c===undefined){return false}$.ajax({url:c,data:{pref_name:a,pref_value:b},error:function(){return false},success:function(){return true}})};GalaxyAsync.prototype.log_user_action=function(c,b,d){if(!this.log_action){return}var a=this.url_dict[arguments.callee];if(a===undefined){return false}$.ajax({url:a,data:{action:c,context:b,params:d},error:function(){return false},success:function(){return true}})};$(document).ready(function(){$("select[refresh_on_change='true']").change(function(){var a=$(this),e=a.val(),d=false,c=a.attr("refresh_on_change_values");if(c){c=c.split(",");var b=a.attr("last_selected_value");if($.inArray(e,c)===-1&&$.inArray(b,c)===-1){return}}$(window).trigger("refresh_on_change");$(document).trigger("convert_to_values");a.get(0).form.submit()});$(":checkbox[refresh_on_change='true']").click(function(){var a=$(this),e=a.val(),d=false,c=a.attr("refresh_on_change_values");if(c){c=c.split(",");var b=a.attr("last_selected_value");if($.inArray(e,c)===-1&&$.inArray(b,c)===-1){return}}$(window).trigger("refresh_on_change");a.get(0).form.submit()});$("a[confirm]").click(function(){return confirm($(this).attr("confirm"))});if($.fn.tooltip){$(".tooltip").tooltip({placement:"top"})}make_popup_menus();replace_big_select_inputs(20,1500);$("a").click(function(){var b=$(this);var c=(parent.frames&&parent.frames.galaxy_main);if((b.attr("target")=="galaxy_main")&&(!c)){var a=b.attr("href");if(a.indexOf("?")==-1){a+="?"}else{a+="&"}a+="use_panels=True";b.attr("href",a);b.attr("target","_self")}return b})});
\ No newline at end of file
diff -r 8b301f6af8340f8cd01022035d5765cf0aba3ede -r 72f1dcdf1c542e6d4689305f5de2077c0bfb4035 static/scripts/packed/mvc/history.js
--- a/static/scripts/packed/mvc/history.js
+++ b/static/scripts/packed/mvc/history.js
@@ -1,1 +1,1 @@
-_=_;var Loggable={logger:null,log:function(){return(this.logger)?(this.logger.debug.apply(this,arguments)):(undefined)}};var LoggingModel=BaseModel.extend(Loggable);var LoggingView=BaseView.extend(Loggable);var Localizable={localizedStrings:{},setLocalizedString:function(b,a){this.localizedStrings[b]=a},localize:function(a){if(a in this.localizedStrings){return this.localizedStrings[a]}return a}};var LocalizableView=LoggingView.extend(Localizable);function linkHTMLTemplate(b,a){if(!b){return"<a></a>"}a=a||"a";var c=["<"+a];for(key in b){var d=b[key];if(d===""){continue}switch(key){case"text":continue;case"classes":key="class";d=(b.classes.join)?(b.classes.join(" ")):(b.classes);default:c.push([" ",key,'="',d,'"'].join(""))}}c.push(">");if("text" in b){c.push(b.text)}c.push("</"+a+">");return c.join("")}var HistoryItem=LoggingModel.extend({defaults:{id:null,name:"",data_type:null,file_size:0,genome_build:null,metadata_data_lines:0,metadata_dbkey:null,metadata_sequences:0,misc_blurb:"",misc_info:"",model_class:"",state:"",deleted:false,purged:false,visible:true,for_editing:true,bodyIsShown:false},initialize:function(){this.log(this+".initialize",this.attributes);this.log("\tparent history_id: "+this.get("history_id"))},isEditable:function(){return(!(this.get("deleted")||this.get("purged")))},hasData:function(){return(this.get("file_size")>0)},toString:function(){return"HistoryItem("+(this.get("name")||this.get("id")||"")+")"}});HistoryItem.STATES={NEW:"new",UPLOAD:"upload",QUEUED:"queued",RUNNING:"running",OK:"ok",EMPTY:"empty",ERROR:"error",DISCARDED:"discarded",SETTING_METADATA:"setting_metadata",FAILED_METADATA:"failed_metadata"};var HistoryItemView=LoggingView.extend({logger:console,tagName:"div",className:"historyItemContainer",initialize:function(){this.log(this+".initialize:",this,this.model);return this},render:function(){this.log(this+".model:",this.model);var d=this.model.get("id"),c=this.model.get("state");this.$el.attr("id","historyItemContainer-"+d);var a=$("<div/>").attr("id","historyItem-"+d).addClass("historyItemWrapper").addClass("historyItem").addClass("historyItem-"+c);a.append(this._render_purgedWarning());a.append(this._render_deletionWarning());a.append(this._render_visibleWarning());a.append(this._render_titleBar());this.body=$(this._render_body());a.append(this.body);a.find(".tooltip").tooltip({placement:"bottom"});var b=a.find("[popupmenu]");b.each(function(e,f){f=$(f);make_popupmenu(f)});this.$el.children().remove();return this.$el.append(a)},_render_purgedWarning:function(){var a=null;if(this.model.get("purged")){a=$(HistoryItemView.STRINGS.purgedMsg)}return a},_render_deletionWarning:function(){var b=null;if(this.model.get("deleted")){var a="";if(this.model.get("undelete_url")){a+=HistoryItemView.TEMPLATES.undeleteLink(this.model.attributes)}if(this.model.get("purge_url")){a+=HistoryItemView.TEMPLATES.purgeLink(this.model.attributes)}b=$(HistoryItemView.TEMPLATES.warningMsg({warning:a}))}return b},_render_visibleWarning:function(){var b=null;if(!this.model.get("visible")&&this.model.get("unhide_url")){var a=HistoryItemView.TEMPLATES.hiddenMsg(this.model.attributes);b=$(HistoryItemView.TEMPLATES.warningMsg({warning:a}))}return b},_render_titleBar:function(){var a=$('<div class="historyItemTitleBar" style="overflow: hidden"></div>');a.append(this._render_titleButtons());a.append('<span class="state-icon"></span>');a.append(this._render_titleLink());return a},_render_titleButtons:function(){var a=$('<div class="historyItemButtons"></div>'),b=this.model.get("for_editing");if(this.model.get("state")!==HistoryItem.STATES.UPLOAD){a.append(this._render_displayButton());if(b){a.append(this._render_editButton())}}if(b){a.append(this._render_deleteButton())}return a},_render_displayButton:function(){if(this.model.get("purged")){return $('<span class="icon-button display_disabled tooltip" title="Cannot display datasets removed from disk"></span>')}var b=this.model.get("id"),a={title:"Display data in browser",href:"/datasets/"+b+"/display/?preview=True",target:(this.model.get("for_editing"))?("galaxy_main"):(""),classes:["icon-button","tooltip","display"],dataset_id:b};return $(linkHTMLTemplate(a))},_render_editButton:function(){var c=this.model.get("id"),b=this.model.get("purged"),a=this.model.get("deleted");if(a||b){if(!b){return $('<span class="icon-button edit_disabled tooltip" title="Undelete dataset to edit attributes"></span>')}else{return $('<span class="icon-button edit_disabled tooltip" title="Cannot edit attributes of datasets removed from disk"></span>')}}return $(linkHTMLTemplate({title:"Edit attributes",href:"/datasets/"+c+"/edit",target:"galaxy_main",classes:["icon-button","tooltip","edit"]}))},_render_deleteButton:function(){var c=this.model.get("id"),b=this.model.get("purged"),a=this.model.get("deleted");if(b||a){return $('<span title="Dataset is already deleted" class="icon-button delete_disabled tooltip"></span>')}return $(linkHTMLTemplate({title:"Delete",href:"/datasets/"+c+"/delete?show_deleted_on_refresh=False",target:"galaxy_main",id:"historyItemDeleter-"+c,classes:["icon-button","tooltip","delete"]}))},_render_titleLink:function(){var b=this.model.get("name"),a=this.model.get("hid");title=(a+": "+b);return $(linkHTMLTemplate({href:"javascript:void(0);",text:'<span class="historyItemTitle">'+title+"</span>"}))},_render_body_not_viewable:function(a){a.append($("<div>You do not have permission to view dataset.</div>"))},_render_body_uploading:function(a){a.append($("<div>Dataset is uploading</div>"))},_render_body_queued:function(a){a.append($("<div>Job is waiting to run.</div>"));a.append(this._render_showParamsAndRerun())},_render_body_running:function(a){a.append("<div>Job is currently running.</div>");a.append(this._render_showParamsAndRerun())},_render_body_error:function(a){if(!this.model.get("purged")){a.append($("<div>"+this.model.get("misc_blurb")+"</div>"))}a.append(("An error occurred running this job: <i>"+$.trim(this.model.get("misc_info"))+"</i>"));var b=$(this._render_showParamsAndRerun());if(this.model.get("for_editing")){b.prepend($(linkHTMLTemplate({title:"View or report this error",href:this.model.get("report_errors_url"),target:"galaxy_main",classes:["icon-button","tooltip","bug"]})))}if(this.model.hasData()){b.prepend(this._render_downloadLinks())}a.append(b)},_render_body_discarded:function(a){a.append("<div>The job creating this dataset was cancelled before completion.</div>");a.append(this._render_showParamsAndRerun())},_render_body_setting_metadata:function(a){a.append($("<div>Metadata is being auto-detected.</div>"))},_render_body_empty:function(a){a.append($("<div>No data: <i>"+this.model.get("misc_blurb")+"</i></div>"));a.append(this._render_showParamsAndRerun())},_render_body_failed_metadata:function(b){var c="An error occurred setting the metadata for this dataset.";if(this.model.isEditable()){var a=linkHTMLTemplate({text:"set it manually or retry auto-detection",href:this.model.get("edit_url"),target:"galaxy_main"});c+="You may be able to "+a+"."}b.append($(HistoryItemView.TEMPLATES.warningMsg({warning:c})));this._render_body_ok(b)},_render_body_ok:function(i){i.append(this._render_hdaSummary());if(this.model.get("misc_info")){i.append($('<div class="info">Info: '+this.model.get("misc_info")+"</div>"))}if(this.model.hasData()){var d=$("<div/>");d.append(this._render_downloadLinks());d.append($(linkHTMLTemplate({title:"View details",href:this.model.get("show_params_url"),target:"galaxy_main",classes:["icon-button","tooltip","information"]})));if(this.model.get("for_editing")){d.append($(linkHTMLTemplate({title:"Run this job again",href:this.model.get("rerun_url"),target:"galaxy_main",classes:["icon-button","tooltip","arrow-circle"]})));if(this.model.get("trackster_urls")){var a=this.model.get("trackster_urls");d.append($(linkHTMLTemplate({title:"View in Trackster",href:"javascript:void(0)",classes:["icon-button","tooltip","chart_curve","trackster-add"],"data-url":a["data-url"],"action-url":a["action-url"],"new-url":a["new-url"]})))}if(this.model.get("retag_url")&&this.model.get("annotate_url")){var e=$('<div style="float: right;"></div>');e.append($(linkHTMLTemplate({title:"Edit dataset tags",target:"galaxy_main",href:this.model.get("retag_url"),classes:["icon-button","tooltip","tags"]})));e.append($(linkHTMLTemplate({title:"Edit dataset annotation",target:"galaxy_main",href:this.model.get("annotation_url"),classes:["icon-button","tooltip","annotate"]})));d.append(e);d.append('<div style="clear: both"></div>');var c=$('<div class="tag-area" style="display: none">');c.append("<strong>Tags:</strong>");c.append('<div class="tag-elt"></div>');d.append(c);var f=$(('<div id="${dataset_id}-annotation-area" class="annotation-area" style="display: none">'));f.append("<strong>Annotation:</strong>");f.append(('<div id="${dataset_id}-annotation-elt" style="margin: 1px 0px 1px 0px" class="annotation-elt tooltip editable-text" title="Edit dataset annotation"></div>'));d.append(f)}}d.append('<div style="clear: both;"></div>');i.append(d);var j=$("<div/>");if(this.model.get("display_apps")){var k=this.model.get("display_apps"),b=$("<span/>");for(app_name in k){var h=k[app_name],g=app_name+" ";for(location_name in h){g+=linkHTMLTemplate({text:location_name,href:h[location_name].url,target:h[location_name].target})+" "}b.append(g)}j.append(b)}i.append(j)}else{if(this.model.get("for_editing")){i.append(this._render_showParamsAndRerun())}}i.append(this._render_peek())},_render_body:function(){this.log(this+"_render_body");var b=this.model.get("state"),c=this.model.get("for_editing");this.log("state:",b,"for_editing",c);var a=$("<div/>").attr("id","info-"+this.model.get("id")).addClass("historyItemBody").attr("style","display: block");switch(b){case HistoryItem.STATES.NOT_VIEWABLE:this._render_body_not_viewable(a);break;case HistoryItem.STATES.UPLOAD:this._render_body_uploading(a);break;case HistoryItem.STATES.QUEUED:this._render_body_queued(a);break;case HistoryItem.STATES.RUNNING:this._render_body_running(a);break;case HistoryItem.STATES.ERROR:this._render_body_error(a);break;case HistoryItem.STATES.DISCARDED:this._render_body_discarded(a);break;case HistoryItem.STATES.SETTING_METADATA:this._render_body_setting_metadata(a);break;case HistoryItem.STATES.EMPTY:this._render_body_empty(a);break;case HistoryItem.STATES.FAILED_METADATA:this._render_body_failed_metadata(a);break;case HistoryItem.STATES.OK:this._render_body_ok(a);break;default:a.append($('<div>Error: unknown dataset state "'+b+'".</div>'))}a.append('<div style="clear: both"></div>');if(this.model.get("bodyIsShown")===false){a.hide()}return a},_render_hdaSummary:function(){var a=_.template('<span class="<%= dbkey %>"><%= dbkey %></span>',{dbkey:this.model.get("metadata_dbkey")});if(this.model.get("metadata_dbkey")==="?"&&this.model.isEditable()){a=linkHTMLTemplate({text:this.model.get("metadata_dbkey"),href:this.model.get("edit_url"),target:"galaxy_main"})}return(HistoryItemView.TEMPLATES.hdaSummary(_.extend({dbkeyHTML:a},this.model.attributes)))},_render_showParamsAndRerun:function(){var a=$("<div/>");a.append($(linkHTMLTemplate({title:"View details",href:this.model.get("show_params_url"),target:"galaxy_main",classes:["icon-button","tooltip","information"]})));if(this.model.get("for_editing")){a.append($(linkHTMLTemplate({title:"Run this job again",href:this.model.get("rerun_url"),target:"galaxy_main",classes:["icon-button","tooltip","arrow-circle"]})))}return a},_render_downloadLinks:function(){if(this.model.get("purged")){return null}var a=linkHTMLTemplate({title:"Download",href:this.model.get("download_url"),classes:["icon-button","tooltip","disk"]});var d=this.model.get("download_meta_urls");if(!d){return a}var c=$('<div popupmenu="dataset-'+this.model.get("id")+'-popup"></div>');c.append(linkHTMLTemplate({text:"Download Dataset",title:"Download",href:this.model.get("download_url"),classes:["icon-button","tooltip","disk"]}));c.append("<a>Additional Files</a>");for(file_type in d){c.append(linkHTMLTemplate({text:"Download "+file_type,href:d[file_type],classes:["action-button"]}))}var b=$(('<div style="float:left;" class="menubutton split popup" id="dataset-${dataset_id}-popup"></div>'));b.append(a);c.append(b);return c},_render_peek:function(){if(!this.model.get("peek")){return null}return $("<div/>").append($("<pre/>").attr("id","peek"+this.model.get("id")).addClass("peek").append(this.model.get("peek")))},events:{"click .historyItemTitle":"toggleBodyVisibility"},toggleBodyVisibility:function(){this.log(this+".toggleBodyVisibility");this.$el.find(".historyItemBody").toggle()},toString:function(){var a=(this.model)?(this.model+""):("");return"HistoryItemView("+a+")"}});HistoryItemView.TEMPLATES={};HistoryItemView.TEMPLATES.warningMsg=_.template("<div class=warningmessagesmall><strong><%= warning %></strong></div>");HistoryItemView.TEMPLATES.undeleteLink=_.template('This dataset has been deleted. Click <a href="<%= undelete_url %>" class="historyItemUndelete" id="historyItemUndeleter-{{ id }}" target="galaxy_history">here</a> to undelete it.');HistoryItemView.TEMPLATES.purgeLink=_.template(' or <a href="<%= purge_url %>" class="historyItemPurge" id="historyItemPurger-{{ id }}" target="galaxy_history">here</a> to immediately remove it from disk.');HistoryItemView.TEMPLATES.hiddenMsg=_.template('This dataset has been hidden. Click <a href="<%= unhide_url %>" class="historyItemUnhide" id="historyItemUnhider-{{ id }}" target="galaxy_history">here</a> to unhide it.');HistoryItemView.TEMPLATES.hdaSummary=_.template(["<%= misc_blurb %><br />",'format: <span class="<%= data_type %>"><%= data_type %></span>, ',"database: <%= dbkeyHTML %>"].join(""));HistoryItemView.STRINGS={};HistoryItemView.STRINGS.purgedMsg=HistoryItemView.TEMPLATES.warningMsg({warning:"This dataset has been deleted and removed from disk."});var HistoryCollection=Backbone.Collection.extend({model:HistoryItem,toString:function(){return("HistoryCollection()")}});var History=LoggingModel.extend({logger:console,defaults:{id:"",name:"",state:"",state_details:{discarded:0,empty:0,error:0,failed_metadata:0,ok:0,queued:0,running:0,setting_metadata:0,upload:0}},initialize:function(b,a){this.log(this+".initialize",b,a);this.items=new HistoryCollection()},loadDatasetsAsHistoryItems:function(c){var a=this,b=this.get("id"),d=this.get("state_details");_.each(c,function(f,e){a.log("loading dataset: ",f,e);var h=new HistoryItem(_.extend(f,{history_id:b}));a.log("as History:",h);a.items.add(h);var g=f.state;d[g]+=1});this.set("state_details",d);this._stateFromStateDetails();return this},_stateFromStateDetails:function(){this.set("state","");var a=this.get("state_details");if((a.error>0)||(a.failed_metadata>0)){this.set("state",HistoryItem.STATES.ERROR)}else{if((a.running>0)||(a.setting_metadata>0)){this.set("state",HistoryItem.STATES.RUNNING)}else{if(a.queued>0){this.set("state",HistoryItem.STATES.QUEUED)}else{if(a.ok===this.items.length){this.set("state",HistoryItem.STATES.OK)}else{throw ("_stateFromStateDetails: unable to determine history state from state details: "+this.state_details)}}}}return this},toString:function(){var a=(this.get("name"))?(","+this.get("name")):("");return"History("+this.get("id")+a+")"}});var HistoryView=LoggingView.extend({logger:console,el:"body.historyPage",initialize:function(){this.log(this+".initialize");this.itemViews=[];var a=this;this.model.items.each(function(c){var b=new HistoryItemView({model:c});a.itemViews.push(b)})},render:function(){this.log(this+".render");var a=$("<div/>");_.each(this.itemViews,function(b){a.prepend(b.render())});this.$el.append(a.children());a.remove()},toString:function(){var a=this.model.get("name")||"";return"HistoryView("+a+")"}});if(window.USE_MOCK_DATA){mockHistory={};mockHistory.data={template:{id:"a799d38679e985db",name:"template",data_type:"fastq",file_size:226297533,genome_build:"?",metadata_data_lines:0,metadata_dbkey:"?",metadata_sequences:0,misc_blurb:"215.8 MB",misc_info:"uploaded fastq file",model_class:"HistoryDatasetAssociation",download_url:"",state:"ok",visible:true,deleted:false,purged:false,hid:0,for_editing:true,undelete_url:"example.com/undelete",purge_url:"example.com/purge",unhide_url:"example.com/unhide",display_url:"example.com/display",edit_url:"example.com/edit",delete_url:"example.com/delete",show_params_url:"example.com/show_params",rerun_url:"example.com/rerun",retag_url:"example.com/retag",annotate_url:"example.com/annotate",peek:['<table cellspacing="0" cellpadding="3"><tr><th>1.QNAME</th><th>2.FLAG</th><th>3.RNAME</th><th>4.POS</th><th>5.MAPQ</th><th>6.CIGAR</th><th>7.MRNM</th><th>8.MPOS</th><th>9.ISIZE</th><th>10.SEQ</th><th>11.QUAL</th><th>12.OPT</th></tr>','<tr><td colspan="100%">@SQ SN:gi|87159884|ref|NC_007793.1| LN:2872769</td></tr>','<tr><td colspan="100%">@PG ID:bwa PN:bwa VN:0.5.9-r16</td></tr>','<tr><td colspan="100%">HWUSI-EAS664L:15:64HOJAAXX:1:1:13280:968 73 gi|87159884|ref|NC_007793.1| 2720169 37 101M = 2720169 0 NAATATGACATTATTTTCAAAACAGCTGAAAATTTAGACGTACCGATTTATCTACATCCCGCGCCAGTTAACAGTGACATTTATCAATCATACTATAAAGG !!!!!!!!!!$!!!$!!!!!$!!!!!!$!$!$$$!!$!!$!!!!!!!!!!!$!</td></tr>','<tr><td colspan="100%">!!!$!$!$$!!$$!!$!!!!!!!!!!!!!!!!!!!!!!!!!!$!!$!! XT:A:U NM:i:1 SM:i:37 AM:i:0 X0:i:1 X1:i:0 XM:i:1 XO:i:0 XG:i:0 MD:Z:0A100</td></tr>','<tr><td colspan="100%">HWUSI-EAS664L:15:64HOJAAXX:1:1:13280:968 133 gi|87159884|ref|NC_007793.1| 2720169 0 * = 2720169 0 NAAACTGTGGCTTCGTTNNNNNNNNNNNNNNNGTGANNNNNNNNNNNNNNNNNNNGNNNNNNNNNNNNNNNNNNNNCNAANNNNNNNNNNNNNNNNNNNNN !!!!!!!!!!!!$!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!</td></tr>','<tr><td colspan="100%">!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!</td></tr>',"</table>"].join("")}};_.extend(mockHistory.data,{deleted:_.extend(_.clone(mockHistory.data.template),{deleted:true}),purgedNotDeleted:_.extend(_.clone(mockHistory.data.template),{purged:true}),notvisible:_.extend(_.clone(mockHistory.data.template),{visible:false}),hasDisplayApps:_.extend(_.clone(mockHistory.data.template),{display_apps:{"display in IGB":{Web:"/display_application/63cd3858d057a6d1/igb_bam/Web",Local:"/display_application/63cd3858d057a6d1/igb_bam/Local"}}}),canTrackster:_.extend(_.clone(mockHistory.data.template),{trackster_urls:{"data-url":"example.com/trackster-data","action-url":"example.com/trackster-action","new-url":"example.com/trackster-new"}}),zeroSize:_.extend(_.clone(mockHistory.data.template),{file_size:0}),hasMetafiles:_.extend(_.clone(mockHistory.data.template),{download_meta_urls:{bam_index:"example.com/bam-index"}}),upload:_.extend(_.clone(mockHistory.data.template),{state:HistoryItem.STATES.UPLOAD}),queued:_.extend(_.clone(mockHistory.data.template),{state:HistoryItem.STATES.QUEUED}),running:_.extend(_.clone(mockHistory.data.template),{state:HistoryItem.STATES.RUNNING}),empty:_.extend(_.clone(mockHistory.data.template),{state:HistoryItem.STATES.EMPTY}),error:_.extend(_.clone(mockHistory.data.template),{state:HistoryItem.STATES.ERROR}),discarded:_.extend(_.clone(mockHistory.data.template),{state:HistoryItem.STATES.DISCARDED}),setting_metadata:_.extend(_.clone(mockHistory.data.template),{state:HistoryItem.STATES.SETTING_METADATA}),failed_metadata:_.extend(_.clone(mockHistory.data.template),{state:HistoryItem.STATES.FAILED_METADATA})});$(document).ready(function(){mockHistory.items={};mockHistory.views={};for(key in mockHistory.data){mockHistory.items[key]=new HistoryItem(mockHistory.data[key]);mockHistory.items[key].set("name",key);mockHistory.views[key]=new HistoryItemView({model:mockHistory.items[key]});$("body").append(mockHistory.views[key].render())}})};
\ No newline at end of file
+function linkHTMLTemplate(b,a){if(!b){return"<a></a>"}a=a||"a";var c=["<"+a];for(key in b){var d=b[key];if(d===""){continue}switch(key){case"text":continue;case"classes":key="class";d=(b.classes.join)?(b.classes.join(" ")):(b.classes);default:c.push([" ",key,'="',d,'"'].join(""))}}c.push(">");if("text" in b){c.push(b.text)}c.push("</"+a+">");return c.join("")}var HistoryItem=BaseModel.extend(LoggableMixin).extend({defaults:{id:null,name:"",data_type:null,file_size:0,genome_build:null,metadata_data_lines:0,metadata_dbkey:null,metadata_sequences:0,misc_blurb:"",misc_info:"",model_class:"",state:"",deleted:false,purged:false,visible:true,for_editing:true,bodyIsShown:false},initialize:function(){this.log(this+".initialize",this.attributes);this.log("\tparent history_id: "+this.get("history_id"))},isEditable:function(){return(!(this.get("deleted")||this.get("purged")))},hasData:function(){return(this.get("file_size")>0)},toString:function(){var a=this.get("id")||"";if(this.get("name")){a+=':"'+this.get("name")+'"'}return"HistoryItem("+a+")"}});HistoryItem.STATES={NEW:"new",UPLOAD:"upload",QUEUED:"queued",RUNNING:"running",OK:"ok",EMPTY:"empty",ERROR:"error",DISCARDED:"discarded",SETTING_METADATA:"setting_metadata",FAILED_METADATA:"failed_metadata"};var HistoryItemView=BaseView.extend(LoggableMixin).extend({tagName:"div",className:"historyItemContainer",initialize:function(){this.log(this+".initialize:",this,this.model)},render:function(){this.log(this+".model:",this.model);var d=this.model.get("id"),c=this.model.get("state");this.$el.attr("id","historyItemContainer-"+d);var a=$("<div/>").attr("id","historyItem-"+d).addClass("historyItemWrapper").addClass("historyItem").addClass("historyItem-"+c);a.append(this._render_warnings());a.append(this._render_titleBar());this.body=$(this._render_body());a.append(this.body);a.find(".tooltip").tooltip({placement:"bottom"});var b=a.find("[popupmenu]");b.each(function(e,f){f=$(f);make_popupmenu(f)});this.$el.children().remove();return this.$el.append(a)},_render_warnings:function(){return $(jQuery.trim(HistoryItemView.templates.messages(this.model.toJSON())))},_render_titleBar:function(){var a=$('<div class="historyItemTitleBar" style="overflow: hidden"></div>');a.append(this._render_titleButtons());a.append('<span class="state-icon"></span>');a.append(this._render_titleLink());return a},_render_titleButtons:function(){var a=$('<div class="historyItemButtons"></div>'),b=this.model.get("for_editing");if(this.model.get("state")!==HistoryItem.STATES.UPLOAD){a.append(this._render_displayButton());if(b){a.append(this._render_editButton())}}if(b){a.append(this._render_deleteButton())}return a},_render_displayButton:function(){displayBtnData=(this.model.get("purged"))?({title:"Cannot display datasets removed from disk",icon_class:"display",enabled:false,}):({title:"Display data in browser",href:this.model.get("display_url"),target:(this.model.get("for_editing"))?("galaxy_main"):(null),icon_class:"display",});this.displayButton=new IconButtonView({model:new IconButton(displayBtnData)});return this.displayButton.render().$el},_render_editButton:function(){var d=this.model.get("id"),c=this.model.get("purged"),a=this.model.get("deleted");var b={title:"Edit attributes",href:this.model.get("edit_url"),target:"galaxy_main",icon_class:"edit"};if(a||c){b={enabled:false,icon_class:"edit"};b.title=(!c)?("Undelete dataset to edit attributes"):("Cannot edit attributes of datasets removed from disk")}this.editButton=new IconButtonView({model:new IconButton(b)});return this.editButton.render().$el},_render_deleteButton:function(){if(!this.model.get("for_editing")){return null}var a=(this.model.get("delete_url"))?({title:"Delete",href:this.model.get("delete_url"),target:"galaxy_main",id:"historyItemDeleter-"+this.model.get("id"),icon_class:"delete"}):({title:"Dataset is already deleted",icon_class:"delete",enabled:false});this.deleteButton=new IconButtonView({model:new IconButton(a)});return this.deleteButton.render().$el},_render_titleLink:function(){var b=this.model.get("name"),a=this.model.get("hid");title=(a+": "+b);return $(linkHTMLTemplate({href:"javascript:void(0);",text:'<span class="historyItemTitle">'+title+"</span>"}))},_render_body_not_viewable:function(a){a.append($("<div>You do not have permission to view dataset.</div>"))},_render_body_uploading:function(a){a.append($("<div>Dataset is uploading</div>"))},_render_body_queued:function(a){a.append($("<div>Job is waiting to run.</div>"));a.append(this._render_showParamsAndRerun())},_render_body_running:function(a){a.append("<div>Job is currently running.</div>");a.append(this._render_showParamsAndRerun())},_render_body_error:function(a){if(!this.model.get("purged")){a.append($("<div>"+this.model.get("misc_blurb")+"</div>"))}a.append(("An error occurred running this job: <i>"+$.trim(this.model.get("misc_info"))+"</i>"));var b=$(this._render_showParamsAndRerun());if(this.model.get("for_editing")){b.prepend($(linkHTMLTemplate({title:"View or report this error",href:this.model.get("report_errors_url"),target:"galaxy_main",classes:["icon-button","tooltip","bug"]})))}if(this.model.hasData()){b.prepend(this._render_downloadLinks())}a.append(b)},_render_body_discarded:function(a){a.append("<div>The job creating this dataset was cancelled before completion.</div>");a.append(this._render_showParamsAndRerun())},_render_body_setting_metadata:function(a){a.append($("<div>Metadata is being auto-detected.</div>"))},_render_body_empty:function(a){a.append($("<div>No data: <i>"+this.model.get("misc_blurb")+"</i></div>"));a.append(this._render_showParamsAndRerun())},_render_body_failed_metadata:function(b){var c="An error occurred setting the metadata for this dataset.";if(this.model.isEditable()){var a=linkHTMLTemplate({text:"set it manually or retry auto-detection",href:this.model.get("edit_url"),target:"galaxy_main"});c+="You may be able to "+a+"."}b.append($(HistoryItemView.templates.warningMsg({warning:c})));this._render_body_ok(b)},_render_body_ok:function(h){h.append(this._render_hdaSummary());if(this.model.get("misc_info")){h.append($('<div class="info">Info: '+this.model.get("misc_info")+"</div>"))}if(this.model.hasData()){var c=$("<div/>");c.append(this._render_downloadLinks());c.append($(linkHTMLTemplate({title:"View details",href:this.model.get("show_params_url"),target:"galaxy_main",classes:["icon-button","tooltip","information"]})));if(this.model.get("for_editing")){c.append($(linkHTMLTemplate({title:"Run this job again",href:this.model.get("rerun_url"),target:"galaxy_main",classes:["icon-button","tooltip","arrow-circle"]})));if(this.model.get("trackster_urls")){var a=this.model.get("trackster_urls");c.append($(linkHTMLTemplate({title:"View in Trackster",href:"javascript:void(0)",classes:["icon-button","tooltip","chart_curve","trackster-add"],"data-url":a["data-url"],"action-url":a["action-url"],"new-url":a["new-url"]})))}if(this.model.get("retag_url")&&this.model.get("annotate_url")){var d=$('<div style="float: right;"></div>');d.append($(linkHTMLTemplate({title:"Edit dataset tags",target:"galaxy_main",href:this.model.get("retag_url"),classes:["icon-button","tooltip","tags"]})));d.append($(linkHTMLTemplate({title:"Edit dataset annotation",target:"galaxy_main",href:this.model.get("annotation_url"),classes:["icon-button","tooltip","annotate"]})));c.append(d);c.append('<div style="clear: both"></div>');this.tagArea=$('<div class="tag-area" style="display: none">');this.tagArea.append("<strong>Tags:</strong>");this.tagElt=$('<div class="tag-elt"></div>');c.append(this.tagArea.append(this.tagElt));var e=$(('<div id="${dataset_id}-annotation-area" class="annotation-area" style="display: none">'));this.annotationArea=e;e.append("<strong>Annotation:</strong>");this.annotationElem=$('<div id="'+this.model.get("id")+'-annotation-elt" style="margin: 1px 0px 1px 0px" class="annotation-elt tooltip editable-text" title="Edit dataset annotation"></div>');e.append(this.annotationElem);c.append(e)}}c.append('<div style="clear: both;"></div>');h.append(c);var i=$("<div/>");if(this.model.get("display_apps")){var j=this.model.get("display_apps"),b=$("<span/>");for(app_name in j){var g=j[app_name],f=app_name+" ";for(location_name in g){f+=linkHTMLTemplate({text:location_name,href:g[location_name].url,target:g[location_name].target})+" "}b.append(f)}i.append(b)}h.append(i)}else{if(this.model.get("for_editing")){h.append(this._render_showParamsAndRerun())}}h.append(this._render_peek())},_render_body:function(){var b=this.model.get("state"),c=this.model.get("for_editing");var a=$("<div/>").attr("id","info-"+this.model.get("id")).addClass("historyItemBody").attr("style","display: block");switch(b){case HistoryItem.STATES.NOT_VIEWABLE:this._render_body_not_viewable(a);break;case HistoryItem.STATES.UPLOAD:this._render_body_uploading(a);break;case HistoryItem.STATES.QUEUED:this._render_body_queued(a);break;case HistoryItem.STATES.RUNNING:this._render_body_running(a);break;case HistoryItem.STATES.ERROR:this._render_body_error(a);break;case HistoryItem.STATES.DISCARDED:this._render_body_discarded(a);break;case HistoryItem.STATES.SETTING_METADATA:this._render_body_setting_metadata(a);break;case HistoryItem.STATES.EMPTY:this._render_body_empty(a);break;case HistoryItem.STATES.FAILED_METADATA:this._render_body_failed_metadata(a);break;case HistoryItem.STATES.OK:this._render_body_ok(a);break;default:a.append($('<div>Error: unknown dataset state "'+b+'".</div>'))}a.append('<div style="clear: both"></div>');if(this.model.get("bodyIsShown")===false){a.hide()}return a},_render_hdaSummary:function(){var a=_.template('<span class="<%= dbkey %>"><%= dbkey %></span>',{dbkey:this.model.get("metadata_dbkey")});if(this.model.get("metadata_dbkey")==="?"&&this.model.isEditable()){a=linkHTMLTemplate({text:this.model.get("metadata_dbkey"),href:this.model.get("edit_url"),target:"galaxy_main"})}return(HistoryItemView.TEMPLATES.hdaSummary(_.extend({dbkeyHTML:a},this.model.attributes)))},_render_showParamsAndRerun:function(){var a=$("<div/>");a.append($(linkHTMLTemplate({title:"View details",href:this.model.get("show_params_url"),target:"galaxy_main",classes:["icon-button","tooltip","information"]})));if(this.model.get("for_editing")){a.append($(linkHTMLTemplate({title:"Run this job again",href:this.model.get("rerun_url"),target:"galaxy_main",classes:["icon-button","tooltip","arrow-circle"]})))}return a},_render_downloadLinks:function(){if(this.model.get("purged")){return null}var a=linkHTMLTemplate({title:"Download",href:this.model.get("download_url"),classes:["icon-button","tooltip","disk"]});var d=this.model.get("download_meta_urls");if(!d){return a}var c=$('<div popupmenu="dataset-'+this.model.get("id")+'-popup"></div>');c.append(linkHTMLTemplate({text:"Download Dataset",title:"Download",href:this.model.get("download_url"),classes:["icon-button","tooltip","disk"]}));c.append("<a>Additional Files</a>");for(file_type in d){c.append(linkHTMLTemplate({text:"Download "+file_type,href:d[file_type],classes:["action-button"]}))}var b=$(('<div style="float:left;" class="menubutton split popup" id="dataset-${dataset_id}-popup"></div>'));b.append(a);c.append(b);return c},_render_peek:function(){if(!this.model.get("peek")){return null}return $("<div/>").append($("<pre/>").attr("id","peek"+this.model.get("id")).addClass("peek").append(this.model.get("peek")))},events:{"click .historyItemTitle":"toggleBodyVisibility","click a.icon-button.tags":"loadAndDisplayTags","click a.icon-button.annotate":"loadAndDisplayAnnotation"},loadAndDisplayTags:function(b){this.log(this,".loadAndDisplayTags",b);var c=this.tagArea;var a=this.tagElt;if(c.is(":hidden")){if(!a.html()){$.ajax({url:this.model.get("ajax_get_tag_url"),error:function(){alert("Tagging failed")},success:function(d){this.log("tag_elt_html:",d);a.html(d);a.find(".tooltip").tooltip();c.slideDown("fast")}})}else{c.slideDown("fast")}}else{c.slideUp("fast")}return false},loadAndDisplayAnnotation:function(b){this.log(this,".loadAndDisplayAnnotation",b);var d=this.annotationArea,c=this.annotationElem,a=this.model.get("ajax_set_annotation_url");this.log("annotationArea hidden:",d.is(":hidden"));this.log("annotationElem html:",c.html());if(d.is(":hidden")){if(!c.html()){$.ajax({url:this.model.get("ajax_get_annotation_url"),error:function(){alert("Annotations failed")},success:function(e){if(e===""){e="<em>Describe or add notes to dataset</em>"}c.html(e);d.find(".tooltip").tooltip();async_save_text(c.attr("id"),c.attr("id"),a,"new_annotation",18,true,4);d.slideDown("fast")}})}else{d.slideDown("fast")}}else{d.slideUp("fast")}return false},toggleBodyVisibility:function(){this.log(this+".toggleBodyVisibility");this.$el.find(".historyItemBody").toggle()},toString:function(){var a=(this.model)?(this.model+""):("");return"HistoryItemView("+a+")"}});HistoryItemView.TEMPLATES={};HistoryItemView.TEMPLATES.hdaSummary=_.template(["<%= misc_blurb %><br />",'format: <span class="<%= data_type %>"><%= data_type %></span>, ',"database: <%= dbkeyHTML %>"].join(""));HistoryItemView.templates=CompiledTemplateLoader.getTemplates({"common-templates.html":{warningMsg:"template-warningmessagesmall",},"history-templates.html":{messages:"template-history-warning-messages2",hdaSummary:"template-history-hdaSummary"}});var HistoryCollection=Backbone.Collection.extend({model:HistoryItem,toString:function(){return("HistoryCollection()")}});var History=BaseModel.extend(LoggableMixin).extend({defaults:{id:"",name:"",state:"",state_details:{discarded:0,empty:0,error:0,failed_metadata:0,ok:0,queued:0,running:0,setting_metadata:0,upload:0}},initialize:function(b,a){this.log(this+".initialize",b,a);this.items=new HistoryCollection()},loadDatasetsAsHistoryItems:function(c){var a=this,b=this.get("id"),d=this.get("state_details");_.each(c,function(f,e){a.log("loading dataset: ",f,e);var h=new HistoryItem(_.extend(f,{history_id:b}));a.log("as History:",h);a.items.add(h);var g=f.state;d[g]+=1});this.set("state_details",d);this._stateFromStateDetails();return this},_stateFromStateDetails:function(){this.set("state","");var a=this.get("state_details");if((a.error>0)||(a.failed_metadata>0)){this.set("state",HistoryItem.STATES.ERROR)}else{if((a.running>0)||(a.setting_metadata>0)){this.set("state",HistoryItem.STATES.RUNNING)}else{if(a.queued>0){this.set("state",HistoryItem.STATES.QUEUED)}else{if(a.ok===this.items.length){this.set("state",HistoryItem.STATES.OK)}else{throw ("_stateFromStateDetails: unable to determine history state from state details: "+this.state_details)}}}}return this},toString:function(){var a=(this.get("name"))?(","+this.get("name")):("");return"History("+this.get("id")+a+")"}});var HistoryView=BaseView.extend(LoggableMixin).extend({el:"body.historyPage",initialize:function(){this.log(this+".initialize");this.itemViews=[];var a=this;this.model.items.each(function(c){var b=new HistoryItemView({model:c});a.itemViews.push(b)})},render:function(){this.log(this+".render");var a=$("<div/>");_.each(this.itemViews,function(b){a.prepend(b.render())});this.$el.append(a.children());a.remove()},toString:function(){var a=this.model.get("name")||"";return"HistoryView("+a+")"}});function createMockHistoryData(){mockHistory={};mockHistory.data={template:{id:"a799d38679e985db",name:"template",data_type:"fastq",file_size:226297533,genome_build:"?",metadata_data_lines:0,metadata_dbkey:"?",metadata_sequences:0,misc_blurb:"215.8 MB",misc_info:"uploaded fastq file",model_class:"HistoryDatasetAssociation",download_url:"",state:"ok",visible:true,deleted:false,purged:false,hid:0,for_editing:true,undelete_url:"example.com/undelete",purge_url:"example.com/purge",unhide_url:"example.com/unhide",display_url:"example.com/display",edit_url:"example.com/edit",delete_url:"example.com/delete",show_params_url:"example.com/show_params",rerun_url:"example.com/rerun",retag_url:"example.com/retag",annotate_url:"example.com/annotate",peek:['<table cellspacing="0" cellpadding="3"><tr><th>1.QNAME</th><th>2.FLAG</th><th>3.RNAME</th><th>4.POS</th><th>5.MAPQ</th><th>6.CIGAR</th><th>7.MRNM</th><th>8.MPOS</th><th>9.ISIZE</th><th>10.SEQ</th><th>11.QUAL</th><th>12.OPT</th></tr>','<tr><td colspan="100%">@SQ SN:gi|87159884|ref|NC_007793.1| LN:2872769</td></tr>','<tr><td colspan="100%">@PG ID:bwa PN:bwa VN:0.5.9-r16</td></tr>','<tr><td colspan="100%">HWUSI-EAS664L:15:64HOJAAXX:1:1:13280:968 73 gi|87159884|ref|NC_007793.1| 2720169 37 101M = 2720169 0 NAATATGACATTATTTTCAAAACAGCTGAAAATTTAGACGTACCGATTTATCTACATCCCGCGCCAGTTAACAGTGACATTTATCAATCATACTATAAAGG !!!!!!!!!!$!!!$!!!!!$!!!!!!$!$!$$$!!$!!$!!!!!!!!!!!$!</td></tr>','<tr><td colspan="100%">!!!$!$!$$!!$$!!$!!!!!!!!!!!!!!!!!!!!!!!!!!$!!$!! XT:A:U NM:i:1 SM:i:37 AM:i:0 X0:i:1 X1:i:0 XM:i:1 XO:i:0 XG:i:0 MD:Z:0A100</td></tr>','<tr><td colspan="100%">HWUSI-EAS664L:15:64HOJAAXX:1:1:13280:968 133 gi|87159884|ref|NC_007793.1| 2720169 0 * = 2720169 0 NAAACTGTGGCTTCGTTNNNNNNNNNNNNNNNGTGANNNNNNNNNNNNNNNNNNNGNNNNNNNNNNNNNNNNNNNNCNAANNNNNNNNNNNNNNNNNNNNN !!!!!!!!!!!!$!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!</td></tr>','<tr><td colspan="100%">!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!</td></tr>',"</table>"].join("")}};_.extend(mockHistory.data,{deleted:_.extend(_.clone(mockHistory.data.template),{deleted:true}),purgedNotDeleted:_.extend(_.clone(mockHistory.data.template),{purged:true}),notvisible:_.extend(_.clone(mockHistory.data.template),{visible:false}),hasDisplayApps:_.extend(_.clone(mockHistory.data.template),{display_apps:{"display in IGB":{Web:"/display_application/63cd3858d057a6d1/igb_bam/Web",Local:"/display_application/63cd3858d057a6d1/igb_bam/Local"}}}),canTrackster:_.extend(_.clone(mockHistory.data.template),{trackster_urls:{"data-url":"example.com/trackster-data","action-url":"example.com/trackster-action","new-url":"example.com/trackster-new"}}),zeroSize:_.extend(_.clone(mockHistory.data.template),{file_size:0}),hasMetafiles:_.extend(_.clone(mockHistory.data.template),{download_meta_urls:{bam_index:"example.com/bam-index"}}),upload:_.extend(_.clone(mockHistory.data.template),{state:HistoryItem.STATES.UPLOAD}),queued:_.extend(_.clone(mockHistory.data.template),{state:HistoryItem.STATES.QUEUED}),running:_.extend(_.clone(mockHistory.data.template),{state:HistoryItem.STATES.RUNNING}),empty:_.extend(_.clone(mockHistory.data.template),{state:HistoryItem.STATES.EMPTY}),error:_.extend(_.clone(mockHistory.data.template),{state:HistoryItem.STATES.ERROR}),discarded:_.extend(_.clone(mockHistory.data.template),{state:HistoryItem.STATES.DISCARDED}),setting_metadata:_.extend(_.clone(mockHistory.data.template),{state:HistoryItem.STATES.SETTING_METADATA}),failed_metadata:_.extend(_.clone(mockHistory.data.template),{state:HistoryItem.STATES.FAILED_METADATA})});$(document).ready(function(){mockHistory.items={};mockHistory.views={};for(key in mockHistory.data){mockHistory.items[key]=new HistoryItem(mockHistory.data[key]);mockHistory.items[key].set("name",key);mockHistory.views[key]=new HistoryItemView({model:mockHistory.items[key]});$("body").append(mockHistory.views[key].render())}})};
\ No newline at end of file
diff -r 8b301f6af8340f8cd01022035d5765cf0aba3ede -r 72f1dcdf1c542e6d4689305f5de2077c0bfb4035 static/scripts/packed/mvc/ui.js
--- a/static/scripts/packed/mvc/ui.js
+++ b/static/scripts/packed/mvc/ui.js
@@ -1,1 +1,1 @@
-var create_icon_buttons_menu=function(b,a){if(!a){a={}}var c=new IconButtonCollection(_.map(b,function(d){return new IconButton(_.extend(d,a))}));return new IconButtonMenuView({collection:c})};var GalaxyPaths=Backbone.Model.extend({defaults:{root_path:"",image_path:""}});var IconButton=Backbone.Model.extend({defaults:{title:"",icon_class:"",on_click:null,tooltip_config:{}}});var IconButtonCollection=Backbone.Collection.extend({model:IconButton});var IconButtonMenuView=Backbone.View.extend({tagName:"div",initialize:function(){this.render()},render:function(){var a=this;this.collection.each(function(c){var b=$("<a/>").attr("href","javascript:void(0)").attr("title",c.attributes.title).addClass("icon-button menu-button").addClass(c.attributes.icon_class).appendTo(a.$el).click(c.attributes.on_click);if(c.attributes.tooltip_config){b.tooltip(c.attributes.tooltip_config)}});return this}});var Grid=Backbone.Collection.extend({});var GridView=Backbone.View.extend({});
\ No newline at end of file
+var IconButton=Backbone.Model.extend({defaults:{title:"",icon_class:"",on_click:null,tooltip_config:{},isMenuButton:true,id:null,href:null,target:null,enabled:true,visible:true}});var IconButtonView=Backbone.View.extend({tagName:"a",className:"icon-button",hrefVoidFn:["javascript",":void(0)"].join(""),fadeSpeed:0,initialize:function(){this.model.attributes.tooltip_config={placement:"bottom"};this.model.bind("change",this.render,this)},render:function(){var a=this.model.attributes.icon_class+"_disabled";if(!this.model.attributes.visible){this.$el.fadeOut(this.fadeSpeed)}if(this.model.attributes.enabled){if(this.$el.hasClass(a)){this.$el.removeClass(a)}this.$el.addClass(this.model.attributes.icon_class)}else{this.$el.removeClass(this.model.attributes.icon_class);this.$el.addClass(a)}if(this.model.attributes.isMenuButton){this.$el.addClass("menu-button")}else{this.$el.removeClass("menu-button")}this.$el.data("tooltip",false);this.$el.attr("data-original-title",null);this.$el.removeClass("tooltip");if(this.model.attributes.title){this.$el.attr("title",this.model.attributes.title).addClass("tooltip");this.$el.tooltip(this.model.attributes.tooltip_config)}this.$el.attr("id",(this.model.attributes.id)?(this.model.attributes.id):(null));this.$el.attr("target",(this.model.attributes.target)?(this.model.attributes.target):(null));this.$el.attr("href",(this.model.attributes.href&&!this.model.attributes.on_click)?(this.model.attributes.href):(this.hrefVoidFn));if(this.model.attributes.visible){this.$el.fadeIn(this.fadeSpeed)}return this},events:{click:"click"},click:function(a){if(this.model.attributes.on_click){this.model.attributes.on_click(a);return false}return true}});var IconButtonCollection=Backbone.Collection.extend({model:IconButton});var IconButtonMenuView=Backbone.View.extend({tagName:"div",initialize:function(){this.render()},render:function(){var a=this;this.collection.each(function(c){var b=$("<a/>").attr("href","javascript:void(0)").attr("title",c.attributes.title).addClass("icon-button menu-button").addClass(c.attributes.icon_class).appendTo(a.$el).click(c.attributes.on_click);if(c.attributes.tooltip_config){b.tooltip(c.attributes.tooltip_config)}});return this}});var create_icon_buttons_menu=function(b,a){if(!a){a={}}var c=new IconButtonCollection(_.map(b,function(d){return new IconButton(_.extend(d,a))}));return new IconButtonMenuView({collection:c})};var Grid=Backbone.Collection.extend({});var GridView=Backbone.View.extend({});var GalaxyPaths=Backbone.Model.extend({defaults:{root_path:"",image_path:""}});var GalaxyLocalization=jQuery.extend({},{aliasName:"_l",localizedStrings:{},setLocalizedString:function(b,a){var c=this;var d=function(f,e){if(f!==e){c.localizedStrings[f]=e}};if(jQuery.type(b)==="string"){d(b,a)}else{if(jQuery.type(b)==="object"){jQuery.each(b,function(e,f){d(e,f)})}else{throw ("Localization.setLocalizedString needs either a string or object as the first argument, given: "+b)}}},localize:function(b){try{return this.localizedStrings[b]}catch(a){return b}},toString:function(){return"GalaxyLocalization"}});window[GalaxyLocalization.aliasName]=function(a){return GalaxyLocalization.localize(a)};
\ No newline at end of file
diff -r 8b301f6af8340f8cd01022035d5765cf0aba3ede -r 72f1dcdf1c542e6d4689305f5de2077c0bfb4035 static/scripts/packed/viz/visualization.js
--- a/static/scripts/packed/viz/visualization.js
+++ b/static/scripts/packed/viz/visualization.js
@@ -1,1 +1,1 @@
-var ServerStateDeferred=Backbone.Model.extend({defaults:{ajax_settings:{},interval:1000,success_fn:function(a){return true}},go:function(){var d=$.Deferred(),c=this,f=c.get("ajax_settings"),e=c.get("success_fn"),b=c.get("interval"),a=function(){$.ajax(f).success(function(g){if(e(g)){d.resolve(g)}else{setTimeout(a,b)}})};a();return d}});var CanvasManager=function(a){this.default_font=a!==undefined?a:"9px Monaco, Lucida Console, monospace";this.dummy_canvas=this.new_canvas();this.dummy_context=this.dummy_canvas.getContext("2d");this.dummy_context.font=this.default_font;this.char_width_px=this.dummy_context.measureText("A").width;this.patterns={};this.load_pattern("right_strand","/visualization/strand_right.png");this.load_pattern("left_strand","/visualization/strand_left.png");this.load_pattern("right_strand_inv","/visualization/strand_right_inv.png");this.load_pattern("left_strand_inv","/visualization/strand_left_inv.png")};_.extend(CanvasManager.prototype,{load_pattern:function(a,e){var b=this.patterns,c=this.dummy_context,d=new Image();d.src=galaxy_paths.attributes.image_path+e;d.onload=function(){b[a]=c.createPattern(d,"repeat")}},get_pattern:function(a){return this.patterns[a]},new_canvas:function(){var a=$("<canvas/>")[0];if(window.G_vmlCanvasManager){G_vmlCanvasManager.initElement(a)}a.manager=this;return a}});var Cache=Backbone.Model.extend({defaults:{num_elements:20,obj_cache:null,key_ary:null},initialize:function(a){this.clear()},get_elt:function(b){var c=this.attributes.obj_cache,d=this.attributes.key_ary,a=d.indexOf(b);if(a!==-1){if(c[b].stale){d.splice(a,1);delete c[b]}else{this.move_key_to_end(b,a)}}return c[b]},set_elt:function(b,d){var e=this.attributes.obj_cache,f=this.attributes.key_ary,c=this.attributes.num_elements;if(!e[b]){if(f.length>=c){var a=f.shift();delete e[a]}f.push(b)}e[b]=d;return d},move_key_to_end:function(b,a){this.attributes.key_ary.splice(a,1);this.attributes.key_ary.push(b)},clear:function(){this.attributes.obj_cache={};this.attributes.key_ary=[]},size:function(){return this.attributes.key_ary.length}});var GenomeDataManager=Cache.extend({defaults:_.extend({},Cache.prototype.defaults,{dataset:null,filters_manager:null,data_url:null,dataset_state_url:null,feature_search_url:null,genome_wide_summary_data:null,data_mode_compatible:function(a,b){return true},can_subset:function(a){return false}}),data_is_ready:function(){var c=this.get("dataset"),b=$.Deferred(),a=new ServerStateDeferred({ajax_settings:{url:this.get("dataset_state_url"),data:{dataset_id:c.id,hda_ldda:c.get("hda_ldda")},dataType:"json"},interval:5000,success_fn:function(d){return d!=="pending"}});$.when(a.go()).then(function(d){b.resolve(d==="ok"||d==="data")});return b},search_features:function(a){var b=this.get("dataset"),c={query:a,dataset_id:b.id,hda_ldda:b.get("hda_ldda")};return $.getJSON(this.get("feature_search_url"),c)},load_data:function(j,h,b,g){var d={chrom:j.get("chrom"),low:j.get("start"),high:j.get("end"),mode:h,resolution:b},e=this.get("dataset");if(e){d.dataset_id=e.id;d.hda_ldda=e.get("hda_ldda")}$.extend(d,g);var k=this.get("filters_manager");if(k){var l=[];var a=k.filters;for(var f=0;f<a.length;f++){l.push(a[f].name)}d.filter_cols=JSON.stringify(l)}var c=this;return $.getJSON(this.get("data_url"),d,function(i){c.set_data(j,i)})},get_data:function(g,f,c,e){var h=this.get_elt(g);if(h&&(is_deferred(h)||this.get("data_mode_compatible")(h,f))){return h}var j=this.get("key_ary"),b=this.get("obj_cache"),k,a;for(var d=0;d<j.length;d++){k=j[d];a=new GenomeRegion({from_str:k});if(a.contains(g)){h=b[k];if(is_deferred(h)||(this.get("data_mode_compatible")(h,f)&&this.get("can_subset")(h))){this.move_key_to_end(k,d);return h}}}h=this.load_data(g,f,c,e);this.set_data(g,h);return h},set_data:function(b,a){this.set_elt(b,a)},DEEP_DATA_REQ:"deep",BROAD_DATA_REQ:"breadth",get_more_data:function(i,h,d,g,e){var k=this.get_elt(i);if(!(k&&this.get("data_mode_compatible")(k,h))){console.log("ERROR: no current data for: ",dataset,i.toString(),h,d,g);return}k.stale=true;var c=i.get("start");if(e===this.DEEP_DATA_REQ){$.extend(g,{start_val:k.data.length+1})}else{if(e===this.BROAD_DATA_REQ){c=(k.max_high?k.max_high:k.data[k.data.length-1][2])+1}}var j=i.copy().set("start",c);var b=this,f=this.load_data(j,h,d,g),a=$.Deferred();this.set_data(i,a);$.when(f).then(function(l){if(l.data){l.data=k.data.concat(l.data);if(l.max_low){l.max_low=k.max_low}if(l.message){l.message=l.message.replace(/[0-9]+/,l.data.length)}}b.set_data(i,l);a.resolve(l)});return a},get_elt:function(a){return Cache.prototype.get_elt.call(this,a.toString())},set_elt:function(b,a){return Cache.prototype.set_elt.call(this,b.toString(),a)}});var ReferenceTrackDataManager=GenomeDataManager.extend({load_data:function(a,d,e,b,c){if(b>1){return{data:null}}return GenomeDataManager.prototype.load_data.call(this,a,d,e,b,c)}});var Genome=Backbone.Model.extend({defaults:{name:null,key:null,chroms_info:null},get_chroms_info:function(){return this.attributes.chroms_info.chrom_info}});var GenomeRegion=Backbone.RelationalModel.extend({defaults:{chrom:null,start:0,end:0,DIF_CHROMS:1000,BEFORE:1001,CONTAINS:1002,OVERLAP_START:1003,OVERLAP_END:1004,CONTAINED_BY:1005,AFTER:1006},initialize:function(b){if(b.from_str){var d=b.from_str.split(":"),c=d[0],a=d[1].split("-");this.set({chrom:c,start:parseInt(a[0],10),end:parseInt(a[1],10)})}},copy:function(){return new GenomeRegion({chrom:this.get("chrom"),start:this.get("start"),end:this.get("end")})},length:function(){return this.get("end")-this.get("start")},toString:function(){return this.get("chrom")+":"+this.get("start")+"-"+this.get("end")},toJSON:function(){return{chrom:this.get("chrom"),start:this.get("start"),end:this.get("end")}},compute_overlap:function(h){var b=this.get("chrom"),g=h.get("chrom"),f=this.get("start"),d=h.get("start"),e=this.get("end"),c=h.get("end"),a;if(b&&g&&b!==g){return this.get("DIF_CHROMS")}if(f<d){if(e<d){a=this.get("BEFORE")}else{if(e<=c){a=this.get("OVERLAP_START")}else{a=this.get("CONTAINS")}}}else{if(f>c){a=this.get("AFTER")}else{if(e<=c){a=this.get("CONTAINED_BY")}else{a=this.get("OVERLAP_END")}}}return a},contains:function(a){return this.compute_overlap(a)===this.get("CONTAINS")},overlaps:function(a){return _.intersection([this.compute_overlap(a)],[this.get("DIF_CHROMS"),this.get("BEFORE"),this.get("AFTER")]).length===0}});var GenomeRegionCollection=Backbone.Collection.extend({model:GenomeRegion});var BrowserBookmark=Backbone.RelationalModel.extend({defaults:{region:null,note:""},relations:[{type:Backbone.HasOne,key:"region",relatedModel:"GenomeRegion"}]});var BrowserBookmarkCollection=Backbone.Collection.extend({model:BrowserBookmark});var GenomeWideBigWigData=Backbone.Model.extend({defaults:{data:null,min:0,max:0},initialize:function(b){var a=_.flatten(_.map(this.get("data"),function(c){if(c.data.length!==0){return _.map(c.data,function(d){return d[1]})}else{return 0}}));this.set("max",_.max(a));this.set("min",_.min(a))}});var GenomeWideSummaryTreeData=Backbone.RelationalModel.extend({defaults:{data:null,min:0,max:0},initialize:function(b){var a=_.max(this.get("data"),function(c){if(!c||typeof c==="string"){return 0}return c[1]});this.attributes.max=(a&&typeof a!=="string"?a[1]:0)}});var BackboneTrack=Dataset.extend({initialize:function(a){this.set("id",a.dataset_id);var c=this.get("genome_wide_data");if(c){var b=(this.get("track_type")==="LineTrack"?GenomeWideBigWigData:GenomeWideSummaryTreeData);this.set("genome_wide_data",new b(c))}}});var Visualization=Backbone.RelationalModel.extend({defaults:{id:"",title:"",type:"",dbkey:"",tracks:null},relations:[{type:Backbone.HasMany,key:"tracks",relatedModel:"BackboneTrack"}],url:function(){return galaxy_paths.get("visualization_url")},save:function(){return $.ajax({url:this.url(),type:"POST",dataType:"json",data:{vis_json:JSON.stringify(this)}})}});var GenomeVisualization=Visualization.extend({defaults:_.extend({},Visualization.prototype.defaults,{bookmarks:null,viewport:null})});var TrackConfig=Backbone.Model.extend({});var CircsterDataLayout=Backbone.Model.extend({defaults:{genome:null,dataset:null,total_gap:null},chroms_layout:function(){var b=this.attributes.genome.get_chroms_info(),d=d3.layout.pie().value(function(f){return f.len}).sort(null),e=d(b),a=this.attributes.total_gap/b.length,c=_.map(e,function(h,g){var f=h.endAngle-a;h.endAngle=(f>h.startAngle?f:h.startAngle);return h});return c},chrom_data_layout:function(d,c,b,e,a){},genome_data_layout:function(){var b=this,a=this.chroms_layout(),f=this.get("track").get("genome_wide_data"),e=this.get("radius_start"),c=this.get("radius_end"),d=_.zip(a,f.get("data")),g=_.map(d,function(i){var j=i[0],h=i[1];return b.chrom_data_layout(j,h,e,c,f.get("min"),f.get("max"))});return g}});var CircsterSummaryTreeLayout=CircsterDataLayout.extend({chrom_data_layout:function(k,b,h,g,d,i){if(!b||typeof b==="string"){return null}var e=b[0],j=b[3],c=d3.scale.linear().domain([d,i]).range([h,g]),f=d3.layout.pie().value(function(l){return j}).startAngle(k.startAngle).endAngle(k.endAngle),a=f(e);_.each(e,function(l,m){a[m].outerRadius=c(l[1])});return a}});var CircsterBigWigLayout=CircsterDataLayout.extend({chrom_data_layout:function(j,b,h,g,d,i){var e=b.data;if(e.length===0){return}var c=d3.scale.linear().domain([d,i]).range([h,g]),f=d3.layout.pie().value(function(l,k){if(k+1===e.length){return 0}return e[k+1][0]-e[k][0]}).startAngle(j.startAngle).endAngle(j.endAngle),a=f(e);_.each(e,function(k,l){a[l].outerRadius=c(k[1])});return a}});var CircsterView=Backbone.View.extend({className:"circster",initialize:function(a){this.width=a.width;this.height=a.height;this.total_gap=a.total_gap;this.genome=a.genome;this.radius_start=a.radius_start;this.dataset_arc_height=a.dataset_arc_height;this.track_gap=5},render:function(){var b=this,c=this.dataset_arc_height;var a=d3.select(b.$el[0]).append("svg").attr("width",b.width).attr("height",b.height).append("g").attr("transform","translate("+b.width/2+","+b.height/2+")");this.model.get("tracks").each(function(f,l){var g=f.get("genome_wide_data"),k=b.radius_start+l*(c+b.track_gap),h=(g instanceof GenomeWideBigWigData?CircsterBigWigLayout:CircsterSummaryTreeLayout),n=new h({track:f,radius_start:k,radius_end:k+c,genome:b.genome,total_gap:b.total_gap}),d=n.chroms_layout(),i=n.genome_data_layout();var o=a.append("g").attr("id","inner-arc"),m=d3.svg.arc().innerRadius(k).outerRadius(k+c),e=o.selectAll("#inner-arc>path").data(d).enter().append("path").attr("d",m).style("stroke","#ccc").style("fill","#ccc").append("title").text(function(q){return q.data.chrom});var p=f.get("prefs"),j=p.block_color;_.each(i,function(q){if(!q){return}var t=a.append("g"),s=d3.svg.arc().innerRadius(k),r=t.selectAll("path").data(q).enter().append("path").attr("d",s).style("stroke",j).style("fill",j)})})}});var TrackBrowserRouter=Backbone.Router.extend({initialize:function(b){this.view=b.view;this.route(/([\w]+)$/,"change_location");this.route(/([\w]+\:[\d,]+-[\d,]+)$/,"change_location");var a=this;a.view.on("navigate",function(c){a.navigate(c)})},change_location:function(a){this.view.go_to(a)}});var add_datasets=function(a,c,b){$.ajax({url:a,data:{"f-dbkey":view.dbkey},error:function(){alert("Grid failed")},success:function(d){show_modal("Select datasets for new tracks",d,{Cancel:function(){hide_modal()},Add:function(){var e=[];$("input[name=id]:checked,input[name=ldda_ids]:checked").each(function(){var f,g=$(this).val();if($(this).attr("name")==="id"){f={hda_id:g}}else{f={ldda_id:g}}e[e.length]=$.ajax({url:c,data:f,dataType:"json"})});$.when.apply($,e).then(function(){var f=(arguments[0] instanceof Array?$.map(arguments,function(g){return g[0]}):[arguments[0]]);b(f)});hide_modal()}})}})};
\ No newline at end of file
+var ServerStateDeferred=Backbone.Model.extend({defaults:{ajax_settings:{},interval:1000,success_fn:function(a){return true}},go:function(){var d=$.Deferred(),c=this,f=c.get("ajax_settings"),e=c.get("success_fn"),b=c.get("interval"),a=function(){$.ajax(f).success(function(g){if(e(g)){d.resolve(g)}else{setTimeout(a,b)}})};a();return d}});var CanvasManager=function(a){this.default_font=a!==undefined?a:"9px Monaco, Lucida Console, monospace";this.dummy_canvas=this.new_canvas();this.dummy_context=this.dummy_canvas.getContext("2d");this.dummy_context.font=this.default_font;this.char_width_px=this.dummy_context.measureText("A").width;this.patterns={};this.load_pattern("right_strand","/visualization/strand_right.png");this.load_pattern("left_strand","/visualization/strand_left.png");this.load_pattern("right_strand_inv","/visualization/strand_right_inv.png");this.load_pattern("left_strand_inv","/visualization/strand_left_inv.png")};_.extend(CanvasManager.prototype,{load_pattern:function(a,e){var b=this.patterns,c=this.dummy_context,d=new Image();d.src=galaxy_paths.attributes.image_path+e;d.onload=function(){b[a]=c.createPattern(d,"repeat")}},get_pattern:function(a){return this.patterns[a]},new_canvas:function(){var a=$("<canvas/>")[0];if(window.G_vmlCanvasManager){G_vmlCanvasManager.initElement(a)}a.manager=this;return a}});var Cache=Backbone.Model.extend({defaults:{num_elements:20,obj_cache:null,key_ary:null},initialize:function(a){this.clear()},get_elt:function(b){var c=this.attributes.obj_cache,d=this.attributes.key_ary,a=d.indexOf(b);if(a!==-1){if(c[b].stale){d.splice(a,1);delete c[b]}else{this.move_key_to_end(b,a)}}return c[b]},set_elt:function(b,d){var e=this.attributes.obj_cache,f=this.attributes.key_ary,c=this.attributes.num_elements;if(!e[b]){if(f.length>=c){var a=f.shift();delete e[a]}f.push(b)}e[b]=d;return d},move_key_to_end:function(b,a){this.attributes.key_ary.splice(a,1);this.attributes.key_ary.push(b)},clear:function(){this.attributes.obj_cache={};this.attributes.key_ary=[]},size:function(){return this.attributes.key_ary.length}});var GenomeDataManager=Cache.extend({defaults:_.extend({},Cache.prototype.defaults,{dataset:null,filters_manager:null,data_url:null,dataset_state_url:null,feature_search_url:null,genome_wide_summary_data:null,data_mode_compatible:function(a,b){return true},can_subset:function(a){return false}}),data_is_ready:function(){var c=this.get("dataset"),b=$.Deferred(),a=new ServerStateDeferred({ajax_settings:{url:this.get("dataset_state_url"),data:{dataset_id:c.id,hda_ldda:c.get("hda_ldda")},dataType:"json"},interval:5000,success_fn:function(d){return d!=="pending"}});$.when(a.go()).then(function(d){b.resolve(d==="ok"||d==="data")});return b},search_features:function(a){var b=this.get("dataset"),c={query:a,dataset_id:b.id,hda_ldda:b.get("hda_ldda")};return $.getJSON(this.get("feature_search_url"),c)},load_data:function(j,h,b,g){var d={chrom:j.get("chrom"),low:j.get("start"),high:j.get("end"),mode:h,resolution:b},e=this.get("dataset");if(e){d.dataset_id=e.id;d.hda_ldda=e.get("hda_ldda")}$.extend(d,g);var k=this.get("filters_manager");if(k){var l=[];var a=k.filters;for(var f=0;f<a.length;f++){l.push(a[f].name)}d.filter_cols=JSON.stringify(l)}var c=this;return $.getJSON(this.get("data_url"),d,function(i){c.set_data(j,i)})},get_data:function(g,f,c,e){var h=this.get_elt(g);if(h&&(is_deferred(h)||this.get("data_mode_compatible")(h,f))){return h}var j=this.get("key_ary"),b=this.get("obj_cache"),k,a;for(var d=0;d<j.length;d++){k=j[d];a=new GenomeRegion({from_str:k});if(a.contains(g)){h=b[k];if(is_deferred(h)||(this.get("data_mode_compatible")(h,f)&&this.get("can_subset")(h))){this.move_key_to_end(k,d);return h}}}h=this.load_data(g,f,c,e);this.set_data(g,h);return h},set_data:function(b,a){this.set_elt(b,a)},DEEP_DATA_REQ:"deep",BROAD_DATA_REQ:"breadth",get_more_data:function(i,h,d,g,e){var k=this.get_elt(i);if(!(k&&this.get("data_mode_compatible")(k,h))){console.log("ERROR: no current data for: ",dataset,i.toString(),h,d,g);return}k.stale=true;var c=i.get("start");if(e===this.DEEP_DATA_REQ){$.extend(g,{start_val:k.data.length+1})}else{if(e===this.BROAD_DATA_REQ){c=(k.max_high?k.max_high:k.data[k.data.length-1][2])+1}}var j=i.copy().set("start",c);var b=this,f=this.load_data(j,h,d,g),a=$.Deferred();this.set_data(i,a);$.when(f).then(function(l){if(l.data){l.data=k.data.concat(l.data);if(l.max_low){l.max_low=k.max_low}if(l.message){l.message=l.message.replace(/[0-9]+/,l.data.length)}}b.set_data(i,l);a.resolve(l)});return a},get_elt:function(a){return Cache.prototype.get_elt.call(this,a.toString())},set_elt:function(b,a){return Cache.prototype.set_elt.call(this,b.toString(),a)}});var ReferenceTrackDataManager=GenomeDataManager.extend({load_data:function(a,d,e,b,c){if(b>1){return{data:null}}return GenomeDataManager.prototype.load_data.call(this,a,d,e,b,c)}});var Genome=Backbone.Model.extend({defaults:{name:null,key:null,chroms_info:null},get_chroms_info:function(){return this.attributes.chroms_info.chrom_info}});var GenomeRegion=Backbone.RelationalModel.extend({defaults:{chrom:null,start:0,end:0,DIF_CHROMS:1000,BEFORE:1001,CONTAINS:1002,OVERLAP_START:1003,OVERLAP_END:1004,CONTAINED_BY:1005,AFTER:1006},initialize:function(b){if(b.from_str){var d=b.from_str.split(":"),c=d[0],a=d[1].split("-");this.set({chrom:c,start:parseInt(a[0],10),end:parseInt(a[1],10)})}},copy:function(){return new GenomeRegion({chrom:this.get("chrom"),start:this.get("start"),end:this.get("end")})},length:function(){return this.get("end")-this.get("start")},toString:function(){return this.get("chrom")+":"+this.get("start")+"-"+this.get("end")},toJSON:function(){return{chrom:this.get("chrom"),start:this.get("start"),end:this.get("end")}},compute_overlap:function(h){var b=this.get("chrom"),g=h.get("chrom"),f=this.get("start"),d=h.get("start"),e=this.get("end"),c=h.get("end"),a;if(b&&g&&b!==g){return this.get("DIF_CHROMS")}if(f<d){if(e<d){a=this.get("BEFORE")}else{if(e<=c){a=this.get("OVERLAP_START")}else{a=this.get("CONTAINS")}}}else{if(f>c){a=this.get("AFTER")}else{if(e<=c){a=this.get("CONTAINED_BY")}else{a=this.get("OVERLAP_END")}}}return a},contains:function(a){return this.compute_overlap(a)===this.get("CONTAINS")},overlaps:function(a){return _.intersection([this.compute_overlap(a)],[this.get("DIF_CHROMS"),this.get("BEFORE"),this.get("AFTER")]).length===0}});var GenomeRegionCollection=Backbone.Collection.extend({model:GenomeRegion});var BrowserBookmark=Backbone.RelationalModel.extend({defaults:{region:null,note:""},relations:[{type:Backbone.HasOne,key:"region",relatedModel:"GenomeRegion"}]});var BrowserBookmarkCollection=Backbone.Collection.extend({model:BrowserBookmark});var GenomeWideBigWigData=Backbone.Model.extend({defaults:{data:null,min:0,max:0},initialize:function(b){var a=_.flatten(_.map(this.get("data"),function(c){if(c.data.length!==0){return _.map(c.data,function(d){return d[1]})}else{return 0}}));this.set("max",_.max(a));this.set("min",_.min(a))}});var GenomeWideSummaryTreeData=Backbone.RelationalModel.extend({defaults:{data:null,min:0,max:0},initialize:function(b){var a=_.max(this.get("data"),function(c){if(!c||typeof c==="string"){return 0}return c[1]});this.attributes.max=(a&&typeof a!=="string"?a[1]:0)}});var BackboneTrack=Dataset.extend({initialize:function(a){this.set("id",a.dataset_id);var c=this.get("genome_wide_data");if(c){var b=(this.get("track_type")==="LineTrack"?GenomeWideBigWigData:GenomeWideSummaryTreeData);this.set("genome_wide_data",new b(c))}}});var Visualization=Backbone.RelationalModel.extend({defaults:{id:"",title:"",type:"",dbkey:"",tracks:null},relations:[{type:Backbone.HasMany,key:"tracks",relatedModel:"BackboneTrack"}],url:function(){return galaxy_paths.get("visualization_url")},save:function(){return $.ajax({url:this.url(),type:"POST",dataType:"json",data:{vis_json:JSON.stringify(this)}})}});var GenomeVisualization=Visualization.extend({defaults:_.extend({},Visualization.prototype.defaults,{bookmarks:null,viewport:null})});var TrackConfig=Backbone.Model.extend({});var CircsterDataLayout=Backbone.Model.extend({defaults:{genome:null,dataset:null,total_gap:null},chroms_layout:function(){var b=this.attributes.genome.get_chroms_info(),d=d3.layout.pie().value(function(f){return f.len}).sort(null),e=d(b),a=this.attributes.total_gap/b.length,c=_.map(e,function(h,g){var f=h.endAngle-a;h.endAngle=(f>h.startAngle?f:h.startAngle);return h});return c},chrom_data_layout:function(d,c,b,e,a){},genome_data_layout:function(){var b=this,a=this.chroms_layout(),f=this.get("track").get("genome_wide_data"),e=this.get("radius_start"),c=this.get("radius_end"),d=_.zip(a,f.get("data")),g=_.map(d,function(i){var j=i[0],h=i[1];return b.chrom_data_layout(j,h,e,c,f.get("min"),f.get("max"))});return g}});var CircsterSummaryTreeLayout=CircsterDataLayout.extend({chrom_data_layout:function(k,b,h,g,d,i){if(!b||typeof b==="string"){return null}var e=b[0],j=b[3],c=d3.scale.linear().domain([d,i]).range([h,g]),f=d3.layout.pie().value(function(l){return j}).startAngle(k.startAngle).endAngle(k.endAngle),a=f(e);_.each(e,function(l,m){a[m].outerRadius=c(l[1])});return a}});var CircsterBigWigLayout=CircsterDataLayout.extend({chrom_data_layout:function(j,b,h,g,d,i){var e=b.data;if(e.length===0){return}var c=d3.scale.linear().domain([d,i]).range([h,g]),f=d3.layout.pie().value(function(l,k){if(k+1===e.length){return 0}return e[k+1][0]-e[k][0]}).startAngle(j.startAngle).endAngle(j.endAngle),a=f(e);_.each(e,function(k,l){a[l].outerRadius=c(k[1])});return a}});var CircsterView=Backbone.View.extend({className:"circster",initialize:function(a){this.total_gap=a.total_gap;this.genome=a.genome;this.dataset_arc_height=a.dataset_arc_height;this.track_gap=5},render:function(){var c=this,e=this.dataset_arc_height,f=c.$el.width(),a=c.$el.height(),d=(Math.min(f,a)/2-this.model.get("tracks").length*(this.dataset_arc_height+this.track_gap));var b=d3.select(c.$el[0]).append("svg").attr("width",f).attr("height",a).attr("pointer-events","all").append("svg:g").call(d3.behavior.zoom().on("zoom",function(){b.attr("transform","translate("+d3.event.translate+") scale("+d3.event.scale+")")})).attr("transform","translate("+f/2+","+a/2+")").append("svg:g");this.model.get("tracks").each(function(i,o){var j=i.get("genome_wide_data"),n=d+o*(e+c.track_gap),k=(j instanceof GenomeWideBigWigData?CircsterBigWigLayout:CircsterSummaryTreeLayout),q=new k({track:i,radius_start:n,radius_end:n+e,genome:c.genome,total_gap:c.total_gap}),g=q.chroms_layout(),l=q.genome_data_layout();var r=b.append("g").attr("id","inner-arc"),p=d3.svg.arc().innerRadius(n).outerRadius(n+e),h=r.selectAll("#inner-arc>path").data(g).enter().append("path").attr("d",p).style("stroke","#ccc").style("fill","#ccc").append("title").text(function(t){return t.data.chrom});var s=i.get("prefs"),m=s.block_color;_.each(l,function(t){if(!t){return}var w=b.append("g"),v=d3.svg.arc().innerRadius(n),u=w.selectAll("path").data(t).enter().append("path").attr("d",v).style("stroke",m).style("fill",m)})})}});var TrackBrowserRouter=Backbone.Router.extend({initialize:function(b){this.view=b.view;this.route(/([\w]+)$/,"change_location");this.route(/([\w]+\:[\d,]+-[\d,]+)$/,"change_location");var a=this;a.view.on("navigate",function(c){a.navigate(c)})},change_location:function(a){this.view.go_to(a)}});var add_datasets=function(a,c,b){$.ajax({url:a,data:{"f-dbkey":view.dbkey},error:function(){alert("Grid failed")},success:function(d){show_modal("Select datasets for new tracks",d,{Cancel:function(){hide_modal()},Add:function(){var e=[];$("input[name=id]:checked,input[name=ldda_ids]:checked").each(function(){var f,g=$(this).val();if($(this).attr("name")==="id"){f={hda_id:g}}else{f={ldda_id:g}}e[e.length]=$.ajax({url:c,data:f,dataType:"json"})});$.when.apply($,e).then(function(){var f=(arguments[0] instanceof Array?$.map(arguments,function(g){return g[0]}):[arguments[0]]);b(f)});hide_modal()}})}})};
\ 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: dannon: Enhance replace_big_select_inputs to accept a list of elements instead of automatically grabbing all selects.
by Bitbucket 12 Sep '12
by Bitbucket 12 Sep '12
12 Sep '12
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/changeset/8b301f6af834/
changeset: 8b301f6af834
user: dannon
date: 2012-09-12 18:59:19
summary: Enhance replace_big_select_inputs to accept a list of elements instead of automatically grabbing all selects.
affected #: 1 file
diff -r 59e3badd56fd2805b9f89f9b5d2f7dcf6189e74c -r 8b301f6af8340f8cd01022035d5765cf0aba3ede static/scripts/galaxy.base.js
--- a/static/scripts/galaxy.base.js
+++ b/static/scripts/galaxy.base.js
@@ -178,7 +178,7 @@
}
// Replace select box with a text input box + autocomplete.
-function replace_big_select_inputs(min_length, max_length) {
+function replace_big_select_inputs(min_length, max_length, select_elts) {
// To do replace, jQuery's autocomplete plugin must be loaded.
if (!jQuery().autocomplete) {
return;
@@ -191,8 +191,10 @@
if (max_length === undefined) {
max_length = 3000;
}
+
+ var select_elts = select_elts || $('select');
- $('select').each( function() {
+ select_elts.each( function() {
var select_elt = $(this);
// Make sure that options is within range.
var num_options = select_elt.find('option').length;
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: Cleanup imports, fix reference to 'libraries' in example.
by Bitbucket 12 Sep '12
by Bitbucket 12 Sep '12
12 Sep '12
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/changeset/59e3badd56fd/
changeset: 59e3badd56fd
user: dannon
date: 2012-09-12 18:57:42
summary: Cleanup imports, fix reference to 'libraries' in example.
affected #: 1 file
diff -r 81529070d60df960ae226d7d31a422b6f8febb0c -r 59e3badd56fd2805b9f89f9b5d2f7dcf6189e74c lib/galaxy/web/api/history_contents.py
--- a/lib/galaxy/web/api/history_contents.py
+++ b/lib/galaxy/web/api/history_contents.py
@@ -3,8 +3,7 @@
"""
import logging
from galaxy import web
-from galaxy.web.base.controller import *
-from galaxy.model.orm import *
+from galaxy.web.base.controller import BaseAPIController, url_for, UsesHistoryDatasetAssociationMixin, UsesHistoryMixin, UsesLibraryMixin, UsesLibraryMixinItems
import pkg_resources
pkg_resources.require( "Routes" )
@@ -73,7 +72,7 @@
@web.expose_api
def create( self, trans, history_id, payload, **kwd ):
"""
- POST /api/libraries/{encoded_history_id}/contents
+ POST /api/histories/{encoded_history_id}/contents
Creates a new history content item (file, aka HistoryDatasetAssociation).
"""
from_ld_id = payload.get( 'from_ld_id', None )
@@ -99,3 +98,4 @@
# TODO: implement other "upload" methods here.
trans.response.status = 403
return "Not implemented."
+
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: Whitespace cleanup, remove unused sa_session reference.
by Bitbucket 12 Sep '12
by Bitbucket 12 Sep '12
12 Sep '12
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/changeset/81529070d60d/
changeset: 81529070d60d
user: dannon
date: 2012-09-12 18:55:01
summary: Whitespace cleanup, remove unused sa_session reference.
affected #: 1 file
diff -r 93a04e500eb464b7dd7c0dba565b60661307e94b -r 81529070d60df960ae226d7d31a422b6f8febb0c lib/galaxy/web/framework/__init__.py
--- a/lib/galaxy/web/framework/__init__.py
+++ b/lib/galaxy/web/framework/__init__.py
@@ -62,7 +62,7 @@
"""
func.exposed = True
return func
-
+
def json( func ):
@wraps(func)
def decorator( self, trans, *args, **kwargs ):
@@ -127,8 +127,8 @@
trans.set_user( provided_key.user )
if trans.request.body:
def extract_payload_from_request(trans, func, kwargs):
- content_type = trans.request.headers['content-type']
- if content_type.startswith('application/x-www-form-urlencoded') or content_type.startswith('multipart/form-data'):
+ content_type = trans.request.headers['content-type']
+ if content_type.startswith('application/x-www-form-urlencoded') or content_type.startswith('multipart/form-data'):
# If the content type is a standard type such as multipart/form-data, the wsgi framework parses the request body
# and loads all field values into kwargs. However, kwargs also contains formal method parameters etc. which
# are not a part of the request body. This is a problem because it's not possible to differentiate between values
@@ -136,7 +136,7 @@
# in the payload. Therefore, the decorated method's formal arguments are discovered through reflection and removed from
# the payload dictionary. This helps to prevent duplicate argument conflicts in downstream methods.
payload = kwargs.copy()
- named_args, _, _, _ = inspect.getargspec(func)
+ named_args, _, _, _ = inspect.getargspec(func)
for arg in named_args:
payload.pop(arg, None)
else:
@@ -145,7 +145,7 @@
# such as multipart/form-data. Leaving it as is for backward compatibility, just in case.
payload = util.recursively_stringify_dictionary_keys( simplejson.loads( trans.request.body ) )
return payload
- try:
+ try:
kwargs['payload'] = extract_payload_from_request(trans, func, kwargs)
except ValueError:
error_status = '400 Bad Request'
@@ -210,7 +210,7 @@
def form( *args, **kwargs ):
return FormBuilder( *args, **kwargs )
-
+
class WebApplication( base.WebApplication ):
def __init__( self, galaxy_app, session_cookie='galaxysession' ):
base.WebApplication.__init__( self )
@@ -322,7 +322,7 @@
except:
event.user = None
try:
- event.session_id = self.galaxy_session.id
+ event.session_id = self.galaxy_session.id
except:
event.session_id = None
self.sa_session.add( event )
@@ -339,23 +339,22 @@
return None
def set_cookie( self, value, name='galaxysession', path='/', age=90, version='1' ):
"""Convenience method for setting a session cookie"""
- # The galaxysession cookie value must be a high entropy 128 bit random number encrypted
+ # The galaxysession cookie value must be a high entropy 128 bit random number encrypted
# using a server secret key. Any other value is invalid and could pose security issues.
self.response.cookies[name] = value
self.response.cookies[name]['path'] = path
self.response.cookies[name]['max-age'] = 3600 * 24 * age # 90 days
tstamp = time.localtime ( time.time() + 3600 * 24 * age )
- self.response.cookies[name]['expires'] = time.strftime( '%a, %d-%b-%Y %H:%M:%S GMT', tstamp )
+ self.response.cookies[name]['expires'] = time.strftime( '%a, %d-%b-%Y %H:%M:%S GMT', tstamp )
self.response.cookies[name]['version'] = version
def _ensure_valid_session( self, session_cookie, create=True):
"""
Ensure that a valid Galaxy session exists and is available as
trans.session (part of initialization)
-
+
Support for universe_session and universe_user cookies has been
removed as of 31 Oct 2008.
"""
- sa_session = self.sa_session
# Try to load an existing session
secure_id = self.get_cookie( name=session_cookie )
galaxy_session = None
@@ -369,7 +368,7 @@
# Decode the cookie value to get the session_key
session_key = self.security.decode_guid( secure_id )
try:
- # Make sure we have a valid UTF-8 string
+ # Make sure we have a valid UTF-8 string
session_key = session_key.encode( 'utf8' )
except UnicodeDecodeError:
# We'll end up creating a new galaxy_session
@@ -384,7 +383,7 @@
if self.app.config.use_remote_user:
assert "HTTP_REMOTE_USER" in self.environ, \
"use_remote_user is set but no HTTP_REMOTE_USER variable"
- remote_user_email = self.environ[ 'HTTP_REMOTE_USER' ]
+ remote_user_email = self.environ[ 'HTTP_REMOTE_USER' ]
if galaxy_session:
# An existing session, make sure correct association exists
if galaxy_session.user is None:
@@ -429,13 +428,13 @@
# FIXME: If prev_session is a proper relation this would not
# be needed.
if prev_galaxy_session:
- self.sa_session.add( prev_galaxy_session )
+ self.sa_session.add( prev_galaxy_session )
self.sa_session.flush()
# If the old session was invalid, get a new history with our new session
if invalidate_existing_session:
self.new_history()
def _ensure_logged_in_user( self, environ, session_cookie ):
- # The value of session_cookie can be one of
+ # The value of session_cookie can be one of
# 'galaxysession' or 'galaxycommunitysession'
# Currently this method does nothing unless session_cookie is 'galaxysession'
if session_cookie == 'galaxysession' and self.galaxy_session.user is None:
@@ -469,7 +468,7 @@
host = None
if host in UCSC_SERVERS:
return
- external_display_path = url_for( controller='dataset', action='display_application' )
+ external_display_path = url_for( controller='dataset', action='display_application' )
if self.request.path.startswith( external_display_path ):
request_path_split = external_display_path.split( '/' )
try:
@@ -484,13 +483,13 @@
Create a new GalaxySession for this request, possibly with a connection
to a previous session (in `prev_galaxy_session`) and an existing user
(in `user_for_new_session`).
-
+
Caller is responsible for flushing the returned session.
"""
session_key = self.security.get_new_guid()
galaxy_session = self.app.model.GalaxySession(
session_key=session_key,
- is_valid=True,
+ is_valid=True,
remote_host = self.request.remote_host,
remote_addr = self.request.remote_addr,
referer = self.request.headers.get( 'Referer', None ) )
@@ -507,7 +506,7 @@
"""
if not self.app.config.use_remote_user:
return None
-
+
user = self.sa_session.query( self.app.model.User ) \
.filter( self.app.model.User.table.c.email==remote_user_email ) \
.first()
@@ -555,7 +554,7 @@
Login a new user (possibly newly created)
- create a new session
- associate new session with user
- - if old session had a history and it was not associated with a user, associate it with the new session,
+ - if old session had a history and it was not associated with a user, associate it with the new session,
otherwise associate the current session's history with the user
- add the disk usage of the current session to the user's total disk usage
"""
@@ -637,7 +636,7 @@
return self.galaxy_session
def get_history( self, create=False ):
"""
- Load the current history, creating a new one only if there is not
+ Load the current history, creating a new one only if there is not
current history and we're told to create"
"""
history = self.galaxy_session.current_history
@@ -709,7 +708,7 @@
return rval
def set_message( self, message, type=None ):
"""
- Convenience method for setting the 'message' and 'message_type'
+ Convenience method for setting the 'message' and 'message_type'
element of the template context.
"""
self.template_context['message'] = message
@@ -724,11 +723,11 @@
def show_message( self, message, type='info', refresh_frames=[], cont=None, use_panels=False, active_view="" ):
"""
Convenience method for displaying a simple page with a single message.
-
+
`type`: one of "error", "warning", "info", or "done"; determines the
type of dialog box and icon displayed with the message
-
- `refresh_frames`: names of frames in the interface that should be
+
+ `refresh_frames`: names of frames in the interface that should be
refreshed when the message is displayed
"""
return self.fill_template( "message.mako", status=type, message=message, refresh_frames=refresh_frames, cont=cont, use_panels=use_panels, active_view=active_view )
@@ -752,7 +751,7 @@
Convenience method for displaying a simple page with a single HTML
form.
"""
- return self.fill_template( template, form=form, header=header, use_panels=( form.use_panels or use_panels ),
+ return self.fill_template( template, form=form, header=header, use_panels=( form.use_panels or use_panels ),
active_view=active_view )
def fill_template(self, filename, **kwargs):
"""
@@ -764,19 +763,19 @@
if filename.endswith( ".mako" ):
return self.fill_template_mako( filename, **kwargs )
else:
- template = Template( file=os.path.join(self.app.config.template_path, filename),
+ template = Template( file=os.path.join(self.app.config.template_path, filename),
searchList=[kwargs, self.template_context, dict(caller=self, t=self, h=helpers, util=util, request=self.request, response=self.response, app=self.app)] )
return str( template )
def fill_template_mako( self, filename, **kwargs ):
template = self.webapp.mako_template_lookup.get_template( filename )
- template.output_encoding = 'utf-8'
+ template.output_encoding = 'utf-8'
data = dict( caller=self, t=self, trans=self, h=helpers, util=util, request=self.request, response=self.response, app=self.app )
data.update( self.template_context )
data.update( kwargs )
return template.render( **data )
def stream_template_mako( self, filename, **kwargs ):
template = self.webapp.mako_template_lookup.get_template( filename )
- template.output_encoding = 'utf-8'
+ template.output_encoding = 'utf-8'
data = dict( caller=self, t=self, trans=self, h=helpers, util=util, request=self.request, response=self.response, app=self.app )
data.update( self.template_context )
data.update( kwargs )
@@ -808,31 +807,31 @@
dbnames = list()
datasets = self.sa_session.query( self.app.model.HistoryDatasetAssociation ) \
.filter_by( deleted=False, history_id=self.history.id, extension="len" )
-
+
for dataset in datasets:
dbnames.append( (dataset.dbkey, dataset.name) )
-
+
user = self.get_user()
if user and 'dbkeys' in user.preferences:
user_keys = from_json_string( user.preferences['dbkeys'] )
for key, chrom_dict in user_keys.iteritems():
dbnames.append((key, "%s (%s) [Custom]" % (chrom_dict['name'], key) ))
-
+
dbnames.extend( util.dbnames )
return dbnames
@property
def ucsc_builds( self ):
return util.dlnames['ucsc']
-
+
@property
def ensembl_builds( self ):
return util.dlnames['ensembl']
-
+
@property
def ncbi_builds( self ):
return util.dlnames['ncbi']
-
+
def db_dataset_for( self, dbkey ):
"""
Returns the db_file dataset associated/needed by `dataset`, or `None`.
@@ -855,7 +854,7 @@
if self.sa_session.query( self.app.model.RequestType ).filter_by( deleted=False ).count() > 0:
return True
return False
-
+
class FormBuilder( object ):
"""
Simple class describing an HTML form
@@ -875,7 +874,7 @@
def add_password( self, name, label, value=None, error=None, help=None ):
return self.add_input( 'password', label, name, value, error, help )
def add_select( self, name, label, value=None, options=[], error=None, help=None, use_label=True ):
- self.inputs.append( SelectInput( name, label, value=value, options=options, error=error, help=help, use_label=use_label ) )
+ self.inputs.append( SelectInput( name, label, value=value, options=options, error=error, help=help, use_label=use_label ) )
return self
class FormInput( object ):
@@ -893,7 +892,7 @@
class GalaxyWebAPITransaction( GalaxyWebTransaction ):
"""
- TODO: Unify this with WebUITransaction, since we allow session auth now.
+ TODO: Unify this with WebUITransaction, since we allow session auth now.
Enable functionality of 'create' parameter in parent _ensure_valid_session
"""
def __init__( self, environ, app, webapp, session_cookie):
@@ -915,7 +914,7 @@
# Decode the cookie value to get the session_key
session_key = self.security.decode_guid( secure_id )
try:
- # Make sure we have a valid UTF-8 string
+ # Make sure we have a valid UTF-8 string
session_key = session_key.encode( 'utf8' )
except UnicodeDecodeError:
# We'll end up creating a new galaxy_session
@@ -991,7 +990,7 @@
dbnames.append((key, "%s (%s) [Custom]" % (chrom_dict['name'], key) ))
dbnames.extend( util.dbnames )
return dbnames
-
+
@property
def ucsc_builds( self ):
return util.dlnames['ucsc']
@@ -1029,7 +1028,7 @@
def __init__( self, name, label, value=None, options=[], error=None, help=None, use_label=True ):
FormInput.__init__( self, "select", name, label, value=value, error=error, help=help, use_label=use_label )
self.options = options
-
+
class FormData( object ):
"""
Class for passing data about a form to a template, very rudimentary, could
@@ -1038,7 +1037,7 @@
def __init__( self ):
self.values = Bunch()
self.errors = Bunch()
-
+
class Bunch( dict ):
"""
Bunch based on a 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: Boto bumped to 2.5.2, async cloudlaunch update with downloadable keys and basic cluster picker.
by Bitbucket 12 Sep '12
by Bitbucket 12 Sep '12
12 Sep '12
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/changeset/93a04e500eb4/
changeset: 93a04e500eb4
user: dannon
date: 2012-09-12 18:51:56
summary: Boto bumped to 2.5.2, async cloudlaunch update with downloadable keys and basic cluster picker.
affected #: 3 files
diff -r e2cb958b3f7596744bb08febc858fa25139fd1ac -r 93a04e500eb464b7dd7c0dba565b60661307e94b eggs.ini
--- a/eggs.ini
+++ b/eggs.ini
@@ -33,7 +33,7 @@
[eggs:noplatform]
amqplib = 0.6.1
Beaker = 1.4
-boto = 2.2.2
+boto = 2.5.2
decorator = 3.1.2
docutils = 0.7
drmaa = 0.4b3
diff -r e2cb958b3f7596744bb08febc858fa25139fd1ac -r 93a04e500eb464b7dd7c0dba565b60661307e94b lib/galaxy/web/controllers/cloudlaunch.py
--- a/lib/galaxy/web/controllers/cloudlaunch.py
+++ b/lib/galaxy/web/controllers/cloudlaunch.py
@@ -8,38 +8,77 @@
import datetime
import logging
+import os
+import tempfile
import time
+import boto
+import pkg_resources
from galaxy import eggs
-import pkg_resources
pkg_resources.require('boto')
-import boto
from galaxy import web
from galaxy.web.base.controller import BaseUIController
+from galaxy.util.json import to_json_string
from boto.ec2.regioninfo import RegionInfo
from boto.exception import EC2ResponseError
+from boto.s3.connection import OrdinaryCallingFormat, S3Connection
+
log = logging.getLogger(__name__)
+PKEY_PREFIX = 'gxy_pkey'
+DEFAULT_KEYPAIR = 'deleteme_keypair'
+DEFAULT_AMI = 'ami-da58aab3'
+
class CloudController(BaseUIController):
+
def __init__(self, app):
BaseUIController.__init__(self, app)
@web.expose
def index(self, trans, share_string=None):
- return trans.fill_template("cloud/index.mako", share_string=share_string)
+ return trans.fill_template("cloud/index.mako", default_keypair = DEFAULT_KEYPAIR, share_string=share_string)
@web.expose
- def launch_instance(self, trans, cluster_name, password, key_id, secret, instance_type, share_string):
+ def get_account_info(self, trans, key_id, secret, **kwargs):
+ """
+ Get EC2 Account Info
+ """
+ #Keypairs
+ account_info = {}
+ try:
+ ec2_conn = connect_ec2(key_id, secret)
+ kps = ec2_conn.get_all_key_pairs()
+ except EC2ResponseError, e:
+ log.error("Problem starting an instance: %s\n%s" % (e, e.body))
+ account_info['keypairs'] = [akp.name for akp in kps]
+ #Existing Clusters
+ s3_conn = S3Connection(key_id, secret, calling_format=OrdinaryCallingFormat())
+ buckets = s3_conn.get_all_buckets()
+ clusters = []
+ for bucket in buckets:
+ pd = bucket.get_key('persistent_data.yaml')
+ if pd:
+ # This is a cloudman bucket.
+ # We need to get persistent data, and the cluster name.
+ for key in bucket.list():
+ if key.name.endswith('.clusterName'):
+ clusters.append({'name':key.name.split('.clusterName')[0], 'persistent_data': pd.get_contents_as_string()})
+ account_info['clusters'] = clusters
+ return to_json_string(account_info)
+
+ @web.expose
+ def launch_instance(self, trans, cluster_name, password, key_id, secret, instance_type, share_string, keypair, **kwargs):
ec2_error = None
try:
# Create security group & key pair used when starting an instance
ec2_conn = connect_ec2(key_id, secret)
sg_name = create_cm_security_group(ec2_conn)
- kp_name, kp_material = create_key_pair(ec2_conn)
+ kp_name, kp_material = create_key_pair(ec2_conn, key_name=keypair)
except EC2ResponseError, err:
ec2_error = err.error_message
if ec2_error:
- return trans.fill_template("cloud/run.mako", error = ec2_error)
+ #return trans.fill_template("cloud/run.mako", error = ec2_error)
+ return {'errors':[ec2_error]}
else:
user_provided_data={'cluster_name':cluster_name,
'access_key':key_id,
@@ -62,13 +101,41 @@
instance.update()
ct +=1
time.sleep(1)
- return trans.fill_template("cloud/run.mako",
- instance = rs.instances[0],
- kp_name = kp_name,
- kp_material = kp_material)
+ if kp_material:
+ #We have created a keypair. Save to tempfile for one time retrieval.
+ (fd, fname) = tempfile.mkstemp(prefix=PKEY_PREFIX, dir=trans.app.config.new_file_path)
+ f = os.fdopen(fd, 'wt')
+ f.write(kp_material)
+ f.close()
+ kp_material_tag = fname[fname.rfind(PKEY_PREFIX) + len(PKEY_PREFIX):]
+ else:
+ kp_material_tag = None
+ return to_json_string({
+ 'cluster_name': cluster_name,
+ 'instance_id': rs.instances[0].id,
+ 'image_id': rs.instances[0].image_id,
+ 'public_dns_name': rs.instances[0].public_dns_name,
+ 'kp_name': kp_name,
+ 'kp_material_tag':kp_material_tag
+ })
else:
- return trans.fill_template("cloud/run.mako",
- error = "Instance failure, but no specific error was detected. Please check your AWS Console.")
+ return {'errors':["Instance failure, but no specific error was detected. Please check your AWS Console."]}
+
+ @web.expose
+ def get_pkey(self, trans, kp_material_tag=None):
+ if kp_material_tag:
+ expected_path = os.path.join(trans.app.config.new_file_path, PKEY_PREFIX + kp_material_tag)
+ if os.path.exists(expected_path):
+ f = open(expected_path)
+ kp_material = f.read()
+ f.close()
+ trans.response.headers['Content-Length'] = int( os.stat( expected_path ).st_size )
+ trans.response.set_content_type( "application/octet-stream" ) #force octet-stream so Safari doesn't append mime extensions to filename
+ trans.response.headers["Content-Disposition"] = 'attachment; filename="%s.pem"' % DEFAULT_KEYPAIR
+ os.remove(expected_path)
+ return kp_material
+ trans.response.status = 400
+ return "Invalid identifier"
# ## Cloud interaction methods
def connect_ec2(a_key, s_key):
@@ -150,7 +217,7 @@
return True
return False
-def create_key_pair(ec2_conn, key_name='cloudman_key_pair'):
+def create_key_pair(ec2_conn, key_name=DEFAULT_KEYPAIR):
""" Create a key pair with the provided name.
Return the name of the key or None if there was an error creating the key.
"""
@@ -169,8 +236,8 @@
return None, None
return kp.name, kp.material
-def run_instance(ec2_conn, user_provided_data, image_id='ami-da58aab3',
- kernel_id=None, ramdisk_id=None, key_name='cloudman_key_pair',
+def run_instance(ec2_conn, user_provided_data, image_id=DEFAULT_AMI,
+ kernel_id=None, ramdisk_id=None, key_name=DEFAULT_KEYPAIR,
security_groups=['CloudMan']):
""" Start an instance. If instance start was OK, return the ResultSet object
else return None.
diff -r e2cb958b3f7596744bb08febc858fa25139fd1ac -r 93a04e500eb464b7dd7c0dba565b60661307e94b templates/cloud/index.mako
--- a/templates/cloud/index.mako
+++ b/templates/cloud/index.mako
@@ -27,6 +27,9 @@
#ec_button_container{
float:right;
}
+ #hidden_options{
+ display:none;
+ }
div.toolForm{
margin-top: 10px;
margin-bottom: 10px;
@@ -45,57 +48,215 @@
.workflow-annotation {
margin-bottom: 1em;
}
+ #loading_indicator{
+ position:fixed;
+ top:40px;
+ }
</style></%def>
+<%def name="javascripts()">
+ ${parent.javascripts()}
+ <script type="text/javascript">
+ var ACCOUNT_URL = "${h.url_for( controller='/cloudlaunch', action='get_account_info')}";
+ var PKEY_DL_URL = "${h.url_for( controller='/cloudlaunch', action='get_pkey')}";
+ $(document).ready(function(){
+ $('#id_existing_instance').change(function(){
+ var ei_name = $(this).val();
+ if (ei_name === "New Cluster"){
+ //For new instances, need to see the cluster name field.
+ $('#id_cluster_name').val("New Cluster")
+ $('#cluster_name_wrapper').show('fast');
+ }else{
+ //Hide the Cluster Name field, but set the value
+ $('#id_cluster_name').val($(this).val());
+ $('#cluster_name_wrapper').hide('fast');
+ }
+ });
+ //When id_secret and id_key are complete, submit to get_account_info
+ $("#id_secret, #id_key_id").bind("change paste keyup", function(){
+ secret_el = $("#id_secret");
+ key_el = $("#id_key_id");
+ if (secret_el.val().length === 40 && key_el.val().length === 20){
+ //Submit these to get_account_info, unhide fields, and update as appropriate
+ $.getJSON(ACCOUNT_URL,
+ {key_id: key_el.val(),secret:secret_el.val()},
+ function(result){
+ var kplist = $("#id_keypair");
+ var clusterlist = $("#id_existing_instance");
+ kplist.find('option').remove();
+ clusterlist.find('option').remove();
+ //Update fields with appropriate elements
+ if (_.size(result.clusters) > 0){
+ clusterlist.append($('<option/>').val('New Cluster').text('New Cluster'));
+ _.each(result.clusters, function(cluster, index){
+ clusterlist.append($('<option/>').val(cluster.name).text(cluster.name));
+ });
+ $('#existing_instance_wrapper').show();
+ }
+ if (!_.include(result.keypairs, '${default_keypair}')){
+ kplist.append($('<option/>').val('${default_keypair}').text('Create New - ${default_keypair}'));
+ }
+ _.each(result.keypairs, function(keypair, index){
+ kplist.append($('<option/>').val(keypair).text(keypair));
+ });
+ $('#hidden_options').show('fast');
+ });
+ }
+ });
+ $('#loading_indicator').ajaxStart(function(){
+ $(this).show('fast');
+ }).ajaxStop(function(){
+ $(this).hide('fast');
+ });
+ $('form').ajaxForm({
+ type: 'POST',
+ dataType: 'json',
+ beforeSubmit: function(data){
+ //Hide the form, show pending box with spinner.
+ $('#launchFormContainer').hide('fast');
+ $('#responsePanel').show('fast');
+ },
+ success: function(data){
+ //Success Message, link to key download if required, link to server itself.
+ $('#launchPending').hide('fast');
+ //Check for success/error.
+ if (data.error){
+ //Apologize profusely.
+ $("launchPending").hide();
+ $("#launchError").show();
+ }else{
+ //Set appropriate fields (dns, key, ami) and then display.
+ if(data.kp_material_tag){
+ var kp_download_link = $('<a/>').attr('href', PKEY_DL_URL + '?kp_material_tag=' + data.kp_material_tag)
+ .attr('target','_blank')
+ .text("Download your key now");
+ $('#keypairInfo').append(kp_download_link);
+ $('#keypairInfo').show();
+ }
+ $('.kp_name').text(data.kp_name);
+ $('#instance_id').text(data.instance_id);
+ $('#image_id').text(data.image_id);
+ $('#instance_link').html($('<a/>')
+ .attr('href', 'http://' + data.public_dns_name + '/cloud')
+ .attr('target','_blank')
+ .text(data.public_dns_name + '/cloud'));
+ $('#instance_dns').text(data.public_dns_name);
+ $('#launchSuccess').show('fast');
+ }
+ }
+ });
+ });
+ </script>
+</%def><%def name="center_panel()"><div style="overflow: auto; height: 100%;"><div class="page-container" style="padding: 10px;">
+ <div id="loading_indicator"></div><h2>Launch a Galaxy Cloud Instance</h2>
- <div class="toolForm">
- <form action="${h.url_for( controller='cloudlaunch', action='launch_instance' )}" method="post">
- <div class="form-row">
- <label for="id_cluster_name">Cluster Name</label>
- <input type="text" size="40" name="cluster_name" id="id_cluster_name"/><br/>
- </div>
- <div class="form-row">
- <label for="id_password">Password</label>
- <input type="password" size="40" name="password" id="id_password"/><br/>
- </div>
+ <div id="launchFormContainer" class="toolForm">
+ <form id="cloudlaunch_form" action="${h.url_for( controller='/cloudlaunch', action='launch_instance')}" method="post">
+
+ <p>To launch a Galaxy Cloud Cluster, enter your AWS Secret Key ID, and Secret Key. Galaxy will use these to present appropriate
+options for launching your cluster.</p>
+
<div class="form-row"><label for="id_key_id">Key ID</label>
- <input type="text" size="40" name="key_id" id="id_key_id"/><br/>
+ <input type="text" size="30" maxlength="20" name="key_id" id="id_key_id" value=""/><br/>
+ <div class="toolParamHelp">
+ This is the text string that uniquely identifies your account, found in the <a
+href="https://portal.aws.amazon.com/gp/aws/securityCredentials">Security Credentials section of the AWS
+Console</a>.
+ </div></div>
+
<div class="form-row"><label for="id_secret">Secret Key</label>
- <input type="password" size="120" name="secret" id="id_secret"/><br/>
+ <input type="text" size="50" maxlength="40" name="secret" id="id_secret" value=""/><br/>
+ <div class="toolParamHelp">
+ This is your AWS Secret Key, also found in the <a href="https://portal.aws.amazon.com/gp/aws/securityCredentials">Security
+Credentials section of the AWS Console</a>. </div></div>
- %if share_string:
- <input type='hidden' name='share_string' value='${share_string}'/>
- %else:
- <div class="form-row">
- <label for="id_share_string">Instance Share String (optional)</label>
- <input type="text" size="120" name="share_string" id="id_share_string"/><br/>
+
+ <div id="hidden_options">
+ <div id='existing_instance_wrapper' style="display:none;" class="form-row">
+ <label for="id_existing_instance">Instances in your account</label>
+ <select name="existing_instance" id="id_existing_instance">
+ </select>
+ </div>
+ <div id='cluster_name_wrapper' class="form-row">
+ <label for="id_cluster_name">Cluster Name</label>
+ <input type="text" size="40" class="text-and-autocomplete-select" name="cluster_name" id="id_cluster_name"/><br/>
+ <div class="toolParamHelp">
+ This is the name for your cluster. You'll use this when you want to restart.
+ </div>
+ </div>
+
+ <div class="form-row">
+ <label for="id_password">Cluster Password</label>
+ <input type="password" size="40" name="password" id="id_password"/><br/>
+ </div>
+
+ <div class="form-row">
+ <label for="id_keypair">Key Pair</label>
+ <select name="keypair" id="id_keypair">
+ <option name="Create" value="cloudman_keypair">cloudman_keypair</option>
+ </select>
+ </div>
+
+ %if share_string:
+ <input type='hidden' name='share_string' value='${share_string}'/>
+ %else:
+ <div class="form-row">
+ <label for="id_share_string">Instance Share String (optional)</label>
+ <input type="text" size="120" name="share_string" id="id_share_string"/><br/>
+ </div>
+ %endif
+ <div class="form-row">
+ <label for="id_instance_type">Instance Type</label>
+ <select name="instance_type" id="id_instance_type">
+ <option value="m1.large">Large</option>
+ <option value="m1.xlarge">Extra Large</option>
+ <option value="m2.4xlarge">High-Memory Quadruple Extra Large</option>
+ </select>
+ </div>
+ <div class="form-row">
+ <p>Requesting the instance may take a moment, please be patient. Do not refresh your browser or navigate away from the page</p>
+ <input type="submit" value="Submit" id="id_submit"/>
+ </div></div>
- %endif
- <div class="form-row">
- <label for="id_instance_type">Instance Type</label>
- <select name="instance_type" id="id_instance_type">
- <option value="m1.large">Large</option>
- <option value="t1.micro">Micro</option>
- <option value="m1.xlarge">Extra Large</option>
- <option value="m2.4xlarge">High-Memory Quadruple Extra Large</option>
- </select>
- </div>
- <div class="form-row">
- <p>Requesting the instance may take a moment, please be patient. Do not refresh your browser or navigate away from the page</p>
- <input type="submit" value="Submit" id="id_submit"/>
- </div>
+ <div class="form-row">
+ <div id="loading_indicator" style="position:relative;left:10px;right:0px"></div>
+ </div></form></div>
+ <div id="responsePanel" class="toolForm" style="display:none;">
+ <div id="launchPending">Launch Pending, please be patient.</div>
+ <div id="launchError" style="display:none;">ERROR</div>
+ <div id="launchSuccess" style="display:none;">
+ <div id="keypairInfo" style="display:none;margin-bottom:20px;">
+ <h3>Very Important Key Pair Information</h3>
+ <p>A new key pair named <strong><span class="kp_name">kp_name</span></strong> has been created in your AWS
+ account and will be used to access this instance via ssh. It is
+ <strong>very important</strong> that you save the following private key
+ as it is not saved on this Galaxy instance and will be permanently lost if not saved. Additionally, this link will
+ only allow a single download, after which the key is removed from the Galaxy server permanently.<br/>
+ </div>
+ <div>
+ <h3>Access Information</h3>
+ <ul>
+ <li>Your instance '<span id="instance_id">undefined</span>' has been successfully launched using the
+ '<span id="image_id">undefined</span>' AMI.</li>
+ <li>While it may take a few moments to boot, you will be able to access the cloud control
+ panel at <span id="instance_link">undefined.</span>.</li>
+ <li>SSH access is also available using your private key. From the terminal, you would execute something like:</br> `ssh -i <span class="kp_name">undefined</span>.pem ubuntu@<span
+id="instance_dns">undefined</span>`</li>
+ </ul>
+ </div>
+ </div></div></div></%def>
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