Commit 41b6420a authored by prumde's avatar prumde

Updated for Setting userInfo in localStorage and provided link for explicitly...

Updated for Setting userInfo in  localStorage and provided link for explicitly opening respective catalog ( i.e. Sales / Purchase )

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@175127 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 5dd1dae8
<%System.out.println("***In Catalog.jsp****"); %> <%System.out.println("***In Catalog.jsp****"); %>
<%@page import="java.io.*"%> <%@page import="java.io.*"%>
<%@page import="java.util.*"%>
<%@page import="javax.naming.*"%>
<%@page import="org.json.*"%>
<%@page import="ibase.system.config.*"%>
<%@page import="ibase.webitm.webService.ejb.*"%>
<%@page import="ibase.webitm.utility.*"%> <%@page import="ibase.webitm.utility.*"%>
<%@page import="ibase.utility.*"%>
<%!
private InitialContext getInitialContext() throws ITMException
{
InitialContext ctx = null;
try
{
AppConnectParm appConnect = new AppConnectParm();
ctx = new InitialContext( appConnect.getProperty() );
}
catch( ITMException itme )
{
System.out.println( "ITMException : getInitialContext : "+ itme.getMessage() );
throw itme;
}
catch(Exception e)
{
System.out.println( "Exception : getInitialContext : "+ e.getMessage() );
throw new ITMException(e);
}
return ctx;
}
public JSONObject getUserDetails(UserInfoBean userInfo) throws ITMException, NamingException
{
JSONObject resultDtlJson = new JSONObject();
try
{
System.out.println("in get user dtl");
ExtServiceRemote extServices = (ExtServiceRemote) getInitialContext().lookup("ibase/ExtServiceEJB/remote");
System.out.println("User InfoBean in getUserDetails = "+userInfo);
userInfo = extServices.updateUseInfo(userInfo);
HashMap<String, String> resultMap = extServices.getLoginUserDetails( userInfo);
if( resultMap != null && resultMap.size() > 0 )
{
for ( Map.Entry<String, String> entry : resultMap.entrySet() )
{
resultDtlJson.put( entry.getKey(), entry.getValue() );
}
}
}
catch (Exception e)
{
System.out.println("Exception in getUserDetails "+e.getMessage());
e.printStackTrace();
}
System.out.println( "resultDtlJson-["+ resultDtlJson +"]" );
return resultDtlJson;
}
%>
<% <%
String userDetailStr = "{}";
String siteCode = "L2D01"; String siteCode = "L2D01";
String catalog = "local2do": String catalog = "local2do";
String loginCode = "";
//ibase.utility.UserInfoBean userInfo = ( ibase.utility.UserInfoBean )session.getAttribute("USER_INFO"); //ibase.utility.UserInfoBean userInfo = ( ibase.utility.UserInfoBean )session.getAttribute("USER_INFO");
ibase.utility.UserInfoBean userInfo = new ibase.utility.UserInfoBean( session.getAttribute("USER_INFO").toString() ); UserInfoBean userInfo = new UserInfoBean( session.getAttribute("USER_INFO").toString() );
if( userInfo == null ) if( userInfo == null )
{ {
System.out.println("[Forwarding to DirectAccess.jsp] .........."); System.out.println("[Forwarding to DirectAccess.jsp] ..........");
String directAccessPathStr = ".." + File.separator + ".." + File.separator + "jsp" + File.separator + "DirectAccess.jsp"; String directAccessPathStr = ".." + File.separator + ".." + File.separator + "jsp" + File.separator + "DirectAccess.jsp";
%>
<%
} }
else else
{ {
loginCode = userInfo.getLoginCode();
JSONObject resultDtlJson = getUserDetails(userInfo);
System.out.println("**************************resultDtlJson["+resultDtlJson+"]");
if(resultDtlJson != null)
{
userDetailStr = resultDtlJson.toString();
}
System.out.println("**************************Catalog["+userInfo.toString()+"]"); System.out.println("**************************Catalog["+userInfo.toString()+"]");
siteCode = userInfo.getSiteCode(); siteCode = userInfo.getSiteCode();
System.out.println("**************************Catalog site code["+siteCode+"]"); System.out.println("**************************Catalog site code["+siteCode+"]");
...@@ -28,16 +96,65 @@ else ...@@ -28,16 +96,65 @@ else
<html> <html>
<head> <head>
<style>
.content{
display: flex;
flex-direction: column;
display: grid;
position: relative;
padding: 20px;
margin: 20px;
background: #7bc6ff;
}
#catalog-link{
width: 150px;
height: 40px;
line-height: 40px;
color: white;
padding: 0;
padding-left: 15px;
font-size: 18px;
text-decoration: none;
}
#hint-message{
display: block;
height: 35px;
line-height: 35px;
color: red;
padding: 0;
padding-left: 25px;
}
</style>
<script type="text/javascript"> <script type="text/javascript">
function load() function load()
{ {
console.log('window loading'); console.log('window loading');
window.open('/ibase/ecm/<%=catalog%>/index.html?siteCode=<%=siteCode%>'); var userDetailJsonStr = '<%=userDetailStr%>';
var userDetailJson = JSON.parse( userDetailJsonStr );
userDetailJson.jti = '<%=loginCode%>';
userDetailJson.profileImageLink = "/ibase/resource/images/users/" + '<%=loginCode%>' + ".png?temp=" + Math.random();;
localStorage.setItem('userInfo', JSON.stringify( userDetailJson ) );
var w = window.open('/ibase/ecm/<%=catalog%>/index.html?siteCode=<%=siteCode%>', '_blank');
if( w )
{
var hintMessage = document.getElementById('hint-message');
hintMessage.style.display = 'none';
}
var openCatalog = document.getElementById('catalog-link');
openCatalog.setAttribute('href','/ibase/ecm/<%=catalog%>/index.html?siteCode=<%=siteCode%>');
} }
</script> </script>
</head> </head>
<body onload='load();'> <body onload='load();'>
<div class='content'>
<a id="catalog-link" href="" target="_blank"> Open <%=catalog%> catalog </a>
<span id="hint-message" > It seems popup blocker is enabled. To access Catalog site click on above link.</span>
</div>
<body> <body>
</body> </body>
</html> </html>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment