<%@ 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.flowmanage"%>

<%@ page import = "java.lang.Object"%>
<%@page import="zr.zrpower.flowengine.mode.config.FLOW_CONFIG_ACTIVITY"%>
<%@ page import = "zr.zrpower.flowengine.service.FlowControl" %>

<HTML>
<%
  SessionUser user = (SessionUser)session.getAttribute("userinfo");
  UIService userUI =new UIService();
  flowmanage flowmanage = new flowmanage();
  String strFLOWID ="";//流程ID
  String strNodeLst ="";
  String strID = "";
  String strNAME = "";
  String strchecked = "";
  strFLOWID = request.getParameter("FLOWID");

  FLOW_CONFIG_ACTIVITY[] Activity = null;
  FlowControl FControl = new FlowControl();

  Activity = FControl.GetActivityList(strFLOWID);
     if (Activity!=null && Activity.length>0){
       for(int i=0;i<Activity.length;i++){
          strID=Activity[i].getID();
          strNAME=Activity[i].getNAME();
          if (i == 0) {
             strchecked = "checked";
          }
          else {
            strchecked = "";
          }

          if (!strNAME.equals("开始") && !strNAME.equals("结束"))
          {
            strNodeLst = strNodeLst + "<table border='0' cellspacing='0' cellpadding='0'><tr><td width='5'></td><td style='cursor:pointer' onclick=\"selectOnclick('"
            +strID+"');\"><input type='radio' "+strchecked+" onclick=\"selectOnclick('"
            +strID+"');\" name='record' value='"
            +strID+"'><img src='"+SysPreperty.getProperty().AppUrl
            +"zrsysmanage/images/"+user.getUserImage()+"/flowselect.gif' border='0' align='absmiddle'>"+strNAME
            +"</td></tr></table>";
          }
       }
  }

%>
<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" src="../js/Workflow.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 FunOk(){
  var length = document.NodeListForm.elements.length
  var recordindex
  var selectedstring
  var strValue
  selectedstring=""
  for (var i=0; i<length; i++){
    recordindex  = document.NodeListForm.elements[i].name.indexOf("record");
    if (recordindex  != -1) {
      if (document.NodeListForm.elements[i].checked){
        strValue = document.NodeListForm.elements[i].value;
        intValue = strValue.length;
        if (selectedstring == ""){
          selectedstring = strValue;
        }else{
          selectedstring = selectedstring  + "," + strValue;
        }
      }
    }
  }

  if (selectedstring != "") {
      window.returnValue = selectedstring;
      window.close();
      return;
  }else {
      alert("请选择流程!");
  }
  return;
}
function selectOnclick(id)
{
    var length = document.NodeListForm.elements.length
    var recordindex
    var selectedstring
    var strValue
    selectedstring=""
    for (var i=0; i<length; i++){
    recordindex  = document.NodeListForm.elements[i].name.indexOf("record");
    if (recordindex  != -1) {
          strValue = document.NodeListForm.elements[i].value;
          if (strValue==id)
          {
            document.NodeListForm.elements[i].checked='checked';
          }else
          {document.NodeListForm.elements[i].checked='';}
     }
    }
}
</SCRIPT>
</HEAD>
<BODY class="UserListBody">
<Form method="post" name="NodeListForm" action="">
<input type="hidden" name="formfields" value="">
<%if(!user.getUserWINDOWTYPE().equals("6")){ %>
<!--HTML Head表单头显示[显示内容,图标文件,用户肤色的图片文件夹]-->
<%=userUI.ShowHeadHtml("选择流程","IcoTitle.gif",user.getUserImage())%>
   <tr><td align="center">
<%}%>
         <table border='0' width="100%" cellspacing="0" cellpadding="0" align=center>
            <tr>
               <td height=5></td>
            </tr>
            <tr>
               <td height="200">
               <DIV id="divMessage" style='padding-left:0;padding-top:0;width:100%;height:100%;overflow:auto'>
                 <%=strNodeLst%>
               </DIV>
               </td>
            </tr>
            <tr>
              <td height=10></td>
            </tr>
            <tr>
               <td height=25 align="center">

                <table cellspacing="0" cellpadding="0" border='0'><tr>
                 <%=userUI.ClickButton1("确定","FunOk();","buttonSure.gif",user.getUserImage())%>
                 <%=userUI.ClickButton1("关闭","window.close();","buttonClose.gif",user.getUserImage())%>
                </tr></table>

               </td>
            </tr>
            <tr>
              <td height=20></td>
            </tr>
          </table>
<%if(!user.getUserWINDOWTYPE().equals("6")){ %>
          </td></tr>
<!--HTML Foot显示表单尾-->
<%=userUI.ShowFootHtml()%>
<%}%>
</FORM>
</BODY>
</HTML>
<%
//清空相关对象
user = null;
userUI = null;
flowmanage = null;
%>
