Skip to content
Snippets Groups Projects
Commit b1bde4eb authored by Renaud Le Gac's avatar Renaud Le Gac
Browse files

Replace the namespace Db by App.

parent 232dc742
Branches
Tags
No related merge requests found
......@@ -18,20 +18,19 @@ def index():
# css files
csslibs = [os.path.join(base, 'static', 'extjs', 'resources', 'css', 'ext-all.css'),
os.path.join(base, 'static', 'dbjs', 'icons.css')]
os.path.join(base, 'static', 'appjs', 'icons.css')]
# javascript librairies
jslibs = [os.path.join(base, 'static', 'extjs', 'ext-base.js'),
os.path.join(base, 'static', 'extjs', 'ext-all.js'),
os.path.join(base, 'static', 'dbjs', 'base.js'),
os.path.join(base, 'static', 'dbjs', 'action.js'),
os.path.join(base, 'static', 'dbjs', 'jsonstore.js'),
os.path.join(base, 'static', 'dbjs', 'combobox.js'),
os.path.join(base, 'static', 'dbjs', 'entryform.js'),
os.path.join(base, 'static', 'dbjs', 'vieweditgrid.js')]
os.path.join(base, 'static', 'extjs', 'ext-all.js')]
# application librairies
applibs = [os.path.join(base, 'static', 'appjs', 'appbase.js'),
os.path.join(base, 'static', 'appjs', 'action.js'),
os.path.join(base, 'static', 'appjs', 'jsonstore.js'),
os.path.join(base, 'static', 'appjs', 'combobox.js'),
os.path.join(base, 'static', 'appjs', 'entryform.js'),
os.path.join(base, 'static', 'appjs', 'vieweditgrid.js'),
os.path.join(base, 'static', 'appjs', 'appcfg.js'),
os.path.join(base, 'static', 'appjs', 'appmgr.js'),
os.path.join(base, 'static', 'appmain.js')
......
/**
* Db.Action is very similar to Ext.form.Action but without connection to a form.
* App.Action is very similar to Ext.form.Action but without connection to a form.
* Configuration parameters are those of the Ext.Ajax.request:
*
* @param {Function} failure
......@@ -17,8 +17,7 @@
* @version $Id$
*
*/
Db.Action = function(config){
App.Action = function(config){
return Ext.apply({
......@@ -56,7 +55,7 @@ Db.Action = function(config){
}
},
url: Db.url,
url: App.dburl,
waitMsg: 'Saving data...',
waitTitle: 'Please wait...'
......
......@@ -7,4 +7,15 @@
*
*/
Ext.namespace('App');
Ext.namespace('App');
App.cfgurl = '/'+App.name+'/configuration';
App.dburl = '/'+App.name+'/database';
App.httpFailure = function(form, action){
if (action.response) {
if (action.response.status != 200) {
Ext.MessageBox.alert('Error', action.response.responseText);
}
}
}
\ No newline at end of file
......@@ -15,9 +15,6 @@
* $Id$
*
*/
Ext.namespace('App');
App.Cfg = function(){
this.addEvents('cfgloaded');
......@@ -47,7 +44,7 @@ App.Cfg = Ext.extend(Ext.data.HttpProxy, {
/**
* Raise a message window when the HTTP exception is raised
*/
failure: Db.httpFailure,
failure: App.httpFailure,
/**
* Push the JSON object into the scope (App)
......
......@@ -12,10 +12,6 @@
* $Id$
*
*/
Ext.namespace('App');
App.Mgr = function(config){
this.cfg = {};
......@@ -87,7 +83,7 @@ Ext.extend(App.Mgr, Ext.util.Observable , {
if (keys.widget == 'viewedit') {
var cfgjs = this.cfg[keys.widget][keys.table].store;
var js = new Db.JsonStore(cfgjs);
var js = new App.JsonStore(cfgjs);
this.cfg[keys.widget][keys.table].store = js;
var cfgcm = this.cfg[keys.widget][keys.table].colModel
......
......@@ -10,7 +10,7 @@
* @param {String} hiddenName
* @version $Id$
*/
Db.ComboBox = Ext.extend(Ext.form.ComboBox, {
App.ComboBox = Ext.extend(Ext.form.ComboBox, {
debug: false,
table: '',
......@@ -20,7 +20,7 @@ Db.ComboBox = Ext.extend(Ext.form.ComboBox, {
emptyText: "Select a "+this.fieldLabel+" ...",
mode: 'remote',
selectOnFocus: true,
store: new Db.JsonStore({
store: new App.JsonStore({
table: this.table,
tableFields: [this.valueField, this.displayField],
sortInfo: {field: this.displayField}
......@@ -28,10 +28,10 @@ Db.ComboBox = Ext.extend(Ext.form.ComboBox, {
triggerAction: 'all',
typeAhead: true,
});
Db.ComboBox.superclass.initComponent.apply(this, arguments);
App.ComboBox.superclass.initComponent.apply(this, arguments);
}
});
Ext.reg('httpdbcombobox', Db.ComboBox);
Ext.reg('httpdbcombobox', App.ComboBox);
......@@ -10,7 +10,7 @@
*
* @version $Id$
*/
Db.EntryForm = Ext.extend(Ext.FormPanel, {
App.EntryForm = Ext.extend(Ext.FormPanel, {
debug: false,
action: 'create',
......@@ -29,12 +29,12 @@ Db.EntryForm = Ext.extend(Ext.FormPanel, {
labelWidth: 75,
});
Db.EntryForm.superclass.initComponent.apply(this, arguments);
App.EntryForm.superclass.initComponent.apply(this, arguments);
this.submitActionCfg = {
clientValidation: true,
failure: function(form, action){
Db.httpFailure(form, action);
App.httpFailure(form, action);
},
method: 'POST',
params: {
......@@ -43,7 +43,7 @@ Db.EntryForm = Ext.extend(Ext.FormPanel, {
'table': this.table
},
reset: true,
url: Db.url,
url: App.dburl,
waitMsg: 'Saving Record...'
};
......@@ -119,5 +119,5 @@ Db.EntryForm = Ext.extend(Ext.FormPanel, {
});
// register the xtype in the Ext.ComponentMgr
Ext.reg('httpdbentryform', Db.EntryForm);
Ext.reg('httpdbentryform', App.EntryForm);
......@@ -12,7 +12,7 @@
* @author legac
* @version $Id$
*/
Db.JsonStore = Ext.extend(Ext.data.Store, {
App.JsonStore = Ext.extend(Ext.data.Store, {
constructor: function(config){
......@@ -41,11 +41,11 @@ Db.JsonStore = Ext.extend(Ext.data.Store, {
root: 'data',
fields: li
}),
url: Db.url
url: App.dburl
});
// construct the underlying class. DON'T MOVE
Db.JsonStore.superclass.constructor.apply(this, arguments);
App.JsonStore.superclass.constructor.apply(this, arguments);
// create the baseParams (public)
// this arrray have to be built after the call to the constructor
......
......@@ -23,7 +23,7 @@
* TODO: add refresh in the context menu
*
*/
Db.ViewEditGrid = Ext.extend(Ext.grid.GridPanel, {
App.ViewEditGrid = Ext.extend(Ext.grid.GridPanel, {
formModel: '',
table: '',
......@@ -56,7 +56,7 @@ Db.ViewEditGrid = Ext.extend(Ext.grid.GridPanel, {
});
Db.ViewEditGrid.superclass.initComponent.apply(this, arguments);
App.ViewEditGrid.superclass.initComponent.apply(this, arguments);
// the header context menu
this.headerContextMenu = new Ext.menu.Menu({
......@@ -160,7 +160,7 @@ Db.ViewEditGrid = Ext.extend(Ext.grid.GridPanel, {
*/
onDelete: function(){
var dbAction = new Db.Action({
var dbAction = new App.Action({
params: {
'id': '',
'action': 'delete',
......@@ -231,7 +231,7 @@ Db.ViewEditGrid = Ext.extend(Ext.grid.GridPanel, {
// *
// */
// onRender: function(){
// Db.ViewEditGrid.superclass.onRender.apply(this, arguments);
// App.ViewEditGrid.superclass.onRender.apply(this, arguments);
// this.getStore().load();
// },
/**
......@@ -310,4 +310,4 @@ Db.ViewEditGrid = Ext.extend(Ext.grid.GridPanel, {
}
});
Ext.reg('httpdbviewedit', Db.ViewEditGrid);
\ No newline at end of file
Ext.reg('httpdbviewedit', App.ViewEditGrid);
\ No newline at end of file
......@@ -23,8 +23,6 @@
<script type="text/javascript">
Ext.namespace('App');
App.name = '{{=request.application}}';
App.cfgurl = '/'+App.name+'/configuration';
App.dburl = '/'+App.name+'/database';
</script>
<!-- application scripts -->
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment