SF.net SVN: postfixadmin:[1422] trunk
Brought to you by:
christian_boltz,
gingerdog
From: <chr...@us...> - 2013-01-27 19:52:21
|
Revision: 1422 http://sourceforge.net/p/postfixadmin/code/1422 Author: christian_boltz Date: 2013-01-27 19:52:19 +0000 (Sun, 27 Jan 2013) Log Message: ----------- 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 Modified Paths: -------------- trunk/edit.php trunk/model/AliasHandler.php trunk/model/AliasdomainHandler.php trunk/model/MailboxHandler.php Modified: trunk/edit.php =================================================================== --- trunk/edit.php 2013-01-27 18:24:03 UTC (rev 1421) +++ trunk/edit.php 2013-01-27 19:52:19 UTC (rev 1422) @@ -63,8 +63,14 @@ $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 @@ 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; } } Modified: trunk/model/AliasHandler.php =================================================================== --- trunk/model/AliasHandler.php 2013-01-27 18:24:03 UTC (rev 1421) +++ trunk/model/AliasHandler.php 2013-01-27 19:52:19 UTC (rev 1422) @@ -95,8 +95,9 @@ # 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 @@ $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 Modified: trunk/model/AliasdomainHandler.php =================================================================== --- trunk/model/AliasdomainHandler.php 2013-01-27 18:24:03 UTC (rev 1421) +++ trunk/model/AliasdomainHandler.php 2013-01-27 19:52:19 UTC (rev 1422) @@ -87,6 +87,7 @@ 'required_role' => 'admin', 'listview' => 'list-virtual.php', 'early_init' => 1, # 0 for create-domain + 'prefill' => array('alias_domain', 'target_domain'), ); } Modified: trunk/model/MailboxHandler.php =================================================================== --- trunk/model/MailboxHandler.php 2013-01-27 18:24:03 UTC (rev 1421) +++ trunk/model/MailboxHandler.php 2013-01-27 19:52:19 UTC (rev 1422) @@ -89,8 +89,9 @@ # 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 @@ 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); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |