@using Common;
@model string

<div class="main">
    <form class="form-horizontal form ui-validForm" action="@Url.Action()" method="post">
        <div class="control-group">
            <label class="control-label">采集名称</label>
            <div class="controls form-inline form-group-sm">
                <input type="text" value="" class="form-control" id="name" name="name" data-validate="dataType:'*" nullMsg:'请填写采集名称!" style="width:95%" />
                <span class="help-block"></span>
            </div>
        </div>
        <div class="control-group">
            <label class="control-label">采集类型</label>
            <div class="controls form-inline form-group-sm">
                <select class="form-control" id="table_id" name="table_id" style="width:95%" data-validate="dataType:'*" nullMsg:'请选择采集类型！">
                </select>
                <span class="help-block"></span>
            </div>
        </div>
        <div class="control-group">
            <label class="control-label">域名</label>
            <div class="controls form-inline form-group-sm">
                <input type="text" value="" class="form-control" id="url" name="url" data-validate="dataType:'*" nullMsg:'请填写域名!" style="width:95%" />
                <span class="help-block">如:http://www.pageadmin.net</span>
            </div>
        </div>
        <div class="control-group">
            <label class="control-label radio">链接是否规则</label>
            <div class="controls">
                <label class="radio-inline">
                    <input type="radio" name="is_rules" id="is_rules" class="ui-show-hide" showObjs=".list_url,.list_page" hideObjs=".irregular_list_url" checked="checked" value="1">是
                </label>
                <label class="radio-inline">
                    <input type="radio" name="is_rules" id="is_rules" class="ui-show-hide" showObjs=".irregular_list_url" hideObjs=".list_url,.list_page" value="0">否
                </label>
                <span class="help-block"></span>
            </div>
        </div>
        <div class="control-group list_url">
            <label class="control-label">规则列表链接</label>
            <div class="controls form-inline form-group-sm">
                <input type="text" value="" class="form-control" id="list_url" name="list_url" data-validate="dataType:'*" nullMsg:'请填写采集列表链接!" style="width:95%" />
                <span class="help-block">请把规则页数替换成*</span>
            </div>
        </div>
        <div class="control-group irregular_list_url">
            <label class="control-label">不规则列表链接</label>
            <div class="controls form-inline form-group-sm">
                <textarea class="form-control" id="irregular_list_url" name="irregular_list_url" data-validate="dataType:'*" nullMsg:'请填写采集列表链接!" style="width:95%;height:100px;"></textarea>
                <span class="help-block">如多条链接用","隔开</span>
            </div>
        </div>
        <div class="control-group list_page">
            <label class="control-label">采集列表页数</label>
            <div class="controls form-inline form-group-sm clearfix">
                <input type="text" placeholder="开始页数" class="form-control left" id="list_startpage" name="list_startpage" data-validate="dataType:'*" nullMsg:'请填写采集列表开始页!" style="width:100px;margin-right:5px;" />
                <input type="text" placeholder="结束页数" class="form-control" id="list_endpage" name="list_endpage" data-validate="dataType:'*" nullMsg:'请填写采集列表结束页!" style="width:100px" />
                <span class="help-block">如：采集1-10页,填写开始1,结束10</span>
            </div>
        </div>
        <div class="control-group">
            <label class="control-label radio">延迟时间</label>
            <div class="controls">
                <label class="radio-inline">
                    <input type="radio" name="seconds" id="seconds" checked="checked" value="10">10毫秒
                </label>
                <label class="radio-inline">
                    <input type="radio" name="seconds" id="seconds" value="20">20毫秒
                </label>
                <label class="radio-inline">
                    <input type="radio" name="seconds" id="seconds" value="30">30毫秒
                </label>
                <span class="help-block"></span>
            </div>
        </div>
        <div class="control-group">
            <label class="control-label radio">采集页面编码</label>
            <div class="controls">
                <label class="radio-inline">
                    <input type="radio" name="encodname" id="encodname" value="GB2312">GB2312
                </label>
                <label class="radio-inline">
                    <input type="radio" name="encodname" id="encodname" checked value="UTF-8">UTF-8
                </label>
                <span class="help-block"></span>
            </div>
        </div>
        <div class="control-group">
            <label class="control-label">采集列表开始html</label>
            <div class="controls form-inline form-group-sm">
                <input type="text" value="" class="form-control" id="list_starthtml" name="list_starthtml" data-validate="dataType:'*" nullMsg:'请填写采集列表开始html!" style="width:95%" />
                <span class="help-block"></span>
            </div>
        </div>
        <div class="control-group">
            <label class="control-label">采集列表结束html</label>
            <div class="controls form-inline form-group-sm">
                <input type="text" value="" class="form-control" id="list_endhtml" name="list_endhtml" data-validate="dataType:'*" nullMsg:'请填写采集列表结束html!" style="width:95%" />
                <span class="help-block">html标签有空格用\s+替换,如:&lt;div class="list"&gt;\s+&lt;ul&gt;</span>
            </div>
        </div>
        <div class="control-group">
            <label class="control-label">采集链接包含</label>
            <div class="controls form-inline form-group-sm">
                <input type="text" value="" class="form-control" id="href_contain" name="href_contain" style="width:95%" />
                <span class="help-block">html标签有空格用\s+替换,如:&lt;/ul&gt;\s+&lt;/div&gt;</span>
            </div>
        </div>
        <div class="control-group">
            <label class="control-label">采集链接不包含</label>
            <div class="controls form-inline form-group-sm">
                <input type="text" value="" class="form-control" id="no_href_contain" name="no_href_contain" style="width:95%" />
                <span class="help-block"></span>
            </div>
        </div>

        <div class="control-group">
            <label class="control-label"></label>
            <div class="controls form-inline">
                <input type="hidden" id="state" name="state" value="0" />
                <input type="hidden" id="uid" name="uid" value="@PA.GetCurrentUser().Uid" />
                <input type="hidden" id="id" name="id" value="{id}" />
                <button type="button" class="btn btn-primary btn-sm ui-pagePost Preservation" data-custom-params="url:'@Url.Action()',callBack:'PostRefreshBack'" id="bt_submit">提交</button>
                <button type="button" class="btn btn-primary btn-sm ui-pagePost NextStep" data-custom-params="url:'@Url.Action()',callBack:'CallBack'" id="bt_submit">下一步</button>
                <button type="button" class="btn btn-default btn-sm ui-closeDialog">关闭</button>
                <span class="help-block"></span>
            </div>
        </div>
    </form>
</div>
<script type="text/javascript">
    var params = { valueField: 'id', textField: 'remark'};/*绑定表*/
    var listJson = CallAjax("get", false, "@Url.Action("ListData", "InfoTable")");
    $("#table_id").FillSelect(eval(listJson), params);

    //绑定数据
    var id =Request("id");
    if (id != "") {
        $(".NextStep").show().siblings(".Preservation").hide();
        var data = @Html.Raw(Model??"null");
        $(".form").FormBind(data);
    } else
    {
        $(".Preservation").show().siblings(".NextStep").hide();
    }
    function CallBack()
    {
        var params = { title: "采集配置", url: "@Url.Action("DetailRule")?id="+id, width: "780px", height: "90%"};
        IDialog(params);
        return true;
    }

</script>






