<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="Admin_Line.aspx.vb" Inherits="TourEx.Web.Admin_Line" validateRequest="false" %>
<%@ Import Namespace="TourEx.BLL" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题页</title>
<link rel="stylesheet" type="text/css" href="Css/Style.css"/>
<script type="text/javascript" src="../Sys/Js/jquery.js"></script>
<script type="text/javascript" src="../Sys/Js/CreateSelect.js"></script>
<script type="text/javascript" src="../Sys/Js/jquery.validate.js"></script>
<script type="text/javascript" src="../Sys/Js/jquery.validate.check.js"></script>
<script type="text/javascript" src="../Sys/WebEdit/xheditor-zh-cn.min.js"></script>
<script type="text/javascript" src="../Sys/WebEdit/xheditor_plugins/ubb.min.js"></script>
</head>
<body>
<form runat="server" id="TourExForm">
<ul class="navLocation">
	<li>您当前位置：<a href="Admin_Main.aspx">首页</a> > <a href="Admin_LineList.aspx">度假列表</a> > <asp:Label ID="navIgation" runat="server" Text=""></asp:Label></li>
</ul>
<asp:HiddenField ID="RanNum" runat="server" />
<div class="infoBox">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
	<tr>
		<td class="infoBoxTd" width="120px">度假名称：</td>
		<td>
			<asp:TextBox ID="L_Name" runat="server" MaxLength="30" Width="300px" CssClass="formTitle"></asp:TextBox>
		</td>
	</tr>
	<tr>
		<td class="infoBoxTd">度假主题：</td>
		<td>
                <asp:CheckBoxList ID="L_TopicsId" runat="server" 
                RepeatDirection="Horizontal" DataValueField="t_id" DataTextField="t_name" 
                    RepeatLayout="Flow">
                </asp:CheckBoxList>
			<label for="L_TopicsId"></label>
		</td>
	</tr>
	<tr>
		<td class="infoBoxTd">目的地：</td>
		<td>
			<span id="CategoryList">
				<asp:HiddenField ID="L_CategoryId" runat="server" Value="0" />
			</span>
			<label for="L_CategoryId"></label>
		</td>
	</tr>
	<tr>
		<td class="infoBoxTd">门市价：</td>
		<td>
			<asp:TextBox ID="L_RackRate" runat="server" 
                onkeyup="this.value=this.value.replace(/\D/g,'');" maxlength="6" Width="50px" CssClass="formTitle"></asp:TextBox> 元/位
		</td>
	</tr>
	<tr>
		<td class="infoBoxTd">价格：</td>
		<td>
			<asp:TextBox ID="L_Price" runat="server" 
                onkeyup="this.value=this.value.replace(/\D/g,'');" maxlength="6" Width="50px" CssClass="formTitle"></asp:TextBox> 元/位
		</td>
	</tr>
	<tr>
		<td class="infoBoxTd">儿童价:</td>
		<td>
			<asp:TextBox ID="L_ChildrenPrice" runat="server" 
                onkeyup="this.value=this.value.replace(/\D/g,'');" maxlength="6" Width="50px" CssClass="formTitle"></asp:TextBox> 元/位
		</td>
	</tr>
	<tr>
	  <td class="infoBoxTd">成人价点评<%=WebSet.BonusName %>：</td>
	  <td>
	    <asp:TextBox ID="L_Bonus" runat="server" onkeyup="this.value=this.value.replace(/\D/g,'');" Width="50px" CssClass="formTitle"></asp:TextBox>
元
	  </td>
	</tr>
	<tr>
	  <td class="infoBoxTd">儿童价点评<%=WebSet.BonusName %>：</td>
	  <td>
	    <asp:TextBox ID="L_ChildrenBonus" runat="server" onkeyup="this.value=this.value.replace(/\D/g,'');" Width="50px" CssClass="formTitle"></asp:TextBox>
元
	  </td>
	</tr>
	<tr>
		<td class="infoBoxTd">出发日期：</td>
		<td>
			<asp:TextBox ID="L_StartDate" runat="server" MaxLength="200" Text="天天发团" Width="300px" CssClass="formTitle"></asp:TextBox>
			<label for="L_StartDate"></label>
			<div class="lineDescription">
			格式一：天天发团<br />
			格式二：一,二,三,四,五,六,日(每周星期几发团，英文逗号分割)<br />
			格式三：1,2,3...(每月几号发团，英文逗号分割)<br />
			格式四：1-30,10-15...(直接填写日期，英文逗号分割)<br />
			</div>
		</td>
	</tr>
	<tr>
		<td class="infoBoxTd">特殊价：</td>
		<td>
            <asp:TextBox ID="L_SpecialPrice" runat="server" Height="74px" TextMode="MultiLine" CssClass="formTextarea"></asp:TextBox>
            <div class="lineDescription">格式：“月-日:成人价:儿童价”，每行一条记录</div>
		</td>
	</tr>
	<tr>
		<td class="infoBoxTd">往返交通：</td>
		<td>
			<asp:TextBox ID="L_Traffic" runat="server" MaxLength="50" Text="" Width="200px" CssClass="formTitle"></asp:TextBox>
		</td>
	</tr>
	<tr>
		<td class="infoBoxTd">提前报名：</td>
		<td>
			<asp:TextBox ID="L_EarlyBird" runat="server" MaxLength="50" Text="建议您提前**天报名" 
                Width="200px" CssClass="formTitle"></asp:TextBox>
		</td>
	</tr>
	<tr>
		<td class="infoBoxTd">出游天数：</td>
		<td>
            <asp:DropDownList ID="L_TravelDays" runat="server" onchange="AddDays();">
            <asp:ListItem Value="1" Text="1"></asp:ListItem>
            <asp:ListItem Value="2" Text="2"></asp:ListItem>
            <asp:ListItem Value="3" Text="3"></asp:ListItem>
            <asp:ListItem Value="4" Text="4"></asp:ListItem>
            <asp:ListItem Value="5" Text="5"></asp:ListItem>
            <asp:ListItem Value="6" Text="6"></asp:ListItem>
            <asp:ListItem Value="7" Text="7"></asp:ListItem>
            <asp:ListItem Value="8" Text="8"></asp:ListItem>
            <asp:ListItem Value="9" Text="9"></asp:ListItem>
            <asp:ListItem Value="10" Text="10"></asp:ListItem>
            <asp:ListItem Value="11" Text="11"></asp:ListItem>
            <asp:ListItem Value="12" Text="12"></asp:ListItem>
            <asp:ListItem Value="13" Text="13"></asp:ListItem>
            <asp:ListItem Value="14" Text="14"></asp:ListItem>
            <asp:ListItem Value="15" Text="15"></asp:ListItem>
            </asp:DropDownList>天
		</td>
	</tr>
	<tr id="TravelInstructions" style="display:none">
		<td class="infoBoxTd"></td>
		<td>
		    <ul class="lineTravel">
                <li><span class="Title">行程标题：</span><asp:TextBox ID="L_Title" runat="server" 
                        Width="200px" CssClass="formTitle"></asp:TextBox></li>
			    <li><span class="Title">行程说明：</span><asp:TextBox ID="L_Text" runat="server" TextMode="MultiLine" Height="100px" Width="500px"></asp:TextBox></li>
            </ul>
		</td>
	</tr>
	<tr>
		<td class="infoBoxTd">特色介绍：</td>
		<td>
			<asp:TextBox ID="L_SpecialServices" runat="server" TextMode="MultiLine" Height="80px" Width="500px" CssClass="formTextarea"></asp:TextBox>
		</td>
	</tr>
	<tr>
		<td class="infoBoxTd">预订须知：</td>
		<td>
			<asp:TextBox ID="L_BookNotes" runat="server" TextMode="MultiLine" Height="80px" Width="500px" CssClass="formTextarea"></asp:TextBox>
		</td>
	</tr>
	 <tr>
		<td class="infoBoxTd">温馨提醒：</td>
		<td>
			<asp:TextBox ID="L_Reminder" runat="server" TextMode="MultiLine" Height="80px" Width="500px" CssClass="formTextarea"></asp:TextBox>
		</td>
	</tr>
	<tr>
		<td class="infoBoxTd">费用包含：</td>
		<td>
			<asp:TextBox ID="L_FeeIncludes" runat="server" TextMode="MultiLine" Height="80px" Width="500px" CssClass="formTextarea"></asp:TextBox>
		</td>
	</tr>
	<tr>
		<td class="infoBoxTd">费用不包含：</td>
		<td>
			<asp:TextBox ID="L_FeeNoIncludes" runat="server" TextMode="MultiLine" Height="80px" Width="500px" CssClass="formTextarea"></asp:TextBox>
		</td>
	</tr>
	<tr>
		<td class="infoBoxTd">自费活动：</td>
		<td>
			<asp:TextBox ID="L_OptionalActivities" runat="server" TextMode="MultiLine" Height="80px" Width="500px" CssClass="formTextarea"></asp:TextBox>
		</td>
	</tr>
	<tr>
		<td class="infoBoxTd">购物：</td>
		<td>
			<asp:TextBox ID="L_Shop" runat="server" TextMode="MultiLine" Height="80px" Width="500px" CssClass="formTextarea"></asp:TextBox>
		</td>
	</tr>
	<tr>
		<td class="infoBoxTd">推荐：</td>
		<td><asp:CheckBox ID="L_TJ" runat="server" /></td>
	</tr>
	<tr>
		<td class="infoBoxTd">排序：</td>
		<td>
			<asp:TextBox ID="L_OrderId" runat="server" MaxLength="8" Width="50px" 
                CssClass="formTitle"></asp:TextBox>
		</td>
	</tr>
	<tr>
		<td class="infoBoxTd">&nbsp;</td>
		<td>
			<asp:Button ID="Button1" runat="server" Text="确定" CssClass="formInput01" />
		</td>
	</tr>
</table>
</div>
</form>

<script language="javascript" type="text/javascript">
<!--//
var editor=new Array();
CreateSelect("CategoryList","L_CategoryId",$('#L_CategoryId').val() ,0,"选择分类",function(){$('#L_CategoryId').valid();},"LineCategory","../");
function AddDays()
{
    var s=$('#L_TravelDays option:selected').text()
    var s1=$('[id^="days_"]').length;
    if(s>s1)
    {
        var tr,ti,te;
        ti=$('#L_Title').val().split("|");
        te=$('#L_Text').val().split("|");
        for(var i=s1+1;i<=s;i++)
        {
            $("#TravelInstructions").before($('#TravelInstructions').clone().attr('id','days_'+i)); 
        	tr=$("#TravelInstructions").prev("tr");
        	tr.find("td:first").text('第 '+i+' 天：');
        	$('[name="L_Title"]',tr).attr('id','L_Title_'+i).attr('name','L_Title_'+i);
        	$('[name="L_Text"]',tr).attr('id','L_Text_'+i).attr('name','L_Text_'+i);
        	$('#L_Title_'+i).rules('add',{required:true,messages:{required:'请填写标题!'}});
        	$('#L_Text_'+i).rules('add',{required:true,messages:{required:'请填行程说明!'}});
        	if(i<=ti.length)
        	{
	            $('#L_Text_'+i).val(html2ubb(ti[i-1]));
        	    $('#L_Title_'+i).val(ti[i-1]);
        	    $('#L_Text_'+i).val(te[i-1]);
        	 }else{
        	    $('#L_Title_'+i).val('');
        	    $('#L_Text_'+i).val('');
        	}
        	tr.show();
        	editor[i-1]=ExeEditor(i);
	        editor[i-1].setSource(html2ubb($('#L_Text_'+i).val()));
        }
    }else if(s1>s){
        $('[id^="days_"]').each(function(i){
            if(i>=s)
            {
                $('#L_Title_'+(i+1)).rules('remove');
                $('#L_Text_'+(i+1)).rules('remove');
                $(this).remove();
            }
        });
    }
}
function ExeEditor(i){
    return $('#L_Text_'+i).xheditor({tools:'full',width:'500',height:'150',forcePtag:false,internalScript:true,inlineScript:true,linkTag:true,localUrl:'root',showBlocktag:true,beforeSetSource:ubb2html,beforeGetSource:html2ubb,upImgUrl:'Admin_Upload.ashx?r='+$('#RanNum').val(),upFlashUrl:'Admin_Upload.ashx?r='+$('#RanNum').val(),upMediaUrl:'Admin_Upload.ashx?r='+$('#RanNum').val(),focus:function(){$('#L_Text_'+i).val(editor[i-1].getSource());$('#L_Text_'+i).valid();},blur:function(){$('#L_Text_'+i).val(editor[i-1].getSource());$('#L_Text_'+i).valid();}});

}
$(function(){
	$("#TourExForm").validate({
		rules:{
			L_Name: {required: true},
			L_TopicsId:{required: true,min:1},
			L_CategoryId: {required: true,min:1},
			L_RackRate:{required: true,min:1},
			L_Price:{required: true,min:1},
			L_ChildrenPrice:{required: true,min:1},
			L_StartDate:{required:true,CheckStartDate:true},
			L_SpecialPrice:{CheckSpecialPrice:true}
		},
		messages: {
			L_Name: {required: '请填写度假名称'},
			L_TopicsId:{required: '请选择度假主题',min:'请选择度假主题'},
			L_CategoryId: {required: '请选择度假类型',min:'请选择度假类型'},
			L_RackRate:{required: '请填写价格',min:1},
			L_Price:{required: '请填写价格',min:1},
			L_ChildrenPrice:{required: '请填写儿童价',min:1},
			L_StartDate:{required: '请填写发团日期'}
		}
	}); 
	AddDays();
    jQuery.validator.addMethod("CheckStartDate", function(value, element, param) {
        var IsStartDate=false;
        value = $.trim(value)
        if('天天发团'!=value)
        {
            var StartDate=value+','; 
    	    if(!StartDate.match(new RegExp('^(((0?[1-9])|(1[0-2]))-((0?[1-9])|([0-2][0-9])|(3[0-1])),)+$','i'))==false)
    	    {
    	        IsStartDate = true;
    	    }else if(!StartDate.match(new RegExp('^([一二三四五六日],)+$','i'))==false){
    	        IsStartDate = true;
    	    }else if(!StartDate.match(new RegExp('^(((0?[1-9])|([0-2][0-9])|(3[01])),)+$','i'))==false){
    	        IsStartDate = true;
    	    }
        }else{
            IsStartDate = true;
        }
	    return this.optional(element) || IsStartDate;  
    }, $.validator.format("发团日期格式不合法"));
    jQuery.validator.addMethod("CheckSpecialPrice", function(value, element) {
        var IsSpecialPrice=true;
        value = $.trim(value);
        if(''!=value)
        {
            value = value + "\n";
            if(!value.match(new RegExp('^(((0?[1-9])|(1[0-2]))-((0?[1-9])|([0-2][0-9])|(3[01])):([1-9][0-9]*):([1-9][0-9]*)([\r\n]{1,2}))+$','i')))
            {
                IsSpecialPrice=false;
            }
        }
	    return this.optional(element) || IsSpecialPrice;  
    }, $.validator.format("特殊价格式不合法"));
});
//-->
</script>
</body>
</html>
