aboutsummaryrefslogtreecommitdiff
path: root/templates/sidebar/clipboard-area.php
blob: b5c23fee591b90f0d821d72157b6e50e1916b134 (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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
<form method="post" class="clipboard-form">
    <?= CSRFProtection::tokenTag() ?>
    <div class="input-group">
        <select name="selected_clipboard_id" class="clipboard-selector"
                <?= $clipboards ? '' : 'disabled="disabled"' ?>>
            <? if ($clipboards): ?>
                <? foreach ($clipboards as $clipboard): ?>
                    <option value="<?= htmlReady($clipboard->id) ?>"
                            <?= $clipboard->id == $selected_clipboard_id
                              ? 'selected="selected"'
                              : '' ?>>
                        <?= htmlReady($clipboard->name) ?>
                    </option>
                <? endforeach ?>
            <? endif ?>
        </select>
            <input class="clipboard-name invisible" type="text" name="clipboard_name" value="">
            <?= Icon::create('edit')->asInput(
                [
                    'data-widget-id' => $clipboard_widget_id,
                    'class' => 'middle clipboard-edit-button' . ($clipboards ? '' : ' invisible')
                ]
            ) ?>

            <?= Icon::create('accept')->asInput(
                [
                    'class' => 'middle clipboard-edit-accept invisible',
                    'data-widget-id' => $clipboard_widget_id
                ]
            ) ?>

            <?= Icon::create('decline')->asInput(
                [
                    'data-widget-id' => $clipboard_widget_id,
                    'class' => 'middle clipboard-edit-cancel invisible',
                ]
            ) ?>

            <?= Icon::create('trash')->asInput(
                [
                    'class' => 'middle clipboard-remove-button' . ($clipboards ? '' : ' invisible'),
                    'data-confirm-message' => _('Sind Sie sicher?')
                ]
            ) ?>
    </div>
    <div class="clipboard-area-container">
        <? if ($clipboards): ?>
            <? foreach ($clipboards as $clipboard): ?>
                <table id="Clipboard_<?= htmlReady($clipboard->id) ?>"
                       class="clipboard-area <?= $clipboard->id != $selected_clipboard_id
                                               ? 'invisible'
                                               : '' ?>"
                       data-id="<?= htmlReady($clipboard->id) ?>">
                    <colgroup>
                        <col style="width: 70%">
                    </colgroup>
                    <? $items = $clipboard->getContent() ?>
                    <? if ($items): ?>
                        <? foreach ($items as $item): ?>
                            <?
                            $checkbox_id = sprintf(
                                'item_%1$s_%2$s_%3$s',
                                $clipboard->id,
                                $item['range_type'],
                                $item['range_id']
                            )
                            ?>
                            <? if ($special_item_template): ?>
                                <?= $this->render_partial(
                                    $special_item_template,
                                    [
                                        'item' => $item,
                                        'draggable_items' => $draggable_items,
                                        'checkbox_id' => $checkbox_id
                                    ]
                                ) ?>
                            <? else: ?>
                                <tr class="clipboard-item <?= $draggable_items
                                                            ? 'draggable'
                                                            : '' ?>"
                                    data-range_id="<?= htmlReady($item['range_id']) ?>">
                                    <td class="item-name"><?= htmlReady($item['name']) ?></td>
                                    <td class="actions">
                                    <?= Icon::create('trash')->asInput(
                                        [
                                            'title' => sprintf(_('%s löschen'), $item['name']),
                                            'data-confirm-message' => _('Sind Sie sicher?'),
                                            'class' => 'text-bottom clipboard-item-remove-button'
                                        ]
                                    ) ?>
                                    </td>
                                </tr>
                            <? endif ?>
                        <? endforeach ?>
                    <? endif ?>
                    <tr class="empty-clipboard-message <?= $items ? 'invisible' : '' ?>">
                        <td>
                        <?= htmlReady($empty_clipboard_string) ?>
                        </td>
                    </tr>
                    <? if ($special_item_template): ?>
                        <?= $this->render_partial(
                            $special_item_template,
                            [
                                'item' => null,
                                'draggable_items' => $draggable_items
                            ]
                        ) ?>
                    <? else: ?>
                        <tr class="clipboard-item <?= $draggable_items
                                                    ? 'draggable'
                                                    : ''
                                                  ?> clipboard-item-template invisible"
                            data-range_id="">
                            <td class="item-name"></td>
                            <td class="item-actions">
                                <?= Icon::create('trash')->asInput(
                                    [
                                        'class' => 'text-bottom clipboard-item-remove-button'
                                    ]
                                ) ?>
                            </td>
                        </tr>
                    <? endif ?>
                </table>
            <? endforeach ?>
        <? endif ?>
        <table id="Clipboard_CLIPBOARD_ID"
               class="clipboard-area clipboard-template invisible"
               data-id="CLIPBOARD_ID">
            <colgroup>
                <col style="width: 80%">
            </colgroup>
            <tr class="empty-clipboard-message">
                <td>
                <?= htmlReady($empty_clipboard_string) ?>
                </td>
            </tr>
            <? if ($special_item_template): ?>
                <?= $this->render_partial(
                    $special_item_template,
                    [
                        'item' => null,
                        'draggable_items' => $draggable_items
                    ]
                ) ?>
            <? else: ?>
                <tr class="clipboard-item <?= $draggable_items
                                            ? 'draggable'
                                            : ''
                                          ?> clipboard-item-template invisible"
                    data-range_id="">
                    <td class="item-name"></td>
                    <td>
                        <?= Icon::create('trash')->asInput(
                            [
                                'class' => 'text-bottom clipboard-item-remove-button'
                            ]
                        ) ?>
                    </td>
                </tr>
            <? endif ?>
        </table>
    </div>
</form>