edit.php:

- prefill all $formconf['prefill'] fields from URL parameters (typically
  used for the domain)

model/AliasdomainHandler.php:
- allow to prefill alias_domain and target_domain from URL parameters
 
model/AliasHandler.php:
- allow to prefill domain from URL parameters
- some whitespace changes
- add storemore() with a TODO note

model/MailboxHandler.php:
- allow to prefill domain from URL parameters
- some whitespace changes
- add some TODO notes



git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1422 a1433add-5e2c-0410-b055-b7f2511e0802
pull/2/head
Christian Boltz 12 years ago
parent efb98c24c5
commit a46bcc955c

@ -63,8 +63,14 @@ if ($edit != '' || $active != '' || $formconf['early_init']) {
$form_fields = $handler->getStruct();
$id_field = $handler->getId_field();
if ($edit != "") {
if ($_SERVER['REQUEST_METHOD'] == "GET" && $active == '') { # read values from database (except if $active is set to save some CPU cycles)
if ($_SERVER['REQUEST_METHOD'] == "GET" && $active == '') {
if ($edit == '') { # new - prefill fields from URL parameters if allowed in $formconf['prefill']
if ( isset($formconf['prefill']) ) {
foreach ($formconf['prefill'] as $field) {
if (isset ($_GET[$field])) $form_fields[$field]['default'] = safeget($field);
}
}
} else { # edit mode - read values from database
if (!$handler->view()) {
flash_error($handler->errormsg);
header ("Location: " . $formconf['listview']);
@ -141,7 +147,7 @@ if ($_SERVER['REQUEST_METHOD'] == "POST" || $active != '') {
header ("Location: " . $formconf['listview']);
exit;
} else {
header("Location: edit.php?table=$table");
header("Location: edit.php?table=$table"); # TODO: hand over last used domain etc. ($formconf['prefill'] ?)
exit;
}
}

@ -95,8 +95,9 @@ class AliasHandler extends PFAHandler {
# various settings
'required_role' => 'admin',
'listview' => 'list-virtual.php',
'early_init' => 0,
'listview' => 'list-virtual.php',
'early_init' => 0,
'prefill' => array('domain'),
);
}
@ -237,6 +238,11 @@ class AliasHandler extends PFAHandler {
$this->values['goto'] = join(',', $values['goto']);
}
protected function storemore() {
# TODO: if alias belongs to a mailbox, update mailbox active status
return true;
}
protected function read_from_db_postprocess($db_result) {
foreach ($db_result as $key => $value) {
# split comma-separated 'goto' into an array

@ -87,6 +87,7 @@ class AliasdomainHandler extends PFAHandler {
'required_role' => 'admin',
'listview' => 'list-virtual.php',
'early_init' => 1, # 0 for create-domain
'prefill' => array('alias_domain', 'target_domain'),
);
}

@ -89,8 +89,9 @@ class MailboxHandler extends PFAHandler {
# various settings
'required_role' => 'admin',
'listview' => 'list-virtual.php',
'early_init' => 0,
'listview' => 'list-virtual.php',
'early_init' => 0,
'prefill' => array('domain'),
);
}
@ -161,10 +162,14 @@ class MailboxHandler extends PFAHandler {
protected function storemore() {
if ($this->new) {
# TODO: create alias
# TODO: postcreate hook
# TODO: send welcome mail
# TODO: create mailbox subfolders
# TODO: --- most of this is probably already in $this->add() already ---
} else {
# TODO: update alias (active status)
# postedit hook
# TODO: implement a poststore() function? - would make handling of old and new values much easier...
list(/*NULL*/,$domain) = explode('@', $this->id);

Loading…
Cancel
Save