<%@page contentType="text/html; charset=GBK" %>

<%@page import="zr.zrpower.common.util.SysPreperty"%>
<%@page import="zr.zrpower.ejb.sys.UIService"%>
<%@ page import = "zr.zrpower.analyseengine.mode.Variable"%>
<%@ page import = "zr.zrpower.analyseengine.service.StatisticsConfig"%>
<%@page import="zr.zrpower.entity.sys.SessionUser"%>
<html>
<%
  SessionUser user = (SessionUser) session.getAttribute("userinfo");
  UIService userUI = new UIService();


StatisticsConfig StatisticsCfg =  new StatisticsConfig();
Variable[] Variables = null;
Variables = StatisticsCfg.GetVariableList();
  request.setCharacterEncoding("GBK");
String strResult=request.getParameter("strResult");


  //html5用到
  String userClass="windowimg";
  String zdid=request.getParameter("zdid");
  if(!"6".equals(user.getUserImage())){
     userClass=user.getUserImage();
  }
%>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=GBK">
<META HTTP-EQUIV="pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Cache-Control" CONTENT="no-cache, must-revalidate">
<META HTTP-EQUIV="expires" CONTENT="0">
<title><%=SysPreperty.getProperty().SystemName%><%=SysPreperty.getProperty().Versoin%></title>

<link REL="stylesheet" type="text/css" href="../../zrsysmanage/css/<%=user.getUserCSS()%>">
<SCRIPT LANGUAGE="JavaScript" src="../../zrsysmanage/script/Public.js"></SCRIPT>
<SCRIPT LANGUAGE="JavaScript" src="../../zrsysmanage/script/DealList.js"></SCRIPT>
<script Language="javascript">

  function  fillVariable(obj)
  {
   RegForm.txtResult.value=RegForm.txtResult.value+obj.options[obj.selectedIndex].value;
  }

  function  OKClick()
  {


    <%if("6".equals(user.getUserImage())){%>
    var index = parent.layer.getFrameIndex(window.name); //获取窗口索引
      parent.$('#<%=zdid%>').val(RegForm.txtResult.value);
      parent.layer.close(index);
    <%}else{%>
      window.returnValue=RegForm.txtResult.value;
       window.close();
    <%}%>
  }
</script>

</head>

<body class="BodyMain">
<form action="" method="post" name="RegForm">
<!--HTML Head表单头显示[显示内容，用户肤色的图片文件夹]-->
<%=userUI.ShowHeadHtml("设置管理",user.getUserImage())%>
<!--HTML Body Start显示表单开始部分-->
<%=userUI.ShowBodyStartHtml()%>

  <fieldset style="width:95%">
    <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 width="50%" align="center" height=23>
                           待选变量值
                        </td>

                      <td width="50%" align="center">设置说明</td>
                      </tr>
                      <tr>
                        <td  align="center" >
                          <select name="VaribleList" style="height: 150px;width: 200px" size=15 onchange="fillVariable(this)" >
                          <%
                          if(Variables!=null)
                          {
                            for(int i=0;i< Variables.length;i++)
                            {
                              out.print("<option value=\""+Variables[i].getCODE()+"\">"+Variables[i].getNAME()+"</option>");
                            }
                          }
                          %>
                          <option value="P1">自定义参数1</option>
                          <option value="P2">自定义参数2</option>
                          <option value="P3">自定义参数3</option>
                          <option value="P4">自定义参数4</option>
                          <option value="P5">自定义参数5</option>

                          </select>
                        </td>
                        <td align="left" valign="top">
1.获取当前日期为sysdate;<br />
2.字符串相加表示为'aaaa'||'bb',结果为'aaaabb';<br />
3.Session变量与字符串相加表示为'{变量}'||'bb',结果为'变量的值bb';<br />
4.字符串拆分用substr表示,如substr('{变量}',1,2)表示为从1位开始,取2个字符;<br />
5.自定义参数为通过页面地址传递的值;<br />
注意：在设置公式时应符合运算的规则，设置好后应检查一次，在确认没问题时再确定!
                        </td>
                      </tr>
                   <tr>
                   <td colspan=2 style="border-bottom:1px inset #999999;">&nbsp;</td>
                   </tr>
                   <tr>
                   <td colspan=2 height=5>&nbsp;</td>
                   </tr>
                   <tr>
                    <td align=center colspan=2>设置结果：<input class="text" type="text" name="txtResult" size="90" value="<%=strResult%>"   maxlength="1000" ></td>

                   </tr>
                    </table>
                  </td>
                </tr>
              </table>
              <br>
  </fieldset>
  <center>
    <br>
     <table cellspacing="0" cellpadding="0" border='0'><tr>
                 <%=userUI.ClickButton1("确 定","OKClick();","buttonSure.gif",user.getUserImage())%>

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

                <%}else{ %>
                    <%=userUI.ClickButton1("取 消","window.close();","buttonClose.gif",user.getUserImage())%>
                <%} %>
          </tr></table>
    <br/>
  </center>

  <!--HTML Foot显示表单尾-->
<%=userUI.ShowFootHtml()%>
</form>
</body>
</html>
<%
//清空相关对象
user = null;
userUI = null;
Variables = null;

%>
