aboutsummaryrefslogtreecommitdiff
path: root/templates
diff options
context:
space:
mode:
authorThomas Hackl <hackl@data-quest.de>2024-11-25 08:41:07 +0000
committerThomas Hackl <hackl@data-quest.de>2024-11-25 08:41:07 +0000
commitd1375e5f7b5d7543ec694df7c2f47b0a967f8951 (patch)
tree68f494e37de796f46e13d79caafb8f8b7cb2072c /templates
parenta69083a3ec3fcd8fb510fc6ea4c53f6ffcb3e436 (diff)
Resolve "Garuda in den Kern übernehmen"
Closes #3326 Merge request studip/studip!3035
Diffstat (limited to 'templates')
-rw-r--r--templates/forms/checkbox_collection_input.php33
-rw-r--r--templates/forms/fieldset.php10
-rw-r--r--templates/forms/file_input.php11
-rw-r--r--templates/forms/form.php1
-rw-r--r--templates/forms/quicksearchlist_input.php18
-rw-r--r--templates/forms/radio_input.php16
-rw-r--r--templates/forms/serial_wysiwyg_input.php17
-rw-r--r--templates/forms/textarea_input.php28
-rw-r--r--templates/forms/user_filter_input.php19
9 files changed, 133 insertions, 20 deletions
diff --git a/templates/forms/checkbox_collection_input.php b/templates/forms/checkbox_collection_input.php
new file mode 100644
index 0000000..9e6dec3
--- /dev/null
+++ b/templates/forms/checkbox_collection_input.php
@@ -0,0 +1,33 @@
+<?php
+/**
+ * @var bool $collapsible
+ * @var string $title
+ * @var array $options
+ * @var bool $required
+ * @var string $name
+ * @var array $selected
+ * @var array $attributes
+ */
+?>
+<fieldset<?= $collapsable ? ' class="collapsable collapsed"' : '' ?>>
+ <legend><?= htmlReady($title) ?></legend>
+ <? foreach ($options as $id => $displayname): ?>
+ <label<?= $required ? ' class="studiprequired"' : '' ?>>
+ <input type="checkbox"
+ v-model="<?= htmlReady($name) ?>"
+ name="<?= htmlReady($name) ?>[]"
+ value="<?= $id ?>"
+ class="<?= htmlReady($name . '-selector') ?>"
+ id="<?= $id ?>"
+ <?= $required ? 'required aria-required="true"' : '' ?>
+ <?= in_array($id, $selected) ? 'selected' : '' ?>
+ <?= $attributes ?>>
+ <span class="textlabel">
+ <?= htmlReady($displayname) ?>
+ </span>
+ <? if ($required) : ?>
+ <span class="asterisk" title="<?= _('Dies ist ein Pflichtfeld') ?>" aria-hidden="true">*</span>
+ <? endif ?>
+ </label>
+ <? endforeach ?>
+</fieldset>
diff --git a/templates/forms/fieldset.php b/templates/forms/fieldset.php
index 491f726..25a9739 100644
--- a/templates/forms/fieldset.php
+++ b/templates/forms/fieldset.php
@@ -1,4 +1,12 @@
-<fieldset>
+<?php
+/**
+ * @var bool $collapsable
+ * @var bool $collapsed
+ * @var string $legend
+ * @var array<\Studip\Forms\Part> $part
+ */
+?>
+<fieldset<?= $collapsable ? ' class="collapsable' . ($collapsed ? ' collapsed' : '') . '"' : '' ?>>
<? if ($legend) : ?>
<legend><?= htmlReady($this->legend) ?></legend>
<? endif ?>
diff --git a/templates/forms/file_input.php b/templates/forms/file_input.php
new file mode 100644
index 0000000..2441b52
--- /dev/null
+++ b/templates/forms/file_input.php
@@ -0,0 +1,11 @@
+<div class="formpart" data-form-input-for="<?= htmlReady($name) ?>">
+ <file-upload
+ name="<?= htmlReady($name) ?>"
+ title="<?= htmlReady($title) ?>"
+ upload-url="<?= htmlReady($uploadUrl) ?>"
+ folder="<?= htmlReady($value) ?>"
+ id="<?= htmlReady($id) ?>"
+ :multiple="<?= $multiple ? 'true' : 'false' ?>"
+ accept="<?= htmlReady($accept) ?>"
+ <?= $required ? ':required="true"' : '' ?>></file-upload>
+</div>
diff --git a/templates/forms/form.php b/templates/forms/form.php
index b367974..00e4c7d 100644
--- a/templates/forms/form.php
+++ b/templates/forms/form.php
@@ -37,6 +37,7 @@ $form_id = md5(uniqid());
data-required="<?= htmlReady(json_encode($required_inputs)) ?>"
data-server_validation="<?= $server_validation ? 1 : 0?>"
data-validation_url="<?= htmlReady($_SERVER['REQUEST_URI']) ?>"
+ <?= $form->hasFileInput() ? ' enctype="application/x-www-form-urlencoded"' : '' ?>
class="default studipform<?= $form->isCollapsable() ? ' collapsable' : '' ?>">
<?= CSRFProtection::tokenTag(['ref' => 'securityToken']) ?>
diff --git a/templates/forms/quicksearchlist_input.php b/templates/forms/quicksearchlist_input.php
new file mode 100644
index 0000000..167ec93
--- /dev/null
+++ b/templates/forms/quicksearchlist_input.php
@@ -0,0 +1,18 @@
+<div class="formpart" data-form-input-for="<?= htmlReady($name) ?>">
+ <label<?= $required ? ' class="studiprequired"' : '' ?> for="<?= htmlReady($id) ?>">
+ <span class="textlabel">
+ <?= htmlReady($title) ?>
+ </span>
+ <? if ($required) : ?>
+ <span class="asterisk" title="<?= _('Dies ist ein Pflichtfeld') ?>" aria-hidden="true">*</span>
+ <? endif ?>
+ <quicksearch-list-input
+ name="<?= htmlReady($name) ?>"
+ id="<?= htmlReady($id) ?>"
+ <?= $required ? 'required aria-required="true"' : '' ?>
+ value="<?= htmlReady($value) ?>"
+ v-model="<?= htmlReady($name) ?>"
+ <?= $attributes ?>
+ ></quicksearch-list-input>
+ </label>
+</div>
diff --git a/templates/forms/radio_input.php b/templates/forms/radio_input.php
index da110d1..f7636d1 100644
--- a/templates/forms/radio_input.php
+++ b/templates/forms/radio_input.php
@@ -1,17 +1,21 @@
<div class="formpart">
<section <?= $this->orientation == 'horizontal' ? 'class="hgroup"' : '' ?> id="<?= htmlReady($id) ?>">
- <span class="textlabel">
+ <span class="textlabel<?= $required ? ' studiprequired' : '' ?> ">
<?= htmlReady($this->title) ?>
+ <? if ($required) : ?>
+ <span class="asterisk" title="<?= _('Dies ist ein Pflichtfeld') ?>" aria-hidden="true">*</span>
+ <? endif ?>
</span>
- <? foreach ($options as $key => $option) : ?>
+ <? $count = 0; foreach ($options as $key => $option) : ?>
<label class="" <?= $attributes ?>>
<input type="radio"
- name="<?= htmlReady($this->name) ?>"
- v-model="<?= htmlReady($this->name) ?>"
- value="<?= htmlReady($key) ?>" <?= $key == $value ? 'checked' : '' ?>>
+ name="<?= htmlReady($name) ?>"
+ v-model="<?= htmlReady($name) ?>"
+ value="<?= htmlReady($key) ?>" <?= $key == $value ? 'checked' : '' ?>
+ <?= $required && $count === 0 ? ' required' : ''?>>
<?= htmlReady($option) ?>
</label>
- <? endforeach ?>
+ <? $count++; endforeach ?>
</section>
</div>
diff --git a/templates/forms/serial_wysiwyg_input.php b/templates/forms/serial_wysiwyg_input.php
new file mode 100644
index 0000000..f67a0c1
--- /dev/null
+++ b/templates/forms/serial_wysiwyg_input.php
@@ -0,0 +1,17 @@
+<div class="formpart" data-form-input-for="<?= htmlReady($name) ?>">
+ <label<?= $this->required ? ' class="studiprequired"' : '' ?> for="<?= htmlReady($id) ?>">
+ <span class="textlabel">
+ <?= htmlReady($this->title) ?>
+ </span>
+ <? if ($this->required) : ?>
+ <span class="asterisk" title="<?= _('Dies ist ein Pflichtfeld') ?>" aria-hidden="true">*</span>
+ <? endif ?>
+ </label>
+ <serial-text-markers :markers="<?= htmlReady($markers) ?>" editor="<?= htmlReady($id) ?>"></serial-text-markers>
+ <studip-wysiwyg
+ id="<?= htmlReady($id) ?>"
+ v-model="<?= htmlReady($name) ?>"
+ value="<?= htmlReady($value) ?>"
+ <?= $required ? 'required' : '' ?>>
+ </studip-wysiwyg>
+</div>
diff --git a/templates/forms/textarea_input.php b/templates/forms/textarea_input.php
index 2afa96c..8effff1 100644
--- a/templates/forms/textarea_input.php
+++ b/templates/forms/textarea_input.php
@@ -1,13 +1,15 @@
-<label<?= ($this->required ? ' class="studiprequired"' : '') ?> for="<?= $id ?>">
- <span class="textlabel">
- <?= htmlReady($this->title) ?>
- </span>
- <? if ($this->required) : ?>
- <span class="asterisk" title="<?= _('Dies ist ein Pflichtfeld') ?>" aria-hidden="true">*</span>
- <? endif ?>
-</label>
-<textarea name="<?= htmlReady($name) ?>"
- v-model="<?= htmlReady($name) ?>"
- id="<?= $id ?>"
- <?= ($required ? 'required aria-required="true"' : '') ?>
- <?= $attributes ?>><?= htmlReady($value) ?></textarea>
+<div class="formpart" data-form-input-for="<?= htmlReady($name) ?>">
+ <label<?= ($this->required ? ' class="studiprequired"' : '') ?> for="<?= $id ?>">
+ <span class="textlabel">
+ <?= htmlReady($this->title) ?>
+ </span>
+ <? if ($this->required) : ?>
+ <span class="asterisk" title="<?= _('Dies ist ein Pflichtfeld') ?>" aria-hidden="true">*</span>
+ <? endif ?>
+ </label>
+ <textarea name="<?= htmlReady($name) ?>"
+ v-model="<?= htmlReady($name) ?>"
+ id="<?= $id ?>"
+ <?= ($required ? 'required aria-required="true"' : '') ?>
+ <?= $attributes ?>><?= htmlReady($value) ?></textarea>
+</div>
diff --git a/templates/forms/user_filter_input.php b/templates/forms/user_filter_input.php
new file mode 100644
index 0000000..20d9386
--- /dev/null
+++ b/templates/forms/user_filter_input.php
@@ -0,0 +1,19 @@
+<div class="formpart" data-form-input-for="<?= htmlReady($name) ?>">
+ <label<?= $required ? ' class="studiprequired"' : '' ?> for="<?= htmlReady($id) ?>">
+ <span class="textlabel">
+ <?= htmlReady($title) ?>
+ </span>
+ <? if ($required) : ?>
+ <span class="asterisk" title="<?= _('Dies ist ein Pflichtfeld') ?>" aria-hidden="true">*</span>
+ <? endif ?>
+ <user-filter-input
+ name="<?= htmlReady($name) ?>"
+ id="<?= htmlReady($id) ?>"
+ <?= $required ? 'required aria-required="true"' : '' ?>
+ value="<?= htmlReady($value) ?>"
+ v-model="<?= htmlReady($name) ?>"
+ <?= $attributes ?>
+ ></user-filter-input>
+ </label>
+
+</div>