<commit_before><?php

/**
 * @var Zend_Layout $layout
 */
$layout = $this->layout();

// The current language
$lang = $this->language();

$layout->header = $this->t('vomanage_header');
$layout->subheader = $this->t('vomanage_sub_header');
$layout->title = $layout->title . ' - ' . $layout->subheader;
$layout->footerText = $this->t('footer');

?>

<div>
    <br/>
        <h2><?php echo $this->t('vomanage_add_intro'); ?></h2>
    <br/>
    Virtual Organisation: <strong><?php echo htmlentities($vo_id); ?></strong>
    <br/>
    <br/>
</div>

<?php if ($data['formaction'] == 'save') : ?>
<div>
    <?php if ($errors['sql'] != 0) : ?>
        <p>
            <?php echo $this->t('vomanage_save_fail'); ?>:
            <font color="red"><strong><?php echo $this->t($errors['sql']); ?></strong></font>
        </p>
    <?php endif; ?>
    <?php if (count($errors) === 0) : ?>
        <p>
            <?php echo $this->t('vomanage_save_success'); ?>
        </p>
        <br />

        <form id="actionform" method="POST">
            <input type="hidden" id="vo_id" name="vo_id" value="<?php echo htmlentities($vo_id); ?>"/>
            <input type="hidden" id="action" name="action" value="Index"/>
            <input type="submit" name="backtoindex" value="<?php echo $this->t('vomanage_save_back'); ?>"/>
        </form>
        </p>
    <?php endif; ?>
</div>
<?php endif; ?>

<?php if ($data['formaction'] != 'save' || count($errors) > 0) : ?>
<div>
    <form id="addform" method="POST">
        <table class="formtable">
            <tr>
                <td style="font-weight: bold;">
                    <label for="sp_entity_id">SP entity id</label>
                </td>
                <td>
                    <select name="sp_entity_id">
                        <?php foreach ($spList as $id => $details) : ?>
                        <option value="<?php echo $id ?>" <?php if ($data['sp_entity_id'] == $id) echo 'selected="selected"' ?>>
                            <?php if (isset($details['displayName:'.$lang])) : ?><?php echo htmlentities($details['displayName:'.$lang]); ?>
                            <?php elseif (isset($details['name:'.$lang])) : ?><?php echo htmlentities($details['name:'.$lang]); ?>
                            <?php elseif (isset($details['description:'.$lang])) : ?><?php echo htmlentities($details['description:'.$lang]); ?>
                            <?php else : ?><?php echo htmlentities($id); ?>
                            <?php endif; ?>
                        <?php endforeach; ?>
                    </select>
                </td>
            </tr>
            <tr>
                <td style="font-weight: bold;">
                    <label for="user_id_pattern">User id pattern</label>
                </td>
                <td>
                    <input type="text" name="user_id_pattern" value="<?php echo htmlentities($data['user_id_pattern']); ?>">
                    <?php if (isset($errors['user_id_pattern'])) : ?><font color="red"><?php echo $this->t($errors['user_id_pattern']); ?></font><?php endif; ?>                    
                </td>
            </tr>
            <tr>
                <td style="font-weight: bold;">
                    <label for="attribute_name_saml">Attribute name (SAML)</label>
                </td>
                <td>
                    <input type="text" name="attribute_name_saml" value="<?php echo htmlentities($data['attribute_name_saml']); ?>">
                    <?php if (isset($errors['attribute_name_saml'])) : ?><font color="red"><?php echo $this->t($errors['attribute_name_saml']); ?></font><?php endif; ?>                    
                </td>
            </tr>
            <tr>
                <td style="font-weight: bold;">
                    <label for="attribute_name_opensocial">Attribute name (OpenSocial)</label>
                </td>
                <td>
                    <input type="text" name="attribute_name_opensocial" value="<?php echo htmlentities($data['attribute_name_opensocial']); ?>">
                    <?php if (isset($errors['attribute_name_opensocial'])) : ?><font color="red"><?php echo $this->t($errors['attribute_name_opensocial']); ?></font><?php endif; ?>                    
                </td>
            </tr>
            <tr>
                <td style="font-weight: bold;">
                    <label for="attribute_value">Attribute value</label>
                </td>
                <td>
                    <?php if (!is_array($data['attribute_value']) || count($data['attribute_value']) == 0) : ?>
                    <p id="novaluesmessage">
                        <?php echo $this->t('vomanage_novalues'); ?>
                    </p>
                    <?php endif; ?>
                    <ul id="valuelist">
                    <?php if (is_array($data['attribute_value'])) : ?>
                        <?php foreach ($data['attribute_value'] as $i => $value) : ?>
                            <li id="attribute_value_<?php echo $i ?>"><?php echo htmlentities($value); ?><input type="hidden" name="attribute_value[]" value="<?php echo htmlentities($value); ?>"><a href="#" style="margin-left: 50px" onclick="$('#attribute_value_<?php echo $i ?>').remove();">[remove]</a></li>
                        <?php endforeach; ?>
                    <?php endif; ?>
                    </ul>
                    <script>
                        var valuecount = <?php echo ($i > 0 ? $i : 0) ?>;
                        var addValue = function() {
                            var newvalue = jQuery.trim($('#newvalue').val());
                            if (newvalue != '') {
                                valuecount++;
                                $("#valuelist").append('<li id="attribute_value_'+valuecount+'">'+newvalue+'<input type="hidden" name="attribute_value[]" value="'+newvalue+'"><a href="#" style="margin-left: 50px" onclick="$(\'#attribute_value_'+valuecount+'\').remove();">[remove]</a></li>');
                                $("#novaluesmessage").hide();
                            }
                            $('#newvalue').val('');
                        }
                    </script>
                    <input type="text" name="newvalue" id="newvalue"><input type="button" value="<?php echo $this->t('vomanage_add_newvalue'); ?>" 
                        onclick="addValue();"/>
                    <?php if (isset($errors['attribute_value'])) : ?><font color="red"><?php echo $this->t($errors['attribute_value']); ?></font><?php endif; ?>                    
                </td>
            </tr>
        </table>
        <br/>
        <input type="hidden" name="vo_id" value="<?php echo htmlentities($vo_id); ?>"/>
        <input type="hidden" id="action" name="action" value="Add"/><commit_msg>HTML escaping to prevent XSS forgery<commit_after><?php

/**
 * @var Zend_Layout $layout
 */
$layout = $this->layout();

// The current language
$lang = $this->language();

$layout->header = $this->t('vomanage_header');
$layout->subheader = $this->t('vomanage_sub_header');
$layout->title = $layout->title . ' - ' . $layout->subheader;
$layout->footerText = $this->t('footer');

?>

<div>
    <br/>
        <h2><?php echo $this->t('vomanage_add_intro'); ?></h2>
    <br/>
    Virtual Organisation: <strong><?php echo htmlentities($vo_id); ?></strong>
    <br/>
    <br/>
</div>

<?php if ($data['formaction'] == 'save') : ?>
<div>
    <?php if ($errors['sql'] != 0) : ?>
        <p>
            <?php echo $this->t('vomanage_save_fail'); ?>:
            <font color="red"><strong><?php echo $this->t($errors['sql']); ?></strong></font>
        </p>
    <?php endif; ?>
    <?php if (count($errors) === 0) : ?>
        <p>
            <?php echo $this->t('vomanage_save_success'); ?>
        </p>
        <br />

        <form id="actionform" method="POST">
            <input type="hidden" id="vo_id" name="vo_id" value="<?php echo htmlentities($vo_id); ?>"/>
            <input type="hidden" id="action" name="action" value="Index"/>
            <input type="submit" name="backtoindex" value="<?php echo $this->t('vomanage_save_back'); ?>"/>
        </form>
        </p>
    <?php endif; ?>
</div>
<?php endif; ?>

<?php if ($data['formaction'] != 'save' || count($errors) > 0) : ?>
<div>
    <form id="addform" method="POST">
        <table class="formtable">
            <tr>
                <td style="font-weight: bold;">
                    <label for="sp_entity_id">SP entity id</label>
                </td>
                <td>
                    <select name="sp_entity_id">
                        <?php foreach ($spList as $id => $details) : ?>
                        <option value="<?php echo $id ?>" <?php if ($data['sp_entity_id'] == $id) echo 'selected="selected"' ?>>
                            <?php if (isset($details['displayName:'.$lang])) : ?><?php echo htmlentities($details['displayName:'.$lang]); ?>
                            <?php elseif (isset($details['name:'.$lang])) : ?><?php echo htmlentities($details['name:'.$lang]); ?>
                            <?php elseif (isset($details['description:'.$lang])) : ?><?php echo htmlentities($details['description:'.$lang]); ?>
                            <?php else : ?><?php echo htmlentities($id); ?>
                            <?php endif; ?>
                        <?php endforeach; ?>
                    </select>
                </td>
            </tr>
            <tr>
                <td style="font-weight: bold;">
                    <label for="user_id_pattern">User id pattern</label>
                </td>
                <td>
                    <input type="text" name="user_id_pattern" value="<?php echo htmlentities($data['user_id_pattern']); ?>">
                    <?php if (isset($errors['user_id_pattern'])) : ?><font color="red"><?php echo $this->t($errors['user_id_pattern']); ?></font><?php endif; ?>                    
                </td>
            </tr>
            <tr>
                <td style="font-weight: bold;">
                    <label for="attribute_name_saml">Attribute name (SAML)</label>
                </td>
                <td>
                    <input type="text" name="attribute_name_saml" value="<?php echo htmlentities($data['attribute_name_saml']); ?>">
                    <?php if (isset($errors['attribute_name_saml'])) : ?><font color="red"><?php echo $this->t($errors['attribute_name_saml']); ?></font><?php endif; ?>                    
                </td>
            </tr>
            <tr>
                <td style="font-weight: bold;">
                    <label for="attribute_name_opensocial">Attribute name (OpenSocial)</label>
                </td>
                <td>
                    <input type="text" name="attribute_name_opensocial" value="<?php echo htmlentities($data['attribute_name_opensocial']); ?>">
                    <?php if (isset($errors['attribute_name_opensocial'])) : ?><font color="red"><?php echo $this->t($errors['attribute_name_opensocial']); ?></font><?php endif; ?>                    
                </td>
            </tr>
            <tr>
                <td style="font-weight: bold;">
                    <label for="attribute_value">Attribute value</label>
                </td>
                <td>
                    <?php if (!is_array($data['attribute_value']) || count($data['attribute_value']) == 0) : ?>
                    <p id="novaluesmessage">
                        <?php echo $this->t('vomanage_novalues'); ?>
                    </p>
                    <?php endif; ?>
                    <ul id="valuelist">
                    <?php if (is_array($data['attribute_value'])) : ?>
                        <?php foreach ($data['attribute_value'] as $i => $value) : ?>
                            <li id="attribute_value_<?php echo $i ?>"><?php echo htmlentities($value); ?><input type="hidden" name="attribute_value[]" value="<?php echo htmlentities($value); ?>"><a href="#" style="margin-left: 50px" onclick="$('#attribute_value_<?php echo $i ?>').remove();">[remove]</a></li>
                        <?php endforeach; ?>
                    <?php endif; ?>
                    </ul>
                    <script>
                        var valuecount = <?php echo ($i > 0 ? $i : 0) ?>;
                        var addValue = function() {
                            var newvalue = jQuery.trim($('#newvalue').val());
                            if (newvalue != '') {
                                newvalue = encodeURIComponent(newvalue);
                                valuecount++;
                                $("#valuelist").append('<li id="attribute_value_'+valuecount+'">'+newvalue+'<input type="hidden" name="attribute_value[]" value="'+newvalue+'"><a href="#" style="margin-left: 50px" onclick="$(\'#attribute_value_'+valuecount+'\').remove();">[remove]</a></li>');
                                $("#novaluesmessage").hide();
                            }
                            $('#newvalue').val('');
                        }
                    </script>
                    <input type="text" name="newvalue" id="newvalue"><input type="button" value="<?php echo $this->t('vomanage_add_newvalue'); ?>" 
                        onclick="addValue();"/>
                    <?php if (isset($errors['attribute_value'])) : ?><font color="red"><?php echo $this->t($errors['attribute_value']); ?></font><?php endif; ?>                    
                </td>
            </tr>
        </table>
        <br/>
        <input type="hidden" name="vo_id" value="<?php echo htmlentities($vo_id); ?>"/>
        <input type="hidden" id="action" name="action" value="Add"/>
{'fraction_non_alphanumeric': 0.19514690834673293, 'fraction_numerical': 0.00175412951322906, 'mean_word_length': 1.7839267548321465, 'pattern_counts': {'":': 0, '<': 329, '<?xml version=': 0, '>': 381, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '6809057', 'n_tokens_mistral': 3845, 'n_tokens_neox': 3774, 'n_words': 742}