<commit_before>{% extends base_template %}
{% load xforms_extras %}
{% load url_extras %}
{% block head %}
    
    <script type="text/javascript" src="/static/app_manager/js/app_manager.js"></script>
    <style type="text/css">
        #main_container {
            padding: 0;
        }
        input.sms-autocomplete {
            width: 90%;
        }
        .dialog textarea {
            width: 90%;
            height: 100px;
            padding: 10px;
        }
    </style>


    {% include "sms/partials/sms_autocomplete.html" %}
{% endblock %}
{% block content %}
    <div id="main_container">
        {% if error %}
        <div id="error">
            {% ifequal error 'app_exists' %}
                {# trans #} Oops! We can't create that application; you already have one with the same name.
            {% endifequal %}
        </div>
        {% endif %}
    
        <div id="title-bar">
            <div id="choose-application">
                <div>
                    {% if applications %}
                        <p>Application:</p>
                    {% endif %}
                    {% if edit and app %}
                        <a class="delete_link" href="#"></a>
                        <div class="delete_dialog" title="Delete Application?">
                            <form action="{% url corehq.apps.app_manager.views.delete_app domain app.id %}" method="POST">
                                <table>
                                    <tr>
                                        <td>Are you sure you want to delete application
                                            "<span class="variable-app_name">{{ app.name }}</span>"
                                            and all its modules and forms?</td>
                                    </tr>
                                </table>
                                <input type="submit" value="Delete" />
                            </form>
                        </div>
                    {% endif %}
                    {% if applications %}
                        {% ifequal applications|length 1 %}
                            <strong id="app_name" class="variable-app_name">{{ app.name }}{% if app.doc_type == "RemoteApp" %} (remote){% endif %}</strong>
                        {% else %}
                            <select class="applications">
                                {% if not app %}
                                    <option value="#" disabled="" selected="">No Application Selected</option>
                                {% endif %}
                                {% for a in applications %}
                                <option value="{% url corehq.apps.app_manager.views.view_app domain a.id %}"
                                        {% ifequal a.id app.id %}selected="" class="variable-app_name" {% endifequal %}>
                                    {{ a.name }}{% if a.doc_type == "RemoteApp" %} (remote){% endif %}
                                </option>
                                {% endfor %}
                            </select>
                        {% endifequal %}
                        {% if app %}
                            <div id="version" class="variable-version">v. {{ app.version }}</div>
                        {% endif %}
                    {% endif %}
                </div>
                {% if edit and applications %}
                    <a class="new_link" id="new_app" href="#">Application</a>
                {% endif %}
                {% if edit or not applications %}
                    <div id="new_app_dialog" title="Create a New Application">
                        <h4>Start from scratch</h4>
                        <form action="{% url corehq.apps.app_manager.views.new_app domain %}" method="post">
                            <table>
                                {{ new_app_form.as_table }}
                            </table>
                            <input type="submit" value="Create Application"/>
                        </form>
{#                        <hr/>#}
{#                        <h4>From Factory Application</h4>#}
{#                        <form action="{% url corehq.apps.app_manager.views.import_factory_app domain %}" method="post">#}
{#                            <table>#}
{#                                <tr>#}
{#                                    <th>Name:</th>#}
{#                                    <td><input type="text" name="name"/></td>#}
{#                                </tr>#}
{#                                <tr>#}
{#                                    <th>Application:</th>#}
{#                                    <td>#}
{#                                        <select name="app_id">#}
{#                                            <option value="" disabled="true">Select an application</option>#}
{#                                            {% for fapp in factory_apps %}#}
{#                                                <option value="{{ fapp.id }}">{{ fapp.name }}</option>#}
{#                                            {% endfor %}#}
{#                                        </select>#}
{#                                    </td>#}
{#                                </tr>#}
{#                            </table>#}
{#                            <input type="submit" value="Import Application">#}
{#                        </form>#}
{#                        <hr/>#}
{#                        <h4>Import from source (advanced)</h4>#}
{#                        <form action="{% url corehq.apps.app_manager.views.import_app domain %}" method="post">#}
{#                            <table>#}
{#                                <tr>#}
{#                                    <th>Name:</th>#}
{#                                    <td><input type="text" name="name"/></td>#}
{#                                </tr>#}
{#                                <tr>#}
{#                                    <th>Source:</th>#}
{#                                    <td><textarea name="source" id="jkasf"></textarea></td>#}
{#                                </tr>#}
{#                            </table>#}
{#                            <input type="submit" value="Import Application">#}
{#                        </form>#}
                    </div>
                {% endif %}
            </div>
            {% if applications %}
                <div id="edit">
                    {% if edit  %}
                        <a class="button" href="{% urlencode request.path request.GET without "edit" %}">
                            Done Editing
                        </a>
                    {% else %}
                        <a class="button" href="{% urlencode request.path request.GET with "edit" as "true" %}">
                            Edit
                        </a>
                    {% endif %}
                </div>
            {% endif %}

        </div>
        {% if app %}
        <div id="form-tabs">
            <ul>
                <li><a href='#forms'>Structure and Configuration</a></li>
                <li><a href='#release'>Release Manager</a></li>
            </ul>
            <div id="forms">
                {% block app-content %}
                {% endblock %}
            </div>
            <div id="release">
                {% if saved_apps.0.version != app.version %}
                    <form action="{% url corehq.apps.app_manager.views.save_copy domain app.id %}" method="post">
                        <input type="hidden" name="next" value="{{ request.get_full_path }}" />
                        <input type="submit" value="Make New Build" />
                    </form>
                {% endif %}
                {% if build_errors %}
                    <div class="message">
                        Build Failed!
                        <ul>
                            {% for error in build_errors %}
                                <li>
                                    {% if error.type == "invalid xml" %}
                                        Invalid xml in form
                                        <a href="{% urlencode request.path request.GET with "m" as module.id with "f" as form.id %}">
                                            {{ error.form.name|trans:langs }}
                                        </a>
                                        in module "{{ error.module.name|trans:langs }}": {{ error.message }}
                                    {% else %}
                                    {% if error.type == "no ref detail" %}
                                        Module
                                        <a href="{% urlencode request.path request.GET with "m" as module.id without "f" %}">
                                            {{ error.module.name|trans:langs }}
                                        </a>
                                        uses referrals but doesn't have
                                        detail screens configured for referrals.
                                    {% else %}
                                    {% if error.type == "no case detail" %}
                                        Module
                                        <a href="{% urlencode request.path request.GET with "m" as module.id without "f" %}">{{ error.module.name|trans:langs }}</a>
                                        uses cases but doesn't have
                                        detail screens configured for cases.
                                    {% else %}
                                    {% if error.type == "no modules" %}
                                        This application has no modules.
                                    {% else %}
                                    {% if error.type == "no forms" %}
                                        Module
                                        <a href="{% urlencode request.path request.GET with "m" as module.id without "f" %}">{{ error.module.name|trans:langs }}</a>
                                        has no forms.
                                    {% else %}
                                    {% if error.type == "no case type" %}
                                        Module
                                        <a href="{% urlencode request.path request.GET with "m" as module.id without "f" %}">{{ error.module.name|trans:langs }}</a>
                                        uses cases but doesn't have a
                                        case type defined.
                                    {% else %}
                                        {{ error }}
                                    {% endif %}
                                    {% endif %}
                                    {% endif %}
                                    {% endif %}
                                    {% endif %}
                                    {% endif %}
                                </li><commit_msg>fixed build errors to not crash the site<commit_after>{% extends base_template %}
{% load xforms_extras %}
{% load url_extras %}
{% block head %}
    
    <script type="text/javascript" src="/static/app_manager/js/app_manager.js"></script>
    <style type="text/css">
        #main_container {
            padding: 0;
        }
        input.sms-autocomplete {
            width: 90%;
        }
        .dialog textarea {
            width: 90%;
            height: 100px;
            padding: 10px;
        }
    </style>


    {% include "sms/partials/sms_autocomplete.html" %}
{% endblock %}
{% block content %}
    <div id="main_container">
        {% if error %}
        <div id="error">
            {% ifequal error 'app_exists' %}
                {# trans #} Oops! We can't create that application; you already have one with the same name.
            {% endifequal %}
        </div>
        {% endif %}
    
        <div id="title-bar">
            <div id="choose-application">
                <div>
                    {% if applications %}
                        <p>Application:</p>
                    {% endif %}
                    {% if edit and app %}
                        <a class="delete_link" href="#"></a>
                        <div class="delete_dialog" title="Delete Application?">
                            <form action="{% url corehq.apps.app_manager.views.delete_app domain app.id %}" method="POST">
                                <table>
                                    <tr>
                                        <td>Are you sure you want to delete application
                                            "<span class="variable-app_name">{{ app.name }}</span>"
                                            and all its modules and forms?</td>
                                    </tr>
                                </table>
                                <input type="submit" value="Delete" />
                            </form>
                        </div>
                    {% endif %}
                    {% if applications %}
                        {% ifequal applications|length 1 %}
                            <strong id="app_name" class="variable-app_name">{{ app.name }}{% if app.doc_type == "RemoteApp" %} (remote){% endif %}</strong>
                        {% else %}
                            <select class="applications">
                                {% if not app %}
                                    <option value="#" disabled="" selected="">No Application Selected</option>
                                {% endif %}
                                {% for a in applications %}
                                <option value="{% url corehq.apps.app_manager.views.view_app domain a.id %}"
                                        {% ifequal a.id app.id %}selected="" class="variable-app_name" {% endifequal %}>
                                    {{ a.name }}{% if a.doc_type == "RemoteApp" %} (remote){% endif %}
                                </option>
                                {% endfor %}
                            </select>
                        {% endifequal %}
                        {% if app %}
                            <div id="version" class="variable-version">v. {{ app.version }}</div>
                        {% endif %}
                    {% endif %}
                </div>
                {% if edit and applications %}
                    <a class="new_link" id="new_app" href="#">Application</a>
                {% endif %}
                {% if edit or not applications %}
                    <div id="new_app_dialog" title="Create a New Application">
                        <h4>Start from scratch</h4>
                        <form action="{% url corehq.apps.app_manager.views.new_app domain %}" method="post">
                            <table>
                                {{ new_app_form.as_table }}
                            </table>
                            <input type="submit" value="Create Application"/>
                        </form>
{#                        <hr/>#}
{#                        <h4>From Factory Application</h4>#}
{#                        <form action="{% url corehq.apps.app_manager.views.import_factory_app domain %}" method="post">#}
{#                            <table>#}
{#                                <tr>#}
{#                                    <th>Name:</th>#}
{#                                    <td><input type="text" name="name"/></td>#}
{#                                </tr>#}
{#                                <tr>#}
{#                                    <th>Application:</th>#}
{#                                    <td>#}
{#                                        <select name="app_id">#}
{#                                            <option value="" disabled="true">Select an application</option>#}
{#                                            {% for fapp in factory_apps %}#}
{#                                                <option value="{{ fapp.id }}">{{ fapp.name }}</option>#}
{#                                            {% endfor %}#}
{#                                        </select>#}
{#                                    </td>#}
{#                                </tr>#}
{#                            </table>#}
{#                            <input type="submit" value="Import Application">#}
{#                        </form>#}
{#                        <hr/>#}
{#                        <h4>Import from source (advanced)</h4>#}
{#                        <form action="{% url corehq.apps.app_manager.views.import_app domain %}" method="post">#}
{#                            <table>#}
{#                                <tr>#}
{#                                    <th>Name:</th>#}
{#                                    <td><input type="text" name="name"/></td>#}
{#                                </tr>#}
{#                                <tr>#}
{#                                    <th>Source:</th>#}
{#                                    <td><textarea name="source" id="jkasf"></textarea></td>#}
{#                                </tr>#}
{#                            </table>#}
{#                            <input type="submit" value="Import Application">#}
{#                        </form>#}
                    </div>
                {% endif %}
            </div>
            {% if applications %}
                <div id="edit">
                    {% if edit  %}
                        <a class="button" href="{% urlencode request.path request.GET without "edit" %}">
                            Done Editing
                        </a>
                    {% else %}
                        <a class="button" href="{% urlencode request.path request.GET with "edit" as "true" %}">
                            Edit
                        </a>
                    {% endif %}
                </div>
            {% endif %}

        </div>
        {% if app %}
        <div id="form-tabs">
            <ul>
                <li><a href='#forms'>Structure and Configuration</a></li>
                <li><a href='#release'>Release Manager</a></li>
            </ul>
            <div id="forms">
                {% block app-content %}
                {% endblock %}
            </div>
            <div id="release">
                {% if saved_apps.0.version != app.version %}
                    <form action="{% url corehq.apps.app_manager.views.save_copy domain app.id %}" method="post">
                        <input type="hidden" name="next" value="{{ request.get_full_path }}" />
                        <input type="submit" value="Make New Build" />
                    </form>
                {% endif %}
                {% if build_errors %}
                    <div class="message">
                        Build Failed!
                        <ul>
                            {% for error in build_errors %}
                                <li>
                                    {% if error.type == "invalid xml" %}
                                        Invalid xml in form
                                        <a href="{% urlencode request.path request.GET with "m" as error.module.id with "f" as error.form.id %}">
                                            {{ error.form.name|trans:langs }}
                                        </a>
                                        in module "{{ error.module.name|trans:langs }}": {{ error.message }}
                                    {% else %}
                                    {% if error.type == "no ref detail" %}
                                        Module
                                        <a href="{% urlencode request.path request.GET with "m" as error.module.id with "f" as error.form.id %}">
                                            {{ error.module.name|trans:langs }}
                                        </a>
                                        uses referrals but doesn't have
                                        detail screens configured for referrals.
                                    {% else %}
                                    {% if error.type == "no case detail" %}
                                        Module
                                        <a href="{% urlencode request.path request.GET with "m" as error.module.id without "f" %}">
                                            {{ error.module.name|trans:langs }}
                                        </a>
                                        uses cases but doesn't have
                                        detail screens configured for cases.
                                    {% else %}
                                    {% if error.type == "no modules" %}
                                        This application has no modules.
                                    {% else %}
                                    {% if error.type == "no forms" %}
                                        Module
                                        <a href="{% urlencode request.path request.GET with "m" as error.module.id without "f" %}">{{ error.module.name|trans:langs }}</a>
                                        has no forms.
                                    {% else %}
                                    {% if error.type == "no case type" %}
                                        Module
                                        <a href="{% urlencode request.path request.GET with "m" as error.module.id without "f" %}">{{ error.module.name|trans:langs }}</a>
                                        uses cases but doesn't have a
                                        case type defined.
                                    {% else %}
                                        {{ error }}
                                    {% endif %}
                                    {% endif %}
                                    {% endif %}
                                    {% endif %}
                                    {% endif %}
                                    {% endif %}
                                </li>
{'fraction_non_alphanumeric': 0.12349711900548976, 'fraction_numerical': 0.0016333197223356473, 'mean_word_length': 0.7850664075153871, 'pattern_counts': {'":': 2, '<': 281, '<?xml version=': 0, '>': 281, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 4}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 189, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '372296', 'n_tokens_mistral': 5213, 'n_tokens_neox': 4596, 'n_words': 1092}