<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head><title><!--{$UUDEV_PAGE_TITLE}--></title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<!--{include file=elements/header.css.html}-->
<!--{include file=elements/header.js.html type=common}-->
<!--{include file=elements/header.js.html type=popbox}-->
<!--{include file=elements/header.js.html type=valid}-->
</head>
<body>
<div id="outside">
	<!--{include file=frame/top.html}-->
	<div id="mainareaContent">
		<!--{include file=frame/left.html}-->
		<div id="rightContent">
			<div id="topContent">
				<div class="sitmap">
					<span class="r"><!--{include file="elements/uuadvad.html"}--></span>模块管理&nbsp;&gt;&nbsp;音乐模块&nbsp;&gt;&nbsp;语种管理
				</div>
			</div>
			<div class="tabcontent">
				<a href="index.php?r=Music.musiclist" class="link">内管管理</a>
				<a href="index.php?r=SiteSet.musicset" class="link">属性设置</a>
				<a href="index.php?r=Music.musicListLayout" class="link">列表页布局</a>
					<a href="index.php?r=Music.musicPageLayout" class="link">内容页布局</a>
				<a href="index.php?r=Music.categorylist" class="link">风格</a>
				<a href="index.php?r=Music.languagelist" class="nolink">语种</a>
				<a href="index.php?r=Music.singerarealist" class="link">地区</a>
				<a href="index.php?r=Music.singerlist" class="link">歌手</a>
				<a href="index.php?r=Music.albumlist" class="link">专辑</a>
			</div>
			<div id="secrightContent">
				<div class="tableContent3">
					<form name="searchForm" action="index.php" method="get" onSubmit="setDisabled('button', window.document);">
						<input type="hidden" name="r" value="Music.languagelist"/>
						<div class="searchbar">
							语种&nbsp;<input type="text" class="text" name="language" value="<!--{$language}-->"/>
							&nbsp;<button type="submit" class="but2font">查询</button>
						</div>
					</form>
					<div class="operation">
						<button type="button" class="but2font" onClick="addLanguage('<!--{$returnParams}-->')">新增</button>
						<button type="button" class="but2font" onClick="batchOperate('index.php?r=Music.deletelanguage&returnParams=<!--{$returnParams}-->', 'recordId', 'ids', '确定删除？')">删除</button>
					</div>
					<table class="tbl_list" cellpadding="0" cellspacing="0" width="100%" border="0">
						<tr class="thead">
							<td width="5%"><input type="checkbox" class="checkall"/></td>
							<td width="45%">语种</td>
							<td width="25%">排序</td>
							<td width="25%">操作</td>
						</tr>
						<!--{foreach from=$datalist item=item name=list}-->
						<tr onMouseOver="chgTrColor(this)" onMouseOut="chgTrColor(this)">
							<td><input type="checkbox" class="checkid" name="recordId" value="<!--{$item.id}-->"/></td>
							<td><!--{$item.language}--></td>
							<td><!--{$item.show_order}--></td>
							<td><a href="javascript:editLanguage('<!--{$item.id}-->', '<!--{$returnParams}-->')">修改</a></td>
						</tr>
						<!--{foreachelse}-->
						<tr><td colspan="4">没有对应数据</td></tr>
						<!--{/foreach}-->
					</table>
					<div class="operation">
						<button type="button" class="but2font" onClick="addLanguage('<!--{$returnParams}-->')">新增</button>
						<button type="button" class="but2font" onClick="batchOperate('index.php?r=Music.deletelanguage&returnParams=<!--{$returnParams}-->', 'recordId', 'ids', '确定删除？')">删除</button>
					</div>
					<div class="page"><!--{$pager}--></div>
				</div>
			</div>
		</div>
	</div>
</div>
</body>
<script>
function addLanguage(returnParams){
	var str = "<form id=\"addForm\" action=\"index.php?r=Music.addlanguage\" method=\"post\">";
	str += "<input type=\"hidden\" name=\"returnParams\" value=\""+decodeURIComponent(returnParams)+"\"/>";
	str += "<table class=\"tbl_edit\" width=\"100%\"><tr>";
	str += "<td class=\"td_name\">语种<span class=\"red\">*</span></td>";
	str += "<td class=\"td_content\"><input type=\"text\" class=\"text\" id=\"language\" name=\"data[MusicLanguage][language]\" maxlength=\"32\"/><span id=\"span_language\"></span></td>";
	str += "</tr><tr>";
	str += "<td class=\"td_name\">排序<span class=\"red\">*</span></td>";
	str += "<td class=\"td_content\"><input type=\"text\" class=\"text\" id=\"show_order\" name=\"data[MusicLanguage][show_order]\" value=\"999\" maxlength=\"3\"/><span id=\"span_show_order\"></span></td>";
	str += "</tr><tr>";
	str += "<td class=\"noborder\"></td>";
	str += "<td class=\"noborder\"><button type=\"submit\" class=\"butsubmit\">提交</button></td>";
	str += "</tr></table></form>";
	$.popbox({title:"新增语种", content:str});
	$("#addForm").validate({
		rules: {
			"data[MusicLanguage][language]" : {
				"required" : true,
				"remote" : {
					url : "index.php",
					cache : false,
					data : {
						r : "Music.checklanguage",
						language : function(){
							return $("#language").val();
						}
					}
				}
			},
			"data[MusicLanguage][show_order]" :{
				required: true,
				number: true,
				digits: true,
				range: [1, 999]
			}
		},
		messages: {
			"data[MusicLanguage][language]" : {
				"required" : "语种不能为空",
				"remote" : "语种不能重复"
			},
			"data[MusicLanguage][show_order]" :{
				required: "排序不能为空",
				number: "排序必须为正整数",
				digits: "排序必须为正整数",
				range: $.format("排序必须在{0}到{1}之间")
			}
		},
		errorPlacement: function(error, element){
			$("#span_" + element.attr("id")).html(error).attr("class", "error");
		},
		submitHandler: function(form){
			setDisabled(":button", window.document);
			form.submit();
		},
		errorClass: "invalid",
		success: function(label){
			label.parent().html("&nbsp;").attr("class", "valid");
		}
	});
}

function editLanguage(id, returnParams){
	$.popbox({title:"修改语种", content:popstr_search});
	$.ajax({
		url: "index.php?r=Music.editlanguage&id="+id,
		type: "get",
		data:{returnParams:returnParams},
		cache: false,
		dataType: "text",
		success: function(str){
			$.popbox.setcontent({title:"修改语种", content:str});
		}
	});
}
</script>
</html>