form.html 4.13 KB
Newer Older
Ryan Herbert's avatar
Ryan Herbert committed
1
{{extend 'db_layout.html'}}
2
<form id="upload_form"  action="DB_ADDRESS/file/submit" enctype="multipart/form-data" method="post">
3

Ryan Herbert's avatar
Ryan Herbert committed
4
    {{ if source_module_active: }}
Ryan Herbert's avatar
Ryan Herbert committed
5
        <span>file source</span>
Ryan Herbert's avatar
Ryan Herbert committed
6 7 8 9 10
        <label for="source_computer">my computer</label>
        <input type="radio" id="source_computer" name="source" value="computer" onchange="db.toggle_file_source()"/>
        <label for="source_nfs">network</label>
        <input type="radio" id="source_nfs" name="source" value="nfs" onchange="db.toggle_file_source()" checked="checked" />
    {{pass}}
Ryan Herbert's avatar
Ryan Herbert committed
11
    <div {{if source_module_active:}} hidden {{pass}}>
12 13 14 15 16 17 18 19 20
        <select id="pre_process" name="pre_process" onChange="db.pre_process_onChange(this)" {{if source_module_active:}} disabled {{pass}}>
            <option required_files="1" value="0">no pre-process (1 file)</option>
            {{for row in pre_process_list :}}
                <option title="{{=row["info"]}}" required_files="{{=row["file"]}}" value="{{=row["id"]}}"
                    {{if 'file_id' in request.vars and row["id"]==files[0].pre_process_id :}}selected{{pass}}>
                    {{=row["id"]}} &ndash; {{=row["name"]}}
                </option>
            {{pass}}
        </select>
Ryan Herbert's avatar
Ryan Herbert committed
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
    </div>
    <div>
        You must associate this sample with at least one patient, run or set.<br>You can also associate it with any combination of the three.
    </div>
    <div class="field_div">
        {{ if len(errors) > 0: }}
            <div class="error">{{=", ".join(errors)}}</div>
        {{ pass }}
        <label for="set_ids" id="set_ids__label">sets: </label>
        <div class="token_div form-control" onclick="$('#token_input').focus()">
            <input
                hidden
                id="file_set_list"
                name="set_ids"
                type="text"
                value="{{=",".join([set['id'] for set in sets])}}">
            <div id="set_div" class="token_container">
                {{ for set in sets: }}
                    <span class="set_token {{=set['type']}}_token" data-set-id="{{=set['id']}}">
                        <i class="icon-cancel" onclick="new Tokeniser(document.getElementById('set_div'), document.getElementById('file_set_list')).removeToken(this.parentNode);"></i>
                        {{=set['id'][3:]}}
                    </span>
                {{pass}}
44
            </div>
Ryan Herbert's avatar
Ryan Herbert committed
45 46 47 48 49 50 51 52 53 54 55
            <input
                id="token_input"
                class="token_input"
                autocomplete="off"
                onfocus="new VidjilAutoComplete().setupSamples(this);
                new Tokeniser(document.getElementById('set_div'), document.getElementById('file_set_list'));"
                data-needs-atwho="true"
                data-needs-tokeniser="true"
                data-group-ids="{{=upload_group_ids}}"
                data-keys='["generic", "patient", "run"]'
                type="text">
56
        </div>
Ryan Herbert's avatar
Ryan Herbert committed
57
    </div>
58 59
    <div id="fieldset_container">
        {{ for i, file in enumerate(files): }}
Ryan Herbert's avatar
Ryan Herbert committed
60
            <div class="clear"></div>
61 62 63
            {{ include 'partial/file/form.html' }}
        {{ pass }}
    </div>
Ryan Herbert's avatar
Ryan Herbert committed
64
    <div class="clear"></div>
65
    <span class="button"
Ryan Herbert's avatar
Ryan Herbert committed
66
          onclick="add_file('fieldset_container', this.dataset.index++, {{=group_ids}})"
67
          id="file_button"
68
          data-index="{{=len(files)}}">add file</span>
69
    <div class="clear"></div>
70
    <input type="submit" value="Soumettre" class="btn">
Ryan Herbert's avatar
Ryan Herbert committed
71
</form>
Ryan Herbert's avatar
Ryan Herbert committed
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92

<div id="jstree_container" class="modal jstree-container">
    <span class="closeButton"
        onclick="db.close_jstree()">
        <i class="icon-cancel"></i>
    </span>
    <input type="hidden" id="file_filename" />
    <span>file:</span>
    <span id="file_indicator"></span>
    <div class="jstree" id="jstree_loader"
        {{if not source_module_active:}}
            hidden
        {{else:}}
            onload="db.set_jstree($('#jstree'))"
        {{pass}}>
        <div id="jstree"></div>
    </div>
    <span id="jstree_button" class="jstree_button button2" data-index=0 onclick="db.select_jstree($(this).data('index'))">ok</span>
    <span id="jstree_close" class="jstree_button button2" onclick="db.close_jstree()">cancel</span>
</div>

93
<div class="clear"></div>