@openerpweb.jsonrequest
def db_operation(self, req, flag, **kw):
- if flag == 'drop':
+ if flag == 'create':
+ pass
+
+ elif flag == 'drop':
db = kw.get('db')
password = kw.get('password')
-moz-border-radius: 10px;
}
+table.db_option_table input.required {
+ background-color: #D2D2FF;
+}
+
.db_option_table input[type="text"], input[type="password"], select {
width: 300px;
}
self.$option_id.html(QWeb.render("CreateDB", self));
$("form[name=create_db_form]").validate();
+
+ $("input[name=create_confirm_pwd]").rules("add", {
+ equalTo: 'input[name=create_admin_pwd]',
+ messages: {
+ required: "Password did not match !"
+ }
+ });
+
+ $("input[name=super_admin_pwd]").focus();
+
+ self.$option_id.find('form[name=create_db_form]').submit(function(ev) {
+ ev.preventDefault();
+
+ var super_admin_pwd = self.$option_id.find("input[name=super_admin_pwd]").val();
+ var db = self.$option_id.find("input[name=db_name]").val();
+ var demo_data = self.$option_id.find("input[name=demo_data]:checked");
+ var db_lang = self.$option_id.find("select[name=db_lang]").val();
+ var admin_pwd = self.$option_id.find("input[name=create_admin_pwd]").val();
+ var confirm_pwd = self.$option_id.find("input[name=create_confirm_pwd]").val();
+
+ if (demo_data.length)
+ demo_data = 'True';
+ else
+ demo_data = 'False';
+
+ self.rpc("/base/session/db_operation", {
+ 'flag': 'create',
+ 'super_admin_pwd': super_admin_pwd,
+ 'db': db,
+ 'demo_data': demo_data,
+ 'db_lang': db_lang,
+ 'admin_pwd': admin_pwd,
+ 'confirm_pwd': confirm_pwd
+ },
+ function(result) {
+ if (result && !result.error) {
+
+ }
+ });
+
+ });
+
+
});
self.$element.find('#db-drop').click(function() {
$("form[name=change_pwd_form]").validate();
$("input[name=old_pwd]").rules("add", {
- required: true,
minlength: 1,
messages: {
required: "Please enter password !"
}
});
$("input[name=new_pwd]").rules("add", {
- required: true,
minlength: 1,
messages: {
required: "Please enter password !"
}
});
$("input[name=confirm_pwd]").rules("add", {
- required: true,
equalTo: 'input[name=new_pwd]',
messages: {
required: "Password did not match !"
<table align="center" class="db_option_table">
<tr>
<td><label for="super_admin_pwd">Super admin password:</label></td>
- <td><input type="text" name="super_admin_pwd" autofocus="true"/></td>
+ <td><input type="password" name="super_admin_pwd" class="required"/></td>
</tr>
<tr>
<td><label for="db_name">New database name:</label></td>
- <td><input type="text" name="db_name"/></td>
+ <td><input type="text" name="db_name" class="required"/></td>
</tr>
<tr>
<td><label for="demo_data">Load Demonstration data:</label></td>
- <td><input type="checkbox" name="demo_data"/></td>
+ <td><input type="checkbox" name="demo_data" checked='checked'/></td>
</tr>
<tr>
<td><label for="db_lang">Default language:</label></td>
</td>
</tr>
<tr>
- <td><label for="admin_pwd">Super admin password:</label></td>
- <td><input type="text" name="super_admin_pwd"/></td>
+ <td><label for="create_admin_pwd">Super admin password:</label></td>
+ <td><input type="password" name="create_admin_pwd" class="required"/></td>
</tr>
<tr>
- <td><label for="confirm_pwd">Confirm password:</label></td>
- <td><input type="text" name="confirm_pwd"/></td>
+ <td><label for="create_confirm_pwd">Confirm password:</label></td>
+ <td><input type="password" name="create_confirm_pwd" class="required"/></td>
</tr>
<tr>
<td colspan="2" align="right"><input type="submit" value="Create"/></td>
<table align="center" class="db_option_table">
<tr>
<td><label for="old_pwd">Old password:</label></td>
- <td><input type="password" name="old_pwd"/></td>
+ <td><input type="password" name="old_pwd" class="required"/></td>
</tr>
<tr>
<td><label for="new_pwd">New password:</label></td>
- <td><input type="password" name="new_pwd"/></td>
+ <td><input type="password" name="new_pwd" class="required"/></td>
</tr>
<tr>
<td><label for="confirm_pwd">Confirm password:</label></td>
- <td><input type="password" name="confirm_pwd"/></td>
+ <td><input type="password" name="confirm_pwd" class="required"/></td>
</tr>
<tr>
<td colspan="2" align="right"><input type="submit" value="Change Password"/></td>