123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419 |
- var traceDumpWin = null;
- var gRecordDumpWin = null;
- var gPushCmdWin = null;
- var gQSDebug = true;
- function trace(msg, useTraceDumpWin)
- {
- var winToDumpTo;
- if (typeof useTraceDumpWin != "undefined" && useTraceDumpWin === true)
- {
- if (!traceDumpWin || (traceDumpWin && traceDumpWin.closed))
- {
- traceDumpWin = window.open(goApplicationManager.getReportFrame().oCVQS.getWebContentRoot() + "/common/blank.html", "_trace_window_");
- }
- winToDumpTo = traceDumpWin;
- }
- else
- {
- winToDumpTo = window.open("", "_trace_window_");
- }
- winToDumpTo.document.writeln("<hr/><b>");
- var d = new Date();
- winToDumpTo.document.writeln(d.getHours() + ":" + d.getMinutes() + ":" + d.getSeconds() + ":" + d.getMilliseconds());
- winToDumpTo.document.writeln("</b><br/><pre>" + msg + "</pre>");
- };
- function traceObject(obj)
- {
- if (!traceDumpWin || (traceDumpWin && traceDumpWin.closed))
- {
- traceDumpWin = window.open(goApplicationManager.getReportFrame().oCVQS.getWebContentRoot() + "/common/blank.html", "_trace_window_");
- }
- traceDumpWin.document.open();
- traceDumpWin.document.writeln("<p>Output of an object. ["+(new Date())+"]</p>");
- traceDumpWin.document.writeln(traceObjectHtml(obj));
- traceDumpWin.document.close();
- };
- function traceObjectHtml(obj)
- {
- var str = "<table border=\"1\" cellspacing=\"0\" cellpadding=\"0\"><th>name</th><th>value(s)</th>";
- var p = new Array();
- var i;
- for (i in obj)
- {
- p.push(i);
- }
- p.sort();
- for (i = 0; i < p.length; i++)
- {
- var pre = "<tr><td>" + p[i] + "</td><td>";
- var mid = obj[p[i]];
- var post = "</td></tr>";
- if (typeof mid == "object")
- {
- mid = traceObjectHtml(mid);
- }
- str += pre + mid + post;
- }
- return str + "</table>";
- };
- function showConfigValues(showCalcFuns)
- {
- if (!traceDumpWin || (traceDumpWin && traceDumpWin.closed))
- {
- traceDumpWin = window.open(goApplicationManager.getReportFrame().oCVQS.getWebContentRoot() + "/common/blank.html", "_trace_window_");
- }
- var i;
- var HTMLout = "<html><head><title>Config values</title></head><body>";
- HTMLout += "<p>As of ["+(new Date())+"]</p><hr/>";
- HTMLout += retrieveConfigKeys(goApplicationManager, "Application Manager");
- HTMLout += retrieveConfigKeys(goApplicationManager.getReportManager(), "Report Manager");
- HTMLout += retrieveConfigKeys(goApplicationManager.getReportManager().getParameterManager(), "Parameter Manager");
- var aRegdFeatureList = goApplicationManager.getFeatureRegistry().getAllRegisteredFeatures();
- var aUnregdFeatureList = goApplicationManager.getFeatureRegistry().getAllUnregisteredFeatures();
- HTMLout += "<p style=\"color:red\">Feature Object Status</p>";
- HTMLout += "<table border=\"1\" cellspacing=\"0\" cellpadding=\"2\"><th>Feature Name</th><th>State</th>";
- var iRegdFeatureCount = 0;
- var iUnregdFeatureCount = 0;
- var p = new Array();
- for (i in aRegdFeatureList)
- {
- iRegdFeatureCount++;
- p.push(i);
- }
- p.sort();
- for (i = 0; i < p.length; i++)
- {
- HTMLout += "<tr><td>" + aRegdFeatureList[p[i]].m_sFeatureName + "</td><td>" + aRegdFeatureList[p[i]].m_sFeatureState + "</td></tr>";
- }
- p = new Array();
- for (i in aUnregdFeatureList)
- {
- iUnregdFeatureCount++;
- p.push(i);
- }
- p.sort();
- if (p.length > 0)
- {
- HTMLout += "<tr><td colspan='2'><hr/></td></tr>";
- }
- for (i = 0; i < p.length; i++)
- {
- if (aUnregdFeatureList instanceof Object)
- {
- HTMLout += "<tr><td>" + aUnregdFeatureList[p[i]].m_sFeatureName + "</td><td>" + aUnregdFeatureList[p[i]].m_sFeatureState + "</td></tr>";
- }
- }
- HTMLout += "</table>";
- HTMLout += "<font color='green'><b> Total Registered Features: " + iRegdFeatureCount + "</b></font><br/>";
- HTMLout += "<font color='red'><b> Total Unregistered Features: " + iUnregdFeatureCount + "</b></font><br/>";
- HTMLout += "<font color='black'><b> Total Features: " + (iRegdFeatureCount + iUnregdFeatureCount) + "</b></font><br/><br/><hr/>";
- HTMLout += "<p style=\"color:red\">Config values</p>";
- HTMLout += "<table border=\"1\" cellspacing=\"0\" cellpadding=\"2\" style=\"width:100%;\"><th>name</th><th align=\"left\" style=\"width:100%;\">value(s)</th>";
- p = new Array();
- for (i in cfgValues)
- {
- p.push(i);
- }
- p.sort();
- for (i = 0; i < p.length; i++)
- {
- if (!(p[i] == "CalcFns" || p[i] == "CalcFnsRestricted") || showCalcFuns)
- {
- HTMLout += "<tr><td style=\"color:blue\">"+p[i]+"</td>"+printValue(cfgValues[p[i]])+"</tr>";
- }
- }
- HTMLout += "</table></body></html>";
- traceDumpWin.document.open();
- traceDumpWin.document.write(HTMLout);
- traceDumpWin.document.close();
- };
- function retrieveConfigKeys(oManager, sLabel)
- {
- var HTMLout = "<p style=\"color:red\">" + sLabel + " Variables</p>";
- HTMLout += "<table border=\"1\" cellspacing=\"0\" cellpadding=\"2\" style=\"width:100%;\"><th>Type</th><th>Name</th><th align=\"left\" style=\"width:100%;\">Value(s)</th>";
- var oManagerKeys = oManager.keys();
- for (i = 0; i < oManagerKeys.length; i++)
- {
- HTMLout += "<tr><td>" + typeof oManager.get(oManagerKeys[i]) + "</td><td style=\"color:blue\">" + oManagerKeys[i] + "</td>" + printValue(oManager.get(oManagerKeys[i])) + "</tr>";
- }
- HTMLout += "</table><br/><hr/>";
- return HTMLout;
- };
- function showDialogValues()
- {
- var now = new Date();
- if (!traceDumpWin || (traceDumpWin && traceDumpWin.closed))
- {
- traceDumpWin = window.open(goApplicationManager.getReportFrame().oCVQS.getWebContentRoot() + "/common/blank.html", "_trace_window_");
- }
- var HTMLout = "<html><head><title>Dialog values</title></head><body><p>Dialog <font color='red'><b>local</b></font> values [" + now + "]</p>";
- HTMLout += "<table border=\"1\" cellspacing=\"0\" cellpadding=\"2\" style=\"width:100%;\"><th>name</th><th align=\"left\" style=\"width:100%;\">value(s)</th>";
- var i = "none";
- var p = new Array();
- for (i in dialogFormValues)
- {
- p.push(i);
- }
- p.sort();
- if (p.length > 0)
- {
- for (i = 0; i < p.length; i++)
- {
- HTMLout += "<tr><td style=\"color:blue\">"+p[i]+"</td>"+printValue(dialogFormValues[p[i]])+"</tr>";
- }
- }
- if (i == "none")
- {
- HTMLout += "<tr><td colspan='2'>None</td></tr>";
- }
- HTMLout += "</table>";
- HTMLout += "<p>Dialog <font color='blue'><b>global</b></font> values [" + now + "]</p>";
- HTMLout += "<table border=\"1\" cellspacing=\"0\" cellpadding=\"2\" style=\"width:100%;\"><th>name</th><th align=\"left\" style=\"width:100%;\">value(s)</th>";
- i = "none";
- for (i in dialogGlobalValues)
- {
- HTMLout += "<tr><td style=\"color:blue\">"+i+"</td>"+printValue(dialogGlobalValues[i])+"</tr>";
- }
- if (i == "none")
- {
- HTMLout += "<tr><td colspan='2'>None</td></tr>";
- }
- HTMLout += "</table>";
- var aFeatureStack = goApplicationManager.getFeatureManager().getFeatureLaunchStack();
- HTMLout += "<p>Feature Object <font color='green'><b>" + aFeatureStack[aFeatureStack.length - 1] + "</b></font> [" + now + "]</p>";
- HTMLout += "<table border=\"1\" cellspacing=\"0\" cellpadding=\"2\" style=\"width:100%;\"><th>Type</th><th>Name</th><th align=\"left\" style=\"width:100%;\">Value(s)</th>";
- i = "none";
- var oFeature = goApplicationManager.getFeatureManager().getAllFeatureDetailsInStack();
- if (oFeature.length > 0)
- {
- for (i = 0; i < oFeature.length; i++)
- {
- HTMLout += "<tr><td>" + oFeature[i][0] + "</td><td style=\"color:blue\">" + oFeature[i][1] + "</td>" + printValue(oFeature[i][2]) + "</tr>";
- }
- }
- if (i == "none")
- {
- HTMLout += "<tr><td colspan='3'>None</td></tr>";
- }
- HTMLout += "</table></body></html>";
- traceDumpWin.document.open();
- traceDumpWin.document.write(HTMLout);
- traceDumpWin.document.close();
- };
- function printValue(n)
- {
- if (n === null)
- {
- return "<td style='color:blue;width:100%;'>null</td>";
- }
- if (typeof n == "string" && n === "")
- {
- return "<td style='color:red;width:100%;'>[Empty String]</td>";
- }
- var i;
- var t;
- if (typeof n == "object")
- {
- if (n.length > 0)
- {
- t = "<td>";
- for (i in n)
- {
- if (typeof n[i] == "object")
- {
- if (t == "<td>")
- {
- t += "<table><tr><td style=\"color:red;\">";
- }
- else
- {
- t += "<table style='border-top:1px solid #999999;'><tr><td style=\"color:red;\">";
- }
- t += i + ".</td><td style='color:#999999'>[object]</td><td style='width:100%;'>\n<textarea readonly='true' style='color:black;border:none;width:100%;";
- if (document.all)
- {
- t += "overflow:hidden;";
- }
- else
- {
- t += "min-";
- }
- t += "height:100%;'>";
- if (n[i].nodeName)
- {
- t += "[dom element]: " + n[i].nodeName;
- }
- else if (typeof n[i].length == "number" && n[i].length > 0)
- {
- for(var j = 0; j < n[i].length; j++)
- {
- t += "[array element " + j + "]: " + n[i][j] + "\n";
- }
- }
- else
- {
- t += "[UNKNOWN TYPE]";
- }
- t += "\n</textarea></td>";
- }
- else
- {
- if (t == "<td>")
- {
- t += "<table><tr><td style=\"color:red;\">" + i + ". </td>";
- }
- else
- {
- t += "<table style='border-top:1px solid #999999;'><tr><td style=\"color:red;\">" + i + ". </td>";
- }
- if (typeof n[i] == "string" && n[i] === "")
- {
- t += "<td style=\"color:red;width:100%;\">[Empty String]</td>";
- }
- else
- {
- t += "<td style='width:100%;'>\n<textarea readonly='true' style='color:black;border:none;width:100%;";
- if (document.all)
- {
- t += "overflow:hidden;";
- }
- else
- {
- t += "min-";
- }
- t += "height:100%;'>" + n[i] + "\n</textarea>\n</td>";
- }
- }
- t += "</tr></table>";
- }
- t += "</td>";
- }
- else
- {
- t = "<td style='color:red;width:100%;'><table style='width:100%;height:100%;'><tr><td style='color:#999999'>[object]</td></tr><tr><td style='width:100%;height:100%;'>\n<textarea readonly='true' style='color:black;border:none;width:100%;overflow:auto;";
- if (!document.all)
- {
- t += "min-";
- }
- t += "height:150px;'>";
- for (i in n)
- {
- if (typeof i != "undefined" && typeof i != "unknown")
- {
- t += "[attribute]: " + i;
- }
- else
- {
- t += "[attribute UNKNOWN]";
- }
- if (typeof n[i] != "undefined" && typeof n[i] != "unknown")
- {
- t += "\n [value]: " + n[i] + "\n";
- }
- else
- {
- t += "\n [value UNKNOWN]\n";
- }
- }
- t += "\n</textarea>\n</td></tr></table></td>";
- }
- return t;
- }
- t = "<td style='color:red;width:100%;'>\n<textarea readonly='true' style='color:black;border:none;width:100%;";
- if (document.all)
- {
- t += "overflow:hidden;";
- }
- else
- {
- t += "min-";
- }
- t += "height:100%;'>" + n + "\n</textarea></td>";
- return t;
- };
- function displayForm(f)
- {
- var t = "Parameters for form [" + f.id + "] for window \"" + f.target + "\" using " + f.action;
- var parms = f.document.getElementsByTagName("INPUT");
- for (var i = parms.length-1; i >= 0; i--)
- {
- t += "\n\t" + parms[i].name + " = " + parms[i].value;
- }
- trace(t);
- };
- function recordCommandsToggle()
- {
- if (!gRecordDumpWin || (gRecordDumpWin && gRecordDumpWin.closed))
- {
- gRecordDumpWin = window.open(goApplicationManager.getReportFrame().oCVQS.getWebContentRoot() + "/common/blank.html", "_record_window_");
- }
- gRecordDumpWin.document.open();
- gRecordDumpWin.document.writeln("<html><head><title>Command Recording</title></head><body><textarea id='recordText' style='width:100%;height:100%;'></textarea></body></html>");
- gRecordDumpWin.document.close();
- };
- function recordCommand(cmd)
- {
- if (!(!gRecordDumpWin || (gRecordDumpWin && gRecordDumpWin.closed)))
- {
- var recordText = gRecordDumpWin.document.getElementById("recordText");
- recordText.value += (cmd + "\n");
- }
- };
- function pushCommandsToggle()
- {
- if (!gPushCmdWin || (gPushCmdWin && gPushCmdWin.closed))
- {
- gPushCmdWin = window.open(goApplicationManager.getReportFrame().oCVQS.getWebContentRoot() + "/common/blank.html", "_push_cmd_window_");
- }
- gPushCmdWin.document.open();
- var HTMLOut = "<html><head><title>Push Commands</title></head><body>";
- HTMLOut += "<input type='text' id='encodeText' style='width:100%;'></input><button onclick=\"document.getElementById('encodeText').value = opener.escapeParam(document.getElementById('encodeText').value)\">Escape Parameter</button>";
- HTMLOut += "<textarea id='pushText' style='width:100%;height:80%;'></textarea><button onclick=\"opener.sendCmd(document.getElementById('pushText').value.replace(/\\s*\\n\\s*(\\w\\w:)/g,';$1'), '', true)\">Push Command</button>";
- HTMLOut += "<button onclick=\"opener.setMiniQuery(document.getElementById('pushText').value)\">Set MiniQuery to above</button>";
- HTMLOut += "</body></html>";
- gPushCmdWin.document.write(HTMLOut);
- gPushCmdWin.document.close();
- };
- function setMiniQuery(miniQuery)
- {
- cfgSet("conversation_qs_spec", miniQuery);
- goApplicationManager.getMiniQueryManager().setMiniQuery(miniQuery);
- goApplicationManager.getFeatureManager().launchFeature('Run', new Array('full'));
- };
|