<%@ Page Language="VB" ContentType="text/html" ResponseEncoding="gb2312" Inherits="b2bNet.Admin_Admin_SQLTag_Add" %>
<%On Error Resume Next%>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<link href="inc/admin_style.css" rel="stylesheet" type="text/css" /><link href="inc/style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="inc/xml_http_lib.js"></script>
<title><%=AppConst.SiteName%></title>
<style type="text/css">
<!--
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
}
.style1 {color: #FF0000}
.lh15 {LINE-HEIGHT: 150%
}
-->
</style>
<script type="Text/JavaScript" language=javascript>
function checkTagName()
{
    //document.form.T_Name.value.replace(/^\w+$/, "");
}

function newadd(){
	if(document.form.T_Name.value==""){
		alert("请指定标签名称！");
		document.form.T_Name.focus();
		return false;
	}
	if(document.form.T_SQL.value==""){
		alert("请指定标调用的SQL语句！");
		document.form.T_SQL.focus();
		return false;
	}
//	if(document.form.T_HTML.value==""){
//		alert("请指定标签内容！" + document.form.T_HTML.value);
//		document.form.T_HTML.focus();
//		return false;
//	}
	return true;
}
function getTagHtml()
{
    var htmlTag = encodeURIComponent(document.all.T_SQL.value.replace(/\"/g, ""));
    if (htmlTag == "") return
    var args = prompt("请输入标签参数，以逗号间隔", "");
    if (args == null) return
    
    args = encodeURIComponent(args.replace(/\"/g, ""));
    document.all.btnRefresh.disabled = true;
    var geturl = "Admin_SQLTag_GetFields.aspx?sql=" + htmlTag + "&args=" + args + "&r=" + Math.random();
    xmlHttp.open("GET", geturl, true);
    xmlHttp.send(null);
    xmlHttp.onreadystatechange = function()
    {
        if (xmlHttp.readyState == 4)
        {
            document.getElementById("div_Preview").innerHTML = xmlHttp.responseText;
            document.all.btnRefresh.disabled = false;
        }
    }
}
</script>
</head>
<body>
<table style="background-color:#A6D7FF; width:100%" border="0" cellpadding="0" cellspacing="1">
      <tr>
        <td style="height:24" class="topbg"><div align="center"><strong>==添加动态标签==</strong></div></td>
      </tr>
</table>
      <table style="width:100%"  border="0" align="center" cellpadding="0" cellspacing="0">
        <tr>
          <td style="height:27; width:30" align="center"><img src="images/12.gif" width="6" height="10" /></td>
          <td>您现在的位置：<%=AppConst.SiteName%> > <a href="Admin_SQLTag.aspx">动态标签</a> > 添加</td>
        </tr>
      </table>
      <table style="width:100%"  border="0" cellpadding="3" cellspacing="1" class="border">
        <form name="form" method="post" onsubmit="return newadd()">
        <tr>
          <td style="height:12" colspan="2" class="Title"><div align="center"><strong>==添加动态标签==</strong></div></td>
        </tr>
        <tr class="tdbg">
          <td style="height:13; width:21%"><div align="right" style="color:Red">* 标签名称：</div></td>
          <td style="height:13; width:79%"><input type="text" name="T_Name" value="" size="40" onchange="checkTagName();" />&nbsp;&nbsp注：代 &nbsp;&nbsp;* 为必填。</td>
        </tr>
        <tr class="tdbg">
          <td style="height:13; width:21%" valign="top" ><div align="right" style="color:Red">* 调用SQL：</div></td>
          <td style="height:13; width:79%"><textarea name="T_SQL" rows="4" style="width: 550" ></textarea>
            <input type="button" onclick="getTagHtml()" name="btnRefresh" value="刷新字段" />
          </td>
        </tr>
        <tr class="tdbg">
          <td style="height:13; width:21%" valign="top" ><div align="right">字段列表：</div></td>
          <td style="height:13; width:79%"><div id="div_Preview" style="width: 100%; word-break:break-all; word-wrap:break-word" ></div></td>
        </tr>
        <tr class="tdbg">
          <td style="height:25" align="right" valign="top" class="tdbg" >* 标签代码：</td>
          <td style="" valign="top" class="tdbg"><textarea name="T_HTML" rows="12" style="width: 550; word-wrap:normal; word-break:keep-all; overflow-x:auto" ></textarea></td>
        </tr>
        <tr class="tdbg">
          <td style="height:13; width:21%" valign="top"><div align="right">标签说明：</div></td>
          <td style="height:13; width:79%"><textarea name="T_Remark" rows="2" style="width: 550"></textarea></td>
        </tr>
        <tr class="tdbg">
          <td style="height:13"><div align="right">是否启用：</div></td>
          <td style="height:13"><label><input name="IsUsable" type="checkbox" id="IsUsable" value="1" checked="checked" />启用标签</label>
              &nbsp; 脚本类型：<select name="T_Language" >
                <option value="VbAspx" selected>ASP代码</option>
                <option value="VbCode">VB代码</option>
              </select>
          </td>
        </tr>
        <tr class="tdbg" height="10"><td colspan="2"></td></tr>
        <tr class="tdbg">
          <td style="height:26">&nbsp;</td>
          <td style="height:26"><input type="submit" name="Submit" value="提交" style="width:100px;" />
          &nbsp;&nbsp;
            <input type="reset" name="Submit" value="重置"  style="width:100px;"/></td>
        </tr>
        </form>
      </table>
      <table width="100%" cellpadding="3" cellspacing="1" class="border">
      <tr>
        <td style="width: 50%" class="tdbg"><font color="red"><strong>Field("ID")</strong></font> -- 获取字段ID的值</td>
        <td style="width: 50%" class="tdbg"><font color="red"><strong>List</strong></font> -- 标签的记录集</td>
      </tr>
      <tr>
        <td class="tdbg"><font color="red"><strong>IsNull(arg1)</strong><span style="color: #000000; background-color: #f0f0f0">
                -- 判断参数 arg1 是否为空</span></font></td>
      <td class="tdbg">
          <strong><span style="color: #ff0000">Input(0)</span></strong> -- 获取第1个标签参数（从零开始）</td>
    </tr>
    <tr>
        <td class="tdbg">
        <font color="red"><strong>NotNull(arg1)</strong></font> -- 判断参数 arg1 是否非空</td>
        <td class="tdbg">
        <strong><span style="color: #ff0000">FixedLenText(arg1, 20)</span></strong> -- 限定arg1的字符长度为20，若超出20，则以省略号代替</td>
    </tr>
    <tr>
        <td class="tdbg">
            <strong><span style="color: red">IsTrue(arg1)</span></strong> --&nbsp; 判断 arg1 是否为
            True</td>
        <td class="tdbg">
        <font color="red"><strong>Output(arg1)</strong></font> -- 将指定字符串以HTML格式输出
        </td>
    </tr>
          <tr>
              <td class="tdbg">
                  <span style="color: #ff0000"><strong>GetMemberTypeName(3)</strong></span> -- 获取会员类型名称</td>
              <td class="tdbg">
                  <span style="color: #ff0000"><strong>YearDiff(arg1)</strong></span> -- 指定日期到今天所经过的年度</td>
          </tr>
</table>
</body>
</html>
