{include file="$admin_template_path/html/header.html"}
</head>
<body>
{include file="$admin_template_path/html/pagetops.html"}
{if $errorMessage}
<div id="errormsg">
<div class="msg">
  <div class="closebtn"><i data-icon="" class="icon-close"></i></div>
  {$errorMessage}
</div>
</div>
{literal}
<script type="text/javascript">
seajs.use(["modules/pageui/msg"], function(msg){
    msg.msginit("#errormsg");
});
</script>
{/literal}
{/if}

<div class="pagebg">
	<div class="mcontent pagemain clr">
	    {include file="$admin_template_path/html/leftmenu.html"}
	    <div class="pagemainconent headtools{if $paging !=""} paging{/if}">

		<div class="headtool b-b clr">
			<div class="toolsearch clr rf">
				<form class="sort-control" method="post" action="?m={$smarty.get.m}&c={$smarty.get.c}">
					<button type="submit" class="btntheme btnsize rf">搜索</button>
					<input class="ipttheme rf" type="text" id="q" name="q" placeholder="开始搜索...">
				</form>
			</div>
		</div>
		{if $paging !=""}
		<div class="page-controls">
			{$paging}
		</div>
		{/if}
		<div class="rightdetail_admin">
			{if is_array($data)}
			<div class="general_table_border">
				<table id="itemlist" class="general_table" cellspacing="0" cellpadding="0" border="0">
					<thead>
						<tr>
							<th><a href="?m={$smarty.get.m}&c={$smarty.get.c}&p={$smarty.get.p}&q={$smarty.get.q}&order=name&dir={$orderDir}&user={$smarty.get.user}" title="">作品名称</a></th>
							<th>作者</th>
							<th><a href="?m={$smarty.get.m}&c={$smarty.get.c}&p={$smarty.get.p}&q={$smarty.get.q}&order=price&dir={$orderDir}&user={$smarty.get.user}" title="">售价</a></th>
							<th><a href="?m={$smarty.get.m}&c={$smarty.get.c}&p={$smarty.get.p}&q={$smarty.get.q}&order=sales&dir={$orderDir}&user={$smarty.get.user}" title="">销量</a></th>
							<th><a href="?m={$smarty.get.m}&c={$smarty.get.c}&p={$smarty.get.p}&q={$smarty.get.q}&order=earning&dir={$orderDir}&user={$smarty.get.user}" title="">收入</a></th>		
							<th><a href="?m={$smarty.get.m}&c={$smarty.get.c}&p={$smarty.get.p}&q={$smarty.get.q}&order=freefile&dir={$orderDir}&user={$smarty.get.user}" title="">可否免费</a></th>
							<th><a href="?m={$smarty.get.m}&c={$smarty.get.c}&p={$smarty.get.p}&q={$smarty.get.q}&order=weekly&dir={$orderDir}&user={$smarty.get.user}" title="">是否推荐</a></th>				
							<th width="250">操作</th>
						</tr>
					</thead>

					<tbody>
					{foreach from=$data item=d}
						<tr id="row{$d.id}" class="{cycle values="no,alt"}">
							<td>{$d.name}</td>
							<td>{$users[$d.user_id].username}</td>
							<td>{$currency.symbol}{$d.price|string_format:"%.0f"}</td>
							<td>{$d.sales}</td>
							<td>{$currency.symbol}{$d.earning|string_format:"%.0f"}</td>
							<td id="status_pic">
								
								{if $d.free_request == 'true'}
									{if $d.free_file == 'true'}
									    <img class="statusbtn" id="status_pic_{$d.id}" status="{$d.free_file}" item="{$d.id}" src="{$template_data}admin/images/icons/24x24/accept.png" style="cursor:pointer"/>
									{else}
										<img class="statusbtn" id="status_pic_{$d.id}" status="{$d.free_file}" item="{$d.id}" src="{$template_data}img/question.png" style="cursor:pointer"/>
									{/if}
									<img src='{$template_data}img/loading.gif' class="status_pic_{$d.id}" style="display:none"/>
								{else}
								    <img src="{$template_data}/admin/images/icons/24x24/delete.png"/>
								{/if}
							</td>
							<td>
								{if $d.weekly_to == ''}
									<img src="{$template_data}/admin/images/icons/24x24/delete.png">
								{else}
									<img src="{$template_data}/admin/images/icons/24x24/accept.png">
								{/if}
							</td>
							<td>
								<a href="?m={$smarty.get.m}&c=comments&id={$d.id}" title="{$lang.comments}"><img class="middle" src="{$template_data}admin/images/icons/16x16/icon-comments.png" /> {$d.comments} {$lang.comments} </a>
								<a href="?m={$smarty.get.m}&c=edit&id={$d.id}&p={$smarty.get.p}" title="编辑"><i class="fa fa-edit text-success m-r-xs"></i> 编辑作品</a>
								<a class="deletebtn" ajax-url="/apps/{$smarty.get.m}/ajax/delete.php" item-id="{$d.id}" href="javascript:void(0);" title="删除"><i class="fa fa-trash-o text-danger m-r-xs"></i> 删除作品</a>
							</td>
						</tr>
						{/foreach}
					</tbody>
				</table>
			</div>
			{literal}
			<script type="text/javascript">
			seajs.use(["modules/ajax/btns"], function(aj){
			  aj.deletebtninit("#itemlist .deletebtn", "ajax-url", "item-id", {'delete':true,'id':''}, "deleteRow");
			});
			</script>
			{/literal}
			{else}
				暂无记录
			{/if}
		</div>

		</div>
	</div>
</div>
<script>
{literal}
seajs.use(["modules/pageui/admin"], function(adm){
	adm.cheange_status("#status_pic .statusbtn", "/{/literal}{$languageURL}{literal}admin/?m=items&c=list");
});
{/literal}
</script>
</body>
</html>