<commit_before><?php defined('C5_EXECUTE') or die("Access Denied.");

$ih = Core::make('helper/concrete/ui');
$dh = Core::make('helper/date');

?>
<?php if ($this->controller->getTask() == 'view_detail') {
    ?>

    <script type="text/javascript">
        deleteFileSet = function () {
            if (confirm('<?=t('Are you sure you want to permanently remove this file set?')?>')) {
                location.href = "<?=$view->url('/dashboard/files/sets', 'delete', $fs->getFileSetID(),
                    Core::make('helper/validation/token')->generate('delete_file_set'))?>";
            }
        }
    </script>

    <div class="ccm-dashboard-header-buttons">
        <button class="btn btn-danger" onclick="deleteFileSet()"><?= t('Delete Set') ?></button>
    </div>

    <form method="post" class="form-horizontal" id="file_sets_edit"
          action="<?= $view->url('/dashboard/files/sets', 'file_sets_edit') ?>">
        <?= $validation_token->output('file_sets_edit');
        ?>


        <div class="form-group">
            <?= $form->label('file_set_name', t('Name')) ?>
            <?= $form->text('file_set_name', $fs->fsName, array('class' => 'span5'));
            ?>
        </div>

        <?= $form->hidden('fsID', $fs->getFileSetID()); ?>

        <?php
        $fl = new FileList();
        $fl->filterBySet($fs);
        $fl->sortByFileSetDisplayOrder();
        $files = $fl->get();
        if (count($files) > 0) {
            ?>

            <span
                class="help-block"><?= t('Click and drag to reorder the files in this set. New files added to this set will automatically be appended to the end.') ?></span>
            <div class="ccm-spacer">&nbsp;</div>

            <div class="table-responsive">
                <table class="ccm-search-results-table compact-results">
                    <thead>
                    <tr>
                        <th></th>
                        <th><span><?= t('Thumbnail') ?></span></th>
                        <th><a href="javascript:void(0)" class="sort-link" data-sort="type"><?= t('Type') ?></a></th>
                        <th><a href="javascript:void(0)" class="sort-link" data-sort="title"><?= t('Title') ?></a></th>
                        <th><a href="javascript:void(0)" class="sort-link"
                               data-sort="filename"><?= t('File name') ?></a></th>
                        <th><a href="javascript:void(0)" class="sort-link" data-sort="added"><?= t('Added') ?></a></th>
                    </tr>
                    </thead>

                    <tbody class="ccm-file-set-file-list">

                    <?php foreach ($files as $f) {
                        ?>
                        <tr id="fID_<?= $f->getFileID() ?>" class="">
                            <td><i class="fa fa-arrows-v"></i></td>
                            <td class="ccm-file-manager-search-results-thumbnail"><?= $f->getListingThumbnailImage() ?>
                                <input type="hidden" name="fsDisplayOrder[]" value="<?= $f->getFileID() ?>"/></td>
                            <td data-key="type"><?= $f->getGenericTypetext() ?>/<?= $f->getType() ?></td>
                            <td data-key="title"><?= $f->getTitle() ?></td>
                            <td data-key="filename"><?= $f->getFileName() ?></td>
                            <td data-key="added"
                                data-sort="<?= $f->getDateAdded()->getTimestamp() ?>"><?= $dh->formatDateTime($f->getDateAdded()->getTimestamp()) ?></td>
                        </tr>
                        <?php
                    }
                    ?>
                    </tbody>
                </table><commit_msg>HTML-Escape file name and title when viewing file sets<commit_after><?php defined('C5_EXECUTE') or die("Access Denied.");

$ih = Core::make('helper/concrete/ui');
$dh = Core::make('helper/date');

?>
<?php if ($this->controller->getTask() == 'view_detail') {
    ?>

    <script type="text/javascript">
        deleteFileSet = function () {
            if (confirm('<?=t('Are you sure you want to permanently remove this file set?')?>')) {
                location.href = "<?=$view->url('/dashboard/files/sets', 'delete', $fs->getFileSetID(),
                    Core::make('helper/validation/token')->generate('delete_file_set'))?>";
            }
        }
    </script>

    <div class="ccm-dashboard-header-buttons">
        <button class="btn btn-danger" onclick="deleteFileSet()"><?= t('Delete Set') ?></button>
    </div>

    <form method="post" class="form-horizontal" id="file_sets_edit"
          action="<?= $view->url('/dashboard/files/sets', 'file_sets_edit') ?>">
        <?= $validation_token->output('file_sets_edit');
        ?>


        <div class="form-group">
            <?= $form->label('file_set_name', t('Name')) ?>
            <?= $form->text('file_set_name', $fs->fsName, array('class' => 'span5'));
            ?>
        </div>

        <?= $form->hidden('fsID', $fs->getFileSetID()); ?>

        <?php
        $fl = new FileList();
        $fl->filterBySet($fs);
        $fl->sortByFileSetDisplayOrder();
        $files = $fl->get();
        if (count($files) > 0) {
            ?>

            <span
                class="help-block"><?= t('Click and drag to reorder the files in this set. New files added to this set will automatically be appended to the end.') ?></span>
            <div class="ccm-spacer">&nbsp;</div>

            <div class="table-responsive">
                <table class="ccm-search-results-table compact-results">
                    <thead>
                    <tr>
                        <th></th>
                        <th><span><?= t('Thumbnail') ?></span></th>
                        <th><a href="javascript:void(0)" class="sort-link" data-sort="type"><?= t('Type') ?></a></th>
                        <th><a href="javascript:void(0)" class="sort-link" data-sort="title"><?= t('Title') ?></a></th>
                        <th><a href="javascript:void(0)" class="sort-link"
                               data-sort="filename"><?= t('File name') ?></a></th>
                        <th><a href="javascript:void(0)" class="sort-link" data-sort="added"><?= t('Added') ?></a></th>
                    </tr>
                    </thead>

                    <tbody class="ccm-file-set-file-list">

                    <?php foreach ($files as $f) {
                        ?>
                        <tr id="fID_<?= $f->getFileID() ?>" class="">
                            <td><i class="fa fa-arrows-v"></i></td>
                            <td class="ccm-file-manager-search-results-thumbnail"><?= $f->getListingThumbnailImage() ?>
                                <input type="hidden" name="fsDisplayOrder[]" value="<?= $f->getFileID() ?>"/></td>
                            <td data-key="type"><?= $f->getGenericTypetext() ?>/<?= $f->getType() ?></td>
                            <td data-key="title"><?= h($f->getTitle()) ?></td>
                            <td data-key="filename"><?= h($f->getFileName()) ?></td>
                            <td data-key="added"
                                data-sort="<?= $f->getDateAdded()->getTimestamp() ?>"><?= $dh->formatDateTime($f->getDateAdded()->getTimestamp()) ?></td>
                        </tr>
                        <?php
                    }
                    ?>
                    </tbody>
                </table>
{'fraction_non_alphanumeric': 0.20457296570275724, 'fraction_numerical': 0.001882985877605918, 'mean_word_length': 1.7099125364431487, 'pattern_counts': {'":': 0, '<': 181, '<?xml version=': 0, '>': 239, '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': '4930779', 'n_tokens_mistral': 2145, 'n_tokens_neox': 2118, 'n_words': 381}