diff options
| author | Jan-Hendrik Willms <tleilax+github@gmail.com> | 2021-07-22 16:07:19 +0200 |
|---|---|---|
| committer | Jan-Hendrik Willms <tleilax+github@gmail.com> | 2021-07-22 16:19:12 +0200 |
| commit | a3da1483a9e689846179159355badfec8073dbec (patch) | |
| tree | 770dcca6bdf5f6f2a11b0e7fcbbeda6919a3fc52 /templates/datafields | |
current code from svn, revision 62608
Diffstat (limited to 'templates/datafields')
| -rw-r--r-- | templates/datafields/bool.php | 19 | ||||
| -rw-r--r-- | templates/datafields/combo.php | 35 | ||||
| -rw-r--r-- | templates/datafields/date.php | 19 | ||||
| -rw-r--r-- | templates/datafields/email.php | 14 | ||||
| -rw-r--r-- | templates/datafields/link.php | 15 | ||||
| -rw-r--r-- | templates/datafields/phone.php | 32 | ||||
| -rw-r--r-- | templates/datafields/radio.php | 20 | ||||
| -rw-r--r-- | templates/datafields/selectbox.php | 33 | ||||
| -rw-r--r-- | templates/datafields/textarea.php | 16 | ||||
| -rw-r--r-- | templates/datafields/textareai18n.php | 19 | ||||
| -rw-r--r-- | templates/datafields/textline.php | 14 | ||||
| -rw-r--r-- | templates/datafields/textlinei18n.php | 17 | ||||
| -rw-r--r-- | templates/datafields/textmarkup.php | 16 | ||||
| -rw-r--r-- | templates/datafields/textmarkupi18n.php | 19 | ||||
| -rw-r--r-- | templates/datafields/time.php | 17 |
15 files changed, 305 insertions, 0 deletions
diff --git a/templates/datafields/bool.php b/templates/datafields/bool.php new file mode 100644 index 0000000..73df34e --- /dev/null +++ b/templates/datafields/bool.php @@ -0,0 +1,19 @@ +<input type="hidden" name="<?= $name ?>[<?= $model->id ?>]" value="0"> + +<label> + <span class="datafield_title <?= $model->is_required && $entry->isEditable() ? 'required' : '' ?>"> + <?= htmlReady($model->name) ?> + </span> + + <? if ($model->description): ?> + <?= tooltipIcon($model->description) ?> + <? endif ?> +</label> + +<label> + <input type="checkbox" name="<?= $name ?>[<?= $model->id ?>]" + value="1" id="<?= $name ?>_<?= $model->id ?>" + <? if ($value) echo 'checked'; ?> + <?= !$entry->isEditable() ? "disabled" : "" ?> + <? if ($model->is_required) echo 'required'; ?>> +</label> diff --git a/templates/datafields/combo.php b/templates/datafields/combo.php new file mode 100644 index 0000000..093d0a1 --- /dev/null +++ b/templates/datafields/combo.php @@ -0,0 +1,35 @@ +<label> + <span class="datafield_title <?= $model->is_required ? 'required' : '' ?>"> + <?= htmlReady($model->name) ?> + </span> + + <? if ($model->description): ?> + <?= tooltipIcon($model->description) ?> + <? endif ?> +</label> + +<label> + <input type="radio" name="<?= $name ?>[<?= $model->id ?>][combo]" + value="select" id="combo_<?= $model->id ?>_select" + <?= !$entry->isEditable() ? "disabled" : "" ?> + <? if (in_array($value, $values)) echo 'checked'; ?>> + <select style="display: inline-block; width: auto;" <?= !$entry->isEditable() ? "disabled" : "" ?> + name="<?= $name ?>[<?= $model->id ?>][select]" onfocus="$('#combo_<?= $model->id ?>_select').prop('checked', true);"> + <? foreach ($values as $v): ?> + <option value="<?= htmlReady($v) ?>" <? if ($v === $value) echo 'selected'; ?>> + <?= htmlReady($v) ?> + </option> + <? endforeach; ?> + </select> +</label> + +<label> + <input type="radio" name="<?= $name ?>[<?= $model->id ?>][combo]" + value="text" id="combo_<?= $model->id ?>_text" + <?= !$entry->isEditable() ? "disabled" : "" ?> + <? if (!in_array($value, $values)) echo 'checked'; ?>> + <input name="<?= $name ?>[<?= $model->id ?>][text]" + value="<? if (!in_array($value, $values)) echo htmlReady($value); ?>" + <?= !$entry->isEditable() ? "disabled" : "" ?> + onfocus="$('#combo_<?= $model->id ?>_text').prop('checked', true);"> +</label> diff --git a/templates/datafields/date.php b/templates/datafields/date.php new file mode 100644 index 0000000..579cf69 --- /dev/null +++ b/templates/datafields/date.php @@ -0,0 +1,19 @@ +<label> + <span class="datafield_title <?= $model->is_required ? 'required' : '' ?>"> + <?= htmlReady($model->name) ?> + </span> + + <? if ($model->description): ?> + <?= tooltipIcon($model->description) ?> + <? endif ?> + <div style="white-space: nowrap;"> + <input type="text" name="<?= $name ?>[<?= $model->id ?>]" + class="no-hint" + value="<? if ($value) echo date('d.m.Y ', $timestamp); ?>" + <?= !$entry->isEditable() ? "disabled" : "" ?> + title="<?= _('Datum') ?>" + style="width: 8em;" + data-date-picker + <? if ($model->is_required) echo 'required'; ?>> + </div> +</label> diff --git a/templates/datafields/email.php b/templates/datafields/email.php new file mode 100644 index 0000000..86779f7 --- /dev/null +++ b/templates/datafields/email.php @@ -0,0 +1,14 @@ +<label> + <span class="datafield_title <?= $model->is_required ? 'required' : '' ?>"> + <?= htmlReady($model->name) ?> + </span> + + <? if ($model->description): ?> + <?= tooltipIcon($model->description) ?> + <? endif ?> + + <input type="email" name="<?= $name ?>[<?= $model->id ?>]" + value="<?= htmlReady($value) ?>" id="<?= $name ?>_<?= $model->id ?>" + <?= !$entry->isEditable() ? "disabled" : "" ?> + <? if ($model->is_required) echo 'required'; ?>> +</label> diff --git a/templates/datafields/link.php b/templates/datafields/link.php new file mode 100644 index 0000000..c454250 --- /dev/null +++ b/templates/datafields/link.php @@ -0,0 +1,15 @@ +<label> + <span class="datafield_title <?= $model->is_required ? 'required' : '' ?>"> + <?= htmlReady($model->name) ?> + </span> + + <? if ($model->description): ?> + <?= tooltipIcon($model->description) ?> + <? endif ?> + + <input type="url" name="<?= $name ?>[<?= $model->id ?>]" + value="<?= htmlReady($value) ?>" id="<?= $name ?>_<?= $model->id ?>" + <?= !$entry->isEditable() ? "disabled" : "" ?> + size="30" placeholder="http://" + <? if ($model->is_required) echo 'required'; ?>> +</label> diff --git a/templates/datafields/phone.php b/templates/datafields/phone.php new file mode 100644 index 0000000..384b86b --- /dev/null +++ b/templates/datafields/phone.php @@ -0,0 +1,32 @@ +<label> + <span class="datafield_title <?= $model->is_required ? 'required' : '' ?>"> + <?= htmlReady($model->name) ?> + </span> + + <? if ($model->description): ?> + <?= tooltipIcon($model->description) ?> + <? endif ?> + + <div style="white-space: nowrap; display: flex; justify-content: flex-start; align-items: baseline;"> + + <input type="tel" name="<?= $name ?>[<?= $model->id ?>][]" + value="<?= htmlReady($values[0]) ?>" maxlength="3" size="2" + <?= !$entry->isEditable() ? "disabled" : "" ?> + title="<?= _('Landesvorwahl ohne führende Nullen') ?>" + placeholder="49" class="no-hint" style="width: 3em; margin-left:5px" + <? if ($model->is_required) echo 'required'; ?>> + + <input type="tel" name="<?= $name ?>[<?= $model->id ?>][]" + value="<?= htmlReady($values[1]) ?>" maxlength="6" size="5" + <?= !$entry->isEditable() ? "disabled" : "" ?> + title="<?= _('Ortsvorwahl ohne führende Null') ?>" + placeholder="541" class="no-hint" style="margin-left:5px" + <? if ($model->is_required) echo 'required'; ?>> + + <input type="tel" name="<?= $name ?>[<?= $model->id ?>][]" + value="<?= htmlReady($values[2]) ?>" maxlength="10" size="9" + <?= !$entry->isEditable() ? "disabled" : "" ?> + title="<?= _('Rufnummer') ?>" + placeholder="969-0000" class="no-hint" style="margin-left:5px" + <? if ($model->is_required) echo 'required'; ?>> + </div> +</label> diff --git a/templates/datafields/radio.php b/templates/datafields/radio.php new file mode 100644 index 0000000..ad07330 --- /dev/null +++ b/templates/datafields/radio.php @@ -0,0 +1,20 @@ +<label> + <span class="datafield_title <?= $model->is_required ? 'required' : '' ?>"> + <?= htmlReady($model->name) ?> + </span> + + <? if ($model->description): ?> + <?= tooltipIcon($model->description) ?> + <? endif ?> +</label> + +<? foreach ($type_param as $pkey => $pval): ?> + <label> + <input type="radio" name="<?= $name ?>[<?= $model->id ?>]" + value="<?= $is_assoc ? (string) $pkey : $pval ?>" + <?= !$entry->isEditable() ? "disabled" : "" ?> + <? if ($value === ($is_assoc ? (string)$pkey : $pval)) echo 'checked'; ?> + <? if ($model->is_required) echo 'required'; ?>> + <?= htmlReady($pval) ?> + </label> +<? endforeach ?> diff --git a/templates/datafields/selectbox.php b/templates/datafields/selectbox.php new file mode 100644 index 0000000..0cc263e --- /dev/null +++ b/templates/datafields/selectbox.php @@ -0,0 +1,33 @@ +<label> + <span class="datafield_title <?= $model->is_required ? 'required' : '' ?>"> + <?= htmlReady($model->name) ?> + </span> + + <? if ($model->description): ?> + <?= tooltipIcon($model->description) ?> + <? endif ?> + + <?php + $selected = function ($needle) use ($value) { + if (is_array($value) && !in_array($needle, $value)) { + return ''; + } + if (!is_array($value) && $needle != $value) { + return ''; + } + return ' selected'; + }; + ?> + <select name="<?= $name ?>[<?= $model->id ?>]<? if ($multiple) echo '[]'; ?>" + id="<?= $name ?>_<?= $model->id ?>" + <?= !$entry->isEditable() ? "disabled" : "" ?> + <? if ($multiple) echo 'multiple'; ?> + <? if ($model->is_required) echo 'required'; ?>> + <? foreach ($type_param as $pkey => $pval): ?> + <option value="<?= $is_assoc ? (string)$pkey : $pval ?>" + <?= $selected($is_assoc ? (string)$pkey : $pval) ?>> + <?= htmlReady($pval) ?> + </option> + <? endforeach; ?> + </select> +</label> diff --git a/templates/datafields/textarea.php b/templates/datafields/textarea.php new file mode 100644 index 0000000..af119c5 --- /dev/null +++ b/templates/datafields/textarea.php @@ -0,0 +1,16 @@ +<label> + <span class="datafield_title <?= $model->is_required ? 'required' : '' ?>"> + <?= htmlReady($model->name) ?> + </span> + + <? if ($model->description): ?> + <?= tooltipIcon($model->description) ?> + <? endif ?> + + <textarea name="<?= $name ?>[<?= $model->id ?>]" + <?= !$entry->isEditable() ? "disabled" : "" ?> + id="<?= $name ?>_<?= $model->id ?>" + rows="6" + <? if ($model->is_required) echo 'required'; ?> + ><?= htmlReady($value) ?></textarea> +</label> diff --git a/templates/datafields/textareai18n.php b/templates/datafields/textareai18n.php new file mode 100644 index 0000000..b3fa27e --- /dev/null +++ b/templates/datafields/textareai18n.php @@ -0,0 +1,19 @@ +<label> + <span class="datafield_title <?= $model->is_required ? 'required' : '' ?>"> + <?= htmlReady($model->name) ?> + </span> + + <? if ($model->description): ?> + <?= tooltipIcon($model->description) ?> + <? endif ?> + + <? if ($entry->isEditable()) : ?> + <?= I18N::textarea($name, $value, ['required' => (bool) $model->is_required, 'locale_names' => $locale_names]) ?> + <? else : ?> + <textarea name="<?= $name ?>[<?= $model->id ?>]" + disabled + id="<?= $name ?>_<?= $model->id ?>" + rows="6" + ><?= htmlReady($value) ?></textarea> + <? endif ?> +</label> diff --git a/templates/datafields/textline.php b/templates/datafields/textline.php new file mode 100644 index 0000000..991f3dd --- /dev/null +++ b/templates/datafields/textline.php @@ -0,0 +1,14 @@ +<label> + <span class="datafield_title <?= $model->is_required ? 'required' : '' ?>"> + <?= htmlReady($model->name) ?> + </span> + + <? if ($model->description): ?> + <?= tooltipIcon($model->description) ?> + <? endif ?> + + <input type="text" name="<?= $name ?>[<?= $model->id ?>]" + value="<?= htmlReady($value) ?>" id="<?= $name ?>_<?= $model->id ?>" + <?= !$entry->isEditable() ? "disabled" : "" ?> + <? if ($model->is_required) echo 'required'; ?>> +</label> diff --git a/templates/datafields/textlinei18n.php b/templates/datafields/textlinei18n.php new file mode 100644 index 0000000..6610b49 --- /dev/null +++ b/templates/datafields/textlinei18n.php @@ -0,0 +1,17 @@ +<label> + <span class="datafield_title <?= $model->is_required ? 'required' : '' ?>"> + <?= htmlReady($model->name) ?> + </span> + + <? if ($model->description): ?> + <?= tooltipIcon($model->description) ?> + <? endif ?> + + <? if ($entry->isEditable()) : ?> + <?= I18N::input($name, $value, ['required' => (bool) $model->is_required, 'locale_names' => $locale_names]) ?> + <? else : ?> + <input type="text" name="<?= $name ?>[<?= $model->id ?>]" + value="<?= htmlReady($value) ?>" id="<?= $name ?>_<?= $model->id ?>" + disabled> + <? endif ?> +</label> diff --git a/templates/datafields/textmarkup.php b/templates/datafields/textmarkup.php new file mode 100644 index 0000000..e876d13 --- /dev/null +++ b/templates/datafields/textmarkup.php @@ -0,0 +1,16 @@ +<label> + <span class="datafield_title <?= $model->is_required ? 'required' : '' ?>"> + <?= htmlReady($model->name) ?> + </span> + + <? if ($model->description): ?> + <?= tooltipIcon($model->description) ?> + <? endif ?> + + <textarea name="<?= $name ?>[<?= $model->id ?>]" + id="<?= $name ?>_<?= $model->id ?>" + class="add_toolbar wysiwyg" + <?= !$entry->isEditable() ? "disabled" : "" ?> + <? if ($model->is_required) echo 'required'; ?> + ><?= wysiwygReady($value) ?></textarea> +</label> diff --git a/templates/datafields/textmarkupi18n.php b/templates/datafields/textmarkupi18n.php new file mode 100644 index 0000000..3e7229a --- /dev/null +++ b/templates/datafields/textmarkupi18n.php @@ -0,0 +1,19 @@ +<label> + <span class="datafield_title <?= $model->is_required ? 'required' : '' ?>"> + <?= htmlReady($model->name) ?> + </span> + + <? if ($model->description): ?> + <?= tooltipIcon($model->description) ?> + <? endif ?> + + <? if ($entry->isEditable()) : ?> + <?= I18N::textarea($name, $value, ['class' => 'add_toolbar wysiwyg', 'required' => (bool) $model->is_required, 'locale_names' => $locale_names]) ?> + <? else : ?> + <textarea name="<?= $name ?>[<?= $model->id ?>]" + id="<?= $name ?>_<?= $model->id ?>" + class="wysiwyg" + disabled + ><?= wysiwygReady($value) ?></textarea> + <? endif ?> +</label> diff --git a/templates/datafields/time.php b/templates/datafields/time.php new file mode 100644 index 0000000..0fe3c92 --- /dev/null +++ b/templates/datafields/time.php @@ -0,0 +1,17 @@ +<label> + <span class="datafield_title <?= $model->is_required ? 'required' : '' ?>"> + <?= htmlReady($model->name) ?> + </span> + + <? if ($model->description): ?> + <?= tooltipIcon($model->description) ?> + <? endif ?> + + <div style="white-space: nowrap;"> + <input type="text" name="<?= $name ?>[<?= $model->id ?>][]" + value="<?= $value ?>" title="<?= _('Uhrzeit') ?>" + <?= !$entry->isEditable() ? "disabled" : "" ?> + maxlength="2" class="size-s no-hint has-time-picker" + <? if ($model->is_required) echo 'required'; ?>> + </div> +</label> |
