tpl fixes, dont use printHtml for none-string types

This commit is contained in:
Dennis Eichhorn 2020-12-06 11:13:19 +01:00
parent 5212b1d915
commit 69ef0158d0
8 changed files with 40 additions and 39 deletions

View File

@ -1,10 +1,10 @@
<div class="ipt-wrap">
<div class="ipt-first">
<span class="input">
<button type="button" id="<?= $this->printHtml($this->getId()); ?>-book-button" data-action='[
<button type="button" id="<?= $this->getId(); ?>-book-button" data-action='[
{
"key": 1, "listener": "click", "action": [
{"key": 1, "type": "dom.popup", "selector": "#group-selector-tpl", "aniIn": "fadeIn", "id": "<?= $this->printHtml($this->getId()); ?>"},
{"key": 1, "type": "dom.popup", "selector": "#group-selector-tpl", "aniIn": "fadeIn", "id": "<?= $this->getId(); ?>"},
{"key": 2, "type": "message.request", "uri": "<?= \phpOMS\Uri\UriFactory::build('{/prefix}admin/group?filter=some&limit=10'); ?>", "method": "GET", "request_type": "json"},
{"key": 3, "type": "dom.table.append", "id": "acc-table", "aniIn": "fadeIn", "data": [], "bindings": {"id": "id", "name": "name/0"}, "position": -1},
{"key": 4, "type": "message.request", "uri": "<?= \phpOMS\Uri\UriFactory::build('{/prefix}admin/group?filter=some&limit=10'); ?>", "method": "GET", "request_type": "json"},
@ -12,37 +12,37 @@
]
}
]'><i class="fa fa-book"></i></button>
<input type="text" list="<?= $this->printHtml($this->getId()); ?>-datalist" id="<?= $this->printHtml($this->getId()); ?>" name="receiver" placeholder="&#xf007; Guest" data-action='[
<input type="text" list="<?= $this->getId(); ?>-datalist" id="<?= $this->getId(); ?>" name="receiver" placeholder="&#xf007; Guest" data-action='[
{
"key": 1, "listener": "keyup", "action": [
{"key": 1, "type": "validate.keypress", "pressed": "!13!37!38!39!40"},
{"key": 2, "type": "utils.timer", "id": "<?= $this->printHtml($this->getId()); ?>", "delay": 500, "resets": true},
{"key": 3, "type": "dom.datalist.clear", "id": "<?= $this->printHtml($this->getId()); ?>-datalist"},
{"key": 4, "type": "message.request", "uri": "{/base}/{/lang}/api/admin/find/group?search={!#<?= $this->printHtml($this->getId()); ?>}", "method": "GET", "request_type": "json"},
{"key": 5, "type": "dom.datalist.append", "id": "<?= $this->printHtml($this->getId()); ?>-datalist", "value": "id", "text": "name"}
{"key": 2, "type": "utils.timer", "id": "<?= $this->getId(); ?>", "delay": 500, "resets": true},
{"key": 3, "type": "dom.datalist.clear", "id": "<?= $this->getId(); ?>-datalist"},
{"key": 4, "type": "message.request", "uri": "{/base}/{/lang}/api/admin/find/group?search={!#<?= $this->getId(); ?>}", "method": "GET", "request_type": "json"},
{"key": 5, "type": "dom.datalist.append", "id": "<?= $this->getId(); ?>-datalist", "value": "id", "text": "name"}
]
},
{
"key": 2, "listener": "keydown", "action" : [
{"key": 1, "type": "validate.keypress", "pressed": "13|9"},
{"key": 2, "type": "message.request", "uri": "{/base}/{/lang}/api/admin/find/group?search={!#<?= $this->printHtml($this->getId()); ?>}", "method": "GET", "request_type": "json"},
{"key": 3, "type": "dom.setvalue", "overwrite": true, "selector": "#<?= $this->printHtml($this->getId()); ?>-idlist", "value": "{0/id}", "data": ""},
{"key": 4, "type": "dom.setvalue", "overwrite": true, "selector": "#<?= $this->printHtml($this->getId()); ?>-taglist", "value": "<span id=\"<?= $this->printHtml($this->getId()); ?>-taglist-{0/id}\" class=\"tag red\" data-id=\"{0/id}\"><i class=\"fa fa-times\"></i> {0/name}</span>", "data": ""},
{"key": 5, "type": "dom.setvalue", "overwrite": true, "selector": "#<?= $this->printHtml($this->getId()); ?>", "value": "", "data": ""}
{"key": 2, "type": "message.request", "uri": "{/base}/{/lang}/api/admin/find/group?search={!#<?= $this->getId(); ?>}", "method": "GET", "request_type": "json"},
{"key": 3, "type": "dom.setvalue", "overwrite": true, "selector": "#<?= $this->getId(); ?>-idlist", "value": "{0/id}", "data": ""},
{"key": 4, "type": "dom.setvalue", "overwrite": true, "selector": "#<?= $this->getId(); ?>-taglist", "value": "<span id=\"<?= $this->getId(); ?>-taglist-{0/id}\" class=\"tag red\" data-id=\"{0/id}\"><i class=\"fa fa-times\"></i> {0/name}</span>", "data": ""},
{"key": 5, "type": "dom.setvalue", "overwrite": true, "selector": "#<?= $this->getId(); ?>", "value": "", "data": ""}
]
}
]'>
<datalist id="<?= $this->printHtml($this->getId()); ?>-datalist"></datalist>
<input type="hidden" id="<?= $this->printHtml($this->getId()); ?>-idlist"<?= $this->isRequired() ? ' required' : ''; ?>>
<datalist id="<?= $this->getId(); ?>-datalist"></datalist>
<input type="hidden" id="<?= $this->getId(); ?>-idlist"<?= $this->isRequired() ? ' required' : ''; ?>>
</span>
</div>
<div class="ipt-second"><button><?= $this->getHtml('Add', '0', '0'); ?></button></div>
</div>
<div class="box taglist" id="<?= $this->printHtml($this->getId()); ?>-taglist" data-action='[
<div class="box taglist" id="<?= $this->getId(); ?>-taglist" data-action='[
{
"key": 1, "listener": "click", "selector": "#<?= $this->printHtml($this->getId()); ?>-taglist span fa", "action": [
"key": 1, "listener": "click", "selector": "#<?= $this->getId(); ?>-taglist span fa", "action": [
{"key": 1, "type": "dom.getvalue", "base": "self"},
{"key": 2, "type": "dom.removevalue", "selector": "#<?= $this->printHtml($this->getId()); ?>-idlist", "data": ""},
{"key": 2, "type": "dom.removevalue", "selector": "#<?= $this->getId(); ?>-idlist", "data": ""},
{"key": 3, "type": "dom.remove", "base": "self"}
]
}

View File

@ -57,7 +57,7 @@ echo $this->getData('nav')->render(); ?>
elseif ($value->getStatus() === AccountStatus::TIMEOUT) { $color = 'purple'; }
elseif ($value->getStatus() === AccountStatus::BANNED) { $color = 'red'; } ?>
<tr tabindex="0" data-href="<?= $url; ?>">
<td data-label="<?= $this->getHtml('ID', '0', '0'); ?>"><a href="<?= $url; ?>"><?= $this->printHtml($value->getId()); ?></a>
<td data-label="<?= $this->getHtml('ID', '0', '0'); ?>"><a href="<?= $url; ?>"><?= $value->getId(); ?></a>
<td data-label="<?= $this->getHtml('Status'); ?>"><a href="<?= $url; ?>"><span class="tag <?= $color; ?>"><?= $this->getHtml('Status'. $value->getStatus()); ?></span></a>
<td data-label="<?= $this->getHtml('Name'); ?>"><a href="<?= $url; ?>"><?= $this->printHtml(
\sprintf('%3$s %2$s %1$s', $value->name1, $value->name2, $value->name3)

View File

@ -50,18 +50,18 @@ echo $this->getData('nav')->render(); ?>
<table class="layout wf-100">
<tbody>
<tr><td><label for="iId"><?= $this->getHtml('ID', '0', '0'); ?></label>
<tr><td><input id="iId" name="iaccount-idlist" type="text" value="<?= $this->printHtml($account->getId()); ?>" disabled>
<tr><td><input id="iId" name="iaccount-idlist" type="text" value="<?= $account->getId(); ?>" disabled>
<tr><td><label for="iType"><?= $this->getHtml('Type'); ?></label>
<tr><td><select id="iType" name="type">
<option value="<?= $this->printHtml(AccountType::USER); ?>"<?= $this->printHtml($account->getType() === AccountType::USER ? ' selected' : ''); ?>><?= $this->getHtml('Person'); ?>
<option value="<?= $this->printHtml(AccountType::GROUP); ?>"<?= $this->printHtml($account->getType() === AccountType::GROUP ? ' selected' : ''); ?>><?= $this->getHtml('Organization'); ?>
<option value="<?= AccountType::USER; ?>"<?= $this->printHtml($account->getType() === AccountType::USER ? ' selected' : ''); ?>><?= $this->getHtml('Person'); ?>
<option value="<?= AccountType::GROUP; ?>"<?= $this->printHtml($account->getType() === AccountType::GROUP ? ' selected' : ''); ?>><?= $this->getHtml('Organization'); ?>
</select>
<tr><td><label for="iStatus"><?= $this->getHtml('Status'); ?></label>
<tr><td><select id="iStatus" name="status">
<option value="<?= $this->printHtml(AccountStatus::ACTIVE); ?>"<?= $this->printHtml($account->getStatus() === AccountStatus::ACTIVE ? ' selected' : ''); ?>><?= $this->getHtml('Active'); ?>
<option value="<?= $this->printHtml(AccountStatus::INACTIVE); ?>"<?= $this->printHtml($account->getStatus() === AccountStatus::INACTIVE ? ' selected' : ''); ?>><?= $this->getHtml('Inactive'); ?>
<option value="<?= $this->printHtml(AccountStatus::TIMEOUT); ?>"<?= $this->printHtml($account->getStatus() === AccountStatus::TIMEOUT ? ' selected' : ''); ?>><?= $this->getHtml('Timeout'); ?>
<option value="<?= $this->printHtml(AccountStatus::BANNED); ?>"<?= $this->printHtml($account->getStatus() === AccountStatus::BANNED ? ' selected' : ''); ?>><?= $this->getHtml('Banned'); ?>
<option value="<?= AccountStatus::ACTIVE; ?>"<?= $this->printHtml($account->getStatus() === AccountStatus::ACTIVE ? ' selected' : ''); ?>><?= $this->getHtml('Active'); ?>
<option value="<?= AccountStatus::INACTIVE; ?>"<?= $this->printHtml($account->getStatus() === AccountStatus::INACTIVE ? ' selected' : ''); ?>><?= $this->getHtml('Inactive'); ?>
<option value="<?= AccountStatus::TIMEOUT; ?>"<?= $this->printHtml($account->getStatus() === AccountStatus::TIMEOUT ? ' selected' : ''); ?>><?= $this->getHtml('Timeout'); ?>
<option value="<?= AccountStatus::BANNED; ?>"<?= $this->printHtml($account->getStatus() === AccountStatus::BANNED ? ' selected' : ''); ?>><?= $this->getHtml('Banned'); ?>
</select>
<tr><td><label for="iUsername"><?= $this->getHtml('Username'); ?></label>
<tr><td>
@ -137,7 +137,7 @@ echo $this->getData('nav')->render(); ?>
$url = UriFactory::build('{/prefix}admin/group/settings?{?}&id=' . $value->getId()); ?>
<tr data-href="<?= $url; ?>">
<td><a href="#"><i class="fa fa-times"></i></a>
<td><a href="<?= $url; ?>"><?= $this->printHtml($value->getId()); ?></a>
<td><a href="<?= $url; ?>"><?= $value->getId(); ?></a>
<td><a href="<?= $url; ?>"><?= $this->printHtml($value->name); ?></a>
<?php endforeach; ?>
<?php if ($c === 0) : ?>
@ -157,7 +157,7 @@ echo $this->getData('nav')->render(); ?>
</table>
</div>
<div class="portlet-foot">
<input name="account" type="hidden" value="<?= $this->printHtml($account->getId()); ?>">
<input name="account" type="hidden" value="<?= $account->getId(); ?>">
<input type="submit" value="<?= $this->getHtml('Add', '0', '0'); ?>">
</div>
</form>
@ -250,7 +250,7 @@ echo $this->getData('nav')->render(); ?>
</table>
</div>
<div class="portlet-foot">
<input type="hidden" name="permissionref" value="<?= $this->printHtml($account->getId()); ?>">
<input type="hidden" name="permissionref" value="<?= $account->getId(); ?>">
<input type="hidden" name="permissionowner" value="<?= PermissionOwner::ACCOUNT; ?>">
<input type="submit" value="<?= $this->getHtml('Add', '0', '0'); ?>">
</div>

View File

@ -12,6 +12,7 @@
*/
declare(strict_types=1);
use phpOMS\Account\GroupStatus;
use phpOMS\Uri\UriFactory;
/** @var \phpOMS\Views\View $this */
@ -28,8 +29,8 @@ echo $this->getData('nav')->render(); ?>
<tr><td><label for="iStatus"><?= $this->getHtml('Status'); ?></label>
<tr><td>
<select id="iStatus" name="status">
<option value="<?= $this->printHtml(\phpOMS\Account\GroupStatus::ACTIVE); ?>" selected><?= $this->getHtml('Active'); ?>
<option value="<?= $this->printHtml(\phpOMS\Account\GroupStatus::INACTIVE); ?>"><?= $this->getHtml('Inactive'); ?>
<option value="<?= GroupStatus::ACTIVE; ?>" selected><?= $this->getHtml('Active'); ?>
<option value="<?= GroupStatus::INACTIVE; ?>"><?= $this->getHtml('Inactive'); ?>
</select>
<tr><td><label for="iGname"><?= $this->getHtml('Name'); ?></label>
<tr><td><input id="iGname" name="name" type="text" spellcheck="false" autocomplete="off" placeholder="&#xf0c0; Guest" required>

View File

@ -44,7 +44,7 @@ echo $this->getData('nav')->render(); ?>
elseif ($value->getStatus() === \phpOMS\Account\GroupStatus::INACTIVE) { $color = 'darkblue'; }
elseif ($value->getStatus() === \phpOMS\Account\GroupStatus::HIDDEN) { $color = 'purple'; } ?>
<tr tabindex="0" data-href="<?= $url; ?>">
<td data-label="<?= $this->getHtml('ID', '0', '0'); ?>"><a href="<?= $url; ?>"><?= $this->printHtml($value->getId()); ?></a>
<td data-label="<?= $this->getHtml('ID', '0', '0'); ?>"><a href="<?= $url; ?>"><?= $value->getId(); ?></a>
<td data-label="<?= $this->getHtml('Status'); ?>"><a href="<?= $url; ?>"><span class="tag <?= $color; ?>"><?= $this->getHtml('Status'. $value->getStatus()); ?></span></a>
<td data-label="<?= $this->getHtml('Name'); ?>"><a href="<?= $url; ?>"><?= $this->printHtml($value->name); ?></a>
<td data-label="<?= $this->getHtml('Members'); ?>">

View File

@ -48,7 +48,7 @@ echo $this->getData('nav')->render(); ?>
<div class="portlet-head"><?= $this->getHtml('Group'); ?></div>
<div class="portlet-body">
<label for="iGid"><?= $this->getHtml('ID', '0', '0'); ?></label>
<input id="iGid" name="id" type="text" value="<?= $this->printHtml($group->getId()); ?>" disabled>
<input id="iGid" name="id" type="text" value="<?= $group->getId(); ?>" disabled>
<label for="iGname"><?= $this->getHtml('Name'); ?></label>
<input id="iGname" name="name" type="text" spellcheck="false" autocomplete="off" placeholder="&#xf0c0; Guest" value="<?= $this->printHtml($group->name); ?>">
<label for="iGstatus"><?= $this->getHtml('Status'); ?></label>
@ -215,7 +215,7 @@ echo $this->getData('nav')->render(); ?>
</table>
</div>
<div class="portlet-foot">
<input type="hidden" name="permissionref" value="<?= $this->printHtml($group->getId()); ?>">
<input type="hidden" name="permissionref" value="<?= $group->getId(); ?>">
<input type="hidden" name="permissionowner" value="<?= PermissionOwner::GROUP; ?>">
<input type="submit" value="<?= $this->getHtml('Add', '0', '0'); ?>">
</div>

View File

@ -49,7 +49,7 @@ $isntalled = $this->getData('isntalled') ?? [];
}
?>
<tr tabindex="0" data-href="<?= $url; ?>">
<td data-label="<?= $this->getHtml('ID', '0', '0'); ?>"><a href="<?= $url; ?>"><?= $this->printHtml($module->getId()); ?></a>
<td data-label="<?= $this->getHtml('ID', '0', '0'); ?>"><a href="<?= $url; ?>"><?= $module->getId(); ?></a>
<td data-label="<?= $this->getHtml('Name'); ?>"><a href="<?= $url; ?>"><?= $this->printHtml($module->getExternalName()); ?></a>
<td data-label="<?= $this->getHtml('Version'); ?>"><a href="<?= $url; ?>"><?= $this->printHtml($module->getVersion()); ?></a>
<td data-label="<?= $this->getHtml('Status'); ?>">

View File

@ -61,7 +61,7 @@ $l11n = $this->getData('defaultlocalization') ?? new NullLocalization();
<tr><td>
<select id="iOname" name="settings_1000000009">
<?php $unit = UnitMapper::get((int) $settings[1000000009]); ?>
<option value="<?= $this->printHtml($unit->getId()); ?>"><?= $this->printHtml($unit->name); ?>
<option value="<?= $unit->getId(); ?>"><?= $this->printHtml($unit->name); ?>
</select>
</table>
</div>
@ -249,19 +249,19 @@ $l11n = $this->getData('defaultlocalization') ?? new NullLocalization();
<tbody>
<tr><td><label for="iPrecisionVeryShort"><?= $this->getHtml('VeryShort'); ?></label>
<tr><td>
<input form="fLocalization" id="iPrecisionVeryShort" name="settings_precision_vs" value="<?= $this->printHtml($l11n->getPrecision()['very_short']); ?>" type="number">
<input form="fLocalization" id="iPrecisionVeryShort" name="settings_precision_vs" value="<?= $l11n->getPrecision()['very_short']; ?>" type="number">
<tr><td><label for="iPrecisionShort"><?= $this->getHtml('Short'); ?></label>
<tr><td>
<input form="fLocalization" id="iPrecisionLight" name="settings_precision_s" value="<?= $this->printHtml($l11n->getPrecision()['short']); ?>" type="number">
<input form="fLocalization" id="iPrecisionLight" name="settings_precision_s" value="<?= $l11n->getPrecision()['short']; ?>" type="number">
<tr><td><label for="iPrecisionMedium"><?= $this->getHtml('Medium'); ?></label>
<tr><td>
<input form="fLocalization" id="iPrecisionMedium" name="settings_precision_m" value="<?= $this->printHtml($l11n->getPrecision()['medium']); ?>" type="number">
<input form="fLocalization" id="iPrecisionMedium" name="settings_precision_m" value="<?= $l11n->getPrecision()['medium']; ?>" type="number">
<tr><td><label for="iPrecisionLong"><?= $this->getHtml('Long'); ?></label>
<tr><td>
<input form="fLocalization" id="iPrecisionLong" name="settings_precision_l" value="<?= $this->printHtml($l11n->getPrecision()['long']); ?>" type="number">
<input form="fLocalization" id="iPrecisionLong" name="settings_precision_l" value="<?= $l11n->getPrecision()['long']; ?>" type="number">
<tr><td><label for="iPrecisionVeryLong"><?= $this->getHtml('VeryLong'); ?></label>
<tr><td>
<input form="fLocalization" id="iPrecisionVeryLong" name="settings_precision_vl" value="<?= $this->printHtml($l11n->getPrecision()['very_long']); ?>" type="number">
<input form="fLocalization" id="iPrecisionVeryLong" name="settings_precision_vl" value="<?= $l11n->getPrecision()['very_long']; ?>" type="number">
</table>
</form>
</div>