<commit_before>@(tableNames: Seq[String])(implicit context: gitbucket.core.controller.Context)
@import context._
@import gitbucket.core.view.helpers._
@html.main("Data export / import"){
  @admin.html.menu("data") {
    <div class="panel panel-default">
      <div class="panel-heading strong">Export</div>
      <div class="panel-body">
        <form class="form form-horizontal" action="@path/admin/export" method="POST">
          @tableNames.map { tableName =>
            <div class="checkbox">
              <label>
                <input type="checkbox" name="tableNames" id="@tableName" value="@tableName" checked/> @tableName
              </label>
            </div>
          }
          <input type="submit" class="btn btn-success pull-right" value="Export">
          <div class="radio pull-right" style="margin-right: 10px;">
            <label>
              <input type="radio" name="type" value="sql">SQL
            </label>
          </div>
          <div class="radio pull-right" style="margin-right: 10px;">
            <label>
              <input type="radio" name="type" value="xml" checked>XML
            </label>
          </div>
        </form>
      </div>
    </div>

    <div class="panel panel-default">
      <div class="panel-heading strong">Import (only XML)</div>
      <div class="panel-body">
        <form class="form form-horizontal" action="@path/upload/import" method="POST" enctype="multipart/form-data" id="import-form">
          <input type="file" name="file" id="file">
          <input type="submit" class="btn btn-success pull-right" value="Import" id="import">
        </form>
      </div>
    </div>
  }
}
<script>
$(function(){
  $('#import-form').submit(function(){
    if(!$('#file').val() == ''){
      alert('Choose an import XML file.');
      return false;
    } else if(!$('#file').val().endsWith(".xml")){
      alert('Import is available for only the XML file.');
      return false;
    }
    return confirm('All existing data is deleted before importing.\nAre you sure?');
  })
})
</script><commit_msg>Fix error checking<commit_after>@(tableNames: Seq[String])(implicit context: gitbucket.core.controller.Context)
@import context._
@import gitbucket.core.view.helpers._
@html.main("Data export / import"){
  @admin.html.menu("data") {
    <div class="panel panel-default">
      <div class="panel-heading strong">Export</div>
      <div class="panel-body">
        <form class="form form-horizontal" action="@path/admin/export" method="POST">
          @tableNames.map { tableName =>
            <div class="checkbox">
              <label>
                <input type="checkbox" name="tableNames" id="@tableName" value="@tableName" checked/> @tableName
              </label>
            </div>
          }
          <input type="submit" class="btn btn-success pull-right" value="Export">
          <div class="radio pull-right" style="margin-right: 10px;">
            <label>
              <input type="radio" name="type" value="sql">SQL
            </label>
          </div>
          <div class="radio pull-right" style="margin-right: 10px;">
            <label>
              <input type="radio" name="type" value="xml" checked>XML
            </label>
          </div>
        </form>
      </div>
    </div>

    <div class="panel panel-default">
      <div class="panel-heading strong">Import (only XML)</div>
      <div class="panel-body">
        <form class="form form-horizontal" action="@path/upload/import" method="POST" enctype="multipart/form-data" id="import-form">
          <input type="file" name="file" id="file">
          <input type="submit" class="btn btn-success pull-right" value="Import" id="import">
        </form>
      </div>
    </div>
  }
}
<script>
$(function(){
  $('#import-form').submit(function(){
    if($('#file').val() == ''){
      alert('Choose an import XML file.');
      return false;
    } else if(!$('#file').val().endsWith(".xml")){
      alert('Import is available for only the XML file.');
      return false;
    }
    return confirm('All existing data is deleted before importing.\nAre you sure?');
  })
})
</script>
{'fraction_non_alphanumeric': 0.1768263183357523, 'fraction_numerical': 0.0019351717464925011, 'mean_word_length': 2.561584840654608, 'pattern_counts': {'":': 0, '<': 75, '<?xml version=': 0, '>': 77, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 4}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3744012', 'n_tokens_mistral': 1214, 'n_tokens_neox': 1194, 'n_words': 277}