scripts/shells/domain.php / AddTask:

- read transport options from $handler->getStruct
  (instead of $handler->getTransports())
- convert selected transport to to transport name directly
  (instead of using $handler->getTransport)

model/DomainHandler.php:
- init_struct: read transport options with Conf::read directly
  (instead of using $this->getTransports()
- delete no longer used functions getTransports() and getTransport()


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1256 a1433add-5e2c-0410-b055-b7f2511e0802
pull/2/head
Christian Boltz 13 years ago
parent e4fc3623cc
commit 8dda511cd5

@ -67,7 +67,7 @@ class DomainHandler extends PFAHandler {
/*select*/ 'round(coalesce(__total_quota/' . intval(Config::read('quota_multiplier')) . ',0)) as total_quota' /*extrafrom*//* already in mailbox_count */ ), /*select*/ 'round(coalesce(__total_quota/' . intval(Config::read('quota_multiplier')) . ',0)) as total_quota' /*extrafrom*//* already in mailbox_count */ ),
'quota' => pacol( $dom_q, $dom_q, $dom_q, 'num' , 'pAdminEdit_domain_quota' , 'pAdminEdit_domain_maxquota_text' , Config::read('domain_quota_default') ), 'quota' => pacol( $dom_q, $dom_q, $dom_q, 'num' , 'pAdminEdit_domain_quota' , 'pAdminEdit_domain_maxquota_text' , Config::read('domain_quota_default') ),
'transport' => pacol( $transp, $transp,$transp,'enum', 'pAdminEdit_domain_transport' , 'pAdminEdit_domain_transport_text' , Config::read('transport_default') , 'transport' => pacol( $transp, $transp,$transp,'enum', 'pAdminEdit_domain_transport' , 'pAdminEdit_domain_transport_text' , Config::read('transport_default') ,
/*options*/ $this->getTransports() ), /*options*/ Config::read('transport_options') ),
'backupmx' => pacol( 1, 1, 1, 'bool', 'pAdminEdit_domain_backupmx' , '' ), 'backupmx' => pacol( 1, 1, 1, 'bool', 'pAdminEdit_domain_backupmx' , '' ),
'active' => pacol( 1, 1, 1, 'bool', 'pAdminEdit_domain_active' , '' , 1 ), 'active' => pacol( 1, 1, 1, 'bool', 'pAdminEdit_domain_active' , '' , 1 ),
'default_aliases' => pacol( $this->new, $this->new, 0, 'bool', 'pAdminCreate_domain_defaultaliases', '' , 1,'', /*not in db*/ 1 ), 'default_aliases' => pacol( $this->new, $this->new, 0, 'bool', 'pAdminCreate_domain_defaultaliases', '' , 1,'', /*not in db*/ 1 ),
@ -93,16 +93,6 @@ class DomainHandler extends PFAHandler {
} }
} }
public function getTransports() {
return Config::read('transport_options');
}
# TODO: specific for CLI? If yes, move to CLI code
public function getTransport($id) {
$transports = Config::read('transport_options');
return $transports[$id-1];
}
/** /**
* called by $this->store() after storing $this->values in the database * called by $this->store() after storing $this->values in the database
* can be used to update additional tables, call scripts etc. * can be used to update additional tables, call scripts etc.

@ -111,7 +111,8 @@ class AddTask extends Shell {
$d = $this->in($question); $d = $this->in($question);
$handler = new DomainHandler(); $handler = new DomainHandler();
$transports = $handler->getTransports(); $struct = $handler->getStruct();
$transports = $struct['transport']['options'];
$qt[] = 'Choose transport option'; $qt[] = 'Choose transport option';
foreach ($transports AS $key => $val) { foreach ($transports AS $key => $val) {
//workaround. $this->in hates number 0 //workaround. $this->in hates number 0
@ -121,6 +122,8 @@ class AddTask extends Shell {
$t = $this->in( join("\n", $qt) ); $t = $this->in( join("\n", $qt) );
$t = $transports[$t-1]; # convert int to transport name
$question = "Add default Aliases:"; $question = "Add default Aliases:";
$default = $this->in($question, array('y','n')); $default = $this->in($question, array('y','n'));
($default == 'y') ? $default = true : $default = false; ($default == 'y') ? $default = true : $default = false;
@ -153,7 +156,7 @@ class AddTask extends Shell {
'mailboxes' => $m, 'mailboxes' => $m,
'maxquota' => $q, 'maxquota' => $q,
'quota' => $d, 'quota' => $d,
'transport' => $handler->getTransport($t), 'transport' => $t,
'backupmx' => $backup, 'backupmx' => $backup,
'active' => 1, 'active' => 1,
'default_aliases' => $default, 'default_aliases' => $default,

Loading…
Cancel
Save