<%@ 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.mode.base.Package"%>
<%@ page import = "zr.zrpower.flowengine.service.FlowSetup"%>
<%@ page import = "zr.zrpower.flowengine.service.FlowControl"%>
<%@ page import = "zr.zrpower.ejb.sys.UserService"%>
<%@ page import = "zr.zrpower.entity.sys.BPIP_USER"%>

<%@ page import = "zr.zrpower.common.util.DateWork" %>
<%@ page import = "java.lang.Object"%>
<HTML>
<%
SessionUser user = (SessionUser)session.getAttribute("userinfo");
UIService userUI =new UIService();
DateWork dw=new DateWork();
Package[] FlowPk = null;
FlowSetup FlowPackage= new FlowSetup();
FlowControl FControl = new FlowControl();
UserService name=new UserService();

String strFID = request.getParameter("FID");
if (strFID ==null)
{strFID = "";}


String PData = "";
int row=0;
int low=0;

FlowPk = FlowPackage.GetFlowPackageList1(strFID);
     if (FlowPk!=null && FlowPk.length>0){
       PData = PData + "{\"total\":"+String.valueOf(FlowPk.length)+",\"list\":[";
       for(int i=0;i<FlowPk.length;i++){



         if (i==0)
         {
           PData = PData + "{\"id\":\""+FlowPk[i].getID()+"\",\"flow_id\":\"4\",\"process_name\":\""+FlowPk[i].getNAME()+"\",\"process_to\":\"\",\"icon\":\"icon-book\",\"style\":\"width:102px;height:40px;line-height:40px;color:#0e76a8;left:"+String.valueOf(low*136+10)+"px;top:"+String.valueOf(row*58+10)+"px;\"}";
         }else
         {
           PData = PData + ",{\"id\":\""+FlowPk[i].getID()+"\",\"flow_id\":\"4\",\"process_name\":\""+FlowPk[i].getNAME()+"\",\"process_to\":\"\",\"icon\":\"icon-book\",\"style\":\"width:102px;height:40px;line-height:40px;color:#0e76a8;left:"+String.valueOf(low*136+10)+"px;top:"+String.valueOf(row*58+10)+"px;\"}";
         }

         if (i!=0 && (i+1) % 5==0)
         {
            row=row+1;
            low = 0;
         }else
         {
            low = low + 1;
         }


       }
       PData = PData + "]}";
      }

%>
<HTML>
 <head>
 <title>WEB流程设计器</title>
 <meta name="keyword" content="">
 <meta name="description" content="">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="IE=9,chrome=1">
    <meta name="author" content="leipi.org">
    <link href="../Public/css/bootstrap/css/bootstrap.css?2025" rel="stylesheet" type="text/css" />
    <!--[if lte IE 6]>
    <link rel="stylesheet" type="text/css" href="../Public/css/bootstrap/css/bootstrap-ie6.css?2025">
    <![endif]-->
    <!--[if lte IE 7]>
    <link rel="stylesheet" type="text/css" href="../Public/css/bootstrap/css/ie.css?2025">
    <![endif]-->
    <link href="../Public/css/site.css?2025" rel="stylesheet" type="text/css" />


    <script type="text/javascript">
        var _root='http://www.zrpower.cn/index.php?s=/',_controller = 'flowdesign';
    </script>


<link rel="stylesheet" type="text/css" href="../Public/js/flowdesign/flowdesign.css"/>

<!--select 2-->
<link rel="stylesheet" type="text/css" href="../Public/js/jquery.multiselect2side/css/jquery.multiselect2side.css"/>
<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>

 </head>
<body>

<input type="hidden" name="CSSTYPE" value="<%=user.getUserWINDOWTYPE()%>">


<!--contextmenu div-->
<div id="processMenu" style="display:none;">
  <ul>
    <li id="openflow"><i class="icon-th"></i>&nbsp;<span class="_label">打开流程</span></li>
    <li id="opensubpackage"><i class="icon-th"></i>&nbsp;<span class="_label">打开子包</span></li>
    <li id="packagecopy"><i class="icon-th"></i>&nbsp;<span class="_label">复制分类</span></li>
    <li id="packagemove"><i class="icon-th"></i>&nbsp;<span class="_label">移动分类</span></li>
    <li id="packagedelete"><i class="icon-th"></i>&nbsp;<span class="_label">删除分类</span></li>
    <li id="pmAttribute"><i class="icon-th"></i>&nbsp;<span class="_label">属性</span></li>
  </ul>
</div>

<!--end div-->

<div class="container mini-layout" id="flowdesign_canvas">
</div>








<script type="text/javascript" src="../Public/js/jquery-1.7.2.min.js?2025"></script>
<script type="text/javascript" src="../Public/css/bootstrap/js/bootstrap.min.js?2025"></script>
<script type="text/javascript" src="../Public/js/jquery-ui/jquery-ui-1.9.2-min.js?2025" ></script>
<script type="text/javascript" src="../Public/js/jsPlumb/jquery.jsPlumb-1.3.16-all-min.js?2025"></script>
<script type="text/javascript" src="../Public/js/jquery.contextmenu.r2.js?2025"></script>
<!--select 2-->
<script type="text/javascript" src="../Public/js/jquery.multiselect2side/js/jquery.multiselect2side.js?2025" ></script>
<!--flowdesign-->
<script type="text/javascript" src="../Public/js/flowdesign/leipi.flowdesign.v3.js?2025"></script>
<SCRIPT language=jscript src="../../js/ControlPackage.js"></SCRIPT>
<SCRIPT LANGUAGE="JavaScript" src="../../../zrsysmanage/script/Public.js"></SCRIPT>

<script type="text/javascript">
var the_flow_id = '4';

function callbackSuperDialog(selectValue){
     var aResult = selectValue.split('@leipi@');
     $('#'+window._viewField).val(aResult[0]);
     $('#'+window._hidField).val(aResult[1]);
    //document.getElementById(window._hidField).value = aResult[1];

}


$(function(){
    var alertModal = $('#alertModal'),attributeModal =  $("#attributeModal");
    //消息提示
    mAlert = function(messages,s)
    {
        if(!messages) messages = "";
        if(!s) s = 2000;
        alertModal.find(".modal-body").html(messages);
        alertModal.modal('toggle');
        setTimeout(function(){alertModal.modal("hide")},s);
    }

    //属性设置
    attributeModal.on("hidden", function() {
        $(this).removeData("modal");//移除数据，防止缓存
    });
    ajaxModal = function(url,fn)
    {
        url += url.indexOf('?') ? '&' : '?';
        url += '_t='+ new Date().getTime();
        attributeModal.find(".modal-body").html('<img src="../Public/images/loading.gif"/>');
        attributeModal.modal({
            remote:url
        });

        //加载完成执行
        if(fn)
        {
            attributeModal.on('shown',fn);
        }


    }


    /*
    jsp 命名习惯 单词用下划线_隔开
    js 命名习惯：首字母小写 + 其它首字线大写
    */
    /*步骤数据*/
    var processData = <%=PData%>;

    /*创建流程设计器*/
    var _canvas = $("#flowdesign_canvas").Flowdesign({
                      "processData":processData

                      /*画面右键*/
                      ,canvasMenus:{


                      }
                      /*步骤右键*/
                      ,processMenus: {


                          "openflow":function(t)
                          {
                              var activeId = _canvas.getActiveId();//右键当前的ID
                              OpenFlow(activeId);
                          },
                          "opensubpackage":function(t)
                          {
                              var activeId = _canvas.getActiveId();//右键当前的ID
                              OpenSubPackage(activeId);
                          },
                          "packagecopy":function(t)
                          {
                              var activeId = _canvas.getActiveId();//右键当前的ID
                              OpenFlowPackageCopy(activeId);
                          },
                          "packagemove":function(t)
                          {
                              var activeId = _canvas.getActiveId();//右键当前的ID
                              OpenFlowPackageMove(activeId,'<%=strFID%>');
                          },
                          "packagedelete":function(t)
                          {
                              var activeId = _canvas.getActiveId();//右键当前的ID
                              DeletePackage(activeId);
                          },
                          "pmAttribute":function(t)
                          {
                              var activeId = _canvas.getActiveId();//右键当前的ID

                              SetupProperty(activeId);
                          },


                      }

                      ,fnDbClick:function(){
                          //和 pmAttribute 一样
                          var activeId = _canvas.getActiveId();//右键当前的ID
                          OpenFlow(activeId);

                      }
                  });



});


</script>

</body>
</html>
<%
//清空相关对象
user = null;
userUI = null;
FlowPk = null;
FlowPackage = null;
FControl = null;
name = null;
%>
