aboutsummaryrefslogtreecommitdiff
path: root/app/views/file/edit_urlfile.php
blob: 619821869e5a2c4d53d42e8c7971a174f61e4956 (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
65
66
67
68
69
70
71
72
73
<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_urlfile/' . $file_ref->id, ['from_plugin' => $from_plugin ?? null]) ?>">

            <?= CSRFProtection::tokenTag() ?>
            <fieldset>
                <legend><?= _('Datei bearbeiten') ?></legend>

                <label>
                    <?= _('Name') ?>
                    <input id="edit_file_name" type="text" name="name"
                           value="<?= htmlReady($name) ?>">
                </label>

                <label>
                    <?= _('URL') ?>
                    <input id="edit_file_url" type="text" name="url"
                           value="<?= htmlReady($file_ref->file['metadata']['url']) ?>">
                </label>

                <label>
                    <?= _('Zugriffsart') ?>
                </label>
                <label>
                    <input type="radio" name="access_type" value="redirect"
                        <? if ($file_ref->file['metadata']['access_type'] === "redirect") echo 'checked'; ?>>
                    <?= _('Direktlink')?>
                </label>
                <label>
                    <input type="radio" name="access_type" value="proxy"
                        <? if ($file_ref->file['metadata']['access_type'] === "proxy") echo 'checked'; ?>>
                    <?= _('Link über Proxy')?>
                </label>

                <label>
                    <?= _('Beschreibung') ?>
                    <textarea name="description" placeholder="<?= _('Optionale Beschreibung') ?>"><?= htmlReady($description); ?></textarea>
                </label>
            </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>
                <?= Studip\Button::createAccept(_('Speichern'), 'save') ?>
                <?= 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>