jsharmony-cms 1.5.3 → 1.6.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.
Files changed (126) hide show
  1. package/.eslintrc.js +47 -0
  2. package/.eslintrc_clientjs.js +45 -0
  3. package/.eslintrc_models.js +63 -0
  4. package/.eslintrc_onroute.js +57 -0
  5. package/.eslintrc_test.js +53 -0
  6. package/clientjs/component/componentModel/componentTemplate.js +11 -11
  7. package/clientjs/component/componentModel/dataModelTemplate_formPreview.js +12 -12
  8. package/clientjs/component/componentModel/dataModelTemplate_gridPreview.js +17 -15
  9. package/clientjs/component/componentModel/fieldModel.js +4 -5
  10. package/clientjs/component/componentModel/propertiesModelTemplate_form.js +7 -7
  11. package/clientjs/component/dialogs/dialog.js +13 -15
  12. package/clientjs/component/dialogs/dialogResizer.js +11 -11
  13. package/clientjs/component/dialogs/formDialog.js +8 -8
  14. package/clientjs/component/dialogs/gridDialog.js +5 -5
  15. package/clientjs/component/dialogs/overlayService.js +4 -4
  16. package/clientjs/component/editors/dataEditor_form.js +18 -17
  17. package/clientjs/component/editors/dataEditor_gridPreview.js +13 -14
  18. package/clientjs/component/editors/dataEditor_gridPreviewController.js +56 -56
  19. package/clientjs/component/editors/gridDataStore.js +9 -9
  20. package/clientjs/component/editors/htmlPropertyEditorController.js +6 -6
  21. package/clientjs/component/editors/propertyEditor_form.js +6 -5
  22. package/clientjs/component/templateRenderer.js +14 -14
  23. package/clientjs/component/utils/cloner.js +1 -1
  24. package/clientjs/component/utils/convert.js +1 -1
  25. package/clientjs/component/utils/domSerializer.js +5 -5
  26. package/clientjs/jsHarmonyCMS.Component.js +16 -16
  27. package/clientjs/jsHarmonyCMS.ComponentManager.js +32 -30
  28. package/clientjs/jsHarmonyCMS.Controller.js +10 -10
  29. package/clientjs/jsHarmonyCMS.ControllerExtensions.js +11 -15
  30. package/clientjs/jsHarmonyCMS.Editor.Picker.js +15 -15
  31. package/clientjs/jsHarmonyCMS.Editor.TinyMCEPlugin.js +50 -49
  32. package/clientjs/jsHarmonyCMS.Editor.js +24 -26
  33. package/clientjs/jsHarmonyCMS.Loader.js +6 -6
  34. package/clientjs/jsHarmonyCMS.Toolbar.js +25 -25
  35. package/clientjs/jsHarmonyCMS.Util.js +11 -11
  36. package/clientjs/jsHarmonyCMS.js +13 -20
  37. package/doc/deployment_target.json +7 -1
  38. package/init/install.app.config.local.js +14 -14
  39. package/jsHarmonyCMS.js +35 -38
  40. package/jsHarmonyCMSConfig.js +17 -18
  41. package/jsHarmonyCMSPreviewServer.js +4 -6
  42. package/jsHarmonyCMSSFTPServer.js +23 -24
  43. package/lint.cmd +10 -0
  44. package/models/Branch_Clone.js +2 -3
  45. package/models/Branch_Conflicts.js +16 -16
  46. package/models/Branch_Conflicts.onroute.js +1 -1
  47. package/models/Branch_Diff.js +12 -12
  48. package/models/Branch_Diff.onroute.js +1 -1
  49. package/models/Branch_Review.js +4 -4
  50. package/models/Branch_Summary.js +5 -9
  51. package/models/Branch_Validate.js +10 -10
  52. package/models/Dashboard_BranchOverview.js +3 -3
  53. package/models/Dashboard_NewContentPieChart.js +13 -23
  54. package/models/Dashboard_NewContentPieChart.json +2 -1
  55. package/models/Dashboard_UserPieChart.js +13 -23
  56. package/models/Dashboard_UserPieChart.json +2 -1
  57. package/models/Link_Browser_Base.onroute.js +4 -6
  58. package/models/Media_Tree.js +61 -65
  59. package/models/Media_Tree.onroute.js +4 -6
  60. package/models/Menu_Listing.js +6 -6
  61. package/models/Menu_Listing.onroute.js +10 -10
  62. package/models/Menu_Tree.js +44 -45
  63. package/models/Menu_Tree_Info.js +9 -9
  64. package/models/Page_Listing.js +2 -2
  65. package/models/Page_Listing.onroute.js +1 -2
  66. package/models/Page_Revision_Listing.onroute.js +1 -2
  67. package/models/Page_Tree.js +17 -17
  68. package/models/Page_Tree.onroute.js +2 -4
  69. package/models/Page_Tree_Listing.js +21 -24
  70. package/models/Publish_Add.onroute.js +1 -3
  71. package/models/Publish_Add_Branch.js +4 -4
  72. package/models/Publish_Add_Release.js +7 -7
  73. package/models/Publish_Change_Log.js +3 -3
  74. package/models/Publish_Log.js +6 -6
  75. package/models/Publish_Redeploy.js +3 -4
  76. package/models/Search.js +31 -31
  77. package/models/Site_Config.js +2 -2
  78. package/models/Site_Config.onroute.js +0 -1
  79. package/models/Site_Deployment_Target.js +26 -27
  80. package/models/Site_Deployment_Target_CmsHost_Listing.onroute.js +2 -2
  81. package/models/Site_Deployment_Target_IntegrationCode.js +7 -7
  82. package/models/Site_Deployment_Target_IntegrationCode.onroute.js +2 -7
  83. package/models/Site_Deployment_Target_Key.js +6 -6
  84. package/models/Site_Deployment_Target_Key_Upload.js +4 -4
  85. package/models/Site_SFTP.js +1 -1
  86. package/models/Site_SFTP.onroute.js +4 -5
  87. package/models/Site_Template_Component.js +2 -2
  88. package/models/Site_Template_Component.onroute.js +11 -14
  89. package/models/Site_Template_Page.js +4 -6
  90. package/models/Site_Template_Page.onroute.js +11 -14
  91. package/models/Sitemap_Listing.js +4 -4
  92. package/models/Sitemap_Tree.js +61 -64
  93. package/models/Sitemap_Tree.onroute.js +1 -2
  94. package/models/Sitemap_Tree_Info.js +14 -14
  95. package/models/_funcs.branch.js +73 -51
  96. package/models/_funcs.component.js +35 -34
  97. package/models/_funcs.conflicts.js +70 -72
  98. package/models/_funcs.deploy.ftp.driver.ftp.js +20 -20
  99. package/models/_funcs.deploy.ftp.driver.sftp.js +38 -38
  100. package/models/_funcs.deploy.ftp.js +67 -67
  101. package/models/_funcs.deploy.js +289 -313
  102. package/models/_funcs.deployment_target.js +37 -37
  103. package/models/_funcs.diff.js +69 -70
  104. package/models/_funcs.js +1 -1
  105. package/models/_funcs.media.js +16 -18
  106. package/models/_funcs.menu.js +10 -10
  107. package/models/_funcs.merge.js +24 -27
  108. package/models/_funcs.page.js +42 -51
  109. package/models/_funcs.search.js +26 -44
  110. package/models/_funcs.sitemap.js +52 -54
  111. package/models/_funcs.template.js +100 -98
  112. package/models/_funcs.validate.js +35 -42
  113. package/models/js/branch.js +20 -20
  114. package/models/js/site.js +19 -19
  115. package/package.json +2 -2
  116. package/public/js/jsHarmonyCMS.Controller.page.js +49 -48
  117. package/public/js/jsHarmonyCMS.js +439 -449
  118. package/public/js/jsHarmonyCMS.local.js +2 -2
  119. package/public/js/tinymce/plugins/charmapmaterialicons/plugin.min.js +1661 -1660
  120. package/public/js/tinymce/plugins/jsHarmonyCmsWebSnippet/plugin.min.js +650 -647
  121. package/test/HTMLDoc.js +53 -54
  122. package/test/merge-matrix.js +101 -101
  123. package/test/merge.js +13 -15
  124. package/test/parseUrl.js +0 -2
  125. package/public/js/tinymce/plugins/charmapmaterialicons/plugin.orig.js +0 -1706
  126. package/public/js/tinymce/plugins/jsHarmonyCmsWebSnippet/plugin.orig.js +0 -556
package/.eslintrc.js ADDED
@@ -0,0 +1,47 @@
1
+ module.exports = {
2
+ "env": {
3
+ "browser": true,
4
+ "node": true,
5
+ "es6": true,
6
+ },
7
+ "extends": [
8
+ "eslint:recommended",
9
+ ],
10
+ "parserOptions": {
11
+ "ecmaVersion": 8
12
+ },
13
+ "rules": {
14
+ "no-trailing-spaces":[
15
+ "error",
16
+ { "skipBlankLines": true }
17
+ ],
18
+ "indent": [
19
+ "error",
20
+ 2,
21
+ { "SwitchCase":1 }
22
+ ],
23
+ "linebreak-style": [
24
+ "error",
25
+ "windows"
26
+ ],
27
+ "quotes": [
28
+ "error",
29
+ "single",
30
+ { "avoidEscape": true }
31
+ ],
32
+ "semi": [
33
+ "error",
34
+ "always"
35
+ ],
36
+ "no-unused-vars": [
37
+ "error",
38
+ {
39
+ "args": "none"
40
+ }
41
+ ],
42
+ "no-cond-assign": [
43
+ "error",
44
+ "except-parens"
45
+ ]
46
+ }
47
+ };
@@ -0,0 +1,45 @@
1
+ module.exports = {
2
+ "env": {
3
+ "browser": true,
4
+ },
5
+ "extends": [
6
+ "eslint:recommended"
7
+ ],
8
+ "parserOptions": {
9
+ "ecmaVersion": 6
10
+ },
11
+ "rules": {
12
+ "no-trailing-spaces":[
13
+ "error",
14
+ { "skipBlankLines": true }
15
+ ],
16
+ "indent": [
17
+ "error",
18
+ 2,
19
+ { "SwitchCase":1 }
20
+ ],
21
+ "linebreak-style": [
22
+ "error",
23
+ "windows"
24
+ ],
25
+ "quotes": [
26
+ "error",
27
+ "single",
28
+ { "avoidEscape": true }
29
+ ],
30
+ "semi": [
31
+ "error",
32
+ "always"
33
+ ],
34
+ "no-unused-vars": [
35
+ "error",
36
+ {
37
+ "args": "none"
38
+ }
39
+ ],
40
+ "no-cond-assign": [
41
+ "error",
42
+ "except-parens"
43
+ ]
44
+ }
45
+ };
@@ -0,0 +1,63 @@
1
+ module.exports = {
2
+ "env": {
3
+ "browser": true,
4
+ },
5
+ "extends": [
6
+ "eslint:recommended",
7
+ ],
8
+ "parserOptions": {
9
+ "ecmaVersion": 6
10
+ },
11
+ "globals": {
12
+ "jsh": "readonly",
13
+ "modelid": "readonly",
14
+ "XExt": "readonly",
15
+ "XForm": "readonly",
16
+ "XPage": "readonly",
17
+ "XValidate": "readonly",
18
+ "XBase": "readonly",
19
+ "XModels": "readonly",
20
+ "XFormat": "readonly",
21
+ "$": "readonly",
22
+ "_": "readonly",
23
+ "ejs": "readonly",
24
+ "moment": "readonly",
25
+ "async": "readonly",
26
+ "xmodel": "readonly",
27
+ "_GET": "readonly",
28
+ },
29
+ "rules": {
30
+ "no-trailing-spaces":[
31
+ "error",
32
+ { "skipBlankLines": true }
33
+ ],
34
+ "indent": [
35
+ "error",
36
+ 2,
37
+ { "SwitchCase":1 }
38
+ ],
39
+ "linebreak-style": [
40
+ "error",
41
+ "windows"
42
+ ],
43
+ "quotes": [
44
+ "error",
45
+ "single",
46
+ { "avoidEscape": true }
47
+ ],
48
+ "semi": [
49
+ "error",
50
+ "always"
51
+ ],
52
+ "no-unused-vars": [
53
+ "error",
54
+ {
55
+ "args": "none"
56
+ }
57
+ ],
58
+ "no-cond-assign": [
59
+ "error",
60
+ "except-parens"
61
+ ]
62
+ }
63
+ };
@@ -0,0 +1,57 @@
1
+ module.exports = {
2
+ "env": {
3
+ "browser": true,
4
+ "node": true,
5
+ "es6": true,
6
+ },
7
+ "extends": [
8
+ "eslint:recommended",
9
+ ],
10
+ "globals": {
11
+ "routetype": "readonly",
12
+ "req": "readonly",
13
+ "res": "readonly",
14
+ "callback": "readonly",
15
+ "require": "readonly",
16
+ "jsh": "readonly",
17
+ "modelid": "readonly",
18
+ "params": "readonly",
19
+ },
20
+ "parserOptions": {
21
+ "ecmaVersion": 8
22
+ },
23
+ "rules": {
24
+ "no-trailing-spaces":[
25
+ "error",
26
+ { "skipBlankLines": true }
27
+ ],
28
+ "indent": [
29
+ "error",
30
+ 2,
31
+ { "SwitchCase":1 }
32
+ ],
33
+ "linebreak-style": [
34
+ "error",
35
+ "windows"
36
+ ],
37
+ "quotes": [
38
+ "error",
39
+ "single",
40
+ { "avoidEscape": true }
41
+ ],
42
+ "semi": [
43
+ "error",
44
+ "always"
45
+ ],
46
+ "no-unused-vars": [
47
+ "error",
48
+ {
49
+ "args": "none"
50
+ }
51
+ ],
52
+ "no-cond-assign": [
53
+ "error",
54
+ "except-parens"
55
+ ]
56
+ }
57
+ };
@@ -0,0 +1,53 @@
1
+ module.exports = {
2
+ "env": {
3
+ "browser": true,
4
+ },
5
+ "plugins": [
6
+ "es5"
7
+ ],
8
+ "extends": [
9
+ "eslint:recommended"
10
+ ],
11
+ "globals": {
12
+ "it": "readonly",
13
+ "describe": "readonly",
14
+ "after": "readonly",
15
+ "before": "readonly",
16
+ "beforeEach": "readonly",
17
+ },
18
+ "rules": {
19
+ "no-trailing-spaces":[
20
+ "error",
21
+ { "skipBlankLines": true }
22
+ ],
23
+ "indent": [
24
+ "error",
25
+ 2,
26
+ { "SwitchCase":1 }
27
+ ],
28
+ "linebreak-style": [
29
+ "error",
30
+ "windows"
31
+ ],
32
+ "quotes": [
33
+ "error",
34
+ "single",
35
+ { "avoidEscape": true }
36
+ ],
37
+ "semi": [
38
+ "error",
39
+ "always"
40
+ ],
41
+ "no-console": "off",
42
+ "no-unused-vars": [
43
+ "error",
44
+ {
45
+ "args": "none"
46
+ }
47
+ ],
48
+ "no-cond-assign": [
49
+ "error",
50
+ "except-parens"
51
+ ]
52
+ }
53
+ };
@@ -85,8 +85,8 @@ ComponentTemplate.prototype.getCaptions = function() {
85
85
  captions.push(this._componentConfig.caption);
86
86
  captions.push(this._componentConfig.caption);
87
87
  }
88
- return captions
89
- }
88
+ return captions;
89
+ };
90
90
 
91
91
  /**
92
92
  * Get the component configuration as defined by the component JSON.
@@ -95,7 +95,7 @@ ComponentTemplate.prototype.getCaptions = function() {
95
95
  */
96
96
  ComponentTemplate.prototype.getComponentConfig = function() {
97
97
  return this._componentConfig;
98
- }
98
+ };
99
99
 
100
100
  /**
101
101
  * Return the editor type
@@ -107,7 +107,7 @@ ComponentTemplate.prototype.getDataEditorType = function() {
107
107
  return this._componentConfig.data.layout;
108
108
  }
109
109
  return undefined;
110
- }
110
+ };
111
111
 
112
112
  /**
113
113
  * @public
@@ -115,7 +115,7 @@ ComponentTemplate.prototype.getDataEditorType = function() {
115
115
  */
116
116
  ComponentTemplate.prototype.getDataModelTemplate_FormPreview = function() {
117
117
  return this._dataModelTemplate_FormPreview;
118
- }
118
+ };
119
119
 
120
120
  /**
121
121
  * @public
@@ -123,7 +123,7 @@ ComponentTemplate.prototype.getDataModelTemplate_FormPreview = function() {
123
123
  */
124
124
  ComponentTemplate.prototype.getDataModelTemplate_GridPreview = function() {
125
125
  return this._dataModelTemplate_GridPreview;
126
- }
126
+ };
127
127
 
128
128
  /**
129
129
  * @public
@@ -131,7 +131,7 @@ ComponentTemplate.prototype.getDataModelTemplate_GridPreview = function() {
131
131
  */
132
132
  ComponentTemplate.prototype.getPropertiesModelTemplate_Form = function() {
133
133
  return this._propertiesModelTemplate_Form;
134
- }
134
+ };
135
135
 
136
136
  /**
137
137
  * Get the ID specified for the component configuration.
@@ -141,7 +141,7 @@ ComponentTemplate.prototype.getPropertiesModelTemplate_Form = function() {
141
141
  */
142
142
  ComponentTemplate.prototype.getTemplateId = function() {
143
143
  return this._componentConfig.id;
144
- }
144
+ };
145
145
 
146
146
  /**
147
147
  * Gets the base class name for this component
@@ -150,7 +150,7 @@ ComponentTemplate.prototype.getTemplateId = function() {
150
150
  */
151
151
  ComponentTemplate.prototype.getClassName = function() {
152
152
  return this._componentConfig.className || this._jsh.XExt.escapeCSSClass(this._componentConfig.id, { nodash: true });
153
- }
153
+ };
154
154
 
155
155
  /**
156
156
  * @private
@@ -175,7 +175,7 @@ ComponentTemplate.prototype.processBrowserFields = function(fields) {
175
175
  titleFieldName: field.name + '_jsh_browserDataTitle',
176
176
  browserType: browserType,
177
177
  validate: field.validate,
178
- }
178
+ };
179
179
 
180
180
  field.mediaBrowserControlInfo = info;
181
181
  field.name = info.titleFieldName;
@@ -218,7 +218,7 @@ ComponentTemplate.prototype.processBrowserFields = function(fields) {
218
218
  });
219
219
 
220
220
  return retVal;
221
- }
221
+ };
222
222
 
223
223
 
224
224
  exports = module.exports = ComponentTemplate;
@@ -77,10 +77,10 @@ DataModelTemplate_FormPreview.prototype.buildTemplate = function(componentTempla
77
77
  var popup = _.isArray(modelConfig.popup) ? modelConfig.popup : [];
78
78
 
79
79
  var fields = modelConfig.fields || [];
80
- fields.unshift({ control:'html', value:'<div class="jsharmony_cms">', captionclass:"hidden"});
81
- fields.push({ control:'html', value:'</div>', captionclass:"hidden"});
80
+ fields.unshift({ control:'html', value:'<div class="jsharmony_cms">', captionclass:'hidden'});
81
+ fields.push({ control:'html', value:'</div>', captionclass:'hidden'});
82
82
  fields.push({
83
- caption: '', control:'html', value:'<div class="jsharmony_cms_preview_editor jsharmony_cms_component_preview" data-id="previewWrapper"></div>', 'block':true, captionclass:"hidden"
83
+ caption: '', control:'html', value:'<div class="jsharmony_cms_preview_editor jsharmony_cms_component_preview" data-id="previewWrapper"></div>', 'block':true, captionclass:'hidden'
84
84
  });
85
85
 
86
86
  var model = _.extend({}, modelConfig);
@@ -116,7 +116,7 @@ DataModelTemplate_FormPreview.prototype.buildTemplate = function(componentTempla
116
116
  itemTemplate = templateHtml;
117
117
  }
118
118
  this._itemTemplate = itemTemplate;
119
- }
119
+ };
120
120
 
121
121
  /**
122
122
  * Get the link browser field info (if exists) for the link field with
@@ -130,7 +130,7 @@ DataModelTemplate_FormPreview.prototype.getBrowserFieldInfo = function(fieldName
130
130
  return field.mediaBrowserControlInfo && field.mediaBrowserControlInfo.dataFieldName === fieldName;
131
131
  });
132
132
  return field ? field.mediaBrowserControlInfo : undefined;
133
- }
133
+ };
134
134
 
135
135
  /**
136
136
  * Get the link browser field infos
@@ -145,7 +145,7 @@ DataModelTemplate_FormPreview.prototype.getBrowserFieldInfos = function() {
145
145
  }
146
146
  });
147
147
  return retVal;
148
- }
148
+ };
149
149
 
150
150
  /**
151
151
  * Get the EJS string used to render the item preview
@@ -154,7 +154,7 @@ DataModelTemplate_FormPreview.prototype.getBrowserFieldInfos = function() {
154
154
  */
155
155
  DataModelTemplate_FormPreview.prototype.getItemTemplate = function() {
156
156
  return this._itemTemplate || '';
157
- }
157
+ };
158
158
 
159
159
  /**
160
160
  * @public
@@ -164,7 +164,7 @@ DataModelTemplate_FormPreview.prototype.getModelInstance = function() {
164
164
  model.id = DataModelTemplate_FormPreview.getNextInstanceId(this._componentTemplate);
165
165
 
166
166
  return model;
167
- }
167
+ };
168
168
 
169
169
  /**
170
170
  * Return the raw model JavaScript.
@@ -173,7 +173,7 @@ DataModelTemplate_FormPreview.prototype.getModelInstance = function() {
173
173
  */
174
174
  DataModelTemplate_FormPreview.prototype.getModelJs = function() {
175
175
  return this._rawOriginalJs;
176
- }
176
+ };
177
177
 
178
178
  /**
179
179
  * Get a unique ID for the model instance
@@ -184,7 +184,7 @@ DataModelTemplate_FormPreview.getNextInstanceId = function(componentTemplate) {
184
184
  if (DataModelTemplate_FormPreview._id == undefined) DataModelTemplate_FormPreview._id = 0;
185
185
  var id = DataModelTemplate_FormPreview._id++;
186
186
  return 'DataModel_FormPreview_' + componentTemplate.getClassName() + '_' + id;
187
- }
187
+ };
188
188
 
189
189
  /**
190
190
  * Create a pristine copy of the data.
@@ -202,7 +202,7 @@ DataModelTemplate_FormPreview.getNextInstanceId = function(componentTemplate) {
202
202
  */
203
203
  DataModelTemplate_FormPreview.prototype.makePristineCopy = function(dataInstance) {
204
204
  return FieldModel.makePristineCopy(dataInstance, this._modelTemplate.fields);
205
- }
205
+ };
206
206
 
207
207
  /**
208
208
  * Iterates through the fieldModels
@@ -230,6 +230,6 @@ DataModelTemplate_FormPreview.prototype.makePristineCopy = function(dataInstance
230
230
  */
231
231
  DataModelTemplate_FormPreview.prototype.populateDataInstance = function(dataInstance) {
232
232
  return FieldModel.populateDataInstance(dataInstance, this._modelTemplate.fields || []);
233
- }
233
+ };
234
234
 
235
235
  exports = module.exports = DataModelTemplate_FormPreview;
@@ -142,7 +142,7 @@ DataModelTemplate_GridPreview.prototype.buildTemplate = function(componentTempla
142
142
  this._rowTemplate = rowTemplate;
143
143
 
144
144
  return model;
145
- }
145
+ };
146
146
 
147
147
  /**
148
148
  * Ensure that an ID field exists.
@@ -162,7 +162,7 @@ DataModelTemplate_GridPreview.prototype.ensureIdField = function(fields) {
162
162
  }
163
163
 
164
164
  return idFields[0].name;
165
- }
165
+ };
166
166
 
167
167
  /**
168
168
  * Ensure that a sequence field exists.
@@ -174,14 +174,14 @@ DataModelTemplate_GridPreview.prototype.ensureIdField = function(fields) {
174
174
  DataModelTemplate_GridPreview.prototype.ensureSequenceField = function(fields) {
175
175
 
176
176
  var seqFieldName = 'sequence'; //This is by convention!!!
177
- var hasSeqField = _.some(fields, function(field) { return field.name === seqFieldName; })
177
+ var hasSeqField = _.some(fields, function(field) { return field.name === seqFieldName; });
178
178
  if (!hasSeqField) {
179
179
  var idField = { name: seqFieldName, type: 'int', control: 'hidden', caption: '', isAutoAddedField: true };
180
180
  fields.push(idField);
181
181
  }
182
182
 
183
- return seqFieldName
184
- }
183
+ return seqFieldName;
184
+ };
185
185
 
186
186
  /**
187
187
  * Get the name of the field used for the data item ID.
@@ -190,7 +190,7 @@ DataModelTemplate_GridPreview.prototype.ensureSequenceField = function(fields) {
190
190
  */
191
191
  DataModelTemplate_GridPreview.prototype.getIdFieldName = function() {
192
192
  return this._idFieldName;
193
- }
193
+ };
194
194
 
195
195
  /**
196
196
  * @public
@@ -199,7 +199,9 @@ DataModelTemplate_GridPreview.prototype.getModelInstance = function() {
199
199
  var model = Cloner.deepClone(this._modelTemplate);
200
200
  model.id = DataModelTemplate_GridPreview.getNextInstanceId(this._componentTemplate);
201
201
 
202
- model.js = function() {
202
+ //model.js is stringified and executed in the context of the model
203
+ /* globals modelid, jsh */
204
+ model.js = function() {
203
205
  var gridApi = new jsh.XAPI.Grid.Static(modelid);
204
206
  var formApi = new jsh.XAPI.Form.Static(modelid);
205
207
  return {
@@ -207,11 +209,11 @@ DataModelTemplate_GridPreview.prototype.getModelInstance = function() {
207
209
  if (apiType === 'grid') return gridApi;
208
210
  else if (apiType === 'form') return formApi;
209
211
  }
210
- }
211
- }
212
+ };
213
+ };
212
214
 
213
215
  return model;
214
- }
216
+ };
215
217
 
216
218
  /**
217
219
  * Return the raw model JavaScript.
@@ -220,7 +222,7 @@ DataModelTemplate_GridPreview.prototype.getModelInstance = function() {
220
222
  */
221
223
  DataModelTemplate_GridPreview.prototype.getModelJs = function() {
222
224
  return this._rawOriginalJs;
223
- }
225
+ };
224
226
 
225
227
  /**
226
228
  * Get a unique ID for the model instance
@@ -231,7 +233,7 @@ DataModelTemplate_GridPreview.getNextInstanceId = function(componentTemplate) {
231
233
  if (DataModelTemplate_GridPreview._id == undefined) DataModelTemplate_GridPreview._id = 0;
232
234
  var id = DataModelTemplate_GridPreview._id++;
233
235
  return 'DataModel_GridPreview_' + componentTemplate.getClassName() + '_' + id;
234
- }
236
+ };
235
237
 
236
238
  /**
237
239
  * Get the EJS string used to render the row item preview
@@ -240,7 +242,7 @@ DataModelTemplate_GridPreview.getNextInstanceId = function(componentTemplate) {
240
242
  */
241
243
  DataModelTemplate_GridPreview.prototype.getRowTemplate = function() {
242
244
  return this._rowTemplate || '';
243
- }
245
+ };
244
246
 
245
247
  /**
246
248
  * Create a pristine copy of the data.
@@ -260,7 +262,7 @@ DataModelTemplate_GridPreview.prototype.getRowTemplate = function() {
260
262
  DataModelTemplate_GridPreview.prototype.makePristineCopy = function(dataInstance, removeAutoAddedFields) {
261
263
  var fields = removeAutoAddedFields ? _.filter(this._modelTemplate.fields, function(field) { return !field.isAutoAddedField; }) : this._modelTemplate.fields;
262
264
  return FieldModel.makePristineCopy(dataInstance, fields);
263
- }
265
+ };
264
266
 
265
267
  /**
266
268
  * Iterates through the fieldModels
@@ -288,7 +290,7 @@ DataModelTemplate_GridPreview.prototype.makePristineCopy = function(dataInstance
288
290
  */
289
291
  DataModelTemplate_GridPreview.prototype.populateDataInstance = function(dataInstance) {
290
292
  return FieldModel.populateDataInstance(dataInstance, this._modelTemplate.fields || []);
291
- }
293
+ };
292
294
 
293
295
 
294
296
  exports = module.exports = DataModelTemplate_GridPreview;
@@ -18,7 +18,6 @@ along with this package. If not, see <http://www.gnu.org/licenses/>.
18
18
  */
19
19
 
20
20
  var _ = require('lodash');
21
- var Cloner = require('../utils/cloner');
22
21
  var Convert = require('../utils/convert');
23
22
 
24
23
  /**
@@ -54,7 +53,7 @@ FieldModel.convertTypes = function(dataInstance, fields) {
54
53
  tinyint: true,
55
54
  decimal: true,
56
55
  float: true
57
- }
56
+ };
58
57
 
59
58
  dataInstance = dataInstance || {};
60
59
  _.forEach(fields || [], function(field) {
@@ -67,7 +66,7 @@ FieldModel.convertTypes = function(dataInstance, fields) {
67
66
  dataInstance[fieldName] = Convert.toNumber(dataInstance[fieldName]);
68
67
  }
69
68
  });
70
- }
69
+ };
71
70
 
72
71
  /**
73
72
  * Create a pristine copy of the data.
@@ -98,7 +97,7 @@ FieldModel.makePristineCopy = function(dataInstance, fields) {
98
97
 
99
98
  FieldModel.convertTypes(pristineCopy);
100
99
  return pristineCopy;
101
- }
100
+ };
102
101
 
103
102
  /**
104
103
  * Iterates through the fieldModels
@@ -172,6 +171,6 @@ FieldModel.populateDataInstance = function(dataInstance, fields) {
172
171
  FieldModel.convertTypes(dataInstance);
173
172
  // Must return in case original instance was null/undefined
174
173
  return dataInstance;
175
- }
174
+ };
176
175
 
177
176
  exports = module.exports = FieldModel;
@@ -63,8 +63,8 @@ PropertiesModelTemplate_Form.prototype.buildTemplate = function(componentTemplat
63
63
  var model = _.extend({}, modelConfig);
64
64
 
65
65
  if(modelConfig.fields && modelConfig.fields.length){
66
- modelConfig.fields.unshift({ control:'html', value:'<div class="jsharmony_cms">',captionclass:"hidden"});
67
- modelConfig.fields.push({ control:'html', value:'</div>',captionclass:"hidden"});
66
+ modelConfig.fields.unshift({ control:'html', value:'<div class="jsharmony_cms">',captionclass:'hidden'});
67
+ modelConfig.fields.push({ control:'html', value:'</div>',captionclass:'hidden'});
68
68
  }
69
69
 
70
70
  this._modelTemplate = model;
@@ -74,7 +74,7 @@ PropertiesModelTemplate_Form.prototype.buildTemplate = function(componentTemplat
74
74
  model.onecolumn = true;
75
75
  if(model.js && _.isString(model.js) && model.js.trim()) model.js = '(function(){ var cms = '+this._cms._instance+';' + model.js + ' })();';
76
76
  this._jsh.XPage.ParseModelDefinition(model, null, null, { ignoreErrors: true });
77
- }
77
+ };
78
78
 
79
79
  /**
80
80
  * @public
@@ -84,7 +84,7 @@ PropertiesModelTemplate_Form.prototype.getModelInstance = function() {
84
84
  model.id = PropertiesModelTemplate_Form.getNextInstanceId(this._componentTemplate);
85
85
 
86
86
  return model;
87
- }
87
+ };
88
88
 
89
89
  /**
90
90
  * Get a unique ID for the model instance
@@ -95,7 +95,7 @@ PropertiesModelTemplate_Form.getNextInstanceId = function(componentTemplate) {
95
95
  if (PropertiesModelTemplate_Form._id == undefined) PropertiesModelTemplate_Form._id = 0;
96
96
  var id = PropertiesModelTemplate_Form._id++;
97
97
  return 'PropertiesModel_Form_' + componentTemplate.getClassName() + '_' + id;
98
- }
98
+ };
99
99
 
100
100
  /**
101
101
  * Create a pristine copy of the data.
@@ -113,7 +113,7 @@ PropertiesModelTemplate_Form.getNextInstanceId = function(componentTemplate) {
113
113
  */
114
114
  PropertiesModelTemplate_Form.prototype.makePristineCopy = function(dataInstance) {
115
115
  return FieldModel.makePristineCopy(dataInstance, this._modelTemplate.fields);
116
- }
116
+ };
117
117
 
118
118
  /**
119
119
  * Iterates through the fieldModels
@@ -141,6 +141,6 @@ PropertiesModelTemplate_Form.prototype.makePristineCopy = function(dataInstance)
141
141
  */
142
142
  PropertiesModelTemplate_Form.prototype.populateDataInstance = function(dataInstance) {
143
143
  return FieldModel.populateDataInstance(dataInstance, this._modelTemplate.fields || []);
144
- }
144
+ };
145
145
 
146
146
  exports = module.exports = PropertiesModelTemplate_Form;