Changeset View
Changeset View
Standalone View
Standalone View
swh/web/ui/templates/upload_and_search.html
Show First 20 Lines • Show All 49 Lines • ▼ Show 20 Lines | <div class="container"> | ||||
style="display:none" | style="display:none" | ||||
placeholder="File(s) to upload, hash and search for SHA-1 or SHA-256 checksum" /> | placeholder="File(s) to upload, hash and search for SHA-1 or SHA-256 checksum" /> | ||||
{% if search_stats is not none and search_stats %} | {% if search_stats is not none and search_stats %} | ||||
<label id="stats"> | <label id="stats"> | ||||
Files available in SWH: {{ '%.2f' | format(search_stats['pct']) }}% of | Files available in SWH: {{ '%.2f' | format(search_stats['pct']) }}% of | ||||
{{ search_stats['nbfiles'] }} files. | {{ search_stats['nbfiles'] }} files. | ||||
</label> | </label> | ||||
{% endif %} | {% endif %} | ||||
{% if responses is not none and responses %} | {% if search_res is not none %} | ||||
<table id="results" class="table table-striped"> | <table id="results" class="table table-striped"> | ||||
<thead class="thead-default"> | <thead class="thead-default"> | ||||
<th>File name</th> | <th>File name</th> | ||||
<th>SHA1 checksum</th> | <th>SHA1 checksum</th> | ||||
<th>Result</th> | <th>Result</th> | ||||
</thead> | </thead> | ||||
{% for resp in responses %} | {% for res in search_res %} | ||||
<tr> | <tr> | ||||
<td>{{ resp['filename'] }}</td> | {% if res['filename'] is not none %} | ||||
{% if resp['found'] %} | <td>{{ res['filename'] }}</td> | ||||
<td><a href="{{ url_for('browse_content') }}sha1:{{ resp['sha1'] }}">{{ resp['sha1'] }}</a></td> | {% else %} | ||||
<td>From text input</td> | |||||
{% endif %} | |||||
{% if res['found'] %} | |||||
<td><a href="{{ url_for('browse_content') }}sha1:{{ res['sha1'] }}">{{ res['sha1'] }}</a></td> | |||||
<td><span class="glyphicon glyphicon-ok file-found"></span></td> | <td><span class="glyphicon glyphicon-ok file-found"></span></td> | ||||
{% else %} | {% else %} | ||||
<td>{{ resp['sha1'] }}</td> | <td>{{ res['sha1'] }}</td> | ||||
<td><span class="glyphicon glyphicon-remove file-notfound"></span></td> | <td><span class="glyphicon glyphicon-remove file-notfound"></span></td> | ||||
{% endif %} | {% endif %} | ||||
</tr> | </tr> | ||||
{% endfor %} | {% endfor %} | ||||
</table> | </table> | ||||
{% endif %} | {% endif %} | ||||
{% if messages is not none and messages %} | {% if messages is not none and messages %} | ||||
<div id="messages" class="row"> | <div id="messages" class="row"> | ||||
{% for message in messages %} | {% for message in messages %} | ||||
<br /> | <br /> | ||||
<div class="span8">{{ message | safe }}</div> | <div class="span8">{{ message | safe }}</div> | ||||
{% endfor %} | {% endfor %} | ||||
</div> | </div> | ||||
{% endif %} | {% endif %} | ||||
<!-- jQuery setup --> | <!-- jQuery setup --> | ||||
<div id="test"></div> | <div id="test"></div> | ||||
<script> | <script> | ||||
// Delegate dropbox click | // Delegate dropbox click | ||||
$("#fileinput").inputclick($("#fileElem")); | $("#fileinput").inputclick($("#fileElem")); | ||||
// Make the dropbox available for drag & drop | // Make the dropbox available for drag & drop | ||||
$("#fileElem").filedialog($("#filelist"), $("#searchForm")); | $("#fileElem").filedialog($("#filelist"), $("#searchForm")); | ||||
$("#fileinput").filedrop($("#filelist"), $("#searchForm")); | |||||
// Make the submission button receptive to files | // Make the submission button receptive to files | ||||
$("#fileinput").filedrop($("#filelist"), $("#searchForm")); | |||||
</script> | </script> | ||||
</div> | </div> | ||||
{% endblock %} | {% endblock %} |