Guest User

Untitled

a guest
Oct 16th, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.53 KB | None | 0 0
  1. Ext.namespace('Ext.wba.product');
  2.  
  3. Ext.onReady(function(){
  4.  
  5. Ext.QuickTips.init();
  6.  
  7. });
  8.  
  9. Ext.wba.ProductListConfigPanel = function(config){
  10. Ext.wba.ProductListConfigPanel.superclass.constructor.call(this, config);
  11. };
  12.  
  13. Ext.extend(Ext.wba.ProductListConfigPanel, Ext.wba.GenericConfigPanel,{
  14. tabs: true,
  15. getFields : function(properties) {
  16. var widget1 = Ext.wba.widgetManager.getGenericType("string");
  17. var config1 = {
  18. name: "headerText",
  19. title: "Text Heading",
  20. wba: this.wbaInterface,
  21. required: false
  22. };
  23.  
  24. var widget2 = Ext.wba.widgetManager.getGenericType("image");
  25. var config2 = {
  26. name: "headerImage",
  27. title: "Image Heading",
  28. wba: this.wbaInterface,
  29. required: false
  30. };
  31.  
  32. var widget3 = Ext.wba.widgetManager.getGenericType("santanaLink");
  33. var config3 = {
  34. name: "headerLink",
  35. title: "Link Heading",
  36. wba: this.wbaInterface,
  37. required: false
  38. };
  39.  
  40. var widget4 = Ext.wba.widgetManager.getGenericType("string");
  41. var config4 = {
  42. name: "subheaderText",
  43. title: "Subheading",
  44. wba: this.wbaInterface,
  45. required: false
  46. };
  47.  
  48.  
  49. var widget5 = Ext.wba.widgetManager.getGenericType("asin");
  50. var config5 = {
  51. name: "ASIN",
  52. title: "ASIN",
  53. wba: this.wbaInterface,
  54. required: false
  55. };
  56.  
  57.  
  58. var widget6 = Ext.wba.widgetManager.getGenericType("integer");
  59. var config6 = {
  60. name: "numResultsToShow",
  61. title: "Number of Products",
  62. wba: this.wbaInterface,
  63. required: true,
  64. width: 40
  65. };
  66.  
  67. var widget7 = Ext.wba.widgetManager.getGenericType("boolean");
  68. var config7 = {
  69. name: "isCarousel",
  70. title: "Display as a Carousel",
  71. wba: this.wbaInterface,
  72. required: false,
  73.  
  74. handler: function(checkBox, checked) {
  75. var maxTotalResultField = Ext.getCmp('maxTotalResults');
  76. if(checked) {
  77. maxTotalResultField.enable();
  78. }
  79. else {
  80. maxTotalResultField.setValue('');
  81. maxTotalResultField.disable();
  82. maxTotalResultField.removeClass('x-form-invalid');
  83. }
  84. }
  85. };
  86.  
  87. var widget8 = Ext.wba.widgetManager.getGenericType("integer");
  88. var config8 = {
  89. name: "maxTotalResults",
  90. id: "maxTotalResults",
  91. title: "Number of Products to include in carousel",
  92. wba: this.wbaInterface,
  93. width: 40,
  94. required: true,
  95. disabled: true
  96. };
  97.  
  98.  
  99. var widget9 = Ext.wba.widgetManager.getGenericType("integer");
  100. var config9 = {
  101. name: "thumbImageSize",
  102. title: "Image Width",
  103. wba: this.wbaInterface,
  104. required: false,
  105. defaultValue: 120,
  106. width: 40
  107. };
  108.  
  109. var widget10 = Ext.wba.widgetManager.getGenericType("boolean");
  110. var config10 = {
  111. name: "showProductTitle",
  112. title: "Display Product Title",
  113. wba: this.wbaInterface,
  114. required: false
  115. };
  116.  
  117. var widget11= Ext.wba.widgetManager.getGenericType("boolean");
  118. var config11 = {
  119. name: "showProductDetails",
  120. title: "Display Product Details",
  121. wba: this.wbaInterface,
  122. required: false
  123. };
  124.  
  125. var widget12 = Ext.wba.widgetManager.getGenericType("boolean");
  126. var config12 = {
  127. name: "hideOOSAsins",
  128. title: "Supress Unavailable Products",
  129. wba: this.wbaInterface,
  130. required: false
  131. };
  132.  
  133. var widget13 = Ext.wba.widgetManager.getGenericType("boolean");
  134. var config13 = {
  135. name: "performAsinDeDuping",
  136. title: "Supress Duplicate Products",
  137. wba: this.wbaInterface,
  138. required: false
  139. };
  140.  
  141. var widget14 = Ext.wba.widgetManager.getGenericType("boolean");
  142. var config14 = {
  143. name: "displayQuickView",
  144. title: "Enable Quick View",
  145. wba: this.wbaInterface,
  146. checked: true,
  147. required: false
  148. };
  149.  
  150. var widgets = [];
  151. widgets.push(new widget1(config1));
  152. widgets.push(new widget2(config2));
  153. widgets.push(new widget3(config3));
  154. widgets.push(new widget4(config4));
  155. widgets.push(new widget5(config5));
  156. widgets.push(new widget6(config6));
  157. widgets.push(new widget7(config7));
  158. widgets.push(new widget8(config8));
  159. widgets.push(new widget9(config9));
  160. widgets.push(new widget10(config10));
  161. widgets.push(new widget11(config11));
  162. widgets.push(new widget12(config12));
  163. widgets.push(new widget13(config13));
  164. widgets.push(new widget14(config14));
  165.  
  166. var tab1Items = [];
  167. var tab2Items = [];
  168.  
  169. var TextheadingComplex = Ext.wba.FormColumnWidget(widgets.slice(0, 1), 1, false, {
  170. title: 'Text Heading',
  171. complex: true,
  172. type: 'TextheadingComplexType'
  173. });
  174.  
  175. var SubheadingComplex = Ext.wba.FormColumnWidget(widgets.slice(3, 4), 1, false, {
  176. title: 'Subheading',
  177. complex: true,
  178. type: 'SubheadingComplexType'
  179. });
  180.  
  181. tab1Items.push(TextheadingComplex);
  182. tab1Items = tab1Items.concat(widgets.slice(1, 3));
  183. tab1Items.push(SubheadingComplex);
  184.  
  185. var productASINComplex = Ext.wba.FormColumnWidget(widgets.slice(4, 5), 1, false, {
  186. complex: true,
  187. type: 'TextheadingComplexType2'
  188. });
  189.  
  190. var rightColumnItems = widgets.slice(5, 6);
  191.  
  192. var carouselGroup = Ext.wba.FormGroupWidget(widgets.slice(6, 8),"Carousel",1,{labelWidth: 220,labelSeparator:' ',complex:true});
  193. var productInfoGroup = Ext.wba.FormGroupWidget(widgets.slice(9, 11),"Product Information",1,{labelWidth: 116,labelSeparator:Ext.wba.RequiredIcon+' ',complex:true});
  194. var productSuppressionGroup = Ext.wba.FormGroupWidget(widgets.slice(11, 13),"Suppression",1,{labelWidth: 116,labelSeparator:Ext.wba.RequiredIcon+' ',complex:true});
  195. var quickViewGroup = Ext.wba.FormGroupWidget(widgets.slice(13, 14),"Quick View",1,{labelWidth: 116,labelSeparator:Ext.wba.RequiredIcon+' ',complex:true});
  196. rightColumnItems.push(carouselGroup);
  197. rightColumnItems = rightColumnItems.concat(widgets.slice(8,9));
  198. rightColumnItems.push(productInfoGroup);
  199. rightColumnItems.push(productSuppressionGroup);
  200. rightColumnItems.push(quickViewGroup);
  201.  
  202. var productRightColumnComplex = Ext.wba.FormColumnWidget(rightColumnItems, 1, false, {
  203. title: 'Display Options',
  204. complex: true,
  205. type: 'TextheadingComplexType3'
  206. });
  207.  
  208. tab2Items.push(productRightColumnComplex);
  209.  
  210. return {
  211. items: [
  212. {title:'Headings',items:tab1Items},
  213. {title:'Products',items:tab2Items}
  214. ],
  215.  
  216. widgets: widgets
  217. };
  218. }
  219. });
  220.  
  221. Ext.wba.pageletPanel.load(Ext.wba.ProductListConfigPanel);
Add Comment
Please, Sign In to add comment