aboutsummaryrefslogtreecommitdiff
path: root/app/views/file/edit.php
blob: 803b312e1ece99dbbfb88d90f0a0541768b88d45 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<div id="file_edit_window">
    <?= $this->render_partial('file/_file_aside.php', compact('file_ref')) ?>

    <div id="file_management_forms">
        <form method="post" data-dialog class="default"
            action="<?= $controller->action_link('edit/' . $file_ref->id, ['from_plugin' => $from_plugin ?? null]) ?>">

            <?= CSRFProtection::tokenTag() ?>
            <fieldset>
                <legend><?= _('Zusatzangaben') ?></legend>
                <label>
                    <?= _('Name') ?>
                    <input id="edit_file_name" type="text" name="name"
                           value="<?= htmlReady($name) ?>">
                </label>
                <label>
                    <?= _('Beschreibung') ?>
                    <textarea name="description" placeholder="<?= _('Optionale Beschreibung') ?>"><?= htmlReady($description); ?></textarea>
                </label>
            </fieldset>

            <fieldset>
                <legend><?= _('Barrierefreiheit') ?></legend>
                <label>
                    <input type="checkbox" name="is_accessible" value="1" <?= $file->getAccessibility() ? "checked" : "" ?>>
                    <?= _('Diese Datei ist barrierefrei.') ?>
                </label>
                <?= formatReady((string)Config::get()->ACCESSIBILITY_INFO_TEXT ?: '') ?>
            </fieldset>

            <?= $this->render_partial('file/_terms_of_use_select.php', [
                'content_terms_of_use_entries' => $content_terms_of_use_entries,
                'selected_terms_of_use_id'     => $content_terms_of_use->id,
            ]) ?>

            <footer data-dialog-button>
                <? if ($show_force_button): ?>
                    <?= Studip\Button::createAccept(_('Trotzdem speichern'), 'force_save') ?>
                <? else: ?>
                    <?= Studip\Button::createAccept(_('Speichern'), 'save') ?>
                <? endif ?>
                <?= Studip\LinkButton::createCancel(
                    _('Abbrechen'),
                    $controller->url_for((in_array($folder->range_type, ['course', 'institute']) ? $folder->range_type . '/' : '') . 'files/index/' . $folder->id)
                ) ?>
            </footer>
        </form>
    </div>
</div>

<script>
    //On focus on the edit file name input field, the whole file name but the
    //extension shall be selected. This can't be done with jQuery directly!

    jQuery('#edit_file_name').focus(function() {
        //select the whole file name, but the file extension
        var text = $(this).val(),
            //get start position of extension:
            extension_start_pos = text.lastIndexOf('.');

        $(this).setSelection(0, extension_start_pos);
    });

</script>