<!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="link">语种</a>
				<a href="index.php?r=Music.singerarealist" class="link">地区</a>
				<a href="index.php?r=Music.singerlist" class="nolink">歌手</a>
				<a href="index.php?r=Music.albumlist" class="link">专辑</a>
			</div>
			<div id="secrightContent">
				<div class="tableContent2">
					<div style="display:none">
						<select id="slc_area">
							<option value="">请选择地区</option>
							<!--{foreach from=$area item=item}-->
								<option value="<!--{$item.id}-->"><!--{$item.area}--></option>
							<!--{/foreach}-->
						</select>
					</div>
					<form name="searchForm" action="index.php" method="get" onSubmit="setDisabled('button', window.document);">
						<input type="hidden" name="r" value="Music.singerlist"/>
						<input type="hidden" id="singer_area_id" name="singer_area_id" value="<!--{$singer_area_id}-->"/>
						<input type="hidden" id="singer_type" name="singer_type" value="<!--{$singer_type}-->"/>
						<div class="searchbar">
							歌手姓名&nbsp;<input type="text" class="text" name="singer_name" value="<!--{$singer_name}-->"/>
							&nbsp;<button type="submit" class="but2font">查询</button>
						</div>
					</form>
					<div class="operation">
						<button type="button" class="but2font" onClick="addSinger('<!--{$returnParams}-->')">新增</button>
						<button type="button" class="but2font" onClick="batchOperate('index.php?r=Music.deletesinger&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="35%">歌手姓名</td>
							<td width="20%"><select onChange="$('#singer_area_id').val(this.value);document.forms['searchForm'].submit();">
								<option value="">地区</option>
								<!--{foreach from=$area item=item}-->
								<option value="<!--{$item.id}-->" <!--{if $item.id eq $singer_area_id}-->selected<!--{/if}-->><!--{$item.area}--></option>
								<!--{/foreach}-->
							</select></td>
							<td width="20%"><select onChange="$('#singer_type').val(this.value);document.forms['searchForm'].submit();">
								<option value="">类型</option>
								<option value="1" <!--{if $singer_type eq 1}-->selected<!--{/if}-->>男歌手</option>
								<option value="2" <!--{if $singer_type eq 2}-->selected<!--{/if}-->>女歌手</option>
								<option value="3" <!--{if $singer_type eq 3}-->selected<!--{/if}-->>组合</option>
							</select></td>
							<td width="20%">操作</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.singer_name}--></td>
							<td><!--{$item.singer_area}--></td>
							<td><!--{if $item.singer_type eq 1}-->男歌手<!--{elseif $item.singer_type eq 2}-->女歌手<!--{elseif $item.singer_type eq 3}-->组合<!--{/if}--></td>
							<td><a href="javascript:editSinger('<!--{$item.id}-->', '<!--{$returnParams}-->')">修改</a></td>
						</tr>
						<!--{foreachelse}-->
						<tr><td colspan="5">没有对应数据</td></tr>
						<!--{/foreach}-->
					</table>
					<div class="operation">
						<button type="button" class="but2font" onClick="addSinger('<!--{$returnParams}-->')">新增</button>
						<button type="button" class="but2font" onClick="batchOperate('index.php?r=Music.deletesinger&returnParams=<!--{$returnParams}-->', 'recordId', 'ids', '确定删除？')">删除</button>
					</div>
					<div class="page"><!--{$pager}--></div>
				</div>
			</div>
		</div>
	</div>
</div>
</body>
<script>
function addSinger(returnParams){
	var str = "<form id=\"singerForm\" action=\"index.php?r=Music.addsinger\" 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=\"singer_name\" name=\"data[MusicSinger][singer_name]\" maxlength=\"32\"/><span id=\"span_singer_name\"></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\" maxlength=\"1\" id=\"first_character\" name=\"data[MusicSinger][first_character]\" maxlength=\"1\"/><span id=\"span_first_character\"></span></td>";
	str += "</tr><tr>";
	str += "<td class=\"td_name\">地区<span class=\"red\">*</span></td>";
	str += "<td class=\"td_content\"><select id=\"slc_singer_area_id\" name=\"data[MusicSinger][singer_area_id]\">"+$("#slc_area").html()+"</select><span id=\"span_slc_singer_area_id\"></span><input type=\"hidden\" id=\"singer_area\" name=\"data[MusicSinger][singer_area]\"/></td>";
	str += "</tr><tr>";
	str += "<td class=\"td_name\">类型</td>";
	str += "<td class=\"td_content\"><select name=\"data[MusicSinger][singer_type]\"><option value=\"1\">男歌手</option><option value=\"2\">女歌手</option><option value=\"3\">组合</option></select></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, height:220});
	singerValid();
}

function singerValid(){
	$("#slc_singer_area_id").change(function(){
		$("#singer_area").val($("#slc_singer_area_id option:selected").html());
	});
	$("#singerForm").validate({
		rules: {
			"data[MusicSinger][singer_name]" : "required",
			"data[MusicSinger][first_character]" : "required",
			"data[MusicSinger][singer_area_id]" : "required"
		},
		messages: {
			"data[MusicSinger][singer_name]" : "歌手姓名不能为空",
			"data[MusicSinger][first_character]" : "歌手首字母不能为空",
			"data[MusicSinger][singer_area_id]" : "地区不能为空"
		},
		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 editSinger(id, returnParams){
	$.popbox({title:"修改歌手", content:popstr_search, height:220});
	$.ajax({
		url: "index.php?r=Music.editsinger&id="+id,
		type: "get",
		data:{returnParams:returnParams},
		cache: false,
		dataType: "text",
		success: function(str){
			$.popbox.setcontent({title:"修改歌手", content:str, height:220});
		}
	});
}
</script>
</html>