Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
fusiondirectory
fusiondirectory-plugins
Commits
88cc9097
Commit
88cc9097
authored
Nov 26, 2012
by
Benoit Mortier
Browse files
Fixes:
#1598
parent
805f1a4d
Changes
21
Hide whitespace changes
Inline
Side-by-side
alias/admin/alias/alias-filter.tpl
0 → 100644
View file @
88cc9097
<div
class=
"contentboxh"
>
<p
class=
"contentboxh"
>
<img
src=
"images/launch.png"
align=
"right"
alt=
"[F]"
>
{
t
}
Filter
{/
t
}
</p>
</div>
<div
class=
"contentboxb"
>
{
$MAILREDIRECTION
}
<label
for=
"MAILREDIRECTION"
>
{
t
}
Show mail redirections
{/
t
}
</label><br>
{
$MAILDISTRIBUTION
}
<label
for=
"MAILDISTRIBUTION"
>
{
t
}
Show mail distribution
{/
t
}
</label><br>
{
if
class_available
(
'sympaAlias'
)
}
{
$SYMPAALIAS
}
<label
for=
"SYMPAALIAS"
>
{
t
}
Show sympa list alias
{/
t
}
</label><br>
{/
if
}
<div
style=
"border-top:1px solid #AAAAAA"
></div>
{
$SCOPE
}
<table
summary=
""
style=
"width:100%;border-top:1px solid #B0B0B0;"
>
<tr>
<td>
<label
for=
"NAME"
>
<img
src=
"images/lists/search.png"
align=
middle
>
{
t
}
Name
{/
t
}
</label>
</td>
<td>
{
$NAME
}
</td>
</tr>
</table>
<table
summary=
""
width=
"100%"
style=
"background:#EEEEEE;border-top:1px solid #B0B0B0;"
>
<tr>
<td
width=
"100%"
align=
"right"
>
{
$APPLY
}
</td>
</tr>
</table>
</div>
alias/admin/alias/alias-filter.xml
0 → 100644
View file @
88cc9097
<?xml version="1.0" encoding="UTF-8"?>
<filterdef>
<definition>
<category>
alias
</category>
<template>
alias-filter.tpl
</template>
<initial>
true
</initial>
</definition>
<search>
<query>
<backend>
LDAP
</backend>
<filter>
(
&
(|$MAILREDIRECTION$MAILDISTRIBUTION$SYMPAALIAS)$NAME)
</filter>
<attribute>
dn
</attribute>
<attribute>
cn
</attribute>
<attribute>
mail
</attribute>
<attribute>
description
</attribute>
</query>
<scope>
auto
</scope>
</search>
<element>
<type>
textfield
</type>
<tag>
NAME
</tag>
<size>
20
</size>
<maxlength>
60
</maxlength>
<default></default>
<unset></unset>
<set>
(|(cn=*$*)(mail=*$*)(description=*$*))
</set>
<alphabet>
true
</alphabet>
<autocomplete>
<backend>
LDAP
</backend>
<filter>
(
&
(|$MAILREDIRECTION$MAILDISTRIBUTION$SYMPAALIAS)(|(mail=*$NAME*)(cn=*$NAME*)(description=*$NAME*)))
</filter>
<attribute>
cn
</attribute>
<attribute>
mail
</attribute>
<attribute>
description
</attribute>
<frequency>
0.5
</frequency>
<characters>
3
</characters>
</autocomplete>
</element>
<element>
<type>
checkbox
</type>
<tag>
MAILREDIRECTION
</tag>
<default>
true
</default>
<unset></unset>
<set>
(objectClass=mailAliasRedirection)
</set>
</element>
<element>
<type>
checkbox
</type>
<tag>
MAILDISTRIBUTION
</tag>
<default>
true
</default>
<unset></unset>
<set>
(objectClass=mailAliasDistribution)
</set>
</element>
<element>
<type>
checkbox
</type>
<tag>
SYMPAALIAS
</tag>
<default>
true
</default>
<unset></unset>
<set>
(objectClass=sympaAlias)
</set>
</element>
</filterdef>
alias/admin/alias/alias-list.tpl
0 → 100644
View file @
88cc9097
<input
type=
'image'
src=
'images/empty.png'
name=
'no_action_posted'
value=
'do_nothing'
alt=
''
style=
'width:2px;height:2px;'
>
<table
summary=
""
border=
"0"
style=
"width:100%;height:100%; vertical-align:top; text-align:left;"
cellpadding=
2
>
<tr>
<td
style=
"vertical-align:top;height:100%"
>
<div
class=
"contentboxh"
>
<p
class=
"contentboxh"
>
{
$HEADLINE
}
{
$SIZELIMIT
}
</p>
</div>
<div
class=
"contentboxb"
>
<div
style=
'background:white;padding:3px'
>
<table><tr>
<td>
{
$ROOT
}
</td><td>
{
$BACK
}
</td><td>
{
$HOME
}
</td><td>
{
$RELOAD
}
</td><td>
{
$SEPARATOR
}
</td><td>
{
t
}
Base
{/
t
}
{
$BASE
}
</td><td>
{
$SEPARATOR
}
</td><td><img
src=
'images/rocket.png'
alt=
''
class=
'center'
></td><td>
{
$ACTIONS
}
</td>
</tr></table>
</div>
</div>
<div
style=
'height:4px;'
>
</div>
{
$LIST
}
</td>
<td
style=
'vertical-align:top;min-width:250px'
>
{
$FILTER
}
</td>
</tr>
</table>
<input
type=
"hidden"
name=
"ignore"
>
alias/admin/alias/alias-list.xml
0 → 100644
View file @
88cc9097
<?xml version="1.0" encoding="UTF-8"?>
<list>
<definition>
<departmentBrowser>
true
</departmentBrowser>
<departmentRootVisible>
true
</departmentRootVisible>
<baseMode>
true
</baseMode>
<multiSelect>
true
</multiSelect>
<template>
alias-list.tpl
</template>
<module>
alias
</module>
<label>
List of Mail aliases
</label>
<defaultSortColumn>
1
</defaultSortColumn>
<objectType>
<label>
Mail redirection
</label>
<objectClass>
mailAliasRedirection
</objectClass>
<category>
alias
</category>
<class>
mailAliasRedirection
</class>
<image>
plugins/alias/images/mailredirection.png
</image>
</objectType>
<objectType>
<label>
Mail distribution
</label>
<objectClass>
mailAliasDistribution
</objectClass>
<category>
alias
</category>
<class>
mailAliasDistribution
</class>
<image>
plugins/alias/images/maildistribution.png
</image>
</objectType>
<objectType>
<label>
Sympa list alias
</label>
<objectClass>
sympaAlias
</objectClass>
<category>
alias
</category>
<class>
sympaAlias
</class>
<image>
plugins/sympa/images/sympa_icon.png
</image>
</objectType>
</definition>
<table>
<layout>
|20px;c||||100px;r|
</layout>
<department>
<value>
%{filter:objectType(dn,objectClass)}
</value>
</department>
<department>
<value>
%{filter:departmentLink(row,dn,description)}
</value>
<span>
3
</span>
</department>
<column>
<value>
%{filter:objectType(dn,objectClass)}
</value>
</column>
<column>
<label>
Name
</label>
<sortAttribute>
cn
</sortAttribute>
<sortType>
string
</sortType>
<value>
%{filter:link(row,dn,"%s",cn)}
</value>
<export>
true
</export>
</column>
<column>
<label>
Description
</label>
<sortAttribute>
description
</sortAttribute>
<sortType>
string
</sortType>
<value>
%{filter:link(row,dn,"%s",description)}
</value>
<export>
true
</export>
</column>
<column>
<label>
aliasExpirationDate
</label>
<sortAttribute>
aliasExpirationDate
</sortAttribute>
<sortType>
integer
</sortType>
<value>
%{filter:link(row,dn,"%s",aliasExpirationDate)}
</value>
<export>
true
</export>
</column>
<column>
<label>
Actions
</label>
<value>
%{filter:actions(dn,row,objectClass)}
</value>
</column>
</table>
<actionmenu>
<action>
<type>
sub
</type>
<image>
images/lists/new.png
</image>
<label>
Create
</label>
<action>
<name>
new_mailAliasRedirection
</name>
<type>
entry
</type>
<image>
plugins/alias/images/alias-mini.png
</image>
<label>
Mail redirection
</label>
</action>
<action>
<name>
new_mailAliasDistribution
</name>
<type>
entry
</type>
<image>
plugins/alias/images/alias-mini.png
</image>
<label>
Mail distribution
</label>
</action>
<action>
<name>
new_sympaAlias
</name>
<type>
entry
</type>
<image>
plugins/alias/images/alias-mini.png
</image>
<label>
Sympa alias
</label>
<depends>
sympaAlias
</depends>
</action>
</action>
<action>
<name>
edit
</name>
<type>
entry
</type>
<image>
images/lists/edit.png
</image>
<label>
Edit
</label>
</action>
<action>
<name>
remove
</name>
<type>
entry
</type>
<image>
images/lists/trash.png
</image>
<label>
Remove
</label>
</action>
<action>
<type>
separator
</type>
</action>
<action>
<type>
exporter
</type>
</action>
<action>
<type>
separator
</type>
</action>
<action>
<type>
copypaste
</type>
</action>
<action>
<type>
snapshot
</type>
</action>
</actionmenu>
<actiontriggers
snapshot=
"true"
copypaste=
"true"
>
<action>
<name>
cp
</name>
<type>
copypaste
</type>
</action>
<action>
<name>
edit
</name>
<type>
entry
</type>
<image>
images/lists/edit.png
</image>
<label>
Edit alias
</label>
</action>
<action>
<name>
snapshot
</name>
<type>
snapshot
</type>
</action>
<action>
<name>
remove
</name>
<type>
entry
</type>
<image>
images/lists/trash.png
</image>
<acl>
alias/mailAliasRedirection[d]
</acl>
<label>
Remove alias
</label>
</action>
</actiontriggers>
</list>
alias/admin/alias/class_aliasManagement.inc
0 → 100644
View file @
88cc9097
<?php
/*
* This code is part of FusionDirectory (http://www.fusiondirectory.org/)
* Copyright (C) 2010 Antoine Gallavardin
* Copyright (C) 2012 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
aliasManagement
extends
management
{
// Tab definitions
protected
$tabClass
=
"aliastabs"
;
protected
$aclCategory
=
"alias"
;
protected
$aclPlugin
=
"alias"
;
protected
$objectName
=
"alias"
;
/* Return plugin informations for acl handling */
public
static
function
plInfo
()
{
return
array
(
"plShortName"
=>
_
(
"Aliases"
),
"plDescription"
=>
_
(
"Alias management"
),
"plIcon"
=>
"plugins/alias/images/alias.png"
,
"plSelfModify"
=>
FALSE
,
"plSection"
=>
"admin"
,
"plPriority"
=>
30
,
"plCategory"
=>
array
(
"alias"
=>
array
(
"description"
=>
_
(
"Mail aliases"
),
"objectClass"
=>
array
(
"mailAliasRedirection"
,
"mailAliasDistribution"
))),
"plProvidedAcls"
=>
array
()
);
}
function
__construct
(
$config
,
$ui
)
{
$this
->
config
=
$config
;
$this
->
ui
=
$ui
;
$this
->
storagePoints
=
array
(
get_ou
(
"aliasRDN"
));
// Build filter
if
(
session
::
global_is_set
(
get_class
(
$this
)
.
"_filter"
))
{
$filter
=
session
::
global_get
(
get_class
(
$this
)
.
"_filter"
);
}
else
{
$filter
=
new
filter
(
get_template_path
(
"alias-filter.xml"
,
TRUE
));
$filter
->
setObjectStorage
(
$this
->
storagePoints
);
}
$this
->
setFilter
(
$filter
);
// Build headpage
$headpage
=
new
listing
(
get_template_path
(
"alias-list.xml"
,
TRUE
));
$headpage
->
registerElementFilter
(
"filterProperties"
,
"aliasManagement::filterProperties"
);
$headpage
->
setFilter
(
$filter
);
parent
::
__construct
(
$config
,
$ui
,
"alias"
,
$headpage
);
$this
->
registerAction
(
"edit_alias"
,
"editEntry"
);
$this
->
registerAction
(
"new_mailAliasRedirection"
,
"newEntry"
);
$this
->
registerAction
(
"new_mailAliasDistribution"
,
"newEntry"
);
$this
->
registerAction
(
"new_sympaAlias"
,
"newEntry"
);
}
// Overridden new handler - We've different types of departments to create!
function
newEntry
(
$action
=
""
,
$target
=
array
(),
$all
=
array
(),
$altTabClass
=
""
,
$altTabType
=
""
,
$altAclCategory
=
""
)
{
$type
=
preg_replace
(
"/^new_/"
,
""
,
$action
);
return
management
::
newEntry
(
$action
,
$target
,
$all
,
$this
->
tabClass
,
strtoupper
(
$type
)
.
'TABS'
,
$this
->
aclCategory
);
}
function
editEntry
(
$action
=
""
,
$target
=
array
(),
$all
=
array
(),
$altTabClass
=
""
,
$altTabType
=
""
,
$altAclCategory
=
""
)
{
$type
=
$this
->
getHeadpage
()
->
getType
(
$target
[
0
]);
$str
=
management
::
editEntry
(
$action
,
$target
,
$all
,
$this
->
tabClass
,
strtoupper
(
$type
)
.
'TABS'
,
$this
->
aclCategory
);
if
(
preg_match
(
"/^edit_/"
,
$action
))
{
$tab
=
preg_replace
(
"/^edit_/"
,
""
,
$action
);
if
(
isset
(
$this
->
tabObject
->
by_object
[
$tab
]))
{
$this
->
tabObject
->
current
=
$tab
;
}
else
{
trigger_error
(
"Unknown tab: "
.
$tab
);
}
}
if
(
!
empty
(
$str
))
{
return
$str
;
}
}
function
removeEntryConfirmed
(
$action
=
""
,
$target
=
array
(),
$all
=
array
(),
$altTabClass
=
""
,
$altTabType
=
""
,
$altAclCategory
=
""
)
{
$headpage
=
$this
->
getHeadpage
();
$targets
=
array
();
foreach
(
$this
->
dns
as
$dn
)
{
$type
=
$headpage
->
getType
(
$dn
);
if
(
empty
(
$type
))
{
continue
;
}
$targets
[
$type
][]
=
$dn
;
}
foreach
(
$targets
as
$type
=>
$dns
)
{
$this
->
dns
=
$dns
;
management
::
removeEntryConfirmed
(
$action
,
$target
,
$all
,
$this
->
tabClass
,
strtoupper
(
$type
)
.
'TABS'
,
$this
->
aclCategory
);
}
}
/*! \brief This method is used to queue and process copy&paste actions.
* Allows to copy, cut and paste mutliple entries at once.
* @param String 'action' The name of the action which was the used as trigger.
* @param Array 'target' A list of object dns, which should be affected by this method.
* @param Array 'all' A combination of both 'action' and 'target'.
*/
function
copyPasteHandler
(
$action
=
""
,
$target
=
array
(),
$all
=
array
(),
$altTabClass
=
""
,
$altTabType
=
""
,
$altAclCategory
=
""
,
$altAclPlugin
=
""
)
{
// Add entries to queue
if
(
$action
==
"copy"
||
$action
==
"cut"
)
{
$headpage
=
$this
->
getHeadpage
();
$targets
=
array
();
foreach
(
$target
as
$dn
)
{
$type
=
$headpage
->
getType
(
$dn
);
if
(
empty
(
$type
))
{
continue
;
}
$targets
[
$type
][]
=
$dn
;
}
foreach
(
$targets
as
$type
=>
$dns
)
{
return
management
::
copyPasteHandler
(
$action
,
$dns
,
$all
,
$this
->
tabClass
,
strtoupper
(
$type
)
.
'TABS'
,
$this
->
aclCategory
);
}
}
else
{
return
management
::
copyPasteHandler
(
$action
,
$target
,
$all
);
}
}
}
?>
alias/admin/alias/class_mailAliasDistribution.inc
0 → 100644
View file @
88cc9097
<?php
/*
* This code is part of FusionDirectory (http://www.fusiondirectory.org)
* Copyright (C) 2012 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
mailAliasDistribution
extends
simplePlugin
{
var
$mainTab
=
TRUE
;
var
$objectclasses
=
array
(
"top"
,
"mailAliasDistribution"
);
/* Return plugin informations for acl handling */
public
static
function
plInfo
()
{
return
array
(
"plShortName"
=>
_
(
"Temporary mail distribution"
),
"plDescription"
=>
_
(
"Temporary mail distribution"
),
"plSelfModify"
=>
FALSE
,
"plCategory"
=>
array
(
"alias"
),
"plObjectType"
=>
array
(
"mailAliasDistribution"
=>
array
(
"name"
=>
_
(
"Temporary mail distribution"
),
"filter"
=>
"objectClass=mailAliasDistribution"
)),
"plProvidedAcls"
=>
parent
::
generatePlProvidedAcls
(
self
::
getAttributesInfo
())
);
}
// The main function : information about attributes
static
function
getAttributesInfo
()
{
global
$config
;
return
array
(
// Attributes are grouped by section
'main'
=>
array
(
'name'
=>
_
(
"Mail distribution"
),
'attrs'
=>
array
(
new
BaseSelectorAttribute
(
get_ou
(
"aliasRDN"
)),
new
HostNameAttribute
(
_
(
"Name"
),
_
(
"Name to identify this alias"
),
"cn"
,
TRUE
),
new
TextAreaAttribute
(
_
(
"Description"
),
_
(
"Description of this alias"
),
"description"
,
FALSE
),
new
MailAttribute
(
_
(
"Email address"
),
_
(
"Email address"
),
"mail"
,
TRUE
),
new
SetAttribute
(
new
MailAttribute
(
_
(
"Email aliases"
),
_
(
"Aliases for this email address"
),
"gosaMailAlternateAddress"
,
TRUE
)
),
new
SelectAttribute
(
_
(
"Mail server"
),
_
(
"Mail server fot this alias"
),
"gosaMailServer"
,
TRUE
,
array_keys
(
$config
->
data
[
'SERVERS'
][
'IMAP'
])
),
new
DateAttribute
(
_
(
"Expiration date"
),
_
(
"Date after which the alias should be deleted. Leave empty for no deletion."
),
"aliasExpirationDate"
,
FALSE
,
"U"
,
// Unix timestamp
""
)
)
),
);
}
function
__construct
(
&
$config
,
$dn
=
NULL
,
$object
=
NULL
)
{
parent
::
__construct
(
$config
,
$dn
,
$object
);
$this
->
attributesInfo
[
'main'
][
'attrs'
][
'cn'
]
->
setUnique
(
TRUE
);
}
}
?>
alias/admin/alias/class_mailAliasRedirection.inc
0 → 100644
View file @
88cc9097
<?php
/*
* This code is part of FusionDirectory (http://www.fusiondirectory.org)
* Copyright (C) 2012 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
mailAliasRedirection
extends
simplePlugin
{
var
$mainTab
=
TRUE
;
var
$objectclasses
=
array
(
"top"
,
"mailAliasRedirection"
);
/* Return plugin informations for acl handling */
public
static
function
plInfo
()
{
return
array
(
"plShortName"
=>
_
(
"Temporary mail redirection"
),
"plDescription"
=>
_
(
"Temporary mail redirection"
),
"plSelfModify"
=>
FALSE
,
"plCategory"
=>
array
(
"alias"
),
"plObjectType"
=>
array
(
"mailAliasRedirection"
=>
array
(
"name"
=>
_
(
"Temporary mail redirection"
),
"filter"
=>
"objectClass=mailAliasRedirection"
)),