<commit_before><!--
This file is part of Lod4stat.

Copyright (c) 2014 Provincia autonoma di Trento


This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
{% load i18n %}
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <script type="text/javascript" src="/static/js/jquery.cookie.js"></script>
    <script type="text/javascript" src="/static/js/ajax_csfrtoken.js"></script>
    <script>
        $(document).ready(function(){
             initToken();
        });
    </script>
    <link href="/static/css/bootstrap.min.css" rel="stylesheet">
</head>

<body>

<h3 style="padding-bottom: 20px">
    {% trans "Manual request" %} '{{ title.strip }}'
</h3>
<div id="frm_div">
<form id='frm'
      method="POST"
      role="form"
      class="form-horizontal"
      accept-charset="utf-8">
    {% csrf_token %}
    <table class="table">
        {{ form.as_table }}
    </table>
    <p></p>
</form>
    <p align="center">
        <button class="btn btn-default"
                onclick="submit_form()">
            {% trans "Submit" %}
        </button>
        <button class="btn btn-default" onclick="$('#popup').modal('hide');">
            {% trans "Cancel" %}
        </button>
    </p>
</div>
<script>
function submit_form() {
    /*
    element = document.getElementById("frm_div");
    inputs = element.getElementsByTagName("input");
    for (var i = 0; i < inputs.length; i++) {
        if (inputs[i].type != 'hidden' ) {
            input_name = inputs[i].id;
            var label = $("label[for='" + input_name + "']").text().replace(':','');
            if ((inputs[i].disabled == false) && (inputs[i].value == '')) {
              alert('{% trans "The field" %}' + " " +
              label + " " +
              '{% trans "is required" %}' + '.');
               return false;
            }
        }
    }
    */
    
    url="/manual_request_save/";
    $.ajax({ // create an AJAX call...
        data: $('#frm').serialize(), // get the form data
        type: $('#frm').attr('method'), // GET or POST
        url: url, // the file to call
        success: function(response) { // on success..
            $('#popup-body').html(response);
        },
        error: function(xhr, status) {
            alert(xhr.responseText);
	    }
    });
    return false;
}
function updateTerritorialLevel(cmb) {
   var txt = document.forms['frm']['id_other_territorial_level'];
   txt.disabled = (cmb.value!='Altro')
   if ((cmb.value=='Altro') || (cmb.value=='Sezione di censimento')) {
      txt.value='';
      text = '<textarea  id="id_specific_territorial_level" name="specific_territorial_level" rows="4"></textarea>'
   }
   else if (cmb.value=='Provincia') {
      text = '<textarea disabled id="id_specific_territorial_level" name="specific_territorial_level" rows="4"></textarea>'
   }
   else {
      text = '<select multiple id="id_specific_territorial_level" class="form-control" name="specific_territorial_level">'
      if (cmb.value=='Comune') {
         {% for item in districts %}
         text += '<option value="{{ item }}">{{ item }}</option>'
         {% endfor %}
      }
      else if (cmb.value=='Comunità di valle') {
         {% for item in valley_communities %}
         text += '<option value="{{ item }}">{{ item }}</option>'
         {% endfor %}
      }
      else if (cmb.value=='Ambito turistico') {
         {% for item in tourism_sectors %}
         text += '<option value="{{ item }}">{{ item }}</option>'
         {% endfor %}
      }
      else if (cmb.value=='Distretto sanitario') {
         {% for item in health_districts %}
         text += '<option value="{{ item }}">{{ item }}</option>'
         {% endfor %}
      }
      text += '</select>'
   }
   $("#id_specific_territorial_level").replaceWith(text);
}
var terr = document.forms['frm']['id_territorial_level'];
if (terr.value=="") {
  var txt = document.forms['frm']['id_other_territorial_level'];
  text = '<textarea style="width:100%" id="id_specific_territorial_level" name="specific_territorial_level" rows="4"></textarea>'
  $("#id_specific_territorial_level").replaceWith(text);
}
else {
  updateTerritorialLevel(terr);
}
</script>
</body><commit_msg>Beautify manual request<commit_after><!--
This file is part of Lod4stat.

Copyright (c) 2014 Provincia autonoma di Trento


This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
{% load i18n %}
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <script type="text/javascript" src="/static/js/jquery.cookie.js"></script>
    <script type="text/javascript" src="/static/js/ajax_csfrtoken.js"></script>
    <script>
        $(document).ready(function(){
             initToken();
        });
    </script>
    <link href="/static/css/bootstrap.min.css" rel="stylesheet">
</head>

<body>

<h3 style="padding-bottom: 20px">
    {% trans "Manual request" %}
</h3>
<div id="frm_div">
<form id='frm'
      method="POST"
      role="form"
      class="form-horizontal"
      accept-charset="utf-8">
    {% csrf_token %}
    <table class="table">
        {{ form.as_table }}
    </table>
    <p></p>
</form>
    <p align="center">
        <button class="btn btn-default"
                onclick="submit_form()">
            {% trans "Submit" %}
        </button>
        <button class="btn btn-default" onclick="$('#popup').modal('hide');">
            {% trans "Cancel" %}
        </button>
    </p>
</div>
<script>
function submit_form() {
    /*
    element = document.getElementById("frm_div");
    inputs = element.getElementsByTagName("input");
    for (var i = 0; i < inputs.length; i++) {
        if (inputs[i].type != 'hidden' ) {
            input_name = inputs[i].id;
            var label = $("label[for='" + input_name + "']").text().replace(':','');
            if ((inputs[i].disabled == false) && (inputs[i].value == '')) {
              alert('{% trans "The field" %}' + " " +
              label + " " +
              '{% trans "is required" %}' + '.');
               return false;
            }
        }
    }
    */

    url="/manual_request_save/";
    $.ajax({ // create an AJAX call...
        data: $('#frm').serialize(), // get the form data
        type: $('#frm').attr('method'), // GET or POST
        url: url, // the file to call
        success: function(response) { // on success..
            $('#popup-body').html(response);
        },
        error: function(xhr, status) {
            alert(xhr.responseText);
	    }
    });
    return false;
}
function updateTerritorialLevel(cmb) {
   var txt = document.forms['frm']['id_other_territorial_level'];
   txt.disabled = (cmb.value!='Altro')
   if ((cmb.value=='Altro') || (cmb.value=='Sezione di censimento')) {
      txt.value='';
      text = '<textarea  id="id_specific_territorial_level" name="specific_territorial_level" rows="4"></textarea>'
   }
   else if (cmb.value=='Provincia') {
      text = '<textarea disabled id="id_specific_territorial_level" name="specific_territorial_level" rows="4"></textarea>'
   }
   else {
      text = '<select multiple id="id_specific_territorial_level" class="form-control" name="specific_territorial_level">'
      if (cmb.value=='Comune') {
         {% for item in districts %}
         text += '<option value="{{ item }}">{{ item }}</option>'
         {% endfor %}
      }
      else if (cmb.value=='Comunità di valle') {
         {% for item in valley_communities %}
         text += '<option value="{{ item }}">{{ item }}</option>'
         {% endfor %}
      }
      else if (cmb.value=='Ambito turistico') {
         {% for item in tourism_sectors %}
         text += '<option value="{{ item }}">{{ item }}</option>'
         {% endfor %}
      }
      else if (cmb.value=='Distretto sanitario') {
         {% for item in health_districts %}
         text += '<option value="{{ item }}">{{ item }}</option>'
         {% endfor %}
      }
      text += '</select>'
   }
   $("#id_specific_territorial_level").replaceWith(text);
}
var terr = document.forms['frm']['id_territorial_level'];
if (terr.value=="") {
  var txt = document.forms['frm']['id_other_territorial_level'];
  text = '<textarea style="width:100%" id="id_specific_territorial_level" name="specific_territorial_level" rows="4"></textarea>'
  $("#id_specific_territorial_level").replaceWith(text);
}
else {
  updateTerritorialLevel(terr);
}
</script>
</body>
{'fraction_non_alphanumeric': 0.17263006374665843, 'fraction_numerical': 0.004729590787579683, 'mean_word_length': 2.813014504116033, 'pattern_counts': {'":': 0, '<': 107, '<?xml version=': 0, '>': 105, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, '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': '2357342', 'n_tokens_mistral': 3086, 'n_tokens_neox': 2958, 'n_words': 744}