<commit_before><!DOCTYPE HTML>
<html>
    <head>
        {IF submitted == "true"}
            <!-- Reset manipulated URL caused by GET/POST actions to avoid problems on page refreshing -->
            <meta http-equiv="refresh" content="0; url=?action=show_qa&zeder_id={zeder_id}&zeder_instance={zeder_instance}">
        {ENDIF}

        <link rel="stylesheet" href="https://getbootstrap.com/docs/4.0/dist/css/bootstrap.min.css"/>
        <link rel="stylesheet" href="https://cdn.datatables.net/1.10.16/css/jquery.dataTables.min.css"/>
        <script type="text/javascript" src="https://code.jquery.com/jquery-3.3.1.min.js"></script>
        <script type="text/javascript" src="https://code.jquery.com/ui/1.12.0/jquery-ui.min.js"></script>
        <script type="text/javascript" src="https://cdn.datatables.net/v/dt/dt-1.10.16/datatables.js"></script>

        <!-- popper is required by bootstrap for tabs -->
        <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.11.0/umd/popper.min.js"></script>
        <script type="text/javascript" src="https://getbootstrap.com/docs/4.0/dist/js/bootstrap.min.js"></script>

        <style>
            {style_css}
        </style>
    </head>
    <body>
        <script type="text/javascript">
            function ValidateForm() {{
                const regex = document.getElementById("regex").value;
                try {{
                    const regexObj = RegExp(regex);
                    regexObj.test("");
                } catch (err) {{
                    alert("Invalid regex: " + regex);
                    return false;
                }
                return confirm('Are you sure?');
            }
        </script>
        <h1>QA Settings</h1>
        <p><b>{IF journal_name != ""}Journal: {journal_name}{ENDIF}</b></p>
        <p>QA documentation: <a href="https://github.com/ubtue/ub_tools/wiki/Zotero-Harvester-Architecture#user-content-validation" target="_blank">see Wiki</a></p>
        <table class="table table-bordered" style="width: 200px;">
            <thead>
                <tr>
                    <th>Field tag</th>
                    <th>Regular articles<br>(All&nbsp;journals)</th>
                    <th>Review articles<br>(All&nbsp;journals)</th>
                    {IF journal_name != ""}
                        <th>Regular articles<br>(This&nbsp;journal)</th>
                        <th>Review articles<br>(This&nbsp;journal)</th>
                    {ENDIF}
                </tr>
            </thead>
            <tbody>
                {LOOP tags, global_regular_articles, global_review_articles, journal_regular_articles, journal_review_articles}
                    <tr>
                        <td nowrap><a href="https://www.loc.gov/marc/bibliographic/bd{tags}.html" title="Link to external MARC 21 documentation at loc.gov" target="_blank">{tags}</a></td>
                        <td nowrap>{global_regular_articles}</td>
                        <td nowrap>{global_review_articles}</td>
                        {IF journal_name != ""}
                            <td nowrap>{journal_regular_articles}</td>
                            <td nowrap>{journal_review_articles}</td>
                        {ENDIF}
                    </tr>
                {ENDLOOP}
            </tbody>
        </table>

        <form id="add_form" method="post" action="?" autocomplete="off" onsubmit="return ValidateForm()">
            <input type="hidden" name="action" value="show_qa">
            <input type="hidden" name="zeder_id" value="{zeder_id}">
            <input type="hidden" name="zeder_instance" value="{zeder_instance}">

            {IF journal_name != ""}
                <p>Add new journal setting:</p>
                <!-- The quantifier inside the pattern needs to be written as "{{3}" due to Template.h escaping rules! -->
                <input name="add_tag" placeholder="3-digit tag number" required="required" minlength="3" maxlength="3" pattern="[0-9]{{3}">
                <input name="add_subfield_code" placeholder="1-character subfield code" required="required" minlength="1" maxlength="1" pattern="[0-9a-z]{{1}">
                <select name="add_record_type">
                    <option>regular_article</option>
                    <option>review</option>
                </select>
                <input id="regex" name="add_regex" placeholder="optional regex">
                <select name="add_presence">
                    <option>always</option>
                    <option>sometimes</option>
                    <option>ignore</option>
                </select><commit_msg>zotero_cgi/qa.html: Swap columns 2 and 3<commit_after><!DOCTYPE HTML>
<html>
    <head>
        {IF submitted == "true"}
            <!-- Reset manipulated URL caused by GET/POST actions to avoid problems on page refreshing -->
            <meta http-equiv="refresh" content="0; url=?action=show_qa&zeder_id={zeder_id}&zeder_instance={zeder_instance}">
        {ENDIF}

        <link rel="stylesheet" href="https://getbootstrap.com/docs/4.0/dist/css/bootstrap.min.css"/>
        <link rel="stylesheet" href="https://cdn.datatables.net/1.10.16/css/jquery.dataTables.min.css"/>
        <script type="text/javascript" src="https://code.jquery.com/jquery-3.3.1.min.js"></script>
        <script type="text/javascript" src="https://code.jquery.com/ui/1.12.0/jquery-ui.min.js"></script>
        <script type="text/javascript" src="https://cdn.datatables.net/v/dt/dt-1.10.16/datatables.js"></script>

        <!-- popper is required by bootstrap for tabs -->
        <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.11.0/umd/popper.min.js"></script>
        <script type="text/javascript" src="https://getbootstrap.com/docs/4.0/dist/js/bootstrap.min.js"></script>

        <style>
            {style_css}
        </style>
    </head>
    <body>
        <script type="text/javascript">
            function ValidateForm() {{
                const regex = document.getElementById("regex").value;
                try {{
                    const regexObj = RegExp(regex);
                    regexObj.test("");
                } catch (err) {{
                    alert("Invalid regex: " + regex);
                    return false;
                }
                return confirm('Are you sure?');
            }
        </script>
        <h1>QA Settings</h1>
        <p><b>{IF journal_name != ""}Journal: {journal_name}{ENDIF}</b></p>
        <p>QA documentation: <a href="https://github.com/ubtue/ub_tools/wiki/Zotero-Harvester-Architecture#user-content-validation" target="_blank">see Wiki</a></p>
        <table class="table table-bordered" style="width: 200px;">
            <thead>
                <tr>
                    <th>Field tag</th>
                    <th>Regular articles<br>(All&nbsp;journals)</th>
                    {IF journal_name != ""}
                        <th>Regular articles<br>(This&nbsp;journal)</th>
                    {ENDIF}
                    <th>Review articles<br>(All&nbsp;journals)</th>
                    {IF journal_name != ""}
                        <th>Review articles<br>(This&nbsp;journal)</th>
                    {ENDIF}
                </tr>
            </thead>
            <tbody>
                {LOOP tags, global_regular_articles, global_review_articles, journal_regular_articles, journal_review_articles}
                    <tr>
                        <td nowrap><a href="https://www.loc.gov/marc/bibliographic/bd{tags}.html" title="Link to external MARC 21 documentation at loc.gov" target="_blank">{tags}</a></td>
                        <td nowrap>{global_regular_articles}</td>
                        {IF journal_name != ""}
                            <td nowrap>{journal_regular_articles}</td>
                        {ENDIF}
                        <td nowrap>{global_review_articles}</td>
                        {IF journal_name != ""}
                            <td nowrap>{journal_review_articles}</td>
                        {ENDIF}
                    </tr>
                {ENDLOOP}
            </tbody>
        </table>

        <form id="add_form" method="post" action="?" autocomplete="off" onsubmit="return ValidateForm()">
            <input type="hidden" name="action" value="show_qa">
            <input type="hidden" name="zeder_id" value="{zeder_id}">
            <input type="hidden" name="zeder_instance" value="{zeder_instance}">

            {IF journal_name != ""}
                <p>Add new journal setting:</p>
                <!-- The quantifier inside the pattern needs to be written as "{{3}" due to Template.h escaping rules! -->
                <input name="add_tag" placeholder="3-digit tag number" required="required" minlength="3" maxlength="3" pattern="[0-9]{{3}">
                <input name="add_subfield_code" placeholder="1-character subfield code" required="required" minlength="1" maxlength="1" pattern="[0-9a-z]{{1}">
                <select name="add_record_type">
                    <option>regular_article</option>
                    <option>review</option>
                </select>
                <input id="regex" name="add_regex" placeholder="optional regex">
                <select name="add_presence">
                    <option>always</option>
                    <option>sometimes</option>
                    <option>ignore</option>
                </select>
{'fraction_non_alphanumeric': 0.15059794687268493, 'fraction_numerical': 0.009948142660599004, 'mean_word_length': 1.8828553996339232, 'pattern_counts': {'":': 0, '<': 191, '<?xml version=': 0, '>': 191, 'https://': 18, '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': '488614', 'n_tokens_mistral': 2792, 'n_tokens_neox': 2590, 'n_words': 462}