<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%@ taglib uri="/struts-tags" prefix="s" %>
<fmt:setBundle basename="param1" var="p1"/>
<fmt:message key="common.date.pattern.dateZH" var="dateZH" bundle="${p1}"/>
<fmt:message key="common.date.pattern.date_1" var="date_1" bundle="${p1}"/>
<fmt:message key="common.date.pattern.datetimeZH" var="datetimeZH" bundle="${p1}"/>
<fmt:message key="common.date.pattern.datetime_1" var="datetime_1" bundle="${p1}"/>
<style>
<!--
A:link {
    text-decoration: none;
    color: #003366;
}
-->
</style>

<%
    String localPath = request.getContextPath();

 %>
 <LINK rel=stylesheet type=text/css href="<%=localPath %>/jwapp/common/css/content_table.css">
  <table width="100%" height="75" border="0" leftmargin="0" bottommargin="0" topmargin="0" rightmargin="0">
    <tr>
     <td width="60%">
     
     </td>
     <td align="right" valign="bottom" style="color:#ffffff;">
     <div style="float:right; padding:10px;">
  		
  	 <div id="layout_north_changeSkin_container" class="divcss5" onclick="$('#layout_north_changeSkin').menu('show',{left:$(this).offset().left-20,top:64})" style="cursor:pointer;display:none !important;" onmouseover="this.style.background='#ccc';" onmouseout="this.style.background=''">
   		<img src="<%=localPath %>/images/main/top-icon4.png"  style="height:16px;vertical-align:middle;text-align:center;"/>
        <!-- <a href="javascript:void(0);" class="easyui-menubutton" data-options="iconCls:'icon-edit',menu:'#layout_north_changeSkin',duration:'50'">更换皮肤</a> -->
        <%-- <span style="font-size:12px;color:#fff;">修改皮肤</span> --%>
        <span style="font-size:12px;color:#fff;">修改皮肤</span>
        
        <!--换皮肤-->
		<div class="menu-active" style="display:none;" id="layout_north_cssDiv"></div>
		<div id="layout_north_changeSkin" class="easyui-menu" style="width: 120px;">
			<!-- <div data-options="iconCls:'icon-save'" onclick="changeTheme('default');">default</div> -->				
			<div onclick="changeTheme('default');location.reload();">默认</div>
			<div onclick="changeTheme('ztw_blue');location.reload();">蓝色</div>
			<div onclick="changeTheme('ztw_black');location.reload();">黑色</div>
			<div onclick="changeTheme('ztw_green');location.reload();">绿色</div>
			<div onclick="changeTheme('ztw_red');location.reload();">红色</div>
		</div>
		
     </div>&nbsp;
     <div class="divcss5" id="top_password"   style="display:inline;cursor:pointer;" onclick="doModifyPass();" onmouseover="this.style.background='#ccc';" onmouseout="this.style.background=''">
     <img src="<%=localPath %>/images/main/top-icon2.png"  style="height:16px;vertical-align:middle;text-align:center;"/>
              <span style="background-url:<%=localPath %>/images/main/top-icon2.png;font-size:12px;color:#fff;">密码修改</span>
     </div>&nbsp;
     <div class="divcss5" id="top_user"   style="display:inline;cursor:pointer;"  onmouseover="this.style.background='#ccc';" onmouseout="this.style.background=''">
     <img src="<%=localPath %>/images/main/top-icon1.png"  style="height:16px;vertical-align:middle;text-align:center;"/>
              <span style="font-size:12px;color:#fff;"><s:property value="#session.userInfo['EMNAME']"/></span>
     </div>&nbsp;
<!--      <div class="divcss5"   style="display:inline" onclick="showHelp(this);" onmouseover="this.style.background='#ccc';" onmouseout="this.style.background=''"> -->
<!--      <img src="<%=localPath %>/gaowj/images/icons/(08,09).png"  style="height:16px;vertical-align:middle;text-align:center;"/> -->
<!--               <span style="font-size:12px;color:#fff;">帮助</span> -->
<!--      </div>&nbsp; -->
     <div class="divcss5"   style="display:inline;cursor:pointer;" onclick="doMain('quit');" onmouseover="this.style.background='#ccc';" onmouseout="this.style.background=''">
     <img src="<%=localPath %>/images/main/top-icon3.png"  style="height:16px;vertical-align:middle;text-align:center;"/>
              <span style="font-size:12px;color:#fff;">退出</span>
     </div>

     </div>
     </td>
    </tr>
  </table>
  <div id="SendProduct" >  </div>
  <div id="modifypassDialog"  style="overflow:auto;">
    <form id="modifypassForm" method="post">
		<table  align="center"  style="margin-top:10px;">
			<tr>
				<td style="border-bottom:1px solid #ccc;height:30px;">
					<label>原来密码:</label>
					<input class="easyui-textbox" style="width:133px;margin-left:10px;" type="password" id="OLDPASS" name="FIELD_OLDPASS" data-options="required:true" />
				</td>
		    </tr>
			<tr>
				<td style="border-bottom:1px solid #ccc;height:30px;">
					<label>新的密码:</label>
					<input class="easyui-textbox" style="width:133px;margin-left:10px;" type="password" id="NEWPASS" name="FIELD_NEWPASS" data-options="required:true" />
				</td>
		    </tr>
			<tr>
				<td style="border-bottom:1px solid #ccc;height:30px;">
					<label>再次输入:</label>
					<input class="easyui-textbox" style="width:133px;margin-left:10px;" type="password" id="AGAINNEWPASS" name="FIELD_AGAINNEWPASS" data-options="required:true" />
				</td>
			</tr>
		</table>
	</form>
  </div>
  <div id="personInfo" style="left: 0px; top: 35px;">
            <div class="arrow"></div>
            <table border="0" cellpadding="0" cellspacing="0" class="tableStyle"
		style="width: 300px;line-height:25px;">
		<tr>
			<td colspan="2" align="center" style="text-align:center;font-size:13px;">
			  <span>用户信息</span>
			</td>
		</tr>
		<tr>
		   <td style="width:100px" class="tableStyleLable">
		     <span>操作人员:</span>
		   </td>
		   <td>
		    <span id="p_session_userName"><s:property value="#session.userInfo['EMNAME']"/></span>
		   </td>
		</tr>
		<tr>
		   <td style="width:100px" class="tableStyleLable">
		     <span>所属单位:</span>
		   </td>
		   <td>
		    <span id="p_session_userDepart"><s:property value="#session.userInfo['EMDEPARTNAME']"/></span>
		   </td>
		</tr>
		<tr>
		   <td style="width:100px" class="tableStyleLable">
		     <span>登录账户:</span>
		   </td>
		   <td>
		    <span id="p_session_userLoginid"><s:property value="#session.userInfo['EMID']"/></span>
		   </td>
		</tr>
		<tr>
		   <td style="width:100px" class="tableStyleLable">
		     <span>登录人IP:</span>
		   </td>
		   <td>
		    <span id="p_session_userLoginip"><s:property value="#session.userInfo['LOGINIP']"/></span>
		   </td>
		</tr>
		<tr>
		   <td style="width:100px" class="tableStyleLable">
		     <span>上次登录时间:</span>
		   </td>
		   <td>
		    <span id="p_session_userBeforetime"><s:property value="#session.userInfo['BEFORETIME']"/></span>
		   </td>
		</tr>
	</table>
            
        </div>
        <script type="text/javascript" src="<%=localPath %>/jwapp/common/js/jwAppCommonModule.js"></script>
<script type="text/javascript">
 
$(function() {
	
	//如果是v5原始版本那就显示换肤功能
	var localPath = '<%=localPath %>';
	if('true'=='<%=com.gaowj.business.util.PropUtil.getValue("openChangeSkin", "quartz_service", "false") %>'){
		$('#layout_north_changeSkin_container').show();
		$('#layout_north_changeSkin_container').css('display','inline');
		//初始化皮肤
		changeTheme('${cookie.easyuiTheme.value}');
	}
	
});
 
 $("#personInfo").hide();
 $("#modifypassDialog").hide();
 function doMain(idx){  
	  if(idx=='quit'){
	      $.messager.confirm('提示', '<fmt:message key="common.quit.click" bundle="${p1}"/>?', function(r) {
		     if (r) {
		        window.top.location = "<%=localPath %>/logout";
		     }
	      });
	  }else{
		  window.top.location = "<%=localPath %>/login"; 
	  }
  }
  
  function doModifyPass(){


      $("#modifypassDialog").show();
      $("#modifypassForm")[0].reset();
      $("#OLDPASS").textbox("setValue","");
      $("#NEWPASS").textbox("setValue","");
      $("#AGAINNEWPASS").textbox("setValue","");
      $('#modifypassDialog')
			.dialog(
					{
						iconCls : 'icon-ext-password',
						title : '密码修改',
						width : 300,
						height : 200,
						closed : false,
						cache : false,
						minimizable : false,
						maximizable : false,
						resizable : true,
						modal : true,
						buttons : [
								{
									text : '保存',
									iconCls : 'icon-ok',
									handler : function() {
										if (!($("#modifypassForm").validateSubmit()))
											return;
										if ($('#modifypassForm').form('validate')) {
											var v_entity = $("#modifypassForm").getFormVal();
											var v_result = jwAppCommonModel.jwAppsCommonActAction.modifyPass(v_entity);
											$('#modifypassDialog').dialog("close");
											$.messager.alert('提示',v_result.VALUE, "info");
										}
									}
								},
								{
									text : '返回',
									iconCls : 'icon-back',
									handler : function() {
									    $("#modifypassDialog").hide();
										$('#modifypassDialog').dialog('close');
									}
								} ]

					});
    }

$('#top_user').tooltip( {
	content : $('#personInfo').html(),
	showEvent : 'click',
	onShow : function() {
		var t = $(this);
		t.tooltip('tip').css( {
			backgroundColor : '#ffffff'
		//borderColor: '#666'
				}).unbind().bind('mouseenter', function() {
			t.tooltip('show');
		}).bind('mouseleave', function() {
			t.tooltip('hide');
		});
	}

});

/*****************修改皮肤*****************/
function changeTheme(themeName){
	if(themeName==''){
		themeName='default';
	}
	var $easyuiTheme = $('#easyuiTheme');
	var url = $easyuiTheme.attr('href');
	var urls = url.split("/");
	if (urls.length > 2) {
		urls[urls.length - 2] = themeName;
	}
	var href = '';
	for ( var i = 0; i <= urls.length - 1; i++) {
		href += urls[i];
		if (i != urls.length - 1) {
			href += '/';
		}
	}
	$easyuiTheme.attr('href', href);
	window.setTimeout(function() {
		selectSkinMenu();
	}, 0);//0表示尽可能早的执行

	$.cookie('easyuiTheme', themeName, {
		expires : 7
	});
	
}

/**
 * 选中当前的皮肤
 */
function selectSkinMenu() {
	var skinDiv = $("#layout_north_changeSkin div");
	var skinDivOne;
	var onclick;
	var layout_north_cssDiv = $("#layout_north_cssDiv")[0];

	for ( var i = 0; i <= skinDiv.length - 1; i++) {
		skinDivOne = $(skinDiv[i]);
		skinDivOne.css('border-color', '');
		skinDivOne.css('color', '');
		skinDivOne.css('background', '');
		onclick = skinDivOne.attr('onclick');
		if (typeof (onclick) == "undefined") {
			continue;
		}
		onclick = onclick.split("changeTheme('");
		if (onclick.length < 2) {
			continue;
		}
		onclick = onclick[1].split("'");
		onclick = onclick[0];
		if (onclick == $.cookie('easyuiTheme')) {
			skinDivOne.css('border-color', getStyle(layout_north_cssDiv, 'border-color'));
			skinDivOne.css('color', getStyle(layout_north_cssDiv, 'color'));
			skinDivOne.css('background', getStyle(layout_north_cssDiv, 'background'));
			skinDivOne.css('border-radius','5px');
		}
	}
}

/**
 * 获取class的属性值
 * 
 * @param obj
 * @param attr
 * @returns
 */
function getStyle(obj, attr) {
	var ie = !+"\v1";// 简单判断ie6~8
	if (attr == "backgroundPosition") {// IE6~8不兼容backgroundPosition写法,识别backgroundPositionX/Y
		if (ie) {
			return obj.currentStyle.backgroundPositionX + " " + obj.currentStyle.backgroundPositionY;
		}
	}
	if (obj.currentStyle) {
		return obj.currentStyle[attr];
	} else {
		return document.defaultView.getComputedStyle(obj, null)[attr];
	}
}

</script>