<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>管理页面</title>
<link href="{webroot}theme/admin/css/layout.css" rel="stylesheet" type="text/css" />
<link href="{webroot}theme/admin/css/iframe.css" rel="stylesheet" type="text/css" />
<link href="{webroot}theme/admin/css/iconfont.css" rel="stylesheet" type="text/css" />
<link href="{webroot}lib/css/jquery.colorpicker.css" rel="stylesheet" type="text/css" />
<script src="{webroot}lib/js/jquery.js"></script>
<script src="{webroot}lib/js/jquery-migrate-1.1.0.min.js"></script>
<script src="{webroot}lib/js/jquery-ui.min.js"></script>
<script src="{webroot}theme/admin/js/jquery.layout-latest.min.js"></script>
<script src="{webroot}lib/tips/jquery.tips.js"></script>
<script src="{webroot}lib/validator/jquery.validator.js"></script>
<script src="{webroot}lib/validator/zh_CN.js"></script>
<script src="{webroot}lib/js/jquery.livequery.js"></script>
<script src="{webroot}theme/admin/js/admin.js"></script>
<script src="{webroot}lib/dialog/artdialog.js"></script>
<!--[if lt IE 9]>
<script src="{webroot}lib/js/html5.js"></script>
<![endif]-->
<script>
var myLayout;
$(function(){
	myLayout=$("body").layout({north__spacing_open:0,south__spacing_open:0,east__spacing_open:0,east__minSize:250,resizable:false});
	
	var html=$("#content").val();
	html=html.replace("plug","webroot}plug");
	html=html.replace("webroot","{webroot");
	$("#content").val(html);
	
	var $addInput=$("#addInput");
	var $tableid=$("#voteitem");
	var $addInput=$("#addInput");
	$addInput.click(function(){
		var sonnum=$("#voteitem li").size();
		var textValueTrHtml='<li><input type="text" name="t0" id="t0_'+sonnum+'" size="15" maxlength="50" class="ip" data-rule="客服名称:required;" /><input type="text" name="t1" id="t1_'+sonnum+'" size="40" maxlength="50" class="ip" data-rule="客服QQ:required;" />　<a href="javascript:;" class="leftarr iconfont">&#xe60a;</a><a href="javascript:;" class="rightarr iconfont">&#xe608;</a><a href="javascript:;" class="delarr iconfont">&#xe602;</a><span for="t1_'+sonnum+'" class="msg-box"></span></li>';
	    $tableid.append(textValueTrHtml);
	})
	
	$(".leftarr").live("click", function() {
		var $ValueTr = $(this).parent();
		var $PrevTr = $ValueTr.prev("li");
		var PrevTrIndex = $("#voteitem li").index($PrevTr);
		$PrevTr.insertAfter($ValueTr);
	});
	
	$(".rightarr").live("click", function() {
		var $ValueTr = $(this).parent();
		var $NextTr = $ValueTr.next("li");
		if ($NextTr.length > 0) {
			$NextTr.insertBefore($ValueTr);
		}
	});
	
	$(".delarr").live("click", function() {
		if (confirm("\u60a8\u786e\u5b9a\u8981\u5220\u9664\u5417\uff1f") == true) {
		var sonnum=$("#voteitem li").size()
		 $(this).parent().remove();
		}
	});
})
</script>
</head>
<body>

<div class="ui-layout-north">
    <div class="right_subject">当前位置：插件 > <a href="?">在线客服</a></div>
</div>
<form class="formname" method="post">
<div class="ui-layout-center">
    <div class="table_form">
        <div class="form_group">
            <div class="form_txt">调用代码：</div>
            <div class="form_input">
            <input type="text" id="content" value="&lt;script src=&quot;plug/service/online.js&quot;&gt;&lt;/script&gt;" class="ip" size="70"><br><span>请将代码放在模板底部文件中{if webmode=3}，并请重新生成网站{/if}(开启模板缓存的，请先清空缓存)</span>
            </div>
        </div>
 
        <div class="form_group">
            <div class="form_txt">客服管理：</div>
            <div class="form_input">
            <input type="button" value="增加客服" class="bnt_save" id="addInput">
               <ul class="voteitem" id="voteitem">
               <%dim xml,item,i,name,qq%>
               <%set xml=server.createobject("microsoft.xmldom")%>
               <%xml.async=false%>
               <%xml.load(server.mappath("data.xml"))%>
               <%set item=xml.getElementsByTagName("item")%>
               <%for i=0 to (item.length-1)%>
               <%set name=item.item(i).getElementsByTagName("name")%>
               <%set qq=item.item(i).getElementsByTagName("qq")%>
               <li><input type="text" name="t0" id="t0_<%=i%>" size="15" maxlength="50" class="ip" value="{name.item(0).Text}" data-rule="客服名称:required;" /><input type="text" name="t1" id="t1_<%=i%>" size="40" maxlength="50" class="ip" value="{qq.item(0).Text}" data-rule="客服QQ:required;" />　<a href="javascript:;" class="leftarr iconfont">&#xe60a;</a><a href="javascript:;" class="rightarr iconfont">&#xe608;</a><a href="javascript:;" class="delarr iconfont">&#xe602;</a><span for="t1_<%=i%>" class="msg-box"></span></li>
               <%next%>
                   <%set xml=nothing%>
                   <%set item=nothing%>
               </ul>
            </div>
        </div>
 
    </div>
</div>

<div class="ui-layout-south">
    <div class="form_bnt"><input type="submit" value="保存" class="bnt_save"></div>
</div>
</form>

<script>
$(".formname").validator(
	{
		stopOnError:true,
        theme:'yellow_top',
		ignore:':hidden',
		beforeSubmit:function(){$("input[type='submit']").attr("disabled",true);},
		valid:function(form)
		{			
			$.fn.tips({type:'loading',content:'数据提交中'});
			$.ajax(
			{
				url:"index.asp?act=edit",
				type:"post",
				data:$(form).serialize(),
				success:function(data){
					data=jQuery.parseJSON(data);
					$.fn.tips({type:'ok',content:data.info});
					$("input[type='submit']").attr("disabled",false);
				}
			});
		},
		invalid:function(){$("input[type='submit']").attr("disabled",false);}
	}
);
</script>

</body>
</html>