<commit_before><%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%>
<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%>

<%@ page import="edu.wustl.catissuecore.util.global.Constants"%>
<%@ page import="edu.wustl.common.util.global.ApplicationProperties"%>
<%@ page import="edu.wustl.common.util.XMLPropertyHandler"%>
<%@ page import="java.text.MessageFormat"%>

<link rel="STYLESHEET" type="text/css" href="css/dhtmlxtabbar.css" />
<link rel="stylesheet" type="text/css" href="css/styleSheet.css" />
<link rel="stylesheet" type="text/css" href="css/CascadeMenu.css" />
<link rel="stylesheet" type="text/css" href="css/catissue_suite.css" />

<script src="jss/script.js" type="text/javascript"></script>
<script src="jss/overlib_mini.js" type="text/javascript"></script>
<script src="jss/calender.js" type="text/javascript"></script>
<script src="jss/splitter.js" type="text/javascript"></script>
<script src="jss/ajax.js" type="text/javascript"></script>
<script src="jss/caTissueSuite.js" type="text/javascript"></script>

<html>
<tiles:importAttribute />
<head>
<title><bean:message key="app.name"/><bean:message key="app.version"/></title>

<!--Jitendra -->
<script language="JavaScript">
		var timeOut;
		var advanceTime;
		var lastRefreshTime;//timestamp in millisecond of last accessed through child page
		var pageLoadTime;
		var warnTimeout;
		var defTimeout;
		<%
			int timeOut = -1;
			int advanceTime = Integer.parseInt(XMLPropertyHandler.getValue(Constants.SESSION_EXPIRY_WARNING_ADVANCE_TIME));
			String tempMsg = ApplicationProperties.getValue("app.session.advanceWarning");
			Object[] args = new Object[] {"" + advanceTime};
			String advanceTimeoutMesg = MessageFormat.format(tempMsg,args);
			
			timeOut = -1;
				
			if(request.getSession().getAttribute(Constants.SESSION_DATA) != null) //if user is logged in
			{
				//timeOut = request.getSession().getMaxInactiveInterval();
				String timeOutToSet = XMLPropertyHandler
				.getValue(Constants.SESSION_TIME_OUT);
				if(timeOutToSet != null)
				{
				request.getSession().setMaxInactiveInterval(Integer.parseInt(timeOutToSet)*60);
				timeOut = request.getSession().getMaxInactiveInterval();
				}
			}
		%>


		timeOut = "<%= timeOut%>";	
		advanceTime = "<%= advanceTime%>";
		pageLoadTime = new Date().getTime(); //timestamp in millisecond of last pageload
		lastRefreshTime = pageLoadTime ; // last refreshtime in millisecond
		setAdvanceSessionTimeout(timeOut);
		
		function warnBeforeSessionExpiry()
		{	
			//check for the last refresh time,whether page is refreshed in child frame after first load.		
			if(lastRefreshTime > pageLoadTime)
			{
				
				var newTimeout = (lastRefreshTime - pageLoadTime)*0.001;
				newTimeout = newTimeout + (advanceTime*60.0);
				
				pageLoadTime = lastRefreshTime ;
				setAdvanceSessionTimeout(newTimeout);
				
			}
			else
			{
				defTimeout = setTimeout('sendToHomePage()', advanceTime*60*1000);
				var choice = confirm("<%= advanceTimeoutMesg %>");
			
				if(choice == 0) //cancel pressed, extend session
				{
					clearTimeout(defTimeout);
					sendBlankRequest();
					setAdvanceSessionTimeout(timeOut);
				}
			}
		}
		
		function setAdvanceSessionTimeout(ptimeOut) 
		{
			
			if(ptimeOut > 0)
			{
				var time = (ptimeOut - (advanceTime*60)) * 1000;
				warnTimeout = setTimeout('warnBeforeSessionExpiry()', time); //if session timeout, then redirect to Home page
			}
		}
		
		
		function sendToHomePage()
		{			
				<% 
				   Object obj = request.getSession().getAttribute(Constants.SESSION_DATA);			  			
				   if(obj != null) 
				   {
				%>			
				   var timeoutMessage = "<%= ApplicationProperties.getValue("app.session.timeout") %>";
				   alert(timeoutMessage);			  
			   
				   window.location.href = "Logout.do";
				<%
				   }
				%>		  
		}

		function detectApplicationUsageActivity()
		{
			var currentTime = new Date().getTime();
			var activationTime = currentTime - pageLoadTime;
			var advTime = (advanceTime * 1) + 1;
			
			if(((timeOut*1000) - activationTime) <= (advTime*60*1000)) {
				lastRefreshTime = new Date().getTime();
				sendBlankRequest();
				clearTimeout(warnTimeout);
				clearTimeout(defTimeout);
				setAdvanceSessionTimeout(timeOut);
			}
			
//			if (lastRefreshTime <= pageLoadTime)
//			{
//				lastRefreshTime = new Date().getTime();
//				clearTimeout(advanceTime*60*1000);
//				sendBlankRequest();
//			}
		}
		
		function getUmlModelLink()
		{
				var  frameUrl="<%=XMLPropertyHandler.getValue("umlmodel.link")%>";
				NewWindow(frameUrl,'name');
		}
		
		function getUserGuideLink()
		{
			var frameUrl = "<%=XMLPropertyHandler.getValue("userguide.link")%>";
			NewWindow(frameUrl,'name');
		}
	</script>
<!--Jitendra -->

<!-- Mandar 11-Aug-06 : For calendar changes -->
<script src="jss/calendarComponent.js"></script>
<SCRIPT>var imgsrc="images/";</SCRIPT>
<LINK href="css/calanderComponent.css" type=text/css rel=stylesheet>
<!-- Mandar 11-Aug-06 : calendar changes end -->

<!-- For Favicon -->
<link rel="shortcut icon" href="images/favicon.ico"
	type="image/vnd.microsoft.icon" />
<link rel="icon" href="images/favicon.ico"<commit_msg>Changes for fixing bug #15060<commit_after><%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%>
<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%>

<%@ page import="edu.wustl.catissuecore.util.global.Constants"%>
<%@ page import="edu.wustl.common.util.global.ApplicationProperties"%>
<%@ page import="edu.wustl.common.util.XMLPropertyHandler"%>
<%@ page import="java.text.MessageFormat"%>

<link rel="STYLESHEET" type="text/css" href="css/dhtmlxtabbar.css" />
<link rel="stylesheet" type="text/css" href="css/styleSheet.css" />
<link rel="stylesheet" type="text/css" href="css/CascadeMenu.css" />
<link rel="stylesheet" type="text/css" href="css/catissue_suite.css" />

<script src="jss/script.js" type="text/javascript"></script>
<script src="jss/overlib_mini.js" type="text/javascript"></script>
<script src="jss/calender.js" type="text/javascript"></script>
<script src="jss/splitter.js" type="text/javascript"></script>
<script src="jss/ajax.js" type="text/javascript"></script>
<script src="jss/caTissueSuite.js" type="text/javascript"></script>

<html>
<tiles:importAttribute />
<head>
<title><bean:message key="app.name"/> <bean:message key="app.version"/></title>

<!--Jitendra -->
<script language="JavaScript">
		var timeOut;
		var advanceTime;
		var lastRefreshTime;//timestamp in millisecond of last accessed through child page
		var pageLoadTime;
		var warnTimeout;
		var defTimeout;
		<%
			int timeOut = -1;
			int advanceTime = Integer.parseInt(XMLPropertyHandler.getValue(Constants.SESSION_EXPIRY_WARNING_ADVANCE_TIME));
			String tempMsg = ApplicationProperties.getValue("app.session.advanceWarning");
			Object[] args = new Object[] {"" + advanceTime};
			String advanceTimeoutMesg = MessageFormat.format(tempMsg,args);

			timeOut = -1;

			if(request.getSession().getAttribute(Constants.SESSION_DATA) != null) //if user is logged in
			{
				//timeOut = request.getSession().getMaxInactiveInterval();
				String timeOutToSet = XMLPropertyHandler
				.getValue(Constants.SESSION_TIME_OUT);
				if(timeOutToSet != null)
				{
				request.getSession().setMaxInactiveInterval(Integer.parseInt(timeOutToSet)*60);
				timeOut = request.getSession().getMaxInactiveInterval();
				}
			}
		%>


		timeOut = "<%= timeOut%>";
		advanceTime = "<%= advanceTime%>";
		pageLoadTime = new Date().getTime(); //timestamp in millisecond of last pageload
		lastRefreshTime = pageLoadTime ; // last refreshtime in millisecond
		setAdvanceSessionTimeout(timeOut);

		function warnBeforeSessionExpiry()
		{
			//check for the last refresh time,whether page is refreshed in child frame after first load.
			if(lastRefreshTime > pageLoadTime)
			{

				var newTimeout = (lastRefreshTime - pageLoadTime)*0.001;
				newTimeout = newTimeout + (advanceTime*60.0);

				pageLoadTime = lastRefreshTime ;
				setAdvanceSessionTimeout(newTimeout);

			}
			else
			{
				defTimeout = setTimeout('sendToHomePage()', advanceTime*60*1000);
				var choice = confirm("<%= advanceTimeoutMesg %>");

				if(choice == 0) //cancel pressed, extend session
				{
					clearTimeout(defTimeout);
					sendBlankRequest();
					setAdvanceSessionTimeout(timeOut);
				}
			}
		}

		function setAdvanceSessionTimeout(ptimeOut)
		{

			if(ptimeOut > 0)
			{
				var time = (ptimeOut - (advanceTime*60)) * 1000;
				warnTimeout = setTimeout('warnBeforeSessionExpiry()', time); //if session timeout, then redirect to Home page
			}
		}


		function sendToHomePage()
		{
				<%
				   Object obj = request.getSession().getAttribute(Constants.SESSION_DATA);
				   if(obj != null)
				   {
				%>
				   var timeoutMessage = "<%= ApplicationProperties.getValue("app.session.timeout") %>";
				   alert(timeoutMessage);

				   window.location.href = "Logout.do";
				<%
				   }
				%>
		}

		function detectApplicationUsageActivity()
		{
			var currentTime = new Date().getTime();
			var activationTime = currentTime - pageLoadTime;
			var advTime = (advanceTime * 1) + 1;

			if(((timeOut*1000) - activationTime) <= (advTime*60*1000)) {
				lastRefreshTime = new Date().getTime();
				sendBlankRequest();
				clearTimeout(warnTimeout);
				clearTimeout(defTimeout);
				setAdvanceSessionTimeout(timeOut);
			}

//			if (lastRefreshTime <= pageLoadTime)
//			{
//				lastRefreshTime = new Date().getTime();
//				clearTimeout(advanceTime*60*1000);
//				sendBlankRequest();
//			}
		}

		function getUmlModelLink()
		{
				var  frameUrl="<%=XMLPropertyHandler.getValue("umlmodel.link")%>";
				NewWindow(frameUrl,'name');
		}

		function getUserGuideLink()
		{
			var frameUrl = "<%=XMLPropertyHandler.getValue("userguide.link")%>";
			NewWindow(frameUrl,'name');
		}
	</script>
<!--Jitendra -->

<!-- Mandar 11-Aug-06 : For calendar changes -->
<script src="jss/calendarComponent.js"></script>
<SCRIPT>var imgsrc="images/";</SCRIPT>
<LINK href="css/calanderComponent.css" type=text/css rel=stylesheet>
<!-- Mandar 11-Aug-06 : calendar changes end -->

<!-- For Favicon -->
<link rel="shortcut icon" href="images/favicon.ico"
	type="image/vnd.microsoft.icon" />
<link rel="icon" href="images/favicon.ico"
{'fraction_non_alphanumeric': 0.1588347659980898, 'fraction_numerical': 0.010219675262655206, 'mean_word_length': 4.135360470819029, 'pattern_counts': {'":': 0, '<': 115, '<?xml version=': 0, '>': 113, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6295975', 'n_tokens_mistral': 4026, 'n_tokens_neox': 3386, 'n_words': 592}