except Exception, e:
pass
return {"lang_list": lang_list}
-
+
+ @openerpweb.jsonrequest
+ def drop_db(self, req, **kw):
+
+ db = kw.get('db')
+ password = kw.get('password')
+ try:
+ res = req.session.proxy("db").drop(password, db)
+ if res:
+ return res
+ except TypeError:
+ return {'error': e}
+
@openerpweb.jsonrequest
def modules(self, req):
return {"modules": [name
-moz-border-radius: 10px;
}
-.db_option_table input[type="text"], input[type="password"], select, textarea {
+.db_option_table input[type="text"], input[type="password"], select {
width: 300px;
}
self.$element.find('#db-drop').click(function() {
self.db_string = "DROP DATABASE";
self.$option_id.html(QWeb.render("DropDB", self));
+
+ self.$option_id.find('#drop_db_btn').click(function() {
+ var db = self.$option_id.find("select[name=drop_db]").val();
+ var password = self.$option_id.find("input[name=drop_password]").val();
+
+ if (confirm("Do you really want to delete the database: " + db + " ?")) {
+ self.rpc("/base/session/drop_db", {'db': db, 'password': password},
+ function(result) {
+ self.$option_id.find("select[name=drop_db] :selected").remove();
+ self.notification.notify("Dropping database", "The database '" + db + "' has been dropped");
+ });
+ }
+ });
+
});
self.$element.find('#db-backup').click(function() {
self.db_string = "BACKUP DATABASE";
<td><input type="text" name="confirm_pwd"/></td>
</tr>
<tr>
- <td colspan="2" align="right"><button type="button">Submit</button></td>
+ <td colspan="2" align="right"><button type="button">Create</button></td>
</tr>
</table>
</t>
</table>
<table align="center" class="db_option_table">
<tr>
- <td><label for="db_name">Database:</label></td>
+ <td><label for="drop_db">Database:</label></td>
<t t-if="db_list">
- <select name="db">
+ <select name="drop_db">
<t t-foreach="db_list" t-as="db">
<option t-att-value="db"><t t-esc="db"/></option>
</t>
</t>
</tr>
<tr>
- <td><label for="pwd">Password:</label></td>
- <td><input type="password" name="pwd"/></td>
+ <td><label for="droppassword">Password:</label></td>
+ <td><input type="password" name="drop_password" value=""/></td>
</tr>
<tr>
- <td colspan="2" align="right"><button type="button">Submit</button></td>
+ <td colspan="2" align="right"><button type="button" id="drop_db_btn">Drop</button></td>
</tr>
</table>
</t>
<td><input type="password" name="pwd"/></td>
</tr>
<tr>
- <td colspan="2" align="right"><button type="button">Submit</button></td>
+ <td colspan="2" align="right"><button type="button">Backup</button></td>
</tr>
</table>
</t>
<td><input type="text" name="new_db"/></td>
</tr>
<tr>
- <td colspan="2" align="right"><button type="button">Submit</button></td>
+ <td colspan="2" align="right"><button type="button">Restore</button></td>
</tr>
</table>
</t>
<td><input type="password" name="confirm_pwd"/></td>
</tr>
<tr>
- <td colspan="2" align="right"><button type="button">Submit</button></td>
+ <td colspan="2" align="right"><button type="button">Change Password</button></td>
</tr>
</table>
</t>