<!-- #include file="admin_conn.asp" -->
<%
chkLogin
dim action : action = be("get","action")
dim objxml,xmlnode
set objxml = new AppXmlDom : objxml.OpenXml("../inc/vodplay.xml")
set xmlnode = objxml.FindNodes("players/player")

select case action
	case else: headAdmin "播放器管理" : main
end select
dispseObj()

sub main()
	dim status,from,show,des,sort,tip,i
%>
<script language="javascript">
$(document).ready(function(){
	$("#form2").validate({
		rules:{
			from:{
				required:true,
				maxlength:32,
				stringCheck:true
			},
			des:{
				required:true,
				maxlength:254
			},
			show:{
				required:true,
				stringCheck:true,
				maxlength:64
			},
			sort:{
				number:true
			},
			tip:{
				maxlength:255
			}
		}
	});
	$('#form1').form({
		onSubmit:function(){
			if(!$("#form1").valid()) {return false;}
		},
	    success:function(data){
	        $.messager.alert('系统提示', data, 'info',function(){
	        	location.href=location.href;
	        });
	    }
	});
	$('#form2').form({
		onSubmit:function(){
			if(!$("#form2").valid()) {return false;}
		},
	    success:function(data){
	        $.messager.alert('系统提示', data, 'info');
	    }
	});
	$("#btnAdd").click(function(){
		$('#form2').form('clear');
		$("#flag").val("add");
		$("#from").attr("readonly",false);
		$('#win1').window('open');
	});
	$("#btnCancel").click(function(){
		location.href= location.href;
	});
});
function edit(id)
{
	$('#form2').form('clear');
	$("#flag").val("edit");
	$("#from").attr("readonly",true);
	$('#win1').window('open');
	$('#form2').form('load','admin_ajax.asp?action=getinfoxml&tab=vodplay&val='+id);
}
</script>
<form action="" method="post" id="form1" name="form1">
<table class="tb">
    <tr>
      <td width="10%">来源</td>
      <td width="10%">序号</td>
      <td width="13%">名称</td>
      <td width="10%">状态</td>
      <td width="13%">备注</td>
      <td>提示信息</td>
      <td width="15%">操作</td>
    </tr>
	<%
	 if xmlnode.length=0 then
	%>
    <tr><td align="center" colspan="5">没有任何记录!</td></tr>
	<%
		else
		for i=0 to xmlnode.length-1
			status = xmlnode(i).getAttributeNode("status").nodevalue
			sort = xmlnode(i).getAttributeNode("sort").nodevalue
			from = xmlnode(i).getAttributeNode("from").nodevalue
			show = xmlnode(i).getAttributeNode("show").nodevalue
			des = xmlnode(i).getAttributeNode("des").nodevalue
			tip = xmlnode(i).selectNodes("tip")(0).text
	%>
    <tr>
      <td><%=from%></td>
      <td><%=sort%></td>
      <td><%=show%></td>
      <td><%
      if status="1" then writeA "<font color=green>启用</font>" else writeA "<font color=red>禁用</font>"
      %></td>
      <td><%=des%></td>
      <td><%=tip%></td>
      <td>
	  <a href="javascript:void(0)" onclick="edit('<%=from%>');return false;">修改</a> |
	  <a href="admin_ajax.asp?action=delxml&tab=vodplay&val=<%=from%>" onClick="return confirm('确定要删除吗?');">删除</a></td>
    </tr>
	<%
		next
	end if
	%>
</table>
</form>

<div id="win1" class="easyui-window" title="窗口" style="padding:5px;width:450px;" closed="true" minimizable="false" maximizable="false">
<form action="admin_ajax.asp?action=savexml&tab=vodplay" method="post" name="form2" id="form2">
<table class="tb">
	<input id="flag" name="flag" type="hidden" value="">
	<tr>
	<td width="20%">来源：</td>
	<td><input id="from" size=40 value="" name="from" >
	</td>
    </tr>
	<tr>
	<td>名称：</td>
	<td><input id="show" size=40 value="" name="show" >
	</td>
    </tr>
    <tr>
	<td>状态：</td>
	<td>
	<select id="status" name="status">
	<option value="1">启用</option>
	<option value="0">禁用</option>
	</select>
	</td>
	</tr>
    <tr>
     <td>排序：</td>
      <td><input id="sort" size=10 value="" name="sort" >
	  </td>
    </tr>
	<tr>
	<td width="20%">备注：</td>
	<td><input id="des" size=40 value="" name="des">
	</td>
	</tr>
    <tr>
     <td>描述信息：</td>
      <td>
      <TEXTAREA id="tip" NAME="tip" ROWS="8" style="width:300px;table-layout:fixed; word-wrap:break-word;"></TEXTAREA>
	  </td>
    </tr>
    <tr align="center" >
      <td colspan="2"><input class="input" type="submit" value="保存" id="btnSave"> <input class="input" type="button" value="返回" id="btnCancel"></td>
    </tr>
</table>
</form>
</div>
</body>
</html>
<%
end sub

set xmlnode = nothing
set objxml= nothing
%>
