diff --git a/contrib/openldap/core-fd.schema b/contrib/openldap/core-fd.schema index 792d5c80ecca3dce8648eb97f8211db41a26632a..06b2b2fe4b062a2d4fd3f96aa571e5f4d0d1705a 100644 --- a/contrib/openldap/core-fd.schema +++ b/contrib/openldap/core-fd.schema @@ -93,6 +93,45 @@ attributetype ( 1.3.6.1.4.1.38414.62.11.5 NAME 'fdSubscriptionName' DESC 'FusionDirectory - Subscription client name' SUP name ) +### Mail Template Related Attributes ### + +attributetype ( 1.3.6.1.4.1.38414.88.1.1 NAME 'fdMailTemplateBody' + DESC 'FusionDirectory - template mail field' + EQUALITY octetStringMatch + SUBSTR caseIgnoreSubstringsMatch + SYNTAX 1.3.6.1.4.1.1466.115.121.1.40) + +attributetype ( 1.3.6.1.4.1.38414.88.1.2 NAME 'fdMailTemplateRDN' + DESC 'FusionDirectory - template Mail RDN' + EQUALITY caseExactIA5Match + SUBSTR caseExactIA5SubstringsMatch + SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 + SINGLE-VALUE) + +attributetype ( 1.3.6.1.4.1.38414.88.1.3 NAME 'fdMailTemplateSignature' + DESC 'FusionDirectory - template mail field' + EQUALITY octetStringMatch + SUBSTR caseIgnoreSubstringsMatch + SYNTAX 1.3.6.1.4.1.1466.115.121.1.40) + +attributetype ( 1.3.6.1.4.1.38414.88.1.4 NAME 'fdMailTemplateAttachment' + DESC 'FusionDirectory - template mail field' + EQUALITY octetStringMatch + SUBSTR caseIgnoreSubstringsMatch + SYNTAX 1.3.6.1.4.1.1466.115.121.1.40) + +attributetype ( 1.3.6.1.4.1.38414.88.1.5 NAME 'fdMailTemplateReadReceipt' + DESC 'FusionDirectory - template mail field' + EQUALITY octetStringMatch + SUBSTR caseIgnoreSubstringsMatch + SYNTAX 1.3.6.1.4.1.1466.115.121.1.40) + +attributetype ( 1.3.6.1.4.1.38414.88.1.6 NAME 'fdMailTemplateSubject' + DESC 'FusionDirectory - template mail field' + EQUALITY octetStringMatch + SUBSTR caseIgnoreSubstringsMatch + SYNTAX 1.3.6.1.4.1.1466.115.121.1.40) + # Classes objectclass ( 1.3.6.1.4.1.10098.1.2.1.19.4 NAME 'gosaDepartment' SUP top AUXILIARY @@ -130,3 +169,16 @@ objectclass ( 1.3.6.1.4.1.38414.62.2.2 NAME 'fdSubscriptionInformation' SUP top DESC 'FusionDirectory - Information about current subscription' MUST ( cn ) MAY ( uid $ fdSubscriptionStartDate $ fdSubscriptionEndDate $ fdSubscriptionType $ fdSubscriptionContractId $ fdSubscriptionName )) + +### Mail Template Related Object Class ### + +objectclass (1.3.6.1.4.1.38414.88.2.1 NAME 'fdMailTemplate' + DESC 'FusionDirectory - template mail object' + MUST ( cn $ fdMailTemplateBody $ fdMailTemplateSubject ) + MAY ( fdMailTemplateSignature $ fdMailTemplateReadReceipt $ fdMailTemplateAttachment ) ) + +objectclass ( 1.3.6.1.4.1.38414.88.2.2 NAME 'fdMailTemplateConf' + DESC 'FusionDirectory Mail Template Configuration' + SUP top AUXILIARY + MUST ( cn ) + MAY ( fdMailTemplateRDN ) ) diff --git a/plugins/addons/mailtemplate/class_mailTemplate.inc b/plugins/addons/mailtemplate/class_mailTemplate.inc new file mode 100644 index 0000000000000000000000000000000000000000..21cd65f15a4f032313e5cb5f3c68d7287177e8c4 --- /dev/null +++ b/plugins/addons/mailtemplate/class_mailTemplate.inc @@ -0,0 +1,88 @@ +<?php +/* + This code is part of FusionDirectory (http://www.fusiondirectory.org/) + + Copyright (C) 2012-2022 FusionDirectory + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. +*/ + +class mailTemplate extends simplePlugin +{ + var $displayHeader = FALSE; + + public static function plInfo (): array + { + return [ + 'plShortName' => _('Mail Template'), + 'plDescription' => _('Mail Tempmlate'), + 'plObjectClass' => ['fdMailTemplate'], + 'plFilter' => '(objectClass=fdMailTemplate)', + 'plObjectType' => ['mailTemplate' => [ + 'name' => _('Mail Template'), + 'ou' => get_ou('mailTemplateRDN'), + 'icon' => 'geticon.php?context=applications&icon=dsa&size=16', + ]], + 'plProvidedAcls' => parent::generatePlProvidedAcls(static::getAttributesInfo()) + ]; + } + + static function getAttributesInfo (): array + { + global $config; + return [ + // Attributes are grouped by section + 'mailTemplate' => [ + '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 FileAttribute( + _('Attachment'), _('Import a file for this e-mail'), + 'fdMailTemplateAttachment', FALSE + ), + new BooleanAttribute( + _('Read Receipt'), + _('Read Receipt'), + 'fdMailTemplateReadReceipt', FALSE + ), + ] + ], + ]; + } + + + function __construct ($dn = NULL, $object = NULL, $parent = NULL, $mainTab = FALSE) + { + global $config; + parent::__construct($dn, $object, $parent, $mainTab); + + } + +} diff --git a/plugins/addons/mailtemplate/class_mailTemplateManagement.inc b/plugins/addons/mailtemplate/class_mailTemplateManagement.inc new file mode 100644 index 0000000000000000000000000000000000000000..f211ee33e68752f8e80ee13fe67b105787ee904d --- /dev/null +++ b/plugins/addons/mailtemplate/class_mailTemplateManagement.inc @@ -0,0 +1,159 @@ +<?php + +/* + This code is part of FusionDirectory (http://www.fusiondirectory.org/) + Copyright (C) 2011-2022 FusionDirectory + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. +*/ + +class mailTemplateManagement extends management +{ + + public static $columns = [ + ['ObjectTypeColumn', []], + ['LinkColumn', ['attributes' => 'cn', 'label' => 'Template Name']], + ['ActionsColumn', ['label' => 'Actions']], + ]; + + static function plInfo (): array + { + return [ + 'plShortName' => _('Mail Template'), + 'plTitle' => _('Mail Template'), + 'plDescription' => _('Manages mails templates'), + 'plIcon' => 'geticon.php?context=types&icon=user&size=48', + 'plManages' => ['mailTemplate'], + 'plSection' => 'conf', + 'plPriority' => 30, + 'plProvidedAcls' => [], + ]; + } + + protected function configureActions () + { + global $config; + + $createMenu = []; + + foreach ($this->objectTypes as $type) { + $infos = objects::infos($type); + $img = 'geticon.php?context=actions&icon=document-new&size=16'; + if (isset($infos['icon'])) { + $img = $infos['icon']; + } + $createMenu[] = new Action( + 'new_'.$type, $infos['name'], $img, + '0', 'newEntry', + [$infos['aclCategory'].'/'.$infos['mainTab'].'/c'] + ); + } + + $this->registerAction( + new SubMenuAction( + 'new', _('Create'), 'geticon.php?context=actions&icon=document-new&size=16', + $createMenu + ) + ); + + // Add export actions + $exportMenu = []; + foreach ($this->exporters as $action => $exporter) { + $exportMenu[] = new Action( + $action, $exporter['label'], $exporter['image'], + '0', 'export' + ); + } + $this->registerAction( + new SubMenuAction( + 'export', _('Export list'), 'geticon.php?context=actions&icon=document-export&size=16', + $exportMenu + ) + ); + + $this->registerAction( + new Action( + 'edit', _('Edit'), 'geticon.php?context=actions&icon=document-edit&size=16', + '+', 'editEntry' + ) + ); + $this->actions['edit']->setSeparator(TRUE); + + if (!$this->skipCpHandler) { + $this->registerAction( + new Action( + 'cut', _('Cut'), 'geticon.php?context=actions&icon=edit-cut&size=16', + '+', 'copyPasteHandler', + ['dr'] + ) + ); + $this->registerAction( + new Action( + 'copy', _('Copy'), 'geticon.php?context=actions&icon=edit-copy&size=16', + '+', 'copyPasteHandler', + ['r'] + ) + ); + $this->registerAction( + new Action( + 'paste', _('Paste'), 'geticon.php?context=actions&icon=edit-paste&size=16', + '0', 'copyPasteHandler', + ['w'] + ) + ); + $this->actions['paste']->setEnableFunction([$this, 'enablePaste']); + } + + $this->registerAction( + new Action( + 'remove', _('Remove'), 'geticon.php?context=actions&icon=edit-delete&size=16', + '+', 'removeRequested', + ['d'] + ) + ); + + if (!static::$skipSnapshots && ($config->get_cfg_value('enableSnapshots') == 'TRUE')) { + $this->registerAction( + new Action( + 'snapshot', _('Create snapshot'), 'geticon.php?context=actions&icon=snapshot&size=16', + '1', 'createSnapshotDialog', + ['/SnapshotHandler/c'] + ) + ); + $this->registerAction( + new Action( + 'restore', _('Restore snapshot'), 'geticon.php?context=actions&icon=document-restore&size=16', + '*', 'restoreSnapshotDialog', + ['w', '/SnapshotHandler/r'] + ) + ); + $this->actions['snapshot']->setSeparator(TRUE); + $this->actions['restore']->setEnableFunction([$this, 'enableSnapshotRestore']); + } + + + /* Actions from footer are not in any menus and do not need a label */ + $this->registerAction(new HiddenAction('apply', 'applyChanges')); + $this->registerAction(new HiddenAction('save', 'saveChanges')); + $this->registerAction(new HiddenAction('cancel', 'cancelEdit')); + $this->registerAction(new HiddenAction('cancelDelete', 'cancelEdit')); + $this->registerAction(new HiddenAction('removeConfirmed', 'removeConfirmed')); + if (!$this->skipConfiguration) { + $this->registerAction(new HiddenAction('configure', 'configureDialog')); + } + } + + +} diff --git a/plugins/config/mailtemplate/class_mailTemplateConfig.inc b/plugins/config/mailtemplate/class_mailTemplateConfig.inc new file mode 100644 index 0000000000000000000000000000000000000000..6a6c26678556bef3c5b2dc961bce7602de848e7f --- /dev/null +++ b/plugins/config/mailtemplate/class_mailTemplateConfig.inc @@ -0,0 +1,52 @@ +<?php +/* + This code is part of FusionDirectory (http://www.fusiondirectory.org/) + Copyright (C) 2012-2016 FusionDirectory + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. +*/ + +class mailTemplateConfig extends multiPluginSection +{ + static function plInfo (): array + { + return [ + 'plShortName' => _('mail template configuration'), + 'plDescription' => _('FusionDirectory mail template plugin configuration'), + 'plObjectClass' => ['fdMailTemplateConf'], + 'plCategory' => ['configuration'], + 'plObjectType' => ['smallConfig'], + + 'plProvidedAcls' => parent::generatePlProvidedAcls(static::getAttributesInfo()) + ]; + } + + static function getAttributesInfo (): array + { + return [ + 'mailTemplateConf' => [ + 'name' => _('Mail Template'), + 'attrs' => [ + new StringAttribute( + _('Mail Template RDN'), _('Branch in which Directory Base, mails templates will be stored'), + 'fdMailTemplateRDN', TRUE, + 'ou=mailTemplate' + ), + ] + ], + ]; + } +} +