<commit_before>﻿{% extends "baselayout.html" %}
{% load i18n %}
{% load bootstrap3 %}
{% load tagging_tags %}
{% load wrong_sign %}
{% block bootstrap3_title %}Signbank: Search Signs{% endblock %}
{% block extrahead %}
{% endblock %}

{% block extrajs %}

    <script type="text/javascript" src="{{ STATIC_URL }}js/typeahead.bundle.min.js"></script>
    <script type='text/javascript' src="{{ STATIC_URL }}js/gloss_search.js"></script>

    <script type='text/javascript'>
    
     $(document).ready(function(){
        
        
        $('.collapsetoggle').click(function() {
            if ($(this).text() == 'Show') {
                $(this).text('Hide');
            } else {
                $(this).text('Show');
            }
        });
        
    });



// http://www.javascript-coder.com/javascript-form/javascript-reset-form.phtml
function clearForm(myFormElement) {

  var elements = myFormElement.elements;

  myFormElement.reset();

  for(i=0; i<elements.length; i++) {

      field_type = elements[i].type.toLowerCase();
    
      switch(field_type) {
    
        case "text":
        case "password":
        case "textarea":
        case "hidden":
    
          elements[i].value = "";
          break;
    
        case "radio":
        case "checkbox":
            if (elements[i].checked) {
              elements[i].checked = false;
          }
          break;
    
        case "select-one":
        case "select-multiple":
                    elements[i].selectedIndex = -1;
          break;
    
        default:
          break;
      }
    }
    return(false);
}

/**
 * @param {string} field_name - name of the field to sort on
 * @param {string} action     - one of: desc, asc, del
 * @param {string} frmName    - name of the <form ...> that contains the 'sortOrder' <input> field
 * @returns {void}
 */
function do_sort_column(field_name, action, frmName) {
  // Combine @field_name and @action into [sOrder]
  var sOrder = field_name;
  if (action == 'desc') {
    // Descending sort order is signified by a '-' prefix
    sOrder = '-' + sOrder;
  } else if (action == 'del') {
    // "Deleting" (pressing 'x') the sort order of a column means: return to the default 'idgloss' sort order
    sOrder = 'idgloss';
  }

  // Set the value of the [sortOrder] field defined in dictionary/forms.py::GlossSearchForm
  $("#" + frmName + " input[name='sortOrder']").val(sOrder);

  // Submit the form with the indicated name
  $("#" + frmName).submit();
}

/**
 * @returns {void}
 */
function do_adminsearch(el) {
 var sSearchType = $(el).attr('value');
  $("#adminsearch input[name='search_type']").val(sSearchType);
  switch(sSearchType) {
    case "morpheme":
        $("#adminsearch").attr('action', '{{URL}}/morphemes/search/');
        break;
    case "sign":
        $("#adminsearch").attr('action', '{{URL}}/signs/search/');
        break;
    case "sign_or_morpheme":
        $("#adminsearch").attr('action', '{{URL}}/signs/search/');
        break;
  }
  document.getElementById('adminsearch').submit();
}

   </script>
{% endblock %}


{% block content %}
{% url 'dictionary:protected_media' '' as protected_media_url %}

{% if perms.dictionary.search_gloss %}
<div class="panel panel-default">
    <div class="panel-heading" data-toggle="collapse" data-target="#query-area">{% trans "Form your query" %}</div>

    <div id='query-area' class='collapse {% if not request.GET.search and not request.GET.keyword and not request.GET.englishGloss and not show_all %} in {% endif %}'>
        <div id='searchformwell' class='well search-results-collapsable'>
            <form name='adminsearch' id='adminsearch' method='get' action='{{URL}}/signs/search'>
                <!-- EK: A sort-order specification is in a hidden form field, which is filled by JS:do_sort_column() -->
                <div class="hidden">
                    <input name='sortOrder' class='form-control' value='idgloss' >
                    <input name='search_type' class='form-control' value='sign'>
                </div>
                <div>
                    <table class='table' id='searchfields'>
                        <tr>
                            <td><div class='input-group'>
                                <label class='input-group-addon' for='id_annotation_idgloss'>{{searchform.search.label}}</label>
                                <input name='search' class='form-control' {% if searchform.search.value %}value='{{searchform.search.value}}'{% endif %}></div>
                            </td>
                            {% if SEPARATE_ENGLISH_IDGLOSS_FIELD %}
                            <td><div class='input-group'>

                                <label class='input-group-addon' for='id_annotation_idgloss_en'>{{searchform.englishGloss.label}}</label>
                                <input name='englishGloss' class='form-control' {% if searchform.englishGloss.value %}value='{{searchform.englishGloss.value}}'{% endif %}></div>
                            </td>
                            {% endif %}

                            <td><div class='input-group'>
                                <label class='input-group-addon' for='id_keyword'>{{searchform.keyword.label}}</label>
                                <input name='keyword' class='form-control' {% if searchform.keyword.value %}value='{{searchform.keyword.value}}'{% endif %}></div>
                            </td>
                        </tr>
                    </table>
                </div>

                <div class="panel-group">
                    <div  class="panel panel-default">
                        <div class="panel-heading" data-toggle="collapse" data-target="#searchpanels">{% trans "Search by Language and Basic Properties" %}</div>

                        <div id='searchpanels' class='collapse'>
                        <table class='table'>
                              <tr>
                                <td>
                                    <div class='input-group'>
                                        <label class='input-group-addon' for='id_language'>{{searchform.language.label}}</label>
                                        {{searchform.language}}
                                    </div>
                                </td>
                                <td>
                                    <div class='input-group'>
                                        <label class='input-group-addon' for='id_dialect'>{{searchform.dialect.label}}</label>
                                        {{searchform.dialect}}
                                    </div>
                                </td>
                              </tr>

                        </table>

                        <table class='table'>
                            {% for fieldname,field,label in input_names_fields_and_labels.main %}

                                <tr><td><label for='id_{{fieldname}}'>{{label}}</label></td><td>{{field}}</td></tr>

                            {% endfor %}

                        </table>

                        </div>
                      </div>

                    <div  class="panel panel-default">
                      <div class="panel-heading" data-toggle="collapse" data-target="#morph_search">{% trans "Search by Morphology" %}</div>

                      <div id='morph_search' class='collapse'>
                      <table class='table table-condensed'>
                        <tr>

                          <td>
                            <table class='table table-condensed'>
                                <tr>
                                    <td><label for='id_morpheme'>{{searchform.morpheme.label}}</label></td>
                                    <td><input class='form-control morphtypeahead' placeholder='{% trans "Morpheme Gloss" %}' name='id_morpheme'></td>
                                </tr>
                                <tr><td><label for='id_hasComponentOfType'>{{searchform.hasComponentOfType.label}}</label></td><td>{{searchform.hasComponentOfType}}</td></tr>
                                <tr><td><label for='id_hasMorphemeOfType'>{{searchform.hasMorphemeOfType.label}}</label></td><td>{{searchform.hasMorphemeOfType}}</td></tr>
                            </table>

                          </td>
                        </tr>
                      </table>
                      </div>
                    </div>

                    <div  class="panel panel-default">
                      <div class="panel-heading" data-toggle="collapse" data-target="#phon_search">{% trans "Search by Phonology" %}</div>

                      <div id='phon_search' class='collapse'>
                      <table class='table table-condensed'>
                        <tr>

                          <td>
                            <table class='table table-condensed'>
                                {% for fieldname,field,label in input_names_fields_and_labels.phonology %}

                                    <tr><td><label for='id_{{fieldname}}'>{{label}}</label></td><td>{{field}}</td></tr>

                                {% endfor %}

                            </table>

                          </td>
                        </tr>
                      </table>
                      </div>
                    </div>

                    <div  class="panel panel-default">
                      <div class="panel-heading" data-toggle="collapse" data-target="#sem_search">{% trans "Search by Semantics" %}</div>

                      <div id='sem_search' class='collapse'>
                      <table class='table table-condensed'>
                        <tr>

                          <td>
                            <table class='table table-condensed'>
                                {% for fieldname,field,label in input_names_fields_and_labels.semantics %}

                                    <tr><td><label for='id_{{fieldname}}'>{{label}}</label></td><td>{{field}}</td></tr>

                                {% endfor %}



                            </table>

                          </td>
                        </tr>
                      </table>
                      </div>
                    </div>

                    <div  class="panel panel-default">
                      <div class="panel-heading" data-toggle="collapse" data-target="#rel_search">{% trans "Search by Relation" %}</div>

                      <div id='rel_search' class='collapse'>
                      <table class='table'>
                        <tr>

                              <tr>
                                <td>
                                    <div class='input-group'>
                                        <label class='input-group-addon' for='id_relation'>{{searchform.relation.label}}</label>
                                        {{searchform.relation}}
                                    </div>
                                </td>
                                <td>
                                    <div class='input-group'>
                                        <label class='input-group-addon' for='id_hasRelation'>{{searchform.hasRelation.label}}</label>
                                        {{searchform.hasRelation}}
                                    </div>
                                </td>
                              </tr>

                              <tr>
                                <td>
                                    <div class='input-group'>
                                        <label class='input-group-addon' for='id_relationToForeignSign'>{{searchform.relationToForeignSign.label}}</label>
                                        {{searchform.relationToForeignSign}}
                                    </div>
                                </td>

                                <td>
                                    <div class='input-group'>
                                        <label class='input-group-addon' for='id_hasRelationToForeignSign'>{{searchform.hasRelationToForeignSign.label}}</label>
                                        {{searchform.hasRelationToForeignSign}}
                                    </div>
                                </td>

                              </tr>


                        </tr>
                      </table>
                      </div>
                    </div>

                    <div  class="panel panel-default">
                      <div class="panel-heading" data-toggle="collapse" data-target="#pub_search">{% trans "Search by Publication Status and Notes" %}</div>

                      <div id='pub_search' class='collapse'>
                      <table class='table'>
                          <tr>
                            <td>
                                <div class='input-group'>
                                    <label class='input-group-addon' for='id_inWeb'>{{searchform.inWeb.label}}</label>
                                    {{searchform.inWeb}}
                                </div>
                            </td>
                            <td>
                                <div class='input-group'>
                                    <label class='input-group-addon' for='id_isNew'>{{searchform.isNew.label}}</label>
                                    {{searchform.isNew}}
                                </div>
                            </td>
                          </tr>

                          <tr>
                            <td>
                                <div class='input-group'>
                                    <label class='input-group-addon' for='id_definitionRole'>{{searchform.definitionRole.label}}</label>
                                    {{searchform.definitionRole}}
                                </div>
                            </td>
                            <td>
                                <div class='input-group'>
                                    <label class='input-group-addon' for='id_definitionContains'>{{searchform.definitionContains.label}}</label>
                                    {{searchform.definitionContains}}
                                </div>
                            </td>
                          </tr>

                          <tr>
                            <td>
                                <div class='input-group'>
                                    <label class='input-group-addon' for='id_definitionRole'>{{searchform.createdBefore.label}}</label>
                                    {{searchform.createdBefore}}
                                </div>
                            </td>
                            <td>
                                <div class='input-group'>
                                    <label class='input-group-addon' for='id_definitionContains'>{{searchform.createdAfter.label}}</label>
                                    {{searchform.createdAfter}}
                                </div>
                            </td>
                          </tr>


                          <tr>
                              <td>
                                  <div class='input-group'>
                                    <label class='input-group-addon' for='id_language'>{{searchform.tags.label}}</label>
                                    {{searchform.tags}}
                                  </div>
                              </td>
                          </tr>

                      </table>

                      </div>
                    </div>
                </div>

                <div class='btn-group'>
                    <!-- Make sure no button has the *name* 'submit', otherwise submit() cannot be used -->
                    <div class="btn-group">
                        <a class='btn btn-primary dropdown-toggle' data-toggle="dropdown" type='submit' name='submit_button'>
                            <span data-bind="label" onclick="do_adminsearch(this);"  name="search_type" value="sign">
                                {% if search_type == 'sign' %}
                                {% trans "Search sign" %}
                                {% else %}
                                {% trans "Search sign or morpheme" %}
                                {% endif %}
                            </span>&nbsp;<span class="caret"></span>
                        </a>
                        <ul class="dropdown-menu dropdown-menu-left">
                            <li><a href="#" onclick="do_adminsearch(this);" type='submit' name="search_type" value="sign">{% trans "Search sign" %}</a></li>
                            <li><a href="#" onclick="do_adminsearch(this);" type='submit' name="search_type" value="morpheme">{% trans "Search morpheme" %}</a></li>
                            <li><a href="#" onclick="do_adminsearch(this);" type='submit' name="search_type" value="sign_or_morpheme">{% trans "Sign or morpheme" %}</a></li>
                        </ul>
                    </div>

                    <!-- The element below adds an invisible submit option, so the 'button' above also works when enter is pressed -->
                    <input type="submit" style="visibility: hidden;" />

                    {% if perms.dictionary.export_csv %}
                    <input class='btn btn-default' type='submit' name='format' value='CSV'>
                    {% endif %}
                    <!--<input class='btn btn-default' type='submit' name='export_ecv' value='ECV'>-->
                    {% if perms.dictionary.export_ecv %}
                    <input class='btn btn-default' type='submit' name='export_ecv' value='ECV'>
                    {% endif %}
                    <input class='btn btn-default' type='submit' onclick="clearForm(document.adminsearch);" value='{% trans "Reset" %}'>
                </div>

                <div class='form-group' id='paginate_by'>
                <label for='paginate_by'>{% trans "Results per page" %}</label>
                <select class='form-control' name="paginate_by">
                    <option>3000</option>
                    <option>2000</option>
                    <option>1000</option>
                    <option>500</option>
                  <option>100</option>
                    <option>50</option>
                    <option>25</option>
                    <option>10</option>
                </select>
                </div>


            </form>

        </div>

    </div>

</div>
{% endif %}

{% if perms.dictionary.add_gloss %}
<div  class="panel panel-default">
  <div class="panel-heading" data-toggle="collapse"  data-target='#add_gloss_form'>{% trans "Add New Sign" %}</div>

     <div id='add_gloss_form' class='collapse'>
         <form action='{% url "dictionary:add_gloss" %}' method='post'>
             {% csrf_token %}
             <table class='table'>
                 <tr>
                     <th><label for='id_idgloss'>ID Gloss</label></th>
                     <th><label for='id_annotation_idgloss'>Annotation ID Gloss (Dutch)</label></th>
                     <th><label for='id_annotation_idgloss_en'>Annotation ID Gloss (English)</label></th>
                     <th></th>
                 </tr>
                 <tr>
                     <td>{{add_gloss_form.idgloss}}</td>
                     <td>{{add_gloss_form.annotation_idgloss}}</td><commit_msg>Took the button bar and page size drowpdown menu out of the collapsible query panel. #288<commit_after>﻿{% extends "baselayout.html" %}
{% load i18n %}
{% load bootstrap3 %}
{% load tagging_tags %}
{% load wrong_sign %}
{% block bootstrap3_title %}Signbank: Search Signs{% endblock %}
{% block extrahead %}
{% endblock %}

{% block extrajs %}

    <script type="text/javascript" src="{{ STATIC_URL }}js/typeahead.bundle.min.js"></script>
    <script type='text/javascript' src="{{ STATIC_URL }}js/gloss_search.js"></script>

    <script type='text/javascript'>
    
     $(document).ready(function(){
        
        
        $('.collapsetoggle').click(function() {
            if ($(this).text() == 'Show') {
                $(this).text('Hide');
            } else {
                $(this).text('Show');
            }
        });
        
    });



// http://www.javascript-coder.com/javascript-form/javascript-reset-form.phtml
function clearForm(myFormElement) {

  var elements = myFormElement.elements;

  myFormElement.reset();

  for(i=0; i<elements.length; i++) {

      field_type = elements[i].type.toLowerCase();
    
      switch(field_type) {
    
        case "text":
        case "password":
        case "textarea":
        case "hidden":
    
          elements[i].value = "";
          break;
    
        case "radio":
        case "checkbox":
            if (elements[i].checked) {
              elements[i].checked = false;
          }
          break;
    
        case "select-one":
        case "select-multiple":
                    elements[i].selectedIndex = -1;
          break;
    
        default:
          break;
      }
    }
    return(false);
}

/**
 * @param {string} field_name - name of the field to sort on
 * @param {string} action     - one of: desc, asc, del
 * @param {string} frmName    - name of the <form ...> that contains the 'sortOrder' <input> field
 * @returns {void}
 */
function do_sort_column(field_name, action, frmName) {
  // Combine @field_name and @action into [sOrder]
  var sOrder = field_name;
  if (action == 'desc') {
    // Descending sort order is signified by a '-' prefix
    sOrder = '-' + sOrder;
  } else if (action == 'del') {
    // "Deleting" (pressing 'x') the sort order of a column means: return to the default 'idgloss' sort order
    sOrder = 'idgloss';
  }

  // Set the value of the [sortOrder] field defined in dictionary/forms.py::GlossSearchForm
  $("#" + frmName + " input[name='sortOrder']").val(sOrder);

  // Submit the form with the indicated name
  $("#" + frmName).submit();
}

/**
 * @returns {void}
 */
function do_adminsearch(el) {
 var sSearchType = $(el).attr('value');
  $("#adminsearch input[name='search_type']").val(sSearchType);
  switch(sSearchType) {
    case "morpheme":
        $("#adminsearch").attr('action', '{{URL}}/morphemes/search/');
        break;
    case "sign":
        $("#adminsearch").attr('action', '{{URL}}/signs/search/');
        break;
    case "sign_or_morpheme":
        $("#adminsearch").attr('action', '{{URL}}/signs/search/');
        break;
  }
  document.getElementById('adminsearch').submit();
}

   </script>
{% endblock %}


{% block content %}
{% url 'dictionary:protected_media' '' as protected_media_url %}

{% if perms.dictionary.search_gloss %}
<form name='adminsearch' id='adminsearch' method='get' action='{{URL}}/signs/search'>
<div class="panel panel-default">
    <div class="panel-heading" data-toggle="collapse" data-target="#query-area">{% trans "Form your query" %}</div>

    <div id='query-area' class='collapse {% if not request.GET.search and not request.GET.keyword and not request.GET.englishGloss and not show_all %} in {% endif %}'>
        <div id='searchformwell' class='well search-results-collapsable'>

                <!-- EK: A sort-order specification is in a hidden form field, which is filled by JS:do_sort_column() -->
                <div class="hidden">
                    <input name='sortOrder' class='form-control' value='idgloss' >
                    <input name='search_type' class='form-control' value='sign'>
                </div>
                <div>
                    <table class='table' id='searchfields'>
                        <tr>
                            <td><div class='input-group'>
                                <label class='input-group-addon' for='id_annotation_idgloss'>{{searchform.search.label}}</label>
                                <input name='search' class='form-control' {% if searchform.search.value %}value='{{searchform.search.value}}'{% endif %}></div>
                            </td>
                            {% if SEPARATE_ENGLISH_IDGLOSS_FIELD %}
                            <td><div class='input-group'>

                                <label class='input-group-addon' for='id_annotation_idgloss_en'>{{searchform.englishGloss.label}}</label>
                                <input name='englishGloss' class='form-control' {% if searchform.englishGloss.value %}value='{{searchform.englishGloss.value}}'{% endif %}></div>
                            </td>
                            {% endif %}

                            <td><div class='input-group'>
                                <label class='input-group-addon' for='id_keyword'>{{searchform.keyword.label}}</label>
                                <input name='keyword' class='form-control' {% if searchform.keyword.value %}value='{{searchform.keyword.value}}'{% endif %}></div>
                            </td>
                        </tr>
                    </table>
                </div>

                <div class="panel-group">
                    <div  class="panel panel-default">
                        <div class="panel-heading" data-toggle="collapse" data-target="#searchpanels">{% trans "Search by Language and Basic Properties" %}</div>

                        <div id='searchpanels' class='collapse'>
                        <table class='table'>
                              <tr>
                                <td>
                                    <div class='input-group'>
                                        <label class='input-group-addon' for='id_language'>{{searchform.language.label}}</label>
                                        {{searchform.language}}
                                    </div>
                                </td>
                                <td>
                                    <div class='input-group'>
                                        <label class='input-group-addon' for='id_dialect'>{{searchform.dialect.label}}</label>
                                        {{searchform.dialect}}
                                    </div>
                                </td>
                              </tr>

                        </table>

                        <table class='table'>
                            {% for fieldname,field,label in input_names_fields_and_labels.main %}

                                <tr><td><label for='id_{{fieldname}}'>{{label}}</label></td><td>{{field}}</td></tr>

                            {% endfor %}

                        </table>

                        </div>
                      </div>

                    <div  class="panel panel-default">
                      <div class="panel-heading" data-toggle="collapse" data-target="#morph_search">{% trans "Search by Morphology" %}</div>

                      <div id='morph_search' class='collapse'>
                      <table class='table table-condensed'>
                        <tr>

                          <td>
                            <table class='table table-condensed'>
                                <tr>
                                    <td><label for='id_morpheme'>{{searchform.morpheme.label}}</label></td>
                                    <td><input class='form-control morphtypeahead' placeholder='{% trans "Morpheme Gloss" %}' name='id_morpheme'></td>
                                </tr>
                                <tr><td><label for='id_hasComponentOfType'>{{searchform.hasComponentOfType.label}}</label></td><td>{{searchform.hasComponentOfType}}</td></tr>
                                <tr><td><label for='id_hasMorphemeOfType'>{{searchform.hasMorphemeOfType.label}}</label></td><td>{{searchform.hasMorphemeOfType}}</td></tr>
                            </table>

                          </td>
                        </tr>
                      </table>
                      </div>
                    </div>

                    <div  class="panel panel-default">
                      <div class="panel-heading" data-toggle="collapse" data-target="#phon_search">{% trans "Search by Phonology" %}</div>

                      <div id='phon_search' class='collapse'>
                      <table class='table table-condensed'>
                        <tr>

                          <td>
                            <table class='table table-condensed'>
                                {% for fieldname,field,label in input_names_fields_and_labels.phonology %}

                                    <tr><td><label for='id_{{fieldname}}'>{{label}}</label></td><td>{{field}}</td></tr>

                                {% endfor %}

                            </table>

                          </td>
                        </tr>
                      </table>
                      </div>
                    </div>

                    <div  class="panel panel-default">
                      <div class="panel-heading" data-toggle="collapse" data-target="#sem_search">{% trans "Search by Semantics" %}</div>

                      <div id='sem_search' class='collapse'>
                      <table class='table table-condensed'>
                        <tr>

                          <td>
                            <table class='table table-condensed'>
                                {% for fieldname,field,label in input_names_fields_and_labels.semantics %}

                                    <tr><td><label for='id_{{fieldname}}'>{{label}}</label></td><td>{{field}}</td></tr>

                                {% endfor %}



                            </table>

                          </td>
                        </tr>
                      </table>
                      </div>
                    </div>

                    <div  class="panel panel-default">
                      <div class="panel-heading" data-toggle="collapse" data-target="#rel_search">{% trans "Search by Relation" %}</div>

                      <div id='rel_search' class='collapse'>
                      <table class='table'>
                        <tr>

                              <tr>
                                <td>
                                    <div class='input-group'>
                                        <label class='input-group-addon' for='id_relation'>{{searchform.relation.label}}</label>
                                        {{searchform.relation}}
                                    </div>
                                </td>
                                <td>
                                    <div class='input-group'>
                                        <label class='input-group-addon' for='id_hasRelation'>{{searchform.hasRelation.label}}</label>
                                        {{searchform.hasRelation}}
                                    </div>
                                </td>
                              </tr>

                              <tr>
                                <td>
                                    <div class='input-group'>
                                        <label class='input-group-addon' for='id_relationToForeignSign'>{{searchform.relationToForeignSign.label}}</label>
                                        {{searchform.relationToForeignSign}}
                                    </div>
                                </td>

                                <td>
                                    <div class='input-group'>
                                        <label class='input-group-addon' for='id_hasRelationToForeignSign'>{{searchform.hasRelationToForeignSign.label}}</label>
                                        {{searchform.hasRelationToForeignSign}}
                                    </div>
                                </td>

                              </tr>


                        </tr>
                      </table>
                      </div>
                    </div>

                    <div  class="panel panel-default">
                      <div class="panel-heading" data-toggle="collapse" data-target="#pub_search">{% trans "Search by Publication Status and Notes" %}</div>

                      <div id='pub_search' class='collapse'>
                      <table class='table'>
                          <tr>
                            <td>
                                <div class='input-group'>
                                    <label class='input-group-addon' for='id_inWeb'>{{searchform.inWeb.label}}</label>
                                    {{searchform.inWeb}}
                                </div>
                            </td>
                            <td>
                                <div class='input-group'>
                                    <label class='input-group-addon' for='id_isNew'>{{searchform.isNew.label}}</label>
                                    {{searchform.isNew}}
                                </div>
                            </td>
                          </tr>

                          <tr>
                            <td>
                                <div class='input-group'>
                                    <label class='input-group-addon' for='id_definitionRole'>{{searchform.definitionRole.label}}</label>
                                    {{searchform.definitionRole}}
                                </div>
                            </td>
                            <td>
                                <div class='input-group'>
                                    <label class='input-group-addon' for='id_definitionContains'>{{searchform.definitionContains.label}}</label>
                                    {{searchform.definitionContains}}
                                </div>
                            </td>
                          </tr>

                          <tr>
                            <td>
                                <div class='input-group'>
                                    <label class='input-group-addon' for='id_definitionRole'>{{searchform.createdBefore.label}}</label>
                                    {{searchform.createdBefore}}
                                </div>
                            </td>
                            <td>
                                <div class='input-group'>
                                    <label class='input-group-addon' for='id_definitionContains'>{{searchform.createdAfter.label}}</label>
                                    {{searchform.createdAfter}}
                                </div>
                            </td>
                          </tr>


                          <tr>
                              <td>
                                  <div class='input-group'>
                                    <label class='input-group-addon' for='id_language'>{{searchform.tags.label}}</label>
                                    {{searchform.tags}}
                                  </div>
                              </td>
                          </tr>

                      </table>

                      </div>
                    </div>
                </div>

        </div>

    </div>

</div>

    <div class='btn-group' style="margin-bottom: 20px">
        <!-- Make sure no button has the *name* 'submit', otherwise submit() cannot be used -->
        <div class="btn-group">
            <a class='btn btn-primary dropdown-toggle' data-toggle="dropdown" type='submit' name='submit_button'>
            <span data-bind="label" onclick="do_adminsearch(this);" name="search_type" value="sign">
                {% if search_type == 'sign' %}
                {% trans "Search sign" %}
                {% else %}
                {% trans "Search sign or morpheme" %}
                {% endif %}
            </span>&nbsp;<span class="caret"></span>
            </a>
            <ul class="dropdown-menu dropdown-menu-left">
                <li><a href="#" onclick="do_adminsearch(this);" type='submit' name="search_type" value="sign">{% trans "Search sign" %}</a></li>
                <li><a href="#" onclick="do_adminsearch(this);" type='submit' name="search_type" value="morpheme">{% trans "Search morpheme" %}</a></li>
                <li><a href="#" onclick="do_adminsearch(this);" type='submit' name="search_type"
                       value="sign_or_morpheme">{% trans "Sign or morpheme" %}</a></li>
            </ul>
        </div>

        <!-- The element below adds an invisible submit option, so the 'button' above also works when enter is pressed -->
        <input type="submit" style="visibility: hidden;"/>

        {% if perms.dictionary.export_csv %}
        <input class='btn btn-default' type='submit' name='format' value='CSV'>
        {% endif %}
        <!--<input class='btn btn-default' type='submit' name='export_ecv' value='ECV'>-->
        {% if perms.dictionary.export_ecv %}
        <input class='btn btn-default' type='submit' name='export_ecv' value='ECV'>
        {% endif %}
        <input class='btn btn-default' type='submit' onclick="clearForm(document.adminsearch);"
               value='{% trans "Reset" %}'>
    </div>

    <div class='form-group' id='paginate_by'>
        <label for='paginate_by'>{% trans "Results per page" %}</label>
        <select class='form-control' name="paginate_by">
            <option>3000</option>
            <option>2000</option>
            <option>1000</option>
            <option>500</option>
            <option>100</option>
            <option>50</option>
            <option>25</option>
            <option>10</option>
        </select>
    </div>

</form>
{% endif %}

<div></div>

{% if perms.dictionary.add_gloss %}
<div  class="panel panel-default">
  <div class="panel-heading" data-toggle="collapse"  data-target='#add_gloss_form'>{% trans "Add New Sign" %}</div>

     <div id='add_gloss_form' class='collapse'>
         <form action='{% url "dictionary:add_gloss" %}' method='post'>
             {% csrf_token %}
             <table class='table'>
                 <tr>
                     <th><label for='id_idgloss'>ID Gloss</label></th>
                     <th><label for='id_annotation_idgloss'>Annotation ID Gloss (Dutch)</label></th>
                     <th><label for='id_annotation_idgloss_en'>Annotation ID Gloss (English)</label></th>
                     <th></th>
                 </tr>
                 <tr>
                     <td>{{add_gloss_form.idgloss}}</td>
                     <td>{{add_gloss_form.annotation_idgloss}}</td>
{'fraction_non_alphanumeric': 0.1376087238738154, 'fraction_numerical': 0.0016876541607166039, 'mean_word_length': 1.2144540907261543, 'pattern_counts': {'":': 22, '<': 695, '<?xml version=': 0, '>': 693, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 115, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7390637', 'n_tokens_mistral': 10118, 'n_tokens_neox': 9228, 'n_words': 1771}