jsharmony 1.30.2 → 1.31.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/clientjs/XExt.js CHANGED
@@ -2006,17 +2006,17 @@ exports = module.exports = function(jsh){
2006
2006
  }
2007
2007
  },
2008
2008
  function(){
2009
- jsh.$dialogBlock(sel + ' input.button_ok').on('click', acceptfunc);
2010
- jsh.$dialogBlock(sel + ' input.button_cancel').on('click', cancelfunc);
2009
+ jsh.$dialogBlock(sel + ' input.button_ok').on('click', function(){ acceptfunc(); });
2010
+ jsh.$dialogBlock(sel + ' input.button_cancel').on('click', function(){ cancelfunc(); });
2011
2011
 
2012
- jsh.$dialogBlock(sel).off('acceptDialog').on('acceptDialog', acceptfunc);
2013
- jsh.$dialogBlock(sel).off('cancelDialog').on('cancelDialog', cancelfunc);
2012
+ jsh.$dialogBlock(sel).off('acceptDialog').on('acceptDialog', function(){ acceptfunc(); });
2013
+ jsh.$dialogBlock(sel).off('cancelDialog').on('cancelDialog', function(){ cancelfunc(); });
2014
2014
 
2015
2015
  jsh.$dialogBlock(sel + ' input, ' + sel + ' textarea, ' + sel + ' select').on('keydown', function (e) {
2016
2016
  if (options.specialKeys.escape && (e.keyCode == 27)) { e.preventDefault(); e.stopImmediatePropagation(); cancelfunc(); }
2017
2017
  });
2018
2018
  jsh.$dialogBlock(sel + ' input:not(:checkbox):not(:button)').on('keydown', function (e) {
2019
- if (options.specialKeys.escape && (e.keyCode == 13)) { e.preventDefault(); e.stopImmediatePropagation(); acceptfunc(); }
2019
+ if (options.specialKeys.enter && (e.keyCode == 13)) { e.preventDefault(); e.stopImmediatePropagation(); acceptfunc(); }
2020
2020
  });
2021
2021
  if(options.backgroundClose){
2022
2022
  jsh.dialogBlock.on('mousedown.close' + sel, function(e){
@@ -156,6 +156,53 @@ exports.LoadSQLFiles = function(module, dir, options){
156
156
  return rslt;
157
157
  };
158
158
 
159
+ exports.LoadSQLFile = function(sqlfilename, module, basepath){
160
+ var _this = this;
161
+ var sqlfiletype = 'sql';
162
+ if(basepath){
163
+ try{
164
+ var basepathStats = fs.lstatSync(basepath);
165
+ if(!basepathStats.isDirectory()) basepath = path.dirname(basepath);
166
+ }
167
+ catch(ex){
168
+ basepath = '';
169
+ }
170
+ }
171
+ if(Helper.beginsWith(sqlfilename, 'simplejson:')){
172
+ sqlfiletype = 'simplejson';
173
+ sqlfilename = sqlfilename.substr(11);
174
+ }
175
+ else if(Helper.beginsWith(sqlfilename, 'json:')){
176
+ sqlfiletype = 'json';
177
+ sqlfilename = sqlfilename.substr(5);
178
+ }
179
+ else if (sqlfilename.indexOf('.simplejson', sqlfilename.length - 11) !== -1){
180
+ sqlfiletype = 'simplejson';
181
+ }
182
+ else if (sqlfilename.indexOf('.json', sqlfilename.length - 5) !== -1){
183
+ sqlfiletype = 'json';
184
+ }
185
+
186
+ _this.Log.info('Loading SQL from ' + sqlfilename);
187
+
188
+ if(basepath && !path.isAbsolute(sqlfilename)) sqlfilename = path.join(basepath, sqlfilename);
189
+
190
+ if(sqlfiletype=='simplejson'){
191
+ try{
192
+ return JSON.parse(fs.readFileSync(sqlfilename, 'utf8'));
193
+ }
194
+ catch(ex){
195
+ throw new Error('Error parsing file "'+sqlfilename+'":' + ex.toString());
196
+ }
197
+ }
198
+ else if(sqlfiletype=='json'){
199
+ return _this.ParseJSON(sqlfilename, module && module.name, 'SQL File ' + sqlfilename, null, { fatalError: false });
200
+ }
201
+ else {
202
+ return fs.readFileSync(sqlfilename, 'utf8');
203
+ }
204
+ };
205
+
159
206
  exports.LoadSQLObjects = function(dir, module, dbid, options){
160
207
  var _this = this;
161
208
  options = _.extend({ dbtype: null }, options);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jsharmony",
3
- "version": "1.30.2",
3
+ "version": "1.31.0",
4
4
  "description": "Rapid Application Development (RAD) Platform for Node.js Database Application Development",
5
5
  "main": "index.js",
6
6
  "scripts": {