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

<%@ page import = "zr.zrpower.flowengine.runtime.ActFlowRun"%>
<%@ page import = "zr.zrpower.flowengine.mode.config.FLOW_CONFIG_ACTIVITY"%>
<%@ page import = "java.lang.Object"%>
<%
  String strCNodeNo;
  String strExecuteNo;
  String strNodeNo;
  String strUserLst="";
  String strAstrategy="";
  String strType="";
  String strName="";
  String strAutograph="";
  String ISCachet ="";
  String str_OtherID="";
  String str_ParentID ="";
  String str_ParentID1 ="";
  String AttMessage ="";//附件提示信息
  String IsAttMessage ="0";//是否需要检测附件提示
  String strIsNote = "";//短信提醒类别
  String SELECTDEPTID = "";


  //多路分支是否表现在操作按钮上
  String strISBRANCH="";

  SessionUser user = (SessionUser)session.getAttribute("userinfo");
  UIService userUI =new UIService();
  FlowControl FControl = new FlowControl();
  flowmanage flowmanage = new flowmanage();

  strCNodeNo = request.getParameter("CNodeNo");
  if (strCNodeNo==null){strCNodeNo="";}
  strExecuteNo = request.getParameter("ExecuteNo");
  if (strExecuteNo==null){strExecuteNo="";}
  strNodeNo = request.getParameter("NodeNo");
  if (strNodeNo==null){strNodeNo="";}
  strType = request.getParameter("Type");
  if (strType==null){strType="";}
  AttMessage = request.getParameter("AttMessage");
  if (AttMessage==null){AttMessage="";}
  str_OtherID = request.getParameter("OtherID");
  if (str_OtherID==null){str_OtherID="";}
  str_ParentID = request.getParameter("ParentID");
  if (str_ParentID==null){str_ParentID="";}
  str_ParentID1 = request.getParameter("ParentID1");
  if (str_ParentID1==null){str_ParentID1="";}
  SELECTDEPTID = request.getParameter("SELECTDEPTID");
  if (SELECTDEPTID==null){SELECTDEPTID="";}

  FLOW_CONFIG_ACTIVITY activity = null;
  activity = FControl.GetFlowActivity(strNodeNo);
  if (activity!=null)
  {
  //得到活动的分配策略(1分配一人 2分配多人)
  strAstrategy = activity.getASTRATEGY();
  //得到活动是否顺序会签(1是0否)
  strAutograph = activity.getISSIGN();
  //得到选择步骤的名称
  strName = activity.getNAME();
  //得到是否短信提示的状态
  strIsNote=activity.getISNOTE();
  strISBRANCH=activity.getISBRANCH();
  }
  //初始化流程默认运转参数------------------
  ActFlowRun ActFlowRun = new ActFlowRun();
  ActFlowRun.FlowInitDefault(strExecuteNo,"",str_OtherID,str_ParentID,str_ParentID1,"","",strISBRANCH);
  //初始化默认流程运转参数结束---------------

  if (AttMessage.length()>0)
  {
       //根据当前活动和下一活动得到是否需要附件提示
       IsAttMessage = FControl.GetISAttMessage(strCNodeNo,strNodeNo);
  }

  strUserLst = FControl.GetActivityDoUserList(strExecuteNo,strCNodeNo,strNodeNo,ActFlowRun,user);

  //根据用户编号字符串得到用户列表
  strUserLst = flowmanage.GetShowUserList(strUserLst,"record","flowuser.gif",strAstrategy,strNodeNo,user,SELECTDEPTID);

  //根据指定的角色得到用户列表(按角色分组),备用接口，动态指定角色时使用。
  //strUserLst = flowmanage.GetRoleUserList("record","flowuser.gif",strAstrategy,strNodeNo,user,"301,302,303,304");

%>
<HTML>
<HEAD>
<TITLE><%=SysPreperty.getProperty().SystemName%><%=SysPreperty.getProperty().Versoin%></TITLE>
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META http-equiv="Content-Type" content="text/html; charset=GBK">
<link REL="stylesheet" type="text/css" href="../../zrsysmanage/css/<%=user.getUserCSS()%>">
<SCRIPT LANGUAGE="JavaScript" src="../../zrsysmanage/script/Public.js"></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 GetUserNo(){

  var length = document.recordfrm.elements.length;
  var recordindex="";
  var selectedstring="";
  var strValue="";
  var strMsg="0";
  var IsNote = document.recordfrm.IsNote.value;
  for (var i=(length-1); i>=0; 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 (IsNote=="4")
    {
       strMsg = document.recordfrm.msgtype.value;
    }else
    {
      recordindex  = document.recordfrm.elements[i].name.indexOf("msgtype");
      if (recordindex  != -1) {
        if (document.recordfrm.elements[i].checked){
          strMsg = document.recordfrm.elements[i].value;
        }
      }
    }
    //-----------------------------
  }

  if (selectedstring != "") {
      selectedstring = selectedstring  +"/"+strMsg;
      window.returnValue = selectedstring;
      
      return selectedstring;
  }else {
      alert("请选择要提交操作的用户!");
  }
  return selectedstring;
}
//作用：返回提示信息或待选人员为一人时直接提交
function returnMessage(){
    var IsAttMessage = document.recordfrm.IsAttMessage.value;
    if (IsAttMessage=="1")
    {
       window.returnValue = "IsAttMessage";
       window.close();
       return;
    }
}
function selectOnclick(id)
{
    if (document.getElementById(id).checked==true)
    {document.getElementById(id).checked='';}
    else
    {document.getElementById(id).checked='checked';}
}

function DeptOnclick(id)
{
    var isdo;
    if (document.getElementById(id).checked==true)
    {
     document.getElementById(id).checked='checked';
     isdo = true;
     }
    else
    {
     document.getElementById(id).checked='';
     isdo = false;
    }

  var length;
  length = document.recordfrm.elements.length ;

  for (var i=0; i<length; i++) {
    if (document.recordfrm.elements[i].name.indexOf(id+"record") != -1)
    {document.recordfrm.elements[i].checked = isdo;}
  }

}

</script>
<BODY class="UserListBody" >
<FORM method="post" name="recordfrm" action="">
<input type="hidden" name="setall" value="0">
<input type="hidden" name="IsAttMessage" value="<%=IsAttMessage%>">
<input type="hidden" name="IsNote" value="<%=strIsNote%>">

<!--HTML Head表单头显示[显示内容,图标文件,用户肤色的图片文件夹]-->

        <TABLE  border="0" width="200px" cellpadding=0 cellspacing=0>
          <%=strUserLst%>
        </TABLE>
      

</FORM>
</BODY>
</html>
<SCRIPT language=javascript type=text/javascript>
<!--
setTimeout("returnMessage();",300);
// -->
</SCRIPT>
<%
//清空相关对象
user = null;
userUI = null;
ActFlowRun = null;
activity = null;
FControl = null;
%>
