Allow new DB template selection
authorJamie Cameron <jcameron@webmin.com>
Wed, 23 Mar 2011 22:40:35 +0000 (15:40 -0700)
committerJamie Cameron <jcameron@webmin.com>
Wed, 23 Mar 2011 22:40:35 +0000 (15:40 -0700)
postgresql/CHANGELOG
postgresql/lang/en
postgresql/newdb.cgi
postgresql/newdb_form.cgi

index a0eb600..354ee20 100644 (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.
index 9ea7bb8..f367c71 100644 (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
index 35b0395..63b23cd 100755 (executable)
@@ -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 '*') {
index 45dfa65..fe20884 100755 (executable)
@@ -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, "&lt;".$text{'newdb_notemplate'}."&gt;" ],
+                    &list_databases() ]));
+
 print &ui_table_end();
 print &ui_form_end([ [ undef, $text{'create'} ] ]);