Commit dae949ca authored by Celine Noirot's avatar Celine Noirot
Browse files

Remove useless lib

parent ac366bf3
......@@ -15,7 +15,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
import sys, re
import re
class GFF3Record:
"""
......
......@@ -26,7 +26,6 @@ __status__ = 'beta'
from collections import namedtuple
import sys
import struct
import os
import io
str = str
from codecs import getreader, getwriter
......
......@@ -30,8 +30,6 @@ import datetime
import logging
import traceback
from configparser import ConfigParser, NoOptionError
from inspect import getcallargs
from datetime import date as ddate
from collections import OrderedDict
......@@ -1373,8 +1371,9 @@ class Workflow(threading.Thread):
if parameter.rules is not None:
rules[parameter.name] = parameter.rules.split(";")
if isinstance(parameter, InputFileList) and parameter.name in user_params:
if len(set(user_params[parameter.name])) < len(user_params[parameter.name]):
raise RuleException("Error for parameter '" + parameter.name + "': some files are duplicated")
# if only one element, type is not a list and test doen't works
if isinstance(user_params[parameter.name],list) and len(set(user_params[parameter.name])) < len(user_params[parameter.name]):
raise RuleException("Error for parameter '" + parameter.name + "': some files are duplicated"+user_params[parameter.name]+":"+user_params[parameter.name]+" "+str(len(parameter)))
# Check rules:
for src_arg, arg_rules in rules.items():
......
......@@ -691,10 +691,10 @@ Handsontable.cellTypes["bootdate"] = Handsontable.BootstrapDateCell;
// trigger an event to specify the workflow is loaded
$this.$element.trigger('loaded.wfform', $this.workflow);
$this.$element.html("");
$.tmpl(
globalTemplate, {
$.tmpl(
globalTemplate, {
workflow: $this.workflow,
display_form_type: $this.options.displayFormType,
display_run_button: $this.options.displayRunButton,
display_reset_button: $this.options.displayResetButton,
parameters: $this.options.parameters,
......@@ -936,7 +936,7 @@ Handsontable.cellTypes["bootdate"] = Handsontable.BootstrapDateCell;
JflowBrowser.exec(fill_files, true);
return false;
})
$(".to-readonly").on("focusin", function(event) {
$(this).prop('readonly', true);
});
......@@ -1211,6 +1211,20 @@ Handsontable.cellTypes["bootdate"] = Handsontable.BootstrapDateCell;
if($("[id^=handsontable_]").length == 0) {
params = JflowWfformRules.check_parameters_rules($this.workflow.parameters, $this);
}
if ($this.options.displayFormType == "collapse") {
$('.btn-moreless').click(function () {
var $this = $(this);
if($this.children().hasClass('glyphicon-chevron-down'))
{
$this.html('<span class="glyphicon glyphicon-chevron-up"></span>');
}
else
{
$this.html('<span class="glyphicon glyphicon-chevron-down"></span>');
}
});
}
}
});
}
......@@ -1236,6 +1250,7 @@ Handsontable.cellTypes["bootdate"] = Handsontable.BootstrapDateCell;
}
WFForm.prototype._getParameterRule = function(param, server_url) {
var crule = {};
crule["mparam"] = param;
if (param.type == "int" && param.action == "append") {
......@@ -1249,11 +1264,10 @@ Handsontable.cellTypes["bootdate"] = Handsontable.BootstrapDateCell;
} else if (param.type.indexOf("browsefile") === 0) {
var size = param.type.split(SIZE_LIMIT_SPLITER)[1];
crule["maxfilesize"] = [this.getNbOctet(size), size];
// if it is not a known type, check from the custom ones, using the validate_field address
// if it's a input file list with choices
} else if (param.type.indexOf("inputfiles") === 0 && param.action == "append" && param.choices != "undefined") {
//ASK Jerome HowTo debug
crule['inputfiles'] = true;
console.log(param);
// if it is not a known type, check from the custom ones, using the validate_field address
} else if (param.type != "str" && param.type != "password" ) {
crule["remote"] = {
url: server_url + '/validate_field?callback=?',
......@@ -1331,7 +1345,24 @@ Handsontable.cellTypes["bootdate"] = Handsontable.BootstrapDateCell;
' {{each(gindex, group) workflow.groups}}',
' <fieldset>',
' {{if group != "default" }}',
' <legend>${group}</legend>',
' <div class="row"><div class="col-sm-8"><legend>',
' ${group}',
' </legend></div>',
' <div class="col-sm-4">',
' {{if display_form_type == "collapse"}}',
' <button class="btn btn-default btn-moreless" type="button" data-toggle="collapse" data-target="#collapse${gindex}" aria-expanded="false" aria-controls="collapse${gindex}">',
' {{if gindex <= 1 }}',
' <span class="glyphicon glyphicon-chevron-up"></span>',
' {{else}}',
' <span class="glyphicon glyphicon-chevron-down"></span>',
' {{/if}}',
' </button>',
' {{/if}}',
' </div>',
' </div>' ,
' {{/if}}',
' {{if display_form_type == "collapse"}}',
' <div id="collapse${gindex}" class="collapse {{if gindex <= 1 }} in{{/if}}">',
' {{/if}}',
' {{each(index, param) workflow.parameters_per_groups[group]}}',
// it the parameter has not already been settled
......@@ -1382,7 +1413,10 @@ Handsontable.cellTypes["bootdate"] = Handsontable.BootstrapDateCell;
' {{/if}}',
' {{/if}}',
' {{/each}}',
' </fieldset>',
' {{if display_form_type == "collapse"}}',
' </div>',
' {{/if}}',
' </fieldset>',
' {{/each}}',
' <fieldset>',
// for all workflow add the workflowClass
......@@ -1423,13 +1457,13 @@ Handsontable.cellTypes["bootdate"] = Handsontable.BootstrapDateCell;
' <input name="browse_${sub_param.name}" id="browse_${sub_param.name}" class="fileupload" type="file">',
' {{/if}}',
' {{/if}}',
' {{/each}}',
' {{/each}}',
' {{/if}}',
' {{/each}}',
' {{/each}}',
'</form>',
'<div id="progress"></div>'].join('\n');
$.fn.wfform.defaults = {
serverURL: "",
dateTemplate: [
......@@ -1455,9 +1489,9 @@ Handsontable.cellTypes["bootdate"] = Handsontable.BootstrapDateCell;
'{{/if}}',
' {{each(j, choice) param.choices}}',
' {{if choice == param.default}}',
' <option selected>${choice}</option>',
' <option {{if $.type(param.choices) === "object"}} value=${j} {{/if}} selected>${choice}</option>', //Add value= if choices is a dict
' {{else}}',
' <option>${choice}</option>',
' <option {{if $.type(param.choices) === "object"}} value=${j} {{/if}} >${choice}</option>',
' {{/if}}',
' {{/each}}',
' </select>',
......@@ -1567,6 +1601,7 @@ Handsontable.cellTypes["bootdate"] = Handsontable.BootstrapDateCell;
'{{/each}}',
'</dl>'].join('\n'),
workflowClass: null,
displayFormType: "default",
displayRunButton: true,
displayResetButton: true,
workflow: null,
......
This diff is collapsed.
Markdown is supported
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