diff --git a/lib/galaxy/webapps/galaxy/controllers/workflow.py b/lib/galaxy/webapps/galaxy/controllers/workflow.py index e08f3fc194a..9cfbabd94f0 100644 --- a/lib/galaxy/webapps/galaxy/controllers/workflow.py +++ b/lib/galaxy/webapps/galaxy/controllers/workflow.py @@ -2110,7 +2110,6 @@ def _expand_multiple_inputs(kwargs, mode): _split_inputs(kwargs, mode) # Build up every combination of inputs to be run together. - #input_combos = [single_inputs] input_combos = _extend_with_matched_combos(single_inputs, matched_multi_inputs) input_combos = _extend_with_multiplied_combos(input_combos, multiplied_multi_inputs) @@ -2172,17 +2171,18 @@ def _split_inputs(kwargs, mode): """ input_keys = filter(lambda a: a.endswith('|input'), kwargs) single_inputs = {} - multi_inputs = {} + matched_multi_inputs = {} + multiplied_multi_inputs = {} for input_key in input_keys: input_val = kwargs[input_key] if isinstance(input_val, list): - multi_inputs[input_key] = input_val + input_base = input_key[:-len("|input")] + mode_key = "%s|multi_mode" % input_base + mode = kwargs.get(mode_key, "matched") + if mode == "matched": + matched_multi_inputs[input_key] = input_val + else: + multiplied_multi_inputs[input_key] = input_val else: single_inputs[input_key] = input_val - matched_multi_inputs = {} - multiplied_multi_inputs = {} - if mode == "product": - multiplied_multi_inputs = multi_inputs - else: - matched_multi_inputs = multi_inputs return (single_inputs, matched_multi_inputs, multiplied_multi_inputs) diff --git a/static/images/silk/link.png b/static/images/silk/link.png new file mode 100644 index 00000000000..25eacb7c252 Binary files /dev/null and b/static/images/silk/link.png differ diff --git a/static/images/silk/link_break.png b/static/images/silk/link_break.png new file mode 100644 index 00000000000..523575306d5 Binary files /dev/null and b/static/images/silk/link_break.png differ diff --git a/templates/webapps/galaxy/workflow/run.mako b/templates/webapps/galaxy/workflow/run.mako index 40852dc7527..72779d655c2 100644 --- a/templates/webapps/galaxy/workflow/run.mako +++ b/templates/webapps/galaxy/workflow/run.mako @@ -33,12 +33,12 @@ } else { select.val($('option:last', select).val()); } + select.siblings('img').hide(); select.removeAttr('multiple').removeAttr('size'); placeholder = 'type to filter'; } else { - // Comment out the following line to multiple batch input workflows in UI. - $('.multiinput').addClass('disabled'); $('.multiinput', select.closest('.form-row')).removeClass('disabled'); + select.siblings('img').show(); select.attr('multiple', 'multiple').attr('size', 8); placeholder = 'type to filter, [enter] to select all'; } @@ -126,6 +126,57 @@ select.after(filter); select.width(new_width); }); + + // Augment hidden fields with icons. + // http://stackoverflow.com/a/2088430 + var imgOn='${h.url_for("/static/images/silk/link.png")}'; + var imgOff='${h.url_for("/static/images/silk/link_break.png")}'; + $(function(){ + $(".multi-mode").each(function(){ + if($(this).val() == "matched") { + $(this).before($(document.createElement("img")) + .attr({src:imgOn,title:'Checkbox', id:$(this).attr("id")}) + .css("display", $(this).css("display")) + .addClass("chkBoxImg")); + } else { + $(this).before($(document.createElement("img")) + .attr({src:imgOff, title:'Checkbox',id:$(this).attr("id")}) + .css("display", $(this).css("display")) + .addClass("chkBoxImg")); + } + }); + $("img.chkBoxImg").click(function(){ + i= $(this).siblings("input[type=hidden]"); + s=$(this).attr("src"); + if(s==imgOn) { + $(this).attr("src",imgOff); + $(i).val("product"); + } else { + $(this).attr("src",imgOn); + $(i).val("matched"); + } + }); + }); + $("#tool_form").submit(function(e) { + var matchLength = -1; + $('span.multiinput_wrap select[name*="|input"]').each(function() { + var value = $(this).val(); + if(value instanceof Array) { + // Multi-value + if($(this).siblings("input[type=hidden]").val() == "matched") { + var length = $(this).val().length; + if(matchLength == -1) { + matchLength = length; + } else if(length != matchLength) { + e.preventDefault(); + alert("Linked inputs must be submitted in equal number."); + return false; + } + } + } + }); + return true; + }); }); @@ -260,6 +311,7 @@ if wf_parms: %if step.type == 'data_input': ##Input Dataset Step, wrap for multiinput. + ${param.get_html_field( t, value, other_values ).get_html( str(step.id) + "|" + prefix )} %else: @@ -340,30 +392,6 @@ if wf_parms:
## - - - - %if wf_parms:
Workflow Parameters