MessageDialog.js 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. /*******************************************************************************
  2. * IBM Confidential
  3. *
  4. * OCO Source Materials
  5. *
  6. * A and PM: PD
  7. *
  8. * (c) Copyright IBM Corp. 2014, 2015
  9. *
  10. * The source code for this program is not published or otherwise divested of
  11. * its trade secrets, irrespective of what has been deposited with the U.S.
  12. * Copyright Office.
  13. ******************************************************************************/
  14. define([
  15. "dojo/_base/declare",
  16. "bux/dialogs/InformationDialog",
  17. "dojo/dom-style",
  18. "dojo/dom-class"
  19. ],function(declare, InformationDialog, domStyle, domClass){
  20. var MessageDialog = declare("pd/widgets/MessageDialog", [InformationDialog], {
  21. title: PDMSG.IPT.IDS_IPT_APPLICATION_TITLE,
  22. style: "width: auto",
  23. postMixInProperties: function() {
  24. //pd.convertToInnerHtml is to work around a HTML encode used in BUX InformationNotice.js
  25. //which basically will make any XML escaped content (e.g. non-Latin-1 characters in
  26. //ERROR_DESC tag in the error page returned by CPS engine) double encoded.
  27. this.sMainMessage = pd.convertToInnerHtml(this.sMainMessage);
  28. this.sDescription = pd.convertToInnerHtml(this.sDescription);
  29. this.inherited(arguments);
  30. },
  31. _size: function() {
  32. this.inherited(arguments);
  33. var oDialogContentContainer = dojo.marginBox(this.dialogContentContainer);
  34. domStyle.set(this.dialogContentContainer,{
  35. width: oDialogContentContainer.w + "px",
  36. overflow: "auto",
  37. position: "relative"
  38. });
  39. },
  40. startup: function() {
  41. this.inherited(arguments);
  42. if (this._titlePane) {
  43. domClass.add(this._titlePane.containerNode, "pdDialogPaneContent");
  44. }
  45. }
  46. });
  47. MessageDialog.Alert = function (_sMainMessage, _sDescription, _okHandler, sInfoIconClass) {
  48. var AlertDialog = new MessageDialog({
  49. sInfoIconClass: (sInfoIconClass || 'bux-informationDialog-warning-icon'),
  50. sMainMessage: _sMainMessage,
  51. sDescription: _sDescription,
  52. yesOKHandler : _okHandler
  53. });
  54. return AlertDialog;
  55. };
  56. MessageDialog.Confirm = function (_title,_sMainMessage, _sDescription, _yesHandler, sInfoIconClass) {
  57. var ConfirmDialog = new MessageDialog({
  58. title: _title,
  59. sInfoIconClass: (sInfoIconClass || 'bux-informationDialog-warning-icon'),
  60. sMainMessage: _sMainMessage,
  61. sDescription: _sDescription,
  62. buttons : ['YES','NO'],
  63. yesOKHandler : _yesHandler
  64. });
  65. return ConfirmDialog;
  66. };
  67. MessageDialog.Error = function (_sMainMessage, _sDescription, _sDetail, _okHandler) {
  68. var ErrorDialog = new MessageDialog({
  69. sInfoIconClass: 'bux-informationDialog-error-icon',
  70. sMainMessage: _sMainMessage,
  71. sDescription: _sDescription,
  72. sDetail : _sDetail,
  73. bDetailIsHtml: true,
  74. _bContainerHeightAuto: true,
  75. yesOKHandler : _okHandler
  76. });
  77. return ErrorDialog;
  78. };
  79. MessageDialog.Info = function (_sMainMessage, _sDescription, _okHandler) {
  80. var InfoDialog = new MessageDialog({
  81. sInfoIconClass: 'bux-informationDialog-info-icon',
  82. sMainMessage: _sMainMessage,
  83. sDescription: _sDescription,
  84. yesOKHandler : _okHandler
  85. });
  86. return InfoDialog;
  87. };
  88. MessageDialog.Warning = function (_sMainMessage, _sDescription, _sDetail, _okHandler) {
  89. var InfoDialog = MessageDialog.WarningWithDetails(_sMainMessage, _sDescription, _sDetail, _okHandler);
  90. return InfoDialog;
  91. };
  92. MessageDialog.WarningWithDetails = function (_sMainMessage, _sDescription, _sDetail, _okHandler) {
  93. var InfoDialog = new MessageDialog({
  94. sInfoIconClass: 'bux-informationDialog-warning-icon',
  95. sMainMessage: _sMainMessage,
  96. sDescription: _sDescription,
  97. sDetail : _sDetail,
  98. yesOKHandler : _okHandler,
  99. _bContainerHeightAuto: true,
  100. bDetailIsHtml:true
  101. });
  102. return InfoDialog;
  103. };
  104. MessageDialog.Working = function (_sMainMessage) {
  105. var WorkingDialog = new MessageDialog({
  106. sInfoIconClass: 'bux-informationDialog-working-icon',
  107. sMainMessage: _sMainMessage,
  108. buttons: ['CLOSE'],
  109. baseClass: "icdDialogNoChrome bux-WorkingDialog",
  110. autofocus: false,
  111. duration: 0.000001, //Can't be 0, or there will be a divide by 0 exception within the dojo transition.
  112. _onShow: function(){
  113. dojo.style(this.domNode, "opacity", 1);
  114. }
  115. });
  116. return WorkingDialog;
  117. };
  118. return MessageDialog;
  119. });