<%@ page contentType="text/html; charset=GBK"  errorPage="../error.jsp" %>
<%@ page import = "zr.zrpower.entity.sys.SessionUser"%>
<%@ page import = "zr.zrpower.common.util.SysPreperty"%>
<%@ page import = "zr.zrpower.flowengine.service.FlowControl"%>

<%@ page import = "zr.zrpower.ejb.sys.UIService"%>
<%@ page import = "zr.zrpower.flowengine.mode.config.FLOW_CONFIG_ACTIVITY"%>
<html>
<head>
<%
  SessionUser user = (SessionUser)session.getAttribute("userinfo");
  FlowControl FControl = new FlowControl();
  UIService userUI =new UIService();
  String strUnitid = request.getParameter("nodeId");
  String strNodeNo = request.getParameter("NodeNo");
  String th = request.getParameter("th");
  if (th==null){th="";}


  FLOW_CONFIG_ACTIVITY activity = null;
  activity = FControl.GetFlowActivity(strNodeNo);

  //得到活动的分配策略(1分配一人 2分配多人)
  String strAstrategy = activity.getASTRATEGY();

  String strUserList="";
  if(!strUnitid.equals("0")){
   strUserList = FControl.GetShowUnitUserList(strUnitid,"record",user.getUserImage(),"flowuser.gif",strAstrategy);
  }
%>
<meta http-equiv="Content-Type" content="text/html; charset=GBK">
<title></title>
<link REL="stylesheet" type="text/css" href="../../zrsysmanage/css/<%=user.getUserCSS()%>">
<SCRIPT LANGUAGE="JavaScript" src="../../zrsysmanage/script/Public.js"></SCRIPT>
<script src="../../zrsysmanage/html5/script/jquery-2.0.3.min.js" type="text/jscript" ></script>
<script src="../../zrsysmanage/html5/layer/layer.js" type="text/jscript" ></script>

<SCRIPT LANGUAGE="javascript">
//作用：全选
function selectall(){
  var setcheck,length;
  length = document.recordfrm.elements.length ;
  if (document.recordfrm.setall.value == 0){
    document.recordfrm.setall.value = 1;
    setcheck = true;
  }else{
    document.recordfrm.setall.value = 0;
    setcheck = false;
  }
  for (var i=0; i<length; i++) {
    if (document.recordfrm.elements[i].name.indexOf("record") != -1)
      document.recordfrm.elements[i].checked = setcheck;
  }
  return;
}
//作用：部门全选
function selectallPm(unitid){
  var setcheck,length;
  length = document.recordfrm.elements.length ;
  setcheck = true;

  for (var i=0; i<length; i++) {
    if (document.recordfrm.elements[i].title == unitid)
      document.recordfrm.elements[i].checked = setcheck;
  }

}

//作用：取消全选
function selectnotBM(unitid){
  var setcheck,length;
  length = document.recordfrm.elements.length ;
  setcheck = false;
  for (var i=0; i<length; i++) {

    if (document.recordfrm.elements[i].title == unitid)
      document.recordfrm.elements[i].checked = setcheck;
  }

}
//作用：获取记录
function GetUserNo(){
  var length = document.recordfrm.elements.length;
  var recordindex= "";
  var selectedstring= "";
  var strValue= "";
  for (var i=0; i<length; i++){
    recordindex  = document.recordfrm.elements[i].name.indexOf("record");
    if (recordindex  != -1) {
      if (document.recordfrm.elements[i].checked){
        strValue = document.recordfrm.elements[i].value;
        intValue = strValue.length;
        if (selectedstring == ""){
          selectedstring = strValue;
        }else{
          selectedstring = selectedstring  + "," + strValue;
        }
      }
    }
  }

  if (selectedstring != "") {

      <%if(!user.getUserWINDOWTYPE().equals("6")){ %>
       window.returnValue = selectedstring;
       window.close();
      <%}else{%>

         <%if (th.equals("1")){%>
           parent.parent.parent.SelectUpDept_x_f(selectedstring);
         <%}else{%>
           parent.parent.parent.SelectDoDept_x_f(selectedstring);
         <%}%>

      <%}%>

  }else {



      <%if(!user.getUserWINDOWTYPE().equals("6")){ %>
       alert("请选择要操作的用户!");
      <%}else{%>
       layer.alert("请选择要操作的用户!", {icon: 7});
      <%}%>

  }

}

function selectOnclick(id)
{
    if (document.getElementById(id).checked==true)
    {document.getElementById(id).checked='';}
    else
    {document.getElementById(id).checked='checked';}
}

</script>
</head>
<BODY class="BodyMain">
<FORM method="post" name="recordfrm" action="">
<input type="hidden" name="setall" value="0">
<TABLE border="0" width="95%" cellpadding=0 cellspacing=0>
     <TR>
      <TD height="320">

  <DIV id="divMessage" style='padding-left:0;padding-top:0;width:100%;height:100%;overflow:auto'>
  <TABLE border="0" width="95%" cellpadding=0 cellspacing=0>
    <TR>
       <TD width="95%" height="3"></TD>
    </TR>
    <TR>
      <TD valign="top">
        <TABLE  border="0" width="95%" cellpadding=0 cellspacing=0>
          <%=strUserList%>
        </TABLE>
      </TD>
    </TR>
  </TABLE>
  </DIV>

  </td></tr>

  <tr><td height="10"></td></tr>
  <tr><td height="30" align="center">
          <center>
          <table cellspacing="0" cellpadding="0" border='0'><tr>
                 <td>
                    <%if (!strAstrategy.equals("1")){%>
                   <img src="<%=SysPreperty.getProperty().AppUrl%>zrsysmanage/images/<%=user.getUserImage()%>/PuTreeRoot.gif" valign="absmiddle" WIDTH="17" HEIGHT="17">
                   <input type="checkbox" name="Dept" onclick="selectall();">全选&nbsp;<%}%>
                 </td>
                 <%=userUI.ClickButton1("确定","GetUserNo();","buttonSure.gif",user.getUserImage())%>

                 <%if(!user.getUserWINDOWTYPE().equals("6")){ %>
                    <%=userUI.ClickButton1("关闭","parent.parent.window.close();","buttonClose.gif",user.getUserImage())%>
                 <%}else{%>
                    <%=userUI.ClickButton1("关闭","parent.parent.parent.layer.closeAll();","buttonClose.gif",user.getUserImage())%>
                 <%}%>

         </tr></table>
         </center>
    </td></tr></TABLE>
</form>
</body>
</html>
<%
//清空相关对象
user = null;
userUI = null;
activity = null;
FControl = null;
%>
