CubeViewPropertiesPane.js 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281
  1. /*
  2. *+------------------------------------------------------------------------+
  3. *| Licensed Materials - Property of IBM
  4. *|
  5. *| BI and PM: BUX
  6. *|
  7. *| (C) Copyright IBM Corp. 2009
  8. *|
  9. *| US Government Users Restricted Rights - Use, duplication or
  10. *| disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  11. *|
  12. *+------------------------------------------------------------------------+
  13. */
  14. dojo.provide("CubeViewPropertiesPane");
  15. dojo.require("dojo.string");
  16. dojo.require("bux.i18n");
  17. dojo.require("bux.Helper");
  18. dojo.require("bux.iwidget.filter.Filter");
  19. dojo.require("bux.dialogs.WidgetPropertiesFromJSON");
  20. dojo.require("bux.layout.TableContainer");
  21. dojo.require("dijit.form.TextBox");
  22. dojo.require("dijit.form.CheckBox");
  23. dojo.declare("CubeViewPropertiesPane",
  24. [bux.dialogs.WidgetPropertiesFromJSON],
  25. {
  26. sourceWidget: null,
  27. labelInput: null,
  28. tabTitle: "Cube View",
  29. webLabelInput:null,
  30. cubeLabelInput: null,
  31. cubeViewLabelInput: null,
  32. accessLabelInput:null,
  33. serverLabelInput: null,
  34. userNameLabelInput: null,
  35. passwordLabelInput: null,
  36. cancelPropertiesCallback: null,
  37. getReadStore: function (url){
  38. //return null;
  39. return new dojo.data.ItemFileReadStore(
  40. {
  41. url : this.sourceWidget.iContext.io.rewriteURI(url)
  42. });
  43. },
  44. refreshCubes: function() {
  45. var _propDialog = this;
  46. if (this.cubeViewLabelInput != null) {
  47. this.cubeViewLabelInput.destroy();
  48. }
  49. this.cubeViewLabelInput = new dijit.form.FilteringSelect({
  50. labelAttr: "name",
  51. valueAttr: "name",
  52. searchAttr: "name",
  53. value: "" ,
  54. store: this.getReadStore(
  55. "../sms/Tm1/cubes/" + _propDialog.properties.label.value + "/" + _propDialog.properties.serverLabel.value),
  56. onChange : function (value) {
  57. _propDialog.properties.cubeViewLabel.value = this.attr('value');
  58. }}, document.createElement('div'));
  59. dojo.place(this.cubeViewLabelInput.domNode, this.id + "_cubeViewLabelInput");
  60. },
  61. refreshServers: function() {
  62. var _propDialog = this;
  63. if (this.serverLabelInput != null) {
  64. this.serverLabelInput.destroy();
  65. }
  66. this.serverLabelInput =new dijit.form.FilteringSelect({
  67. labelAttr: "name",
  68. valueAttr: "name",
  69. searchAttr: "name",
  70. value: "",
  71. store: this.getReadStore("../sms/Tm1/servers/" + _propDialog.properties.label.value),
  72. onChange : function (value) {
  73. _propDialog.properties.serverLabel.value = this.attr('value');
  74. _propDialog.refreshCubes();
  75. }
  76. }, document.createElement('div'));
  77. dojo.place(this.serverLabelInput.domNode, this.id + "_serverLabelInput");
  78. },
  79. generateWidgetPropertiesUI: function()
  80. {
  81. var _propDialog = this;
  82. this.labelInput = new dijit.form.TextBox({
  83. value: _propDialog.properties.label
  84. });
  85. this.webLabelInput = new dijit.form.TextBox({
  86. value: _propDialog.properties.webLabel
  87. });
  88. this.serverLabelInput =new dijit.form.TextBox({
  89. labelAttr: "name",
  90. valueAttr: "name",
  91. searchAttr: "name",
  92. value: _propDialog.properties.serverLabel
  93. }, document.createElement('div'));
  94. this.cubeLabelInput = new dijit.form.TextBox({
  95. labelAttr: "name",
  96. valueAttr: "name",
  97. searchAttr: "name",
  98. value: _propDialog.properties.cubeLabel
  99. }, document.createElement('div'));
  100. this.cubeViewLabelInput = new dijit.form.TextBox({
  101. labelAttr: "name",
  102. valueAttr: "name",
  103. searchAttr: "name",
  104. value: _propDialog.properties.cubeViewLabel
  105. }, document.createElement('div'));
  106. this.accessLabelInput = new dijit.form.TextBox({
  107. labelAttr: "name",
  108. valueAttr: "name",
  109. searchAttr: "name",
  110. value: _propDialog.properties.accessLabel
  111. }, document.createElement('div'));
  112. this.userNameLabelInput = new dijit.form.TextBox({
  113. labelAttr: "name",
  114. valueAttr: "name",
  115. searchAttr: "name",
  116. value: _propDialog.properties.userNameLabel
  117. }, document.createElement('div'));
  118. this.passwordLabelInput = new dijit.form.TextBox({
  119. labelAttr: "name",
  120. valueAttr: "name",
  121. searchAttr: "name",
  122. value: _propDialog.properties.passwordLabel
  123. }, document.createElement('div'));
  124. var configHTML;
  125. if (this.firstLine) {
  126. configHTML =
  127. '<div id="{$ID}_configDescription" class="bux-widgetPropertiesDialog-ItemSpacing bux-dialog-info">' + this.firstLine + '</div>' +
  128. '<br/>' +
  129. '<div id="{$ID}_setLabel">' +
  130. '<div><label for="' + this.webLabelInput.id + '" class="bux-dialog-label">' + ' TM1Web Url: ' + '</label></div>' +
  131. '<div><span id="{$ID}_webLabelInput"></span></div>' +
  132. '</div>' +
  133. '<br/>' +
  134. '<div id="{$ID}_setLabel">' +
  135. '<div><label for="' + this.labelInput.id + '" class="bux-dialog-label">' + ' TM1 Host: ' + '</label></div>' +
  136. '<div><span id="{$ID}_labelInput"></span></div>' +
  137. '</div>' +
  138. '<br/>' +
  139. '<div id="{$ID}_setServerLabel">' +
  140. '<div><label for="' + this.serverLabelInput.id + '" class="bux-dialog-label">' + ' Server: ' + '</label></div>' +
  141. '<div><span id="{$ID}_serverLabelInput"></span></div>' +
  142. '</div>' +
  143. '<br/>' +
  144. '<div id="{$ID}_setCubeLabel">' +
  145. '<div><label for="' + this.cubeLabelInput.id + '" class="bux-dialog-label">' + ' Cube: ' + '</label></div>' +
  146. '<div><span id="{$ID}_cubeLabelInput"></span></div>' +
  147. '</div>' +
  148. '<br/>' +
  149. '<div id="{$ID}_setCubeViewLabel">' +
  150. '<div><label for="' + this.cubeViewLabelInput.id + '" class="bux-dialog-label">' + ' CubeView: ' + '</label></div>' +
  151. '<div><span id="{$ID}_cubeViewLabelInput"></span></div>' +
  152. '</div>' +
  153. '<br/>' +
  154. '<div id="{$ID}_setAccessLabel">' +
  155. '<div><label for="' + this.accessLabelInput.id + '" class="bux-dialog-label">' + ' AccessType: ' + '</label></div>' +
  156. '<div><span id="{$ID}_accessLabelInput"></span></div>' +
  157. '</div>' +
  158. '<br/>' +
  159. '<div id="{$ID}_setUserNameLabel">' +
  160. '<div><label for="' + this.userNameLabelInput.id + '" class="bux-dialog-label">' + ' UserName: ' + '</label></div>' +
  161. '<div><span id="{$ID}_userNameLabelInput"></span></div>' +
  162. '</div>' +
  163. '<br/>' +
  164. '<div id="{$ID}_setPasswordLabel">' +
  165. '<div><label for="' + this.passwordLabelInput.id + '" class="bux-dialog-label">' + ' Password: ' + '</label></div>' +
  166. '<div><span id="{$ID}_passwordLabelInput"></span></div>' +
  167. '</div>';
  168. } else {
  169. configHTML =
  170. '<div id="{$ID}_configDescription" class="bux-widgetPropertiesDialog-ItemSpacing bux-dialog-info">' + ' Specify the cubeView Information ' + '</div>' +
  171. '<br/>' +
  172. '<div id="{$ID}_setLabel">' +
  173. '<div><label for="' + this.labelInput.id + '" class="bux-dialog-label">' + ' TM1 Host: ' + '</label></div>' +
  174. '<div><span id="{$ID}_labelInput"></span></div>' +
  175. '</div>' +
  176. '<br/>' +
  177. '<div id="{$ID}_setServerLabel">' +
  178. '<div><label for="' + this.serverLabelInput.id + '" class="bux-dialog-label">' + ' Server: ' + '</label></div>' +
  179. '<div><span id="{$ID}_serverLabelInput"></span></div>' +
  180. '</div>' +
  181. '<br/>' +
  182. '<div id="{$ID}_setCubeLabel">' +
  183. '<div><label for="' + this.cubeLabelInput.id + '" class="bux-dialog-label">' + ' Cube: ' + '</label></div>' +
  184. '<div><span id="{$ID}_cubeLabelInput"></span></div>' +
  185. '</div>' +
  186. '<br/>' +
  187. '<div id="{$ID}_setCubeViewLabel">' +
  188. '<div><label for="' + this.cubeViewLabelInput.id + '" class="bux-dialog-label">' + ' CubeView: ' + '</label></div>' +
  189. '<div><span id="{$ID}_cubeViewLabelInput"></span></div>' +
  190. '</div>' +
  191. '<br/>' +
  192. '<div id="{$ID}_setUserNameLabel">' +
  193. '<div><label for="' + this.userNameLabelInput.id + '" class="bux-dialog-label">' + ' UserName: ' + '</label></div>' +
  194. '<div><span id="{$ID}_userNameLabelInput"></span></div>' +
  195. '</div>' +
  196. '<br/>' +
  197. '<div id="{$ID}_setPasswordLabel">' +
  198. '<div><label for="' + this.passwordLabelInput.id + '" class="bux-dialog-label">' + ' Password: ' + '</label></div>' +
  199. '<div><span id="{$ID}_passwordLabelInput"></span></div>' +
  200. '</div>';
  201. }
  202. this.domNode.innerHTML = configHTML.replace(/\{\$ID\}/g, this.id);
  203. if (this.firstLine) {
  204. dojo.place(this.webLabelInput.domNode, this.id + "_webLabelInput");
  205. dojo.place(this.accessLabelInput.domNode, this.id + "_accessLabelInput");
  206. }
  207. dojo.place(this.labelInput.domNode, this.id + "_labelInput");
  208. dojo.place(this.serverLabelInput.domNode, this.id + "_serverLabelInput");
  209. dojo.place(this.cubeLabelInput.domNode, this.id + "_cubeLabelInput");
  210. dojo.place(this.cubeViewLabelInput.domNode, this.id + "_cubeViewLabelInput");
  211. dojo.place(this.userNameLabelInput.domNode, this.id + "_userNameLabelInput");
  212. dojo.place(this.passwordLabelInput.domNode, this.id + "_passwordLabelInput");
  213. },
  214. onOk: function()
  215. {
  216. if (this.okPropertiesCallback) {
  217. this.okPropertiesCallback();
  218. return;
  219. }
  220. this.inherited(arguments);
  221. },
  222. onCancel: function()
  223. {
  224. if (this.cancelPropertiesCallback) {
  225. this.cancelPropertiesCallback();
  226. return;
  227. }
  228. this.inherited(arguments);
  229. },
  230. sizeToFitContents: function(){
  231. if (dojo.isIE || dojo.isTrident) {
  232. //This needs to be revisited at some point, however because of the
  233. //manner in which this dialog is populated, IE cannot properly size this tab.
  234. dojo.contentBox(this.domNode, {
  235. w: 440,
  236. h: 472
  237. });
  238. } else {
  239. this.inherited(arguments);
  240. }
  241. },
  242. destroy: function () {
  243. this.inherited(arguments);
  244. if (this.cubeViewLabelInput != null) {
  245. this.cubeViewLabelInput.destroy();
  246. }
  247. },
  248. validate: function (){
  249. var _bValid = true;
  250. if (!_bValid){
  251. this.disableOK(true);
  252. }else{
  253. this.disableOK(false);
  254. }
  255. return _bValid;
  256. }
  257. }
  258. );