<%@ page contentType="text/html; charset=GBK" %>
<%@ page import = "zr.zrpower.common.util.SysPreperty" %>
<%@ page import = "zr.zrpower.entity.sys.SessionUser" %>
<%@ page import = "zr.zrpower.flowengine.mode.config.FLOW_CONFIG_PROCESS"%>
<%@ page import = "zr.zrpower.flowengine.mode.base.Package"%>
<%@ page import = "zr.zrpower.ejb.sys.UserService"%>
<%@ page import = "zr.zrpower.ejb.sys.UIService" %>
<%@ page import = "zr.zrpower.flowengine.service.FlowConfig" %>
<%@ page import = "java.lang.Object"%>

<HTML>
<%

SessionUser user = (SessionUser)session.getAttribute("userinfo");
UIService userUI =new UIService();
UserService name=new UserService();
FLOW_CONFIG_PROCESS[] PROCESS = null;
Package[] Package = null;
FlowConfig Fconfig =new FlowConfig();

String strPackageID = request.getParameter("PackageID");

    //得到查询的记录集
     PROCESS = Fconfig.GetFlowList2(strPackageID);

     String strshow_data ="";
      String strDate = "";
      if (PROCESS!=null && PROCESS.length>0){
        strshow_data = strshow_data + "[";
        for(int i=0;i<PROCESS.length;i++){
          strshow_data = strshow_data + "[";
          strshow_data = strshow_data + "\""+PROCESS[i].getID()+"\",";
          strshow_data = strshow_data + "\""+PROCESS[i].getNAME()+"\",";

          strDate = String.valueOf(PROCESS[i].getCREATEDATE());
          if (strDate==null){strDate="";}
          if (strDate.length()>10)
          {
             strDate = strDate.substring(0,10);
          }

          if (i < PROCESS.length-1 )
          {
             strshow_data = strshow_data + "\""+strDate+"\"],\r\n";
          }else
          {
             strshow_data = strshow_data + "\""+strDate+"\"]";
          }
        }

        strshow_data = strshow_data + "]";
        }else
        {
          strshow_data = "null";
        }

%>
<HTML>
<HEAD>
<TITLE></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/ControlPackage.js"></SCRIPT>

<link rel="stylesheet" type="text/css" media="all" href="../../../ZrwebGui/sigma_grid/grid/calendar/calendar-blue.css">
<script type="text/javascript" src="../../../ZrwebGui/sigma_grid/grid/calendar/calendar.js"></script>
<script type="text/javascript" src="../../../ZrwebGui/sigma_grid/grid/calendar/calendar-setup.js"></script>
<link rel="stylesheet" type="text/css" href="../../../ZrwebGui/sigma_grid/grid/gt_grid.css">
<link rel="stylesheet" type="text/css" href="../../../ZrwebGui/sigma_grid/grid/skin/vista/skinstyle.css">
<link rel="stylesheet" type="text/css" href="../../../ZrwebGui/sigma_grid/grid/skin/pink/skinstyle.css">
<link rel="stylesheet" type="text/css" href="../../../ZrwebGui/sigma_grid/grid/skin/mac/skinstyle.css">
<script type="text/javascript" src="../../../ZrwebGui/sigma_grid/grid/gt_msg_en.js"></script>
<script type="text/javascript" src="../../../ZrwebGui/sigma_grid/grid/gt_const.js"></script>
<script type="text/javascript" src="../../../ZrwebGui/sigma_grid/grid/gt_grid_all.js"></script>

<LINK type="text/css" rel="stylesheet" href="../../../zrsysmanage/html5/css/style_tables.css">
<SCRIPT LANGUAGE="JavaScript" src="../../../zrsysmanage/html5/script/jquery-2.0.3.min.js"></SCRIPT>
<SCRIPT LANGUAGE="JavaScript" src="../../../zrsysmanage/html5/layer/layer.js"></SCRIPT>
<SCRIPT LANGUAGE="Javascript" src="../../../zrsysmanage/html5/script/systype.js"></SCRIPT>


<script type="text/javascript" >
var css = "<%=user.getUserCSS()%>";
var skincss = "vista";

if (css=="Blue.css")
{skincss = "vista";}
if (css=="Public.css")
{skincss = "default";}
if (css=="Window.css" || css=="nBlue.css")
{skincss = "mac";}
if (css=="Yellow.css")
{skincss = "pink";}


var grid_demo_id = "myGrid1" ;
var show_data= <%=strshow_data%>;

var dsOption= {

	fields :[
		{name : 'NAME1'  },
		{name : 'NAME2'  },
		{name : 'NAME3'  }
	],

	recordType : 'array',
	data : show_data
}



var colsOption = [
           {id: 'NAME1' , header: "<center>流程ID</center>" , width :80 , align : 'center'  },
	   {id: 'NAME2' , header: "<center>流程名称</center>" , width :380 ,align : 'center'  },
	   {id: 'NAME3' , header: "<center>创建日期</center>" , width :120 , align : 'center'   }
];


var gridOption={
	id : grid_demo_id,
	width: "99%",
	height: "92%",
	container : 'gridbox',
	replaceContainer : true,
	dataset : dsOption ,
	columns : colsOption,
	pageSize : 2000,
	toolbarContent : null,
        skin : skincss,

        onCellDblClick:function(value, record , cell, row,  colNO, rowNO,columnObj,grid){
           OpenFlowConfig();
        },

       showIndexColumn : true
};

<%if(!user.getUserWINDOWTYPE().equals("6")){%>
var mygrid=new Sigma.Grid( gridOption );
Sigma.Util.onLoad( Sigma.Grid.render(mygrid));
<%}%>
</script>


</HEAD>

<BODY class="BodyMain">
<form name="recordfrm" action="List1.jsp">
<input type="hidden" name="CSSTYPE" value="<%=user.getUserWINDOWTYPE()%>">


<%if(user.getUserWINDOWTYPE().equals("6")){ %>

  <div id="mianRole" style="height: 90%;overflow: auto;">
  <table class="bordered" id="html5_table">

<thead>
<tr>
<th style="width:30%;">流程ID</th>
<th style="width:40%;">流程名称</th>
<th style="width:30%;">创建日期</th>
</tr>
</thead>

<%
   if (PROCESS!=null && PROCESS.length>0){
        for(int i=0;i<PROCESS.length;i++){
          strDate = String.valueOf(PROCESS[i].getCREATEDATE());
          if (strDate==null){strDate="";}
          if (strDate.length()>10)
          {
             strDate = strDate.substring(0,10);
          }
%>
        <tr  ondblclick="OpenFlowConfig();" onclick="click_color(this,'<%=PROCESS[i].getID()%>');">
        <td style="text-align:center;"><%=PROCESS[i].getID()%></td>
        <td style="text-align:center;"><%=PROCESS[i].getNAME()%></td>
        <td style="text-align:center;"><%=strDate%></td>
        </tr>

<%
        }
 }
%>

</table>
<br>
</div>

<%}else{%>


<div id="gridbox" style="border:0px solid #cccccc;background-color:#f3f3f3;padding:5px;height:200px;width:700px;" ></div>

<%}%>
</form>
</BODY>
<script language="JavaScript" type="text/JavaScript">
<!--
var allvalue="";
function clickValue(value){
    allvalue=value;
}
function AddFlow(type){
    var url="AddFrm.jsp?type="+type;
    OpenSetup1(url);
}
function EditFlow(){
    <%if(user.getUserWINDOWTYPE().equals("6")){ %>
     var strID = allvalue;
     if (strID=="" || strID.length==0)
      {
        layer.alert('请先选择流程！', {icon: 7});
      }else
      {
        var url="EditFrm.jsp?SelectedItems="+strID;
        OpenSetup1(url);
      }

   <%}else{%>
     var allvalue = mygrid.getSelectedRecords()+",0";
     var strID = allvalue.split(",")[0];
     var url="EditFrm.jsp?SelectedItems="+strID;
     OpenSetup1(url);
   <%}%>

}
function OpenFlowConfig(){
    <%if(user.getUserWINDOWTYPE().equals("6")){ %>
     var strID = allvalue;

   <%}else{%>
     var allvalue = mygrid.getSelectedRecords()+",0";
     var strID = allvalue.split(",")[0];
   <%}%>
    parent.location.href="FlowDesign.jsp?SelectedItems="+strID;
}
//-->
</script>
</HTML>
<%
//清空相关对象
user = null;
userUI = null;
name = null;
PROCESS = null;
Package = null;
Fconfig = null;
%>
