Verified Commit 56765b81 authored by dockx thibault's avatar dockx thibault
Browse files

:sparkles: (Mail) - sub nodes attachments

Adds subnodes attachments during first creation.
Apply or update has to be fixed.
Showing with 62 additions and 35 deletions
+62 -35
......@@ -121,8 +121,8 @@ attributetype ( 1.3.6.1.4.1.38414.62.1.7 NAME 'fdMailTemplateSignature'
SUBSTR caseIgnoreSubstringsMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.40)
attributetype ( 1.3.6.1.4.1.38414.62.1.8 NAME 'fdMailTemplateAttachment'
DESC 'FusionDirectory - template mail field'
attributetype ( 1.3.6.1.4.1.38414.62.1.8 NAME 'fdMailAttachmentsContent'
DESC 'FusionDirectory - attachment data in bin format'
EQUALITY octetStringMatch
SUBSTR caseIgnoreSubstringsMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.40)
......@@ -447,8 +447,13 @@ objectclass (1.3.6.1.4.1.38414.62.2.3 NAME 'fdPluginManager'
objectclass (1.3.6.1.4.1.38414.62.2.4 NAME 'fdMailTemplate'
DESC 'FusionDirectory - template mail object'
SUP top STRUCTURAL
MUST ( cn $ fdMailTemplateBody $ fdMailTemplateSubject )
MAY ( fdMailTemplateSignature $ fdMailTemplateReadReceipt $ fdMailTemplateAttachment ) )
MAY ( fdMailTemplateSignature $ fdMailTemplateReadReceipt))
objectclass (1.3.6.1.4.1.38414.62.2.10 NAME 'fdMailAttachments'
DESC 'FusionDirectory - mail template attachments'
MUST ( cn $ fdMailAttachmentsContent ))
objectclass ( 1.3.6.1.4.1.38414.62.2.5 NAME 'fdMailTemplateConf'
DESC 'FusionDirectory Mail Template Configuration'
......
......@@ -26,14 +26,14 @@ class mailTemplate extends simplePlugin
public static function plInfo (): array
{
return [
'plShortName' => _('Mail Template'),
'plShortName' => _('Mail Template'),
'plDescription' => _('Mail Template'),
'plObjectClass' => ['fdMailTemplate'],
'plFilter' => '(objectClass=fdMailTemplate)',
'plObjectType' => ['mailTemplate' => [
'name' => _('Mail Template'),
'ou' => get_ou('mailTemplateRDN'),
'icon' => 'geticon.php?context=applications&icon=mail-template&size=16',
'plFilter' => '(objectClass=fdMailTemplate)',
'plObjectType' => ['mailTemplate' => [
'name' => _('Mail Template'),
'ou' => get_ou('mailTemplateRDN'),
'icon' => 'geticon.php?context=applications&icon=mail-template&size=16',
]],
'plProvidedAcls' => parent::generatePlProvidedAcls(static::getAttributesInfo())
];
......@@ -45,33 +45,46 @@ class mailTemplate extends simplePlugin
return [
// Attributes are grouped by section
'mailTemplate' => [
'name' => _('Mail Object'),
'name' => _('Mail Object'),
'attrs' => [
new StringAttribute(
_('Mail Template Name'), _('Mail Template Name'),
'cn', TRUE
),
new StringAttribute(
_('Mail Subject'), _('Mail Subject'),
'fdMailTemplateSubject', TRUE
),
new TextAreaAttribute(
_('Mail Template Body'), _('Text to be sent to recipient'),
'fdMailTemplateBody', TRUE
),
new TextAreaAttribute(
_('Mail Signature'), _('Mail Signature'),
'fdMailTemplateSignature', FALSE
),
new FileDownloadAttribute(
_('Attachment'), _('Import a file for this e-mail'),
'fdMailTemplateAttachment', FALSE, '', TRUE
),
new BooleanAttribute(
_('Read Receipt'),
_('Read Receipt'),
'fdMailTemplateReadReceipt', FALSE
),
new StringAttribute(
_('Mail Template Name'), _('Mail Template Name'),
'cn', TRUE
),
new StringAttribute(
_('Mail Subject'), _('Mail Subject'),
'fdMailTemplateSubject', TRUE
),
new TextAreaAttribute(
_('Mail Template Body'), _('Text to be sent to recipient'),
'fdMailTemplateBody', TRUE
),
new TextAreaAttribute(
_('Mail Signature'), _('Mail Signature'),
'fdMailTemplateSignature', FALSE
),
new BooleanAttribute(
_('Read Receipt'),
_('Read Receipt'),
'fdMailTemplateReadReceipt', FALSE
),
new SubNodesAttribute(
'', _('Attachments'),
'attachments', ['fdMailAttachments'],
[
new StringAttribute(
_('Name'), _('The name of the attachment file'),
'cn', TRUE
),
new FileDownloadAttribute(
_('Attachment'), _('Import a file for this e-mail'),
'fdMailAttachmentsContent', FALSE, '', TRUE
),
],
FALSE, /* no order */
[],
TRUE /* edit enabled */
),
]
],
];
......@@ -85,4 +98,13 @@ class mailTemplate extends simplePlugin
}
function ldap_save (): array
{
global $config;
$errors = parent::ldap_save();
$this->attributesAccess['attachments']->postLdapSave($config->get_ldap_link());
return $errors;
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment