diff --git a/create-domain.php b/create-domain.php index 65217370..1409558a 100644 --- a/create-domain.php +++ b/create-domain.php @@ -28,7 +28,7 @@ $form_fields = $handler->getStruct(); if ($_SERVER['REQUEST_METHOD'] == "POST") { - foreach($form_fields as $key => $field) { + foreach($form_fields as $key => $field) { if ($field['editable'] == 0) { $values[$key] = $field['default']; } else { @@ -70,18 +70,22 @@ if ($error != 1) { } } +foreach($form_fields as $key => $field) { + $smartykey = "t" . ucfirst($key); # TODO: ugly workaround until I decide on the template variable names + switch ($field['type']) { + case 'bool': + $smarty->assign ($smartykey, ($values[$key] == '1') ? ' checked="checked"' : ''); + break; + case 'enum': + $smarty->assign ($smartykey, select_options ($form_fields[$key]['options'], array ($values[$key])),false); + break; + default: + $smarty->assign ($smartykey, $values[$key]); + } +} + $smarty->assign ('mode', 'create'); $smarty->assign ('pAdminCreate_domain_domain_text_error', $pAdminCreate_domain_domain_text_error, false); -$smarty->assign ('tDomain', $values['domain']); -$smarty->assign ('tDescription', $values['description']); -$smarty->assign ('tAliases', $values['aliases']); -$smarty->assign ('tMailboxes', $values['mailboxes']); -$smarty->assign ('tDomainquota', $values['quota']); -$smarty->assign ('tMaxquota', $values['maxquota']); -$smarty->assign ('select_options', select_options ($form_fields['transport']['options'], array ($values['transport'])),false); -$smarty->assign ('tDefaultaliases', ($values['default_aliases'] == '1') ? ' checked="checked"' : ''); -$smarty->assign ('tBackupmx', ($values['backupmx'] == '1') ? ' checked="checked"' : ''); -$smarty->assign ('tActive', ($values['active'] == '1') ? ' checked="checked"' : ''); $smarty->assign ('smarty_template', 'admin_edit-domain'); $smarty->display ('index.tpl'); diff --git a/edit-domain.php b/edit-domain.php index 8d9d7d42..6f2ddfa2 100644 --- a/edit-domain.php +++ b/edit-domain.php @@ -126,8 +126,8 @@ $smarty->assign ('tDescription', $tDescription); $smarty->assign ('tAliases', $tAliases); $smarty->assign ('tMailboxes', $tMailboxes); $smarty->assign ('tMaxquota', $tMaxquota); -$smarty->assign ('tDomainquota', $tDomainquota); -$smarty->assign ('select_options', select_options($CONF['transport_options'], array($tTransport)), false); +$smarty->assign ('tQuota', $tDomainquota); +$smarty->assign ('tTransport', select_options($CONF['transport_options'], array($tTransport)), false); if ($tBackupmx) $smarty->assign ('tBackupmx', ' checked="checked"'); if ($tActive) $smarty->assign ('tActive', ' checked="checked"'); $smarty->assign ('smarty_template', 'admin_edit-domain'); diff --git a/templates/admin_edit-domain.tpl b/templates/admin_edit-domain.tpl index 0d199700..863dd7c4 100644 --- a/templates/admin_edit-domain.tpl +++ b/templates/admin_edit-domain.tpl @@ -42,7 +42,7 @@ {if $CONF.domain_quota===YES}