Allow new DB template selection

This commit is contained in:
Jamie Cameron
2011-03-23 15:40:35 -07:00
parent f16ba51f8c
commit d5b8f12f07
4 changed files with 12 additions and 0 deletions

View File

@@ -73,3 +73,4 @@ Added a history of previous commands to the Execute SQL page.
Added greater than / less than selectors to the table data search form.
---- Changes since 1.530 ----
Added an option to the restore form to limit the restore to only certain tables.
When creating a new database, a template database to copy from can now be selected.

View File

@@ -218,6 +218,8 @@ newdb_epath=Missing database path
newdb_user=Owned by user
newdb_encoding=Character set encoding
newdb_eencoding=Missing character set encoding
newdb_template=Template database
newdb_notemplate=None
user_title=PostgreSQL Users
user_ecannot=You are not allowed to edit users

View File

@@ -27,6 +27,9 @@ if (!$in{'encoding_def'} && &get_postgresql_version() >= 8) {
$in{'encoding'} =~ /\S/ || &error($text{'newdb_eencoding'});
$cmd .= " encoding = '$in{'encoding'}'";
}
if ($in{'template'}) {
$cmd .= " template = $in{'template'}";
}
&execute_sql_logged($config{'basedb'}, $cmd);
&webmin_log("create", "db", $in{'db'});
if ($access{'dbs'} ne '*') {

View File

@@ -34,6 +34,12 @@ if (&get_postgresql_version() >= 8) {
print &ui_table_row($text{'newdb_path'},
&ui_opt_textbox("path", undef, 40, $text{'default'}));
# Template DB
print &ui_table_row($text{'newdb_template'},
&ui_select("template", undef,
[ [ undef, "<".$text{'newdb_notemplate'}.">" ],
&list_databases() ]));
print &ui_table_end();
print &ui_form_end([ [ undef, $text{'create'} ] ]);