| 1 |
<?php |
| 2 |
/* |
| 3 |
|
| 4 |
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/) |
| 5 |
Copyright (C) 2013 - 2026 Roland Gruber |
| 6 |
|
| 7 |
This program is free software; you can redistribute it and/or modify |
| 8 |
it under the terms of the GNU General Public License as published by |
| 9 |
the Free Software Foundation; either version 2 of the License, or |
| 10 |
(at your option) any later version. |
| 11 |
|
| 12 |
This program is distributed in the hope that it will be useful, |
| 13 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 |
GNU General Public License for more details. |
| 16 |
|
| 17 |
You should have received a copy of the GNU General Public License |
| 18 |
along with this program; if not, write to the Free Software |
| 19 |
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 20 |
*/ |
| 21 |
|
| 22 |
/** |
| 23 |
* Manages Kolab shared folders. |
| 24 |
* |
| 25 |
* @package modules |
| 26 |
* @author Roland Gruber |
| 27 |
*/ |
| 28 |
|
| 29 |
use LAM\TYPES\ConfiguredType; |
| 30 |
|
| 31 |
/** |
| 32 |
* Manages Kolab shared folders. |
| 33 |
* |
| 34 |
* @package modules |
| 35 |
*/ |
| 36 |
class kolabSharedFolder extends baseModule { |
| 37 |
|
| 38 |
/** @var array<string, string> $folderTypes list of folder types (label => id) */ |
| 39 |
private array $folderTypes; |
| 40 |
|
| 41 |
/** |
| 42 |
* Creates a new kolabSharedFolder object. |
| 43 |
* |
| 44 |
* @param string $scope account type (user, group, host) |
| 45 |
*/ |
| 46 |
public function __construct($scope) { |
| 47 |
// call parent constructor |
| 48 |
parent::__construct($scope); |
| 49 |
$this->folderTypes = [ |
| 50 |
_('Shared mail folder') => 'mail', |
| 51 |
]; |
| 52 |
} |
| 53 |
|
| 54 |
/** |
| 55 |
* {@inheritDoc} |
| 56 |
*/ |
| 57 |
public function can_manage(): bool { |
| 58 |
return $this->get_scope() === 'kolabSharedFolderType'; |
| 59 |
} |
| 60 |
|
| 61 |
/** |
| 62 |
* {@inheritDoc} |
| 63 |
*/ |
| 64 |
public function get_metaData(): array { |
| 65 |
$return = []; |
| 66 |
// icon |
| 67 |
$return['icon'] = 'kolab.png'; |
| 68 |
// alias name |
| 69 |
$return["alias"] = _("Kolab shared folder"); |
| 70 |
// this is a base module |
| 71 |
$return["is_base"] = true; |
| 72 |
// RDN attribute |
| 73 |
$return["RDN"] = ["cn" => "normal"]; |
| 74 |
// module dependencies |
| 75 |
$return['dependencies'] = ['depends' => [], 'conflicts' => []]; |
| 76 |
// LDAP filter |
| 77 |
$return["ldap_filter"] = ['or' => "(objectClass=kolabSharedFolder)"]; |
| 78 |
// managed object classes |
| 79 |
$return['objectClasses'] = ['kolabSharedFolder', 'mailrecipient']; |
| 80 |
// managed attributes |
| 81 |
$return['attributes'] = ['cn', 'kolabAllowSMTPRecipient', 'kolabAllowSMTPSender', 'acl', |
| 82 |
'alias', 'kolabDelegate', 'kolabFolderType', 'kolabTargetFolder', 'mail']; |
| 83 |
// help Entries |
| 84 |
$return['help'] = [ |
| 85 |
'cn' => [ |
| 86 |
"Headline" => _("Name"), 'attr' => 'cn', |
| 87 |
"Text" => _("Please enter a name for this folder.") |
| 88 |
], |
| 89 |
'mail' => [ |
| 90 |
"Headline" => _("Email address"), 'attr' => 'mail', |
| 91 |
"Text" => _("The folder's email address.") |
| 92 |
], |
| 93 |
'kolabAllowSMTPRecipient' => [ |
| 94 |
"Headline" => _('Allowed recipients'), 'attr' => 'kolabAllowSMTPRecipient', |
| 95 |
"Text" => _('Describes the allowed or disallowed SMTP recipient addresses for mail sent by this account (e.g. "domain.tld" or "[email protected]").') |
| 96 |
], |
| 97 |
'kolabAllowSMTPRecipientList' => [ |
| 98 |
"Headline" => _('Allowed recipients'), 'attr' => 'kolabAllowSMTPRecipient', |
| 99 |
"Text" => _('Describes the allowed or disallowed SMTP recipient addresses for mail sent by this account (e.g. "domain.tld" or "[email protected]").') |
| 100 |
. ' ' . _("Multiple values are separated by semicolon.") |
| 101 |
], |
| 102 |
'kolabAllowSMTPSender' => [ |
| 103 |
"Headline" => _('Allowed senders'), 'attr' => 'kolabAllowSMTPSender', |
| 104 |
"Text" => _('Describes the allowed or disallowed SMTP addresses sending mail to this account (e.g. "domain.tld" or "[email protected]").') |
| 105 |
], |
| 106 |
'kolabAllowSMTPSenderList' => [ |
| 107 |
"Headline" => _('Allowed senders'), 'attr' => 'kolabAllowSMTPSender', |
| 108 |
"Text" => _('Describes the allowed or disallowed SMTP addresses sending mail to this account (e.g. "domain.tld" or "[email protected]").') |
| 109 |
. ' ' . _("Multiple values are separated by semicolon.") |
| 110 |
], |
| 111 |
'delegate' => [ |
| 112 |
"Headline" => _("Delegates"), 'attr' => 'kolabDelegate', |
| 113 |
"Text" => _("Delegates are allowed to act on behalf of the shared folder. This property is checked when using the Kolab smtp daemon (Postfix) to send emails.") |
| 114 |
], |
| 115 |
'delegateList' => [ |
| 116 |
"Headline" => _("Delegates"), 'attr' => 'kolabDelegate', |
| 117 |
"Text" => _("This is a semi-colon separated list of delegates.") |
| 118 |
], |
| 119 |
'alias' => [ |
| 120 |
"Headline" => _("Email alias"), 'attr' => 'alias', |
| 121 |
"Text" => _("Email alias for this account.") |
| 122 |
], |
| 123 |
'aliasList' => [ |
| 124 |
"Headline" => _("Email alias list"), 'attr' => 'alias', |
| 125 |
"Text" => _("This is a comma separated list of eMail aliases.") |
| 126 |
], |
| 127 |
'kolabTargetFolder' => [ |
| 128 |
"Headline" => _("Target IMAP folder"), 'attr' => 'kolabTargetFolder', |
| 129 |
"Text" => _("The folder on the server where the shared folder is located (e.g. shared/[email protected]).") |
| 130 |
], |
| 131 |
'kolabFolderType' => [ |
| 132 |
"Headline" => _("Type"), 'attr' => 'kolabFolderType', |
| 133 |
"Text" => _("Specifies the folder type (e.g. shared mail folder).") |
| 134 |
], |
| 135 |
]; |
| 136 |
// upload fields |
| 137 |
$return['upload_columns'] = [ |
| 138 |
[ |
| 139 |
'name' => 'kolabSharedFolder_cn', |
| 140 |
'description' => _('Name'), |
| 141 |
'help' => 'cn', |
| 142 |
'example' => 'folder', |
| 143 |
'required' => true |
| 144 |
], |
| 145 |
[ |
| 146 |
'name' => 'kolabSharedFolder_mail', |
| 147 |
'description' => _('Email address'), |
| 148 |
'help' => 'mail', |
| 149 |
'example' => _('[email protected]'), |
| 150 |
'required' => true |
| 151 |
], |
| 152 |
[ |
| 153 |
'name' => 'kolabSharedFolder_kolabTargetFolder', |
| 154 |
'description' => _('Target IMAP folder'), |
| 155 |
'help' => 'kolabTargetFolder', |
| 156 |
'example' => 'shared/[email protected]', |
| 157 |
'required' => true |
| 158 |
], |
| 159 |
[ |
| 160 |
'name' => 'kolabSharedFolder_kolabFolderType', |
| 161 |
'description' => _('Type'), |
| 162 |
'help' => 'kolabFolderType', |
| 163 |
'example' => 'mail', |
| 164 |
'required' => true |
| 165 |
], |
| 166 |
[ |
| 167 |
'name' => 'kolabSharedFolder_kolabAllowSMTPRecipient', |
| 168 |
'description' => _('Allowed recipients'), |
| 169 |
'help' => 'kolabAllowSMTPRecipientList', |
| 170 |
'example' => '.com; -.net', |
| 171 |
], |
| 172 |
[ |
| 173 |
'name' => 'kolabSharedFolder_kolabAllowSMTPSender', |
| 174 |
'description' => _('Allowed senders'), |
| 175 |
'help' => 'kolabAllowSMTPSenderList', |
| 176 |
'example' => '.com; -.net', |
| 177 |
], |
| 178 |
[ |
| 179 |
'name' => 'kolabSharedFolder_aliases', |
| 180 |
'description' => _('Email aliases'), |
| 181 |
'help' => 'aliasList', |
| 182 |
'example' => 'user@domain,user2@domain' |
| 183 |
], |
| 184 |
[ |
| 185 |
'name' => 'kolabSharedFolder_delegates', |
| 186 |
'description' => _('Delegates'), |
| 187 |
'help' => 'delegateList', |
| 188 |
'example' => 'uid=user,ou=People,dc=example,dc=com;uid=user2,ou=People,dc=example,dc=com' |
| 189 |
], |
| 190 |
]; |
| 191 |
// available PDF fields |
| 192 |
$return['PDF_fields'] = [ |
| 193 |
'cn' => _('Name'), |
| 194 |
'kolabAllowSMTPRecipient' => _('Allowed recipients'), |
| 195 |
'kolabAllowSMTPSender' => _('Allowed senders'), |
| 196 |
'aliases' => _('Email aliases'), |
| 197 |
'delegate' => _('Delegates'), |
| 198 |
'mail' => _('Email address'), |
| 199 |
'kolabTargetFolder' => _('Target IMAP folder'), |
| 200 |
'kolabFolderType' => _('Type'), |
| 201 |
]; |
| 202 |
return $return; |
| 203 |
} |
| 204 |
|
| 205 |
/** |
| 206 |
* {@inheritDoc} |
| 207 |
*/ |
| 208 |
protected function load_Messages(): void { |
| 209 |
$this->messages['kolabAllowSMTPRecipient'][0] = ['ERROR', _('Allowed recipients'), _('Please enter a valid recipient expression.')]; |
| 210 |
$this->messages['kolabAllowSMTPRecipient'][1] = ['ERROR', _('Account %s:') . ' kolabSharedFolder_kolabAllowSMTPRecipient', _('Please enter a valid recipient expression.')]; |
| 211 |
$this->messages['kolabAllowSMTPSender'][0] = ['ERROR', _('Allowed senders'), _('Please enter a valid sender expression.')]; |
| 212 |
$this->messages['kolabAllowSMTPSender'][1] = ['ERROR', _('Account %s:') . ' kolabSharedFolder_kolabAllowSMTPSender', _('Please enter a valid sender expression.')]; |
| 213 |
$this->messages['alias'][0] = ['ERROR', _('Email alias is invalid!')]; // third array value is set dynamically |
| 214 |
$this->messages['alias'][1] = ['ERROR', _('Account %s:') . ' kolabSharedFolder_aliases', _('Email alias list has invalid format!')]; |
| 215 |
$this->messages['delegate'][0] = ['ERROR', _('Account %s:') . ' kolabSharedFolder_delegates', _('Unknown delegate: %s')]; |
| 216 |
$this->messages['mail'][0] = ['ERROR', _('Email address'), _('Please enter a valid email address!')]; |
| 217 |
$this->messages['mail'][1] = ['ERROR', _('Account %s:') . ' kolabSharedFolder_mail', _('Please enter a valid email address!')]; |
| 218 |
$this->messages['cn'][0] = ['ERROR', _('Name'), _('Please enter a name.')]; |
| 219 |
$this->messages['kolabTargetFolder'][0] = ['ERROR', _('Target IMAP folder'), _('Please enter a target folder.')]; |
| 220 |
} |
| 221 |
|
| 222 |
/** |
| 223 |
* {@inheritDoc} |
| 224 |
*/ |
| 225 |
public function display_html_attributes(): htmlElement|array { |
| 226 |
$container = new htmlResponsiveRow(); |
| 227 |
// name |
| 228 |
$this->addSimpleInputTextField($container, 'cn', _('Name'), true); |
| 229 |
// mail |
| 230 |
$this->addSimpleInputTextField($container, 'mail', _('Email address'), true); |
| 231 |
// target folder |
| 232 |
$this->addSimpleInputTextField($container, 'kolabTargetFolder', _('Target IMAP folder'), true); |
| 233 |
// folder type |
| 234 |
$possibleTypes = $this->folderTypes; |
| 235 |
$selectedTypes = ['mail']; |
| 236 |
if (!empty($this->attributes['kolabFolderType'])) { |
| 237 |
$selectedTypes = $this->attributes['kolabFolderType']; |
| 238 |
if (!in_array($this->attributes['kolabFolderType'][0], $possibleTypes)) { |
| 239 |
$possibleTypes[$this->attributes['kolabFolderType'][0]] = $this->attributes['kolabFolderType'][0]; |
| 240 |
} |
| 241 |
} |
| 242 |
$typeSelect = new htmlResponsiveSelect('kolabFolderType', $possibleTypes, $selectedTypes, _('Type'), 'kolabFolderType'); |
| 243 |
$typeSelect->setHasDescriptiveElements(true); |
| 244 |
$container->add($typeSelect); |
| 245 |
$container->addVerticalSpacer('1rem'); |
| 246 |
// allowed recipients |
| 247 |
$this->addMultiValueInputTextField($container, 'kolabAllowSMTPRecipient', _('Allowed recipients')); |
| 248 |
// allowed senders |
| 249 |
$this->addMultiValueInputTextField($container, 'kolabAllowSMTPSender', _('Allowed senders')); |
| 250 |
// mail aliases |
| 251 |
$container->add(new htmlSubTitle(_('Email aliases'))); |
| 252 |
$this->addMultiValueInputTextField($container, 'alias', null); |
| 253 |
// delegates |
| 254 |
$delegatesData = searchLDAPByAttribute('mail', '*', 'inetOrgPerson', ['dn'], ['user']); |
| 255 |
$delegates = []; |
| 256 |
for ($i = 0; $i < count($delegatesData); $i++) { |
| 257 |
$delegates[getAbstractDN($delegatesData[$i]['dn'])] = $delegatesData[$i]['dn']; |
| 258 |
} |
| 259 |
uksort($delegates, compareDN(...)); |
| 260 |
$container->add(new htmlSubTitle(_('Delegates'))); |
| 261 |
$delegatesContainer = new htmlTable(); |
| 262 |
if (isset($this->attributes['kolabDelegate'])) { |
| 263 |
for ($i = 0; $i < count($this->attributes['kolabDelegate']); $i++) { |
| 264 |
$delegateSelect = new htmlSelect('delegate' . $i, $delegates, [$this->attributes['kolabDelegate'][$i]]); |
| 265 |
$delegateSelect->setHasDescriptiveElements(true); |
| 266 |
$delegateSelect->setSortElements(false); |
| 267 |
$delegatesContainer->addElement($delegateSelect); |
| 268 |
$delegatesContainer->addElement(new htmlButton('delDelegate' . $i, 'del.svg', true)); |
| 269 |
if ($i === 0) { |
| 270 |
$delegatesContainer->addElement(new htmlHelpLink('delegate')); |
| 271 |
} |
| 272 |
$delegatesContainer->addNewLine(); |
| 273 |
} |
| 274 |
} |
| 275 |
// input box for new delegate |
| 276 |
$delegatesContainer->addElement(new htmlSelect('delegate', $delegates)); |
| 277 |
$delegatesContainer->addElement(new htmlButton('addDelegate', 'add.svg', true)); |
| 278 |
if (empty($this->attributes['kolabDelegate'])) { |
| 279 |
$delegatesContainer->addElement(new htmlHelpLink('delegate')); |
| 280 |
} |
| 281 |
$container->add($delegatesContainer); |
| 282 |
return $container; |
| 283 |
} |
| 284 |
|
| 285 |
/** |
| 286 |
* {@inheritDoc} |
| 287 |
*/ |
| 288 |
public function process_attributes(): array { |
| 289 |
$errors = []; |
| 290 |
// cn |
| 291 |
$this->attributes['cn'][0] = $_POST['cn']; |
| 292 |
if (empty($_POST['cn'])) { |
| 293 |
$errors[] = $this->messages['cn'][0]; |
| 294 |
} |
| 295 |
// mail |
| 296 |
$this->attributes['mail'][0] = $_POST['mail']; |
| 297 |
if (empty($_POST['mail']) || !get_preg($_POST['mail'], 'email')) { |
| 298 |
$errors[] = $this->messages['mail'][0]; |
| 299 |
} |
| 300 |
// target folder |
| 301 |
$this->attributes['kolabTargetFolder'][0] = $_POST['kolabTargetFolder']; |
| 302 |
if (empty($_POST['kolabTargetFolder'])) { |
| 303 |
$errors[] = $this->messages['kolabTargetFolder'][0]; |
| 304 |
} |
| 305 |
// folder type |
| 306 |
$this->attributes['kolabFolderType'][0] = $_POST['kolabFolderType']; |
| 307 |
// allowed recipients |
| 308 |
$this->processMultiValueInputTextField('kolabAllowSMTPRecipient', $errors, 'kolabEmailPrefix'); |
| 309 |
// allowed senders |
| 310 |
$this->processMultiValueInputTextField('kolabAllowSMTPSender', $errors, 'kolabEmailPrefix'); |
| 311 |
// mail aliases |
| 312 |
$this->processMultiValueInputTextField('alias', $errors, 'email'); |
| 313 |
// check old delegates |
| 314 |
$this->attributes['kolabDelegate'] = []; |
| 315 |
$i = 0; |
| 316 |
while (isset($_POST['delegate' . $i])) { |
| 317 |
if (isset($_POST['delDelegate' . $i])) { |
| 318 |
$i++; |
| 319 |
continue; |
| 320 |
} |
| 321 |
$this->attributes['kolabDelegate'][] = $_POST['delegate' . $i]; |
| 322 |
$i++; |
| 323 |
} |
| 324 |
// check new delegate |
| 325 |
if (isset($_POST['addDelegate']) && ($_POST['delegate'] != "")) { |
| 326 |
$this->attributes['kolabDelegate'][] = $_POST['delegate']; |
| 327 |
} |
| 328 |
$this->attributes['kolabDelegate'] = array_unique($this->attributes['kolabDelegate']); |
| 329 |
return $errors; |
| 330 |
} |
| 331 |
|
| 332 |
/** |
| 333 |
* {@inheritDoc} |
| 334 |
*/ |
| 335 |
public function build_uploadAccounts(array $rawAccounts, array $ids, array &$partialAccounts, array $selectedModules, ConfiguredType &$type): array { |
| 336 |
$messages = []; |
| 337 |
$delegates = searchLDAPByAttribute(null, null, 'inetOrgPerson', ['dn'], ['user']); |
| 338 |
for ($d = 0; $d < count($delegates); $d++) { |
| 339 |
if (isset($delegates[$d]['dn'])) { |
| 340 |
$delegates[$d] = $delegates[$d]['dn']; |
| 341 |
} |
| 342 |
} |
| 343 |
for ($i = 0; $i < count($rawAccounts); $i++) { |
| 344 |
// add object classes |
| 345 |
if (!in_array('kolabSharedFolder', $partialAccounts[$i]['objectClass'])) { |
| 346 |
$partialAccounts[$i]['objectClass'][] = 'kolabSharedFolder'; |
| 347 |
} |
| 348 |
if (!in_array('mailrecipient', $partialAccounts[$i]['objectClass'])) { |
| 349 |
$partialAccounts[$i]['objectClass'][] = 'mailrecipient'; |
| 350 |
} |
| 351 |
// cn |
| 352 |
$partialAccounts[$i]['cn'] = $rawAccounts[$i][$ids['kolabSharedFolder_cn']]; |
| 353 |
// mail |
| 354 |
$this->mapSimpleUploadField($rawAccounts, $ids, $partialAccounts, $i, 'kolabSharedFolder_mail', 'mail', |
| 355 |
'email', $this->messages['mail'][1], $messages); |
| 356 |
// target folder |
| 357 |
$partialAccounts[$i]['kolabTargetFolder'] = $rawAccounts[$i][$ids['kolabSharedFolder_kolabTargetFolder']]; |
| 358 |
// folder type |
| 359 |
$partialAccounts[$i]['kolabFolderType'] = $rawAccounts[$i][$ids['kolabSharedFolder_kolabFolderType']]; |
| 360 |
// allowed recipients |
| 361 |
$this->mapSimpleUploadField($rawAccounts, $ids, $partialAccounts, $i, 'kolabSharedFolder_kolabAllowSMTPRecipient', 'kolabAllowSMTPRecipient', 'kolabEmailPrefix', $this->messages['kolabAllowSMTPRecipient'][1], $messages, '/;[ ]*/'); |
| 362 |
// allowed senders |
| 363 |
$this->mapSimpleUploadField($rawAccounts, $ids, $partialAccounts, $i, 'kolabSharedFolder_kolabAllowSMTPSender', 'kolabAllowSMTPSender', 'kolabEmailPrefix', $this->messages['kolabAllowSMTPSender'][1], $messages, '/;[ ]*/'); |
| 364 |
// add mail aliases |
| 365 |
$this->mapSimpleUploadField($rawAccounts, $ids, $partialAccounts, $i, 'kolabSharedFolder_aliases', 'alias', 'email', $this->messages['alias'][1], $messages, '/,[ ]*/'); |
| 366 |
// add delegates |
| 367 |
if ($rawAccounts[$i][$ids['kolabSharedFolder_delegates']] != "") { |
| 368 |
$newDelegates = explode(';', $rawAccounts[$i][$ids['kolabSharedFolder_delegates']]); |
| 369 |
// check format |
| 370 |
for ($d = 0; $d < count($newDelegates); $d++) { |
| 371 |
if (in_array($newDelegates[$d], $delegates)) { |
| 372 |
$partialAccounts[$i]['kolabDelegate'][] = $newDelegates[$d]; |
| 373 |
} |
| 374 |
// invalid format |
| 375 |
else { |
| 376 |
$errMsg = $this->messages['delegate'][0]; |
| 377 |
$errMsg[] = [$i, $newDelegates[$d]]; |
| 378 |
$messages[] = $errMsg; |
| 379 |
} |
| 380 |
} |
| 381 |
} |
| 382 |
} |
| 383 |
return $messages; |
| 384 |
} |
| 385 |
|
| 386 |
/** |
| 387 |
* {@inheritDoc} |
| 388 |
*/ |
| 389 |
public function get_pdfEntries(array $pdfKeys, string $typeId): array { |
| 390 |
$return = []; |
| 391 |
$this->addSimplePDFField($return, 'cn', _('Name')); |
| 392 |
$this->addSimplePDFField($return, 'mail', _('Email address')); |
| 393 |
$this->addSimplePDFField($return, 'kolabTargetFolder', _('Target IMAP folder')); |
| 394 |
$this->addSimplePDFField($return, 'kolabAllowSMTPRecipient', _('Allowed recipients')); |
| 395 |
$this->addSimplePDFField($return, 'kolabAllowSMTPSender', _('Allowed senders')); |
| 396 |
$this->addSimplePDFField($return, 'aliases', _('Email aliases'), 'alias'); |
| 397 |
$this->addSimplePDFField($return, 'delegate', _('Delegates'), 'kolabDelegate', '; '); |
| 398 |
if (!empty($this->attributes['kolabFolderType'])) { |
| 399 |
$type = $this->attributes['kolabFolderType'][0]; |
| 400 |
$typeList = array_flip($this->folderTypes); |
| 401 |
if (isset($typeList[$type])) { |
| 402 |
$type = $typeList[$type]; |
| 403 |
} |
| 404 |
$this->addPDFKeyValue($return, 'kolabFolderType', _('Type'), $type); |
| 405 |
} |
| 406 |
return $return; |
| 407 |
} |
| 408 |
|
| 409 |
/** |
| 410 |
* @inheritDoc |
| 411 |
*/ |
| 412 |
public function getListAttributeDescriptions(ConfiguredType $type): array { |
| 413 |
return [ |
| 414 |
"cn" => _('Name'), |
| 415 |
"mail" => _('Email address'), |
| 416 |
"kolabdelegate" => _('Delegates'), |
| 417 |
'alias' => _('Email aliases'), |
| 418 |
]; |
| 419 |
} |
| 420 |
|
| 421 |
/** |
| 422 |
* @inheritDoc |
| 423 |
*/ |
| 424 |
public function getListRenderFunction(string $attributeName, ConfiguredType $type): ?callable { |
| 425 |
if ($attributeName === 'mail') { |
| 426 |
return function(array $entry, string $attribute): htmlElement { |
| 427 |
$group = new htmlGroup(); |
| 428 |
if (isset($entry[$attribute][0]) && ($entry[$attribute][0] != '')) { |
| 429 |
for ($i = 0; $i < count($entry[$attribute]); $i++) { |
| 430 |
if ($i > 0) { |
| 431 |
$group->addElement(new htmlOutputText(", ")); |
| 432 |
} |
| 433 |
$group->addElement(new htmlLink($entry[$attribute][$i], "mailto:" . $entry[$attribute][$i])); |
| 434 |
} |
| 435 |
} |
| 436 |
return $group; |
| 437 |
}; |
| 438 |
} |
| 439 |
return null; |
| 440 |
} |
| 441 |
|
| 442 |
} |