notes/brainstorming.txt
[app.Builder.js] / dbgenerate.js
index ebf9262..5d2d001 100644 (file)
@@ -119,6 +119,7 @@ var map = {
     'date' : 'date',
     'datetime' : 'date',
     'timestamp with time zone' : 'date',
+    'timestamp without time zone' : 'date',
     'time' : 'string', //bogus
     'int' : 'int',
     'integer' : 'int',
@@ -128,7 +129,10 @@ var map = {
     'smallint' : 'int',
     'decimal' : 'float',
     'float' : 'float',
+    'numeric' : 'float',
     'char' : 'string',
+    'character' : 'string',
+    'character varying' : 'string',
     'varchar' : 'string',
     'text' : 'string',
     'longtext' : 'string',
@@ -137,7 +141,9 @@ var map = {
     'enum' : 'string',
     'timestamp' : 'number',
     'blob' : 'text',
+    'bytea' : 'text',
     'boolean' : 'int',
+    'text[]' : 'string',
     
 }
 
@@ -266,6 +272,8 @@ switch(cfg.DBTYPE) {
                 
                 
         break;
+    default:
+        throw "Invalid data base type " + cfg.DBTYPE + " should be MySQL or PostgreSQL";
 /*
            "Field": "province",
         "Type": "varchar(255)",
@@ -301,8 +309,8 @@ tables.forEach(function(table) {
     //print(JSON.stringify(schema, null,4));    Seed.quit();
     
     schema.forEach(function(e)  {
-        e.Type = e.type;
-        e.Field = e.field;
+        e.Type = e.Type || e.type;
+        e.Field = e.Field || e.field;
          
         var type = e.Type.match(/([^(]+)\(([^\)]+)\)/);
         var row  = { }; 
@@ -379,6 +387,11 @@ tables.forEach(function(table) {
             '|xns' : 'Roo.form',
             xtype : xtype
         }
+         if (xtype == 'DateField') {
+            form[row.name].format = 'Y-m-d';
+            form[row.name].width = 100;
+        }
+        
         if (xtype == 'TextArea') {
             form[row.name].height = 100;
         }
@@ -392,8 +405,8 @@ tables.forEach(function(table) {
     var combo = {
         '|xns' : 'Roo.form',
         xtype: 'ComboBox',
-        allowBlank : 'false',
-        editable : 'false',
+        allowBlank : false,
+        editable : false,
         emptyText : 'Select ' + table,
         forceSelection : true,
         listWidth : 400,
@@ -613,7 +626,7 @@ readers.forEach(function(reader) {
                         "|rowdblclick": "function (_self, rowIndex, e)\n" + 
                             "{\n" + 
                             "    if (!_this.dialog) return;\n" + 
-                            "    _this.dialog.show( this.getDataSource().getAt(rowIndex), function() {\n" + 
+                            "    _this.dialog.show( this.getDataSource().getAt(rowIndex).data, function() {\n" + 
                             "        _this.grid.footer.onClick('first');\n" + 
                             "    }); \n" + 
                             "}\n"
@@ -844,6 +857,7 @@ readers.forEach(function(reader) {
             "resizable": false,
             "title": "Edit / Create " + reader.table,
             "width": 400,
+            "modal" : true,
             "xtype": "LayoutDialog",
             "|xns": "Roo",
             "items": [