<commit_before><?php
/*
 *  Copyright (c) 2012, 2013 <NAME> <<EMAIL>>,
 *                           <NAME> <<EMAIL>>, 
 *                           AIP E-Science (www.aip.de)
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  See the NOTICE file distributed with this work for additional
 *  information regarding copyright ownership. You may obtain a copy
 *  of the License at
 *
 *  http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 */
?>

<?php if ($this->status === 'ok'): ?>
    <p>Query successfully submitted.</p>
<?php elseif ($this->status === 'plan'): ?>
    <p>Query submitted.</p>
    <p>You need to view and approve the <a href="<?php echo $this->escape($this->redirect); ?>">query plan</a>.
<?php elseif ($this->status === 'form'): ?>
    <script type="text/javascript">      
        $(document).ready(function() {
            $('#sql_query').daiquiri_codemirror();

            $('#daiquiry-form-query-sql').daiquiri_query_buttons();
                                
            $('.daiquiri-query-example').click(function() {
                var string = $(this).attr('data-toggle');
                $('#sql_query').insertAtCaret(string);
                $('#sql_query').daiquiri_codemirror_insertAtCaret(string);
            });

            $('#sql_clear').click(function(){
                $('#sql_query').val('');
                $('#sql_query').daiquiri_codemirror_clear();
            });
        });
    </script>

    <h4><?php echo $this->escape($this->formOptions['title']); ?></h4>

    <p><?php echo $this->escape($this->formOptions['help']); ?></p>
    <?php echo $this->form; ?>
    <?php if (!empty($this->errors['form'])): ?>
        <p class="text-error">An error has occured.</p>
        <ul class="text-error">
            <?php foreach ($this->errors['form'] as $error): ?>
                <?php if (is_array($error)): ?>
                    <?php foreach ($error as $e): ?>
                        <li><?php echo $this->escape($e); ?></li>
                    <?php endforeach; ?>
                <?php else: ?>
                    <li><?php echo $this->escape($error); ?></li>
                <?php endif; ?>
            <?php endforeach; ?>
        </ul>
    <?php endif; ?>
    <div class="accordion" id="sql-query-accordion">
        <div class="accordion-group">
            <div class="accordion-heading">
                <a class="accordion-toggle" data-toggle="collapse" data-parent="#sql-query-accordion-2" href="#sql-query-accordion-2">
                    Example Queries
                </a>
            </div>
            <div id="sql-query-accordion-2" class="accordion-body collapse">
                <div class="accordion-inner">
                    <?php echo $this->action('example-queries', 'index', 'query'); ?>
                </div>
            </div>
        </div>

        <div class="accordion-group">
            <div class="accordion-heading">
                <a class="accordion-toggle" data-toggle="collapse" data-parent="#sql-query-accordion-1" href="#sql-query-accordion-1">
                    Database browser
                </a>
            </div>
            <div id="sql-query-accordion-1" class="accordion-body collapse">
                <div class="accordion-inner">
                    <div id="browser"></div>
                </div>
            </div>
        </div>
    </div>
<?php endif; ?>
<commit_msg>bug fixes to query form error handling and paqu update<commit_after><?php
/*
 *  Copyright (c) 2012, 2013 <NAME> <<EMAIL>>,
 *                           <NAME> <<EMAIL>>, 
 *                           AIP E-Science (www.aip.de)
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  See the NOTICE file distributed with this work for additional
 *  information regarding copyright ownership. You may obtain a copy
 *  of the License at
 *
 *  http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 */
?>

<?php if ($this->status === 'ok'): ?>
    <p>Query successfully submitted.</p>
<?php elseif ($this->status === 'plan'): ?>
    <p>Query submitted.</p>
    <p>You need to view and approve the <a href="<?php echo $this->escape($this->redirect); ?>">query plan</a>.
<?php elseif ($this->status === 'form' || $this->status === 'error'): ?>
    <script type="text/javascript">      
        $(document).ready(function() {
            $('#sql_query').daiquiri_codemirror();

            $('#daiquiry-form-query-sql').daiquiri_query_buttons();
                                
            $('.daiquiri-query-example').click(function() {
                var string = $(this).attr('data-toggle');
                $('#sql_query').insertAtCaret(string);
                $('#sql_query').daiquiri_codemirror_insertAtCaret(string);
            });

            $('#sql_clear').click(function(){
                $('#sql_query').val('');
                $('#sql_query').daiquiri_codemirror_clear();
            });
        });
    </script>

    <h4><?php echo $this->escape($this->formOptions['title']); ?></h4>

    <p><?php echo $this->escape($this->formOptions['help']); ?></p>
    <?php echo $this->form; ?>
    <?php if ($this->status === 'error' && array_key_exists("from", $this->errors)): ?>
        <p class="text-error">An error has occured.</p>
        <ul class="text-error">
            <?php foreach ($this->errors['form'] as $error): ?>
                <?php if (is_array($error)): ?>
                    <?php foreach ($error as $e): ?>
                        <li><?php echo $this->escape($e); ?></li>
                    <?php endforeach; ?>
                <?php else: ?>
                    <li><?php echo $this->escape($error); ?></li>
                <?php endif; ?>
            <?php endforeach; ?>
        </ul>
    <?php endif; ?>
    <div class="accordion" id="sql-query-accordion">
        <div class="accordion-group">
            <div class="accordion-heading">
                <a class="accordion-toggle" data-toggle="collapse" data-parent="#sql-query-accordion-2" href="#sql-query-accordion-2">
                    Example Queries
                </a>
            </div>
            <div id="sql-query-accordion-2" class="accordion-body collapse">
                <div class="accordion-inner">
                    <?php echo $this->action('example-queries', 'index', 'query'); ?>
                </div>
            </div>
        </div>

        <div class="accordion-group">
            <div class="accordion-heading">
                <a class="accordion-toggle" data-toggle="collapse" data-parent="#sql-query-accordion-1" href="#sql-query-accordion-1">
                    Database browser
                </a>
            </div>
            <div id="sql-query-accordion-1" class="accordion-body collapse">
                <div class="accordion-inner">
                    <div id="browser"></div>
                </div>
            </div>
        </div>
    </div>
<?php endif; ?>

{'fraction_non_alphanumeric': 0.169799092676604, 'fraction_numerical': 0.005184705119896306, 'mean_word_length': 1.996504854368932, 'pattern_counts': {'":': 0, '<': 147, '<?xml version=': 0, '>': 179, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4638911', 'n_tokens_mistral': 2223, 'n_tokens_neox': 2141, 'n_words': 532}