LogOnDialog.js 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. /*
  2. *+------------------------------------------------------------------------+
  3. *| Licensed Materials - Property of IBM
  4. *| IBM Cognos Products: Viewer
  5. *| (C) Copyright IBM Corp. 2001, 2011
  6. *|
  7. *| US Government Users Restricted Rights - Use, duplication or
  8. *| disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  9. *|
  10. *+------------------------------------------------------------------------+
  11. */
  12. function LogOnDialog(oCV){
  13. if (oCV) {
  14. this.m_oCV = oCV;
  15. }
  16. }
  17. LogOnDialog.prototype = new ILogOnDialog();
  18. LogOnDialog.prototype.getViewer = function() {
  19. return this.m_oCV;
  20. };
  21. LogOnDialog.prototype.handleUnknownHTMLResponse = function(responseText) {
  22. this.show(null);
  23. };
  24. LogOnDialog.prototype.show = function(soapFault) {
  25. var promptInfoNamespace = this.getPromptInfoNamespacesFromAuthenticationFault(soapFault);
  26. if (window["CVEditContentActionInstance"]) {
  27. window["CVEditContentActionInstance"].transitionFromBUA();
  28. }
  29. IWidgetLogonhandler.handleLogon(this.getViewer().getId(), promptInfoNamespace);
  30. };
  31. LogOnDialog.prototype.getPromptInfoNamespacesFromAuthenticationFault = function(soapFaultDocument) {
  32. if (!soapFaultDocument) {
  33. return null;
  34. }
  35. var camElement = XMLHelper_FindChildByTagName(soapFaultDocument, "CAM", true);
  36. if (camElement == null) { return null; }
  37. var promptInfo = XMLHelper_FindChildByTagName(camElement, "promptInfo", true);
  38. if (promptInfo == null) { return null; }
  39. var displayObjects = XMLHelper_FindChildByTagName(camElement, "displayObjects", true);
  40. if (displayObjects == null) { return null; }
  41. var items = XMLHelper_FindChildrenByTagName(displayObjects, "item", true);
  42. if (items == null || items.length != 1) { return null; }
  43. var itemNode = items[0];
  44. if (itemNode == null) { return null; }
  45. var nameNode = XMLHelper_FindChildByTagName(itemNode, "name", true);
  46. var name = XMLHelper_GetText(nameNode, false);
  47. if (name === 'CAMNamespace') {
  48. var valueNode = XMLHelper_FindChildByTagName(itemNode, "value", true);
  49. var value = XMLHelper_GetText(valueNode, false);
  50. if (value!=null) {
  51. return value;
  52. }
  53. }
  54. return null;
  55. };