123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131 |
- var GUtil = {};
- GUtil.createHiddenForm = function(name, method, viewerId, target) {
- var form = document.getElementById(name);
- if(form) {
- document.body.removeChild(form);
- }
- form = document.createElement("form");
- form.id = name;
- form.name = name;
- form.method = method;
- form.style.display = "none";
- form.action = document.forms["formWarpRequest" + viewerId].action;
- form.target = target + (new Date()).getTime();
- document.body.appendChild(form);
- return form;
- };
- GUtil.createFormField = function(el, name, value) {
- var input = document.createElement("input");
- input.type = "hidden";
- input.name = name;
- input.value = value;
- el.appendChild(input);
- };
- GUtil.generateCallback = function(func, aParams, oContext){
-
-
- if (func) {
- var funcContext = oContext || this;
- aParams = (aParams instanceof Array)? aParams : [];
- return (function(response){
- if(typeof response != "undefined" && aParams.length == 0) {
- aParams.push(response);
- }
- return func.apply(funcContext,aParams);
- });
- } else {
-
- return (function() {});
- }
- };
- GUtil.destroyProperties = function(inParam, bDestroyCognosViewer){
- var property;
- if (inParam instanceof Array) {
- for(var i=0; i<inParam.length; i++) {
- property = inParam[i];
- if (property instanceof String) {
- property = null;
- } else {
- if (property && property.destroy && !property._beingDestroyed) {
- property.destroy();
- }
- GUtil.destroyProperties(property);
- }
- }
- } else if (inParam instanceof Object){
- if (inParam._beingDestroyed) {
- return;
- }
- var obj = inParam;
- obj._beingDestroyed = true;
- for (var field in obj) {
- property = obj[field];
- if (field === "_beingDestroyed" || field === "m_destroyed" || field === "_destroyed" || typeof property == "function") {
-
- continue;
- }
- if (property instanceof Array) {
- GUtil.destroyProperties(property);
- } else if (property instanceof Object) {
- if (typeof property.destroy == "function" && !property._destroyed && (property!==CCognosViewer || bDestroyCognosViewer)) {
- property.destroy();
- }
- }
- delete obj[field];
- }
- }
- };
|