<!DOCTYPE html>

<%@ include file = "EgTrackerA.jsp"%>
<%@ page import = "com.egurkha.*"%>
<%@ page import = "com.egurkha.ini.*"%>
<%@ page import = "com.egurkha.util.*"%>
<%@ page import = "com.eg.EgInstallInfo" %>
<%@ page import = "com.eg.IniFile"%>
<%@ page import = "com.eg.EgURLEncoder"%>
<%@ page import = "com.eg.EgServicesInfo"%>
<%@ page import = "java.util.*"%>
<%@ taglib prefix = "egui" uri = "../WEB-INF/eg-taglib.tld"%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ include file="listSearchJson.jsp"%>

<%
	response.setHeader("Cache-Control", "no-store");
	response.setHeader("Pragma", "no-cache");
	response.setDateHeader("Expires", -1);

	String urname =  request.getParameter("qctr");
	String reqFrom = request.getParameter("reqfrom");
	String userName = request.getParameter("username");
	String dispUserName = request.getParameter("dispUserName");
	String showAlert = request.getParameter("showAlert");
	if (urname == null)
	{
		urname = "0";
	}
	reqFrom = (reqFrom !=null && reqFrom.length()>0)?reqFrom:"navlink";
	if (dispUserName == null || dispUserName.length() == 0)
	{
		dispUserName = "-1";
		urname = "0";
	}
	else
	{
		urname = "1";
	}
	dispUserName = StringUtils.decodeSecurityChar(dispUserName);
	userName = StringUtils.decodeSecurityChar(userName);

	if (StringUtils.isNull(showAlert))
	{
		showAlert = "";
	}
	
	if (StringUtils.isNull(showAlert))
	{
		showAlert = "";
	}
	String urlStr = "EgChangeUserProfile/data/EgMailAlertSuppressJson.jsp?qctr="+urname+"&reqfrom="+reqFrom;
	if (!userName.equals("-1"))
	{
		urlStr = urlStr + "&userID="+EgURLEncoder.encode(StringUtils.encodeSecurityChar(userName),"UTF-8");
	}
	EgServicesInfo servicesInfo = new EgServicesInfo("manager");
	boolean isFilterMailAlertsEnabled = servicesInfo.isFilterMailAlertsEnabled();
	servicesInfo = null;
	String usrCache = dispUserName;
	String usrCacheValue = userName;
	if (usrCache.indexOf("\\") != -1)
	{
		usrCache = StringUtils.replace(usrCache,"\\","\\\\");
	}
	if (usrCacheValue.indexOf("\\") != -1)
	{
		usrCacheValue = StringUtils.replace(usrCacheValue,"\\","\\\\");
	}
%>

<html>
<head>
<title>Change user profile</title>
<meta charset="utf-8">

<script type="text/javascript" src="../extjs/ext-all.js"></script>


<!-- Fancy Scroll-->
<script src="/final/jquery/jquery.js"></script>
<script src="/final/styles/jscrollpane/jquery.jscrollpane.js" ></script>
<script src="/final/styles/jscrollpane/jquery.mousewheel.js" ></script>
<script src="/final/styles/jscrollpane/mwheelIntent.js" ></script>
<link rel="stylesheet" href="/final/styles/jscrollpane/jquery.jscrollpane.css"/>

<script language="JavaScript1.2" src="/final/scripts/eg_DateUtil.js"></script>
<script language="javascript1.2" src="eg_scripts/ajaxutils.js"></script>
<script language="Javascript1.2" src="eg_scripts/date.js"></script>
<script language="javascript1.2" src="eg_scripts/validate.js"></script>
<script language="JavaScript1.2" src="../scripts/<%=script_src%>"></script>
<script src="/final/scripts/utilities/EncodeDecodeParams.js"></script>

<script language="javascript">
	var csrfToken = '<%=strCsrfToken%>';
	var publicJSON = '';
	var userElementJSON = '';
	var userMailJSON = '';
	var appCnt = '';
	var mailFilterOption = '';

	var userIDValidationMsg54 = '<egui:intnl text="admin.service.Disassociate"/>';
	var userIDValidationMsg55 = '<egui:intnl text="admin.service.Associate"/>';
	var userIDValidationMsg56 = '<egui:intnl text="admin.user.Auto-associate segments/services/service groups/zones/components to other users"/>';
	var userIDValidationMsg57 = '<egui:intnl text="admin.user.Apply the chosen logo for other modules"/>';
	var userIDValidationMsg58 = '<egui:intnl text="admin.title.MAIL ALERTS FILTERING"/>';
	var userIDValidationMsg59 = '<egui:intnl text="admin.user.User ID"/>';
	var userIDValidationMsg60 = '<egui:intnl text="admin.user.Choose a user"/>';
	var userIDValidationMsg61 = '<egui:intnl text="admin.user.Please Choose a day"/>';
	var userIDValidationMsg62 = '<egui:intnl text="admin.logo.File name is not allowed in DBL(Chinese,Korean,Japanese),since manager is SingleByte"/>';
	var userIDValidationMsg63 = '<egui:intnl text="admin.logo.Field is empty or the selected File does not have the extension"/>';
	var userIDValidationMsg64 = '<egui:intnl text="admin.user.Please enter valid Mail ID/Mobile number"/>';

	var radioOptionYes = '<egui:intnl text="admin.common.Yes"/>';
	var radioOptionNo = '<egui:intnl text="admin.common.No"/>';
	var NextBtn = '<egui:intnl text="admin.user.Next"/>';
	var submitBtn = '<egui:intnl text="admin.user.Submit"/>';
	var validateBtn = '<egui:intnl text="admin.user.Validate"/>';
	var label_1 = '<egui:intnl text="admin.service.Associated elements"/>';


	var radioOptionYes = '<egui:intnl text="admin.common.Yes"/>';
	var radioOptionNo = '<egui:intnl text="admin.common.No"/>';
	var radioOptionEnable = '<egui:intnl text="admin.user.Enable"/>';
	var radioOptionDisable = '<egui:intnl text="admin.user.Disable"/>';
	var filterMessage = '<egui:intnl text="admin.filter.EXCLUDED ELEMENTS FOR"/>';
	var filterMessage2 = '<egui:intnl text="admin.filter.INCLUDED ELEMENTS FOR"/>';
	var New = '<egui:intnl text="admin.user.New"/>';
	var alarmNotifyComplete = '<egui:intnl text="admin.user.Complete List"/>';
	
	var associatedUserIDs = '';
	var appURL = '<%=urlStr%>';
	var selectedUserID = '<%=usrCache%>';
	var selectedUserValID = '<%=usrCacheValue%>';
	var reqFrom = '<%=reqFrom%>';
	var isFilterMailAlertsEnabled;
	if ('<%=isFilterMailAlertsEnabled%>' == 'true' || '<%=isFilterMailAlertsEnabled%>' == true)
	{
		isFilterMailAlertsEnabled = true;
	}
	else
	{
		isFilterMailAlertsEnabled = false;
	}
	var isAlarmEnabled = false;

	var pageDiscription = '';
	if (reqFrom == "adduser")
	{
		pageDiscription = '<egui:intnl description="EgAddUser.jsp"/>.';
	}
	else
	{
		pageDiscription = '<egui:intnl description="EgChangeUserProfile.jsp"/>.';
	}
	var pageTitle = '';
	var pageTitle2 = '<egui:intnl text="admin.title.CHANGE USER PROFILE"/>';
	var pageTitle3 = '<egui:intnl text="admin.title.ELEMENT ASSOCIATION FOR"/>';
	var pageTitle4 = '<egui:intnl text="admin.title.MAIL/SMS ALERTS FILTERING FOR"/>';
	var pageTitle5 = '<egui:intnl text="admin.title.MODIFY USER"/>';
	var pageTitle = '<egui:intnl text="admin.title.MAIL/SMS ALERTS FILTERING FOR "/> \''+selectedUserID+"'";
	var pageTitle6 = '<egui:intnl text="admin.user.USER PREFERENCES FOR"/>';

	var intnlLabel1 = '<egui:intnl text="admin.user.No users have been configured"/>';
	var intnlLabel2 = '<egui:intnl text="admin.common.Domain"/>';
	var intnlLabel3 = '<egui:intnl text="admin.common.Local"/>';
	var intnlLabel4 = '<egui:intnl text="admin.user.Domain" />';
	var intnlLabel5 = '<egui:intnl text="No components have been associated with this user" />';
	var intnlLabel6 = '<egui:intnl text="admin.service.Associated elements"/>';
	var reqfrom = '<%=reqFrom%>';
	var backText = '<egui:intnl text="admin.header.Back"/>';
	var updateBtn = '<egui:intnl text="admin.user.Update"/>';
	var pageIntnl80 = '<egui:intnl text="admin.user.USER PREFERENCES"/>';
	var pageIntnl81 = '<egui:intnl text="admin.user.ELEMENTS ASSOCIATION"/>';
	var pageIntnl82 = '<egui:intnl text="admin.user.MAIL/SMS ALERTS FILTERING"/>';
	var pageIntnl83 = '<egui:intnl text="admin.user.BASIC INFORMATION"/>';
	var pageIntnl84 = '<egui:intnl text="admin.service.Assign and Add More"/>';
	var pageIntnl85 = '<egui:intnl text="admin.service.Finish"/>';
	var pageIntnl86 = '<egui:intnl text="admin.service.View associated elements"/>';
	var pageIntnl87 = '<egui:intnl text="admin.service.View excluded elements"/>';
	var pageIntnl88 = '<egui:intnl text="admin.user.Next"/>';
	var pageIntnl89 = '<egui:intnl text="admin.user.Please choose an associate type"/>';
	var pageIntnl90 = '<egui:intnl text="admin.user.Please choose filter by"/>';
	var pageIntnl91 = '<egui:intnl text="admin.user.Previous"/>';
	var pageIntnl92 = '<egui:intnl text="admin.user.New user has been created"/>';
	var pageIntnl93 = '<egui:intnl text="admin.common.All elements"/>';
	var pageIntnl94 = '<egui:intnl text="admin.common.Descriptors only"/>';
	var pageIntnl95 = '<egui:intnl text="admin.common.DESCRIPTORS INCLUDED FOR ALERTS"/>';
	var pageIntnl96 = '<egui:intnl text="admin.common.DESCRIPTORS EXCLUDED FROM ALERTS"/>';
	var showAlert = "<%=showAlert%>";
	var pageIntnl97 = '<egui:intnl text="admin.service.View included elements"/>';
	var pageIntnl98 = '<egui:intnl text="admin.user.The elements have been associated/disassociated successfully"/>';
	var pageIntnl99 = '<egui:intnl text="admin.user.Mail/SMS alert filters have been configured successfully"/>';
	var pageIntnl100 = '<egui:intnl text="admin.user.Request has been processed successfully"/>';

	var isConfigEnabled = '<%=EgInstallInfo.isConfigSupported%>';

	var probsErrorMessage = '<egui:intnl text="admin.error.Problem encountered while loading the user interface"/>';
	var requestTimeOut = '<egui:intnl text="admin.error.Response timed out"/>';
	var errorTitle = '<egui:intnl text="admin.user.Error"/>';

	Ext.onReady(function(){
		Ext.Ajax.extraParams = {"com.eg.CSRF_NONCE" : csrfToken};
		Ext.data.Connection.prototype.extraParams = {"com.eg.CSRF_NONCE" : csrfToken};
		Ext.data.ScriptTagProxy.prototype.extraParams = {"com.eg.CSRF_NONCE" : csrfToken};

		Ext.Ajax.on('requestexception', function (conn, response, options) {
			var errorStr = response.responseText;
			if (errorStr != undefined && errorStr != 'undefined' && errorStr.indexOf("customerror") != -1)
			{
				if (errorStr.indexOf("user-session-invalid") != -1)
				{
					callWindow(1);
				}
				else if (errorStr.indexOf("user-deleted") != -1)
				{
					callWindow(2);
				}
				else if (errorStr.indexOf("user-timedout") != -1)
				{
					callWindow(3);
				}
			}
			else
			{
				if (response.status == 302 || (response.timedout != undefined && response.timedout == true))
				{
					Ext.Msg.show({
						title : errorTitle,
						msg : requestTimeOut,
						buttons : Ext.Msg.OK,
						icon : 'iconError'
					});
				}
				else
				{
					console.log(response.responseText);
					Ext.Msg.show({
						title : errorTitle,
						msg : probsErrorMessage,
						buttons : Ext.Msg.OK,
						icon : 'iconError'
					});
				}
			}
		});
	});

</script>
<script src="../admin/MailAlertFilter/app/app.js"></script>
<egui:skin ui="admin"/>
</head>
<BODY>
	<div id="loadmask" class="x-mask-msg x-layer x-mask-msg-default" style="z-index: 19001;left:45%;top:35%;"><div class="x-mask-loading" style="position:relative">Loading...</div></div>
</BODY>
</HTML>
<%
	if(request.getQueryString()!=null)
	{
		session.setAttribute("adminLastAccessedURL","/final/admin/EgMailAlertFilter.jsp?"+request.getQueryString());
	}
	else
	{
		session.setAttribute("adminLastAccessedURL","/final/admin/EgMailAlertFilter.jsp?qctr=0&reqfrom=navlink");
	}
%>



