EMV_SIDEBAR.jsp 5.35 KB
Newer Older
Thitichaipun Wutthisak committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139
<%@ page contentType="text/html; charset=UTF-8" language="java" %>
<%@ page import="com.csc.library.menu.Menu" %>
<%@ page import="com.csc.library.menu.AdminMenu" %>
<%@ page import="com.csc.library.utilities.UProfile"%>
<%@ page import="com.csc.library.utilities.ScreenHelper" %>
<%@ page import="com.csc.library.session.*"%>
<%@ page import="com.csc.library.entry.*"%>
<%@ page import="java.io.File,com.csc.library.util.ManageDocument" %>

<!-- Begin Side Bar -->
<%
	UProfile uprofile = null;
	int sharenote = 0;
	int num_basket = 0;
	if(session != null ) {
		uprofile = (UProfile)session.getAttribute("userprofile");
	}
	if( uprofile == null ){
		return;
	}

	ManageDocument manage = new ManageDocument();
	manage.setUProfile( uprofile );
	int newnote = manage.getNewDocument( uprofile.get("employeeid") );


	DbInquiry actor_incident_inq = new InitialInquiry(manage.getUProfile()).getDbInquiry("vw_transfer_share");
			actor_incident_inq.setColumn("*");
			actor_incident_inq.setFilter("TU_ACTOR_ID = '"+uprofile.get("employeeid")+"' AND "+
										  "(TRANSFER_CODE = '0' OR TRANSFER_CODE = '1') AND "+
				  						  "TU_STATUS = '0'");
			actor_incident_inq.refresh();
			if( actor_incident_inq.next() ){
				sharenote = actor_incident_inq.recCount();
				//out.println("====="+sharenote+"=====");
			}
//out.print("===== "+uprofile.get("employeeid"));
	DbInquiry basket = new InitialInquiry(manage.getUProfile()).getDbInquiry("vw_transfer_share");
	basket.setColumn("*");
	basket.setFilter("TFR_ACTOR_ID = '"+uprofile.get("employeeid")+"' AND "+
										  "TU_ACTOR_ID = '"+uprofile.get("employeeid")+"' AND "+
										  "TRANSFER_CODE = '1' AND "+
				  						  "TR_STATUS = '0'");
	basket.refresh();
	if( basket.next() ){
				num_basket = basket.recCount();
				//out.println("====="+num_basket+"=====");
			}

			//out.println("====="+uprofile+"=====");

%>
	<script type='text/javascript' src='/hr/dwr/engine.js'></script>
	<script type='text/javascript' src='/hr/dwr/util.js'></script>
	<script type='text/javascript' src='/hr/dwr/interface/SearchDWR.js'></script>
	<script language="javascript">
		var _errorHandler = function(message) {
			if(message != null ) {
				if (typeof message == "object" && message.name == "Error" && message.description) {
					alert("Error: " + message.description);
				} else if (message.toString().indexOf("0x80040111") == -1) {
					// Ignore NS_ERROR_NOT_AVAILABLE
					//alert(message);
				}
			}
		}
		//dwr.engine.setErrorHandler(function(message) {});
		dwr.engine.setErrorHandler(_errorHandler);
		function checkPM() {
			dwr.engine.beginBatch();
			SearchDWR.searchAll(new Array("PMINBOX","messageid,companyid,senderid","userid = '<%=uprofile.get("employeeid")%>' and flag='0'","messageid","langon"),pm); 
			dwr.engine.endBatch({	
			  async:false
			});
			setTimeout("checkPM();",300000);
		}
		var pm=function(data){
			var newpm = document.getElementById("newpm");
			if(newpm) {
				newpm.innerHTML = "["+data.length+"]";
			}
			if(data.length>0) {
				showPm();
			}  else {
				hiddenPm();
			}
		}
		function hiddenPm(){
			var icon_pm = document.getElementById("icon_pm");
			if(icon_pm) {
				icon_pm.src="../IMAGES/EMPVIEW/ICON-PM.gif";
			}
		}
		function showPm(){
			var icon_pm = document.getElementById("icon_pm");
			if(icon_pm) {
				icon_pm.src="../IMAGES/EMPVIEW/ICON_PM_SWAP.gif";
			}
		}
		addEvent(window, "load", checkPM);
	</script>

      <div class="user-info">
        <div class="employee-pic"><img id="employeepic" src="<%=uprofile.get("picture_path")%>" onload="resizeImg(this,120,120);" alt="Employee Picture" width="100" height="100" border="1" class="border-black" style="visibility: hidden;" /></div>
		<div class="strong"><%=uprofile.get("employeeid")%></div>
        <div class="strong"><%=uprofile.get("fullname")%></div>
        <%//if( !ScreenHelper.isIgnoreString( uprofile.get("jobname")) ) { %><div><%=uprofile.get("positionname")%></div><% // } %>
        <%//if( !ScreenHelper.isIgnoreString( uprofile.get("bu3name")) ) { %><div><%=uprofile.get("bu4name")%></div><% // } %>
        <% //if( !ScreenHelper.isIgnoreString( uprofile.get("companyname")) ) { %><div><%=uprofile.get("companyname")%></div><%// } %>
<%
	Menu menu = new AdminMenu(uprofile);
	String strMenuList = menu.getMenu();
	strMenuList=strMenuList.replace("[","");
	strMenuList=strMenuList.replace("]","");
	strMenuList=strMenuList.replace("{","<");
	strMenuList=strMenuList.replace("}",">");
%>
        <div class="admin-menu"><%=strMenuList %></div>
      </div>    
      <div class="box-gray-left">
      	<span id="inbox">
			<a href="/hr/MYNOTE/INBOX.jsp"><script language="JavaScript" type="text/javascript" >swapLang("Documents");</script></a>
			<span id="newnote">[<%=newnote %>]</span>
		</span><br> 
<!--         <span id="pm">
			<a href="PM_INBOX.jsp"><script language="JavaScript" type="text/javascript" >swapLang("Private Message");</script></a>
			<span id="newpm">[0]</span>
		</span><br> -->
		<span id="share_work">
			<a href="/hr/MYNOTE/SHARE_WORK.jsp"><script language="JavaScript" type="text/javascript" >swapLang("Share Work");</script></a>
			<span id="sharenote">[<%=sharenote %>]</span>
		</span><br> 
		<span id="assigned_work">
			<a href="/hr/MYNOTE/ASSIGNED_WORK.jsp"><script language="JavaScript" type="text/javascript" >swapLang("Tasks assigned");</script></a>
			<span id="num_basket">[<%=num_basket %>]</span>
		</span> 
      </div>
	  
      <!-- End Side Bar -->