Commit 82248bc5 authored by Jerome Mariette's avatar Jerome Mariette
Browse files

fix bug with inputfile within a multiple type

parent dc46abaf
......@@ -79,7 +79,7 @@ cherrypy.tools.CORS = cherrypy.Tool('before_finalize', CORS)
class JFlowServer (object):
MULTIPLE_TYPE_SPLITER = "._."
MULTIPLE_TYPE_SPLITER = "___"
JFLOW_WDATA = "data"
def __init__(self):
......@@ -152,7 +152,7 @@ class JFlowServer (object):
@jsonify
def get_available_workflows(self, **kwargs):
workflows = []
wf_instances = self.wfmanager.get_available_workflows()
wf_instances, wf_methodes = self.wfmanager.get_available_workflows()
for instance in wf_instances:
parameters, parameters_per_groups, groups = [], {}, ["default"]
for param in instance.get_parameters():
......
......@@ -30,7 +30,20 @@
$element.addClass(errorClass).removeClass(validClass);
// add the bootstrap error class
if ($element.parent().parent("blockquote").find("div").length > 0) {
if ($element.parent().parent().parent().parent("blockquote").find("div").length > 0) {
// if it's a multiple type
$element.parent().parent().parent().parent("blockquote").parent("div.controls").parent("div.control-group").addClass(errorClass);
// highlight append button as well
$element.parent().parent().parent().parent("blockquote").find("div.input-append").each(function() {
$(this).find(".btn").addClass("btn-danger");
$(this).find(".icon-calendar").addClass("icon-white");
$(this).find(".icon-search").addClass("icon-white");
});
//highlight prepend button as well
$element.parent().parent().parent().parent("blockquote").find("div.input-prepend").each(function() {
$(this).find(".btn").addClass("btn-danger");
});
} else if ($element.parent().parent("blockquote").find("div").length > 0) {
// if it's a multiple type
$element.parent().parent("blockquote").parent("div.controls").parent("div.control-group").addClass(errorClass);
// highlight append button as well
......@@ -76,6 +89,22 @@
$(this).find(".icon-calendar").removeClass("icon-white");
$(this).find(".icon-search").removeClass("icon-white");
});
$element.parent().parent("blockquote").find("div.input-prepend").each(function() {
$(this).find(".btn").removeClass("btn-danger");
});
}
} else if ($element.parent().parent().parent().parent("blockquote").find("div").length > 0) {
// if it's a multiple type, check if there is no other error
if ($element.parent().parent().parent().parent("blockquote").find("input." + errorClass).length == 0) {
$element.parents("div.control-group").removeClass(errorClass).addClass(validClass);
$element.parent().parent().parent().parent("blockquote").find("div.input-append").each(function() {
$(this).find(".btn").removeClass("btn-danger");
$(this).find(".icon-calendar").removeClass("icon-white");
$(this).find(".icon-search").removeClass("icon-white");
});
$element.parent().parent().parent().parent("blockquote").find("div.input-prepend").each(function() {
$(this).find(".btn").removeClass("btn-danger");
});
}
} else if ($element.parents("div.control-group").find("input." + errorClass).length == 0) {
// Only remove the class if there are no other errors
......@@ -93,7 +122,9 @@
},
errorPlacement: function(error, element) {
error.addClass("help-block");
if (element.parent("div.input-append").parent("div.input-prepend").length > 0) {
if (element.parent("div.input-append").parent("div.input-prepend").parent("div.input-prepend").length > 0) {
error.insertAfter(element.parent("div.input-append").parent("div.input-prepend").parent("div.input-prepend"));
} else if (element.parent("div.input-append").parent("div.input-prepend").length > 0) {
error.insertAfter(element.parent("div.input-append").parent("div.input-prepend"));
} else if (element.parent("div.input-append").length > 0) {
error.insertAfter(element.parent("div.input-append"));
......@@ -583,6 +614,13 @@ jQuery.validator.addMethod("exclude_required", function(value, element, options)
// if param is an inputfile or just a browsefile
' {{if param.type == "inputfile" || param.type == "browsefile"}}',
' <input name="browse_${param.name}" id="browse_${param.name}" class="fileupload" type="file">',
// if it's a multiple type
' {{else param.type == "MultipleParameters"}}',
' {{each(spindex, sub_param) param.sub_parameters}}',
' {{if sub_param.type == "inputfile" || sub_param.type == "browsefile"}}',
' <input name="browse_${sub_param.name}" id="browse_${sub_param.name}" class="fileupload" type="file">',
' {{/if}}',
' {{/each}}',
' {{/if}}',
' {{/each}}',
' {{/each}}',
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment