<%@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.ejb.sys.SecurityService"%>
<%@ page import = "zr.zrpower.flowengine.mode.config.FLOW_CONFIG_ACTIVITY_CONNE"%>
<%@ page import = "zr.zrpower.flowengine.mode.config.FLOW_CONFIG_ACTIVITY"%>
<%@ page import = "zr.zrpower.flowengine.service.FlowConfig"%>
<%@page import = "zr.zrpower.flowengine.mode.base.Variable"%>
<%@ page import = "zr.zrpower.flowengine.service.FlowSetup"%>
<%@page import="zr.zrpower.flowengine.service.FlowManageAct"%>
<%@ page import = "zr.zrpower.flowengine.service.FlowControl"%>

<%@page import="zr.zrpower.common.util.DateWork"%>
<%@page import="java.lang.Object"%>
<%@page import="java.util.*"%>
<%@page import="java.text.*"%>

<HTML>
<%
  SessionUser user = (SessionUser) session.getAttribute("userinfo");
  UIService userUI = new UIService();
  String strcid = request.getParameter("cid");
  if (strcid==null){strcid="";}
  String streid = request.getParameter("eid");
  if (streid==null){streid="";}

  FlowManageAct flowManageAct = new FlowManageAct();
  FlowConfig Flow = new FlowConfig();
  FlowSetup FlowPackage= new FlowSetup();
  FlowControl FControl = new FlowControl();

  String ID="";
  ID = Flow.getActivityID(strcid,streid);

  FLOW_CONFIG_ACTIVITY_CONNE Pr = Flow.getActivityID(ID);

  String SessionStr;

%>
<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="../../js/Workflow.js"></SCRIPT>
<SCRIPT LANGUAGE="JavaScript" src="../../../zrsysmanage/script/Public.js"></SCRIPT>
<SCRIPT LANGUAGE="JavaScript" src="../../js/DealList.js"></SCRIPT>
<script type='text/javascript' src='../../../dwr/engine.js'></script>
<script type='text/javascript' src='../../../dwr/util.js'></script>
<script type='text/javascript' src='../../../dwr/interface/FlowMaActBean.js'></script>

<script type="text/javascript" src="../../../ZrwebGui/tab/tab.js"></script>
<link rel="stylesheet" type="text/css" href="../../../ZrwebGui/tab/tab.css">
<STYLE type=text/css>
#con { FONT-SIZE: 12px; MARGIN: 0px auto; WIDTH: 98% }
#tags { PADDING-RIGHT: 0px; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px 0px 0px 10px; WIDTH: 98% ; PADDING-TOP: 0px; HEIGHT: 23px }
#tags LI { BACKGROUND: url(../../../ZrwebGui/tab/skin/<%=user.getUserImage()%>/tagleft.gif) no-repeat left bottom; FLOAT: left; MARGIN-RIGHT: 1px; LIST-STYLE-TYPE: none; HEIGHT: 23px }
#tags LI A { PADDING-RIGHT: 10px; PADDING-LEFT: 10px; BACKGROUND: url(../../../ZrwebGui/tab/skin/<%=user.getUserImage()%>/tagright.gif) no-repeat right bottom; FLOAT: left; PADDING-BOTTOM: 0px; COLOR: #999;
LINE-HEIGHT: 23px; PADDING-TOP: 0px; HEIGHT: 23px; TEXT-DECORATION: none }
.tagContent { PADDING-RIGHT: 10px; DISPLAY: none; PADDING-LEFT: 10px; BACKGROUND: url(../../../ZrwebGui/tab/skin/<%=user.getUserImage()%>/bg.gif) repeat-x; PADDING-BOTTOM: 10px; WIDTH: 100%; COLOR: #474747;
PADDING-TOP: 10px; HEIGHT: 82% }
</STYLE>

<SCRIPT LANGUAGE="javascript">
function SelectFlow()
  {
      var strFID = document.RegForm.FID.value;
      var len = 0;
      //清空列表-----------
      document.all.srcList.options.length = 0;

      for(var i = 0; i < document.all.hiddList.length; i++)
      {
      var strText = document.all.hiddList.options[i].text;
      var strText1 = strText.substring(0,strText.length - 30);
      var strlen = strText.length;
      strText = strText.substring(strlen-10);
      if (strFID == strText)
      {
       document.all.srcList.options[len] = new Option(strText1,document.all.hiddList.options[i].value);
       len = len+1;
      }
      }
      return true;
 }
function Check(theForm)
{
    if (!(ListAll())){
    return false;
    }
   return true;
 }
function btnSpecialValue(strValue)
{
  if(CheckInputWhereExpression(RegForm.WHERE1.value,strValue))
     RegForm.WHERE1.value=RegForm.WHERE1.value+strValue;
}


function select_onchang(){
	if (document.RegForm.CONNTYPE.value=='5')
        {
        div1.style.display='';
        div2.style.display='';
        div3.style.display='';
        div4.style.display='';
        div5.style.display='';
        div6.style.display='';
        div7.style.display='';
        div8.style.display='';
        div9.style.display='';
        div10.style.display='';
        div11.style.display='none';
        }
        else
        {
        div1.style.display='none';
        div2.style.display='none';
        div3.style.display='none';
        div4.style.display='none';
        div5.style.display='none';
        div6.style.display='none';
        div7.style.display='none';
        div8.style.display='none';
        div9.style.display='none';
        div10.style.display='none';
        div11.style.display='none';
       }

       return false;
}

//====

function fillTableName(obj)
   {
    tableName= obj.options[obj.selectedIndex].value;
   }

function fillSessionName(obj)
   {
    if(obj.selectedIndex<0)
    return;
    SessionName = obj.options[obj.selectedIndex].value;
    RegForm.WHERE1.value=RegForm.WHERE1.value+SessionName;
   }

function fillFieldName(obj)
   {
    if(obj.selectedIndex<0)
    return;
    tableName=RegForm.TableList.value;
     fieldName=obj.options[obj.selectedIndex].value;
       RegForm.WHERE1.value=RegForm.WHERE1.value+'['+tableName+'.'+fieldName+']';
   }
function ShowHelpModal()
{

  var url='formulaHelp.jsp';
  var status='dialogHeight:400px;dialogWidth:500px;status:0;help:no;center:yes';
  window.showModalDialog(url,window,status);
}
function deletedata()
{
  var url = "deleteconnid.jsp?cid=<%=strcid%>&eid=<%=streid%>";
  location.href=url;
}

</SCRIPT>
<%
 Variable[] sessionVariables = null;
 try
 {

   FlowSetup flowSetup = new FlowSetup();
   sessionVariables= flowSetup.GetVariableList();
 }
 catch(Exception ex)
 {
 }
 %>
</HEAD>
<BODY class="BodyMain">
<FORM name="RegForm" method="post" action="../../../flowprocess.do">
<input type="hidden" name="formfields" value="">
<input type="hidden" name="InputType" value="1"/>
<input type="hidden" name="ID" value="<%=ID%>">
<input type="hidden" name="CID" value="<%=strcid%>">
<input type="hidden" name="EID" value="<%=streid%>">

<input type="hidden" name="Act" value="edit1">


<% if(!"6".equals(user.getUserWINDOWTYPE())){%>
<%=userUI.ShowHeadHtml("关系管理",user.getUserImage())%>
<%=userUI.ShowBodyStartHtml()%><table width="100%">
<%}%>
  <tr>
    <td height="450"  valign="top">



<DIV id="con">
  <UL id="tags">
    <LI class="selectTag">
      <A onClick="selectTag('tagContent0',this)"  href="javascript:void(0)">
      <IMG src="../../../ZrwebGui/tab/skin/<%=user.getUserImage()%>/page.gif" align='absmiddle' border=0>
      基本属性
      </A>
    </LI>
     <LI>
       <A onClick="selectTag('tagContent1',this)" href="javascript:void(0)">
       <IMG src="../../../ZrwebGui/tab/skin/<%=user.getUserImage()%>/page.gif" align='absmiddle' border=0>
         接收人属性
       </A>
     </LI>


  </UL>





<DIV id="tagContent">
    <DIV class="tagContent selectTag" id="tagContent0">


            <br>
            &nbsp;
             <fieldset style="width: 98%">
               <legend>基本属性管理</legend>
                <table border='0' width="99%" cellspacing="0" cellpadding="0" align=center>
                  <tr>
                   <td colspan="2">
                    <table border='0' width="100%" cellspacing="0" cellpadding="0" align=center>
                     <tr>
                      <td colspan=2  align=left>依赖名称：<input class="text" type="text" name="NAME" size="30"  value="<%=Pr.getNAME()%>"  maxlength="100"></td><td colspan=2 align=left>依赖描述：<input class="text" type="text" name="DESC1" size="30"  value="<%=Pr.getDESC1()%>" maxlength="100"></td>
                     </tr>
                     <tr>
                       <td colspan=2 align=left>附件检测:
                         <input type="radio"  onclick="ISATT.value=1" name="ISATT1" value=1 <% if (Pr.getISATT().equals("1")) {out.print("checked");}%>>是　
                         <input type="radio" onclick="ISATT.value=0" name="ISATT1" value=0 <% if (Pr.getISATT().equals("0")) {out.print("checked");}%>>否
                         <input type="hidden" name="ISATT" value="<%=Pr.getISATT()%>">
                       </td>
                       <td colspan=2 align=left>关联流程是否必建检测:
                         <input type="radio"  onclick="ISNEED.value=1" name="ISNEED1" value=1 <% if (Pr.getISNEED().equals("1")) {out.print("checked");}%>>是　
                         <input type="radio"  onclick="ISNEED.value=0" name="ISNEED1" value=0 <% if (Pr.getISNEED().equals("0")) {out.print("checked");}%>>否
                         <input type="hidden" name="ISNEED" value="<%=Pr.getISNEED()%>">
                       </td>
                     </tr>

                     <tr>
                       <td colspan=4 style="border-bottom:1px inset #999999;">　</td>
                     </tr>
                     <tr>
                     <td colspan=4 height=1  ></td>
                     <tr>
                     <tr>
                     <td colspan=4 height=5  >条件设置&nbsp;&nbsp;&nbsp;</td>
                     <tr>
                      <tr>
                        <td width="20%" align="center" height=23>
                          待选表
                        </td>
                        <td width="20%" align="center">
                          待选字段
                        </td>
                        <td width="20%" align="center">
                          待选SESSION值
                        </td>
                        <td width="40%" align="center"></td>
                    </tr>
                    <tr>
                        <td align="center">
                          <select id="TableList" name="TableList" style="width:150px;height:150px" size=15 onChange="loadFieldList(this.value)" onclick="fillTableName(this)">
                          </select>
                        </td>
                        <td align=center>
                          <select id="FieldList" name="FieldList" style="width:150px;height:150px" size=15 onclick="fillFieldName(this)">
                          </select>
                        </td>
                        <td  align="center" >
                          <select name="SessionValueList" style="width:150px;height:150px" size=15 onclick="fillSessionName(this)">
                           <%
                          if(sessionVariables!=null)
                          {
                            for( int i=0;i< sessionVariables.length;i++)
                            {
                              out.print("<option value=\""+sessionVariables[i].getCODE()+"\">"+sessionVariables[i].getNAME()+"</option>");
                            }
                          }
                          %>
                          </select>
                        </td>
                        <td align="center" valign="top">
                          <input  type="button" value="+" class="Button1" onClick="btnSpecialValue('+')"/>
                          <input  type="button" value="-" class="Button1" onClick="btnSpecialValue('-')"/>
                          <input  type="button" value="*" class="Button1" onClick="btnSpecialValue('*')"/>
                          <input  type="button" value="/" class="Button1" onClick="btnSpecialValue('/')"/>
                          <input  type="button" value=">" class="Button1" onClick="btnSpecialValue('>')"/>
                          <input  type="button" value=">=" class="Button1" onClick="btnSpecialValue('>=')"/><br /><br />
                          <input  type="button" value="<"  class="Button1" onClick="btnSpecialValue('<')"/>
                          <input  type="button" value="<=" class="Button1" onClick="btnSpecialValue('<=')"/>
                          <input  type="button" value="!=" class="Button1" onClick="btnSpecialValue('!=')"/>
                          <input  type="button" value="=" class="Button1" onClick="btnSpecialValue('=')"/>
                          <input  type="button" value="(" class="Button1" onClick="btnSpecialValue('(')"/>
                          <input  type="button" value=")" class="Button1" onClick="btnSpecialValue(')')"/><br /><br />
                          <input  type="button" value="AND" class="Button1" onClick="btnSpecialValue(' AND ')"/>
                          <input  type="button" value="OR" class="Button1" onClick="btnSpecialValue(' OR ')"/>
                          <input  type="button" value="0" class="Button1" onClick="btnSpecialValue('0')"/>
                          <input  type="button" value="1" class="Button1" onClick="btnSpecialValue('1')"/>
                          <input  type="button" value="2" class="Button1" onClick="btnSpecialValue('2')"/>
                          <input  type="button" value="3" class="Button1" onClick="btnSpecialValue('3')"/><br /><br />
                          <input  type="button" value="4" class="Button1" onClick="btnSpecialValue('4')"/>
                          <input  type="button" value="5" class="Button1" onClick="btnSpecialValue('5')"/>
                          <input  type="button" value="6" class="Button1" onClick="btnSpecialValue('6')"/>
                          <input  type="button" value="7" class="Button1" onClick="btnSpecialValue('7')"/>
                          <input  type="button" value="8" class="Button1" onClick="btnSpecialValue('8')"/>
                          <input  type="button" value="9" class="Button1" onClick="btnSpecialValue('9')"/>
                        </td>
                  </tr>
                   <tr>
                       <td colspan=4 style="border-bottom:1px inset #999999;">　</td>
                   </tr>
                   <tr>
                      <td colspan=4 height=5>&nbsp;</td>
                  </tr>
                  <tr>
                     <td colspan=4><table><tr><td>
                     依赖条件：<input class="text" type="text" name="WHERE1" size="88" value="<%=Pr.getWHERE1()%>" maxlength="3000">
                     <%=userUI.ClickButton1("条件设置帮助","JavaScript:ShowHelpModal();","buttonSelect.gif",user.getUserImage())%>
                    </td></tr></table></td>
                  </tr>
               </table>
                </td>
               </tr>
            </table>
             <br>
          </fieldset>

        </DIV>


<DIV class="tagContent" id="tagContent1">

    <br>
      &nbsp;
       <fieldset style="width: 98%">
         <legend>接收人属性管理</legend>
           <table border='0' width="100%" cellspacing="0" cellpadding="0" align=center>
            <tr>
              <td colspan=2 height=10> </td>
                </tr>
                  <tr>
                  <td colspan="2">
                    <table border='0' width="70%" cellspacing="0" cellpadding="0" align=center>
                      <tr>
                        <td colspan=3 height=10> </td>
                      </tr>
                      <tr>
                    <td colspan=3 align=left >接收类型：
                    <select name="CONNTYPE"  onchange="select_onchang();">
                    <%=FlowPackage.ShowPackageSelect1(Pr.getTYPE())%>
                    </select></td>

                   </tr>

                    <tr>
                   <td colspan=3   style="border-bottom:1px inset #999999;">　</td>
                   </tr>

                <tr width="100%" align="center">
                        <td width="45%" align="center" height=23>
                         <div  id="div1" <% if (Pr.getTYPE().equals("5")){%>style="display:'';"<%} else {%>style="display:none;"<%}%>>选择活动的处理人</div>
                        </td>
                        <td width="10%" align="center">
                        </td>
                        <td width="45%" align="center">
                        </td>
                  </tr>

                  <tr width="100%" align="center">
                       <td width="45%" align="center" height=23>
                          <font class="AlertSign"><div  id="div2" <% if (Pr.getTYPE().equals("5")){%>style="display:'';"<%} else {%>style="display:none;"<%}%>>待选步骤</div></font>
                        </td>
                        <td width="10%" align="center">
                          <font class="AlertSign"><div  id="div3" <% if (Pr.getTYPE().equals("5")){%>style="display:'';"<%} else {%>style="display:none;"<%}%>>操作</div></font>
                        </td>
                        <td width="45%" align="center">
                          <font class="AlertSign"><div  id="div4" <% if (Pr.getTYPE().equals("5")){%>style="display:'';"<%} else {%>style="display:none;"<%}%>>已选步骤</div></font>
                        </td>
                  </tr>
                  <tr width="70%" align="center">
                        <td width="35%" align="center" height=23>
                            <font class="AlertSign"> <div  id="div5" <% if (Pr.getTYPE().equals("5")){%>style="display:'';"<%} else {%>style="display:none;"<%}%>>
                             </div></font>
                        </td>
                        <td width="10%" align="center">
                          <font class="AlertSign"></font><div  id="div11" style="display:none;"> <%=Flow.Activity_AllList("hiddList","",Pr.getFID())%></div>
                        </td>
                        <td width="35%" align="center">

                        </td>
                </tr>
                <tr>
                        <td align="right">
                         <div  id="div6" <% if (Pr.getTYPE().equals("5")){%>style="display:'';"<%} else {%>style="display:none;"<%}%>> <%=Flow.Flow_Activity_List1(Pr.getFID(),"srcList","")%></div>
                          <br><div  id="div7" <% if (Pr.getTYPE().equals("5")){%>style="display:'';"<%} else {%>style="display:none;"<%}%>><input type="checkbox" name="SelAllX" onclick="JavaScript:CheckBoxSel(this.checked,'srcList');">
                          全选
                          &nbsp;&nbsp;
                          <Font class="WriteSign">注：使用Ctrl键可选择多个</Font></div>
                          <br>
                        </td>
                        <td align=center>
                         <div  id="div10" <% if (Pr.getTYPE().equals("5")){%>style="display:'';"<%} else {%>style="display:none;"<%}%>>   <img src="<%=SysPreperty.getProperty().AppUrl%>zrsysmanage/images/<%=user.getUserImage()%>/PuArrow_U.gif" style="cursor:pointer" title="上移" onclick="javascript:upFromDestList();"><br><br>
                            <img src="<%=SysPreperty.getProperty().AppUrl%>zrsysmanage/images/<%=user.getUserImage()%>/PuArrow_R.gif" style="cursor:pointer" title="增加活动" onClick="javascript:addSrcToDestListPu(srcList,destList)"><br><br>
                             <img src="<%=SysPreperty.getProperty().AppUrl%>zrsysmanage/images/<%=user.getUserImage()%>/PuArrow_L.gif"  style="cursor:pointer" title="删除活动" onclick="javascript:deleteFromDestListPu(destList);"><br><br>
                              <img src="<%=SysPreperty.getProperty().AppUrl%>zrsysmanage/images/<%=user.getUserImage()%>/PuArrow_D.gif"  style="cursor:pointer" title="下移" onclick="javascript:downFromDestList();">
                        </div></td>
                        <td align=left>
                         <div  id="div8" <% if (Pr.getTYPE().equals("5")){%>style="display:'';"<%} else {%>style="display:none;"<%}%>><%=Flow.Flow_Activity_List(ID,"destList","")%></div>
                          <br>
                          <div  id="div9" <% if (Pr.getTYPE().equals("5")){%>style="display:'';"<%} else {%>style="display:none;"<%}%>><input type="checkbox" name="SelAllX" onclick="JavaScript:CheckBoxSel(this.checked,'destList');">
                          全选
                          &nbsp;&nbsp;
                          <Font class="WriteSign">注：使用Ctrl键可选择多个</Font></div>
                          <br>
                        </td>
                      </tr>

                    </table>
                  </td>
                </tr>
              </table>


              <center>
            </fieldset>

          </DIV>
  </DIV>
</DIV>


    </td>
  </tr>
  <tr valign="top">
    <td valign="top">
      <center>
        <br>
        <table cellspacing="0" cellpadding="0" border='0'>
         <tr>
         <%=userUI.ClickButton("保存","JavaScript:if(Check(document.RegForm)){document.RegForm.submit();}","buttonSave.gif",user.getUserImage())%>
         <%=userUI.ClickButton("删除","JavaScript:deletedata();","buttonDelete.gif",user.getUserImage())%>

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

        </tr></table>
      </center>
    </td>
  </tr>
</table>

<% if(!"6".equals(user.getUserWINDOWTYPE())){%>
<%=userUI.ShowFootHtml()%>
<%}%>
<SCRIPT LANGUAGE="javascript">
<!--


    //加载数据表下拉列表。
    function loadTableList(){

        FlowMaActBean.GetTableList(
        function(items){
              dwr.util.addOptions("TableList",items,0,1);

              if(RegForm.TableList.length>0)
              {
                 RegForm.TableList.selectedIndex=0;
                 loadFieldList(RegForm.TableList.value);
              }

        }
        );


    }


    loadTableList();

     // 加载字段下拉列表。
    function loadFieldList(TableName){
        if(TableName==null||TableName==''){
        ClearFieldList();
        return;
        }

        FlowMaActBean.GetFieldList(TableName,
        function(items){
              ClearFieldList();
              dwr.util.addOptions("FieldList",items,0,1);
              if(RegForm.FieldList.length>0)
              {
                RegForm.FieldList.selectedIndex=0;
              }

        }
        );

    }


    function ClearFieldList(){
        dwr.util.removeAllOptions("FieldList");
    }


-->
</SCRIPT>
</FORM>
</BODY>
</HTML>
<%
//清空相关对象
user =null;
userUI=null;
Flow=null;
flowManageAct=null;
FlowPackage=null;
FControl=null;
Pr=null;
%>
