[imp] refactored Database

bzr revid: nicolas.vanhoren@openerp.com-20120104102031-px4eqngvtx0l6n3c
This commit is contained in:
niv-openerp 2012-01-04 11:20:31 +01:00
parent f63dca7122
commit 10e6994f6e
2 changed files with 19 additions and 18 deletions

View File

@ -260,6 +260,7 @@ openerp.web.Loading = openerp.web.Widget.extend(/** @lends openerp.web.Loading#
});
openerp.web.Database = openerp.web.Widget.extend(/** @lends openerp.web.Database# */{
template: "DatabaseManager",
/**
* @constructs openerp.web.Database
* @extends openerp.web.Widget
@ -270,12 +271,10 @@ openerp.web.Database = openerp.web.Widget.extend(/** @lends openerp.web.Database
*/
init: function(parent, element_id, option_id) {
this._super(parent, element_id);
this.$option_id = $('#' + option_id);
this.unblockUIFunction = $.unblockUI;
},
start: function() {
this._super();
this.$element.html(QWeb.render("Database", this));
this.$option_id = $("#oe_db_options");
var self = this;
var fetch_db = this.rpc("/web/database/get_list", {}, function(result) {
@ -290,6 +289,7 @@ openerp.web.Database = openerp.web.Widget.extend(/** @lends openerp.web.Database
});
$.when(fetch_db, fetch_langs).then(function () {self.do_create();});
this.$element.find('#db-back').click(_.bind(function() {this.hide();}, this));
this.$element.find('#db-create').click(this.do_create);
this.$element.find('#db-drop').click(this.do_drop);
this.$element.find('#db-backup').click(this.do_backup);
@ -567,9 +567,8 @@ openerp.web.Login = openerp.web.Widget.extend(/** @lends openerp.web.Login# */{
},
start: function() {
var self = this;
this.database = new openerp.web.Database(
this, "oe_database", "oe_db_options");
this.database.start();
this.database = new openerp.web.Database(this);
this.database.appendTo(this.$element);
this.$element.find('#oe-db-config').click(function() {
self.database.show();

View File

@ -54,16 +54,6 @@
</div>
</div>
</t>
<t t-name="Database">
<ul class="db_options" style="padding: 0px; display: inline;">
<li id="db-create">Create</li>
<li id="db-drop">Drop</li>
<li id="db-backup">Backup</li>
<li id="db-restore">Restore</li>
<li id="db-change-password">Password</li>
<li id="back-to-login">Back to Login</li>
</ul>
</t>
<t t-name="Database.CreateDB">
<form name="create_db_form" class="oe_forms" method="POST">
<table width="100%">
@ -320,17 +310,29 @@
<a href="http://www.openerp.com">Powered by <span class="openerp">OpenERP</span></a>
</div>
</div>
</div>
</t>
<t t-name="DatabaseManager">
<table class="oe-database-manager">
<tr class="db_options_row">
<td valign="top" class="db_container">
<div id="oe_database" class="database"></div>
<div class="database">
<ul class="db_options" style="padding: 0px; display: inline;">
<li id="db-back">Back</li>
<li id="db-create">Create</li>
<li id="db-drop">Drop</li>
<li id="db-backup">Backup</li>
<li id="db-restore">Restore</li>
<li id="db-change-password">Password</li>
<li id="back-to-login">Back to Login</li>
</ul>
</div>
</td>
<td valign="top" class="db_right_pane">
<div id="oe_db_options"></div>
</td>
</tr>
</table>
</div>
</t>
<t t-name="Header">
<div>