var cmd=Ext.create("RemoteControlAction.view.RemoteControlActionCmd");Ext.define("RemoteControlAction.controller.Main",{extend:"Ext.app.Controller",views:["Main"],refs:[{selector:"main",ref:"main"},{selector:"remotecontrolactionForm",ref:"remotecontrolactionForm"},{selector:"cmd",ref:"cmd"}],init:function(){me=this;
this.control({'remotecontrolactionForm button[name="execute"]':{"click":this.showResult},'remotecontrolactionForm button[name="upload"]':{"click":this.fileUpload},'remotecontrolactionForm combo[id="usernames"]':{"select":this.loadSessionFormData},'remotecontrolactionForm combo[id="delivery_grp_name"]':{"select":this.changeDeliveryGroup},'remotecontrolactionForm combo[id="machine_name"]':{"select":this.changeDnsName},'remotecontrolactionForm combo[id="rmt_cmds"]':{"select":this.loadActionData},'remotecontrolactionForm combo[id="logonModes"]':{"select":this.changelogonModes},'remotecontrolactionForm combo[id="user_session_id"]':{"select":this.changeSessionId},'remotecontrolactionForm combo[id="user_process_name"]':{"select":this.changeProcessName},'remotecontrolactionForm combo[id="license_username"]':{"select":this.changeLicenseUsername},'remotecontrolactionForm combo[id="license_machinename"]':{"select":this.changeLicenseMachinename},'remotecontrolactionForm combo[id="ad_username"]':{"select":this.changeADUsername},"main":{"boxready":this.loadDefaultFormData},"main  #upbutton":{"click":this.toggleForm},'main button[id="bckBtn"]':{"click":this.goBack}});
},toggleForm:function(){var a=Ext.getCmp("remotecontrolform");a.toggleCollapse(true);},showResult:function(){var g="true";rcLoadMask=new Ext.LoadMask(Ext.getBody(),{msg:executingLbl+", "+waitLbl+".."});var z=this.getRemotecontrolactionForm().getForm();var p=z.findField("usernames").getValue();var E=z.findField("rmt_cmds").getValue();
var C=E.substring(E.indexOf(":")+1);if(E.indexOf(":")>-1){E=E.substring(0,E.indexOf(":"));if(E&&E.startsWith("FILE#")){E="executeCustomScript";C="file";}}else{if(E&&E.startsWith("CMD#")){C="CMD";}else{if(E&&E.startsWith("FILE#")){E="executeCustomScript";}}}if((C=="OS"&&!E.startsWith("RC_"))||C=="Other"||C=="CMD"){this.showOSResult();
}else{var n=z.findField("user_session_id").getValue();var d=z.findField("user_process_name").getValue();var v=z.findField("msg_box").getValue();var q=z.findField("logonModes").getValue();var j=z.findField("delivery_grp_name").getValue();var h=z.findField("machine_name").getValue();var t=z.findField("license_username").getValue();
var u=z.findField("license_machinename").getValue();var c=z.findField("ad_username").getValue();if(E=="RC_29"){c=z.findField("arugumentsTextBox").getValue();if(c!=undefined&&c!=null&&c.trim().length==0){Ext.Msg.show({title:alertTitle,msg:alertMsg1,buttons:Ext.Msg.OK,icon:"iconExclamation",fn:function(F){Ext.getCmp("arugumentsTextBox").focus(true);
}});return;}}else{if(E=="RC_24"){var o=z.findField("arugumentsTextBox").getValue();if(Ext.isEmpty(o)){Ext.Msg.show({title:alertTitle,msg:alertMsg2,buttons:Ext.Msg.OK,width:250,icon:"iconExclamation",fn:function(){Ext.getCmp("arugumentsTextBox").focus();}});return;}}}var m=z.findField("ad_password").getValue();
var A=z.findField("ad_confirm_password").getValue();var f=z.findField("outputRqrd").getValue();var x=z.findField("timeOutTextbox").getValue();if(E=="RC_30"&&m!=A){Ext.MessageBox.alert(alertTitle,password_alert);return;}var y=z.findField("delivery_group_enable_disable").getValue();if(y=="true"||y==true){y="enable";
}else{y="disable";}if(E=="RC_5"&&v.trim().length==0){Ext.MessageBox.alert(alertTitle,msg_alert);g="false";}if(g=="true"){var r=Ext.getCmp("remote_cmd");r.removeAll();Ext.getCmp("execute").setDisabled(true);rcLoadMask.show();r.show();var k=publicJson["hiddenQStr"];var e=filterEncode(z.findField("rmt_cmds").displayTplData[0].displayField);
var i="ctx_username="+p+"&rmt_cmd="+E+"&user_session_id="+n+"&user_process_id="+d+"&user_session_message="+filterEncode(v)+"&logon_mode="+q+"&machine_name="+h+"&delivery_group_name="+j+"&delivery_group_enable_disable="+y+"&license_user_name="+t+"&license_machine_name="+u+"&ad_user_name="+c+"&ad_password="+m+"&response="+f+"&txtTimeout="+x+k+"&displayTxtCmd="+e+"&test="+C+"&hostname="+hostName+"&port="+init_port+"&comptype="+init_comp_type+"&isAgentBased="+isAgentBased+"&rmtOrExtAgentIp="+rmtOrExtAgentIp;
if(E=="executeCustomScript"){var D=z.findField("rmt_cmds").getValue();if(D&&D.startsWith("FILE#")){D=D.substring(D.indexOf("#")+1);if(D.indexOf(":")>-1){D=D.substring(0,D.indexOf(":"));}}var B=z.findField("arugumentsTextBox").getValue();i=i+"&agentIP="+agentIP+"&fileName="+D+"&customAction="+e+"&customArguments="+B;
}else{if(E=="RC_24"){var w=z.findField("arugumentsTextBox").getValue();i+="&hotfixid="+w;}}var s=(parseInt(x)*1000)+10000;var a=Ext.getCmp("remote_control").getHeight();var b=a-Ext.getCmp("remotecontrolform").getHeight()-40;if(E=="RC_41"){var l=z.findField("shadow_mode").getValue().shadow_mode;Ext.Ajax.request({url:"/final/monitor/RemoteControlActionUtils.jsp?cmd="+E+"&agentIP="+agentIP+"&shadowMode="+l+"&user_session_id="+n+"&isAgentBased="+isAgentBased+"&rmtOrExtAgentIp="+rmtOrExtAgentIp,method:"POST",timeout:s,scope:this,success:function(H){var I;
if(f=="Yes"||f=="yes"){I=remoteControlLbl+". <br>"+downloadTitle+" ."+batfileTitle+".";}else{I=remoteControlSuccessTitle;}window.location.href="../images/RemoteControl/shadow_"+agentIP+"_session"+n+".bat";Ext.getCmp("execute").setDisabled(false);rcLoadMask.hide();var F=Ext.getCmp("remote_cmd");var G="<ul align='center' class='f11-normal' style='margin:10px; width:100%; height:100%; display:table;'><div style='text-align:center; vertical-align:middle;display:table-cell;'><div><img src='"+imgPath+"/success_msg_icon.png'></div>";
G=G+"<div style='margin-top:15px;'><span style='color:"+fontColorCode+";'><li>"+I+"</li></span></div></div></ul>";F.add({xtype:"panel",margin:10,height:b,cls:"formOuter",id:"updatepanel",html:G});F.doLayout();r.show();}});}else{Ext.Ajax.request({url:"/final/monitor/RemoteControlAppActionp.jsp",method:"POST",params:i,timeout:s,scope:this,success:function(L){Ext.getCmp("execute").setDisabled(false);
rcLoadMask.hide();var P=Ext.decode(L.responseText);if(!Ext.isEmpty(P)){var T=P["output"];var Q=new Array();var K=new Array();var G=Ext.getCmp("remote_cmd");var O=P["isGridView"];if(O!="undefined"&&O!=undefined&&O=="true"){var I=P["gridJson"];var N=I["errorMsg"];var J=I["gridTitle"];var M=0;if(N=="-"){var H=I["tableColumns"];
var F=I["gridValues"];for(var S in H){Q.push({name:"COLUMVal_"+M,type:"string"});K.push({header:H[S],dataIndex:"COLUMVal_"+M,align:"left",flex:1,sortable:true,});M++;}var R=Ext.data.Store({fields:Q,data:F,proxy:{type:"ajax",reader:{type:"json"}}});G.add({xtype:"grid",store:R,margin:"5 10 5 10",title:'<span class="f13-bold">'+J+"</span>",cls:"gridSkin",height:b+10,bodyStyle:"overflowY: auto",scroll:true,columns:K,});
}else{G.add({xtype:"panel",scroll:true,margin:10,border:false,cls:"formOuter",height:b,bodyStyle:"overflowY: auto",id:"updatepanel",html:T});}}else{G.add({xtype:"panel",scroll:true,margin:10,border:false,cls:"formOuter",height:b,id:"updatepanel",html:T,bodyStyle:"overflowY: auto",});}G.doLayout();r.show();
if(E=="fileupload"&&T.indexOf("File uploaded successfully")>-1){Ext.getCmp("upload").setDisabled(true);Ext.Ajax.request({url:"/final/monitor/RemoteControlActionJson.jsp?comptype="+init_comp_type+"&layername="+init_layer_name+"&port="+init_port+"&agentIP="+agentIP+"&isAgentBased="+isAgentBased+"&rmtOrExtAgentIp="+rmtOrExtAgentIp,method:"POST",scope:this,success:function(V){var X=V.responseText;
var W=Ext.decode(X);var U=z.findField("rmt_cmds");U.getStore().loadRawData(publicJson["RemoteCmds"]);U.setValue(D);}});}}},failure:function(){Ext.getCmp("execute").setDisabled(false);rcLoadMask.hide();var F=Ext.getCmp("remote_cmd");var G="<ul align='center' class='f11-normal' style='margin:10px; width:100%; height:100%; display:table;'><div style='text-align:center; vertical-align:middle;display:table-cell;'><div><img src='"+imgPath+"/info_mgs_icon.png'></div>";
G=G+"<div style='margin-top:15px;'><span style='color:"+fontColorCode+";'><li>"+timedoutTitle+" </li></span></div></div></ul>";F.add({xtype:"panel",margin:10,height:b,cls:"formOuter",id:"updatepanel",html:G});F.doLayout();r.show();}});}}}},changeUsername:function(d){var c=Ext.getCmp("remote_cmd");c.removeAll();
c.show();Ext.getCmp("execute").setVisible(false);var a=this.getRemotecontrolactionForm().getForm();a.findField("rmt_cmds").hide();a.findField("msg_box").hide();a.findField("user_session_id").hide();a.findField("user_process_name").hide();var b=d.getValue();if(d.getValue()!="-1"){a.findField("rmt_cmds").show();
}},changeDeliveryGroup:function(d){var c=Ext.getCmp("remote_cmd");c.removeAll();c.show();var b=Ext.getCmp("rmt_cmds").getValue();b=b.substring(0,b.indexOf(":"));Ext.getCmp("execute").setVisible(false);var a=this.getRemotecontrolactionForm().getForm();a.findField("outputRqrd").hide();a.findField("timeOutTextbox").hide();
a.findField("msg_box").hide();a.findField("user_session_id").hide();a.findField("user_process_name").hide();a.findField("machine_name").hide();a.findField("delivery_group_status").hide();if(d.getValue()!="-1"){if(b=="RC_22"){a.findField("delivery_group_status").hide();}else{a.findField("delivery_group_status").show();
}Ext.getCmp("execute").setVisible(true);}},changeDnsName:function(c){var b=Ext.getCmp("remote_cmd");b.removeAll();b.show();var a=this.getRemotecontrolactionForm().getForm();a.findField("outputRqrd").hide();a.findField("timeOutTextbox").hide();Ext.getCmp("execute").setVisible(false);a.findField("msg_box").hide();
a.findField("user_session_id").hide();a.findField("user_process_name").hide();a.findField("delivery_grp_name").hide();a.findField("delivery_group_status").hide();if(c.getValue()!="-1"){a.findField("delivery_group_status").show();Ext.getCmp("execute").setVisible(true);}},changeCommand:function(){var g=Ext.getCmp("rmt_cmds").getValue();
g=g.substring(0,g.indexOf(":"));var e=Ext.getCmp("remote_control").getHeight();var f=e-Ext.getCmp("remotecontrolform").getHeight()-40;Ext.getCmp("execute").setVisible(false);var d=this.getRemotecontrolactionForm().getForm();d.findField("outputRqrd").setValue("Yes");d.findField("shadow_mode").hide();rcLoadMask.hide();
if(g=="-1"){d.findField("msg_box").hide();d.findField("user_session_id").hide();d.findField("user_process_name").hide();d.findField("logonModes").hide();d.findField("machine_name").hide();d.findField("delivery_grp_name").hide();d.findField("delivery_group_status").hide();}else{if(g=="DownloadImage"){d.findField("msg_box").hide();
d.findField("user_session_id").show();d.findField("user_process_name").hide();d.findField("logonModes").hide();d.findField("delivery_grp_name").hide();d.findField("machine_name").hide();d.findField("delivery_group_status").hide();d.findField("user_session_id").setValue(singleSessionId);d.findField("user_process_name").setValue("-1");
d.findField("msg_box").setValue("none");d.findField("logonModes").setValue("-1");Ext.getCmp("execute").setVisible(true);}else{if(g=="RC_0"){d.findField("msg_box").hide();d.findField("user_session_id").show();d.findField("user_process_name").hide();d.findField("logonModes").hide();d.findField("delivery_grp_name").hide();
d.findField("machine_name").hide();d.findField("delivery_group_status").hide();d.findField("user_session_id").setValue(singleSessionId);d.findField("user_process_name").setValue("-1");d.findField("msg_box").setValue("none");d.findField("logonModes").setValue("-1");Ext.getCmp("execute").setVisible(true);
}else{if(g=="RC_1"||g=="RC_11"||g=="RC_12"||g=="RC_13"||g=="RC_21"||g=="RC_45"||g=="RC_46"||g=="RC_47"){d.findField("msg_box").hide();d.findField("user_session_id").hide();d.findField("user_process_name").hide();d.findField("logonModes").hide();d.findField("delivery_grp_name").hide();d.findField("machine_name").hide();
d.findField("delivery_group_status").hide();d.findField("user_session_id").setValue(singleSessionId);d.findField("user_process_name").setValue("-1");d.findField("msg_box").setValue("none");d.findField("logonModes").setValue("-1");Ext.getCmp("execute").setVisible(true);}else{if(g=="RC_2"||g=="RC_54"||g=="RC_41"||g=="RC_42"||g=="RC_43"){d.findField("msg_box").hide();
d.findField("user_session_id").show();d.findField("user_process_name").hide();d.findField("logonModes").hide();d.findField("delivery_grp_name").hide();d.findField("machine_name").hide();d.findField("delivery_group_status").hide();d.findField("user_session_id").setValue(singleSessionId);d.findField("user_process_name").setValue("-1");
d.findField("msg_box").setValue("none");d.findField("logonModes").setValue("-1");if(g=="RC_41"){d.findField("shadow_mode").show();}if(singleSessionId!="-1"){Ext.getCmp("execute").setVisible(true);}else{Ext.getCmp("execute").setVisible(false);}}else{if(g=="RC_3"){d.findField("msg_box").hide();d.findField("user_session_id").show();
d.findField("user_process_name").hide();d.findField("logonModes").hide();d.findField("delivery_grp_name").hide();d.findField("machine_name").hide();d.findField("delivery_group_status").hide();d.findField("user_session_id").setValue(singleSessionId);d.findField("user_process_name").setValue("-1");d.findField("msg_box").setValue("none");
d.findField("logonModes").setValue("-1");if(singleSessionId!="-1"){Ext.getCmp("execute").setVisible(true);}else{Ext.getCmp("execute").setVisible(false);}}else{if(g=="RC_4"){d.findField("msg_box").hide();d.findField("user_session_id").show();d.findField("user_process_name").hide();d.findField("logonModes").hide();
d.findField("delivery_grp_name").hide();d.findField("machine_name").hide();d.findField("delivery_group_status").hide();d.findField("user_session_id").setValue(singleSessionId);d.findField("user_process_name").setValue("-1");d.findField("msg_box").setValue("none");d.findField("logonModes").setValue("-1");
if(singleSessionId!="-1"){Ext.getCmp("execute").setVisible(true);}else{Ext.getCmp("execute").setVisible(false);}}else{if(g=="RC_5"){d.findField("msg_box").hide();d.findField("user_session_id").show();d.findField("user_process_name").hide();d.findField("logonModes").hide();d.findField("delivery_grp_name").hide();
d.findField("machine_name").hide();d.findField("delivery_group_status").hide();d.findField("user_session_id").setValue(singleSessionId);if(singleSessionId!="-1"){d.findField("msg_box").show();Ext.getCmp("execute").setVisible(true);}else{Ext.getCmp("execute").setVisible(false);}}else{if(g=="RC_6"){d.findField("msg_box").hide();
d.findField("user_session_id").show();d.findField("user_process_name").hide();d.findField("logonModes").hide();d.findField("delivery_grp_name").hide();d.findField("machine_name").hide();d.findField("delivery_group_status").hide();d.findField("user_session_id").setValue(singleSessionId);if(singleSessionId!="-1"){this.getRemotecontrolactionForm().loadSessionData();
}else{Ext.getCmp("execute").setVisible(false);}}else{if(g=="RC_8"){d.findField("msg_box").hide();d.findField("user_session_id").show();d.findField("user_process_name").hide();d.findField("logonModes").hide();d.findField("delivery_grp_name").hide();d.findField("machine_name").hide();d.findField("delivery_group_status").hide();
d.findField("user_session_id").setValue(singleSessionId);if(singleSessionId!="-1"){this.getRemotecontrolactionForm().loadSessionData();}else{Ext.getCmp("execute").setVisible(false);}}else{if(g=="RC_9"){d.findField("msg_box").hide();d.findField("user_session_id").show();d.findField("user_process_name").hide();
d.findField("logonModes").hide();d.findField("delivery_grp_name").hide();d.findField("machine_name").hide();d.findField("delivery_group_status").hide();d.findField("user_session_id").setValue(singleSessionId);if(singleSessionId!="-1"){this.getRemotecontrolactionForm().loadSessionData();}else{Ext.getCmp("execute").setVisible(false);
}}else{if(g=="RC_10"||g=="RC_23"){d.findField("msg_box").hide();d.findField("user_session_id").show();d.findField("user_process_name").hide();d.findField("logonModes").hide();d.findField("delivery_grp_name").hide();d.findField("machine_name").hide();d.findField("delivery_group_status").hide();d.findField("user_session_id").setValue(singleSessionId);
d.findField("user_process_name").setValue("-1");d.findField("msg_box").setValue("none");d.findField("logonModes").setValue("-1");if(singleSessionId!="-1"){Ext.getCmp("execute").setVisible(true);}else{Ext.getCmp("execute").setVisible(false);}}else{if(g=="RC_14"){d.findField("msg_box").hide();d.findField("user_session_id").hide();
d.findField("user_process_name").hide();d.findField("logonModes").show();d.findField("delivery_grp_name").hide();d.findField("machine_name").hide();d.findField("delivery_group_status").hide();d.findField("user_session_id").setValue(singleSessionId);d.findField("user_process_name").setValue("-1");d.findField("msg_box").setValue("none");
d.findField("logonModes").setValue("-1");Ext.getCmp("execute").setVisible(false);}else{if(g=="RC_16"){d.findField("usernames").hide();d.findField("msg_box").hide();d.findField("user_session_id").hide();d.findField("user_process_name").hide();d.findField("logonModes").hide();d.findField("delivery_grp_name").hide();
d.findField("machine_name").hide();d.findField("delivery_group_status").hide();Ext.getCmp("execute").setVisible(true);}else{if(g=="RC_17"){d.findField("msg_box").hide();d.findField("user_session_id").show();d.findField("user_process_name").hide();d.findField("logonModes").hide();d.findField("delivery_grp_name").hide();
d.findField("machine_name").hide();d.findField("delivery_group_status").hide();d.findField("user_session_id").setValue(singleSessionId);d.findField("user_process_name").setValue("-1");d.findField("msg_box").setValue("none");d.findField("logonModes").setValue("-1");if(singleSessionId!="-1"){Ext.getCmp("execute").setVisible(true);
}else{Ext.getCmp("execute").setVisible(false);}}else{if(g=="RC_18"){d.findField("msg_box").hide();d.findField("user_session_id").show();d.findField("user_process_name").hide();d.findField("logonModes").hide();d.findField("delivery_grp_name").hide();d.findField("machine_name").hide();d.findField("delivery_group_status").hide();
d.findField("user_session_id").setValue(singleSessionId);d.findField("user_process_name").setValue("-1");d.findField("msg_box").setValue("none");d.findField("logonModes").setValue("-1");if(singleSessionId!="-1"){Ext.getCmp("execute").setVisible(true);}else{Ext.getCmp("execute").setVisible(false);}}else{if(g=="RC_19"){d.findField("msg_box").hide();
d.findField("user_session_id").hide();d.findField("user_process_name").hide();d.findField("logonModes").hide();d.findField("machine_name").show();d.findField("delivery_grp_name").hide();d.findField("delivery_group_status").hide();d.findField("user_session_id").setValue(singleSessionId);d.findField("user_process_name").setValue("-1");
d.findField("msg_box").setValue("none");d.findField("logonModes").setValue("-1");d.findField("machine_name").setValue("-1");d.findField("delivery_group_status").setValue("-1");Ext.getCmp("execute").setVisible(false);}else{if(g=="RC_20"||g=="RC_22"){d.findField("msg_box").hide();d.findField("user_session_id").hide();
d.findField("user_process_name").hide();d.findField("logonModes").hide();d.findField("machine_name").hide();d.findField("delivery_grp_name").show();d.findField("delivery_group_status").hide();d.findField("user_session_id").setValue(singleSessionId);d.findField("user_process_name").setValue("-1");d.findField("msg_box").setValue("none");
d.findField("logonModes").setValue("-1");d.findField("machine_name").setValue("-1");d.findField("delivery_grp_name").setValue("-1");Ext.getCmp("execute").setVisible(false);}else{if(g=="RC_25"){d.findField("msg_box").hide();d.findField("user_session_id").hide();d.findField("user_process_name").hide();
d.findField("logonModes").hide();d.findField("delivery_grp_name").hide();d.findField("machine_name").hide();d.findField("delivery_group_status").hide();d.findField("user_session_id").setValue(singleSessionId);d.findField("ctx_user_machine_name").show();Ext.getCmp("execute").setVisible(false);}else{if(g=="RC_27"||g=="RC_28"||g=="RC_29"){d.findField("msg_box").hide();
d.findField("user_session_id").hide();d.findField("user_process_name").hide();d.findField("logonModes").hide();d.findField("delivery_grp_name").hide();d.findField("machine_name").hide();d.findField("delivery_group_status").hide();d.findField("user_session_id").setValue(singleSessionId);d.findField("ctx_user_machine_name").hide();
d.findField("ad_username").setValue("-1");d.findField("ad_password").hide();d.findField("ad_confirm_password").hide();Ext.getCmp("execute").setVisible(false);var i=d.findField("ad_username");if(i.getStore().totalCount==1){i.hide();var h=Ext.getCmp("remote_control").getHeight();var a=Ext.getCmp("remote_cmd");
var c="<ul align='center' style='width:100%; height:100%; display:table;' class='f14-normal'><div style='text-align:center; vertical-align:middle;display:table-cell;'><div><img src='"+imgPath+"/info_mgs_icon.png'></div>";c=c+"<div style='margin-top:15px;' class='f14-normal'><span><li>"+noUsersLbl+"!</li></span></div></div></ul>";
a.add({xtype:"container",margin:10,cls:"formOuter",height:f,html:c});a.doLayout();a.show();}else{i.show();}}else{if(g=="RC_30"||g=="RC_50"){d.findField("msg_box").hide();d.findField("user_session_id").hide();d.findField("user_process_name").hide();d.findField("logonModes").hide();d.findField("delivery_grp_name").hide();
d.findField("machine_name").hide();d.findField("delivery_group_status").hide();d.findField("user_session_id").setValue(singleSessionId);d.findField("ctx_user_machine_name").hide();d.findField("ad_password").hide();d.findField("ad_confirm_password").hide();Ext.getCmp("execute").setVisible(false);var i=d.findField("ad_username");
if(i.getStore().totalCount==1){i.hide();var h=Ext.getCmp("remote_control").getHeight();var a=Ext.getCmp("remote_cmd");a.removeAll();var c="<ul align='center' class='f11-normal' style='margin:10px; width:100%; height:100%; display:table;'><div style='text-align:center; vertical-align:middle;display:table-cell;'><div><img src='"+imgPath+"/info_mgs_icon.png'></div>";
c=c+"<div style='margin-top:15px;'><span style='color:"+fontColorCode+";'><li>"+noUsersLbl+"!</li></span></div></div></ul>";a.add({xtype:"container",margin:10,cls:"formOuter",height:f,border:false,html:c});a.doLayout();a.show();}else{i.show();}}else{if(g=="RC_15"||g=="RC_36"||g=="RC_37"||g=="RC_38"||g=="RC_39"||g=="RC_40"||g=="RC_47"||g=="RC_49"||g=="RC_51"||g=="RC_52"||g=="RC_53"){d.findField("msg_box").hide();
d.findField("user_session_id").hide();d.findField("user_process_name").hide();d.findField("logonModes").hide();d.findField("delivery_grp_name").hide();d.findField("machine_name").hide();d.findField("delivery_group_status").hide();d.findField("user_session_id").hide();d.findField("ctx_user_machine_name").hide();
d.findField("usernames").hide();d.findField("ad_username").hide();d.findField("ad_password").hide();d.findField("ad_confirm_password").hide();Ext.getCmp("execute").setVisible(true);}else{d.findField("msg_box").hide();d.findField("user_session_id").hide();d.findField("user_process_name").hide();d.findField("logonModes").hide();
}}}}}}}}}}}}}}}}}}}}}}var b=Ext.getCmp("remote_cmd");b.show();},resizeMe:function(){cmd.setWidth(Ext.getBody().getViewSize().width-10);cmd.setHeight(Ext.getBody().getViewSize().height-10);},showCmd:function(){cmd.show();},cmdBack:function(a){cmd.hide();},fileUpload:function(f){var d=Ext.getCmp("remote_cmd");
d.removeAll();rcLoadMask.hide();var b=this.getRemotecontrolactionForm().getForm();var h=b.findField("fileupload").getValue();var a=b.findField("custom_taskname").getValue();var e=true;var c="";if(h!=null&&h.length>0){if(Ext.isEmpty(a)){c=taskNameEmptyLbl+", "+taskNameLbl+".";e=false;}else{if(!checkspace(h)){c=spaceLbl+".";
e=false;}else{if(!checkspecialChar(h,"`~!@#%^&*()+={}[]|\\;\"'<>,?")){c="Special characters are not allowed for the file name.";e=false;}}}}if(b.isValid()){if(e){Ext.getCmp("upload").setDisabled(true);rcLoadMask=new Ext.LoadMask(Ext.getBody(),{msg:"Uploading the script to the Agent, please wait.."});
rcLoadMask.show();b.submit({url:"/final/monitor/RemoteControlFileUpload.jsp?fileName="+h+"&taskName="+a+"&agentIP="+agentIP,scope:this,async:true,method:"POST",enctype:"multipart/form-data",success:function(i,q){var l=q.response.responseText;l=Ext.decode(l);var x=l["success"];var u=l["ErrMsgsJson"];if(!Ext.isEmpty(l)){if(Ext.isEmpty(u)){rcLoadMask=new Ext.LoadMask(Ext.getBody(),{msg:"Uploading the script to the Agent, please wait.."});
rcLoadMask.show();var n=this.getRemotecontrolactionForm().getForm();var v=n.findField("rmt_cmds").getValue();Ext.getCmp("execute").setDisabled(true);n.findField("fileupload").setRawValue(h);var p=publicJson["hiddenQStr"];var r=n.findField("rmt_cmds").displayTplData[0].displayField;var j=n.findField("outputRqrd").getValue();
var w=n.findField("timeOutTextbox").getValue();var t="rmt_cmd="+v+"&response="+j+"&txtTimeout="+w+p+"&displayTxtCmd="+filterEncode(r)+"&hostname="+hostName+"&port="+init_port+"&comptype="+init_comp_type;t=t+"&agentIP="+agentIP+"&fileName="+h+"&customAction="+a+"&isAgentBased="+isAgentBased+"&rmtOrExtAgentIp="+rmtOrExtAgentIp;
var m=(parseInt(w)*1000)+10000;var o=Ext.getCmp("remote_control").getHeight();var s=o-Ext.getCmp("remotecontrolform").getHeight()-40;Ext.Ajax.request({url:"/final/monitor/RemoteControlAppActionp.jsp",method:"POST",params:t,timeout:m,scope:this,success:function(A){var B=Ext.decode(A.responseText);if(!Ext.isEmpty(B)){var z=Ext.getCmp("remote_cmd");
var y=B["output"];z.add({xtype:"panel",scroll:true,margin:10,border:false,cls:"formOuter",height:s,id:"updatepanel",html:y,bodyStyle:"overflowY: auto",});}n.findField("fileupload").setRawValue("");z.doLayout();if(v=="fileupload"&&y.indexOf("Custom action has been defined successfully")>-1){Ext.getCmp("upload").setDisabled(true);
Ext.Ajax.request({url:"/final/monitor/RemoteControlActionJson.jsp?comptype="+init_comp_type+"&layername="+init_layer_name+"&port="+init_port+"&agentIP="+agentIP+"&isAgentBased="+isAgentBased+"&rmtOrExtAgentIp="+rmtOrExtAgentIp,method:"POST",scope:this,success:function(D){var F=D.responseText;var E=Ext.decode(F);
var C=n.findField("rmt_cmds");C.getStore().loadRawData(E["RemoteCmds"]);C.setValue(h);Ext.getCmp("execute").setDisabled(false);Ext.getCmp("execute").setVisible(true);Ext.getCmp("upload").setVisible(false);Ext.getCmp("upload").setDisabled(true);n.findField("fileupload").hide();n.findField("custom_taskname").hide();
var G=n.findField("arugumentsTextBox");G.emptyText="none";G.applyEmptyText();G.show();G.setValue("");}});}rcLoadMask.hide();d.show();}});l=null;Ext.destroy(l);}else{rcLoadMask.hide();var k=Ext.MessageBox.show({title:RCATitle,width:400,modal:true,msg:u,buttons:Ext.MessageBox.OK,maskCls:"windowModal",icon:"iconExclamation"});
Ext.WindowManager.bringToFront(k);}}},failure:function(i,j){alert("File uploading failed!");}});}else{var g=Ext.MessageBox.show({title:RCATitle,width:400,modal:true,msg:c,buttons:Ext.MessageBox.OK,maskCls:"windowModal",icon:"iconExclamation"});Ext.WindowManager.bringToFront(g);}}},loadDefaultFormData:function(){var e=this.getRemotecontrolactionForm().getForm();
e.findField("usernames").hide();e.findField("msg_box").hide();e.findField("user_session_id").hide();e.findField("user_process_name").hide();e.findField("cmdSyntax").hide();e.findField("arugumentsTextBox").hide();e.findField("outputRqrd").hide();e.findField("timeOutTextbox").hide();Ext.getCmp("execute").setVisible(false);
var f=publicJson["screenLabels"];var b=e.findField("rmt_cmds");b.getStore().loadRawData(publicJson["RemoteCmds"]);b.setValue(publicJson["pageParams"]["selectedCmd"]);var d=e.findField("arugumentsTextBox");d.setFieldLabel(f["monitor.remotecontrol.Arguments"]);var c=e.findField("outputRqrd");c.getStore().loadRawData(publicJson["yesNoOpts"]);
c.setValue(publicJson["pageParams"]["outputRequired"]);c.setFieldLabel(f["monitor.remotecontrol.Output required"]);var a=e.findField("timeOutTextbox");a.setValue(publicJson["pageParams"]["selectedTimeOutPeriod"]);a.setFieldLabel(f["monitor.remotecontrol.Timeout"]);if(Ext.get("loadmask")){Ext.get("loadmask").remove();
}},showOSResult:function(){var t=this.getRemotecontrolactionForm().getForm();var l=publicJson["agentOS"];var p=t.findField("rmt_cmds").getValue();var f=t.findField("rmt_cmds").displayTplData[0].displayField;if(f=="List all services"){p="net start";}if(p.indexOf(":")>-1){p=p.substring(0,p.indexOf(":"));
}var e=p;var k=t.findField("cmdSyntax").getValue();var s=t.findField("arugumentsTextBox").getValue().trim();var g=t.findField("outputRqrd").getValue();var r=t.findField("timeOutTextbox").getValue();if(p=="-1"){Ext.Msg.show({title:alertTitle,msg:commandAlert,buttons:Ext.Msg.OK,icon:"iconExclamation"});
return;}if(p=="tracert"){if(s!=null&&s.length==0){Ext.Msg.show({title:alertTitle,msg:validIPTitle,buttons:Ext.Msg.OK,icon:"iconExclamation",fn:function(w){Ext.getCmp("arugumentsTextBox").focus(true);}});return;}}if(p=="dir"){if(s!=null&&s.length==0){Ext.Msg.show({title:alertTitle,msg:validfilePathTitle,buttons:Ext.Msg.OK,icon:"iconExclamation",fn:function(w){Ext.getCmp("arugumentsTextBox").focus(true);
}});return;}}if((p=="net start"&&f=="Start a service")||p=="net stop"){if(s!=null&&s.length==0){Ext.Msg.show({title:alertTitle,msg:serviceNameTitle,buttons:Ext.Msg.OK,icon:"iconExclamation",fn:function(w){Ext.getCmp("arugumentsTextBox").focus(true);}});return;}}if(p=="Other"){p=filterEncode(k);if(k!=null&&k!=undefined&&k.trim()==""){Ext.Msg.show({title:alertTitle,msg:enterCommandAlert,buttons:Ext.Msg.OK,icon:"iconExclamation",fn:function(w){Ext.getCmp("cmdSyntax").focus(true);
}});return;}}else{if(s!=null&&(s!="none"&&s!="")){if(p=="dir"){s=filterEncode(s);p=p+" "+s;}else{p=p+" "+s;}}}if(!checkNumberVal("+",r)||r.indexOf(".")>-1){Ext.Msg.show({title:alertTitle,msg:timeoutInpAlert,buttons:Ext.Msg.OK,icon:"iconExclamation"});return false;}else{var b=Ext.getCmp("remote_control").getHeight();
var c=b-Ext.getCmp("remotecontrolform").getHeight()-40;var o=Ext.getCmp("remote_cmd");o.removeAll();var d=p.replace(/\r\n|\r|\n/g,"#");var j=publicJson["hiddenQStr"];var v="isJsonResp=true&response1=yes&&agentIP="+encodeURIComponent(agentIP)+"&hostName="+encodeURIComponent(hostName)+"&selCmd="+encodeURIComponent(p)+"&txtCmd1="+encodeURIComponent(p)+"&displayTxtCmd="+encodeURIComponent(filterEncode(f))+"&arguments="+encodeURIComponent(s)+"&txtCmd="+encodeURIComponent(d)+"&response="+g+"&txtTimeout="+r+j+"&isAgentBased="+encodeURIComponent(isAgentBased)+"&rmtOrExtAgentIp="+encodeURIComponent(rmtOrExtAgentIp)+"&agentOS="+encodeURIComponent(l);
var q=(parseInt(r)*1000)+10000;if(d=="RC_42"||d=="RC_43"){var n=Ext.getCmp("user_session_id").getValue();v=v+"user_session_id="+n;}Ext.getCmp("execute").setDisabled(true);if(isAgentBased=="false"){agentIP=rmtOrExtAgentIp;}if(d=="compmgmt"||d=="mstsc"){var u=t.findField("serv_user").getValue().trim();
if(d=="compmgmt"&&Ext.isEmpty(u)){Ext.getCmp("execute").setDisabled(false);var h=Ext.MessageBox.show({title:RCATitle,width:300,msg:'<div style="min-height:35px;">'+userNameTitle+", <br>"+validUserNameTitle+".</div>",modal:true,maskCls:"windowModal",buttons:Ext.MessageBox.OK,icon:Ext.MessageBox.WARNING});
Ext.WindowManager.bringToFront(h);}else{Ext.Ajax.request({url:"/final/monitor/RemoteControlActionUtils.jsp?cmd="+d+"&agentIP="+agentIP+"&username="+encodeURIComponent(u)+"&isAgentBased="+isAgentBased+"&rmtOrExtAgentIp="+rmtOrExtAgentIp,method:"POST",timeout:q,scope:this,success:function(z){Ext.getCmp("execute").setDisabled(false);
rcLoadMask.hide();var B;if(d=="compmgmt"){if(g=="Yes"||g=="yes"){B=computerManagementTitle+". <br>"+downloadTitle+"."+batfileTitle+"..";}else{B=remoteControlSuccessTitle;}window.location.href="../images/RemoteControl/compmgmt_"+agentIP+".bat";}else{if(g=="Yes"||g=="yes"){B=RDPInitiateTitle+". "+downTitle+" ."+rdpTitle+"..";
}else{B=remoteControlSuccessTitle;}var A="../images/RemoteControl/"+agentIP+".rdp";var C=agentIP+".rdp";this.downloadRCAFile(C);}Ext.getCmp("execute").setDisabled(false);rcLoadMask.hide();var x=Ext.getCmp("remote_cmd");var y="<ul align='center' style='margin:10px; width:95%; height:93%; display:table;' class='f14-normal'><div style='text-align:center; vertical-align:middle;display:table-cell;'><div><img src='"+imgPath+"/success_msg_icon.png'></div>";
y=y+"<div style='margin-top:15px;'><span style='color:"+fontColorCode+";'><li>"+B+"</li></span></div></div></ul>";var w=commandTitle+" - "+d;if(d=="RC_24"){w=outputTitle;}x.add({xtype:"panel",margin:"0 10 10 10",title:w,bodyStyle:{"overflowY":"auto","box-shadow":"none"},border:true,bodyCls:"configWinBody",header:{style:{"border":"0px","background":"transparent !important","padding-left":"0px"},},height:c+10,id:"updatepanel",html:y});
x.doLayout();o.show();},failure:function(){Ext.getCmp("execute").setDisabled(false);rcLoadMask.hide();var w=Ext.getCmp("remote_cmd");var x="<ul align='center' class='f11-normal' style='margin:10px; width:95%; height:93%; display:table;'><div style='text-align:center; vertical-align:middle;display:table-cell;'><div><img src='"+imgPath+"/error_msg_icon.png'></div>";
x=x+"<div style='margin-top:15px;'><span style='color:"+fontColorCode+";'><li>"+timedoutTitle+"</li></span></div></div></ul>";w.add({xtype:"panel",margin:10,height:c,cls:"formOuter",id:"updatepanel",html:x});w.doLayout();o.show();}});}}else{if(d=="ping"&&Ext.isEmpty(s)){Ext.getCmp("execute").setDisabled(false);
var h=Ext.MessageBox.show({title:RCATitle,width:300,msg:"<div>"+validIPTitle+".</div>",modal:true,maskCls:"windowModal",buttons:Ext.MessageBox.OK,icon:Ext.MessageBox.WARNING,fn:function(w){Ext.getCmp("arugumentsTextBox").focus(true);}});Ext.WindowManager.bringToFront(h);}else{if(d.startsWith("shutdown")){var i="";
if(d[d.length-1]=="r"){i=rebootTitle+"..";}else{if(d[d.length-1]=="s"){i=shutdownTitle+"..";}}Ext.getCmp("execute").setDisabled(false);var a=Ext.getCmp("remote_cmd");var m="<ul align='center' style='margin:10px; width:95%; height:93%; display:table;' class='f14-normal'><div style='text-align:center; vertical-align:middle;display:table-cell;'><div><img src='"+imgPath+"/info_mgs_icon.png'></div>";
m=m+"<div style='margin-top:15px;'>"+i+"</div></div></ul>";a.add({xtype:"panel",margin:10,height:c,cls:"formOuter",id:"updatepanel",html:m});a.doLayout();o.show();}else{rcLoadMask.show();}Ext.Ajax.request({url:"/final/monitor/RemoteControlActionp.jsp",method:"POST",params:v,timeout:q,scope:this,success:function(D){Ext.getCmp("execute").setDisabled(false);
rcLoadMask.hide();var A=D.responseText;var I=Ext.decode(A);if(!Ext.isEmpty(I)){var H=I["errorMessage"];if(H!=null&&H!="-"){}else{if(!d.startsWith("shutdown")){var M=I["output"];var x=Ext.getCmp("remote_cmd");var G=I["isGridView"];if(G!="undefined"&&G!=undefined&&G=="true"){var J=new Array();var C=new Array();
var z=I["gridJson"];var y=z["tableColumns"];var w=z["gridValues"];var B=z["gridTitle"];var F=0;if(w.length>0){for(var L in y){J.push({name:"COLUMVal_"+F,type:"string"});C.push({header:y[L],dataIndex:"COLUMVal_"+F,align:"left",flex:1,sortable:true,});F++;}var K=Ext.data.Store({fields:J,data:w,proxy:{type:"ajax",reader:{type:"json"}}});
if(d.indexOf("wmic os list")>-1){x.add({xtype:"panel",bodyStyle:"overflowY: auto",margin:"5 10 0 10",border:false,cls:"formOuter",height:30,id:"updatepanel",html:'<span class="f13-bold" style="margin: 5px 0 0px 10px;display: block;">'+WMITitle+"..</span>"});c=c-30;x.add({xtype:"grid",store:K,margin:"0 10 5 10",title:'<span class="f13-bold">'+B+"</span>",cls:"gridSkin",height:c+10,bodyStyle:"overflowY: auto",columns:C,});
}else{x.add({xtype:"grid",store:K,margin:"5 10 5 10",title:'<span class="f13-bold">'+B+"</span>",cls:"gridSkin",height:c+10,bodyStyle:"overflowY: auto",columns:C,});}}else{x.add({xtype:"panel",bodyStyle:"overflowY: auto",margin:10,border:false,cls:"formOuter",height:c,id:"updatepanel",html:M});}}else{var E=commandTitle+" - "+d;
if(d=="RC_24"){E=outputTitle;}x.add({xtype:"panel",scroll:true,margin:"0 10 10 10",title:E,bodyStyle:{"overflowY":"auto","box-shadow":"none"},border:true,bodyCls:"configWinBody",header:{style:{"border":"0px","background":"transparent !important","padding-left":"0px"},},height:c+10,id:"updatepanel",html:M});
}x.doLayout();o.show();}}}},failure:function(){Ext.getCmp("execute").setDisabled(false);rcLoadMask.hide();var w=Ext.getCmp("remote_cmd");var x="<ul align='center' style='margin:10px; width:95%; height:93%; display:table;' class='f14-normal'><div style='text-align:center; vertical-align:middle;display:table-cell;'><div><img src='"+imgPath+"/error_msg_icon.png'></div>";
x=x+"<div style='margin-top:15px;'>"+timedoutTitle+"</div></div></ul>";w.add({xtype:"panel",margin:10,height:c,cls:"formOuter",id:"updatepanel",html:x});w.doLayout();o.show();}});}}}},downloadRCAFile:function(a){Ext.defer(function(){window.location.href="../monitor/eg_scripts/RemoteControlAction/data/RCAFileDownload.jsp?fileName="+encodeURIComponent(a);
},500);},loadFormData:function(){var d=this.getRemotecontrolactionForm().getForm();var c="";var e="";if(init_test_name=="ChangeLoginTest"||init_test_name=="CtxXcXDSiteTest"||init_test_name=="CtxXcXDSiteSiteTest"||init_test_name=="CtxXcXDCGroupTest"||init_test_name=="CtxXcXDCBrMachTest"||init_test_name=="ADUserLockOutTest"||init_test_name=="CitrixLicenseTest"||init_test_name=="ADUsersTest"||init_test_name=="CtxXcXDDesktopsTest"){e="hostname="+hostName+"&comptype="+init_comp_type+"&layername="+init_layer_name+"&test="+init_test_name;
}else{c=Ext.getCmp("usernames").getValue();if(c==null||c=="-1"){var a=d.findField("user_session_id");a.setValue("-1");a.hide();var b=d.findField("user_process_name");b.setValue("-1");Ext.getCmp("user_process_name").hide();Ext.getCmp("execute").setVisible(false);return;}e="hostname="+hostName+"&comptype="+init_comp_type+"&layername="+init_layer_name+"&test="+init_test_name+"&selected_user_name="+encodeURIComponent(c);
}rcLoadMask.show();Ext.Ajax.request({url:"/final/monitor/RemoteControlActionUserInfo.jsp?"+e,method:"POST",scope:this,timeout:60000,success:function(j){var g=j.responseText;var n=Ext.decode(g);var t=d.findField("user_session_id");t.getStore().loadRawData(n["sessionIdsOpts"]);var r=n["pageParams"]["selectedSessionId"];
t.setValue("-1");if(r=="-1"){Ext.getCmp("user_session_id").hide();}else{Ext.getCmp("user_session_id").show();}singleSessionId=n["pageParams"]["singleSessionId"];var o=d.findField("user_process_name");o.getStore().loadRawData(n["processOpts"]);var i=n["pageParams"]["selectedProcess"];o.setValue("-1");
if(i=="-1"){Ext.getCmp("user_process_name").hide();}else{Ext.getCmp("user_process_name").show();}var f=d.findField("msg_box");f.setValue(n["pageParams"]["arguments"]);var k=d.findField("logonModes");k.getStore().loadRawData(n["logonModesOpts"]);var h=n["pageParams"]["selectedLogonMode"];k.setValue(h);
if(h=="-1"){Ext.getCmp("logonModes").hide();}else{Ext.getCmp("logonModes").show();}var m=d.findField("delivery_grp_name");m.getStore().loadRawData(n["deliveryGroupOpts"]);var l=n["pageParams"]["selectedLogonMode"];m.setValue(l);if(l=="-1"){Ext.getCmp("delivery_grp_name").hide();}else{Ext.getCmp("delivery_grp_name").show();
}var q=d.findField("machine_name");q.getStore().loadRawData(n["machineNameOpts"]);var p=n["pageParams"]["selectedLogonMode"];q.setValue(p);if(p=="-1"){Ext.getCmp("machine_name").hide();}else{Ext.getCmp("machine_name").show();}var s=d.findField("ad_username");s.getStore().removeAll();s.getStore().loadRawData(n["adUsernamesOpts"]);
s.setValue("-1");Ext.getCmp("ad_username").hide();if(c!=-1){this.changeCommand();}},failure:function(g){Ext.getCmp("execute").setVisible(false);rcLoadMask.hide();Ext.MessageBox.alert(actionTitle,failedetailsLbl);var i=this.getRemotecontrolactionForm().getForm();var f=i.findField("user_session_id");f.setValue("-1");
var h=i.findField("user_process_name");h.setValue("-1");Ext.getCmp("user_process_name").hide();}});},loadActionData:function(){var k;var j=false;var c=Ext.getCmp("remote_cmd");if(c!=null){c.removeAll();}var i=Ext.getCmp("rmt_cmds").getValue();if(i=="-1"){this.loadDefaultFormData();return;}var d=this.getRemotecontrolactionForm().getForm();
var g=d.findField("rmt_cmds").displayTplData[0].displayField;d.findField("usernames").hide();d.findField("ad_username").hide();d.findField("ctx_user_machine_name").hide();d.findField("license_username").hide();d.findField("license_machinename").hide();d.findField("fileupload").hide();d.findField("custom_taskname").hide();
d.findField("outputRqrd").hide();d.findField("timeOutTextbox").hide();d.findField("outputRqrd").setValue("Yes");d.findField("ad_password").hide();d.findField("ad_confirm_password").hide();Ext.getCmp("upload").setVisible(false);Ext.getCmp("execute").setVisible(false);Ext.getCmp("arugumentsTextBox").setValue("");
d.findField("shadow_mode").hide();init_test_name=i;if(i.indexOf(":")>-1){k=i.substring(0,i.indexOf(":"));init_test_name=i.substring(i.indexOf(":")+1);}else{j=true;}if(i=="fileupload"){d.findField("serv_user").hide();d.findField("msg_box").hide();d.findField("user_session_id").hide();d.findField("user_process_name").hide();
d.findField("logonModes").hide();d.findField("delivery_grp_name").hide();d.findField("machine_name").hide();d.findField("delivery_group_status").hide();d.findField("cmdSyntax").hide();d.findField("fileupload").show();d.findField("fileupload").setRawValue("");var f=Ext.getCmp("arugumentsTextBox");f.hide();
d.findField("custom_taskname").show();d.findField("custom_taskname").setValue("");var a=Ext.getCmp("upload");a.setVisible(true);if(!a.isDisabled()){a.setDisabled(true);}}else{if(init_test_name=="OS"||init_test_name=="Other"){d.findField("serv_user").hide();d.findField("msg_box").hide();d.findField("user_session_id").hide();
d.findField("user_process_name").hide();d.findField("logonModes").hide();d.findField("delivery_grp_name").hide();d.findField("machine_name").hide();d.findField("delivery_group_status").hide();if(k=="Other"){d.findField("cmdSyntax").show();d.findField("cmdSyntax").setValue("");d.findField("arugumentsTextBox").hide();
}else{d.findField("cmdSyntax").hide();if(k=="RC_47"||k=="RC_44"||i.startsWith("FILE#")||k=="typeperf -q -y"||g=="List all services"){d.findField("arugumentsTextBox").hide();}else{d.findField("arugumentsTextBox").show();}}if(k=="mstsc"||k=="compmgmt"){d.findField("serv_user").setValue("");d.findField("serv_user").show();
d.findField("arugumentsTextBox").hide();}else{var h=d.findField("arugumentsTextBox");var b=publicJson["arguments"][k];var e=publicJson["arguments"][k+"_LABEL"];h.emptyText=b;h.setFieldLabel(argumentsLbl);if(e!=undefined){h.setFieldLabel(e);}h.applyEmptyText();}Ext.getCmp("execute").setVisible(true);}else{d.findField("serv_user").hide();
d.findField("cmdSyntax").hide();d.findField("arugumentsTextBox").hide();d.findField("msg_box").hide();d.findField("user_session_id").hide();d.findField("user_process_name").hide();d.findField("logonModes").hide();d.findField("delivery_grp_name").hide();d.findField("machine_name").hide();d.findField("delivery_group_status").hide();
d.findField("user_session_id").setValue(singleSessionId);d.findField("user_process_name").setValue("-1");d.findField("msg_box").setValue("none");d.findField("logonModes").setValue("-1");if(j){var f=Ext.getCmp("arugumentsTextBox");f.show();f.emptyText="none";f.applyEmptyText();Ext.getCmp("execute").setVisible(true);
Ext.getCmp("execute").setDisabled(false);}else{if(k=="RC_15"||k=="RC_36"||k=="RC_37"||k=="RC_49"||k=="RC_51"||k=="RC_52"||k=="RC_53"||k=="RC_55"){d.findField("usernames").hide();Ext.getCmp("execute").setVisible(true);}else{if(k=="RC_29"){var h=d.findField("arugumentsTextBox");h.setFieldLabel(ad_username_label);
h.emptyText="Enter username";h.applyEmptyText();d.findField("arugumentsTextBox").show();d.findField("usernames").hide();Ext.getCmp("execute").setVisible(true);}else{rcLoadMask.show();d.findField("outputRqrd").hide();d.findField("timeOutTextbox").hide();Ext.getCmp("execute").setVisible(false);Ext.Ajax.request({url:"/final/monitor/RemoteControlActionSessionJson.jsp?comptype="+init_comp_type+"&layername="+init_layer_name+"&test="+init_test_name+"&task_name="+k+"&port="+init_port+"&isAgentBased="+isAgentBased+"&rmtOrExtAgentIp="+rmtOrExtAgentIp,method:"POST",scope:this,timeout:300000,success:function(n){if(init_test_name=="ChangeLoginTest"||init_test_name=="CtxXcXDSiteTest"||init_test_name=="CtxXcXDSiteSiteTest"||init_test_name=="CtxXcXDCGroupTest"||init_test_name=="CtxXcXDCBrMachTest"||init_test_name=="ADUserLockOutTest"||init_test_name=="CitrixLicenseTest"||init_test_name=="ADUsersTest"||init_test_name=="CtxXcXDDesktopsTest"){this.loadFormData();
}else{rcLoadMask.hide();d.findField("usernames").show();var s=Ext.decode(n.responseText);var r=d.findField("usernames");r.getStore().removeAll();r.getStore().loadRawData(s["usernamesOpts"]);r.setValue("-1");var o=Ext.getCmp("remote_control").getHeight();var q=o-Ext.getCmp("remotecontrolform").getHeight()-40;
var p=s["usernamesOpts"];if(p.length==1){d.findField("usernames").hide();var t=Ext.getCmp("remote_control").getHeight();var l=Ext.getCmp("remote_cmd");l.removeAll();var m="<ul align='center' class='f11-normal' style='margin:10px; width:100%; height:100%; display:table;'><div style='text-align:center; vertical-align:middle;display:table-cell;'><div><img src='"+imgPath+"/info_mgs_icon.png'></div>";
m=m+"<div style='margin-top:15px;'><span style='color:"+fontColorCode+";'><li>No Users found!</li></span></div></div></ul>";l.add({xtype:"panel",margin:10,cls:"formOuter",height:q,border:false,html:m});l.doLayout();l.show();}}},failure:function(l){rcLoadMask.hide();alert("failure...");}});}}}}}},loadSessionFormData:function(){var a=Ext.getCmp("remote_cmd");
if(a!=null){a.removeAll();}this.loadFormData();},changelogonModes:function(){var c=Ext.getCmp("remote_cmd");if(c!=null){c.removeAll();}var a=Ext.getCmp("logonModes").getValue();if(a=="-1"){var b=this.getRemotecontrolactionForm().getForm();b.findField("msg_box").hide();b.findField("user_session_id").hide();
b.findField("user_process_name").hide();Ext.getCmp("execute").setVisible(false);}else{Ext.getCmp("execute").setVisible(true);}},changeSessionId:function(){var d=Ext.getCmp("remote_cmd");if(d!=null){d.removeAll();}Ext.getCmp("execute").setVisible(true);var b=this.getRemotecontrolactionForm().getForm();
var c=Ext.getCmp("rmt_cmds").getValue();c=c.substring(0,c.indexOf(":"));var a=Ext.getCmp("user_session_id").getValue();if(c=="-1"){b.findField("msg_box").hide();b.findField("user_session_id").hide();b.findField("user_process_name").hide();b.findField("logonModes").hide();Ext.getCmp("execute").setVisible(false);
}else{if(a=="-1"){b.findField("msg_box").hide();b.findField("user_session_id").show();b.findField("user_process_name").hide();b.findField("logonModes").hide();Ext.getCmp("execute").setVisible(false);}else{if(c=="RC_0"||c=="RC_2"||c=="RC_54"||c=="RC_3"||c=="RC_4"||c=="RC_17"||c=="RC_18"){b.findField("msg_box").hide();
b.findField("user_session_id").show();b.findField("user_process_name").hide();b.findField("logonModes").hide();}else{if(c=="RC_5"){b.findField("msg_box").show();b.findField("user_session_id").show();b.findField("user_process_name").hide();b.findField("logonModes").hide();}else{if(c=="RC_6"){Ext.getCmp("execute").setVisible(false);
this.getRemotecontrolactionForm().loadSessionData();}else{if(c=="RC_8"){Ext.getCmp("execute").setVisible(false);this.getRemotecontrolactionForm().loadSessionData();}else{if(c=="RC_9"){Ext.getCmp("execute").setVisible(false);this.getRemotecontrolactionForm().loadSessionData();}else{if(c=="RC_14"){b.findField("msg_box").hide();
b.findField("user_session_id").hide();b.findField("user_process_name").hide();b.findField("logonModes").hide();b.findField("user_session_id").setValue(singleSessionId);b.findField("user_process_name").setValue("-1");b.findField("msg_box").setValue("none");b.findField("logonModes").setValue("-1");Ext.getCmp("execute").setVisible(true);
}else{b.findField("msg_box").hide();b.findField("user_session_id").show();b.findField("user_process_name").hide();b.findField("logonModes").hide();}}}}}}}}},changeProcessName:function(){var b=Ext.getCmp("remote_cmd");if(b!=null){b.removeAll();}var a=this.getRemotecontrolactionForm().getForm();if(Ext.getCmp("user_process_name").getValue()=="-1"){Ext.getCmp("execute").setVisible(false);
}else{Ext.getCmp("execute").setVisible(true);}},changeLicenseUsername:function(){var a=Ext.getCmp("remote_cmd");if(a!=null){a.removeAll();}if(Ext.getCmp("license_username").getValue()=="-1"){Ext.getCmp("execute").setVisible(false);}else{Ext.getCmp("execute").setVisible(true);}},changeLicenseMachinename:function(){var a=Ext.getCmp("remote_cmd");
if(a!=null){a.removeAll();}if(Ext.getCmp("license_machinename").getValue()=="-1"){Ext.getCmp("execute").setVisible(false);}else{Ext.getCmp("execute").setVisible(true);}},changeADUsername:function(){var a=this.getRemotecontrolactionForm().getForm();var c=Ext.getCmp("remote_cmd");if(c!=null){c.removeAll();
}var b=Ext.getCmp("rmt_cmds").getValue();b=b.substring(0,b.indexOf(":"));Ext.getCmp("ad_password").hide();Ext.getCmp("ad_confirm_password").hide();if(Ext.getCmp("ad_username").getValue()=="-1"){Ext.getCmp("execute").setVisible(false);}else{if(b=="RC_30"){Ext.getCmp("ad_password").show();Ext.getCmp("ad_confirm_password").show();
}Ext.getCmp("execute").setVisible(true);}}});function checkspace(b){var a;if(typeof(b)=="object"){a=b.value;}else{a=b;}for(count=0;count<a.length;count++){if(a.charAt(count)==" "){return false;}}return true;}function checkspecialChar(c,b){if(typeof(c)=="object"){obj_val=c.value;}else{obj_val=c;}for(var a=0;
a<obj_val.length;a++){check_char=b.indexOf(obj_val.charAt(a));if(check_char>=0){return false;}}return true;}