for (var i =0;i < this.get_n_columns(); i++) {
cols.push(this.get_column_name(i));
}
- //console.dump(cols);
+ //print(JSON.stringify(cols, null,4));
var iter = this.create_iter();
var res = [];
- while (iter.move_next()) {
+ //print(this.get_n_rows());
+ var _this = this;
+ for (var r = 0; r < this.get_n_rows(); r++) {
+
+ // single clo..
+ //print("GOT ROW");
if (cols.length == 1) {
- res.push(iter.get_value_at(0).get_string());
+ res.push(this.get_value_at(0,r).get_string());
continue;
}
var add = { };
cols.forEach(function(n,i) {
- var val = iter.get_value_at(i);
- var type = GObject.type_name(val.g_type) ;
- var vs = type == 'GdaBlob' ? val.value.to_string(1024) : val.value;
- // print(n + " : TYPE: " + GObject.type_name(val.g_type) + " : " + vs);
+ var val = _this.get_value_at(i,r);
+ var type = GObject.type_name(val.g_type) ;
+ var vs = ['GdaBinary', 'GdaBlob' ].indexOf(type) > -1 ? val.value.to_string(1024) : val.value;
+ //print(n + " : TYPE: " + GObject.type_name(val.g_type) + " : " + vs);
//print (n + '=' + iter.get_value_at(i).value);
add[n] = vs;
});
//--- load ini files..
// this is very specific.
- var dirs = File.list( GLib.get_home_dir() + '/gitlive').filter(
- function(e) { return e.match(/^Pman/); }
+
+ var dirs = File.list( cfg.INI + '/Pman').filter(
+ function(e) {
+ if (!File.isDirectory(cfg.INI + '/Pman/' + e + '/DataObjects')) {
+ return false;
+ }
+ return true;
+ }
);
+
dirs.forEach(function(d) {
// this currently misses the web.*/Pman/XXXX/DataObjects..
- var path = GLib.get_home_dir() + '/gitlive/' + d + '/DataObjects';
- if (!File.isDirectory(path)) {
- path = GLib.get_home_dir() + '/gitlive/' + d + '/Pman/DataObjects';
- }
+ var path = cfg.INI + '/Pman/' + d + '/DataObjects';
+
if (!File.isDirectory(path)) {
return; //skip
}
readIni(path + '/' + i);
})
-
-
-
+
});
+ // look at web.XXXX/Pman/XXX/DataObjects/*.ini
+ var inis = File.list(cfg.INI).filter(
+ function(e) { return e.match(/\.links\.ini$/); }
+ )
+
+ inis.forEach(function(i) {
+ readIni(path + '/' + i);
+
+ })
+
+
}
print(JSON.stringify(ini, null,4));
//console.dump(ini);
var firstTxtCol = '';
-
+ print(JSON.stringify(schema, null,4));
schema.forEach(function(e) {
var type = e.Type.match(/([^(]+)\(([^\)]+)\)/);
if (e.Type == 'text') {
xtype = 'TextArea';
}
-
+ if (e.name == 'id') {
+ xtype = 'Hidden';
+ }
// what about booleans.. -> checkboxes..
pageSize : 20,
qtip: 'Select ' + table,
selectOnFocus: true,
- tirggerAction : all,
+ triggerAction : 'all',
typeAhead: true,
- valueField : id,
+
width: 300,
+
+
+
tpl : '<div class="x-grid-cell-text x-btn button"><b>{name}</b> </div>', // SET WHEN USED
queryParam : '',// SET WHEN USED
fieldLabel : table, // SET WHEN USED
+ valueField : 'id',
+ displayField : '', // SET WHEN USED eg. project_id_name
hiddenName : '', // SET WHEN USED eg. project_id
name : '', // SET WHEN USED eg. project_id_name
items : [
// merge in data (eg. project_id => project_id_*****
add.oreader.forEach(function(or) {
-
-
-
reader.reader.push({
name : col + '_' + or.name,
type : or.type
// col is mapped to something..
var combofields = add.combofields;
+ if (add.combofields.length < 2) {
+ continue;
+ }
+ if (typeof(reader.form[col]) == 'undefined') {
+ print("missing linked column " + col);
+ continue;
+ }
+
var combofields_name = add.combofields[1].name;
var old = reader.form[col];
reader.form[col] = JSON.parse(JSON.stringify(add.combo)); // clone
reader.form[col].queryParam = 'query[' + combofields_name + ']';// SET WHEN USED
reader.form[col].fieldLabel = old.fieldLabel; // SET WHEN USED
reader.form[col].hiddenName = old.name; // SET WHEN USED eg. project_id
+ reader.form[col].displayField = combofields_name; // SET WHEN USED eg. project_id
reader.form[col].name = old.name + '_' + combofields_name; // SET WHEN USED eg. project_id_name
reader.form[col].tpl = '<div class="x-grid-cell-text x-btn button"><b>{' + combofields_name +'}</b> </div>'; // SET WHEN USED
root : "data",
'*prop' : "reader",
id : 'id', // maybe no..
- '|fields' : JSON.stringify(reader.reader, null,4)
+ '|fields' : JSON.stringify(reader.reader, null,4).replace(/"/g,"'")
};
File.write(
if (!File.isDirectory(dir)) {
File.mkdir(dir);
}
- formElements = [];
+ var formElements = [];
for (var k in reader.form) {
if (k == 'id') { // should really do primary key testing..
continue;
- }
+ }
formElements.push(reader.form[k]);
}
+ formElements.push(reader.form['id']);
print("WRITE: " + dir + '/' + cfg.DB_NAME + '_' + reader.table + '.json');
style : "margin:10px;",
"|url" : "baseURL + '/Roo/" + reader.table + ".php'",
items : formElements
- })
+ }, null, 4)
);
-
+
+
+
+ /// COMBO..
+
+ dir = GLib.get_home_dir() + '/.Builder/Roo.form.ComboBox';
+ if (!File.isDirectory(dir)) {
+ File.mkdir(dir);
+ }
+
+ print("WRITE: " + dir + '/' + cfg.DB_NAME + '_' + reader.table + '.json');
+
+ File.write(
+ dir + '/' + cfg.DB_NAME + '_' + reader.table + '.json',
+
+
+ JSON.stringify(reader.combo, null, 4)
+ );
+
+
+
+
+
+
+
+
+
+
});