WritingBoard.js 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. MWF.xDesktop.requireApp("process.Xform", "WritingBoard", null, false);
  2. MWF.xApplication.cms.Xform.WritingBoard = MWF.CMSWritingBoard = new Class({
  3. Extends: MWF.APPWritingBoard,
  4. upload: function( callback ){
  5. var img = this.tablet.getImage( null, true );
  6. if(img)Promise.resolve( img ).then(function( image ){
  7. Promise.resolve( this.tablet.getFormData(image) ).then(function (formData) {
  8. o2.xDesktop.uploadImageByScale(
  9. this.form.businessData.document.id,
  10. "cmsDocument",
  11. 0, //maxSize
  12. formData,
  13. image,
  14. function (json) {
  15. if(callback)callback(json);
  16. }.bind(this),
  17. function () {
  18. }.bind(this)
  19. );
  20. }.bind(this))
  21. }.bind(this))
  22. },
  23. validationConfigItem: function(routeName, data){
  24. var flag = (data.status=="all") ? true: (routeName == "publish");
  25. if (flag){
  26. var n = this.getData();
  27. var v = (data.valueType=="value") ? n : n.length;
  28. switch (data.operateor){
  29. case "isnull":
  30. if (!v){
  31. this.notValidationMode(data.prompt);
  32. return false;
  33. }
  34. break;
  35. case "notnull":
  36. if (v){
  37. this.notValidationMode(data.prompt);
  38. return false;
  39. }
  40. break;
  41. case "gt":
  42. if (v>data.value){
  43. this.notValidationMode(data.prompt);
  44. return false;
  45. }
  46. break;
  47. case "lt":
  48. if (v<data.value){
  49. this.notValidationMode(data.prompt);
  50. return false;
  51. }
  52. break;
  53. case "equal":
  54. if (v==data.value){
  55. this.notValidationMode(data.prompt);
  56. return false;
  57. }
  58. break;
  59. case "neq":
  60. if (v!=data.value){
  61. this.notValidationMode(data.prompt);
  62. return false;
  63. }
  64. break;
  65. case "contain":
  66. if (v.indexOf(data.value)!=-1){
  67. this.notValidationMode(data.prompt);
  68. return false;
  69. }
  70. break;
  71. case "notcontain":
  72. if (v.indexOf(data.value)==-1){
  73. this.notValidationMode(data.prompt);
  74. return false;
  75. }
  76. break;
  77. }
  78. }
  79. return true;
  80. }
  81. });