{include file="header.tpl" page_name=$page_name sys_name=$sys_name}
<div align="center">
{$admin_nav}
	{if $do == 'list'}
		{literal}
			<script type="text/javascript">
				$(document).ready(function(){
					$("input[type=checkbox]").css("cursor", "pointer");
					$("#frm_navigation").submit(function(){
						var flg = true;
						$(".checkbox_val").each(function(){
							if($(this).attr("checked") == "checked" || $(this).attr("checked")){
								flg = false;
							}
						});
						if(flg){
							alert("请您选择要操作的项");
							return false;
						}
						return true;
					});
				});
				function checkedall(self){
					$(".checkbox_val").attr("checked", $(self).attr("checked"));
				}
			</script>
		{/literal}
		<form action="?action=navigation&do=deleteall" method="post" id="frm_navigation">
			<table width="98%" border="0" cellpadding="0" cellspacing="0" class="tableborder tableborder_line">
				<tr class="header" style="background-color: rgb(255, 255, 255); cursor: default;">
					<td align="center" style="text-algin:center">全选
					<input type="checkbox" onclick="checkedall(this)"  class="checkbox" />
					</td>
					<td>导航名称</td>
					<td>顺序</td>
					<td>链接地址</td>
					<td>显示位置</td>
					<td>是否打开新窗口</td>
					<td>是否显示</td>
					<td>操作</td>
				</tr>
				{if $navigation}
					{foreach from=$navigation item=nav }
						<tr>
							<td>
								<input type="checkbox" class="checkbox checkbox_val" name="navids[]" value="{$nav.nav_id}" />
							</td>
							<td>{$nav.nav_name}</td>
							<td>{$nav.nav_sort}</td>
							<td>{$nav.nav_link}</td>
							<td align="center">{if $nav.nav_position == 'top'}顶部{elseif $nav.nav_position == 'center'}中间{else}底部{/if}</td>
							<td>{if $nav.nav_blank == '_blank'}是{else}否{/if}</td>
							<td>{if $nav.nav_display == '1' }是{else}否{/if}</td>
							<td>
								<a href="?action=navigation&do=edit&id={$nav.nav_id}">修改<a>
								|
								<a href="?action=navigation&do=delete&id={$nav.nav_id}">删除</a>
							</td>
						</tr>
					{/foreach}
					<tr>
						<td colspan="10" >
                        {literal}
                        	<script type="text/javascript">
                            	function go_to(string){
									window.location.href='?action=navigation&do=list&opt='+string;
								}
                            </script>
                        {/literal}
							<input type="submit" value="批量删除" /> <input type="button" onclick="go_to('center');" value="中间" /> <input type="button" onclick="go_to('bottom');" value="底部" /> <input type="button" onclick="go_to('top');" value="顶部" /> <input type="button" value="全部"  onclick="go_to('all');"/>
						</td>
					</tr>
				{else}
					<tr>
						<td colspan="10" >
						<font color="red">暂无数据。</font>
						</td>
					</tr>
				{/if}
			</table>
		</form>
	{else}
		{literal}
			<script type="text/javascript">
				$(document).ready(function(){
					$("#frm_navigation").submit(function(){
						var flg = true;
						$(".must_in").each(function(){
							if($.trim($(this).val()) == ""){
								flg = false;
							}
						});
						if(!flg){
							alert("请把信息填写完整");
							return false;
						}
						return true;
					});
				});
			</script>
		{/literal}
		<form id="frm_navigation" action="?action=navigation&do=oper" method="post" autocomplete="off">
			<table width="98%" border="0" cellpadding="0" cellspacing="0" class="tableborder">
				<tr>
					<td class="one">连接名称：</td>
					<td>
						<input type="text" name="name" class="must_in" value="{$nav.nav_name}" size="50" maxlength="50" /> <span>*</span>
					</td>
				</tr>
				<tr>
					<td class="one">链接地址：</td>
					<td>
						<input type="text" name="link" class="must_in" value="{if $nav.nav_link}{$nav.nav_link}{else}#{/if}" size="50" maxlength="255" /><span class="red">*</span>
					</td>
				</tr>
				<tr>
					<td class="one">显示顺序：</td>
					<td>
						<input type="text" name="sort" size="50" value="{$nav.nav_sort}" maxlength="5" onkeyup="this.value=this.value.replace(/\D/g,'')" onafterpaste="this.value=this.value.replace(/\D/g,'')"/>
					</td>
				</tr>
				<tr>
					<td class="one">显示位置：</td>
					<td>
						<select name="position" style="width:280px">
							<option value="top" {if $nav.nav_position == 'top'}selected="selected"{/if}>顶部</option>
							<option value="center" {if $nav.nav_position == 'center'}selected="selected"{/if}>中间</option>
							<option value="bottom" {if $nav.nav_position == 'bottom'}selected="selected"{/if}>底部</option>
						</select>
					</td>
				</tr>
				<tr>
					<td class="one">是否新窗口：</td>
					<td>
						<input type="radio" name="target" {if $nav.nav_blank == '_self'}checked="checked"{/if} class="radio" value="_self" />否&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
						<input type="radio" name="target" {if $nav.nav_blank != '_self'}checked="checked"{/if} class="radio" value="_blank" />是
					</td>
				</tr>
				<tr>
					<td class="one">是否显示：</td>
					<td>
						<input type="radio" name="display" {if $nav.nav_display == '0'}checked="checked"{/if} class="radio" value="0" />否&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
						<input type="radio" name="display" {if $nav.nav_display != '0'}checked="checked"{/if} class="radio" value="1" />是
					</td>
				</tr>
				<tr>
					<td colspan="2">
						<div align="center" style="width:100%">
						<input type="submit" value="提 交" /> <input type="button" onclick="window.location.href='?action=navigation&do=list'" value="返回" />
						</div>
					</td>
				</tr>
			</table>
			<input type="hidden" value="{$nav.nav_id}" name="id" />
		</form>
	{/if}
</div>
{include file="footer.tpl"}