0
0
mirror of https://github.com/postfixadmin/postfixadmin.git synced 2024-09-19 19:22:14 +02:00

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
This commit is contained in:
Christian Boltz 2011-10-30 21:25:57 +00:00
parent e4fc3623cc
commit 8dda511cd5
2 changed files with 7 additions and 14 deletions

View File

@ -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 */ ),
'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') ,
/*options*/ $this->getTransports() ),
/*options*/ Config::read('transport_options') ),
'backupmx' => pacol( 1, 1, 1, 'bool', 'pAdminEdit_domain_backupmx' , '' ),
'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 ),
@ -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
* can be used to update additional tables, call scripts etc.

View File

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