<commit_before>{% set title = "Translation tool" %}
{% set current_link = "home" %}
{% extends 'composers/translate/layout.html' %}
{% block body_content %}
    <div class="translateblock">
    <div class="row">
        <div class="col-lg-12">
            <div class="page-header">
                <h1 id="apptitle">{{ gettext("Translate") }}</h1>
            </div>
        </div>
    </div>

    <div class="row">
        <div class="col-lg-6">
            <div class="well">
                <form class="form-horizontal" id="geturl" name="geturl"
                      action="{{ url_for('translate.translate_selectlang') }}" method="POST">
                    <fieldset>
                        <legend>{{ gettext("Step 1 - App creation") }}</legend>

                        <div class="form-group">
                            <label for="appurl" class="col-lg-2 control-label">{{ gettext("URL") }}</label>

                            <div class="col-lg-10">
                                <input type="text" id="appurl" name="appurl" class="form-control"
                                       placeholder="{{ gettext("URL of the app") }}">
                                <span class="help-block">{{ gettext("Enter the URL of the XML for the app you want to translate.") }}</span>
                            </div>
                        </div>

                        <div class="form-group">
                            <label for="appname" class="col-lg-2 control-label">{{ gettext("Name") }}</label>

                            <div class="col-lg-10">
                                <input type="text" id="appname" name="appname" class="form-control"
                                       placeholder="{{ gettext("Name of the app") }}">
                                <span class="help-block">{{ gettext("Enter the name of the new app that will be created.") }}</span>
                            </div>
                        </div>


                        <div class="form-group">
                            <div class="col-lg-10 col-lg-offset-2">
                                <label class="control-label" for="searchapp">Or you can search the app on the Go-Lab
                                    portal</label>

                                <div class="controls">
                                    <a data-toggle="modal" href="#searchmodal" class="btn btn-primary" id="searchapp">Search
                                        app on portal</a>

                                    <div class="modal fade" id="searchmodal" tabindex="-1" role="dialog"
                                         aria-labelledby="searchmodallabel" aria-hidden="true">
                                        <div class="modal-dialog">
                                            <div class="modal-content">
                                                <div class="modal-header">
                                                    <button type="button" class="close" data-dismiss="modal"
                                                            aria-hidden="true">&times;</button>
                                                    <h4 class="modal-title">List of apps</h4>
                                                </div>

                                                <div class="modal-body">
                                                    <div id="page-content-wrapper">
                                                        <div class="content-header">
                                                            <p>Select the app clicking over one of the thumbnails
                                                                below.</p>
                                                        </div>


                                                        <!-- App thumbnails -->
                                                        <div class="page-content inset" style="">

                                                            <table id="appsearch-table" class="display" cellspacing="0"
                                                                   widdth="100%">
                                                                <thead>
                                                                <tr>
                                                                    <th>Title</th>
                                                                    <th>Author</th>
                                                                    <th>Description</th>
                                                                    <th>Type</th>
                                                                    <th>App URL</th>
                                                                </tr>
                                                                </thead>
                                                                <tfoot>
                                                                <tr>
                                                                    <th>Title</th>
                                                                    <th>Author</th>
                                                                    <th>Description</th>
                                                                    <th>Type</th>
                                                                    <th>App URL</th>
                                                                </tr>
                                                                </tfoot>
                                                                <tbody>

                                                                </tbody>
                                                            </table>

                                                            {#                                                            <div class="row">#}
                                                            {#                                                              <div class="col-md-4 col-xs-height">#}
                                                            {#                                                                <a class="thumbnail" href="#"><img class="img-responsive" src="http://placehold.it/200x100"></a>#}
                                                            {##}
                                                            {#                                                              </div>#}
                                                            {##}
                                                            {#                                                            </div>#}
                                                        </div>
                                                    </div>
                                                </div>

                                                <div class="modal-footer">
                                                    <button type="button" class="btn btn-warning" id="closemodal"
                                                            data-dismiss="modal">Close
                                                    </button>
                                                    <button type="button" class="btn btn-success" id="addurl">Add App
                                                    </button>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>


                        <hr>

                        {% with messages = get_flashed_messages() %}
                            {% if messages %}
                                <div class="alert alert-error">
                                    {% for message in messages %}
                                        <p>{{ message }}</p>
                                    {% endfor %}
                                </div>
                            {% endif %}
                        {% endwith %}

                        <div class="form-group">
                            <div class="col-lg-10 col-lg-offset-2">
                                <label class="control-label" for="selectlang"></label>

                                <div class="controls">

                                    <button type="submit" id="sendurlbtn" name="sendurl"
                                            class="btn btn-success">{{ gettext("Step 2 - Select language »") }}</button>

                                    <!--
                                        <a class="btn btn-success" id="sendurlbtn" href="{{ url_for('translate.translate_selectlang') }}">Step 2 - Select language »</a>
                                        -->
                                </div>
                            </div>
                        </div>
                    </fieldset>

                    {{ csrf_field()|safe }}

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

    <div class="row">
        <br>

        <div class="alert alert-info col-md-11 col-md-offset-1">
            {{ gettext("Put the address of an application to be adapted. Examples:") }}
            <ul>
                {% for example in ['http://go-lab.gw.utwente.nl/production/conceptmapper_v1/tools/conceptmap/src/main/webapp/conceptmapper.xml', 'http://go-lab.gw.utwente.nl/production/hypothesis_v1/tools/hypothesis/src/main/webapp/hypothesis.xml'] %}
                    <li>{{ example }}</li>
                {% endfor %}
            </ul>
        </div>
    </div>

{% endblock %}


{% block scripts %}
    {{ super() }}

    <script type="text/javascript">
    $(document).ready( function() {
        appsearch = $("#appsearch-table").DataTable();
        //appsearch.row.add(["A", "B", "C", "D"]);

        $.getJSON("http://www.golabz.eu/rest/apps/retrieve.json")
                .done( function(data) {
                });
    });<commit_msg>[translate]: AppSearch table is now somewhat filled properly through the API<commit_after>{% set title = "Translation tool" %}
{% set current_link = "home" %}
{% extends 'composers/translate/layout.html' %}
{% block body_content %}
    <div class="translateblock">
    <div class="row">
        <div class="col-lg-12">
            <div class="page-header">
                <h1 id="apptitle">{{ gettext("Translate") }}</h1>
            </div>
        </div>
    </div>

    <div class="row">
        <div class="col-lg-6">
            <div class="well">
                <form class="form-horizontal" id="geturl" name="geturl"
                      action="{{ url_for('translate.translate_selectlang') }}" method="POST">
                    <fieldset>
                        <legend>{{ gettext("Step 1 - App creation") }}</legend>

                        <div class="form-group">
                            <label for="appurl" class="col-lg-2 control-label">{{ gettext("URL") }}</label>

                            <div class="col-lg-10">
                                <input type="text" id="appurl" name="appurl" class="form-control"
                                       placeholder="{{ gettext("URL of the app") }}">
                                <span class="help-block">{{ gettext("Enter the URL of the XML for the app you want to translate.") }}</span>
                            </div>
                        </div>

                        <div class="form-group">
                            <label for="appname" class="col-lg-2 control-label">{{ gettext("Name") }}</label>

                            <div class="col-lg-10">
                                <input type="text" id="appname" name="appname" class="form-control"
                                       placeholder="{{ gettext("Name of the app") }}">
                                <span class="help-block">{{ gettext("Enter the name of the new app that will be created.") }}</span>
                            </div>
                        </div>


                        <div class="form-group">
                            <div class="col-lg-10 col-lg-offset-2">
                                <label class="control-label" for="searchapp">Or you can search the app on the Go-Lab
                                    portal</label>

                                <div class="controls">
                                    <a data-toggle="modal" href="#searchmodal" class="btn btn-primary" id="searchapp">Search
                                        app on portal</a>

                                    <div class="modal fade" id="searchmodal" tabindex="-1" role="dialog"
                                         aria-labelledby="searchmodallabel" aria-hidden="true">
                                        <div class="modal-dialog">
                                            <div class="modal-content">
                                                <div class="modal-header">
                                                    <button type="button" class="close" data-dismiss="modal"
                                                            aria-hidden="true">&times;</button>
                                                    <h4 class="modal-title">List of apps</h4>
                                                </div>

                                                <div class="modal-body">
                                                    <div id="page-content-wrapper">
                                                        <div class="content-header">
                                                            <p>Select the app clicking over one of the thumbnails
                                                                below.</p>
                                                        </div>


                                                        <!-- App thumbnails -->
                                                        <div class="page-content inset" style="">

                                                            <table id="appsearch-table" class="display" cellspacing="0"
                                                                   widdth="100%">
                                                                <thead>
                                                                <tr>
                                                                    <th>Title</th>
                                                                    <th>Author</th>
                                                                    <th>Description</th>
                                                                    <th>Type</th>
                                                                    <th>App URL</th>
                                                                </tr>
                                                                </thead>
                                                                <tfoot>
                                                                <tr>
                                                                    <th>Title</th>
                                                                    <th>Author</th>
                                                                    <th>Description</th>
                                                                    <th>Type</th>
                                                                    <th>App URL</th>
                                                                </tr>
                                                                </tfoot>
                                                                <tbody>

                                                                </tbody>
                                                            </table>

                                                            {#                                                            <div class="row">#}
                                                            {#                                                              <div class="col-md-4 col-xs-height">#}
                                                            {#                                                                <a class="thumbnail" href="#"><img class="img-responsive" src="http://placehold.it/200x100"></a>#}
                                                            {##}
                                                            {#                                                              </div>#}
                                                            {##}
                                                            {#                                                            </div>#}
                                                        </div>
                                                    </div>
                                                </div>

                                                <div class="modal-footer">
                                                    <button type="button" class="btn btn-warning" id="closemodal"
                                                            data-dismiss="modal">Close
                                                    </button>
                                                    <button type="button" class="btn btn-success" id="addurl">Add App
                                                    </button>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>


                        <hr>

                        {% with messages = get_flashed_messages() %}
                            {% if messages %}
                                <div class="alert alert-error">
                                    {% for message in messages %}
                                        <p>{{ message }}</p>
                                    {% endfor %}
                                </div>
                            {% endif %}
                        {% endwith %}

                        <div class="form-group">
                            <div class="col-lg-10 col-lg-offset-2">
                                <label class="control-label" for="selectlang"></label>

                                <div class="controls">

                                    <button type="submit" id="sendurlbtn" name="sendurl"
                                            class="btn btn-success">{{ gettext("Step 2 - Select language »") }}</button>

                                    <!--
                                        <a class="btn btn-success" id="sendurlbtn" href="{{ url_for('translate.translate_selectlang') }}">Step 2 - Select language »</a>
                                        -->
                                </div>
                            </div>
                        </div>
                    </fieldset>

                    {{ csrf_field()|safe }}

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

    <div class="row">
        <br>

        <div class="alert alert-info col-md-11 col-md-offset-1">
            {{ gettext("Put the address of an application to be adapted. Examples:") }}
            <ul>
                {% for example in ['http://go-lab.gw.utwente.nl/production/conceptmapper_v1/tools/conceptmap/src/main/webapp/conceptmapper.xml', 'http://go-lab.gw.utwente.nl/production/hypothesis_v1/tools/hypothesis/src/main/webapp/hypothesis.xml'] %}
                    <li>{{ example }}</li>
                {% endfor %}
            </ul>
        </div>
    </div>

{% endblock %}


{% block scripts %}
    {{ super() }}

    <script type="text/javascript">
    $(document).ready( function() {

        // Initialize the AppSearch table and fill the values through AJAX.

        var appsearch = $("#appsearch-table").DataTable();

        $.getJSON("{{ url_for("translate.appslist_proxy") }}")
                .done( function(data) {
                    console.log("AppsList retrieved");

                    var apps = data;

                    for(var i = 0; i < apps.length; i++) {
                        var app = apps[i];
                        appsearch.row.add([app["title"], app["author"], app["description"], app["app_type"], app["app_url"]]);
                    }

                    appsearch.draw();
                });
    });
{'fraction_non_alphanumeric': 0.10552739560704803, 'fraction_numerical': 0.0038136615978759353, 'mean_word_length': 0.6087598043022443, 'pattern_counts': {'":': 0, '<': 294, '<?xml version=': 0, '>': 293, 'https://': 0, 'lorem ipsum': 0, 'www.': 1, 'xml': 4}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 298, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6883648', 'n_tokens_mistral': 3856, 'n_tokens_neox': 3549, 'n_words': 784}