diff --git a/gosa-core/setup/class_setupStep_Config2.inc b/gosa-core/setup/class_setupStep_Config2.inc
index e6b96b10cd333da4261ba4a26cda2fd7828709d3..450fe81e1c20c6ef30dbb700f57526944166cfba 100644 (file)
var $header_image = "images/ldapserver.png";
var $cyrusunixstyle = FALSE;
var $header_image = "images/ldapserver.png";
var $cyrusunixstyle = FALSE;
- var $mail = "none";
+ var $mail = "none";
+ var $mail_attrib = "";
var $mail_methods = array();
var $mail_settings = array("vacationdir" => "/etc/gosa/vacation",
"vacationdir_active" => FALSE);
var $mail_methods = array();
var $mail_settings = array("vacationdir" => "/etc/gosa/vacation",
"vacationdir_active" => FALSE);
var $timezone = "Europe/Berlin";
var $timezones = array();
var $timezone = "Europe/Berlin";
var $timezones = array();
- var $attributes = array("governmentmode","sambaidmapping","cyrusunixstyle","mail","use_netatalk","enableFAI_management","timezone","enableMimeType");
+ var $attributes = array("mail_attrib","governmentmode","sambaidmapping","cyrusunixstyle","mail","use_netatalk","enableFAI_management","timezone","enableMimeType");
var $called = FALSE;
function Step_Config2()
{
$this->update_strings();
var $called = FALSE;
function Step_Config2()
{
$this->update_strings();
- $tmp = $this->get_available_mail_classes();
- foreach($tmp['name'] as $name){
- $this->mail_methods[$name] = $name;
- }
+ $this->mail_methods = $this->get_available_mail_classes();
/* Look for samba password generation method */
if(file_exists("/usr/bin/mkntpasswd")){
/* Look for samba password generation method */
if(file_exists("/usr/bin/mkntpasswd")){
$pwdhash= 'perl -MCrypt::SmbHash -e "print join(q[:], ntlmgen \$ARGV[0]), $/;"';
}
$pwdhash= 'perl -MCrypt::SmbHash -e "print join(q[:], ntlmgen \$ARGV[0]), $/;"';
}
- $this->timezones = _get_tz_zones();
+ $this->timezones = timezone::_get_tz_zones();
$this->samba_settings['smbhash'] = $pwdhash;
}
$this->samba_settings['smbhash'] = $pwdhash;
}
function execute()
{
function execute()
{
+ $this->mail_methods = $this->get_available_mail_classes();
/* On first call check for rid/sid base */
$cv = $this->parent->captured_values;
/* On first call check for rid/sid base */
$cv = $this->parent->captured_values;
- $ldap = new LDAP($cv['admin'],
+ $ldap_l = new LDAP($cv['admin'],
$cv['password'],
$cv['connection'],
FALSE,
$cv['tls']);
$cv['password'],
$cv['connection'],
FALSE,
$cv['tls']);
+ $ldap = new ldapMultiplexer($ldap_l);
+
$ldap->cd($cv['base']);
$ldap->search("(objectClass=sambaDomain)",array("dn"));
if($ldap->count()){
$ldap->cd($cv['base']);
$ldap->search("(objectClass=sambaDomain)",array("dn"));
if($ldap->count()){
$smarty->assign("mail_methods",$this->mail_methods);
$smarty->assign("samba_settings",$this->samba_settings);
$smarty->assign("bool",array(FALSE => _("No"), TRUE => _("Yes")));
$smarty->assign("mail_methods",$this->mail_methods);
$smarty->assign("samba_settings",$this->samba_settings);
$smarty->assign("bool",array(FALSE => _("No"), TRUE => _("Yes")));
- foreach($this->attributes as $attr){
+ foreach($this->attributes as $attr){
$smarty->assign($attr,$this->$attr);
}
$smarty->assign("timezone" ,$this->timezone);
$smarty->assign($attr,$this->$attr);
}
$smarty->assign("timezone" ,$this->timezone);
$this->timezone = $_POST['timezone'];
}
$this->timezone = $_POST['timezone'];
}
+ $old_mail = $this->mail;
+
/* Get attributes */
foreach($this->attributes as $attr){
if(isset($_POST[$attr])){
/* Get attributes */
foreach($this->attributes as $attr){
if(isset($_POST[$attr])){
$this->samba_settings['samba_sid_active'] = TRUE;
$this->samba_settings['samba_rid_active'] = TRUE;
}
$this->samba_settings['samba_sid_active'] = TRUE;
$this->samba_settings['samba_rid_active'] = TRUE;
}
+
+ /* Reload mail naming attribute */
+ if($old_mail != $this->mail && isset($this->mail_methods[$this->mail]['uattrib'])){
+ $this->mail_attrib = $this->mail_methods[$this->mail]['uattrib'];
+ }
}
$tmp = $this->check();
}
$tmp = $this->check();
return($tmp);
}
return($tmp);
}
-/* Returns the classnames auf the mail classes */
+
+ /* Returns the classnames auf the mail classes */
function get_available_mail_classes()
{
function get_available_mail_classes()
{
- $dir = opendir( "../include");
- $methods = array();
- $suffix = "class_mail-methods-";
- $lensuf = strlen($suffix);
- $prefix = ".inc";
- $lenpre = strlen($prefix);
- $i = 0;
- while (($file = readdir($dir)) !== false){
-
- if(stristr($file,$suffix)) {
- $lenfile = strlen($file);
- $methods['name'][$i] = substr($file,$lensuf,($lenfile-$lensuf)-$lenpre);
- $methods['file'][$i] = $file;
- $methods[$i]['file'] = $file;
- $methods[$i]['name'] = substr($file,$lensuf,($lenfile-$lensuf)-$lenpre);
- $i++;
+ global $class_mapping;
+
+ $default_uattrib = "";
+ $m_class_vars = get_class_vars("mailMethod");
+ if(isset($m_class_vars['uattrib'])){
+ $default_uattrib = $m_class_vars['uattrib'];
+ }
+
+ foreach($class_mapping as $name => $file){
+ if(preg_match("/^mailMethod[a-z]*$/i",$name)){
+ $name = preg_replace("/^mailMethod/","",$name);
+ if(!empty($name)){
+ $methods[$name]['name'] = $name;
+ $m_class_vars = get_class_vars("mailMethod".$methods[$name]['name']);
+ if(isset($m_class_vars['uattrib'])){
+ $methods[$name]['uattrib'] = $m_class_vars['uattrib'];
+ }else{
+ $methods[$name]['uattrib'] = $default_uattrib;
+ }
+ }
}
}
return($methods);
}
}
}
return($methods);
}
-
}
// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
}
// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: