Skip to content

Commit

Permalink
SmtpServers, MessageTemplates, Notifications
Browse files Browse the repository at this point in the history
  • Loading branch information
Ioannis committed Apr 29, 2024
1 parent 1ba5a7a commit 28d10be
Show file tree
Hide file tree
Showing 4 changed files with 152 additions and 112 deletions.
49 changes: 39 additions & 10 deletions app/plugins/CoreServer/templates/SmtpServers/fields.inc
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,48 @@

// This view does currently not support read-only, and add is not used
if($vv_action == 'edit') {
print $this->Field->control('hostname');
print $this->element('form/listItem', [
'arguments' => [
'fieldName' => 'hostname',
]
]);

print $this->Field->control('port', ['default' => 587]);
print $this->element('form/listItem', [
'arguments' => [
'fieldName' => 'port',
'fieldOptions' => [
'default' => 587
]
]]);

print $this->Field->control('username');
print $this->element('form/listItem', [
'arguments' => [
'fieldName' => 'username',
]
]);

print $this->Field->control('password');
print $this->element('form/listItem', [
'arguments' => [
'fieldName' => 'password',
]
]);

print $this->Field->control('use_tls', ['default' => true]);
print $this->element('form/listItem', [
'arguments' => [
'fieldName' => 'use_tls',
'fieldOptions' => [
'default' => true
]
]]);

print $this->Field->control('default_from');

print $this->Field->control('default_reply_to');

print $this->Field->control('override_to');
foreach ([
'default_from',
'default_reply_to',
'override_to',
] as $field) {
print $this->element('form/listItem', [
'arguments' => [
'fieldName' => $field
]]);
}
}
36 changes: 17 additions & 19 deletions app/templates/MessageTemplates/fields.inc
Original file line number Diff line number Diff line change
Expand Up @@ -28,25 +28,23 @@
<?php
// This view does not support read-only
if($vv_action == 'add' || $vv_action == 'edit') {
print $this->Field->control('description');

print $this->Field->control('status');

print $this->Field->control('context');

print $this->Field->control('format');

print $this->Field->control('subject');

foreach ([
'description',
'status',
'context',
'format',
'subject',
// XXX auto show/hide based on format
print $this->Field->control('body_text');

'body_text',
// XXX auto show/hide based on format
print $this->Field->control('body_html');

print $this->Field->control('cc');

print $this->Field->control('bcc');

print $this->Field->control('reply_to');
'body_html',
'cc',
'bcc',
'reply_to',
] as $field) {
print $this->element('form/listItem', [
'arguments' => [
'fieldName' => $field
]]);
}
}
177 changes: 95 additions & 82 deletions app/templates/Notifications/fields.inc
Original file line number Diff line number Diff line change
Expand Up @@ -30,96 +30,109 @@ use \App\Lib\Enum\NotificationStatusEnum;
<?php
// This view does not support add or edit
if($vv_action == 'view') {
print $this->Field->control('comment');

print $this->Field->control('action');

print $this->Field->control('source');

print $this->Field->control('created');
foreach ([
'comment',
'action',
'source',
'created',
] as $field) {
print $this->element('form/listItem', [
'arguments' => [
'fieldName' => $field
]]);
}

if($vv_obj->status == NotificationStatusEnum::PendingAcknowledgment) {
print $this->Field->statusControl(
fieldName: 'status',
status: __d('enumeration', 'NotificationStatusEnum.PA'),
link: [
'url' => [
'action' => 'acknowledge',
$vv_obj->id
],
'label' => __d('operation', 'acknowledge'),
'confirm' => __d('operation', 'Notifications.acknowledge.confirm')
]
);
print $this->element('form/listItem', [
'arguments' => [
'fieldName' => 'status',
'status' => __d('enumeration', 'NotificationStatusEnum.PA'),
'link' => [
'url' => [
'action' => 'acknowledge',
$vv_obj->id
],
'label' => __d('operation', 'acknowledge'),
'confirm' => __d('operation', 'Notifications.acknowledge.confirm')
]
]
]);
} else {
print $this->Field->control('status');
}

print $this->Field->statusControl(
fieldName: 'subject_person_id',
status: !empty($vv_obj->subject_person->primary_name)
? $vv_obj->subject_person->primary_name->full_name
: "",
link: !empty($vv_obj->subject_person)
? ['url' => [
'controller' => 'people',
'action' => 'edit',
$vv_obj->subject_person->id
]]
: []
);

print $this->Field->statusControl(
fieldName: 'recipient_person_id',
status: !empty($vv_obj->recipient_person->primary_name)
? $vv_obj->recipient_person->primary_name->full_name
: "",
link: !empty($vv_obj->recipient_person)
? ['url' => [
'controller' => 'people',
'action' => 'edit',
$vv_obj->recipient_person->id
]]
: []
);

print $this->Field->statusControl(
fieldName: 'actor_person_id',
status: !empty($vv_obj->actor_person->primary_name)
? $vv_obj->actor_person->primary_name->full_name
: "",
link: !empty($vv_obj->actor_person)
? ['url' => [
'controller' => 'people',
'action' => 'edit',
$vv_obj->actor_person->id
]]
: []
);

print $this->Field->control('resolution_time');
}

print $this->Field->statusControl(
fieldName: 'resolver_person_id',
status: !empty($vv_obj->resolver_person->primary_name)
? $vv_obj->resolver_person->primary_name->full_name
: "",
link: !empty($vv_obj->resolver_person)
? ['url' => [
'controller' => 'people',
'action' => 'edit',
$vv_obj->resolver_person->id
]]
: []
);
print $this->element('form/listItem', [
'arguments' => [
'fieldName' => 'subject_person_id',
'status' => $vv_obj->subject_person->primary_name?->full_name ?? '',
'link' => !empty($vv_obj->subject_person)
? ['url' => [
'controller' => 'people',
'action' => 'edit',
$vv_obj->subject_person->id
]]
: []
]
]);

print $this->Field->control('notification_time');
print $this->element('form/listItem', [
'arguments' => [
'fieldName' => 'recipient_person_id',
'status' => $vv_obj->recipient_person->primary_name?->full_name ?? '',
'link' => !empty($vv_obj->recipient_person)
? ['url' => [
'controller' => 'people',
'action' => 'edit',
$vv_obj->recipient_person->id
]]
: []
]
]);

print $this->Field->control('email_subject');
print $this->element('form/listItem', [
'arguments' => [
'fieldName' => 'actor_person_id',
'status' => $vv_obj->actor_person->primary_name?->full_name ?? '',
'link' => !empty($vv_obj->actor_person)
? ['url' => [
'controller' => 'people',
'action' => 'edit',
$vv_obj->actor_person->id
]]
: []
]
]);

print $this->Field->control('email_body_text');
print $this->element('form/listItem', [
'arguments' => [
'fieldName' => 'resolution_time',
]
]);

print $this->Field->control('resolution_subject');
print $this->element('form/listItem', [
'arguments' => [
'fieldName' => 'resolver_person_id',
'status' => $vv_obj->resolver_person->primary_name?->full_name ?? '',
'link' => !empty($vv_obj->resolver_person)
? ['url' => [
'controller' => 'people',
'action' => 'edit',
$vv_obj->resolver_person->id
]]
: []
]
]);

print $this->Field->control('resolution_body');
foreach ([
'notification_time',
'email_subject',
'email_body_text',
'resolution_subject',
'resolution_body',
] as $field) {
print $this->element('form/listItem', [
'arguments' => [
'fieldName' => $field
]]);
}
}
2 changes: 1 addition & 1 deletion app/templates/element/form/infoDiv/grouped.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
?>

<div class="field-info">
<?php foreach ($groupedControls as $fieldName => $fieldArguments): ?>
<?php foreach ($vv_field_arguments['groupedControls'] as $fieldName => $fieldArguments): ?>
<?php
if(isset($fieldArguments['singleRowItem']) && $fieldArguments['singleRowItem']) {
$classes .= 'd-block ';
Expand Down

0 comments on commit 28d10be

Please sign in to comment.