jsharmony 1.40.15 → 1.41.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/AppSrv.File.js CHANGED
@@ -334,6 +334,12 @@ exports.ProcessFileParams = function (req, res, model, P, fieldlist, sql_extfiel
334
334
  if (field.controlparams._data_file_has_extension) tdest += '%%%EXT%%%';
335
335
  fileops.push({ op: 'move', src: '', dest: tdest });
336
336
  }
337
+ //Delete cached files in main operation
338
+ if (field.controlparams.cache) for (var cname in field.controlparams.cache) {
339
+ var cdest = jsh.Config.datadir + field.controlparams.data_folder + '/' + (field.controlparams.data_file_prefix||field.name) + '_' + cname + '_%%%KEY%%%';
340
+ if (field.controlparams._data_file_has_extension) cdest += '%%%EXT%%%';
341
+ fileops.push({ op: 'move', src: '', dest: cdest });
342
+ }
337
343
  filecallback(null);
338
344
  }
339
345
  else {
@@ -378,6 +384,12 @@ exports.ProcessFileParams = function (req, res, model, P, fieldlist, sql_extfiel
378
384
  fileops.push({ op: 'move', src: '', dest: tdest });
379
385
  }
380
386
  }
387
+ //Clear cached files
388
+ if (field.controlparams.cache) for (var cname in field.controlparams.cache) {
389
+ var cdest = jsh.Config.datadir + field.controlparams.data_folder + '/' + (field.controlparams.data_file_prefix||field.name) + '_' + cname + '_%%%KEY%%%';
390
+ if (field.controlparams._data_file_has_extension) cdest += '.' + (field.controlparams.cache[cname].format || '');
391
+ fileops.push({ op: 'move', src: '', dest: cdest });
392
+ }
381
393
  //Resize Image, if applicable
382
394
  if (field.controlparams.image && _.includes(jsh.Config.supported_images, file_ext)) {
383
395
  filedest = Helper.ReplaceAll(filedest, '%%%EXT%%%', '.' + field.controlparams.image.format);
@@ -413,7 +425,7 @@ exports.ProcessFileOperations = function (keyval, fileops, rslt, stats, callback
413
425
  function(filehandlercb){
414
426
  //Get src file extension
415
427
  HelperFS.getExtFileName(filesrc, function(err, filename){
416
- if(err) return callback(Helper.NewError('File not found', -33));
428
+ if(err) return opcallback(Helper.NewError('File not found', -33));
417
429
  filesrc = filename;
418
430
  return filehandlercb();
419
431
  });
@@ -421,7 +433,10 @@ exports.ProcessFileOperations = function (keyval, fileops, rslt, stats, callback
421
433
  function(filehandlercb){
422
434
  //Get dest file extension
423
435
  HelperFS.getExtFileName(filedest, function(err, filename){
424
- if(err) return callback(Helper.NewError('File not found', -33));
436
+ if(err){
437
+ if((fileop.op == 'move') && !filesrc) return opcallback(null);
438
+ return opcallback(Helper.NewError('File not found', -33));
439
+ }
425
440
  filedest = filename;
426
441
  return filehandlercb();
427
442
  });
@@ -445,6 +460,7 @@ exports.ProcessFileOperations = function (keyval, fileops, rslt, stats, callback
445
460
  else return opcallback(null);
446
461
  });
447
462
  }, function (fileerr) {
463
+ if(fileerr && (fileerr.number == -33)) return callback(fileerr);
448
464
  if ((fileerr != null) && ('code' in fileerr) && (fileerr.code == 'ENOENT')) { /* Ignore this error */ }
449
465
  else if (fileerr != null) {
450
466
  jsh.Log.error(fileerr);
@@ -458,7 +474,10 @@ exports.ProcessFileOperationsDone = function (fileops, callback) {
458
474
  async.eachSeries(fileops, function (fileop, opcallback) {
459
475
  if ((fileop.op == 'move') || (fileop.op == 'delete_on_complete')) {
460
476
  if (fileop.src == '') return opcallback(null);
461
- HelperFS.unlink(fileop.src, function (err) { opcallback(null); });
477
+ HelperFS.getExtFileName(fileop.src, function(err, filename){
478
+ if(err) return opcallback(null);
479
+ HelperFS.unlink(filename, function (err) { opcallback(null); });
480
+ });
462
481
  }
463
482
  else return opcallback(null);
464
483
  }, function (err) { callback(null, null); });
@@ -649,12 +649,17 @@ exports.deleteModelForm = function (req, res, fullmodelid, Q, P, onComplete) {
649
649
  _.each(filelist, function (file) {
650
650
  var filefield = _this.getFieldByName(model.fields, file);
651
651
  //Delete file in post-processing
652
- fileops.push({ op: 'move', src: _this.jsh.Config.datadir + filefield.controlparams.data_folder + '/' + (filefield.controlparams.data_file_prefix||file) + '_' + keyval + ((filefield.controlparams._data_file_has_extension)?'%%%EXT%%%':''), dst: '' });
652
+ fileops.push({ op: 'move', src: _this.jsh.Config.datadir + filefield.controlparams.data_folder + '/' + (filefield.controlparams.data_file_prefix||file) + '_' + keyval + ((filefield.controlparams._data_file_has_extension)?'%%%EXT%%%':''), dest: '' });
653
653
  //Delete thumbnails in post-processing
654
654
  if (filefield.controlparams.thumbnails) for (var tname in filefield.controlparams.thumbnails) {
655
- fileops.push({ op: 'move', src: _this.jsh.Config.datadir + filefield.controlparams.data_folder + '/' + (filefield.controlparams.data_file_prefix||filefield.name) + '_' + tname + '_' + keyval + ((filefield.controlparams._data_file_has_extension)?'%%%EXT%%%':''), dst: '' });
655
+ fileops.push({ op: 'move', src: _this.jsh.Config.datadir + filefield.controlparams.data_folder + '/' + (filefield.controlparams.data_file_prefix||filefield.name) + '_' + tname + '_' + keyval + ((filefield.controlparams._data_file_has_extension)?'%%%EXT%%%':''), dest: '' });
656
+ }
657
+ //Delete cache in post-processing
658
+ if (filefield.controlparams.cache) for (var cname in filefield.controlparams.cache) {
659
+ fileops.push({ op: 'move', src: _this.jsh.Config.datadir + filefield.controlparams.data_folder + '/' + (filefield.controlparams.data_file_prefix||filefield.name) + '_' + cname + '_' + keyval + ((filefield.controlparams._data_file_has_extension)?'%%%EXT%%%':''), dest: '' });
656
660
  }
657
661
  });
662
+
658
663
  dbtasks['_POSTPROCESS'] = function (callback) {
659
664
  _this.ProcessFileOperationsDone(fileops, callback);
660
665
  };
@@ -1961,7 +1961,7 @@ exports.ParseEntities = function () {
1961
1961
  var _v_controlparams = [
1962
1962
  'value_true', 'value_false', 'value_hidden', 'code_val', 'popupstyle', 'popupiconstyle', 'popup_copy_results', 'onpopup', 'base_readonly', 'dateformat', 'panelstyle',
1963
1963
  'download_button', 'preview_button', 'upload_button', 'delete_button', 'data_folder', 'data_file_prefix', 'sqlparams', '_data_file_has_extension', 'show_thumbnail', 'preview_on_click', 'icon',
1964
- 'image', 'thumbnails', 'expand_all', 'expand_to_selected', 'onmove', 'ondrop', 'ongetnodecontent', 'drag_anchor_settings', 'item_context_menu', 'item_dropdown', 'insert_link', 'grid_save_before_update', 'update_when_blank', 'htmlarea_config', 'placeholder'
1964
+ 'image', 'thumbnails', 'cache', 'expand_all', 'expand_to_selected', 'onmove', 'ondrop', 'ongetnodecontent', 'drag_anchor_settings', 'item_context_menu', 'item_dropdown', 'insert_link', 'grid_save_before_update', 'update_when_blank', 'htmlarea_config', 'placeholder'
1965
1965
  ];
1966
1966
  var _v_popuplov = ['target', 'code_val', 'popupstyle', 'popupiconstyle', 'popup_copy_results', 'onpopup', 'popup_copy_results', 'onpopup', 'base_readonly'];
1967
1967
  var _v_lov = ['sql', 'sql2', 'sqlmp', 'code', 'code2', 'code_sys', 'code2_sys', 'code_app', 'code2_app', 'schema', 'blank', 'parent', 'parents', 'datalock', 'sql_params', 'sqlselect', 'sqlselect_params', 'sqltruncate', 'always_get_full_lov', 'nodatalock', 'showcode', 'db', 'database', 'values', 'post_process'];
package/jsHarmony.css CHANGED
@@ -229,6 +229,7 @@ BODY
229
229
  <%-rootcss%> .xform_file_download .xform_file_download_button { padding-right:25px; }
230
230
  <%-rootcss%> .xform_file_download.nodocument .xform_file_download_button { display:none; }
231
231
  <%-rootcss%> .xform_image, .xform_image_preview { display:inline-block; }
232
+ <%-rootcss%> .xtbl td .xform_image_preview { vertical-align: text-top; }
232
233
  <%-rootcss%> .xform .xform_label,
233
234
  <%-rootcss%> .xform input,
234
235
  <%-rootcss%> .xform select,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jsharmony",
3
- "version": "1.40.15",
3
+ "version": "1.41.0",
4
4
  "description": "Rapid Application Development (RAD) Platform for Node.js Database Application Development",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -102,7 +102,7 @@ for(var i=0;i<model.fields.length;i++){
102
102
  <% if(field.controlparams.preview_button){ %><a class="<%=field.name%>_preview linkbutton xform_file_preview_button" href="#" onclick="<%-instance%>.XPage.FilePreview(<%=JSON.stringify(model.id)%>,<%=JSON.stringify(field.name)%>,<%=JSON.stringify(field.caption_ext||field.caption)%>);return false;"><img src="<%-jsh._PUBLICURL%>images/icon_search.png" /><%=field.controlparams.preview_button%></a><% } %>
103
103
  <a class="<%=field.name%>_upload linkbutton xform_file_upload_button" href="#" onclick="<%-instance%>.XPage.FileUploadDialog(<%=JSON.stringify(model.id)%>,<%=JSON.stringify(field.name)%>,<%=JSON.stringify(field.caption_ext||field.caption)%>);return false;"><img src="<%-jsh._PUBLICURL%>images/icon_upload.png" /><%=field.controlparams.upload_button%></a>
104
104
  <a class="<%=field.name%>_delete linkbutton xform_file_delete_button" href="#" onclick="<%-instance%>.XPage.FileDelete(<%=JSON.stringify(model.id)%>,<%=JSON.stringify(field.name)%>,<%=JSON.stringify(field.caption_ext||field.caption)%>);return false;"><img src="<%-jsh._PUBLICURL%>images/icon_delete.png" /><%=field.controlparams.delete_button%></a>
105
- <% if(field.controlparams.preview_on_click){ %><a class="<%=field.name%>_preview xform_filee_preview xelem<%=model.class%>" href="#" onclick="<%-instance%>.XPage.FilePreview(<%=JSON.stringify(model.id)%>,<%=JSON.stringify(field.name)%>,<%=JSON.stringify(field.caption_ext||field.caption)%>);return false;"><% } %>
105
+ <% if(field.controlparams.preview_on_click){ %><a class="<%=field.name%>_preview xform_file_preview xelem<%=model.class%>" href="#" onclick="<%-instance%>.XPage.FilePreview(<%=JSON.stringify(model.id)%>,<%=JSON.stringify(field.name)%>,<%=JSON.stringify(field.caption_ext||field.caption)%>);return false;"><% } %>
106
106
  <img class="<%=field.name%>_thumbnail xform_file_thumbnail" />
107
107
  <% if(field.controlparams.preview_on_click){ %></a><% } %>
108
108
  <input autocomplete="off" type="hidden" data-id="<%=field.name%>_token" class="<%=field.name%>_token xform_file_token xform_ctrl xelem<%=model.class%> <%=controlclass%>" value="" />